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: Tue, 14 Oct 2003 19:52:03 -0400

Index: emacs/lisp/imenu.el
diff -c emacs/lisp/imenu.el:1.89.2.1 emacs/lisp/imenu.el:1.89.2.2
*** emacs/lisp/imenu.el:1.89.2.1        Fri Apr  4 01:20:08 2003
--- emacs/lisp/imenu.el Tue Oct 14 19:51:09 2003
***************
*** 1,6 ****
  ;;; imenu.el --- framework for mode-specific buffer indexes
  
! ;; Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  
  ;; Author: Ake Stenhoff <address@hidden>
  ;;         Lars Lindberg <address@hidden>
--- 1,6 ----
  ;;; imenu.el --- framework for mode-specific buffer indexes
  
! ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 2003 Free Software Foundation, 
Inc.
  
  ;; Author: Ake Stenhoff <address@hidden>
  ;;         Lars Lindberg <address@hidden>
***************
*** 527,548 ****
              menulist (delq imenu--rescan-item menulist)))
      (setq tail menulist)
      (dolist (item tail)
!       (if (imenu--subalist-p item)
!         (setq keep-at-top (cons item keep-at-top)
!               menulist (delq item menulist))))
      (if imenu-sort-function
!       (setq menulist
!             (sort
!              (copy-sequence menulist)
!              imenu-sort-function)))
      (if (> (length menulist) imenu-max-items)
!       (let ((count 0))
!         (setq menulist
!               (mapcar
!                (function
!                 (lambda (menu)
!                   (cons (format "From: %s" (caar menu)) menu)))
!                (imenu--split menulist imenu-max-items)))))
      (cons title
          (nconc (nreverse keep-at-top) menulist))))
  
--- 527,543 ----
              menulist (delq imenu--rescan-item menulist)))
      (setq tail menulist)
      (dolist (item tail)
!       (when (imenu--subalist-p item)
!       (push item keep-at-top)
!       (setq menulist (delq item menulist))))
      (if imenu-sort-function
!       (setq menulist (sort menulist imenu-sort-function)))
      (if (> (length menulist) imenu-max-items)
!       (setq menulist
!             (mapcar
!              (lambda (menu)
!                (cons (format "From: %s" (caar menu)) menu))
!              (imenu--split menulist imenu-max-items))))
      (cons title
          (nconc (nreverse keep-at-top) menulist))))
  
***************
*** 634,652 ****
        alist)
         t))
  
! (defun imenu--create-keymap-1 (title alist)
!   (let ((counter 0))
!     (list* 'keymap title
!          (mapcar
!           (lambda (item)
!             (list* (car item) (car item)
!                    (cond
!                     ((imenu--subalist-p item)
!                      (imenu--create-keymap-1 (car item) (cdr item)))
!                     (t
!                      `(lambda () (interactive)
!                         (imenu--menubar-select ',item))))))
!           alist))))
  
  (defun imenu--in-alist (str alist)
    "Check whether the string STR is contained in multi-level ALIST."
--- 629,646 ----
        alist)
         t))
  
! (defun imenu--create-keymap (title alist &optional cmd)
!   (list* 'keymap title
!        (mapcar
!         (lambda (item)
!           (list* (car item) (car item)
!                  (cond
!                   ((imenu--subalist-p item)
!                    (imenu--create-keymap (car item) (cdr item) cmd))
!                   (t
!                    `(lambda () (interactive)
!                       ,(if cmd `(,cmd ',item) (list 'quote item)))))))
!         alist)))
  
  (defun imenu--in-alist (str alist)
    "Check whether the string STR is contained in multi-level ALIST."
***************
*** 717,741 ****
         (error "This buffer cannot use 
`imenu-default-create-index-function'"))))
  
  ;; Not used and would require cl at run time
! ;;; (defun imenu--flatten-index-alist (index-alist &optional concat-names 
prefix)
! ;;;   ;; Takes a nested INDEX-ALIST and returns a flat index alist.
! ;;;   ;; If optional CONCAT-NAMES is non-nil, then a nested index has its
! ;;;   ;; name and a space concatenated to the names of the children.
! ;;;   ;; Third argument PREFIX is for internal use only.
! ;;;   (mapcan
! ;;;    (lambda (item)
! ;;;      (let* ((name (car item))
! ;;;       (pos (cdr item))
! ;;;       (new-prefix (and concat-names
! ;;;                        (if prefix
! ;;;                            (concat prefix imenu-level-separator name)
! ;;;                          name))))
! ;;;        (cond
! ;;;   ((or (markerp pos) (numberp pos))
! ;;;    (list (cons new-prefix pos)))
! ;;;   (t
! ;;;    (imenu--flatten-index-alist pos new-prefix)))))
! ;;;    index-alist))
  
  ;;;
  ;;; Generic index gathering function.
--- 711,735 ----
         (error "This buffer cannot use 
`imenu-default-create-index-function'"))))
  
  ;; Not used and would require cl at run time
! ;; (defun imenu--flatten-index-alist (index-alist &optional concat-names 
prefix)
! ;;   ;; Takes a nested INDEX-ALIST and returns a flat index alist.
! ;;   ;; If optional CONCAT-NAMES is non-nil, then a nested index has its
! ;;   ;; name and a space concatenated to the names of the children.
! ;;   ;; Third argument PREFIX is for internal use only.
! ;;   (mapcan
! ;;    (lambda (item)
! ;;      (let* ((name (car item))
! ;;        (pos (cdr item))
! ;;        (new-prefix (and concat-names
! ;;                         (if prefix
! ;;                             (concat prefix imenu-level-separator name)
! ;;                           name))))
! ;;        (cond
! ;;    ((or (markerp pos) (numberp pos))
! ;;     (list (cons new-prefix pos)))
! ;;    (t
! ;;     (imenu--flatten-index-alist pos new-prefix)))))
! ;;    index-alist))
  
  ;;;
  ;;; Generic index gathering function.
***************
*** 745,753 ****
    "Defines whether `imenu--generic-function' should fold case when matching.
  
  This variable should be set (only) by initialization code
! for modes which use `imenu--generic-function'.  If it is not set, that
! function will use the current value of `case-fold-search' to match
! patterns.")
  ;;;###autoload
  (make-variable-buffer-local 'imenu-case-fold-search)
  
--- 739,746 ----
    "Defines whether `imenu--generic-function' should fold case when matching.
  
  This variable should be set (only) by initialization code
! for modes which use `imenu--generic-function'.  If it is not set, but
! `font-lock-defaults' is set, then font-lock's setting is used.")
  ;;;###autoload
  (make-variable-buffer-local 'imenu-case-fold-search)
  
***************
*** 758,763 ****
--- 751,759 ----
  
  PATTERNS is an alist with elements that look like this:
   (MENU-TITLE REGEXP INDEX).
+ or like this:
+  (MENU-TITLE REGEXP INDEX FUNCTION ARGUMENTS...)
+ with zero or more ARGUMENTS.
  
  MENU-TITLE is a string used as the title for the submenu or nil if the
  entries are not nested.
***************
*** 773,785 ****
  See `lisp-imenu-generic-expression' for an example of PATTERNS.
  
  Returns an index of the current buffer as an alist.  The elements in
! the alist look like: (INDEX-NAME . INDEX-POSITION).  They may also be
! nested index lists like (INDEX-NAME . INDEX-ALIST) depending on
! PATTERNS."
  
    (let ((index-alist (list 'dummy))
        prev-pos beg
!         (case-fold-search imenu-case-fold-search)
          (old-table (syntax-table))
          (table (copy-syntax-table (syntax-table)))
          (slist imenu-syntax-alist))
--- 769,788 ----
  See `lisp-imenu-generic-expression' for an example of PATTERNS.
  
  Returns an index of the current buffer as an alist.  The elements in
! the alist look like:
!  (INDEX-NAME . INDEX-POSITION)
! or like:
!  (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...)
! They may also be nested index alists like: 
!  (INDEX-NAME . INDEX-ALIST)
! depending on PATTERNS."
  
    (let ((index-alist (list 'dummy))
        prev-pos beg
!         (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search)
!                                 (not (local-variable-p 'font-lock-defaults)))
!                             imenu-case-fold-search
!                           (nth 2 font-lock-defaults)))
          (old-table (syntax-table))
          (table (copy-syntax-table (syntax-table)))
          (slist imenu-syntax-alist))
***************
*** 903,912 ****
  Returns t for rescan and otherwise an element or subelement of INDEX-ALIST."
    (setq index-alist (imenu--split-submenus index-alist))
    (let* ((menu (imenu--split-menu index-alist (or title (buffer-name))))
!        (map (imenu--create-keymap-1 (car menu)
!                                     (if (< 1 (length (cdr menu)))
!                                         (cdr menu)
!                                       (cdr (car (cdr menu)))))))
      (popup-menu map event)))
  
  (defun imenu-choose-buffer-index (&optional prompt alist)
--- 906,915 ----
  Returns t for rescan and otherwise an element or subelement of INDEX-ALIST."
    (setq index-alist (imenu--split-submenus index-alist))
    (let* ((menu (imenu--split-menu index-alist (or title (buffer-name))))
!        (map (imenu--create-keymap (car menu)
!                                   (cdr (if (< 1 (length (cdr menu)))
!                                            menu
!                                          (car (cdr menu)))))))
      (popup-menu map event)))
  
  (defun imenu-choose-buffer-index (&optional prompt alist)
***************
*** 999,1008 ****
          (setq index-alist (imenu--split-submenus index-alist))
          (setq menu (imenu--split-menu index-alist
                                        (buffer-name)))
!         (setq menu1 (imenu--create-keymap-1 (car menu)
!                                             (if (< 1 (length (cdr menu)))
!                                                 (cdr menu)
!                                               (cdr (car (cdr menu))))))
          (setq old (lookup-key (current-local-map) [menu-bar index]))
          (setcdr old (cdr menu1)))))))
  
--- 1002,1012 ----
          (setq index-alist (imenu--split-submenus index-alist))
          (setq menu (imenu--split-menu index-alist
                                        (buffer-name)))
!         (setq menu1 (imenu--create-keymap (car menu)
!                                           (cdr (if (< 1 (length (cdr menu)))
!                                                    menu
!                                                  (car (cdr menu))))
!                                           'imenu--menubar-select))
          (setq old (lookup-key (current-local-map) [menu-bar index]))
          (setcdr old (cdr menu1)))))))
  
***************
*** 1058,1061 ****
--- 1062,1066 ----
  
  (provide 'imenu)
  
+ ;;; arch-tag: 98a2f5f5-4b91-4704-b18c-3aacf77d77a7
  ;;; imenu.el ends here




reply via email to

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