(defvar Man-topic-history nil "Topic read history.")
-(defvar man-mode-syntax-table
+(defvar Man-mode-syntax-table
(let ((table (copy-syntax-table (standard-syntax-table))))
(modify-syntax-entry ?. "w" table)
(modify-syntax-entry ?_ "w" table)
(setq word (concat word (match-string-no-properties 1)))
;; Make sure the section number gets included by the code below.
(goto-char (match-end 1)))
- (when (string-match "[._]+$" word)
+ (when (string-match "[-._]+$" word)
(setq word (substring word 0 (match-beginning 0))))
;; The following was commented out since the preceding code
;; should not produce a leading "*" in the first place.
(put 'Man-mode 'mode-class 'special)
-(defun Man-mode ()
+(define-derived-mode Man-mode fundamental-mode "Man"
"A mode for browsing Un*x manual pages.
The following man commands are available in the buffer. Try
The following key bindings are currently in effect in the buffer:
\\{Man-mode-map}"
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'Man-mode
- mode-name "Man"
- buffer-auto-save-file-name nil
+ (setq buffer-auto-save-file-name nil
mode-line-buffer-identification
(list (default-value 'mode-line-buffer-identification)
" {" 'Man-page-mode-string "}")
buffer-read-only t)
(buffer-disable-undo)
(auto-fill-mode -1)
- (use-local-map Man-mode-map)
- (set-syntax-table man-mode-syntax-table)
(setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
(set (make-local-variable 'outline-regexp) Man-heading-regexp)
(set (make-local-variable 'outline-level) (lambda () 1))
(Man-build-page-list)
(Man-strip-page-headers)
(Man-unindent)
- (Man-goto-page 1 t)
- (run-mode-hooks 'Man-mode-hook))
+ (Man-goto-page 1 t))
(defsubst Man-build-section-alist ()
"Build the list of manpage sections."