diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2008-08-19 21:44:56 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2008-08-19 21:44:56 +0000 |
commit | bf2e3fa7a92748c89f16ea1b68e00138b16f4bec (patch) | |
tree | 86cc524b3182a068f6685c8de884ea4640fa4741 /lisp/edmacro.el | |
parent | edfbf712e5735a9d9754c628c5fdd757bfa82620 (diff) | |
download | emacs-bf2e3fa7a92748c89f16ea1b68e00138b16f4bec.tar.gz |
(edmacro-parse-keys): Catch events with spaces in their names.
Diffstat (limited to 'lisp/edmacro.el')
-rw-r--r-- | lisp/edmacro.el | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/edmacro.el b/lisp/edmacro.el index 1c2f9104a06..be948ad579f 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -686,14 +686,22 @@ This function assumes that the events can be stored in a string." (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 "<as df>". + (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))))) |