-;;; man.el --- browse UNIX manual pages -*- coding: utf-8 -*-
+;;; man.el --- browse UNIX manual pages
-;; Copyright (C) 1993-1994, 1996-1997, 2001-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 1996-1997, 2001-2016 Free Software
+;; Foundation, Inc.
;; Author: Barry A. Warsaw <bwarsaw@cen.com>
;; Maintainer: emacs-devel@gnu.org
;; ============= TODO ===========
;; - Add a command for printing.
;; - The awk script deletes multiple blank lines. This behavior does
-;; not allow to understand if there was indeed a blank line at the
+;; not allow one to understand if there was indeed a blank line at the
;; end or beginning of a page (after the header, or before the
;; footer). A different algorithm should be used. It is easy to
;; compute how many blank lines there are before and after the page
"Manpage cleaning filter command phrases.
This variable contains a list of the following form:
-'((command-string phrase-string*)*)
+ ((command-string phrase-string*)*)
Each phrase-string is concatenated onto the command-string to form a
command filter. The (standard) output (and standard error) of the Un*x
(defcustom Man-frame-parameters nil
"Frame parameter list for creating a new frame for a manual page."
- :type 'sexp
+ :type '(repeat (cons :format "%v"
+ (symbol :tag "Parameter")
+ (sexp :tag "Value")))
:group 'man)
(defcustom Man-downcase-section-letters-flag t
(defvar Man-reference-regexp
(concat "\\(" Man-name-regexp
- "\\(\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
+ "\\(‐?\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
Man-section-regexp "\\))")
"Regular expression describing a reference to another manpage.")
(defvar Man-apropos-regexp
- (concat "\\\[\\(" Man-name-regexp "\\)\\\][ \t]*(\\(" Man-section-regexp "\\))")
+ (concat "\\[\\(" Man-name-regexp "\\)\\][ \t]*(\\(" Man-section-regexp "\\))")
"Regular expression describing a reference to manpages in \"man -k output\".")
(defvar Man-synopsis-regexp "SYNOPSIS"
;; `call-process' below sends it to /dev/null,
;; so we don't need `2>' even with DOS shells
;; which do support stderr redirection.
- ((not (fboundp 'start-process)) " %s")
+ ((not (fboundp 'make-process)) " %s")
((concat " %s 2>" null-device)))))
(flist Man-filter-list))
(while (and flist (car flist))
;; Record the distance traveled.
(setq distance (- column (current-column)))
(when (looking-back
- (concat "([ \t]*\\(?:" Man-section-regexp "\\)[ \t]*)"))
+ (concat "([ \t]*\\(?:" Man-section-regexp "\\)[ \t]*)")
+ (line-beginning-position))
;; Skip section number backwards.
(goto-char (match-beginning 0))
(skip-chars-backward " \t"))
;; see this-
;; command-here(1)
;; Note: This code gets executed iff our entry is after POS.
- (when (looking-at "[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
+ (when (looking-at "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
(setq word (concat word (match-string-no-properties 1)))
;; Make sure the section number gets included by the code below.
(goto-char (match-end 1)))
foo(sec)[, bar(sec) [, ...]] [other stuff] - description
For more details and some regression tests, please see
-test/automated/man-tests.el in the emacs bzr repository."
+test/automated/man-tests.el in the emacs repository."
(goto-char (point-min))
;; See man-tests for data about which systems use which format (hopefully we
;; will be able to simplify the code if/when some of those formats aren't
An \"apropos\" query with -k gives a buffer of matching page
names or descriptions. The pattern argument is usually an
-\"egrep\" style regexp.
+\"grep -E\" style regexp.
-k pattern"
"[cleaning...]")
'face 'mode-line-emphasis)))
(Man-start-calling
- (if (fboundp 'start-process)
+ (if (fboundp 'make-process)
(let ((proc (start-process
manual-program buffer
(if (memq system-type '(cygwin windows-nt))
(quit-restore-window
(get-buffer-window (current-buffer) t) 'kill)
(kill-buffer (current-buffer)))
- (message "Can't find the %s manpage"
- (Man-page-from-arguments args)))
+ ;; Entries hyphenated due to the window's width
+ ;; won't be found in the man database, so remove
+ ;; the hyphenation -- assuming Groff hyphenates
+ ;; either with hyphen-minus (ASCII 45, #x2d),
+ ;; hyphen (#x2010) or soft hyphen (#xad) -- and
+ ;; look again.
+ (if (string-match "[-‐]" args)
+ (let ((str (replace-match "" nil nil args)))
+ (Man-getpage-in-background str))
+ (message "Can't find the %s manpage"
+ (Man-page-from-arguments args))))
(if Man-fontify-manpage-flag
(message "%s man page formatted"
(Man-page-from-arguments Man-arguments))
- (message "%s man page cleaned up" Man-arguments))
+ (message "%s man page cleaned up"
+ (Man-page-from-arguments Man-arguments)))
(unless (and (processp process)
(not (eq (process-status process) 'exit)))
(setq mode-line-process nil))