Spelling fixes.
[bpt/emacs.git] / lisp / woman.el
index eb801b5..243196a 100644 (file)
@@ -1439,8 +1439,8 @@ The cdr of each alist element is the path-index / filename."
          (push (woman-topic-all-completions-1 dir path-index)
                files))
       (setq path-index (1+ path-index)))
-    ;; Uniquefy topics:
-    ;; Concate all lists with a single nconc call to
+    ;; Uniquify topics:
+    ;; Concatenate all lists with a single nconc call to
     ;; avoid retraversing the first lists repeatedly  -- dak
     (woman-topic-all-completions-merge
      (apply #'nconc files))))
@@ -2023,7 +2023,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
 ;; Both advices are disabled because "a file in Emacs should not put
 ;; advice on a function in Emacs" (see Info node "(elisp)Advising
 ;; Functions").  Counting the formatting time is useful for
-;; developping, but less applicable for daily use.  The advice for
+;; developing, but less applicable for daily use.  The advice for
 ;; `Man-getpage-in-background' can be discarded, because the
 ;; key-binding in `woman-mode-map' has been remapped to call `woman'
 ;; but `man'.  Michael Albinus <michael.albinus@gmx.de>
@@ -2157,8 +2157,8 @@ No external programs are used."
   (run-hooks 'woman-pre-format-hook)
   (and (boundp 'font-lock-mode) font-lock-mode (font-lock-mode -1))
   ;; (fundamental-mode)
-  (let ((start-time (current-time))    ; (HIGH LOW MICROSEC)
-       time)                           ; HIGH * 2**16 + LOW seconds
+  (let ((start-time (current-time))
+       time)
     (message "WoMan formatting buffer...")
 ;  (goto-char (point-min))
 ;  (cond
@@ -2167,10 +2167,8 @@ No external programs are used."
 ;    (delete-region (point-min) (point))) ; potentially dangerous!
 ;   (t (message "WARNING: .TH request not found -- not man-page format?")))
     (woman-decode-region (point-min) (point-max))
-    (setq time (current-time)
-         time (+ (* (- (car time) (car start-time)) 65536)
-                 (- (cadr time) (cadr start-time))))
-    (message "WoMan formatting buffer...done in %d seconds" time)
+    (setq time (float-time (time-since start-time)))
+    (message "WoMan formatting buffer...done in %g seconds" time)
     (WoMan-log-end time))
   (run-hooks 'woman-post-format-hook))
 
@@ -2560,7 +2558,7 @@ REQUEST is the invoking directive without the leading dot."
      ;; ((looking-at "[te]") (setq c nil))   ; reject t(roff) and e(ven page)
      ((looking-at "[ntoe]")
       (setq c (memq (following-char) woman-if-conditions-true)))
-     ;; Unrecognised letter so reject:
+     ;; Unrecognized letter so reject:
      ((looking-at "[A-Za-z]") (setq c nil)
       (WoMan-warn "%s %s -- unrecognized condition name rejected!"
                  request (match-string 0)))
@@ -2623,15 +2621,27 @@ If DELETE is non-nil then delete from point."
     ;; Process matching .el anything:
     (cond ((string= request "ie")
           ;; Discard unless previous .ie c `evaluated to false'.
+          ;; IIUC, an .ie must be followed by an .el.
+          ;; (An if with no else uses .if rather than .ie.)
+          ;; TODO warn if no .el found?
+          ;; The .el should come immediately after the .ie (modulo
+          ;; comments etc), but this searches to eob.
           (cond ((re-search-forward "^[.'][ \t]*el[ \t]*" nil t)
                  (woman-delete-match 0)
                  (woman-if-body "el" nil (not delete)))))
+;;; FIXME neither the comment nor the code here make sense to me.
+;;; This branch was executed for an else (any else, AFAICS).
+;;; At this point, the else in question has already been processed above.
+;;; The re-search will find the _next_ else, if there is one, and
+;;; delete it.  If there is one, it belongs to another if block.  (Bug#9447)
+;;; woman0-el does not need this bit either.
          ;; Got here after processing a single-line `.ie' as a body
          ;; clause to be discarded:
-         ((string= request "el")
-          (cond ((re-search-forward "^[.'][ \t]*el[ \t]*" nil t)
-                 (woman-delete-match 0)
-                 (woman-if-body "el" nil t)))))
+;;;      ((string= request "el")
+;;;       (cond ((re-search-forward "^[.'][ \t]*el[ \t]*" nil t)
+;;;              (woman-delete-match 0)
+;;;              (woman-if-body "el" nil t)))))
+          )
     (goto-char from)))
 
 (defun woman0-el ()
@@ -2927,11 +2937,15 @@ interpolated by `\*x' and `\*(xx' escapes."
     ("bv" "|")                         ; bold vertical
 
     ;; groff etc. extensions:
+    ;; List these via eg man -Tdvi groff_char > groff_char.dvi.
     ("lq" "\"")
     ("rq" "\"")
     ("aq" "'")
     ("ha" "^")
     ("ti" "~")
+    ("oq" "‘")                          ; u2018
+    ("cq" "’")                          ; u2019
+    ("hy" "‐")                          ; u2010
     )
   "Alist of special character codes with ASCII and extended-font equivalents.
 Each alist elements has the form
@@ -3683,7 +3697,7 @@ expression in parentheses.  Leaves point after the value."
                               (setq woman-request (match-string 1)))))
             ;; Delete request or macro name:
             (woman-delete-match 0))
-           ;; Unrecognised request:
+           ;; Unrecognized request:
            ((prog1 nil
               ;; (WoMan-warn ".%s request ignored!" woman-request)
               (WoMan-warn-ignored woman-request "ignored!")
@@ -3940,6 +3954,8 @@ Optional argument NUMERIC, if non-nil, means the argument is numeric."
     ;; Done like this to preserve any text properties of the `\'
     (while (search-forward "\\" to t)
       (let ((c (following-char)))
+       ;; Some other escapes, such as \f, are handled in
+       ;; `woman0-process-escapes'.
        (cond ((eq c ?')                ; \' -> '
               (delete-char -1)
               (cond (numeric           ; except in numeric args, \' -> `
@@ -3953,12 +3969,7 @@ Optional argument NUMERIC, if non-nil, means the argument is numeric."
               (insert "\t"))
              ((and numeric
                    (memq c '(?w ?n ?h)))) ; leave \w, \n, \h (?????)
-             ((eq c ?l) (woman-horizontal-line))
-             (t
-              ;; \? -> ? where ? is any remaining character
-              (WoMan-warn "Escape ignored: \\%c -> %c" c c)
-              (delete-char -1))
-             )))
+             ((eq c ?l) (woman-horizontal-line)))))
     (goto-char from)
     ;; Process non-default tab settings:
     (cond (tab-stop-list
@@ -4529,7 +4540,7 @@ IGNORED is a string appended to the log message."
   "Log the end of formatting in *WoMan-Log*.
 TIME specifies the time it took to format the man page, to be printed
 with the message."
-  (WoMan-log-1 (format "Formatting time %d seconds." time) 'end))
+  (WoMan-log-1 (format "Formatting time %g seconds." time) 'end))
 
 (defun WoMan-log-1 (string &optional end)
   "Log a message STRING in *WoMan-Log*.
@@ -4584,4 +4595,9 @@ logging the message."
 
 (provide 'woman)
 
+\f
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
 ;;; woman.el ends here