emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/imenu.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/imenu.el [lexbind]
Date: Wed, 08 Dec 2004 19:18:20 -0500

Index: emacs/lisp/imenu.el
diff -c emacs/lisp/imenu.el:1.89.2.8 emacs/lisp/imenu.el:1.89.2.9
*** emacs/lisp/imenu.el:1.89.2.8        Fri Nov 12 04:21:13 2004
--- emacs/lisp/imenu.el Wed Dec  8 23:36:20 2004
***************
*** 62,69 ****
  
  ;;; Code:
  
- (require 'newcomment)
- 
  (eval-when-compile (require 'cl))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- 62,67 ----
***************
*** 745,752 ****
  ;;;###autoload
  (make-variable-buffer-local 'imenu-case-fold-search)
  
! ;; Originally "Built on some ideas that Erik Naggum <address@hidden>
! ;; once posted to comp.emacs" but since substantially re-written.
  (defun imenu--generic-function (patterns)
    "Return an index of the current buffer as an alist.
  
--- 743,750 ----
  ;;;###autoload
  (make-variable-buffer-local 'imenu-case-fold-search)
  
! ;; This function can be called with quitting disabled,
! ;; so it needs to be careful never to loop!
  (defun imenu--generic-function (patterns)
    "Return an index of the current buffer as an alist.
  
***************
*** 800,805 ****
--- 798,804 ----
      (unwind-protect                   ; for syntax table
        (save-match-data
          (set-syntax-table table)
+ 
          ;; map over the elements of imenu-generic-expression
          ;; (typically functions, variables ...)
          (dolist (pat patterns)
***************
*** 808,843 ****
                  (index (nth 2 pat))
                  (function (nth 3 pat))
                  (rest (nthcdr 4 pat))
!                 cs)
              ;; Go backwards for convenience of adding items in order.
              (goto-char (point-max))
!             (while (re-search-backward regexp nil t)
                (goto-char (match-end index))
                (setq beg (match-beginning index))
!               (if (setq cs (save-match-data (comment-beginning)))
!                   (goto-char cs)      ; skip this one, it's in a comment
!                 (goto-char beg)
!                 (imenu-progress-message prev-pos nil t)
!                 ;; Add this sort of submenu only when we've found an
!                 ;; item for it, avoiding empty, duff menus.
!                 (unless (assoc menu-title index-alist)
!                   (push (list menu-title) index-alist))
!                 (if imenu-use-markers
!                     (setq beg (copy-marker beg)))
!                 (let ((item
!                        (if function
!                            (nconc (list (match-string-no-properties index)
!                                         beg function)
!                                   rest)
!                          (cons (match-string-no-properties index)
!                                beg)))
!                       ;; This is the desired submenu,
!                       ;; starting with its title (or nil).
!                       (menu (assoc menu-title index-alist)))
!                   ;; Insert the item unless it is already present.
!                   (unless (member item (cdr menu))
!                     (setcdr menu
!                             (cons item (cdr menu)))))))))
          (set-syntax-table old-table)))
      (imenu-progress-message prev-pos 100 t)
      ;; Sort each submenu by position.
--- 807,848 ----
                  (index (nth 2 pat))
                  (function (nth 3 pat))
                  (rest (nthcdr 4 pat))
!                 start)
              ;; Go backwards for convenience of adding items in order.
              (goto-char (point-max))
!             (while (and (re-search-backward regexp nil t)
!                         ;; Exit the loop if we get an empty match,
!                         ;; because it means a bad regexp was specified.
!                         (not (= (match-beginning 0) (match-end 0))))
!               (setq start (point))
                (goto-char (match-end index))
                (setq beg (match-beginning index))
!               (goto-char beg)
!               (imenu-progress-message prev-pos nil t)
!               ;; Add this sort of submenu only when we've found an
!               ;; item for it, avoiding empty, duff menus.
!               (unless (assoc menu-title index-alist)
!                 (push (list menu-title) index-alist))
!               (if imenu-use-markers
!                   (setq beg (copy-marker beg)))
!               (let ((item
!                      (if function
!                          (nconc (list (match-string-no-properties index)
!                                       beg function)
!                                 rest)
!                        (cons (match-string-no-properties index)
!                              beg)))
!                     ;; This is the desired submenu,
!                     ;; starting with its title (or nil).
!                     (menu (assoc menu-title index-alist)))
!                 ;; Insert the item unless it is already present.
!                 (unless (member item (cdr menu))
!                   (setcdr menu
!                           (cons item (cdr menu)))))
!               ;; Move to the start of the entire match,
!               ;; to ensure we keep moving backwards
!               ;; as long as the match is nonempty.
!               (goto-char start))))
          (set-syntax-table old-table)))
      (imenu-progress-message prev-pos 100 t)
      ;; Sort each submenu by position.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]