diff options
| author | F. Jason Park | 2023-02-22 06:24:17 -0800 |
|---|---|---|
| committer | F. Jason Park | 2023-02-22 06:33:12 -0800 |
| commit | db7096a532ca031687f9411df621900e869e9e98 (patch) | |
| tree | 3ebc17604347d5cbde6fb79fb399096fbac0179f | |
| parent | db21c84bc9458a1ebaf93a4ff5d289ff96ddd33d (diff) | |
| download | emacs-db7096a532ca031687f9411df621900e869e9e98.tar.gz emacs-db7096a532ca031687f9411df621900e869e9e98.zip | |
Yield to erc-move-to-prompt before unhiding prompt
* lisp/erc/erc-backend.el (erc--hide-prompt): Change hook depth from 0
to 91 to allow the `move-to-prompt' module to do its thing. This
feature was added by bug#54826 and first appeared in Emacs 29.
* lisp/erc/erc-common.el (erc-server-user): Remove erroneous comment.
The `buffers' field is a list of buffers.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Use `erc--target'
instead of `erc-default-recipients' because this is new code.
| -rw-r--r-- | lisp/erc/erc-backend.el | 34 | ||||
| -rw-r--r-- | lisp/erc/erc-common.el | 3 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 4 |
3 files changed, 18 insertions, 23 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index cf0b734bd28..567443f5329 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el | |||
| @@ -883,24 +883,22 @@ Conditionally try to reconnect and take appropriate action." | |||
| 883 | (erc--unhide-prompt))) | 883 | (erc--unhide-prompt))) |
| 884 | 884 | ||
| 885 | (defun erc--hide-prompt (proc) | 885 | (defun erc--hide-prompt (proc) |
| 886 | (erc-with-all-buffers-of-server | 886 | (erc-with-all-buffers-of-server proc nil |
| 887 | proc nil ; sorta wish this was indent 2 | 887 | (when (and erc-hide-prompt |
| 888 | (when (and erc-hide-prompt | 888 | (or (eq erc-hide-prompt t) |
| 889 | (or (eq erc-hide-prompt t) | 889 | (memq (if erc--target |
| 890 | ;; FIXME use `erc--target' after bug#48598 | 890 | (if (erc--target-channel-p erc--target) |
| 891 | (memq (if (erc-default-target) | 891 | 'channel |
| 892 | (if (erc-channel-p (car erc-default-recipients)) | 892 | 'query) |
| 893 | 'channel | 893 | 'server) |
| 894 | 'query) | 894 | erc-hide-prompt)) |
| 895 | 'server) | 895 | (marker-position erc-insert-marker) |
| 896 | erc-hide-prompt)) | 896 | (marker-position erc-input-marker) |
| 897 | (marker-position erc-insert-marker) | 897 | (get-text-property erc-insert-marker 'erc-prompt)) |
| 898 | (marker-position erc-input-marker) | 898 | (with-silent-modifications |
| 899 | (get-text-property erc-insert-marker 'erc-prompt)) | 899 | (add-text-properties erc-insert-marker (1- erc-input-marker) |
| 900 | (with-silent-modifications | 900 | `(display ,erc-prompt-hidden))) |
| 901 | (add-text-properties erc-insert-marker (1- erc-input-marker) | 901 | (add-hook 'pre-command-hook #'erc--unhide-prompt-on-self-insert 91 t)))) |
| 902 | `(display ,erc-prompt-hidden))) | ||
| 903 | (add-hook 'pre-command-hook #'erc--unhide-prompt-on-self-insert 0 t)))) | ||
| 904 | 902 | ||
| 905 | (defun erc-process-sentinel (cproc event) | 903 | (defun erc-process-sentinel (cproc event) |
| 906 | "Sentinel function for ERC process." | 904 | "Sentinel function for ERC process." |
diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el index 994555acecf..0279b0a0bc4 100644 --- a/lisp/erc/erc-common.el +++ b/lisp/erc/erc-common.el | |||
| @@ -48,9 +48,6 @@ | |||
| 48 | ;; User data | 48 | ;; User data |
| 49 | nickname host login full-name info | 49 | nickname host login full-name info |
| 50 | ;; Buffers | 50 | ;; Buffers |
| 51 | ;; | ||
| 52 | ;; This is an alist of the form (BUFFER . CHANNEL-DATA), where | ||
| 53 | ;; CHANNEL-DATA is either nil or an erc-channel-user struct. | ||
| 54 | (buffers nil)) | 51 | (buffers nil)) |
| 55 | 52 | ||
| 56 | (cl-defstruct (erc-channel-user (:type vector) :named) | 53 | (cl-defstruct (erc-channel-user (:type vector) :named) |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 40a2d2de657..d6c63934163 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -147,7 +147,7 @@ | |||
| 147 | (should (looking-at-p (regexp-quote erc-prompt))) | 147 | (should (looking-at-p (regexp-quote erc-prompt))) |
| 148 | (setq erc-server-process (buffer-local-value 'erc-server-process | 148 | (setq erc-server-process (buffer-local-value 'erc-server-process |
| 149 | (get-buffer "ServNet")) | 149 | (get-buffer "ServNet")) |
| 150 | erc-default-recipients '("#chan"))) | 150 | erc--target (erc--target-from-string "#chan"))) |
| 151 | 151 | ||
| 152 | (with-current-buffer (get-buffer-create "bob") | 152 | (with-current-buffer (get-buffer-create "bob") |
| 153 | (erc-tests--send-prep) | 153 | (erc-tests--send-prep) |
| @@ -155,7 +155,7 @@ | |||
| 155 | (should (looking-at-p (regexp-quote erc-prompt))) | 155 | (should (looking-at-p (regexp-quote erc-prompt))) |
| 156 | (setq erc-server-process (buffer-local-value 'erc-server-process | 156 | (setq erc-server-process (buffer-local-value 'erc-server-process |
| 157 | (get-buffer "ServNet")) | 157 | (get-buffer "ServNet")) |
| 158 | erc-default-recipients '("bob"))) | 158 | erc--target (erc--target-from-string "bob"))) |
| 159 | 159 | ||
| 160 | (ert-info ("Value: t (default)") | 160 | (ert-info ("Value: t (default)") |
| 161 | (should (eq erc-hide-prompt t)) | 161 | (should (eq erc-hide-prompt t)) |