summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/newcomment.el5
-rw-r--r--lisp/simple.el7
2 files changed, 9 insertions, 3 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 8772b52376d..e3ee4dfab11 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1382,10 +1382,9 @@ unless optional argument SOFT is non-nil."
(interactive)
(comment-normalize-vars t)
(let (compos comin)
- ;; If we are not inside a comment and we only auto-fill comments,
- ;; don't do anything (unless no comment syntax is defined).
+ ;; If we are not inside a comment don't do anything (unless no
+ ;; comment syntax is defined).
(unless (and comment-start
- comment-auto-fill-only-comments
(not (called-interactively-p 'interactive))
(not (save-excursion
(prog1 (setq compos (comment-beginning))
diff --git a/lisp/simple.el b/lisp/simple.el
index e3d86abe87a..027ce3959a9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7219,6 +7219,13 @@ unless optional argument SOFT is non-nil."
;; If we're not inside a comment, just try to indent.
(t (indent-according-to-mode))))))
+(defun internal-auto-fill ()
+ "The function called by `self-insert-command' to perform auto-filling."
+ (when (or (not comment-start)
+ (not comment-auto-fill-only-comments)
+ (nth 4 (syntax-ppss)))
+ (do-auto-fill)))
+
(defvar normal-auto-fill-function 'do-auto-fill
"The function to use for `auto-fill-function' if Auto Fill mode is turned on.
Some major modes set this.")