From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Problems with the capitalization in Word Abbreviation Mode
Date: Mon, 06 Oct 2008 15:12:14 +0200 [thread overview]
Message-ID: <1223299055.389667@arno.fh-trier.de> (raw)
In-Reply-To: <e5b03fff-e9cb-4f50-8772-4d876bc8bd4c@k13g2000hse.googlegroups.com>
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
next prev parent reply other threads:[~2008-10-06 13:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-06 8:12 Problems with the capitalization in Word Abbreviation Mode Hans-Christian Mick
2008-10-06 13:12 ` Andreas Politz [this message]
2008-10-06 14:31 ` Hans-Christian Mick
2008-10-06 16:53 ` Andreas Politz
2008-10-07 4:06 ` Xah
-- strict thread matches above, loose matches on Subject: below --
2008-10-06 16:06 martin rudalics
[not found] <mailman.381.1223309323.25473.help-gnu-emacs@gnu.org>
2008-10-07 18:35 ` Xah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1223299055.389667@arno.fh-trier.de \
--to=politza@fh-trier.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).