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

Cannot run org-agenda-kill after introducing derived mode #102

Closed
AloisJanicek opened this issue Mar 15, 2020 · 3 comments
Closed

Cannot run org-agenda-kill after introducing derived mode #102

AloisJanicek opened this issue Mar 15, 2020 · 3 comments

Comments

@AloisJanicek
Copy link

Since org-agenda-kill explicitly requires org-agenda-mode by this line

(or (eq major-mode 'org-agenda-mode) (user-error "Not in agenda"))

at the beginning of its definition, after introducing org-ql-view-mode in ba7d4a2, user can no longer delete org headings from inside Org-QL buffer.

This is loosely related to #35 in a sense that it shows that Org-mode sometimes tests and restricts execution of its org-agenda functions.

Temporary work-around for users until this is solved would be advising org-agenda-kill with :around advice and overriding value of major-mode - which is not pretty.

  (advice-add #'org-agenda-kill :around (lambda (orig-fun &rest args)
                                          (let ((major-mode 'org-agenda-mode))
                                            (apply orig-fun args))))

after searching org-agenda.el, more commands are using this equality test:

  • org-agenda-capture
  • org-agenda-archive-with
  • org-agenda-kill-all-agenda-buffers (but this fn is probably not relevant to org-ql)
  • org-agenda-save-markers-for-cut-and-paste (also not sure if relevant)
@alphapapa
Copy link
Owner

Hi Alois,

Thanks for catching this.

I wasn't aware of the org-agenda-kill command. I'm surprised that it even exists, because it sounds somewhat dangerous, to kill an entry remotely while in an Agenda buffer. I guess it isn't bound by default?

Anyway, as you noticed, other commands are broken by this as well. I guess I should revert the change that added the derived mode, at least for 0.4, because I didn't intend to break those commands. Instead, I can do another kind of check in the org-ql-view-refresh command.

In the long term, the org-ql-view buffers will probably have their own mode (I intend it to be based on magit-section, similar to Bufler), and remote-editing commands like these will need to be either reimplemented or wrapped by org-ql-view.

I'll push a fix for this in a little while. Thanks.

@alphapapa
Copy link
Owner

I think that should do it. Please let me know if that fixes it for you. Thanks.

@AloisJanicek
Copy link
Author

Works well now, you fixed it, thanks for your quick response.

When it comes to destructive remote editing from agenda buffers, I use org-agenda-kill a lot in my inbox search. I have a habit of capturing almost anything which comes up to my mind and sometimes those things are so low quality that it is best to delete them :-) and the most easier way to do it is to press d d (or default C-k if I was not using evil-collection)

As for your long term plans with org-ql-view and its architecture I am entirely trusting your instincts and expertise on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants