emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Nathan Neff <nathan.neff@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Refile targets fail with certain filename
Date: Mon, 12 Dec 2011 12:05:03 -0500	[thread overview]
Message-ID: <28788.1323709503@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Nathan Neff <nathan.neff@gmail.com> of "Mon, 12 Dec 2011 09:55:18 CST." <CAC=HedDx2hzEDtAPb7tORvPAZA4eRz4Tbmv4YJJYWvZ1da1X4Q@mail.gmail.com>

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

> Hello,
> 
> This was a very tricky problem to work around.  I have two directories
> ("notesmine" and "personal") that I use to refile stuff to.  I refile to my
> notesmine directory once every few months, so I was baffled last night
> when I started getting "Wrong type argument:
> stringp, nil" when I wanted to refile to my notesmine directory.
> 
> ;; Setup
> ;; My /Users/nate/Documents/notesmine directory has a file called
> "org-mode.org" in it.
> 
> ;; Begin Code
> (defun njn/personal-org-files()
>        (interactive)
>        (directory-files "/Users/nate/Documents/notesmine" 't "^[^.].*org$")
>     )
> 
> (defun njn/refile-targets-personal()
>     (interactive)
>     (setq org-refile-targets
>           (quote ((njn/personal-org-files :maxlevel . 5))))
>   )
> 
> ;; I would then run M-x njn/refile-targets-personal, and
> ;; then press Ctrl-C Ctrl-W to refile a heading in one of my org files.
> ;; Then, I would see the "Wrong type argument: stringp nil"
> 
> I found that the problem *disappears* when I remove or re-name
> the "org-mode.org" file from my notesmine directory!
> 
> I refile to my personal directory all the time, and I found that if
> I move the "org-mode.org" file to my personal directory, (or create a blank
> "org-mode.org" file in my personal directory then I would start
> getting the same "Wrong type argument stringp, nil" error when refiling
> to my personal directory.
> 
> So, as a geek, I'm interested in why the "org-mode.org" filename causes
> this error.  I've reproduced the problem with the simple code above, so
> I hope someone else can say "Yes, I can reproduce the problem" and I will
> have done some good :-)
> 
> Can anyone reproduce the error and tell me if "org-mode.org" is a keyword or
> function or something, or is the problem in the regular expression I'm
> using to select
> my refile targets?
> 

I cannot reproduce it, but the setup needed is probably sufficiently complicated
to make the attempt futile.

Here's the minimal .emacs I tried:

--8<---------------cut here---------------start------------->8---
;;; -*- mode: emacs-lisp -*-
;;; constant part
(add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp"))
(add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/contrib/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install)

(setq debug-on-error t)
(setq eval-expression-print-length nil)
(setq eval-expression-print-level nil)

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)

;;;; Nathan Neff's problem config.
;; Setup
;; My /Users/nate/Documents/notesmine directory has a file called "org-mode.org" in it.

(setq org-agenda-files '("/home/nick/lib/notesmine"))

;; Begin Code
(defun njn/personal-org-files()
       (interactive)
       (directory-files "/home/nick/lib/notesmine" 't "^[^.].*org$")
    )

(defun njn/refile-targets-personal()
    (interactive)
    (setq org-refile-targets
          (quote ((njn/personal-org-files :maxlevel . 5))))
  )

;; I would then run M-x njn/refile-targets-personal, and
;; then press Ctrl-C Ctrl-W to refile a heading in one of my org files.
;; Then, I would see the "Wrong type argument: stringp nil"
;;; end of Nathan Neff's problem config

--8<---------------cut here---------------end--------------->8---

and /home/nick/lib/notesmine contains two files, tasks.org and org-mode.org:

tasks.org:
--8<---------------cut here---------------start------------->8---

* TODO foo
  SCHEDULED: <2011-12-12 Mon>

** DONE bar
   SCHEDULED: <2011-12-12 Mon>
--8<---------------cut here---------------end--------------->8---

org-mode.org:

--8<---------------cut here---------------start------------->8---

* one
** two
*** three
**** four
***** five
****** TODO foo
       SCHEDULED: <2011-12-12 Mon>
--8<---------------cut here---------------end--------------->8---

After doing M-x njn/refile-targets-personal, I can refile from tasks.org (to either
tasks.org or org-mode.org) with C-c C-w with no problems.

I'd suggest you turn on debug-on-error and post the backtrace, preferably
with a minimal .emacs similar to the above and none of your other
customizations: emacs -q -l /path/to/minimal/dot/emacs

Nick

  reply	other threads:[~2011-12-12 17:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 15:55 Refile targets fail with certain filename Nathan Neff
2011-12-12 17:05 ` Nick Dokos [this message]
2011-12-12 21:04   ` Nathan Neff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28788.1323709503@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nathan.neff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).