Function: Man-getpage-in-background

Man-getpage-in-background is a byte-compiled function defined in man.el.gz.

Signature

(Man-getpage-in-background TOPIC)

Documentation

Use TOPIC to build and fire off the manpage and cleaning command.

Return the buffer in which the manpage will appear.

Source Code

;; Defined in /usr/src/emacs/lisp/man.el.gz
(defun Man-getpage-in-background (topic)
  "Use TOPIC to build and fire off the manpage and cleaning command.
Return the buffer in which the manpage will appear."
  (let* ((default-directory (Man-default-directory))
         (man-args topic)
	 (bufname
          (if (file-remote-p default-directory)
              (format "*Man %s %s*" (file-remote-p default-directory) man-args)
            (format "*Man %s*" man-args)))
	 (buffer (get-buffer bufname)))
    (if buffer
	(Man-notify-when-ready buffer)
      (message "Invoking %s %s in the background" manual-program man-args)
      (setq buffer (generate-new-buffer bufname))
      (Man-notify-when-ready buffer)
      (with-current-buffer buffer
	(setq buffer-undo-list t)
	(setq Man-original-frame (selected-frame))
	(setq Man-arguments man-args)
	(Man-mode)
	(setq mode-line-process
	      (concat " " (propertize (if Man-fontify-manpage-flag
					  "[formatting...]"
					"[cleaning...]")
				      'face 'mode-line-emphasis)))
	(Man-start-calling
	 (if (and (fboundp 'make-process)
                  (not Man-prefer-synchronous-call))
	     (let ((proc (start-file-process
			  manual-program buffer
			  (Man-shell-file-name)
			  shell-command-switch
			  (format (Man-build-man-command) man-args))))
	       (set-process-sentinel proc 'Man-bgproc-sentinel)
	       (set-process-filter proc 'Man-bgproc-filter))
	   (let* ((inhibit-read-only t)
		  (exit-status
		   (process-file
                    (Man-shell-file-name) nil (list buffer nil) nil
		    shell-command-switch
		    (format (Man-build-man-command) man-args)))
		  (msg ""))
	     (or (and (numberp exit-status)
		      (= exit-status 0))
		 (and (numberp exit-status)
		      (setq msg
			    (format "exited abnormally with code %d"
				    exit-status)))
		 (setq msg exit-status))
	     (man--maybe-fontify-manpage)
	     (Man-bgproc-sentinel (cons buffer exit-status) msg))))))
    buffer))