- (when (string-match "\\`\\([0-9]+\\):\\(.*\\)\\'" x)
- (let ((file-name counsel--git-grep-dir)
- (line-number (match-string-no-properties 1 x)))
+ (let ((default-directory (file-name-directory counsel--git-grep-dir))
+ file-name line-number)
+ (when (cond ((string-match "\\`\\([0-9]+\\):\\(.*\\)\\'" x)
+ (setq file-name counsel--git-grep-dir)
+ (setq line-number (match-string-no-properties 1 x)))
+ ((string-match "\\`\\([^:]+\\):\\([0-9]+\\):\\(.*\\)\\'" x)
+ (setq file-name (match-string-no-properties 1 x))
+ (setq line-number (match-string-no-properties 2 x)))
+ (t nil))