all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Roche <Tom_Roche@pobox.com>
To: help-gnu-emacs@gnu.org,
Subject: `quick-calc` inside `query-replace` breaks
Date: Wed, 29 Jul 2015 18:39:25 -0400	[thread overview]
Message-ID: <87vbd2wpuq.fsf@pobox.com> (raw)


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>



             reply	other threads:[~2015-07-29 22:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 22:39 Tom Roche [this message]
2015-09-10 18:59 ` `quick-calc` inside `query-replace` breaks Tom Roche

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

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

  git send-email \
    --in-reply-to=87vbd2wpuq.fsf@pobox.com \
    --to=tom_roche@pobox.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.
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.