[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: abbrevs and cursor control

From: Harry Putnam
Subject: Re: abbrevs and cursor control
Date: Fri, 14 Feb 2003 10:00:32 GMT
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) (Kai Großjohann) writes:

> Harry Putnam <> writes:
>> (define-skeleton hp-mkeywords
>>      "Insert nifty keywords string into mail/news messages
>>          and closing characters to make it searchable in a blob"
>>      nil
>>      "Keywords: "_"\n" 
>>      (format-time-string "X-Key-Date: %b %d %Y %w\n") 
>>      "X-&&: ") 
>> I'd like to do something like that with the symplicity of an abbrev
>> rather than calling command or hitting command keys.
> I hope you mean ease of use rather than ease of definition.  Actually,
> you can marry skeletons and abbrevs: the define-abbrev function (and
> its ilk) allows you to specify a hook.  You could specify the empty
> string as the expansion and the skeleton as the hook.

Swish... that was the sound of your response zooming right over my
head.  Not sure I understand how an empty string can expand, but
maybe I'm reading this wrong.  

After poring over C-h f define-abbrev I got sort of close I guess, but


Though its the kind of thing lisp programmers consider the epitome of
lucid. Its not very helpfull to laypeople.  No indication of where
parens might go or other really usefull stuff.

I tried this:

(define-abbrev cperl-mode-abbrev-table "hpb" "" hp-pbase 0 )
then lots of other stuff with parens, finally discovering:
(define-abbrev cperl-mode-abbrev-table "hpb" "" (hp-pbase 0))

Evaling with C-x e does insert the hp-pbase skeleton but I'll be
damed if I can see what to type to get it to expand like other

Typing hpb<spc> just makes the `hpb' disappear and the skeleton stuff 
isn't inserted.

This piece from C-h f:
  If EXPANSION is not a string, the abbrev is a special one,
  which does not expand in the usual way but only runs HOOK.

Kind of sounds like EXPANSION shouldn't be a string at all.  Not even
the empty one "".

So trying 
 (define-abbrev cperl-mode-abbrev-table "hpb" nil (hp-pbase 0))
 (define-abbrev cperl-mode-abbrev-table "hpb"  (hp-pbase 0))

C-x e will still insert the hp-pbase skeleton but still nothing good
happens when typing hpb<spc>.  I've run out of experiments.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]