all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `quick-calc` inside `query-replace` breaks
@ 2015-07-29 22:39 Tom Roche
  2015-09-10 18:59 ` Tom Roche
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Roche @ 2015-07-29 22:39 UTC (permalink / raw)
  To: help-gnu-emacs


summary: 2 or 3 branched questions (at end) about a change in behavior (24.3.1 -> 24.4.1) when running interactive `quick-calc` inside interactive `query-replace`.

details:

Until yesterday I was using version='GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.4)' (on Debian) and frequently used workflows like the following:

I would compose text with markdown-style footnotes, but instead of enumerating them while composing (which is brittle WRT text rearrangement :-), I would defer the enumeration until I was done. Hence

version#=0 ~=
> Foo![NNN] but also bar[NNN] and baz[NNN].
>
> ===
>
> [NNN]: ...
> [NNN]: ...
> [NNN]: ...

where 'NNN' isa "numerator" (i.e., a template for integers), and '===' isa "fence" between text and footnotes. On "done-ness," I would

1. `query-replace` the "first two" numerators (after the beginning of the document, and after the fence) with '1'

2. recording a macro that interactively `query-replace`d each successive pair of numerators with successive integers.

3. run the macro, checking that the "footnote" matched its text. (This is non-trivial, because

* a footnote can be used more than once
* sometimes I use a footnote inside another footnote

) The macro relied on the facts that

* `query-replace` has an argument stack, accessible via arrow keys: one can retrieve previously-used arguments for the current call.

* `query-replace` arguments could be modified *from the stack*. E.g., after doing `query-replace NNN 1', I could record the following sequence:

1. `M-x query-replace`

2. sequence=[2*<up> RET] to retrieve the 'NNN' from the stack, and make it the first argument in the current call

3. sequence=[2*<up> C-k] to copy the '1' (from the previous call) from the stack to the kill-ring

4. `M-x quick-calc` inside the `query-replace`

5. sequence=[C-y + 1 RET] to increment the numeric input (in this case, '1') and exit `quick-calc`

6. C-y to return the result of the incrementation (in this case, 2) from `quick-calc` to the argument list for the current `query-replace` call

7. RET to call `query-replace` to do the work.

Seems complex now that I've typed it :-) but after doing it so many times, it's in my "muscle memory." So I was annoyed to discover just now, after finally upgrading to {Jessie, 'GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)'}, that I can no longer do this! because when I call `quick-calc` inside the `query-replace`, I immediately get the error

> byte-code: Wrong number of arguments: (lambda nil (interactive) (log-BP4)), 2

which abends `quick-calc`, which abends macro recording. So I'd like to know:

1. Is the new behavior a bug or a feature (i.e., Working As Designed)?

1.1. (if a bug) Has this been previously reported?

1.1.1. (if so) apologies if this is a FAQ, but a quick websearch showed me nothing.

1.1.2. (if not) To where should it be reported?

1.2. (if WAD) How can I workaround the new behavior to do what I want (possibly more effectively)?

TIA, Tom Roche <Tom_Roche@pobox.com>



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

end of thread, other threads:[~2015-09-10 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29 22:39 `quick-calc` inside `query-replace` breaks Tom Roche
2015-09-10 18:59 ` Tom Roche

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.