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))
|
:sort sort))
|
||||||
(strings (-map #'org-ql-view--format-element results))
|
(strings (-map #'org-ql-view--format-element results))
|
||||||
(buffer (or buffer (format "%s %s*" org-ql-view-buffer-name-prefix (or title query))))
|
(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.
|
;; Bind variables for `org-ql-view--display' to set.
|
||||||
(org-ql-view-buffers-files buffers-files)
|
(org-ql-view-buffers-files buffers-files)
|
||||||
(org-ql-view-query query)
|
(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
|
;; 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.
|
;; 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)))
|
;; (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")
|
nil 'face 'org-agenda-structure) "\n")
|
||||||
;; Calling `org-agenda-finalize' should be unnecessary, because in a "series" agenda,
|
;; 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.
|
;; `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)
|
(org-agenda-finalize)
|
||||||
(goto-char (point-min))))))
|
(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.
|
"Return `header-line-format' for BUFFERS-FILES and QUERY.
|
||||||
If TITLE, prepend it to the header."
|
If TITLE, prepend it to the header."
|
||||||
(let* ((title (if title
|
(let* ((title (if title
|
||||||
(concat (propertize "View:" 'face 'transient-argument)
|
(concat (propertize "View:" 'face 'transient-argument)
|
||||||
title " ")
|
title " ")
|
||||||
""))
|
""))
|
||||||
(query-formatted (org-ql-view--format-query query))
|
(query-formatted (when query
|
||||||
(query-width (length query-formatted))
|
(org-ql-view--format-query query)))
|
||||||
(query-propertized (propertize (org-ql-view--font-lock-string 'emacs-lisp-mode query-formatted)
|
(query-width (when query-formatted
|
||||||
'help-echo query-formatted))
|
(length query-formatted)))
|
||||||
(available-width (max 0 (- (window-width)
|
(query-propertized (when query-formatted
|
||||||
(length "In: ")
|
(propertize (org-ql-view--font-lock-string 'emacs-lisp-mode query-formatted)
|
||||||
(length "Query: ")
|
'help-echo query-formatted)))
|
||||||
query-width 4)))
|
(available-width (max 0 (- (window-width) (length "In: ")
|
||||||
(buffers-files-formatted (format "%s" (org-ql-view--contract-buffers-files buffers-files)))
|
(length "Query: ") (or query-width 0)
|
||||||
(buffers-files-formatted (propertize (->> buffers-files-formatted
|
4)))
|
||||||
(org-ql-view--font-lock-string 'emacs-lisp-mode)
|
(buffers-files-formatted (when buffers-files
|
||||||
(s-truncate available-width))
|
(format "%s" (org-ql-view--contract-buffers-files buffers-files))))
|
||||||
'help-echo buffers-files-formatted)))
|
(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))))
|
||||||
(concat title
|
(concat title
|
||||||
(propertize "Query:" 'face 'transient-argument)
|
(when query (propertize "Query:" 'face 'transient-argument))
|
||||||
query-propertized " "
|
(when query query-propertized)
|
||||||
(propertize "In:" 'face 'transient-argument)
|
(when query " ")
|
||||||
buffers-files-formatted)))
|
(when buffers-files
|
||||||
|
(propertize "In:" 'face 'transient-argument))
|
||||||
|
(when buffers-files-formatted
|
||||||
|
buffers-files-formatted))))
|
||||||
|
|
||||||
(defun org-ql-view--format-query (query)
|
(defun org-ql-view--format-query (query)
|
||||||
"Return QUERY formatted as a string.
|
"Return QUERY formatted as a string.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue