# HG changeset patch # User Chong Yidong # Date 1219182296 0 # Node ID 1b5f78ffef83f80a520bb48020dbe57cd1f1607f # Parent 325188eea8c436aa103bb416005bc29c8957edca (edmacro-parse-keys): Catch events with spaces in their names. diff -r 325188eea8c4 -r 1b5f78ffef83 lisp/edmacro.el --- a/lisp/edmacro.el Tue Aug 19 21:44:48 2008 +0000 +++ b/lisp/edmacro.el Tue Aug 19 21:44:56 2008 +0000 @@ -686,14 +686,22 @@ (defun edmacro-parse-keys (string &optional need-vector) (let ((case-fold-search nil) + (len (length string)) ; We won't alter string in the loop below. (pos 0) (res [])) - (while (and (< pos (length string)) + (while (and (< pos len) (string-match "[^ \t\n\f]+" string pos)) - (let ((word (substring string (match-beginning 0) (match-end 0))) - (key nil) - (times 1)) - (setq pos (match-end 0)) + (let* ((word-beg (match-beginning 0)) + (word-end (match-end 0)) + (word (substring string word-beg len)) + (times 1) + key) + ;; Try to catch events of the form "". + (if (string-match "^<[^ >\t\n\f][^>\t\n\f]*>" word) + (setq word (match-string 0 word) + pos (+ word-beg (match-end 0))) + (setq word (substring string word-beg word-end) + pos word-end)) (when (string-match "\\([0-9]+\\)\\*." word) (setq times (string-to-number (substring word 0 (match-end 1)))) (setq word (substring word (1+ (match-end 1)))))