emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
@ 2023-04-03 19:53 Carlo Tambuatco
  2023-04-04  8:54 ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Carlo Tambuatco @ 2023-04-03 19:53 UTC (permalink / raw)
  To: Org-Mode Mailing List

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

This is a bug that started with org-9.6, and has persisted up until now. I
have stayed
with org-9.5.5 waiting until this is resolved, but it has not as of yet.

What happens is, for certain org templates that I run, the buffer simply
freezes and displays a message: clipboard pasted as level 2 subtree'.

Emacs then becomes unresponsive. All I can do is force quit and restart
emacs.

All of my templates worked perfectly up until 9.5.5, and most of them still
work.
It is only with 4 or 5 of them that cause this issue. I do not think it is
a syntax
issue, as they worked before, but has any syntax for defining org templates
changed
with the 9.6.x releases?

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-04-04  8:54 UTC (permalink / raw)
  To: Carlo Tambuatco; +Cc: Org-Mode Mailing List

Carlo Tambuatco <oraclmaster@gmail.com> writes:

> This is a bug that started with org-9.6, and has persisted up until now. I
> have stayed
> with org-9.5.5 waiting until this is resolved, but it has not as of yet.
>
> What happens is, for certain org templates that I run, the buffer simply
> freezes and displays a message: clipboard pasted as level 2 subtree'.
>
> Emacs then becomes unresponsive. All I can do is force quit and restart
> emacs.

Does C-g work?
If it does, may you run M-x toggle-debug-on-quit, trigger the hand,
press, C-g, and then share the backtrace?

-- 
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-04  8:54 ` Ihor Radchenko
@ 2023-04-04 10:14   ` Carlo Tambuatco
  2023-04-04 10:19     ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Carlo Tambuatco @ 2023-04-04 10:14 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode Mailing List

I tried M-x toggle-debug-on-quit like you said, then I tried to run one of my 
capture templates. It froze on ‘clipboard pasted as level 2 subtree’, again, then 
I did C-g to quit, but then it just quits out of creating the template. I think it 
is some bug during the copy paste step when it is pasting information from 
the template to the subtree, but I don’t know the technical details.

I don’t see any backtrace. 

It is weird, because SOME of my templates still work. But all of my templates 
worked perfectly before 9.6.x. Now some of them are giving me this error. 



> On Apr 4, 2023, at 4:54 AM, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> Carlo Tambuatco <oraclmaster@gmail.com> writes:
> 
>> This is a bug that started with org-9.6, and has persisted up until now. I
>> have stayed
>> with org-9.5.5 waiting until this is resolved, but it has not as of yet.
>> 
>> What happens is, for certain org templates that I run, the buffer simply
>> freezes and displays a message: clipboard pasted as level 2 subtree'.
>> 
>> Emacs then becomes unresponsive. All I can do is force quit and restart
>> emacs.
> 
> Does C-g work?
> If it does, may you run M-x toggle-debug-on-quit, trigger the hand,
> press, C-g, and then share the backtrace?
> 
> -- 
> 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>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-04 10:14   ` Carlo Tambuatco
@ 2023-04-04 10:19     ` Ihor Radchenko
  2023-04-04 10:25       ` Carlo Tambuatco
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-04-04 10:19 UTC (permalink / raw)
  To: Carlo Tambuatco; +Cc: Org-Mode Mailing List

Carlo Tambuatco <oraclmaster@gmail.com> writes:

> I tried M-x toggle-debug-on-quit like you said, then I tried to run one of my 
> capture templates. It froze on ‘clipboard pasted as level 2 subtree’, again, then 
> I did C-g to quit, but then it just quits out of creating the template. I think it 
> is some bug during the copy paste step when it is pasting information from 
> the template to the subtree, but I don’t know the technical details.
>
> I don’t see any backtrace. 

Hmm.
Do you happen to use GTK Emacs build?

-- 
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-04 10:19     ` Ihor Radchenko
@ 2023-04-04 10:25       ` Carlo Tambuatco
  2023-04-04 11:24         ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Carlo Tambuatco @ 2023-04-04 10:25 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode Mailing List

I installed emacs from emacs-plus@28 formula on homebrew for macOS Ventura.

So, I don’t think it is teh GTK emacs build…



> On Apr 4, 2023, at 6:19 AM, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> Carlo Tambuatco <oraclmaster@gmail.com> writes:
> 
>> I tried M-x toggle-debug-on-quit like you said, then I tried to run one of my 
>> capture templates. It froze on ‘clipboard pasted as level 2 subtree’, again, then 
>> I did C-g to quit, but then it just quits out of creating the template. I think it 
>> is some bug during the copy paste step when it is pasting information from 
>> the template to the subtree, but I don’t know the technical details.
>> 
>> I don’t see any backtrace. 
> 
> Hmm.
> Do you happen to use GTK Emacs build?
> 
> -- 
> 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>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-04 10:25       ` Carlo Tambuatco
@ 2023-04-04 11:24         ` Ihor Radchenko
  2023-04-16  3:34           ` Carlo Tambuatco
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-04-04 11:24 UTC (permalink / raw)
  To: Carlo Tambuatco; +Cc: Org-Mode Mailing List

Carlo Tambuatco <oraclmaster@gmail.com> writes:

> I installed emacs from emacs-plus@28 formula on homebrew for macOS Ventura.
>
> So, I don’t think it is teh GTK emacs build…

I see.
Then, may you try to create a minimal reproducer?
See https://orgmode.org/manual/Feedback.html#Feedback

-- 
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-04 11:24         ` Ihor Radchenko
@ 2023-04-16  3:34           ` Carlo Tambuatco
  2023-04-16 12:12             ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Carlo Tambuatco @ 2023-04-16  3:34 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 3296 bytes --]

Sorry it took so long to get a backtrace going...I've been really busy.

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.

These backtraces were produced when I hit C-g to abort a
capture template that got stuck on
'clipboard pasted as level 2 subtree',

Let me know what you think.

Here are some of the backtraces generated:

Debugger entered--Lisp error: (error "Capture template ‘d’: Quit")
  signal(error ("Capture template ‘d’: Quit"))
  error("Capture template `%s': %s" "d" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

Debugger entered--Lisp error: (error "Capture template ‘e’: Quit")
  signal(error ("Capture template ‘e’: Quit"))
  error("Capture template `%s': %s" "e" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

Debugger entered--Lisp error: (error "Capture template ‘r’: Quit")
  signal(error ("Capture template ‘r’: Quit"))
  error("Capture template `%s': %s" "r" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

Debugger entered--Lisp error: (error "Capture template ‘Rr’: Quit")
  signal(error ("Capture template ‘Rr’: Quit"))
  error("Capture template `%s': %s" "Rr" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

Debugger entered--Lisp error: (error "Capture template ‘Rg’: Quit")
  signal(error ("Capture template ‘Rg’: Quit"))
  error("Capture template `%s': %s" "Rg" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

Debugger entered--Lisp error: (error "Capture template ‘Cc’: Quit")
  signal(error ("Capture template ‘Cc’: Quit"))
  error("Capture template `%s': %s" "Cc" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

On Tue, Apr 4, 2023 at 7:21 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Carlo Tambuatco <oraclmaster@gmail.com> writes:
>
> > I installed emacs from emacs-plus@28 formula on homebrew for macOS
> Ventura.
> >
> > So, I don’t think it is teh GTK emacs build…
>
> I see.
> Then, may you try to create a minimal reproducer?
> See https://orgmode.org/manual/Feedback.html#Feedback
>
> --
> 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>
>

[-- Attachment #1.2: Type: text/html, Size: 4905 bytes --]

[-- Attachment #2: org-capture-templates.el --]
[-- Type: application/octet-stream, Size: 5765 bytes --]

(setf org-capture-templates '(("N" "New Note")
                              ("Np" "Personal Note" entry (file+headline
                                                          "~/Documents/Org/Personal/Notes.org"
                                                          "Personal Notes")
                               "* %? \nCaptured On: %t \n%i\n" :empty-lines 1)

                              ("Ns" "Study Note" entry (file+headline
                                                       "~/Documents/Org/Programming/Notes.org"
                                                       "Study Notes")
                               "* %? \nCaptured On: %t \n%i\n" :empty-lines 1)

                              ("Nw" "Work Note" entry (file+headline
                                                       "~/Documents/Org/Work/Notes.org"
                                                       "Work Notes")
                               "* %? \nCaptured On: %^t \n%i\n" :empty-lines 1)
			      ("a" "Appointment" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Appointments")
                               "* TODO %? \nSCHEDULED: %^{when}t DEADLINE: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:END:\n" :empty-lines 1)

                              ("d" "Due Date" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Due Dates")
                               "* TODO %? \nDEADLINE: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|recursive|nil}p\n:END:\n" :empty-lines 1)

                              ("e" "Event" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Events")
                               "* TODO %? \nSCHEDULED: %^{when}t\n" :empty-lines 1)
			      ("t" "TV Show" entry (file+headline
                                                        "~/Documents/Org/Personal/TV_Schedule.org"
                                                        "Current TV Shows:")
                               "* WATCH %? [/]\nSCHEDULED: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|checkbox recursive|recursive|nil}p\n:Network: %^{Network|Netflix|AZ Prime|HBO|Cinemax|Showtime|CW|AMC|FX|Fox|Facebook|USA|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:STYLE: %^{STYLE|habit|nil}p\n:END:\n:LOGBOOK:\n:END:\nEpisodes:\n1. [ ] " :empty-lines 1)

                              ("m" "Movies / TV / Streaming Events" entry (file+headline
                                                        "~/Documents/Org/Personal/TV_Schedule.org"
                                                        "Movies / TV / Streaming Events")
                               "* WATCH %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:Network: %^{Network|Netflix|AZ Prime|HBO|Cinemax|Showtime|CW|AMC|FX|Fox|USA|DVD|nil}p\n:END:\n" :empty-lines 1)

			      ("B" "New Book")
			      ("Bn" "Novel" entry (file+headline
						   "~/Documents/Org/Personal/Books_Read.org"
						   "Novels Read")
			       "* TODO %? \n:PROPERTIES:\n:AUTHOR: %^{AUTHOR}p\n:END:\n"
			       :empty-lines 1)

			      ("Bf" "Nonfiction" entry (file+headline
						   "~/Documents/Org/Personal/Books_Read.org"
						   "Nonfiction Read")
			       "* TODO %? \n:PROPERTIES:\n:AUTHOR: %^{AUTHOR}p\n:TOPIC: %^{TOPIC}p\n:END:\n"
			       :empty-lines 1)

                              ("r" "Race" entry (file+headline
                                                 "~/Documents/Org/Personal/Workouts.org"
                                                 "Scheduled Races")
                               "* RACE %? \nSCHEDULED: %^{when}t" :empty-lines 1)

                              ("R" "New Reminder")

                              ("Rr" "Reminder" entry (file+headline
                                                     "~/Documents/Org/Personal/Personal_Schedule.org"
                                                     "Reminders")
                               "* TODO %? \n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:STYLE: %^{STYLE|habit|nil}p\n:END:\n" :empty-lines 1)

                              ("Rg" "Game Release Date" entry (file+headline
                                                     "~/Documents/Org/Personal/Personal_Schedule.org"
                                                     "Reminders")
                               "* TODO %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:Console: %^{Console|PS5|PC}p\n:END:\n" :empty-lines 1)

			      ("C" "New Chore(s)/Task(s)")

                              ("Cc" "Chore" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Chores")
                               "* TODO %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|checkbox recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:STYLE: %^{STYLE|nil|habit}p\n:CATEGORY: %^{CATEGORY|nil|Daily_Chores}p\n:END:\n" :empty-lines 1)

			      ("Ct" "Task" entry (file+headline
						 "~/Documents/Org/Personal/Personal_Schedule.org"
						 "Tasks")
			       "* TODO %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|checkbox recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:END:\n" :empty-lines 1)
			      ))

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-16  3:34           ` Carlo Tambuatco
@ 2023-04-16 12:12             ` Ihor Radchenko
  2023-04-17 10:40               ` Carlo Tambuatco
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-04-16 12:12 UTC (permalink / raw)
  To: Carlo Tambuatco; +Cc: Org-Mode Mailing List

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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-16 12:12             ` Ihor Radchenko
@ 2023-04-17 10:40               ` Carlo Tambuatco
  2023-06-06 15:03                 ` Carlo Tambuatco
  0 siblings, 1 reply; 11+ messages in thread
From: Carlo Tambuatco @ 2023-04-17 10:40 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode Mailing List

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

I've decided to delete the org-9.6 folder entirely and go with the
built-in org-9.5.5 that comes with my emacs distribution, emacs-28.2 (9.0).

Maybe for some reason newer versions of org are just incompatible with
my version of emacs 28.2. Maybe the version of emacs you're using is
newer or somehow more compatible with these bleeding edge development
versions of org-mode, but I suppose when I upgrade my emacs the version
of org that comes with it (9.6, I suppose) will just work out of the box.

At any rate, I can't spend any more time and energy on this. I'll stick to
what works. Thanks for the help.

On Sun, Apr 16, 2023 at 8:09 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> 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>
>

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-04-17 10:40               ` Carlo Tambuatco
@ 2023-06-06 15:03                 ` Carlo Tambuatco
  2023-06-07 11:29                   ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Carlo Tambuatco @ 2023-06-06 15:03 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 7550 bytes --]

Hey Ihor, I recently upgraded my emacs to emacs@29 via homebrew, and I know
this is an
old thread, but now that my new emacs version comes with org-9.6.6, I am
getting the same
issues as I detailed in this thread with my org capture templates. I tried
to do a reproduce
with emacs -q but the error does not reproduce in those conditions, so it
might be an issue
with org mode interacting with some of my other packages installed.

I will include a list of emacs packages I have installed, and my
org-init.el file. Maybe you
could see if anything jumps out at you that is causing this weird behavior.

On Mon, Apr 17, 2023 at 6:40 AM Carlo Tambuatco <oraclmaster@gmail.com>
wrote:

> I've decided to delete the org-9.6 folder entirely and go with the
> built-in org-9.5.5 that comes with my emacs distribution, emacs-28.2 (9.0).
>
> Maybe for some reason newer versions of org are just incompatible with
> my version of emacs 28.2. Maybe the version of emacs you're using is
> newer or somehow more compatible with these bleeding edge development
> versions of org-mode, but I suppose when I upgrade my emacs the version
> of org that comes with it (9.6, I suppose) will just work out of the box.
>
> At any rate, I can't spend any more time and energy on this. I'll stick to
> what works. Thanks for the help.
>
> On Sun, Apr 16, 2023 at 8:09 AM Ihor Radchenko <yantar92@posteo.net>
> wrote:
>
>> 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>
>>
>

[-- Attachment #1.2: Type: text/html, Size: 9614 bytes --]

[-- Attachment #2: emacs-packages.txt --]
[-- Type: text/plain, Size: 5022 bytes --]

0blayout-readme.txt
a-20210929.1510
abyss-theme-readme.txt
ac-anaconda-readme.txt
ac-html-20151005.731
ac-html-angular-readme.txt
ac-html-csswatcher-readme.txt
ac-ispell-20151101.226
ac-php-20230522.1329
ac-php-core-20230529.1404
ac-python-20110519
ac-slime-20171027.2100
ace-flyspell-readme.txt
achievements-readme.txt
adjust-parens-readme.txt
aio-20200610.1904
alert-20221213.1619
archives
async-20230528.622
atom-dark-theme-20220114.1902
auctex-13.2.0
auctex-13.2.0.signed
auto-complete-20221231.1633
bbdb-20220706.433
bind-key-20230203.2004
chess-2.0.5
chess-2.0.5.signed
cider-1.7.0
clojure-mode-5.16.0
coffee-mode-20200315.1133
commenter-20160219.1627
company-20230416.2034
company-irony-20190124.2346
compat-29.1.4.1
compat-29.1.4.1.signed
concurrent-20170601.435
creole-20140924.1500
csv-readme.txt
ctable-20210128.629
dart-mode-20220401.0
dash-20230502.1324
db-20140421.2111
db-pg-readme.txt
db-readme.txt
deferred-20170901.1330
ebf-readme.txt
eclim-readme.txt
eglot-20221020.1010
eldoc-1.14.0
eldoc-1.14.0.signed
elnode-20190702.1509
elpy-20230402.1946
env-var-import-2.1
epc-20140610.534
epl-20180205.2049
ess-20230419.1527
exec-path-from-shell-20220826.1535
extend-dnd-readme.txt
eyuml-readme.txt
f-20230116.1032
fakir-20140729.1652
flycheck-20230306.414
flycheck-irony-20180604.2152
flycheck-kotlin-20230111.1907
flycheck-nimsuggest-20171027.2208
flycheck-perl6-20180509.2201
flycheck-swift-readme.txt
flymake-1.3.4
flymake-1.3.4.signed
flyspell-correct-readme.txt
geeknote-readme.txt
gh-readme.txt
git-commit-20230521.2344
gntp-20141025.250
gnupg
gnuplot-20230323.1400
gnuplot-mode-20171013.1616
gnuplot-mode-readme.txt
go-mode-20221228.1706
gradle-mode-20150313.1905
hackernews-readme.txt
helm-20230529.1452
helm-core-20230505.802
helm-perldoc-readme.txt
helm-projectile-20221215.613
highlight-indentation-20210221.1418
horoscope-readme.txt
ht-20230214.1632
htmlize-20200816.746
htmlize-20210825.2150
humanoid-themes-20230308.2129
indium-20210309.1210
inkpot-theme-20230511.116
ipython.el
irony-20220110.849
irony-eldoc-20200622.2214
ivy-20230410.1815
japanlaw-readme.txt
jdee-20191102.1426
jedi-20191011.1750
jedi-core-20210503.1315
js2-mode-20230509.2244
js2-refactor-20210306.2003
json-process-client-20210525.733
julia-mode-20230510.745
kotlin-mode-20230123.1859
kubernetes-readme.txt
kv-20140108.1534
latex-extra-20220817.5
let-alist-1.0.6
let-alist-1.0.6.signed
log4e-20211019.948
lsp-mode-20230524.1820
lua-mode-20221218.605
lv-20200507.1518
macrostep-20230518.1911
magit-20230530.1403
magit-section-20230521.1803
markdown-mode+-20170320.2104
markdown-mode-20230522.147
meghanada-readme.txt
memoize-20200103.2036
modus-operandi-theme-20201114.729
modus-vivendi-theme-20201114.729
multiple-cursors-20230309.1204
muse-3.20.2
muse-3.20.2.signed
muse-readme.txt
nim-mode-20211102.917
noflet-20141102.1454
ob-kotlin-20180823.1321
orca-readme.txt
org-9.5.5
org-ac-readme.txt
org-agenda-property-readme.txt
org-alert-20230520.1449
org-analyzer-20191001.1717
org-autolist-20220530.1620
org-board-readme.txt
org-brain-readme.txt
org-bullets-20200317.1740
org-category-capture-readme.txt
org-chef-readme.txt
org-dropbox-readme.txt
org-ehtml-readme.txt
org-evil-readme.txt
org-gcal-20221212.1817
org-grep-20230424.2005
org-if-readme.txt
org-kanban-readme.txt
org-mind-map-readme.txt
org-notebook-readme.txt
org-outlook-readme.txt
org-random-todo-readme.txt
org-recur-readme.txt
org-super-agenda-readme.txt
org-tree-slide-readme.txt
orgit-readme.txt
orglue-readme.txt
osx-dictionary-readme.txt
osx-plist-readme.txt
paredit-20221127.1452
parseclj-20220422.936
parseedn-20220520.835
pdf-tools-20230404.327
perl6-mode-20200414.1930
persist-0.5
persist-0.5.signed
php-extras-2.2.0.20140405
php-mode-20230521.1700
pinentry-0.1
pinentry-0.1.signed
pinentry-readme.txt
pkg-info-20150517.1143
podcaster-readme.txt
popup-20221231.1634
project-0.9.8
project-0.9.8.signed
projectile-20230317.1101
python-environment-20150310.853
python-info-20151228.1852
python-mode-20230515.722
pyvenv-20211014.707
queue-0.2
queue-0.2.signed
reformatter-20220627.825
request-20230127.417
request-deferred-20220614.1604
rg-20230430.721
ruby-additional-readme.txt
rust-mode-20230112.27
rustic-20230130.912
rw-hunspell-0.2
s-20220902.1511
seq-2.22
seq-2.22.signed
seq-2.23
seq-2.23.signed
sesman-20190909.1754
sesman-20210901.1134
skype-readme.txt
slime-20230314.915
solarized-theme-20230507.1413
spacemacs-theme-20230530.1751
spinner-1.7.4
spinner-1.7.4.signed
swank-cdt-1.0.1
sweetgreen-readme.txt
swift-mode-20230507.717
swift3-mode-readme.txt
swiper-20230410.1815
swiper-helm-20180131.1744
swiper-helm-readme.txt
sx-readme.txt
tNFA-readme.txt
tablist-20230321.705
test-simple-readme.txt
transient-20230601.1854
try-20181204.236
try-readme.txt
use-package-20230426.2324
vs-dark-theme-20230415.435
web-20141231.2001
web-mode-20230329.601
wgrep-20230203.1214
winum-20190911.1607
with-editor-20230511.2142
worf-readme.txt
xcscope-20210719.828
xref-1.6.3
xref-1.6.3.signed
xterm-color-20230321.3
yasnippet-20200604.246
zig-mode-20230307.1215

[-- Attachment #3: org-init.el --]
[-- Type: application/octet-stream, Size: 24081 bytes --]

;; org-init.el --- Org mode initialization settings

;; Copyright (C) 2017 Free Software Foundation, Inc.
;;
;; Author: Carlo Tambuatco <carloftambuatco@iMac.local>
;; Maintainer: Carlo Tambuatco <carloftambuatco@iMac.local>
;; Created: 22 Sep 2017
;; Version: 0.01
;; Keywords

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.



;; Initialize Org Mode
(require 'org)
;(require 'org-install) ; Not required with emacs@29
(require 'org-gcal)
(require 'org-autolist)
(require 'pinentry)
(require 'org-analyzer)
(require 'org-alert)
(require 'org-attach-git)

;;; Load Org markdown exporter
(require 'ox-md nil t)

;;;Customize org modules
(setq org-modules '(ol-bbdb
                      ol-gnus
                      org-habit
                      ol-irc
                      org-mouse
                      org-crypt
                      org-protocol
                      ol-w3m
                      ol-bibtex
                      ol-docview
                      ol-info
                      ol-mhe
                      ol-rmail))

(eval-after-load 'org
 '(org-load-modules-maybe t))

;;; Set default alert system
(setq alert-default-style 'notifier)
;;; Set default interval for receiving alerts
;;; Set to 120 minutes
(setq org-alert-interval (* 2 60 60))
;;; Enable Org Alert
(org-alert-enable)

;;; Use org-bullets to make everything nice and awesome
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))

;;; Enable autolist mode in all org buffers
(add-hook 'org-mode-hook (lambda () (org-autolist-mode)))

;;;Org directory
(setf org-directory "~/Documents/Org")

;;;Directory for Org-Analyzer
(setf org-analyzer-directory "~/Documents/Org/Programming/")

;;;Org mode keybindings
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda-list)
(global-set-key "\C-cA" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(global-set-key (kbd "<f5>") 'org-revert-all-org-buffers)
;;;(if (display-graphic-p) (global-set-key (kbd "<f5>") 'org-agenda))
;;;Open all directory links in dired
(add-to-list 'org-file-apps '(directory . emacs))

;;;Org Habit Column Graph
(setq org-habit-graph-column 70)
(setq org-habit-show-habits-only-for-today nil)

;;;Org default span for agenda view
(setq org-agenda-span 'day)

;;;Keep log times hidden
(setq org-log-into-drawer "LOGBOOK")
(setq org-clock-into-drawer 1)

;;;Set behavior of scheduled items with deadlines
;; Non-nil means skip scheduling line if same entry shows because of deadline.

;; In the agenda of today, an entry can show up multiple times
;; because it is both scheduled and has a nearby deadline, and maybe
;; a plain time stamp as well.

;; When this variable is nil, the entry will be shown several times.

;; When set to t, then only the deadline is shown and the fact that
;; the entry is scheduled today or was scheduled previously is not
;; shown.

;; When set to the symbol ‘not-today’, skip scheduled previously,
;; but not scheduled today.

;; When set to the symbol ‘repeated-after-deadline’, skip scheduled
;; items if they are repeated beyond the current deadline.
(setq org-agenda-skip-scheduled-if-deadline-is-shown 'repeated-after-deadline)

;;;Enable org property inheritance
(setq org-use-property-inheritance t)

;;Disable auto-saving
(setq auto-save-default nil)


;; Set Org directories [Remember to update with journal books]
(setq org-agenda-files (list "~/Documents/Org"
                             "~/Documents/Org/Personal"
                             "~/Documents/Org Journals/Training"
                             "~/Documents/Org/Programming"
                             "~/Documents/Org/Work"
                             "~/Documents/Org Journals/Programming Journal"))

;;;Set TODO default sequence
(setq org-todo-keywords
      '((sequence "TODO(t)" "IN_PROGRESS(i)" "|" "DONE(d!)" "POSTPONED(p@)" "CANCELLED(c@)")
        (sequence "TEST(e)" "TESTING(s)" "|" "PASS(p!)" "FAIL(f@)")))

;;;Set TODO keyword faces
(setq org-todo-keyword-faces
      '(("TODO" . (:foreground "#FFAAAA"))
        ("TEST" . (:foreground "#FFAAAA"))
        ("PRACTICE" . (:foreground "#FFAAAA"))
        ("STUDY" . (:foreground "#FFAAAA"))
        ("THEORY" . (:foreground "#FFAAAA"))
        ("WORKOUT" . (:foreground "#9EC9EA" :underline t))
        ("RACE" . (:foreground "#FAFA01" :weight bold))
        ("WATCH" . (:foreground "#FD00D6"))
        ("IN_PROGRESS" . (:foreground "#00E0E7"))
        ("TESTING" . (:foreground "#00E0E7"))
        ("POSTPONED" . (:foreground "#FF7700"))
        ("CANCELLED" . (:foreground "#D42800" :weight bold))
        ("MISSED" . (:foreground "#D42800" :weight bold))
	("IGNORED" . (:foreground "#D72800" :weight bold))
        ("FAIL" . (:foreground "#D42800" :weight bold))))

;;;Set lowest priority to G (ascii 71) for seven piority levels
(setq org-lowest-priority 71)

;;;Org mode log TODO timestamp
(setq org-log-done 'time)

;;;(setq org-agenda-log-mode-items '(closed clock))

;;;Org mode use am/pm time grid style
(setq org-agenda-timegrid-use-ampm t)

;;;Archiving Directory for completed tasks
(setq org-archive-location "~/Documents/Org/Completed.org::* From %s")

;;;Org enforce ordered properties, blocking
(setq org-enforce-todo-dependencies t)

;;;Turn on abbrev-mode in org-mode
(add-hook 'org-mode-hook 'abbrev-mode)
(add-hook 'org-mode-hook 'helm-mode)
(add-hook 'org-mode-hook (lambda () (global-auto-complete-mode -1)))

;; Enable symmetric encrpytion support
(require 'org-crypt)
(setq epg-gpg-program "gpg")
(org-crypt-use-before-save-magic)
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
;; GPG key to use for encryption
;; Either the Key ID or set to nil to use symmetric encryption.
(setq org-crypt-key nil)
(setf epa-pinentry-mode 'loopback)
(pinentry-start)
;(fset 'epg-wait-for-status 'ignore) ;; gpg tends to stall on encryption

;; Set the encoding to utf-8
(setq org-export-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(set-charset-priority 'unicode)
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))

;;iCalendar export file settings
(setq org-icalendar-include-todo t)
(setq org-icalendar-use-deadline '(event-if-todo todo-due))
(setq org-icalendar-use-scheduled '(event-if-todo))

;; Don't allow editing of folded regions
(setq org-catch-invisible-edits 'error)

;; Start the weekly agenda on Monday
(setq org-agenda-start-on-weekday 1)

;; Enable indentation view, does not effect file.
(setq org-startup-indented t)

;; Make attachments be copied / assigned a uuid
;; and placed in a appropiate folder
(setq org-id-method (quote uuidgen))
(setq org-attach-directory "attach/")

(setq org-tag-persistent-alist '(("@coding" . ?x) ("@design" . ?d)
                                 ("@studying" . ?s) ("@errands" . ?e)
                                 ("@purchases" . ?p) ("crypt" . ?c)
                                 ("@important" . ?i) ("@chore" . ?h)
                                 ("@appointment" . ?a) ("@subject" . ?b)
                                 ("@entertainment" . ?m) ("@event" . ?v)
                                 ("@project" . ?j) ("@reminder" . ?r)))

;; Sync Google calendars to your org files
(require 'org-gcal)

;; Org Grep
;; see https://github.com/pinard/org-grep for usage
(autoload 'org-grep "org-grep" nil t)
(define-key org-mode-map "\C-cng" 'org-grep-full)
(define-key org-mode-map "\C-cog" 'org-grep)

;;Convert all lines in a selected region to an unordered list
(defun org-convert-lines-to-checklist (beg end)
  "Convert all plain lines in region to a plain list with
checkboxes."
  (interactive "r")
  (save-excursion
    (goto-char beg)
    (dotimes (_ (- (line-number-at-pos end) (line-number-at-pos beg)))
      (insert "- [ ] ")
      (indent-according-to-mode)
      (forward-line 1))))

(defun org-convert-lines-to-unordered-list (beg end)
  "Convert all plain lines in region to a plain list without
checkboxes."
  (interactive "r")
  (save-excursion
    (goto-char beg)
    (dotimes (_ (- (line-number-at-pos end) (line-number-at-pos beg)))
      (insert "- ")
      (indent-according-to-mode)
      (forward-line 1))))

;; Org capture settings


;; Allow setting of tags withing org capture buffer
(add-hook 'org-capture-mode-hook
          (lambda ()
            (save-restriction
              (widen)
              (setq-local org-tag-alist (org-get-buffer-tags)))))

;; Org capture templates
(setf org-capture-templates '(("N" "New Note")
                              ("Np" "Personal Note" entry (file+headline
                                                          "~/Documents/Org/Personal/Notes.org"
                                                          "Personal Notes")
                               "* %? \nCaptured On: %t \n%i\n" :empty-lines 1)

                              ("Ns" "Study Note" entry (file+headline
                                                       "~/Documents/Org/Programming/Notes.org"
                                                       "Study Notes")
                               "* %? \nCaptured On: %t \n%i\n" :empty-lines 1)

                              ("Nw" "Work Note" entry (file+headline
                                                       "~/Documents/Org/Work/Notes.org"
                                                       "Work Notes")
                               "* %? \nCaptured On: %^t \n%i\n" :empty-lines 1)
			      ("a" "Appointment" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Appointments")
                               "* TODO %? \nSCHEDULED: %^{when}t DEADLINE: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:END:\n" :empty-lines 1)

                              ("d" "Due Date" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Due Dates")
                               "* TODO %? \nDEADLINE: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|recursive|nil}p\n:END:\n" :empty-lines 1)

                              ("e" "Event" entry (file+headline
                                                        "~/Documents/Org/Personal/Personal_Schedule.org"
                                                        "Events")
                               "* TODO %? \nSCHEDULED: %^{when}t\n" :empty-lines 1)
			      ("t" "TV Show" entry (file+headline
                                                        "~/Documents/Org/Personal/TV_Schedule.org"
                                                        "Current TV Shows:")
                               "* WATCH %? [/]\nSCHEDULED: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|checkbox recursive|recursive|nil}p\n:Network: %^{Network|Netflix|AZ Prime|HBO|Cinemax|Showtime|CW|AMC|FX|Fox|Facebook|USA|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:STYLE: %^{STYLE|habit|nil}p\n:END:\n:LOGBOOK:\n:END:\nEpisodes:\n1. [ ] " :empty-lines 1)

                              ("m" "Movies / TV / Streaming Events" entry (file+headline
                                                        "~/Documents/Org/Personal/TV_Schedule.org"
                                                        "Movies / TV / Streaming Events")
                               "* WATCH %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:Network: %^{Network|Netflix|AZ Prime|HBO|Cinemax|Showtime|CW|AMC|FX|Fox|USA|DVD|nil}p\n:END:\n" :empty-lines 1)

			      ("B" "New Book")
			      ("Bn" "Novel" entry (file+headline
						   "~/Documents/Org/Personal/Books_Read.org"
						   "Novels Read")
			       "* TODO %? \n:PROPERTIES:\n:AUTHOR: %^{AUTHOR}p\n:END:\n"
			       :empty-lines 1)

			      ("Bf" "Nonfiction" entry (file+headline
						   "~/Documents/Org/Personal/Books_Read.org"
						   "Nonfiction Read")
			       "* TODO %? \n:PROPERTIES:\n:AUTHOR: %^{AUTHOR}p\n:TOPIC: %^{TOPIC}p\n:END:\n"
			       :empty-lines 1)

                              ("r" "Race" entry (file+headline
                                                 "~/Documents/Org/Personal/Workouts.org"
                                                 "Scheduled Races")
                               "* RACE %? \nSCHEDULED: %^{when}t" :empty-lines 1)

                              ("R" "New Reminder")

                              ("Rr" "Reminder" entry (file+headline
                                                     "~/Documents/Org/Personal/Personal_Schedule.org"
                                                     "Reminders")
                               "* TODO %? \n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|t|nil}p\n:STYLE: %^{STYLE|habit|nil}p\n:END:\n" :empty-lines 1)

                              ("Rg" "Game Release Date" entry (file+headline
                                                     "~/Documents/Org/Personal/Personal_Schedule.org"
                                                     "Reminders")
                               "* TODO %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:Console: %^{Console|PS5|PC}p\n:END:\n" :empty-lines 1)

			      ("C" "New Chore(s)/Task(s)")

			      ("Ct" "Task" entry (file+headline
						  "~/Documents/Org/Personal/Personal_Schedule.org"
						  "Tasks")
			       "* TODO %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|checkbox recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|nil|t}p\n:END:\n" :empty-lines 1)
			      ("Ch" "Chores" entry (file+headline
						  "~/Documents/Org/Personal/Personal_Schedule.org"
						  "Chores")
			       "* TODO %? \nSCHEDULED: %^{when}t\n:PROPERTIES:\n:COOKIE_DATA: %^{COOKIE_DATA|todo recursive|checkbox recursive|recursive|nil}p\n:ORDERED: %^{ORDERED|nil|t}p\n:END:\n" :empty-lines 1)
			      ))

;;Hide all scheduled tasks if DONE
(setf org-agenda-skip-scheduled-if-done t)

;;Org Custom Commands

;;Appointments, Reminders and Chores
(add-to-list 'org-agenda-custom-commands
             '("r" . "Reminders, Appointments and Chores"))
(add-to-list 'org-agenda-custom-commands
             '("rr" "Reminders" tags "+@reminder/!TODO"))
(add-to-list 'org-agenda-custom-commands
             '("ra" "Appointments" tags "+@appointment/!TODO"))
(add-to-list 'org-agenda-custom-commands
             '("rh" "Chores (Domestic)" tags "+@chore/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("rd" "Today's Daily Chores" tags "+SCHEDULED<\"<tomorrow>\"+CATEGORY=\"Daily_Chores\""))
(add-to-list 'org-agenda-custom-commands
             '("rt" "Today's Tasks" tags "+SCHEDULED<\"<tomorrow>\"+CATEGORY=\"Task\"/!-DONE-FINISHED-WATCHED"))
(add-to-list 'org-agenda-custom-commands
             '("rA" "Today's Completed Tasks" tags "+TIMESTAMP_IA>=\"<today>\"+TIMESTAMP_IA<\"<tomorrow>\""))
(add-to-list 'org-agenda-custom-commands
               '("rg" "Game Release Dates" tags "+Console=\"PS4\"|Console=\"PS5\"/!TODO"))

;;Workouts
(add-to-list 'org-agenda-custom-commands
             '("W" "Workouts" tags "+@conditioning/!WORKOUT|IN_PROGRESS"))

;;All Tasks in Progress or Postponed
(add-to-list 'org-agenda-custom-commands
             '("P" . "Tasks In Progress/Postponed" ))
(add-to-list 'org-agenda-custom-commands
             '("Pi" "In Progress" tags "/IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("Pp" "Postponed" tags "/POSTPONED"))

;;Testing
(add-to-list 'org-agenda-custom-commands
             '("t" . "Tests"))
(add-to-list 'org-agenda-custom-commands
             '("ti" "Tests in Progress" tags "/TESTING"))
(add-to-list 'org-agenda-custom-commands
             '("tp" "Tests Passed" tags "/PASS"))
(add-to-list 'org-agenda-custom-commands
             '("tf" "Tests Failed" tags "/FAIL"))

;;Deadlines
(add-to-list 'org-agenda-custom-commands
             '("d" . "Deadlines"))
(add-to-list 'org-agenda-custom-commands
             '("da" "All Deadlines" tags "+DEADLINE>=\"<now>\"/!"))
(add-to-list 'org-agenda-custom-commands
             '("di" "Imminent Deadlines" tags "+DEADLINE<=\"<+2w>\"/!"))
(add-to-list 'org-agenda-custom-commands
             '("dI" "Important Deadlines" tags "+{@important}+DEADLINE>=\"<now>\"/!"))

;;Music Practice
(add-to-list 'org-agenda-custom-commands
             '("i" . "Music Instrument Practice"))
(add-to-list 'org-agenda-custom-commands
             '("ig" "Guitar Practice" tags "Guitar"))
(add-to-list 'org-agenda-custom-commands
             '("ip" "Piano Practice" tags "Piano"))

;;Events and Entertainment
(add-to-list 'org-agenda-custom-commands
             '("E" . "Events and Entertainment"))
(add-to-list 'org-agenda-custom-commands
             '("Ea" "All Events" tags "+{@event}/!TODO|WATCH"))
(add-to-list 'org-agenda-custom-commands
             '("Eu" "Upcoming Events (Next 2 weeks)" tags "+SCHEDULED<=\"<+2w>\"+{@event}/!TODO|WATCH"))
(add-to-list 'org-agenda-custom-commands
             '("Et" "Television and Movies" tags "+{@television\|@streaming\|@entertainment}/!WATCH"))

;;Subjects
(add-to-list 'org-agenda-custom-commands
             '("b" . "Study Subjects and Books"))
(add-to-list 'org-agenda-custom-commands
             '("ba" "All Subjects" tags "+@subject-@unimportant/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("bu" "Unimportant Subjects" tags "+@unimportant/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("bc" "Current Subjects" tags "+@subject-@unimportant+TIMESTAMP_IA>=\"<-21d>\"+/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("br" "Recent Subjects" tags "+@subject-@unimportant+TIMESTAMP_IA>=\"<-4d>\"+/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("bl" "Less Recent Subjects"
               tags "+@subject-@unimportant+TIMESTAMP_IA<\"<-4d>\"+TIMESTAMP_IA>=\"<-10d>\"+/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
             '("bi" "Current ignored subjects"
               tags "+@subject-@unimportant+TIMESTAMP_IA>=\"<-21d>\"+TIMESTAMP_IA<\"<-10d>\"+/!TODO|IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
	         '("bb" . "Books"))
(add-to-list 'org-agenda-custom-commands
	         '("bbr" "Recent Books"
               tags "+@books+TIMESTAMP_IA>=\"<2023-01-01>\""))
(add-to-list 'org-agenda-custom-commands
	         '("bbn" "Current novels"
	           tags "+CATEGORY=\"novel\"+/!IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
	         '("bbN" "All novels"
	           tags "+CATEGORY=\"novel\""))
(add-to-list 'org-agenda-custom-commands
	         '("bbb" "Current nonfiction"
	           tags "+CATEGORY=\"nonfiction\"+/!IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
	         '("bbB" "All nonfiction"
	           tags "+CATEGORY=\"nonfiction\""))
(add-to-list 'org-agenda-custom-commands
	         '("bbt" "Current textbooks"
	           tags "+CATEGORY=\"textbook\"+/!IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
	         '("bbT" "All textbooks"
	           tags "+CATEGORY=\"textbook\""))
(add-to-list 'org-agenda-custom-commands
	     '("bbI" "All In Progress"
	       tags "+@books+/!IN_PROGRESS"))
(add-to-list 'org-agenda-custom-commands
	     '("bbU" "All Unread"
	       tags "+@books+/!TODO"))

;;Notes
(add-to-list 'org-agenda-custom-commands
             '("N" . "Notes"))
(add-to-list 'org-agenda-custom-commands
             '("Np" "Personal Notes" tags "Personal_Notes"))
(add-to-list 'org-agenda-custom-commands
             '("Ns" "Study Notes" tags "Study_Notes"))
(add-to-list 'org-agenda-custom-commands
             '("Nw" "Work Notes" tags "Work_Notes"))

;; ----------------
;; Journal SYSTEM !
;; ----------------

;; SETUP A ROBUST / GENERAL JOURNAL SYSTEM
;; I have modified this from:
;; https://aqeelakber.com/2016/12/21/emacs-org-mode-journal-and-log/
;; Optional Journaling system, record

;; Author name to be auto inserted in entries
(setq journal-author "Carlo Tambuatco")

;; This is the base folder where all your "books"
;; will be stored.
(setq journal-base-dir "~/Documents/Org Journals/")

;; Journal Key bindings
(global-set-key (kbd "C-c j") 'journal-today)
(global-set-key (kbd "C-c e") 'browse-journal)


;; These are your "books" (folders), add as many as you like.
;; Note: "sub volumes" are acheivable with sub folders.
(setq journal-books '("Training"
                      "Blender"
                      "Programming Journal"
                      "Personal Journal"
                      "Japanese"
                      "Guitar"
                      "Investing"
                      "Piano"
                      ))


;; Functions for journal
(defun get-journal-file-today (book)
  "Return today's filename for a books journal file."
  (interactive (list (completing-read "Book: " journal-books) ))
  (expand-file-name
   (concat journal-base-dir book "/J"
	   (format-time-string "%Y-%m-%d") ".org" )) )

(defun journal-today ()
  "Load todays journal entry for book"
  (interactive)
  (find-file (call-interactively 'get-journal-file-today)) )

(defun go-to-journal-dir (book)
  "Go to a journal directory based on a given Book"
  (interactive (list (completing-read "Goto Book: " journal-books)))
          (concat journal-base-dir book)
  )

(defun browse-journal ()
  "Browse an existing journal directory"
  (interactive)
  (dired (call-interactively 'go-to-journal-dir)))


(defun journal-entry-date ()
  "Inserts the journal heading based on the file's name."
  (when (string-match
	 "\\(J\\)\\(20[0-9][0-9]\\)\\-\\([0-9][0-9]\\)\\-\\([0-9][0-9]\\)\\(.org\\)"
	 (buffer-name))
    (let ((year  (string-to-number (match-string 2 (buffer-name))))
          (month (string-to-number (match-string 3 (buffer-name))))
          (day   (string-to-number (match-string 4 (buffer-name))))
          (datim nil))
      (setq datim (encode-time 0 0 0 day month year))
      (format-time-string "%Y-%m-%d (%A)" datim))))

;; Auto-insert journal header
(auto-insert-mode)
(eval-after-load 'autoinsert
  '(define-auto-insert
     '("\\(J\\)\\(20[0-9][0-9]\\)\\-\\([0-9][0-9]\\)\\-\\([0-9][0-9]\\)\\(.org\\)" . "Journal Header")
     '("Short description: "
       "#+TITLE: Journal Entry - "
       (car
	(last
	 (split-string
	  (file-name-directory buffer-file-name) "/Org/"))) \n
       (concat "#+AUTHOR: " journal-author) \n
       "#+DATE: " (journal-entry-date) \n
       "#+FILETAGS: :"
       (car (split-string (car
	              (last
	               (split-string
	                (file-name-directory buffer-file-name) "/Org/"))) "/")) ":" \n \n
       > _ \n
       )))



;; Org Babel customization for evaluating languages
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (R . t)
   (calc . t)
   (gnuplot . t)
   (java . t)))

;;Use the following in a source block to allow changing of DONE state
;;buffer local only

;; Set TODO entry to DONE when all children are DONE
;;  (defun org-summary-todo (n-done n-not-done)
;;    "Switch entry to DONE when all subentries are done, to TODO otherwise."
;;    (let (org-log-done org-log-states)   ; turn off logging
;;      (org-todo (if (= n-not-done 0) "DONE" "TODO"))))

;; (add-hook 'org-after-todo-statistics-hook 'org-summary-todo nil t)

;;; org-init.el ends here

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...
  2023-06-06 15:03                 ` Carlo Tambuatco
@ 2023-06-07 11:29                   ` Ihor Radchenko
  0 siblings, 0 replies; 11+ messages in thread
From: Ihor Radchenko @ 2023-06-07 11:29 UTC (permalink / raw)
  To: Carlo Tambuatco; +Cc: Org-Mode Mailing List

Carlo Tambuatco <oraclmaster@gmail.com> writes:

> Hey Ihor, I recently upgraded my emacs to emacs@29 via homebrew, and I know
> this is an
> old thread, but now that my new emacs version comes with org-9.6.6, I am
> getting the same
> issues as I detailed in this thread with my org capture templates. I tried
> to do a reproduce
> with emacs -q but the error does not reproduce in those conditions, so it
> might be an issue
> with org mode interacting with some of my other packages installed.
>
> I will include a list of emacs packages I have installed, and my
> org-init.el file. Maybe you
> could see if anything jumps out at you that is causing this weird behavior.

You may try https://github.com/Malabarba/elisp-bug-hunter to narrow down
the cause in your config.

If that does not work, we can try to arrange jitsi call to investigate
in more details.

-- 
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-06-07 11:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2023-04-17 10:40               ` Carlo Tambuatco
2023-06-06 15:03                 ` Carlo Tambuatco
2023-06-07 11:29                   ` Ihor Radchenko

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).