# HG changeset patch # User Aidan Kehoe # Date 1312991437 -3600 # Node ID 493c487cbc3f1fc4f14855181174eca2c717f119 # Parent b90c153730c78ba2829bb9f6c972532bcbdd6687 Add #'event-apply-modifiers, implement #'event-apply-modifiers in terms of it. 2011-08-10 Aidan Kehoe * 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. diff -r b90c153730c7 -r 493c487cbc3f lisp/ChangeLog --- 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 + + * 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 * bytecomp.el (byte-compile-normal-call): diff -r b90c153730c7 -r 493c487cbc3f lisp/keymap.el --- 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.