unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: define-derived-mode
Date: Tue, 10 May 2005 10:47:45 +0200	[thread overview]
Message-ID: <87wtq731se.fsf@xs4all.nl> (raw)
In-Reply-To: <200505100007.j4A078L07495@raven.dms.auburn.edu> (Luc Teirlinck's message of "Mon, 9 May 2005 19:07:08 -0500 (CDT)")

Luc Teirlinck <teirllm@dms.auburn.edu> writes:

> Lute Kamstra wrote:
>
>    > which was an incompatible change.
>
>    Not compatible with what?
>
> With pre-existing defvars or defcustoms for these hooks.  (Unless you
> checked for _all_ uses of `define-generic-mode' that there are none.
> But how did you get a list of _all_ outside packages that use it?)

define-generic-mode is an all-in-one solution for defining a major
mode.  You call it, and every aspect of the major mode should be set
up.  I think it's very unlikely that anyone who uses
define-generic-mode will add a defvar for the mode hook.  (This
certainly isn't the case in Emacs' sources.)

> In the case of `define-minor-mode' two concrete examples of variables
> with competing defcustoms are auto-revert-mode-hook and
> global-auto-revert-mode-hook.  In this particular case, not too much
> harm is done, but it is not exactly very clean.
>
>    I primarily wanted to define the mode hook as a variable so that I
>    could give it docstring.  I chose defcustom over defvar because
>    define-minor-mode and quite some other major modes did that.  I don't
>    strongly object to making the defcustom a defvar, but I don't
>    understand your problems with the use of defcustom:
>
> I have a problem with _both_ defvar and defcustom.  Hooks do not need
> a defvar, most hooks do not have them.  The only reason for a defvar
> is to add a docstring.  You use the defvar to give the hook the
> docstring: "Hook run when entering Mymode mode.".  This "generic"
> docstring contains no info that is not already contained in the hook's
> name and it could overwrite _real_ info contained in a handwritten
> defvar or defcustom.
>
> If you want to make people aware of the mode hook, it would seem
> better to put an additional sentence in the default mode doc:
>
> "Mymode mode.
> This a generic mode defined with `define-generic-mode'.
> As all such modes, it runs `foo-mode-hook' as the very last thing it does."

Ok, that sounds reasonable.  I'll implement that.

>    I don't recall the bugs you refer to; could you give me the subject(s)
>    of the relevant thread(s)?
>
> It is scattered over several threads.  Threads about Custom tend to be
> superlong and unfocused. `find-file-hook as illustration of Custom problems'
> is one of the threads, but several other threads about Custom were
> going on at the same time and they all intertwined.
>
> There are several problems, related to the fact that hooks have to be
> customized using add-hook and remove-hook and not using setq.  But
> Custom does use setq.  Here is an example of the type of problems that
> occur.  (By no means the only one.)  The user customizes foo-hook
> using Custom.  Then in the next Emacs version, a very essential
> function badly-needed-fun is added to foo-hook.  The user's
> custom-set-variables form overrides the adding of badly-needed-fun to
> foo-hook.
>
> These kind of problems are supposed to get fixed in 23 or 24, but it
> is too tricky to still get it done for 22. 

Thanks for clarifying,

  Lute.

  reply	other threads:[~2005-05-10  8:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-08  1:01 define-derived-mode Luc Teirlinck
2005-05-08  3:15 ` define-derived-mode Luc Teirlinck
2005-05-08 16:12   ` define-derived-mode Richard Stallman
2005-05-08 17:00     ` define-derived-mode Juanma Barranquero
2005-05-09  8:57       ` define-derived-mode Richard Stallman
2005-05-08 17:48     ` define-derived-mode Luc Teirlinck
2005-05-09  8:57       ` define-derived-mode Richard Stallman
2005-05-09 10:13         ` define-derived-mode David Kastrup
2005-05-12 13:53         ` define-derived-mode Lute Kamstra
2005-05-17 15:58           ` define-derived-mode Lute Kamstra
2005-05-09 10:35       ` define-derived-mode Lute Kamstra
2005-05-10  0:07         ` define-derived-mode Luc Teirlinck
2005-05-10  8:47           ` Lute Kamstra [this message]
2005-05-08 14:04 ` define-derived-mode Luc Teirlinck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wtq731se.fsf@xs4all.nl \
    --to=lute.kamstra.lists@xs4all.nl \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).