Is there a list of commands to choose Emacs modes? How can I know which modes are available on my platform? I mean the list of modes names you type after M-x
.
It includes Text mode, HTML mode, SGML mode, TeX mode and Outline mode. The second group contains modes for specific programming languages. These include Lisp mode (which has several variants), C mode, Fortran mode, and others.
The standard default value is fundamental-mode . If the default value is nil , then whenever Emacs creates a new buffer via a command such as C-x b ( switch-to-buffer ), the new buffer is put in the major mode of the previously current buffer.
If you invoke the mode command directly with no prefix argument (either via M-x , or by binding it to a key and typing that key; see Customizing Key Bindings), that toggles the minor mode. The minor mode is turned on if it was off, and turned off if it was on.
type M-x *-mode <Tab>
and emacs will list all interactive commands ending in -mode
that are currently loaded.
I'm not sure you can easily see what modes are available after a require
without first having loaded all the elisp files in your load path.
A function for listing major modes with some guess-work to avoid the listing of minor-modes and other functions that end in -mode:
(defun list-major-modes ()
"Returns list of potential major mode names (without the final -mode).
Note, that this is guess work."
(interactive)
(let (l)
(mapatoms #'(lambda (f) (and
(commandp f)
(string-match "-mode$" (symbol-name f))
;; auto-loaded
(or (and (autoloadp (symbol-function f))
(let ((doc (documentation f)))
(when doc
(and
(let ((docSplit (help-split-fundoc doc f)))
(and docSplit ;; car is argument list
(null (cdr (read (car docSplit)))))) ;; major mode starters have no arguments
(if (string-match "[mM]inor" doc) ;; If the doc contains "minor"...
(string-match "[mM]ajor" doc) ;; it should also contain "major".
t) ;; else we cannot decide therefrom
))))
(null (help-function-arglist f)))
(setq l (cons (substring (symbol-name f) 0 -5) l)))))
(when (called-interactively-p 'any)
(with-current-buffer (get-buffer-create "*Major Modes*")
(clear-buffer-delete)
(let ((standard-output (current-buffer)))
(display-completion-list l)
(display-buffer (current-buffer)))))
l))
C-h a mode
displays a summary of all modes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With