<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><generator uri="https://gohugo.io/" version="0.101.0">Hugo</generator><title type="html">theme on A Scripter's Notes</title><subtitle type="html">Emacs, scripting and anything text oriented.</subtitle><link href="https://scripter.co/categories/theme/" rel="alternate" type="text/html" title="HTML"/><link href="https://scripter.co/categories/theme/index.xml" rel="alternate" type="application/rss+xml" title="RSS"/><link href="https://scripter.co/categories/theme/atom.xml" rel="self" type="application/atom+xml" title="Atom"/><link href="https://scripter.co/categories/theme/jf2feed.json" rel="alternate" type="application/jf2feed+json" title="jf2feed"/><updated>2026-04-22T08:24:57-04:00</updated><author><name>Kaushal Modi</name><email>kaushal.modi@gmail.com</email></author><id>https://scripter.co/categories/theme/</id><entry><title type="html">How to save a function name in a variable in elisp?</title><link href="https://scripter.co/how-to-save-a-function-name-in-a-variable-in-elisp/?utm_source=atom_feed" rel="alternate" type="text/html"/><id>https://scripter.co/how-to-save-a-function-name-in-a-variable-in-elisp/</id><published>2014-03-12T15:53:31-04:00</published><updated>2014-03-12T15:53:31-04:00</updated><content type="html"><![CDATA[<p>I have a couple of theme packages installed on my emacs but I would
like to assign a default theme.</p>
<p>I set the <a href="https://github.com/bbatsov/zenburn-emacs">zenburn theme</a> via a function <code>zenburn</code>. I set the
<a href="https://github.com/fniessen/emacs-leuven-theme">leuven theme</a> via another function <code>leuven</code>. But in my emacs
startup I didn&rsquo;t want to hard-code either of these function and thus
arose the need to set a variable to one of these functions.</p>
<p><em>You assign the function to a variable using <code>defvar</code> and you call
that function linked to that variable using <code>funcall</code>.</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-elisp" data-lang="elisp"><span class="line"><span class="cl"><span class="p">(</span><span class="nb">defvar</span> <span class="nv">default-theme</span> <span class="ss">&#39;zenburn</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">;; zenburn</span>
</span></span><span class="line"><span class="cl"><span class="p">(</span><span class="nb">defun</span> <span class="nv">zenburn</span> <span class="p">()</span>
</span></span><span class="line"><span class="cl">  <span class="s">&#34;Activate zenburn theme.&#34;</span>
</span></span><span class="line"><span class="cl">  <span class="p">(</span><span class="nb">interactive</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">  <span class="c1">;; disable other themes before setting this theme</span>
</span></span><span class="line"><span class="cl">  <span class="p">(</span><span class="nv">disable-theme</span> <span class="ss">&#39;leuven</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">  <span class="p">(</span><span class="nv">load-theme</span> <span class="ss">&#39;zenburn</span> <span class="no">t</span><span class="p">))</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="p">(</span><span class="nf">funcall</span> <span class="nv">default-theme</span><span class="p">)</span> <span class="c1">;; Set the default theme</span>
</span></span></code></pre></div><p>You can check out my full emacs config for visual settings on
my <a href="https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-visual.el">git</a>.</p>
<p><a href="https://stackoverflow.com/questions/9942675/in-elisp-how-do-i-put-a-function-in-a-variable">Reference</a></p>]]></content><category scheme="https://scripter.co/categories/emacs" term="emacs" label="emacs"/><category scheme="https://scripter.co/categories/elisp" term="elisp" label="elisp"/><category scheme="https://scripter.co/categories/function" term="function" label="function"/><category scheme="https://scripter.co/categories/variable" term="variable" label="variable"/><category scheme="https://scripter.co/categories/theme" term="theme" label="theme"/></entry></feed>