summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/init-files.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/init-files.el b/lisp/init-files.el
index 1f8e846..104ca44 100644
--- a/lisp/init-files.el
+++ b/lisp/init-files.el
@@ -46,7 +46,10 @@
(defun km/dired-jump-file-at-point ()
"Run `dired-jump' on file at point."
(interactive)
- (let ((file (thing-at-point 'filename)))
+ (let ((file (or (and (use-region-p)
+ (buffer-substring-no-properties
+ (region-beginning) (region-end)))
+ (thing-at-point 'filename))))
(if (and file (file-exists-p file))
(dired-jump 'other-window (expand-file-name file))
(user-error "No file at point"))))