emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Error when saving remember entries in non org-mode file types.
@ 2009-06-16 23:25 Jere McDevitt
  2009-06-18  8:21 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Jere McDevitt @ 2009-06-16 23:25 UTC (permalink / raw)
  To: emacs-orgmode


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

Org-mode version: 6.27a

I configured org-remember-templates to use a file named "project.todo" to
hold todo entries for me.

(setq org-remember-templates
        ("Project" ?p "* TODO %?\n %u"  "~/org/project.todo" bottom )))

I hadn't added the .todo extension to the auto-mode-alist so when it was
loaded to be written to by the org-remember-handler, it came up by default
in fundamental-mode, not org-mode.

This generates an error condition that I tracked down in the org-remember.el
file to line 887 in the org-remember-handler function:

 ((not (org-mode-p))
        (if (eq heading 'top)
            (goto-char (point-min))
          (goto-char (point-max))
          (or (bolp) (newline)))
        (insert text-before-node-creation)
                  .......


The error is that text-before-node-creation apparently is a nil and the
insert routine is generating an error because of it.  This variable is set
earlier in the handler at around line 845 but only if the text being
inserted does not look like an org-outline-regexp:

  (unless (looking-at org-outline-regexp)
    ;; add a headline
    (setq text-before-node-creation (buffer-string))

Because my template actually does look like an org-outline-regexp (it starts
with "* TODO"), that variable is never set and because the buffer is not in
org-mode, this code is triggered using the text-buffer-node-creation.

The simple work around was to add .todo files to the auto-mode-alist (or I
could have changed the template), but I thought I would post a note about
it.

Jere

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

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Error when saving remember entries in non org-mode file types.
  2009-06-16 23:25 Error when saving remember entries in non org-mode file types Jere McDevitt
@ 2009-06-18  8:21 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-06-18  8:21 UTC (permalink / raw)
  To: Jere McDevitt; +Cc: emacs-orgmode


On Jun 17, 2009, at 1:25 AM, Jere McDevitt wrote:

> Org-mode version: 6.27a
>
> I configured org-remember-templates to use a file named  
> "project.todo" to hold todo entries for me.
>
> (setq org-remember-templates
>        ("Project" ?p "* TODO %?\n %u"  "~/org/project.todo" bottom )))
>
> I hadn't added the .todo extension to the auto-mode-alist so when it  
> was loaded to be written to by the org-remember-handler, it came up  
> by default in fundamental-mode, not org-mode.
>
> This generates an error condition that I tracked down in the org- 
> remember.el file to line 887 in the org-remember-handler function:

Yes, target files for remember templates must be in Org-mode.
That does make sense normally, because your TODO tasks
are Org nodes.

I would simply recommend to actually use a .org extension.

I you don't want to do that, instead of adding to auto-mode-alist,
you can start the file with

# -*- mode: org -*-

HTH

- Carsten


>
> ((not (org-mode-p))
>        (if (eq heading 'top)
>            (goto-char (point-min))
>          (goto-char (point-max))
>          (or (bolp) (newline)))
>        (insert text-before-node-creation)
>                  .......
>
>
> The error is that text-before-node-creation apparently is a nil and  
> the insert routine is generating an error because of it.  This  
> variable is set earlier in the handler at around line 845 but only  
> if the text being inserted does not look like an org-outline-regexp:
>
>  (unless (looking-at org-outline-regexp)
>    ;; add a headline
>    (setq text-before-node-creation (buffer-string))
>
> Because my template actually does look like an org-outline-regexp  
> (it starts with "* TODO"), that variable is never set and because  
> the buffer is not in org-mode, this code is triggered using the text- 
> buffer-node-creation.
>
> The simple work around was to add .todo files to the auto-mode-alist  
> (or I could have changed the template), but I thought I would post a  
> note about it.
>
> Jere _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-06-18  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16 23:25 Error when saving remember entries in non org-mode file types Jere McDevitt
2009-06-18  8:21 ` Carsten Dominik

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