(BUF_NARROWED, NARROWED): New macros to test whether a region
authorEric S. Raymond <esr@snark.thyrsus.com>
Fri, 23 Apr 1993 03:06:10 +0000 (03:06 +0000)
committerEric S. Raymond <esr@snark.thyrsus.com>
Fri, 23 Apr 1993 03:06:10 +0000 (03:06 +0000)
restriction has narrowed the buffer.

src/buffer.h

index 5c09f30..34d92fd 100644 (file)
@@ -53,6 +53,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Character position of end of buffer.  */ 
 #define Z (current_buffer->text.z)
 
+/* Is the current buffer narrowed? */
+#define NARROWED       ((BEGV != BEG) || (ZV != Z))
+
 /* Modification count.  */
 #define MODIFF (current_buffer->text.modiff)
 
@@ -98,6 +101,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Character position of end of buffer.  */ 
 #define BUF_Z(buf) ((buf)->text.z)
 
+/* Is this buffer narrowed? */
+#define BUF_NARROWED(buf) ((BUF_BEGV(buf) != BUF_BEG(buf)) \
+                          || (BUF_ZV(buf) != BUF_Z(buf)))
+
 /* Modification count.  */
 #define BUF_MODIFF(buf) ((buf)->text.modiff)