summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-08-11 01:19:50 -0400
committerKyle Meyer <kyle@kyleam.com>2015-08-11 01:19:50 -0400
commit9a825577040ff0f5b469eeff36eea3d031639193 (patch)
tree867a574382b1906f3c41a9419e3d34a932bdc32b /lisp
parentaa70c4d2407c1d0a2934ac378715ff73c426431a (diff)
downloademacs.d-9a825577040ff0f5b469eeff36eea3d031639193.tar.gz
dired-jump-file-at-point: Use region if active
Diffstat (limited to 'lisp')
-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"))))