aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-11-01 04:00:09 +0000
committerGlenn Morris2007-11-01 04:00:09 +0000
commit87006f3e0a209add511b15b3c75ff0ea34b88bc2 (patch)
treecaa7c640521563fcf7d05088f00184dff3239db9
parent8aafd651a977bd71eedb60b290fb7265c862c884 (diff)
downloademacs-87006f3e0a209add511b15b3c75ff0ea34b88bc2.tar.gz
emacs-87006f3e0a209add511b15b3c75ff0ea34b88bc2.zip
(nroff-mode): Set indent-line-function.
(nroff-indent-line-function): New function. (nroff-count-text-lines): Use nroff-forward-text-line rather than obsolete alias.
-rw-r--r--lisp/textmodes/nroff-mode.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index 31ec234fddc..d1a9a2ee86f 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -132,6 +132,7 @@ 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 'imenu-generic-expression) nroff-imenu-expression)) 136 (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression))
136 137
137(defun nroff-outline-level () 138(defun nroff-outline-level ()
@@ -163,6 +164,19 @@ Puts a full-stop before comments on a line by themselves."
163 9) 8)))))) ; add 9 to ensure at least two blanks 164 9) 8)))))) ; add 9 to ensure at least two blanks
164 (goto-char pt)))) 165 (goto-char pt))))
165 166
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
172(defun nroff-indent-line-function ()
173 "Function for `indent-line-function' in `nroff-mode'."
174 (save-excursion
175 (forward-line 0)
176 (when (looking-at "[ \t]*\\\\\"[ \t]*") ; \# does not need this
177 (delete-horizontal-space)
178 (insert ?.))))
179
166(defun nroff-count-text-lines (start end &optional print) 180(defun nroff-count-text-lines (start end &optional print)
167 "Count lines in region, except for nroff request lines. 181 "Count lines in region, except for nroff request lines.
168All lines not starting with a period are counted up. 182All lines not starting with a period are counted up.
@@ -175,7 +189,7 @@ Noninteractively, return number of non-request lines from START to END."
175 (save-restriction 189 (save-restriction
176 (narrow-to-region start end) 190 (narrow-to-region start end)
177 (goto-char (point-min)) 191 (goto-char (point-min))
178 (- (buffer-size) (forward-text-line (buffer-size))))))) 192 (- (buffer-size) (nroff-forward-text-line (buffer-size)))))))
179 193
180(defun nroff-forward-text-line (&optional cnt) 194(defun nroff-forward-text-line (&optional cnt)
181 "Go forward one nroff text line, skipping lines of nroff requests. 195 "Go forward one nroff text line, skipping lines of nroff requests.