[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f60d10e 075/167: "C-x C-f M-n" can call ffap-url-fetcher w
From: |
Oleh Krehel |
Subject: |
[elpa] master f60d10e 075/167: "C-x C-f M-n" can call ffap-url-fetcher when at URL |
Date: |
Tue, 08 Dec 2015 10:49:59 +0000 |
branch: master
commit f60d10e5ae51d1289631e0597a9c9e0a1c5e1ca2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
"C-x C-f M-n" can call ffap-url-fetcher when at URL
* ivy.el (ivy--cd-maybe): Check if the input is a valid URL.
If so, exit immediately by calling (funcall ffap-url-fetcher url).
Otherwise, do the usual `ivy--cd' thing.
---
ivy.el | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/ivy.el b/ivy.el
index af9f389..6a900fb 100644
--- a/ivy.el
+++ b/ivy.el
@@ -693,16 +693,26 @@ Call the permanent action if possible."
(defun ivy--cd-maybe ()
"Check if the current input points to a different directory.
If so, move to that directory, while keeping only the file name."
+ (require 'ffap)
(when ivy--directory
- (let* ((input (expand-file-name (ivy--input)))
- (file (file-name-nondirectory input))
- (dir (expand-file-name (file-name-directory input))))
- (if (string= dir ivy--directory)
+ (let ((input (ivy--input))
+ url)
+ (if (setq url (ffap-url-p input))
(progn
- (delete-minibuffer-contents)
- (insert file))
- (ivy--cd dir)
- (insert file)))))
+ (ivy-set-action
+ (lambda (_)
+ (funcall ffap-url-fetcher url)))
+ (setq ivy-exit 'done)
+ (exit-minibuffer))
+ (setq input (expand-file-name input))
+ (let ((file (file-name-nondirectory input))
+ (dir (expand-file-name (file-name-directory input))))
+ (if (string= dir ivy--directory)
+ (progn
+ (delete-minibuffer-contents)
+ (insert file))
+ (ivy--cd dir)
+ (insert file)))))))
(defun ivy--maybe-scroll-history ()
"If the selected history element has an index, scroll there."
- [elpa] master 607fd1f 061/167: Bring back the lost perfect match logic, (continued)
- [elpa] master 607fd1f 061/167: Bring back the lost perfect match logic, Oleh Krehel, 2015/12/08
- [elpa] master f0acebd 063/167: Fix Custom menus, Oleh Krehel, 2015/12/08
- [elpa] master f6dd9cd 066/167: ivy.el (ivy-alt-done): Fix up last commit, Oleh Krehel, 2015/12/08
- [elpa] master a11c978 068/167: ivy-immediate-done should use ivy--directory, Oleh Krehel, 2015/12/08
- [elpa] master d8673f8 078/167: ivy.el (ffap): Move require, Oleh Krehel, 2015/12/08
- [elpa] master 47f53b6 073/167: counsel.el (counsel--find-symbol): Resolve name clash better, Oleh Krehel, 2015/12/08
- [elpa] master dc84ba3 070/167: Rename and move the minibuffer faces, Oleh Krehel, 2015/12/08
- [elpa] master 183b803 071/167: Use a specific blending method for dark themes, Oleh Krehel, 2015/12/08
- [elpa] master f9ef307 072/167: Improve the preselect index in ivy-resume, Oleh Krehel, 2015/12/08
- [elpa] master 576563d 082/167: ivy.el (with-ivy-window): Ensure window is live, Oleh Krehel, 2015/12/08
- [elpa] master f60d10e 075/167: "C-x C-f M-n" can call ffap-url-fetcher when at URL,
Oleh Krehel <=
- [elpa] master bd93a0f 081/167: ivy.el (ivy-state): Add a new field BUFFER, Oleh Krehel, 2015/12/08
- [elpa] master 202546b 080/167: swiper.el (swiper-mc): Update, Oleh Krehel, 2015/12/08
- [elpa] master f00696a 056/167: ivy.el (ivy-extra-directories): Improve :type, Oleh Krehel, 2015/12/08
- [elpa] master e338785 057/167: ivy.el (ivy-sort-functions-alist): Upgrade to defcustom, Oleh Krehel, 2015/12/08
- [elpa] master 71695df 065/167: "C-j" should not stop completion for a pasted file path, Oleh Krehel, 2015/12/08
- [elpa] master dfd6204 064/167: Fix pasting file paths on Windows, Oleh Krehel, 2015/12/08
- [elpa] master 1af25f6 067/167: swiper.el (swiper-font-lock-ensure): Amend exception list, Oleh Krehel, 2015/12/08
- [elpa] master 5f22310 069/167: counsel.el (counsel-git): Update default-directory, Oleh Krehel, 2015/12/08
- [elpa] master 4a04d6e 031/167: Default ivy-display-style to 'fancy for Emacs>=24.5, Oleh Krehel, 2015/12/08
- [elpa] master 3ae4f1a 052/167: ivy-test.el (swiper--re-builder): Update, Oleh Krehel, 2015/12/08