summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2023-05-07 07:28:56 -0700
committerF. Jason Park <jp@neverwas.me>2023-05-13 07:05:22 -0700
commit75a412d78b6f4b4b68a7c649047cd28320110c09 (patch)
tree6785ad5b9d4390ed9d43c5abb815dd3aad2c69ef /test
parent38706abdf7f6d919640e8e14f0e0dc6cf34aa555 (diff)
downloademacs-75a412d78b6f4b4b68a7c649047cd28320110c09.tar.gz
Optionally add spacing between ERC messages
* etc/ERC-NEWS: Mention option `erc-fill-line-spacing'. * lisp/erc/erc-fill.el (erc-fill-line-spacing, erc-fill-spaced-commands): Add options to allow for extra spacing between messages. (erc-fill--function): Internal var allowing modules to override user option `erc-fill-function'. (erc-fill): Add extra line-spacing on certain types of messages. Prefer `erc-fill--function', when set, over `erc-fill-function'. (erc-fill--make-module-dependency-msg, erc-fill--wrap-ensure-dependencies): Rename former to latter and make more useful. (erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): Refactor. (erc-fill--wrap-fix): Remove unused function. (erc-fill-wrap-nudge): Remove reference to nonexistent function in doc string. * test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--graphic-dir): New variable. (erc-fill-tests--compare): Look in `erc-fill-tests--graphic-dir' for graphical snapshots ignored by Git. (erc-fill-line-spacing): New test. * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: New file. (Bug#60936)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/erc/erc-fill-tests.el24
-rw-r--r--test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld1
2 files changed, 22 insertions, 3 deletions
diff --git a/test/lisp/erc/erc-fill-tests.el b/test/lisp/erc/erc-fill-tests.el
index 170436ffbaa..fc33d0b9103 100644
--- a/test/lisp/erc/erc-fill-tests.el
+++ b/test/lisp/erc/erc-fill-tests.el
@@ -120,10 +120,14 @@
;; Obviously, only run one test at a time.
(defvar erc-fill-tests--save-p nil)
+;; On graphical displays, echo .graphic >> .git/info/exclude
+(defvar erc-fill-tests--graphic-dir "fill/snapshots/.graphic")
+
(defun erc-fill-tests--compare (name)
- (when (display-graphic-p)
- (setq name (concat name "-graphic")))
- (let* ((dir (expand-file-name "fill/snapshots/" (ert-resource-directory)))
+ (let* ((dir (expand-file-name (if (display-graphic-p)
+ erc-fill-tests--graphic-dir
+ "fill/snapshots/")
+ (ert-resource-directory)))
(expect-file (file-name-with-extension (expand-file-name name dir)
"eld"))
(erc--own-property-names
@@ -232,6 +236,20 @@
"<bob> " "<alice> " "<alice> " "<bob> " "<bob> " "<Dummy> " "<Dummy> ")
(erc-fill-tests--compare "merge-02-right")))))
+(ert-deftest erc-fill-line-spacing ()
+ :tags '(:unstable)
+ (unless (>= emacs-major-version 29)
+ (ert-skip "Emacs version too low, missing `buffer-text-pixel-size'"))
+
+ (let ((erc-fill-line-spacing 0.5))
+ (erc-fill-tests--wrap-populate
+ (lambda ()
+ (erc-fill-tests--insert-privmsg "bob" "This buffer is for text.")
+ (erc-display-message nil 'notice (current-buffer) "one two three")
+ (erc-display-message nil 'notice (current-buffer) "four five six")
+ (erc-fill-tests--insert-privmsg "bob" "Somebody stop me")
+ (erc-fill-tests--compare "spacing-01-mono")))))
+
(ert-deftest erc-fill-wrap-visual-keys--body ()
:tags '(:unstable)
(erc-fill-tests--wrap-populate
diff --git a/test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld b/test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld
new file mode 100644
index 00000000000..45c3883b023
--- /dev/null
+++ b/test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld
@@ -0,0 +1 @@
+#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.[00:00]\n<alice> bob: come, you are a tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause to complain of? Come me to what was done to her.\n<bob> alice: Either your unparagoned mistress is dead, or she's outprized by a trifle.\n<bob> This buffer is for text.\n*** one two three\n*** four five six\n<bob> Somebody stop me\n" 2 21 (erc-timestamp 0 line-prefix (space :width (- 27 18)) field erc-timestamp) 21 183 (erc-timestamp 0 wrap-prefix #2=(space :width 27) line-prefix #3=(space :width (- 27 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix #2# line-prefix #3# display #1=((margin right-margin) #("[00:00]" 0 7 (display #1# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 190 191 (line-spacing 0.5 wrap-prefix #2# line-prefix #3#) 191 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=(space :width (- 27 (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-command PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 348 349 (line-spacing 0.5 wrap-prefix #2# line-prefix #4#) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=(space :width (- 27 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 435 436 (line-spacing 0.5 wrap-prefix #2# line-prefix #5#) 436 437 (erc-timestamp 0 wrap-prefix #2# line-prefix #6=(space :width (- 27 0)) display #7="" erc-command PRIVMSG) 437 440 (erc-timestamp 0 wrap-prefix #2# line-prefix #6# display #7# erc-command PRIVMSG) 440 442 (erc-timestamp 0 wrap-prefix #2# line-prefix #6# display #7# erc-command PRIVMSG) 442 466 (erc-timestamp 0 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 466 467 (line-spacing 0.5 wrap-prefix #2# line-prefix #6#) 467 484 (erc-timestamp 0 wrap-prefix #2# line-prefix #8=(space :width (- 27 (4)))) 484 485 (wrap-prefix #2# line-prefix #8#) 485 502 (erc-timestamp 0 wrap-prefix #2# line-prefix #10=(space :width (- 27 (4)))) 502 503 (line-spacing 0.5 wrap-prefix #2# line-prefix #10#) 503 504 (erc-timestamp 0 wrap-prefix #2# line-prefix #9=(space :width (- 27 (6))) erc-command PRIVMSG) 504 507 (erc-timestamp 0 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 507 525 (erc-timestamp 0 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 525 526 (wrap-prefix #2# line-prefix #9#)) \ No newline at end of file