aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2010-11-05 01:16:55 -0700
committerGlenn Morris2010-11-05 01:16:55 -0700
commitf7fe4837cd719d4d57eebafa4940b534e250ec60 (patch)
tree8065a5a5e658cfaf419545907a9a139f57a9b205 /lisp
parent869c4186c170eb786d2327c99fb7dada463315a0 (diff)
downloademacs-f7fe4837cd719d4d57eebafa4940b534e250ec60.tar.gz
emacs-f7fe4837cd719d4d57eebafa4940b534e250ec60.zip
Quiet, woman. (Sorry...).
* lisp/woman.el (woman0-roff-buffer, woman1-roff-buffer) (woman2-roff-buffer): Give local variable `request' a prefix. (woman0-macro): Rename argument `request' in the same way. (woman-request): New name for `request' dynamic variable. (woman-unquote, woman-forward-arg): Update for above name change. (woman1-roff-buffer): Give local variable `unquote' a prefix. (woman1-unquote): New name for `unquote' dynamic variable. (woman1-B-or-I, woman1-alt-fonts): Update for above name change. (woman-translations): Rename from `translations'. No longer global. (woman2-tr, woman-translate): Update for above name change. (woman-translate): Check for bound variable. (woman2-roff-buffer): Give local variable `translations' a prefix.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/woman.el93
2 files changed, 67 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 86eee226d6d..4da5b10ea8c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,18 @@
12010-11-05 Glenn Morris <rgm@gnu.org> 12010-11-05 Glenn Morris <rgm@gnu.org>
2 2
3 * woman.el (woman0-roff-buffer, woman1-roff-buffer)
4 (woman2-roff-buffer): Give local variable `request' a prefix.
5 (woman0-macro): Rename argument `request' in the same way.
6 (woman-request): New name for `request' dynamic variable.
7 (woman-unquote, woman-forward-arg): Update for above name change.
8 (woman1-roff-buffer): Give local variable `unquote' a prefix.
9 (woman1-unquote): New name for `unquote' dynamic variable.
10 (woman1-B-or-I, woman1-alt-fonts): Update for above name change.
11 (woman-translations): Rename from `translations'. No longer global.
12 (woman2-tr, woman-translate): Update for above name change.
13 (woman-translate): Check for bound variable.
14 (woman2-roff-buffer): Give local variable `translations' a prefix.
15
3 * play/doctor.el: Give all local variables a prefix. Update callers. 16 * play/doctor.el: Give all local variables a prefix. Update callers.
4 (doc$, doctor-put-meaning): Use backquote. 17 (doc$, doctor-put-meaning): Use backquote.
5 18
diff --git a/lisp/woman.el b/lisp/woman.el
index 96cfea72d4e..265b20bb2d2 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -2475,23 +2475,23 @@ Preserves location of `point'."
2475Start at FROM and re-scan new text as appropriate." 2475Start at FROM and re-scan new text as appropriate."
2476 (goto-char from) 2476 (goto-char from)
2477 (let ((woman0-if-to (make-marker)) 2477 (let ((woman0-if-to (make-marker))
2478 request woman0-macro-alist 2478 woman-request woman0-macro-alist
2479 (woman0-search-regex-start woman0-search-regex-start) 2479 (woman0-search-regex-start woman0-search-regex-start)
2480 (woman0-search-regex 2480 (woman0-search-regex
2481 (concat woman0-search-regex-start woman0-search-regex-end)) 2481 (concat woman0-search-regex-start woman0-search-regex-end))
2482 woman0-rename-alist) 2482 woman0-rename-alist)
2483 (set-marker-insertion-type woman0-if-to t) 2483 (set-marker-insertion-type woman0-if-to t)
2484 (while (re-search-forward woman0-search-regex nil t) 2484 (while (re-search-forward woman0-search-regex nil t)
2485 (setq request (match-string 1)) 2485 (setq woman-request (match-string 1))
2486 (cond ((string= request "ig") (woman0-ig)) 2486 (cond ((string= woman-request "ig") (woman0-ig))
2487 ((string= request "if") (woman0-if "if")) 2487 ((string= woman-request "if") (woman0-if "if"))
2488 ((string= request "ie") (woman0-if "ie")) 2488 ((string= woman-request "ie") (woman0-if "ie"))
2489 ((string= request "el") (woman0-el)) 2489 ((string= woman-request "el") (woman0-el))
2490 ((string= request "so") (woman0-so)) 2490 ((string= woman-request "so") (woman0-so))
2491 ((string= request "rn") (woman0-rn)) 2491 ((string= woman-request "rn") (woman0-rn))
2492 ((string= request "de") (woman0-de)) 2492 ((string= woman-request "de") (woman0-de))
2493 ((string= request "am") (woman0-de 'append)) 2493 ((string= woman-request "am") (woman0-de 'append))
2494 (t (woman0-macro request)))) 2494 (t (woman0-macro woman-request))))
2495 (set-marker woman0-if-to nil) 2495 (set-marker woman0-if-to nil)
2496 (woman0-rename) 2496 (woman0-rename)
2497 ;; Should now re-run `woman0-roff-buffer' if any renaming was 2497 ;; Should now re-run `woman0-roff-buffer' if any renaming was
@@ -2522,6 +2522,7 @@ Start at FROM and re-scan new text as appropriate."
2522 (goto-char from) ; necessary! 2522 (goto-char from) ; necessary!
2523 (woman2-process-escapes to 'numeric)) 2523 (woman2-process-escapes to 'numeric))
2524 2524
2525;; request does not appear to be used dynamically by any callees.
2525(defun woman0-if (request) 2526(defun woman0-if (request)
2526 ".if/ie c anything -- Discard unless c evaluates to true. 2527 ".if/ie c anything -- Discard unless c evaluates to true.
2527Remember condition for use by a subsequent `.el'. 2528Remember condition for use by a subsequent `.el'.
@@ -2573,6 +2574,7 @@ REQUEST is the invoking directive without the leading dot."
2573 (woman-if-ignore woman0-if-to request) ; ERROR! 2574 (woman-if-ignore woman0-if-to request) ; ERROR!
2574 (woman-if-body request woman0-if-to (eq c negated))))) 2575 (woman-if-body request woman0-if-to (eq c negated)))))
2575 2576
2577;; request is not used dynamically by any callees.
2576(defun woman-if-body (request to delete) ; should be reversed as `accept'? 2578(defun woman-if-body (request to delete) ; should be reversed as `accept'?
2577 "Process if-body, including \\{ ... \\}. 2579 "Process if-body, including \\{ ... \\}.
2578REQUEST is the invoking directive without the leading dot. 2580REQUEST is the invoking directive without the leading dot.
@@ -2629,6 +2631,7 @@ If DELETE is non-nil then delete from point."
2629 (if (looking-at "[ \t]*\\{") (search-forward "\\}")) 2631 (if (looking-at "[ \t]*\\{") (search-forward "\\}"))
2630 (forward-line 1)))) 2632 (forward-line 1))))
2631 2633
2634;; request is not used dynamically by any callees.
2632(defun woman-if-ignore (to request) 2635(defun woman-if-ignore (to request)
2633 "Ignore but warn about an if request ending at TO, named REQUEST." 2636 "Ignore but warn about an if request ending at TO, named REQUEST."
2634 (WoMan-warn-ignored request "ignored -- condition not handled!") 2637 (WoMan-warn-ignored request "ignored -- condition not handled!")
@@ -2760,15 +2763,17 @@ Optional argument APPEND, if non-nil, means append macro."
2760 (beginning-of-line) ; delete .de/am line 2763 (beginning-of-line) ; delete .de/am line
2761 (woman-delete-line 1)) 2764 (woman-delete-line 1))
2762 2765
2763(defun woman0-macro (request) 2766;; request may be used dynamically (woman-interpolate-macro calls
2764 "Process the macro call named REQUEST." 2767;; woman-forward-arg).
2768(defun woman0-macro (woman-request)
2769 "Process the macro call named WOMAN-REQUEST."
2765 ;; Leaves point at start of new text. 2770 ;; Leaves point at start of new text.
2766 (let ((macro (assoc request woman0-macro-alist))) 2771 (let ((macro (assoc woman-request woman0-macro-alist)))
2767 (if macro 2772 (if macro
2768 (woman-interpolate-macro (cdr macro)) 2773 (woman-interpolate-macro (cdr macro))
2769 ;; SHOULD DELETE THE UNINTERPRETED REQUEST!!!!! 2774 ;; SHOULD DELETE THE UNINTERPRETED REQUEST!!!!!
2770 ;; Output this message once only per call (cf. strings)? 2775 ;; Output this message once only per call (cf. strings)?
2771 (WoMan-warn "Undefined macro %s not interpolated!" request)))) 2776 (WoMan-warn "Undefined macro %s not interpolated!" woman-request))))
2772 2777
2773(defun woman-interpolate-macro (macro) 2778(defun woman-interpolate-macro (macro)
2774 "Interpolate (.de) or append (.am) expansion of MACRO into the buffer." 2779 "Interpolate (.de) or append (.am) expansion of MACRO into the buffer."
@@ -2985,8 +2990,10 @@ Useful for constructing the alist variable `woman-special-characters'."
2985 2990
2986;;; Formatting macros that do not cause a break: 2991;;; Formatting macros that do not cause a break:
2987 2992
2988(defvar request) ; Bound locally by woman1-roff-buffer 2993;; Bound locally by woman[012]-roff-buffer, and also, annoyingly and
2989(defvar unquote) ; Bound locally by woman1-roff-buffer 2994;; confusingly, as a function argument. Use dynamically in
2995;; woman-unquote and woman-forward-arg.
2996(defvar woman-request)
2990 2997
2991(defun woman-unquote (to) 2998(defun woman-unquote (to)
2992 "Delete any double-quote characters between point and TO. 2999 "Delete any double-quote characters between point and TO.
@@ -3001,7 +3008,7 @@ Leave point at TO (which should be a marker)."
3001 (setq in-quote (not in-quote)) 3008 (setq in-quote (not in-quote))
3002 )) 3009 ))
3003 (if in-quote 3010 (if in-quote
3004 (WoMan-warn "Unpaired \" in .%s arguments." request)))) 3011 (WoMan-warn "Unpaired \" in .%s arguments." woman-request))))
3005 3012
3006(defsubst woman-unquote-args () 3013(defsubst woman-unquote-args ()
3007 "Delete any double-quote characters up to the end of the line." 3014 "Delete any double-quote characters up to the end of the line."
@@ -3010,7 +3017,7 @@ Leave point at TO (which should be a marker)."
3010(defun woman1-roff-buffer () 3017(defun woman1-roff-buffer ()
3011 "Process non-breaking requests." 3018 "Process non-breaking requests."
3012 (let ((case-fold-search t) 3019 (let ((case-fold-search t)
3013 request fn unquote) 3020 woman-request fn woman1-unquote)
3014 (while 3021 (while
3015 ;; Find next control line: 3022 ;; Find next control line:
3016 (re-search-forward woman-request-regexp nil t) 3023 (re-search-forward woman-request-regexp nil t)
@@ -3018,14 +3025,14 @@ Leave point at TO (which should be a marker)."
3018 ;; Construct woman function to call: 3025 ;; Construct woman function to call:
3019 ((setq fn (intern-soft 3026 ((setq fn (intern-soft
3020 (concat "woman1-" 3027 (concat "woman1-"
3021 (setq request (match-string 1))))) 3028 (setq woman-request (match-string 1)))))
3022 (if (get fn 'notfont) ; not a font-change request 3029 (if (get fn 'notfont) ; not a font-change request
3023 (funcall fn) 3030 (funcall fn)
3024 ;; Delete request or macro name: 3031 ;; Delete request or macro name:
3025 (woman-delete-match 0) 3032 (woman-delete-match 0)
3026 ;; If no args then apply to next line else unquote args 3033 ;; If no args then apply to next line else unquote args
3027 ;; (unquote is used by called function): 3034 ;; (woman1-unquote is used by called function):
3028 (setq unquote (not (eolp))) 3035 (setq woman1-unquote (not (eolp)))
3029 (if (eolp) (delete-char 1)) 3036 (if (eolp) (delete-char 1))
3030; ;; Hide leading control character in unquoted argument: 3037; ;; Hide leading control character in unquoted argument:
3031; (cond ((memq (following-char) '(?. ?')) 3038; (cond ((memq (following-char) '(?. ?'))
@@ -3034,7 +3041,7 @@ Leave point at TO (which should be a marker)."
3034 ;; Call the appropriate function: 3041 ;; Call the appropriate function:
3035 (funcall fn) 3042 (funcall fn)
3036 ;; Hide leading control character in quoted argument (only): 3043 ;; Hide leading control character in quoted argument (only):
3037 (if (and unquote (memq (following-char) '(?. ?'))) 3044 (if (and woman1-unquote (memq (following-char) '(?. ?')))
3038 (insert "\\&")))))))) 3045 (insert "\\&"))))))))
3039 3046
3040;;; Font-changing macros: 3047;;; Font-changing macros:
@@ -3047,6 +3054,8 @@ Leave point at TO (which should be a marker)."
3047 ".I -- Set words of current line in italic font." 3054 ".I -- Set words of current line in italic font."
3048 (woman1-B-or-I ".ft I\n")) 3055 (woman1-B-or-I ".ft I\n"))
3049 3056
3057(defvar woman1-unquote) ; bound locally by woman1-roff-buffer
3058
3050(defun woman1-B-or-I (B-or-I) 3059(defun woman1-B-or-I (B-or-I)
3051 ".B/I -- Set words of current line in bold/italic font. 3060 ".B/I -- Set words of current line in bold/italic font.
3052B-OR-I is the appropriate complete control line." 3061B-OR-I is the appropriate complete control line."
@@ -3055,7 +3064,7 @@ B-OR-I is the appropriate complete control line."
3055 ;; Return to bol to process .SM/.B, .B/.if etc. 3064 ;; Return to bol to process .SM/.B, .B/.if etc.
3056 ;; or start of first arg to hide leading control char. 3065 ;; or start of first arg to hide leading control char.
3057 (save-excursion 3066 (save-excursion
3058 (if unquote 3067 (if woman1-unquote
3059 (woman-unquote-args) 3068 (woman-unquote-args)
3060 (while (looking-at "^[.']") (forward-line)) 3069 (while (looking-at "^[.']") (forward-line))
3061 (end-of-line) 3070 (end-of-line)
@@ -3102,11 +3111,12 @@ B-OR-I is the appropriate complete control line."
3102 ;; Return to start of first arg to hide leading control char: 3111 ;; Return to start of first arg to hide leading control char:
3103 (save-excursion 3112 (save-excursion
3104 (setq fonts (cdr fonts)) 3113 (setq fonts (cdr fonts))
3105 (woman-forward-arg unquote 'concat) ; unquote is bound above 3114 ;; woman1-unquote is bound in woman1-roff-buffer.
3115 (woman-forward-arg woman1-unquote 'concat)
3106 (while (not (eolp)) 3116 (while (not (eolp))
3107 (insert (car fonts)) 3117 (insert (car fonts))
3108 (setq fonts (cdr fonts)) 3118 (setq fonts (cdr fonts))
3109 (woman-forward-arg unquote 'concat)) ; unquote is bound above 3119 (woman-forward-arg woman1-unquote 'concat))
3110 (insert "\\fR"))) 3120 (insert "\\fR")))
3111 3121
3112(defun woman-forward-arg (&optional unquote concat) 3122(defun woman-forward-arg (&optional unquote concat)
@@ -3123,7 +3133,7 @@ If optional arg CONCAT is non-nil then join arguments."
3123 (re-search-forward "\"\\|$")) 3133 (re-search-forward "\"\\|$"))
3124 (if (eq (preceding-char) ?\") 3134 (if (eq (preceding-char) ?\")
3125 (if unquote (delete-char -1)) 3135 (if unquote (delete-char -1))
3126 (WoMan-warn "Unpaired \" in .%s arguments." request))) 3136 (WoMan-warn "Unpaired \" in .%s arguments." woman-request)))
3127 ;; (re-search-forward "[^\\\n] \\|$") ; inconsistent 3137 ;; (re-search-forward "[^\\\n] \\|$") ; inconsistent
3128 (skip-syntax-forward "^ ")) 3138 (skip-syntax-forward "^ "))
3129 (cond ((null concat) (skip-chars-forward " \t")) ; don't skip eol! 3139 (cond ((null concat) (skip-chars-forward " \t")) ; don't skip eol!
@@ -3338,7 +3348,12 @@ Ignore the default face and underline only word characters."
3338 3348
3339;;; Output translation: 3349;;; Output translation:
3340 3350
3341(defvar translations nil) ; Also bound locally by woman2-roff-buffer 3351;; This is only set by woman2-tr. It is bound locally in woman2-roff-buffer.
3352;; It is also used by woman-translate. woman-translate may be called
3353;; outside the scope of woman2-roff-buffer (by experiment). Therefore
3354;; this used to be globally bound to nil, to avoid an error. Instead
3355;; we can use bound-and-true-p in woman-translate.
3356(defvar woman-translations)
3342;; A list of the form (\"[ace]\" (a . b) (c . d) (e . ?\ )) or nil. 3357;; A list of the form (\"[ace]\" (a . b) (c . d) (e . ?\ )) or nil.
3343 3358
3344(defun woman-get-next-char () 3359(defun woman-get-next-char ()
@@ -3358,8 +3373,8 @@ Format paragraphs upto TO. Supports special chars.
3358 ;; This should be an update, but consing onto the front of the alist 3373 ;; This should be an update, but consing onto the front of the alist
3359 ;; has the same effect and match duplicates should not matter. 3374 ;; has the same effect and match duplicates should not matter.
3360 ;; Initialize translation data structures: 3375 ;; Initialize translation data structures:
3361 (let ((matches (car translations)) 3376 (let ((matches (car woman-translations))
3362 (alist (cdr translations)) 3377 (alist (cdr woman-translations))
3363 a b) 3378 a b)
3364 ;; `matches' must be a string: 3379 ;; `matches' must be a string:
3365 (setq matches 3380 (setq matches
@@ -3381,15 +3396,15 @@ Format paragraphs upto TO. Supports special chars.
3381 (if (= (string-to-char matches) ?\]) 3396 (if (= (string-to-char matches) ?\])
3382 (substring matches 3) 3397 (substring matches 3)
3383 (concat "[" matches)) 3398 (concat "[" matches))
3384 translations (cons matches alist)) 3399 woman-translations (cons matches alist))
3385 ;; Format any following text: 3400 ;; Format any following text:
3386 (woman2-format-paragraphs to))) 3401 (woman2-format-paragraphs to)))
3387 3402
3388(defsubst woman-translate (to) 3403(defsubst woman-translate (to)
3389 "Translate up to marker TO. Do this last of all transformations." 3404 "Translate up to marker TO. Do this last of all transformations."
3390 (if translations 3405 (if (bound-and-true-p woman-translations)
3391 (let ((matches (car translations)) 3406 (let ((matches (car woman-translations))
3392 (alist (cdr translations)) 3407 (alist (cdr woman-translations))
3393 ;; Translations are case-sensitive, eg ".tr ab" does not 3408 ;; Translations are case-sensitive, eg ".tr ab" does not
3394 ;; affect "A" (bug#6849). 3409 ;; affect "A" (bug#6849).
3395 (case-fold-search nil)) 3410 (case-fold-search nil))
@@ -3633,7 +3648,7 @@ expression in parentheses. Leaves point after the value."
3633 (insert-and-inherit (symbol-function 'insert-and-inherit)) 3648 (insert-and-inherit (symbol-function 'insert-and-inherit))
3634 (set-text-properties (symbol-function 'set-text-properties)) 3649 (set-text-properties (symbol-function 'set-text-properties))
3635 (woman-registers woman-registers) 3650 (woman-registers woman-registers)
3636 fn request translations 3651 fn woman-request woman-translations
3637 tab-stop-list) 3652 tab-stop-list)
3638 (set-marker-insertion-type to t) 3653 (set-marker-insertion-type to t)
3639 ;; ?roff does not squeeze multiple spaces, but does fill, so... 3654 ;; ?roff does not squeeze multiple spaces, but does fill, so...
@@ -3649,13 +3664,13 @@ expression in parentheses. Leaves point after the value."
3649 ;; Construct woman function to call: 3664 ;; Construct woman function to call:
3650 ((setq fn (intern-soft 3665 ((setq fn (intern-soft
3651 (concat "woman2-" 3666 (concat "woman2-"
3652 (setq request (match-string 1))))) 3667 (setq woman-request (match-string 1)))))
3653 ;; Delete request or macro name: 3668 ;; Delete request or macro name:
3654 (woman-delete-match 0)) 3669 (woman-delete-match 0))
3655 ;; Unrecognised request: 3670 ;; Unrecognised request:
3656 ((prog1 nil 3671 ((prog1 nil
3657 ;; (WoMan-warn ".%s request ignored!" request) 3672 ;; (WoMan-warn ".%s request ignored!" woman-request)
3658 (WoMan-warn-ignored request "ignored!") 3673 (WoMan-warn-ignored woman-request "ignored!")
3659 ;; (setq fn 'woman2-LP) 3674 ;; (setq fn 'woman2-LP)
3660 ;; AVOID LEAVING A BLANK LINE! 3675 ;; AVOID LEAVING A BLANK LINE!
3661 ;; (setq fn 'woman2-format-paragraphs) 3676 ;; (setq fn 'woman2-format-paragraphs)
@@ -4486,6 +4501,7 @@ Format paragraphs upto TO."
4486 (setq format (apply 'format format args)) 4501 (setq format (apply 'format format args))
4487 (WoMan-log-1 (concat "** " format))) 4502 (WoMan-log-1 (concat "** " format)))
4488 4503
4504;; request is not used dynamically by any callees.
4489(defun WoMan-warn-ignored (request ignored) 4505(defun WoMan-warn-ignored (request ignored)
4490 "Log a warning message about ignored directive REQUEST. 4506 "Log a warning message about ignored directive REQUEST.
4491IGNORED is a string appended to the log message." 4507IGNORED is a string appended to the log message."
@@ -4557,5 +4573,4 @@ logging the message."
4557 4573
4558(provide 'woman) 4574(provide 'woman)
4559 4575
4560;; arch-tag: eea35e90-552f-4712-a94b-d9ffd3db7651
4561;;; woman.el ends here 4576;;; woman.el ends here