unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* using custom emacs abbreviations
@ 2006-11-10  6:09 Kevin Harriss
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Harriss @ 2006-11-10  6:09 UTC (permalink / raw)


I am wanting to use a set of custom abbreviation in python-mode for
emacs.  The layout for my files I have is follows a ~/.emacs,
~/.emacs-dir/abbrevs.el, ~/.emacs-dir/recipe-abbrevs.el.  I will post
the contents of those files below.  When I open a python file with emacs
it says that it loads recipe-abbrevs.el but when I do M-x list-abbrevs
it only shows the default abbrevs with python-mode, so my custom abbrevs
are not being loaded.

=== ~/.emacs ===
(setq-default abbrev-mode t)
(setq save-abbrevs t)
(setq abbrev-file-name "~/.emacs-dir/abbrevs.el")
(if (file-readable-p abbrev-file-name)
    (read-abbrev-file abbrev-file-name))

(setq auto-mode-alist
      (append
       '(
         ("\\.recipe$" . python-mode)
         ("\\.py$" . python-mode)
         ) auto-mode-alist))

(add-hook 'python-mode-hook
  '(lambda()
      (load-file "~/.emacs-dir/recipe-abbrevs.el")))


=== ~/.emacs-dir/abbrevs.el ===
(define-abbrev-table 'text-mode-abbrev-table '(
    ("\\a" "\alpha" nil 0)
    ("\\auto" "" recipe-abbrev-auto 0)
 )
)

=== ~/.emacs-dir/recipe-abbrevs.el ===
(defun smart-space()
  (interactive)
  (if (not (expand-abbrev))
      (insert " ")
    )
  )
(local-set-key [(space)] 'smart-space)

(defun recipe-abbrevs-auto ()
  (interactive)
  (insert "class  (AutoPackageRecipe):")
)


Thanks,

Kevin

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

* Re: using custom emacs abbreviations
       [not found] <mailman.392.1163138841.2155.help-gnu-emacs@gnu.org>
@ 2006-11-10 16:05 ` Malte Spiess
  0 siblings, 0 replies; 2+ messages in thread
From: Malte Spiess @ 2006-11-10 16:05 UTC (permalink / raw)


Kevin Harriss <special.kevin@gmail.com> writes:

> I am wanting to use a set of custom abbreviation in python-mode for
> emacs.  The layout for my files I have is follows a ~/.emacs,
> ~/.emacs-dir/abbrevs.el, ~/.emacs-dir/recipe-abbrevs.el.  I will post
> the contents of those files below.  When I open a python file with emacs
> it says that it loads recipe-abbrevs.el but when I do M-x list-abbrevs
> it only shows the default abbrevs with python-mode, so my custom abbrevs
> are not being loaded.

I'm not an expert on abbrevs, but I guess this may be your problem:

> [...]
> === ~/.emacs-dir/abbrevs.el ===
> (define-abbrev-table 'text-mode-abbrev-table '(
                        ^^^^^^^^^^^^^^^^^^^^^^
You redefine the table for text mode (should be python-mode I guess).

> Thanks,
>
> Kevin

HTH

Malte

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

end of thread, other threads:[~2006-11-10 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.392.1163138841.2155.help-gnu-emacs@gnu.org>
2006-11-10 16:05 ` using custom emacs abbreviations Malte Spiess
2006-11-10  6:09 Kevin Harriss

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