changeset 5549:493c487cbc3f

Add #'event-apply-modifiers, implement #'event-apply-modifiers in terms of it. 2011-08-10 Aidan Kehoe <kehoea@parhasard.net> * keymap.el: * keymap.el (event-apply-alt-modifier): * keymap.el (event-apply-super-modifier): * keymap.el (event-apply-hyper-modifier): * keymap.el (event-apply-shift-modifier): * keymap.el (event-apply-control-modifier): * keymap.el (event-apply-meta-modifier): * keymap.el (event-apply-modifiers): New. * keymap.el (event-apply-modifier): Implement in terms of #'event-apply-modifier. Rework #'event-apply-modifier to take a list of modifiers, and change its name appropriately. Keep the old name around, too.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 10 Aug 2011 16:50:37 +0100
parents b90c153730c7
children b908c7265a2b
files lisp/ChangeLog lisp/keymap.el
diffstat 2 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Aug 10 15:55:53 2011 +0100
+++ b/lisp/ChangeLog	Wed Aug 10 16:50:37 2011 +0100
@@ -1,3 +1,19 @@
+2011-08-10  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* keymap.el:
+	* keymap.el (event-apply-alt-modifier):
+	* keymap.el (event-apply-super-modifier):
+	* keymap.el (event-apply-hyper-modifier):
+	* keymap.el (event-apply-shift-modifier):
+	* keymap.el (event-apply-control-modifier):
+	* keymap.el (event-apply-meta-modifier):
+	* keymap.el (event-apply-modifiers): New.
+	* keymap.el (event-apply-modifier): Implement in terms of
+	#'event-apply-modifier.
+
+	Rework #'event-apply-modifier to take a list of modifiers, and
+	change its name appropriately. Keep the old name around, too.
+
 2011-08-10  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* bytecomp.el (byte-compile-normal-call):
--- a/lisp/keymap.el	Wed Aug 10 15:55:53 2011 +0100
+++ b/lisp/keymap.el	Wed Aug 10 16:50:37 2011 +0100
@@ -443,22 +443,22 @@
 ;;; to the following event.
 
 (defun event-apply-alt-modifier (ignore-prompt)
-  (event-apply-modifier 'alt))
+  (event-apply-modifiers '(alt)))
 (defun event-apply-super-modifier (ignore-prompt)
-  (event-apply-modifier 'super))
+  (event-apply-modifiers '(super)))
 (defun event-apply-hyper-modifier (ignore-prompt)
-  (event-apply-modifier 'hyper))
+  (event-apply-modifiers '(hyper)))
 (defun event-apply-shift-modifier (ignore-prompt)
-  (event-apply-modifier 'shift))
+  (event-apply-modifiers '(shift)))
 (defun event-apply-control-modifier (ignore-prompt)
-  (event-apply-modifier 'control))
+  (event-apply-modifiers '(control)))
 (defun event-apply-meta-modifier (ignore-prompt)
-  (event-apply-modifier 'meta))
+  (event-apply-modifiers '(meta)))
 
 ;;; #### `key-translate-map' is ignored for now.
-(defun event-apply-modifier (symbol)
-  "Return the next key event, with a modifier flag applied.
-SYMBOL is the name of this modifier, as a symbol.
+(defun event-apply-modifiers (list)
+  "Return the next key event, with a list of modifiers applied.
+LIST describes the names of these modifier, a list of symbols.
 `function-key-map' is scanned for prefix bindings."
   (let (events binding)
     ;; read keystrokes scanning `function-key-map'
@@ -479,11 +479,17 @@
 	  (setq unread-command-events
 		(mapcar 'character-to-event (cdr events))))
       (setq unread-command-events (cdr events)))
-    ;; add a modifier SYMBOL to the first keystroke or event
+    ;; add modifiers LIST to the first keystroke or event
     (vector
-     (append (list symbol)
-	     (delq symbol
-		   (aref (key-sequence-list-description (car events)) 0))))))
+     (append list
+             (set-difference (aref (key-sequence-list-description (car events))
+                                   0)
+                             list :stable t)))))
+
+(defun event-apply-modifier (symbol)
+  "Return the next key event, with a single modifier applied.
+See `event-apply-modifiers'."
+  (event-apply-modifiers (list symbol)))
 
 (defun synthesize-keysym (ignore-prompt)
   "Read a sequence of keys, and returned the corresponding key symbol.