GNU bug report logs - #42052
28.0.50; tab-bar-mode should be frame-local

Previous Next

Package: emacs;

Reported by: "James N. V. Cash" <james.nvc <at> gmail.com>

Date: Thu, 25 Jun 2020 21:53:02 UTC

Severity: wishlist

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42052 in the body.
You can then email your comments to 42052 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Thu, 25 Jun 2020 21:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "James N. V. Cash" <james.nvc <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 25 Jun 2020 21:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "James N. V. Cash" <james.nvc <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; tab-bar-mode should be frame-local
Date: Thu, 25 Jun 2020 16:07:48 -0400
When setting tab-bar-show to `1`, I expect the tab bar to only show if
there is more than one tab in the frame.

This behaves as expected when there is only one frame, but if I have
multiple frames open, then if any one of them has more than one tab, it
turns on tab-bar-mode, which then makes any other frame show the tab
bar, even if they only have one tab in them.

Would it be possible to have tab-bar-mode showing be frame-local?

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)
 of 2020-06-20 built on gonk
Repository revision: 3af631dcf28a5964d9e56c9be8ee7f2125d90d8a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.4 LTS

Configured using:
 'configure --with-xwidgets --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD JSON PDUMPER LCMS2 GMP




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 28 Jun 2020 00:19:03 GMT) Full text and rfc822 format available.

Message #8 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: "James N. V. Cash" <james.nvc <at> gmail.com>
Cc: 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 28 Jun 2020 02:40:27 +0300
> When setting tab-bar-show to `1`, I expect the tab bar to only show if
> there is more than one tab in the frame.
>
> This behaves as expected when there is only one frame, but if I have
> multiple frames open, then if any one of them has more than one tab, it
> turns on tab-bar-mode, which then makes any other frame show the tab
> bar, even if they only have one tab in them.
>
> Would it be possible to have tab-bar-mode showing be frame-local?

Thanks for the request, I see this means a request for a new feature of
enabling the tab-bar separately on each frame independently from
other frames.

When some time ago I asked on emacs-devel about the need for a such feature,
proposing to add a new function global-tab-bar-mode, no one wanted it.
But nevertheless it could be created now anyway.

If someone will point out an example of frame-local modes,
this could help in implementing the same for tab-bar-mode.

I can find only toggle-tool-bar-mode-from-frame, but actually
it's still not frame-local.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 28 Jun 2020 12:16:02 GMT) Full text and rfc822 format available.

Message #11 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: James N. V. Cash <james.nvc <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: , 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 28 Jun 2020 08:15:49 -0400
Juri Linkov <juri <at> linkov.net> writes:

>> When setting tab-bar-show to `1`, I expect the tab bar to only show if
>> there is more than one tab in the frame.
>>
> If someone will point out an example of frame-local modes,
> this could help in implementing the same for tab-bar-mode.

Looking at how the tab-bar-mode currently works, the thing that seems
simplest to me would be to change the various functions that
conditionally turn tab-bar-mode on/off (e.g. in tab-bar-new-tab-to)
to have an additional check if (natnump tab-bar-show), in which case
instead of calling (tab-bar-mode 1) or -1, setting the frame parameter
tab-bar-lines for that particular frame to be 1 or 0, as appropriate.

The wrinkle would be, I suppose, having to remove all the frame-local
settings if tab-bar-show changes, but presumably that wouldn't be
happening too often.

A frame-local toggling of the tab bar could work the same way.

If that makes sense (i.e. having the setting be frame local only when
tab-bar-show is 1), I can try submitting a patch later today.

James Cash




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 28 Jun 2020 19:46:01 GMT) Full text and rfc822 format available.

Message #14 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: James N. V. Cash <james.nvc <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: , 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 28 Jun 2020 15:45:33 -0400
James N. V. Cash <james.nvc <at> gmail.com> writes:

> Juri Linkov <juri <at> linkov.net> writes:
>
>>> When setting tab-bar-show to `1`, I expect the tab bar to only show if
>>> there is more than one tab in the frame.
>>>
>> If someone will point out an example of frame-local modes,
>> this could help in implementing the same for tab-bar-mode.
>
> Looking at how the tab-bar-mode currently works, the thing that seems
> simplest to me would be to change the various functions that
> conditionally turn tab-bar-mode on/off (e.g. in tab-bar-new-tab-to)
> to have an additional check if (natnump tab-bar-show), in which case
> instead of calling (tab-bar-mode 1) or -1, setting the frame parameter
> tab-bar-lines for that particular frame to be 1 or 0, as appropriate.
>
> The wrinkle would be, I suppose, having to remove all the frame-local
> settings if tab-bar-show changes, but presumably that wouldn't be
> happening too often.
>
> A frame-local toggling of the tab bar could work the same way.
>
> If that makes sense (i.e. having the setting be frame local only when
> tab-bar-show is 1), I can try submitting a patch later today.

Here's a simple patch I made that seems to act more like I expect

--- /home/james/src/emacs/lisp/tab-bar.el 2020-06-20 10:16:57.177037735 -0400
+++ tab-bar.el  2020-06-28 15:40:38.711147160 -0400
@@ -799,11 +799,16 @@
       (run-hook-with-args 'tab-bar-tab-post-open-functions
                           (nth to-index tabs)))

-    (when (and (not tab-bar-mode)
-               (or (eq tab-bar-show t)
-                   (and (natnump tab-bar-show)
-                        (> (length tabs) tab-bar-show))))
+    (cond
+     (tab-bar-mode)
+     ((eq tab-bar-show t)
       (tab-bar-mode 1))
+     ((and (natnump tab-bar-show)
+           (> (length tabs) tab-bar-show)
+           (zerop (frame-parameter nil 'tab-bar-lines)))
+      (progn
+        (message "show")
+        (set-frame-parameter nil 'tab-bar-lines 1))))

     (force-mode-line-update)
     (unless tab-bar-mode
@@ -936,10 +941,10 @@
                 tab-bar-closed-tabs)
           (set-frame-parameter nil 'tabs (delq close-tab tabs)))

-        (when (and tab-bar-mode
+        (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
                    (and (natnump tab-bar-show)
                         (<= (length tabs) tab-bar-show)))
-          (tab-bar-mode -1))
+          (set-frame-parameter nil 'tab-bar-lines 0))

         (force-mode-line-update)
         (unless tab-bar-mode
@@ -975,10 +980,12 @@
           (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil)))
       (set-frame-parameter nil 'tabs (list (nth current-index tabs)))

-      (when (and tab-bar-mode
-                 (and (natnump tab-bar-show)
-                      (<= 1 tab-bar-show)))
-        (tab-bar-mode -1))
+      (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
+                   (and (natnump tab-bar-show)
+                        (<= (length tabs) tab-bar-show)))
+          (modify-frame-parameters
+           nil
+           (assq-delete-all 'tab-bar-lines (frame-parameters nil))))

       (force-mode-line-update)
       (unless tab-bar-mode




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 28 Jun 2020 23:22:01 GMT) Full text and rfc822 format available.

Message #17 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: James N. V. Cash <james.nvc <at> gmail.com>
Cc: 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Mon, 29 Jun 2020 02:18:57 +0300
>> Looking at how the tab-bar-mode currently works, the thing that seems
>> simplest to me would be to change the various functions that
>> conditionally turn tab-bar-mode on/off (e.g. in tab-bar-new-tab-to)
>> to have an additional check if (natnump tab-bar-show), in which case
>> instead of calling (tab-bar-mode 1) or -1, setting the frame parameter
>> tab-bar-lines for that particular frame to be 1 or 0, as appropriate.
>>
>> The wrinkle would be, I suppose, having to remove all the frame-local
>> settings if tab-bar-show changes, but presumably that wouldn't be
>> happening too often.
>>
>> A frame-local toggling of the tab bar could work the same way.
>>
>> If that makes sense (i.e. having the setting be frame local only when
>> tab-bar-show is 1), I can try submitting a patch later today.
>
> Here's a simple patch I made that seems to act more like I expect

Thanks for the patch.  One problem is that directly changing the
frame parameter tab-bar-lines avoids performing some other
settings in tab-bar-mode such as loading button images and changing
some keybindings.  OTOH, these keybindings can't be frame-local anyway,
so maybe this is not important for the case when tab-bar-show is 1.

> +     ((and (natnump tab-bar-show)
> +           (> (length tabs) tab-bar-show)
> +           (zerop (frame-parameter nil 'tab-bar-lines)))
> +      (progn
> +        (message "show")
> +        (set-frame-parameter nil 'tab-bar-lines 1))))

Please don't forget to remove this debugging message in the final patch.

> @@ -975,10 +980,12 @@
>            (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil)))
>        (set-frame-parameter nil 'tabs (list (nth current-index tabs)))
>
> -      (when (and tab-bar-mode
> -                 (and (natnump tab-bar-show)
> -                      (<= 1 tab-bar-show)))
> -        (tab-bar-mode -1))
> +      (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
> +                   (and (natnump tab-bar-show)
> +                        (<= (length tabs) tab-bar-show)))
> +          (modify-frame-parameters
> +           nil
> +           (assq-delete-all 'tab-bar-lines (frame-parameters nil))))

Unlike other places that simply use (set-frame-parameter nil 'tab-bar-lines 0)
this code is more complex.  But it seems it should work with just
(set-frame-parameter nil 'tab-bar-lines 0) as well.

BTW, I see a problem in the old code: the variable 'tabs' is not always updated
and sometimes contains obsolete data.  It should help to replace

  (<= (length tabs) tab-bar-show)

with

  (<= (length (funcall tab-bar-tabs-function)) tab-bar-show)

that gets fresh data.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Mon, 29 Jun 2020 00:27:01 GMT) Full text and rfc822 format available.

Message #20 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: James N. V. Cash <james.nvc <at> gmail.com>
To: 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 28 Jun 2020 20:26:29 -0400
Juri Linkov <juri <at> linkov.net> writes:

> Please don't forget to remove this debugging message in the final patch.

Oh oops, sorry about that.

> Unlike other places that simply use (set-frame-parameter nil 'tab-bar-lines 0)
> this code is more complex.  But it seems it should work with just
> (set-frame-parameter nil 'tab-bar-lines 0) as well.

Ah, right. I was thinking that

> BTW, I see a problem in the old code: the variable 'tabs' is not always updated
> and sometimes contains obsolete data.  It should help to replace
>
>   (<= (length tabs) tab-bar-show)
>
> with
>
>   (<= (length (funcall tab-bar-tabs-function)) tab-bar-show)
>
> that gets fresh data.

That makes sense.

Here's another patch that addresses this issues, although as you say, it
still doesn't address the issue of loading the button images or changing
keybindings.

--- /home/james/src/emacs/lisp/tab-bar.el 2020-06-20 10:16:57.177037735 -0400
+++ /home/james/tmp/tab-bar.el  2020-06-28 20:15:46.073203151 -0400
@@ -799,11 +799,14 @@
       (run-hook-with-args 'tab-bar-tab-post-open-functions
                           (nth to-index tabs)))

-    (when (and (not tab-bar-mode)
-               (or (eq tab-bar-show t)
-                   (and (natnump tab-bar-show)
-                        (> (length tabs) tab-bar-show))))
+    (cond
+     (tab-bar-mode)
+     ((eq tab-bar-show t)
       (tab-bar-mode 1))
+     ((and (natnump tab-bar-show)
+           (> (length (funcall tab-bar-tabs-function)) tab-bar-show)
+           (zerop (frame-parameter nil 'tab-bar-lines)))
+      (set-frame-parameter nil 'tab-bar-lines 1)))

     (force-mode-line-update)
     (unless tab-bar-mode
@@ -936,10 +939,11 @@
                 tab-bar-closed-tabs)
           (set-frame-parameter nil 'tabs (delq close-tab tabs)))

-        (when (and tab-bar-mode
-                   (and (natnump tab-bar-show)
-                        (<= (length tabs) tab-bar-show)))
-          (tab-bar-mode -1))
+        (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
+                   (natnump tab-bar-show)
+                   (<= (length (funcall tab-bar-tabs-function))
+                       tab-bar-show))
+          (set-frame-parameter nil 'tab-bar-lines 0))

         (force-mode-line-update)
         (unless tab-bar-mode
@@ -975,10 +979,11 @@
           (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil)))
       (set-frame-parameter nil 'tabs (list (nth current-index tabs)))

-      (when (and tab-bar-mode
-                 (and (natnump tab-bar-show)
-                      (<= 1 tab-bar-show)))
-        (tab-bar-mode -1))
+      (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
+                 (natnump tab-bar-show)
+                 (<= (length (funcall tab-bar-tabs-function))
+                     tab-bar-show))
+        (set-frame-parameter nil 'tab-bar-lines 0))

       (force-mode-line-update)
       (unless tab-bar-mode




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Mon, 29 Jun 2020 00:36:01 GMT) Full text and rfc822 format available.

Message #23 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: James N. V. Cash <james.nvc <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 28 Jun 2020 20:35:01 -0400
James N. V. Cash <james.nvc <at> gmail.com> writes:

>> Unlike other places that simply use (set-frame-parameter nil 'tab-bar-lines 0)
>> this code is more complex.  But it seems it should work with just
>> (set-frame-parameter nil 'tab-bar-lines 0) as well.
>
> Ah, right. I was thinking that

Oof, sorry, my brain is just melting today.

Meant to write: "I was thinking that removing the tab-bar-lines would
allow switching tab-bar-mode on or off global work properly, but then
looking at the implementation, I see that it sets the frame parameter
explicitly when toggling on/off in any case."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Mon, 29 Jun 2020 23:47:02 GMT) Full text and rfc822 format available.

Message #26 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: James N. V. Cash <james.nvc <at> gmail.com>
Cc: 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Tue, 30 Jun 2020 02:45:55 +0300
> Here's another patch that addresses this issues, although as you say, it
> still doesn't address the issue of loading the button images or changing
> keybindings.

Thanks, pushed to master.  If you have more ideas for further development,
this report could be left open to address these issues too.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Thu, 09 Jul 2020 17:07:01 GMT) Full text and rfc822 format available.

Message #29 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: James N. V. Cash <james.nvc <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: , 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Thu, 09 Jul 2020 13:06:41 -0400
Juri Linkov <juri <at> linkov.net> writes:

> Thanks, pushed to master.  If you have more ideas for further development,
> this report could be left open to address these issues too.

I've attached another patch that makes the key bindings & xpm icons get
loaded when tab-bar-show is 1 as well. It doesn't un-load the
keybindings in the way that globalling toggling tab-bar-mode off, but I
don't really see a sensible way of doing that frame-locally.

--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -95,23 +95,27 @@ tab-bar-select-tab-modifiers
   :version "27.1")
 
 
-(define-minor-mode tab-bar-mode
-  "Toggle the tab bar in all graphical frames (Tab Bar mode)."
-  :global t
-  ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
-  :variable tab-bar-mode
-  (let ((val (if tab-bar-mode 1 0)))
-    (dolist (frame (frame-list))
-      (set-frame-parameter frame 'tab-bar-lines val))
-    ;; If the user has given `default-frame-alist' a `tab-bar-lines'
-    ;; parameter, replace it.
-    (if (assq 'tab-bar-lines default-frame-alist)
-        (setq default-frame-alist
-              (cons (cons 'tab-bar-lines val)
-                    (assq-delete-all 'tab-bar-lines
-                                     default-frame-alist)))))
-
-  (when (and tab-bar-mode tab-bar-new-button
+(defun tab-bar--define-keys ()
+  "Install key bindings for switching between tabs if the user has
+configured them."
+  (when tab-bar-select-tab-modifiers
+    (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?0)))
+                    'tab-bar-switch-to-recent-tab)
+    (dotimes (i 9)
+      (global-set-key (vector (append tab-bar-select-tab-modifiers
+                                      (list (+ i 1 ?0))))
+                      'tab-bar-select-tab)))
+  ;; Don't override user customized key bindings
+  (unless (global-key-binding [(control tab)])
+    (global-set-key [(control tab)] 'tab-next))
+  (unless (global-key-binding [(control shift tab)])
+    (global-set-key [(control shift tab)] 'tab-previous))
+  (unless (global-key-binding [(control shift iso-lefttab)])
+    (global-set-key [(control shift iso-lefttab)] 'tab-previous)))
+
+(defun tab-bar--load-buttons ()
+  "Load the icons for the tab buttons."
+  (when (and tab-bar-new-button
              (not (get-text-property 0 'display tab-bar-new-button)))
     ;; This file is pre-loaded so only here we can use the right data-directory:
     (add-text-properties 0 (length tab-bar-new-button)
@@ -121,7 +125,7 @@ tab-bar-mode
                                           :ascent center))
                          tab-bar-new-button))
 
-  (when (and tab-bar-mode tab-bar-close-button
+  (when (and tab-bar-close-button
              (not (get-text-property 0 'display tab-bar-close-button)))
     ;; This file is pre-loaded so only here we can use the right data-directory:
     (add-text-properties 0 (length tab-bar-close-button)
@@ -129,24 +133,27 @@ tab-bar-mode
                                           :file "tabs/close.xpm"
                                           :margin (2 . 0)
                                           :ascent center))
-                         tab-bar-close-button))
+                         tab-bar-close-button)))
 
+(define-minor-mode tab-bar-mode
+  "Toggle the tab bar in all graphical frames (Tab Bar mode)."
+  :global t
+  ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
+  :variable tab-bar-mode
+  (let ((val (if tab-bar-mode 1 0)))
+    (dolist (frame (frame-list))
+      (set-frame-parameter frame 'tab-bar-lines val))
+    ;; If the user has given `default-frame-alist' a `tab-bar-lines'
+    ;; parameter, replace it.
+    (if (assq 'tab-bar-lines default-frame-alist)
+        (setq default-frame-alist
+              (cons (cons 'tab-bar-lines val)
+                    (assq-delete-all 'tab-bar-lines
+                                     default-frame-alist)))))
+  (when tab-bar-mode
+    (tab-bar--load-buttons))
   (if tab-bar-mode
-      (progn
-        (when tab-bar-select-tab-modifiers
-          (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?0)))
-                          'tab-bar-switch-to-recent-tab)
-          (dotimes (i 9)
-            (global-set-key (vector (append tab-bar-select-tab-modifiers
-                                            (list (+ i 1 ?0))))
-                            'tab-bar-select-tab)))
-        ;; Don't override user customized key bindings
-        (unless (global-key-binding [(control tab)])
-          (global-set-key [(control tab)] 'tab-next))
-        (unless (global-key-binding [(control shift tab)])
-          (global-set-key [(control shift tab)] 'tab-previous))
-        (unless (global-key-binding [(control shift iso-lefttab)])
-          (global-set-key [(control shift iso-lefttab)] 'tab-previous)))
+      (tab-bar--define-keys)
     ;; Unset only keys bound by tab-bar
     (when (eq (global-key-binding [(control tab)]) 'tab-next)
       (global-unset-key [(control tab)]))
@@ -806,7 +813,10 @@ tab-bar-new-tab-to
      ((and (natnump tab-bar-show)
            (> (length (funcall tab-bar-tabs-function)) tab-bar-show)
            (zerop (frame-parameter nil 'tab-bar-lines)))
-      (set-frame-parameter nil 'tab-bar-lines 1)))
+      (progn
+        (tab-bar--load-buttons)
+        (tab-bar--define-keys)
+        (set-frame-parameter nil 'tab-bar-lines 1))))
 
     (force-mode-line-update)
     (unless tab-bar-mode




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Fri, 10 Jul 2020 00:04:01 GMT) Full text and rfc822 format available.

Message #32 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: James N. V. Cash <james.nvc <at> gmail.com>
Cc: 42052 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Fri, 10 Jul 2020 02:49:42 +0300
> I've attached another patch that makes the key bindings & xpm icons get
> loaded when tab-bar-show is 1 as well. It doesn't un-load the
> keybindings in the way that globalling toggling tab-bar-mode off, but I
> don't really see a sensible way of doing that frame-locally.

I don't know if such thing as frame-local keybindings is currently possible.

The manual at (info "(elisp) Searching Keymaps") shows the decision tree:

     (or (if overriding-terminal-local-map
             (FIND-IN overriding-terminal-local-map))
         (if overriding-local-map
             (FIND-IN overriding-local-map)
           (or (FIND-IN (get-char-property (point) 'keymap))
               (FIND-IN-ANY emulation-mode-map-alists)
               (FIND-IN-ANY minor-mode-overriding-map-alist)
               (FIND-IN-ANY minor-mode-map-alist)
               (if (get-text-property (point) 'local-map)
                   (FIND-IN (get-char-property (point) 'local-map))
                 (FIND-IN (current-local-map)))))
         (FIND-IN (current-global-map)))

If the variable `overriding-terminal-local-map` can't be made frame-local,
then maybe a new rule could be added.  Then like `(get-char-property (point) 'keymap)`
gets a keymap at point, a new rule could get a keymap from the frame alist.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sat, 11 Jul 2020 14:46:01 GMT) Full text and rfc822 format available.

Message #35 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: James N. V. Cash <james.nvc <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: , 42052 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sat, 11 Jul 2020 10:45:35 -0400
Juri Linkov <juri <at> linkov.net> writes:

>> I've attached another patch that makes the key bindings & xpm icons get
>> loaded when tab-bar-show is 1 as well. It doesn't un-load the
>> keybindings in the way that globalling toggling tab-bar-mode off, but I
>> don't really see a sensible way of doing that frame-locally.
>
> ...
>
> If the variable `overriding-terminal-local-map` can't be made frame-local,
> then maybe a new rule could be added.  Then like `(get-char-property (point) 'keymap)`
> gets a keymap at point, a new rule could get a keymap from the frame alist.

I can look into that as a generally useful addition.

For this particular case though, I don't know if it's completely
necessary: The functions that are bound to keys here silently do nothing
if there's only one tab and the bindings don't get added if there are
other bindings for those keys, so as far as I can tell, it shouldn't
really make a difference whether or not the bindings are active when the
tab bar isn't visible.

It is entirely possible I'm missing something though and it certainly
does seem "cleaner" to remove the key bindings when they don't need to
be there.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sat, 11 Jul 2020 15:18:02 GMT) Full text and rfc822 format available.

Message #38 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: "James N. V. Cash" <james.nvc <at> gmail.com>, 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sat, 11 Jul 2020 11:17:01 -0400
> I don't know if such thing as frame-local keybindings is currently possible.
>
> The manual at (info "(elisp) Searching Keymaps") shows the decision tree:

FWIW, I think it would be nice to eliminate the last few remaining
places where we collect the active keymaps by hand rather than by
calling Fcurrent_active_maps.

Then we could allow Elisp code to modify the behavior of
`current-active-maps`.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 12 Jul 2020 00:36:01 GMT) Full text and rfc822 format available.

Message #41 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: James N. V. Cash <james.nvc <at> gmail.com>
Cc: 42052 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 12 Jul 2020 03:01:15 +0300
> For this particular case though, I don't know if it's completely
> necessary: The functions that are bound to keys here silently do nothing
> if there's only one tab and the bindings don't get added if there are
> other bindings for those keys, so as far as I can tell, it shouldn't
> really make a difference whether or not the bindings are active when the
> tab bar isn't visible.

The answer depends on another question: why bother unsetting tab-bar keys
while disabling tab-bar-mode globally?  I mean the lines in tab-bar-mode
after ";; Unset only keys bound by tab-bar".  Maybe it's useful to make the
keybindings space cleaner?

PS: please see the bug report sent yesterday to emacs-devel at
https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00251.html

It seems the variable tab-bar-mode should be frame-local.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 12 Jul 2020 00:36:01 GMT) Full text and rfc822 format available.

Message #44 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: "James N. V. Cash" <james.nvc <at> gmail.com>, 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 12 Jul 2020 03:04:31 +0300
>> I don't know if such thing as frame-local keybindings is currently possible.
>>
>> The manual at (info "(elisp) Searching Keymaps") shows the decision tree:
>
> FWIW, I think it would be nice to eliminate the last few remaining
> places where we collect the active keymaps by hand rather than by
> calling Fcurrent_active_maps.
>
> Then we could allow Elisp code to modify the behavior of
> `current-active-maps`.

I can't find these places where the active keymaps are collected by hand.
But maybe adding an advice on `current-active-maps` to use frame-local
keybindings might help to find these places where frame-local keybindings
will fail.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Sun, 12 Jul 2020 16:39:01 GMT) Full text and rfc822 format available.

Message #47 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: "James N. V. Cash" <james.nvc <at> gmail.com>, 42052 <at> debbugs.gnu.org
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Sun, 12 Jul 2020 12:38:25 -0400
Juri Linkov [2020-07-12 03:04:31] wrote:

>>> I don't know if such thing as frame-local keybindings is currently possible.
>>>
>>> The manual at (info "(elisp) Searching Keymaps") shows the decision tree:
>>
>> FWIW, I think it would be nice to eliminate the last few remaining
>> places where we collect the active keymaps by hand rather than by
>> calling Fcurrent_active_maps.
>>
>> Then we could allow Elisp code to modify the behavior of
>> `current-active-maps`.
>
> I can't find these places where the active keymaps are collected by hand.

Grep for `current_minor_maps`: it should ideally only be called from
Fcurrent_minor_mode_maps and Fcurrent_active_maps.

IIRC it's done in the code to build the menus and the tool bar.


        Stefan





Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 25 Aug 2020 13:50:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Tue, 13 Oct 2020 03:08:02 GMT) Full text and rfc822 format available.

Message #52 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: "James N. V. Cash" <james.nvc <at> gmail.com>, 42052 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Tue, 13 Oct 2020 05:07:18 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> I've attached another patch that makes the key bindings & xpm icons get
>> loaded when tab-bar-show is 1 as well. It doesn't un-load the
>> keybindings in the way that globalling toggling tab-bar-mode off, but I
>> don't really see a sensible way of doing that frame-locally.
>
> I don't know if such thing as frame-local keybindings is currently possible.

And then the discussion seemed to be concerned with that point, but
skimming this thread, it doesn't look like the proposed patch was
discussed.

Juri, could you take a look at the patch and see whether it looks
reasonable?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42052; Package emacs. (Tue, 05 Jan 2021 18:38:01 GMT) Full text and rfc822 format available.

Message #55 received at 42052 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "James N. V. Cash" <james.nvc <at> gmail.com>, 42052 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#42052: 28.0.50; tab-bar-mode should be frame-local
Date: Tue, 05 Jan 2021 20:36:28 +0200
tags 42052 fixed
close 42052 28.0.50
thanks

>>> I've attached another patch that makes the key bindings & xpm icons get
>>> loaded when tab-bar-show is 1 as well. It doesn't un-load the
>>> keybindings in the way that globalling toggling tab-bar-mode off, but I
>>> don't really see a sensible way of doing that frame-locally.
>>
>> I don't know if such thing as frame-local keybindings is currently possible.
>
> And then the discussion seemed to be concerned with that point, but
> skimming this thread, it doesn't look like the proposed patch was
> discussed.
>
> Juri, could you take a look at the patch and see whether it looks
> reasonable?

Sorry for the delay.  Now the patch is pushed to master, and report is closed.

Frame-local keybindings could be implemented in a separate feature request.




Added tag(s) fixed. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Tue, 05 Jan 2021 18:38:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.0.50, send any further explanations to 42052 <at> debbugs.gnu.org and "James N. V. Cash" <james.nvc <at> gmail.com> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Tue, 05 Jan 2021 18:38:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 03 Feb 2021 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.