[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Troubles with abbrev-mode
From: |
Tassilo Horn |
Subject: |
Re: Troubles with abbrev-mode |
Date: |
Wed, 27 Sep 2006 11:36:59 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
Reiner Steib <reinersteib+gmane@imap.cc> writes:
Hi Reiner,
>> Hm, in my opinion that's a really bad behavior, because...
>>
>> a) if the user wants that behavior, he can set in `message-mode-hook'.
>
> And if he doesn't want the current behavior, he can probably also do
> it in `message-mode-hook' now? [1]
Yes, he can. But I think the current behavior patronizes the user too
much. It's not logical to use a abbrev-table from a different mode, even
if the current mode is derived from it, when newly added abbrevs go into
the current mode's abbrev-table, thus have no effect at all.
If you know what's going on, you can handle it, but for a normal user
without any knowledge about how abbrev-mode works it's simply wrong
accoring to the docs.
,----[ (info "(emacs)Defining Abbrevs") ]
| `C-x a g'
| Define an abbrev, using one or more words before point as its
| expansion (`add-global-abbrev').
|
| `C-x a l'
| Similar, but define an abbrev specific to the current major mode
| (`add-mode-abbrev'). ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| `C-x a i g'
| Define a word in the buffer as an abbrev
| (`inverse-add-global-abbrev').
|
| `C-x a i l'
| Define a word in the buffer as a mode-specific abbrev
| (`inverse-add-mode-abbrev'). ^^^^^^^^^^^^^^^^^^^^
`----
>> b) adding abbrevs in message mode (with `add-mode-abbrev' or
>> `inverse-add-mode-abbrev') adds it to
>> `message-mode-abbrev-table'. So you effectively cannot add abbrevs
>> interactively.
>>
>> So I see two possible fixes:
>>
>> 1) Delete the setq. (To me that seems right and proper.)
>
> This will break existing configurations, wouldn't it?
Yep, but it would be easy to fix. The user could copy his abbrevs to
`message-mode-abbrev-table' or setq `local-abbrev-table' back to
`text-mode-abbrev-table' in `message-mode-hook' (or
`gnus-message-setup-hook'). Ok, the second solution still suffers from
this adding-abbrevs-problem...
> `message-mode' derived from `text-mode': Do we have guidelines /
> conventions / best practice in Emacs on how to deal with abbrevs in
> derived modes?
As I'm not really involved in emacs development I don't know. Should I
start a new thread about point 2 in gmane.emacs.devel?
>> 2) Fix `add-mode-abbrev' and `inverse-add-mode-abbrev', so that they
>> insert into `local-abbrev-table'.
>>
>> To me the second point should be done, too, because that's what a
>> user would expect. Only then he has the possibility to use a
>> abbrev-table for multiple modes, e.g. text-mode-abbrev-table for
>> message-mode-abbrev-table.
>>
>> What do you mean?
>
> I don't have a strong opinion here (as I don't know what the docs
> suggest here).
At least you have to admit that it's inconvenient for the user if he
adds abbrevs interactively, but they don't work.
> [1] BTW, in my init files I find...
> (add-hook
> 'gnus-message-setup-hook
> '(lambda ()
> (when (boundp 'rs-message-mode-abbrev-table)
> (setq local-abbrev-table rs-message-mode-abbrev-table))
> [...]
>
> ... but I don't exactly recall it's purpose. At least, I have some
> abbrevs in message-mode that are not present in text-mode.
But you alway added them with `edit-abbrevs', not interactively with
`add-mode-abbrev' or `inverse-add-mode-abbrev', right?
Bye,
Tassilo
--
A morning without coffee is like something without something else.