I have a form variable which contains a list of file paths specified via functions:

(defcustom my-files-form
      '(append (list (concat my-root ".emacs")
                     (concat my-root ".custom"))
               (file-expand-wildcards (concat my-elisp "user-lisp/[a-z]*.el")))
      "My Form"
      :type 'string)

Before I use the form in a tags-search I want to filter the form's file paths by seq-filter (specifically (seq-filter 'file-exists-p my-files-form)).

However I get an error "Wrong type argument: stringp, append" when doing so. I guess this happens because my-files-form is not yet a proper list of paths but the instructions to generate the list of paths.

How can I resolve these instructions into a proper list?

  • @phils Makes sense! Thanks. Will try it out.
    – halloleo
    Commented Oct 14, 2022 at 11:44
  • emacs.stackexchange.com/tags/elisp/info
    – Drew
    Commented Oct 14, 2022 at 17:15
  • @drew Thanks for hint about the elisp tag. 😄 (However I feel dumping the URL in the comments section without further remarks is a little bit terse given a community which wants to be friendly...)
    – halloleo
    Commented Oct 15, 2022 at 2:54
  • @phils Works perfectly! Thanks a lot. -- Would you mind turning your comment into an answer? If you mind, I'm happy to do so.
    – halloleo
    Commented Oct 17, 2022 at 4:13

1 Answer 1

(seq-filter 'file-exists-p (eval my-files-form))

Refer to C-hf eval

Also note that variables which are going to be eval'd should have a risky-local-variable property -- but as this happens by default for a variable name ending in -form (amongst other things), you don't need to do anything additional in this instance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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