all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: [el-search] How to search string excluding docstring?
Date: Tue, 26 Dec 2017 14:34:51 +0100	[thread overview]
Message-ID: <867et9sjd0.fsf@zoho.com> (raw)
In-Reply-To: 86inculbeq.fsf@zoho.com

YT wrote:

>>> Is this really what you mean? Surly that
>>> isn't implemented as mere regexps?!
>>
>> I'd be very surprised if it were.
>
> So why did you bring it up to begin with?

OK, so now I understand how regexps entered
this discussion! "You can't use grep with
regexps", because it isn't a Lisp parser so it
can't answer the kind of questions that require
you to crunch it down token by token!"

And that's true! Regexps are sometimes
underestimated. Because they cannot do
everything, it doesn't mean they cannot do
a lot, still. But it will never be a perfect
fallout and the result may also be confusing as
semantically the same Lisp, and the same
regexp, can still yield different results.

So you can use grep to search your Elisp, but
not to query your Elisp and expect 100%
consistent/correct/complete answers. If this is
the goal, even to use font lock, which probably
itself uses some half baked method to find out,
to use font lock would be a clever hack
at best.

The reason you can still use grep or font lock
or any other such method is that in the world
of editing code, these are just tools to do
things. An imperfect tool can still help you do
things. And a perfect tool, which is 100 times
more advanced than the imperfect tool, will not
be 100 times more helpful to you.

If we then switch worlds from the
practical/editing to the abstract/theoretical,
to parse the code, or eval it like Lisp does,
this is already capable of telling if something
is a docstring or not. Just do C-h
f forward-char RET !

However here there is a collision between the
two worlds. Because where is point?
Over which element to begin with, when the
query is executed? If one knows that, one could
simply get the defun as a list (which it
already is) and ask, "is the 4th element
a string?". If it is, and if point's at it in
the buffer, then yes it is a docstring.

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


  parent reply	other threads:[~2017-12-26 13:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.6328.1514197667.27995.help-gnu-emacs@gnu.org>
2017-12-25 12:00 ` [el-search] How to search string excluding docstring? Emanuel Berg
2017-12-25 13:57   ` Chunyang Xu
2017-12-25 14:34     ` Michael Heerdegen
     [not found]   ` <mailman.6334.1514210258.27995.help-gnu-emacs@gnu.org>
2017-12-25 14:08     ` Emanuel Berg
2017-12-25 17:55       ` tomas
     [not found]       ` <mailman.6358.1514224565.27995.help-gnu-emacs@gnu.org>
2017-12-25 18:11         ` Emanuel Berg
2017-12-25 19:14           ` tomas
     [not found]           ` <mailman.6366.1514229270.27995.help-gnu-emacs@gnu.org>
2017-12-25 19:36             ` Emanuel Berg
2017-12-25 21:20               ` tomas
     [not found]               ` <mailman.6371.1514236843.27995.help-gnu-emacs@gnu.org>
2017-12-25 21:56                 ` Emanuel Berg
2017-12-26  2:44                   ` Emanuel Berg
2017-12-26 13:34                   ` Emanuel Berg [this message]
2017-12-26 13:48                     ` Jean-Christophe Helary
     [not found]                     ` <mailman.6381.1514296097.27995.help-gnu-emacs@gnu.org>
2017-12-26 15:19                       ` Emanuel Berg
2017-12-27  5:38                     ` Chunyang Xu
2017-12-27 13:58                       ` Michael Heerdegen
     [not found]                     ` <mailman.6406.1514353148.27995.help-gnu-emacs@gnu.org>
2017-12-27  6:58                       ` Emanuel Berg
2017-12-25 19:39             ` Emanuel Berg
2017-12-25 10:27 Chunyang Xu
2017-12-25 10:40 ` Jean-Christophe Helary
2017-12-25 12:00 ` Skip Montanaro
2017-12-25 18:04   ` Michael Heerdegen
2017-12-25 14:56 ` Michael Heerdegen
2017-12-25 16:58   ` Chunyang Xu
2017-12-25 17:51     ` Michael Heerdegen
     [not found] ` <mailman.6340.1514213787.27995.help-gnu-emacs@gnu.org>
2017-12-25 15:50   ` Emanuel Berg
2017-12-25 16:59     ` Michael Heerdegen
     [not found]     ` <mailman.6351.1514221174.27995.help-gnu-emacs@gnu.org>
2017-12-25 18:04       ` Emanuel Berg

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=867et9sjd0.fsf@zoho.com \
    --to=moasen@zoho.com \
    --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.