diff options
| author | David Aspinall | 2008-02-03 16:59:17 +0000 |
|---|---|---|
| committer | David Aspinall | 2008-02-03 16:59:17 +0000 |
| commit | aec2e6a86b72b39e88217348d2146231d8150b0d (patch) | |
| tree | b33760f7e93c4c7c99a499bb5762bb742e9253bf | |
| parent | 32179d7b9506bf223b7794c6944f409d0bab888a (diff) | |
Add some error checking to `unicode-tokens-token-name-alist'
| -rw-r--r-- | lib/unicode-tokens.el | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/unicode-tokens.el b/lib/unicode-tokens.el index 2f2059ae..af8a7cc5 100644 --- a/lib/unicode-tokens.el +++ b/lib/unicode-tokens.el @@ -313,12 +313,25 @@ Also sets `unicode-tokens-token-alist'." (setq tokname (caar ulist)) (setq ustring (cdar ulist)) (setq token (format unicode-tokens-token-format tokname)) - (nconc unicode-tokens-quail-define-rules - (list (list token - (vector ustring)))) - (setq unicode-tokens-token-alist - (nconc unicode-tokens-token-alist - (list (cons token ustring)))) + (cond + ;; Some error checking (but not enough!) + ((eq (length tokname) 0) + (warn "Empty token name (mapped to \"%s\") in unicode tokens list" + ustring)) + ((eq (length ustring) 0) + (warn "Empty token mapping, ignoring token \"%s\" in unicode tokens list" + token)) + ((assoc token unicode-tokens-token-alist) + (warn "Duplicated token entry, ignoring subsequent mapping of %s" token)) + ((rassoc ustring unicode-tokens-token-alist) + (warn "Duplicated target \"%s\", ignoring token %s" ustring token)) + (t + (nconc unicode-tokens-quail-define-rules + (list (list token + (vector ustring)))) + (setq unicode-tokens-token-alist + (nconc unicode-tokens-token-alist + (list (cons token ustring)))))) (setq ulist (cdr ulist)))) ;; make reverse map: convert longer ustring sequences first (setq unicode-tokens-ustring-alist |
