summaryrefslogtreecommitdiff
path: root/devdocs/elisp/emulating-mode-line.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/emulating-mode-line.html')
-rw-r--r--devdocs/elisp/emulating-mode-line.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/devdocs/elisp/emulating-mode-line.html b/devdocs/elisp/emulating-mode-line.html
new file mode 100644
index 00000000..31b332a1
--- /dev/null
+++ b/devdocs/elisp/emulating-mode-line.html
@@ -0,0 +1,11 @@
+ <h4 class="subsection">Emulating Mode Line Formatting</h4> <p>You can use the function <code>format-mode-line</code> to compute the text that would appear in a mode line or header line based on a certain mode line construct. </p> <dl> <dt id="format-mode-line">Function: <strong>format-mode-line</strong> <em>format &amp;optional face window buffer</em>
+</dt> <dd>
+<p>This function formats a line of text according to <var>format</var> as if it were generating the mode line for <var>window</var>, but it also returns the text as a string. The argument <var>window</var> defaults to the selected window. If <var>buffer</var> is non-<code>nil</code>, all the information used is taken from <var>buffer</var>; by default, it comes from <var>window</var>’s buffer. </p> <p>The value string normally has text properties that correspond to the faces, keymaps, etc., that the mode line would have. Any character for which no <code>face</code> property is specified by <var>format</var> gets a default value determined by <var>face</var>. If <var>face</var> is <code>t</code>, that stands for either <code>mode-line</code> if <var>window</var> is selected, otherwise <code>mode-line-inactive</code>. If <var>face</var> is <code>nil</code> or omitted, that stands for the default face. If <var>face</var> is an integer, the value returned by this function will have no text properties. </p> <p>You can also specify other valid faces as the value of <var>face</var>. If specified, that face provides the <code>face</code> property for characters whose face is not specified by <var>format</var>. </p> <p>Note that using <code>mode-line</code>, <code>mode-line-inactive</code>, or <code>header-line</code> as <var>face</var> will actually redisplay the mode line or the header line, respectively, using the current definitions of the corresponding face, in addition to returning the formatted string. (Other faces do not cause redisplay.) </p> <p>For example, <code>(format-mode-line header-line-format)</code> returns the text that would appear in the selected window’s header line (<code>""</code> if it has no header line). <code>(format-mode-line header-line-format
+'header-line)</code> returns the same text, with each character carrying the face that it will have in the header line itself, and also redraws the header line. </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/Emulating-Mode-Line.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Emulating-Mode-Line.html</a>
+ </p>
+</div>