From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Eglen Subject: Patch for links to dired buffers Date: Mon, 01 Feb 2010 15:23:24 +0000 Message-ID: <13564.1265037804@maps> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nby8P-0007Lr-Ng for emacs-orgmode@gnu.org; Mon, 01 Feb 2010 10:24:17 -0500 Received: from [199.232.76.173] (port=39808 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nby8P-0007LW-3A for emacs-orgmode@gnu.org; Mon, 01 Feb 2010 10:24:17 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nby7c-0003NO-2Y for emacs-orgmode@gnu.org; Mon, 01 Feb 2010 10:24:16 -0500 Received: from ppsw-0.csi.cam.ac.uk ([131.111.8.130]:38478) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nby7a-0003Lv-Ab for emacs-orgmode@gnu.org; Mon, 01 Feb 2010 10:23:26 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 * 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")))