Tools for grepping in Emacs

Jonathan Lange jml at mumak.net
Tue Apr 28 09:44:02 BST 2009


On Sun, Apr 12, 2009 at 4:48 PM, Alexander Belchenko <bialix at ukr.net> wrote:
> I don't understand Emacs Lisp but I see you're using simple shell commands,
> so I'll try to comment on this:
>
> ;; Run 'code' at the root of the branch which dirname is in.
> (defmacro at-branch-root (dirname &rest code)
>  `(with-cd (search-upwards ".bzr" (expand-file-name ,dirname)) , at code))
>
> There is `bzr root` command. I don't understand the snippet above, but it seems
> you can use it to cd to branch root, is not?
>

Yeah, I could. In this case, there's no real need to spawn a separate
bzr process to get the root directory, since it's simple enough to
traverse up the directory tree.

>
>   (grep-find (format "bzr ls -V --null | xargs -0 grep -In %s" expression))))
>
>
> `bzr ls` has option --kind=file. You can use it to search only in versioned files,
> not in the symlinks or directories.
>

Nice catch. I've changed the code to use that, and also to use the new
-R option, which appears necessary.

jml



More information about the bazaar mailing list