summaryrefslogtreecommitdiff
path: root/helm-utils.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2015-03-27 09:05:51 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2015-03-27 09:05:51 +0100
commit19aa5718f1f6095ac5df30e689366b8a820e2920 (patch)
tree5ca6a20beda7dab1e08b256eae2d2be7650aee12 /helm-utils.el
parentb58017f6c85cb8367cc01b7ac56949ed54d1024d (diff)
Fix bug in helm-quit-and-find-file introduced by (#948).
* helm-utils.el (helm-quit-and-find-file): Do it.
Diffstat (limited to 'helm-utils.el')
-rw-r--r--helm-utils.el55
1 files changed, 31 insertions, 24 deletions
diff --git a/helm-utils.el b/helm-utils.el
index 6d6c9e84..9a85322d 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -341,34 +341,41 @@ from its directory."
(grep-line (and (stringp sel)
(helm-grep-split-line sel)))
(bmk-name (and (stringp sel)
+ (not grep-line)
(replace-regexp-in-string "\\`\\*" "" sel)))
(bmk (and bmk-name (assoc bmk-name bookmark-alist)))
+ (buf (helm-aif (get-buffer sel) (buffer-name it)))
(default-preselection (or (buffer-file-name helm-current-buffer)
default-directory)))
- (if (stringp sel)
- (helm-aif (get-buffer (or (get-text-property
- (1- (length sel)) 'buffer-name sel)
- sel))
- (or (buffer-file-name it)
- (car (rassoc it dired-buffers))
- (and (with-current-buffer it
- (eq major-mode 'org-agenda-mode))
- org-directory
- (expand-file-name org-directory))
- (with-current-buffer it default-directory))
- (cond (bmk (helm-aif (bookmark-get-filename bmk)
- (if (and ffap-url-regexp
- (string-match ffap-url-regexp it))
- it (expand-file-name it))
- default-directory))
- ((or (file-remote-p sel)
- (file-exists-p sel))
- (expand-file-name sel))
- ((and grep-line (file-exists-p (car grep-line)))
- (expand-file-name (car grep-line)))
- ((and ffap-url-regexp (string-match ffap-url-regexp sel)) sel)
- (t default-preselection)))
- default-preselection))))
+ (cond
+ ;; Buffer.
+ (buf (or (buffer-file-name sel)
+ (car (rassoc buf dired-buffers))
+ (and (with-current-buffer buf
+ (eq major-mode 'org-agenda-mode))
+ org-directory
+ (expand-file-name org-directory))
+ (with-current-buffer buf default-directory)))
+ ;; Bookmark.
+ (bmk (helm-aif (bookmark-get-filename bmk)
+ (if (and ffap-url-regexp
+ (string-match ffap-url-regexp it))
+ it (expand-file-name it))
+ default-directory))
+ ((or (file-remote-p sel)
+ (file-exists-p sel))
+ (expand-file-name sel))
+ ;; Grep.
+ ((and grep-line (file-exists-p (car grep-line)))
+ (expand-file-name (car grep-line)))
+ ;; Occur.
+ (grep-line
+ (with-current-buffer (get-buffer (car grep-line))
+ (or (buffer-file-name) default-directory)))
+ ;; Url.
+ ((and ffap-url-regexp (string-match ffap-url-regexp sel)) sel)
+ ;; Default.
+ (t default-preselection)))))
;; Same as `vc-directory-exclusion-list'.
(defvar helm-walk-ignore-directories