From f880c5dac5296c2e31acd218e8ce36284043db26 Mon Sep 17 00:00:00 2001 From: Greg Sexton Date: Sun, 29 Mar 2015 15:14:03 +0100 Subject: [PATCH] Show node when jumping to compile/grep/occur results --- origami.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/origami.el b/origami.el index 36132f9..88fb08f 100644 --- a/origami.el +++ b/origami.el @@ -622,6 +622,9 @@ uncover any bugs." :type 'hook :group 'origami) +(defun origami-find-occurrence-show-node () + (call-interactively 'origami-show-node)) + ;;;###autoload (define-minor-mode origami-mode "Minor mode to selectively hide/show text in the current buffer. @@ -638,6 +641,16 @@ Key bindings: :lighter nil :keymap origami-mode-map :init-value nil + (if origami-mode + (progn + (add-hook 'occur-mode-find-occurrence-hook + 'origami-find-occurrence-show-node nil t) + (setq next-error-move-function (lambda (ignored pos) + (goto-char pos) + (call-interactively 'origami-show-node)))) + (remove-hook 'occur-mode-find-occurrence-hook + 'origami-find-occurrence-show-node t) + (setq next-error-move-function nil)) (origami-reset (current-buffer))) (provide 'origami)