summaryrefslogtreecommitdiff
path: root/lisp/abbrev.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-03-03 18:45:04 -0800
committerGlenn Morris <rgm@gnu.org>2012-03-03 18:45:04 -0800
commitea16568d87f736736a532c0684de951bc382e4a9 (patch)
tree5e20fc6f6836ffabf5d3df2c052945b364df7751 /lisp/abbrev.el
parenta1e7225c983f616ed6b43c9861b9c1374bbab2bb (diff)
downloademacs-ea16568d87f736736a532c0684de951bc382e4a9.tar.gz
Checked lispref/abbrevs.texi
* doc/lispref/abbrevs.texi: Small copyedits throughout. (Abbrev Mode): Remove this section, folding it into the top-level. (Abbrev Tables): Don't mention irrelevant return values. (Abbrev Expansion): Add cross-ref for wrapper hooks. (Standard Abbrev Tables): Emacs Lisp mode now has its own table. (Abbrev Table Properties): Update nil :regexp description. * lisp/abbrev.el (copy-abbrev-table, abbrev-table-p) (abbrev-minor-mode-table-alist, define-abbrev, abbrev-insert) (expand-abbrev, define-abbrev-table): Doc fixes. * admin/FOR-RELEASE: Related markup.
Diffstat (limited to 'lisp/abbrev.el')
-rw-r--r--lisp/abbrev.el30
1 files changed, 22 insertions, 8 deletions
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 @@
;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
-;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: abbrev convenience
@@ -81,7 +81,8 @@ be replaced by its expansion."
(clear-abbrev-table (symbol-value tablesym))))
(defun copy-abbrev-table (table)
- "Make a new abbrev-table with the same abbrevs as TABLE."
+ "Make a new abbrev-table with the same abbrevs as TABLE.
+Does not copy property lists."
(let ((new-table (make-abbrev-table)))
(mapatoms
(lambda (symbol)
@@ -447,6 +448,7 @@ PROPS is a list of properties."
table))
(defun abbrev-table-p (object)
+ "Return non-nil if OBJECT is an abbrev table."
(and (vectorp object)
(numberp (abbrev-table-get object :abbrev-table-modiff))))
@@ -472,7 +474,8 @@ for any particular abbrev defined in both.")
(defvar abbrev-minor-mode-table-alist nil
"Alist of abbrev tables to use for minor modes.
Each element looks like (VARIABLE . ABBREV-TABLE);
-ABBREV-TABLE is active whenever VARIABLE's value is non-nil.")
+ABBREV-TABLE is active whenever VARIABLE's value is non-nil.
+ABBREV-TABLE can also be a list of abbrev tables.")
(defvar fundamental-mode-abbrev-table
(let ((table (make-abbrev-table)))
@@ -548,6 +551,12 @@ If EXPANSION is not a string (and not nil), the abbrev is a
special one, which does not expand in the usual way but only
runs HOOK.
+If HOOK is a non-nil symbol with a non-nil `no-self-insert' property,
+it can control whether the character that triggered abbrev expansion
+is inserted. If such a HOOK returns non-nil, the character is not
+inserted. If such a HOOK returns nil, then so does `abbrev-insert'
+\(and `expand-abbrev'), as if no abbrev expansion had taken place.
+
PROPS is a property list. The following properties are special:
- `:count': the value for the abbrev's usage-count, which is incremented each
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.
If non-nil, WORDSTART is the place where to insert the abbrev.
If WORDEND is non-nil, the abbrev replaces the previous text between
WORDSTART and WORDEND.
-Return ABBREV if the expansion should be considered as having taken place."
+Return ABBREV if the expansion should be considered as having taken place.
+The return value can be influenced by a `no-self-insert' property;
+see `define-abbrev' for details."
(unless name (setq name (symbol-name abbrev)))
(unless wordstart (setq wordstart (point)))
(unless wordend (setq wordend wordstart))
@@ -811,7 +822,8 @@ the abbrev symbol if expansion took place.")
(defun expand-abbrev ()
"Expand the abbrev before point, if there is an abbrev there.
Effective when explicitly called even when `abbrev-mode' is nil.
-Returns the abbrev symbol, if expansion took place."
+Returns the abbrev symbol, if expansion took place. (The actual
+return value is that of `abbrev-insert'.)"
(interactive)
(run-hooks 'pre-abbrev-expand-hook)
(with-wrapper-hook abbrev-expand-functions ()
@@ -934,9 +946,11 @@ Properties with special meaning:
abbreviations.
- `:case-fixed' non-nil means that abbreviations are looked up without
case-folding, and the expansion is not capitalized/upcased.
-- `:regexp' describes the form of abbrevs. It defaults to \\=\\<\\(\\w+\\)\\W* which
- means that an abbrev can only be a single word. The submatch 1 is treated
- as the potential name of an abbrev.
+- `:regexp' is a regular expression that specifies how to extract the
+ name of the abbrev before point. The submatch 1 is treated
+ as the potential name of an abbrev. If :regexp is nil, the default
+ behavior uses `backward-word' and `forward-word' to extract the name
+ of the abbrev, which can therefore only be a single word.
- `:enable-function' can be set to a function of no argument which returns
non-nil if and only if the abbrevs in this table should be used for this
instance of `expand-abbrev'."