From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Breaking news: What did the IETF ever do for us? The *entire* list!
Date: Fri, 03 Apr 2015 03:42:31 +0200 [thread overview]
Message-ID: <87a8yqugvs.fsf@debian.uxu> (raw)
In-Reply-To: 87k2xvus4s.fsf@kuiper.lan.informatimago.com
"Pascal J. Bourguignon" <pjb@informatimago.com>
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
next prev parent reply other threads:[~2015-04-03 1:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-02 2:31 Breaking news: What did the IETF ever do for us? The *entire* list! Emanuel Berg
2015-04-02 2:59 ` Alexis
2015-04-02 7:11 ` tomas
2015-04-02 7:35 ` Alexis
2015-04-02 7:51 ` tomas
2015-04-02 3:27 ` Pascal J. Bourguignon
2015-04-02 22:56 ` Emanuel Berg
2015-04-03 1:42 ` Emanuel Berg [this message]
2015-04-03 1:33 ` Pascal J. Bourguignon
2015-04-04 1:30 ` Emanuel Berg
[not found] ` <mailman.3167.1427943592.31049.help-gnu-emacs@gnu.org>
2015-04-02 14:40 ` Udyant Wig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8yqugvs.fsf@debian.uxu \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.