emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Lists for org-refile-targets
@ 2009-12-04 16:10 Nathan Neff
  2009-12-04 16:45 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Neff @ 2009-12-04 16:10 UTC (permalink / raw)
  To: emacs-orgmode


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

Hello,

I'm not a lisp programmer -- I would like to tell org-mode to
use two lists of files (org-agenda-files and notesmine-files) when I refile
my remember notes.

Currently, I'm getting an error when I try to refile my notes
and I think it's something very basic.

Here's the relevant code:

;; Use environment variable $ORGDIR to get dir for org-directory
(setq org-directory (getenv "ORGDIR"))
(setq notesmine-dir "~/Documents/notesmine-org")

(setq org-agenda-files (file-expand-wildcards (concat org-directory
"/*.org")))
(setq notesmine-files (file-expand-wildcards (concat notesmine-dir
"/*.org")))

; Targets include this file and any file contributing to the agenda - up to
5 levels deep
(setq org-refile-targets
  (quote
    (
      (org-agenda-files :maxlevel . 5)
      (notesmine-files :maxlevel . 5)
      (nil :maxlevel . 5)
    )
  )
)

I've tried concatenating org-agenda-files and notesmine-files, but I keep
getting errors
when trying to refile.  The error that I get is:
"Wrong type argument, numberp (0.5)"

I can provide a stack trace, but I don't think this is a bug -- I just think
that
I'm not concatenating the list of files that I want to use in
org-refile-targets
correctly.

Any suggestions?

Thanks,
--Nate

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

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 4+ messages in thread

* Re: Lists for org-refile-targets
  2009-12-04 16:10 Lists for org-refile-targets Nathan Neff
@ 2009-12-04 16:45 ` Nick Dokos
       [not found]   ` <211769420912041023m5a592367jc85e5397ecdb1a1e@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2009-12-04 16:45 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Nathan Neff <nathan.neff@gmail.com> wrote:

> Currently, I'm getting an error when I try to refile my notes
> and I think it's something very basic.
> 
> Here's the relevant code:
> 
> ;; Use environment variable $ORGDIR to get dir for org-directory
> (setq org-directory (getenv "ORGDIR"))
> (setq notesmine-dir "~/Documents/notesmine-org")
> 
> (setq org-agenda-files (file-expand-wildcards (concat org-directory "/*.org")))
> (setq notesmine-files (file-expand-wildcards (concat notesmine-dir "/*.org")))
> 
> ; Targets include this file and any file contributing to the agenda - up to 5 levels deep
> (setq org-refile-targets
>   (quote
>     (
>       (org-agenda-files :maxlevel . 5)
>       (notesmine-files :maxlevel . 5)
>       (nil :maxlevel . 5)
>     )
>   )
> )
> 
> I've tried concatenating org-agenda-files and notesmine-files, but I keep getting errors
> when trying to refile.  The error that I get is:
> "Wrong type argument, numberp (0.5)"
> 
> I can provide a stack trace, but I don't think this is a bug -- I just think that
> I'm not concatenating the list of files that I want to use in org-refile-targets
> correctly.
> 

[A stacktrace is always useful. It doesn't matter whether it's a bug in org or in
your code: it can help narrow down the problem]

I suspect that the last line is the problem:

>       (nil :maxlevel . 5)

What happens if you delete it?

HTH,
Nick

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

* Re: Lists for org-refile-targets
       [not found]   ` <211769420912041023m5a592367jc85e5397ecdb1a1e@mail.gmail.com>
@ 2009-12-04 18:25     ` Nathan Neff
       [not found]     ` <28578.1259953419@gamaville.dokosmarshall.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Neff @ 2009-12-04 18:25 UTC (permalink / raw)
  To: emacs-orgmode


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

I still get the "Wrong type argument: numberp, (0.5)" error.

Here's the stacktrace for the error that I get when I set org-refile-targets
with the following code:


  ;; Use environment variable $ORGDIR to get dir for org-directory
  (setq org-directory (getenv "ORGDIR"))
  (setq notesmine-dir "~/Documents/notesmine-org")

  (setq org-agenda-files (file-expand-wildcards (concat org-directory
"/*.org")))
  (setq notesmine-files (file-expand-wildcards (concat notesmine-dir
"/*.org")))

  ; Targets include this file and any file contributing to the agenda - up
to 5 levels deep
  (setq org-refile-targets
   (quote
     (
       (org-agenda-files :maxlevel . 5)
       (notesmine-files :maxlevel . 5)
       (nil :maxlevel . 5)
     )
   )
  )

Debugger entered--Lisp error: (wrong-type-argument numberp (0.5))
  number-to-string((0.5))
  (concat "^\\*\\{1," (number-to-string (if org-odd-levels-only ... ...))
"\\}[     ]")
  (setq descre (concat "^\\*\\{1," (number-to-string ...) "\\}[     ]"))
  (cond ((eq ... :tag) (setq descre ...)) ((eq ... :todo) (setq descre ...))
((eq ... :regexp) (setq descre ...)) ((eq ... :level) (setq descre ...))
((eq ... :maxlevel) (setq fast-path-p t) (setq descre ...)) (t (error "Bad
refiling target description %s" desc)))
  (while (setq entry (pop entries)) (setq files (car entry) desc (cdr
entry)) (setq fast-path-p nil) (cond (... ...) (... ...) (... ...) (...
...)) (if (stringp files) (setq files ...)) (cond (... ...) (... ...) (...
...) (... ...) (... ... ...) (t ...)) (while (setq f ...)
(with-current-buffer ... ... ... ... ...)))
  (save-current-buffer (set-buffer (or default-buffer ...)) (while (setq
entry ...) (setq files ... desc ...) (setq fast-path-p nil) (cond ... ...
... ...) (if ... ...) (cond ... ... ... ... ... ...) (while ... ...)))
  (with-current-buffer (or default-buffer (current-buffer)) (while (setq
entry ...) (setq files ... desc ...) (setq fast-path-p nil) (cond ... ...
... ...) (if ... ...) (cond ... ... ... ... ... ...) (while ... ...)))
  (let ((case-fold-search nil) (entries ...) targets txt re files f desc
descre fast-path-p level pos0) (message "Getting targets...")
(with-current-buffer (or default-buffer ...) (while ... ... ... ... ... ...
...)) (message "Getting targets...done") (nreverse targets))
  org-get-refile-targets(#<buffer notes.org>)
  (setq org-refile-target-table (org-get-refile-targets default-buffer))
  (let ((org-refile-targets org-refile-targets) (org-refile-use-outline-path
org-refile-use-outline-path)) (setq org-refile-target-table
(org-get-refile-targets default-buffer)))
  org-refile-get-location("Refile to: " #<buffer notes.org> nil)
  (or rfloc (org-refile-get-location (if goto "Goto: " "Refile to: ") buffer
org-refile-allow-creating-parent-nodes))
  (let* ((marker ...) (buffer ...) (pos ...) (rfloc ...))
(with-current-buffer buffer (save-excursion ...)))
  (if (equal goto (quote ...)) (org-refile-goto-last-stored) (let* (... ...
... ...) (with-current-buffer buffer ...)))
  org-agenda-refile(nil)
  call-interactively(org-agenda-refile nil nil)

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

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 4+ messages in thread

* Re: Lists for org-refile-targets
       [not found]     ` <28578.1259953419@gamaville.dokosmarshall.org>
@ 2009-12-04 19:17       ` Nathan Neff
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Neff @ 2009-12-04 19:17 UTC (permalink / raw)
  To: nicholas.dokos, emacs-orgmode


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

On Fri, Dec 4, 2009 at 1:03 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:

> Nathan Neff <nathan.neff@gmail.com> wrote:
>
> > On Fri, Dec 4, 2009 at 10:45 AM, Nick Dokos <nicholas.dokos@hp.com>
> wrote:
> >
> >     Nathan Neff <nathan.neff@gmail.com> wrote:
> >
> >     > Currently, I'm getting an error when I try to refile my notes
> >     > and I think it's something very basic.
> >     >
> >     > Here's the relevant code:
> >     >
> >     > ;; Use environment variable $ORGDIR to get dir for org-directory
> >     > (setq org-directory (getenv "ORGDIR"))
> >     > (setq notesmine-dir "~/Documents/notesmine-org")
> >     >
> >     > (setq org-agenda-files (file-expand-wildcards (concat org-directory
> "/*.org")))
> >     > (setq notesmine-files (file-expand-wildcards (concat notesmine-dir
> "/*.org")))
> >     >
> >     > ; Targets include this file and any file contributing to the agenda
> - up to 5 levels deep
> >     > (setq org-refile-targets
> >     >   (quote
> >     >     (
> >     >       (org-agenda-files :maxlevel . 5)
> >     >       (notesmine-files :maxlevel . 5)
> >     >       (nil :maxlevel . 5)
> >     >     )
> >     >   )
> >     > )
> >     >
> >     > I've tried concatenating org-agenda-files and notesmine-files, but
> I keep getting errors
> >     > when trying to refile.  The error that I get is:
> >     > "Wrong type argument, numberp (0.5)"
> >     >
> >     > I can provide a stack trace, but I don't think this is a bug -- I
> just think that
> >     > I'm not concatenating the list of files that I want to use in
> org-refile-targets
> >     > correctly.
> >     >
> >
> >     [A stacktrace is always useful. It doesn't matter whether it's a bug
> in org or in
> >     your code: it can help narrow down the problem]
> >
> >     I suspect that the last line is the problem:
> >
> >     >       (nil :maxlevel . 5)
> >
> >     What happens if you delete it?
> >
> >     HTH,
> >     Nick
> >
> > I still get the "Wrong type argument: numberp, (0.5)" error.
> >
> > Here's the stacktrace:
> >
> > Debugger entered--Lisp error: (wrong-type-argument numberp (0.5))
> >   number-to-string((0.5))
> >   (concat "^\\*\\{1," (number-to-string (if org-odd-levels-only ... ...))
> "\\}[     ]")
> >   (setq descre (concat "^\\*\\{1," (number-to-string ...) "\\}[     ]"))
> >   (cond ((eq ... :tag) (setq descre ...)) ((eq ... :todo) (setq descre
> ...)) ((eq ... :regexp) (setq descre ...)) ((eq ... :level) (setq descre
> ...))
> > ((eq ... :maxlevel) (setq fast-path-p t) (setq descre ...)) (t (error
> "Bad refiling target description %s" desc)))
> >   (while (setq entry (pop entries)) (setq files (car entry) desc (cdr
> entry)) (setq fast-path-p nil) (cond (... ...) (... ...) (... ...) (...
> ...)) (if
> > (stringp files) (setq files ...)) (cond (... ...) (... ...) (... ...)
> (... ...) (... ... ...) (t ...)) (while (setq f ...) (with-current-buffer
> ... ...
> > ... ... ...)))
> >   (save-current-buffer (set-buffer (or default-buffer ...)) (while (setq
> entry ...) (setq files ... desc ...) (setq fast-path-p nil) (cond ... ...
> ...
> > ...) (if ... ...) (cond ... ... ... ... ... ...) (while ... ...)))
> >   (with-current-buffer (or default-buffer (current-buffer)) (while (setq
> entry ...) (setq files ... desc ...) (setq fast-path-p nil) (cond ... ...
> ...
> > ...) (if ... ...) (cond ... ... ... ... ... ...) (while ... ...)))
> >   (let ((case-fold-search nil) (entries ...) targets txt re files f desc
> descre fast-path-p level pos0) (message "Getting targets...")
> > (with-current-buffer (or default-buffer ...) (while ... ... ... ... ...
> ... ...)) (message "Getting targets...done") (nreverse targets))
> >   org-get-refile-targets(#<buffer notes.org>)
> >   (setq org-refile-target-table (org-get-refile-targets default-buffer))
> >   (let ((org-refile-targets org-refile-targets)
> (org-refile-use-outline-path org-refile-use-outline-path)) (setq
> org-refile-target-table
> > (org-get-refile-targets default-buffer)))
> >   org-refile-get-location("Refile to: " #<buffer notes.org> nil)
> >   (or rfloc (org-refile-get-location (if goto "Goto: " "Refile to: ")
> buffer org-refile-allow-creating-parent-nodes))
> >   (let* ((marker ...) (buffer ...) (pos ...) (rfloc ...))
> (with-current-buffer buffer (save-excursion ...)))
> >   (if (equal goto (quote ...)) (org-refile-goto-last-stored) (let* (...
> ... ... ...) (with-current-buffer buffer ...)))
> >   org-agenda-refile(nil)
> >   call-interactively(org-agenda-refile nil nil)
> >
>
> Are you sure you have not omitted a space after a period somewhere?
> (nil :maxfile . 5) is very different from (nil :maxfile .5).
> What is the value of org-refile-targets?
>
> Other than that, I can't see anything wrong in the code (and I think the
> (nil :maxlevel 5) part is legal), so I think you'll need to do some
> debugging.  The code in questions is around line 8973 in org.el and
> looks like this:
>
>         ((eq (car desc) :maxlevel)
>           (setq fast-path-p t)
>           (setq descre (concat "^\\*\\{1," (number-to-string
>                                             (if org-odd-levels-only
>                                                 (1- (* 2 (cdr desc)))
>                                              (cdr desc)))
>                               "\\}[ \t]")))
>
> I would suggest that you add a call to debug:
>
>         ((eq (car desc) :maxlevel)
>           (setq fast-path-p t)
>           (debug)
>           (setq descre (concat "^\\*\\{1," (number-to-string
>                                             (if org-odd-levels-only
>                                                 (1- (* 2 (cdr desc)))
>                                              (cdr desc)))
>                               "\\}[ \t]")))
>
> Load the org.el file explicitly:
>
> M-x load-file <RET> /path/to/org.el <RET>
>
> and then try your refile. When  it drops into the debugger, you can
> say "e" and type an expression to be evaluated into the minibuffer.
> E.g. e desc <RET> --> (:maxfile . 5) but if it looks like this
> (:maxfile .5) watch out!
>
>
Nick -- thank you very much.  The problem was that I had no space between
the period and the 5 on line two below:


(org-agenda-files :maxlevel . 5)
;;BAD
(notesmine-files :maxlevel . 5)

I will keep your debugging advice for the next time --
hopefully I'll be able to find these kinds of problems before
pinging the list.

Thanks again,
--Nate

> HTH,
> Nick
>

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

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 4+ messages in thread

end of thread, other threads:[~2009-12-04 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-04 16:10 Lists for org-refile-targets Nathan Neff
2009-12-04 16:45 ` Nick Dokos
     [not found]   ` <211769420912041023m5a592367jc85e5397ecdb1a1e@mail.gmail.com>
2009-12-04 18:25     ` Nathan Neff
     [not found]     ` <28578.1259953419@gamaville.dokosmarshall.org>
2009-12-04 19:17       ` Nathan Neff

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