all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 21465@debbugs.gnu.org
Subject: bug#21465: [PATCH] CC-modes hierarchy
Date: Sun, 13 Sep 2015 17:18:01 -0400	[thread overview]
Message-ID: <20150913211801.GA10161@holos> (raw)
In-Reply-To: <jwv1te2f57a.fsf-monnier+emacsbugs@gnu.org>

On 13/09/15 at 04:24pm, Stefan Monnier wrote:
> > Nope, for some reason, doing (c-make-inherited-keymap) in the map
> > definition in 24, I end up only with a Foo++ menu.  Simply using
> > (make-keymap), I'd end with with both Foo++ and C++ menus.
> 
> Oh, you mean that your code uses c-make-inherited-keymap and the change
> breaks your code, so you then try to fix it by replacing it with
> make-sparse-keymap or make-keymap.
> 
> Indeed, that's not the right fix.  The right fix is to complain about
> the removal of c-make-inherited-keymap because it is used by external
> CC-mode modes.
> 
> BTW, you don't need c-make-inherited-keymap.  Instead you need
> 
>    (defvar foo++-mode-map
>      (let ((map (make-sparse-keymap)))
>        (set-keymap-parent map c-mode-base-map)
>        ...
>        map))
> 
> This should be just as backward compatible as using
> c-make-inherited-keymap (and "backward" includes XEmacs, here).

That works, thanks.

> >> > when there shouldn't be, or:
> >> > (define-derived-mode foo++-mode c-derivative-mode "Foo++"
> >> >  ...)
> >> > and fontification is broken.
> >> 
> >> How is it broken?
> 
> > Oh, it was broken because I was using (make-syntax-table) instead of
> > (funcall (c-lang-const c-make-mode-syntax-table c)). It looks like
> > c-derivative-mode comes with no syntax table, which is alright.
> 
> Indeed, we could set C's syntax table in c-derivative-mode.  That would
> make a lot of sense, thanks.  The proposed patch just introduces
> c-derivative-mode as a way to make the hierarchy more visible, but it
> doesn't make c-derivative-mode usable on its own.  You could argue that
> c-derivative-mode should be the same as c-mode, but my patch does not
> try to do that (yet?).

Oh, and I guess it's not necessary to do the (funcall …) since it's
already c-mode-syntax-table. Similar to the keymap, I can do

 (set-char-table-parent table c-mode-syntax-table)

It would be nice if c-derivative-mode did that work for us.

Then, if I didn't want the c-mode keymap or syntax table, I could set
the parent of my derived table to nil. That's what I did for a mode that
I recently made derive from conf-mode. I didn't want conf-mode's keymap.





  reply	other threads:[~2015-09-13 21:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-12  2:32 bug#21465: [PATCH] CC-modes hierarchy Stefan Monnier
2015-09-12 16:51 ` Mark Oteiza
2015-09-13 13:25   ` Stefan Monnier
2015-09-13 16:06     ` Mark Oteiza
2015-09-13 20:24       ` Stefan Monnier
2015-09-13 21:18         ` Mark Oteiza [this message]
     [not found] ` <mailman.971.1442025193.19560.bug-gnu-emacs@gnu.org>
2015-09-14 19:33   ` Alan Mackenzie
2015-09-15  1:06     ` Stefan Monnier
2015-09-16 13:57       ` Alan Mackenzie
2015-09-17  1:49         ` Stefan Monnier
2015-09-17 12:30           ` Alan Mackenzie
2015-10-09 20:35             ` Stefan Monnier
2015-10-09 20:49     ` Stefan Monnier
     [not found]     ` <jwva8rrsrsu.fsf-monnier+emacsbugs@gnu.org>
2020-09-07 16:52       ` Lars Ingebrigtsen
2020-09-07 20:03         ` Alan Mackenzie
2020-09-07 20:40           ` Stefan Monnier
2020-09-08 10:11             ` Lars Ingebrigtsen
2015-09-15  8:46 ` Zhang Kai Yu
2015-09-19 18:43 ` Jostein Kjønigsen
2015-09-20 13:35   ` 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=20150913211801.GA10161@holos \
    --to=mvoteiza@udel.edu \
    --cc=21465@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.