emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List of major modes?


From: Kevin Rodgers
Subject: Re: List of major modes?
Date: Mon, 14 Nov 2005 09:26:03 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

David Reitter wrote:
> The following dynamic definition seems to "sort of" work.
>
> (defun major-modes ()
>  (apropos-internal "-mode\\'"
>    (lambda (mode)
>      (and (commandp mode)
>       (not (string-match "\\`turn-\\(on\\|off\\)-"
>                    (symbol-name mode)))
>         (not (assq mode minor-mode-list))))))
>
>
> I don't know, however, whether minor-mode-list is complete, i.e.
> whether it contains the not-yet-auto-loaded minor modes. From what I
> see in easy-mmode.el, it doesn't look like it.

I still think it would be better to include functions that follow the
major mode conventions than to exclude functions that don't follow the
minor mode conventions.  The Emacs Lisp manual has nodes describing both
sets of conventions.

For example:

   * The major mode should usually have its own keymap, which is used
     as the local keymap in all buffers in that mode.  The major mode
     command should call `use-local-map' to install this local map.
     *Note Active Keymaps::, for more information.

     This keymap should be stored permanently in a global variable named
     `MODENAME-mode-map'.  Normally the library that defines the mode
     sets this variable.

So you could check (keymapp (intern-soft (concat mode "-map"))) in the
apropos-internal PREDICATE.

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]