Explorar el Código

Fix bug with org-goto in buffer without file

Paul Griepentrog writes:

> Every once in a while I use org-mode in a buffer that is not
> associated with a file... and then org-goto gets confused.  To repeat:
>
> BUFFER-NO-FILE
> ---------------
> * One
>   - a
> * Two
>   - b
> ---------------
>
> M-x org-mode
> C-c C-j
> org-get-refile-targets: Wrong type argument: stringp, nil
>
> [...]
>
> This patch fixes it:
Carsten Dominik hace 15 años
padre
commit
0077ce97ea
Se han modificado 2 ficheros con 4 adiciones y 1 borrados
  1. 3 0
      lisp/ChangeLog
  2. 1 1
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-12-10  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-get-refile-targets): Catch the case when a buffer
+	has no file.
+
 	* org-latex.el (org-export-as-latex): Cleanup forced line ends
 	where they are not needed.
 	(org-export-latex-subcontent): Remove unnecessary newlines.

+ 1 - 1
lisp/org.el

@@ -8986,7 +8986,7 @@ on the system \"/user@host:\"."
 	  (with-current-buffer
 	      (if (bufferp f) f (org-get-agenda-file-buffer f))
 	    (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f))))
-	    (setq f (expand-file-name f))
+	    (setq f (and f (expand-file-name f)))
 	    (if (eq org-refile-use-outline-path 'file)
 		(push (list (file-name-nondirectory f) f nil nil) targets))
 	    (save-excursion