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.
This commit is contained in:
F. Jason Park 2023-02-22 06:24:17 -08:00
parent db21c84bc9
commit db7096a532
3 changed files with 18 additions and 23 deletions

View file

@ -883,24 +883,22 @@ Conditionally try to reconnect and take appropriate action."
(erc--unhide-prompt))) (erc--unhide-prompt)))
(defun erc--hide-prompt (proc) (defun erc--hide-prompt (proc)
(erc-with-all-buffers-of-server (erc-with-all-buffers-of-server proc nil
proc nil ; sorta wish this was indent 2 (when (and erc-hide-prompt
(when (and erc-hide-prompt (or (eq erc-hide-prompt t)
(or (eq erc-hide-prompt t) (memq (if erc--target
;; FIXME use `erc--target' after bug#48598 (if (erc--target-channel-p erc--target)
(memq (if (erc-default-target) 'channel
(if (erc-channel-p (car erc-default-recipients)) 'query)
'channel 'server)
'query) erc-hide-prompt))
'server) (marker-position erc-insert-marker)
erc-hide-prompt)) (marker-position erc-input-marker)
(marker-position erc-insert-marker) (get-text-property erc-insert-marker 'erc-prompt))
(marker-position erc-input-marker) (with-silent-modifications
(get-text-property erc-insert-marker 'erc-prompt)) (add-text-properties erc-insert-marker (1- erc-input-marker)
(with-silent-modifications `(display ,erc-prompt-hidden)))
(add-text-properties erc-insert-marker (1- erc-input-marker) (add-hook 'pre-command-hook #'erc--unhide-prompt-on-self-insert 91 t))))
`(display ,erc-prompt-hidden)))
(add-hook 'pre-command-hook #'erc--unhide-prompt-on-self-insert 0 t))))
(defun erc-process-sentinel (cproc event) (defun erc-process-sentinel (cproc event)
"Sentinel function for ERC process." "Sentinel function for ERC process."

View file

@ -48,9 +48,6 @@
;; User data ;; User data
nickname host login full-name info nickname host login full-name info
;; Buffers ;; Buffers
;;
;; This is an alist of the form (BUFFER . CHANNEL-DATA), where
;; CHANNEL-DATA is either nil or an erc-channel-user struct.
(buffers nil)) (buffers nil))
(cl-defstruct (erc-channel-user (:type vector) :named) (cl-defstruct (erc-channel-user (:type vector) :named)

View file

@ -147,7 +147,7 @@
(should (looking-at-p (regexp-quote erc-prompt))) (should (looking-at-p (regexp-quote erc-prompt)))
(setq erc-server-process (buffer-local-value 'erc-server-process (setq erc-server-process (buffer-local-value 'erc-server-process
(get-buffer "ServNet")) (get-buffer "ServNet"))
erc-default-recipients '("#chan"))) erc--target (erc--target-from-string "#chan")))
(with-current-buffer (get-buffer-create "bob") (with-current-buffer (get-buffer-create "bob")
(erc-tests--send-prep) (erc-tests--send-prep)
@ -155,7 +155,7 @@
(should (looking-at-p (regexp-quote erc-prompt))) (should (looking-at-p (regexp-quote erc-prompt)))
(setq erc-server-process (buffer-local-value 'erc-server-process (setq erc-server-process (buffer-local-value 'erc-server-process
(get-buffer "ServNet")) (get-buffer "ServNet"))
erc-default-recipients '("bob"))) erc--target (erc--target-from-string "bob")))
(ert-info ("Value: t (default)") (ert-info ("Value: t (default)")
(should (eq erc-hide-prompt t)) (should (eq erc-hide-prompt t))