pic11
pic11

Reputation: 14983

Emacs stock major modes list

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.

Upvotes: 22

Views: 5909

Answers (4)

Alex Ryan
Alex Ryan

Reputation: 3819

C-h a mode

displays a summary of all modes

Upvotes: 4

Tobias
Tobias

Reputation: 5198

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

Upvotes: 5

Jaseem
Jaseem

Reputation: 2285

Here is the list : http://www.emacswiki.org/CategoryModes

Upvotes: 2

tobyodavies
tobyodavies

Reputation: 28099

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.

Upvotes: 23

Related Questions