emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas Holst <thomas_holst@gmx.de>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [bug] in capture
Date: Thu, 17 May 2018 19:17:34 +0200	[thread overview]
Message-ID: <a2447d50-3e4d-b7c0-3ea5-b2c2026a2dc6@gmx.de> (raw)
In-Reply-To: <87fu2rtly4.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 9784 bytes --]

Hi Nicolas,

thank you for looking into this.

To reproduce the error I have to use file+function target. There is no 
error if I use file+headline target.

Here is an ECM:

#+begin_src org
* Setup

#+begin_src emacs-lisp
   (setq org-capture-template nil)

   (setq
    org-capture-templates
    '(("x" "Testing" table-line (file+function 
"~/tmp/capture-bug/ecm.org" th:test-capture)
     "|  |  | %^{Arzt/Apotheke} |"
     :table-line-pos "III-1" :immediate-finish t)))

   (defun th:test-capture ()
     "Sets point to headline"
     (interactive)
     (goto-char (point-min))
     (org-speed-move-safe (quote org-next-visible-heading)))
#+end_src

* testing capture
|---+-----------------+------|
| ! | Datum           | Arzt |
|---+-----------------+------|
|   |                 |      |
|---+-----------------+------|
| # |                 |      |
|---+-----------------+------|
#+end_src

The function "th:test-capture" sets point to beginning of headline 
"testing capture".

I experimented with several point positions (end of the headline, line 
below headline). But none worked. The error stayed the same.

And here is the backtrace:
Debugger entered--Lisp error: (error "Capture template ‘hr’: 
integer-or-marker-p")
   signal(error ("Capture template ‘hr’: integer-or-marker-p"))
   error("Capture template `%s': %s" "hr" integer-or-marker-p)
   (condition-case error (org-capture-place-template (eq (car 
(org-capture-get :target)) (quote 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 (equal goto 0) (org-capture-insert-template-here) (condition-case 
error (org-capture-place-template (eq (car (org-capture-get :target)) 
(quote 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 (quote 
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 (quote 
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 entry "C") (customize-variable (quote 
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 (quote 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)) (quote 
function))) ((error quit) (if (and (buffer-base-buffer ...) 
(string-prefix-p "CAPTURE-" ...)) (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 (quote org-mode)) (org-capture-get :clock-in)) 
(condition-case nil (progn (if (org-clock-is-active) (org-capture-put 
:interrupted-clock ...)) (org-clock-in) (set (make-local-variable ...) 
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 
(quote 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) (quote 
(read-only t)) initial))) (if (stringp annotation) (progn 
(remove-text-properties 0 (length annotation) (quote (read-only t)) 
annotation))) (cond ((equal entry "C") (customize-variable (quote 
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 (quote 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 ...) (quote function))) ((error 
quit) (if (and ... ...) (kill-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 (quote 
org-mode)) (org-capture-get :clock-in)) (condition-case nil (progn (if 
... ...) (org-clock-in) (set ... t)) (error "Could not start the clock 
in this capture buffer"))) (if (org-capture-get :immediate-finish) 
(org-capture-finalize))))))
   (cond ((equal goto (quote (4))) (org-capture-goto-target)) ((equal 
goto (quote (16))) (org-capture-goto-last-stored)) (t (let* ((orig-buf 
(current-buffer)) (annotation (if (and (boundp ...) 
org-capture-link-is-already-stored) (plist-get org-store-link-plist 
:annotation) (condition-case nil (progn ...) (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) (quote (read-only t)) 
initial))) (if (stringp annotation) (progn (remove-text-properties 0 
(length annotation) (quote (read-only t)) annotation))) (cond ((equal 
entry "C") (customize-variable (quote 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 ... ...)) 
:original-file-nondirectory (and (buffer-file-name orig-buf) 
(file-name-nondirectory ...)) :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 ... ...) (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 ...) (... ... ... ...)) (if (and ... ...) 
(condition-case nil ... ...)) (if (org-capture-get :immediate-finish) 
(org-capture-finalize))))))))
   org-capture(nil)
   funcall-interactively(org-capture nil)
   #<subr call-interactively>(org-capture nil nil)
   apply(#<subr call-interactively> org-capture (nil nil))
   call-interactively@ido-cr+-record-current-command(#<subr 
call-interactively> org-capture nil nil)
   apply(call-interactively@ido-cr+-record-current-command #<subr 
call-interactively> (org-capture nil nil))
   call-interactively(org-capture nil nil)
   command-execute(org-capture)

-- 
   Thomas


Am 16.05.2018 um 21:55 schrieb Nicolas Goaziou:
> Hello,
>
> Thomas Holst <thomas_holst@gmx.de> writes:
>
>> I have among other the following template:
>>
>> #+begin_src emacs-lisp
>>    ("hr" "Rechnung erfassen" table-line
>>   � (file+function "~/git/org-priv/Univ_Beih.org"
>> th:capure-find-open-vers-regn)
>>   � "| # | %^u | %^{Arzt/Apotheke} | %^{fr wen|Lida|Oleg|Victor|Simon}
>> | %^{Betrag} | %^u | | [[file:%c][link Beleg]] |"
>>   � :table-line-pos "III-1" :immediate-finish t)
>> #+end_src
>>
>> With org-mode from git I get an error when using this template:
>>
>> : condition-case: Capture template ‘hr’: integer-or-marker-p
> I have too little information to reproduce the problem.
>
> Could you provide a minimal example, i.e., no custom function like
> `th:capure-find-open-vers-regn' and a minimal document where this table
> line is going to be inserted.
>
> Also, I would need the backtrace.
>
> Thank you.
>
>> Was there a change in the syntax I missed?
> No, there wasn't.
>
> Regards,
>


[-- Attachment #2: Type: text/html, Size: 12993 bytes --]

  reply	other threads:[~2018-05-17 17:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 17:26 [bug] in capture Thomas Holst
2018-05-16 19:55 ` Nicolas Goaziou
2018-05-17 17:17   ` Thomas Holst [this message]
2018-05-17 21:01     ` Nicolas Goaziou
2018-05-21 20:23       ` Thomas Holst

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=a2447d50-3e4d-b7c0-3ea5-b2c2026a2dc6@gmx.de \
    --to=thomas_holst@gmx.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).