aboutsummaryrefslogtreecommitdiff
path: root/hcel-outline.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-09-21 12:52:31 +1000
committerYuchen Pei <hi@ypei.me>2022-09-21 12:53:21 +1000
commit1b0817abd54e4ff050240bee47b28e66e843eb66 (patch)
treebbcc42d8e14d2fbe2cb268e3b64b77a01c64c1ca /hcel-outline.el
parent8632869b89a60f4cd0a4d3f0975469512fb76087 (diff)
Patch from Stefan Monnier.
https://lists.gnu.org/archive/html/emacs-devel/2022-09/msg01378.html
Diffstat (limited to 'hcel-outline.el')
-rw-r--r--hcel-outline.el34
1 files changed, 18 insertions, 16 deletions
diff --git a/hcel-outline.el b/hcel-outline.el
index a46db14..78aad54 100644
--- a/hcel-outline.el
+++ b/hcel-outline.el
@@ -17,31 +17,33 @@
;; You should have received a copy of the GNU Affero General Public
;; License along with hcel. If not, see <https://www.gnu.org/licenses/>.
+(require 'hcel-source)
+
(defvar hcel-outline-buffer-name "*hcel-outline*")
(defvar hcel-outline-indentation 2)
(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 "f" 'outline-forward-same-level)
- (define-key kmap "F" 'hcel-outline-follow-mode)
- (define-key kmap "b" 'outline-backward-same-level)
- (define-key kmap "u" 'outline-up-heading)
- (define-key kmap "\t" 'hcel-outline-toggle-children)
- (define-key kmap "\r" 'hcel-outline-open-thing-at-point)
- (define-key kmap "o" 'hcel-outline-open-thing-at-point-other-window)
- (define-key kmap "q" 'quit-window)
+ (define-key kmap "n" #'outline-next-visible-heading)
+ (define-key kmap "p" #'outline-previous-visible-heading)
+ (define-key kmap "f" #'outline-forward-same-level)
+ (define-key kmap "F" #'hcel-outline-follow-mode)
+ (define-key kmap "b" #'outline-backward-same-level)
+ (define-key kmap "u" #'outline-up-heading)
+ (define-key kmap "\t" #'hcel-outline-toggle-children)
+ (define-key kmap "\r" #'hcel-outline-open-thing-at-point)
+ (define-key kmap "o" #'hcel-outline-open-thing-at-point-other-window)
+ (define-key kmap "q" #'quit-window)
kmap))
(define-derived-mode hcel-outline-mode outline-mode "hcel-outline"
- "Major mode for browsing Haskell codebases"
+ "Major mode for browsing Haskell codebases."
(setq-local package-filter nil
module-filter nil
outline-regexp "\\( *\\)."
outline-level (lambda () (1+ (/ (length (match-string 1))
hcel-outline-indentation)))
- buffer-read-only t))
-(add-hook 'hcel-outline-mode-hook 'hcel-minor-mode)
+ buffer-read-only t)
+ (hcel-minor-mode 1))
(defun hcel ()
(interactive)
@@ -61,7 +63,7 @@
(hcel-api-packages)))
(hcel-outline-mode))))
-(define-key hcel-mode-map "o" 'hcel)
+(define-key hcel-mode-map "o" #'hcel)
;; TODO: maybe remove
(defun hcel-outline-update-opened (package-id module-path)
@@ -208,8 +210,8 @@ update in the outline mode too."
(if (not (eq major-mode 'hcel-outline-mode))
(error "Not in hcel-outline mode!")
(add-hook 'post-command-hook
- 'hcel-outline-open-thing-at-point-other-window nil t))
+ #'hcel-outline-open-thing-at-point-other-window nil t))
(remove-hook 'post-command-hook
- 'hcel-outline-open-thing-at-point-other-window t)))
+ #'hcel-outline-open-thing-at-point-other-window t)))
(provide 'hcel-outline)