How do I add an item to the 'org-publish-project-alist' variable? reddit / emacs ---------------------------------------------------------------------- DeltaBuffalo · 2022-04-21 16:46 Hi all, Beginner in emacs-lisp I address to you concerning the following project: [https://github.com/DarkBuffalo/org-easy- blog](https://github.com/DarkBuffalo/org-easy-blog). Is it possible to add an item to the 'org-publish-project-alist' variable instead of redefining it with setq like in the following bad example? : [https://github.com/DarkBuffalo/org-easy- blog/blob/4a30b86158d3554ab96de8afd3e8979ba31bcb9c/org-easy- blog.el#L293](https://github.com/DarkBuffalo/org-easy- blog/blob/4a30b86158d3554ab96de8afd3e8979ba31bcb9c/org-easy- blog.el#L293) thank you ---------------------------------------------------------------------- usaoc · 2022-04-21 17:07 My choice would be to use [the generalized setter `setf`](https://www. gnu.org/software/emacs/manual/html_node/elisp/Setting-Generalized- Variables.html) with an [`alist-get` call](https://www.gnu.org/softwar e/emacs/manual/html_node/elisp/Association-Lists.html) as the place in a [`with-eval-after-load` form](https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks- for-Loading.html) of [the `ox-publish` library](https://github.com/emacs-straight/org- mode/blob/b8656a2cef3d5da7270e391222d8139fc042edd5/lisp/ox- publish.el#L65). (with-eval-after-load 'ox-publish (setf (alist-get KEY org-publish-project-alist nil nil #'string=) VALUE)) Edit: Ah, [`ox-publish` is already `require`d](https://github.com/DarkBuffalo/org-easy- blog/blob/4a30b86158d3554ab96de8afd3e8979ba31bcb9c/org-easy- blog.el#L32), so `with-eval-after-load` is not needed. ---------------------------------------------------------------------- DeltaBuffalo · 2022-04-21 17:57 Thank you very much, I will test this. ---------------------------------------------------------------------- DeltaBuffalo · 2022-04-21 19:44 thanks for the advice. Here is the result: https://github.com/DarkBuffalo/org-easy- blog/blob/0a3931acafa01361308233ae9504ca6e0883b502/org-easy- blog.el#L293 ---------------------------------------------------------------------- deltille · 2022-04-21 20:10 Try the function (add-to-list), its function help should tell you what you need. There's a few ways to add something to a list, a lot of them do involve re-defining with setq, but specifically re-defining it to the old list + your new entry. Add-to-list will just modify the list in place though. ---------------------------------------------------------------------- DeltaBuffalo · 2022-04-22 09:46 Thanks, There are several ways to do the same thing. Emacs-lisp is awesome.