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

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

RE: [External] : removing extraneous information in repeat-complex-comma


From: Drew Adams
Subject: RE: [External] : removing extraneous information in repeat-complex-command
Date: Sat, 7 Jan 2023 22:14:26 +0000

> Is there a simple way to resimplify complex commands?
> 
> E.g, after
>      (query-replace "<^J/script>" "</script>" nil nil nil nil nil)

(You don't need to include all those nil's - but
they don't hurt.)

> C-x ESC ESC produced
> (query-replace #("<^J/script>" 0 8 (syntax-table … )) "</script>" nil nil nil 
> nil nil)
> where … represents about 120k characters.
> in the minibuffer.

Do you see the same problem if you start Emacs using
`emacs -Q' (no init file)?  If not, bisect your init
file to find the culprit.

If you do see the same thing, what's your Emacs version?
If you do see the same thing, and if you're using an
Emacs version that's not yet released (e.g. Emacs 29),
then consider filing a bug report: `M-x report-emacs-bug'.

Another possibility is that you didn't in fact use
(query-replace "<^J/script>" "</script>" nil nil nil nil nil)
initially, but in fact the first string arg you provided
was a propertized string, with the properties you see
when you use `repeat-complex-command'.

In that case, you've shot yourself in the foot.  You can
of course write your own function that, before invoking
`query-replace` just removes all text properties from
the first (or both) strings.  For that, use function
`set-text-properties'.

(You don't need a macro for this; just write a function,
with `defun'.)

If this is the case, you might also consider sending an
enhancement request to have `query-replace' do that
itself.  Again, that's `M-x report-emacs-bug'.

I don't think there's any use case for `query-replace'
not to remove text properties (it doesn't affect which
text is found, AFAIK), but perhaps I'm not thinking of
something here.

In any case, if you file and enhancement request or bug
report, someone will let you know, if there's a good
reason why `query-replace' should not remove text
properties from its string args.

reply via email to

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