Skip to content

Commit

Permalink
Simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
raxod502 authored and dajva committed Dec 30, 2019
1 parent 39814b2 commit 36ca9c2
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions rg.el
Expand Up @@ -341,17 +341,10 @@ If LITERAL is non nil prompt for literal string. DEFAULT is the default pattern
(let ((project (project-current)))
(when project
(car (project-roots project)))))
(condition-case nil
(let* ((file (or file default-directory))
(backend (vc-responsible-backend file)))
(vc-call-backend backend 'root file))
(error (if file
(or (file-name-directory file)
;; in case FILE is a relative path with no
;; directory component
default-directory)
;; in case we're not visiting any file
default-directory)))))
(let ((file (expand-file-name (or file default-directory))))
(condition-case nil
(vc-call-backend (vc-responsible-backend file) 'root file)
(error (file-name-directory file))))))

(defun rg-run (pattern files dir &optional literal confirm flags)
"Execute rg command with supplied PATTERN, FILES and DIR.
Expand Down

0 comments on commit 36ca9c2

Please sign in to comment.