4.3BSD/usr/contrib/emacs/lisp/nroff-mode.elc


(defvar nroff-mode-abbrev-table nil "Abbrev table used while in nroff mode.")

(defvar nroff-mode-map nil "Major mode keymap for nroff-mode buffers")

(if (not nroff-mode-map) (progn (setq nroff-mode-map (make-sparse-keymap)) (define-key nroff-mode-map "	" (quote tab-to-tab-stop)) (define-key nroff-mode-map "s" (quote center-line)) (define-key nroff-mode-map "?" (quote count-text-lines)) (define-key nroff-mode-map "
" (quote electric-nroff-newline)) (define-key nroff-mode-map "n" (quote forward-text-line)) (define-key nroff-mode-map "p" (quote backward-text-line))))

(defun nroff-mode nil "\
Major mode for editing text intended for nroff to format.
\\{nroff-mode-map}
Turning on Nroff mode runs text-mode-hook, then nroff-mode-hook.
Also, try nroff-electric-mode, for automatically inserting
closing requests for requests that are used in matched pairs." (interactive) (byte-code "ÉˆÊ ˆË!ˆÌ‰ˆÍ‰ˆÎ!ˆ
‰ˆÏÐ!ˆÏÆ!ˆÑ‰ˆÏÇ!ˆÒP‰ˆÏÈ!ˆÒP‰ˆÓÔÕ\"‡" [nroff-mode-map mode-name major-mode text-mode-syntax-table local-abbrev-table nroff-mode-abbrev-table page-delimiter paragraph-start paragraph-separate nil kill-all-local-variables use-local-map "Nroff" nroff-mode set-syntax-table make-local-variable nroff-electric-mode "^\\.bp" "^\\.\\|" run-hooks text-mode-hook nroff-mode-hook] 10))

(defun count-text-lines (start end &optional print) "\
Count lines in region, except for nroff request lines.
All lines not starting with a period are counted up.
Interactively, print result in echo area.
Noninteractively, return number of non-request lines from START to END." (interactive "r
p") (byte-code "ȃÄÅÆ	
\"\"‚#ŠŒÇ	
\"ˆebˆÈ ÉÈ !Z))‡" [print start end nil message "Region has %d text lines" count-text-lines narrow-to-region buffer-size forward-text-line] 8))

(defun forward-text-line (&optional cnt) "\
Go forward one nroff text line, skipping lines of nroff requests.
An argument is a repeat count; if negative, move backward." (interactive "p") (byte-code "Áˆ?ƒ
‰‚ÁˆÃV…m?…:ÄÂ!ˆm?…&ÅÆ!…0ÄÂ!ˆ‚ˆÂZ‰ˆ‚ˆÃW…Co?…fÄÇ!ˆo?…RÅÆ!…\\ÄÇ!ˆ‚JˆÂ\\‰ˆ‚;ˆ‡" [cnt nil 1 0 forward-line looking-at "\\.." -1] 9))

(defun backward-text-line (&optional cnt) "\
Go backward one nroff text line, skipping lines of nroff requests.
An argument is a repeat count; negative means move forward." (interactive "p") (byte-code "ÁˆÂ[!‡" [cnt nil forward-text-line] 2))

(defconst nroff-brace-table (quote ((".(b" . ".)b") (".(l" . ".)l") (".(q" . ".)q") (".(c" . ".)c") (".(x" . ".)x") (".(z" . ".)z") (".(d" . ".)d") (".(f" . ".)f") (".DS" . ".DE") (".KS" . ".KE") (".de" . ".."))))

(defun electric-nroff-newline (arg) "\
Insert newline for nroff mode; special if electric-nroff mode.
In electric-nroff-mode, if ending a line containing an nroff opening request,
automatically inserts the matching closing request after point." (interactive "P") (byte-code "ĈŠÅ ˆ	?…!
…!`dÆZX…!ÇÈ`Æ`\\\"\"A)?ƒ0ÉÊ	!!‚5ËÌÌ#)‡" [completion arg nroff-electric-mode nroff-brace-table nil beginning-of-line 3 assoc buffer-substring newline prefix-numeric-value insert "
"] 9))

(defun electric-nroff-mode (arg) "\
Toggle nroff-electric-newline minor mode
Nroff-electric-newline forces emacs to check for an nroff
request at the beginning of the line, and insert the
matching closing request if necessary.  
This command toggles that mode (off->on, on->off), 
with an argument, turns it on iff arg is positive, otherwise off." (interactive "P") (byte-code "È	?ƒ?‚
…Ä	!ÅV‰ˆÆÇÈ#‡" [nroff-electric-mode arg t nil prefix-numeric-value 0 set-minor-mode electric-nroff-mode "electric"] 5))