all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "damien.thiriet77" <damien.thiriet77@laposte.net>
To: help-gnu-emacs@gnu.org
Subject: problems with minor-mode-table-alist
Date: Wed, 17 Oct 2012 19:25:57 +0200	[thread overview]
Message-ID: <1670792404.228409.1350494757622.JavaMail.www@wwinf8310> (raw)

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	other threads:[~2012-10-17 17:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1670792404.228409.1350494757622.JavaMail.www@wwinf8310 \
    --to=damien.thiriet77@laposte.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.