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* ((man-args topic)
	 (bufname (concat "*Man " 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))
      (with-current-buffer buffer
	(Man-notify-when-ready 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 (fboundp 'make-process)
	     (let ((proc (start-process
			  manual-program buffer
			  (if (memq system-type '(cygwin windows-nt))
			      shell-file-name
			    "sh")
			  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
		   (call-process 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))
	     (if Man-fontify-manpage-flag
		 (Man-fontify-manpage)
	       (Man-cleanup-manpage))
	     (Man-bgproc-sentinel bufname msg))))))
    buffer))