カーソル下の単語をgrepする(改悪版)

この記事は2年以上前に書いたものです。
そのため情報が古い可能性があります。ご了承ください。m(_ _)m

tips/カーソル下の単語を grep する – XyzzyWiki
を参考にして、機能縮小版。
個人的に、「検索対象のファイルは現在のファイルと同じ拡張子のみ」が要らなかったんで。

(defun grep-current-directory-at-word ()
  (interactive)
  (let ((filename (get-buffer-file-name))
        (pattern (ed::get-winhelp-topic)))

        (progn
          (require "grepd")
          (ed::scan-files pattern (or (car ed::*grep-file-history*) "*.*") (directory-namestring filename))
          )
      (if (not filename)
          (message "ファイル名無いよ")
        (message "検索するWordが無いよ"))))
  )

(defun grep-dialog-with-word-and-filename ()
  (interactive)
  (unless (pre-selection-p)
    (skip-syntax-spec-forward "w_")
    (ed::begin-selection)
    (skip-syntax-spec-backward "w_"))
  (grep-dialog)
  )

(global-set-key #\C-8 #'grep-current-directory-at-word)
(global-set-key #\C-9 #'grep-dialog-with-word-and-filename)

カテゴリー: ソフトウェア タグ: , , パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です