diff options
| author | Francesco Potortì | 1994-10-27 19:08:03 +0000 |
|---|---|---|
| committer | Francesco Potortì | 1994-10-27 19:08:03 +0000 |
| commit | 6e7e47f6e18bc53a0445fa920724444888995748 (patch) | |
| tree | ca06bf0cc0fe19fae7a55e088431eda6f22602a2 | |
| parent | 4d19cb8e06d296b1cc305b17d93471867fbe73ed (diff) | |
| download | emacs-6e7e47f6e18bc53a0445fa920724444888995748.tar.gz emacs-6e7e47f6e18bc53a0445fa920724444888995748.zip | |
* man.el (Man-fontify-manpage-flag): defvar put at outer level.
(manual-program, Man-untabify-command, Man-untabify-command-args,
Man-sed-command, Man-awk-command, Man-mode-line-format,
Man-mode-map, Man-mode-hook, Man-cooked-hook, Man-name-regexp,
Man-section-regexp, Man-page-header-regexp, Man-heading-regexp,
Man-see-also-regexp, Man-first-heading-regexp,
Man-reference-regexp, Man-switches, Man-specified-section-option):
Make them normal defvars, no more user options.
(Man-overstrike-face, Man-undeline-face): New user options.
(Man-init-defvars): Man-fontify-manpage-flag removed from here.
(man-fontify-manpage): Use the new user options above.
| -rw-r--r-- | lisp/man.el | 109 |
1 files changed, 56 insertions, 53 deletions
diff --git a/lisp/man.el b/lisp/man.el index ab27a6b74ab..52645b61515 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Barry A. Warsaw <bwarsaw@cen.com> | 5 | ;; Author: Barry A. Warsaw <bwarsaw@cen.com> |
| 6 | ;; Last-Modified: $Date: 1994/10/24 12:37:01 $ | 6 | ;; Last-Modified: $Date: 1994/10/24 15:34:50 $ |
| 7 | ;; Version: $Revision: 1.54 $ | 7 | ;; Version: $Revision: 1.55 $ |
| 8 | ;; Keywords: help | 8 | ;; Keywords: help |
| 9 | ;; Adapted-By: ESR, pot | 9 | ;; Adapted-By: ESR, pot |
| 10 | 10 | ||
| @@ -106,7 +106,6 @@ | |||
| 106 | (defvar Man-filter-list) | 106 | (defvar Man-filter-list) |
| 107 | (defvar Man-original-frame) | 107 | (defvar Man-original-frame) |
| 108 | (defvar Man-arguments) | 108 | (defvar Man-arguments) |
| 109 | (defvar Man-fontify-manpage-flag) | ||
| 110 | (defvar Man-sections-alist) | 109 | (defvar Man-sections-alist) |
| 111 | (defvar Man-refpages-alist) | 110 | (defvar Man-refpages-alist) |
| 112 | (defvar Man-uses-untabify-flag) | 111 | (defvar Man-uses-untabify-flag) |
| @@ -116,8 +115,14 @@ | |||
| 116 | ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | 115 | ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
| 117 | ;; user variables | 116 | ;; user variables |
| 118 | 117 | ||
| 119 | (defvar manual-program "man" | 118 | (defvar Man-fontify-manpage-flag t |
| 120 | "The name of the program that produces man pages.") | 119 | "*Make up the manpage with fonts.") |
| 120 | |||
| 121 | (defvar Man-overstrike-face 'bold | ||
| 122 | "*Face to use when fontifying overstrike.") | ||
| 123 | |||
| 124 | (defvar Man-underline-face 'underline | ||
| 125 | "*Face to use when fontifying underlinining.") | ||
| 121 | 126 | ||
| 122 | ;; Use the value of the obsolete user option Man-notify, if set. | 127 | ;; Use the value of the obsolete user option Man-notify, if set. |
| 123 | (defvar Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) | 128 | (defvar Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) |
| @@ -171,39 +176,20 @@ their references which Un*x `man' does not recognize. This | |||
| 171 | association list is used to translate those sections, when found, to | 176 | association list is used to translate those sections, when found, to |
| 172 | the associated section number.") | 177 | the associated section number.") |
| 173 | 178 | ||
| 179 | (defvar manual-program "man" | ||
| 180 | "The name of the program that produces man pages.") | ||
| 181 | |||
| 174 | (defvar Man-untabify-command "pr" | 182 | (defvar Man-untabify-command "pr" |
| 175 | "*Command used for untabifying.") | 183 | "Command used for untabifying.") |
| 176 | 184 | ||
| 177 | (defvar Man-untabify-command-args (list "-t" "-e") | 185 | (defvar Man-untabify-command-args (list "-t" "-e") |
| 178 | "*List of arguments to be passed to Man-untabify-command (which see).") | 186 | "List of arguments to be passed to Man-untabify-command (which see).") |
| 179 | 187 | ||
| 180 | (defvar Man-sed-command "sed" | 188 | (defvar Man-sed-command "sed" |
| 181 | "*Command used for processing sed scripts.") | 189 | "Command used for processing sed scripts.") |
| 182 | 190 | ||
| 183 | (defvar Man-awk-command "awk" | 191 | (defvar Man-awk-command "awk" |
| 184 | "*Command used for processing awk scripts.") | 192 | "Command used for processing awk scripts.") |
| 185 | |||
| 186 | (defconst Man-sysv-sed-script "\ | ||
| 187 | /\b/ { s/_\b//g | ||
| 188 | s/\b_//g | ||
| 189 | s/o\b+/o/g | ||
| 190 | :ovstrk | ||
| 191 | s/\\(.\\)\b\\1/\\1/g | ||
| 192 | t ovstrk | ||
| 193 | } | ||
| 194 | /\e\\[[0-9][0-9]*m/ s///g" | ||
| 195 | "Script for sysV-like sed to nuke backspaces and ANSI codes from manpages.") | ||
| 196 | |||
| 197 | (defconst Man-berkeley-sed-script "\ | ||
| 198 | /\b/ { s/_\b//g\\ | ||
| 199 | s/\b_//g\\ | ||
| 200 | s/o\b+/o/g\\ | ||
| 201 | :ovstrk\\ | ||
| 202 | s/\\(.\\)\b\\1/\\1/g\\ | ||
| 203 | t ovstrk\\ | ||
| 204 | }\\ | ||
| 205 | /\e\\[[0-9][0-9]*m/ s///g" | ||
| 206 | "Script for berkeley-like sed to nuke backspaces and ANSI codes from manpages.") | ||
| 207 | 193 | ||
| 208 | (defvar Man-mode-line-format | 194 | (defvar Man-mode-line-format |
| 209 | '("" mode-line-modified | 195 | '("" mode-line-modified |
| @@ -212,54 +198,51 @@ the associated section number.") | |||
| 212 | " " Man-page-mode-string | 198 | " " Man-page-mode-string |
| 213 | " %[(" mode-name mode-line-process minor-mode-alist ")%]----" | 199 | " %[(" mode-name mode-line-process minor-mode-alist ")%]----" |
| 214 | (-3 . "%p") "-%-") | 200 | (-3 . "%p") "-%-") |
| 215 | "*Mode line format for manual mode buffer.") | 201 | "Mode line format for manual mode buffer.") |
| 216 | 202 | ||
| 217 | (defvar Man-mode-map nil | 203 | (defvar Man-mode-map nil |
| 218 | "*Keymap for Man mode.") | 204 | "Keymap for Man mode.") |
| 219 | 205 | ||
| 220 | (defvar Man-mode-hook nil | 206 | (defvar Man-mode-hook nil |
| 221 | "*Hook run when Man mode is enabled.") | 207 | "Hook run when Man mode is enabled.") |
| 222 | 208 | ||
| 223 | (defvar Man-cooked-hook nil | 209 | (defvar Man-cooked-hook nil |
| 224 | "*Hook run after removing backspaces but before Man-mode processing.") | 210 | "Hook run after removing backspaces but before Man-mode processing.") |
| 225 | 211 | ||
| 226 | (defvar Man-name-regexp "[-a-zA-Z0-9_][-a-zA-Z0-9_.]*" | 212 | (defvar Man-name-regexp "[-a-zA-Z0-9_][-a-zA-Z0-9_.]*" |
| 227 | "*Regular expression describing the name of a manpage (without section).") | 213 | "Regular expression describing the name of a manpage (without section).") |
| 228 | 214 | ||
| 229 | (defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]" | 215 | (defvar Man-section-regexp "[0-9][a-zA-Z+]*\\|[LNln]" |
| 230 | "*Regular expression describing a manpage section within parentheses.") | 216 | "Regular expression describing a manpage section within parentheses.") |
| 231 | 217 | ||
| 232 | (defvar Man-page-header-regexp | 218 | (defvar Man-page-header-regexp |
| 233 | (concat "^[ \t]*\\(" Man-name-regexp | 219 | (concat "^[ \t]*\\(" Man-name-regexp |
| 234 | "(\\(" Man-section-regexp "\\))\\).*\\1") | 220 | "(\\(" Man-section-regexp "\\))\\).*\\1") |
| 235 | "*Regular expression describing the heading of a page.") | 221 | "Regular expression describing the heading of a page.") |
| 236 | 222 | ||
| 237 | (defvar Man-heading-regexp "^\\([A-Z][A-Z ]+\\)$" | 223 | (defvar Man-heading-regexp "^\\([A-Z][A-Z ]+\\)$" |
| 238 | "*Regular expression describing a manpage heading entry.") | 224 | "Regular expression describing a manpage heading entry.") |
| 239 | 225 | ||
| 240 | (defvar Man-see-also-regexp "SEE ALSO" | 226 | (defvar Man-see-also-regexp "SEE ALSO" |
| 241 | "*Regular expression for SEE ALSO heading (or your equivalent). | 227 | "Regular expression for SEE ALSO heading (or your equivalent). |
| 242 | This regexp should not start with a `^' character.") | 228 | This regexp should not start with a `^' character.") |
| 243 | 229 | ||
| 244 | (defvar Man-first-heading-regexp "^[ \t]*NAME$\\|^[ \t]*No manual entry fo.*$" | 230 | (defvar Man-first-heading-regexp "^[ \t]*NAME$\\|^[ \t]*No manual entry fo.*$" |
| 245 | "*Regular expression describing first heading on a manpage. | 231 | "Regular expression describing first heading on a manpage. |
| 246 | This regular expression should start with a `^' character.") | 232 | This regular expression should start with a `^' character.") |
| 247 | 233 | ||
| 248 | (defvar Man-reference-regexp | 234 | (defvar Man-reference-regexp |
| 249 | (concat "\\(" Man-name-regexp "\\)(\\(" Man-section-regexp "\\))") | 235 | (concat "\\(" Man-name-regexp "\\)(\\(" Man-section-regexp "\\))") |
| 250 | "*Regular expression describing a reference in the SEE ALSO section.") | 236 | "Regular expression describing a reference in the SEE ALSO section.") |
| 251 | 237 | ||
| 252 | (defvar Man-switches "" | 238 | (defvar Man-switches "" |
| 253 | "*Switches passed to the man command, as a single string.") | 239 | "Switches passed to the man command, as a single string.") |
| 254 | 240 | ||
| 255 | ;; Would someone like to provide a good test for being on Solaris? | ||
| 256 | ;; We could give it its own value of system-type, but that has drawbacks; | ||
| 257 | ;; it would require changes in lots of places that test system-type. | ||
| 258 | (defvar Man-specified-section-option | 241 | (defvar Man-specified-section-option |
| 259 | (if (string-match "-solaris[0-9.]*$" system-configuration) | 242 | (if (string-match "-solaris[0-9.]*$" system-configuration) |
| 260 | "-s" | 243 | "-s" |
| 261 | "") | 244 | "") |
| 262 | "*Option that indicates a specified a manual section name.") | 245 | "Option that indicates a specified a manual section name.") |
| 263 | 246 | ||
| 264 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 247 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 265 | ;; end user variables | 248 | ;; end user variables |
| @@ -279,6 +262,28 @@ This regular expression should start with a `^' character.") | |||
| 279 | (setq-default Man-current-page 0) | 262 | (setq-default Man-current-page 0) |
| 280 | (setq-default Man-page-mode-string "1 of 1") | 263 | (setq-default Man-page-mode-string "1 of 1") |
| 281 | 264 | ||
| 265 | (defconst Man-sysv-sed-script "\ | ||
| 266 | /\b/ { s/_\b//g | ||
| 267 | s/\b_//g | ||
| 268 | s/o\b+/o/g | ||
| 269 | :ovstrk | ||
| 270 | s/\\(.\\)\b\\1/\\1/g | ||
| 271 | t ovstrk | ||
| 272 | } | ||
| 273 | /\e\\[[0-9][0-9]*m/ s///g" | ||
| 274 | "Script for sysV-like sed to nuke backspaces and ANSI codes from manpages.") | ||
| 275 | |||
| 276 | (defconst Man-berkeley-sed-script "\ | ||
| 277 | /\b/ { s/_\b//g\\ | ||
| 278 | s/\b_//g\\ | ||
| 279 | s/o\b+/o/g\\ | ||
| 280 | :ovstrk\\ | ||
| 281 | s/\\(.\\)\b\\1/\\1/g\\ | ||
| 282 | t ovstrk\\ | ||
| 283 | }\\ | ||
| 284 | /\e\\[[0-9][0-9]*m/ s///g" | ||
| 285 | "Script for berkeley-like sed to nuke backspaces and ANSI codes from manpages.") | ||
| 286 | |||
| 282 | (if Man-mode-map | 287 | (if Man-mode-map |
| 283 | nil | 288 | nil |
| 284 | (setq Man-mode-map (make-keymap)) | 289 | (setq Man-mode-map (make-keymap)) |
| @@ -310,8 +315,6 @@ This regular expression should start with a `^' character.") | |||
| 310 | "Used for initialising variables based on the value of window-system. | 315 | "Used for initialising variables based on the value of window-system. |
| 311 | This is necessary if one wants to dump man.el with emacs." | 316 | This is necessary if one wants to dump man.el with emacs." |
| 312 | 317 | ||
| 313 | (defvar Man-fontify-manpage-flag t | ||
| 314 | "*Make up the manpage with fonts.") | ||
| 315 | ;; The following is necessary until fonts are implemented on | 318 | ;; The following is necessary until fonts are implemented on |
| 316 | ;; terminals. | 319 | ;; terminals. |
| 317 | (setq Man-fontify-manpage-flag (and Man-fontify-manpage-flag | 320 | (setq Man-fontify-manpage-flag (and Man-fontify-manpage-flag |
| @@ -619,19 +622,19 @@ Same for the ANSI bold and normal escape sequences." | |||
| 619 | (progn (if (search-forward "\e[0m" nil 'move) | 622 | (progn (if (search-forward "\e[0m" nil 'move) |
| 620 | (delete-backward-char 4)) | 623 | (delete-backward-char 4)) |
| 621 | (point)) | 624 | (point)) |
| 622 | 'face 'bold)) | 625 | 'face Man-overstrike-face)) |
| 623 | (goto-char (point-min)) | 626 | (goto-char (point-min)) |
| 624 | (while (search-forward "_\b" nil t) | 627 | (while (search-forward "_\b" nil t) |
| 625 | (backward-delete-char 2) | 628 | (backward-delete-char 2) |
| 626 | (put-text-property (point) (1+ (point)) 'face 'underline)) | 629 | (put-text-property (point) (1+ (point)) 'face Man-underline-face)) |
| 627 | (goto-char (point-min)) | 630 | (goto-char (point-min)) |
| 628 | (while (search-forward "\b_" nil t) | 631 | (while (search-forward "\b_" nil t) |
| 629 | (backward-delete-char 2) | 632 | (backward-delete-char 2) |
| 630 | (put-text-property (1- (point)) (point) 'face 'underline)) | 633 | (put-text-property (1- (point)) (point) 'face Man-underline-face)) |
| 631 | (goto-char (point-min)) | 634 | (goto-char (point-min)) |
| 632 | (while (re-search-forward "\\(.\\)\\(\b\\1\\)+" nil t) | 635 | (while (re-search-forward "\\(.\\)\\(\b\\1\\)+" nil t) |
| 633 | (replace-match "\\1") | 636 | (replace-match "\\1") |
| 634 | (put-text-property (1- (point)) (point) 'face 'bold)) | 637 | (put-text-property (1- (point)) (point) 'face Man-overstrike-face)) |
| 635 | (goto-char (point-min)) | 638 | (goto-char (point-min)) |
| 636 | (while (search-forward "o\b+" nil t) | 639 | (while (search-forward "o\b+" nil t) |
| 637 | (backward-delete-char 2) | 640 | (backward-delete-char 2) |