Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs stock major modes list

Tags:

emacs

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.

like image 289
pic11 Avatar asked Apr 04 '11 08:04

pic11


People also ask

What are the major modes in Emacs?

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.

What is the default mode of Emacs?

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.

How do I enable minor mode in Emacs?

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.


3 Answers

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.

like image 54
tobyodavies Avatar answered Sep 21 '22 13:09

tobyodavies


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))
like image 38
Tobias Avatar answered Sep 19 '22 13:09

Tobias


C-h a mode

displays a summary of all modes

like image 45
Alex Ryan Avatar answered Sep 21 '22 13:09

Alex Ryan