lokedhs / gnu-apl-mode

GNU APL mode for Emacs
GNU General Public License v3.0
94 stars 18 forks source link

Bug/inconsistency: M-. to edit function not tracked to the source files #19

Closed fourier closed 7 years ago

fourier commented 7 years ago

Right now M-.allows to jump/edit the function which is defined in some source file. However if the function just has been created in the interpreter session it is impossible to edit it using M-.from the interpreter session. One can type C-c C-f and type a function name to edit it. It could be great to point to the function and type M-. as well in the interpreter session to edit functions instead of manually type their name with C-c C-f.

lokedhs commented 7 years ago

I'm not sure that is useful, at least not as default behaviour. Navigating to source using M-. and editing a function using C-c C-f are very different activities, and they should be invoked using different commands.

However, implementing your requested functionality is pretty easy, and can be done without changes to gnu-apl-mode. Instead of gnu-apl-find-function-at-point, use this function:

(defun gnu-apl-find-function-at-point-or-open-editor ()
  (interactive)
  (let* ((name (gnu-apl--name-at-point))
         (buffer (current-buffer)))
    (gnu-apl-find-function-at-point)
    (when (eq buffer (current-buffer))
      (gnu-apl-edit-function name))))
fourier commented 7 years ago

Thanks, works for me.