diff options
Diffstat (limited to 'lisp/man.el')
-rw-r--r-- | lisp/man.el | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/lisp/man.el b/lisp/man.el index 409fadb66b8..d52ca2156d2 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1157,7 +1157,7 @@ See the variable `Man-notify-method' for the different notification behaviors." (let ((saved-frame (with-current-buffer man-buffer Man-original-frame))) (pcase Man-notify-method - (`newframe + ('newframe ;; Since we run asynchronously, perhaps while Emacs is waiting ;; for input, we must not leave a different buffer current. We ;; can't rely on the editor command loop to reselect the @@ -1168,25 +1168,25 @@ See the variable `Man-notify-method' for the different notification behaviors." (set-window-dedicated-p (frame-selected-window frame) t) (or (display-multi-frame-p frame) (select-frame frame))))) - (`pushy + ('pushy (switch-to-buffer man-buffer)) - (`bully + ('bully (and (frame-live-p saved-frame) (select-frame saved-frame)) (pop-to-buffer man-buffer) (delete-other-windows)) - (`aggressive + ('aggressive (and (frame-live-p saved-frame) (select-frame saved-frame)) (pop-to-buffer man-buffer)) - (`friendly + ('friendly (and (frame-live-p saved-frame) (select-frame saved-frame)) (display-buffer man-buffer 'not-this-window)) - (`polite + ('polite (beep) (message "Manual buffer %s is ready" (buffer-name man-buffer))) - (`quiet + ('quiet (message "Manual buffer %s is ready" (buffer-name man-buffer))) (_ ;; meek (message "")) @@ -1206,10 +1206,7 @@ Same for the ANSI bold and normal escape sequences." (interactive) (goto-char (point-min)) ;; Fontify ANSI escapes. - (let ((ansi-color-apply-face-function - (lambda (beg end face) - (when face - (put-text-property beg end 'face face)))) + (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face) (ansi-color-map Man-ansi-color-map)) (ansi-color-apply-on-region (point-min) (point-max))) ;; Other highlighting. @@ -1220,31 +1217,33 @@ Same for the ANSI bold and normal escape sequences." (goto-char (point-min)) (while (and (search-forward "__\b\b" nil t) (not (eobp))) (backward-delete-char 4) - (put-text-property (point) (1+ (point)) 'face 'Man-underline)) + (put-text-property (point) (1+ (point)) + 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (search-forward "\b\b__" nil t) (backward-delete-char 4) - (put-text-property (1- (point)) (point) 'face 'Man-underline)))) + (put-text-property (1- (point)) (point) + 'font-lock-face 'Man-underline)))) (goto-char (point-min)) (while (and (search-forward "_\b" nil t) (not (eobp))) (backward-delete-char 2) - (put-text-property (point) (1+ (point)) 'face 'Man-underline)) + (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (search-forward "\b_" nil t) (backward-delete-char 2) - (put-text-property (1- (point)) (point) 'face 'Man-underline)) + (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) (goto-char (point-min)) (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) (replace-match "\\1") - (put-text-property (1- (point)) (point) 'face 'Man-overstrike)) + (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike)) (goto-char (point-min)) (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) (replace-match "o") - (put-text-property (1- (point)) (point) 'face 'bold)) + (put-text-property (1- (point)) (point) 'font-lock-face 'bold)) (goto-char (point-min)) (while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+") - (put-text-property (1- (point)) (point) 'face 'bold)) + (put-text-property (1- (point)) (point) 'font-lock-face 'bold)) ;; When the header is longer than the manpage name, groff tries to ;; condense it to a shorter line interspersed with ^H. Remove ^H with ;; their preceding chars (but don't put Man-overstrike). (Bug#5566) @@ -1258,7 +1257,7 @@ Same for the ANSI bold and normal escape sequences." (while (re-search-forward Man-heading-regexp nil t) (put-text-property (match-beginning 0) (match-end 0) - 'face 'Man-overstrike)))) + 'font-lock-face 'Man-overstrike)))) (defun Man-highlight-references (&optional xref-man-type) "Highlight the references on mouse-over. @@ -1538,16 +1537,16 @@ The following key bindings are currently in effect in the buffer: (set (make-local-variable 'bookmark-make-record-function) 'Man-bookmark-make-record)) -(defsubst Man-build-section-alist () +(defun Man-build-section-list () "Build the list of manpage sections." - (setq Man--sections nil) + (setq Man--sections ()) (goto-char (point-min)) (let ((case-fold-search nil)) - (while (re-search-forward Man-heading-regexp (point-max) t) + (while (re-search-forward Man-heading-regexp nil t) (let ((section (match-string 1))) (unless (member section Man--sections) (push section Man--sections))) - (forward-line 1))) + (forward-line))) (setq Man--sections (nreverse Man--sections))) (defsubst Man-build-references-alist () @@ -1828,7 +1827,7 @@ Specify which REFERENCE to use; default is based on word at point." (widen) (goto-char page-start) (narrow-to-region page-start page-end) - (Man-build-section-alist) + (Man-build-section-list) (Man-build-references-alist) (goto-char (point-min))))) |