changeset 70547:e184fae4f7dd

(field-at-point): New function.
author Nick Roberts <nickrob@snap.net.nz>
date Wed, 10 May 2006 00:32:34 +0000
parents 264aa3b97540
children 289021558ff6
files lisp/subr.el
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Wed May 10 00:29:24 2006 +0000
+++ b/lisp/subr.el	Wed May 10 00:32:34 2006 +0000
@@ -1956,6 +1956,13 @@
   "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.