summaryrefslogtreecommitdiff
path: root/helm-regexp.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2015-06-15 14:02:15 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2015-06-15 14:02:15 +0200
commit4f41c509a4077721ac854cdf066945610849da81 (patch)
tree50146d020006cf16d85e60a31312b987e442b5a2 /helm-regexp.el
parent832a4ecd8cee3116851f46947789338f3afde51a (diff)
Start fixing actions to reuse window if available (#1064).
* helm-regexp.el (helm-moccur-action): Do it.
Diffstat (limited to 'helm-regexp.el')
-rw-r--r--helm-regexp.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/helm-regexp.el b/helm-regexp.el
index 5e6d8af5..26e39a9a 100644
--- a/helm-regexp.el
+++ b/helm-regexp.el
@@ -223,9 +223,11 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(let* ((split (helm-grep-split-line candidate))
(buf (car split))
(lineno (string-to-number (nth 1 split)))
- (split-pat (helm-mp-split-pattern helm-input)))
+ (split-pat (helm-mp-split-pattern helm-input))
+ (switch-fn (if (get-buffer-window buf 'visible)
+ #'pop-to-buffer #'switch-to-buffer)))
(cl-case method
- (buffer (switch-to-buffer buf))
+ (buffer (funcall switch-fn buf))
(buffer-other-window (switch-to-buffer-other-window buf))
(buffer-other-frame (switch-to-buffer-other-frame buf)))
(helm-goto-line lineno)