aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-08-08 19:52:03 +0000
committerStefan Monnier2007-08-08 19:52:03 +0000
commita88459cd637fe9fbe44491468cac08fbc840171b (patch)
tree3b312ec117d6f3ed41b52092262436435316fea2
parent4cb071a4bd34c40215e88ca8fa31eec0e796def9 (diff)
downloademacs-a88459cd637fe9fbe44491468cac08fbc840171b.tar.gz
emacs-a88459cd637fe9fbe44491468cac08fbc840171b.zip
Remove spurious * in docstrings.
Merge defvars and toplevel setq-defaults. (Man-highlight-references0): Limit=nil rather than point-max. (Man-mode-map): Move initialization into the declaration. (Man-strip-page-headers, Man-unindent): Use dolist & inhibit-read-only. (Man-view-header-file): Use expand-file-name rather than concat. (Man-notify-when-ready, Man-bgproc-sentinel): Use with-current-buffer.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/man.el136
2 files changed, 72 insertions, 76 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fe3b90d5100..ae2e80bd306 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12007-08-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * man.el: Remove spurious * in docstrings.
4 Merge defvars and toplevel setq-defaults.
5 (Man-highlight-references0): Limit=nil rather than point-max.
6 (Man-mode-map): Move initialization into the declaration.
7 (Man-strip-page-headers, Man-unindent): Use dolist & inhibit-read-only.
8 (Man-view-header-file): Use expand-file-name rather than concat.
9 (Man-notify-when-ready, Man-bgproc-sentinel): Use with-current-buffer.
10
11 * man.el (Man-next-section): Make sure we do not move backward.
12
12007-08-08 Vinicius Jose Latorre <viniciusjl@ig.com.br> 132007-08-08 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2 14
3 * ps-print.el (ps-default-fg, ps-default-bg): Docstring fix. 15 * ps-print.el (ps-default-fg, ps-default-bg): Docstring fix.
diff --git a/lisp/man.el b/lisp/man.el
index 03003a46d1b..c7593e88dda 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -37,7 +37,7 @@
37 37
38;; ========== Credits and History ========== 38;; ========== Credits and History ==========
39;; In mid 1991, several people posted some interesting improvements to 39;; In mid 1991, several people posted some interesting improvements to
40;; man.el from the standard emacs 18.57 distribution. I liked many of 40;; man.el from the standard Emacs 18.57 distribution. I liked many of
41;; these, but wanted everything in one single package, so I decided 41;; these, but wanted everything in one single package, so I decided
42;; to incorporate them into a single manual browsing mode. While 42;; to incorporate them into a single manual browsing mode. While
43;; much of the code here has been rewritten, and some features added, 43;; much of the code here has been rewritten, and some features added,
@@ -109,8 +109,6 @@
109 109
110 110
111(defvar Man-notify) 111(defvar Man-notify)
112(defvar Man-current-page)
113(defvar Man-page-list)
114(defcustom Man-filter-list nil 112(defcustom Man-filter-list nil
115 "*Manpage cleaning filter command phrases. 113 "*Manpage cleaning filter command phrases.
116This variable contains a list of the following form: 114This variable contains a list of the following form:
@@ -127,13 +125,8 @@ the manpage buffer."
127 (string :tag "Phrase String")))) 125 (string :tag "Phrase String"))))
128 :group 'man) 126 :group 'man)
129 127
130(defvar Man-original-frame)
131(defvar Man-arguments)
132(defvar Man-sections-alist)
133(defvar Man-refpages-alist)
134(defvar Man-uses-untabify-flag t 128(defvar Man-uses-untabify-flag t
135 "Non-nil means use `untabify' instead of `Man-untabify-command'.") 129 "Non-nil means use `untabify' instead of `Man-untabify-command'.")
136(defvar Man-page-mode-string)
137(defvar Man-sed-script nil 130(defvar Man-sed-script nil
138 "Script for sed to nuke backspaces and ANSI codes from manpages.") 131 "Script for sed to nuke backspaces and ANSI codes from manpages.")
139 132
@@ -141,28 +134,28 @@ the manpage buffer."
141;; user variables 134;; user variables
142 135
143(defcustom Man-fontify-manpage-flag t 136(defcustom Man-fontify-manpage-flag t
144 "*Non-nil means make up the manpage with fonts." 137 "Non-nil means make up the manpage with fonts."
145 :type 'boolean 138 :type 'boolean
146 :group 'man) 139 :group 'man)
147 140
148(defcustom Man-overstrike-face 'bold 141(defcustom Man-overstrike-face 'bold
149 "*Face to use when fontifying overstrike." 142 "Face to use when fontifying overstrike."
150 :type 'face 143 :type 'face
151 :group 'man) 144 :group 'man)
152 145
153(defcustom Man-underline-face 'underline 146(defcustom Man-underline-face 'underline
154 "*Face to use when fontifying underlining." 147 "Face to use when fontifying underlining."
155 :type 'face 148 :type 'face
156 :group 'man) 149 :group 'man)
157 150
158(defcustom Man-reverse-face 'highlight 151(defcustom Man-reverse-face 'highlight
159 "*Face to use when fontifying reverse video." 152 "Face to use when fontifying reverse video."
160 :type 'face 153 :type 'face
161 :group 'man) 154 :group 'man)
162 155
163;; Use the value of the obsolete user option Man-notify, if set. 156;; Use the value of the obsolete user option Man-notify, if set.
164(defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly) 157(defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly)
165 "*Selects the behavior when manpage is ready. 158 "Selects the behavior when manpage is ready.
166This variable may have one of the following values, where (sf) means 159This variable may have one of the following values, where (sf) means
167that the frames are switched, so the manpage is displayed in the frame 160that the frames are switched, so the manpage is displayed in the frame
168where the man command was called from: 161where the man command was called from:
@@ -183,7 +176,7 @@ Any other value of `Man-notify-method' is equivalent to `meek'."
183 :group 'man) 176 :group 'man)
184 177
185(defcustom Man-width nil 178(defcustom Man-width nil
186 "*Number of columns for which manual pages should be formatted. 179 "Number of columns for which manual pages should be formatted.
187If nil, the width of the window selected at the moment of man 180If nil, the width of the window selected at the moment of man
188invocation is used. If non-nil, the width of the frame selected 181invocation is used. If non-nil, the width of the frame selected
189at the moment of man invocation is used. The value also can be a 182at the moment of man invocation is used. The value also can be a
@@ -194,12 +187,12 @@ positive integer."
194 :group 'man) 187 :group 'man)
195 188
196(defcustom Man-frame-parameters nil 189(defcustom Man-frame-parameters nil
197 "*Frame parameter list for creating a new frame for a manual page." 190 "Frame parameter list for creating a new frame for a manual page."
198 :type 'sexp 191 :type 'sexp
199 :group 'man) 192 :group 'man)
200 193
201(defcustom Man-downcase-section-letters-flag t 194(defcustom Man-downcase-section-letters-flag t
202 "*Non-nil means letters in sections are converted to lower case. 195 "Non-nil means letters in sections are converted to lower case.
203Some Un*x man commands can't handle uppercase letters in sections, for 196Some Un*x man commands can't handle uppercase letters in sections, for
204example \"man 2V chmod\", but they are often displayed in the manpage 197example \"man 2V chmod\", but they are often displayed in the manpage
205with the upper case letter. When this variable is t, the section 198with the upper case letter. When this variable is t, the section
@@ -209,7 +202,7 @@ being sent to the man background process."
209 :group 'man) 202 :group 'man)
210 203
211(defcustom Man-circular-pages-flag t 204(defcustom Man-circular-pages-flag t
212 "*Non-nil means the manpage list is treated as circular for traversal." 205 "Non-nil means the manpage list is treated as circular for traversal."
213 :type 'boolean 206 :type 'boolean
214 :group 'man) 207 :group 'man)
215 208
@@ -220,7 +213,7 @@ being sent to the man background process."
220 ;; '("3X" . "3") ; Xlib man pages 213 ;; '("3X" . "3") ; Xlib man pages
221 '("3X11" . "3") 214 '("3X11" . "3")
222 '("1-UCB" . "")) 215 '("1-UCB" . ""))
223 "*Association list of bogus sections to real section numbers. 216 "Association list of bogus sections to real section numbers.
224Some manpages (e.g. the Sun C++ 2.1 manpages) have section numbers in 217Some manpages (e.g. the Sun C++ 2.1 manpages) have section numbers in
225their references which Un*x `man' does not recognize. This 218their references which Un*x `man' does not recognize. This
226association list is used to translate those sections, when found, to 219association list is used to translate those sections, when found, to
@@ -250,9 +243,6 @@ the associated section number."
250(defvar Man-awk-command "awk" 243(defvar Man-awk-command "awk"
251 "Command used for processing awk scripts.") 244 "Command used for processing awk scripts.")
252 245
253(defvar Man-mode-map nil
254 "Keymap for Man mode.")
255
256(defvar Man-mode-hook nil 246(defvar Man-mode-hook nil
257 "Hook run when Man mode is enabled.") 247 "Hook run when Man mode is enabled.")
258 248
@@ -349,20 +339,22 @@ Otherwise, the value is whatever the function
349;; end user variables 339;; end user variables
350 340
351;; other variables and keymap initializations 341;; other variables and keymap initializations
342(defvar Man-original-frame)
343(make-variable-buffer-local 'Man-original-frame)
344(defvar Man-arguments)
345(make-variable-buffer-local 'Man-arguments)
346(put 'Man-arguments 'permanent-local t)
347
348(defvar Man-sections-alist nil)
352(make-variable-buffer-local 'Man-sections-alist) 349(make-variable-buffer-local 'Man-sections-alist)
350(defvar Man-refpages-alist nil)
353(make-variable-buffer-local 'Man-refpages-alist) 351(make-variable-buffer-local 'Man-refpages-alist)
352(defvar Man-page-list nil)
354(make-variable-buffer-local 'Man-page-list) 353(make-variable-buffer-local 'Man-page-list)
354(defvar Man-current-page 0)
355(make-variable-buffer-local 'Man-current-page) 355(make-variable-buffer-local 'Man-current-page)
356(defvar Man-page-mode-string "1 of 1")
356(make-variable-buffer-local 'Man-page-mode-string) 357(make-variable-buffer-local 'Man-page-mode-string)
357(make-variable-buffer-local 'Man-original-frame)
358(make-variable-buffer-local 'Man-arguments)
359(put 'Man-arguments 'permanent-local t)
360
361(setq-default Man-sections-alist nil)
362(setq-default Man-refpages-alist nil)
363(setq-default Man-page-list nil)
364(setq-default Man-current-page 0)
365(setq-default Man-page-mode-string "1 of 1")
366 358
367(defconst Man-sysv-sed-script "\ 359(defconst Man-sysv-sed-script "\
368/\b/ { s/_\b//g 360/\b/ { s/_\b//g
@@ -398,30 +390,32 @@ Otherwise, the value is whatever the function
398 table) 390 table)
399 "Syntax table used in Man mode buffers.") 391 "Syntax table used in Man mode buffers.")
400 392
401(unless Man-mode-map 393(defvar Man-mode-map
402 (setq Man-mode-map (make-sparse-keymap)) 394 (let ((map (make-sparse-keymap)))
403 (suppress-keymap Man-mode-map) 395 (suppress-keymap map)
404 (set-keymap-parent Man-mode-map button-buffer-map) 396 (set-keymap-parent map button-buffer-map)
405 397
406 (define-key Man-mode-map " " 'scroll-up) 398 (define-key map " " 'scroll-up)
407 (define-key Man-mode-map "\177" 'scroll-down) 399 (define-key map "\177" 'scroll-down)
408 (define-key Man-mode-map "n" 'Man-next-section) 400 (define-key map "n" 'Man-next-section)
409 (define-key Man-mode-map "p" 'Man-previous-section) 401 (define-key map "p" 'Man-previous-section)
410 (define-key Man-mode-map "\en" 'Man-next-manpage) 402 (define-key map "\en" 'Man-next-manpage)
411 (define-key Man-mode-map "\ep" 'Man-previous-manpage) 403 (define-key map "\ep" 'Man-previous-manpage)
412 (define-key Man-mode-map ">" 'end-of-buffer) 404 (define-key map ">" 'end-of-buffer)
413 (define-key Man-mode-map "<" 'beginning-of-buffer) 405 (define-key map "<" 'beginning-of-buffer)
414 (define-key Man-mode-map "." 'beginning-of-buffer) 406 (define-key map "." 'beginning-of-buffer)
415 (define-key Man-mode-map "r" 'Man-follow-manual-reference) 407 (define-key map "r" 'Man-follow-manual-reference)
416 (define-key Man-mode-map "g" 'Man-goto-section) 408 (define-key map "g" 'Man-goto-section)
417 (define-key Man-mode-map "s" 'Man-goto-see-also-section) 409 (define-key map "s" 'Man-goto-see-also-section)
418 (define-key Man-mode-map "k" 'Man-kill) 410 (define-key map "k" 'Man-kill)
419 (define-key Man-mode-map "q" 'Man-quit) 411 (define-key map "q" 'Man-quit)
420 (define-key Man-mode-map "m" 'man) 412 (define-key map "m" 'man)
421 ;; Not all the man references get buttons currently. The text in the 413 ;; Not all the man references get buttons currently. The text in the
422 ;; manual page can contain references to other man pages 414 ;; manual page can contain references to other man pages
423 (define-key Man-mode-map "\r" 'man-follow) 415 (define-key map "\r" 'man-follow)
424 (define-key Man-mode-map "?" 'describe-mode)) 416 (define-key map "?" 'describe-mode)
417 map)
418 "Keymap for Man mode.")
425 419
426;; buttons 420;; buttons
427(define-button-type 'Man-abstract-xref-man-page 421(define-button-type 'Man-abstract-xref-man-page
@@ -730,8 +724,7 @@ all sections related to a subject, put something appropriate into the
730 (require 'env) 724 (require 'env)
731 (message "Invoking %s %s in the background" manual-program man-args) 725 (message "Invoking %s %s in the background" manual-program man-args)
732 (setq buffer (generate-new-buffer bufname)) 726 (setq buffer (generate-new-buffer bufname))
733 (save-excursion 727 (with-current-buffer buffer
734 (set-buffer buffer)
735 (setq buffer-undo-list t) 728 (setq buffer-undo-list t)
736 (setq Man-original-frame (selected-frame)) 729 (setq Man-original-frame (selected-frame))
737 (setq Man-arguments man-args)) 730 (setq Man-arguments man-args))
@@ -802,8 +795,7 @@ all sections related to a subject, put something appropriate into the
802(defun Man-notify-when-ready (man-buffer) 795(defun Man-notify-when-ready (man-buffer)
803 "Notify the user when MAN-BUFFER is ready. 796 "Notify the user when MAN-BUFFER is ready.
804See the variable `Man-notify-method' for the different notification behaviors." 797See the variable `Man-notify-method' for the different notification behaviors."
805 (let ((saved-frame (save-excursion 798 (let ((saved-frame (with-current-buffer man-buffer
806 (set-buffer man-buffer)
807 Man-original-frame))) 799 Man-original-frame)))
808 (cond 800 (cond
809 ((eq Man-notify-method 'newframe) 801 ((eq Man-notify-method 'newframe)
@@ -975,7 +967,7 @@ default type, `Man-xref-man-page' is used for the buttons."
975 (Man-next-section 1) 967 (Man-next-section 1)
976 (point))) 968 (point)))
977 (goto-char (point-min)) 969 (goto-char (point-min))
978 (point-max)))) 970 nil)))
979 (while (re-search-forward regexp end t) 971 (while (re-search-forward regexp end t)
980 (make-text-button 972 (make-text-button
981 (match-beginning button-pos) 973 (match-beginning button-pos)
@@ -1031,8 +1023,7 @@ manpage command."
1031 (or (stringp process) 1023 (or (stringp process)
1032 (set-process-buffer process nil)) 1024 (set-process-buffer process nil))
1033 1025
1034 (save-excursion 1026 (with-current-buffer Man-buffer
1035 (set-buffer Man-buffer)
1036 (let ((case-fold-search nil)) 1027 (let ((case-fold-search nil))
1037 (goto-char (point-min)) 1028 (goto-char (point-min))
1038 (cond ((or (looking-at "No \\(manual \\)*entry for") 1029 (cond ((or (looking-at "No \\(manual \\)*entry for")
@@ -1223,13 +1214,10 @@ The following key bindings are currently in effect in the buffer:
1223 1214
1224(defun Man-strip-page-headers () 1215(defun Man-strip-page-headers ()
1225 "Strip all the page headers but the first from the manpage." 1216 "Strip all the page headers but the first from the manpage."
1226 (let ((buffer-read-only nil) 1217 (let ((inhibit-read-only t)
1227 (case-fold-search nil) 1218 (case-fold-search nil)
1228 (page-list Man-page-list)
1229 (page ())
1230 (header "")) 1219 (header ""))
1231 (while page-list 1220 (dolist (page Man-page-list)
1232 (setq page (car page-list))
1233 (and (nth 2 page) 1221 (and (nth 2 page)
1234 (goto-char (car page)) 1222 (goto-char (car page))
1235 (re-search-forward Man-first-heading-regexp nil t) 1223 (re-search-forward Man-first-heading-regexp nil t)
@@ -1243,17 +1231,14 @@ The following key bindings are currently in effect in the buffer:
1243 ;; line. 1231 ;; line.
1244 ;; (setq header (concat "\n" header))) 1232 ;; (setq header (concat "\n" header)))
1245 (while (search-forward header (nth 1 page) t) 1233 (while (search-forward header (nth 1 page) t)
1246 (replace-match ""))) 1234 (replace-match ""))))))
1247 (setq page-list (cdr page-list)))))
1248 1235
1249(defun Man-unindent () 1236(defun Man-unindent ()
1250 "Delete the leading spaces that indent the manpage." 1237 "Delete the leading spaces that indent the manpage."
1251 (let ((buffer-read-only nil) 1238 (let ((inhibit-read-only t)
1252 (case-fold-search nil) 1239 (case-fold-search nil))
1253 (page-list Man-page-list)) 1240 (dolist (page Man-page-list)
1254 (while page-list 1241 (let ((indent "")
1255 (let ((page (car page-list))
1256 (indent "")
1257 (nindent 0)) 1242 (nindent 0))
1258 (narrow-to-region (car page) (car (cdr page))) 1243 (narrow-to-region (car page) (car (cdr page)))
1259 (if Man-uses-untabify-flag 1244 (if Man-uses-untabify-flag
@@ -1281,7 +1266,6 @@ The following key bindings are currently in effect in the buffer:
1281 (or (eolp) 1266 (or (eolp)
1282 (delete-char nindent)) 1267 (delete-char nindent))
1283 (forward-line 1))) 1268 (forward-line 1)))
1284 (setq page-list (cdr page-list))
1285 )))) 1269 ))))
1286 1270
1287 1271
@@ -1466,7 +1450,7 @@ Specify which REFERENCE to use; default is based on word at point."
1466 (let ((path Man-header-file-path) 1450 (let ((path Man-header-file-path)
1467 complete-path) 1451 complete-path)
1468 (while path 1452 (while path
1469 (setq complete-path (concat (car path) "/" file) 1453 (setq complete-path (expand-file-name file (car path))
1470 path (cdr path)) 1454 path (cdr path))
1471 (if (file-readable-p complete-path) 1455 (if (file-readable-p complete-path)
1472 (progn (view-file complete-path) 1456 (progn (view-file complete-path)