* add argument to a derived-mode
@ 2017-01-13 0:38 Joe Riel
2017-01-13 14:37 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Joe Riel @ 2017-01-13 0:38 UTC (permalink / raw)
To: Help GNU Emacs
Is there a way to use define-derived-mode to
create a major mode that takes an argument if
the base mode does not?
--
Joe Riel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add argument to a derived-mode
2017-01-13 0:38 add argument to a derived-mode Joe Riel
@ 2017-01-13 14:37 ` Stefan Monnier
2017-01-15 20:49 ` Joe Riel
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2017-01-13 14:37 UTC (permalink / raw)
To: help-gnu-emacs
> Is there a way to use define-derived-mode to
> create a major mode that takes an argument if
> the base mode does not?
Major modes do not take arguments, no.
Instead, you'll want to define 2 functions:
- a major mode
- the function you want, with its argument, and which internally calls
the major mode.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add argument to a derived-mode
2017-01-13 14:37 ` Stefan Monnier
@ 2017-01-15 20:49 ` Joe Riel
2017-01-15 22:33 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Joe Riel @ 2017-01-15 20:49 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
On Fri, 13 Jan 2017 09:37:07 -0500
Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > Is there a way to use define-derived-mode to
> > create a major mode that takes an argument if
> > the base mode does not?
>
> Major modes do not take arguments, no.
> Instead, you'll want to define 2 functions:
> - a major mode
> - the function you want, with its argument, and which internally calls
> the major mode.
Is it a requirement that major modes not take an argument?
In my case the major modes are not invoked interactively,
so having a required argument isn't a practical problem.
However, if it's considered bad form to pass arguments to them,
I'll make the change, which would allow using define-derived-mode.
--
Joe Riel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add argument to a derived-mode
2017-01-15 20:49 ` Joe Riel
@ 2017-01-15 22:33 ` Stefan Monnier
2017-01-16 1:53 ` Joe Riel
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2017-01-15 22:33 UTC (permalink / raw)
To: Joe Riel; +Cc: help-gnu-emacs
> Is it a requirement that major modes not take an argument?
Technically, not quite (it may be called with no arguments, so any
argument it can accept should be optional).
> However, if it's considered bad form to pass arguments to them,
> I'll make the change, which would allow using define-derived-mode.
Yes, it's considered bad form and likely to lead to problems sooner
or later.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: add argument to a derived-mode
2017-01-15 22:33 ` Stefan Monnier
@ 2017-01-16 1:53 ` Joe Riel
0 siblings, 0 replies; 5+ messages in thread
From: Joe Riel @ 2017-01-16 1:53 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
On Sun, 15 Jan 2017 17:33:10 -0500
Stefan Monnier <monnier@IRO.UMontreal.CA> wrote:
> > Is it a requirement that major modes not take an argument?
>
> Technically, not quite (it may be called with no arguments, so any
> argument it can accept should be optional).
>
> > However, if it's considered bad form to pass arguments to them,
> > I'll make the change, which would allow using define-derived-mode.
>
> Yes, it's considered bad form and likely to lead to problems sooner
> or later.
Thanks. I made the changes. Using define-derived-mode is certainly nicer.
--
Joe Riel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-16 1:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-13 0:38 add argument to a derived-mode Joe Riel
2017-01-13 14:37 ` Stefan Monnier
2017-01-15 20:49 ` Joe Riel
2017-01-15 22:33 ` Stefan Monnier
2017-01-16 1:53 ` Joe Riel
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.