emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/nroff-mode.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/nroff-mode.el,v
Date: Sat, 03 Nov 2007 03:02:01 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       07/11/03 03:02:00

Index: nroff-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/nroff-mode.el,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- nroff-mode.el       1 Nov 2007 04:00:09 -0000       1.36
+++ nroff-mode.el       3 Nov 2007 03:02:00 -0000       1.37
@@ -132,7 +132,8 @@
   (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 'indent-line-function) 'nroff-indent-line-function)
+  (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 ()
@@ -152,6 +153,7 @@
          (skip-chars-backward " \t")
          (if (bolp)
              (progn
+               ;; FIXME delete-horizontal-space?
                (setq pt (1+ pt))
                (insert ?.)
                1)
@@ -164,18 +166,11 @@
                              9) 8)))))) ; add 9 to ensure at least two blanks
       (goto-char pt))))
 
-;; All this does is insert a "." at the start of comment-lines,
-;; for the sake of comment-dwim adding a new comment on an empty line.
-;; Hack! The right fix probably involves ;; comment-insert-comment-function,
-;; but comment-dwim does not call that for the empty line case.
 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01869.html
-(defun nroff-indent-line-function ()
-  "Function for `indent-line-function' in `nroff-mode'."
-  (save-excursion
-    (forward-line 0)
-    (when (looking-at "[ \t]*\\\\\"[ \t]*") ; \# does not need this
-      (delete-horizontal-space)
-      (insert ?.))))
+(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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]