[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tab-bar.el: add defcustoms for functions to call after openi

From: Juri Linkov
Subject: Re: [PATCH] tab-bar.el: add defcustoms for functions to call after opening and before closing
Date: Sun, 10 Nov 2019 22:42:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> New defcustoms, tab-bar-post-open-functions and
> tab-bar-pre-close-functions. Call all of the function in
> post-open-functions at the end of tab-bar-new-tab-to, passing in the new
> tab as an argument. Similar for pre-close-functions, but slightly more
> complicated to lend some expressive power. Each of the functions take 2
> arguments, the tab itself, and a flag indicating whether or not it's the
> last tab. The big thing is that the return values are kept track of, and
> if *any* of the functions return a non-nil value
> (ie `(cl-some (mapcar (lambda (x) (funcall x tab last-tab))) 
> pre-close-functions)`
> is non-nil), it short-circuits and doesn't run the rest of
> tab-bar-close-tab.

Also similar to run-hook-with-args-until-success.

> This would be useful to provide to users so that they can do other
> clean-up tasks when the tab is closed, as well as providing a way to
> protect a tab from being closed. Ditto for being able to do some tab
> set-up when you open a new tab.

Please bring up some examples of usages for these options because
without examples it's hard to understand how these options are
intended to be used, e.g. how to rename a new tab after creating,
or do a clean-up task on closing, or prevent from closing, etc.

> This is going to take some additional work. I couldn't think of a clean
> way to gracefully provide a way to easily make permanent changes to the
> tab for the purposes of tab-bar-post-open-functions - the functions
> within have to grovel through the tabs frame parameter and write back a value
> themselves. I personally don't find this an optimal user experience, but
> feedback on that point is welcome.

But you provide a new tab as a parameter to tab-bar-post-open-functions.
Could it be used to make changes in a new tab?

> Patch follows.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]