是否有选择Emacs模式的命令列表?我怎么知道我的平台上有哪些模式可用?我的意思是您在M-x
之后键入的模式名称列表。
答案 0 :(得分:21)
键入M-x *-mode <Tab>
,emacs将列出当前加载的所有以-mode
结尾的交互式命令。
我不确定您是否可以在require
之后轻松查看可用的模式,而无需先加载加载路径中的所有elisp文件。
答案 1 :(得分:4)
用于列出主要模式的函数,通过一些猜测来避免列出以-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))
答案 2 :(得分:2)
答案 3 :(得分:2)
C-h a mode
显示所有模式的摘要