Give argument of `db/org-get-location` a more descriptive name

It's not a universal arguments, so calling it ARG is not only just
non-informative, but also misleading.
This commit is contained in:
Daniel - 2023-07-29 19:50:12 +02:00
parent 42af8216e0
commit c0660fe0f6
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 27 additions and 26 deletions

View File

@ -1404,20 +1404,21 @@ not."
(t (user-error "Neither ID nor CUSTOM_ID given"))))) (t (user-error "Neither ID nor CUSTOM_ID given")))))
(org-search-view nil query))) (org-search-view nil query)))
(defun db/org-get-location (&optional arg) (defun db/org-get-location (&optional use-all-org-files)
"Interactively query for location and return mark. "Interactively query for location and return mark.
When ARG is nil, this functions by default searches through the When USE-ALL-ORG-FILES is nil, this functions by default searches
current buffer if that one is an Org buffer and is associated through the current buffer if that one is an Org buffer and is
with a file, and `db/org-default-org-file' otherwise. If the associated with a file, and `db/org-default-org-file' otherwise.
current buffer is associated with a file from the variable If the current buffer is associated with a file from the variable
`org-agenda-files', though, the search is extended through all `org-agenda-files', though, the search is extended through all
agenda files (the rationale being that Org agenda files are agenda files (the rationale being that Org agenda files are
always considered to be one large data collection). always considered to be one large data collection).
When ARG is non-nil, search through all files in the variables When USE-ALL-ORG-FILES is non-nil, search through all files in
`org-agenda-files', `org-agenda-text-search-extra-files', and the the variables `org-agenda-files',
current file or `db/org-default-org-file' as described above. `org-agenda-text-search-extra-files', and the current file or
`db/org-default-org-file' as described above.
Search is always conducted up to level 9. If the selected Search is always conducted up to level 9. If the selected
location does not have an associated point or mark, error out. location does not have an associated point or mark, error out.
@ -1445,33 +1446,33 @@ linking to any item."
'((org-agenda-files :maxlevel . 9)) '((org-agenda-files :maxlevel . 9))
'((nil :maxlevel . 9))) '((nil :maxlevel . 9)))
;; When ARG is non-nil, add all agenda ;; When USE-ALL-ORG-FILES is non-nil, add
;; files, but only if not already done ;; all agenda files, but only if not
;; so. ;; already done so.
(and arg (and use-all-org-files
(not current-buffer-is-in-org-agenda-files?) (not current-buffer-is-in-org-agenda-files?)
'((org-agenda-files :maxlevel . 9))) '((org-agenda-files :maxlevel . 9)))
;; When ARG is non-nil, add extra file ;; When USE-ALL-ORG-FILES is non-nil, add
;; files to search though. ;; extra file files to search though.
(and arg (and use-all-org-files
`((,(cl-remove-if-not #'stringp `((,(cl-remove-if-not #'stringp
org-agenda-text-search-extra-files) org-agenda-text-search-extra-files)
:maxlevel . 9))))) :maxlevel . 9)))))
(target-pointer (org-refile-get-location nil default-buffer)) (target-pointer (org-refile-get-location nil default-buffer))
(pom (nth 3 target-pointer))) (pom (nth 3 target-pointer)))
(cond (cond
((markerp pom) pom) ((markerp pom) pom)
((integerp pom) ((integerp pom)
;; Convert point to marker to ensure we are always in the correct ;; Convert point to marker to ensure we are always in the correct
;; buffer; the second element of `target-pointer' contains the path to ;; buffer; the second element of `target-pointer' contains the path to
;; the target file ;; the target file
(save-mark-and-excursion (save-mark-and-excursion
(with-current-buffer (find-file-noselect (nth 1 target-pointer)) (with-current-buffer (find-file-noselect (nth 1 target-pointer))
(goto-char pom) (goto-char pom)
(point-marker)))) (point-marker))))
(t (user-error "Invalid location")))))) (t (user-error "Invalid location"))))))
(defun db/org-find-links-to-current-item (arg) (defun db/org-find-links-to-current-item (arg)
"Find links to current item. "Find links to current item.