emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Bug: capture with PROPERTIES [7.4 commit-4760c3b94...]


From: Giovanni Ridolfi
Subject: Re: [Orgmode] Bug: capture with PROPERTIES [7.4 commit-4760c3b94...]
Date: Mon, 13 Dec 2010 16:34:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (windows-nt)

Giovanni Ridolfi <address@hidden> writes:
- sorry for the double post of Friday -

> Emacs  : GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600)
>  of 2010-05-08 on G41R2F1

I can confirm the bug in 7.4 commit 4760c3b9482cfeda02d24590e2fb7c70a9c1d0cd

As the debug-on-error gave me not error :-( 
I put some (debug) calls in org-capture.el:

--- org-capture.el      2010-12-13 16:14:39.086099200 +0100
+++ org-capture-2.el    2010-12-13 16:14:23.443606400 +0100
@@ -1225,9 +1225,14 @@
       (when plist-p
        (goto-char (point-min))
+; 
+      (debug)
        (while (re-search-forward "%\\(:[-a-zA-Z]+\\)" nil t)
          (unless (org-capture-escaped-%)
            (and (setq x (or (plist-get org-store-link-plist
                                        (intern (match-string 1))) ""))
-                (replace-match x t t)))))
+                (replace-match x t t))))
+; 
+      (debug)
+)
 
       ;; Turn on org-mode in temp buffer, set local variables
@@ -1292,4 +1297,6 @@
                ((prop (org-substring-no-properties prompt))
                 (pall (concat prop "_ALL"))
+; 
+      (debug)
                 (allowed
                  (with-current-buffer
@@ -1311,5 +1318,11 @@
                                                  existing nil nil
                                                  "" nil ""))))
-             (org-set-property prop val)))
+             (org-set-property prop val)
+; 
+      (debug)
+)
+; 
+      (debug)
+)
           (char
            ;; These are the date/time related ones
--------------------------------

And calling "my capture template", /repetita iuvant/:

------------------------ test.org FILE: ------------------
     -*- mode: org; -*-

(setq org-capture-templates
'(
("q" "element" entry (file+headline "test.org" "capture") "*** %^{prompt} \n 
:PROPERTIES:\n :ID: lab \n %^{Element}p  \n %^{Number}p \n %^{Type}p \n 
:Feeling: %? \n :Comment:  \n :END:"
)
))
* capture
:PROPERTIES:
:Element_ALL: H He Li Na Hg
:Number_ALL:  1  2  3 4  80
:Type_ALL: gas solid liquid
:END:

-----------------------------------

The capture process stops 
after the insertion of the first PROPERTY
with this *backtrace*:

--------------------------- *backtrace*  ---------
Debugger entered: nil
  (let* ((prop ...) (pall ...) (debug) (allowed ...) (existing ...) (propprompt 
...) (val ...)) (org-set-property prop val) (debug))
  (cond ((member char ...) (let* ... ... ...)) ((equal char "C") (cond ... 
...)) ((equal char "L") (cond ... ...)) ((equal char "p") (let* ... ... ...) 
(debug)) (char (setq org-time-was-given ...) (setq time ...) (if ... ...) 
(org-insert-time-stamp time org-time-was-given ... nil nil ...)) (t (let ... 
...)))
  (if (org-capture-escaped-%) nil (setq char (if ... ...) prompt (if ... ...)) 
(goto-char (match-beginning 0)) (replace-match "") (setq completions nil 
default nil) (when prompt (setq completions ... prompt ... default ... histvar 
... completions ...)) (unless (boundp histvar) (set histvar nil)) (cond (... 
...) (... ...) (... ...) (... ... ...) (char ... ... ... ...) (t ...)))
  (unless (org-capture-escaped-%) (setq char (if ... ...) prompt (if ... ...)) 
(goto-char (match-beginning 0)) (replace-match "") (setq completions nil 
default nil) (when prompt (setq completions ... prompt ... default ... histvar 
... completions ...)) (unless (boundp histvar) (set histvar nil)) (cond (... 
...) (... ...) (... ...) (... ... ...) (char ... ... ... ...) (t ...)))
  (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t) 
(unless (org-capture-escaped-%) (setq char ... prompt ...) (goto-char ...) 
(replace-match "") (setq completions nil default nil) (when prompt ...) (unless 
... ...) (cond ... ... ... ... ... ...)))
  (save-window-excursion (delete-other-windows) (switch-to-buffer 
(get-buffer-create "*Capture*")) (erase-buffer) (insert template) (goto-char 
(point-min)) (org-capture-steal-local-variables buffer) (setq buffer-file-name 
nil) (goto-char (point-min)) (while (re-search-forward "%\\[\\(.+\\)\\]" nil t) 
(unless ... ...)) (goto-char (point-min)) (while (re-search-forward 
"%\\((.+)\\)" nil t) (unless ... ... ...)) (goto-char (point-min)) (while 
(re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) (unless ... ... ...)) (when 
plist-p (goto-char ...) (debug) (while ... ...) (debug)) (let (...) (org-mode)) 
(goto-char (point-min)) (while (re-search-forward 
"%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t) (unless ... ... ... ... ... 
... ... ...)) (goto-char (point-min)) (while (looking-at "[   ]*\n") 
(replace-match "")) (if (re-search-forward "[    \n]*\\'" nil t) (replace-match 
"\n")) (untabify (point-min) (point-max)) (set-buffer-modified-p nil) (prog1 
(buffer-string) (kill-buffer ...)))
  (let* ((buffer ...) (file ...) (ct ...) (dct ...) (ct1 ...) (plist-p ...) 
(v-c ...) (v-x ...) (v-t ...) (v-T ...) (v-u ...) (v-U ...) (v-i ...) (v-a ...) 
(v-a ...) (clipboards ...) (v-A ...) (v-n user-full-name) (v-k ...) (v-K ...) 
v-I (org-startup-folded nil) (org-inhibit-startup t) org-time-was-given 
org-end-time-was-given x prompt completions char time pos default histvar) 
(setq org-store-link-plist (plist-put org-store-link-plist :annotation v-a) 
org-store-link-plist (plist-put org-store-link-plist :initial v-i)) (setq 
initial v-i) (unless template (setq template "") (message "No template") (ding) 
(sit-for 1)) (save-window-excursion (delete-other-windows) (switch-to-buffer 
...) (erase-buffer) (insert template) (goto-char ...) 
(org-capture-steal-local-variables buffer) (setq buffer-file-name nil) 
(goto-char ...) (while ... ...) (goto-char ...) (while ... ...) (goto-char ...) 
(while ... ...) (when plist-p ... ... ... ...) (let ... ...) (goto-char ...) 
(while ... ...) (goto-char ...) (while ... ...) (if ... ...) (untabify ... ...) 
(set-buffer-modified-p nil) (prog1 ... ...)))
  org-capture-fill-template()
  --------------------------
  (org-capture-put :template (org-capture-fill-template))
  ----------------
  (condition-case error (org-capture-put :template (org-capture-fill-template)) 
((error quit) (if ... ...) (error "Capture abort: %s" error)))
  (cond ((equal entry "C") (customize-variable ...)) ((equal entry "q") (error 
"Abort")) (t (org-capture-set-plist entry) (org-capture-get-template) 
(org-capture-put :original-buffer orig-buf :annotation annotation :initial 
initial) (org-capture-put :default-time ...) (org-capture-set-target-location) 
(condition-case error ... ...) (if ... ... ... ...)))
  (let* ((orig-buf ...) (annotation ...) (initial ...) (entry ...)) (when 
(stringp initial) (remove-text-properties 0 ... ... initial)) (when (stringp 
annotation) (remove-text-properties 0 ... ... annotation)) (cond (... ...) (... 
...) (t ... ... ... ... ... ... ...)))
  (cond ((equal goto ...) (org-capture-goto-target)) ((equal goto ...) 
(org-capture-goto-last-stored)) (t (let* ... ... ... ...)))
  org-capture(nil)
  -----------
  call-interactively(org-capture nil nil)
  recursive-edit()
  byte-code("\306      
@\307=\203!\310\311\312\"\210\313\311!\211A@)\242\314=\203!\310\315\312\"\210\316!\210\317
 \210\320 !\210\f\203d\321ed\"
V\203Web\210\322
\245y\210`db\210\322
\245
Zy\210`|\210)\323c\210eb\210\324\325\326 
\"\210\327\306!\210\324\330!\210\331\312\324\330!\210\212\332 
\210+\331\207" [unread-command-char debugger-args x debugger-buffer 
noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t 
backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer 
count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil 
recursive-edit middlestart buffer-read-only standard-output] 4)
----------------------------------------------------
there are some "Non-printable characters" in the last line

And this is capture buffer:

------------------- *Capture* - buffer-----------------
*** test 4760c3b
 :PROPERTIES:
 :ID: lab 
   
 %^{Number}p 
 %^{Type}p 
 :Feeling: %? 
 :Comment:  
 :Element:  He
 :END:
--------------------------------------------------------

hth with debugging

cheers,
Giovanni



reply via email to

[Prev in Thread] Current Thread [Next in Thread]