Skip to content

Commit 036abd6

Browse files
committed
Add magic-filetype-collect-major-modes
1 parent f7d95b9 commit 036abd6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.org

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,10 @@ If you write the setting to =.emacs=, you can be briefly defined as follows.
4444

4545
*** Reload major mode
4646
=M-x magic-filetype-reload-major-mode=
47+
48+
** Utility function
49+
*** Collect major-modes
50+
#+BEGIN_SRC emacs-lisp
51+
(require 'magic-filetype')
52+
(completing-read "Input major mode: " (magic-filetype-collect-major-modes))
53+
#+END_SRC

magic-filetype.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@
150150
:group 'magic-filetype
151151
:type '(alist :key-type symbol :value-type list))
152152

153+
(defun magic-filetype-collect-major-modes ()
154+
"Retturn list of MAJOR-MODEs by `auto-mode-alist'."
155+
(cl-loop for elm in auto-mode-alist
156+
if (symbolp (cdr elm))
157+
collect (cdr elm)))
158+
153159
;;;###autoload
154160
(defun magic-filetype-major-mode-from-language-name (lang-name)
155161
"Invoke `major-mode' from `LANG-NAME'."

0 commit comments

Comments
 (0)