X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/cbee283dd7dd655124e81a6bd555506476180b5d..b336bfcdf39f1e4d35bff4a7bd01d3b4bca8f516:/lisp/progmodes/ebrowse.el diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index c8fea81949..e32c453b91 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -1,7 +1,7 @@ ;;; ebrowse.el --- Emacs C++ class browser & tags facility ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -;; 2002, 2003, 2004, 2005, 2006, 2007, 2008 +;; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 ;; Free Software Foundation Inc. ;; Author: Gerd Moellmann @@ -10,10 +10,10 @@ ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,9 +21,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -164,8 +162,7 @@ This space is used to display markers." (t (:foreground "red"))) "*The face used for the mark character in the tree." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-tree-mark-face 'face-alias 'ebrowse-tree-mark) +(define-obsolete-face-alias 'ebrowse-tree-mark-face 'ebrowse-tree-mark "22.1") (defface ebrowse-root-class @@ -173,24 +170,21 @@ This space is used to display markers." (t (:weight bold :foreground "blue"))) "*The face used for root classes in the tree." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-root-class-face 'face-alias 'ebrowse-root-class) +(define-obsolete-face-alias 'ebrowse-root-class-face 'ebrowse-root-class "22.1") (defface ebrowse-file-name '((t (:italic t))) "*The face for filenames displayed in the tree." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-file-name-face 'face-alias 'ebrowse-file-name) +(define-obsolete-face-alias 'ebrowse-file-name-face 'ebrowse-file-name "22.1") (defface ebrowse-default '((t nil)) "*Face for everything else in the tree not having other faces." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-default-face 'face-alias 'ebrowse-default) +(define-obsolete-face-alias 'ebrowse-default-face 'ebrowse-default "22.1") (defface ebrowse-member-attribute @@ -198,16 +192,16 @@ This space is used to display markers." (t (:foreground "red"))) "*Face used to display member attributes." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-member-attribute-face 'face-alias 'ebrowse-member-attribute) +(define-obsolete-face-alias 'ebrowse-member-attribute-face + 'ebrowse-member-attribute "22.1") (defface ebrowse-member-class '((t (:foreground "purple"))) "*Face used to display the class title in member buffers." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-member-class-face 'face-alias 'ebrowse-member-class) +(define-obsolete-face-alias 'ebrowse-member-class-face + 'ebrowse-member-class "22.1") (defface ebrowse-progress @@ -215,8 +209,7 @@ This space is used to display markers." (t (:background "blue"))) "*Face for progress indicator." :group 'ebrowse-faces) -;; backward-compatibility alias -(put 'ebrowse-progress-face 'face-alias 'ebrowse-progress) +(define-obsolete-face-alias 'ebrowse-progress-face 'ebrowse-progress "22.1") @@ -1009,8 +1002,7 @@ HEADER is the tree header structure of the class tree." (loop for buffer in (ebrowse-browser-buffer-list) until (eq header (ebrowse-value-in-buffer 'ebrowse--header buffer)) finally do - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (ebrowse-fill-member-table)))) (ebrowse-hs-member-table header)) @@ -1143,7 +1135,7 @@ Tree mode key bindings: (unless (zerop (buffer-size)) (goto-char (point-min)) - (multiple-value-setq (header tree) (ebrowse-read)) + (multiple-value-setq (header tree) (values-list (ebrowse-read))) (message "Sorting. Please be patient...") (setq tree (ebrowse-sort-tree-list tree)) (erase-buffer) @@ -1339,7 +1331,8 @@ With PREFIX, insert that many filenames." (setf ebrowse--show-file-names-flag (not ebrowse--show-file-names-flag)) (let ((old-line (count-lines (point-min) (point)))) (ebrowse-redraw-tree) - (goto-line old-line))) + (goto-char (point-min)) + (forward-line (1- old-line)))) @@ -1619,8 +1612,7 @@ and (b) in the directories named in `ebrowse-search-path'." Restore frame configuration active before viewing the file, and possibly kill the viewed buffer." (let (exit-action original-frame-configuration) - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (setq original-frame-configuration ebrowse--frame-configuration exit-action ebrowse--view-exit-action)) ;; Delete the frame in which we viewed. @@ -2595,7 +2587,7 @@ TAGS-FILE-NAME is the file name of the BROWSE file." accessor (second info) member (third info)) (multiple-value-setq (tree member on-class) - (ebrowse-member-info-from-point)) + (values-list (ebrowse-member-info-from-point))) (setq accessor ebrowse--accessor)) ;; View/find class if on a line containing a class name. (when on-class @@ -3315,7 +3307,7 @@ from point as default. Value is a list (CLASS-NAME MEMBER-NAME)." (save-excursion (let* (start member-info (members (ebrowse-member-table header))) (multiple-value-bind (class-name member-name) - (ebrowse-tags-read-member+class-name) + (values-list (ebrowse-tags-read-member+class-name)) (unless member-name (error "No member name at point")) (if members @@ -3380,7 +3372,7 @@ the user choose the class to use. As a last step, a tags search is performed that positions point on the member declaration or definition." (multiple-value-bind - (tree header tree-buffer) (ebrowse-choose-tree) + (tree header tree-buffer) (values-list (ebrowse-choose-tree)) (unless tree (error "No class tree")) (let* ((marker (point-marker)) class-name @@ -3388,10 +3380,11 @@ definition." info) (unless name (multiple-value-setq (class-name name) - (ebrowse-tags-read-name - header - (concat (if view "View" "Find") " member " - (if definition "definition" "declaration") ": ")))) + (values-list + (ebrowse-tags-read-name + header + (concat (if view "View" "Find") " member " + (if definition "definition" "declaration") ": "))))) (setq info (ebrowse-tags-choose-class tree header name class-name)) (ebrowse-push-position marker info) ;; Goto the occurrence of the member @@ -3509,13 +3502,14 @@ FIX-NAME non-nil means display the buffer for that member. Otherwise read a member name from point." (interactive) (multiple-value-bind - (tree header tree-buffer) (ebrowse-choose-tree) + (tree header tree-buffer) (values-list (ebrowse-choose-tree)) (unless tree (error "No class tree")) (let* ((marker (point-marker)) class-name (name fix-name) info) (unless name (multiple-value-setq (class-name name) - (ebrowse-tags-read-name header - (concat "Find member list of: ")))) + (values-list + (ebrowse-tags-read-name header + (concat "Find member list of: "))))) (setq info (ebrowse-tags-choose-class tree header name class-name)) (ebrowse-push-position marker info) (ebrowse-tags-select/create-member-buffer tree-buffer info)))) @@ -3559,7 +3553,7 @@ The file name is read from the minibuffer." (interactive) (let* ((buffer (or (ebrowse-choose-from-browser-buffers) (error "No tree buffer"))) - (files (save-excursion (set-buffer buffer) (ebrowse-files-table))) + (files (with-current-buffer buffer (ebrowse-files-table))) (file (completing-read "List members in file: " files nil t)) (header (ebrowse-value-in-buffer 'ebrowse--header buffer)) temp-buffer-setup-hook @@ -3737,8 +3731,7 @@ TREE-BUFFER specifies the class tree we operate on." ;; on which tree (s)he wants to operate. (when initialize (let ((buffer (or tree-buffer (ebrowse-choose-from-browser-buffers)))) - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (setq ebrowse-tags-next-file-list (ebrowse-files-list (ebrowse-marked-classes-p)) ebrowse-tags-loop-last-file @@ -3821,14 +3814,14 @@ looks like a function call to the member." (interactive) ;; Choose the tree to use if there is more than one. (multiple-value-bind (tree header tree-buffer) - (ebrowse-choose-tree) + (values-list (ebrowse-choose-tree)) (unless tree (error "No class tree")) ;; Get the member name NAME (class-name is ignored). (let ((name fix-name) class-name regexp) (unless name (multiple-value-setq (class-name name) - (ebrowse-tags-read-name header "Find calls of: "))) + (values-list (ebrowse-tags-read-name header "Find calls of: ")))) ;; Set tags loop form to search for member and begin loop. (setq regexp (concat "\\<" name "[ \t]*(") ebrowse-tags-loop-form (list 're-search-forward regexp nil t)) @@ -4128,8 +4121,7 @@ Otherwise, FILE-NAME specifies the file to save the tree in." (header (copy-ebrowse-hs ebrowse--header)) (tree ebrowse--tree)) (unwind-protect - (save-excursion - (set-buffer (setq standard-output temp-buffer)) + (with-current-buffer (setq standard-output temp-buffer) (erase-buffer) (setf (ebrowse-hs-member-table header) nil) (insert (prin1-to-string header) " ") @@ -4170,7 +4162,7 @@ Otherwise, FILE-NAME specifies the file to save the tree in." (with-output-to-temp-buffer "*Tree Statistics*" (multiple-value-bind (classes member-functions member-variables static-functions static-variables) - (ebrowse-gather-statistics) + (values-list (ebrowse-gather-statistics)) (set-buffer standard-output) (erase-buffer) (insert "STATISTICS FOR TREE " (or tree-file "unknown") ":\n\n") @@ -4214,8 +4206,8 @@ NUMBER-OF-STATIC-VARIABLES:" ;;; Global key bindings -;;; The following can be used to bind key sequences starting with -;;; prefix `\C-c\C-m' to browse commands. +;; The following can be used to bind key sequences starting with +;; prefix `\C-c\C-m' to browse commands. (defvar ebrowse-global-map nil "*Keymap for Ebrowse commands.") @@ -4274,14 +4266,14 @@ NUMBER-OF-STATIC-VARIABLES:" ;;; Electric C++ browser buffer menu -;;; Electric buffer menu customization to display only some buffers -;;; (in this case Tree buffers). There is only one problem with this: -;;; If the very first character typed in the buffer menu is a space, -;;; this will select the buffer from which the buffer menu was -;;; invoked. But this buffer is not displayed in the buffer list if -;;; it isn't a tree buffer. I therefore let the buffer menu command -;;; loop read the command `p' via `unread-command-char'. This command -;;; has no effect since we are on the first line of the buffer. +;; Electric buffer menu customization to display only some buffers +;; (in this case Tree buffers). There is only one problem with this: +;; If the very first character typed in the buffer menu is a space, +;; this will select the buffer from which the buffer menu was +;; invoked. But this buffer is not displayed in the buffer list if +;; it isn't a tree buffer. I therefore let the buffer menu command +;; loop read the command `p' via `unread-command-char'. This command +;; has no effect since we are on the first line of the buffer. (defvar electric-buffer-menu-mode-hook nil) @@ -4316,7 +4308,8 @@ NUMBER-OF-STATIC-VARIABLES:" (interactive) (let* ((maxlin (count-lines (point-min) (point-max))) (n (min maxlin (+ 2 (string-to-number (this-command-keys)))))) - (goto-line n) + (goto-char (point-min)) + (forward-line (1- n)) (throw 'electric-buffer-menu-select (point)))) @@ -4491,12 +4484,12 @@ EVENT is the mouse event." (provide 'ebrowse) -;;; Local variables: -;;; eval:(put 'ebrowse-output 'lisp-indent-hook 0) -;;; eval:(put 'ebrowse-ignoring-completion-case 'lisp-indent-hook 0) -;;; eval:(put 'ebrowse-save-selective 'lisp-indent-hook 0) -;;; eval:(put 'ebrowse-for-all-trees 'lisp-indent-hook 1) -;;; End: +;; Local variables: +;; eval:(put 'ebrowse-output 'lisp-indent-hook 0) +;; eval:(put 'ebrowse-ignoring-completion-case 'lisp-indent-hook 0) +;; eval:(put 'ebrowse-save-selective 'lisp-indent-hook 0) +;; eval:(put 'ebrowse-for-all-trees 'lisp-indent-hook 1) +;; End: ;; arch-tag: 4fa3c8bf-1771-479b-bcd7-b029c7c9677b ;;; ebrowse.el ends here