[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tutorial: "Control-X-prefix is now on M-x Control-X-prefix"
From: |
Lennart Borgman (gmail) |
Subject: |
Re: tutorial: "Control-X-prefix is now on M-x Control-X-prefix" |
Date: |
Thu, 04 Jan 2007 03:15:46 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (Windows/20061207) |
Kim F. Storm wrote:
"Lennart Borgman (gmail)" <address@hidden> writes:
I guess this does not interfere with the normal C-x handling (from a
users point of view)? Cua mode does something similar. (Are there any
collisions?)
Should this be treated like the corresponding Cua mode case in the tutorial=
Probably it could just check that C-x is bound to a keymap of some sort,
rather than a specific keymap...?
I think it is a good idea. Here is a patch that does that.
It also takes care of some new errors I found. I overlooked that the
function-key-map and key-translation-map must be handled explicitly
here. This did not show up because I earlier missed to test if
key-binding returned nil.
I have tried to test this version and it seems to work for those cases
we have been testing now at least.
Could someone please install these changes?
Index: tutorial.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tutorial.el,v
retrieving revision 1.10
diff -u -r1.10 tutorial.el
--- tutorial.el 3 Jan 2007 12:02:24 -0000 1.10
+++ tutorial.el 4 Jan 2007 02:13:30 -0000
@@ -139,15 +139,19 @@
(key-description key)
" is the command `")
(insert (format "%s" db))
- (insert "'. "
- "However, your customizations have rebound it to
the command `")
- (insert (format "%s" cb))
- (insert "'.")
- (when mapsym
- (insert " (For the more advanced user:"
- " This binding is in the keymap `"
- (format "%s" mapsym)
- "'.)"))
+ (insert "'. ")
+ (if cb
+ (progn
+ (insert
+ "However, your customizations have rebound it to the
command `")
+ (insert (format "%s" cb))
+ (insert "'.")
+ (when mapsym
+ (insert " (For the more advanced user:"
+ " This binding is in the keymap `"
+ (format "%s" mapsym)
+ "'.)")))
+ (insert "However your customiziations have removed this
binding."))
(if (string= where "")
(unless (keymapp db)
(insert "\n\nYou can use M-x "
@@ -429,9 +433,21 @@
(def-fun (nth 0 kdf))
(def-fun-txt (format "%s" def-fun))
(rem-fun (command-remapping def-fun))
+ (fm-key (if (key-binding key)
+ key
+ (let ((k (lookup-key function-key-map key)))
+ (if (and k
+ (not (numberp k)))
+ k key))))
+ (tm-key (let ((k (lookup-key
+ key-translation-map
+ fm-key)))
+ (if (and k
+ (not (numberp k))
+ (not (keymapp k))) k fm-key)))
(key-fun (if (eq def-fun 'ESC-prefix)
(lookup-key global-map [27])
- (key-binding key)))
+ (key-binding tm-key)))
(where (where-is-internal (if rem-fun rem-fun def-fun))))
(if where
(progn
@@ -446,8 +462,9 @@
(cond ((eq key-fun def-fun)
;; No rebinding, return t
t)
- ((eq key-fun (command-remapping def-fun))
- ;; Just a remapping, return t
+ ((and key-fun
+ (eq key-fun rem-fun))
+ ;; Just a command remapping, return t
t)
;; cua-mode specials:
((and cua-mode
@@ -471,12 +488,18 @@
(timeout . copy-region-as-kill)))
(setq def-fun-txt "\"C-c prefix\""))
(and (eq def-fun 'Control-X-prefix)
+ (eq 'Control-X-prefix (lookup-key
global-map [?\C-x]))
(equal key-fun
'(keymap (timeout . kill-region)))
(setq def-fun-txt "\"C-x prefix\""))))
(setq remark (list "cua-mode replacement" 'cua-mode))
(setq where "Same key")
nil)
+ ((and (eq def-fun 'Control-X-prefix)
+ (eq 'keymap (car (key-binding [?\C-x])))
+ (eq 'Control-X-prefix (lookup-key global-map
[?\C-x])))
+ ;; Looks like some local key binding was added to
C-x ...
+ t)
;; viper-mode specials:
((and (boundp 'viper-mode-string)
(boundp 'viper-current-state)
@@ -571,6 +594,8 @@
(where (nth 3 ck))
s1 s2 help-string)
(unless (string= where "Same key")
+ (when (string= where "")
+ (setq where (format "M-x %s" def-fun)))
(setq tutorial--point-after-chkeys (point-marker)
s1 (get-lang-string tutorial--lang 'tut-chgdkey)
s2 (get-lang-string tutorial--lang 'tut-chgdkey2)