comparison lisp/imenu.el @ 10072:a7b70665c937

(imenu): Widen temporary before scan the file. Widen if the user asks to move to an object that is outside the current accessible region.
author Richard M. Stallman <rms@gnu.org>
date Thu, 24 Nov 1994 11:26:41 +0000
parents 5646f9ac8ec3
children caafb376e619
comparison
equal deleted inserted replaced
10071:1a498b87fdbd 10072:a7b70665c937
45 ;;; Thanks goes to 45 ;;; Thanks goes to
46 ;; [simon] - Simon Leinen simon@lia.di.epfl.ch 46 ;; [simon] - Simon Leinen simon@lia.di.epfl.ch
47 ;; [dean] - Dean Andrews ada@unison.com 47 ;; [dean] - Dean Andrews ada@unison.com
48 ;; [alon] - Alon Albert al@mercury.co.il 48 ;; [alon] - Alon Albert al@mercury.co.il
49 ;; [greg] - Greg Thompson gregt@porsche.visix.COM 49 ;; [greg] - Greg Thompson gregt@porsche.visix.COM
50 ;; [kai] - Kai Grossjohann grossjoh@linus.informatik.uni-dortmund.de
50 51
51 ;;; Code 52 ;;; Code
52 (eval-when-compile (require 'cl)) 53 (eval-when-compile (require 'cl))
53 54
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
472 ;;;###autoload 473 ;;;###autoload
473 (defun imenu () 474 (defun imenu ()
474 "Jump to a place in the buffer chosen using a buffer menu or mouse menu. 475 "Jump to a place in the buffer chosen using a buffer menu or mouse menu.
475 See `imenu-choose-buffer-index' for more information." 476 See `imenu-choose-buffer-index' for more information."
476 (interactive) 477 (interactive)
477 (let ((index-item (imenu-choose-buffer-index))) 478 (let ((index-item (save-restriction
479 (widen)
480 (imenu-choose-buffer-index))))
478 (and index-item 481 (and index-item
479 (progn 482 (progn
480 (push-mark) 483 (push-mark)
481 (cond 484 (cond
482 ((markerp (cdr index-item)) 485 ((markerp (cdr index-item))
486 (if (or ( > (marker-position (cdr index-item)) (point-min))
487 ( < (marker-position (cdr index-item)) (point-max)))
488 ;; widen if outside narrowing
489 (widen))
483 (goto-char (marker-position (cdr index-item)))) 490 (goto-char (marker-position (cdr index-item))))
484 (t 491 (t
492 (if (or ( > (cdr index-item) (point-min))
493 ( < (cdr index-item) (point-max)))
494 ;; widen if outside narrowing
495 (widen))
485 (goto-char (cdr index-item)))))))) 496 (goto-char (cdr index-item))))))))
486
487 497
488 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 498 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
489 ;;;; 499 ;;;;
490 ;;;; Some examples of functions utilizing the framework of this 500 ;;;; Some examples of functions utilizing the framework of this
491 ;;;; package. 501 ;;;; package.