Permalink
Browse files

* helm-regexp.el (helm-m-occur-action): Issue #113 Go to first occure…

…nce.
  • Loading branch information...
1 parent 03249ee commit e74a82f3739ec2a08f2b172c572928e3a4dff26c @thierryvolpiatto thierryvolpiatto committed Sep 12, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 helm-regexp.el
View
4 helm-regexp.el
@@ -217,7 +217,9 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(buffer (switch-to-buffer buf))
(buffer-other-window (switch-to-buffer-other-window buf))
(buffer-other-frame (switch-to-buffer-other-frame buf)))
- (helm-goto-line lineno)))
+ (helm-goto-line lineno)
+ (when (re-search-forward helm-pattern (point-at-eol) t)
+ (goto-char (match-beginning 0)))))
(defun helm-m-occur-persistent-action (candidate)
(helm-m-occur-goto-line candidate)

6 comments on commit e74a82f

@lewang
emacs-helm member

This works not for multi-line matches.

@lewang
emacs-helm member

In fact the line number I see in the completion buffer is that of the last line in a multi-line match. This should probably the frist line.

@thierryvolpiatto
emacs-helm member
@lewang
emacs-helm member

Newline works with occur (C-q C-j in minibuffer). It works as well as single line matches AFAICT. Example output:

13 matches for "end^J " in buffer: ruby.rb
     42:              end
       :            end
     55:            end
       :          end
     59:        end
       :      rescue Error => err
     63:      end
       :      return nil
     81:        end
       :      end
    105:    end
       :  end
    113:    end
       :  end
    160:            end
       :            line_no = tk.line_no.to_s
    171:            end
       :          end
    190:            end
       :          else
    194:          end
       :          reset_comment = false
    199:        end
       :      end
    217:      end
       :    end
@lewang
emacs-helm member

It' s not a common use-case for me, but still, it should work. :)

@thierryvolpiatto
emacs-helm member
Please sign in to comment.