Add: (org-ql-agenda--header-line-format) Move code to new function
This commit is contained in:
parent
b5ccc3294e
commit
cc5756d00d
1 changed files with 21 additions and 17 deletions
|
|
@ -230,8 +230,18 @@ SORT: One or a list of `org-ql' sorting functions, like `date' or
|
||||||
(setq-local org-ql-sort sort)
|
(setq-local org-ql-sort sort)
|
||||||
(setq-local org-ql-narrow narrow)
|
(setq-local org-ql-narrow narrow)
|
||||||
(setq-local org-ql-super-groups super-groups)
|
(setq-local org-ql-super-groups super-groups)
|
||||||
|
(setq-local header-line-format (org-ql-agenda--header-line-format buffers-files query))
|
||||||
;; TODO: Derive a minor mode and set keymap there.
|
;; TODO: Derive a minor mode and set keymap there.
|
||||||
(local-set-key "g" #'org-ql-search-refresh)
|
(local-set-key "g" #'org-ql-search-refresh)
|
||||||
|
;; Clear buffer, insert entries, etc.
|
||||||
|
(erase-buffer)
|
||||||
|
(insert entries)
|
||||||
|
(pop-to-buffer (current-buffer))
|
||||||
|
(org-agenda-finalize)
|
||||||
|
(goto-char (point-min)))))
|
||||||
|
|
||||||
|
(defun org-ql-agenda--header-line-format (buffers-files query)
|
||||||
|
"Return header-line-format for BUFFERS-FILES and QUERY."
|
||||||
(let* ((query-formatted (format "%S" query))
|
(let* ((query-formatted (format "%S" query))
|
||||||
(query-formatted (propertize (org-ql-agenda--font-lock-string 'emacs-lisp-mode query-formatted)
|
(query-formatted (propertize (org-ql-agenda--font-lock-string 'emacs-lisp-mode query-formatted)
|
||||||
'help-echo query-formatted))
|
'help-echo query-formatted))
|
||||||
|
|
@ -245,16 +255,10 @@ SORT: One or a list of `org-ql' sorting functions, like `date' or
|
||||||
(org-ql-agenda--font-lock-string 'emacs-lisp-mode)
|
(org-ql-agenda--font-lock-string 'emacs-lisp-mode)
|
||||||
(s-truncate available-width))
|
(s-truncate available-width))
|
||||||
'help-echo buffers-files-formatted)))
|
'help-echo buffers-files-formatted)))
|
||||||
(setq-local header-line-format (concat (propertize "Query: " 'face 'org-agenda-structure)
|
(concat (propertize "Query: " 'face 'org-agenda-structure)
|
||||||
query-formatted " "
|
query-formatted " "
|
||||||
(propertize "In: " 'face 'org-agenda-structure)
|
(propertize "In: " 'face 'org-agenda-structure)
|
||||||
buffers-files-formatted)))
|
buffers-files-formatted)))
|
||||||
;; Clear buffer, insert entries, etc.
|
|
||||||
(erase-buffer)
|
|
||||||
(insert entries)
|
|
||||||
(pop-to-buffer (current-buffer))
|
|
||||||
(org-agenda-finalize)
|
|
||||||
(goto-char (point-min)))))
|
|
||||||
|
|
||||||
(defun org-ql-agenda--font-lock-string (mode s)
|
(defun org-ql-agenda--font-lock-string (mode s)
|
||||||
"Return string S font-locked according to MODE."
|
"Return string S font-locked according to MODE."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue