Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not reopen ebib after killing buffer (i.e. not using ebib-quit) #213

Open
dalanicolai opened this issue Sep 15, 2021 · 6 comments
Open
Labels
Bug Incorrect behaviour, should be fixed.

Comments

@dalanicolai
Copy link

After killing the 'ebib index buffer' using kill-buffer, I can not reopen ebib because the value of index in the ebib--buffer-alist gets set to #<killed buffer>. Unfortunately, I did not find a quick way to fix it, and therefore I am just reporting it here.

This bug has very low priority as I can, as a workaround, just remap the kill-buffer function to ebib-quit. So I am just reporting the issue here for 'completeness`. Thank you!

@joostkremers joostkremers added the Bug Incorrect behaviour, should be fixed. label Sep 15, 2021
@joostkremers
Copy link
Owner

Thanks for reporting this. Ideally, Ebib should be a little more robust, of course, so this does count as a bug.

@lebensterben
Copy link

@joostkremers
We can remind users to use ebib-quit instead of kill-buffer in the installation section of https://joostkremers.github.io/ebib/?

Alternatively, we may use a :around advice to kill-buffer for ebib-mode which calls ebib-quit.

@joostkremers
Copy link
Owner

The key sequence C-x k is bound to ebib-quit already, but obviously that is not enough. I should instead remap the key sequence bound to kill-buffer to call ebib-quit.

That wouldn't have any effect, though, if the user calls M-x kill-buffer directly, or if there is a different command to kill the buffer (as seems to be the case for Spacemacs).

For M-x kill-buffer, it would suffice to add a function to kill-buffer-query-functions to warn the user, but I don't know if that hook is run at all in the case of spacemacs/kill-this-buffer. (Though I would be a little surprised if it weren't.)

A more robust way would be to make sure that the index buffer is recreated if it's killed. For the index buffer, that would be fairly easy to implement. A similar problem exists for the entry buffer, however, and there it's not so easy to fix. I need to think a little about the best way to deal with this issue.

@joostkremers
Copy link
Owner

@joostkremers
We can remind users to use ebib-quit instead of kill-buffer in the installation section of https://joostkremers.github.io/ebib/?

I would definitely be good to mention this in the manual somewhere.

Alternatively, we may use a :around advice to kill-buffer for ebib-mode which calls ebib-quit.

There shouldn't be any need for an :around advice, given that there is kill-buffer-query-functions and kill-buffer-hook. I just need to think about the best way to use these hooks.

@lebensterben
Copy link

@joostkremers

(defun spacemacs/kill-this-buffer (&optional arg)
  "Kill the current buffer.
If the universal prefix argument is used then kill also the window."
  (interactive "P")
  (if (window-minibuffer-p)
      (abort-recursive-edit)
    (if (equal '(4) arg)
        (kill-buffer-and-window)
      (kill-buffer))))

Simply put spacemacs/kill-this-buffer is just kill-buffer in this use case.

@joostkremers
Copy link
Owner

@lebensterben Thanks for digging that up. It's what I expected, but it's good to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect behaviour, should be fixed.
Projects
None yet
Development

No branches or pull requests

3 participants