Skip to content

Commit 09dba9c

Browse files
authored
Merge pull request #39 from kermorgant/phpactor-action-collection
Implement phpactor-action-collection
2 parents c5328bb + c2f4c3d commit 09dba9c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

phpactor.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@
177177
(let ((use-dialog-box nil)
178178
(type (if type (intern type) value-type)))
179179
(cl-case type
180+
(confirm (if (y-or-n-p label) t
181+
(error "Action cancelled")))
180182
(file (read-file-name label nil default))
181183
(text (read-string label default))
182184
(choice (completing-read label
@@ -257,6 +259,13 @@
257259
(view-mode 1))
258260
(pop-to-buffer buffer)))
259261

262+
(cl-defun phpactor-action-collection (&key actions)
263+
"Executes a collection of actions."
264+
(mapc
265+
(lambda (action)
266+
(apply #'phpactor-action-dispatch (list :action (plist-get action :name) :parameters (plist-get action :parameters))))
267+
actions))
268+
260269
(cl-defun phpactor-action-open-file (&key path offset)
261270
"Open file from Phpactor."
262271
(unless (and path offset)
@@ -270,6 +279,10 @@
270279
(find-file path)
271280
(goto-char (1+ offset)))
272281

282+
(cl-defun phpactor-action-close-file (&key path)
283+
"Close file from Phpactor."
284+
(kill-buffer (find-file-noselect path t)))
285+
273286
;; this function was adapted from go-mode
274287
(defun phpactor--goto-line (line)
275288
"Goto line LINE."

0 commit comments

Comments
 (0)