unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tpeplt <tpeplt@gmail.com>
To: Joost Kremers <joostkremers@fastmail.fm>
Cc: Heime <heimeborgia@protonmail.com>,
	 Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: file mode synonymous with major mode
Date: Thu, 28 Mar 2024 15:22:14 -0400	[thread overview]
Message-ID: <87h6gqf9g9.fsf@gmail.com> (raw)
In-Reply-To: <867chmmzwp.fsf@p200300d62732bb94c15e79ce9a9ec518.dip0.t-ipconnect.de> (Joost Kremers's message of "Thu, 28 Mar 2024 11:08:54 +0100")

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.)

--



  reply	other threads:[~2024-03-28 19:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  9:56 file mode synonymous with major mode Heime
2024-03-28 10:08 ` Joost Kremers
2024-03-28 19:22   ` tpeplt [this message]
2024-03-29  1:14     ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6gqf9g9.fsf@gmail.com \
    --to=tpeplt@gmail.com \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=joostkremers@fastmail.fm \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).