all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christoph Arenz <tiga.arenz@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Severe regressions in context of keyboard macros
Date: Thu, 26 Sep 2019 20:27:37 +0200	[thread overview]
Message-ID: <830f19fe-20dd-b3a3-fc50-26573760dbff@web.de> (raw)
In-Reply-To: <83v9tfl0lc.fsf@gnu.org>

On 9/26/19 2:10 PM, Eli Zaretskii wrote:
>> Cc: emacs-devel@gnu.org
>> From: Christoph Arenz <tiga.arenz@web.de>
>> Date: Thu, 26 Sep 2019 13:22:50 +0200
>>
>> On 9/26/19 12:56 PM, Eli Zaretskii wrote:
>>> What about the other facility -- could Calc use it to avoid recording
>>> keys more than once?
>> I have not yet looked into that -- as I am getting more time constrained.
> Thanks.  And the method used by quail.el -- did you actually try to
> use it in Calc, or did you just look at what it does in the context of
> input methods?
Yes, I tried to get a grip on how inhibit--record-char should be used both
by wrapping some parts in calc.el in a (let ((inhibit--record-char t)) ...)
form, e.g. in calc-fancy-prefix-other-key and/or in calc-fancy-prefix but
could not get it to work.
At that point I tried to understand it better by code reading in quail.el
and did some edebug tries with my simplified test case with
(push ?a unread-command-events).

In case of quail, I used french-prefix etc. input-methods and triggered two
keyboard events like
(progn
     (push ?, unread-command-events)
     (push ?c unread-command-events))
which let me stumble across weird behavior, which again lead me to more
closely do some simple tests as described in my former mail.

Now, I started to get a closer look at the other facility you mentioned:
'(no-record . KEY):
Here is my current result. I did not have much time for tests, though.
Does this go in the right direction?

Thanks!

working on master 07367e5b95fe31f3d4e994b42b081075501b9b60

modified   lisp/calc/calc.el
@@ -3400,7 +3400,17 @@ calc-read-key
      (cons key key)))

  (defun calc-unread-command (&optional input)
-  (push (or input last-command-event) unread-command-events))
+  (let ((event (or input last-command-event)))
+    ;; do not double-record key presses in calc when defining a
keyboard macro
+    ;; FIXME: need to check if 'when form' is correct for all calls of
this function
+    ;; seems to work for calls from calc-fancy-prefix-other-key
+    ;; checked for `<f3> I S <f4>' and `<f3> I H P <f4>'
+    ;; more tests needed
+    (when defining-kbd-macro
+      (setq event (cons 'no-record (if (consp event)
+                                       (cdr event)
+                                     event))))
+    (push event unread-command-events)))

  (defun calc-clear-unread-commands ()
    (setq unread-command-events nil))




  reply	other threads:[~2019-09-26 18:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19  8:17 Severe regressions in context of keyboard macros Christoph Arenz
2019-09-20  7:23 ` Eli Zaretskii
2019-09-20 15:43   ` Christoph Arenz
2019-09-20 17:54     ` Eli Zaretskii
2019-09-23 11:57       ` Christoph Arenz
2019-09-24  8:45         ` Eli Zaretskii
2019-09-26 10:46           ` Christoph Arenz
2019-09-26 10:56             ` Eli Zaretskii
2019-09-26 11:22               ` Christoph Arenz
2019-09-26 12:10                 ` Eli Zaretskii
2019-09-26 18:27                   ` Christoph Arenz [this message]
2019-09-28  9:18                     ` Christoph Arenz
2019-09-28  9:46                       ` Eli Zaretskii
2019-09-29 17:42                         ` Christoph Arenz
2019-10-15 12:12                           ` Eli Zaretskii
2019-09-28 12:35                       ` Stefan Monnier
2019-09-28 13:44                         ` Eli Zaretskii
2019-09-29 17:59                           ` Christoph Arenz
2019-09-27 14:58             ` Fwd: " Christoph Arenz

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=830f19fe-20dd-b3a3-fc50-26573760dbff@web.de \
    --to=tiga.arenz@web.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.