summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-11-24 11:26:41 +0000
committerRichard M. Stallman <rms@gnu.org>1994-11-24 11:26:41 +0000
commitace1633dd452dc1675986fe9181d1ba4db37649c (patch)
treeb127d29f9104995c7756a0c13009c365aeb57ae4 /lisp/imenu.el
parent5e3882bb12c4b0b61c98ee3d79de0ec3c1717447 (diff)
downloademacs-ace1633dd452dc1675986fe9181d1ba4db37649c.tar.gz
(imenu): Widen temporary before scan the file.
Widen if the user asks to move to an object that is outside the current accessible region.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 80b31229ee4..9721677c7fb 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -47,6 +47,7 @@
;; [dean] - Dean Andrews ada@unison.com
;; [alon] - Alon Albert al@mercury.co.il
;; [greg] - Greg Thompson gregt@porsche.visix.COM
+;; [kai] - Kai Grossjohann grossjoh@linus.informatik.uni-dortmund.de
;;; Code
(eval-when-compile (require 'cl))
@@ -474,17 +475,26 @@ See 'imenu' for more information."
"Jump to a place in the buffer chosen using a buffer menu or mouse menu.
See `imenu-choose-buffer-index' for more information."
(interactive)
- (let ((index-item (imenu-choose-buffer-index)))
+ (let ((index-item (save-restriction
+ (widen)
+ (imenu-choose-buffer-index))))
(and index-item
(progn
(push-mark)
(cond
((markerp (cdr index-item))
+ (if (or ( > (marker-position (cdr index-item)) (point-min))
+ ( < (marker-position (cdr index-item)) (point-max)))
+ ;; widen if outside narrowing
+ (widen))
(goto-char (marker-position (cdr index-item))))
(t
+ (if (or ( > (cdr index-item) (point-min))
+ ( < (cdr index-item) (point-max)))
+ ;; widen if outside narrowing
+ (widen))
(goto-char (cdr index-item))))))))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; Some examples of functions utilizing the framework of this