emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Severe regressions in context of keyboard macros


From: Christoph Arenz
Subject: Re: Severe regressions in context of keyboard macros
Date: Thu, 26 Sep 2019 20:27:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 9/26/19 2:10 PM, Eli Zaretskii wrote:
Cc: address@hidden
From: Christoph Arenz <address@hidden>
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 via email to

[Prev in Thread] Current Thread [Next in Thread]