Function: Man-start-calling
Man-start-calling is a macro defined in man.el.gz.
Signature
(Man-start-calling &rest BODY)
Documentation
Start the man command in body after setting up the environment.
Source Code
;; Defined in /usr/src/emacs/lisp/man.el.gz
(defmacro Man-start-calling (&rest body)
"Start the man command in `body' after setting up the environment."
(declare (debug t))
`(let ((process-environment (copy-sequence process-environment))
;; The following is so Awk script gets \n intact
;; But don't prevent decoding of the outside.
(coding-system-for-write 'raw-text-unix)
;; We must decode the output by a coding system that the
;; system's locale suggests in multibyte mode.
(coding-system-for-read
(or coding-system-for-read ; allow overriding with "C-x RET c"
Man-coding-system
locale-coding-system))
;; Avoid possible error by using a directory that always exists.
(default-directory (Man-default-directory)))
;; Prevent any attempt to use display terminal fanciness.
(setenv "TERM" "dumb")
;; In Debian Woody, at least, we get overlong lines under X
;; unless COLUMNS or MANWIDTH is set. This isn't a problem on
;; a tty. man(1) says:
;; MANWIDTH
;; If $MANWIDTH is set, its value is used as the line
;; length for which manual pages should be formatted.
;; If it is not set, manual pages will be formatted
;; with a line length appropriate to the current
;; terminal (using an ioctl(2) if available, the value
;; of $COLUMNS, or falling back to 80 characters if
;; neither is available).
(when (or window-system
(not (or (getenv "MANWIDTH") (getenv "COLUMNS"))))
;; Since the page buffer is displayed beforehand,
;; we can select its window and get the window/frame width.
(setq-local Man-columns (Man-columns))
(setenv "COLUMNS" (number-to-string Man-columns)))
;; Since man-db 2.4.3-1, man writes plain text with no escape
;; sequences when stdout is not a tty. In 2.5.0, the following
;; env-var was added to allow control of this (see Debian Bug#340673).
(setenv "MAN_KEEP_FORMATTING" "1")
,@body))