Fix/Revert: Don't derive a new mode; check a variable in refresh

Using a different major mode in org-ql-view buffers causes some Org Agenda
remote commands to not work, because they test whether the major mode
is org-agenda-mode.  Even though these remote commands are not
guaranteed to work, it was not intended to break them now, so this
restores compatibility with them.

Fixes #102.  Thanks to Alois Janíček (@aloisjanicek) for reporting.

This reverts commit ba7d4a2e82.

Released as 0.4.4.
This commit is contained in:
Adam Porter 2020-03-15 14:58:06 -05:00
parent ba7d4a2e82
commit 4fef5b089f
4 changed files with 80 additions and 62 deletions

View file

@ -309,7 +309,7 @@ TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or
If PROMPT is non-nil (interactively, with prefix), prompt to
update search arguments."
(interactive "P")
(unless (eq major-mode 'org-ql-view-mode)
(unless org-ql-view-buffers-files
(user-error "Not an Org QL View buffer"))
(let* ((current-line (buffer-substring-no-properties (line-beginning-position) (line-end-position)))
(old-pos (point))
@ -356,10 +356,6 @@ update search arguments."
;;;; Functions
(define-derived-mode org-ql-view-mode org-agenda-mode "Org QL View"
"Major mode for `org-ql-view' buffers."
(setf buffer-read-only t))
(defun org-ql-view--list-buffer ()
"Return view list buffer."
(with-current-buffer (get-buffer-create "*Org QL View List*")
@ -474,8 +470,9 @@ with human-readable strings."
If NAME is non-nil, return buffer by that name instead of using
default buffer."
(with-current-buffer (get-buffer-create (or name (concat org-ql-view-buffer-name-prefix "*")))
(unless (eq major-mode 'org-ql-view-mode)
(org-ql-view-mode))
(unless (eq major-mode 'org-agenda-mode)
(org-agenda-mode)
(setf buffer-read-only t))
(current-buffer)))
(defun org-ql-view--format-relative-date (difference)