emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Refile fails with blank TODO


From: Nathan Neff
Subject: [O] Refile fails with blank TODO
Date: Mon, 12 Dec 2011 15:13:48 -0600

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]