help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Breaking news: What did the IETF ever do for us? The *entire* list!


From: Emanuel Berg
Subject: Re: Breaking news: What did the IETF ever do for us? The *entire* list!
Date: Fri, 03 Apr 2015 03:42:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <address@hidden>
writes:

> Wrong.
>
> 1- it should be written in emacs lisp. 2- you should
> search words using \< \> in regexp, to avoid finding
> "isisCircLevelISPriority" when searching for
> "elisp".
>
> Something like:
>
>     (defvar *rfc-base-directory* "/data/doc/rfc/")
>
>     (defun search-rfc (word) (interactive "sRFC Search
> Word: ") (find-grep (format "find %S -name \\*.txt
> -exec grep -nHi %s {} \\;" (shell-quote-argument
> *rfc-base-directory*) (shell-quote-argument (concat
> "\\<" word "\\>")))))

This is a different function: it doesn't do the rank,
and it shows the the hit fragments. The idea is rather
a function that points you to the right document,
which you then examine peace and quiet.

By the way, *rfc-base-directory* (the asterisks) is
indeed CL (convention) syntax for global variables.

But I agree the word part is a good idea. You can do
that with the 'grep -w' option, so currently the best
version of this function is:

    search-rfc () {
        local search=$1
        files=("${(@f)$(grep -w -i $search -l /usr/share/doc/RFC/*/**.txt)}")
        for f in $files; do
            local data=`grep -w -c -H -i $search $f`
            local occs=${data##*:}
            local filename=${data%:*}
            echo $occs\\t$filename
        done | sort -n -r
    }

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]