summaryrefslogtreecommitdiff
path: root/lisp/textmodes/nroff-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes/nroff-mode.el')
-rw-r--r--lisp/textmodes/nroff-mode.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index 31ec234fddc..97b9f3b45c3 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -132,6 +132,8 @@ closing requests for requests that are used in matched pairs."
(set (make-local-variable 'comment-start-skip) "\\\\[\"#][ \t]*")
(set (make-local-variable 'comment-column) 24)
(set (make-local-variable 'comment-indent-function) 'nroff-comment-indent)
+ (set (make-local-variable 'comment-insert-comment-function)
+ 'nroff-insert-comment-function)
(set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression))
(defun nroff-outline-level ()
@@ -151,6 +153,7 @@ Puts a full-stop before comments on a line by themselves."
(skip-chars-backward " \t")
(if (bolp)
(progn
+ ;; FIXME delete-horizontal-space?
(setq pt (1+ pt))
(insert ?.)
1)
@@ -163,6 +166,12 @@ Puts a full-stop before comments on a line by themselves."
9) 8)))))) ; add 9 to ensure at least two blanks
(goto-char pt))))
+;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01869.html
+(defun nroff-insert-comment-function ()
+ "Function for `comment-insert-comment-function' in `nroff-mode'."
+ (indent-to (nroff-comment-indent))
+ (insert comment-start))
+
(defun nroff-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.
@@ -175,7 +184,7 @@ Noninteractively, return number of non-request lines from START to END."
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
- (- (buffer-size) (forward-text-line (buffer-size)))))))
+ (- (buffer-size) (nroff-forward-text-line (buffer-size)))))))
(defun nroff-forward-text-line (&optional cnt)
"Go forward one nroff text line, skipping lines of nroff requests.