From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gregor Zattler Subject: Re: Bug: master: "Capture abort: (error Format specifier Date: Sun, 08 Apr 2018 15:22:58 +0200 Message-ID: <87a7udj0i5.fsf@len.workgroup> References: <87zi2esqri.fsf@len.workgroup> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5AI2-0003Cs-Lb for emacs-orgmode@gnu.org; Sun, 08 Apr 2018 09:23:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5AHw-0004ht-MP for emacs-orgmode@gnu.org; Sun, 08 Apr 2018 09:23:26 -0400 Received: from mout.gmx.net ([212.227.17.21]:38675) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5AHv-0004fI-UN for emacs-orgmode@gnu.org; Sun, 08 Apr 2018 09:23:20 -0400 Received: from len.workgroup ([79.228.1.75]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Lz3JU-1eRn3m1fcW-014Cjs for ; Sun, 08 Apr 2018 15:23:18 +0200 In-Reply-To: <87zi2esqri.fsf@len.workgroup> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode Hi Nicolas, * Gregor Zattler [2018-04-07; 22:30]: > * Nicolas Goaziou [2018-04-03; 22:05]: >> There is no such thing as a "%I" placeholder. Do you mean "%I"? > > Yes, I mean %i, the capital %I in this quote is --as I realize > now, while typing this email-- an abbrev artefact.[1] I assume I > pasted from the X11 selection and the abbrev capitalized it. > > In my customizations file all templates have %I. Sorry for this arrgs: In my customizations file all templates have %i ^ > very special noise: this capital I in my email > does not explain the capture > errors I experience with recent git master, since they are not > part of my templates. OK, it was a typo in emails, not in the configuration. I investigated further. Long story short: My org-structure-template-alist interfered with capturing. I deleted this customisation and capturing works again with org from git master. With this minimal .emacs: (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(org-capture-templates (quote (("t" "test" entry (file+olp "~/.notes.org" "test") "* %? %^{}G %i %^{wann f=C3=A4llig?}T %a: notiert am/um: %U"))))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) I was *not* able to trigger the error with org-mode as of git master. Therefore the problem has to do with other parts of my customization.=20 Then I turned on debug-on-error and produced a backtrace (see below). This is way above my elisp skills, but I realize something about org-tempo on top of the backtrace. I have this module enabled in my customization. Therefore I disabled it in org-modules and tested again. Tada! disabling org-tempo "fixes" the error. I the enhanced my minimal .emacs and enabled org-tempo: (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(org-capture-templates (quote (("t" "test" entry (file+olp "~/.notes.org" "test") "* %? %^{}G %i %^{wann f=C3=A4llig?}T %a: notiert am/um: %U")))) '(org-modules (quote (org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-= rmail org-tempo org-w3m)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) But I was not able to produce the error with org-tempo enabled. Digging further I discovered org-structure-template-alist which was configured: '(org-structure-template-alist (quote (("s" "#+BEGIN_SRC ? #+END_SRC") ("E" "#+begin_src emacs-lisp ? #+end_src") ("e" "#+BEGIN_EXAMPLE ? #+END_EXAMPLE") ("q" "#+BEGIN_QUOTE ? #+END_QUOTE") ("v" "#+BEGIN_VERSE ? #+END_VERSE") ("V" "#+BEGIN_VERBATIM ? #+END_VERBATIM") ("c" "#+BEGIN_CENTER ? #+END_CENTER") ("l" "#+BEGIN_EXPORT latex ? #+END_EXPORT") ("L" "#+LaTeX: ") ("h" "#+BEGIN_EXPORT html ? #+END_EXPORT") ("H" "#+HTML: ") ("a" "#+BEGIN_EXPORT ascii ? #+END_EXPORT") ("A" "#+ASCII: ") ("i" "#+INDEX: ?") ("I" "#+INCLUDE: %file ?") ("u" "(use-package ? ;; :ensure nil ;; :commands ;; :bind ;; :init ;; :config )")))) I erased this customization and bingo: capturing works again. Somehow tempo templates interfere with org capture. Some day I will customize org-structure-template-alist again, since templates for use-package and emacs lisp src blocks come in handy. Have a nice day, Gregor Debugger entered--Lisp error: (error "Format specifier doesn=E2=80=99t matc= h argument type") format("<%c" "s") (closure (t) (pair) (format "<%c" (car pair)))(("s" "#+BEGIN_SRC ?\n\n#+E= ND_SRC")) mapcar((closure (t) (pair) (format "<%c" (car pair))) (("s" "#+BEGIN_SRC = ?\n\n#+END_SRC") ("E" "#+begin_src emacs-lisp ?\n\n#+end_src") ("e" "#+BEGI= N_EXAMPLE\n?\n#+END_EXAMPLE") ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE") ("v" "#= +BEGIN_VERSE\n?\n#+END_VERSE") ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM") = ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER") ("l" "#+BEGIN_EXPORT latex\n?\n#+EN= D_EXPORT") ("L" "#+LaTeX: ") ("h" "#+BEGIN_EXPORT html\n?\n#+END_EXPORT") (= "H" "#+HTML: ") ("a" "#+BEGIN_EXPORT ascii\n?\n#+END_EXPORT") ("A" "#+ASCII= : ") ("i" "#+INDEX: ?") ("I" "#+INCLUDE: %file ?") ("u" "(use-package ?\n;;= :ensure nil\n;; :commands\n;; :bind\n;; :init\n;; :config\n)") (76 . "late= x") (72 . "html") (65 . "ascii") (105 . "index"))) (let ((keys (mapcar (function (lambda (pair) (format "<%c" (car pair)))) = (append org-structure-template-alist org-tempo-keywords-alist)))) (if (> (l= ength keys) (length (delete-dups keys))) (progn (warn "Duplicated keys in `= org-structure-template-alist' and `org-tempo-keywords-alist'"))) (setq org-= tempo-tags (cl-remove-if (function (lambda (tag) (member (car tag) keys))) = org-tempo-tags)) (mapc (function org-tempo-add-block) org-structure-templat= e-alist) (mapc (function org-tempo-add-keyword) org-tempo-keywords-alist)) org-tempo-add-templates() org-tempo-setup() run-hooks(change-major-mode-after-body-hook text-mode-hook outline-mode-h= ook org-mode-hook) apply(run-hooks (change-major-mode-after-body-hook text-mode-hook outline= -mode-hook org-mode-hook)) run-mode-hooks(org-mode-hook) org-mode() set-auto-mode-0(org-mode nil) set-auto-mode() normal-mode(t) after-find-file(nil t) find-file-noselect-1(# "~/org/grfz.org" nil nil "~/org/g= rfz.org" (4197982 64770)) find-file-noselect("/home/grfz/org/grfz.org") (if this-buffer (current-buffer) (find-file-noselect file)) (let* ((file (if this-buffer buffer-file-name (car-safe (prog1 path (setq= path (cdr path)))))) (buffer (if this-buffer (current-buffer) (find-file-n= oselect file))) (level 1) (lmin 1) (lmax 1) end found flevel) (if buffer ni= l (error "File not found :%s" file)) (save-current-buffer (set-buffer buffe= r) (if (derived-mode-p 'org-mode) nil (error "Buffer %s needs to be in Org = mode" buffer)) (save-excursion (save-restriction (widen) (goto-char (point-= min)) (let ((--dolist-tail-- path)) (while --dolist-tail-- (let ((heading (= car --dolist-tail--))) (let ((re (format org-complex-heading-regexp-format = (regexp-quote heading))) (cnt 0)) (while (re-search-forward re end t) (setq= level (- (match-end 1) (match-beginning 1))) (if (and (>=3D level lmin) (<= =3D level lmax)) (progn (setq found (match-beginning 0) flevel level cnt (1= + cnt))))) (if (=3D cnt 0) (progn (error "Heading not found on level %d: %s= " lmax heading))) (if (> cnt 1) (progn (error "Heading not unique on level = %d: %s" lmax heading))) (goto-char found) (setq lmin (1+ flevel) lmax (+ lm= in (if org-odd-levels-only 1 0))) (setq end (save-excursion (org-end-of-sub= tree t t)))) (setq --dolist-tail-- (cdr --dolist-tail--))))) (if (org-at-he= ading-p) (progn (point-marker))))))) org-find-olp(("/home/grfz/org/grfz.org" "Computer")) (let ((m (org-find-olp (cons (org-capture-expand-file path) outline-path)= ))) (set-buffer (marker-buffer m)) (org-capture-put-target-region-and-posit= ion) (widen) (goto-char m) (set-marker m nil)) (let ((outline-path x259) (path x258)) (let ((m (org-find-olp (cons (org-= capture-expand-file path) outline-path)))) (set-buffer (marker-buffer m)) (= org-capture-put-target-region-and-position) (widen) (goto-char m) (set-mark= er m nil))) (let* ((x258 (car x257)) (x259 (cdr x257))) (let ((outline-path x259) (pa= th x258)) (let ((m (org-find-olp (cons (org-capture-expand-file path) outli= ne-path)))) (set-buffer (marker-buffer m)) (org-capture-put-target-region-a= nd-position) (widen) (goto-char m) (set-marker m nil)))) (if (consp x257) (let* ((x258 (car x257)) (x259 (cdr x257))) (let ((outli= ne-path x259) (path x258)) (let ((m (org-find-olp (cons (org-capture-expand= -file path) outline-path)))) (set-buffer (marker-buffer m)) (org-capture-pu= t-target-region-and-position) (widen) (goto-char m) (set-marker m nil)))) (= let ((target val)) (error "Invalid capture target specification: %S" target= ))) (let* ((x257 (cdr val))) (if (consp x257) (let* ((x258 (car x257)) (x259 = (cdr x257))) (let ((outline-path x259) (path x258)) (let ((m (org-find-olp = (cons (org-capture-expand-file path) outline-path)))) (set-buffer (marker-b= uffer m)) (org-capture-put-target-region-and-position) (widen) (goto-char m= ) (set-marker m nil)))) (let ((target val)) (error "Invalid capture target = specification: %S" target)))) (cond ((eq x245 'file) (let* ((x246 (cdr val))) (if (consp x246) (let* ((= x247 (car x246)) (x248 (cdr x246))) (if (null x248) (let ((path x247)) (set= -buffer (org-capture-target-buffer path)) (org-capture-put-target-region-an= d-position) (widen) (setq target-entry-p nil)) (let ((target val)) (error "= Invalid capture target specification: %S" target)))) (let ((target val)) (e= rror "Invalid capture target specification: %S" target))))) ((eq x245 'id) = (let* ((x249 (cdr val))) (if (consp x249) (let* ((x250 (car x249)) (x251 (c= dr x249))) (if (null x251) (let ((id x250)) (let* ((val (org-id-find id))) = (if (consp val) (let* ((x277 (car val)) (x278 (cdr val))) (let ((position x= 278) (path x277)) (set-buffer (org-capture-target-buffer path)) (widen) (or= g-capture-put-target-region-and-position) (goto-char position))) (error "Ca= nnot find target ID \"%s\"" id)))) (let ((target val)) (error "Invalid capt= ure target specification: %S" target)))) (let ((target val)) (error "Invali= d capture target specification: %S" target))))) ((eq x245 'file+headline) (= let* ((x252 (cdr val))) (if (consp x252) (let* ((x253 (car x252)) (x254 (cd= r x252))) (if (consp x254) (let* ((x255 (car x254)) (x256 (cdr x254))) (if = (null x256) (let ((headline x255) (path x253)) (set-buffer (org-capture-tar= get-buffer path)) (if (derived-mode-p 'org-mode) nil (org-display-warning (= format "Capture requirement: switching buffer %S to Org mode" (current-buff= er))) (org-mode)) (org-capture-put-target-region-and-position) (widen) (got= o-char (point-min)) (if (re-search-forward (format org-complex-heading-rege= xp-format (regexp-quote headline)) nil t) (beginning-of-line) (goto-char (p= oint-max)) (if (bolp) nil (insert "\n")) (insert "* " headline "\n") (begin= ning-of-line 0))) (let ((target val)) (error "Invalid capture target specif= ication: %S" target)))) (let ((target val)) (error "Invalid capture target = specification: %S" target)))) (let ((target val)) (error "Invalid capture t= arget specification: %S" target))))) ((eq x245 'file+olp) (let* ((x257 (cdr= val))) (if (consp x257) (let* ((x258 (car x257)) (x259 (cdr x257))) (let (= (outline-path x259) (path x258)) (let ((m (org-find-olp (cons (org-capture-= expand-file path) outline-path)))) (set-buffer (marker-buffer m)) (org-capt= ure-put-target-region-and-position) (widen) (goto-char m) (set-marker m nil= )))) (let ((target val)) (error "Invalid capture target specification: %S" = target))))) ((eq x245 'file+regexp) (let* ((x260 (cdr val))) (if (consp x26= 0) (let* ((x261 (car x260)) (x262 (cdr x260))) (if (consp x262) (let* ((x26= 3 (car x262)) (x264 (cdr x262))) (if (null x264) (let ((regexp x263) (path = x261)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-targe= t-region-and-position) (widen) (goto-char (point-min)) (if (not (re-search-= forward regexp nil t)) (error "No match for target regexp in file %s" path)= (goto-char (if (org-capture-get :prepend) (match-beginning 0) (match-end 0= ))) (org-capture-put :exact-position (point)) (setq target-entry-p (and (de= rived-mode-p 'org-mode) (org-at-heading-p))))) (let ((target val)) (error "= Invalid capture target specification: %S" target)))) (let ((target val)) (e= rror "Invalid capture target specification: %S" target)))) (let ((target va= l)) (error "Invalid capture target specification: %S" target))))) ((eq x245= 'file+olp+datetree) (let* ((x265 (cdr val))) (if (consp x265) (let* ((x266= (car x265)) (x267 (cdr x265))) (let ((outline-path x267) (path x266)) (let= ((m (if outline-path (org-find-olp (cons (org-capture-expand-file path) ou= tline-path)) (set-buffer (org-capture-target-buffer path)) (point-marker)))= ) (set-buffer (marker-buffer m)) (org-capture-put-target-region-and-positio= n) (widen) (goto-char m) (set-marker m nil) (require 'org-datetree) (org-ca= pture-put-target-region-and-position) (widen) (funcall (if (eq (org-capture= -get :tree-type) 'week) (function org-datetree-find-iso-week-create) (funct= ion org-datetree-find-date-create)) (calendar-gregorian-from-absolute (cond= (org-overriding-default-time (time-to-days org-overriding-default-time)) (= (or (org-capture-get :time-prompt) (equal current-prefix-arg 1)) (let ((pro= mpt-time (org-read-date nil t nil "Date for tree entry:" (current-time)))) = (org-capture-put :default-time (cond ((and (or (not (boundp 'org-time-was-g= iven)) (not org-time-was-given)) (not (=3D (time-to-days prompt-time) (org-= today)))) (apply (function encode-time) (append '(0 0 0) (cdr (cdr (cdr (de= code-time prompt-time))))))) ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\= )" org-read-date-final-answer) (apply (function encode-time) (org-read-date= -analyze (replace-match "\\1 \\2" nil nil org-read-date-final-answer) promp= t-time (decode-time prompt-time)))) (t prompt-time))) (time-to-days prompt-= time))) (t (org-today)))) (if outline-path 'subtree-at-point))))) (let ((ta= rget val)) (error "Invalid capture target specification: %S" target))))) ((= eq x245 'file+function) (let* ((x268 (cdr val))) (if (consp x268) (let* ((x= 269 (car x268)) (x270 (cdr x268))) (if (consp x270) (let* ((x271 (car x270)= ) (x272 (cdr x270))) (if (null x272) (let ((function x271) (path x269)) (se= t-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-a= nd-position) (widen) (funcall function) (org-capture-put :exact-position (p= oint)) (setq target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading= -p)))) (let ((target val)) (error "Invalid capture target specification: %S= " target)))) (let ((target val)) (error "Invalid capture target specificati= on: %S" target)))) (let ((target val)) (error "Invalid capture target speci= fication: %S" target))))) ((eq x245 'function) (let* ((x273 (cdr val))) (if= (consp x273) (let* ((x274 (car x273)) (x275 (cdr x273))) (if (null x275) (= let ((fun x274)) (funcall fun) (org-capture-put :exact-position (point)) (s= etq target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p)))) (l= et ((target val)) (error "Invalid capture target specification: %S" target)= ))) (let ((target val)) (error "Invalid capture target specification: %S" t= arget))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (prog= n (if (and (markerp org-clock-hd-marker) (marker-buffer org-clock-hd-marker= )) (progn (set-buffer (marker-buffer org-clock-hd-marker)) (org-capture-put= -target-region-and-position) (widen) (goto-char org-clock-hd-marker)) (erro= r "No running clock that could be used as capture target"))) (let ((target = val)) (error "Invalid capture target specification: %S" target))))) (t (let= ((target val)) (error "Invalid capture target specification: %S" target)))) (let* ((x245 (car val))) (cond ((eq x245 'file) (let* ((x246 (cdr val))) = (if (consp x246) (let* ((x247 (car x246)) (x248 (cdr x246))) (if (null x248= ) (let ((path x247)) (set-buffer (org-capture-target-buffer path)) (org-cap= ture-put-target-region-and-position) (widen) (setq target-entry-p nil)) (le= t ((target val)) (error "Invalid capture target specification: %S" target))= )) (let ((target val)) (error "Invalid capture target specification: %S" ta= rget))))) ((eq x245 'id) (let* ((x249 (cdr val))) (if (consp x249) (let* ((= x250 (car x249)) (x251 (cdr x249))) (if (null x251) (let ((id x250)) (let* = ((val (org-id-find id))) (if (consp val) (let* ((x277 (car val)) (x278 (cdr= val))) (let ((position x278) (path x277)) (set-buffer (org-capture-target-= buffer path)) (widen) (org-capture-put-target-region-and-position) (goto-ch= ar position))) (error "Cannot find target ID \"%s\"" id)))) (let ((target v= al)) (error "Invalid capture target specification: %S" target)))) (let ((ta= rget val)) (error "Invalid capture target specification: %S" target))))) ((= eq x245 'file+headline) (let* ((x252 (cdr val))) (if (consp x252) (let* ((x= 253 (car x252)) (x254 (cdr x252))) (if (consp x254) (let* ((x255 (car x254)= ) (x256 (cdr x254))) (if (null x256) (let ((headline x255) (path x253)) (se= t-buffer (org-capture-target-buffer path)) (if (derived-mode-p 'org-mode) n= il (org-display-warning (format "Capture requirement: switching buffer %S t= o Org mode" (current-buffer))) (org-mode)) (org-capture-put-target-region-a= nd-position) (widen) (goto-char (point-min)) (if (re-search-forward (format= org-complex-heading-regexp-format (regexp-quote headline)) nil t) (beginni= ng-of-line) (goto-char (point-max)) (if (bolp) nil (insert "\n")) (insert "= * " headline "\n") (beginning-of-line 0))) (let ((target val)) (error "Inva= lid capture target specification: %S" target)))) (let ((target val)) (error= "Invalid capture target specification: %S" target)))) (let ((target val)) = (error "Invalid capture target specification: %S" target))))) ((eq x245 'fi= le+olp) (let* ((x257 (cdr val))) (if (consp x257) (let* ((x258 (car x257)) = (x259 (cdr x257))) (let ((outline-path x259) (path x258)) (let ((m (org-fin= d-olp (cons (org-capture-expand-file path) outline-path)))) (set-buffer (ma= rker-buffer m)) (org-capture-put-target-region-and-position) (widen) (goto-= char m) (set-marker m nil)))) (let ((target val)) (error "Invalid capture t= arget specification: %S" target))))) ((eq x245 'file+regexp) (let* ((x260 (= cdr val))) (if (consp x260) (let* ((x261 (car x260)) (x262 (cdr x260))) (if= (consp x262) (let* ((x263 (car x262)) (x264 (cdr x262))) (if (null x264) (= let ((regexp x263) (path x261)) (set-buffer (org-capture-target-buffer path= )) (org-capture-put-target-region-and-position) (widen) (goto-char (point-m= in)) (if (not (re-search-forward regexp nil t)) (error "No match for target= regexp in file %s" path) (goto-char (if (org-capture-get :prepend) (match-= beginning 0) (match-end 0))) (org-capture-put :exact-position (point)) (set= q target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p))))) (le= t ((target val)) (error "Invalid capture target specification: %S" target))= )) (let ((target val)) (error "Invalid capture target specification: %S" ta= rget)))) (let ((target val)) (error "Invalid capture target specification: = %S" target))))) ((eq x245 'file+olp+datetree) (let* ((x265 (cdr val))) (if = (consp x265) (let* ((x266 (car x265)) (x267 (cdr x265))) (let ((outline-pat= h x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-cap= ture-expand-file path) outline-path)) (set-buffer (org-capture-target-buffe= r path)) (point-marker)))) (set-buffer (marker-buffer m)) (org-capture-put-= target-region-and-position) (widen) (goto-char m) (set-marker m nil) (requi= re 'org-datetree) (org-capture-put-target-region-and-position) (widen) (fun= call (if (eq (org-capture-get :tree-type) 'week) (function org-datetree-fin= d-iso-week-create) (function org-datetree-find-date-create)) (calendar-greg= orian-from-absolute (cond (org-overriding-default-time (time-to-days org-ov= erriding-default-time)) ((or (org-capture-get :time-prompt) (equal current-= prefix-arg 1)) (let ((prompt-time (org-read-date nil t nil "Date for tree e= ntry:" (current-time)))) (org-capture-put :default-time (cond ((and (or (no= t (boundp 'org-time-was-given)) (not org-time-was-given)) (not (=3D (time-t= o-days prompt-time) (org-today)))) (apply (function encode-time) (append '(= 0 0 0) (cdr (cdr (cdr (decode-time prompt-time))))))) ((string-match "\\([^= ]+\\)--?[^ ]+[ ]+\\(.*\\)" org-read-date-final-answer) (apply (function en= code-time) (org-read-date-analyze (replace-match "\\1 \\2" nil nil org-read= -date-final-answer) prompt-time (decode-time prompt-time)))) (t prompt-time= ))) (time-to-days prompt-time))) (t (org-today)))) (if outline-path 'subtre= e-at-point))))) (let ((target val)) (error "Invalid capture target specific= ation: %S" target))))) ((eq x245 'file+function) (let* ((x268 (cdr val))) (= if (consp x268) (let* ((x269 (car x268)) (x270 (cdr x268))) (if (consp x270= ) (let* ((x271 (car x270)) (x272 (cdr x270))) (if (null x272) (let ((functi= on x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-ca= pture-put-target-region-and-position) (widen) (funcall function) (org-captu= re-put :exact-position (point)) (setq target-entry-p (and (derived-mode-p '= org-mode) (org-at-heading-p)))) (let ((target val)) (error "Invalid capture= target specification: %S" target)))) (let ((target val)) (error "Invalid c= apture target specification: %S" target)))) (let ((target val)) (error "Inv= alid capture target specification: %S" target))))) ((eq x245 'function) (le= t* ((x273 (cdr val))) (if (consp x273) (let* ((x274 (car x273)) (x275 (cdr = x273))) (if (null x275) (let ((fun x274)) (funcall fun) (org-capture-put :e= xact-position (point)) (setq target-entry-p (and (derived-mode-p 'org-mode)= (org-at-heading-p)))) (let ((target val)) (error "Invalid capture target s= pecification: %S" target)))) (let ((target val)) (error "Invalid capture ta= rget specification: %S" target))))) ((eq x245 'clock) (let* ((x276 (cdr val= ))) (if (null x276) (progn (if (and (markerp org-clock-hd-marker) (marker-b= uffer org-clock-hd-marker)) (progn (set-buffer (marker-buffer org-clock-hd-= marker)) (org-capture-put-target-region-and-position) (widen) (goto-char or= g-clock-hd-marker)) (error "No running clock that could be used as capture = target"))) (let ((target val)) (error "Invalid capture target specification= : %S" target))))) (t (let ((target val)) (error "Invalid capture target spe= cification: %S" target))))) (if (consp val) (let* ((x245 (car val))) (cond ((eq x245 'file) (let* ((x= 246 (cdr val))) (if (consp x246) (let* ((x247 (car x246)) (x248 (cdr x246))= ) (if (null x248) (let ((path x247)) (set-buffer (org-capture-target-buffer= path)) (org-capture-put-target-region-and-position) (widen) (setq target-e= ntry-p nil)) (let ((target val)) (error "Invalid capture target specificati= on: %S" target)))) (let ((target val)) (error "Invalid capture target speci= fication: %S" target))))) ((eq x245 'id) (let* ((x249 (cdr val))) (if (cons= p x249) (let* ((x250 (car x249)) (x251 (cdr x249))) (if (null x251) (let ((= id x250)) (let* ((val (org-id-find id))) (if (consp val) (let* ((x277 (car = val)) (x278 (cdr val))) (let ((position x278) (path x277)) (set-buffer (org= -capture-target-buffer path)) (widen) (org-capture-put-target-region-and-po= sition) (goto-char position))) (error "Cannot find target ID \"%s\"" id))))= (let ((target val)) (error "Invalid capture target specification: %S" targ= et)))) (let ((target val)) (error "Invalid capture target specification: %S= " target))))) ((eq x245 'file+headline) (let* ((x252 (cdr val))) (if (consp= x252) (let* ((x253 (car x252)) (x254 (cdr x252))) (if (consp x254) (let* (= (x255 (car x254)) (x256 (cdr x254))) (if (null x256) (let ((headline x255) = (path x253)) (set-buffer (org-capture-target-buffer path)) (if (derived-mod= e-p 'org-mode) nil (org-display-warning (format "Capture requirement: switc= hing buffer %S to Org mode" (current-buffer))) (org-mode)) (org-capture-put= -target-region-and-position) (widen) (goto-char (point-min)) (if (re-search= -forward (format org-complex-heading-regexp-format (regexp-quote headline))= nil t) (beginning-of-line) (goto-char (point-max)) (if (bolp) nil (insert = "\n")) (insert "* " headline "\n") (beginning-of-line 0))) (let ((target va= l)) (error "Invalid capture target specification: %S" target)))) (let ((tar= get val)) (error "Invalid capture target specification: %S" target)))) (let= ((target val)) (error "Invalid capture target specification: %S" target)))= )) ((eq x245 'file+olp) (let* ((x257 (cdr val))) (if (consp x257) (let* ((x= 258 (car x257)) (x259 (cdr x257))) (let ((outline-path x259) (path x258)) (= let ((m (org-find-olp (cons (org-capture-expand-file path) outline-path))))= (set-buffer (marker-buffer m)) (org-capture-put-target-region-and-position= ) (widen) (goto-char m) (set-marker m nil)))) (let ((target val)) (error "I= nvalid capture target specification: %S" target))))) ((eq x245 'file+regexp= ) (let* ((x260 (cdr val))) (if (consp x260) (let* ((x261 (car x260)) (x262 = (cdr x260))) (if (consp x262) (let* ((x263 (car x262)) (x264 (cdr x262))) (= if (null x264) (let ((regexp x263) (path x261)) (set-buffer (org-capture-ta= rget-buffer path)) (org-capture-put-target-region-and-position) (widen) (go= to-char (point-min)) (if (not (re-search-forward regexp nil t)) (error "No = match for target regexp in file %s" path) (goto-char (if (org-capture-get := prepend) (match-beginning 0) (match-end 0))) (org-capture-put :exact-positi= on (point)) (setq target-entry-p (and (derived-mode-p 'org-mode) (org-at-he= ading-p))))) (let ((target val)) (error "Invalid capture target specificati= on: %S" target)))) (let ((target val)) (error "Invalid capture target speci= fication: %S" target)))) (let ((target val)) (error "Invalid capture target= specification: %S" target))))) ((eq x245 'file+olp+datetree) (let* ((x265 = (cdr val))) (if (consp x265) (let* ((x266 (car x265)) (x267 (cdr x265))) (l= et ((outline-path x267) (path x266)) (let ((m (if outline-path (org-find-ol= p (cons (org-capture-expand-file path) outline-path)) (set-buffer (org-capt= ure-target-buffer path)) (point-marker)))) (set-buffer (marker-buffer m)) (= org-capture-put-target-region-and-position) (widen) (goto-char m) (set-mark= er m nil) (require 'org-datetree) (org-capture-put-target-region-and-positi= on) (widen) (funcall (if (eq (org-capture-get :tree-type) 'week) (function = org-datetree-find-iso-week-create) (function org-datetree-find-date-create)= ) (calendar-gregorian-from-absolute (cond (org-overriding-default-time (tim= e-to-days org-overriding-default-time)) ((or (org-capture-get :time-prompt)= (equal current-prefix-arg 1)) (let ((prompt-time (org-read-date nil t nil = "Date for tree entry:" (current-time)))) (org-capture-put :default-time (co= nd ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (= not (=3D (time-to-days prompt-time) (org-today)))) (apply (function encode-= time) (append '(0 0 0) (cdr (cdr (cdr (decode-time prompt-time))))))) ((str= ing-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" org-read-date-final-answer) (ap= ply (function encode-time) (org-read-date-analyze (replace-match "\\1 \\2" = nil nil org-read-date-final-answer) prompt-time (decode-time prompt-time)))= ) (t prompt-time))) (time-to-days prompt-time))) (t (org-today)))) (if outl= ine-path 'subtree-at-point))))) (let ((target val)) (error "Invalid capture= target specification: %S" target))))) ((eq x245 'file+function) (let* ((x2= 68 (cdr val))) (if (consp x268) (let* ((x269 (car x268)) (x270 (cdr x268)))= (if (consp x270) (let* ((x271 (car x270)) (x272 (cdr x270))) (if (null x27= 2) (let ((function x271) (path x269)) (set-buffer (org-capture-target-buffe= r path)) (org-capture-put-target-region-and-position) (widen) (funcall func= tion) (org-capture-put :exact-position (point)) (setq target-entry-p (and (= derived-mode-p 'org-mode) (org-at-heading-p)))) (let ((target val)) (error = "Invalid capture target specification: %S" target)))) (let ((target val)) (= error "Invalid capture target specification: %S" target)))) (let ((target v= al)) (error "Invalid capture target specification: %S" target))))) ((eq x24= 5 'function) (let* ((x273 (cdr val))) (if (consp x273) (let* ((x274 (car x2= 73)) (x275 (cdr x273))) (if (null x275) (let ((fun x274)) (funcall fun) (or= g-capture-put :exact-position (point)) (setq target-entry-p (and (derived-m= ode-p 'org-mode) (org-at-heading-p)))) (let ((target val)) (error "Invalid = capture target specification: %S" target)))) (let ((target val)) (error "In= valid capture target specification: %S" target))))) ((eq x245 'clock) (let*= ((x276 (cdr val))) (if (null x276) (progn (if (and (markerp org-clock-hd-m= arker) (marker-buffer org-clock-hd-marker)) (progn (set-buffer (marker-buff= er org-clock-hd-marker)) (org-capture-put-target-region-and-position) (wide= n) (goto-char org-clock-hd-marker)) (error "No running clock that could be = used as capture target"))) (let ((target val)) (error "Invalid capture targ= et specification: %S" target))))) (t (let ((target val)) (error "Invalid ca= pture target specification: %S" target))))) (let ((target val)) (error "Inv= alid capture target specification: %S" target))) (let* ((val (or target (org-capture-get :target)))) (if (consp val) (let*= ((x245 (car val))) (cond ((eq x245 'file) (let* ((x246 (cdr val))) (if (co= nsp x246) (let* ((x247 (car x246)) (x248 (cdr x246))) (if (null x248) (let = ((path x247)) (set-buffer (org-capture-target-buffer path)) (org-capture-pu= t-target-region-and-position) (widen) (setq target-entry-p nil)) (let ((tar= get val)) (error "Invalid capture target specification: %S" target)))) (let= ((target val)) (error "Invalid capture target specification: %S" target)))= )) ((eq x245 'id) (let* ((x249 (cdr val))) (if (consp x249) (let* ((x250 (c= ar x249)) (x251 (cdr x249))) (if (null x251) (let ((id x250)) (let* ((val (= org-id-find id))) (if (consp val) (let* ((x277 (car val)) (x278 (cdr val)))= (let ((position x278) (path x277)) (set-buffer (org-capture-target-buffer = path)) (widen) (org-capture-put-target-region-and-position) (goto-char posi= tion))) (error "Cannot find target ID \"%s\"" id)))) (let ((target val)) (e= rror "Invalid capture target specification: %S" target)))) (let ((target va= l)) (error "Invalid capture target specification: %S" target))))) ((eq x245= 'file+headline) (let* ((x252 (cdr val))) (if (consp x252) (let* ((x253 (ca= r x252)) (x254 (cdr x252))) (if (consp x254) (let* ((x255 (car x254)) (x256= (cdr x254))) (if (null x256) (let ((headline x255) (path x253)) (set-buffe= r (org-capture-target-buffer path)) (if (derived-mode-p 'org-mode) nil (org= -display-warning (format "Capture requirement: switching buffer %S to Org m= ode" (current-buffer))) (org-mode)) (org-capture-put-target-region-and-posi= tion) (widen) (goto-char (point-min)) (if (re-search-forward (format org-co= mplex-heading-regexp-format (regexp-quote headline)) nil t) (beginning-of-l= ine) (goto-char (point-max)) (if (bolp) nil (insert "\n")) (insert "* " hea= dline "\n") (beginning-of-line 0))) (let ((target val)) (error "Invalid cap= ture target specification: %S" target)))) (let ((target val)) (error "Inval= id capture target specification: %S" target)))) (let ((target val)) (error = "Invalid capture target specification: %S" target))))) ((eq x245 'file+olp)= (let* ((x257 (cdr val))) (if (consp x257) (let* ((x258 (car x257)) (x259 (= cdr x257))) (let ((outline-path x259) (path x258)) (let ((m (org-find-olp (= cons (org-capture-expand-file path) outline-path)))) (set-buffer (marker-bu= ffer m)) (org-capture-put-target-region-and-position) (widen) (goto-char m)= (set-marker m nil)))) (let ((target val)) (error "Invalid capture target s= pecification: %S" target))))) ((eq x245 'file+regexp) (let* ((x260 (cdr val= ))) (if (consp x260) (let* ((x261 (car x260)) (x262 (cdr x260))) (if (consp= x262) (let* ((x263 (car x262)) (x264 (cdr x262))) (if (null x264) (let ((r= egexp x263) (path x261)) (set-buffer (org-capture-target-buffer path)) (org= -capture-put-target-region-and-position) (widen) (goto-char (point-min)) (i= f (not (re-search-forward regexp nil t)) (error "No match for target regexp= in file %s" path) (goto-char (if (org-capture-get :prepend) (match-beginni= ng 0) (match-end 0))) (org-capture-put :exact-position (point)) (setq targe= t-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p))))) (let ((tar= get val)) (error "Invalid capture target specification: %S" target)))) (let= ((target val)) (error "Invalid capture target specification: %S" target)))= ) (let ((target val)) (error "Invalid capture target specification: %S" tar= get))))) ((eq x245 'file+olp+datetree) (let* ((x265 (cdr val))) (if (consp = x265) (let* ((x266 (car x265)) (x267 (cdr x265))) (let ((outline-path x267)= (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-ex= pand-file path) outline-path)) (set-buffer (org-capture-target-buffer path)= ) (point-marker)))) (set-buffer (marker-buffer m)) (org-capture-put-target-= region-and-position) (widen) (goto-char m) (set-marker m nil) (require 'org= -datetree) (org-capture-put-target-region-and-position) (widen) (funcall (i= f (eq (org-capture-get :tree-type) 'week) (function org-datetree-find-iso-w= eek-create) (function org-datetree-find-date-create)) (calendar-gregorian-f= rom-absolute (cond (org-overriding-default-time (time-to-days org-overridin= g-default-time)) ((or (org-capture-get :time-prompt) (equal current-prefix-= arg 1)) (let ((prompt-time (org-read-date nil t nil "Date for tree entry:" = (current-time)))) (org-capture-put :default-time (cond ((and (or (not (boun= dp 'org-time-was-given)) (not org-time-was-given)) (not (=3D (time-to-days = prompt-time) (org-today)))) (apply (function encode-time) (append '(0 0 0) = (cdr (cdr (cdr (decode-time prompt-time))))))) ((string-match "\\([^ ]+\\)-= -?[^ ]+[ ]+\\(.*\\)" org-read-date-final-answer) (apply (function encode-ti= me) (org-read-date-analyze (replace-match "\\1 \\2" nil nil org-read-date-f= inal-answer) prompt-time (decode-time prompt-time)))) (t prompt-time))) (ti= me-to-days prompt-time))) (t (org-today)))) (if outline-path 'subtree-at-po= int))))) (let ((target val)) (error "Invalid capture target specification: = %S" target))))) ((eq x245 'file+function) (let* ((x268 (cdr val))) (if (con= sp x268) (let* ((x269 (car x268)) (x270 (cdr x268))) (if (consp x270) (let*= ((x271 (car x270)) (x272 (cdr x270))) (if (null x272) (let ((function x271= ) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-p= ut-target-region-and-position) (widen) (funcall function) (org-capture-put = :exact-position (point)) (setq target-entry-p (and (derived-mode-p 'org-mod= e) (org-at-heading-p)))) (let ((target val)) (error "Invalid capture target= specification: %S" target)))) (let ((target val)) (error "Invalid capture = target specification: %S" target)))) (let ((target val)) (error "Invalid ca= pture target specification: %S" target))))) ((eq x245 'function) (let* ((x2= 73 (cdr val))) (if (consp x273) (let* ((x274 (car x273)) (x275 (cdr x273)))= (if (null x275) (let ((fun x274)) (funcall fun) (org-capture-put :exact-po= sition (point)) (setq target-entry-p (and (derived-mode-p 'org-mode) (org-a= t-heading-p)))) (let ((target val)) (error "Invalid capture target specific= ation: %S" target)))) (let ((target val)) (error "Invalid capture target sp= ecification: %S" target))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if= (null x276) (progn (if (and (markerp org-clock-hd-marker) (marker-buffer o= rg-clock-hd-marker)) (progn (set-buffer (marker-buffer org-clock-hd-marker)= ) (org-capture-put-target-region-and-position) (widen) (goto-char org-clock= -hd-marker)) (error "No running clock that could be used as capture target"= ))) (let ((target val)) (error "Invalid capture target specification: %S" t= arget))))) (t (let ((target val)) (error "Invalid capture target specificat= ion: %S" target))))) (let ((target val)) (error "Invalid capture target spe= cification: %S" target)))) (save-excursion (let* ((val (or target (org-capture-get :target)))) (if (= consp val) (let* ((x245 (car val))) (cond ((eq x245 'file) (let* ((x246 (cd= r val))) (if (consp x246) (let* ((x247 (car x246)) (x248 (cdr x246))) (if (= null x248) (let ((path x247)) (set-buffer (org-capture-target-buffer path))= (org-capture-put-target-region-and-position) (widen) (setq target-entry-p = nil)) (let ((target val)) (error "Invalid capture target specification: %S"= target)))) (let ((target val)) (error "Invalid capture target specificatio= n: %S" target))))) ((eq x245 'id) (let* ((x249 (cdr val))) (if (consp x249)= (let* ((x250 (car x249)) (x251 (cdr x249))) (if (null x251) (let ((id x250= )) (let* ((val (org-id-find id))) (if (consp val) (let* ((x277 (car val)) (= x278 (cdr val))) (let ((position x278) (path x277)) (set-buffer (org-captur= e-target-buffer path)) (widen) (org-capture-put-target-region-and-position)= (goto-char position))) (error "Cannot find target ID \"%s\"" id)))) (let (= (target val)) (error "Invalid capture target specification: %S" target)))) = (let ((target val)) (error "Invalid capture target specification: %S" targe= t))))) ((eq x245 'file+headline) (let* ((x252 (cdr val))) (if (consp x252) = (let* ((x253 (car x252)) (x254 (cdr x252))) (if (consp x254) (let* ((x255 (= car x254)) (x256 (cdr x254))) (if (null x256) (let ((headline x255) (path x= 253)) (set-buffer (org-capture-target-buffer path)) (if (derived-mode-p 'or= g-mode) nil (org-display-warning (format "Capture requirement: switching bu= ffer %S to Org mode" (current-buffer))) (org-mode)) (org-capture-put-target= -region-and-position) (widen) (goto-char (point-min)) (if (re-search-forwar= d (format org-complex-heading-regexp-format (regexp-quote headline)) nil t)= (beginning-of-line) (goto-char (point-max)) (if (bolp) nil (insert "\n")) = (insert "* " headline "\n") (beginning-of-line 0))) (let ((target val)) (er= ror "Invalid capture target specification: %S" target)))) (let ((target val= )) (error "Invalid capture target specification: %S" target)))) (let ((targ= et val)) (error "Invalid capture target specification: %S" target))))) ((eq= x245 'file+olp) (let* ((x257 (cdr val))) (if (consp x257) (let* ((x258 (ca= r x257)) (x259 (cdr x257))) (let ((outline-path x259) (path x258)) (let ((m= (org-find-olp (cons (org-capture-expand-file path) outline-path)))) (set-b= uffer (marker-buffer m)) (org-capture-put-target-region-and-position) (wide= n) (goto-char m) (set-marker m nil)))) (let ((target val)) (error "Invalid = capture target specification: %S" target))))) ((eq x245 'file+regexp) (let*= ((x260 (cdr val))) (if (consp x260) (let* ((x261 (car x260)) (x262 (cdr x2= 60))) (if (consp x262) (let* ((x263 (car x262)) (x264 (cdr x262))) (if (nul= l x264) (let ((regexp x263) (path x261)) (set-buffer (org-capture-target-bu= ffer path)) (org-capture-put-target-region-and-position) (widen) (goto-char= (point-min)) (if (not (re-search-forward regexp nil t)) (error "No match f= or target regexp in file %s" path) (goto-char (if (org-capture-get :prepend= ) (match-beginning 0) (match-end 0))) (org-capture-put :exact-position (poi= nt)) (setq target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p= ))))) (let ((target val)) (error "Invalid capture target specification: %S"= target)))) (let ((target val)) (error "Invalid capture target specificatio= n: %S" target)))) (let ((target val)) (error "Invalid capture target specif= ication: %S" target))))) ((eq x245 'file+olp+datetree) (let* ((x265 (cdr va= l))) (if (consp x265) (let* ((x266 (car x265)) (x267 (cdr x265))) (let ((ou= tline-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons= (org-capture-expand-file path) outline-path)) (set-buffer (org-capture-tar= get-buffer path)) (point-marker)))) (set-buffer (marker-buffer m)) (org-cap= ture-put-target-region-and-position) (widen) (goto-char m) (set-marker m ni= l) (require 'org-datetree) (org-capture-put-target-region-and-position) (wi= den) (funcall (if (eq (org-capture-get :tree-type) 'week) (function org-dat= etree-find-iso-week-create) (function org-datetree-find-date-create)) (cale= ndar-gregorian-from-absolute (cond (org-overriding-default-time (time-to-da= ys org-overriding-default-time)) ((or (org-capture-get :time-prompt) (equal= current-prefix-arg 1)) (let ((prompt-time (org-read-date nil t nil "Date f= or tree entry:" (current-time)))) (org-capture-put :default-time (cond ((an= d (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= =3D (time-to-days prompt-time) (org-today)))) (apply (function encode-time)= (append '(0 0 0) (cdr (cdr (cdr (decode-time prompt-time))))))) ((string-m= atch "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" org-read-date-final-answer) (apply (= function encode-time) (org-read-date-analyze (replace-match "\\1 \\2" nil n= il org-read-date-final-answer) prompt-time (decode-time prompt-time)))) (t = prompt-time))) (time-to-days prompt-time))) (t (org-today)))) (if outline-p= ath 'subtree-at-point))))) (let ((target val)) (error "Invalid capture targ= et specification: %S" target))))) ((eq x245 'file+function) (let* ((x268 (c= dr val))) (if (consp x268) (let* ((x269 (car x268)) (x270 (cdr x268))) (if = (consp x270) (let* ((x271 (car x270)) (x272 (cdr x270))) (if (null x272) (l= et ((function x271) (path x269)) (set-buffer (org-capture-target-buffer pat= h)) (org-capture-put-target-region-and-position) (widen) (funcall function)= (org-capture-put :exact-position (point)) (setq target-entry-p (and (deriv= ed-mode-p 'org-mode) (org-at-heading-p)))) (let ((target val)) (error "Inva= lid capture target specification: %S" target)))) (let ((target val)) (error= "Invalid capture target specification: %S" target)))) (let ((target val)) = (error "Invalid capture target specification: %S" target))))) ((eq x245 'fu= nction) (let* ((x273 (cdr val))) (if (consp x273) (let* ((x274 (car x273)) = (x275 (cdr x273))) (if (null x275) (let ((fun x274)) (funcall fun) (org-cap= ture-put :exact-position (point)) (setq target-entry-p (and (derived-mode-p= 'org-mode) (org-at-heading-p)))) (let ((target val)) (error "Invalid captu= re target specification: %S" target)))) (let ((target val)) (error "Invalid= capture target specification: %S" target))))) ((eq x245 'clock) (let* ((x2= 76 (cdr val))) (if (null x276) (progn (if (and (markerp org-clock-hd-marker= ) (marker-buffer org-clock-hd-marker)) (progn (set-buffer (marker-buffer or= g-clock-hd-marker)) (org-capture-put-target-region-and-position) (widen) (g= oto-char org-clock-hd-marker)) (error "No running clock that could be used = as capture target"))) (let ((target val)) (error "Invalid capture target sp= ecification: %S" target))))) (t (let ((target val)) (error "Invalid capture= target specification: %S" target))))) (let ((target val)) (error "Invalid = capture target specification: %S" target)))) (org-capture-put :buffer (curr= ent-buffer) :pos (point) :target-entry-p target-entry-p :decrypted (and (fe= aturep 'org-crypt) (org-at-encrypted-entry-p) (save-excursion (org-decrypt-= entry) (and (org-back-to-heading t) (point)))))) (let ((target-entry-p t)) (save-excursion (let* ((val (or target (org-cap= ture-get :target)))) (if (consp val) (let* ((x245 (car val))) (cond ((eq x2= 45 'file) (let* ((x246 (cdr val))) (if (consp x246) (let* ((x247 (car x246)= ) (x248 (cdr x246))) (if (null x248) (let ((path x247)) (set-buffer (org-ca= pture-target-buffer path)) (org-capture-put-target-region-and-position) (wi= den) (setq target-entry-p nil)) (let ((target val)) (error "Invalid capture= target specification: %S" target)))) (let ((target val)) (error "Invalid c= apture target specification: %S" target))))) ((eq x245 'id) (let* ((x249 (c= dr val))) (if (consp x249) (let* ((x250 (car x249)) (x251 (cdr x249))) (if = (null x251) (let ((id x250)) (let* ((val (org-id-find id))) (if (consp val)= (let* ((x277 (car val)) (x278 (cdr val))) (let ((position x278) (path x277= )) (set-buffer (org-capture-target-buffer path)) (widen) (org-capture-put-t= arget-region-and-position) (goto-char position))) (error "Cannot find targe= t ID \"%s\"" id)))) (let ((target val)) (error "Invalid capture target spec= ification: %S" target)))) (let ((target val)) (error "Invalid capture targe= t specification: %S" target))))) ((eq x245 'file+headline) (let* ((x252 (cd= r val))) (if (consp x252) (let* ((x253 (car x252)) (x254 (cdr x252))) (if (= consp x254) (let* ((x255 (car x254)) (x256 (cdr x254))) (if (null x256) (le= t ((headline x255) (path x253)) (set-buffer (org-capture-target-buffer path= )) (if (derived-mode-p 'org-mode) nil (org-display-warning (format "Capture= requirement: switching buffer %S to Org mode" (current-buffer))) (org-mode= )) (org-capture-put-target-region-and-position) (widen) (goto-char (point-m= in)) (if (re-search-forward (format org-complex-heading-regexp-format (rege= xp-quote headline)) nil t) (beginning-of-line) (goto-char (point-max)) (if = (bolp) nil (insert "\n")) (insert "* " headline "\n") (beginning-of-line 0)= )) (let ((target val)) (error "Invalid capture target specification: %S" ta= rget)))) (let ((target val)) (error "Invalid capture target specification: = %S" target)))) (let ((target val)) (error "Invalid capture target specifica= tion: %S" target))))) ((eq x245 'file+olp) (let* ((x257 (cdr val))) (if (co= nsp x257) (let* ((x258 (car x257)) (x259 (cdr x257))) (let ((outline-path x= 259) (path x258)) (let ((m (org-find-olp (cons (org-capture-expand-file pat= h) outline-path)))) (set-buffer (marker-buffer m)) (org-capture-put-target-= region-and-position) (widen) (goto-char m) (set-marker m nil)))) (let ((tar= get val)) (error "Invalid capture target specification: %S" target))))) ((e= q x245 'file+regexp) (let* ((x260 (cdr val))) (if (consp x260) (let* ((x261= (car x260)) (x262 (cdr x260))) (if (consp x262) (let* ((x263 (car x262)) (= x264 (cdr x262))) (if (null x264) (let ((regexp x263) (path x261)) (set-buf= fer (org-capture-target-buffer path)) (org-capture-put-target-region-and-po= sition) (widen) (goto-char (point-min)) (if (not (re-search-forward regexp = nil t)) (error "No match for target regexp in file %s" path) (goto-char (if= (org-capture-get :prepend) (match-beginning 0) (match-end 0))) (org-captur= e-put :exact-position (point)) (setq target-entry-p (and (derived-mode-p 'o= rg-mode) (org-at-heading-p))))) (let ((target val)) (error "Invalid capture= target specification: %S" target)))) (let ((target val)) (error "Invalid c= apture target specification: %S" target)))) (let ((target val)) (error "Inv= alid capture target specification: %S" target))))) ((eq x245 'file+olp+date= tree) (let* ((x265 (cdr val))) (if (consp x265) (let* ((x266 (car x265)) (x= 267 (cdr x265))) (let ((outline-path x267) (path x266)) (let ((m (if outlin= e-path (org-find-olp (cons (org-capture-expand-file path) outline-path)) (s= et-buffer (org-capture-target-buffer path)) (point-marker)))) (set-buffer (= marker-buffer m)) (org-capture-put-target-region-and-position) (widen) (got= o-char m) (set-marker m nil) (require 'org-datetree) (org-capture-put-targe= t-region-and-position) (widen) (funcall (if (eq (org-capture-get :tree-type= ) 'week) (function org-datetree-find-iso-week-create) (function org-datetre= e-find-date-create)) (calendar-gregorian-from-absolute (cond (org-overridin= g-default-time (time-to-days org-overriding-default-time)) ((or (org-captur= e-get :time-prompt) (equal current-prefix-arg 1)) (let ((prompt-time (org-r= ead-date nil t nil "Date for tree entry:" (current-time)))) (org-capture-pu= t :default-time (cond ((and (or (not (boundp 'org-time-was-given)) (not org= -time-was-given)) (not (=3D (time-to-days prompt-time) (org-today)))) (appl= y (function encode-time) (append '(0 0 0) (cdr (cdr (cdr (decode-time promp= t-time))))))) ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" org-read-dat= e-final-answer) (apply (function encode-time) (org-read-date-analyze (repla= ce-match "\\1 \\2" nil nil org-read-date-final-answer) prompt-time (decode-= time prompt-time)))) (t prompt-time))) (time-to-days prompt-time))) (t (org= -today)))) (if outline-path 'subtree-at-point))))) (let ((target val)) (err= or "Invalid capture target specification: %S" target))))) ((eq x245 'file+f= unction) (let* ((x268 (cdr val))) (if (consp x268) (let* ((x269 (car x268))= (x270 (cdr x268))) (if (consp x270) (let* ((x271 (car x270)) (x272 (cdr x2= 70))) (if (null x272) (let ((function x271) (path x269)) (set-buffer (org-c= apture-target-buffer path)) (org-capture-put-target-region-and-position) (w= iden) (funcall function) (org-capture-put :exact-position (point)) (setq ta= rget-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p)))) (let ((t= arget val)) (error "Invalid capture target specification: %S" target)))) (l= et ((target val)) (error "Invalid capture target specification: %S" target)= ))) (let ((target val)) (error "Invalid capture target specification: %S" t= arget))))) ((eq x245 'function) (let* ((x273 (cdr val))) (if (consp x273) (= let* ((x274 (car x273)) (x275 (cdr x273))) (if (null x275) (let ((fun x274)= ) (funcall fun) (org-capture-put :exact-position (point)) (setq target-entr= y-p (and (derived-mode-p 'org-mode) (org-at-heading-p)))) (let ((target val= )) (error "Invalid capture target specification: %S" target)))) (let ((targ= et val)) (error "Invalid capture target specification: %S" target))))) ((eq= x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (if (and (mar= kerp org-clock-hd-marker) (marker-buffer org-clock-hd-marker)) (progn (set-= buffer (marker-buffer org-clock-hd-marker)) (org-capture-put-target-region-= and-position) (widen) (goto-char org-clock-hd-marker)) (error "No running c= lock that could be used as capture target"))) (let ((target val)) (error "I= nvalid capture target specification: %S" target))))) (t (let ((target val))= (error "Invalid capture target specification: %S" target))))) (let ((targe= t val)) (error "Invalid capture target specification: %S" target)))) (org-c= apture-put :buffer (current-buffer) :pos (point) :target-entry-p target-ent= ry-p :decrypted (and (featurep 'org-crypt) (org-at-encrypted-entry-p) (save= -excursion (org-decrypt-entry) (and (org-back-to-heading t) (point))))))) org-capture-set-target-location() (cond ((equal entry "C") (customize-variable 'org-capture-templates)) ((e= qual entry "q") (user-error "Abort")) (t (org-capture-set-plist entry) (org= -capture-get-template) (org-capture-put :original-buffer orig-buf :original= -file (or (buffer-file-name orig-buf) (and (featurep 'dired) (car (rassq or= ig-buf dired-buffers)))) :original-file-nondirectory (and (buffer-file-name= orig-buf) (file-name-nondirectory (buffer-file-name orig-buf))) :annotatio= n annotation :initial initial :return-to-wconf (current-window-configuratio= n) :default-time (or org-overriding-default-time (org-current-time))) (org-= capture-set-target-location) (condition-case error (org-capture-put :templa= te (org-capture-fill-template)) ((error quit) (if (get-buffer "*Capture*") = (kill-buffer "*Capture*")) (error "Capture abort: %s" error))) (setq org-ca= pture-clock-keep (org-capture-get :clock-keep)) (if (equal goto 0) (org-cap= ture-insert-template-here) (condition-case error (org-capture-place-templat= e (eq (car (org-capture-get :target)) 'function)) ((error quit) (if (and (b= uffer-base-buffer (current-buffer)) (string-prefix-p "CAPTURE-" (buffer-nam= e))) (kill-buffer (current-buffer))) (set-window-configuration (org-capture= -get :return-to-wconf)) (error "Capture template `%s': %s" (org-capture-get= :key) (nth 1 error)))) (if (and (derived-mode-p 'org-mode) (org-capture-ge= t :clock-in)) (condition-case nil (progn (if (org-clock-is-active) (org-cap= ture-put :interrupted-clock (copy-marker org-clock-marker))) (org-clock-in)= (set (make-local-variable 'org-capture-clock-was-started) t)) (error "Coul= d not start the clock in this capture buffer"))) (if (org-capture-get :imme= diate-finish) (org-capture-finalize))))) (let* ((orig-buf (current-buffer)) (annotation (if (and (boundp 'org-capt= ure-link-is-already-stored) org-capture-link-is-already-stored) (plist-get = org-store-link-plist :annotation) (condition-case nil (progn (org-store-lin= k nil)) (error nil)))) (entry (or org-capture-entry (org-capture-select-tem= plate keys))) initial) (setq initial (or org-capture-initial (and (org-regi= on-active-p) (buffer-substring (point) (mark))))) (if (stringp initial) (pr= ogn (remove-text-properties 0 (length initial) '(read-only t) initial))) (i= f (stringp annotation) (progn (remove-text-properties 0 (length annotation)= '(read-only t) annotation))) (cond ((equal entry "C") (customize-variable = 'org-capture-templates)) ((equal entry "q") (user-error "Abort")) (t (org-c= apture-set-plist entry) (org-capture-get-template) (org-capture-put :origin= al-buffer orig-buf :original-file (or (buffer-file-name orig-buf) (and (fea= turep 'dired) (car (rassq orig-buf dired-buffers)))) :original-file-nondire= ctory (and (buffer-file-name orig-buf) (file-name-nondirectory (buffer-file= -name orig-buf))) :annotation annotation :initial initial :return-to-wconf = (current-window-configuration) :default-time (or org-overriding-default-tim= e (org-current-time))) (org-capture-set-target-location) (condition-case er= ror (org-capture-put :template (org-capture-fill-template)) ((error quit) (= if (get-buffer "*Capture*") (kill-buffer "*Capture*")) (error "Capture abor= t: %s" error))) (setq org-capture-clock-keep (org-capture-get :clock-keep))= (if (equal goto 0) (org-capture-insert-template-here) (condition-case erro= r (org-capture-place-template (eq (car (org-capture-get :target)) 'function= )) ((error quit) (if (and (buffer-base-buffer (current-buffer)) (string-pre= fix-p "CAPTURE-" (buffer-name))) (kill-buffer (current-buffer))) (set-windo= w-configuration (org-capture-get :return-to-wconf)) (error "Capture templat= e `%s': %s" (org-capture-get :key) (nth 1 error)))) (if (and (derived-mode-= p 'org-mode) (org-capture-get :clock-in)) (condition-case nil (progn (if (o= rg-clock-is-active) (org-capture-put :interrupted-clock (copy-marker org-cl= ock-marker))) (org-clock-in) (set (make-local-variable 'org-capture-clock-w= as-started) t)) (error "Could not start the clock in this capture buffer"))= ) (if (org-capture-get :immediate-finish) (org-capture-finalize)))))) (cond ((equal goto '(4)) (org-capture-goto-target)) ((equal goto '(16)) (= org-capture-goto-last-stored)) (t (let* ((orig-buf (current-buffer)) (annot= ation (if (and (boundp 'org-capture-link-is-already-stored) org-capture-lin= k-is-already-stored) (plist-get org-store-link-plist :annotation) (conditio= n-case nil (progn (org-store-link nil)) (error nil)))) (entry (or org-captu= re-entry (org-capture-select-template keys))) initial) (setq initial (or or= g-capture-initial (and (org-region-active-p) (buffer-substring (point) (mar= k))))) (if (stringp initial) (progn (remove-text-properties 0 (length initi= al) '(read-only t) initial))) (if (stringp annotation) (progn (remove-text-= properties 0 (length annotation) '(read-only t) annotation))) (cond ((equal= entry "C") (customize-variable 'org-capture-templates)) ((equal entry "q")= (user-error "Abort")) (t (org-capture-set-plist entry) (org-capture-get-te= mplate) (org-capture-put :original-buffer orig-buf :original-file (or (buff= er-file-name orig-buf) (and (featurep 'dired) (car (rassq orig-buf dired-bu= ffers)))) :original-file-nondirectory (and (buffer-file-name orig-buf) (fil= e-name-nondirectory (buffer-file-name orig-buf))) :annotation annotation :i= nitial initial :return-to-wconf (current-window-configuration) :default-tim= e (or org-overriding-default-time (org-current-time))) (org-capture-set-tar= get-location) (condition-case error (org-capture-put :template (org-capture= -fill-template)) ((error quit) (if (get-buffer "*Capture*") (kill-buffer "*= Capture*")) (error "Capture abort: %s" error))) (setq org-capture-clock-kee= p (org-capture-get :clock-keep)) (if (equal goto 0) (org-capture-insert-tem= plate-here) (condition-case error (org-capture-place-template (eq (car (org= -capture-get :target)) 'function)) ((error quit) (if (and (buffer-base-buff= er (current-buffer)) (string-prefix-p "CAPTURE-" (buffer-name))) (kill-buff= er (current-buffer))) (set-window-configuration (org-capture-get :return-to= -wconf)) (error "Capture template `%s': %s" (org-capture-get :key) (nth 1 e= rror)))) (if (and (derived-mode-p 'org-mode) (org-capture-get :clock-in)) (= condition-case nil (progn (if (org-clock-is-active) (org-capture-put :inter= rupted-clock (copy-marker org-clock-marker))) (org-clock-in) (set (make-loc= al-variable 'org-capture-clock-was-started) t)) (error "Could not start the= clock in this capture buffer"))) (if (org-capture-get :immediate-finish) (= org-capture-finalize)))))))) org-capture(nil) funcall-interactively(org-capture nil) call-interactively(org-capture nil nil) command-execute(org-capture) Ciao; Gregor --=20 -... --- .-. . -.. ..--.. ...-.-