unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* add-mode-abbrev writes to fundamental table only
@ 2004-08-01 15:46 Harry Putnam
  2004-08-01 15:54 ` Harry Putnam
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Putnam @ 2004-08-01 15:46 UTC (permalink / raw)


Emacs version (yesterday cvs)

If this isn't a new problem related to cvs emacs then it might be a
good subject here:

I'm finding when I have entered any mode (Here we use sh-mode) that
running `add-mode-abbrev' will only write my new abbrev to the
Fundamental-mode-abbrev-table.

Test by:

C-x C-f some.sh <RET>
M-: major-mode<RET>
(Verify it is sh-mode)
newab<M-x add-mode-abbrev><RET>nb<RET>

Now M-x edit-abbrevs<RET> and search for newab.  See what abbrev table
its under.

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

* Re: add-mode-abbrev writes to fundamental table only
  2004-08-01 15:46 Harry Putnam
@ 2004-08-01 15:54 ` Harry Putnam
  0 siblings, 0 replies; 5+ messages in thread
From: Harry Putnam @ 2004-08-01 15:54 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

> I'm finding when I have entered any mode (Here we use sh-mode) that
                                  ^^^ 
This is a hefty overstatement  (any mode) it should have said only
sh-mode, as it seem to be confined to that mode only.

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

* Re: add-mode-abbrev writes to fundamental table only
       [not found] <mailman.2354.1091375582.1960.help-gnu-emacs@gnu.org>
@ 2005-02-25 19:13 ` rgb
  2005-02-28 19:19   ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: rgb @ 2005-02-25 19:13 UTC (permalink / raw)


> I'm finding when I have entered any mode (Here we use sh-mode) that
> running `add-mode-abbrev' will only write my new abbrev to the
> Fundamental-mode-abbrev-table.
>

I just had this problem in a mode I'm writing.  I found that
it occurs when local-abbrev-table is not set.
local-abbrev-table is buffer local when set but if it's not
set the default is usually fundamental-mode.

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

* Re: add-mode-abbrev writes to fundamental table only
  2005-02-25 19:13 ` add-mode-abbrev writes to fundamental table only rgb
@ 2005-02-28 19:19   ` Kevin Rodgers
  2005-02-28 21:03     ` rgb
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2005-02-28 19:19 UTC (permalink / raw)


rgb wrote:
 >>I'm finding when I have entered any mode (Here we use sh-mode) that
 >>running `add-mode-abbrev' will only write my new abbrev to the
 >>Fundamental-mode-abbrev-table.
 >
 > I just had this problem in a mode I'm writing.  I found that
 > it occurs when local-abbrev-table is not set.
 > local-abbrev-table is buffer local when set but if it's not
 > set the default is usually fundamental-mode.

What version of Emacs doesn't set local-abbrev-table?  If I run
emacs-21.3 -q --no-site-file -f sh-mode, `C-h f local-abbrev-table'
displays

| local-abbrev-table's value is
| [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
|
| Local in buffer redstone_build; global value is
| [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
|
|
| Documentation:
| Local (mode-specific) abbrev table of current buffer.

And `M-: (eq local-abbrev-table (default-value 'local-abbrev-table))'
returns nil.

I guess the workaround for OP is something like:

(add-hook 'sh-mode-hook
           (lambda ()
             (or local-abbrev-table
                 (setq local-abbrev-table (make-abbrev-table)))))

-- 
Kevin Rodgers

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

* Re: add-mode-abbrev writes to fundamental table only
  2005-02-28 19:19   ` Kevin Rodgers
@ 2005-02-28 21:03     ` rgb
  0 siblings, 0 replies; 5+ messages in thread
From: rgb @ 2005-02-28 21:03 UTC (permalink / raw)


Kevin Rodgers wrote:
> rgb wrote:
>  >>I'm finding when I have entered any mode (Here we use sh-mode)
that
>  >>running `add-mode-abbrev' will only write my new abbrev to the
>  >>Fundamental-mode-abbrev-table.
>  >
>  > I just had this problem in a mode I'm writing.  I found that
>  > it occurs when local-abbrev-table is not set.
>  > local-abbrev-table is buffer local when set but if it's not
>  > set the default is usually fundamental-mode.
>
> What version of Emacs doesn't set local-abbrev-table?

It might just be an unwanted side effect of something in OP's .emacs.
For example I saw the code below on emacswiki.  It would cause these
symptoms and a user may not connect the two without understanding the
connection between add-mode-abbrev and local-abbrev-table.

(defun sql-pre-abbrev-expand-hook ()
  ;; Allow our abbrevs only in a code context.
  (setq local-abbrev-table
	(if (sql-in-code-context-p)
	    sql-mode-abbrev-table)))

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

end of thread, other threads:[~2005-02-28 21:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2354.1091375582.1960.help-gnu-emacs@gnu.org>
2005-02-25 19:13 ` add-mode-abbrev writes to fundamental table only rgb
2005-02-28 19:19   ` Kevin Rodgers
2005-02-28 21:03     ` rgb
2004-08-01 15:46 Harry Putnam
2004-08-01 15:54 ` Harry Putnam

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).