emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 247e587d56: Document how to specify fallback modes


From: Lars Ingebrigtsen
Subject: master 247e587d56: Document how to specify fallback modes
Date: Tue, 19 Apr 2022 12:21:34 -0400 (EDT)

branch: master
commit 247e587d56f9be5164b3783e04cfba73fd667175
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Document how to specify fallback modes
    
    * doc/emacs/custom.texi (Specifying File Variables): Document
    fallback mode order.
---
 doc/emacs/custom.texi | 25 +++++++++++++++++++++++++
 etc/NEWS              |  5 +++++
 2 files changed, 30 insertions(+)

diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index a3c9c7c206..63e3bb5815 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1232,6 +1232,31 @@ Manual}.
 These four keywords are not really variables; setting them in any
 other context has no special meaning.
 
+  If you're editing a file across Emacs versions, and a new mode has
+been introduced to handle a file in a newer Emacs version, you can use
+several @code{mode} entries to use the new mode (called
+@code{my-new-mode}) in the new Emacs, and fall back to the old mode
+(called @code{my-old-mode}) in older Emacs versions.  If you're
+enabling the modes in the first line of the file, you should use this
+order:
+
+@example
+-*- mode: my-new; mode: my-old -*-
+@end example
+
+  Emacs will ignore undefined modes until it finds one it can use.
+However, if you're using a local variable block at the end up the
+file, the order is reversed:
+
+@example
+Local variables:
+mode: my-old
+mode: my-new
+@end example
+
+  Here Emacs will use the @emph{last} defined mode it finds.  (This is
+for historical reasons.)
+
   Do not use the @code{mode} keyword for minor modes.  To enable or
 disable a minor mode in a local variables list, use the @code{eval}
 keyword with a Lisp expression that runs the mode command
diff --git a/etc/NEWS b/etc/NEWS
index 496ff32d20..3442ebd81b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1441,6 +1441,11 @@ functions.
 
 * Lisp Changes in Emacs 29.1
 
++++
+** The local variable section now supports defining fallback modes.
+This was previously only available when using a property line (i.e.,
+putting the modes on the first line of a file).
+
 +++
 ** New function 'flush-standard-output'.
 This enables you do display incomplete lines from batch-based Emacs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]