Switch to recommended form of GPLv3 permissions notice.
[bpt/emacs.git] / lisp / progmodes / ebrowse.el
index cc808ad..bdc4c57 100644 (file)
@@ -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
+;; 2002, 2003, 2004, 2005, 2006, 2007, 2008
 ;; Free Software Foundation Inc.
 
 ;; Author: Gerd Moellmann <gerd@gnu.org>
 
 ;; 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 2, 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 <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -896,10 +894,10 @@ this is the first progress message displayed."
   (let (message-log-max)
     (when start (setq ebrowse-n-boxes 0))
     (setq ebrowse-n-boxes (mod (1+ ebrowse-n-boxes) ebrowse-max-boxes))
-    (message (concat title ": "
-                    (propertize (make-string ebrowse-n-boxes
-                                             (if (display-color-p) ?\  ?+))
-                                'face 'ebrowse-progress)))))
+    (message "%s: %s" title
+            (propertize (make-string ebrowse-n-boxes
+                                     (if (display-color-p) ?\  ?+))
+                        'face 'ebrowse-progress))))
 
 \f
 ;;; Reading a tree from disk
@@ -1003,7 +1001,7 @@ type `ebrowse-hs' is set to the resulting obarray."
 
 
 (defun ebrowse-member-table (header)
-  "Return the member obarray.  Build it it hasn't been set up yet.
+  "Return the member obarray.  Build it if it hasn't been set up yet.
 HEADER is the tree header structure of the class tree."
   (when (null (ebrowse-hs-member-table header))
     (loop for buffer in (ebrowse-browser-buffer-list)
@@ -1139,6 +1137,7 @@ Tree mode key bindings:
 
     (kill-all-local-variables)
     (use-local-map ebrowse-tree-mode-map)
+    (buffer-disable-undo)
 
     (unless (zerop (buffer-size))
       (goto-char (point-min))
@@ -1148,15 +1147,15 @@ Tree mode key bindings:
       (erase-buffer)
       (message nil))
 
-    (mapcar 'make-local-variable
-           '(ebrowse--tags-file-name
-             ebrowse--indentation
-             ebrowse--tree
-             ebrowse--header
-             ebrowse--show-file-names-flag
-             ebrowse--frozen-flag
-             ebrowse--tree-obarray
-             revert-buffer-function))
+    (mapc 'make-local-variable
+         '(ebrowse--tags-file-name
+           ebrowse--indentation
+           ebrowse--tree
+           ebrowse--header
+           ebrowse--show-file-names-flag
+           ebrowse--frozen-flag
+           ebrowse--tree-obarray
+           revert-buffer-function))
 
     (setf ebrowse--show-file-names-flag nil
          ebrowse--tree-obarray (make-vector 127 0)
@@ -1613,21 +1612,6 @@ and (b) in the directories named in `ebrowse-search-path'."
     file-name))
 
 
-(defun ebrowse-view-file-other-window (file)
-  "View a file FILE in another window.
-This is a replacement for `view-file-other-window' which does not
-seem to work. It should be removed when `view.el' is fixed."
-  (interactive)
-  (let ((old-arrangement (current-window-configuration))
-       (had-a-buf (get-file-buffer file))
-       (buf-to-view (find-file-noselect file)))
-    (switch-to-buffer-other-window buf-to-view)
-    (view-mode-enter old-arrangement
-                    (and (not had-a-buf)
-                         (not (buffer-modified-p buf-to-view))
-                         'kill-buffer))))
-
-
 (defun ebrowse-view-exit-fn (buffer)
   "Function called when exiting View mode in BUFFER.
 Restore frame configuration active before viewing the file,
@@ -1638,20 +1622,19 @@ and possibly kill the viewed buffer."
       (setq original-frame-configuration ebrowse--frame-configuration
            exit-action ebrowse--view-exit-action))
     ;; Delete the frame in which we viewed.
-    (mapcar 'delete-frame
-           (loop for frame in (frame-list)
-                 when (not (assq frame original-frame-configuration))
-                 collect frame))
+    (mapc 'delete-frame
+         (loop for frame in (frame-list)
+            when (not (assq frame original-frame-configuration))
+            collect frame))
     (when exit-action
       (funcall exit-action buffer))))
 
 
 (defun ebrowse-view-file-other-frame (file)
   "View a file FILE in another frame.
-The new frame is deleted when it is no longer used."
+The new frame is deleted when you quit viewing the file in that frame."
   (interactive)
   (let ((old-frame-configuration (current-frame-configuration))
-       (old-arrangement (current-window-configuration))
        (had-a-buf (get-file-buffer file))
        (buf-to-view (find-file-noselect file)))
     (switch-to-buffer-other-frame buf-to-view)
@@ -1662,8 +1645,8 @@ The new frame is deleted when it is no longer used."
          (and (not had-a-buf)
               (not (buffer-modified-p buf-to-view))
               'kill-buffer))
-    (view-mode-enter old-arrangement 'ebrowse-view-exit-fn)))
-
+    (view-mode-enter (cons (selected-window) (cons (selected-window) t))
+                    'ebrowse-view-exit-fn)))
 
 (defun ebrowse-view/find-file-and-search-pattern
   (struc info file tags-file-name &optional view where)
@@ -1698,7 +1681,7 @@ specifies where to find/view the result."
           (setq view-mode-hook nil))
         (push 'ebrowse-find-pattern view-mode-hook)
         (case where
-          (other-window (ebrowse-view-file-other-window file))
+          (other-window (view-file-other-window file))
           (other-frame  (ebrowse-view-file-other-frame file))
           (t            (view-file file))))
        (t
@@ -2256,28 +2239,28 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
   (kill-all-local-variables)
   (use-local-map ebrowse-member-mode-map)
   (setq major-mode 'ebrowse-member-mode)
-  (mapcar 'make-local-variable
-         '(ebrowse--decl-column        ;display column
-           ebrowse--n-columns          ;number of short columns
-           ebrowse--column-width       ;width of columns above
-           ebrowse--show-inherited-flag ;include inherited members?
-           ebrowse--filters            ;public, protected, private
-           ebrowse--accessor           ;vars, functions, friends
-           ebrowse--displayed-class    ;class displayed
-           ebrowse--long-display-flag  ;display with regexps?
-           ebrowse--source-regexp-flag ;show source regexp?
-           ebrowse--attributes-flag    ;show `virtual' and `inline'
-           ebrowse--member-list        ;list of members displayed
-           ebrowse--tree               ;the class tree
-           ebrowse--member-mode-strings ;part of mode line
-           ebrowse--tags-file-name     ;
-           ebrowse--header
-           ebrowse--tree-obarray
-           ebrowse--virtual-display-flag
-           ebrowse--inline-display-flag
-           ebrowse--const-display-flag
-           ebrowse--pure-display-flag
-           ebrowse--frozen-flag))      ;buffer not automagically reused
+  (mapc 'make-local-variable
+       '(ebrowse--decl-column          ;display column
+         ebrowse--n-columns            ;number of short columns
+         ebrowse--column-width         ;width of columns above
+         ebrowse--show-inherited-flag  ;include inherited members?
+         ebrowse--filters              ;public, protected, private
+         ebrowse--accessor             ;vars, functions, friends
+         ebrowse--displayed-class      ;class displayed
+         ebrowse--long-display-flag    ;display with regexps?
+         ebrowse--source-regexp-flag   ;show source regexp?
+         ebrowse--attributes-flag      ;show `virtual' and `inline'
+         ebrowse--member-list          ;list of members displayed
+         ebrowse--tree                 ;the class tree
+         ebrowse--member-mode-strings  ;part of mode line
+         ebrowse--tags-file-name       ;
+         ebrowse--header
+         ebrowse--tree-obarray
+         ebrowse--virtual-display-flag
+         ebrowse--inline-display-flag
+         ebrowse--const-display-flag
+         ebrowse--pure-display-flag
+         ebrowse--frozen-flag))        ;buffer not automagically reused
   (setq mode-name "Ebrowse-Members"
        mode-line-buffer-identification
        (propertized-buffer-identification "C++ Members")
@@ -3598,7 +3581,7 @@ The file name is read from the minibuffer."
 
 
 (defun* ebrowse-draw-file-member-info (info &optional (kind ""))
-  "Display a line in an the members per file info buffer.
+  "Display a line in the members info buffer.
 INFO describes the member.  It has the form (TREE ACCESSOR MEMBER).
 TREE is the class of the member to display.
 ACCESSOR is the accessor symbol of its member list.
@@ -4148,7 +4131,7 @@ Otherwise, FILE-NAME specifies the file to save the tree in."
          (erase-buffer)
          (setf (ebrowse-hs-member-table header) nil)
          (insert (prin1-to-string header) " ")
-         (mapcar 'ebrowse-save-class tree)
+         (mapc 'ebrowse-save-class tree)
          (write-file file-name)
          (message "Tree written to file `%s'" file-name))
       (kill-buffer temp-buffer)
@@ -4163,7 +4146,7 @@ Otherwise, FILE-NAME specifies the file to save the tree in."
   (insert "[ebrowse-ts ")
   (prin1 (ebrowse-ts-class class))     ;class name
   (insert "(")                         ;list of subclasses
-  (mapcar 'ebrowse-save-class (ebrowse-ts-subclasses class))
+  (mapc 'ebrowse-save-class (ebrowse-ts-subclasses class))
   (insert ")")
   (dolist (func ebrowse-member-list-accessors)
     (prin1 (funcall func class))
@@ -4513,5 +4496,5 @@ EVENT is the mouse event."
 ;;; eval:(put 'ebrowse-for-all-trees 'lisp-indent-hook 1)
 ;;; End:
 
-;;; arch-tag: 4fa3c8bf-1771-479b-bcd7-b029c7c9677b
+;; arch-tag: 4fa3c8bf-1771-479b-bcd7-b029c7c9677b
 ;;; ebrowse.el ends here