Skip to content

Commit

Permalink
Implement phpactor-action-collection and phpactor-action-close-file
Browse files Browse the repository at this point in the history
resolves emacs-php#36 (class renaming now works)
  • Loading branch information
kermorgant committed Jul 29, 2018
1 parent 17819d6 commit aca70a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
(let ((use-dialog-box nil)
(type (if type (intern type) value-type)))
(cl-case type
(confirm (read-string label default))
(file (read-file-name label nil default))
(text (read-string label default))
(choice (completing-read label
Expand Down Expand Up @@ -257,6 +258,14 @@
(view-mode 1))
(pop-to-buffer buffer)))

(cl-defun phpactor-action-collection (&key actions)
"WIP: Executes a collection of actions."
(mapc
(lambda (action)
(apply #'phpactor-action-dispatch (list :action (plist-get action :name) :parameters (plist-get action :parameters)))
)
actions))

(cl-defun phpactor-action-open-file (&key path offset)
"Open file from Phpactor."
(unless (and path offset)
Expand All @@ -270,6 +279,10 @@
(find-file path)
(goto-char (1+ offset)))

(cl-defun phpactor-action-close-file (&key path)
"Close file from Phpactor."
(kill-buffer (find-file-noselect path t)))

;; this function was adapted from go-mode
(defun phpactor--goto-line (line)
"Goto line LINE."
Expand Down

0 comments on commit aca70a1

Please sign in to comment.