* Refile fails with blank TODO
@ 2011-12-12 21:13 Nathan Neff
2011-12-12 21:29 ` Nick Dokos
2011-12-18 19:41 ` David Maus
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Neff @ 2011-12-12 21:13 UTC (permalink / raw)
To: emacs-orgmode
Hello,
With some help from Nick Dokos, I think I've found a
bug:
If you have a blank TODO entry in any of your refile targets,
you will get the error message below.
Here's a sample ~/Documents/notesmine/emacs.org file that will
reproduce the error:
----
* Emacs - auto fill mode
* TODO
* Rectangle
blah blah blah about rectangle
----
Here's the setup I used with the latest pull from org-mode:
-------------- begin init.el ----------------
;;; -*- mode: emacs-lisp -*-
;;; constant part
(add-to-list 'load-path (expand-file-name "~/.emacs.d/src/org/lisp"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/src/org/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 '("~/Documents/personal"))
;; Begin Code
(defun njn/personal-org-files()
(interactive)
(directory-files "~/Documents/notesmine" 't "^[^.].*org$")
)
(defun njn/refile-targets-personal()
(interactive)
(setq org-refile-targets
(quote ((njn/personal-org-files :maxlevel . 5))))
)
-------------- end code -------------------
I'm able to replicate this bug by opening Emacs and
running M-x njn/refile-targets-personal
I've gone back at least as far back as commit
3e6ac9dfe2171fd84d95db4808fd024b1c95a8a3 -- But I don't think this commit
is the cause of the error, it's just as far back as I've gone when
trying to find
the actual cause of the error. Previously, I thought the error was caused by
the refile target file's name "org-mode.org", but this was not the case.
Thanks and hope someone else can replicate it :-)
-------- Begin Error Message ---------
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("\\[\\[\\(\\(http\\|https\\|ftp\\|mailto\\|file\\|news\\|shell\\|elisp\\|doi\\|message\\|file\\+sys\\|file\\+emacs\\|bbdb\\|bibtex\\|docview\\|gnus\\|info\\|irc\\|mew\\|mhe\\|rmail\\|vm\\|wl\\):\\)?\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
nil)
(if (string-match org-bracket-link-analytic-regexp link)
(replace-match (if ... ... ...) nil t link) link)
(progn (if (string-match org-bracket-link-analytic-regexp link)
(replace-match ... nil t link) link))
(unwind-protect (progn (if ... ... link)) (set-match-data
save-match-data-internal (quote evaporate)))
(let ((save-match-data-internal ...)) (unwind-protect (progn ...)
(set-match-data save-match-data-internal ...)))
(save-match-data (if (string-match org-bracket-link-analytic-regexp
link) (replace-match ... nil t link) link))
org-link-display-format(nil)
(setq level (org-reduced-level (- ... ...)) txt
(org-link-display-format (match-string 4)) txt
(replace-regexp-in-string "\\( *[[0-9]+/?[0-9]*%?]\\)+$" "" txt) re
(format org-complex-heading-regexp-format (regexp-quote ...)))
(progn (setq level (org-reduced-level ...) txt
(org-link-display-format ...) txt (replace-regexp-in-string "\\(
*[[0-9]+/?[0-9]*%?]\\)+$" "" txt) re (format
org-complex-heading-regexp-format ...)) (when
org-refile-use-outline-path (setq txt ...)) (push (list txt f re ...)
tgs))
(if (and (looking-at org-complex-heading-regexp) (not ...)) (progn
(setq level ... txt ... txt ... re ...) (when
org-refile-use-outline-path ...) (push ... tgs)))
(when (and (looking-at org-complex-heading-regexp) (not ...)) (setq
level (org-reduced-level ...) txt (org-link-display-format ...) txt
(replace-regexp-in-string "\\( *[[0-9]+/?[0-9]*%?]\\)+$" "" txt) re
(format org-complex-heading-regexp-format ...)) (when
org-refile-use-outline-path (setq txt ...)) (push (list txt f re ...)
tgs))
(catch (quote next) (when org-refile-target-verify-function
(save-match-data ...)) (when (and ... ...) (setq level ... txt ... txt
... re ...) (when org-refile-use-outline-path ...) (push ... tgs)))
(while (re-search-forward descre nil t) (goto-char (setq pos0 ...))
(catch (quote next) (when org-refile-target-verify-function ...) (when
... ... ... ...)) (when (= ... pos0) (goto-char ...)))
(save-restriction (widen) (goto-char (point-min)) (while
(re-search-forward descre nil t) (goto-char ...) (catch ... ... ...)
(when ... ...)))
(save-excursion (save-restriction (widen) (goto-char ...) (while ...
... ... ...)))
(progn (if (bufferp f) (setq f ...)) (setq f (and f ...)) (if (eq
org-refile-use-outline-path ...) (push ... tgs)) (save-excursion
(save-restriction ... ... ...)))
(or (setq tgs (org-refile-cache-get ... descre)) (progn (if ... ...)
(setq f ...) (if ... ...) (save-excursion ...)))
(save-current-buffer (set-buffer (if ... f ...)) (or (setq tgs ...)
(progn ... ... ... ...)) (when org-refile-use-cache
(org-refile-cache-put tgs ... descre)) (setq targets (append tgs
targets)))
(with-current-buffer (if (bufferp f) f (org-get-agenda-file-buffer
f)) (or (setq tgs ...) (progn ... ... ... ...)) (when
org-refile-use-cache (org-refile-cache-put tgs ... descre)) (setq
targets (append tgs targets)))
(while (setq f (pop files)) (with-current-buffer (if ... f ...) (or
... ...) (when org-refile-use-cache ...) (setq targets ...)))
(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 tgs 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-refile-get-targets(nil (#("foo" 0 3 (fontified t face
org-level-1)) #("fooboo" 0 6 (fontified t face org-level-2))))
(setq org-refile-target-table (org-refile-get-targets default-buffer
excluded-entries))
(let ((org-refile-targets org-refile-targets)
(org-refile-use-outline-path org-refile-use-outline-path)
excluded-entries) (when (and ... ... ...) (org-map-tree ...)) (setq
org-refile-target-table (org-refile-get-targets default-buffer
excluded-entries)))
org-refile-get-location("Refile subtree \"foo\" to" nil nil nil)
(save-excursion (unless goto (org-back-to-heading t) (setq
heading-text ...)) (org-refile-get-location (cond ... ... ...)
default-buffer org-refile-allow-creating-parent-nodes goto))
(let (heading-text) (save-excursion (unless goto ... ...)
(org-refile-get-location ... default-buffer
org-refile-allow-creating-parent-nodes goto)))
(or rfloc (let (heading-text) (save-excursion ... ...)))
(setq it (or rfloc (let ... ...)))
(or (and (equal goto 2) org-clock-hd-marker (marker-buffer
org-clock-hd-marker) (prog1 ... ...)) (setq it (or rfloc ...)))
(if (or (and ... org-clock-hd-marker ... ...) (setq it ...)) (progn
(setq file ... re ... pos ...) (if ... ...) (setq nbuf ...) (if goto
... ... ... ... ... ... ...)))
(when (or (and ... org-clock-hd-marker ... ...) (setq it ...)) (setq
file (nth 1 it) re (nth 2 it) pos (nth 3 it)) (if (and ... pos ...
...) (error "Cannot refile to position inside the tree or region"))
(setq nbuf (or ... ...)) (if goto (progn ... ... ...) (if regionp ...
...) (with-current-buffer ... ... ...) (if regionp ... ...) (when ...
...) (setq org-markers-to-move nil) (message "Refiled to \"%s\" in
file %s" ... file)))
(if (equal goto (quote ...)) (org-refile-goto-last-stored) (when (or
... ...) (setq file ... re ... pos ...) (if ... ...) (setq nbuf ...)
(if goto ... ... ... ... ... ... ...)))
(let* ((cbuf ...) (regionp ...) (region-start ...) (region-end ...)
(region-length ...) (filename ...) pos it nbuf file re level reversed)
(setq last-command nil) (when regionp (goto-char region-start) (or ...
...) (setq region-start ...) (unless ... ...)) (if (equal goto ...)
(org-refile-goto-last-stored) (when ... ... ... ... ...)))
(if (member goto (quote ...)) (org-refile-cache-clear) (let* (...
... ... ... ... ... pos it nbuf file re level reversed) (setq
last-command nil) (when regionp ... ... ... ...) (if ... ... ...)))
org-refile(nil)
call-interactively(org-refile nil nil)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Refile fails with blank TODO
2011-12-12 21:13 Refile fails with blank TODO Nathan Neff
@ 2011-12-12 21:29 ` Nick Dokos
2011-12-18 19:41 ` David Maus
1 sibling, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2011-12-12 21:29 UTC (permalink / raw)
To: Nathan Neff; +Cc: nicholas.dokos, emacs-orgmode
Nathan Neff <nathan.neff@gmail.com> wrote:
> If you have a blank TODO entry in any of your refile targets,
> you will get the error message below.
>
> ...
> I'm able to replicate this bug by opening Emacs and
> running M-x njn/refile-targets-personal
> ...
> Thanks and hope someone else can replicate it :-)
>
Yup, I can replicate it. You can work around it by adding a space (or
something else) after the TODO, but I agree that it should be handled a
bit more gracefully than with an obscure error message that does not
point at the culprit.
I think empty TODO lines and the problems they cause have been discussed
on the list recently, but I wasn't paying much attention (and I don't
have time to look atm) so I'm not sure what the resolution was.
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Refile fails with blank TODO
2011-12-12 21:13 Refile fails with blank TODO Nathan Neff
2011-12-12 21:29 ` Nick Dokos
@ 2011-12-18 19:41 ` David Maus
1 sibling, 0 replies; 3+ messages in thread
From: David Maus @ 2011-12-18 19:41 UTC (permalink / raw)
To: Nathan Neff; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
Hi,
At Mon, 12 Dec 2011 15:13:48 -0600,
Nathan Neff wrote:
>
> Hello,
>
> With some help from Nick Dokos, I think I've found a
> bug:
>
> If you have a blank TODO entry in any of your refile targets,
> you will get the error message below.
I pushed a fix for this. Headlines with a blank todo are now ignored
as a possible refile target.
Best,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-18 19:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 21:13 Refile fails with blank TODO Nathan Neff
2011-12-12 21:29 ` Nick Dokos
2011-12-18 19:41 ` David Maus
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).