helm-projectile 하드코딩으로 붙이는 –ignore 옵션 제거하기

less than 1 minute read

| C-c p s s | projectile-ag |

windows에서 이 편한 함수를 사용 못 하고 있다. 에러 메시지를 보니 --ignore 옵션은 없단다. windows에서 ag 대신 ripgrep을 사용하고 있다. 이게 문제인 것 같다.

;;; helm-projectile.el
(defun helm-projectile-ag (&optional options)
  ;; ...
  (ignored (mapconcat (lambda (i)
                        (concat "--ignore " i))
                      ;; ...
                      ))
  ;; ...
  (helm-ag-base-command (concat helm-ag-base-command " " ignored))
  ;; ...

찾아보니 하드코딩.

(when windows?
  (advice-add
   'helm-do-ag
   :before (lambda (&rest _)
             (setq helm-ag-base-command
                   (replace-regexp-in-string
                    "--ignore.*"
                    ""
                    helm-ag-base-command)))))

advice system 함수를 사용해 --ignore 옵션 뒤에 붙은 거 싹 날려버렸다.

C-x C-s C-x C-c