From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Patch for links to dired buffers Date: Tue, 2 Feb 2010 07:22:40 +0100 Message-ID: <393B69A9-9FC4-4411-B7D5-D914D4C4F3D1@gmail.com> References: <13564.1265037804@maps> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcD7B-0006VQ-Th for emacs-orgmode@gnu.org; Tue, 02 Feb 2010 02:24:02 -0500 Received: from [199.232.76.173] (port=35118 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcD7A-0006Ut-Qq for emacs-orgmode@gnu.org; Tue, 02 Feb 2010 02:24:01 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcD77-00081K-Rx for emacs-orgmode@gnu.org; Tue, 02 Feb 2010 02:23:58 -0500 Received: from mail-ew0-f211.google.com ([209.85.219.211]:38527) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NcD76-0007wL-Hh for emacs-orgmode@gnu.org; Tue, 02 Feb 2010 02:23:57 -0500 Received: by mail-ew0-f211.google.com with SMTP id 3so442245ewy.33 for ; Mon, 01 Feb 2010 23:23:56 -0800 (PST) In-Reply-To: <13564.1265037804@maps> 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: Stephen Eglen Cc: emacs-orgmode@gnu.org 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 > > * 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