(defvar Man-section-translations-alist
'(("3C++" . "3")
+ ("3X" . "3") ; Xlib man pages
+ ("3X11" . "3")
("1-UCB" . ""))
"*Association list of bogus sections to real section numbers.
Some manpages (e.g. the Sun C++ 2.1 manpages) have section numbers in
"-e '/^Sun Release [0-9].*[0-9]$/d'"
"-e '/^\\n$/D'"
))
- ("awk '"
- ("BEGIN { blankline=0; anonblank=0; }"
- "/^$/ { if (anonblank==0) next; }"
- "{ anonblank=1; }"
- "/^$/ { blankline++; next; }"
- "{ if (blankline>0) { print \"\"; blankline=0; } print $0; }"
+ ("awk '\n"
+ ("BEGIN { blankline=0; anonblank=0; }\n"
+ "/^$/ { if (anonblank==0) next; }\n"
+ "{ anonblank=1; }\n"
+ "/^$/ { blankline++; next; }\n"
+ "{ if (blankline>0) { print \"\"; blankline=0; } print $0; }\n"
"'"
))
)
(defvar Man-section-regexp "[0-9][a-zA-Z+]*"
"*Regular expression describing a manpage section within parentheses.")
-(defvar Man-heading-regexp "^[A-Z]"
+(defvar Man-heading-regexp "^ ?[A-Z]"
"*Regular expression describing a manpage heading entry.")
(defvar Man-see-also-regexp "SEE ALSO"
"*Regular expression for SEE ALSO heading (or your equivalent).
This regexp should not start with a `^' character.")
-(defvar Man-first-heading-regexp "^NAME$\\|^No manual entry for .*$"
+(defvar Man-first-heading-regexp "^ ?NAME$\\|^ ?No manual entry for .*$"
"*Regular expression describing first heading on a manpage.
This regular expression should start with a `^' character.")
-(defvar Man-reference-regexp "[-a-zA-Z0-9_.]+\\(([0-9][a-zA-Z+]*)\\)?"
+(defvar Man-reference-regexp
+ "[-a-zA-Z0-9_][-a-zA-Z0-9_.]*\\(([0-9][a-zA-Z+]*)\\)?"
"*Regular expression describing a reference in the SEE ALSO section.")
(defvar Man-switches ""
;; ======================================================================
;; top level command and background process sentinel
+;;; This alias makes completion more predictable if ignoring case.
+;;;###autoload
+(defalias 'man 'manual-entry)
+
;;;###autoload
(defun manual-entry (arg)
"Get a Un*x manual page and put it in a buffer.
(defun Man-set-fonts ()
(goto-char (point-min))
- (while (re-search-forward "\\(.\b.\\)+" nil t)
+ (while (re-search-forward "\\(.\b\\)+" nil t)
(let ((st (match-beginning 0)) (en (match-end 0)))
(goto-char st)
(if window-system
- (put-text-property st en 'face
+ (put-text-property st (if (= en (point-max)) en (1+ en)) 'face
(if (looking-at "_") 'underline 'bold)))
(while (and (< (point) en) (looking-at ".\b"))
- (replace-match "") (forward-char 1)))))
+ (replace-match "")))))
(defun Man-bgproc-sentinel (process msg)
"Manpage background process sentinel."
(back-to-indentation)
(while (and (not (eobp)) (/= (point) runningpoint))
(setq runningpoint (point))
- (let* ((bow (point))
- (eow (re-search-forward Man-reference-regexp end t))
- (word (buffer-substring bow (match-end 0)))
+ (let* ((eow (re-search-forward Man-reference-regexp end t))
+ (word (buffer-substring (match-beginning 0) (match-end 0)))
(len (1- (length word))))
(if (not eow) nil
(if hyphenated
Returns t if section is found, nil otherwise."
(let ((curpos (point)))
(goto-char (point-min))
- (if (re-search-forward (concat "^" section) (point-max) t)
+ (if (re-search-forward (concat "^\\s-?" section) (point-max) t)
(progn (beginning-of-line) t)
(goto-char curpos)
nil)