Fix invisible erc-speedbar cursor in text terminals

* lisp/erc/erc-speedbar.el
(erc-speedbar--reset-last-ran-on-timer): Use `with-current-buffer'
instead of `setf' and `buffer-local-value'.
(erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable)
(erc-speedbar-toggle-nicknames-window-lock): Revise doc string.
(erc-speedbar-toggle-nicknames-window-lock): Set `cursor-type' in
speedbar buffer.
(erc-nickbar-toggle-nicknames-window-lock): New function alias.  Note
that this name flouts traditional library namespacing conventions.
* lisp/erc/erc-status-sidebar.el (erc-status-sidebar-get-window): Use
`cursor-type' instead of `internal-show-cursor'.  (Bug#63595)
This commit is contained in:
F. Jason Park 2024-03-31 16:32:44 -07:00
parent e0df2841fb
commit ee377aaddf
2 changed files with 15 additions and 10 deletions

View file

@ -566,9 +566,8 @@ The INDENT level is ignored."
(defun erc-speedbar--reset-last-ran-on-timer ()
"Reset `erc-speedbar--last-ran'."
(when speedbar-buffer
(with-suppressed-warnings ((obsolete buffer-local-value)) ; <=29
(setf (buffer-local-value 'erc-speedbar--last-ran speedbar-buffer)
(current-time)))))
(with-current-buffer speedbar-buffer
(setq erc-speedbar--last-ran (current-time)))))
;;;###autoload(autoload 'erc-nickbar-mode "erc-speedbar" nil t)
(define-erc-module nickbar nil
@ -578,10 +577,12 @@ show its buffer in an `erc-status-sidebar' window instead of a
separate frame. When disabling, close the window or, with a
negative prefix arg, destroy the session.
WARNING: this module may produce unwanted side effects, like the
raising of frames or the stealing of input focus. If you witness
such a thing and can reproduce it, please file a bug report with
\\[erc-bug]."
For controlling whether the speedbar window is selectable with
`other-window', see `erc-nickbar-toggle-nicknames-window-lock'.
Note that during initialization, this module may produce unwanted
side effects, like the raising of frames or the stealing of input
focus. If you witness such a thing and can reproduce it, please
file a bug report with \\[erc-bug]."
((add-hook 'erc--setup-buffer-hook #'erc-speedbar--ensure)
(add-hook 'erc-insert-post-hook #'erc-speedbar--run-timer-on-post-insert)
(add-hook 'speedbar-timer-hook #'erc-speedbar--reset-last-ran-on-timer)
@ -638,8 +639,8 @@ such a thing and can reproduce it, please file a bug report with
(defun erc-speedbar-toggle-nicknames-window-lock (arg)
"Toggle whether nicknames window is selectable with \\[other-window].
When arg is a number, lock the window if non-negative, otherwise
unlock."
When ARG is a number, lock the window if non-negative. Otherwise,
unlock the window."
(interactive "P")
(unless erc-nickbar-mode
(user-error "`erc-nickbar-mode' inactive"))
@ -648,10 +649,14 @@ unlock."
((integerp arg) nil)
(t (not (window-parameter window
'no-other-window))))))
(with-current-buffer speedbar-buffer
(setq cursor-type (not val)))
(set-window-parameter window 'no-other-window val)
(unless (numberp arg)
(message "nick-window: %s" (if val "protected" "selectable"))))))
(defalias 'erc-nickbar-toggle-nicknames-window-lock
#'erc-speedbar-toggle-nicknames-window-lock)
;;;; Nicks integration

View file

@ -192,7 +192,7 @@ If NO-CREATION is non-nil, the window is not created."
(set-window-parameter sidebar-window 'no-delete-other-windows t)
;; Don't cycle to this window with `other-window'.
(set-window-parameter sidebar-window 'no-other-window t)
(internal-show-cursor sidebar-window nil)
(setq cursor-type nil)
(set-window-fringes sidebar-window 0 0)
;; Set a custom display table so the window doesn't show a
;; truncation symbol when a channel name is too big.