From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Testing new abbrev tables in elisp Date: Wed, 31 Oct 2007 18:09:32 +0200 Organization: JURTA Message-ID: <87lk9kw23x.fsf@jurta.org> References: <200706201948.06271.andreas.roehler@online.de> <200710262113.34899.andreas.roehler@online.de> <200710281514.00722.andreas.roehler@online.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1193849570 21380 80.91.229.12 (31 Oct 2007 16:52:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Oct 2007 16:52:50 +0000 (UTC) Cc: andreas.roehler@online.de, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 31 17:52:49 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1InGo6-0001GR-0D for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2007 17:52:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1InGnw-00068o-FQ for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2007 12:52:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1InGns-00067l-LN for emacs-devel@gnu.org; Wed, 31 Oct 2007 12:52:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1InGno-00063Z-QI for emacs-devel@gnu.org; Wed, 31 Oct 2007 12:52:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1InGno-00063T-Kc for emacs-devel@gnu.org; Wed, 31 Oct 2007 12:52:24 -0400 Original-Received: from smtp-out.neti.ee ([194.126.126.39]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1InGIu-00079P-KR for emacs-devel@gnu.org; Wed, 31 Oct 2007 12:20:28 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by MXR-13.estpak.ee (Postfix) with ESMTP id 3159BA90F; Wed, 31 Oct 2007 18:20:13 +0200 (EET) X-Virus-Scanned: amavisd-new at !change-mydomain-variable!.example.com Original-Received: from smtp-out.neti.ee ([127.0.0.1]) by localhost (MXR-1.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SHdHeercXivl; Wed, 31 Oct 2007 18:20:08 +0200 (EET) Original-Received: from Relayhost2.neti.ee (Relayhost2 [88.196.174.142]) by MXR-13.estpak.ee (Postfix) with ESMTP id B3DC49225; Wed, 31 Oct 2007 18:20:08 +0200 (EET) Original-Received: from mail.estpak.ee (84-50-157-21-dsl.est.estpak.ee [84.50.157.21]) by Relayhost2.neti.ee (Postfix) with ESMTP id 377FE1EC415; Wed, 31 Oct 2007 18:20:08 +0200 (EET) In-Reply-To: (Stefan Monnier's message of "Sun, 28 Oct 2007 17:03:19 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:82233 Archived-At: >> Beside of case-sensitivity another theme is in the >> pipe: to allow multi-word abbrevs. > > Since I've installed my code this is now possible. Just set the :regexp > property of the abbrev table accordingly. It's easy to write such code now to do this indeed, thanks. For example, (defvar dict '(("multi-word abbrev" "multi-word expansion") ;; ... )) (dolist (d dict) (define-abbrev global-abbrev-table (car d) (cadr d))) (abbrev-table-put global-abbrev-table :regexp (regexp-opt (mapcar 'car dict) 'words)) But maybe abbrev-mode should try to update :regexp automatically when the user interactively defines a new multi-word abbrev? So instead of giving the error message "Some abbrev characters are not word constituents" it could run something like: (let ((abbrevs ())) (mapatoms (lambda (sym) (if (symbol-value sym) (push (symbol-name sym) abbrevs))) global-abbrev-table) (abbrev-table-put global-abbrev-table :regexp (regexp-opt abbrevs 'words))) to rebuild :regexp from all abbrevs when at least one of them is not word constituent? -- Juri Linkov http://www.jurta.org/emacs/