Skip to content

Commit

Permalink
Fix issue when jumping from grep-mode moccur-mode buffers.
Browse files Browse the repository at this point in the history
* helm-grep.el (helm-grep-mode-jump): Cleanup overlays.
(helm-grep-mode-jump-other-window-1): Same.
(helm-grep-mode-jump-other-window): Same.
* helm-regexp.el (helm-moccur-mode-goto-line): Same.
(helm-moccur-mode-goto-line-ow): Same.
* helm-utils.el (helm-highlight-current-line): Ensure helm is alive before
checking for helm-buffer and source.
  • Loading branch information
thierryvolpiatto committed Jan 26, 2017
1 parent 9cd55c6 commit 6459cd3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 5 additions & 2 deletions helm-grep.el
Expand Up @@ -813,14 +813,16 @@ Special commands:
(defun helm-grep-mode-jump ()
(interactive)
(helm-grep-action
(buffer-substring (point-at-bol) (point-at-eol))))
(buffer-substring (point-at-bol) (point-at-eol)))
(helm-match-line-cleanup-pulse))

(defun helm-grep-mode-jump-other-window-1 (arg)
(let ((candidate (buffer-substring (point-at-bol) (point-at-eol))))
(condition-case nil
(progn
(save-selected-window
(helm-grep-action candidate 'other-window)
(helm-match-line-cleanup-pulse)
(recenter))
(forward-line arg))
(error nil))))
Expand All @@ -837,7 +839,8 @@ Special commands:
(interactive)
(let ((candidate (buffer-substring (point-at-bol) (point-at-eol))))
(condition-case nil
(helm-grep-action candidate 'other-window)
(progn (helm-grep-action candidate 'other-window)
(helm-match-line-cleanup-pulse))
(error nil))))


Expand Down
4 changes: 2 additions & 2 deletions helm-regexp.el
Expand Up @@ -439,12 +439,12 @@ Same as `helm-moccur-goto-line' but go in new frame."
(defun helm-moccur-mode-goto-line ()
(interactive)
(helm-aif (get-text-property (point) 'helm-realvalue)
(helm-moccur-goto-line it)))
(progn (helm-moccur-goto-line it) (helm-match-line-cleanup-pulse))))

(defun helm-moccur-mode-goto-line-ow ()
(interactive)
(helm-aif (get-text-property (point) 'helm-realvalue)
(helm-moccur-goto-line-ow it)))
(progn (helm-moccur-goto-line-ow it) (helm-match-line-cleanup-pulse))))

(defun helm-moccur-mode-goto-line-ow-forward-1 (arg)
(condition-case nil
Expand Down
10 changes: 7 additions & 3 deletions helm-utils.el
Expand Up @@ -617,9 +617,13 @@ If STRING is non--nil return instead a space separated string."
(cl-loop with ov
for r in (helm-remove-if-match
"\\`!" (split-string
;; Needed for highlighting AG matches.
(if (with-helm-buffer
(assq 'pcre (helm-get-current-source)))
;; We are maybe not in helm when
;; jumping from helm-grep-mode and
;; helm-moccur-mode buffers.
(if (and helm-alive-p
(with-helm-buffer
;; Needed for highlighting AG matches.
(assq 'pcre (helm-get-current-source))))
(helm--translate-pcre-to-elisp helm-input)
helm-input)))
do (save-excursion
Expand Down

0 comments on commit 6459cd3

Please sign in to comment.