diff lisp/finder.el @ 18226:37ff8dfff53b

(finder-mode): Don't switch buffers or change text here. (finder-by-keyword): Don't call finder-mode here. (finder-list-matches): Call finder-mode here. Switch to a buffer called *Finder Category*. (finder-list-keywords): Call finder-mode here. Switch to the buffer *Finder*. If the buffer already exists, don't reinitialize it or move point.
author Richard M. Stallman <rms@gnu.org>
date Thu, 12 Jun 1997 03:51:53 +0000
parents ae0f1e4a63be
children 21a40db838e2
line wrap: on
line diff
--- a/lisp/finder.el	Thu Jun 12 02:52:57 1997 +0000
+++ b/lisp/finder.el	Thu Jun 12 03:51:53 1997 +0000
@@ -172,23 +172,29 @@
 (defun finder-list-keywords ()
   "Display descriptions of the keywords in the Finder buffer."
   (interactive)
-  (setq buffer-read-only nil)
-  (erase-buffer)
-  (mapcar
-   (lambda (assoc)
-     (let ((keyword (car assoc)))
-       (insert (symbol-name keyword))
-       (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
-       (cons (symbol-name keyword) keyword)))
-   finder-known-keywords)
-  (goto-char (point-min))
-  (setq finder-headmark (point))
-  (setq buffer-read-only t)
-  (set-buffer-modified-p nil)
-  (balance-windows)
-  (finder-summary))
+  (if (get-buffer "*Finder*")
+      (pop-to-buffer "*Finder*")
+    (pop-to-buffer (set-buffer "*Finder*"))
+    (finder-mode)
+    (setq buffer-read-only nil)
+    (erase-buffer)
+    (mapcar
+     (lambda (assoc)
+       (let ((keyword (car assoc)))
+	 (insert (symbol-name keyword))
+	 (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
+	 (cons (symbol-name keyword) keyword)))
+     finder-known-keywords)
+    (goto-char (point-min))
+    (setq finder-headmark (point))
+    (setq buffer-read-only t)
+    (set-buffer-modified-p nil)
+    (balance-windows)
+    (finder-summary)))
 
 (defun finder-list-matches (key)
+  (pop-to-buffer (set-buffer "*Finder Category*"))
+  (finder-mode)
   (setq buffer-read-only nil)
   (erase-buffer)
   (let ((id (intern key)))
@@ -262,7 +268,6 @@
 (defun finder-by-keyword ()
   "Find packages matching a given keyword."
   (interactive)
-  (finder-mode)
   (finder-list-keywords))
 
 (defun finder-mode ()
@@ -272,9 +277,6 @@
 \\[finder-exit]	exit Finder mode and kill the Finder buffer.
 "
   (interactive)
-  (pop-to-buffer "*Finder*")
-  (setq buffer-read-only nil)
-  (erase-buffer)
   (use-local-map finder-mode-map)
   (set-syntax-table emacs-lisp-mode-syntax-table)
   (setq mode-name "Finder")