summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-02-02 07:22:27 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-02-02 07:22:27 +0100
commit2cd16d4cd5ac8be1497f793cf366cb6403f0e7f9 (patch)
tree32ca01b827b8e0e2ac5e8eba40be19599df63154
parent05f7b57556caa1e2151aa2f9a3c8718b81617888 (diff)
downloadorg-mode-2cd16d4cd5ac8be1497f793cf366cb6403f0e7f9.tar.gz
Make org-store-link point to directory in a dired buffer
When the cursor is not in a line listing a file, that is.
-rwxr-xr-xlisp/ChangeLog6
-rw-r--r--lisp/org.el13
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9753371..646d244 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
diff --git a/lisp/org.el b/lisp/org.el
index 2a98322..9488bf6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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")))