/[emacs]/emacs/lisp/progmodes/ebrowse.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/ebrowse.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by rms, Mon Jun 10 09:04:23 2002 UTC revision 1.17.2.1 by miles, Fri Apr 4 06:20:32 2003 UTC
# Line 31  Line 31 
31  ;; - A complete set of tags-like functions working on class trees  ;; - A complete set of tags-like functions working on class trees
32  ;; - An electric buffer list showing class browser buffers only  ;; - An electric buffer list showing class browser buffers only
33    
34  ;; Documentation is found in a separate Info file.  ;; Documentation is found in a separate Info file.
35    
36  ;;; Code:  ;;; Code:
37    
# Line 258  This is a destructive operation." Line 258  This is a destructive operation."
258  (defmacro ebrowse-output (&rest body)  (defmacro ebrowse-output (&rest body)
259    "Eval BODY with a writable current buffer.    "Eval BODY with a writable current buffer.
260  Preserve buffer's modified state."  Preserve buffer's modified state."
261    (let ((modified (gensym "--ebrowse-output--")))    (let ((modified (make-symbol "--ebrowse-output--")))
262      `(let (buffer-read-only (,modified (buffer-modified-p)))      `(let (buffer-read-only (,modified (buffer-modified-p)))
263         (unwind-protect         (unwind-protect
264             (progn ,@body)             (progn ,@body)
# Line 375  otherwise use the current frame's width. Line 375  otherwise use the current frame's width.
375    ;; they are defined.    ;; they are defined.
376    member-table)    member-table)
377    
378        
379  (defstruct (ebrowse-ts (:type vector) :named)  (defstruct (ebrowse-ts (:type vector) :named)
380    "Tree structure.    "Tree structure.
381  Following the header structure, an BROWSE file contains a number  Following the header structure, a BROWSE file contains a number
382  of `ebrowse-ts' structures, each one describing one root class of  of `ebrowse-ts' structures, each one describing one root class of
383  the class hierarchy with all its subclasses."  the class hierarchy with all its subclasses."
384    ;; A `ebrowse-cs' structure describing the root class.    ;; A `ebrowse-cs' structure describing the root class.
# Line 551  Buffer-local in Ebrowse buffers.") Line 551  Buffer-local in Ebrowse buffers.")
551  (defvar ebrowse--frozen-flag nil  (defvar ebrowse--frozen-flag nil
552    "Non-nil means an Ebrowse buffer won't be reused.    "Non-nil means an Ebrowse buffer won't be reused.
553  Buffer-local in Ebrowse buffers.")  Buffer-local in Ebrowse buffers.")
554      
555    
556  (defvar ebrowse--show-file-names-flag nil  (defvar ebrowse--show-file-names-flag nil
557    "Non-nil means show file names in a tree buffer.    "Non-nil means show file names in a tree buffer.
# Line 572  Buffer-local in Ebrowse member buffers." Line 572  Buffer-local in Ebrowse member buffers."
572    "Width of a columns to display for short member display form.    "Width of a columns to display for short member display form.
573  Buffer-local in Ebrowse member buffers.")  Buffer-local in Ebrowse member buffers.")
574    
575      
576  (defvar ebrowse--virtual-display-flag nil  (defvar ebrowse--virtual-display-flag nil
577    "Non-nil means display virtual members in a member buffer.    "Non-nil means display virtual members in a member buffer.
578  Buffer-local in Ebrowse member buffers.")  Buffer-local in Ebrowse member buffers.")
# Line 796  information." Line 796  information."
796    
797  (defun ebrowse-base-classes (tree)  (defun ebrowse-base-classes (tree)
798    "Return list of base-classes of TREE by searching subclass lists.    "Return list of base-classes of TREE by searching subclass lists.
799  This function must be used instead of the struct slot  This function must be used instead of the struct slot
800  `base-classes' to access the base-class list directly because it  `base-classes' to access the base-class list directly because it
801  computes this information lazily."  computes this information lazily."
802    (or (ebrowse-ts-base-classes tree)    (or (ebrowse-ts-base-classes tree)
# Line 885  this is the first progress message displ Line 885  this is the first progress message displ
885  ;;; Reading a tree from disk  ;;; Reading a tree from disk
886    
887  (defun ebrowse-read ()  (defun ebrowse-read ()
888    "Read `ebrowse-hs' and `ebrowse-ts' structures in the current buffer.      "Read `ebrowse-hs' and `ebrowse-ts' structures in the current buffer.
889  Return a list (HEADER TREE) where HEADER is the file header read  Return a list (HEADER TREE) where HEADER is the file header read
890  and TREE is a list of `ebrowse-ts' structures forming the class tree."  and TREE is a list of `ebrowse-ts' structures forming the class tree."
891    (let ((header (condition-case nil    (let ((header (condition-case nil
# Line 924  NOCONFIRM." Line 924  NOCONFIRM."
924      (ebrowse-tree-mode)      (ebrowse-tree-mode)
925      (current-buffer)))      (current-buffer)))
926    
927        
928  (defun ebrowse-create-tree-buffer (tree tags-file header obarray pop)  (defun ebrowse-create-tree-buffer (tree tags-file header obarray pop)
929    "Create a new tree buffer for tree TREE.    "Create a new tree buffer for tree TREE.
930  The tree was loaded from file TAGS-FILE.  The tree was loaded from file TAGS-FILE.
# Line 1060  if for some reason a circle is in the in Line 1060  if for some reason a circle is in the in
1060        (define-key map [down-mouse-3] 'ebrowse-mouse-3-in-tree-buffer)        (define-key map [down-mouse-3] 'ebrowse-mouse-3-in-tree-buffer)
1061        (define-key map [mouse-2] 'ebrowse-mouse-2-in-tree-buffer)        (define-key map [mouse-2] 'ebrowse-mouse-2-in-tree-buffer)
1062        (define-key map [down-mouse-1] 'ebrowse-mouse-1-in-tree-buffer))        (define-key map [down-mouse-1] 'ebrowse-mouse-1-in-tree-buffer))
1063      
1064      (let ((map1 (make-sparse-keymap)))      (let ((map1 (make-sparse-keymap)))
1065        (suppress-keymap map1 t)        (suppress-keymap map1 t)
1066        (define-key map "L" map1)        (define-key map "L" map1)
# Line 1115  Tree mode key bindings: Line 1115  Tree mode key bindings:
1115    (interactive)    (interactive)
1116    (let* ((ident (propertized-buffer-identification "C++ Tree"))    (let* ((ident (propertized-buffer-identification "C++ Tree"))
1117           header tree buffer-read-only)           header tree buffer-read-only)
1118        
1119      (kill-all-local-variables)      (kill-all-local-variables)
1120      (use-local-map ebrowse-tree-mode-map)      (use-local-map ebrowse-tree-mode-map)
1121        
1122      (unless (zerop (buffer-size))      (unless (zerop (buffer-size))
1123        (goto-char (point-min))        (goto-char (point-min))
1124        (multiple-value-setq (header tree) (ebrowse-read))        (multiple-value-setq (header tree) (ebrowse-read))
# Line 1126  Tree mode key bindings: Line 1126  Tree mode key bindings:
1126        (setq tree (ebrowse-sort-tree-list tree))        (setq tree (ebrowse-sort-tree-list tree))
1127        (erase-buffer)        (erase-buffer)
1128        (message nil))        (message nil))
1129        
1130      (mapcar 'make-local-variable      (mapcar 'make-local-variable
1131              '(ebrowse--tags-file-name              '(ebrowse--tags-file-name
1132                ebrowse--indentation                ebrowse--indentation
# Line 1136  Tree mode key bindings: Line 1136  Tree mode key bindings:
1136                ebrowse--frozen-flag                ebrowse--frozen-flag
1137                ebrowse--tree-obarray                ebrowse--tree-obarray
1138                revert-buffer-function))                revert-buffer-function))
1139        
1140      (setf ebrowse--show-file-names-flag nil      (setf ebrowse--show-file-names-flag nil
1141            ebrowse--tree-obarray (make-vector 127 0)            ebrowse--tree-obarray (make-vector 127 0)
1142            ebrowse--frozen-flag nil            ebrowse--frozen-flag nil
# Line 1159  Tree mode key bindings: Line 1159  Tree mode key bindings:
1159        (ebrowse-redraw-tree)        (ebrowse-redraw-tree)
1160        (set-buffer-modified-p nil))        (set-buffer-modified-p nil))
1161      (run-hooks 'ebrowse-tree-mode-hook)))      (run-hooks 'ebrowse-tree-mode-hook)))
1162        
1163    
1164    
1165  (defun ebrowse-update-tree-buffer-mode-line ()  (defun ebrowse-update-tree-buffer-mode-line ()
# Line 1222  If given a numeric N-TIMES argument, mar Line 1222  If given a numeric N-TIMES argument, mar
1222      (condition-case error      (condition-case error
1223          (loop repeat (or n-times 1)          (loop repeat (or n-times 1)
1224                as tree = (ebrowse-tree-at-point)                as tree = (ebrowse-tree-at-point)
1225                do (progn                do (progn
1226                     (setf (ebrowse-ts-mark tree) (not (ebrowse-ts-mark tree)))                     (setf (ebrowse-ts-mark tree) (not (ebrowse-ts-mark tree)))
1227                     (forward-line 1)                     (forward-line 1)
1228                     (push tree to-change)))                     (push tree to-change)))
# Line 1295  With PREFIX, insert that many filenames. Line 1295  With PREFIX, insert that many filenames.
1295          (let ((tree (ebrowse-tree-at-point))          (let ((tree (ebrowse-tree-at-point))
1296                start                start
1297                file-name-existing)                file-name-existing)
           (unless tree return)  
1298            (beginning-of-line)            (beginning-of-line)
1299            (skip-chars-forward " \t*a-zA-Z0-9_")            (skip-chars-forward " \t*a-zA-Z0-9_")
1300            (setq start (point)            (setq start (point)
# Line 1426  If no member buffer exists, make one." Line 1425  If no member buffer exists, make one."
1425    "Pop to a browser buffer from any other buffer.    "Pop to a browser buffer from any other buffer.
1426  Pop to member buffer if no prefix ARG, to tree buffer otherwise."  Pop to member buffer if no prefix ARG, to tree buffer otherwise."
1427    (interactive "P")    (interactive "P")
1428    (let ((buffer (get-buffer (if arg    (let ((buffer (get-buffer (if arg
1429                                  ebrowse-tree-buffer-name                                  ebrowse-tree-buffer-name
1430                                ebrowse-member-buffer-name))))                                ebrowse-member-buffer-name))))
1431      (unless buffer      (unless buffer
1432        (setq buffer        (setq buffer
1433              (get-buffer (if arg              (get-buffer (if arg
1434                              ebrowse-member-buffer-name                              ebrowse-member-buffer-name
1435                            ebrowse-tree-buffer-name))))                            ebrowse-tree-buffer-name))))
# Line 1536  VIEW non-nil means view it.  WHERE is ad Line 1535  VIEW non-nil means view it.  WHERE is ad
1535                           :file (ebrowse-cs-file class)                           :file (ebrowse-cs-file class)
1536                           :point (ebrowse-cs-point class))))                           :point (ebrowse-cs-point class))))
1537      (ebrowse-view/find-file-and-search-pattern      (ebrowse-view/find-file-and-search-pattern
1538       browse-struct       browse-struct
1539       (list ebrowse--header class nil)       (list ebrowse--header class nil)
1540       file       file
1541       ebrowse--tags-file-name       ebrowse--tags-file-name
# Line 1638  The new frame is deleted when it is no l Line 1637  The new frame is deleted when it is no l
1637      (make-local-variable 'ebrowse--frame-configuration)      (make-local-variable 'ebrowse--frame-configuration)
1638      (setq ebrowse--frame-configuration old-frame-configuration)      (setq ebrowse--frame-configuration old-frame-configuration)
1639      (make-local-variable 'ebrowse--view-exit-action)      (make-local-variable 'ebrowse--view-exit-action)
1640      (setq ebrowse--view-exit-action      (setq ebrowse--view-exit-action
1641            (and (not had-a-buf)            (and (not had-a-buf)
1642                 (not (buffer-modified-p buf-to-view))                 (not (buffer-modified-p buf-to-view))
1643                 'kill-buffer))                 'kill-buffer))
# Line 1653  describing what to search. Line 1652  describing what to search.
1652  INFO is a list (HEADER MEMBER-OR-CLASS ACCESSOR).  HEADER is the  INFO is a list (HEADER MEMBER-OR-CLASS ACCESSOR).  HEADER is the
1653  header structure of a class tree.  MEMBER-OR-CLASS is either an  header structure of a class tree.  MEMBER-OR-CLASS is either an
1654  `ebrowse-ms' or `ebrowse-cs' structure depending on what is searched.  `ebrowse-ms' or `ebrowse-cs' structure depending on what is searched.
1655  ACCESSOR is an accessor function for the member list of an member  ACCESSOR is an accessor function for the member list of a member
1656  if MEMBER-OR-CLASS is an `ebrowse-ms'.  if MEMBER-OR-CLASS is an `ebrowse-ms'.
1657  FILE is the file to search the member in.  FILE is the file to search the member in.
1658  FILE is not taken out of STRUC here because the filename in STRUC  FILE is not taken out of STRUC here because the filename in STRUC
# Line 1699  expression matching any number of whites Line 1698  expression matching any number of whites
1698          with start = 0          with start = 0
1699          finally return regexp          finally return regexp
1700          while (string-match "[ \t]+" regexp start)          while (string-match "[ \t]+" regexp start)
1701          do (setf (substring regexp (match-beginning 0) (match-end 0))          do (setq regexp (concat (substring regexp 0 (match-beginning 0))
1702                   "[ \t]*"                                  "[ \t]*"
1703                                    (substring regexp (match-end 0)))
1704                   start (+ (match-beginning 0) 5))))                   start (+ (match-beginning 0) 5))))
1705    
1706    
1707  (defun ebrowse-class-declaration-regexp (name)  (defun ebrowse-class-declaration-regexp (name)
1708    "Construct a regexp for a declaration of class NAME."    "Construct a regexp for a declaration of class NAME."
1709    (concat "^[ \t]*\\(template[ \t\n]*<.*>\\)?"    (concat "^[ \t]*\\(template[ \t\n]*<.*>\\)?"
1710            "[ \t\n]*\\(class\\|struct\\|union\\).*\\S_"            "[ \t\n]*\\(class\\|struct\\|union\\).*\\S_"
1711            (ebrowse-symbol-regexp name)            (ebrowse-symbol-regexp name)
# Line 1828  TREE denotes the class shown." Line 1828  TREE denotes the class shown."
1828    
1829    
1830  (defun* ebrowse-draw-tree-fn (&aux stack1 stack2 start)  (defun* ebrowse-draw-tree-fn (&aux stack1 stack2 start)
1831    "Display a single class and recursively it's subclasses.    "Display a single class and recursively its subclasses.
1832  This function may look weird, but this is faster than recursion."  This function may look weird, but this is faster than recursion."
1833    (setq stack1 (make-list (length ebrowse--tree) 0)    (setq stack1 (make-list (length ebrowse--tree) 0)
1834          stack2 (copy-sequence ebrowse--tree))          stack2 (copy-sequence ebrowse--tree))
# Line 1840  This function may look weird, but this i Line 1840  This function may look weird, but this i
1840                start-of-class-name end-of-class-name)                start-of-class-name end-of-class-name)
1841            ;; Insert mark            ;; Insert mark
1842            (insert (if (ebrowse-ts-mark tree) ">" " "))            (insert (if (ebrowse-ts-mark tree) ">" " "))
1843              
1844            ;; Indent and insert class name            ;; Indent and insert class name
1845            (indent-to (+ (* level ebrowse--indentation)            (indent-to (+ (* level ebrowse--indentation)
1846                          ebrowse-tree-left-margin))                          ebrowse-tree-left-margin))
1847            (setq start (point))            (setq start (point))
1848            (insert (ebrowse-qualified-class-name class))            (insert (ebrowse-qualified-class-name class))
1849              
1850            ;; If template class, add <>            ;; If template class, add <>
1851            (when (ebrowse-template-p class)            (when (ebrowse-template-p class)
1852              (insert "<>"))              (insert "<>"))
# Line 2167  See 'Electric-command-loop' for a descri Line 2167  See 'Electric-command-loop' for a descri
2167      (define-key map1 "d" 'ebrowse-switch-member-buffer-to-derived-class)      (define-key map1 "d" 'ebrowse-switch-member-buffer-to-derived-class)
2168      (define-key map1 "n" 'ebrowse-switch-member-buffer-to-next-sibling-class)      (define-key map1 "n" 'ebrowse-switch-member-buffer-to-next-sibling-class)
2169      (define-key map1 "p" 'ebrowse-switch-member-buffer-to-previous-sibling-class))      (define-key map1 "p" 'ebrowse-switch-member-buffer-to-previous-sibling-class))
2170        
2171    (let ((map1 (make-sparse-keymap)))    (let ((map1 (make-sparse-keymap)))
2172      (suppress-keymap map1 t)      (suppress-keymap map1 t)
2173      (define-key map "D" map1)      (define-key map "D" map1)
# Line 2177  See 'Electric-command-loop' for a descri Line 2177  See 'Electric-command-loop' for a descri
2177      (define-key map1 "l" 'ebrowse-toggle-long-short-display)      (define-key map1 "l" 'ebrowse-toggle-long-short-display)
2178      (define-key map1 "r" 'ebrowse-toggle-regexp-display)      (define-key map1 "r" 'ebrowse-toggle-regexp-display)
2179      (define-key map1 "w" 'ebrowse-set-member-buffer-column-width))      (define-key map1 "w" 'ebrowse-set-member-buffer-column-width))
2180        
2181    (let ((map1 (make-sparse-keymap)))    (let ((map1 (make-sparse-keymap)))
2182      (suppress-keymap map1 t)      (suppress-keymap map1 t)
2183      (define-key map "F" map1)      (define-key map "F" map1)
# Line 2192  See 'Electric-command-loop' for a descri Line 2192  See 'Electric-command-loop' for a descri
2192      (define-key map1 "p" 'ebrowse-toggle-pure-member-filter)      (define-key map1 "p" 'ebrowse-toggle-pure-member-filter)
2193      (define-key map1 "r" 'ebrowse-remove-all-member-filters)      (define-key map1 "r" 'ebrowse-remove-all-member-filters)
2194      (define-key map1 "v" 'ebrowse-toggle-virtual-member-filter))      (define-key map1 "v" 'ebrowse-toggle-virtual-member-filter))
2195        
2196    (let ((map1 (make-sparse-keymap)))    (let ((map1 (make-sparse-keymap)))
2197      (suppress-keymap map1 t)      (suppress-keymap map1 t)
2198      (define-key map "L" map1)      (define-key map "L" map1)
# Line 2204  See 'Electric-command-loop' for a descri Line 2204  See 'Electric-command-loop' for a descri
2204      (define-key map1 "t" 'ebrowse-display-types-member-list)      (define-key map1 "t" 'ebrowse-display-types-member-list)
2205      (define-key map1 "v" 'ebrowse-display-variables-member-list)      (define-key map1 "v" 'ebrowse-display-variables-member-list)
2206      (define-key map1 "V" 'ebrowse-display-static-variables-member-list))      (define-key map1 "V" 'ebrowse-display-static-variables-member-list))
2207        
2208    (let ((map1 (make-sparse-keymap)))    (let ((map1 (make-sparse-keymap)))
2209      (suppress-keymap map1 t)      (suppress-keymap map1 t)
2210      (define-key map "G" map1)      (define-key map "G" map1)
2211      (define-key map1 "m" 'ebrowse-goto-visible-member/all-member-lists)      (define-key map1 "m" 'ebrowse-goto-visible-member/all-member-lists)
2212      (define-key map1 "n" 'ebrowse-repeat-member-search)      (define-key map1 "n" 'ebrowse-repeat-member-search)
2213      (define-key map1 "v" 'ebrowse-goto-visible-member))      (define-key map1 "v" 'ebrowse-goto-visible-member))
2214        
2215    (define-key map "f" 'ebrowse-find-member-declaration)    (define-key map "f" 'ebrowse-find-member-declaration)
2216    (define-key map "m" 'ebrowse-switch-to-next-member-buffer)    (define-key map "m" 'ebrowse-switch-to-next-member-buffer)
2217    (define-key map "q" 'bury-buffer)    (define-key map "q" 'bury-buffer)
# Line 2681  CLASS non-nil means display that class' Line 2681  CLASS non-nil means display that class'
2681  the class cursor is on."  the class cursor is on."
2682    (let ((start (point))    (let ((start (point))
2683          (tree  (or class ebrowse--displayed-class))          (tree  (or class ebrowse--displayed-class))
2684          class-name-start          class-name-start
2685          class-name-end)          class-name-end)
2686      (insert "class ")      (insert "class ")
2687      (setq class-name-start (point))      (setq class-name-start (point))
# Line 2831  TREE is the class tree in which the memb Line 2831  TREE is the class tree in which the memb
2831            (indent-to (* i column-width))            (indent-to (* i column-width))
2832            (put-text-property start-of-column (point) 'mouse-face nil)            (put-text-property start-of-column (point) 'mouse-face nil)
2833            (setq start-of-entry (point))            (setq start-of-entry (point))
2834            ;; Show various attributes            ;; Show various attributes
2835            (when ebrowse--attributes-flag            (when ebrowse--attributes-flag
2836              (insert "<")              (insert "<")
2837              (ebrowse-draw-member-attributes member)              (ebrowse-draw-member-attributes member)
# Line 3034  Prefix arg INC specifies which one." Line 3034  Prefix arg INC specifies which one."
3034  Prefix arg ARG says which class should be displayed.  Default is  Prefix arg ARG says which class should be displayed.  Default is
3035  the first derived class."  the first derived class."
3036    (interactive "P")    (interactive "P")
3037    (flet ((ebrowse-tree-obarray-as-alist ()    (flet ((ebrowse-tree-obarray-as-alist ()
3038                                          (loop for s in (ebrowse-ts-subclasses                                          (loop for s in (ebrowse-ts-subclasses
3039                                                          ebrowse--displayed-class)                                                          ebrowse--displayed-class)
3040                                                collect (cons (ebrowse-cs-name                                                collect (cons (ebrowse-cs-name
# Line 3124  the first derived class." Line 3124  the first derived class."
3124      ["Find in Tree" ebrowse-goto-visible-member/all-member-lists      ["Find in Tree" ebrowse-goto-visible-member/all-member-lists
3125       :help "Search for a member in any class"       :help "Search for a member in any class"
3126       :active t])       :active t])
3127     ("Display"     ("Display"
3128      ["Inherited" ebrowse-toggle-base-class-display      ["Inherited" ebrowse-toggle-base-class-display
3129       :help "Toggle display of inherited members"       :help "Toggle display of inherited members"
3130       :style toggle       :style toggle
# Line 3217  the first derived class." Line 3217  the first derived class."
3217      :active (eq (get-text-property (point) 'ebrowse-what) 'class-name)]))      :active (eq (get-text-property (point) 'ebrowse-what) 'class-name)]))
3218    
3219    
3220  (easy-menu-define  (easy-menu-define
3221   ebrowse-member-name-object-menu ebrowse-member-mode-map   ebrowse-member-name-object-menu ebrowse-member-mode-map
3222   "Object menu for member names"   "Object menu for member names"
3223   '("Ebrowse"   '("Ebrowse"
# Line 3274  TREE-HEADER is the header structure of t Line 3274  TREE-HEADER is the header structure of t
3274  NAME is the name of the member.  NAME is the name of the member.
3275  Value is an alist of elements (CLASS-NAME . (CLASS LIST NAME)),  Value is an alist of elements (CLASS-NAME . (CLASS LIST NAME)),
3276  where each element describes one occurrence of member NAME in the tree.  where each element describes one occurrence of member NAME in the tree.
3277  CLASS-NAME is the qualified name of the class in which the  CLASS-NAME is the qualified name of the class in which the
3278  member was found.  The CDR of the acons is described in function  member was found.  The CDR of the acons is described in function
3279  `ebrowse-class/index/member-for-member'."  `ebrowse-class/index/member-for-member'."
3280    (let ((table (ebrowse-member-table tree-header))    (let ((table (ebrowse-member-table tree-header))
# Line 3313  from point as default.  Value is a list Line 3313  from point as default.  Value is a list
3313          (unless member-name          (unless member-name
3314            (error "No member name at point"))            (error "No member name at point"))
3315          (if members          (if members
3316              (let* ((alist (ebrowse-hash-table-to-alist members))              (let* ((name (ebrowse-ignoring-completion-case
3317                     (name (ebrowse-ignoring-completion-case                             (completing-read prompt members nil nil member-name)))
3318                             (completing-read prompt alist nil nil member-name)))                     (completion-result (try-completion name members)))
                    (completion-result (try-completion name alist)))  
3319                ;; Cannot rely on `try-completion' returning t for exact                ;; Cannot rely on `try-completion' returning t for exact
3320                ;; matches!  It returns the name as a string.                ;; matches!  It returns the name as a string.
3321                (unless (setq member-info (gethash name members))                (unless (setq member-info (gethash name members))
3322                  (if (y-or-n-p "No exact match found.  Try substrings? ")                  (if (y-or-n-p "No exact match found.  Try substrings? ")
3323                      (setq name                      (setq name
3324                            (or (first (ebrowse-list-of-matching-members                            (or (first (ebrowse-list-of-matching-members
3325                                        members (regexp-quote name) name))                                        members (regexp-quote name) name))
3326                                (error "Sorry, nothing found")))                                (error "Sorry, nothing found")))
3327                    (error "Canceled")))                    (error "Canceled")))
# Line 3555  The file name is read from the minibuffe Line 3554  The file name is read from the minibuffe
3554    (let* ((buffer (or (ebrowse-choose-from-browser-buffers)    (let* ((buffer (or (ebrowse-choose-from-browser-buffers)
3555                       (error "No tree buffer")))                       (error "No tree buffer")))
3556           (files (save-excursion (set-buffer buffer) (ebrowse-files-table)))           (files (save-excursion (set-buffer buffer) (ebrowse-files-table)))
3557           (alist (ebrowse-hash-table-to-alist files))           (file (completing-read "List members in file: " files nil t))
          (file (completing-read "List members in file: " alist nil t))  
3558           (header (ebrowse-value-in-buffer 'ebrowse--header buffer))           (header (ebrowse-value-in-buffer 'ebrowse--header buffer))
3559           temp-buffer-setup-hook           temp-buffer-setup-hook
3560           (members (ebrowse-member-table header)))           (members (ebrowse-member-table header)))
# Line 3584  INFO describes the member.  It has the f Line 3582  INFO describes the member.  It has the f
3582  TREE is the class of the member to display.  TREE is the class of the member to display.
3583  ACCESSOR is the accessor symbol of its member list.  ACCESSOR is the accessor symbol of its member list.
3584  MEMBER is the member structure.  MEMBER is the member structure.
3585  KIND is a an additional string printed in the buffer."  KIND is an additional string printed in the buffer."
3586    (let* ((tree (first info))    (let* ((tree (first info))
3587           (globals-p (ebrowse-globals-tree-p tree)))           (globals-p (ebrowse-globals-tree-p tree)))
3588      (unless globals-p      (unless globals-p
# Line 3627  KIND is a an additional string printed i Line 3625  KIND is a an additional string printed i
3625    
3626    
3627  (defun ebrowse-some-member-table ()  (defun ebrowse-some-member-table ()
3628    "Return a hash table containing all member of a tree.    "Return a hash table containing all members of a tree.
3629  If there's only one tree loaded, use that.  Otherwise let the  If there's only one tree loaded, use that.  Otherwise let the
3630  use choose a tree."  use choose a tree."
3631    (let* ((buffers (ebrowse-known-class-trees-buffer-list))    (let* ((buffers (ebrowse-known-class-trees-buffer-list))
# Line 3639  use choose a tree." Line 3637  use choose a tree."
3637      (ebrowse-member-table header)))      (ebrowse-member-table header)))
3638    
3639    
 (defun ebrowse-hash-table-to-alist (table)  
   "Return an alist holding all key/value pairs of hash table TABLE."  
   (let ((list))  
     (maphash #'(lambda (key value)  
                  (setq list (cons (cons key value) list)))  
              table)  
     list))  
     
   
3640  (defun ebrowse-cyclic-successor-in-string-list (string list)  (defun ebrowse-cyclic-successor-in-string-list (string list)
3641    "Return the item following STRING in LIST.    "Return the item following STRING in LIST.
3642  If STRING is the last element, return the first element as successor."  If STRING is the last element, return the first element as successor."
# Line 3660  If STRING is the last element, return th Line 3649  If STRING is the last element, return th
3649  ;;;###autoload  ;;;###autoload
3650  (defun* ebrowse-tags-complete-symbol (prefix)  (defun* ebrowse-tags-complete-symbol (prefix)
3651    "Perform completion on the C++ symbol preceding point.    "Perform completion on the C++ symbol preceding point.
3652  A second call of this function without changing point inserts the next match.  A second call of this function without changing point inserts the next match.
3653  A call with prefix PREFIX reads the symbol to insert from the minibuffer with  A call with prefix PREFIX reads the symbol to insert from the minibuffer with
3654  completion."  completion."
3655    (interactive "P")    (interactive "P")
# Line 3672  completion." Line 3661  completion."
3661       ;; With prefix, read name from minibuffer with completion.       ;; With prefix, read name from minibuffer with completion.
3662       (prefix       (prefix
3663        (let* ((members (ebrowse-some-member-table))        (let* ((members (ebrowse-some-member-table))
              (alist (ebrowse-hash-table-to-alist members))  
3664               (completion (completing-read "Insert member: "               (completion (completing-read "Insert member: "
3665                                            alist nil t pattern)))                                            members nil t pattern)))
3666          (when completion          (when completion
3667            (setf ebrowse-last-completion-location nil)            (setf ebrowse-last-completion-location nil)
3668            (delete-region begin end)            (delete-region begin end)
# Line 3706  completion." Line 3694  completion."
3694                (t                (t
3695                 (delete-region begin end)                 (delete-region begin end)
3696                 (insert completion)                 (insert completion)
3697                  
3698                 (setf ebrowse-last-completion-location (point)                 (setf ebrowse-last-completion-location (point)
3699                       ebrowse-last-completion-start pattern                       ebrowse-last-completion-start pattern
3700                       ebrowse-last-completion completion                       ebrowse-last-completion completion
# Line 3808  If regular expression is nil, repeat las Line 3796  If regular expression is nil, repeat las
3796  (defun ebrowse-tags-query-replace (from to)  (defun ebrowse-tags-query-replace (from to)
3797    "Query replace FROM with TO in all files of a class tree.    "Query replace FROM with TO in all files of a class tree.
3798  With prefix arg, process files of marked classes only."  With prefix arg, process files of marked classes only."
3799    (interactive    (interactive
3800     "sTree query replace (regexp): \nsTree query replace %s by: ")     "sTree query replace (regexp): \nsTree query replace %s by: ")
3801    (setq ebrowse-tags-loop-form    (setq ebrowse-tags-loop-form
3802          (list 'and (list 'save-excursion          (list 'and (list 'save-excursion
# Line 3879  If VIEW is non-nil, view the position, o Line 3867  If VIEW is non-nil, view the position, o
3867          (t          (t
3868           (unwind-protect           (unwind-protect
3869               (progn               (progn
3870                 (push (function                 (push (function
3871                        (lambda ()                        (lambda ()
3872                          (goto-char (ebrowse-position-point position))))                          (goto-char (ebrowse-position-point position))))
3873                       view-mode-hook)                       view-mode-hook)
# Line 3905  Positions in buffers that have no file n Line 3893  Positions in buffers that have no file n
3893               :file-name (buffer-file-name (marker-buffer marker))               :file-name (buffer-file-name (marker-buffer marker))
3894               :point (marker-position marker)               :point (marker-position marker)
3895               :target target               :target target
3896               :info info)               :info info)
3897              ebrowse-position-stack))))              ebrowse-position-stack))))
3898    
3899    
# Line 4378  EVENT is the mouse event." Line 4366  EVENT is the mouse event."
4366    
4367    
4368  (easy-menu-define  (easy-menu-define
4369   ebrowse-tree-buffer-class-object-menu ebrowse-tree-mode-map   ebrowse-tree-buffer-class-object-menu ebrowse-tree-mode-map
4370   "Object menu for classes in the tree buffer"   "Object menu for classes in the tree buffer"
4371   '("Class"   '("Class"
4372     ["Functions" ebrowse-tree-command:show-member-functions     ["Functions" ebrowse-tree-command:show-member-functions
# Line 4420  EVENT is the mouse event." Line 4408  EVENT is the mouse event."
4408    
4409    
4410  (easy-menu-define  (easy-menu-define
4411   ebrowse-tree-buffer-object-menu ebrowse-tree-mode-map   ebrowse-tree-buffer-object-menu ebrowse-tree-mode-map
4412   "Object menu for tree buffers"   "Object menu for tree buffers"
4413   '("Ebrowse"   '("Ebrowse"
4414     ["Filename Display" ebrowse-toggle-file-name-display     ["Filename Display" ebrowse-toggle-file-name-display

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.17.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26