How can I map an unknown list of args to start-process in elisp?

可紊 提交于 2019-12-02 01:28:21

You can use apply:

(apply FUNCTION &rest ARGUMENTS)

Call FUNCTION with our remaining args, using our last arg as list of args. Then return the value FUNCTION returns. Thus, (apply '+ 1 2 '(3 4)) returns 10.

This way, you could call start-process using something like:

(apply 'start-process "drush" (current-buffer)
                             drupal-drush-program
                             command
                             a)

As a side note, you should not create temporary variables using setq, as this creates or modified global variables (if no local ones with the name exists). Instead, use let.

Good luck with your elisp projects!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!