comparison lisp/expand.el @ 76712:b73b11ebc50c

Change example to always enable abbrev-mode, and remove redundant `function'. (expand-abbrev-hook): Add autoload cookie.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 24 Mar 2007 16:39:43 +0000
parents e3694f1cb928
children 9355f9b7bbff 4ef881a120fe
comparison
equal deleted inserted replaced
76711:ba2df4dce7bc 76712:b73b11ebc50c
49 ;; ("main" "int\nmain(int argc, char * argv[])\n{\n\n}\n" 37)) 49 ;; ("main" "int\nmain(int argc, char * argv[])\n{\n\n}\n" 37))
50 ;; "Expansions for C mode") 50 ;; "Expansions for C mode")
51 ;; 51 ;;
52 ;; and enter Abbrev mode with the following hook : 52 ;; and enter Abbrev mode with the following hook :
53 ;; 53 ;;
54 ;; (add-hook 'c-mode-hook (function (lambda () 54 ;; (add-hook 'c-mode-hook
55 ;; (expand-add-abbrevs c-mode-abbrev-table c-expand-list) 55 ;; (lambda ()
56 ;; (abbrev-mode)))) 56 ;; (expand-add-abbrevs c-mode-abbrev-table c-expand-list)
57 ;; (abbrev-mode 1)))
57 ;; 58 ;;
58 ;; you can also init some post-process hooks : 59 ;; you can also init some post-process hooks :
59 ;; 60 ;;
60 ;; (add-hook 'expand-load-hook 61 ;; (add-hook 'expand-load-hook
61 ;; (function 62 ;; (lambda ()
62 ;; (lambda () 63 ;; (add-hook 'expand-expand-hook 'indent-according-to-mode)
63 ;; (add-hook 'expand-expand-hook 'indent-according-to-mode) 64 ;; (add-hook 'expand-jump-hook 'indent-according-to-mode)))
64 ;; (add-hook 'expand-jump-hook 'indent-according-to-mode))))
65 ;; 65 ;;
66 ;; Remarks: 66 ;; Remarks:
67 ;; 67 ;;
68 ;; Many thanks to Heddy Boubaker <boubaker@cenatls.cena.dgac.fr>, 68 ;; Many thanks to Heddy Boubaker <boubaker@cenatls.cena.dgac.fr>,
69 ;; Jerome Santini <santini@chambord.univ-orleans.fr>, 69 ;; Jerome Santini <santini@chambord.univ-orleans.fr>,
334 nil) 334 nil)
335 ) 335 )
336 'expand-abbrev-hook))) 336 'expand-abbrev-hook)))
337 337
338 (put 'expand-abbrev-hook 'no-self-insert t) 338 (put 'expand-abbrev-hook 'no-self-insert t)
339 ;;;###autoload
339 (defun expand-abbrev-hook () 340 (defun expand-abbrev-hook ()
340 "Abbrev hook used to do the expansion job of expand abbrevs. 341 "Abbrev hook used to do the expansion job of expand abbrevs.
341 See `expand-add-abbrevs'. Value is non-nil if expansion was done." 342 See `expand-add-abbrevs'. Value is non-nil if expansion was done."
342 ;; Expand only at the end of a line if we are near a word that has 343 ;; Expand only at the end of a line if we are near a word that has
343 ;; an abbrev built from expand-add-abbrev. 344 ;; an abbrev built from expand-add-abbrev.