From: Stefan Kangas Date: Fri, 3 Jan 2025 21:06:43 +0000 (+0100) Subject: Extract new function man--maybe-fontify-manpage X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2f56ec2a244864b35e7efe5a5b58b683863a3651;p=emacs.git Extract new function man--maybe-fontify-manpage * lisp/man.el (man--maybe-fontify-manpage): Extract function from... (Man-getpage-in-background, Man-update-manpage) (Man-bgproc-filter): ...here. (cherry picked from commit 8e9317a1de66314dee96266863827c00cdefde2f) --- diff --git a/lisp/man.el b/lisp/man.el index bdbb868e966..41779b30663 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1248,9 +1248,7 @@ Return the buffer in which the manpage will appear." (format "exited abnormally with code %d" exit-status))) (setq msg exit-status)) - (if Man-fontify-manpage-flag - (Man-fontify-manpage) - (Man-cleanup-manpage)) + (man--maybe-fontify-manpage) (Man-bgproc-sentinel bufname msg)))))) buffer)) @@ -1271,9 +1269,7 @@ Return the buffer in which the manpage will appear." (Man-shell-file-name) nil (list (current-buffer) nil) nil shell-command-switch (format (Man-build-man-command) Man-arguments))) - (if Man-fontify-manpage-flag - (Man-fontify-manpage) - (Man-cleanup-manpage)) + (man--maybe-fontify-manpage) (goto-char old-pos) ;;restore the point, not strictly right. (unless (or (eq text nil) (= old-size (buffer-size))) @@ -1503,6 +1499,11 @@ script would have done them." (while (re-search-forward ".\b" nil t) (delete-char -2)) (Man-softhyphen-to-minus)) +(defun man--maybe-fontify-manpage () + (if Man-fontify-manpage-flag + (Man-fontify-manpage) + (Man-cleanup-manpage))) + (defun Man-bgproc-filter (process string) "Manpage background process filter. When manpage command is run asynchronously, PROCESS is the process @@ -1528,9 +1529,7 @@ command is run. Second argument STRING is the entire string of output." (Man-previous-section 1) (point)) (point)) - (if Man-fontify-manpage-flag - (Man-fontify-manpage) - (Man-cleanup-manpage))) + (man--maybe-fontify-manpage)) (set-marker (process-mark process) (point-max))))))))) (defun Man-bgproc-sentinel (process msg)