(defvar Man-mode-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map)
- (set-keymap-parent map button-buffer-map)
+ (set-keymap-parent map
+ (make-composed-keymap button-buffer-map special-mode-map))
- (define-key map [?\S-\ ] 'scroll-down-command)
- (define-key map " " 'scroll-up-command)
- (define-key map "\177" 'scroll-down-command)
(define-key map "n" 'Man-next-section)
(define-key map "p" 'Man-previous-section)
(define-key map "\en" 'Man-next-manpage)
(define-key map "\ep" 'Man-previous-manpage)
- (define-key map ">" 'end-of-buffer)
- (define-key map "<" 'beginning-of-buffer)
(define-key map "." 'beginning-of-buffer)
(define-key map "r" 'Man-follow-manual-reference)
(define-key map "g" 'Man-goto-section)
(define-key map "s" 'Man-goto-see-also-section)
(define-key map "k" 'Man-kill)
- (define-key map "q" 'Man-quit)
(define-key map "u" 'Man-update-manpage)
(define-key map "m" 'man)
;; Not all the man references get buttons currently. The text in the
;; manual page can contain references to other man pages
(define-key map "\r" 'man-follow)
- (define-key map "?" 'describe-mode)
(easy-menu-define nil map
"`Man-mode' menu."
"--"
["Man..." man t]
["Kill Buffer" Man-kill t]
- ["Quit" Man-quit t]))
+ ["Quit" quit-window t]))
map)
"Keymap for Man mode.")
(defvar bookmark-make-record-function)
-(put 'Man-mode 'mode-class 'special)
-
-(define-derived-mode Man-mode fundamental-mode "Man"
+(define-derived-mode Man-mode special-mode "Man"
"A mode for browsing Un*x manual pages.
The following man commands are available in the buffer. Try
\\[Man-previous-section] Jump to previous manpage section.
\\[Man-goto-section] Go to a manpage section.
\\[Man-goto-see-also-section] Jumps to the SEE ALSO manpage section.
-\\[Man-quit] Deletes the manpage window, bury its buffer.
+\\[quit-window] Deletes the manpage window, bury its buffer.
\\[Man-kill] Deletes the manpage window, kill its buffer.
\\[describe-mode] Prints this help text.
mode-line-buffer-identification
(list (default-value 'mode-line-buffer-identification)
" {" 'Man-page-mode-string "}")
- truncate-lines t
- buffer-read-only t)
+ truncate-lines t)
(buffer-disable-undo)
(auto-fill-mode -1)
(setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
(interactive)
(quit-window t))
-(defun Man-quit ()
- "Bury the buffer containing the manpage."
- (interactive)
- (quit-window))
-
(defun Man-goto-page (page &optional noerror)
"Go to the manual page on page PAGE."
(interactive
(woman-insert-file-contents filename compressed)
;; Set buffer's default directory to that of the file.
(setq default-directory (file-name-directory filename))
- (set (make-local-variable 'backup-inhibited) t)
+ (setq-local backup-inhibited t)
(set-visited-file-name "")
(woman-process-buffer)))
(define-key map [remap man] 'woman)
(define-key map [remap man-follow] 'woman-follow)
map)
- "Keymap for woman mode.")
+ "Keymap for `woman-mode'.")
(defun woman-follow (topic)
"Get a Un*x manual page of the item under point and put it in a buffer."
(woman-reformat-last-file))
(defvar bookmark-make-record-function)
-(put 'woman-mode 'mode-class 'special)
-(defun woman-mode ()
+(define-derived-mode woman-mode special-mode "WoMan"
"Turn on (most of) Man mode to browse a buffer formatted by WoMan.
WoMan is an ELisp emulation of much of the functionality of the Emacs
`man' command running the standard UN*X man and ?roff programs.
WoMan author: F.J.Wright@Maths.QMW.ac.uk
WoMan version: see `woman-version'.
-See `Man-mode' for additional details."
+See `Man-mode' for additional details.
+\\{woman-mode-map}"
(let ((Man-build-page-list (symbol-function 'Man-build-page-list))
(Man-strip-page-headers (symbol-function 'Man-strip-page-headers))
(Man-unindent (symbol-function 'Man-unindent))
(kill-local-variable 'mode-line-buffer-identification)
(use-local-map woman-mode-map)
;; Imenu support:
- (set (make-local-variable 'imenu-generic-expression)
- ;; `make-local-variable' in case imenu not yet loaded!
- woman-imenu-generic-expression)
- (set (make-local-variable 'imenu-space-replacement) " ")
+ (setq imenu-generic-expression woman-imenu-generic-expression)
+ (setq-local imenu-space-replacement " ")
;; Bookmark support.
- (set (make-local-variable 'bookmark-make-record-function)
- 'woman-bookmark-make-record)
+ (setq-local bookmark-make-record-function 'woman-bookmark-make-record)
;; For reformat ...
;; necessary when reformatting a file in its old buffer:
(setq imenu--last-menubar-index-alist nil)
(setq woman-imenu-done nil)
(if woman-imenu (woman-imenu))
(let ((inhibit-read-only t))
- (Man-highlight-references 'WoMan-xref-man-page))
- (set-buffer-modified-p nil)
- (run-mode-hooks 'woman-mode-hook))
+ (Man-highlight-references 'WoMan-xref-man-page)))
(defun woman-imenu (&optional redraw)
"Add a \"Contents\" menu to the menubar.
((eq c ?\t) ; skip
(if (eq (following-char) ?\t)
(forward-char) ; both tabs, just skip
- (dotimes (i woman-tab-width)
+ (dotimes (_ woman-tab-width)
(if (eolp)
(insert ?\s) ; extend line
(forward-char)) ; skip