aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/abbrev.el30
2 files changed, 28 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e4b07c53373..735357439ab 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-03-04 Glenn Morris <rgm@gnu.org>
2
3 * abbrev.el (copy-abbrev-table, abbrev-table-p)
4 (abbrev-minor-mode-table-alist, define-abbrev, abbrev-insert)
5 (expand-abbrev, define-abbrev-table): Doc fixes.
6
12012-03-03 Lars Magne Ingebrigtsen <larsi@gnus.org> 72012-03-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 8
3 * mail/emacsbug.el (report-emacs-bug-hook): Look at the value of 9 * mail/emacsbug.el (report-emacs-bug-hook): Look at the value of
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 7beee0a1752..3845c4ce4e6 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -1,6 +1,6 @@
1;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*- 1;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc.
4 4
5;; Maintainer: FSF 5;; Maintainer: FSF
6;; Keywords: abbrev convenience 6;; Keywords: abbrev convenience
@@ -81,7 +81,8 @@ be replaced by its expansion."
81 (clear-abbrev-table (symbol-value tablesym)))) 81 (clear-abbrev-table (symbol-value tablesym))))
82 82
83(defun copy-abbrev-table (table) 83(defun copy-abbrev-table (table)
84 "Make a new abbrev-table with the same abbrevs as TABLE." 84 "Make a new abbrev-table with the same abbrevs as TABLE.
85Does not copy property lists."
85 (let ((new-table (make-abbrev-table))) 86 (let ((new-table (make-abbrev-table)))
86 (mapatoms 87 (mapatoms
87 (lambda (symbol) 88 (lambda (symbol)
@@ -447,6 +448,7 @@ PROPS is a list of properties."
447 table)) 448 table))
448 449
449(defun abbrev-table-p (object) 450(defun abbrev-table-p (object)
451 "Return non-nil if OBJECT is an abbrev table."
450 (and (vectorp object) 452 (and (vectorp object)
451 (numberp (abbrev-table-get object :abbrev-table-modiff)))) 453 (numberp (abbrev-table-get object :abbrev-table-modiff))))
452 454
@@ -472,7 +474,8 @@ for any particular abbrev defined in both.")
472(defvar abbrev-minor-mode-table-alist nil 474(defvar abbrev-minor-mode-table-alist nil
473 "Alist of abbrev tables to use for minor modes. 475 "Alist of abbrev tables to use for minor modes.
474Each element looks like (VARIABLE . ABBREV-TABLE); 476Each element looks like (VARIABLE . ABBREV-TABLE);
475ABBREV-TABLE is active whenever VARIABLE's value is non-nil.") 477ABBREV-TABLE is active whenever VARIABLE's value is non-nil.
478ABBREV-TABLE can also be a list of abbrev tables.")
476 479
477(defvar fundamental-mode-abbrev-table 480(defvar fundamental-mode-abbrev-table
478 (let ((table (make-abbrev-table))) 481 (let ((table (make-abbrev-table)))
@@ -548,6 +551,12 @@ If EXPANSION is not a string (and not nil), the abbrev is a
548 special one, which does not expand in the usual way but only 551 special one, which does not expand in the usual way but only
549 runs HOOK. 552 runs HOOK.
550 553
554If HOOK is a non-nil symbol with a non-nil `no-self-insert' property,
555it can control whether the character that triggered abbrev expansion
556is inserted. If such a HOOK returns non-nil, the character is not
557inserted. If such a HOOK returns nil, then so does `abbrev-insert'
558\(and `expand-abbrev'), as if no abbrev expansion had taken place.
559
551PROPS is a property list. The following properties are special: 560PROPS is a property list. The following properties are special:
552- `:count': the value for the abbrev's usage-count, which is incremented each 561- `:count': the value for the abbrev's usage-count, which is incremented each
553 time the abbrev is used (the default is zero). 562 time the abbrev is used (the default is zero).
@@ -746,7 +755,9 @@ If non-nil, NAME is the name by which this abbrev was found.
746If non-nil, WORDSTART is the place where to insert the abbrev. 755If non-nil, WORDSTART is the place where to insert the abbrev.
747If WORDEND is non-nil, the abbrev replaces the previous text between 756If WORDEND is non-nil, the abbrev replaces the previous text between
748WORDSTART and WORDEND. 757WORDSTART and WORDEND.
749Return ABBREV if the expansion should be considered as having taken place." 758Return ABBREV if the expansion should be considered as having taken place.
759The return value can be influenced by a `no-self-insert' property;
760see `define-abbrev' for details."
750 (unless name (setq name (symbol-name abbrev))) 761 (unless name (setq name (symbol-name abbrev)))
751 (unless wordstart (setq wordstart (point))) 762 (unless wordstart (setq wordstart (point)))
752 (unless wordend (setq wordend wordstart)) 763 (unless wordend (setq wordend wordstart))
@@ -811,7 +822,8 @@ the abbrev symbol if expansion took place.")
811(defun expand-abbrev () 822(defun expand-abbrev ()
812 "Expand the abbrev before point, if there is an abbrev there. 823 "Expand the abbrev before point, if there is an abbrev there.
813Effective when explicitly called even when `abbrev-mode' is nil. 824Effective when explicitly called even when `abbrev-mode' is nil.
814Returns the abbrev symbol, if expansion took place." 825Returns the abbrev symbol, if expansion took place. (The actual
826return value is that of `abbrev-insert'.)"
815 (interactive) 827 (interactive)
816 (run-hooks 'pre-abbrev-expand-hook) 828 (run-hooks 'pre-abbrev-expand-hook)
817 (with-wrapper-hook abbrev-expand-functions () 829 (with-wrapper-hook abbrev-expand-functions ()
@@ -934,9 +946,11 @@ Properties with special meaning:
934 abbreviations. 946 abbreviations.
935- `:case-fixed' non-nil means that abbreviations are looked up without 947- `:case-fixed' non-nil means that abbreviations are looked up without
936 case-folding, and the expansion is not capitalized/upcased. 948 case-folding, and the expansion is not capitalized/upcased.
937- `:regexp' describes the form of abbrevs. It defaults to \\=\\<\\(\\w+\\)\\W* which 949- `:regexp' is a regular expression that specifies how to extract the
938 means that an abbrev can only be a single word. The submatch 1 is treated 950 name of the abbrev before point. The submatch 1 is treated
939 as the potential name of an abbrev. 951 as the potential name of an abbrev. If :regexp is nil, the default
952 behavior uses `backward-word' and `forward-word' to extract the name
953 of the abbrev, which can therefore only be a single word.
940- `:enable-function' can be set to a function of no argument which returns 954- `:enable-function' can be set to a function of no argument which returns
941 non-nil if and only if the abbrevs in this table should be used for this 955 non-nil if and only if the abbrevs in this table should be used for this
942 instance of `expand-abbrev'." 956 instance of `expand-abbrev'."