• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +refs:dired +refs:pop +refs:to +refs:buffer

26 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
33 ;; `man' (or `manual-entry') command to format a UN*X manual `page'
35 ;; intended to emulate the whole of the -man macro package, plus those
37 ;; the emulation is modified to include the reformatting done by the
58 ;; need to adjust the user option `woman-file-compression-regexp'.
82 ;; variable is set then WoMan will use it; otherwise you may need to
83 ;; reset the Lisp variable `woman-manpath', and you may also want to
88 ;; completion. By default, WoMan suggests the word nearest to the
89 ;; cursor in the current buffer as the topic.
97 ;; (autoload 'woman-dired-find-file "woman"
98 ;; "In dired, run the WoMan man-page browser on this file." t)
99 ;; (add-hook 'dired-mode-hook
101 ;; (define-key dired-mode-map "W" 'woman-dired-find-file)))
102 ;; and open the directory containing the man page file using dired,
105 ;; In each case, the result should (!) be a buffer in Man mode showing
112 ;; (By default, WoMan will automatically define the dired keys "W" and
114 ;; behaviour is controlled by the user option `woman-dired-keys'.
115 ;; Note that the `dired-x' (dired extra) package binds
116 ;; `dired-copy-filename-as-kill' to the key "w" (as pointed out by Jim
117 ;; Davidson), although "W" appears to be really unused. The `dired-x'
118 ;; package will over-write the WoMan binding to "w", whereas (by
119 ;; default) WoMan will not overwrite the `dired-x' binding.)
122 ;; Juanma Barranquero. If you really want to square the man-woman
123 ;; circle then you might care to define the following bash function in
143 ;; The `woman' command uses the word nearest to point in the current
144 ;; buffer as the default topic to look up if it matches the name of a
147 ;; `woman-use-topic-at-point' to t; thanks to Benjamin Riefenstahl for
151 ;; which may be useful to provide special private key bindings, e.g.
165 ;; top-level `Emacs' group. In order to be able to customize WoMan
166 ;; without first loading it, add the following sexp to your .emacs:
174 ;; before formatting a buffer and `woman-post-format-hook' immediately
175 ;; after formatting a buffer. These hooks can be used for special
176 ;; customizations that require code to be executed, etc., although
182 ;; it is better to use the built-in WoMan imenu support).
184 ;; The WoMan menu provides an option to make a contents menu for the
186 ;; variable `woman-imenu' to `t' then WoMan will do it automatically
194 ;; WoMan is configured not to replace spaces in an imenu *Completion*
195 ;; buffer. For further documentation of the use of imenu, such as
221 ;; The number of consecutive blank lines in the formatted buffer
223 ;; .sp 1 (p. 14). Current policy is to output vertical space only
236 ;; The *WoMan-Log* buffer
241 ;; writes a warning to this buffer. If the variable `woman-show-log'
243 ;; displays this buffer. Many WoMan warnings can be completely
245 ;; requests that it is correct to ignore. In some future version this
252 ;; formatted buffer to indicate precisely where they occur by
253 ;; resetting the variable `woman-ignore' to `nil' (by default it is
260 ;; Put something like this in your .emacs. The call to
261 ;; set-visited-file-name is to avoid font-locking triggered by
272 ;; (file-name-sans-extension buffer-file-name)))))
290 ;; the *WoMan-Log* buffer relating to the problem file, together with
292 ;; the source file from, but do not send it to me unless I ask you to!
303 ;; `w32-downcase-file-names' to `t' and use all lower case when
308 ;; the variable `woman-cache-filename' to save the cache between Emacs
314 ;; information cached (in main memory and, optionally, saved to disc).
317 ;; `woman' command (only) to rebuild its topic cache, and to re-save
318 ;; it to `woman-cache-filename' if this variable has a non-nil value.
352 ;; Support diversion and traps (to some extent) - for Tcl/tk pages?
358 ;; -- three main passes, each to process respectively:
365 ;; escape or request and then calls the appropriate function to
440 (eval-when-compile ; to avoid compiler warnings
441 (require 'dired)
446 "Return concatenated list of FN applied to successive `car' elements of X.
463 (mapcar 'woman-Cyg-to-Win (woman-parse-man.conf)))
470 (mapcar 'woman-Cyg-to-Win (woman-parse-man.conf))))
479 (mapcar 'woman-Cyg-to-Win
488 (defun woman-Cyg-to-Win (file)
489 "Convert an absolute filename FILE from Cygwin to Windows form."
491 ;; Cygwin to Cygwin form.
496 ;; Try to use Cygwin mount table via `cygpath.exe'.
498 (with-temp-buffer
501 (buffer-substring 1 (buffer-size)))
504 ;; Hack /cygdrive/x/ or /x/ or (obsolete) //x/ to x:/
525 "*If non-nil then show the *WoMan-Log* buffer if appropriate.
526 I.e. if any warning messages are written to it. Default is nil."
531 "*Hook run by WoMan immediately before formatting a buffer.
537 "*Hook run by WoMan immediately after formatting a buffer.
554 (mapcar 'woman-Cyg-to-Win path)
556 "*List of dirs to search and/or files to try for man config file.
559 the first to start with \"man\" and has an extension starting
561 then it is parsed instead to provide a default value for
592 (with-temp-buffer
599 (add-to-list 'manpath
612 "*List of DIRECTORY TREES to search for UN*X manual files.
619 to manual trees: if such an element's car is equal to a path
631 element must evaluate to a SINGLE directory name. Trailing `/'s are
645 "Regexp to match man directories UNDER `woman-manpath' directories.
648 Microsoft platforms. Its purpose is to avoid `cat?', `.', `..', etc."
655 "*List of SPECIFIC DIRECTORIES to search for UN*X manual files.
660 These directories are searched in addition to the directory trees
670 element must evaluate to a SINGLE directory name (regexp, see above).
690 If the `woman' command is slow to find files then try 3, which may be
693 file `woman-cache-filename' for a change to take effect.
702 It is used to save and restore the cache between sessions. This is
706 the `woman' command to update and re-write the cache."
712 (defcustom woman-dired-keys t
713 "*List of `dired' mode keys to define to run WoMan on current file.
714 E.g. '(\"w\" \"W\"), or any non-null atom to automatically define
715 \"w\" and \"W\" if they are unbound, or nil to do nothing.
732 "*If non-nil then WoMan adds a Contents menu to the menubar.
733 It does this by calling `imenu-add-to-menubar'. Default is nil."
738 "*The title to use if WoMan adds a Contents menu to the menubar.
746 ;; `woman-file-name' sets it to this value if it is unbound.
761 "Regexp used to select (possibly compressed) man source files, e.g.
770 "Bind SYMBOL to VALUE and set `woman-file-regexp' as per user customizations.
785 Regexp used to select man source files (ignoring any compression extension).
800 Regexp used to match compressed man file extensions for which
842 Set this variable to 7 to emulate GNU man formatting."
855 the buffer, which may aid debugging."
860 "*If non-nil, preserve ASCII characters in the WoMan buffer.
861 Otherwise, to save time, some backslashes and spaces may be
864 respectively) so that the buffer content is strictly wrong even though
866 buffer text is searched, copied or saved to a file."
893 It defaults to a non-nil value if the display supports either colors
921 ;; but not enough so to make font errors look terrible. (Files that use
922 ;; non-standard fonts seem to do so badly or in idiosyncratic ways!)
934 "Face for all WoMan additions to man pages."
940 "Set foreground colors of italic and bold faces to their default values."
946 "Set foreground colors of italic and bold faces to that of the default face.
961 ;; With NTEmacs 20.5, the PATTERN option to `x-list-fonts' does
962 ;; not seem to work and fonts may be repeated, so ...
973 ;; Set the symbol font only if `woman-use-symbol-font' is true, to
994 "*A string describing the symbol font to use for special characters.
1046 "Blank lines to leave as vertical space.")
1060 "Set `woman-nospace' to nil."
1069 "Regexp to match a ?roff request plus trailing white space.")
1072 "Buffer-local: set to true if function `woman-imenu' has been called.")
1073 (make-variable-buffer-local 'woman-imenu-done)
1075 ;; From imenu.el -- needed when reformatting a file in its old buffer.
1076 ;; The latest buffer index used to update the menu bar menu.
1079 (make-variable-buffer-local 'imenu--last-menubar-index-alist)
1081 (defvar woman-buffer-alist nil
1085 (defvar woman-buffer-number 0
1086 "Ordinal number of current buffer entry in `woman-buffer-alist'.
1112 (signal 'end-of-buffer nil))
1129 "Delete subexpression SUBEXP of buffer text matched by last search."
1142 "Expanded directory list cache. Resetting to nil forces update.")
1145 "Expanded topic alist cache. Resetting to nil forces update.")
1154 speed, but a non-nil interactive argument forces the caches to be
1155 updated (e.g. to re-interpret the current directory).
1173 ;; Allow WoMan to be called via the standard Help menu:
1179 "A list of cached data used to determine cache validity.
1183 "Generate a list of data used to determine cache validity.
1184 Called both to generate and to check the cache!"
1194 (when dir (add-to-list 'lst (substitute-in-file-name dir)))))
1208 It is saved to the file named by the variable `woman-cache-filename'."
1210 (save-excursion ; to restore current buffer
1211 ;; Make a temporary buffer; name starting with space "hides" it.
1213 (set-buffer (generate-new-buffer "WoMan tmp buffer")))
1215 ;; (switch-to-buffer standard-output t) ; only for debugging
1216 (buffer-disable-undo standard-output)
1228 (write-file woman-cache-filename) ; write CURRENT buffer
1229 (kill-buffer standard-output)
1241 cache to be re-read."
1255 ;; There is a problem in that I want to offer case-insensitive
1256 ;; completions, but to return only a case-sensitive match. This
1257 ;; does not seem to work properly by default, so I re-do the
1266 (setq topic (or (current-word t) "")) ; only within or adjacent to word
1300 ;; `minibuffer-complete' in order to automatically complete the
1309 ;; Intended to be fast by avoiding recursion and list copying.
1352 ;; Allow each path to be a single string or a list of strings:
1368 ;; Need regexp "man" here to avoid "cat?", `.', `..', etc.
1415 (setq dir (pop path))
1421 ;; Concate all lists with a single nconc call to
1432 ;; This function used to check that each file in the directory was
1445 ;; Use a loop instead of mapcar in order to avoid the speed
1465 ;; Instead we use sorting to merge stuff efficiently. -- dak
1472 (setq elt (pop alist))
1481 (setq elt (pop alist))
1504 ;; Use cached path-info to locate files for each topic:
1530 ;;; dired support
1532 (defun woman-dired-define-key (key)
1533 "Bind the argument KEY to the command `woman-dired-find-file'."
1534 (define-key dired-mode-map key 'woman-dired-find-file))
1536 (defsubst woman-dired-define-key-maybe (key)
1537 "If KEY is undefined in Dired, bind it to command `woman-dired-find-file'."
1538 (if (or (eq (lookup-key dired-mode-map key) 'undefined)
1539 (null (lookup-key dired-mode-map key)))
1540 (woman-dired-define-key key)))
1542 (defun woman-dired-define-keys ()
1543 "Define dired keys to run WoMan according to `woman-dired-keys'."
1544 (if woman-dired-keys
1545 (if (listp woman-dired-keys)
1546 (mapcar 'woman-dired-define-key woman-dired-keys)
1547 (woman-dired-define-key-maybe "w")
1548 (woman-dired-define-key-maybe "W")))
1549 (define-key-after (lookup-key dired-mode-map [menu-bar immediate])
1550 [woman] '("Read Man Page (WoMan)" . woman-dired-find-file) 'view))
1552 (if (featurep 'dired)
1553 (woman-dired-define-keys)
1554 (add-hook 'dired-mode-hook 'woman-dired-define-keys))
1557 (defun woman-dired-find-file ()
1558 "In dired, run the WoMan man-page browser on this file."
1560 ;; dired-get-filename is defined in dired.el
1561 (woman-find-file (dired-get-filename)))
1571 (buffer-disable-undo)
1574 (let ((WoMan-current-file buffer-file-name)) ; used for message logging
1575 (rename-buffer
1576 (woman-make-bufname (file-name-nondirectory buffer-file-name)))
1577 (woman-process-buffer)
1601 Use existing buffer if possible; reformat only if prefix arg given.
1603 of an existing WoMan buffer formatted earlier.
1604 No external programs are used, except that `gunzip' will be used to
1609 (setq file-name (expand-file-name file-name))) ; to canonicalize
1610 (let ((alist-tail woman-buffer-alist) exists)
1611 (setq woman-buffer-number 0)
1614 woman-buffer-number (1+ woman-buffer-number)))
1616 (and alist-tail (WoMan-find-buffer))) ; buffer exists
1618 ;; Format new buffer or reformat current buffer:
1626 (buffer-name)
1630 (setq woman-buffer-alist
1631 (cons (cons file-name bufname) woman-buffer-alist)
1632 woman-buffer-number 0))
1639 "Create an unambiguous buffer name from BUFNAME."
1644 (generate-new-buffer-name ; ensure uniqueness
1652 If COMPRESSED is non-nil, turn on auto-compression mode to decompress
1653 the file if necessary. Set buffer name BUFNAME and major mode.
1660 (switch-to-buffer (get-buffer-create bufname))
1661 (buffer-disable-undo)
1662 (setq buffer-read-only nil)
1663 (erase-buffer) ; NEEDED for reformat
1665 ;; Set buffer's default directory to that of the file.
1669 (woman-process-buffer)))
1671 (defun woman-process-buffer ()
1674 ;; Check (crudely) that this really is likely to be in UN*X
1678 (woman-decode-buffer)
1680 "File appears to be pre-formatted -- using source file may be better.")
1681 (woman-man-buffer))
1684 (defun woman-man-buffer ()
1685 "Post-process an nroff-preformatted man buffer."
1710 (if (< (buffer-size) (position-bytes (point-max)))
1722 ;; Interpret overprinting to indicate bold face:
1728 ;; Interpret underlining to indicate italic face:
1729 ;; (Must be AFTER emboldening to interpret bold _ correctly!)
1735 ;; Leave any other uninterpreted ^H's in the buffer for now! (They
1737 ;; interpreted if I knew what to expect.)
1750 "Insert file FILENAME into the current buffer.
1752 then turn on auto-compression mode to decompress the file.
1792 ;; We don't need to call `man' when we are in `woman-mode'.
1797 "Get a Un*x manual page of the item under point and put it in a buffer."
1813 ;; WoMan menu bar and pop-up menu:
1816 ;; That comment was moved after the symbol `woman-menu' to make
1850 ["Show Log" (switch-to-buffer-other-window "*WoMan-Log*" t) t]
1882 "Reset `woman-emulation' to VALUE and reformat, for menu use."
1890 "Turn on (most of) Man mode to browse a buffer formatted by WoMan.
1916 (kill-local-variable 'mode-line-buffer-identification)
1924 ;; necessary when reformatting a file in its old buffer:
1926 ;; necessary to avoid re-installing the same imenu:
1929 (let (buffer-read-only)
1931 (set-buffer-modified-p nil)
1935 "Add a \"Contents\" menu to the menubar.
1936 Optional argument REDRAW, if non-nil, forces mode line to be updated."
1939 ;; This is PRIMARILY to avoid a bug in imenu-add-to-menubar that
1940 ;; causes it to corrupt the menu bar if it is run more than once
1941 ;; in the same buffer.
1944 (imenu-add-to-menubar woman-imenu-title)
1948 "Toggle formatting to fill (most of) the width of the current frame."
1951 (message "Woman fill column set to %s."
1956 "Display WoMan commands and user options in an `apropos' buffer."
1961 (let ((standard-output (get-buffer-create "*Apropos*")))
1996 "Use TOPIC to start WoMan from `Man-follow-manual-reference'."
2003 "Used to record formatting time used by the `man' command.")
2010 ;; key-binding in `woman-mode-map' has been remapped to call `woman'
2015 ;; "Use WoMan unless invoked outside a WoMan buffer or invoked explicitly.
2038 "Find the previous WoMan buffer."
2039 ;; Assumes currently in a WoMan buffer!
2041 (WoMan-find-buffer) ; find current existing buffer
2042 (if (null (cdr woman-buffer-alist))
2043 (error "No previous WoMan buffer"))
2044 (if (>= (setq woman-buffer-number (1+ woman-buffer-number))
2045 (length woman-buffer-alist))
2046 (setq woman-buffer-number 0))
2047 (if (WoMan-find-buffer)
2049 (if (< (setq woman-buffer-number (1- woman-buffer-number)) 0)
2050 (setq woman-buffer-number (1- (length woman-buffer-alist))))
2054 "Find the next WoMan buffer."
2055 ;; Assumes currently in a WoMan buffer!
2057 (WoMan-find-buffer) ; find current existing buffer
2058 (if (null (cdr woman-buffer-alist))
2059 (error "No next WoMan buffer"))
2060 (if (< (setq woman-buffer-number (1- woman-buffer-number)) 0)
2061 (setq woman-buffer-number (1- (length woman-buffer-alist))))
2062 (if (WoMan-find-buffer)
2066 (defun WoMan-find-buffer ()
2067 "Switch to buffer corresponding to `woman-buffer-number' and return it.
2068 If such a buffer does not exist then remove its association from the
2069 alist in `woman-buffer-alist' and return nil."
2070 (if (zerop woman-buffer-number)
2071 (let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
2072 (if buffer
2073 (switch-to-buffer buffer)
2075 (setq woman-buffer-alist (cdr woman-buffer-alist))
2077 (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
2078 (buffer (get-buffer (cdr (car (cdr prev-ptr))))))
2079 (if buffer
2080 (switch-to-buffer buffer)
2083 (if (>= woman-buffer-number (length woman-buffer-alist))
2084 (setq woman-buffer-number 0))
2096 (char-to-string woman-escaped-escape-char)
2103 (char-to-string woman-unpadded-space-char)
2107 "Syntax table to support special characters used internally by WoMan.")
2117 (defun woman-set-buffer-display-table ()
2118 "Set up a display table for a WoMan buffer.
2122 (setq buffer-display-table
2123 ;; The following test appears to be necessary on some
2125 ;; tty. Thanks to T. V. Raman <raman@Adobe.COM>.
2126 ;; The MS-DOS terminal also sets standard-display-table to
2132 (aset buffer-display-table woman-unpadded-space-char [?\ ])
2133 (aset buffer-display-table woman-escaped-escape-char [?\\]))
2141 (defun woman-decode-buffer ()
2142 "Decode a buffer in UN*X man-page source format.
2151 (message "WoMan formatting buffer...")
2162 (message "WoMan formatting buffer...done in %d seconds" time)
2175 "Set to t if .sp N with N < 0 encountered.")
2177 (defun woman-pre-process-region (from to)
2179 To be called on original buffer and any .so insertions."
2181 ;; (to be re-instated as just \ very late!):
2184 (while (re-search-forward "\\(\\\\[\\e]\\)\\|^\\.eo" to t) ; \\
2189 ;; escape character to its argument, if any, which I'm ignoring
2191 (while (and (re-search-forward "\\(\\\\\\)\\|^\\.ec" to t) ; \
2200 (while (re-search-forward "^[.'][ \t]*\\(\\\\\".*\\)?\n\\|\\\\\".*" to t)
2230 ;; specify the sequence of preprocessors to run before nroff or
2232 ;; preprocessors. Some of the preprocessors and the letters used to
2239 This applies to text between .TE and .TS directives.
2242 (defun woman-decode-region (from to)
2245 ;; But this requires care to control major mode implied font locking.
2247 ;; NB: The `to' argument is bogus: it is not currently used, and if
2248 ;; it were it would need to be a marker rather than a position!
2265 (cons (string-to-char (symbol-name woman-emulation)) '(?e ?o)))
2269 ;; Set font of `woman-symbol' face to `woman-symbol-font' if
2278 (woman-set-buffer-display-table)
2300 (woman0-roff-buffer from)
2318 ;; Set buffer-local variables:
2344 (woman1-roff-buffer)
2396 ; to
2399 ; ;; Warn but leave escape in buffer unprocessed:
2402 ; (buffer-substring from (1+ (point)))) ; point at end of arg
2403 ; (setq to (match-end 0)
2405 ; msg (buffer-substring from to))
2406 ; (delete-region from to)
2428 (woman2-roff-buffer)
2435 ;; Re-instate escaped escapes to just `\' and unpaddable
2436 ;; spaces to just `space', without inheriting any text
2437 ;; properties. This is not necessary, UNLESS the buffer is to
2451 (defun woman-horizontal-escapes (to)
2462 to t)
2467 to
2470 ;; Warn but leave escape in buffer unprocessed:
2473 (buffer-substring from (1+ (point)))) ; point at end of arg
2474 (setq to (match-end 0)
2476 msg (buffer-substring from to))
2477 (delete-region from to)
2505 (defvar woman0-if-to) ; marker bound in woman0-roff-buffer
2506 (defvar woman0-macro-alist) ; bound in woman0-roff-buffer
2507 (defvar woman0-search-regex) ; bound in woman0-roff-buffer
2508 (defvar woman0-search-regex-start ; bound in woman0-roff-buffer
2514 (defvar woman0-rename-alist) ; bound in woman0-roff-buffer
2516 (defun woman0-roff-buffer (from)
2520 (let ((woman0-if-to (make-marker))
2526 (set-marker-insertion-type woman0-if-to t)
2538 (set-marker woman0-if-to nil)
2540 ;; Should now re-run `woman0-roff-buffer' if any renaming was
2545 ".ig yy -- Discard input up to `.yy', which defaults to `..')."
2559 (defsubst woman0-process-escapes (from to)
2561 (woman-strings to)
2564 (while (re-search-forward "\\\\f\\(\\[[^]]+\\]\\|(..\\|.\\)" to t)
2567 (woman2-process-escapes to 'numeric))
2570 ".if/ie c anything -- Discard unless c evaluates to true.
2573 ;; c evaluates to a one-character built-in condition name or
2581 (set-marker woman0-if-to
2596 (narrow-to-region from woman0-if-to)
2601 ;; Delete 2nd and 3rd delimiters to avoid processing them:
2602 (delete-region (match-end 3) woman0-if-to)
2605 (woman0-process-escapes (point) woman0-if-to)
2606 (setq c (string= (buffer-substring (point) end1)
2607 (buffer-substring end1 woman0-if-to)))
2612 (woman0-process-escapes from woman0-if-to)
2618 (woman-if-ignore woman0-if-to request) ; ERROR!
2619 (woman-if-body request woman0-if-to (eq c negated)))
2622 (defun woman-if-body (request to delete) ; should be reversed as `accept'?
2629 (if to (delete-region (point) to))
2654 ;; Discard unless previous .ie c `evaluated to false'.
2659 ;; clause to be discarded:
2675 (t ; Ignore -- leave in buffer
2681 (defun woman-if-ignore (to request)
2685 (woman-if-body request to t)
2686 ;; Ignore -- leave in buffer
2698 (name (buffer-substring beg end))
2705 ;; then use the WoMan search mechanism to find the filename ...
2711 (kill-buffer (current-buffer))
2717 (to (copy-marker (+ from length) t)))
2718 (woman-pre-process-region from to)
2719 (set-marker to nil)
2728 "Process .rn xx yy -- rename macro xx to yy."
2730 ;; Should also allow requests and strings to be renamed!
2735 (old (buffer-substring beg end))
2741 new (buffer-substring beg end)
2778 \(Should be up to call of yy, which defaults to `.')
2794 ;; Macro body runs from start of next line to line
2801 (let ((body (woman-unescape (buffer-substring from (point)))))
2813 (backward-char) ; return to end of .de/am line
2829 "Interpolate (.de) or append (.am) expansion of MACRO into the buffer."
2844 (setq actual-arg (buffer-substring from (point)))
2875 Applies to number registers, fonts, strings/macros/diversions, and
2886 (defun woman-strings (&optional to)
2887 "Process ?roff string requests and escape sequences up to buffer position TO.
2893 (re-search-forward "\\(^[.'][ \t]*ds\\)\\|\\\\\\*" to t)
2947 ;; MUST insert all characters as strings for correct conversion to
2985 * `use-symbol-font' is t to indicate use of the symbol font or nil,
2986 i.e. omitted, to indicate use of the default font.
2987 Any element may be nil. Avoid control character codes (0 to \\37, \\180
2988 to \\237) in `extended-font-string' for now, since they can be
2992 map accessory to help construct this alist.")
3002 (defun woman-special-characters (to)
3003 "Process special character escapes \\(xx, \\[xxx] up to buffer position TO.
3005 (while (re-search-forward "\\\\\\(?:(\\(..\\)\\|\\[\\([[^]]+\\)\\]\\)" to t)
3035 (with-output-to-temp-buffer "*WoMan Extended Font Map*"
3037 (set-buffer standard-output)
3054 (defvar request) ; Bound locally by woman1-roff-buffer
3055 (defvar unquote) ; Bound locally by woman1-roff-buffer
3057 (defun woman-unquote (to)
3061 (while (search-forward "\"" to 1)
3074 "Delete any double-quote characters up to the end of the line."
3077 (defun woman1-roff-buffer ()
3085 ;; Construct woman function to call:
3093 ;; If no args then apply to next line else unquote args
3124 ;; Return to bol to process .SM/.B, .B/.if etc.
3125 ;; or start of first arg to hide leading control char.
3171 ;; Return to start of first arg to hide leading control char:
3207 ;; so are flagged `notfont' to turn off automatic request deletion
3212 ".TP -- After tag line, reset font to Roman for paragraph body."
3239 ;; Must be handled here to avoid breaking!
3245 ".hy N -- Set hyphenation mode to N, i.e. IGNORE!"
3251 ".hc c -- Set hyphenation character to c, i.e. delete it!"
3252 (let ((c (char-to-string (following-char))))
3298 ".TX t p -- Resolve SunOS abbrev t and join to p (usually punctuation)."
3376 ;; inserted to prevent this is removed by woman2-process-escapes.
3392 ;; Set font after last request up to eob:
3396 (defun woman-set-face (from to face)
3397 "Set the face of the text from FROM to TO to face FACE.
3405 (while (< (point) to)
3406 (skip-syntax-forward "w" to)
3409 (skip-syntax-forward "^w" to)
3413 (put-text-property from to 'face face))
3420 (defvar translations nil) ; Also bound locally by woman2-roff-buffer
3424 "Return and delete next char in buffer, including special chars."
3430 (prog1 (char-to-string (following-char))
3433 (defun woman2-tr (to)
3460 (if (= (string-to-char matches) ?\])
3465 (woman2-format-paragraphs to)
3468 (defsubst woman-translate (to)
3469 "Translate up to marker TO. Do this last of all transformations."
3473 (while (re-search-forward matches to t)
3474 ;; Done like this to retain text properties and
3478 (buffer-substring-no-properties
3491 ;; (Iff emulating groff need to implement groff italic correction
3502 Also bound locally in `woman2-roff-buffer'.")
3513 (defsubst woman2-process-escapes-to-eol (&optional numeric)
3514 "Process remaining escape sequences up to eol.
3518 (defun woman2-nr (to)
3519 ".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
3520 The increment for auto-incrementing is set to M.
3522 (let* ((name (buffer-substring
3530 nil ; to be interpreted as zero
3531 (woman2-process-escapes-to-eol 'numeric)
3536 nil ; to be interpreted as zero ???
3555 (woman2-format-paragraphs to)))
3565 (woman2-process-escapes-to-eol 'numeric)
3608 ; (buffer-substring
3622 ;; (woman2-process-escapes-to-eol 'numeric)
3634 ;; currently needed to set match-end, even though
3635 ;; string-to-number returns 0 if number not parsed.
3636 (string-to-number (match-string 0)))
3659 (WoMan-warn "Undefined register %s defaulted to 0."
3661 0) ; default to zero
3678 (buffer-substring
3708 (defun woman2-roff-buffer ()
3711 (to (make-marker))
3719 (set-marker-insertion-type to t)
3722 ;; Try to avoid spaces inheriting underlines from preceding text!
3730 ;; Construct woman function to call:
3758 (set-marker to (woman-find-next-control-line))
3760 (funcall fn to)))
3767 (set-marker to nil))))
3771 ; (let ((to (save-excursion
3773 ; (if to (1- to) (point-max)))
3774 (let (to)
3783 (setq to (re-search-forward "\\(\\\\c\\)?\n[.']" nil t))
3788 (if to (1- to) (point-max))))
3790 (defun woman2-PD (to)
3791 ".PD d -- Set the interparagraph distance to d.
3792 Round to whole lines, default 1 line. Format paragraphs upto TO.
3797 (woman2-format-paragraphs to))
3803 ;; Should allow .PD 0 to set zero line spacing
3814 (defun woman2-TH (to)
3818 \(Should set prevailing indent and tabs to 5.)"
3834 (if (string-match (buffer-substring here (point))
3835 (buffer-substring start here))
3845 (woman2-format-paragraphs to woman-left-margin))
3847 (defun woman2-SH (to)
3849 Format paragraphs upto TO. Set prevailing indent to 5."
3851 (delete-char 1) ; apply to next line
3852 (woman-unquote-args) ; else unquote to end of heading
3854 (woman2-process-escapes-to-eol)
3865 (woman2-format-paragraphs to woman-left-margin))
3867 (defun woman2-SS (to)
3871 (delete-char 1)) ; apply to next line.
3874 (woman2-SH to))
3876 (defun woman2-LP (to)
3877 ".LP,.PP -- Begin paragraph. Set prevailing indent to 5.
3882 (woman2-format-paragraphs to woman-left-margin))
3887 (defun woman2-ns (to)
3892 (woman2-format-paragraphs to))
3894 (defun woman2-rs (to)
3899 (woman2-format-paragraphs to))
3901 (defun woman2-sp (to)
3910 (woman2-format-paragraphs to)))
3924 overlap (buffer-substring from
3973 (defun woman2-process-escapes (to &optional numeric)
3974 "Process remaining escape sequences up to marker TO, preserving point.
3976 (assert (and (markerp to) (marker-insertion-type to)))
3979 ;; Discard zero width filler character used to hide leading dots
3981 (while (re-search-forward "\\\\[&|^]" to t)
3985 ;; next text line (after any control lines, unless processing to
3987 (while (re-search-forward "\\\\c.*\n?" to t)
3990 (if (and (or (eobp) (= (point) to)) (not (bolp)))
3993 (woman-translate to)
3995 (woman-special-characters to)
3997 ;; Printable version of the current escape character, ASSUMED to be `\'
3999 ;; Done like this to preserve any text properties of the `\'
4000 (while (search-forward "\\" to t)
4024 (while (search-forward "\t" to t)
4025 (woman-tab-to-tab-stop))
4032 (while (re-search-forward "\\\\[nw]" to t)
4038 (insert-before-markers (number-to-string N))))
4047 (let* ((to (match-end 2))
4050 (c (if (< (point) to) (following-char) ?_)))
4051 (delete-region from to)
4058 (defun woman2-br (to)
4061 (woman2-format-paragraphs to))
4063 (defun woman2-fi (to)
4072 (woman2-format-paragraphs to))
4074 (defun woman2-nf (to)
4076 Input text lines are copied directly to output lines without regard
4080 (woman2-format-paragraphs to))
4082 (defun woman2-ad (to)
4084 Set justification mode to c if specified.
4098 (woman2-format-paragraphs to))
4100 (defun woman2-na (to)
4108 (woman2-format-paragraphs to))
4117 ;; ***** It may suffice to delete only lines ABOVE point! *****
4118 ;; NOTE: Function arguments are evaluated left to right
4138 ;; `fill-region-as-paragraph' in `fill.el' appears to be the principal
4143 (defun woman2-format-paragraphs (to &optional new-left)
4144 "Indent, fill and adjust paragraphs upto TO to current left margin.
4153 ;; Successive control lines are sufficiently common to be worth a
4155 (if (>= (point) to) ; >= as a precaution!
4159 ;; (woman2-process-escapes to) ; 7 October 1999
4160 (woman2-process-escapes to 'numeric)
4166 (indent-to woman-temp-indent)
4168 (indent-rigidly (point) to left-margin)
4169 (woman-horizontal-escapes to)) ; 7 October 1999
4172 ; (cond ((and (= (point) to) (not (looking-at ".nf"))) ; Yuk!!!
4177 (while (< (point) to)
4181 (indent-to (or woman-temp-indent left-margin))
4182 (woman-horizontal-escapes to) ; 7 October 1999
4185 ; (if (re-search-forward "\\(^\\s *$\\)\\|\\(^\\s +\\)" to 1)
4192 (and (re-search-forward "\\(^\\s *$\\)\\|\\(^\\s +\\)" to 1)
4203 ;; This is necessary to preserve some table layouts.
4214 ;; Needs a re-write of the paragraph formatter to
4215 ;; avoid this nonsense to handle temporary indents!
4239 (defun woman2-TP (to)
4240 ".TP i -- Set prevailing indent to i. Format paragraphs upto TO.
4245 (woman2-tagged-paragraph to i)))
4247 (defun woman2-IP (to)
4252 (woman2-format-paragraphs to (+ woman-left-margin
4278 (woman2-tagged-paragraph to i)))))
4286 (defun woman2-tagged-paragraph (to i)
4289 Format paragraphs upto TO. Set prevailing indent to I."
4294 ;; to process all requests uniformly.
4298 (cond ((and (= (point) to)
4304 (woman2-ta to)
4306 (set-marker to (woman-find-next-control-line-carefully))
4312 (woman2-process-escapes-to-eol)
4314 ;; (indent-to woman-left-margin)
4321 (cond ((and (= (point) to) (looking-at "^[.'][ \t]*PD *"))
4324 (set-marker to (woman-find-next-control-line-carefully))
4331 (cond ((< (point) to)
4332 (woman2-format-paragraphs to)
4337 ;; Necessary to avoid spaces inheriting underlines.
4341 (goto-char to) ; necessary ???
4345 (defun woman2-HP (to)
4346 ".HP i -- Set prevailing indent to i. Format paragraphs upto TO.
4351 (woman2-format-paragraphs to (+ woman-left-margin i))
4355 "Set prevailing indent to integer argument at point, and return it.
4363 ;; FIXME should this be >= 0? How else to reset to 0 indent?
4371 (defmacro woman-pop (variable stack)
4378 (defun woman2-RS (to)
4380 Set prevailing indent to 5 for nested indents. Format paragraphs upto TO."
4386 (woman2-format-paragraphs to woman-left-margin))
4388 (defun woman2-RE (to)
4390 Set prevailing indent to amount of starting .RS."
4391 (woman-pop woman-left-margin woman-RS-left-margin)
4392 (woman-pop woman-prevailing-indent woman-RS-prevailing-indent)
4394 (woman2-format-paragraphs to woman-left-margin))
4407 (woman2-process-escapes-to-eol 'numeric)
4423 (defun woman2-ll (to)
4427 (woman2-format-paragraphs to))
4429 (defun woman2-in (to)
4433 (woman2-format-paragraphs to))
4435 (defun woman2-ti (to)
4442 (woman2-format-paragraphs to nil))
4448 (defun woman2-ta (to)
4451 a value preceded by + represents an increment to the previous stop value.
4454 (woman2-process-escapes-to-eol 'numeric)
4469 (woman2-format-paragraphs to))
4475 (defun woman-tab-to-tab-stop ()
4476 "Insert spaces to next defined tab-stop column.
4479 ;; Based on tab-to-tab-stop in indent.el.
4503 (defun woman2-DT (to)
4509 (woman2-format-paragraphs to))
4511 (defun woman2-fc (to)
4514 A VERY FIRST ATTEMPT to make fields at least readable!
4519 (pad ?\ ) end) ; pad defaults to space
4544 (woman2-format-paragraphs to))
4550 (defun woman2-TS (to)
4553 ;; This is a preliminary hack that seems to suffice for lilo.8.
4566 (while (prog1 (search-forward "\t" to t) (goto-char start))
4568 (while (< (point) to)
4569 (when (search-forward "\t" to t)
4576 (while (< (point) to)
4577 (when (search-forward "\t" to t)
4584 (woman2-format-paragraphs to))
4602 (let ((WoMan-current-buffer (buffer-name)))
4604 (set-buffer (get-buffer-create "*WoMan-Log*"))
4606 (setq buffer-read-only nil)
4611 (concat "buffer " WoMan-current-buffer))
4627 IGNORED is a string appended to the log message."
4629 (buffer-substring (point)
4632 (/= (string-to-char tail) ?\ ))
4639 TIME specifies the time it took to format the man page, to be printed
4645 If optional argument END is non-nil then make buffer read-only after
4648 (set-buffer (get-buffer-create "*WoMan-Log*"))
4649 (setq buffer-read-only nil)
4653 (setq buffer-read-only t)
4655 (select-window ; to return to
4657 (select-window (display-buffer (current-buffer)))