From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: Lists for org-refile-targets Date: Fri, 4 Dec 2009 13:17:03 -0600 Message-ID: <211769420912041117y6981755cu7ddd658dff76273f@mail.gmail.com> References: <211769420912040810r530be418g6eaf4e5589c02121@mail.gmail.com> <27084.1259945144@gamaville.dokosmarshall.org> <211769420912041023m5a592367jc85e5397ecdb1a1e@mail.gmail.com> <28578.1259953419@gamaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1925720323==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGdeR-0006o2-Jx for emacs-orgmode@gnu.org; Fri, 04 Dec 2009 14:17:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGdeN-0006kx-NF for emacs-orgmode@gnu.org; Fri, 04 Dec 2009 14:17:11 -0500 Received: from [199.232.76.173] (port=37076 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGdeN-0006kq-FZ for emacs-orgmode@gnu.org; Fri, 04 Dec 2009 14:17:07 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:43172) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGdeM-0002nV-Ve for emacs-orgmode@gnu.org; Fri, 04 Dec 2009 14:17:07 -0500 Received: by bwz7 with SMTP id 7so2419914bwz.26 for ; Fri, 04 Dec 2009 11:17:05 -0800 (PST) In-Reply-To: <28578.1259953419@gamaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com, emacs-orgmode@gnu.org --===============1925720323== Content-Type: multipart/alternative; boundary=000325554cdeeed10e0479ebf3dd --000325554cdeeed10e0479ebf3dd Content-Type: text/plain; charset=ISO-8859-1 On Fri, Dec 4, 2009 at 1:03 PM, Nick Dokos wrote: > Nathan Neff wrote: > > > On Fri, Dec 4, 2009 at 10:45 AM, Nick Dokos > wrote: > > > > Nathan Neff 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(#) > > (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: " # 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 /path/to/org.el > > 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 --> (: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 > --000325554cdeeed10e0479ebf3dd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Fri, Dec 4, 2009 at 1:03 PM, Nick Dok= os <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:
>
> =A0 =A0 Nathan Neff <natha= n.neff@gmail.com> wrote:
>
> =A0 =A0 > Currently, I'm getting an error when I try to refile = my notes
> =A0 =A0 > and I think it's something very basic.
> =A0 =A0 >
> =A0 =A0 > Here's the relevant code:
> =A0 =A0 >
> =A0 =A0 > ;; Use environment variable $ORGDIR to get dir for org-di= rectory
> =A0 =A0 > (setq org-directory (getenv "ORGDIR"))
> =A0 =A0 > (setq notesmine-dir "~/Documents/notesmine-org"= )
> =A0 =A0 >
> =A0 =A0 > (setq org-agenda-files (file-expand-wildcards (concat org= -directory "/*.org")))
> =A0 =A0 > (setq notesmine-files (file-expand-wildcards (concat note= smine-dir "/*.org")))
> =A0 =A0 >
> =A0 =A0 > ; Targets include this file and any file contributing to = the agenda - up to 5 levels deep
> =A0 =A0 > (setq org-refile-targets
> =A0 =A0 > =A0 (quote
> =A0 =A0 > =A0=A0=A0 (
> =A0 =A0 > =A0=A0=A0=A0=A0 (org-agenda-files :maxlevel . 5)
> =A0 =A0 > =A0=A0=A0=A0=A0 (notesmine-files :maxlevel . 5)
> =A0 =A0 > =A0=A0=A0=A0=A0 (nil :maxlevel . 5)
> =A0 =A0 > =A0=A0=A0 )
> =A0 =A0 > =A0 )
> =A0 =A0 > )
> =A0 =A0 >
> =A0 =A0 > I've tried concatenating org-agenda-files and notesmi= ne-files, but I keep getting errors
> =A0 =A0 > when trying to refile.=A0 The error that I get is:
> =A0 =A0 > "Wrong type argument, numberp (0.5)"
> =A0 =A0 >
> =A0 =A0 > I can provide a stack trace, but I don't think this i= s a bug -- I just think that
> =A0 =A0 > I'm not concatenating the list of files that I want t= o use in org-refile-targets
> =A0 =A0 > correctly.
> =A0 =A0 >
>
> =A0 =A0 [A stacktrace is always useful. It doesn't matter whether = it's a bug in org or in
> =A0 =A0 your code: it can help narrow down the problem]
>
> =A0 =A0 I suspect that the last line is the problem:
>
> =A0 =A0 > =A0=A0=A0=A0=A0 (nil :maxlevel . 5)
>
> =A0 =A0 What happens if you delete it?
>
> =A0 =A0 HTH,
> =A0 =A0 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))
> =A0 number-to-string((0.5))
> =A0 (concat "^\\*\\{1," (number-to-string (if org-odd-levels= -only ... ...)) "\\}[ =A0=A0=A0 ]")
> =A0 (setq descre (concat "^\\*\\{1," (number-to-string ...) = "\\}[ =A0=A0=A0 ]"))
> =A0 (cond ((eq ... :tag) (setq descre ...)) ((eq ... :todo) (setq desc= re ...)) ((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)))
> =A0 (while (setq entry (pop entries)) (setq files (car entry) desc (cd= r entry)) (setq fast-path-p nil) (cond (... ...) (... ...) (... ...) (... .= ..)) (if
> (stringp files) (setq files ...)) (cond (... ...) (... ...) (... ...) = (... ...) (... ... ...) (t ...)) (while (setq f ...) (with-current-buffer .= .. ...
> ... ... ...)))
> =A0 (save-current-buffer (set-buffer (or default-buffer ...)) (while (= setq entry ...) (setq files ... desc ...) (setq fast-path-p nil) (cond ... = ... ...
> ...) (if ... ...) (cond ... ... ... ... ... ...) (while ... ...)))
> =A0 (with-current-buffer (or default-buffer (current-buffer)) (while (= setq entry ...) (setq files ... desc ...) (setq fast-path-p nil) (cond ... = ... ...
> ...) (if ... ...) (cond ... ... ... ... ... ...) (while ... ...)))
> =A0 (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)= )
> =A0 org-get-refile-targets(#<buffer notes.org>)
> =A0 (setq org-refile-target-table (org-get-refile-targets default-buff= er))
> =A0 (let ((org-refile-targets org-refile-targets) (org-refile-use-outl= ine-path org-refile-use-outline-path)) (setq org-refile-target-table
> (org-get-refile-targets default-buffer)))
> =A0 org-refile-get-location("Refile to: " #<buffer notes.org> nil)
> =A0 (or rfloc (org-refile-get-location (if goto "Goto: " &qu= ot;Refile to: ") buffer org-refile-allow-creating-parent-nodes))
> =A0 (let* ((marker ...) (buffer ...) (pos ...) (rfloc ...)) (with-curr= ent-buffer buffer (save-excursion ...)))
> =A0 (if (equal goto (quote ...)) (org-refile-goto-last-stored) (let* (= ... ... ... ...) (with-current-buffer buffer ...)))
> =A0 org-agenda-refile(nil)
> =A0 call-interactively(org-agenda-refile nil nil)
>

Are you sure you have not omitted a space after a period somewh= ere?
(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 th= e
(nil :maxlevel 5) part is legal), so I think you'll need to do some
debugging. =A0The code in questions is around line 8973 in org.el and
looks like this:

=A0 =A0 =A0 =A0 ((eq (car desc) :maxlevel)
=A0 =A0 =A0 =A0 =A0(setq fast-path-p t)
=A0 =A0 =A0 =A0 =A0(setq descre (concat "^\\*\\{1," (numbe= r-to-string
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(if org-odd-levels-only
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0(1- (* 2 (cdr desc)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0(cdr desc)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "\\}[ \t]= ")))

I would suggest that you add a call to debug:

=A0 =A0 =A0 =A0 ((eq (car desc) :maxlevel)
=A0 =A0 =A0 =A0 =A0(setq fast-path-p t)
=A0 =A0 =A0 =A0 =A0(debug)
=A0 =A0 =A0 =A0 =A0(setq descre (concat "^\\*\\{1,&= quot; (number-to-string
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(if org-odd-levels-only
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0(1- (* 2 (cdr desc)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0(cdr desc)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "\\}[ \t]= ")))

Load the org.el file explicitly:

M-x load-file <RET> /path/to/org.el <RET>

and then try your refile. When =A0it drops into the debugger, you can
say "e" and type an expression to be evaluated into the minibuffe= r.
E.g. e desc <RET> --> (:maxfile . 5) but if it looks like this
(:maxfile .5) watch out!


Nick -- thank you very much.=A0 The problem was t= hat I had no space between the period and the 5 on line two below:

<= br>(org-agenda-files :maxlevel . 5)
;;BAD
(notesmine-files :maxlevel = . 5)
=A0
I will keep your debugging advice for the next time --
hopefully I&= #39;ll be able to find these kinds of problems before
pinging the list.<= br>
Thanks again,
--Nate
HTH,
Nick

--000325554cdeeed10e0479ebf3dd-- --===============1925720323== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1925720323==--