From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.help Subject: Re: Problems with the capitalization in Word Abbreviation Mode Date: Mon, 06 Oct 2008 15:12:14 +0200 Organization: FH-Trier Message-ID: <1223299055.389667@arno.fh-trier.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1223300459 1107 80.91.229.12 (6 Oct 2008 13:40:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 6 Oct 2008 13:40:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 06 15:41:56 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KmqLK-0006Nd-TC for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Oct 2008 15:41:47 +0200 Original-Received: from localhost ([127.0.0.1]:55383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KmqKH-00060S-8l for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Oct 2008 09:40:41 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.freenet.de!news.tu-darmstadt.de!news.belwue.de!news.uni-kl.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 47 Original-NNTP-Posting-Host: 143-93-54-11.arno.fh-trier.de Original-X-Trace: news.uni-kl.de 1223299073 7444 143.93.54.11 (6 Oct 2008 13:17:53 GMT) Original-X-Complaints-To: usenet@news.uni-kl.de Original-NNTP-Posting-Date: Mon, 6 Oct 2008 13:17:53 +0000 (UTC) User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) In-Reply-To: Cache-Post-Path: arno.fh-trier.de!unknown@dslb-084-059-203-042.pools.arcor-ip.net X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) Original-Xref: news.stanford.edu gnu.emacs.help:163090 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58431 Archived-At: Hans-Christian Mick wrote: > Hello, > > I'm writing a paper in German and trying to automaticalliy fix some of > my usual typos by using the Word Abbreviation mode (and I have to > admit that I'm rather new to Emacs...). > > I'm having a problem with the capitalization in those abbreviations. > > A typo that happens to me rather often is that for example I'm typing > "DAs" instead of "Das" at the beginning of a sentence. > I have tried to define a global abbreviation for that, but now I'm > getting every "das" in the middle of a sentence turned into "Das", > which is not what I wanted of course. > > Looking into my abbrev.defs-file, I did not find the abbreviation > "DAs" that I originally had defined, but only a lowercase "das" and I > couldn't change it even by modifying the file directly (I wrote "DAs" > into the file, but then it didn't work anymore at all). > > Seems as if I'm always getting a lowercase abbreviation, no matter how > I'm defining my abbreviations. > > Could anyone please give me any hint on how to change this behaviour? > > Thanks a lot in advance! I think that's just how abbrevs work. But `define-abbrev' permits a function to handle abnormal expansions: (defmacro 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)) (define-literal-abbrev global-abbrev-table "DAs" "Das") ...and save the abbrev-table. -ap