]> git.eshelyaron.com Git - emacs.git/commitdiff
(field-at-point): New function.
authorNick Roberts <nickrob@snap.net.nz>
Wed, 10 May 2006 00:32:34 +0000 (00:32 +0000)
committerNick Roberts <nickrob@snap.net.nz>
Wed, 10 May 2006 00:32:34 +0000 (00:32 +0000)
lisp/subr.el

index d4167724ca02953833a45327d96f847955a04d19..1c7e23cfcd17488fd88b5b42ce46df0a5032df78 100644 (file)
@@ -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)))
+
 \f
 ;;;; Support for yanking and text properties.