* src/fns.c (Fcompare_strings): Use FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE.
[bpt/emacs.git] / lisp / woman.el
index 1410a89..2dda211 100644 (file)
@@ -1,9 +1,9 @@
 ;;; woman.el --- browse UN*X manual pages `wo (without) man'
 
-;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2014 Free Software Foundation, Inc.
 
 ;; Author: Francis J. Wright <F.J.Wright@qmul.ac.uk>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help, unix
 ;; Adapted-By: Eli Zaretskii <eliz@gnu.org>
 ;; Version: 0.551
               (substring arg 0 (match-end 1))
             arg))))
 
+(require 'cl-lib)
+
 (eval-when-compile                     ; to avoid compiler warnings
   (require 'dired)
-  (require 'cl-lib)
   (require 'apropos))
 
-(defun woman-mapcan (fn x)
-  "Return concatenated list of FN applied to successive `car' elements of X.
-FN must return a list, cons or nil.  Useful for splicing into a list."
-  ;; Based on the Standard Lisp function MAPCAN but with args swapped!
-  ;; More concise implementation than the recursive one.  -- dak
-  (apply #'nconc (mapcar fn x)))
-
 (defun woman-parse-colon-path (paths)
   "Explode search path string PATHS into a list of directory names.
 Allow Cygwin colon-separated search paths on Microsoft platforms.
@@ -438,27 +432,27 @@ As a special case, if PATHS is nil then replace it by calling
   (if (memq system-type '(windows-nt ms-dos))
       (cond ((null paths)
             (mapcar 'woman-Cyg-to-Win (woman-parse-man.conf)))
-           ((string-match ";" paths)
+           ((string-match-p ";" paths)
             ;; Assume DOS-style path-list...
-            (woman-mapcan              ; splice list into list
+            (cl-mapcan                 ; splice list into list
              (lambda (x)
                (if x
                    (list x)
                  (mapcar 'woman-Cyg-to-Win (woman-parse-man.conf))))
              (parse-colon-path paths)))
-           ((string-match "\\`[a-zA-Z]:" paths)
+           ((string-match-p "\\`[a-zA-Z]:" paths)
             ;; Assume single DOS-style path...
             (list paths))
            (t
             ;; Assume UNIX/Cygwin-style path-list...
-            (woman-mapcan              ; splice list into list
+            (cl-mapcan                 ; splice list into list
              (lambda (x)
                (mapcar 'woman-Cyg-to-Win
                        (if x (list x) (woman-parse-man.conf))))
              (let ((path-separator ":"))
                (parse-colon-path paths)))))
     ;; Assume host-default-style path-list...
-    (woman-mapcan                      ; splice list into list
+    (cl-mapcan                         ; splice list into list
      (lambda (x) (if x (list x) (woman-parse-man.conf)))
      (parse-colon-path (or paths "")))))
 
@@ -495,6 +489,8 @@ As a special case, if PATHS is nil then replace it by calling
 (defgroup woman nil
   "Browse UNIX manual pages `wo (without) man'."
   :tag "WoMan"
+  :link '(custom-manual "(woman) Top")
+  :link '(emacs-commentary-link :tag "Commentary" "woman.el")
   :group 'help)
 
 (defcustom woman-show-log nil
@@ -949,6 +945,7 @@ or different fonts."
 
 (defun woman-default-faces ()
   "Set foreground colors of italic and bold faces to their default values."
+  (declare (obsolete "customize the woman-* faces instead." "24.4"))
   (interactive)
   (face-spec-set 'woman-italic (face-user-default-spec 'woman-italic))
   (face-spec-set 'woman-bold (face-user-default-spec 'woman-bold)))
@@ -956,6 +953,7 @@ or different fonts."
 (defun woman-monochrome-faces ()
   "Set foreground colors of italic and bold faces to that of the default face.
 This is usually either black or white."
+  (declare (obsolete "customize the woman-* faces instead." "24.4"))
   (interactive)
   (set-face-foreground 'woman-italic 'unspecified)
   (set-face-foreground 'woman-bold 'unspecified))
@@ -972,7 +970,7 @@ This is usually either black or white."
     ;; With NTEmacs 20.5, the PATTERN option to `x-list-fonts' does
     ;; not seem to work and fonts may be repeated, so ...
     (dolist (font fonts)
-      (and (string-match "-Symbol-" font)
+      (and (string-match-p "-Symbol-" font)
           (not (member font symbol-fonts))
           (setq symbol-fonts (cons font symbol-fonts))))
     symbol-fonts))
@@ -1171,7 +1169,7 @@ Used non-interactively, arguments are optional: if given then TOPIC
 should be a topic string and non-nil RE-CACHE forces re-caching."
   (interactive (list nil current-prefix-arg))
   ;; The following test is for non-interactive calls via gnudoit etc.
-  (if (or (not (stringp topic)) (string-match "\\S " topic))
+  (if (or (not (stringp topic)) (string-match-p "\\S " topic))
       (let ((file-name (woman-file-name topic re-cache)))
        (if file-name
            (woman-find-file file-name)
@@ -1612,7 +1610,7 @@ decompress the file if appropriate.  See the documentation for the
        (let* ((bufname (file-name-nondirectory file-name))
               (case-fold-search t)
               (compressed
-               (not (not (string-match woman-file-compression-regexp bufname)))))
+               (and (string-match-p woman-file-compression-regexp bufname) t)))
          (if compressed
              (setq bufname (file-name-sans-extension bufname)))
          (setq bufname (if exists
@@ -1754,7 +1752,7 @@ Leave point at end of new text.  Return length of inserted text."
       ;; Co-operate with auto-compression mode:
       (if (and compressed
               (or (eq compressed t)
-                  (string-match woman-file-compression-regexp filename))
+                  (string-match-p woman-file-compression-regexp filename))
               ;; (not auto-compression-mode)
               (not (rassq 'jka-compr-handler file-name-handler-alist)) )
          ;; (error "Compressed file requires Auto File Decompression turned on")
@@ -1828,8 +1826,6 @@ Argument EVENT is the invoking mouse event."
    ["Use Full Frame Width" woman-toggle-fill-frame
     :active t :style toggle :selected woman-fill-frame]
    ["Reformat Last Man Page" woman-reformat-last-file t]
-   ["Use Monochrome Main Faces" woman-monochrome-faces t]
-   ["Use Default Main Faces" woman-default-faces t]
    ["Make Contents Menu" (woman-imenu t) (not woman-imenu-done)]
    "--"
    ["Describe (Wo)Man Mode" describe-mode t]
@@ -2192,7 +2188,7 @@ To be called on original buffer and any .so insertions."
   (let ((face-list (face-list)))
     (dolist (face face-list)
       (let ((face-name (symbol-name face)))
-       (if (and (string-match "\\`woman-" face-name)
+       (if (and (string-match-p "\\`woman-" face-name)
                 (face-underline-p face))
            (let ((face-no-ul (intern (concat face-name "-no-ul"))))
              (copy-face face face-no-ul)
@@ -2300,7 +2296,7 @@ Currently set only from '\" t in the first line of the source file.")
 
     ;; Process \k escapes BEFORE changing tab width (?):
     (goto-char from)
-    (woman-mark-horizonal-position)
+    (woman-mark-horizontal-position)
 
     ;; Set buffer-local variables:
     (setq fill-column woman-fill-column
@@ -3029,6 +3025,8 @@ Leave point at TO (which should be a marker)."
   "Delete any double-quote characters up to the end of the line."
   (woman-unquote (save-excursion (end-of-line) (point-marker))))
 
+(defvar woman1-unquote)          ; bound locally by woman1-roff-buffer
+
 (defun woman1-roff-buffer ()
   "Process non-breaking requests."
   (let ((case-fold-search t)
@@ -3069,8 +3067,6 @@ Leave point at TO (which should be a marker)."
   ".I -- Set words of current line in italic font."
   (woman1-B-or-I ".ft I\n"))
 
-(defvar woman1-unquote)          ; bound locally by woman1-roff-buffer
-
 (defun woman1-B-or-I (B-or-I)
   ".B/I -- Set words of current line in bold/italic font.
 B-OR-I is the appropriate complete control line."
@@ -3452,7 +3448,7 @@ Format paragraphs upto TO.  Supports special chars.
 Each element has the form (KEY VALUE . INC) -- inc may be nil.
 Also bound locally in `woman2-roff-buffer'.")
 
-(defun woman-mark-horizonal-position ()
+(defun woman-mark-horizontal-position ()
   "\\kx -- Store current horizontal position in INPUT LINE in register x."
   (while (re-search-forward "\\\\k\\(.\\)" nil t)
     (goto-char (match-beginning 0))