diff options
| author | Glenn Morris | 2008-06-10 03:06:30 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-06-10 03:06:30 +0000 |
| commit | 54e05660ef311cc8d98e831c20834845c2d77e78 (patch) | |
| tree | c859db386e98bda1ac163a61de0ffa556202f185 | |
| parent | 1d69bd9baabc358cf979aa92fd9f1e6072a0fbf3 (diff) | |
| download | emacs-54e05660ef311cc8d98e831c20834845c2d77e78.tar.gz emacs-54e05660ef311cc8d98e831c20834845c2d77e78.zip | |
(finder-font-lock-keywords): Handle ``quotes''.
(finder-compile-keywords): Move let to where needed.
(finder-mouse-face-on-line): Go back one more line if needed.
(finder-list-matches): Use cadr.
(finder-goto-xref): New function.
(finder-commentary): Add buttons to jump to foo.el libraries.
| -rw-r--r-- | lisp/finder.el | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/lisp/finder.el b/lisp/finder.el index 3db4cb6df51..bf3caeb014e 100644 --- a/lisp/finder.el +++ b/lisp/finder.el | |||
| @@ -109,7 +109,7 @@ | |||
| 109 | "Syntax table used while in `finder-mode'.") | 109 | "Syntax table used while in `finder-mode'.") |
| 110 | 110 | ||
| 111 | (defvar finder-font-lock-keywords | 111 | (defvar finder-font-lock-keywords |
| 112 | '(("`\\([^']+\\)'" 1 font-lock-constant-face prepend)) | 112 | '(("`\\([^'`]+\\)'" 1 font-lock-constant-face prepend)) |
| 113 | "Font-lock keywords for Finder mode.") | 113 | "Font-lock keywords for Finder mode.") |
| 114 | 114 | ||
| 115 | (defvar finder-headmark nil | 115 | (defvar finder-headmark nil |
| @@ -138,14 +138,14 @@ finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)" | |||
| 138 | Optional arguments DIRS are a list of Emacs Lisp directories to compile from; | 138 | Optional arguments DIRS are a list of Emacs Lisp directories to compile from; |
| 139 | no arguments compiles from `load-path'." | 139 | no arguments compiles from `load-path'." |
| 140 | (save-excursion | 140 | (save-excursion |
| 141 | (find-file generated-finder-keywords-file) | ||
| 142 | (setq buffer-undo-list t) | ||
| 143 | (erase-buffer) | ||
| 144 | (insert (autoload-rubric generated-finder-keywords-file | ||
| 145 | "keyword-to-package mapping")) | ||
| 146 | (search-backward "") | ||
| 147 | (insert "(setq finder-package-info '(\n") | ||
| 141 | (let (processed summary keywords) | 148 | (let (processed summary keywords) |
| 142 | (find-file generated-finder-keywords-file) | ||
| 143 | (setq buffer-undo-list t) | ||
| 144 | (erase-buffer) | ||
| 145 | (insert (autoload-rubric generated-finder-keywords-file | ||
| 146 | "keyword-to-package mapping")) | ||
| 147 | (search-backward "") | ||
| 148 | (insert "(setq finder-package-info '(\n") | ||
| 149 | (mapc | 149 | (mapc |
| 150 | (lambda (d) | 150 | (lambda (d) |
| 151 | (when (file-exists-p (directory-file-name d)) | 151 | (when (file-exists-p (directory-file-name d)) |
| @@ -175,10 +175,10 @@ no arguments compiles from `load-path'." | |||
| 175 | ;; MS-DOG-type filenames. | 175 | ;; MS-DOG-type filenames. |
| 176 | "^[^=].*\\.el\\(\\.\\(gz\\|Z\\)\\)?$" | 176 | "^[^=].*\\.el\\(\\.\\(gz\\|Z\\)\\)?$" |
| 177 | )))) | 177 | )))) |
| 178 | (or dirs load-path)) | 178 | (or dirs load-path))) |
| 179 | (insert " ))\n") | 179 | (insert " ))\n") |
| 180 | (eval-buffer) ; so we get the new keyword list immediately | 180 | (eval-buffer) ; so we get the new keyword list immediately |
| 181 | (basic-save-buffer)))) | 181 | (basic-save-buffer))) |
| 182 | 182 | ||
| 183 | (defun finder-compile-keywords-make-dist () | 183 | (defun finder-compile-keywords-make-dist () |
| 184 | "Regenerate `finder-inf.el' for the Emacs distribution." | 184 | "Regenerate `finder-inf.el' for the Emacs distribution." |
| @@ -199,6 +199,8 @@ no arguments compiles from `load-path'." | |||
| 199 | "Put `mouse-face' and `help-echo' properties on the previous line." | 199 | "Put `mouse-face' and `help-echo' properties on the previous line." |
| 200 | (save-excursion | 200 | (save-excursion |
| 201 | (forward-line -1) | 201 | (forward-line -1) |
| 202 | ;; If finder-insert-at-column moved us to a new line, go back one more. | ||
| 203 | (if (looking-at "[ \t]") (forward-line -1)) | ||
| 202 | (unless finder-help-echo | 204 | (unless finder-help-echo |
| 203 | (setq finder-help-echo | 205 | (setq finder-help-echo |
| 204 | (let* ((keys1 (where-is-internal 'finder-select | 206 | (let* ((keys1 (where-is-internal 'finder-select |
| @@ -250,11 +252,10 @@ no arguments compiles from `load-path'." | |||
| 250 | (setq finder-headmark (point)) | 252 | (setq finder-headmark (point)) |
| 251 | (mapc | 253 | (mapc |
| 252 | (lambda (x) | 254 | (lambda (x) |
| 253 | (if (memq id (car (cdr (cdr x)))) | 255 | (when (memq id (cadr (cdr x))) |
| 254 | (progn | 256 | (insert (car x)) |
| 255 | (insert (car x)) | 257 | (finder-insert-at-column 16 (concat (cadr x) "\n")) |
| 256 | (finder-insert-at-column 16 (concat (nth 1 x) "\n")) | 258 | (finder-mouse-face-on-line))) |
| 257 | (finder-mouse-face-on-line)))) | ||
| 258 | finder-package-info) | 259 | finder-package-info) |
| 259 | (goto-char (point-min)) | 260 | (goto-char (point-min)) |
| 260 | (forward-line) | 261 | (forward-line) |
| @@ -263,6 +264,15 @@ no arguments compiles from `load-path'." | |||
| 263 | (shrink-window-if-larger-than-buffer) | 264 | (shrink-window-if-larger-than-buffer) |
| 264 | (finder-summary))) | 265 | (finder-summary))) |
| 265 | 266 | ||
| 267 | (define-button-type 'finder-xref 'action #'finder-goto-xref) | ||
| 268 | |||
| 269 | (defun finder-goto-xref (button) | ||
| 270 | "Jump to a lisp file for the BUTTON at point." | ||
| 271 | (let* ((file (button-get button 'xref)) | ||
| 272 | (lib (locate-library file))) | ||
| 273 | (if lib (finder-commentary lib) | ||
| 274 | (message "Unable to locate `%s'" file)))) | ||
| 275 | |||
| 266 | ;;;###autoload | 276 | ;;;###autoload |
| 267 | (defun finder-commentary (file) | 277 | (defun finder-commentary (file) |
| 268 | "Display FILE's commentary section. | 278 | "Display FILE's commentary section. |
| @@ -291,6 +301,13 @@ FILE should be in a form suitable for passing to `locate-library'." | |||
| 291 | (while (re-search-forward "^;+ ?" nil t) | 301 | (while (re-search-forward "^;+ ?" nil t) |
| 292 | (replace-match "" nil nil)) | 302 | (replace-match "" nil nil)) |
| 293 | (goto-char (point-min)) | 303 | (goto-char (point-min)) |
| 304 | (while (re-search-forward "\\<\\([-[:alnum:]]+\\.el\\)\\>" nil t) | ||
| 305 | (if (locate-library (match-string 1)) | ||
| 306 | (make-text-button (match-beginning 1) (match-end 1) | ||
| 307 | 'xref (match-string-no-properties 1) | ||
| 308 | 'help-echo "Read this file's commentary" | ||
| 309 | :type 'finder-xref))) | ||
| 310 | (goto-char (point-min)) | ||
| 294 | (setq buffer-read-only t) | 311 | (setq buffer-read-only t) |
| 295 | (set-buffer-modified-p nil) | 312 | (set-buffer-modified-p nil) |
| 296 | (shrink-window-if-larger-than-buffer) | 313 | (shrink-window-if-larger-than-buffer) |