我基本上想要重构以下内容:
(eval-after-load 'find-file-in-project
'(progn
(add-to-list 'ffip-patterns "*.clj")
(add-to-list 'ffip-patterns "*.erb")
(add-to-list 'ffip-patterns "*.haml")
(add-to-list 'ffip-patterns "Gemfile*")
(add-to-list 'ffip-patterns "*.css")
(add-to-list 'ffip-patterns "*.scss")
(add-to-list 'ffip-patterns "*.sass")
(add-to-list 'ffip-patterns "*.rake")
(add-to-list 'ffip-patterns "*.thor")
(add-to-list 'ffip-patterns "Capfile")
(add-to-list 'ffip-patterns "*.gemspec")
(add-to-list 'ffip-patterns "*.yml")
))
在我定义文件扩展名列表的地方,然后将它们归入ffip-patterns
变量。
答案 0 :(得分:3)
如果您不担心列表中的重复项(add-to-list
检查),您可以使用append
添加元素:
(eval-after-load 'find-file-in-project
'(setq ffip-patterns (append (list "*.clj" "*.erb") ffip-patterns)))
否则,您可以使用dolist
:
(eval-after-load 'find-file-in-project
'(dolist (pattern (list "*.clj" "*.erb"))
(add-to-list 'ffip-patterns pattern)))