diff options
| author | F. Jason Park | 2023-02-19 21:33:36 -0800 |
|---|---|---|
| committer | F. Jason Park | 2023-04-08 14:23:51 -0700 |
| commit | 05f6fdb9e7893329baff675bd31fb36ad64c756d (patch) | |
| tree | 6228f6feb7b97e20a72231cc49ef5fa642246aa0 /test | |
| parent | e7992d2adbc50ba8a3b0fb18b9afe22a2a539b1d (diff) | |
| download | emacs-05f6fdb9e7893329baff675bd31fb36ad64c756d.tar.gz emacs-05f6fdb9e7893329baff675bd31fb36ad64c756d.zip | |
Preserve ERC prompt and its bounding markers
* lisp/erc/erc.el (erc--assert-input-bounds): Add possibly temporary
helper function to sync `process-mark' to `erc-insert-marker' in
server buffer.
(erc-display-line-1): Expect `erc-insert-marker' to always be
initialized. Assert some essential invariants regarding insert
markers.
(erc-send-current-line): Delete typed input but not the prompt.
(erc-display-msg): Rework slightly to respect existing markers.
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send): Set insert marker.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--rename-server-buffer--existing-live): Initialize
markers to appease `erc--assert-input-bounds'.
* test/lisp/erc/erc-tests.el (erc-ring-previous-command): Fix sloppy
mock. (Bug#60936.)
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-dcc-tests.el | 2 | ||||
| -rw-r--r-- | test/lisp/erc/erc-networks-tests.el | 10 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/test/lisp/erc/erc-dcc-tests.el b/test/lisp/erc/erc-dcc-tests.el index fed86eff2c5..7fb5f82e784 100644 --- a/test/lisp/erc/erc-dcc-tests.el +++ b/test/lisp/erc/erc-dcc-tests.el | |||
| @@ -60,6 +60,8 @@ | |||
| 60 | erc-input-marker (make-marker) | 60 | erc-input-marker (make-marker) |
| 61 | erc-insert-marker (make-marker) | 61 | erc-insert-marker (make-marker) |
| 62 | erc-server-current-nick "dummy") | 62 | erc-server-current-nick "dummy") |
| 63 | (erc-display-prompt) | ||
| 64 | (set-marker erc-insert-marker (pos-bol)) | ||
| 63 | (set-process-query-on-exit-flag erc-server-process nil) | 65 | (set-process-query-on-exit-flag erc-server-process nil) |
| 64 | (should-not erc-dcc-list) | 66 | (should-not erc-dcc-list) |
| 65 | (erc-ctcp-query-DCC erc-server-process | 67 | (erc-ctcp-query-DCC erc-server-process |
diff --git a/test/lisp/erc/erc-networks-tests.el b/test/lisp/erc/erc-networks-tests.el index 96836c29aed..b9d216f217b 100644 --- a/test/lisp/erc/erc-networks-tests.el +++ b/test/lisp/erc/erc-networks-tests.el | |||
| @@ -1475,10 +1475,16 @@ | |||
| 1475 | (erc-mode) | 1475 | (erc-mode) |
| 1476 | (setq erc-network 'FooNet | 1476 | (setq erc-network 'FooNet |
| 1477 | erc-server-current-nick "tester" | 1477 | erc-server-current-nick "tester" |
| 1478 | erc-insert-marker (set-marker (make-marker) (point-max)) | 1478 | erc-insert-marker (make-marker) |
| 1479 | erc-input-marker (make-marker) | ||
| 1479 | erc-server-process (erc-networks-tests--create-live-proc) | 1480 | erc-server-process (erc-networks-tests--create-live-proc) |
| 1480 | erc-networks--id (erc-networks--id-create nil)) | 1481 | erc-networks--id (erc-networks--id-create nil)) |
| 1481 | (should-not (erc-networks--rename-server-buffer erc-server-process)) | 1482 | (set-process-sentinel erc-server-process #'ignore) |
| 1483 | (erc-display-prompt nil (point-max)) | ||
| 1484 | (set-marker erc-insert-marker (pos-bol)) | ||
| 1485 | (erc-display-message nil 'notice (current-buffer) "notice") | ||
| 1486 | (with-silent-modifications | ||
| 1487 | (should-not (erc-networks--rename-server-buffer erc-server-process))) | ||
| 1482 | (should (eq erc-active-buffer old-buf)) | 1488 | (should (eq erc-active-buffer old-buf)) |
| 1483 | (should-not (erc-server-process-alive)) | 1489 | (should-not (erc-server-process-alive)) |
| 1484 | (should (string= (buffer-name) "irc.foonet.org")) | 1490 | (should (string= (buffer-name) "irc.foonet.org")) |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 795864a2cc2..b2f24aa718e 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -559,8 +559,8 @@ | |||
| 559 | ;; | 559 | ;; |
| 560 | (cl-letf (((symbol-function 'erc-process-input-line) | 560 | (cl-letf (((symbol-function 'erc-process-input-line) |
| 561 | (lambda (&rest _) | 561 | (lambda (&rest _) |
| 562 | (insert-before-markers | 562 | (erc-display-message |
| 563 | (erc-display-message-highlight 'notice "echo: one\n")))) | 563 | nil 'notice (current-buffer) "echo: one\n"))) |
| 564 | ((symbol-function 'erc-command-no-process-p) | 564 | ((symbol-function 'erc-command-no-process-p) |
| 565 | (lambda (&rest _) t))) | 565 | (lambda (&rest _) t))) |
| 566 | (ert-info ("Create ring, populate, recall") | 566 | (ert-info ("Create ring, populate, recall") |