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

add-log-current-defun doesn't work with Go code #253

Open
robert-uhl opened this issue Jul 24, 2018 · 1 comment
Open

add-log-current-defun doesn't work with Go code #253

robert-uhl opened this issue Jul 24, 2018 · 1 comment

Comments

@robert-uhl
Copy link

robert-uhl commented Jul 24, 2018

add-log-current-defun doesn't know how Go code is formatted. Fortunately, there's a variable add-log-current-defun-function, which can be used to integrate with Go mode:

(defun go-current-def-name ()
  "Return the name of the function at point, or nil."
  (save-excursion
    (go-goto-function-name)
    ;; get the next word
    (buffer-substring-no-properties (point)
				    (progn (forward-sexp 1)
					   (point)))))
(add-hook 'go-mode-hook (lambda ()
                          (setq add-log-current-defun-function #'go-current-def-name)))

It'd be great to have this (or something slightly smarter) added to Go mode.

@robert-uhl robert-uhl changed the title magit-log-trace-definition doesn't work with Go code add-log-current-defun doesn't work with Go code Jul 25, 2018
@psanford
Copy link
Collaborator

Interesting. It does look like most progmodes set the add-log-current-defun-function. Are you depending on this behavior for (add-change-log-entry) or for something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants