[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c++ and c common mode
From: |
Robert Thorpe |
Subject: |
Re: c++ and c common mode |
Date: |
13 Dec 2006 08:28:31 -0800 |
User-agent: |
G2/1.0 |
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.
- c++ and c common mode, Hadron Quark, 2006/12/12
- Message not available
- Re: c++ and c common mode, Hadron Quark, 2006/12/13
- Re: c++ and c common mode, Robert Thorpe, 2006/12/13
- Re: c++ and c common mode, Hadron Quark, 2006/12/13
- Re: c++ and c common mode, Robert Thorpe, 2006/12/13
- Re: c++ and c common mode, Hadron Quark, 2006/12/13
- Re: c++ and c common mode,
Robert Thorpe <=
- Re: c++ and c common mode, Hadron Quark, 2006/12/14
- Re: c++ and c common mode, David Hansen, 2006/12/13