diff options
| author | Richard M. Stallman | 1993-12-23 03:18:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-12-23 03:18:02 +0000 |
| commit | e660d0db20618a2ab33a9dbccc02a27fd41f2841 (patch) | |
| tree | bd3ead8b055e2828953657f409876fe7e503ee7e | |
| parent | 8a68f868d109b73e925318c822dc63c56a047c00 (diff) | |
| download | emacs-e660d0db20618a2ab33a9dbccc02a27fd41f2841.tar.gz emacs-e660d0db20618a2ab33a9dbccc02a27fd41f2841.zip | |
(Man-specified-section-option): Test system-configuration.
(Man-mode-hook): Renamed from Man-mode-hooks.
(Man-follow-manual-reference): Strip trailing - from default.
(Man-getpage-in-background): Use lower case for arg vars.
(Man-follow-manual-reference): Check for existence of references
before using the minibuffer. Delete period from error message.
Delete spurious concat call. Pass arg, not (consp arg),
to Man-getpage-in-background.
(Man-follow-manual-reference): Try to use current word
as a default for the reference to follow.
Use interactive to read the reference name.
| -rw-r--r-- | lisp/man.el | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/lisp/man.el b/lisp/man.el index a4bf961f389..06a708eb5ab 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -185,8 +185,8 @@ the manpage buffer.") | |||
| 185 | (defvar Man-mode-map nil | 185 | (defvar Man-mode-map nil |
| 186 | "*Keymap for Man mode.") | 186 | "*Keymap for Man mode.") |
| 187 | 187 | ||
| 188 | (defvar Man-mode-hooks nil | 188 | (defvar Man-mode-hook nil |
| 189 | "*Hooks for Man mode.") | 189 | "*Normal hook run when Man mode is enabled.") |
| 190 | 190 | ||
| 191 | (defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]" | 191 | (defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]" |
| 192 | "*Regular expression describing a manpage section within parentheses.") | 192 | "*Regular expression describing a manpage section within parentheses.") |
| @@ -212,10 +212,11 @@ This regular expression should start with a `^' character.") | |||
| 212 | ;; Would someone like to provide a good test for being on Solaris? | 212 | ;; Would someone like to provide a good test for being on Solaris? |
| 213 | ;; We could give it its own value of system-type, but that has drawbacks; | 213 | ;; We could give it its own value of system-type, but that has drawbacks; |
| 214 | ;; it would require changes in lots of places that test system-type. | 214 | ;; it would require changes in lots of places that test system-type. |
| 215 | (defvar Man-specified-section-option "" | 215 | (defvar Man-specified-section-option |
| 216 | "*Option that indicates a specified a manual section name. | 216 | (if (string-match "-solaris[0-9.]*$" system-configuration) |
| 217 | On most Unix systems, no option is needed for this. | 217 | "-s" |
| 218 | On Solaris, you need to set this to \"-s \".") | 218 | "") |
| 219 | "*Option that indicates a specified a manual section name.") | ||
| 219 | 220 | ||
| 220 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 221 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 221 | ;; end user variables | 222 | ;; end user variables |
| @@ -259,7 +260,7 @@ On Solaris, you need to set this to \"-s \".") | |||
| 259 | ;; utilities | 260 | ;; utilities |
| 260 | 261 | ||
| 261 | (defun Man-page-mode-string () | 262 | (defun Man-page-mode-string () |
| 262 | "Formats part of the mode line for manual mode." | 263 | "Formats part of the mode line for Man mode." |
| 263 | (format "%d (of %d)" Man-current-page (length Man-page-list))) | 264 | (format "%d (of %d)" Man-current-page (length Man-page-list))) |
| 264 | 265 | ||
| 265 | (defun Man-delete-trailing-newline (str) | 266 | (defun Man-delete-trailing-newline (str) |
| @@ -434,12 +435,12 @@ Universal argument ARG, is passed to `Man-getpage-in-background'." | |||
| 434 | (Man-getpage-in-background man-args (consp arg)) | 435 | (Man-getpage-in-background man-args (consp arg)) |
| 435 | )) | 436 | )) |
| 436 | 437 | ||
| 437 | (defun Man-getpage-in-background (TOPIC &optional override-reuse-p) | 438 | (defun Man-getpage-in-background (topic &optional override-reuse-p) |
| 438 | "Uses TOPIC to build and fire off the manpage and cleaning command. | 439 | "Uses TOPIC to build and fire off the manpage and cleaning command. |
| 439 | Optional OVERRIDE-REUSE-P, when non-nil, means to | 440 | Optional OVERRIDE-REUSE-P, when non-nil, means to |
| 440 | start a background process even if a buffer already exists and | 441 | start a background process even if a buffer already exists and |
| 441 | `Man-reuse-okay-p' is non-nil." | 442 | `Man-reuse-okay-p' is non-nil." |
| 442 | (let* ((man-args TOPIC) | 443 | (let* ((man-args topic) |
| 443 | (bufname (concat "*man " man-args "*")) | 444 | (bufname (concat "*man " man-args "*")) |
| 444 | (buffer (get-buffer bufname))) | 445 | (buffer (get-buffer bufname))) |
| 445 | (if (and Man-reuse-okay-p | 446 | (if (and Man-reuse-okay-p |
| @@ -563,9 +564,9 @@ Man-circular-pages-p Multiple manpage list treated as circular? | |||
| 563 | Man-auto-section-alist List of major modes and their section numbers. | 564 | Man-auto-section-alist List of major modes and their section numbers. |
| 564 | Man-section-translations-alist List of section numbers and their Un*x equiv. | 565 | Man-section-translations-alist List of section numbers and their Un*x equiv. |
| 565 | Man-filter-list Background manpage filter command. | 566 | Man-filter-list Background manpage filter command. |
| 566 | Man-mode-line-format Mode line format for Man-mode buffers. | 567 | Man-mode-line-format Mode line format for Man mode buffers. |
| 567 | Man-mode-map Keymap bindings for Man-mode buffers. | 568 | Man-mode-map Keymap bindings for Man mode buffers. |
| 568 | Man-mode-hooks Hooks for Man-mode. | 569 | Man-mode-hook Normal hook run on entry to Man mode. |
| 569 | Man-section-regexp Regexp describing manpage section letters. | 570 | Man-section-regexp Regexp describing manpage section letters. |
| 570 | Man-heading-regexp Regexp describing section headers. | 571 | Man-heading-regexp Regexp describing section headers. |
| 571 | Man-see-also-regexp Regexp for SEE ALSO section (or your equiv). | 572 | Man-see-also-regexp Regexp for SEE ALSO section (or your equiv). |
| @@ -652,7 +653,7 @@ The following key bindings are currently in effect in the buffer: | |||
| 652 | 653 | ||
| 653 | 654 | ||
| 654 | ;; ====================================================================== | 655 | ;; ====================================================================== |
| 655 | ;; Man-mode commands | 656 | ;; Man mode commands |
| 656 | 657 | ||
| 657 | (defun Man-next-section (n) | 658 | (defun Man-next-section (n) |
| 658 | "Move point to Nth next section (default 1)." | 659 | "Move point to Nth next section (default 1)." |
| @@ -706,25 +707,39 @@ Actually the section moved to is described by `Man-see-also-regexp'." | |||
| 706 | (error (concat "No " Man-see-also-regexp | 707 | (error (concat "No " Man-see-also-regexp |
| 707 | " section found in current manpage.")))) | 708 | " section found in current manpage.")))) |
| 708 | 709 | ||
| 709 | (defun Man-follow-manual-reference (arg) | 710 | (defun Man-follow-manual-reference (arg reference) |
| 710 | "Get one of the manpages referred to in the \"SEE ALSO\" section. | 711 | "Get one of the manpages referred to in the \"SEE ALSO\" section. |
| 711 | Queries you for the page to retrieve. Of course it does this in the | 712 | Specify which reference to use; default is based on word at point. |
| 712 | background. Universal argument ARG is passed to `Man-getpage-in-background'." | 713 | Prefix argument ARG is passed to `Man-getpage-in-background'." |
| 713 | (interactive "P") | 714 | (interactive |
| 715 | (if (not Man-refpages-alist) | ||
| 716 | (error "No references in current man page") | ||
| 717 | (list current-prefix-arg | ||
| 718 | (let* ((default (or | ||
| 719 | (car (all-completions | ||
| 720 | (save-excursion | ||
| 721 | (skip-syntax-backward "w()") | ||
| 722 | (skip-chars-forward " \t") | ||
| 723 | (let ((word (current-word))) | ||
| 724 | ;; strip a trailing '-': | ||
| 725 | (if (string-match "-$" word) | ||
| 726 | (substring word 0 (match-beginning 0)) | ||
| 727 | word))) | ||
| 728 | Man-refpages-alist)) | ||
| 729 | (aheadsym Man-refpages-alist))) | ||
| 730 | chosen | ||
| 731 | (prompt (concat "Refer to: (default " default ") "))) | ||
| 732 | (setq chosen (completing-read prompt Man-refpages-alist nil t)) | ||
| 733 | (if (or (not chosen) | ||
| 734 | (string= chosen "")) | ||
| 735 | default | ||
| 736 | chosen))))) | ||
| 714 | (if (not Man-refpages-alist) | 737 | (if (not Man-refpages-alist) |
| 715 | (error (concat "No references found in current manpage.")) | 738 | (error "No references found in current manpage") |
| 716 | (aput 'Man-refpages-alist | 739 | (aput 'Man-refpages-alist reference) |
| 717 | (let* ((default (aheadsym Man-refpages-alist)) | ||
| 718 | chosen | ||
| 719 | (prompt (concat "Refer to: (default " default ") "))) | ||
| 720 | (setq chosen (completing-read prompt Man-refpages-alist nil t)) | ||
| 721 | (if (or (not chosen) | ||
| 722 | (string= chosen "")) | ||
| 723 | default | ||
| 724 | chosen))) | ||
| 725 | (Man-getpage-in-background | 740 | (Man-getpage-in-background |
| 726 | (Man-translate-references (aheadsym Man-refpages-alist)) | 741 | (Man-translate-references (aheadsym Man-refpages-alist)) |
| 727 | (consp arg)))) | 742 | arg))) |
| 728 | 743 | ||
| 729 | (defun Man-quit () | 744 | (defun Man-quit () |
| 730 | "Kill the buffer containing the manpage." | 745 | "Kill the buffer containing the manpage." |