diff options
| -rw-r--r-- | lisp/finder.el | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/lisp/finder.el b/lisp/finder.el index 652f29cc9d1..7d638bd4edd 100644 --- a/lisp/finder.el +++ b/lisp/finder.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; finder.el --- topic & keyword-based code finder | 1 | ;;; finder.el --- topic & keyword-based code finder |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1992, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | 5 | ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> |
| 6 | ;; Created: 16 Jun 1992 | 6 | ;; Created: 16 Jun 1992 |
| @@ -168,20 +168,19 @@ arguments compiles from `load-path'." | |||
| 168 | ;;; Now the retrieval code | 168 | ;;; Now the retrieval code |
| 169 | 169 | ||
| 170 | (defun finder-insert-at-column (column &rest strings) | 170 | (defun finder-insert-at-column (column &rest strings) |
| 171 | "Insert list of STRINGS, at column COLUMN." | 171 | "Insert, at column COLUMN, other args STRINGS." |
| 172 | (if (> (current-column) column) (insert "\n")) | 172 | (if (> (current-column) column) (insert "\n")) |
| 173 | (move-to-column column) | 173 | (move-to-column column t) |
| 174 | (let ((col (current-column))) | ||
| 175 | (if (< col column) | ||
| 176 | (indent-to column) | ||
| 177 | (if (and (/= col column) | ||
| 178 | (= (preceding-char) ?\t)) | ||
| 179 | (let (indent-tabs-mode) | ||
| 180 | (delete-char -1) | ||
| 181 | (indent-to col) | ||
| 182 | (move-to-column column))))) | ||
| 183 | (apply 'insert strings)) | 174 | (apply 'insert strings)) |
| 184 | 175 | ||
| 176 | (defun finder-mouse-face-on-line () | ||
| 177 | "Put a `mouse-face' property on the previous line." | ||
| 178 | (save-excursion | ||
| 179 | (previous-line 1) | ||
| 180 | (put-text-property (save-excursion (beginning-of-line) (point)) | ||
| 181 | (progn (end-of-line) (point)) | ||
| 182 | 'mouse-face 'highlight))) | ||
| 183 | |||
| 185 | (defun finder-list-keywords () | 184 | (defun finder-list-keywords () |
| 186 | "Display descriptions of the keywords in the Finder buffer." | 185 | "Display descriptions of the keywords in the Finder buffer." |
| 187 | (interactive) | 186 | (interactive) |
| @@ -196,7 +195,7 @@ arguments compiles from `load-path'." | |||
| 196 | (let ((keyword (car assoc))) | 195 | (let ((keyword (car assoc))) |
| 197 | (insert (symbol-name keyword)) | 196 | (insert (symbol-name keyword)) |
| 198 | (finder-insert-at-column 14 (concat (cdr assoc) "\n")) | 197 | (finder-insert-at-column 14 (concat (cdr assoc) "\n")) |
| 199 | (cons (symbol-name keyword) keyword))) | 198 | (finder-mouse-face-on-line))) |
| 200 | finder-known-keywords) | 199 | finder-known-keywords) |
| 201 | (goto-char (point-min)) | 200 | (goto-char (point-min)) |
| 202 | (setq finder-headmark (point)) | 201 | (setq finder-headmark (point)) |
| @@ -219,7 +218,8 @@ arguments compiles from `load-path'." | |||
| 219 | (if (memq id (car (cdr (cdr x)))) | 218 | (if (memq id (car (cdr (cdr x)))) |
| 220 | (progn | 219 | (progn |
| 221 | (insert (car x)) | 220 | (insert (car x)) |
| 222 | (finder-insert-at-column 16 (concat (car (cdr x)) "\n"))))) | 221 | (finder-insert-at-column 16 (concat (nth 1 x) "\n")) |
| 222 | (finder-mouse-face-on-line)))) | ||
| 223 | finder-package-info) | 223 | finder-package-info) |
| 224 | (goto-char (point-min)) | 224 | (goto-char (point-min)) |
| 225 | (forward-line) | 225 | (forward-line) |
| @@ -239,6 +239,7 @@ arguments compiles from `load-path'." | |||
| 239 | (locate-library (concat library "z")))))) | 239 | (locate-library (concat library "z")))))) |
| 240 | 240 | ||
| 241 | (defun finder-commentary (file) | 241 | (defun finder-commentary (file) |
| 242 | "Display FILE's commentary section." | ||
| 242 | (interactive) | 243 | (interactive) |
| 243 | (let* ((str (lm-commentary (finder-find-library file)))) | 244 | (let* ((str (lm-commentary (finder-find-library file)))) |
| 244 | (if (null str) | 245 | (if (null str) |
| @@ -268,6 +269,7 @@ arguments compiles from `load-path'." | |||
| 268 | (current-word)))) | 269 | (current-word)))) |
| 269 | 270 | ||
| 270 | (defun finder-select () | 271 | (defun finder-select () |
| 272 | "Select item on current line in a finder buffer." | ||
| 271 | (interactive) | 273 | (interactive) |
| 272 | (let ((key (finder-current-item))) | 274 | (let ((key (finder-current-item))) |
| 273 | (if (string-match "\\.el$" key) | 275 | (if (string-match "\\.el$" key) |
| @@ -275,12 +277,12 @@ arguments compiles from `load-path'." | |||
| 275 | (finder-list-matches key)))) | 277 | (finder-list-matches key)))) |
| 276 | 278 | ||
| 277 | (defun finder-mouse-select (event) | 279 | (defun finder-mouse-select (event) |
| 280 | "Select item in a finder buffer with the mouse." | ||
| 278 | (interactive "e") | 281 | (interactive "e") |
| 279 | (save-excursion | 282 | (save-excursion |
| 280 | (set-buffer (window-buffer (posn-window (event-start event)))) | 283 | (set-buffer (window-buffer (posn-window (event-start event)))) |
| 281 | (goto-char (posn-point (event-start event))) | 284 | (goto-char (posn-point (event-start event))) |
| 282 | (let ((key (finder-current-item))) | 285 | (finder-select))) |
| 283 | (finder-select)))) | ||
| 284 | 286 | ||
| 285 | (defun finder-by-keyword () | 287 | (defun finder-by-keyword () |
| 286 | "Find packages matching a given keyword." | 288 | "Find packages matching a given keyword." |
| @@ -306,7 +308,9 @@ arguments compiles from `load-path'." | |||
| 306 | (interactive) | 308 | (interactive) |
| 307 | (message "%s" | 309 | (message "%s" |
| 308 | (substitute-command-keys | 310 | (substitute-command-keys |
| 309 | "\\<finder-mode-map>\\[finder-select] = select, \\[finder-mouse-select] = select, \\[finder-list-keywords] = to finder directory, \\[finder-exit] = quit, \\[finder-summary] = help"))) | 311 | "\\<finder-mode-map>\\[finder-select] = select, \ |
| 312 | \\[finder-mouse-select] = select, \\[finder-list-keywords] = to \ | ||
| 313 | finder directory, \\[finder-exit] = quit, \\[finder-summary] = help"))) | ||
| 310 | 314 | ||
| 311 | (defun finder-exit () | 315 | (defun finder-exit () |
| 312 | "Exit Finder mode and kill the buffer." | 316 | "Exit Finder mode and kill the buffer." |