Add: org-ql-view-map

This commit is contained in:
Adam Porter 2019-08-16 12:29:20 -05:00
parent 429c313634
commit ae3ec62e3c
2 changed files with 12 additions and 4 deletions

View file

@ -155,7 +155,8 @@ Read ~QUERY~ and search with ~org-ql~. Interactively, prompt for these variable
~SORT~: One or a list of ~org-ql~ sorting functions, like ~date~ or ~priority~. ~SORT~: One or a list of ~org-ql~ sorting functions, like ~date~ or ~priority~.
Press =g= to refresh the results buffer. *Bindings:*
+ =g=: Refresh results.
[[images/org-ql-search.gif]] [[images/org-ql-search.gif]]
@ -426,6 +427,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
+ Function ~org-ql-search~ and macro ~org-ql-agenda~ accept a ~:title~ argument, which is displayed in the header. + Function ~org-ql-search~ and macro ~org-ql-agenda~ accept a ~:title~ argument, which is displayed in the header.
+ Command ~org-ql-search~ offers global ~org-super-agenda-groups~ in completion. + Command ~org-ql-search~ offers global ~org-super-agenda-groups~ in completion.
+ Customization group ~org-ql~. + Customization group ~org-ql~.
+ Variable ~org-ql-view-map~, active in view buffers displayed by ~org-ql-search~, ~org-ql-agenda~, and ~org-ql-view~.
*Changed* *Changed*
+ Function ~org-ql-query~ renamed to ~org-ql-select~. ~org-ql-query~ now refers to a new function. + Function ~org-ql-query~ renamed to ~org-ql-select~. ~org-ql-query~ now refers to a new function.

View file

@ -60,6 +60,14 @@
(defvar org-ql-agenda-buffer-name "*Org-QL-Agenda*" (defvar org-ql-agenda-buffer-name "*Org-QL-Agenda*"
"Name of default `org-ql-agenda' buffer.") "Name of default `org-ql-agenda' buffer.")
(defvar org-ql-view-map
(let ((map (copy-keymap org-agenda-mode-map)))
(define-key map "g" #'org-ql-search-refresh)
(define-key map (kbd "C-x C-s") #'org-ql-search-save)
map)
"Keymap for `org-ql-agenda', `org-ql-search', and `org-ql-views' views.
Based on `org-agenda-mode-map'.")
;; For refreshing results buffers. ;; For refreshing results buffers.
(defvar org-ql-buffers-files) (defvar org-ql-buffers-files)
(defvar org-ql-query) (defvar org-ql-query)
@ -240,11 +248,9 @@ TITLE: An optional string displayed in the header."
(string (org-ql-agenda--buffer buffer)) (string (org-ql-agenda--buffer buffer))
(null (org-ql-agenda--buffer buffer)) (null (org-ql-agenda--buffer buffer))
(buffer buffer))) (buffer buffer)))
(map (copy-keymap org-agenda-mode-map))
(inhibit-read-only t)) (inhibit-read-only t))
(define-key map "g" #'org-ql-search-refresh)
(with-current-buffer buffer (with-current-buffer buffer
(use-local-map map) (use-local-map org-ql-view-map)
;; Prepare buffer, saving data for refreshing. ;; Prepare buffer, saving data for refreshing.
(setq-local org-ql-buffers-files buffers-files) (setq-local org-ql-buffers-files buffers-files)
(setq-local org-ql-query query) (setq-local org-ql-query query)