From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "damien.thiriet77" Newsgroups: gmane.emacs.help Subject: conditionnal-abbrev-expand Date: Mon, 04 Feb 2013 19:59:22 +0100 Message-ID: <1409032162.446172.1360004362602.JavaMail.www@wwinf8229> References: Reply-To: "damien.thiriet77" NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1360004379 31503 80.91.229.3 (4 Feb 2013 18:59:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Feb 2013 18:59:39 +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 Feb 04 19:59:57 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U2RGg-0006x8-Pr for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Feb 2013 19:59:50 +0100 Original-Received: from localhost ([::1]:53327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2RGO-0004zY-9b for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Feb 2013 13:59:32 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2RGI-0004yo-OE for help-gnu-emacs@gnu.org; Mon, 04 Feb 2013 13:59:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2RGH-0003Y1-K3 for help-gnu-emacs@gnu.org; Mon, 04 Feb 2013 13:59:26 -0500 Original-Received: from smtpout6.laposte.net ([193.253.67.231]:57697 helo=smtpout.laposte.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2RGH-0003Xa-E8 for help-gnu-emacs@gnu.org; Mon, 04 Feb 2013 13:59:25 -0500 Original-Received: from wwinf8229 ([10.99.54.223]) by mwinf8511-out with ME id wJzN1k0054oxRQS03JzNq1; Mon, 04 Feb 2013 19:59:22 +0100 In-Reply-To: X-Originating-IP: [83.28.210.209] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 193.253.67.231 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88947 Archived-At: Hi, I wrote a small elisp function that is very convenient for people using ema= cs for writing articles, especially in flexible tongues as Polish. The idea= is that rather than having 5 abbrev for polityczny, polityczna, polityczne= go, politycznym, politycznymi I will have one abbrev that will expand to 'p= olityczn', and won't have to do a backspace after expansion. However, when = expanded with any punctuation mark, the mark will be set normally, for exam= ple myverylonglongword. <+>. I use this at an individual abbrev level, so t= hat Union Europ=C3=A9enne will be expanded normally when hitting space, and= 'europ=C3=A9en' will be expanded so that I can add properly my 's' or 'nes= ' or so on. Here is the function (defun conditional-abbrev-expand () "Abbrev expand depends on last keystroke. If it is a space, the abbrev is expanded without space insertion. This allows to add suffixes. Punctation marks expand abbrev and space are inserted." ;check that last stroke was a 'space' (when (equal last-input-event ?\s) ;if last stroke was a space, move mark to the left (char-left))) Examples taken from my abbrev-tabble: (define-abbrev global-abbrev-table "eurce" "Europe du Centre-Est") (define-abbrev global-abbrev-table "eur=C3=A9" "europ=C3=A9en" 'conditional= -abbrev-expand) (define-abbrev global-abbrev-table "eurp" "Europe") Is works, it is very usefull, is it a clean function? Une messagerie gratuite, garantie =C3=A0 vie et des services en plus, =C3= =A7a vous tente ? Je cr=C3=A9e ma bo=C3=AEte mail www.laposte.net