0

I have about 30 defconsts for abbrevs and want to loop them to fill global-abbrev-table.

(defconst tablet1 
   '( ("all" "l")     ("as" "as")      ("can" "k") ))

(defconst tablet2
   '( ("again" "ag")  ("any" "n")    ("before" "bf") ))

...

(defconst tablet30
   '( ("again" "ag")  ("any" "n")    ("before" "bf") ))


(defun abbrev ()
  (kill-all-abbrevs)
  (define-abbrev-table 'global-abbrev-table ))

1 Answer 1

-1

Here's one way:

(defun value-of-tablet (n)
  (symbol-value (intern (format "tablet%d" n))))

(define-abbrev-table
       'global-abbrev-table 
            (apply #'append
                   (mapcar #'value-of-tablet
                           (number-sequence 1 30))))
1
  • Works very well.
    – Ephram
    Aug 5 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.