summaryrefslogtreecommitdiff
path: root/devdocs/elisp/mode-line-top.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/mode-line-top.html
new repository
Diffstat (limited to 'devdocs/elisp/mode-line-top.html')
-rw-r--r--devdocs/elisp/mode-line-top.html37
1 files changed, 37 insertions, 0 deletions
diff --git a/devdocs/elisp/mode-line-top.html b/devdocs/elisp/mode-line-top.html
new file mode 100644
index 00000000..d064416f
--- /dev/null
+++ b/devdocs/elisp/mode-line-top.html
@@ -0,0 +1,37 @@
+ <h4 class="subsection">The Top Level of Mode Line Control</h4> <p>The variable in overall control of the mode line is <code>mode-line-format</code>. </p> <dl> <dt id="mode-line-format">User Option: <strong>mode-line-format</strong>
+</dt> <dd>
+<p>The value of this variable is a mode line construct that controls the contents of the mode-line. It is always buffer-local in all buffers. </p> <p>If you set this variable to <code>nil</code> in a buffer, that buffer does not have a mode line. (A window that is just one line tall also does not display a mode line.) </p>
+</dd>
+</dl> <p>The default value of <code>mode-line-format</code> is designed to use the values of other variables such as <code>mode-line-position</code> and <code>mode-line-modes</code> (which in turn incorporates the values of the variables <code>mode-name</code> and <code>minor-mode-alist</code>). Very few modes need to alter <code>mode-line-format</code> itself. For most purposes, it is sufficient to alter some of the variables that <code>mode-line-format</code> either directly or indirectly refers to. </p> <p>If you do alter <code>mode-line-format</code> itself, the new value should use the same variables that appear in the default value (see <a href="mode-line-variables">Mode Line Variables</a>), rather than duplicating their contents or displaying the information in another fashion. This way, customizations made by the user or by Lisp programs (such as <code>display-time</code> and major modes) via changes to those variables remain effective. </p> <p>Here is a hypothetical example of a <code>mode-line-format</code> that might be useful for Shell mode (in reality, Shell mode does not set <code>mode-line-format</code>): </p> <div class="example"> <pre class="example">(setq mode-line-format
+ (list "-"
+ 'mode-line-mule-info
+ 'mode-line-modified
+ 'mode-line-frame-identification
+ "%b--"
+</pre>
+<pre class="example"> ;; <span class="roman">Note that this is evaluated while making the list.</span>
+ ;; <span class="roman">It makes a mode line construct which is just a string.</span>
+ (getenv "HOST")
+</pre>
+<pre class="example"> ":"
+ 'default-directory
+ " "
+ 'global-mode-string
+ " %[("
+ '(:eval (format-time-string "%F"))
+ 'mode-line-process
+ 'minor-mode-alist
+ "%n"
+ ")%]--"
+</pre>
+<pre class="example"> '(which-function-mode ("" which-func-format "--"))
+ '(line-number-mode "L%l--")
+ '(column-number-mode "C%c--")
+ '(-3 "%p")))
+</pre>
+</div> <p>(The variables <code>line-number-mode</code>, <code>column-number-mode</code> and <code>which-function-mode</code> enable particular minor modes; as usual, these variable names are also the minor mode command names.) </p><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/Mode-Line-Top.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Top.html</a>
+ </p>
+</div>