1

どのように dired-do-search に、より見やすい isearch-face を使用させるか、または少なくとも見つかったトークン全体を強調表示させるにはどうすればよいでしょうか?

編集中にそれほど邪魔にならない場合は、カーソルの点滅が代替手段になります。

再表明

文字列「hello」を実行するisearch-forwardと、下の画像に示すように、検索中にその文字列が強調表示されます。

画像1

代わりに dired(-x) モードになっている場合は、次の図に示すようにファイルをマークします。

画像2

次に、文字列「hello」に対して dired-do-search を実行すると、文字列が見つかりますが、以下に示すように強調表示されません。

画像3

dired-do-search で isearch-forward と同じ顔を使用するにはどうすればよいですか? この例では、カーソルを見つけるのは簡単ですが、フォントロックを頻繁に使用する大きなディスプレイでは、カーソルに穏やかで目立たない顔を選択した後、検索の場所を見つけるのはかなり困難ですストリング。

アップデート

以下の答えは、この問題を解決する最も簡単な方法ですか?

4

1 に答える 1

0

おそらくあなたは探しているdired-do-isearchか、dired-do-isearch-regexp

と同じ感覚が必要なら、カスタムと操作 dired-do-searchで呼び出す defun を作成することもできるようです。tags-loop-continuetags-loop-operatetags-loop-scan

これが私が思いついたものです:

(defvar dired-do-search-overlay nil)
(defvar dired-do-search-region nil)
(defun dired-do-search (regexp)
  "Search through all marked files for a match for REGEXP.
Stops when a match is found.
To continue searching for next match, use command \\[tags-loop-continue]."
  (interactive "sSearch marked files (regexp): ")
  (setq 
   tags-loop-operate `(progn 
            (if dired-do-search-overlay
                (delete-overlay dired-do-search-overlay))
            (setq dired-do-search-overlay 
                  (make-overlay (car dired-do-search-region)
                        (cadr dired-do-search-region)))
            (overlay-put dired-do-search-overlay
                     'face isearch-face)
            (overlay-put dired-do-search-overlay
                     'priority 1001)    
            nil)
   tags-loop-scan `(progn
             (if (re-search-forward ',regexp nil t)
             (setq dired-do-search-region 
                   (list (match-beginning 0)
                     (match-end 0)))
               (if dired-do-search-overlay 
               (delete-overlay dired-do-search-overlay))
               nil)))
  (tags-loop-continue 
   (or '(dired-get-marked-files nil nil 'dired-nondirectory-p) t)))
于 2013-07-04T02:53:01.703 に答える