[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 854950a148 2/2: * (sweeprolog-mode): Improve in
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 854950a148 2/2: * (sweeprolog-mode): Improve interaction with auto-fill-mode |
Date: |
Sat, 10 Dec 2022 02:59:35 -0500 (EST) |
branch: elpa/sweeprolog
commit 854950a148087a8e33098d543d1fabcb252762d2
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
* (sweeprolog-mode): Improve interaction with auto-fill-mode
---
sweeprolog-tests.el | 23 +++++++++++++++++++++++
sweeprolog.el | 2 ++
2 files changed, 25 insertions(+)
diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el
index cf0d331151..5ccbb03111 100644
--- a/sweeprolog-tests.el
+++ b/sweeprolog-tests.el
@@ -1044,6 +1044,29 @@ scasp_and_show(Q, Model, Tree) :-
%
% "))))
+(ert-deftest auto-fill-pldoc-comments ()
+ "Test writing PlDoc comments with `auto-fill-mode' enable."
+ (with-temp-buffer
+ (sweeprolog-mode)
+ (auto-fill-mode)
+ (seq-do (lambda (c)
+ (let ((last-command-event c))
+ (call-interactively #'self-insert-command)))
+ "
+%! foobar is det.
+%
+% Nam vestibulum accumsan nisl. Donec pretium posuere tellus. Aenean in
sem ac leo mollis blandit. Nam a sapien. Proin quam nisl, tincidunt et,
mattis eget, convallis nec, purus.
+"
+ )
+ (should (string= (buffer-string)
+ "
+%! foobar is det.
+%
+% Nam vestibulum accumsan nisl. Donec pretium posuere tellus.
+% Aenean in sem ac leo mollis blandit. Nam a sapien. Proin quam
+% nisl, tincidunt et, mattis eget, convallis nec, purus.
+"))))
+
(ert-deftest electric-layout ()
"Test `sweeprolog-electric-layout-mode'."
(with-temp-buffer
diff --git a/sweeprolog.el b/sweeprolog.el
index 9fabeb0280..92c0bde6b0 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -3545,6 +3545,8 @@ certain contexts to maintain conventional Prolog layout."
(setq-local forward-sexp-function #'sweeprolog-forward-sexp-function)
(setq-local syntax-propertize-function #'sweeprolog-syntax-propertize)
(setq-local indent-line-function #'sweeprolog-indent-line)
+ (setq-local adaptive-fill-regexp "[ \t]*")
+ (setq-local fill-indent-according-to-mode t)
(setq-local font-lock-defaults
'(nil
nil