aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorGlenn Morris2007-11-03 03:02:00 +0000
committerGlenn Morris2007-11-03 03:02:00 +0000
commit802054c96394bce2422b72d1876d4fd54c1c219a (patch)
treeeecb9878de55f451dcbc880ec73d5df80137a1fd /lisp/textmodes
parenteb0c4c308497fa8af6ee20354d4168898743f334 (diff)
downloademacs-802054c96394bce2422b72d1876d4fd54c1c219a.tar.gz
emacs-802054c96394bce2422b72d1876d4fd54c1c219a.zip
(nroff-mode): Set comment-insert-comment-function rather than
indent-line-function. (nroff-indent-line-function): Remove. (nroff-insert-comment-function): New function.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/nroff-mode.el19
1 files changed, 7 insertions, 12 deletions
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index d1a9a2ee86f..97b9f3b45c3 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -132,7 +132,8 @@ closing requests for requests that are used in matched pairs."
132 (set (make-local-variable 'comment-start-skip) "\\\\[\"#][ \t]*") 132 (set (make-local-variable 'comment-start-skip) "\\\\[\"#][ \t]*")
133 (set (make-local-variable 'comment-column) 24) 133 (set (make-local-variable 'comment-column) 24)
134 (set (make-local-variable 'comment-indent-function) 'nroff-comment-indent) 134 (set (make-local-variable 'comment-indent-function) 'nroff-comment-indent)
135 (set (make-local-variable 'indent-line-function) 'nroff-indent-line-function) 135 (set (make-local-variable 'comment-insert-comment-function)
136 'nroff-insert-comment-function)
136 (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression)) 137 (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression))
137 138
138(defun nroff-outline-level () 139(defun nroff-outline-level ()
@@ -152,6 +153,7 @@ Puts a full-stop before comments on a line by themselves."
152 (skip-chars-backward " \t") 153 (skip-chars-backward " \t")
153 (if (bolp) 154 (if (bolp)
154 (progn 155 (progn
156 ;; FIXME delete-horizontal-space?
155 (setq pt (1+ pt)) 157 (setq pt (1+ pt))
156 (insert ?.) 158 (insert ?.)
157 1) 159 1)
@@ -164,18 +166,11 @@ Puts a full-stop before comments on a line by themselves."
164 9) 8)))))) ; add 9 to ensure at least two blanks 166 9) 8)))))) ; add 9 to ensure at least two blanks
165 (goto-char pt)))) 167 (goto-char pt))))
166 168
167;; All this does is insert a "." at the start of comment-lines,
168;; for the sake of comment-dwim adding a new comment on an empty line.
169;; Hack! The right fix probably involves ;; comment-insert-comment-function,
170;; but comment-dwim does not call that for the empty line case.
171;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01869.html 169;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01869.html
172(defun nroff-indent-line-function () 170(defun nroff-insert-comment-function ()
173 "Function for `indent-line-function' in `nroff-mode'." 171 "Function for `comment-insert-comment-function' in `nroff-mode'."
174 (save-excursion 172 (indent-to (nroff-comment-indent))
175 (forward-line 0) 173 (insert comment-start))
176 (when (looking-at "[ \t]*\\\\\"[ \t]*") ; \# does not need this
177 (delete-horizontal-space)
178 (insert ?.))))
179 174
180(defun nroff-count-text-lines (start end &optional print) 175(defun nroff-count-text-lines (start end &optional print)
181 "Count lines in region, except for nroff request lines. 176 "Count lines in region, except for nroff request lines.