kai.grossjohann@uni-duisburg.de (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 this: (define-abbrev TABLE NAME EXPANSION &optional HOOK COUNT SYSTEM-FLAG) 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 abbrevs. Typing hpb 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)) or (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. I've run out of experiments.