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: problems with minor-mode-table-alist Date: Wed, 17 Oct 2012 19:25:57 +0200 Message-ID: <1670792404.228409.1350494757622.JavaMail.www@wwinf8310> 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 1350496301 12976 80.91.229.3 (17 Oct 2012 17:51:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2012 17:51:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 17 19:51:48 2012 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 1TOXmU-0005ps-RY for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Oct 2012 19:51:46 +0200 Original-Received: from localhost ([::1]:41573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOXmN-0005VI-Mt for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Oct 2012 13:51:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOXNg-0000JE-3J for help-gnu-emacs@gnu.org; Wed, 17 Oct 2012 13:26:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOXNZ-0006g0-8H for help-gnu-emacs@gnu.org; Wed, 17 Oct 2012 13:26:08 -0400 Original-Received: from smtpout5.laposte.net ([193.253.67.230]:27002 helo=smtpout.laposte.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOXNY-0006ct-Vi for help-gnu-emacs@gnu.org; Wed, 17 Oct 2012 13:26:01 -0400 Original-Received: from wwinf8310 ([10.99.54.221]) by mwinf8510-out with ME id CHRx1k0054mN4ju03HRxba; Wed, 17 Oct 2012 19:25:57 +0200 X-Originating-IP: [83.28.209.66] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.253.67.230 X-Mailman-Approved-At: Wed, 17 Oct 2012 13:51:35 -0400 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:87302 Archived-At: Hello, I have troubles with creating my first minor-mode. The idea is to create la= nguage-related minor-mode, so that the same abbrev "pol" will expand to "po= litique" in French and "polityka" when a polish-minor is active. Unfortunat= ely, I have troubles when declaring this table, and googling did not gave a= ny concrete example. I bet this is stupid elisp error, but I cannot fix it = on my own. Here are the peaces of my .emacs with abbrevs, (define-abbrev-table 'polonais-mode-abbrev-table ()) (load "~/.emacs.d/skr=C3=B3ty.el"); a file with my abbrevs ;liste de tables associ=C3=A9es aux modes mineurs (setq abbrev-minor-mode-table-alist '( (polonais-mode . polonais-mode-abbrev-table) )) I wouldn=E2=80=99t be surprised if my list is not properly written. Here wi= th the minor-mode definition ;;;mode-mineur polonais-mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-minor-mode polonais-mode "Adapt emacs to polish keyboard and abbrevs. Interactively with no argument, this command toggles the mode. A positive prefix argument enables the mode, any other prefix argument disables it. From Lisp, argument omitted or nil enables the mode, `toggle' toggles the state. Dopasuje skr=C3=B3ty Evil do ergonomicznej klawiatury polskiej i wprowadza polsk=C4=85 wersj=C4=99 abbrev." ;valeur initiale nil ;indicateur dans la barre d=E2=80=99=C3=A9tat " ErgPL" ;raccourcis-claviers sp=C3=A9cifiques nil ;(when (polonais-mode 1) ;) ) ;d=C3=A9finit un mode mineur global polonais (define-globalized-minor-mode global-polonais-mode polonais-mode polonais-on) ;fonction pour lancer ce mode global (defun polonais-on () (unless (minibufferp) (polonais-mode 1))) When I try to expand an abbrev when my minor-mode is on, I have an error me= ssage Wrong type argument: vectorp, polonais-mode-abbrev-table. I bet this might be connected to this function from abbrev.el: (defun abbrev--active-tables (&optional tables) "Return the list of abbrev tables currently active. TABLES if non-nil overrides the usual rules. It can hold either a single abbrev table or a list of abbrev tables." ;; We could just remove the `tables' arg and let callers use ;; (or table (abbrev--active-tables)) but then they'd have to be careful ;; to treat the distinction between a single table and a list of tables. (cond ((consp tables) tables) ((vectorp tables) (list tables)) (t (let ((tables (if (listp local-abbrev-table) (append local-abbrev-table (list global-abbrev-table)) (list local-abbrev-table global-abbrev-table)))) ;; Add the minor-mode abbrev tables. (dolist (x abbrev-minor-mode-table-alist) (when (and (symbolp (car x)) (boundp (car x)) (symbol-value (car x))) (setq tables (if (listp (cdr x)) (append (cdr x) tables) (cons (cdr x) tables))))) tables)))) Thank you for your help! Damien Thiriet 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