nroff-mode.elc 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. (defvar nroff-mode-abbrev-table nil "\
  2. Abbrev table used while in nroff mode.")
  3. (defvar nroff-mode-map nil "\
  4. Major mode keymap for nroff-mode buffers")
  5. (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 "
  6. " (quote electric-nroff-newline)) (define-key nroff-mode-map "n" (quote forward-text-line)) (define-key nroff-mode-map "p" (quote backward-text-line))))
  7. (defun nroff-mode nil "\
  8. Major mode for editing text intended for nroff to format.
  9. \\{nroff-mode-map}
  10. Turning on Nroff mode runs text-mode-hook, then nroff-mode-hook.
  11. Also, try nroff-electric-mode, for automatically inserting
  12. closing requests for requests that are used in matched pairs." (interactive) (byte-code "͈ΠˆÏ!ˆÐ‰ˆÑ‰ˆÒ !ˆ ‰ˆÓÔ!ˆÓÆ!ˆÕ‰ˆÓÇ!ˆÖP‰ˆÓÈ!ˆÖP‰ˆÓÉ!ˆ×‰ ˆÓÊ!ˆØ‰
  13. ˆÓË!ˆÙ‰ ˆÓÌ!ˆÚ‰ ˆÛÜÝ\"‡" [nroff-mode-map mode-name major-mode text-mode-syntax-table local-abbrev-table nroff-mode-abbrev-table page-delimiter paragraph-start paragraph-separate comment-start comment-start-skip comment-column comment-indent-hook nil kill-all-local-variables use-local-map "Nroff" nroff-mode set-syntax-table make-local-variable nroff-electric-mode "^\\.bp" "^\\.\\|" "\\\" " "\\\\\"[ ]*" 24 nroff-comment-indent run-hooks text-mode-hook nroff-mode-hook] 14))
  14. (defun nroff-comment-indent nil "\
  15. Compute indent for an nroff/troff comment.
  16. Puts a full-stop before comments on a line by themselves." (byte-code "`ÂŽÃÄ!ˆnƒT‰ˆÅcˆÆ‚3ŠÇÆ!ˆÈÉ!)ƒ(Æ‚3 ÊËÌiÍ\\Ë\"\"]))‡" [pt comment-column ((byte-code "b‡" [pt] 1)) skip-chars-backward " " 46 1 backward-char looking-at "^\\." * 8 / 9] 9))
  17. (defun count-text-lines (start end &optional print) "\
  18. Count lines in region, except for nroff request lines.
  19. All lines not starting with a period are counted up.
  20. Interactively, print result in echo area.
  21. Noninteractively, return number of non-request lines from START to END." (interactive "r
  22. p") (byte-code "ȃÄÅÆ
  23. \"\"‚#ŠŒÇ
  24. \"ˆebˆÈ ÉÈ !Z))‡" [print start end nil message "Region has %d text lines" count-text-lines narrow-to-region buffer-size forward-text-line] 8))
  25. (defun forward-text-line (&optional cnt) "\
  26. Go forward one nroff text line, skipping lines of nroff requests.
  27. 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))
  28. (defun backward-text-line (&optional cnt) "\
  29. Go backward one nroff text line, skipping lines of nroff requests.
  30. An argument is a repeat count; negative means move forward." (interactive "p") (byte-code "ÁˆÂ[!‡" [cnt nil forward-text-line] 2))
  31. (defconst nroff-brace-table (quote ((".(b" . ".)b") (".(l" . ".)l") (".(q" . ".)q") (".(c" . ".)c") (".(x" . ".)x") (".(z" . ".)z") (".(d" . ".)d") (".(f" . ".)f") (".LG" . ".NL") (".SM" . ".NL") (".LD" . ".DE") (".CD" . ".DE") (".BD" . ".DE") (".DS" . ".DE") (".FS" . ".FE") (".KS" . ".KE") (".KF" . ".KE") (".RS" . ".RE") (".TS" . ".TE") (".EQ" . ".EN") (".PS" . ".PE") (".na" . ".ad b") (".nf" . ".fi") (".de" . ".."))))
  32. (defun electric-nroff-newline (arg) "\
  33. Insert newline for nroff mode; special if electric-nroff mode.
  34. In electric-nroff-mode, if ending a line containing an nroff opening request,
  35. automatically inserts the matching closing request after point." (interactive "P") (byte-code "ĈŠÅ ˆ ?…!
  36. …!`dÆZX…!ÇÈ`Æ`\\\" \"A)?ƒ0ÉÊ !!‚;ŠËÌÍ#)ˆÎÏ!)‡" [completion arg nroff-electric-mode nroff-brace-table nil beginning-of-line 3 assoc buffer-substring newline prefix-numeric-value insert "
  37. " "
  38. " forward-char 1] 9))
  39. (defun electric-nroff-mode (arg) "\
  40. Toggle nroff-electric-newline minor mode
  41. Nroff-electric-newline forces emacs to check for an nroff
  42. request at the beginning of the line, and insert the
  43. matching closing request if necessary.
  44. This command toggles that mode (off->on, on->off),
  45. with an argument, turns it on iff arg is positive, otherwise off." (interactive "P") (byte-code "ňÆ=† ÇÈ!ˆÉ \"†Ê ËC\"‰ˆ ?ƒ%
  46. ?‚.Ä….Ì !ÍV‰‡" [major-mode minor-mode-alist nroff-electric-mode arg t nil nroff-mode error "Must be in nroff mode" assq append (nroff-electric-mode " Electric") prefix-numeric-value 0] 6))