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:
parent
db21c84bc9
commit
db7096a532
3 changed files with 18 additions and 23 deletions
|
@ -883,24 +883,22 @@ Conditionally try to reconnect and take appropriate action."
|
|||
(erc--unhide-prompt)))
|
||||
|
||||
(defun erc--hide-prompt (proc)
|
||||
(erc-with-all-buffers-of-server
|
||||
proc nil ; sorta wish this was indent 2
|
||||
(when (and erc-hide-prompt
|
||||
(or (eq erc-hide-prompt t)
|
||||
;; FIXME use `erc--target' after bug#48598
|
||||
(memq (if (erc-default-target)
|
||||
(if (erc-channel-p (car erc-default-recipients))
|
||||
'channel
|
||||
'query)
|
||||
'server)
|
||||
erc-hide-prompt))
|
||||
(marker-position erc-insert-marker)
|
||||
(marker-position erc-input-marker)
|
||||
(get-text-property erc-insert-marker 'erc-prompt))
|
||||
(with-silent-modifications
|
||||
(add-text-properties erc-insert-marker (1- erc-input-marker)
|
||||
`(display ,erc-prompt-hidden)))
|
||||
(add-hook 'pre-command-hook #'erc--unhide-prompt-on-self-insert 0 t))))
|
||||
(erc-with-all-buffers-of-server proc nil
|
||||
(when (and erc-hide-prompt
|
||||
(or (eq erc-hide-prompt t)
|
||||
(memq (if erc--target
|
||||
(if (erc--target-channel-p erc--target)
|
||||
'channel
|
||||
'query)
|
||||
'server)
|
||||
erc-hide-prompt))
|
||||
(marker-position erc-insert-marker)
|
||||
(marker-position erc-input-marker)
|
||||
(get-text-property erc-insert-marker 'erc-prompt))
|
||||
(with-silent-modifications
|
||||
(add-text-properties erc-insert-marker (1- erc-input-marker)
|
||||
`(display ,erc-prompt-hidden)))
|
||||
(add-hook 'pre-command-hook #'erc--unhide-prompt-on-self-insert 91 t))))
|
||||
|
||||
(defun erc-process-sentinel (cproc event)
|
||||
"Sentinel function for ERC process."
|
||||
|
|
|
@ -48,9 +48,6 @@
|
|||
;; User data
|
||||
nickname host login full-name info
|
||||
;; 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))
|
||||
|
||||
(cl-defstruct (erc-channel-user (:type vector) :named)
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
(should (looking-at-p (regexp-quote erc-prompt)))
|
||||
(setq erc-server-process (buffer-local-value 'erc-server-process
|
||||
(get-buffer "ServNet"))
|
||||
erc-default-recipients '("#chan")))
|
||||
erc--target (erc--target-from-string "#chan")))
|
||||
|
||||
(with-current-buffer (get-buffer-create "bob")
|
||||
(erc-tests--send-prep)
|
||||
|
@ -155,7 +155,7 @@
|
|||
(should (looking-at-p (regexp-quote erc-prompt)))
|
||||
(setq erc-server-process (buffer-local-value 'erc-server-process
|
||||
(get-buffer "ServNet"))
|
||||
erc-default-recipients '("bob")))
|
||||
erc--target (erc--target-from-string "bob")))
|
||||
|
||||
(ert-info ("Value: t (default)")
|
||||
(should (eq erc-hide-prompt t))
|
||||
|
|
Loading…
Add table
Reference in a new issue