Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The short answer to you question is:</p> <ul> <li><p>use <code>setq</code> or <code>setq-default</code> for variables defined by <code>defvar</code>.</p></li> <li><p>use <code>setq</code>, <code>setq-default</code>, or the <code>Customize</code> mechanism for variables defined by <code>defcustom</code></p></li> </ul> <p>Below is the long answer.</p> <p>The functions that you are going to use are the following:</p> <ul> <li><p><code>set</code> is the main function to set the value of a variable.</p></li> <li><p><code>setq</code> is another version that automatically quotes its first argument. This is useful since quoting the first argument is what you want to do almost all the time.</p></li> <li><p>Some variables cannot be set globally. Whenever you set the variable it is only set for the current buffer. If you want to simulate setting this variable globally you use <code>set-default</code> or <code>setq-default</code>.</p></li> </ul> <p>The functions that a package writer uses are:</p> <ul> <li><p><code>defvar</code> which allows the package writer to define a variable and to give some documentation. This function is not required but makes the life of users easier.</p></li> <li><p><code>defcustom</code> builds on <code>defvar</code>. It tells emacs that it is a variable, and it allows the developer to create a <code>custom</code> interface to set the value. The developer can say, things like "this variable can contain only the value 'foo or 'bar".</p></li> </ul> <p>Setting variables can be done two ways:</p> <ol> <li><p>if <code>defvar</code> was used, the values can only be set by the user in its <code>.emacs</code> by using the <code>set</code> function (or variants)</p></li> <li><p>if <code>defcustom</code> was used, the values can be set using <code>set</code> (see 1.) OR by using <code>Customize</code>. When using the customize mechanism, emacs will generate some code that it will place in <code>custom-set-variables</code>. The user should not use this function.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload