[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: define abbrev for emacs-lisp-mode but not other lisp-mode
From: |
harven |
Subject: |
Re: define abbrev for emacs-lisp-mode but not other lisp-mode |
Date: |
Wed, 08 Dec 2010 15:36:14 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Xah Lee <xahlee@gmail.com> writes:
> this is a odd thing.
>
> when in emacs-lisp-mode, and when you define a abbrev (e.g. call
> define-mode-abbrev then “ah” then “add-hook”), then call write-abbrev-
> file
>
> then you get this in your abbrev file (e.g. at 〔~/.emacs.d/
> abbrev_defs〕)
>
> (define-abbrev-table 'lisp-mode-abbrev-table '(
> ("ah" "add-hook" nil 0)
> ))
>
> note that it's lisp-mode-abbrev-table not emacs-lisp-mode-abbrev-
> table.
>
> Why's that?
>
> (if you change it to the latter, it won't work.)
>
> i'm wondering because i want the abbrev to be for emacs-lisp-mode
> only, not general lisp mode.
> It appears that emacs-lisp-mode is defined on top of lisp-mode. Ok, so
> my question is, what's the purpose of lisp-mode? Is that supposed to
> be the base for other lisp lang modes to be defined on top of? A look
> at scheme-mode seems to confirm this, but still, i want my abbrev for
> emacs lisp mode only. Is that possible?
>
> thanks.
>
> Xah ∑ http://xahlee.org/ ☄
I would try the following in .emacs
(define-abbrev-table 'emacs-lisp-mode-abbrev-table '(
("ah" "add-hook" nil 0)))
(add-hook 'emacs-lisp-mode-hook (lambda()
(setq abbrev-mode t)
(setq local-abbrev-table emacs-lisp-mode-abbrev-table)))
I think that the nil argument after add-hook is deprecated in emacs ≥ 23.