summaryrefslogtreecommitdiff
path: root/lisp/finder.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-06-10 03:06:30 +0000
committerGlenn Morris <rgm@gnu.org>2008-06-10 03:06:30 +0000
commit54e05660ef311cc8d98e831c20834845c2d77e78 (patch)
treec859db386e98bda1ac163a61de0ffa556202f185 /lisp/finder.el
parent1d69bd9baabc358cf979aa92fd9f1e6072a0fbf3 (diff)
downloademacs-54e05660ef311cc8d98e831c20834845c2d77e78.tar.gz
(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.
Diffstat (limited to 'lisp/finder.el')
-rw-r--r--lisp/finder.el51
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 @@
"Syntax table used while in `finder-mode'.")
(defvar finder-font-lock-keywords
- '(("`\\([^']+\\)'" 1 font-lock-constant-face prepend))
+ '(("`\\([^'`]+\\)'" 1 font-lock-constant-face prepend))
"Font-lock keywords for Finder mode.")
(defvar finder-headmark nil
@@ -138,14 +138,14 @@ finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)"
Optional arguments DIRS are a list of Emacs Lisp directories to compile from;
no arguments compiles from `load-path'."
(save-excursion
+ (find-file generated-finder-keywords-file)
+ (setq buffer-undo-list t)
+ (erase-buffer)
+ (insert (autoload-rubric generated-finder-keywords-file
+ "keyword-to-package mapping"))
+ (search-backward " ")
+ (insert "(setq finder-package-info '(\n")
(let (processed summary keywords)
- (find-file generated-finder-keywords-file)
- (setq buffer-undo-list t)
- (erase-buffer)
- (insert (autoload-rubric generated-finder-keywords-file
- "keyword-to-package mapping"))
- (search-backward " ")
- (insert "(setq finder-package-info '(\n")
(mapc
(lambda (d)
(when (file-exists-p (directory-file-name d))
@@ -175,10 +175,10 @@ no arguments compiles from `load-path'."
;; MS-DOG-type filenames.
"^[^=].*\\.el\\(\\.\\(gz\\|Z\\)\\)?$"
))))
- (or dirs load-path))
- (insert " ))\n")
- (eval-buffer) ; so we get the new keyword list immediately
- (basic-save-buffer))))
+ (or dirs load-path)))
+ (insert " ))\n")
+ (eval-buffer) ; so we get the new keyword list immediately
+ (basic-save-buffer)))
(defun finder-compile-keywords-make-dist ()
"Regenerate `finder-inf.el' for the Emacs distribution."
@@ -199,6 +199,8 @@ no arguments compiles from `load-path'."
"Put `mouse-face' and `help-echo' properties on the previous line."
(save-excursion
(forward-line -1)
+ ;; If finder-insert-at-column moved us to a new line, go back one more.
+ (if (looking-at "[ \t]") (forward-line -1))
(unless finder-help-echo
(setq finder-help-echo
(let* ((keys1 (where-is-internal 'finder-select
@@ -250,11 +252,10 @@ no arguments compiles from `load-path'."
(setq finder-headmark (point))
(mapc
(lambda (x)
- (if (memq id (car (cdr (cdr x))))
- (progn
- (insert (car x))
- (finder-insert-at-column 16 (concat (nth 1 x) "\n"))
- (finder-mouse-face-on-line))))
+ (when (memq id (cadr (cdr x)))
+ (insert (car x))
+ (finder-insert-at-column 16 (concat (cadr x) "\n"))
+ (finder-mouse-face-on-line)))
finder-package-info)
(goto-char (point-min))
(forward-line)
@@ -263,6 +264,15 @@ no arguments compiles from `load-path'."
(shrink-window-if-larger-than-buffer)
(finder-summary)))
+(define-button-type 'finder-xref 'action #'finder-goto-xref)
+
+(defun finder-goto-xref (button)
+ "Jump to a lisp file for the BUTTON at point."
+ (let* ((file (button-get button 'xref))
+ (lib (locate-library file)))
+ (if lib (finder-commentary lib)
+ (message "Unable to locate `%s'" file))))
+
;;;###autoload
(defun finder-commentary (file)
"Display FILE's commentary section.
@@ -291,6 +301,13 @@ FILE should be in a form suitable for passing to `locate-library'."
(while (re-search-forward "^;+ ?" nil t)
(replace-match "" nil nil))
(goto-char (point-min))
+ (while (re-search-forward "\\<\\([-[:alnum:]]+\\.el\\)\\>" nil t)
+ (if (locate-library (match-string 1))
+ (make-text-button (match-beginning 1) (match-end 1)
+ 'xref (match-string-no-properties 1)
+ 'help-echo "Read this file's commentary"
+ :type 'finder-xref)))
+ (goto-char (point-min))
(setq buffer-read-only t)
(set-buffer-modified-p nil)
(shrink-window-if-larger-than-buffer)