all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* problems with minor-mode-table-alist
@ 2012-10-17 17:25 damien.thiriet77
  0 siblings, 0 replies; only message in thread
From: damien.thiriet77 @ 2012-10-17 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-17 17:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 17:25 problems with minor-mode-table-alist damien.thiriet77

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.