all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* removing extraneous information in repeat-complex-command
@ 2023-01-07 18:59 Frederick Bartlett
  2023-01-07 22:02 ` Emanuel Berg
  2023-01-07 22:14 ` [External] : " Drew Adams
  0 siblings, 2 replies; 3+ messages in thread
From: Frederick Bartlett @ 2023-01-07 18:59 UTC (permalink / raw)
  To: help-gnu-emacs

Is there a simple way to resimplify complex commands?

E.g, after
     (query-replace "<^J/script>" "</script>" nil nil nil nil nil)

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.

I strongly prefer the former.

Alternatively, if this can only be solved via a macro, I'd appreciate a
clue or two. While I have written a few in the past, I'm not sure how to
approach this.

Thanks!
Fred


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: removing extraneous information in repeat-complex-command
  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 ` [External] : " Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2023-01-07 22:02 UTC (permalink / raw)
  To: help-gnu-emacs

Frederick Bartlett wrote:

> Is there a simple way to resimplify complex commands? [...]
> Alternatively, if this can only be solved via a macro, I'd
> appreciate a clue or two. While I have written a few in the
> past, I'm not sure how to approach this.

Well, what are you trying to do exactly?

(eval (car command-history))

?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [External] : removing extraneous information in repeat-complex-command
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2023-01-07 22:14 UTC (permalink / raw)
  To: Frederick Bartlett, help-gnu-emacs@gnu.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-07 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [External] : " Drew Adams

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.