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

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

Re: use Elisp to improve your Elisp - some code issues


From: Emanuel Berg
Subject: Re: use Elisp to improve your Elisp - some code issues
Date: Sun, 02 Aug 2015 02:06:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

>> It would be more illustrative if you provide
>> a counterexample of the same construct which cannot
>> be caught by that or another regexp. It will be
>> interesting to see if that example is anything
>> I would put in my code, ever.
>
> It's easy. Try to simplify (- x x) for any sexp x,
> (assuming x doesn't side effect. Just something like
> (+ 2 y) or (+ (* a x x) (* b x) c).

...?

The example was finding (if a a b). Didn't you say
regexps couldn't identify all such cases because of
lack of expressiveness with respect to the more
expressive Lisp?

Finding (- x x) should be very easy! And

    ;; find (- x x) - this is line 64
    (search-regexp-in-files "~/.emacs.d/emacs-init/**/*.el" "(- \\(.*\\) \\1)")

indeed shows the result:

    /home/incal/.emacs.d/emacs-init/search-regexp-in-files.el (64)

(By the way, is there a less bulky way to get the
equivalence of [[:space:]\n]* (and ditto +) at all
places where the punctuation and whitespaces now serve
as delimiters?)

If you mean post-evaluation obviously regexps don't
evaluate anything and they don't know Lisp.

But if you or anyone else do this is Lisp - why not in
the byte-compiler? - and it is an improvement either
with respect to finding all occurrences *or* doing
this post-evaluation (I don't know which you mean)
then I'd use that in an instant rather than my stuff
for analyzing Elisp. I don't see how such things can
be identified post-evaluation because that depends on
evaluation, but perhaps if you only use calculation
with fixed digits it works, tho how many people do how
much of that I wonder.

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




reply via email to

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