comparison 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
comparison
equal deleted inserted replaced
18225:8c99057ec07a 18226:37ff8dfff53b
170 (apply 'insert strings)) 170 (apply 'insert strings))
171 171
172 (defun finder-list-keywords () 172 (defun finder-list-keywords ()
173 "Display descriptions of the keywords in the Finder buffer." 173 "Display descriptions of the keywords in the Finder buffer."
174 (interactive) 174 (interactive)
175 (setq buffer-read-only nil) 175 (if (get-buffer "*Finder*")
176 (erase-buffer) 176 (pop-to-buffer "*Finder*")
177 (mapcar 177 (pop-to-buffer (set-buffer "*Finder*"))
178 (lambda (assoc) 178 (finder-mode)
179 (let ((keyword (car assoc))) 179 (setq buffer-read-only nil)
180 (insert (symbol-name keyword)) 180 (erase-buffer)
181 (finder-insert-at-column 14 (concat (cdr assoc) "\n")) 181 (mapcar
182 (cons (symbol-name keyword) keyword))) 182 (lambda (assoc)
183 finder-known-keywords) 183 (let ((keyword (car assoc)))
184 (goto-char (point-min)) 184 (insert (symbol-name keyword))
185 (setq finder-headmark (point)) 185 (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
186 (setq buffer-read-only t) 186 (cons (symbol-name keyword) keyword)))
187 (set-buffer-modified-p nil) 187 finder-known-keywords)
188 (balance-windows) 188 (goto-char (point-min))
189 (finder-summary)) 189 (setq finder-headmark (point))
190 (setq buffer-read-only t)
191 (set-buffer-modified-p nil)
192 (balance-windows)
193 (finder-summary)))
190 194
191 (defun finder-list-matches (key) 195 (defun finder-list-matches (key)
196 (pop-to-buffer (set-buffer "*Finder Category*"))
197 (finder-mode)
192 (setq buffer-read-only nil) 198 (setq buffer-read-only nil)
193 (erase-buffer) 199 (erase-buffer)
194 (let ((id (intern key))) 200 (let ((id (intern key)))
195 (insert 201 (insert
196 "The following packages match the keyword `" key "':\n\n") 202 "The following packages match the keyword `" key "':\n\n")
260 (finder-list-matches key)))) 266 (finder-list-matches key))))
261 267
262 (defun finder-by-keyword () 268 (defun finder-by-keyword ()
263 "Find packages matching a given keyword." 269 "Find packages matching a given keyword."
264 (interactive) 270 (interactive)
265 (finder-mode)
266 (finder-list-keywords)) 271 (finder-list-keywords))
267 272
268 (defun finder-mode () 273 (defun finder-mode ()
269 "Major mode for browsing package documentation. 274 "Major mode for browsing package documentation.
270 \\<finder-mode-map> 275 \\<finder-mode-map>
271 \\[finder-select] more help for the item on the current line 276 \\[finder-select] more help for the item on the current line
272 \\[finder-exit] exit Finder mode and kill the Finder buffer. 277 \\[finder-exit] exit Finder mode and kill the Finder buffer.
273 " 278 "
274 (interactive) 279 (interactive)
275 (pop-to-buffer "*Finder*")
276 (setq buffer-read-only nil)
277 (erase-buffer)
278 (use-local-map finder-mode-map) 280 (use-local-map finder-mode-map)
279 (set-syntax-table emacs-lisp-mode-syntax-table) 281 (set-syntax-table emacs-lisp-mode-syntax-table)
280 (setq mode-name "Finder") 282 (setq mode-name "Finder")
281 (setq major-mode 'finder-mode) 283 (setq major-mode 'finder-mode)
282 (make-local-variable 'finder-headmark) 284 (make-local-variable 'finder-headmark)