]> code.delx.au - gnu-emacs/blobdiff - lisp/woman.el
Don’t create unnecessary marker in ‘delete-trailing-whitespace’
[gnu-emacs] / lisp / woman.el
index 75c3d2e3822a2dc751f3ab3ab944f5ef654037b6..8189f08b09777313da4f9dd00ba43ecb6b25f41d 100644 (file)
@@ -1,6 +1,6 @@
 ;;; woman.el --- browse UN*X manual pages `wo (without) man'
 
 ;;; woman.el --- browse UN*X manual pages `wo (without) man'
 
-;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2016 Free Software Foundation, Inc.
 
 ;; Author: Francis J. Wright <F.J.Wright@qmul.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
 
 ;; Author: Francis J. Wright <F.J.Wright@qmul.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
@@ -738,7 +738,7 @@ the `woman' command to update and re-write the cache."
 
 (defcustom woman-dired-keys t
   "List of `dired' mode keys to define to run WoMan on current file.
 
 (defcustom woman-dired-keys t
   "List of `dired' mode keys to define to run WoMan on current file.
-E.g. '(\"w\" \"W\"), or any non-null atom to automatically define
+E.g. (\"w\" \"W\"), or any non-null atom to automatically define
 \"w\" and \"W\" if they are unbound, or nil to do nothing.
 Default is t."
   :type '(choice (const :tag "None" nil)
 \"w\" and \"W\" if they are unbound, or nil to do nothing.
 Default is t."
   :type '(choice (const :tag "None" nil)
@@ -752,7 +752,10 @@ Default is t."
   "Imenu support for Sections and Subsections.
 An alist with elements of the form (MENU-TITLE REGEXP INDEX) --
 see the documentation for `imenu-generic-expression'."
   "Imenu support for Sections and Subsections.
 An alist with elements of the form (MENU-TITLE REGEXP INDEX) --
 see the documentation for `imenu-generic-expression'."
-  :type 'sexp
+  :type '(alist :key-type (choice :tag "Title" (const nil) string)
+                :value-type (group (choice (string :tag "Regexp")
+                                           function)
+                                   integer))
   :group 'woman-interface)
 
 (defcustom woman-imenu nil
   :group 'woman-interface)
 
 (defcustom woman-imenu nil
@@ -786,7 +789,7 @@ without interactive confirmation, if it exists as a topic."
 
 (defvar woman-file-regexp nil
   "Regexp used to select (possibly compressed) man source files, e.g.
 
 (defvar woman-file-regexp nil
   "Regexp used to select (possibly compressed) man source files, e.g.
-\"\\.\\([0-9lmnt]\\w*\\)\\(\\.\\(g?z\\|bz2\\|xz\\)\\)?\\'\".
+\"\\.\\([0-9lmnt]\\w*\\)\\(\\.\\(g?z\\|bz2\\|xz\\)\\)?\\\\='\".
 Built automatically from the customizable user options
 `woman-uncompressed-file-regexp' and `woman-file-compression-regexp'.")
 
 Built automatically from the customizable user options
 `woman-uncompressed-file-regexp' and `woman-file-compression-regexp'.")
 
@@ -816,7 +819,7 @@ becoming more common in the GNU world.  For example, the man pages
 in the ncurses package include `toe.1m', `form.3x', etc.
 
 Note: an optional compression regexp will be appended, so this regexp
 in the ncurses package include `toe.1m', `form.3x', etc.
 
 Note: an optional compression regexp will be appended, so this regexp
-MUST NOT end with any kind of string terminator such as $ or \\'."
+MUST NOT end with any kind of string terminator such as $ or \\\\='."
   :type 'regexp
   :set 'set-woman-file-regexp
   :group 'woman-interface)
   :type 'regexp
   :set 'set-woman-file-regexp
   :group 'woman-interface)
@@ -826,8 +829,8 @@ MUST NOT end with any kind of string terminator such as $ or \\'."
   "Do not change this unless you are sure you know what you are doing!
 Regexp used to match compressed man file extensions for which
 decompressors are available and handled by auto-compression mode,
   "Do not change this unless you are sure you know what you are doing!
 Regexp used to match compressed man file extensions for which
 decompressors are available and handled by auto-compression mode,
-e.g. \"\\\\.\\\\(g?z\\\\|bz2\\\\|xz\\\\)\\\\'\" for `gzip', `bzip2', or `xz'.
-Should begin with \\. and end with \\' and MUST NOT be optional."
+e.g. \"\\\\.\\\\(g?z\\\\|bz2\\\\|xz\\\\)\\\\\\='\" for `gzip', `bzip2', or `xz'.
+Should begin with \\. and end with \\\\=' and MUST NOT be optional."
   ;; Should be compatible with car of
   ;; `jka-compr-file-name-handler-entry', but that is unduly
   ;; complicated, includes an inappropriate extension (.tgz) and is
   ;; Should be compatible with car of
   ;; `jka-compr-file-name-handler-entry', but that is unduly
   ;; complicated, includes an inappropriate extension (.tgz) and is
@@ -923,25 +926,21 @@ or different fonts."
   '((t :inherit italic))
   "Face for italic font in man pages."
   :group 'woman-faces)
   '((t :inherit italic))
   "Face for italic font in man pages."
   :group 'woman-faces)
-(define-obsolete-face-alias 'woman-italic-face 'woman-italic "22.1")
 
 (defface woman-bold
   '((t :inherit bold))
   "Face for bold font in man pages."
   :group 'woman-faces)
 
 (defface woman-bold
   '((t :inherit bold))
   "Face for bold font in man pages."
   :group 'woman-faces)
-(define-obsolete-face-alias 'woman-bold-face 'woman-bold "22.1")
 
 (defface woman-unknown
   '((t :inherit font-lock-warning-face))
   "Face for all unknown fonts in man pages."
   :group 'woman-faces)
 
 (defface woman-unknown
   '((t :inherit font-lock-warning-face))
   "Face for all unknown fonts in man pages."
   :group 'woman-faces)
-(define-obsolete-face-alias 'woman-unknown-face 'woman-unknown "22.1")
 
 (defface woman-addition
   '((t :inherit font-lock-builtin-face))
   "Face for all WoMan additions to man pages."
   :group 'woman-faces)
 
 (defface woman-addition
   '((t :inherit font-lock-builtin-face))
   "Face for all WoMan additions to man pages."
   :group 'woman-faces)
-(define-obsolete-face-alias 'woman-addition-face 'woman-addition "22.1")
 
 (defun woman-default-faces ()
   "Set foreground colors of italic and bold faces to their default values."
 
 (defun woman-default-faces ()
   "Set foreground colors of italic and bold faces to their default values."
@@ -1102,7 +1101,7 @@ The ordinal numbers start from 0.")
 (defvar woman-if-conditions-true '(?n ?e ?o)
   "List of one-character built-in condition names that are true.
 Should include ?e, ?o (page even/odd) and either ?n (nroff) or ?t (troff).
 (defvar woman-if-conditions-true '(?n ?e ?o)
   "List of one-character built-in condition names that are true.
 Should include ?e, ?o (page even/odd) and either ?n (nroff) or ?t (troff).
-Default is '(?n ?e ?o).  Set via `woman-emulation'.")
+Default is (?n ?e ?o).  Set via `woman-emulation'.")
 
 \f
 ;;; Specialized utility functions:
 
 \f
 ;;; Specialized utility functions:
@@ -1651,7 +1650,7 @@ Do not call directly!"
             (setq woman-frame (make-frame)))))
     (set-buffer (get-buffer-create bufname))
     (condition-case nil
             (setq woman-frame (make-frame)))))
     (set-buffer (get-buffer-create bufname))
     (condition-case nil
-        (switch-to-buffer (current-buffer))
+        (pop-to-buffer-same-window (current-buffer))
       (error (pop-to-buffer (current-buffer))))
     (buffer-disable-undo)
     (setq buffer-read-only nil)
       (error (pop-to-buffer (current-buffer))))
     (buffer-disable-undo)
     (setq buffer-read-only nil)
@@ -1749,7 +1748,7 @@ Leave point at end of new text.  Return length of inserted text."
   ;; start in 19.34!
   (save-excursion
     (let ((case-fold-search t))
   ;; start in 19.34!
   (save-excursion
     (let ((case-fold-search t))
-      ;; Co-operate with auto-compression mode:
+      ;; Cooperate with auto-compression mode:
       (if (and compressed
               (or (eq compressed t)
                   (string-match-p woman-file-compression-regexp filename))
       (if (and compressed
               (or (eq compressed t)
                   (string-match-p woman-file-compression-regexp filename))
@@ -2061,14 +2060,14 @@ alist in `woman-buffer-alist' and return nil."
   (if (zerop woman-buffer-number)
       (let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
        (if buffer
   (if (zerop woman-buffer-number)
       (let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
        (if buffer
-           (switch-to-buffer buffer)
+           (pop-to-buffer-same-window buffer)
          ;; Delete alist element:
          (setq woman-buffer-alist (cdr woman-buffer-alist))
          nil))
     (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
           (buffer (get-buffer (cdr (car (cdr prev-ptr))))))
       (if buffer
          ;; Delete alist element:
          (setq woman-buffer-alist (cdr woman-buffer-alist))
          nil))
     (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
           (buffer (get-buffer (cdr (car (cdr prev-ptr))))))
       (if buffer
-         (switch-to-buffer buffer)
+         (pop-to-buffer-same-window buffer)
        ;; Delete alist element:
        (setcdr prev-ptr (cdr (cdr prev-ptr)))
        (if (>= woman-buffer-number (length woman-buffer-alist))
        ;; Delete alist element:
        (setcdr prev-ptr (cdr (cdr prev-ptr)))
        (if (>= woman-buffer-number (length woman-buffer-alist))
@@ -2218,7 +2217,7 @@ To be called on original buffer and any .so insertions."
 (defvar woman-emulate-tbl nil
   "True if WoMan should emulate the tbl preprocessor.
 This applies to text between .TE and .TS directives.
 (defvar woman-emulate-tbl nil
   "True if WoMan should emulate the tbl preprocessor.
 This applies to text between .TE and .TS directives.
-Currently set only from '\" t in the first line of the source file.")
+Currently set only from \\='\\\" t in the first line of the source file.")
 
 (defun woman-decode-region (from _to)
   "Decode the region between FROM and TO in UN*X man-page source format."
 
 (defun woman-decode-region (from _to)
   "Decode the region between FROM and TO in UN*X man-page source format."
@@ -2716,7 +2715,7 @@ If DELETE is non-nil then delete from point."
 
 (defsubst woman-unescape (macro)
   "Replace escape sequences in the body of MACRO.
 
 (defsubst woman-unescape (macro)
   "Replace escape sequences in the body of MACRO.
-Replaces || by |, but | by \, where | denotes the internal escape."
+Replaces || by |, but | by \\, where | denotes the internal escape."
   (let (start)
     (while (setq start (string-match woman-unescape-regex macro start))
       (setq macro
   (let (start)
     (while (setq start (string-match woman-unescape-regex macro start))
       (setq macro
@@ -2838,7 +2837,7 @@ special characters."
 (defun woman-strings (&optional to)
   "Process ?roff string requests and escape sequences up to buffer position TO.
 Strings are defined/updated by `.ds xx string' requests and
 (defun woman-strings (&optional to)
   "Process ?roff string requests and escape sequences up to buffer position TO.
 Strings are defined/updated by `.ds xx string' requests and
-interpolated by `\*x' and `\*(xx' escapes."
+interpolated by `\\*x' and `\\*(xx' escapes."
   ;; Add support for .as and .rm?
   (while
       ;; Find .ds requests and \* escapes:
   ;; Add support for .as and .rm?
   (while
       ;; Find .ds requests and \* escapes:
@@ -3549,7 +3548,7 @@ The expression may be an argument in quotes."
                       (if (> (woman-parse-numeric-value) 0) 1 0))
                     )))
            ))
                       (if (> (woman-parse-numeric-value) 0) 1 0))
                     )))
            ))
-;    (if (looking-at "[ \t\nRC\)\"]")  ; R, C are tab types
+;    (if (looking-at "[ \t\nRC)\"]")   ; R, C are tab types
 ;      ()
 ;      (WoMan-warn "Unimplemented numerical operator `%c' in %s"
 ;                (following-char)
 ;      ()
 ;      (WoMan-warn "Unimplemented numerical operator `%c' in %s"
 ;                (following-char)
@@ -3583,7 +3582,7 @@ expression in parentheses.  Leaves point after the value."
                    ;; string-to-number returns 0 if number not parsed.
                    (string-to-number (match-string 0)))
                   ((looking-at "\\\\n\\([-+]\\)?\\(?:\
                    ;; string-to-number returns 0 if number not parsed.
                    (string-to-number (match-string 0)))
                   ((looking-at "\\\\n\\([-+]\\)?\\(?:\
-\\[\\([^]]+\\)\\]\\|\(\\(..\\)\\|\\(.\\)\\)")
+\\[\\([^]]+\\)\\]\\|(\\(..\\)\\|\\(.\\)\\)")
                    ;; interpolate number register, maybe auto-incremented
                    (let* ((pm (match-string-no-properties 1))
                           (name (or (match-string-no-properties 2)
                    ;; interpolate number register, maybe auto-incremented
                    (let* ((pm (match-string-no-properties 1))
                           (name (or (match-string-no-properties 2)
@@ -3719,7 +3718,7 @@ expression in parentheses.  Leaves point after the value."
   "Find and return start of next control line.
 PAT, if non-nil, specifies an additional component of the control
 line regexp to search for, which is appended to the default
   "Find and return start of next control line.
 PAT, if non-nil, specifies an additional component of the control
 line regexp to search for, which is appended to the default
-regexp, \"\\(\\\\c\\)?\\n[.']\"."
+regexp, \"\\(\\\\c\\)?\\n[.\\=']\"."
   (let ((pattern (concat "\\(\\\\c\\)?\n[.']" pat))
         to)
     (save-excursion
   (let ((pattern (concat "\\(\\\\c\\)?\n[.']" pat))
         to)
     (save-excursion
@@ -3761,7 +3760,7 @@ Round to whole lines, default 1 line.  Format paragraphs upto TO.
 
 (defun woman2-TH (to)
   ".TH n c x v m -- Begin a man page.  Format paragraphs upto TO.
 
 (defun woman2-TH (to)
   ".TH n c x v m -- Begin a man page.  Format paragraphs upto TO.
-n is the name of the page in chapter c\; x is extra commentary\;
+n is the name of the page in chapter c; x is extra commentary;
 v alters page foot left; m alters page head center.
 \(Should set prevailing indent and tabs to 5.)"
   (woman-forward-arg 'unquote 'concat)
 v alters page foot left; m alters page head center.
 \(Should set prevailing indent and tabs to 5.)"
   (woman-forward-arg 'unquote 'concat)
@@ -3981,7 +3980,7 @@ Optional argument NUMERIC, if non-nil, means the argument is numeric."
     (goto-char from)))
 
 (defun woman-horizontal-line ()
     (goto-char from)))
 
 (defun woman-horizontal-line ()
-  "\\l'Nc' -- Draw a horizontal line of length N using character c, default _."
+  "\\l\\='Nc\\=' -- Draw a horizontal line of length N using character c, default _."
   (delete-char -1)
   (delete-char 1)
   (looking-at "\\(.\\)\\(.*\\)\\1")
   (delete-char -1)
   (delete-char 1)
   (looking-at "\\(.\\)\\(.*\\)\\1")
@@ -4349,7 +4348,7 @@ Format paragraphs upto TO."
 
 (defun woman2-ta (to)
   ".ta Nt ... -- Set tabs, left type, unless t=R(right), C(centered).
 
 (defun woman2-ta (to)
   ".ta Nt ... -- Set tabs, left type, unless t=R(right), C(centered).
-\(Breaks, but should not.)  The tab stops are separated by spaces\;
+\(Breaks, but should not.)  The tab stops are separated by spaces;
 a value preceded by + represents an increment to the previous stop value.
 Format paragraphs upto TO."
   (setq tab-stop-list nil)
 a value preceded by + represents an increment to the previous stop value.
 Format paragraphs upto TO."
   (setq tab-stop-list nil)
@@ -4548,11 +4547,11 @@ Format paragraphs upto TO."
 
 (defun WoMan-log (format &rest args)
   "Log a message out of FORMAT control string and optional ARGS."
 
 (defun WoMan-log (format &rest args)
   "Log a message out of FORMAT control string and optional ARGS."
-  (WoMan-log-1 (apply 'format format args)))
+  (WoMan-log-1 (apply #'format-message format args)))
 
 (defun WoMan-warn (format &rest args)
   "Log a warning message out of FORMAT control string and optional ARGS."
 
 (defun WoMan-warn (format &rest args)
   "Log a warning message out of FORMAT control string and optional ARGS."
-  (setq format (apply 'format format args))
+  (setq format (apply #'format-message format args))
   (WoMan-log-1 (concat "**  " format)))
 
 ;; request is not used dynamically by any callees.
   (WoMan-log-1 (concat "**  " format)))
 
 ;; request is not used dynamically by any callees.
@@ -4627,9 +4626,4 @@ logging the message."
 
 (provide 'woman)
 
 
 (provide 'woman)
 
-\f
-;; Local Variables:
-;; coding: utf-8
-;; End:
-
 ;;; woman.el ends here
 ;;; woman.el ends here