]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix invisible erc-speedbar cursor in text terminals
authorF. Jason Park <jp@neverwas.me>
Sun, 31 Mar 2024 23:32:44 +0000 (16:32 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 10 Apr 2024 20:27:56 +0000 (22:27 +0200)
* 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)

(cherry picked from commit ee377aaddf9d73116b93c3d54b1ffef9a3a8b925)

lisp/erc/erc-speedbar.el
lisp/erc/erc-status-sidebar.el

index a81a3869436142dd8a548d0a188c1160e0df7d05..b156f61d5d9c980c51ea329adcfef1c2f3bb783e 100644 (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
 
index b7695651e4c4ed22ab20370a23e9ab2101f593c4..dcdef7cfafcc2407f265fdb33e7b59366ee0bccc 100644 (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.