emacs-pretest-bug
[Top][All Lists]
Advanced

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

expand.el: always enable abbrev-mode


From: Markus Triska
Subject: expand.el: always enable abbrev-mode
Date: Tue, 20 Mar 2007 06:03:10 +0100

The example code in expand.el can inadvertently disable abbrev-mode if
it was already enabled. This patch also makes expand-abbrev-hook
autoloaded, which is useful if you save the new abbrevs and want to
avoid marking them as modified by defining them again in future
invocations of the hook.

All the best,

2007-03-20  Markus Triska  <address@hidden>

        * expand.el: change example to always enable abbrev-mode, make
         expand-abbrev-hook autoloaded, remove redundant `function'



*** expand.el   21 Jan 2007 04:53:11 +0100      1.17
--- expand.el   20 Mar 2007 05:17:25 +0100      
***************
*** 51,67 ****
  ;;
  ;;   and enter Abbrev mode with the following hook :
  ;;
! ;; (add-hook 'c-mode-hook (function (lambda ()
! ;;                               (expand-add-abbrevs c-mode-abbrev-table 
c-expand-list)
! ;;                               (abbrev-mode))))
  ;;
  ;;   you can also init some post-process hooks :
  ;;
  ;; (add-hook 'expand-load-hook
! ;;      (function
! ;;       (lambda ()
! ;;         (add-hook 'expand-expand-hook 'indent-according-to-mode)
! ;;         (add-hook 'expand-jump-hook 'indent-according-to-mode))))
  ;;
  ;; Remarks:
  ;;
--- 51,67 ----
  ;;
  ;;   and enter Abbrev mode with the following hook :
  ;;
! ;; (add-hook 'c-mode-hook
! ;;      (lambda ()
! ;;        (expand-add-abbrevs c-mode-abbrev-table c-expand-list)
! ;;        (abbrev-mode 1)))
  ;;
  ;;   you can also init some post-process hooks :
  ;;
  ;; (add-hook 'expand-load-hook
! ;;      (lambda ()
! ;;        (add-hook 'expand-expand-hook 'indent-according-to-mode)
! ;;        (add-hook 'expand-jump-hook 'indent-according-to-mode)))
  ;;
  ;; Remarks:
  ;;
***************
*** 336,341 ****
--- 336,342 ----
        'expand-abbrev-hook)))
  
  (put 'expand-abbrev-hook 'no-self-insert t)
+ ;;;###autoload
  (defun expand-abbrev-hook ()
    "Abbrev hook used to do the expansion job of expand abbrevs.
  See `expand-add-abbrevs'.  Value is non-nil if expansion was done."





reply via email to

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