summaryrefslogtreecommitdiff
path: root/devdocs/elisp/resources.html
blob: 803c5530091ba176ba4e116c7e8896e0258c9e23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 <h3 class="section">X Resources</h3> <p>This section describes some of the functions and variables for querying and using X resources, or their equivalent on your operating system. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/X-Resources.html#X-Resources">X Resources</a> in <cite>The GNU Emacs Manual</cite>, for more information about X resources. </p> <dl> <dt id="x-get-resource">Function: <strong>x-get-resource</strong> <em>attribute class &amp;optional component subclass</em>
</dt> <dd>
<p>The function <code>x-get-resource</code> retrieves a resource value from the X Window defaults database. </p> <p>Resources are indexed by a combination of a <em>key</em> and a <em>class</em>. This function searches using a key of the form ‘<samp><var>instance</var>.<var>attribute</var></samp>’ (where <var>instance</var> is the name under which Emacs was invoked), and using ‘<samp>Emacs.<var>class</var></samp>’ as the class. </p> <p>The optional arguments <var>component</var> and <var>subclass</var> add to the key and the class, respectively. You must specify both of them or neither. If you specify them, the key is ‘<samp><var>instance</var>.<var>component</var>.<var>attribute</var></samp>’, and the class is ‘<samp>Emacs.<var>class</var>.<var>subclass</var></samp>’. </p>
</dd>
</dl> <dl> <dt id="x-resource-class">Variable: <strong>x-resource-class</strong>
</dt> <dd><p>This variable specifies the application name that <code>x-get-resource</code> should look up. The default value is <code>"Emacs"</code>. You can examine X resources for other application names by binding this variable to some other string, around a call to <code>x-get-resource</code>. </p></dd>
</dl> <dl> <dt id="x-resource-name">Variable: <strong>x-resource-name</strong>
</dt> <dd><p>This variable specifies the instance name that <code>x-get-resource</code> should look up. The default value is the name Emacs was invoked with, or the value specified with the ‘<samp>-name</samp>’ or ‘<samp>-rn</samp>’ switches. </p></dd>
</dl> <p>To illustrate some of the above, suppose that you have the line: </p> <div class="example"> <pre class="example">xterm.vt100.background: yellow
</pre>
</div> <p>in your X resources file (whose name is usually <samp>~/.Xdefaults</samp> or <samp>~/.Xresources</samp>). Then: </p> <div class="example"> <pre class="example">(let ((x-resource-class "XTerm") (x-resource-name "xterm"))
  (x-get-resource "vt100.background" "VT100.Background"))
     ⇒ "yellow"
</pre>
<pre class="example">(let ((x-resource-class "XTerm") (x-resource-name "xterm"))
  (x-get-resource "background" "VT100" "vt100" "Background"))
     ⇒ "yellow"
</pre>
</div> <dl> <dt id="inhibit-x-resources">Variable: <strong>inhibit-x-resources</strong>
</dt> <dd><p>If this variable is non-<code>nil</code>, Emacs does not look up X resources, and X resources do not have any effect when creating new frames. </p></dd>
</dl><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Resources.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Resources.html</a>
  </p>
</div>