I have a number of "alists".
(defconst assoc-table-1 '( ("frantic" . "fN") ("authentic" . "atN") )) (defconst assoc-table-2 '( ("graphology" . "Gol") ("phrenology" . "fnol") ))
I then construct a "list of alists".
(defun assoc-list () "TODO" (let* ( (name "assoc-table-") (counter 1) (table '()) ) (while (boundp (intern (concat name (number-to-string counter)))) (setq table (append table (symbol-value (intern (concat name (number-to-string counter)))))) (message "%s" (concat name (number-to-string counter))) (setq counter (1+ counter))) table))
which I pass to this function
(defun shorten () "Shorten word at point according to specific rules." (interactive) (let* ( (bounds (bounds-of-thing-at-point 'word)) (word (downcase (buffer-substring (car bounds) (cdr bounds)))) (rplc "") ) (goto-char (car bounds)) (add-to-list 'nscrip word) (dolist (aggr (assoc-list)) (setq rplc (cdr (assoc word aggr))) (unless (null rplc) (add-to-list 'nscrip (replace-regexp-in-string word rplc word))))
Thu function above fails on the first element because
assoc-list consists of a
"list of alists", but
(assoc word aggr) expects a list in
aggr, but is getting an element with a dot in it.
How can I solve the problem encountered by
(assoc word aggr).