git.fiddlerwoaroof.com
Browse code

emacs: fix helm-rg

Ed Langley authored on 27/07/2019 22:30:58
Showing 1 changed files
... ...
@@ -87,7 +87,25 @@ started from a shell."
87 87
                  packages)))
88 88
 
89 89
 (defun post-init ()
90
-            ;;;;; INDENTATION SETUP  {{{
90
+  ;;;;; INDENTATION SETUP  {{{
91
+  (defun helm-projectile-rg ()
92
+    "Projectile version of `helm-rg'."
93
+    (interactive)
94
+    (if (require 'helm-rg nil t)
95
+        (if (projectile-project-p)
96
+            (let ((helm-rg-prepend-file-name-line-at-top-of-matches nil)
97
+                  (helm-rg-include-file-on-every-match-line t))
98
+              (helm-rg (helm-projectile-rg--region-selection)
99
+                       nil
100
+                       (list (projectile-project-root))))
101
+          (error "You're not in a project"))
102
+      (when (yes-or-no-p "`helm-rg' is not installed. Install? ")
103
+        (condition-case nil
104
+            (progn
105
+              (package-install 'helm-rg)
106
+              (helm-projectile-rg))
107
+          (error "`helm-rg' is not available.  Is MELPA in your `package-archives'?")))))
108
+
91 109
   (centaur-tabs-mode 1)
92 110
   (progn
93 111
     (setq-default indent-tabs-mode nil
... ...
@@ -122,6 +140,7 @@ started from a shell."
122 140
   (setq fwoar.is-ordinary (not (string= invocation-name "EmacsNotes")))
123 141
   (add-hook 'after-init-hook 'post-init)
124 142
 
143
+
125 144
   (when (file-exists-p "/usr/local/bin/gls")
126 145
     (setq insert-directory-program "/usr/local/bin/gls"))
127 146