2

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?

Drew
  • 75,699
  • 9
  • 109
  • 225
halloleo
  • 1,215
  • 9
  • 23
  • @phils Makes sense! Thanks. Will try it out. – halloleo Oct 14 '22 at 11:44
  • https://emacs.stackexchange.com/tags/elisp/info – Drew Oct 14 '22 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 Oct 15 '22 at 02: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 Oct 17 '22 at 04:13

1 Answers1

2
(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.

phils
  • 48,657
  • 3
  • 76
  • 115