[Top][All Lists]

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

[Orgmode] Patch for links to dired buffers

From: Stephen Eglen
Subject: [Orgmode] Patch for links to dired buffers
Date: Mon, 01 Feb 2010 15:23:24 +0000

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

*** /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 via email to

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