Function: nroff-mode

nroff-mode is an autoloaded, interactive and byte-compiled function defined in nroff-mode.el.gz.

Signature

(nroff-mode)

Documentation

Major mode for editing text intended for nroff to format.

C-c C-c nroff-view
C-j nroff-electric-newline
M-? nroff-count-text-lines
M-n nroff-forward-text-line
M-p nroff-backward-text-line
TAB tab-to-tab-stop
Turning on Nroff mode runs text-mode-hook, then nroff-mode-hook. Also, try nroff-electric-mode(var)/nroff-electric-mode(fun), for automatically inserting closing requests for requests that are used in matched pairs.

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/nroff-mode.el.gz
;;;###autoload
(define-derived-mode nroff-mode text-mode "Nroff"
  "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."
  (setq-local font-lock-defaults
              ;; SYNTAX-BEGIN is set to backward-paragraph to avoid slow-down
              ;; near the end of large buffers due to searching to buffer's
              ;; beginning.
              '(nroff-font-lock-keywords nil t nil backward-paragraph))
  (setq-local outline-regexp "\\.H[ ]+[1-7]+ ")
  (setq-local outline-level 'nroff-outline-level)
  ;; now define a bunch of variables for use by commands in this mode
  (setq-local page-delimiter "^\\.\\(bp\\|SK\\|OP\\)")
  (setq-local paragraph-start (concat "[.']\\|" paragraph-start))
  (setq-local paragraph-separate (concat "[.']\\|" paragraph-separate))
  ;; Don't auto-fill directive lines starting . or ' since they normally
  ;; have to be one line.  But do auto-fill comments .\" .\# and '''.
  ;; Comment directives (those starting . or ') are [.'][ \t]*\\[#"]
  ;; or ''', and this regexp is everything except those.  So [.']
  ;; followed by not backslash and not ' or followed by backslash but
  ;; then not # or "
  (setq-local auto-fill-inhibit-regexp
              "[.'][ \t]*\\([^ \t\\']\\|\\\\[^#\"]\\)")
  ;; comment syntax added by mit-erl!gildea 18 Apr 86
  (setq-local comment-start "\\\" ")
  (setq-local comment-start-skip "\\\\[\"#][ \t]*")
  (setq-local comment-column 24)
  (setq-local comment-indent-function #'nroff-comment-indent)
  (setq-local comment-insert-comment-function #'nroff-insert-comment-function)
  (setq-local imenu-generic-expression nroff-imenu-expression))