Hi all, Juri Linkov writes: >> C) Disable tab-bar-mode > > While implementing tab closing undo, I added disabling tab-bar-mode > because it was easier to just add this line: > > (or (<= (length tabs) 1) ; closed the last tab > > But please remove this from the default behavior because > I noticed that it disables tab-bar on all frames, whereas > it would make more sense to disable tab-bar only on the > selected frame. Sorry, I didn't quite understand what you wanted me to do there, so I didn't try to address it. >> #+BEGIN_SRC elisp >> (defcustom tab-bar-close-tab-choice nil >> "Defines what to show in a new tab. >> If nil, do not close the tab. >> If close-frame, close the entire containing frame, as a web >> browser would do. >> If disable-tab-bar, turn off tab-bar-mode so that tabs no longer >> show in the frame. >> If the value is a function, call that function with the tab to be >> closed as the argument." >> :type '(choice (const :tag "Do nothing" nil) >> (const :tag "Close frame" 'close-frame) >> (const :tag "Disable tab-bar-mode" 'disable-tab-bar) >> (function :tag "Function")) >> :group 'tab-bar >> :version "27.1") >> #+END_SRC >> >> And then we can go from there. If that sounds like a workable solution, >> then I'll provide a patch in the next few days that implements the >> defcustom and all the appropriate behavior. > > Please implement this defcustom (with the nil default value) because > we need to improve the current logic of closing the last tab (maybe > the name should be tab-bar-close-last-tab-choice to suggest that > it applies to closing only the last tab, not to every tab close). Implemented in the attached patch. Please let me know what you all think. It occurred to me in the process of writing this up that it might be useful to provide hook variables for creating and closing tabs - 'tab-bar-tab-open-hook' and 'tab-bar-tab-close-hook' perhaps? Standard fare on those - a list of functions that take the tab as an argument, probably called as the last task of tab creation and the first task of tab closing? Thoughts? Thanks, -- ~Robert Cochran