Didier Verna <verna(a)inf.enst.fr> writes:
In addition to the bug Hrvoje fixed in isearch, I'd like to
propose
the following patch to generalize the behavior of isearch (which is
the Right One) to other searches as well. (...)
I agree with your proposal.
One important point: there are 2 interface changes in this patch:
the routine isearch-no-upper-case-p is moved away from isearch.el in
order to be used anywhere else, so the isearch- prefixe is removed.
Two comments:
* You should make an obsolete isearch- alias so that old compiled code
that uses the `with-caps-disable-folding' macro doesn't fail;
* FSF Emacs has a different version of `isearch-no-upper-case-p',
which perhaps works better. (our has a "fixme" comment.)
The other one is one more argument (regexp-flag) to the macro
with-caps-disable-folding, which is moved away from isearch too.
I think we can afford those changes: they lead to only 2 other
modifications in the core lisp packages, and none of the packages I
have installed (almost all of them) use those functions.
This is problematic. For all I know, there can be valid user code
that uses that macro. Adding an argument will make all that code
fail. I think you should choose a different name, or perhaps a new
macro (`with-caps-disable-folding-regexp'?)
The argument that the changes are affordable because the packages
don't use the macro does not stand because we don't know how much user
code uses the macros. What we call "packages" is but one part of Lisp
code written by our users. With your changes, otherwise perfectly
valid code using documented interface will fail in various obscure
ways.
+(put 'with-caps-disable-folding 'lisp-indent-function 1)
+(put 'with-caps-disable-folding 'edebug-form-spec '(form body))
These two are wrong if you add the REGEXP argument.
- (kill-region (point) (progn
+ (kill-region (point) (let ((case-fold-search
+ (if (and (interactive-p)
+ case-fold-search
+ search-caps-disable-folding)
+ (no-upper-case-p (char-to-string char))
+ case-fold-search)))
Didier, you can't add this blob to every function under the sun -- it
will be a maintenance nightmare! You should write a modification of
the `with-caps-disable-folding' macro and use it consistently.
--
Hrvoje Niksic <hniksic(a)srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth