aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-11-01 04:03:12 +0000
committerGlenn Morris2007-11-01 04:03:12 +0000
commit31cf791e20a025f5cde92a551b5751c972da451a (patch)
treecef59ceab1feac1b78c232627b61fdef0f280c80
parent17b159c4e46e77beb476ac63a57322adfeb159d6 (diff)
downloademacs-31cf791e20a025f5cde92a551b5751c972da451a.tar.gz
emacs-31cf791e20a025f5cde92a551b5751c972da451a.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/ChangeLog5
-rw-r--r--lisp/textmodes/nroff-mode.el16
2 files changed, 20 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 37959364533..ce984fb410c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -21,6 +21,11 @@
21 (footnote-roman-lower-regexp, footnote-roman-upper-regexp): 21 (footnote-roman-lower-regexp, footnote-roman-upper-regexp):
22 Match multi-character footnotes. 22 Match multi-character footnotes.
23 23
24 * textmodes/nroff-mode.el (nroff-mode): Set indent-line-function.
25 (nroff-indent-line-function): New function.
26 (nroff-count-text-lines): Use nroff-forward-text-line rather than
27 obsolete alias.
28
242007-10-31 Michael Albinus <michael.albinus@gmx.de> 292007-10-31 Michael Albinus <michael.albinus@gmx.de>
25 30
26 * net/tramp.el (tramp-open-connection-telnet) 31 * net/tramp.el (tramp-open-connection-telnet)
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index 18156071e1c..8297bb05827 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -130,6 +130,7 @@ closing requests for requests that are used in matched pairs."
130 (set (make-local-variable 'comment-start-skip) "\\\\\"[ \t]*") 130 (set (make-local-variable 'comment-start-skip) "\\\\\"[ \t]*")
131 (set (make-local-variable 'comment-column) 24) 131 (set (make-local-variable 'comment-column) 24)
132 (set (make-local-variable 'comment-indent-function) 'nroff-comment-indent) 132 (set (make-local-variable 'comment-indent-function) 'nroff-comment-indent)
133 (set (make-local-variable 'indent-line-function) 'nroff-indent-line-function)
133 (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression)) 134 (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression))
134 135
135(defun nroff-outline-level () 136(defun nroff-outline-level ()
@@ -161,6 +162,19 @@ Puts a full-stop before comments on a line by themselves."
161 9) 8)))))) ; add 9 to ensure at least two blanks 162 9) 8)))))) ; add 9 to ensure at least two blanks
162 (goto-char pt)))) 163 (goto-char pt))))
163 164
165;; All this does is insert a "." at the start of comment-lines,
166;; for the sake of comment-dwim adding a new comment on an empty line.
167;; Hack! The right fix probably involves ;; comment-insert-comment-function,
168;; but comment-dwim does not call that for the empty line case.
169;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01869.html
170(defun nroff-indent-line-function ()
171 "Function for `indent-line-function' in `nroff-mode'."
172 (save-excursion
173 (forward-line 0)
174 (when (looking-at "[ \t]*\\\\\"[ \t]*") ; \# does not need this
175 (delete-horizontal-space)
176 (insert ?.))))
177
164(defun nroff-count-text-lines (start end &optional print) 178(defun nroff-count-text-lines (start end &optional print)
165 "Count lines in region, except for nroff request lines. 179 "Count lines in region, except for nroff request lines.
166All lines not starting with a period are counted up. 180All lines not starting with a period are counted up.
@@ -173,7 +187,7 @@ Noninteractively, return number of non-request lines from START to END."
173 (save-restriction 187 (save-restriction
174 (narrow-to-region start end) 188 (narrow-to-region start end)
175 (goto-char (point-min)) 189 (goto-char (point-min))
176 (- (buffer-size) (forward-text-line (buffer-size))))))) 190 (- (buffer-size) (nroff-forward-text-line (buffer-size)))))))
177 191
178(defun nroff-forward-text-line (&optional cnt) 192(defun nroff-forward-text-line (&optional cnt)
179 "Go forward one nroff text line, skipping lines of nroff requests. 193 "Go forward one nroff text line, skipping lines of nroff requests.