aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Oteiza2016-08-10 00:15:55 -0400
committerMark Oteiza2016-08-10 00:15:55 -0400
commit4ffdcfc6d1d88f821c15dfa30adeb0927cb9acd0 (patch)
treeaa6e75ade6d41d75cbdf47ebf3acf1f002453942
parente13c5467fc0c08c6875653df56b8b54185d0c4cc (diff)
downloademacs-4ffdcfc6d1d88f821c15dfa30adeb0927cb9acd0.tar.gz
emacs-4ffdcfc6d1d88f821c15dfa30adeb0927cb9acd0.zip
Nudge WoMan toward lexical-binding
* lisp/woman.el (woman-parse-man.conf, woman-manpath-add-locales): Use cl-pushnew instead of add-to-list. (woman-justify-list): Rename to woman-justify-styles. (woman-justify-styles): New array. (woman-justify, woman-decode-region, woman2-ad, woman2-na): Use it. (woman-cached-data): Use cl-pushnew instead of add-to-list.
-rw-r--r--lisp/woman.el33
1 files changed, 16 insertions, 17 deletions
diff --git a/lisp/woman.el b/lisp/woman.el
index b3162074c4e..9c3fb2ab4cd 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -568,11 +568,11 @@ or
568 "\ 568 "\
569^[ \t]*\\(?:\\(?:MANDATORY_\\|OPTIONAL_\\)?MANPATH[ \t]+\\(\\S-+\\)\\|\ 569^[ \t]*\\(?:\\(?:MANDATORY_\\|OPTIONAL_\\)?MANPATH[ \t]+\\(\\S-+\\)\\|\
570MANPATH_MAP[ \t]+\\(\\S-+\\)[ \t]+\\(\\S-+\\)\\)" nil t) 570MANPATH_MAP[ \t]+\\(\\S-+\\)[ \t]+\\(\\S-+\\)\\)" nil t)
571 (add-to-list 'manpath 571 (cl-pushnew (if (match-beginning 1)
572 (if (match-beginning 1) 572 (match-string 1)
573 (match-string 1) 573 (cons (match-string 2)
574 (cons (match-string 2) 574 (match-string 3)))
575 (match-string 3))))) 575 manpath))
576 manpath)) 576 manpath))
577 )) 577 ))
578 (setq path (cdr path))) 578 (setq path (cdr path)))
@@ -623,11 +623,12 @@ of `woman-expand-locale' on `woman-locale' added, where they exist."
623 (if (consp elem) 623 (if (consp elem)
624 (cdr elem) 624 (cdr elem)
625 elem)))))) 625 elem))))))
626 (add-to-list 'lst (if (consp elem) 626 (cl-pushnew (if (consp elem)
627 (cons (car elem) dir) 627 (cons (car elem) dir)
628 dir)))) 628 dir)
629 lst)))
629 ;; Non-locale-specific has lowest precedence. 630 ;; Non-locale-specific has lowest precedence.
630 (add-to-list 'lst elem))))) 631 (cl-pushnew elem lst)))))
631 632
632(defcustom woman-manpath 633(defcustom woman-manpath
633 ;; Locales could also be added in woman-expand-directory-path. 634 ;; Locales could also be added in woman-expand-directory-path.
@@ -1021,8 +1022,7 @@ Under MS-Windows, the default is
1021 1022
1022;;; Internal variables: 1023;;; Internal variables:
1023 1024
1024(defconst woman-justify-list 1025(defconst woman-justify-styles [left right center full]
1025 '(left right center full)
1026 "Justify styles for `fill-region-as-paragraph'.") 1026 "Justify styles for `fill-region-as-paragraph'.")
1027(defconst woman-adjust-left 0 ; == adjust off, noadjust 1027(defconst woman-adjust-left 0 ; == adjust off, noadjust
1028 "Adjustment indicator `l' -- adjust left margin only.") 1028 "Adjustment indicator `l' -- adjust left margin only.")
@@ -1037,8 +1037,7 @@ Under MS-Windows, the default is
1037 "Current adjustment number-register value.") 1037 "Current adjustment number-register value.")
1038(defvar woman-adjust-previous woman-adjust 1038(defvar woman-adjust-previous woman-adjust
1039 "Previous adjustment number-register value.") 1039 "Previous adjustment number-register value.")
1040(defvar woman-justify 1040(defvar woman-justify (aref woman-justify-styles woman-adjust)
1041 (nth woman-adjust woman-justify-list) ; use vector?
1042 "Current justification style for `fill-region-as-paragraph'.") 1041 "Current justification style for `fill-region-as-paragraph'.")
1043(defvar woman-justify-previous woman-justify 1042(defvar woman-justify-previous woman-justify
1044 "Previous justification style for `fill-region-as-paragraph'.") 1043 "Previous justification style for `fill-region-as-paragraph'.")
@@ -1198,7 +1197,7 @@ Called both to generate and to check the cache!"
1198 (setq path 1197 (setq path
1199 (split-string (getenv "PATH") path-separator t))) 1198 (split-string (getenv "PATH") path-separator t)))
1200 (setq dir (and (member (car dir) path) (cdr dir)))) 1199 (setq dir (and (member (car dir) path) (cdr dir))))
1201 (when dir (add-to-list 'lst (substitute-in-file-name dir))))) 1200 (when dir (cl-pushnew (substitute-in-file-name dir) lst))))
1202 (mapcar 'substitute-in-file-name woman-path))) 1201 (mapcar 'substitute-in-file-name woman-path)))
1203 1202
1204(defun woman-read-directory-cache () 1203(defun woman-read-directory-cache ()
@@ -2237,7 +2236,7 @@ Currently set only from \\='\\\" t in the first line of the source file.")
2237 woman-RS-left-margin nil 2236 woman-RS-left-margin nil
2238 woman-RS-prevailing-indent nil 2237 woman-RS-prevailing-indent nil
2239 woman-adjust woman-adjust-both 2238 woman-adjust woman-adjust-both
2240 woman-justify (nth woman-adjust woman-justify-list) 2239 woman-justify (aref woman-justify-styles woman-adjust)
2241 woman-nofill nil) 2240 woman-nofill nil)
2242 2241
2243 (setq woman-if-conditions-true 2242 (setq woman-if-conditions-true
@@ -4032,7 +4031,7 @@ Format paragraphs upto TO. (Breaks, but should not.)"
4032 ((memq (following-char) '(?b ?n)) woman-adjust-both) 4031 ((memq (following-char) '(?b ?n)) woman-adjust-both)
4033 (t (woman-get-numeric-arg)) 4032 (t (woman-get-numeric-arg))
4034 ) 4033 )
4035 woman-justify (nth woman-adjust woman-justify-list)) 4034 woman-justify (aref woman-justify-styles woman-adjust))
4036 (woman-delete-line 1) ; ignore any remaining arguments 4035 (woman-delete-line 1) ; ignore any remaining arguments
4037 (woman2-format-paragraphs to)) 4036 (woman2-format-paragraphs to))
4038 4037
@@ -4042,7 +4041,7 @@ Format paragraphs upto TO. (Breaks, but should not.)"
4042 (setq woman-adjust-previous woman-adjust 4041 (setq woman-adjust-previous woman-adjust
4043 woman-justify-previous woman-justify 4042 woman-justify-previous woman-justify
4044 woman-adjust woman-adjust-left ; fill but do not adjust 4043 woman-adjust woman-adjust-left ; fill but do not adjust
4045 woman-justify (nth woman-adjust woman-justify-list)) 4044 woman-justify (aref woman-justify-styles woman-adjust))
4046 (woman-delete-line 1) ; ignore any arguments 4045 (woman-delete-line 1) ; ignore any arguments
4047 (woman2-format-paragraphs to)) 4046 (woman2-format-paragraphs to))
4048 4047