emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
To: emacs-orgmode@gnu.org
Cc: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
Subject: Patch for links to dired buffers
Date: Mon, 01 Feb 2010 15:23:24 +0000	[thread overview]
Message-ID: <13564.1265037804@maps> (raw)

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

             reply	other threads:[~2010-02-01 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 15:23 Stephen Eglen [this message]
2010-02-02  6:22 ` Patch for links to dired buffers Carsten Dominik

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=13564.1265037804@maps \
    --to=s.j.eglen@damtp.cam.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /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).