commit 2f8abc90d27fc371778c72db93242857a5eda711
parent 3744185e7bcec54baf72339850a94178718fda15
Author: Lou Woell <lou.woell@posteo.de>
Date:   Sun, 14 Sep 2025 13:26:25 +0200

[haredoc.el] correctly go up/down namespaces

Diffstat:
Mharedoc.el | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/haredoc.el b/haredoc.el @@ -137,9 +137,10 @@ the results in a new buffer." (path (nth 0 location)) (line (string-to-number (nth 1 location))) (col (string-to-number (nth 2 location))) - (module? (= col line 0)) - (namespace (if module? current-word - (string-join (butlast components) "::"))) + (namespace (if (< 1 (length components)) + (string-join (butlast components) "::") + (car components))) + (module? (= line col 0))) (when haredoc-stack-item (push haredoc-stack-item haredoc-backward-stack) (setq haredoc-forward-stack nil)) @@ -164,17 +165,17 @@ the results in a new buffer." (save-excursion (goto-char (point-min)) (while (re-search-forward "\\[\\[\\(.*?\\)\\]\\]" nil t) - (haredoc/make-button 1 namespace))) + (haredoc/make-button 1 (if module? current-word namespace)))) (save-excursion - (when (or (not module?) haredoc-backward-stack haredoc-forward-stack) + (when (or (< 1 (length components)) haredoc-backward-stack haredoc-forward-stack) (ensure-empty-lines 2) (when haredoc-backward-stack (insert-text-button "[back]" :type 'haredoc-back) - (insert "\t")) - (when (not module?) - (insert-text-button "[module]" :type 'haredoc-module) - (insert "\t")) + (insert " ")) + (when (< 1 (length components)) + (insert-text-button "[up]" :type 'haredoc-module) + (insert " ")) (when haredoc-forward-stack (insert-text-button "[forw]" :type 'haredoc-forw)) (insert "\n")))