summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2006-05-10 00:32:34 +0000
committerNick Roberts <nickrob@snap.net.nz>2006-05-10 00:32:34 +0000
commit1ecaae6cc946143d9a03db5e73d96210e301e876 (patch)
treeef020d21f10566588d5bc487e3312b8a569e11c3 /lisp/subr.el
parente0c6ac6055b6df8d6d7d21bf0edcd8191527b53a (diff)
downloademacs-1ecaae6cc946143d9a03db5e73d96210e301e876.tar.gz
(field-at-point): New function.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index d4167724ca0..1c7e23cfcd1 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1956,6 +1956,13 @@ Otherwise, return nil."
"Return non-nil if OBJECT is one of the two canonical boolean values: t or nil."
(memq object '(nil t)))
+(defun field-at-point (pos)
+ "Return the field at position POS, taking stickiness etc into account"
+ (let ((raw-field (get-char-property (field-beginning pos) 'field)))
+ (if (eq raw-field 'boundary)
+ (get-char-property (1- (field-end pos)) 'field)
+ raw-field)))
+
;;;; Support for yanking and text properties.