From 0f77cab1b303bd23e84a48952834d7d607c089bd Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 6 Sep 2022 11:21:51 +1000 Subject: Adding hcel minor mode and find references in outline mode --- lisp/hcel-outline.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lisp/hcel-outline.el') diff --git a/lisp/hcel-outline.el b/lisp/hcel-outline.el index b55c2b5..3732ed2 100644 --- a/lisp/hcel-outline.el +++ b/lisp/hcel-outline.el @@ -31,12 +31,12 @@ (switch-to-buffer (get-buffer-create hcel-outline-buffer-name)) (save-excursion (mapc - (lambda (package) + (lambda (package-id) (insert (concat (propertize - (hcel-format-package-id package) + (hcel-format-package-id package-id) 'thing 'package - 'package package + 'package-id package-id 'children-loaded nil) "\n"))) (hcel-api-packages))) @@ -45,22 +45,22 @@ (define-key hcel-mode-map "o" 'hcel) ;; TODO: maybe remove -(defun hcel-outline-update-opened (package module-path) +(defun hcel-outline-update-opened (package-id module-path) "Update the outline tree depending on openness of packages and modules. If a package is opened outside of the outline mode (mainly source mode), then update in the outline mode too." (with-current-buffer hcel-outline-buffer-name (save-excursion - (hcel-outline-goto-package package) + (hcel-outline-goto-package package-id) (hcel-outline-load-modules-at-point) (hcel-outline-goto-module module-path) (hcel-outline-load-identifiers-at-point)))) -(defun hcel-outline-goto-package (package) +(defun hcel-outline-goto-package (package-id) (goto-char (point-min)) (re-search-forward - (format "^%s$" (hcel-format-package-id package))) + (format "^%s$" (hcel-format-package-id package-id))) (beginning-of-line)) (defun hcel-outline-goto-module (module-path) @@ -80,7 +80,7 @@ update in the outline mode too." (unless (get-text-property (point) 'children-loaded) (save-excursion (let ((inhibit-read-only t) - (package (get-text-property (point) 'package))) + (package-id (get-text-property (point) 'package-id))) (put-text-property (progn (beginning-of-line) (point)) (progn (end-of-line) (point)) @@ -92,10 +92,10 @@ update in the outline mode too." (propertize (concat (make-string hcel-outline-indentation 32) module "\n") 'thing 'module - 'package package + 'package-id package-id 'module-path module 'folded t))) - (hcel-api-package-info package)))))) + (hcel-api-package-info package-id)))))) (defun hcel-outline-toggle-children () (interactive) @@ -113,7 +113,7 @@ update in the outline mode too." (unless (get-text-property (point) 'children-loaded) (save-excursion (let* ((inhibit-read-only t) - (package-id (get-text-property (point) 'package)) + (package-id (get-text-property (point) 'package-id)) (module-path (get-text-property (point) 'module-path)) (imenu-index)) (put-text-property @@ -134,7 +134,7 @@ update in the outline mode too." (car pair) "\n") 'thing 'identifier - 'package package-id + 'package-id package-id 'module-path module-path 'position (cdr pair)))) imenu-index)))))) @@ -146,7 +146,7 @@ update in the outline mode too." (error "Point is not at a module!")) (let ((buffer (hcel-load-module-source - (plist-get props 'package) + (plist-get props 'package-id) (plist-get props 'module-path)))) (hcel-outline-load-identifiers-at-point) (if other-window @@ -160,7 +160,7 @@ update in the outline mode too." (error "Point is not at an identifier!")) (let ((buffer (hcel-load-module-source - (plist-get props 'package) + (plist-get props 'package-id) (plist-get props 'module-path)))) (if other-window (switch-to-buffer-other-window buffer) -- cgit v1.2.3