[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using custom emacs abbreviations

From: Kevin Harriss
Subject: using custom emacs abbreviations
Date: Fri, 10 Nov 2006 00:09:36 -0600

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
         ("\\.recipe$" . python-mode)
         ("\\.py$" . python-mode)
         ) auto-mode-alist))

(add-hook 'python-mode-hook
      (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()
  (if (not (expand-abbrev))
      (insert " ")
(local-set-key [(space)] 'smart-space)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]