From: Ihor Radchenko <yantar92@posteo.net>
To: Carlo Tambuatco <oraclmaster@gmail.com>
Cc: Org-Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
Date: Sun, 16 Apr 2023 12:12:34 +0000 [thread overview]
Message-ID: <87edokt499.fsf@localhost> (raw)
In-Reply-To: <CAJb92Ez-BVLw3rkV3iA8VosRZ3+K3tvw-UoWn0orqmEf3QWLRw@mail.gmail.com>
Carlo Tambuatco <oraclmaster@gmail.com> writes:
> I restarted emacs with org 9.6.3 and reloaded it uncompiled and
> did M-x toggle-debug-on-error to turn on backtrace on error.
>
> I have also attached a copy of what my org-capture-templates
> variable looks like.
>
> Comparing these backtraces to my org-capture-templates,
> you can see that only some of them fail (the ones corresponding to
> 'd', 'e', 'r', 'Rr', 'Rg', and 'Cc')
>
> They all worked up until Org 9.6. They still work under Org 9.5.5, so
> I don't know what changed.
I tried your templates locally and I am not seeing any problem.
May you try to reproduce starting from emacs -Q?
Or, alternatively, try to use the following version of Org capture, use
C-g to exit, and report the (hopefully) more detailed backtrace.
(defun org-capture (&optional goto keys)
"Capture something.
\\<org-capture-mode-map>
This will let you select a template from `org-capture-templates', and
then file the newly captured information. The text is immediately
inserted at the target location, and an indirect buffer is shown where
you can edit it. Pressing `\\[org-capture-finalize]' brings you back to the \
previous
state of Emacs, so that you can continue your work.
When called interactively with a `\\[universal-argument]' prefix argument \
GOTO, don't
capture anything, just go to the file/headline where the selected
template stores its notes.
With a `\\[universal-argument] \\[universal-argument]' prefix argument, go to \
the last note stored.
When called with a `C-0' (zero) prefix, insert a template at point.
When called with a `C-1' (one) prefix, force prompting for a date when
a datetree entry is made.
ELisp programs can set KEYS to a string associated with a template
in `org-capture-templates'. In this case, interactive selection
will be bypassed.
If `org-capture-use-agenda-date' is non-nil, capturing from the
agenda will use the date at point as the default date. Then, a
`C-1' prefix will tell the capture process to use the HH:MM time
of the day at point (if any) or the current HH:MM time."
(interactive "P")
(when (and org-capture-use-agenda-date
(eq major-mode 'org-agenda-mode))
(setq org-overriding-default-time
(org-get-cursor-date (equal goto 1))))
(cond
((equal goto '(4)) (org-capture-goto-target keys))
((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)
(ignore-errors (org-store-link 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)))))
(when (stringp initial)
(remove-text-properties 0 (length initial) '(read-only t) initial))
(when (stringp annotation)
(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 (and (equal goto 0) 'here))
(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-message-string error))))
(setq org-capture-clock-keep (org-capture-get :clock-keep))
(org-capture-place-template
(eq (car (org-capture-get :target)) 'function))
(when (and (derived-mode-p 'org-mode) (org-capture-get :clock-in))
(condition-case nil
(progn
(when (org-clock-is-active)
(org-capture-put :interrupted-clock
(copy-marker org-clock-marker)))
(org-clock-in)
(setq-local org-capture-clock-was-started
(copy-marker org-clock-marker)))
(error "Could not start the clock in this capture buffer")))
(when (org-capture-get :immediate-finish)
(org-capture-finalize))))))))
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-04-16 12:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 19:53 [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree' Carlo Tambuatco
2023-04-04 8:54 ` Ihor Radchenko
2023-04-04 10:14 ` Carlo Tambuatco
2023-04-04 10:19 ` Ihor Radchenko
2023-04-04 10:25 ` Carlo Tambuatco
2023-04-04 11:24 ` Ihor Radchenko
2023-04-16 3:34 ` Carlo Tambuatco
2023-04-16 12:12 ` Ihor Radchenko [this message]
2023-04-17 10:40 ` Carlo Tambuatco
2023-06-06 15:03 ` Carlo Tambuatco
2023-06-07 11:29 ` Ihor Radchenko
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=87edokt499.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=oraclmaster@gmail.com \
/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).