Skip to content

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

@AloisJanicek

Description

@AloisJanicek

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions