Make org-store-link point to directory in a dired buffer

When the cursor is not in a line listing a file, that is.
This commit is contained in:
Carsten Dominik 2010-02-02 07:22:27 +01:00
parent 05f7b57556
commit 2cd16d4cd5
2 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2010-02-02 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.
2010-02-02 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-concatenate-multiline-links): The for

View File

@ -7669,11 +7669,14 @@ For file links, arg negates `org-context-in-file-links'."
((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)))
(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")))