Function: nroff-electric-newline

nroff-electric-newline is an interactive and byte-compiled function defined in nroff-mode.el.gz.

Signature

(nroff-electric-newline ARG)

Documentation

Insert newline for nroff mode; special if nroff-electric mode.

In nroff-electric-mode(var)/nroff-electric-mode(fun), if ending a line containing an nroff opening request, automatically inserts the matching closing request after point.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/nroff-mode.el.gz
(defun nroff-electric-newline (arg)
  "Insert newline for nroff mode; special if nroff-electric mode.
In `nroff-electric-mode', if ending a line containing an nroff opening request,
automatically inserts the matching closing request after point."
  (interactive "P")
  (let ((completion (save-excursion
		      (beginning-of-line)
		      (and (null arg)
			   nroff-electric-mode
			   (<= (point) (- (point-max) 3))
			   (cdr (assoc (buffer-substring (point)
							 (+ 3 (point)))
				       nroff-brace-table)))))
	(needs-nl (not (looking-at "[ \t]*$"))))
    (if (null completion)
	(newline (prefix-numeric-value arg))
      (save-excursion
	(insert "\n\n" completion)
	(if needs-nl (insert "\n")))
      (forward-char 1))))