[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file mode synonymous with major mode
From: |
tpeplt |
Subject: |
Re: file mode synonymous with major mode |
Date: |
Thu, 28 Mar 2024 15:22:14 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Joost Kremers <joostkremers@fastmail.fm> writes:
> On Thu, Mar 28 2024, Heime wrote:
>> Reading the emacs manual '24.3 Choosing File Modes'. Is it correct to assert
>> that
>> the file mode is synonymous with the major mode ?
>>
>> https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html
>
> Given that that page talks about both major and minor modes, I'd say no. It
> rather refers to any modes activated for a specific file.
>
> Note that it's hardly an issue. "File mode" does not have any specific meaning
> in Emacs (unlike major and minor mode), so I wouldn't worry about it too much.
> (In fact, going through the manual, there appears to be another use of the
> term
> "file mode", referring to what is more commonly called "file permissions": see
> (info "(emacs) Misc File Ops").)
Also, the major mode that is in effect for a given buffer may have
nothing to do with ANY file. For example, the *scratch* buffer and Help
buffers have no file associated with them, but both have a major mode.
You can create a new buffer simply by switching to it with C-x b (bound
to ‘switch-to-buffer’):
C-x b a-new-buffer
That buffer will have your default major mode, which is usually
Fundamental mode. You can then change that mode to, for example,
emacs-lisp-mode, by entering the command ‘emacs-lisp-mode’:
M-x emacs-lisp-mode
Your new buffer will now have its major mode changed to one that is
normally associated with Emacs Lisp files and yet still have no
association with any file.
Likewise, you could have a file of Emacs Lisp code associated with a
buffer in emacs-lisp-mode and could change its major mode to, for
example, text mode:
M-x text-mode
In that case, even though your file has Emacs Lisp code, the buffer
associated with it could be operated on as though it was plain text.
(Besides looking at the first field of the Emacs mode line near the
bottom of the screen, it is also possible to determine which major mode
is in effect by evaluating the variable ‘major-mode’, either in a Lisp
expression or by typing C-h v major-mode RET.)
--