]> git.eshelyaron.com Git - emacs.git/commitdiff
Extract new function man--maybe-fontify-manpage
authorStefan Kangas <stefankangas@gmail.com>
Fri, 3 Jan 2025 21:06:43 +0000 (22:06 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 4 Jan 2025 20:58:24 +0000 (21:58 +0100)
* 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)

lisp/man.el

index bdbb868e9663049dffcac350739473bf93e35a9a..41779b306639f750ea882e315c1b2bb0b99d3f51 100644 (file)
@@ -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)