]> git.eshelyaron.com Git - emacs.git/commitdiff
(BUF_PTR_CHAR_POS): New macro.
authorRichard M. Stallman <rms@gnu.org>
Sat, 25 Jun 1994 22:34:25 +0000 (22:34 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 25 Jun 1994 22:34:25 +0000 (22:34 +0000)
src/buffer.h

index 499a8629afa2b93b0187fbf822954cf17ef074bc..2e2f3fbfe2358ee792a632f2e922a6b2dfd605aa 100644 (file)
@@ -130,6 +130,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 ((ptr) - (current_buffer)->text.beg                                    \
  - (ptr - (current_buffer)->text.beg < (unsigned) GPT ? 0 : GAP_SIZE)  \
  + 1)
+
+/* Convert the address of a char in the buffer into a character position.  */
+#define BUF_PTR_CHAR_POS(buf, ptr)                     \
+((ptr) - (buf)->text.beg                               \
+ - (ptr - (buf)->text.beg < (unsigned) BUF_GPT ((buf)) \
+    ? 0 : BUF_GAP_SIZE ((buf)))                                \
+ + 1)
 \f
 struct buffer_text
   {