all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: require basic stuff from specific packages
@ 2016-07-16  7:07 Emanuel Berg
  2016-07-19 20:43 ` EB double-grep function for bash Tomas Nordin
  0 siblings, 1 reply; 2+ messages in thread
From: Emanuel Berg @ 2016-07-16  7:07 UTC (permalink / raw)
  To: help-gnu-emacs

Here is another approach, namely to abandon the
Emacs documentation and help interface and
instead operate directly on the source with
shell tools, i.e. grep.

The advantage is that it works, and even better
perhaps; there is no unsafe `require' just to
get function definitions; and, it is
much faster.

There is also the ease of use advantage because
you can get all Elisp in the world and just
pour it into a directory and there won't be any
conflicts or problems loading or whatever as
it'll just be a bunch of dead text!

All in all, an unusually good solution -
as usual!

(yeah - how *do* you get *all* MELPA and GNU
ELPA code?)

Here is the function:

    double-grep () {
        local first=$1    # e.g., trim   (most unusual concept first!)
        local second=$2   #       string (the the more usual...)

        local context=$3  #  0 => no context: hits must be on same line
        local results=$4  # 10 => show max 10 (double) hits

        local -a files
        files=($@[5,-1])  # e.g., ~/sw/emacs24-24.4+1/lisp/**/*.el

        grep       --color=always -C $context $first  $files \
            | grep --color=always             $second        \
            | head -n $results

        # invocation example:
        #
        #   $ cd ~/sw/emacs24-24.4+1/lisp/
        #   $ double-grep trim string 0 10 **/*.el
    }

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-21 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1702.1468961014.26859.help-gnu-emacs@gnu.org>
2016-07-21 16:21 ` EB double-grep function for bash Emanuel Berg
2016-07-16  7:07 require basic stuff from specific packages Emanuel Berg
2016-07-19 20:43 ` EB double-grep function for bash Tomas Nordin

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.