Emacs grep在选择时查找
当我在emacs中使用grep find时,我想搜索我选择的文本,这是很常见的。我目前的解决方法是选择文本,然后M-x grep查找并粘贴所选内容。如何创建自动执行此操作的密钥绑定?这里是一个修改的grep find-如果区域处于活动状态,则搜索区域 目录它似乎在我的系统上工作:Emacs grep在选择时查找,emacs,grep,elisp,Emacs,Grep,Elisp,当我在emacs中使用grep find时,我想搜索我选择的文本,这是很常见的。我目前的解决方法是选择文本,然后M-x grep查找并粘贴所选内容。如何创建自动执行此操作的密钥绑定?这里是一个修改的grep find-如果区域处于活动状态,则搜索区域 目录它似乎在我的系统上工作: (defun grep-find (command-args) "Run grep via find, with user-specified args COMMAND-ARGS. Collect output i
(defun grep-find (command-args)
"Run grep via find, with user-specified args COMMAND-ARGS.
Collect output in a buffer.
While find runs asynchronously, you can use the \\[next-error] command
to find the text that grep hits refer to.
This command uses a special history list for its arguments, so you can
easily repeat a find command."
(interactive
(progn
(grep-compute-defaults)
(if grep-find-command
(list
(read-shell-command
"Run find (like this): "
(if (region-active-p)
(let ((str
(buffer-substring-no-properties
(region-beginning)
(region-end))))
(cons (replace-regexp-in-string
" {}"
(concat str " {}")
(car grep-find-command))
(+ (cdr grep-find-command)
(length str))))
grep-find-command) 'grep-find-history))
;; No default was set
(read-string
"compile.el: No `grep-find-command' command available. Press RET.")
(list nil))))
(when command-args
(let ((null-device nil))
(grep command-args))))
我得到以下错误:在字符串中替换regexp:错误的类型参数:listp,find-类型f-和-名称'~'-o-name'*'-o-path'*/.svn/'-print0 | xargs-0-e grep-n-e grep find看起来像这样:find-类型f-和-名字'~'-o-name'*'-o-path'*/.svn/'-print0 | xargs-0-e grep-n-eDo你有什么想法吗?