unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Frederick Bartlett <frederick.bartlett@gmail.com>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : removing extraneous information in repeat-complex-command
Date: Sat, 7 Jan 2023 22:14:26 +0000	[thread overview]
Message-ID: <SJ0PR10MB54883D7131A31CBA455F400EF3F89@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <CAJr-wt0KikORORSM4om2zQz--cpTJWnSicJZL66bBkFn2UJ3FQ@mail.gmail.com>

> 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.

      parent reply	other threads:[~2023-01-07 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 18:59 removing extraneous information in repeat-complex-command Frederick Bartlett
2023-01-07 22:02 ` Emanuel Berg
2023-01-07 22:14 ` Drew Adams [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB54883D7131A31CBA455F400EF3F89@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=frederick.bartlett@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).