[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11983: 24.1; Electric-command-loop broken?
From: |
Roland Winkler |
Subject: |
bug#11983: 24.1; Electric-command-loop broken? |
Date: |
Wed, 18 Jul 2012 15:54:45 -0500 |
I am trying to understand Electric-command-loop in electric.el
(this is used by BBDB 3):
Two things:
- The code contains a hard-coded
(setq universal-argument-num-events 0)
Apparently this is never reset, so exiting Electric-command-loop
leaves behind this binding.
- The doc string says
;; Given third argument non-nil, it
;; INHIBITS quitting unless the user types C-g at toplevel. This is
;; so user can do things like C-u C-g and not get thrown out.
Yet it appears to me, that even for C-u C-g the user gets thrown out.
Here is a slightly simplified version of the code from Electric-command-loop
It does not distinguish between C-g and C-u C-g.
Unfortunately, this hackery goes beyond my understanding of Emacs
internals.
(catch 'return-tag
(let (cmd (inhibit-quit t))
(while t
(setq cmd (read-key-sequence "Prompt: "))
(setq last-command-event (aref cmd (1- (length cmd)))
this-command (key-binding cmd t)
cmd this-command)
;; This makes universal-argument-other-key work.
(setq universal-argument-num-events 0)
(if (or (prog1 quit-flag (setq quit-flag nil))
(eq last-input-event ?\C-g))
(progn (setq unread-command-events nil
prefix-arg nil)
;; If it wasn't canceling a prefix character, then quit.
(if (or (= (length (this-command-keys)) 1)
(not inhibit-quit)) ; safety
(throw 'return-tag (this-command-keys))
(setq cmd nil))))
(setq current-prefix-arg prefix-arg)
(condition-case nil
(progn (command-execute cmd)
(setq last-command this-command))
(error nil)))))
In GNU Emacs 24.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
of 2012-06-10 on regnitz
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
- bug#11983: 24.1; Electric-command-loop broken?,
Roland Winkler <=