Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement phpactor-action-collection #39

Merged
merged 1 commit into from
Aug 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
(let ((use-dialog-box nil)
(type (if type (intern type) value-type)))
(cl-case type
(confirm (if (y-or-n-p label) t
(error "Action cancelled")))
(file (read-file-name label nil default))
(text (read-string label default))
(choice (completing-read label
Expand Down Expand Up @@ -257,6 +259,13 @@
(view-mode 1))
(pop-to-buffer buffer)))

(cl-defun phpactor-action-collection (&key actions)
"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