help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Define skeleton from alist?


From: Paul Rankin
Subject: Define skeleton from alist?
Date: Wed, 13 Jul 2016 18:11:27 +1000

Hello, does anyone really know their skeletons?

I'd like to create a skeleton with define-skeleton using strings from an alist. 
The skeleton should loop through the alist using the car of each element as 
both the prompt and first string inserted, then the cadr as initial value for 
user input.

The alist:

    (defcustom fountain-title-page-list
      (list (list "title" "")
            (list "credit" "written by")
            (list "author" user-full-name)
            (list "source" "")
            (list "date" "")
            (list "contact" user-mail-address))
      "Association list of strings used to create 
`fountain-title-page-skeleton'."
      :type '(repeat (group (string :tag "Key")
                            (string :tag "Initial value")))
      :group 'fountain)

My feeble non-functional attempt at the define-skeleton:

    (define-skeleton fountain-title-page-skeleton
      "Skeleton for inserting title page data.
    See `skeleton-insert'."
      nil
      '(dolist (var fountain-title-page-list
                    (list v1 v2 "\n"))
         (setq v1 (concat (car var) ": "))
         (setq v2 (skeleton-read v1 (cadr var)))))

Any help would be much appreciated.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]