comparison lisp/man.el @ 4377:09cb5e07f8a3

(Man-build-references-alist): When setting word, use only what Man-reference-regexp matched. (Man-reference-regexp): Don't match starting with a period. (Man-first-heading-regexp): Allow leading space. (Man-heading-regexp): Allow leading space.
author Richard M. Stallman <rms@gnu.org>
date Sat, 31 Jul 1993 18:32:04 +0000
parents b39cd3621215
children 088883bdcd70
comparison
equal deleted inserted replaced
4376:109294166e68 4377:09cb5e07f8a3
183 "*Hooks for Man mode.") 183 "*Hooks for Man mode.")
184 184
185 (defvar Man-section-regexp "[0-9][a-zA-Z+]*" 185 (defvar Man-section-regexp "[0-9][a-zA-Z+]*"
186 "*Regular expression describing a manpage section within parentheses.") 186 "*Regular expression describing a manpage section within parentheses.")
187 187
188 (defvar Man-heading-regexp "^[A-Z]" 188 (defvar Man-heading-regexp "^ ?[A-Z]"
189 "*Regular expression describing a manpage heading entry.") 189 "*Regular expression describing a manpage heading entry.")
190 190
191 (defvar Man-see-also-regexp "SEE ALSO" 191 (defvar Man-see-also-regexp "SEE ALSO"
192 "*Regular expression for SEE ALSO heading (or your equivalent). 192 "*Regular expression for SEE ALSO heading (or your equivalent).
193 This regexp should not start with a `^' character.") 193 This regexp should not start with a `^' character.")
194 194
195 (defvar Man-first-heading-regexp "^NAME$\\|^No manual entry for .*$" 195 (defvar Man-first-heading-regexp "^ ?NAME$\\|^ ?No manual entry for .*$"
196 "*Regular expression describing first heading on a manpage. 196 "*Regular expression describing first heading on a manpage.
197 This regular expression should start with a `^' character.") 197 This regular expression should start with a `^' character.")
198 198
199 (defvar Man-reference-regexp "[-a-zA-Z0-9_.]+\\(([0-9][a-zA-Z+]*)\\)?" 199 (defvar Man-reference-regexp
200 "[-a-zA-Z0-9_][-a-zA-Z0-9_.]*\\(([0-9][a-zA-Z+]*)\\)?"
200 "*Regular expression describing a reference in the SEE ALSO section.") 201 "*Regular expression describing a reference in the SEE ALSO section.")
201 202
202 (defvar Man-switches "" 203 (defvar Man-switches ""
203 "*Switches passed to the man command, as a single string.") 204 "*Switches passed to the man command, as a single string.")
204 205
591 (narrow-to-region start end) 592 (narrow-to-region start end)
592 (goto-char (point-min)) 593 (goto-char (point-min))
593 (back-to-indentation) 594 (back-to-indentation)
594 (while (and (not (eobp)) (/= (point) runningpoint)) 595 (while (and (not (eobp)) (/= (point) runningpoint))
595 (setq runningpoint (point)) 596 (setq runningpoint (point))
596 (let* ((bow (point)) 597 (let* ((eow (re-search-forward Man-reference-regexp end t))
597 (eow (re-search-forward Man-reference-regexp end t)) 598 (word (buffer-substring (match-beginning 0) (match-end 0)))
598 (word (buffer-substring bow (match-end 0)))
599 (len (1- (length word)))) 599 (len (1- (length word))))
600 (if (not eow) nil 600 (if (not eow) nil
601 (if hyphenated 601 (if hyphenated
602 (setq word (concat hyphenated word) 602 (setq word (concat hyphenated word)
603 hyphenated nil)) 603 hyphenated nil))