From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Breaking news: What did the IETF ever do for us? The *entire* list! Date: Fri, 03 Apr 2015 03:42:31 +0200 Organization: Aioe.org NNTP Server Message-ID: <87a8yqugvs.fsf@debian.uxu> References: <87619f8dmk.fsf@debian.uxu> <87k2xvus4s.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428025219 6975 80.91.229.3 (3 Apr 2015 01:40:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Apr 2015 01:40:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 03 03:40:19 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ydqan-00024V-Kj for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Apr 2015 03:40:17 +0200 Original-Received: from localhost ([::1]:60623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ydqam-0002Qk-QM for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Apr 2015 21:40:16 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:zfiHkiF0NvKdgBUsvt+qkB1+nuM= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:211240 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103522 Archived-At: "Pascal J. Bourguignon" 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