From aec2e6a86b72b39e88217348d2146231d8150b0d Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Sun, 3 Feb 2008 16:59:17 +0000 Subject: Add some error checking to `unicode-tokens-token-name-alist' --- lib/unicode-tokens.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3