diff options
| author | Juri Linkov | 2009-07-18 21:01:49 +0000 |
|---|---|---|
| committer | Juri Linkov | 2009-07-18 21:01:49 +0000 |
| commit | fcdd8562cd8e75d9166799664f3e1af3ab78b74f (patch) | |
| tree | 88434592061a925080d1898a0f3cdcfa05002b32 | |
| parent | c82f92a0fdb3834d8a2bf690fa68ee34de46fcd1 (diff) | |
| download | emacs-fcdd8562cd8e75d9166799664f3e1af3ab78b74f.tar.gz emacs-fcdd8562cd8e75d9166799664f3e1af3ab78b74f.zip | |
Virtual Info keyword finder.
(add-to-list)<Info-virtual-files>: Add "\\`\\*Finder.*\\*\\'".
(Info-finder-file): New variable.
(Info-finder-find-file): New function.
(finder-known-keywords, finder-package-info)
(find-library-name, lm-commentary): Use defvar and
declare-function to silence compiler warnings.
(Info-finder-find-node): New function.
(info-finder): New command.
| -rw-r--r-- | lisp/info.el | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/lisp/info.el b/lisp/info.el index af4e0b141bd..be61127176c 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -3323,6 +3323,88 @@ Build a menu of the possible matches." | |||
| 3323 | Info-apropos-nodes) | 3323 | Info-apropos-nodes) |
| 3324 | (Info-find-node Info-apropos-file nodename))))) | 3324 | (Info-find-node Info-apropos-file nodename))))) |
| 3325 | 3325 | ||
| 3326 | (add-to-list 'Info-virtual-files | ||
| 3327 | '("\\`\\*Finder.*\\*\\'" | ||
| 3328 | (find-file . Info-finder-find-file) | ||
| 3329 | (find-node . Info-finder-find-node) | ||
| 3330 | )) | ||
| 3331 | |||
| 3332 | (defvar Info-finder-file "*Finder*" | ||
| 3333 | "Info file name of the virtual Info keyword finder manual.") | ||
| 3334 | |||
| 3335 | (defun Info-finder-find-file (filename &optional noerror) | ||
| 3336 | "Finder-specific implementation of Info-find-file." | ||
| 3337 | filename) | ||
| 3338 | |||
| 3339 | (defvar finder-known-keywords) | ||
| 3340 | (defvar finder-package-info) | ||
| 3341 | (declare-function find-library-name "find-func" (library)) | ||
| 3342 | (declare-function lm-commentary "lisp-mnt" (&optional file)) | ||
| 3343 | |||
| 3344 | (defun Info-finder-find-node (filename nodename &optional no-going-back) | ||
| 3345 | "Finder-specific implementation of Info-find-node-2." | ||
| 3346 | (cond | ||
| 3347 | ((equal nodename "Top") | ||
| 3348 | ;; Display Top menu with descriptions of the keywords | ||
| 3349 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: (dir)\n\n" | ||
| 3350 | Info-finder-file nodename)) | ||
| 3351 | (insert "Finder Keywords\n") | ||
| 3352 | (insert "***************\n\n") | ||
| 3353 | (insert "* Menu:\n\n") | ||
| 3354 | (mapc | ||
| 3355 | (lambda (assoc) | ||
| 3356 | (let ((keyword (car assoc))) | ||
| 3357 | (insert (format "* %-14s %s.\n" | ||
| 3358 | (concat (symbol-name keyword) "::") | ||
| 3359 | (cdr assoc))))) | ||
| 3360 | finder-known-keywords)) | ||
| 3361 | ((string-match-p "\\.el\\'" nodename) | ||
| 3362 | ;; Display commentary section | ||
| 3363 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" | ||
| 3364 | Info-finder-file nodename)) | ||
| 3365 | (insert "Finder Commentary\n") | ||
| 3366 | (insert "*****************\n\n") | ||
| 3367 | (insert | ||
| 3368 | "Commentary section of the package `" nodename "':\n\n") | ||
| 3369 | (let ((str (lm-commentary (find-library-name nodename)))) | ||
| 3370 | (if (null str) | ||
| 3371 | (insert "Can't find any Commentary section\n\n") | ||
| 3372 | (insert | ||
| 3373 | (with-temp-buffer | ||
| 3374 | (insert str) | ||
| 3375 | (goto-char (point-min)) | ||
| 3376 | (delete-blank-lines) | ||
| 3377 | (goto-char (point-max)) | ||
| 3378 | (delete-blank-lines) | ||
| 3379 | (goto-char (point-min)) | ||
| 3380 | (while (re-search-forward "^;+ ?" nil t) | ||
| 3381 | (replace-match "" nil nil)) | ||
| 3382 | (buffer-string)))))) | ||
| 3383 | (t | ||
| 3384 | ;; Display packages that match the keyword | ||
| 3385 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" | ||
| 3386 | Info-finder-file nodename)) | ||
| 3387 | (insert "Finder Packages\n") | ||
| 3388 | (insert "***************\n\n") | ||
| 3389 | (insert | ||
| 3390 | "The following packages match the keyword `" nodename "':\n\n") | ||
| 3391 | (insert "* Menu:\n\n") | ||
| 3392 | (let ((id (intern nodename))) | ||
| 3393 | (mapc | ||
| 3394 | (lambda (x) | ||
| 3395 | (when (memq id (cadr (cdr x))) | ||
| 3396 | (insert (format "* %-16s %s.\n" | ||
| 3397 | (concat (car x) "::") | ||
| 3398 | (cadr x))))) | ||
| 3399 | finder-package-info))))) | ||
| 3400 | |||
| 3401 | ;;;###autoload | ||
| 3402 | (defun info-finder () | ||
| 3403 | "Display descriptions of the keywords in the Finder virtual manual." | ||
| 3404 | (interactive) | ||
| 3405 | (require 'finder) | ||
| 3406 | (Info-find-node Info-finder-file "Top")) | ||
| 3407 | |||
| 3326 | (defun Info-undefined () | 3408 | (defun Info-undefined () |
| 3327 | "Make command be undefined in Info." | 3409 | "Make command be undefined in Info." |
| 3328 | (interactive) | 3410 | (interactive) |