Skip to content

Commit

Permalink
elisp/guile: Fix finding the current definition
Browse files Browse the repository at this point in the history
Reported by Pierre Neidhardt:
<#24>.  Well, it was not really
the issue but it is better to define the definition from its start
position, anyway.

* elisp/guix-guile.el (guix-guile-current-definition): Define the
current definition properly when the point is in the beginning of it.
  • Loading branch information
alezost committed May 19, 2018
1 parent 7456bf2 commit 4d2874b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion elisp/guix-guile.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@
(defun guix-guile-current-definition ()
"Return string with name of the current top-level guile definition."
(save-excursion
;; If the point is in the beginning of the current definition,
;; `beginning-of-defun' will move it to the previous one, so we
;; narrow to the definition at first (there is also a commentary
;; about this problem in `narrow-to-defun').
(narrow-to-defun)
(beginning-of-defun)
(if (looking-at guix-guile-definition-regexp)
(match-string-no-properties 1)
(progn
(widen)
(match-string-no-properties 1))
(widen)
(error "Couldn't find the current definition"))))

(defun guix-guile-current-module ()
Expand Down

0 comments on commit 4d2874b

Please sign in to comment.