diff options
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/buffer.h b/src/buffer.h index 65c7168d60a..0975d2e3adc 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -107,27 +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 | /* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: | 110 | /* The BUF_BEGV[_BYTE], BUF_ZV[_BYTE], and BUF_PT[_BYTE] macros cannot |
| 111 | on indirect (or base) buffers, that value is only correct if that buffer | 111 | be used for assignment; use SET_BUF_* macros below for that. */ |
| 112 | is the current_buffer, or if the buffer's text hasn't been modified (via | ||
| 113 | an indirect buffer) since it was last current. */ | ||
| 114 | 112 | ||
| 115 | /* Position of beginning of accessible range of buffer. */ | 113 | /* Position of beginning of accessible range of buffer. */ |
| 116 | #define BUF_BEGV(buf) ((buf)->begv) | 114 | #define BUF_BEGV(buf) \ |
| 117 | #define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) | 115 | (buf == current_buffer ? BEGV \ |
| 116 | : NILP (BVAR (buf, begv_marker)) ? buf->begv \ | ||
| 117 | : marker_position (BVAR (buf, begv_marker))) | ||
| 118 | |||
| 119 | #define BUF_BEGV_BYTE(buf) \ | ||
| 120 | (buf == current_buffer ? BEGV_BYTE \ | ||
| 121 | : NILP (BVAR (buf, begv_marker)) ? buf->begv_byte \ | ||
| 122 | : marker_byte_position (BVAR (buf, begv_marker))) | ||
| 118 | 123 | ||
| 119 | /* Position of point in buffer. */ | 124 | /* Position of point in buffer. */ |
| 120 | #define BUF_PT(buf) ((buf)->pt) | 125 | #define BUF_PT(buf) \ |
| 121 | #define BUF_PT_BYTE(buf) ((buf)->pt_byte) | 126 | (buf == current_buffer ? PT \ |
| 127 | : NILP (BVAR (buf, pt_marker)) ? buf->pt \ | ||
| 128 | : marker_position (BVAR (buf, pt_marker))) | ||
| 129 | |||
| 130 | #define BUF_PT_BYTE(buf) \ | ||
| 131 | (buf == current_buffer ? PT_BYTE \ | ||
| 132 | : NILP (BVAR (buf, pt_marker)) ? buf->pt_byte \ | ||
| 133 | : marker_byte_position (BVAR (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 (BVAR (buf, zv_marker)) ? buf->zv \ | ||
| 139 | : marker_position (BVAR (buf, zv_marker))) | ||
| 140 | |||
| 141 | #define BUF_ZV_BYTE(buf) \ | ||
| 142 | (buf == current_buffer ? ZV_BYTE \ | ||
| 143 | : NILP (BVAR (buf, zv_marker)) ? buf->zv_byte \ | ||
| 144 | : marker_byte_position (BVAR (buf, zv_marker))) | ||
| 122 | 145 | ||
| 123 | /* Position of gap in buffer. */ | 146 | /* Position of gap in buffer. */ |
| 124 | #define BUF_GPT(buf) ((buf)->text->gpt) | 147 | #define BUF_GPT(buf) ((buf)->text->gpt) |
| 125 | #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) | 148 | #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) |
| 126 | 149 | ||
| 127 | /* Position of end of accessible range of buffer. */ | ||
| 128 | #define BUF_ZV(buf) ((buf)->zv) | ||
| 129 | #define BUF_ZV_BYTE(buf) ((buf)->zv_byte) | ||
| 130 | |||
| 131 | /* Position of end of buffer. */ | 150 | /* Position of end of buffer. */ |
| 132 | #define BUF_Z(buf) ((buf)->text->z) | 151 | #define BUF_Z(buf) ((buf)->text->z) |
| 133 | #define BUF_Z_BYTE(buf) ((buf)->text->z_byte) | 152 | #define BUF_Z_BYTE(buf) ((buf)->text->z_byte) |
| @@ -235,8 +254,6 @@ extern void enlarge_buffer_text (struct buffer *, EMACS_INT); | |||
| 235 | 254 | ||
| 236 | /* 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. |
| 237 | 256 | ||
| 238 | SET_BUF_PT* seet to be redundant. Get rid of them? | ||
| 239 | |||
| 240 | The ..._BOTH macros take both a charpos and a bytepos, | 257 | The ..._BOTH macros take both a charpos and a bytepos, |
| 241 | which must correspond to each other. | 258 | which must correspond to each other. |
| 242 | 259 | ||