X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/092af6d8677fa62567a0cf03502123cb177fb317..d4b9aae98f4f5298eaef096e42ac6aca02d9ee31:/lisp/expand.el diff --git a/lisp/expand.el b/lisp/expand.el index 51a1213989..aeb9ec83b1 100644 --- a/lisp/expand.el +++ b/lisp/expand.el @@ -1,6 +1,7 @@ -;;; expand.el --- make abbreviations more usable. +;;; expand.el --- make abbreviations more usable -;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. +;; Copyright (C) 1995, 1996, 2002, 2003, 2004, +;; 2005 Free Software Foundation, Inc. ;; Author: Frederic Lepied ;; Maintainer: Frederic Lepied @@ -20,8 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; @@ -47,7 +48,7 @@ ;; ("default" "default:\n\nbreak;" 10) ;; ("main" "int\nmain(int argc, char * argv[])\n{\n\n}\n" 37)) ;; "Expansions for C mode") -;; +;; ;; and enter Abbrev mode with the following hook : ;; ;; (add-hook 'c-mode-hook (function (lambda () @@ -71,17 +72,28 @@ ;; Please send me a word to give me your feeling about this feature or ;; to explain me how you use it (your expansions table for example) using ;; the function expand-submit-report. +;;; Code: ;;; Constants: -(defvar expand-load-hook nil - "Hooks run when `expand.el' is loaded.") +(defgroup expand nil + "Make abbreviations more usable." + :group 'abbrev) -(defvar expand-expand-hook nil - "Hooks run when an abbrev made by `expand-add-abbrevs' is expanded.") +(defcustom expand-load-hook nil + "Hooks run when `expand.el' is loaded." + :type 'hook + :group 'expand) -(defvar expand-jump-hook nil - "Hooks run by `expand-jump-to-previous-slot' and `expand-jump-to-next-slot'.") +(defcustom expand-expand-hook nil + "Hooks run when an abbrev made by `expand-add-abbrevs' is expanded." + :type 'hook + :group 'expand) + +(defcustom expand-jump-hook nil + "Hooks run by `expand-jump-to-previous-slot' and `expand-jump-to-next-slot'." + :type 'hook + :group 'expand) ;;; Samples: @@ -89,8 +101,7 @@ "Loop var: " "for(" str _ @ "=0; " str @ "; " str @ ") {" \n @ _ \n - "}" > - ) + "}" > \n) (defconst expand-c-sample-expand-list '(("if" "if () {\n \n} else {\n \n}" (5 10 21)) @@ -134,7 +145,7 @@ (concat "(defmacro ()\n" " \"\"\n" - " (` \n" + " `( \n" " ))") (list 11 13 18 25)) @@ -174,7 +185,7 @@ ) "Expansions for Lisp mode. See `expand-add-abbrevs'.") - + ;; perl example from Jari Aalto (defconst expand-sample-perl-mode-expand-list (list @@ -327,7 +338,7 @@ This variable is local to a buffer.") (put 'expand-abbrev-hook 'no-self-insert t) (defun expand-abbrev-hook () "Abbrev hook used to do the expansion job of expand abbrevs. -See `expand-add-abbrevs'." +See `expand-add-abbrevs'. Value is non-nil if expansion was done." ;; Expand only at the end of a line if we are near a word that has ;; an abbrev built from expand-add-abbrev. (if (and (eolp) @@ -353,8 +364,9 @@ See `expand-add-abbrevs'." expand-pos (expand-list-to-markers expand-list) expand-list nil))) (run-hooks 'expand-expand-hook) - t)))) - ) + t) + nil)) + nil)) (defun expand-do-expansion () (delete-backward-char (length last-abbrev-text)) @@ -485,7 +497,7 @@ This is used only in conjunction with `expand-add-abbrevs'." (defun expand-skeleton-end-hook () (if skeleton-positions (setq expand-list skeleton-positions))) - + (add-hook 'skeleton-end-hook (function expand-skeleton-end-hook)) (provide 'expand) @@ -493,4 +505,5 @@ This is used only in conjunction with `expand-add-abbrevs'." ;; run load hooks (run-hooks 'expand-load-hook) +;;; arch-tag: fee53e9e-30e3-4ef3-b191-9785e1f8e885 ;;; expand.el ends here