0

How does Emacs determine the major-mode assigned to a file based on file extension, e.g. .txt or .odt? If the filename has no extension, and I don't do anything to tell Emacs how to treat it, what does it get, fundamental-mode? If I then set text properties, e.g. bold or italic, for strings within the buffer, copy the buffer, and then paste it into, e.g., libreoffice, can it be expected to catch the italic and/or bold face properties set by Emacs? Better: if I write my file, with its text properties from Emacs, and read it into libreoffice, will it treat the file as I intend? Or, only if a filename suffix tells libreoffice what I'm giving it?

That's the point of the title question: if Emacs knows what kind of file it's getting, will it not be consistent with that in what it passes along to libreoffice, Adobe, or whoever?

2
  • 3
    The derailment of your question from "when is the major mode assigned?" to "can I copy and paste text properties to something that isn't Emacs?" is spectacular. Please post separate questions separately -- those two questions have nothing to do with one another.
    – phils
    Commented Sep 21, 2022 at 23:07
  • Possible duplicate. E.g. emacs.stackexchange.com/q/10277/105
    – Drew
    Commented Sep 22, 2022 at 1:35

1 Answer 1

1

One question per question, if you see what I am saying.

Emacs calls normal-mode after opening the file, which determines what mode it should be in and changes to it. You can actually call it yourself if you ever want to reset a buffer back to the default mode, or if you want to test your modifications to the default-mode-alist. Use C-h f to get more information about it.

if Emacs knows what kind of file it's getting, will it not be consistent with that in what it passes along to libreoffice, Adobe, or whoever?

Lol, no. There is no standard way, on any operating system, to convey that information. All applications just look at the file name and guess. (Mac OS prior to OSX had a field that stored a four–letter tag to indicate what application created each file, but as far as I know that is no longer used).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.