help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with minor-mode-table-alist


From: damien.thiriet77
Subject: problems with minor-mode-table-alist
Date: Wed, 17 Oct 2012 19:25:57 +0200

Hello,


I have troubles with creating my first minor-mode. The idea is to create 
language-related minor-mode, so that the same abbrev "pol" will expand to 
"politique" in French and "polityka" when a polish-minor is active. 
Unfortunately, I have troubles when declaring this table, and googling did not 
gave any 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óty.el"); a file with my abbrevs
;liste de tables associées aux modes mineurs
(setq abbrev-minor-mode-table-alist '(
(polonais-mode . polonais-mode-abbrev-table)
))

I wouldn’t be surprised if my list is not properly written. Here with 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óty Evil do ergonomicznej klawiatury polskiej
i wprowadza polską wersję abbrev."
;valeur initiale
nil
;indicateur dans la barre d’état
" ErgPL"
;raccourcis-claviers spécifiques
nil
;(when (polonais-mode 1)
;)
)

;définit 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 message
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 à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]