commit 303ce7826657f2cf3b185eac8c734dd355890aae
parent 2f8abc90d27fc371778c72db93242857a5eda711
Author: Lou Woell <lou.woell@posteo.de>
Date: Sun, 14 Sep 2025 13:45:42 +0200
[haredoc.el] fix goto-src
Diffstat:
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/haredoc.el b/haredoc.el
@@ -104,10 +104,12 @@
(put 'haredoc-forward-stack 'permanent-local t)
(defvar-local haredoc-stack-item nil)
(put 'haredoc-stack-item 'permanent-local t)
+(defvar-local haredoc-current-ns nil)
+(put 'haredoc-current-ns 'permanent-local t)
(defvar-local haredoc-current-path nil)
(put 'haredoc-current-path 'permanent-local t)
-(defvar-local haredoc-namespace nil)
-(put 'haredoc-namespace 'permanent-local t)
+(defvar-local haredoc-parent-ns nil)
+(put 'haredoc-parent-ns 'permanent-local t)
(defun haredoc/back (&optional args)
(interactive)
@@ -137,7 +139,7 @@ the results in a new buffer."
(path (nth 0 location))
(line (string-to-number (nth 1 location)))
(col (string-to-number (nth 2 location)))
- (namespace (if (< 1 (length components))
+ (namespace (if (length> components 1)
(string-join (butlast components) "::")
(car components)))
(module? (= line col 0)))
@@ -150,8 +152,9 @@ the results in a new buffer."
(inhibit-read-only t))
(with-current-buffer buffer
(erase-buffer)
- (setq haredoc-current-path current-word)
- (setq haredoc-namespace namespace)
+ (setq haredoc-current-path current-word
+ haredoc-current-ns (if module? current-word namespace)
+ haredoc-parent-ns namespace)
(ensure-empty-lines 1)
(with-environment-variables
@@ -168,12 +171,12 @@ the results in a new buffer."
(haredoc/make-button 1 (if module? current-word namespace))))
(save-excursion
- (when (or (< 1 (length components)) haredoc-backward-stack haredoc-forward-stack)
+ (when (or (length> components 1) haredoc-backward-stack haredoc-forward-stack)
(ensure-empty-lines 2)
(when haredoc-backward-stack
(insert-text-button "[back]" :type 'haredoc-back)
(insert " "))
- (when (< 1 (length components))
+ (when (length> components 1)
(insert-text-button "[up]" :type 'haredoc-module)
(insert " "))
(when haredoc-forward-stack
@@ -229,13 +232,13 @@ the results in a new buffer."
(defun haredoc/widen ()
(interactive)
- (haredoc haredoc-namespace))
+ (haredoc haredoc-parent-ns))
(defun haredoc/get-symbol-apt ()
(let ((re (string-join (list haredoc-decl-regex
haredoc-symbol-regex))))
(thing-at-point-looking-at re)
- (string-join (list haredoc-namespace (match-string 2)) "::")))
+ (string-join (list haredoc-current-ns (match-string 2)) "::")))
(defun haredoc/narrow ()
(interactive)