unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* common abbrev table for major modes
@ 2010-12-15 18:35 peterson
  2010-12-16 22:08 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: peterson @ 2010-12-15 18:35 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, how can I use one set of abbrev definitions in more than one major
mode?  I want to use the same abbrevs in all text modes, for example
text-mode, erc-mode, muse-mode.  What I found so far is the :parents
option of define-abbrev-table, which contains a list of abbrev tables
from which this table inherits abbreviations.  Seems like the thing
I'm after, but I have no idea how to define the parent.  I tried:

(define-abbrev-table 'muse-mode-abbrev-table '(    ) nil :parents
'(text-mode-abbrev-table))

And had all definitions in the text-mode abbrev table, but I get the
following error in a muse buffer:

abbrev-table-get: Wrong type argument: vectorp, text-mode-abbrev-table

Thanks in advance.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: common abbrev table for major modes
  2010-12-15 18:35 common abbrev table for major modes peterson
@ 2010-12-16 22:08 ` Stefan Monnier
  2010-12-19 17:56   ` peterson
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2010-12-16 22:08 UTC (permalink / raw)
  To: help-gnu-emacs

> (define-abbrev-table 'muse-mode-abbrev-table '(    ) nil :parents
> '(text-mode-abbrev-table))

The :parents should be (list text-mode-abbrev-table) (other you have
a list containing the symbol `text-mode-abbrev-table' rather than a list
containing an abbrev-table).

You may also want to use

  (abbrev-table-put foo-abbrev-table :parents (list text-mode-abbrev-table))

if foo-abbrev-table already exists (calling `define-abbrev-table' on
a table that already exists is not a good idea).


        Stefan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: common abbrev table for major modes
  2010-12-16 22:08 ` Stefan Monnier
@ 2010-12-19 17:56   ` peterson
  0 siblings, 0 replies; 3+ messages in thread
From: peterson @ 2010-12-19 17:56 UTC (permalink / raw)
  To: help-gnu-emacs

Thank you for your help, it works!

On Dec 16, 11:08 pm, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> > (define-abbrev-table 'muse-mode-abbrev-table '(    ) nil :parents
> > '(text-mode-abbrev-table))
>
> The :parents should be (list text-mode-abbrev-table) (other you have
> a list containing the symbol `text-mode-abbrev-table' rather than a list
> containing an abbrev-table).
>
> You may also want to use
>
>   (abbrev-table-put foo-abbrev-table :parents (list text-mode-abbrev-table))
>
> if foo-abbrev-table already exists (calling `define-abbrev-table' on
> a table that already exists is not a good idea).
>
>         Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-19 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15 18:35 common abbrev table for major modes peterson
2010-12-16 22:08 ` Stefan Monnier
2010-12-19 17:56   ` peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).