all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: Reify the cc-mode-common into an actual parent mode
Date: Sat, 28 May 2016 14:08:47 -0400	[thread overview]
Message-ID: <jwvtwhink5z.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20160528113003.GA2950@acm.fritz.box> (Alan Mackenzie's message of "Sat, 28 May 2016 11:30:03 +0000")

> The canonical way to create a mode derived from CC Mode is to derive
> from, say, `c-mode', call `c-add-language', then specify the values of
> the language variables which differ from those of `c-mode'.

Hmm... you don't seem to preach by example here: none of CC-mode's
predefined modes inherit from another.  So I'm not sure "canonical" is
the appropriate word.

I also looked at some of the externally maintained major modes that rely
on CC-mode, and they generally don't seem to derive from any of your
predefined modes either.

> There's nothing coherent about `c-mode-common'; it isn't sensible to set
> a buffer to this mode, and it would be erroneous to attempt to derive a
> mode (other than the seven within CC Mode) directly from it, since the
> language variables for the new mode wouldn't get initialised.

Currently all CC modes seem to either derive from prog-mode or from
fundamental-mode, so they all have the same need to explicitly call
things like (c-init-language-vars-for <mymode>).  Using c-mode-common
doesn't make any difference in this respect.

> modes that have them.  It so happens that, at the moment, those two
> functions don't affect `c-update-modeline', so things work, but this
> executing in the wrong order is storing up trouble for the future, should
> some form in `c-mode''s :after-hook position need executing before
> `c-update-modeline'.

The fact that they don't interfere is not an accident, IMO.
[ BTW, I notice that define-derived-mode doesn't document the relative
  order of execution of inherited :after-hooks.  It's probably better
  that way, admittedly.  ]


        Stefan



  parent reply	other threads:[~2016-05-28 18:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24  0:41 Reify the cc-mode-common into an actual parent mode Stefan Monnier
2016-05-28 11:30 ` Alan Mackenzie
2016-05-28 17:51   ` Stefan Monnier
2016-05-29  9:45     ` Alan Mackenzie
2016-05-29 14:53       ` Stefan Monnier
2016-05-28 18:08   ` Stefan Monnier [this message]
2016-05-29 10:00     ` Alan Mackenzie
2016-05-30 17:37       ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwvtwhink5z.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@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 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.