help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Problems with the capitalization in Word Abbreviation Mode


From: Andreas Politz
Subject: Re: Problems with the capitalization in Word Abbreviation Mode
Date: Mon, 06 Oct 2008 18:53:34 +0200
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

Hans-Christian Mick wrote:

That's just what I wanted, thanks a lot!

I've just pasted into my abbrev-defs-file. Although this lisp-stuff
looks really complicated to me... How long does it take to learn this
stuff?

Mh, you shouldn't paste it in this file. Paste it in the scratch buffer
, eval* it and make emacs save the abbrevs (e.g. by C-x s). Now you
can delete the code.

There is an introduction to elisp for non-programmers in the info files.

(info "(eintr)")

*Place point behind the last paren and type C-x C-e.

Am I right in thinking that in order to add more of these literal-
abbrevs to my abbrev-defs file I should have to write something like
this:

(define-literal-abbrev global-abbrev-table (
("DAs" "Das")
("DIe" "Die")
("WEr" "Wer")
))

No, but maybe a command is more convenient. Note
the updated function.

(defun define-literal-abbrev (table name expansion &optional count system-flag)
  (define-abbrev table (downcase name) 'literal-abbrev
     `(lambda ()
        (let (case-fold-search
             (start (- (point) ,(length name))))
         (when (looking-back ,(regexp-quote name) start)
           (delete-region start (point))
           (insert ,expansion))))
     count system-flag))

(defun add-literal-global-abbrev (name expansion)
  (interactive "MAbbrev : \nMExpansion : ")
  (define-literal-abbrev global-abbrev-table name expansion))



Although I have to admit that now it sounds like the theme of the
German Sesame-Street...:)

Thanks again!

-ap


reply via email to

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