unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* define-derived-mode and function arguments
@ 2010-08-02  0:23 Wojciech Meyer
  2010-08-02  7:54 ` Tassilo Horn
  2010-08-02  8:24 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Wojciech Meyer @ 2010-08-02  0:23 UTC (permalink / raw)
  To: emacs-devel


Hi,

Some of mode definitions don't use the idea of derived modes, instead
they use defuns.

These defuns have sometimes optional arguments.

So the question is, is it possible to use `define-derived-mode' with
optional arguments?

TIA
Wojciech




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-derived-mode and function arguments
  2010-08-02  0:23 define-derived-mode and function arguments Wojciech Meyer
@ 2010-08-02  7:54 ` Tassilo Horn
  2010-08-02  8:24 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2010-08-02  7:54 UTC (permalink / raw)
  To: emacs-devel; +Cc: Wojciech Meyer

On Monday 02 August 2010 02:23:59 Wojciech Meyer wrote:

Hi Wojciech,

> Some of mode definitions don't use the idea of derived modes, instead
> they use defuns.
> 
> These defuns have sometimes optional arguments.
> 
> So the question is, is it possible to use `define-derived-mode' with
> optional arguments?

Not that I know of.  But I even don't know a major mode which uses
optional arguments.  Maybe you confuse minor and major modes?

Calling the `foo-mode' function of one of the former usually toggle the
foo minor mode, and an optional argument is used to enable/disable it
explicitly.  But you cannot disable a major mode except by activating
another major mode, so there's no need for such an argument.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-derived-mode and function arguments
  2010-08-02  0:23 define-derived-mode and function arguments Wojciech Meyer
  2010-08-02  7:54 ` Tassilo Horn
@ 2010-08-02  8:24 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2010-08-02  8:24 UTC (permalink / raw)
  To: Wojciech Meyer; +Cc: emacs-devel

> So the question is, is it possible to use `define-derived-mode' with
> optional arguments?

No, there's no way to have arguments.  Usually those arguments are used
to set some buffer-local vars and the way to make it work with
define-derived-mode is to set those vars in the caller (right after the
call) rather than in the major-mode function.


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-02  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-02  0:23 define-derived-mode and function arguments Wojciech Meyer
2010-08-02  7:54 ` Tassilo Horn
2010-08-02  8:24 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).