aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 21854571670..56d0422b7e3 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -107,22 +107,46 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
107#define BUF_BEG(buf) (BEG) 107#define BUF_BEG(buf) (BEG)
108#define BUF_BEG_BYTE(buf) (BEG_BYTE) 108#define BUF_BEG_BYTE(buf) (BEG_BYTE)
109 109
110/* The BUF_BEGV[_BYTE], BUF_ZV[_BYTE], and BUF_PT[_BYTE] macros cannot
111 be used for assignment; use SET_BUF_* macros below for that. */
112
110/* Position of beginning of accessible range of buffer. */ 113/* Position of beginning of accessible range of buffer. */
111#define BUF_BEGV(buf) ((buf)->begv) 114#define BUF_BEGV(buf) \
112#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) 115 (buf == current_buffer ? BEGV \
116 : NILP (buf->begv_marker) ? buf->begv \
117 : marker_position (buf->begv_marker))
118
119#define BUF_BEGV_BYTE(buf) \
120 (buf == current_buffer ? BEGV_BYTE \
121 : NILP (buf->begv_marker) ? buf->begv_byte \
122 : marker_byte_position (buf->begv_marker))
113 123
114/* Position of point in buffer. */ 124/* Position of point in buffer. */
115#define BUF_PT(buf) ((buf)->pt) 125#define BUF_PT(buf) \
116#define BUF_PT_BYTE(buf) ((buf)->pt_byte) 126 (buf == current_buffer ? PT \
127 : NILP (buf->pt_marker) ? buf->pt \
128 : marker_position (buf->pt_marker))
129
130#define BUF_PT_BYTE(buf) \
131 (buf == current_buffer ? PT_BYTE \
132 : NILP (buf->pt_marker) ? buf->pt_byte \
133 : marker_byte_position (buf->pt_marker))
134
135/* Position of end of accessible range of buffer. */
136#define BUF_ZV(buf) \
137 (buf == current_buffer ? ZV \
138 : NILP (buf->zv_marker) ? buf->zv \
139 : marker_position (buf->zv_marker))
140
141#define BUF_ZV_BYTE(buf) \
142 (buf == current_buffer ? ZV_BYTE \
143 : NILP (buf->zv_marker) ? buf->zv_byte \
144 : marker_byte_position (buf->zv_marker))
117 145
118/* Position of gap in buffer. */ 146/* Position of gap in buffer. */
119#define BUF_GPT(buf) ((buf)->text->gpt) 147#define BUF_GPT(buf) ((buf)->text->gpt)
120#define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) 148#define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte)
121 149
122/* Position of end of accessible range of buffer. */
123#define BUF_ZV(buf) ((buf)->zv)
124#define BUF_ZV_BYTE(buf) ((buf)->zv_byte)
125
126/* Position of end of buffer. */ 150/* Position of end of buffer. */
127#define BUF_Z(buf) ((buf)->text->z) 151#define BUF_Z(buf) ((buf)->text->z)
128#define BUF_Z_BYTE(buf) ((buf)->text->z_byte) 152#define BUF_Z_BYTE(buf) ((buf)->text->z_byte)
@@ -230,8 +254,6 @@ extern void enlarge_buffer_text P_ ((struct buffer *, EMACS_INT));
230 254
231/* Macros for setting the BEGV, ZV or PT of a given buffer. 255/* Macros for setting the BEGV, ZV or PT of a given buffer.
232 256
233 SET_BUF_PT* seet to be redundant. Get rid of them?
234
235 The ..._BOTH macros take both a charpos and a bytepos, 257 The ..._BOTH macros take both a charpos and a bytepos,
236 which must correspond to each other. 258 which must correspond to each other.
237 259