* define abbrev for emacs-lisp-mode but not other lisp-mode
@ 2010-11-16 8:31 Xah Lee
2010-11-16 14:54 ` harven
0 siblings, 1 reply; 3+ messages in thread
From: Xah Lee @ 2010-11-16 8:31 UTC (permalink / raw)
To: help-gnu-emacs
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/ ☄
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: define abbrev for emacs-lisp-mode but not other lisp-mode
2010-11-16 8:31 define abbrev for emacs-lisp-mode but not other lisp-mode Xah Lee
@ 2010-11-16 14:54 ` harven
[not found] ` <98f8192b-26cd-4e25-8163-3fc926ceb455@s9g2000vby.googlegroups.com>
0 siblings, 1 reply; 3+ messages in thread
From: harven @ 2010-11-16 14:54 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: define abbrev for emacs-lisp-mode but not other lisp-mode
[not found] ` <98f8192b-26cd-4e25-8163-3fc926ceb455@s9g2000vby.googlegroups.com>
@ 2010-11-17 8:52 ` harven
0 siblings, 0 replies; 3+ messages in thread
From: harven @ 2010-11-17 8:52 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee <xahlee@gmail.com> writes:
> On Nov 16, 6:54 am, harven <har...@free.fr> wrote:
>> Xah Lee <xah...@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)))
>
> thanks. Interesting solution.
>
> Before i redefine my stuff, i did some more testing on my original
> question.
>
> i tried to go to scheme-mode and apparantly the abbrev does not work,
> but only in emacs-lisp-mode.
>
> if i'm in scheme-mode and i call define-mode-abbrev, it generate this
> code:
>
> (define-abbrev-table 'scheme-mode-abbrev-table
> '(
> ("ttt" "hhh" nil 0)
> ))
>
> So, my question is probably caused by unnecessarily looking under the
> hood.
>
>> I think that the nil argument after add-hook is deprecated in emacs ≥ 23.
>
> any reference you have on this? thanks.
Sorry, that's the 0 notation that is obsolete. It is now an optional property,
and is written as :count 0. See the docstring of define-abbrev.
┌────────────────────────────────────────────────────────────────┐
│(define-abbrev TABLE NAME EXPANSION &optional HOOK &rest PROPS) │
│ ... │
│An obsolete but still supported calling form is: │
│(define-abbrev TABLE NAME EXPANSION &optional HOOK COUNT SYSTEM)│
└────────────────────────────────────────────────────────────────┘
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-17 8:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 8:31 define abbrev for emacs-lisp-mode but not other lisp-mode Xah Lee
2010-11-16 14:54 ` harven
[not found] ` <98f8192b-26cd-4e25-8163-3fc926ceb455@s9g2000vby.googlegroups.com>
2010-11-17 8:52 ` harven
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.