From 5baa0d63dc06ad6140110c4c857850c3fe053390 Mon Sep 17 00:00:00 2001 From: Bala Ramadurai Date: Tue, 26 Jan 2021 09:25:04 +0530 Subject: [PATCH] Changed link and description of the dblock Further to this reply - https://github.com/alphapapa/org-ql/pull/184#issuecomment-766868004, I used the buffer name from org-marker element. --- org-ql-search.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/org-ql-search.el b/org-ql-search.el index 6662dd2..b39c92c 100644 --- a/org-ql-search.el +++ b/org-ql-search.el @@ -289,9 +289,19 @@ For example, an org-ql dynamic block header could look like: (list (cons 'todo (lambda (element) (org-element-property :todo-keyword element))) (cons 'heading (lambda (element) - (org-make-link-string (org-element-property :raw-value element) - (org-link-display-format - (org-element-property :raw-value element))))) + (org-link-make-string + (format "file:%s::%s" + (marker-buffer (org-element-property :org-marker element)) + (org-element-property :raw-value element)) + ;; Prune statistics cookies. Replace + ;; links with their description, or + ;; a plain link if there is none. + (org-trim + (org-link-display-format + (replace-regexp-in-string + "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" "" + (org-element-property :raw-value element))))) + )) (cons 'priority (lambda (element) (--when-let (org-element-property :priority element) (char-to-string it)))) @@ -305,7 +315,7 @@ For example, an org-ql dynamic block header could look like: (org-element-property (intern (concat ":" (upcase property))) element))))) (elements (org-ql-query :from file :where query - :select '(org-element-headline-parser (line-end-position)) + :select 'element-with-markers :order-by sort))) (when take (setf elements (cl-etypecase take @@ -334,6 +344,7 @@ For example, an org-ql dynamic block header could look like: (insert "| " (format-element element) " |" "\n")) (delete-char -1) (org-table-align)))) + ;;;; Functions (cl-defun org-ql-search-directories-files