org-capture-set-target-location: Fix `pcase' conditions
* lisp/org-capture.el (org-capture-set-target-location): Do not demand
file path to be a string in capture targets. Other non-string values
are also allowed and checked in `org-capture-expand-file' that is
called later.
This commit fixes the changes introduced in 0a58a53ed
.
Reported-by: Derek Chen-Becker <derek@chen-becker.org>
Link: https://orgmode.org/list/CAMbmz5nnXY1V1cPObfdw9wyM_GbiuYQ5_rksJ6gcO3Af+HOmSQ@mail.gmail.com
This commit is contained in:
parent
67d9372487
commit
24ce9abce7
|
@ -995,7 +995,7 @@ Store them in the capture property list."
|
|||
((or `here
|
||||
`(here))
|
||||
(org-capture-put :exact-position (point) :insert-here t))
|
||||
(`(file ,(and path (pred stringp)))
|
||||
(`(file ,path)
|
||||
(set-buffer (org-capture-target-buffer path))
|
||||
(org-capture-put-target-region-and-position)
|
||||
(widen)
|
||||
|
@ -1008,7 +1008,7 @@ Store them in the capture property list."
|
|||
(org-capture-put-target-region-and-position)
|
||||
(goto-char position))
|
||||
(_ (error "Cannot find target ID \"%s\"" id))))
|
||||
(`(file+headline ,(and path (pred stringp)) ,(and headline (pred stringp)))
|
||||
(`(file+headline ,path ,(and headline (pred stringp)))
|
||||
(set-buffer (org-capture-target-buffer path))
|
||||
;; Org expects the target file to be in Org mode, otherwise
|
||||
;; it throws an error. However, the default notes files
|
||||
|
@ -1030,7 +1030,7 @@ Store them in the capture property list."
|
|||
(unless (bolp) (insert "\n"))
|
||||
(insert "* " headline "\n")
|
||||
(forward-line -1)))
|
||||
(`(file+olp ,(and path (pred stringp)) . ,(and outline-path (guard outline-path)))
|
||||
(`(file+olp ,path . ,(and outline-path (guard outline-path)))
|
||||
(let ((m (org-find-olp (cons (org-capture-expand-file path)
|
||||
outline-path))))
|
||||
(set-buffer (marker-buffer m))
|
||||
|
@ -1038,7 +1038,7 @@ Store them in the capture property list."
|
|||
(widen)
|
||||
(goto-char m)
|
||||
(set-marker m nil)))
|
||||
(`(file+regexp ,(and path (pred stringp)) ,(and regexp (pred stringp)))
|
||||
(`(file+regexp ,path ,(and regexp (pred stringp)))
|
||||
(set-buffer (org-capture-target-buffer path))
|
||||
(org-capture-put-target-region-and-position)
|
||||
(widen)
|
||||
|
@ -1051,7 +1051,7 @@ Store them in the capture property list."
|
|||
(org-capture-put :exact-position (point))
|
||||
(setq target-entry-p
|
||||
(and (derived-mode-p 'org-mode) (org-at-heading-p)))))
|
||||
(`(file+olp+datetree ,(and path (pred stringp)) . ,outline-path)
|
||||
(`(file+olp+datetree ,path . ,outline-path)
|
||||
(let ((m (if outline-path
|
||||
(org-find-olp (cons (org-capture-expand-file path)
|
||||
outline-path))
|
||||
|
@ -1106,7 +1106,7 @@ Store them in the capture property list."
|
|||
;; the following is the keep-restriction argument for
|
||||
;; org-datetree-find-date-create
|
||||
(when outline-path 'subtree-at-point))))
|
||||
(`(file+function ,(and path (pred stringp)) ,(and function (pred functionp)))
|
||||
(`(file+function ,path ,(and function (pred functionp)))
|
||||
(set-buffer (org-capture-target-buffer path))
|
||||
(org-capture-put-target-region-and-position)
|
||||
(widen)
|
||||
|
|
Loading…
Reference in New Issue