emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch for links to dired buffers
@ 2010-02-01 15:23 Stephen Eglen
  2010-02-02  6:22 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Eglen @ 2010-02-01 15:23 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Stephen Eglen

Currently if I do 'C-c l' (org-store-link) on the top line of a dired
buffer, I get:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  (abbreviate-file-name (expand-file-name (dired-get-filename nil t)))

This simple patch suggests that instead of signaling an error, the
default directory is used.  (I've not removed the trailing / from the
directory name, as I prefer that on the link name to indicate directory
- but that can be deleted.) 

Thanks, Stephen

2010-02-01  Stephen Eglen  <stephen@gnu.org>

	* org.el (org-store-link): For dired buffers, use
	default-directory as link name if dired-get-filename returns
	nil.

*** /tmp/ediff11782xez	2010-02-01 15:17:48.000000000 +0000
--- /home/stephen/langs/emacs/elisp-ds/org-mode/lisp/org.el	2010-02-01 15:17:45.000000000 +0000
***************
*** 7669,7679 ****
  
       ((eq major-mode 'dired-mode)
        ;; link to the file in the current line
!       (setq cpltxt (concat "file:"
! 			   (abbreviate-file-name
! 			    (expand-file-name
! 			     (dired-get-filename nil t))))
! 	    link (org-make-link cpltxt)))
  
       ((and buffer-file-name (org-mode-p))
        (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID")))
--- 7669,7682 ----
  
       ((eq major-mode 'dired-mode)
        ;; link to the file in the current line
!       (let ((file (dired-get-filename nil t)))
! 	(setq file (if file
! 		       (abbreviate-file-name
! 			(expand-file-name (dired-get-filename nil t)))
! 		     ;; otherwise, no file so use current directory.
! 		     default-directory))
! 	(setq cpltxt (concat "file:" file)
! 	      link (org-make-link cpltxt))))
  
       ((and buffer-file-name (org-mode-p))
        (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID")))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch for links to dired buffers
  2010-02-01 15:23 Patch for links to dired buffers Stephen Eglen
@ 2010-02-02  6:22 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-02-02  6:22 UTC (permalink / raw)
  To: Stephen Eglen; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Feb 1, 2010, at 4:23 PM, Stephen Eglen wrote:

> Currently if I do 'C-c l' (org-store-link) on the top line of a dired
> buffer, I get:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>  expand-file-name(nil)
>  (abbreviate-file-name (expand-file-name (dired-get-filename nil t)))
>
> This simple patch suggests that instead of signaling an error, the
> default directory is used.  (I've not removed the trailing / from the
> directory name, as I prefer that on the link name to indicate  
> directory
> - but that can be deleted.)
>
> Thanks, Stephen
>
> 2010-02-01  Stephen Eglen  <stephen@gnu.org>
>
> 	* org.el (org-store-link): For dired buffers, use
> 	default-directory as link name if dired-get-filename returns
> 	nil.
>
> *** /tmp/ediff11782xez	2010-02-01 15:17:48.000000000 +0000
> --- /home/stephen/langs/emacs/elisp-ds/org-mode/lisp/org.el	 
> 2010-02-01 15:17:45.000000000 +0000
> ***************
> *** 7669,7679 ****
>
>       ((eq major-mode 'dired-mode)
>        ;; link to the file in the current line
> !       (setq cpltxt (concat "file:"
> ! 			   (abbreviate-file-name
> ! 			    (expand-file-name
> ! 			     (dired-get-filename nil t))))
> ! 	    link (org-make-link cpltxt)))
>
>       ((and buffer-file-name (org-mode-p))
>        (setq custom-id (ignore-errors (org-entry-get nil  
> "CUSTOM_ID")))
> --- 7669,7682 ----
>
>       ((eq major-mode 'dired-mode)
>        ;; link to the file in the current line
> !       (let ((file (dired-get-filename nil t)))
> ! 	(setq file (if file
> ! 		       (abbreviate-file-name
> ! 			(expand-file-name (dired-get-filename nil t)))
> ! 		     ;; otherwise, no file so use current directory.
> ! 		     default-directory))
> ! 	(setq cpltxt (concat "file:" file)
> ! 	      link (org-make-link cpltxt))))
>
>       ((and buffer-file-name (org-mode-p))
>        (setq custom-id (ignore-errors (org-entry-get nil  
> "CUSTOM_ID")))
>
>
>
>
> _______________________________________________
> 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

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-02  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-01 15:23 Patch for links to dired buffers Stephen Eglen
2010-02-02  6:22 ` Carsten Dominik

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).