emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Patch for links to dired buffers


From: Carsten Dominik
Subject: Re: [Orgmode] Patch for links to dired buffers
Date: Tue, 2 Feb 2010 07:22:40 +0100

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  <address@hidden>

        * 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.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten







reply via email to

[Prev in Thread] Current Thread [Next in Thread]