all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hadron Quark <hadronquark@gmail.com>
Subject: Re: c++ and c common mode
Date: Thu, 14 Dec 2006 19:28:59 +0100	[thread overview]
Message-ID: <m2k60ucowk.fsf@gmail.com> (raw)
In-Reply-To: 1166027311.376131.238890@t46g2000cwa.googlegroups.com

"Robert Thorpe" <rthorpe@realworldtech.com> writes:

> Hadron Quark wrote:
>> "Robert Thorpe" <rthorpe@realworldtech.com> writes:
>> > Hadron Quark wrote:
>> >> "Robert Thorpe" <rthorpe@realworldtech.com> writes:
>> >> > Hadron Quark wrote:
>> >> >> Leo <sdl.web@gmail.com> writes:
>> >> >>
>> >> >> > * [2006.12.13 03:43 +0100] Hadron Quark wrote:
>> >> >> >                            ^^^^^^^^^^^^
>> >> >> >> I am duplicating hook additions e.g
>> >> >> >>
>> >> >> >> (add-hook 'c-mode-common-hook 'my-c-init)
>> >> >> >
>> >> >> > I think this line is sufficient.
>> >> >>
>> >> >> The one line I *did* have to duplicate was the define-key to add to both
>> >> >> keyboard maps:
>> >> >>
>> >> >>
>> >> >> ,----
>> >> >> |   (let ((dl '(
>> >> >> | 	      ([f1] . jump-man-page)
>> >> >> | 	      ([backtab] . semantic-ia-complete-symbol)
>> >> >> | 	      ([f5] . find-tag-noconfirm)
>> >> >> | 	      ([f6] . find-tag-repeat)
>> >> >> | 	      ([f7] . pop-tag-mark)
>> >> >> | 	      ([f2] . gdb-restore-windows)
>> >> >> | 	      ([f10] . compile)
>> >> >> | 	      ([f11] . next-error)
>> >> >> | 	      ([f12] . gdba))))
>> >> >> |     (dolist (i dl)
>> >> >> |       (define-key c-mode-map (car i) (cdr i))
>> >> >> |       (define-key c++-mode-map (car i) (cdr i))
>> >> >> |       ))
>> >> >> `----
>> >> >>
>> >> >> is there a better way? Some common "subset" for "c like" files?
>> >> >
>> >> > Add-hook just adds a function, so why not put the above in a function?
>> >> >
>> >>
>> >> It is : it was just an extract to show the duplication of the define-key lines.
>> >
>> > Ah, I'm with yer now.  You could do:-
>> >
>> > (defun define-key-c-and-c++-map (key x)
>> >   (define-key c-mode-map key x)
>> >   (define-key c++-mode-map key y))
>> >
>>
>> Thanks, but  I realise that - not much of a saving IMO and more
>> cluttering up of name space. I guess I was asking if there is a "base
>> key map" shared by all "c like" file modes so I only have to define-key
>> once.
>
> Inside CC-mode there is such a beast, it's called c-mode-base-map.
> It would be generally useful if it were possible to change it in Emacs
> configuration.  Try asking the CC-mode maintainer if they would
> consider making it a variable users can set.
>

It was changeable! Thanks for your help.

-- 

  reply	other threads:[~2006-12-14 18:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13  2:43 c++ and c common mode Hadron Quark
2006-12-13  3:47 ` Leo
     [not found] ` <mailman.1813.1165981695.2155.help-gnu-emacs@gnu.org>
2006-12-13 12:00   ` Hadron Quark
2006-12-13 13:52   ` Hadron Quark
2006-12-13 15:32     ` Robert Thorpe
2006-12-13 15:39       ` Hadron Quark
2006-12-13 15:47         ` Robert Thorpe
2006-12-13 16:10           ` Hadron Quark
2006-12-13 16:28             ` Robert Thorpe
2006-12-14 18:28               ` Hadron Quark [this message]
2006-12-13 17:57     ` David Hansen

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=m2k60ucowk.fsf@gmail.com \
    --to=hadronquark@gmail.com \
    /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.