emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gregor Zattler <telegraph@gmx.net>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Bug: master: "Capture abort: (error Format specifier
Date: Sun, 08 Apr 2018 15:22:58 +0200	[thread overview]
Message-ID: <87a7udj0i5.fsf@len.workgroup> (raw)
In-Reply-To: <87zi2esqri.fsf@len.workgroup>

Hi Nicolas,
* Gregor Zattler <telegraph@gmx.net> [2018-04-07; 22:30]:
> * Nicolas Goaziou <mail@nicolasgoaziou.fr> [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ällig?}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. 

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ällig?}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’t match argument type")
  format("<%c" "s")
  (closure (t) (pair) (format "<%c" (car pair)))(("s" "#+BEGIN_SRC ?\n\n#+END_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" "#+BEGIN_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#+END_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 . "latex") (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 (> (length 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-template-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-hook 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(#<buffer grfz.org> "~/org/grfz.org" nil nil "~/org/grfz.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-noselect file))) (level 1) (lmin 1) (lmax 1) end found flevel) (if buffer nil (error "File not found :%s" file)) (save-current-buffer (set-buffer buffer) (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 (>= level lmin) (<= level lmax)) (progn (setq found (match-beginning 0) flevel level cnt (1+ cnt))))) (if (= 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 (+ lmin (if org-odd-levels-only 1 0))) (setq end (save-excursion (org-end-of-subtree t t)))) (setq --dolist-tail-- (cdr --dolist-tail--))))) (if (org-at-heading-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-position) (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-marker m nil)))
  (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-capture-put-target-region-and-position) (widen) (goto-char m) (set-marker m nil))))
  (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-capture-put-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-buffer 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-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 specification: %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-capture-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" 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-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-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 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" 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-capture-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 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-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 (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 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-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-expand-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 (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 (time-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 (cond ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= (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-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 'subtree-at-point))))) (let ((target val)) (error "Invalid capture target specification: %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 ((function x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-and-position) (widen) (funcall function) (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 val)) (error "Invalid capture target specification: %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)) (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))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (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)) (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 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-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 specification: %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-capture-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" 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-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-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 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" 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-capture-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 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-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 (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 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-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-expand-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 (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 (time-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 (cond ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= (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-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 'subtree-at-point))))) (let ((target val)) (error "Invalid capture target specification: %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 ((function x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-and-position) (widen) (funcall function) (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 val)) (error "Invalid capture target specification: %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)) (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))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (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)) (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 specification: %S" target)))))
  (if (consp val) (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-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 specification: %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-capture-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" 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-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-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 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" 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-capture-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 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-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 (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 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-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-expand-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 (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 (time-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 (cond ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= (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-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 'subtree-at-point))))) (let ((target val)) (error "Invalid capture target specification: %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 ((function x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-and-position) (widen) (funcall function) (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 val)) (error "Invalid capture target specification: %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)) (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))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (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)) (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 specification: %S" target))))) (let ((target val)) (error "Invalid 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 (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 specification: %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-capture-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" 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-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-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 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" 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-capture-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 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-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 (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 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-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-expand-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 (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 (time-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 (cond ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= (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-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 'subtree-at-point))))) (let ((target val)) (error "Invalid capture target specification: %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 ((function x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-and-position) (widen) (funcall function) (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 val)) (error "Invalid capture target specification: %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)) (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))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (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)) (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 specification: %S" target))))) (let ((target val)) (error "Invalid capture target specification: %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 (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-entry-p nil)) (let ((target 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 (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-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" 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-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-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 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" 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-capture-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 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-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 (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 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-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-expand-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 (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 (time-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 (cond ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= (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-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 'subtree-at-point))))) (let ((target val)) (error "Invalid capture target specification: %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 ((function x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-and-position) (widen) (funcall function) (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 val)) (error "Invalid capture target specification: %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)) (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))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (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)) (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 specification: %S" target))))) (let ((target val)) (error "Invalid capture target specification: %S" target)))) (org-capture-put :buffer (current-buffer) :pos (point) :target-entry-p target-entry-p :decrypted (and (featurep '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-capture-get :target)))) (if (consp val) (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-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 specification: %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-capture-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" 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-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-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 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" 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-capture-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 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-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 (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 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-path x267) (path x266)) (let ((m (if outline-path (org-find-olp (cons (org-capture-expand-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 (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 (time-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 (cond ((and (or (not (boundp 'org-time-was-given)) (not org-time-was-given)) (not (= (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-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 'subtree-at-point))))) (let ((target val)) (error "Invalid capture target specification: %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 ((function x271) (path x269)) (set-buffer (org-capture-target-buffer path)) (org-capture-put-target-region-and-position) (widen) (funcall function) (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 val)) (error "Invalid capture target specification: %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)) (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))))) ((eq x245 'clock) (let* ((x276 (cdr val))) (if (null x276) (progn (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)) (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 specification: %S" target))))) (let ((target val)) (error "Invalid capture target specification: %S" target)))) (org-capture-put :buffer (current-buffer) :pos (point) :target-entry-p target-entry-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)) ((equal 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 orig-buf dired-buffers)))) :original-file-nondirectory (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-time (org-current-time))) (org-capture-set-target-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-keep (org-capture-get :clock-keep)) (if (equal goto 0) (org-capture-insert-template-here) (condition-case error (org-capture-place-template (eq (car (org-capture-get :target)) 'function)) ((error quit) (if (and (buffer-base-buffer (current-buffer)) (string-prefix-p "CAPTURE-" (buffer-name))) (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-get :clock-in)) (condition-case nil (progn (if (org-clock-is-active) (org-capture-put :interrupted-clock (copy-marker org-clock-marker))) (org-clock-in) (set (make-local-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)))))
  (let* ((orig-buf (current-buffer)) (annotation (if (and (boundp 'org-capture-link-is-already-stored) org-capture-link-is-already-stored) (plist-get org-store-link-plist :annotation) (condition-case nil (progn (org-store-link nil)) (error nil)))) (entry (or org-capture-entry (org-capture-select-template keys))) initial) (setq initial (or org-capture-initial (and (org-region-active-p) (buffer-substring (point) (mark))))) (if (stringp initial) (progn (remove-text-properties 0 (length initial) '(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-template) (org-capture-put :original-buffer orig-buf :original-file (or (buffer-file-name orig-buf) (and (featurep 'dired) (car (rassq orig-buf dired-buffers)))) :original-file-nondirectory (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-time (org-current-time))) (org-capture-set-target-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-keep (org-capture-get :clock-keep)) (if (equal goto 0) (org-capture-insert-template-here) (condition-case error (org-capture-place-template (eq (car (org-capture-get :target)) 'function)) ((error quit) (if (and (buffer-base-buffer (current-buffer)) (string-prefix-p "CAPTURE-" (buffer-name))) (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-get :clock-in)) (condition-case nil (progn (if (org-clock-is-active) (org-capture-put :interrupted-clock (copy-marker org-clock-marker))) (org-clock-in) (set (make-local-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))))))
  (cond ((equal goto '(4)) (org-capture-goto-target)) ((equal goto '(16)) (org-capture-goto-last-stored)) (t (let* ((orig-buf (current-buffer)) (annotation (if (and (boundp 'org-capture-link-is-already-stored) org-capture-link-is-already-stored) (plist-get org-store-link-plist :annotation) (condition-case nil (progn (org-store-link nil)) (error nil)))) (entry (or org-capture-entry (org-capture-select-template keys))) initial) (setq initial (or org-capture-initial (and (org-region-active-p) (buffer-substring (point) (mark))))) (if (stringp initial) (progn (remove-text-properties 0 (length initial) '(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-template) (org-capture-put :original-buffer orig-buf :original-file (or (buffer-file-name orig-buf) (and (featurep 'dired) (car (rassq orig-buf dired-buffers)))) :original-file-nondirectory (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-time (org-current-time))) (org-capture-set-target-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-keep (org-capture-get :clock-keep)) (if (equal goto 0) (org-capture-insert-template-here) (condition-case error (org-capture-place-template (eq (car (org-capture-get :target)) 'function)) ((error quit) (if (and (buffer-base-buffer (current-buffer)) (string-prefix-p "CAPTURE-" (buffer-name))) (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-get :clock-in)) (condition-case nil (progn (if (org-clock-is-active) (org-capture-put :interrupted-clock (copy-marker org-clock-marker))) (org-clock-in) (set (make-local-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
-- 
 -... --- .-. . -.. ..--.. ...-.-

  reply	other threads:[~2018-04-08 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 12:33 Bug: master: "Capture abort: (error Format specifier doesn’t match argument type)" Gregor Zattler
2018-04-03  8:26 ` Nicolas Goaziou
2018-04-03 15:58   ` Gregor Zattler
     [not found]     ` <87zi2kvywv.fsf@nicolasgoaziou.fr>
2018-04-07 20:30       ` Gregor Zattler
2018-04-08 13:22         ` Gregor Zattler [this message]
2018-04-05 17:47 ` Gregor Zattler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7udj0i5.fsf@len.workgroup \
    --to=telegraph@gmx.net \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: Bug: master: "Capture abort: (error Format specifier' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).