aboutsummaryrefslogtreecommitdiff
path: root/hcel-outline.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-28 15:27:55 +1000
committerYuchen Pei <hi@ypei.me>2022-09-28 15:27:55 +1000
commit3cd88744e08431268052eeab5f0c8f53439eee17 (patch)
tree7118f59221f5bbfc076f16706fa2a61180c0385b /hcel-outline.el
parentabb88a89b50b241a4492114c6fbce364af56f48e (diff)
allow toggle display of exported ids in hcel-outline mode
Diffstat (limited to 'hcel-outline.el')
-rw-r--r--hcel-outline.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/hcel-outline.el b/hcel-outline.el
index a192e07..ea8f919 100644
--- a/hcel-outline.el
+++ b/hcel-outline.el
@@ -27,8 +27,8 @@
(defvar hcel-outline-mode-map
(let ((kmap (make-sparse-keymap)))
- (define-key kmap "n" #'outline-next-visible-heading)
- (define-key kmap "p" #'outline-previous-visible-heading)
+ (define-key kmap "n" #'next-logical-line)
+ (define-key kmap "p" #'previous-logical-line)
(define-key kmap "f" #'outline-forward-same-level)
(define-key kmap "F" #'hcel-outline-follow-mode)
(define-key kmap "b" #'outline-backward-same-level)
@@ -140,6 +140,12 @@ update in the outline mode too."
((eq thing 'module) (hcel-outline-load-identifiers-at-point))
(t nil))))
+(defun hcel-outline-toggle-exported ()
+ (interactive)
+ (if (memq 'hcel-unexported buffer-invisibility-spec)
+ (remove-from-invisibility-spec 'hcel-unexported)
+ (add-to-invisibility-spec 'hcel-unexported)))
+
(defun hcel-outline-load-identifiers-at-point ()
(interactive)
(unless (eq (get-text-property (point) 'thing) 'module)
@@ -158,7 +164,9 @@ update in the outline mode too."
(y-or-n-p "Open module source?"))
(with-current-buffer
(hcel-load-module-source package-id module-path)
- (setq imenu-index (save-excursion (hcel-imenu-create-index))))
+ (setq imenu-index
+ (save-excursion
+ (hcel-imenu-create-index))))
(beginning-of-line 2)
(mapc
(lambda (pair)
@@ -170,7 +178,10 @@ update in the outline mode too."
'thing 'identifier
'package-id package-id
'module-path module-path
- 'position (cdr pair))))
+ 'position (cdr pair)
+ 'invisible (unless
+ (get-text-property 1 'exported (car pair))
+ 'hcel-unexported))))
imenu-index))))))
(defun hcel-outline-open-module-source-at-point (&optional other-window)