0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

counsel-rg で 2 が返ると一覧が消える問題

Last updated at Posted at 2023-11-02

counsel-rg はとても便利なので、月に1,2度使うのだが、rg が return 2 を返すと counsel の一覧が消えてしまう。
man rg をすると return 2 が返るのは例えばファイルを読む権限がなかったときとかのようだ。
でも、そんなの気にせずに検索結果を見たいのだ。

ま、上記の通りだが、after! ってなんだ?

ともかく

(with-eval-after-load 'counsel
  (advice-add 'counsel-rg
              :around
              (lambda (func &rest args)
                (cl-flet ((filter-func (code) (if (= code 2) 0 code)))
                  (unwind-protect
                      (progn (advice-add 'process-exit-status :filter-return #'filter-func)
                             (apply func args))
                    (advice-remove 'process-exit-status #'filter-func))))))

を use-package counsel のあとでやってやれば解決。 2 のときに 0 を返してくれるので、一覧は消えない。

after! がなにかわからなかったが、これは doomemacs の人はどっかで定義されててつかえる function なんだろうか?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?