Change: (org-ql-view--header-line-format) Use keyword args
This commit is contained in:
parent
f7d8b8c78c
commit
1688774ddd
2 changed files with 29 additions and 20 deletions
|
|
@ -164,7 +164,8 @@ necessary."
|
|||
:sort sort))
|
||||
(strings (-map #'org-ql-view--format-element results))
|
||||
(buffer (or buffer (format "%s %s*" org-ql-view-buffer-name-prefix (or title query))))
|
||||
(header (org-ql-view--header-line-format buffers-files query title))
|
||||
(header (org-ql-view--header-line-format
|
||||
:buffers-files buffers-files :query query :title title))
|
||||
;; Bind variables for `org-ql-view--display' to set.
|
||||
(org-ql-view-buffers-files buffers-files)
|
||||
(org-ql-view-query query)
|
||||
|
|
@ -215,7 +216,8 @@ automatically from the query."
|
|||
;; FIXME: `org-agenda--insert-overriding-header' is from an Org version newer than
|
||||
;; I'm using. Should probably declare it as a minimum Org version after upgrading.
|
||||
;; (org-agenda--insert-overriding-header (or org-ql-block-header (org-ql-agenda--header-line-format from query)))
|
||||
(insert (org-add-props (or org-ql-block-header (org-ql-view--header-line-format from query))
|
||||
(insert (org-add-props (or org-ql-block-header (org-ql-view--header-line-format
|
||||
:buffers-files from :query query))
|
||||
nil 'face 'org-agenda-structure) "\n")
|
||||
;; Calling `org-agenda-finalize' should be unnecessary, because in a "series" agenda,
|
||||
;; `org-agenda-multi' is bound non-nil, in which case `org-agenda-finalize' does nothing.
|
||||
|
|
|
|||
|
|
@ -433,31 +433,38 @@ subsequent refreshing of the buffer: `org-ql-view-buffers-files',
|
|||
(org-agenda-finalize)
|
||||
(goto-char (point-min))))))
|
||||
|
||||
(defun org-ql-view--header-line-format (buffers-files query &optional title)
|
||||
(cl-defun org-ql-view--header-line-format (&key buffers-files query title)
|
||||
"Return `header-line-format' for BUFFERS-FILES and QUERY.
|
||||
If TITLE, prepend it to the header."
|
||||
(let* ((title (if title
|
||||
(concat (propertize "View:" 'face 'transient-argument)
|
||||
title " ")
|
||||
""))
|
||||
(query-formatted (org-ql-view--format-query query))
|
||||
(query-width (length query-formatted))
|
||||
(query-propertized (propertize (org-ql-view--font-lock-string 'emacs-lisp-mode query-formatted)
|
||||
'help-echo query-formatted))
|
||||
(available-width (max 0 (- (window-width)
|
||||
(length "In: ")
|
||||
(length "Query: ")
|
||||
query-width 4)))
|
||||
(buffers-files-formatted (format "%s" (org-ql-view--contract-buffers-files buffers-files)))
|
||||
(buffers-files-formatted (propertize (->> buffers-files-formatted
|
||||
(query-formatted (when query
|
||||
(org-ql-view--format-query query)))
|
||||
(query-width (when query-formatted
|
||||
(length query-formatted)))
|
||||
(query-propertized (when query-formatted
|
||||
(propertize (org-ql-view--font-lock-string 'emacs-lisp-mode query-formatted)
|
||||
'help-echo query-formatted)))
|
||||
(available-width (max 0 (- (window-width) (length "In: ")
|
||||
(length "Query: ") (or query-width 0)
|
||||
4)))
|
||||
(buffers-files-formatted (when buffers-files
|
||||
(format "%s" (org-ql-view--contract-buffers-files buffers-files))))
|
||||
(buffers-files-formatted (when buffers-files-formatted
|
||||
(propertize (->> buffers-files-formatted
|
||||
(org-ql-view--font-lock-string 'emacs-lisp-mode)
|
||||
(s-truncate available-width))
|
||||
'help-echo buffers-files-formatted)))
|
||||
'help-echo buffers-files-formatted))))
|
||||
(concat title
|
||||
(propertize "Query:" 'face 'transient-argument)
|
||||
query-propertized " "
|
||||
(propertize "In:" 'face 'transient-argument)
|
||||
buffers-files-formatted)))
|
||||
(when query (propertize "Query:" 'face 'transient-argument))
|
||||
(when query query-propertized)
|
||||
(when query " ")
|
||||
(when buffers-files
|
||||
(propertize "In:" 'face 'transient-argument))
|
||||
(when buffers-files-formatted
|
||||
buffers-files-formatted))))
|
||||
|
||||
(defun org-ql-view--format-query (query)
|
||||
"Return QUERY formatted as a string.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue