Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
394 stars 44 forks source link

Add `persp-after-kill-functions` #143

Closed roife closed 9 months ago

roife commented 9 months ago

We currently have the persp-before-kill-functions in perps-mode. However, it is challenging to efficiently track the list of persps with this variable.

For instance, I maintain a copy of the perspectives list on my mode-line. However, with persp-before-kill-functions, I have to manually update this list, which is not an elegant solution.

Hence, I'm inquiring if it's feasible to introduce persp-after-kill-functions, which would be invoked after deleting a perspective. If it is accepted, I'm interested in creating a PR for its implementation.

Bad-ptr commented 9 months ago

So I guess you are interested in updated persp-names-cache value? Then I think we need something like persp-names-cache-canged-functions. Maybe this could be implemented using add-variable-watcher. Or by adding persp-update-names-cache function and ask users to only change persp-names-cache using this func(in which we will run persp-names-cache-canged-functions).

roife commented 9 months ago

I have reviewed the documentation of add-variable-watcher and have identified some limitations with it. So, I believe the second approach would be a better solution.

However, I do have concerns about the potential for introducing this new function, as it could constitute a breaking change and impact users' existing configurations.

So I believe adding persp-after-kill-functions might still be a better option.

Bad-ptr commented 9 months ago

I do have concerns about the potential for introducing this new function, as it could constitute a breaking change and impact users' existing configurations.

But this "breaking change" will be for the "good". Also I don't think that many users somehow manipulate this variable in their configs... and even if they are -- it will not break their configs, but instead their configs can break external code.

Anyway..

I believe adding persp-after-kill-functions might still be a better option

Let's do it, then.

roife commented 9 months ago

But this "breaking change" will be for the "good". Also I don't think that many users somehow manipulate this variable in their configs... and even if they are -- it will not break their configs, but instead their configs can break external code.

Well, I agree with you. So I have created a pr that adds persp-names-cache-changed-functions, which is more concise than persp-after-kill-functions for users.