diff lisp/subr.el @ 70547:e184fae4f7dd

(field-at-point): New function.
author Nick Roberts <nickrob@snap.net.nz>
date Wed, 10 May 2006 00:32:34 +0000
parents 7bc1bc4d2381
children 1121231ccc23
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.