diff options
| author | Ken Raeburn | 2015-11-01 01:42:21 -0400 |
|---|---|---|
| committer | Ken Raeburn | 2015-11-01 01:42:21 -0400 |
| commit | 39372e1a1032521be74575bb06f95a3898fbae30 (patch) | |
| tree | 754bd242a23d2358ea116126fcb0a629947bd9ec /src/buffer.c | |
| parent | 6a3121904d76e3b2f63007341d48c5c1af55de80 (diff) | |
| parent | e11aaee266da52937a3a031cb108fe13f68958c3 (diff) | |
| download | emacs-39372e1a1032521be74575bb06f95a3898fbae30.tar.gz emacs-39372e1a1032521be74575bb06f95a3898fbae30.zip | |
merge from trunk
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 1178 |
1 files changed, 578 insertions, 600 deletions
diff --git a/src/buffer.c b/src/buffer.c index 8a1ad607e0b..539a99bc155 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Buffer manipulation primitives for GNU Emacs. | 1 | /* Buffer manipulation primitives for GNU Emacs. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, | 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2015 Free Software Foundation, |
| 4 | Inc. | 4 | Inc. |
| 5 | 5 | ||
| 6 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| @@ -20,8 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | 22 | ||
| 23 | #define BUFFER_INLINE EXTERN_INLINE | ||
| 24 | |||
| 25 | #include <sys/types.h> | 23 | #include <sys/types.h> |
| 26 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
| 27 | #include <sys/param.h> | 25 | #include <sys/param.h> |
| @@ -32,7 +30,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include <verify.h> | 30 | #include <verify.h> |
| 33 | 31 | ||
| 34 | #include "lisp.h" | 32 | #include "lisp.h" |
| 33 | #include "coding.h" | ||
| 35 | #include "intervals.h" | 34 | #include "intervals.h" |
| 35 | #include "systime.h" | ||
| 36 | #include "window.h" | 36 | #include "window.h" |
| 37 | #include "commands.h" | 37 | #include "commands.h" |
| 38 | #include "character.h" | 38 | #include "character.h" |
| @@ -40,10 +40,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 40 | #include "region-cache.h" | 40 | #include "region-cache.h" |
| 41 | #include "indent.h" | 41 | #include "indent.h" |
| 42 | #include "blockinput.h" | 42 | #include "blockinput.h" |
| 43 | #include "keyboard.h" | ||
| 44 | #include "keymap.h" | 43 | #include "keymap.h" |
| 45 | #include "frame.h" | 44 | #include "frame.h" |
| 46 | 45 | ||
| 46 | #ifdef WINDOWSNT | ||
| 47 | #include "w32heap.h" /* for mmap_* */ | ||
| 48 | #endif | ||
| 49 | |||
| 47 | /* First buffer in chain of all buffers (in reverse order of creation). | 50 | /* First buffer in chain of all buffers (in reverse order of creation). |
| 48 | Threaded through ->header.next.buffer. */ | 51 | Threaded through ->header.next.buffer. */ |
| 49 | 52 | ||
| @@ -111,37 +114,8 @@ static void reset_buffer_local_variables (struct buffer *, bool); | |||
| 111 | due to user rplac'ing this alist or its elements. */ | 114 | due to user rplac'ing this alist or its elements. */ |
| 112 | Lisp_Object Vbuffer_alist; | 115 | Lisp_Object Vbuffer_alist; |
| 113 | 116 | ||
| 114 | static Lisp_Object Qkill_buffer_query_functions; | ||
| 115 | |||
| 116 | /* Hook run before changing a major mode. */ | ||
| 117 | static Lisp_Object Qchange_major_mode_hook; | ||
| 118 | |||
| 119 | Lisp_Object Qfirst_change_hook; | ||
| 120 | Lisp_Object Qbefore_change_functions; | ||
| 121 | Lisp_Object Qafter_change_functions; | ||
| 122 | |||
| 123 | static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; | ||
| 124 | static Lisp_Object Qpermanent_local_hook; | ||
| 125 | |||
| 126 | static Lisp_Object Qprotected_field; | ||
| 127 | |||
| 128 | static Lisp_Object QSFundamental; /* A string "Fundamental". */ | 117 | static Lisp_Object QSFundamental; /* A string "Fundamental". */ |
| 129 | 118 | ||
| 130 | static Lisp_Object Qkill_buffer_hook; | ||
| 131 | static Lisp_Object Qbuffer_list_update_hook; | ||
| 132 | |||
| 133 | static Lisp_Object Qget_file_buffer; | ||
| 134 | |||
| 135 | static Lisp_Object Qoverlayp; | ||
| 136 | |||
| 137 | Lisp_Object Qpriority, Qbefore_string, Qafter_string; | ||
| 138 | |||
| 139 | static Lisp_Object Qevaporate; | ||
| 140 | |||
| 141 | Lisp_Object Qmodification_hooks; | ||
| 142 | Lisp_Object Qinsert_in_front_hooks; | ||
| 143 | Lisp_Object Qinsert_behind_hooks; | ||
| 144 | |||
| 145 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); | 119 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); |
| 146 | static void free_buffer_text (struct buffer *b); | 120 | static void free_buffer_text (struct buffer *b); |
| 147 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); | 121 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); |
| @@ -154,226 +128,232 @@ CHECK_OVERLAY (Lisp_Object x) | |||
| 154 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); | 128 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); |
| 155 | } | 129 | } |
| 156 | 130 | ||
| 157 | /* These setters are used only in this file, so they can be private. */ | 131 | /* These setters are used only in this file, so they can be private. |
| 132 | The public setters are inline functions defined in buffer.h. */ | ||
| 158 | static void | 133 | static void |
| 159 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) | 134 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) |
| 160 | { | 135 | { |
| 161 | b->INTERNAL_FIELD (abbrev_mode) = val; | 136 | b->abbrev_mode_ = val; |
| 162 | } | 137 | } |
| 163 | static void | 138 | static void |
| 164 | bset_abbrev_table (struct buffer *b, Lisp_Object val) | 139 | bset_abbrev_table (struct buffer *b, Lisp_Object val) |
| 165 | { | 140 | { |
| 166 | b->INTERNAL_FIELD (abbrev_table) = val; | 141 | b->abbrev_table_ = val; |
| 167 | } | 142 | } |
| 168 | static void | 143 | static void |
| 169 | bset_auto_fill_function (struct buffer *b, Lisp_Object val) | 144 | bset_auto_fill_function (struct buffer *b, Lisp_Object val) |
| 170 | { | 145 | { |
| 171 | b->INTERNAL_FIELD (auto_fill_function) = val; | 146 | b->auto_fill_function_ = val; |
| 172 | } | 147 | } |
| 173 | static void | 148 | static void |
| 174 | bset_auto_save_file_format (struct buffer *b, Lisp_Object val) | 149 | bset_auto_save_file_format (struct buffer *b, Lisp_Object val) |
| 175 | { | 150 | { |
| 176 | b->INTERNAL_FIELD (auto_save_file_format) = val; | 151 | b->auto_save_file_format_ = val; |
| 177 | } | 152 | } |
| 178 | static void | 153 | static void |
| 179 | bset_auto_save_file_name (struct buffer *b, Lisp_Object val) | 154 | bset_auto_save_file_name (struct buffer *b, Lisp_Object val) |
| 180 | { | 155 | { |
| 181 | b->INTERNAL_FIELD (auto_save_file_name) = val; | 156 | b->auto_save_file_name_ = val; |
| 182 | } | 157 | } |
| 183 | static void | 158 | static void |
| 184 | bset_backed_up (struct buffer *b, Lisp_Object val) | 159 | bset_backed_up (struct buffer *b, Lisp_Object val) |
| 185 | { | 160 | { |
| 186 | b->INTERNAL_FIELD (backed_up) = val; | 161 | b->backed_up_ = val; |
| 187 | } | 162 | } |
| 188 | static void | 163 | static void |
| 189 | bset_begv_marker (struct buffer *b, Lisp_Object val) | 164 | bset_begv_marker (struct buffer *b, Lisp_Object val) |
| 190 | { | 165 | { |
| 191 | b->INTERNAL_FIELD (begv_marker) = val; | 166 | b->begv_marker_ = val; |
| 192 | } | 167 | } |
| 193 | static void | 168 | static void |
| 194 | bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) | 169 | bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) |
| 195 | { | 170 | { |
| 196 | b->INTERNAL_FIELD (bidi_display_reordering) = val; | 171 | b->bidi_display_reordering_ = val; |
| 197 | } | 172 | } |
| 198 | static void | 173 | static void |
| 199 | bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) | 174 | bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) |
| 200 | { | 175 | { |
| 201 | b->INTERNAL_FIELD (buffer_file_coding_system) = val; | 176 | b->buffer_file_coding_system_ = val; |
| 202 | } | ||
| 203 | static void | ||
| 204 | bset_cache_long_scans (struct buffer *b, Lisp_Object val) | ||
| 205 | { | ||
| 206 | b->INTERNAL_FIELD (cache_long_scans) = val; | ||
| 207 | } | 177 | } |
| 208 | static void | 178 | static void |
| 209 | bset_case_fold_search (struct buffer *b, Lisp_Object val) | 179 | bset_case_fold_search (struct buffer *b, Lisp_Object val) |
| 210 | { | 180 | { |
| 211 | b->INTERNAL_FIELD (case_fold_search) = val; | 181 | b->case_fold_search_ = val; |
| 212 | } | 182 | } |
| 213 | static void | 183 | static void |
| 214 | bset_ctl_arrow (struct buffer *b, Lisp_Object val) | 184 | bset_ctl_arrow (struct buffer *b, Lisp_Object val) |
| 215 | { | 185 | { |
| 216 | b->INTERNAL_FIELD (ctl_arrow) = val; | 186 | b->ctl_arrow_ = val; |
| 217 | } | 187 | } |
| 218 | static void | 188 | static void |
| 219 | bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) | 189 | bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) |
| 220 | { | 190 | { |
| 221 | b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val; | 191 | b->cursor_in_non_selected_windows_ = val; |
| 222 | } | 192 | } |
| 223 | static void | 193 | static void |
| 224 | bset_cursor_type (struct buffer *b, Lisp_Object val) | 194 | bset_cursor_type (struct buffer *b, Lisp_Object val) |
| 225 | { | 195 | { |
| 226 | b->INTERNAL_FIELD (cursor_type) = val; | 196 | b->cursor_type_ = val; |
| 227 | } | 197 | } |
| 228 | static void | 198 | static void |
| 229 | bset_display_table (struct buffer *b, Lisp_Object val) | 199 | bset_display_table (struct buffer *b, Lisp_Object val) |
| 230 | { | 200 | { |
| 231 | b->INTERNAL_FIELD (display_table) = val; | 201 | b->display_table_ = val; |
| 232 | } | 202 | } |
| 233 | static void | 203 | static void |
| 234 | bset_extra_line_spacing (struct buffer *b, Lisp_Object val) | 204 | bset_extra_line_spacing (struct buffer *b, Lisp_Object val) |
| 235 | { | 205 | { |
| 236 | b->INTERNAL_FIELD (extra_line_spacing) = val; | 206 | b->extra_line_spacing_ = val; |
| 237 | } | 207 | } |
| 238 | static void | 208 | static void |
| 239 | bset_file_format (struct buffer *b, Lisp_Object val) | 209 | bset_file_format (struct buffer *b, Lisp_Object val) |
| 240 | { | 210 | { |
| 241 | b->INTERNAL_FIELD (file_format) = val; | 211 | b->file_format_ = val; |
| 242 | } | 212 | } |
| 243 | static void | 213 | static void |
| 244 | bset_file_truename (struct buffer *b, Lisp_Object val) | 214 | bset_file_truename (struct buffer *b, Lisp_Object val) |
| 245 | { | 215 | { |
| 246 | b->INTERNAL_FIELD (file_truename) = val; | 216 | b->file_truename_ = val; |
| 247 | } | 217 | } |
| 248 | static void | 218 | static void |
| 249 | bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) | 219 | bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) |
| 250 | { | 220 | { |
| 251 | b->INTERNAL_FIELD (fringe_cursor_alist) = val; | 221 | b->fringe_cursor_alist_ = val; |
| 252 | } | 222 | } |
| 253 | static void | 223 | static void |
| 254 | bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) | 224 | bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) |
| 255 | { | 225 | { |
| 256 | b->INTERNAL_FIELD (fringe_indicator_alist) = val; | 226 | b->fringe_indicator_alist_ = val; |
| 257 | } | 227 | } |
| 258 | static void | 228 | static void |
| 259 | bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) | 229 | bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) |
| 260 | { | 230 | { |
| 261 | b->INTERNAL_FIELD (fringes_outside_margins) = val; | 231 | b->fringes_outside_margins_ = val; |
| 262 | } | 232 | } |
| 263 | static void | 233 | static void |
| 264 | bset_header_line_format (struct buffer *b, Lisp_Object val) | 234 | bset_header_line_format (struct buffer *b, Lisp_Object val) |
| 265 | { | 235 | { |
| 266 | b->INTERNAL_FIELD (header_line_format) = val; | 236 | b->header_line_format_ = val; |
| 267 | } | 237 | } |
| 268 | static void | 238 | static void |
| 269 | bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) | 239 | bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) |
| 270 | { | 240 | { |
| 271 | b->INTERNAL_FIELD (indicate_buffer_boundaries) = val; | 241 | b->indicate_buffer_boundaries_ = val; |
| 272 | } | 242 | } |
| 273 | static void | 243 | static void |
| 274 | bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) | 244 | bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) |
| 275 | { | 245 | { |
| 276 | b->INTERNAL_FIELD (indicate_empty_lines) = val; | 246 | b->indicate_empty_lines_ = val; |
| 277 | } | 247 | } |
| 278 | static void | 248 | static void |
| 279 | bset_invisibility_spec (struct buffer *b, Lisp_Object val) | 249 | bset_invisibility_spec (struct buffer *b, Lisp_Object val) |
| 280 | { | 250 | { |
| 281 | b->INTERNAL_FIELD (invisibility_spec) = val; | 251 | b->invisibility_spec_ = val; |
| 282 | } | 252 | } |
| 283 | static void | 253 | static void |
| 284 | bset_left_fringe_width (struct buffer *b, Lisp_Object val) | 254 | bset_left_fringe_width (struct buffer *b, Lisp_Object val) |
| 285 | { | 255 | { |
| 286 | b->INTERNAL_FIELD (left_fringe_width) = val; | 256 | b->left_fringe_width_ = val; |
| 287 | } | 257 | } |
| 288 | static void | 258 | static void |
| 289 | bset_major_mode (struct buffer *b, Lisp_Object val) | 259 | bset_major_mode (struct buffer *b, Lisp_Object val) |
| 290 | { | 260 | { |
| 291 | b->INTERNAL_FIELD (major_mode) = val; | 261 | b->major_mode_ = val; |
| 292 | } | 262 | } |
| 293 | static void | 263 | static void |
| 294 | bset_mark (struct buffer *b, Lisp_Object val) | 264 | bset_mark (struct buffer *b, Lisp_Object val) |
| 295 | { | 265 | { |
| 296 | b->INTERNAL_FIELD (mark) = val; | 266 | b->mark_ = val; |
| 297 | } | 267 | } |
| 298 | static void | 268 | static void |
| 299 | bset_minor_modes (struct buffer *b, Lisp_Object val) | 269 | bset_minor_modes (struct buffer *b, Lisp_Object val) |
| 300 | { | 270 | { |
| 301 | b->INTERNAL_FIELD (minor_modes) = val; | 271 | b->minor_modes_ = val; |
| 302 | } | 272 | } |
| 303 | static void | 273 | static void |
| 304 | bset_mode_line_format (struct buffer *b, Lisp_Object val) | 274 | bset_mode_line_format (struct buffer *b, Lisp_Object val) |
| 305 | { | 275 | { |
| 306 | b->INTERNAL_FIELD (mode_line_format) = val; | 276 | b->mode_line_format_ = val; |
| 307 | } | 277 | } |
| 308 | static void | 278 | static void |
| 309 | bset_mode_name (struct buffer *b, Lisp_Object val) | 279 | bset_mode_name (struct buffer *b, Lisp_Object val) |
| 310 | { | 280 | { |
| 311 | b->INTERNAL_FIELD (mode_name) = val; | 281 | b->mode_name_ = val; |
| 312 | } | 282 | } |
| 313 | static void | 283 | static void |
| 314 | bset_name (struct buffer *b, Lisp_Object val) | 284 | bset_name (struct buffer *b, Lisp_Object val) |
| 315 | { | 285 | { |
| 316 | b->INTERNAL_FIELD (name) = val; | 286 | b->name_ = val; |
| 317 | } | 287 | } |
| 318 | static void | 288 | static void |
| 319 | bset_overwrite_mode (struct buffer *b, Lisp_Object val) | 289 | bset_overwrite_mode (struct buffer *b, Lisp_Object val) |
| 320 | { | 290 | { |
| 321 | b->INTERNAL_FIELD (overwrite_mode) = val; | 291 | b->overwrite_mode_ = val; |
| 322 | } | 292 | } |
| 323 | static void | 293 | static void |
| 324 | bset_pt_marker (struct buffer *b, Lisp_Object val) | 294 | bset_pt_marker (struct buffer *b, Lisp_Object val) |
| 325 | { | 295 | { |
| 326 | b->INTERNAL_FIELD (pt_marker) = val; | 296 | b->pt_marker_ = val; |
| 327 | } | 297 | } |
| 328 | static void | 298 | static void |
| 329 | bset_right_fringe_width (struct buffer *b, Lisp_Object val) | 299 | bset_right_fringe_width (struct buffer *b, Lisp_Object val) |
| 330 | { | 300 | { |
| 331 | b->INTERNAL_FIELD (right_fringe_width) = val; | 301 | b->right_fringe_width_ = val; |
| 332 | } | 302 | } |
| 333 | static void | 303 | static void |
| 334 | bset_save_length (struct buffer *b, Lisp_Object val) | 304 | bset_save_length (struct buffer *b, Lisp_Object val) |
| 335 | { | 305 | { |
| 336 | b->INTERNAL_FIELD (save_length) = val; | 306 | b->save_length_ = val; |
| 337 | } | 307 | } |
| 338 | static void | 308 | static void |
| 339 | bset_scroll_bar_width (struct buffer *b, Lisp_Object val) | 309 | bset_scroll_bar_width (struct buffer *b, Lisp_Object val) |
| 340 | { | 310 | { |
| 341 | b->INTERNAL_FIELD (scroll_bar_width) = val; | 311 | b->scroll_bar_width_ = val; |
| 312 | } | ||
| 313 | static void | ||
| 314 | bset_scroll_bar_height (struct buffer *b, Lisp_Object val) | ||
| 315 | { | ||
| 316 | b->scroll_bar_height_ = val; | ||
| 342 | } | 317 | } |
| 343 | static void | 318 | static void |
| 344 | bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) | 319 | bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) |
| 345 | { | 320 | { |
| 346 | b->INTERNAL_FIELD (scroll_down_aggressively) = val; | 321 | b->scroll_down_aggressively_ = val; |
| 347 | } | 322 | } |
| 348 | static void | 323 | static void |
| 349 | bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) | 324 | bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) |
| 350 | { | 325 | { |
| 351 | b->INTERNAL_FIELD (scroll_up_aggressively) = val; | 326 | b->scroll_up_aggressively_ = val; |
| 352 | } | 327 | } |
| 353 | static void | 328 | static void |
| 354 | bset_selective_display (struct buffer *b, Lisp_Object val) | 329 | bset_selective_display (struct buffer *b, Lisp_Object val) |
| 355 | { | 330 | { |
| 356 | b->INTERNAL_FIELD (selective_display) = val; | 331 | b->selective_display_ = val; |
| 357 | } | 332 | } |
| 358 | static void | 333 | static void |
| 359 | bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) | 334 | bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) |
| 360 | { | 335 | { |
| 361 | b->INTERNAL_FIELD (selective_display_ellipses) = val; | 336 | b->selective_display_ellipses_ = val; |
| 362 | } | 337 | } |
| 363 | static void | 338 | static void |
| 364 | bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) | 339 | bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) |
| 365 | { | 340 | { |
| 366 | b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; | 341 | b->vertical_scroll_bar_type_ = val; |
| 342 | } | ||
| 343 | static void | ||
| 344 | bset_horizontal_scroll_bar_type (struct buffer *b, Lisp_Object val) | ||
| 345 | { | ||
| 346 | b->horizontal_scroll_bar_type_ = val; | ||
| 367 | } | 347 | } |
| 368 | static void | 348 | static void |
| 369 | bset_word_wrap (struct buffer *b, Lisp_Object val) | 349 | bset_word_wrap (struct buffer *b, Lisp_Object val) |
| 370 | { | 350 | { |
| 371 | b->INTERNAL_FIELD (word_wrap) = val; | 351 | b->word_wrap_ = val; |
| 372 | } | 352 | } |
| 373 | static void | 353 | static void |
| 374 | bset_zv_marker (struct buffer *b, Lisp_Object val) | 354 | bset_zv_marker (struct buffer *b, Lisp_Object val) |
| 375 | { | 355 | { |
| 376 | b->INTERNAL_FIELD (zv_marker) = val; | 356 | b->zv_marker_ = val; |
| 377 | } | 357 | } |
| 378 | 358 | ||
| 379 | void | 359 | void |
| @@ -406,7 +386,6 @@ followed by the rest of the buffers. */) | |||
| 406 | if (FRAMEP (frame)) | 386 | if (FRAMEP (frame)) |
| 407 | { | 387 | { |
| 408 | Lisp_Object framelist, prevlist, tail; | 388 | Lisp_Object framelist, prevlist, tail; |
| 409 | Lisp_Object args[3]; | ||
| 410 | 389 | ||
| 411 | framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); | 390 | framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); |
| 412 | prevlist = Fnreverse (Fcopy_sequence | 391 | prevlist = Fnreverse (Fcopy_sequence |
| @@ -427,10 +406,7 @@ followed by the rest of the buffers. */) | |||
| 427 | tail = XCDR (tail); | 406 | tail = XCDR (tail); |
| 428 | } | 407 | } |
| 429 | 408 | ||
| 430 | args[0] = framelist; | 409 | return CALLN (Fnconc, framelist, general, prevlist); |
| 431 | args[1] = general; | ||
| 432 | args[2] = prevlist; | ||
| 433 | return Fnconc (3, args); | ||
| 434 | } | 410 | } |
| 435 | else | 411 | else |
| 436 | return general; | 412 | return general; |
| @@ -577,7 +553,8 @@ even if it is dead. The return value is never nil. */) | |||
| 577 | BUF_END_UNCHANGED (b) = 0; | 553 | BUF_END_UNCHANGED (b) = 0; |
| 578 | BUF_BEG_UNCHANGED (b) = 0; | 554 | BUF_BEG_UNCHANGED (b) = 0; |
| 579 | *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ | 555 | *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ |
| 580 | b->text->inhibit_shrinking = 0; | 556 | b->text->inhibit_shrinking = false; |
| 557 | b->text->redisplay = false; | ||
| 581 | 558 | ||
| 582 | b->newline_cache = 0; | 559 | b->newline_cache = 0; |
| 583 | b->width_run_cache = 0; | 560 | b->width_run_cache = 0; |
| @@ -812,6 +789,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 812 | set_string_intervals (name, NULL); | 789 | set_string_intervals (name, NULL); |
| 813 | bset_name (b, name); | 790 | bset_name (b, name); |
| 814 | 791 | ||
| 792 | /* An indirect buffer shares undo list of its base (Bug#18180). */ | ||
| 793 | bset_undo_list (b, BVAR (b->base_buffer, undo_list)); | ||
| 794 | |||
| 815 | reset_buffer (b); | 795 | reset_buffer (b); |
| 816 | reset_buffer_local_variables (b, 1); | 796 | reset_buffer_local_variables (b, 1); |
| 817 | 797 | ||
| @@ -886,8 +866,8 @@ drop_overlay (struct buffer *b, struct Lisp_Overlay *ov) | |||
| 886 | eassert (b == XBUFFER (Fmarker_buffer (ov->start))); | 866 | eassert (b == XBUFFER (Fmarker_buffer (ov->start))); |
| 887 | modify_overlay (b, marker_position (ov->start), | 867 | modify_overlay (b, marker_position (ov->start), |
| 888 | marker_position (ov->end)); | 868 | marker_position (ov->end)); |
| 889 | Fset_marker (ov->start, Qnil, Qnil); | 869 | unchain_marker (XMARKER (ov->start)); |
| 890 | Fset_marker (ov->end, Qnil, Qnil); | 870 | unchain_marker (XMARKER (ov->end)); |
| 891 | 871 | ||
| 892 | } | 872 | } |
| 893 | 873 | ||
| @@ -931,7 +911,7 @@ reset_buffer (register struct buffer *b) | |||
| 931 | bset_filename (b, Qnil); | 911 | bset_filename (b, Qnil); |
| 932 | bset_file_truename (b, Qnil); | 912 | bset_file_truename (b, Qnil); |
| 933 | bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil); | 913 | bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil); |
| 934 | b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); | 914 | b->modtime = make_timespec (0, UNKNOWN_MODTIME_NSECS); |
| 935 | b->modtime_size = -1; | 915 | b->modtime_size = -1; |
| 936 | XSETFASTINT (BVAR (b, save_length), 0); | 916 | XSETFASTINT (BVAR (b, save_length), 0); |
| 937 | b->last_window_start = 1; | 917 | b->last_window_start = 1; |
| @@ -1061,7 +1041,7 @@ DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, | |||
| 1061 | doc: /* Return a string that is the name of no existing buffer based on NAME. | 1041 | doc: /* Return a string that is the name of no existing buffer based on NAME. |
| 1062 | If there is no live buffer named NAME, then return NAME. | 1042 | If there is no live buffer named NAME, then return NAME. |
| 1063 | Otherwise modify name by appending `<NUMBER>', incrementing NUMBER | 1043 | Otherwise modify name by appending `<NUMBER>', incrementing NUMBER |
| 1064 | \(starting at 2) until an unused name is found, and then return that name. | 1044 | (starting at 2) until an unused name is found, and then return that name. |
| 1065 | Optional second argument IGNORE specifies a name that is okay to use (if | 1045 | Optional second argument IGNORE specifies a name that is okay to use (if |
| 1066 | it is in the sequence to be tried) even if a buffer with that name exists. | 1046 | it is in the sequence to be tried) even if a buffer with that name exists. |
| 1067 | 1047 | ||
| @@ -1117,10 +1097,7 @@ BUFFER defaults to the current buffer. | |||
| 1117 | Return nil if BUFFER has been killed. */) | 1097 | Return nil if BUFFER has been killed. */) |
| 1118 | (register Lisp_Object buffer) | 1098 | (register Lisp_Object buffer) |
| 1119 | { | 1099 | { |
| 1120 | if (NILP (buffer)) | 1100 | return BVAR (decode_buffer (buffer), name); |
| 1121 | return BVAR (current_buffer, name); | ||
| 1122 | CHECK_BUFFER (buffer); | ||
| 1123 | return BVAR (XBUFFER (buffer), name); | ||
| 1124 | } | 1101 | } |
| 1125 | 1102 | ||
| 1126 | DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, | 1103 | DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, |
| @@ -1128,10 +1105,7 @@ DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, | |||
| 1128 | No argument or nil as argument means use the current buffer. */) | 1105 | No argument or nil as argument means use the current buffer. */) |
| 1129 | (register Lisp_Object buffer) | 1106 | (register Lisp_Object buffer) |
| 1130 | { | 1107 | { |
| 1131 | if (NILP (buffer)) | 1108 | return BVAR (decode_buffer (buffer), filename); |
| 1132 | return BVAR (current_buffer, filename); | ||
| 1133 | CHECK_BUFFER (buffer); | ||
| 1134 | return BVAR (XBUFFER (buffer), filename); | ||
| 1135 | } | 1109 | } |
| 1136 | 1110 | ||
| 1137 | DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, | 1111 | DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, |
| @@ -1141,31 +1115,18 @@ If BUFFER is not indirect, return nil. | |||
| 1141 | BUFFER defaults to the current buffer. */) | 1115 | BUFFER defaults to the current buffer. */) |
| 1142 | (register Lisp_Object buffer) | 1116 | (register Lisp_Object buffer) |
| 1143 | { | 1117 | { |
| 1144 | struct buffer *base; | 1118 | struct buffer *base = decode_buffer (buffer)->base_buffer; |
| 1145 | Lisp_Object base_buffer; | 1119 | return base ? (XSETBUFFER (buffer, base), buffer) : Qnil; |
| 1146 | |||
| 1147 | if (NILP (buffer)) | ||
| 1148 | base = current_buffer->base_buffer; | ||
| 1149 | else | ||
| 1150 | { | ||
| 1151 | CHECK_BUFFER (buffer); | ||
| 1152 | base = XBUFFER (buffer)->base_buffer; | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | if (! base) | ||
| 1156 | return Qnil; | ||
| 1157 | XSETBUFFER (base_buffer, base); | ||
| 1158 | return base_buffer; | ||
| 1159 | } | 1120 | } |
| 1160 | 1121 | ||
| 1161 | DEFUN ("buffer-local-value", Fbuffer_local_value, | 1122 | DEFUN ("buffer-local-value", Fbuffer_local_value, |
| 1162 | Sbuffer_local_value, 2, 2, 0, | 1123 | Sbuffer_local_value, 2, 2, 0, |
| 1163 | doc: /* Return the value of VARIABLE in BUFFER. | 1124 | doc: /* Return the value of VARIABLE in BUFFER. |
| 1164 | If VARIABLE does not have a buffer-local binding in BUFFER, the value | 1125 | If VARIABLE does not have a buffer-local binding in BUFFER, the value |
| 1165 | is the default binding of the variable. */) | 1126 | is the default binding of the variable. */) |
| 1166 | (register Lisp_Object variable, register Lisp_Object buffer) | 1127 | (register Lisp_Object variable, register Lisp_Object buffer) |
| 1167 | { | 1128 | { |
| 1168 | register Lisp_Object result = buffer_local_value_1 (variable, buffer); | 1129 | register Lisp_Object result = buffer_local_value (variable, buffer); |
| 1169 | 1130 | ||
| 1170 | if (EQ (result, Qunbound)) | 1131 | if (EQ (result, Qunbound)) |
| 1171 | xsignal1 (Qvoid_variable, variable); | 1132 | xsignal1 (Qvoid_variable, variable); |
| @@ -1178,7 +1139,7 @@ is the default binding of the variable. */) | |||
| 1178 | locally unbound. */ | 1139 | locally unbound. */ |
| 1179 | 1140 | ||
| 1180 | Lisp_Object | 1141 | Lisp_Object |
| 1181 | buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer) | 1142 | buffer_local_value (Lisp_Object variable, Lisp_Object buffer) |
| 1182 | { | 1143 | { |
| 1183 | register struct buffer *buf; | 1144 | register struct buffer *buf; |
| 1184 | register Lisp_Object result; | 1145 | register Lisp_Object result; |
| @@ -1278,20 +1239,10 @@ Most elements look like (SYMBOL . VALUE), describing one variable. | |||
| 1278 | For a symbol that is locally unbound, just the symbol appears in the value. | 1239 | For a symbol that is locally unbound, just the symbol appears in the value. |
| 1279 | Note that storing new VALUEs in these elements doesn't change the variables. | 1240 | Note that storing new VALUEs in these elements doesn't change the variables. |
| 1280 | No argument or nil as argument means use current buffer as BUFFER. */) | 1241 | No argument or nil as argument means use current buffer as BUFFER. */) |
| 1281 | (register Lisp_Object buffer) | 1242 | (Lisp_Object buffer) |
| 1282 | { | 1243 | { |
| 1283 | register struct buffer *buf; | 1244 | struct buffer *buf = decode_buffer (buffer); |
| 1284 | register Lisp_Object result; | 1245 | Lisp_Object result = buffer_lisp_local_variables (buf, 0); |
| 1285 | |||
| 1286 | if (NILP (buffer)) | ||
| 1287 | buf = current_buffer; | ||
| 1288 | else | ||
| 1289 | { | ||
| 1290 | CHECK_BUFFER (buffer); | ||
| 1291 | buf = XBUFFER (buffer); | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | result = buffer_lisp_local_variables (buf, 0); | ||
| 1295 | 1246 | ||
| 1296 | /* Add on all the variables stored in special slots. */ | 1247 | /* Add on all the variables stored in special slots. */ |
| 1297 | { | 1248 | { |
| @@ -1318,18 +1269,32 @@ DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, | |||
| 1318 | 0, 1, 0, | 1269 | 0, 1, 0, |
| 1319 | doc: /* Return t if BUFFER was modified since its file was last read or saved. | 1270 | doc: /* Return t if BUFFER was modified since its file was last read or saved. |
| 1320 | No argument or nil as argument means use current buffer as BUFFER. */) | 1271 | No argument or nil as argument means use current buffer as BUFFER. */) |
| 1321 | (register Lisp_Object buffer) | 1272 | (Lisp_Object buffer) |
| 1322 | { | 1273 | { |
| 1323 | register struct buffer *buf; | 1274 | struct buffer *buf = decode_buffer (buffer); |
| 1324 | if (NILP (buffer)) | 1275 | return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; |
| 1325 | buf = current_buffer; | 1276 | } |
| 1326 | else | 1277 | |
| 1278 | DEFUN ("force-mode-line-update", Fforce_mode_line_update, | ||
| 1279 | Sforce_mode_line_update, 0, 1, 0, | ||
| 1280 | doc: /* Force redisplay of the current buffer's mode line and header line. | ||
| 1281 | With optional non-nil ALL, force redisplay of all mode lines and | ||
| 1282 | header lines. This function also forces recomputation of the | ||
| 1283 | menu bar menus and the frame title. */) | ||
| 1284 | (Lisp_Object all) | ||
| 1285 | { | ||
| 1286 | if (!NILP (all)) | ||
| 1327 | { | 1287 | { |
| 1328 | CHECK_BUFFER (buffer); | 1288 | update_mode_lines = 10; |
| 1329 | buf = XBUFFER (buffer); | 1289 | /* FIXME: This can't be right. */ |
| 1290 | current_buffer->prevent_redisplay_optimizations_p = true; | ||
| 1330 | } | 1291 | } |
| 1331 | 1292 | else if (buffer_window_count (current_buffer)) | |
| 1332 | return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; | 1293 | { |
| 1294 | bset_update_mode_line (current_buffer); | ||
| 1295 | current_buffer->prevent_redisplay_optimizations_p = true; | ||
| 1296 | } | ||
| 1297 | return all; | ||
| 1333 | } | 1298 | } |
| 1334 | 1299 | ||
| 1335 | DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, | 1300 | DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, |
| @@ -1338,9 +1303,31 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, | |||
| 1338 | A non-nil FLAG means mark the buffer modified. */) | 1303 | A non-nil FLAG means mark the buffer modified. */) |
| 1339 | (Lisp_Object flag) | 1304 | (Lisp_Object flag) |
| 1340 | { | 1305 | { |
| 1306 | Frestore_buffer_modified_p (flag); | ||
| 1307 | |||
| 1308 | /* Set update_mode_lines only if buffer is displayed in some window. | ||
| 1309 | Packages like jit-lock or lazy-lock preserve a buffer's modified | ||
| 1310 | state by recording/restoring the state around blocks of code. | ||
| 1311 | Setting update_mode_lines makes redisplay consider all windows | ||
| 1312 | (on all frames). Stealth fontification of buffers not displayed | ||
| 1313 | would incur additional redisplay costs if we'd set | ||
| 1314 | update_modes_lines unconditionally. | ||
| 1315 | |||
| 1316 | Ideally, I think there should be another mechanism for fontifying | ||
| 1317 | buffers without "modifying" buffers, or redisplay should be | ||
| 1318 | smarter about updating the `*' in mode lines. --gerd */ | ||
| 1319 | return Fforce_mode_line_update (Qnil); | ||
| 1320 | } | ||
| 1321 | |||
| 1322 | DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, | ||
| 1323 | Srestore_buffer_modified_p, 1, 1, 0, | ||
| 1324 | doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. | ||
| 1325 | It is not ensured that mode lines will be updated to show the modified | ||
| 1326 | state of the current buffer. Use with care. */) | ||
| 1327 | (Lisp_Object flag) | ||
| 1328 | { | ||
| 1341 | Lisp_Object fn; | 1329 | Lisp_Object fn; |
| 1342 | 1330 | ||
| 1343 | #ifdef CLASH_DETECTION | ||
| 1344 | /* If buffer becoming modified, lock the file. | 1331 | /* If buffer becoming modified, lock the file. |
| 1345 | If buffer becoming unmodified, unlock the file. */ | 1332 | If buffer becoming unmodified, unlock the file. */ |
| 1346 | 1333 | ||
| @@ -1358,7 +1345,6 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1358 | else if (already && NILP (flag)) | 1345 | else if (already && NILP (flag)) |
| 1359 | unlock_file (fn); | 1346 | unlock_file (fn); |
| 1360 | } | 1347 | } |
| 1361 | #endif /* CLASH_DETECTION */ | ||
| 1362 | 1348 | ||
| 1363 | /* Here we have a problem. SAVE_MODIFF is used here to encode | 1349 | /* Here we have a problem. SAVE_MODIFF is used here to encode |
| 1364 | buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as | 1350 | buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as |
| @@ -1380,52 +1366,6 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1380 | or increase MODIFF. */ | 1366 | or increase MODIFF. */ |
| 1381 | : MODIFF++); | 1367 | : MODIFF++); |
| 1382 | 1368 | ||
| 1383 | /* Set update_mode_lines only if buffer is displayed in some window. | ||
| 1384 | Packages like jit-lock or lazy-lock preserve a buffer's modified | ||
| 1385 | state by recording/restoring the state around blocks of code. | ||
| 1386 | Setting update_mode_lines makes redisplay consider all windows | ||
| 1387 | (on all frames). Stealth fontification of buffers not displayed | ||
| 1388 | would incur additional redisplay costs if we'd set | ||
| 1389 | update_modes_lines unconditionally. | ||
| 1390 | |||
| 1391 | Ideally, I think there should be another mechanism for fontifying | ||
| 1392 | buffers without "modifying" buffers, or redisplay should be | ||
| 1393 | smarter about updating the `*' in mode lines. --gerd */ | ||
| 1394 | if (buffer_window_count (current_buffer)) | ||
| 1395 | { | ||
| 1396 | ++update_mode_lines; | ||
| 1397 | current_buffer->prevent_redisplay_optimizations_p = 1; | ||
| 1398 | } | ||
| 1399 | |||
| 1400 | return flag; | ||
| 1401 | } | ||
| 1402 | |||
| 1403 | DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, | ||
| 1404 | Srestore_buffer_modified_p, 1, 1, 0, | ||
| 1405 | doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. | ||
| 1406 | It is not ensured that mode lines will be updated to show the modified | ||
| 1407 | state of the current buffer. Use with care. */) | ||
| 1408 | (Lisp_Object flag) | ||
| 1409 | { | ||
| 1410 | #ifdef CLASH_DETECTION | ||
| 1411 | Lisp_Object fn; | ||
| 1412 | |||
| 1413 | /* If buffer becoming modified, lock the file. | ||
| 1414 | If buffer becoming unmodified, unlock the file. */ | ||
| 1415 | |||
| 1416 | fn = BVAR (current_buffer, file_truename); | ||
| 1417 | /* Test buffer-file-name so that binding it to nil is effective. */ | ||
| 1418 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) | ||
| 1419 | { | ||
| 1420 | bool already = SAVE_MODIFF < MODIFF; | ||
| 1421 | if (!already && !NILP (flag)) | ||
| 1422 | lock_file (fn); | ||
| 1423 | else if (already && NILP (flag)) | ||
| 1424 | unlock_file (fn); | ||
| 1425 | } | ||
| 1426 | #endif /* CLASH_DETECTION */ | ||
| 1427 | |||
| 1428 | SAVE_MODIFF = NILP (flag) ? MODIFF : 0; | ||
| 1429 | return flag; | 1369 | return flag; |
| 1430 | } | 1370 | } |
| 1431 | 1371 | ||
| @@ -1437,23 +1377,14 @@ text in that buffer is changed. It wraps around occasionally. | |||
| 1437 | No argument or nil as argument means use current buffer as BUFFER. */) | 1377 | No argument or nil as argument means use current buffer as BUFFER. */) |
| 1438 | (register Lisp_Object buffer) | 1378 | (register Lisp_Object buffer) |
| 1439 | { | 1379 | { |
| 1440 | register struct buffer *buf; | 1380 | return make_number (BUF_MODIFF (decode_buffer (buffer))); |
| 1441 | if (NILP (buffer)) | ||
| 1442 | buf = current_buffer; | ||
| 1443 | else | ||
| 1444 | { | ||
| 1445 | CHECK_BUFFER (buffer); | ||
| 1446 | buf = XBUFFER (buffer); | ||
| 1447 | } | ||
| 1448 | |||
| 1449 | return make_number (BUF_MODIFF (buf)); | ||
| 1450 | } | 1381 | } |
| 1451 | 1382 | ||
| 1452 | DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, | 1383 | DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, |
| 1453 | Sbuffer_chars_modified_tick, 0, 1, 0, | 1384 | Sbuffer_chars_modified_tick, 0, 1, 0, |
| 1454 | doc: /* Return BUFFER's character-change tick counter. | 1385 | doc: /* Return BUFFER's character-change tick counter. |
| 1455 | Each buffer has a character-change tick counter, which is set to the | 1386 | Each buffer has a character-change tick counter, which is set to the |
| 1456 | value of the buffer's tick counter \(see `buffer-modified-tick'), each | 1387 | value of the buffer's tick counter (see `buffer-modified-tick'), each |
| 1457 | time text in that buffer is inserted or deleted. By comparing the | 1388 | time text in that buffer is inserted or deleted. By comparing the |
| 1458 | values returned by two individual calls of `buffer-chars-modified-tick', | 1389 | values returned by two individual calls of `buffer-chars-modified-tick', |
| 1459 | you can tell whether a character change occurred in that buffer in | 1390 | you can tell whether a character change occurred in that buffer in |
| @@ -1461,16 +1392,7 @@ between these calls. No argument or nil as argument means use current | |||
| 1461 | buffer as BUFFER. */) | 1392 | buffer as BUFFER. */) |
| 1462 | (register Lisp_Object buffer) | 1393 | (register Lisp_Object buffer) |
| 1463 | { | 1394 | { |
| 1464 | register struct buffer *buf; | 1395 | return make_number (BUF_CHARS_MODIFF (decode_buffer (buffer))); |
| 1465 | if (NILP (buffer)) | ||
| 1466 | buf = current_buffer; | ||
| 1467 | else | ||
| 1468 | { | ||
| 1469 | CHECK_BUFFER (buffer); | ||
| 1470 | buf = XBUFFER (buffer); | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | return make_number (BUF_CHARS_MODIFF (buf)); | ||
| 1474 | } | 1396 | } |
| 1475 | 1397 | ||
| 1476 | DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, | 1398 | DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, |
| @@ -1513,7 +1435,7 @@ This does not change the name of the visited file (if any). */) | |||
| 1513 | 1435 | ||
| 1514 | /* Catch redisplay's attention. Unless we do this, the mode lines for | 1436 | /* Catch redisplay's attention. Unless we do this, the mode lines for |
| 1515 | any windows displaying current_buffer will stay unchanged. */ | 1437 | any windows displaying current_buffer will stay unchanged. */ |
| 1516 | update_mode_lines++; | 1438 | update_mode_lines = 11; |
| 1517 | 1439 | ||
| 1518 | XSETBUFFER (buf, current_buffer); | 1440 | XSETBUFFER (buf, current_buffer); |
| 1519 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); | 1441 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); |
| @@ -1544,15 +1466,15 @@ DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, | |||
| 1544 | Buffers not visible in windows are preferred to visible buffers, unless | 1466 | Buffers not visible in windows are preferred to visible buffers, unless |
| 1545 | optional second argument VISIBLE-OK is non-nil. Ignore the argument | 1467 | optional second argument VISIBLE-OK is non-nil. Ignore the argument |
| 1546 | BUFFER unless it denotes a live buffer. If the optional third argument | 1468 | BUFFER unless it denotes a live buffer. If the optional third argument |
| 1547 | FRAME is non-nil, use that frame's buffer list instead of the selected | 1469 | FRAME specifies a live frame, then use that frame's buffer list instead |
| 1548 | frame's buffer list. | 1470 | of the selected frame's buffer list. |
| 1549 | 1471 | ||
| 1550 | The buffer is found by scanning the selected or specified frame's buffer | 1472 | The buffer is found by scanning the selected or specified frame's buffer |
| 1551 | list first, followed by the list of all buffers. If no other buffer | 1473 | list first, followed by the list of all buffers. If no other buffer |
| 1552 | exists, return the buffer `*scratch*' (creating it if necessary). */) | 1474 | exists, return the buffer `*scratch*' (creating it if necessary). */) |
| 1553 | (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) | 1475 | (Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) |
| 1554 | { | 1476 | { |
| 1555 | struct frame *f = decode_any_frame (frame); | 1477 | struct frame *f = decode_live_frame (frame); |
| 1556 | Lisp_Object tail = f->buffer_list, pred = f->buffer_predicate; | 1478 | Lisp_Object tail = f->buffer_list, pred = f->buffer_predicate; |
| 1557 | Lisp_Object buf, notsogood = Qnil; | 1479 | Lisp_Object buf, notsogood = Qnil; |
| 1558 | 1480 | ||
| @@ -1593,10 +1515,11 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1593 | return notsogood; | 1515 | return notsogood; |
| 1594 | else | 1516 | else |
| 1595 | { | 1517 | { |
| 1596 | buf = Fget_buffer (build_string ("*scratch*")); | 1518 | AUTO_STRING (scratch, "*scratch*"); |
| 1519 | buf = Fget_buffer (scratch); | ||
| 1597 | if (NILP (buf)) | 1520 | if (NILP (buf)) |
| 1598 | { | 1521 | { |
| 1599 | buf = Fget_buffer_create (build_string ("*scratch*")); | 1522 | buf = Fget_buffer_create (scratch); |
| 1600 | Fset_buffer_major_mode (buf); | 1523 | Fset_buffer_major_mode (buf); |
| 1601 | } | 1524 | } |
| 1602 | return buf; | 1525 | return buf; |
| @@ -1616,10 +1539,11 @@ other_buffer_safely (Lisp_Object buffer) | |||
| 1616 | if (candidate_buffer (buf, buffer)) | 1539 | if (candidate_buffer (buf, buffer)) |
| 1617 | return buf; | 1540 | return buf; |
| 1618 | 1541 | ||
| 1619 | buf = Fget_buffer (build_string ("*scratch*")); | 1542 | AUTO_STRING (scratch, "*scratch*"); |
| 1543 | buf = Fget_buffer (scratch); | ||
| 1620 | if (NILP (buf)) | 1544 | if (NILP (buf)) |
| 1621 | { | 1545 | { |
| 1622 | buf = Fget_buffer_create (build_string ("*scratch*")); | 1546 | buf = Fget_buffer_create (scratch); |
| 1623 | Fset_buffer_major_mode (buf); | 1547 | Fset_buffer_major_mode (buf); |
| 1624 | } | 1548 | } |
| 1625 | 1549 | ||
| @@ -1666,7 +1590,7 @@ compact_buffer (struct buffer *buffer) | |||
| 1666 | turned off in that buffer. Calling truncate_undo_list on | 1590 | turned off in that buffer. Calling truncate_undo_list on |
| 1667 | Qt tends to return NULL, which effectively turns undo back on. | 1591 | Qt tends to return NULL, which effectively turns undo back on. |
| 1668 | So don't call truncate_undo_list if undo_list is Qt. */ | 1592 | So don't call truncate_undo_list if undo_list is Qt. */ |
| 1669 | if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt)) | 1593 | if (!EQ (BVAR(buffer, undo_list), Qt)) |
| 1670 | truncate_undo_list (buffer); | 1594 | truncate_undo_list (buffer); |
| 1671 | 1595 | ||
| 1672 | /* Shrink buffer gaps. */ | 1596 | /* Shrink buffer gaps. */ |
| @@ -1704,10 +1628,9 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1704 | (Lisp_Object buffer_or_name) | 1628 | (Lisp_Object buffer_or_name) |
| 1705 | { | 1629 | { |
| 1706 | Lisp_Object buffer; | 1630 | Lisp_Object buffer; |
| 1707 | register struct buffer *b; | 1631 | struct buffer *b; |
| 1708 | register Lisp_Object tem; | 1632 | Lisp_Object tem; |
| 1709 | register struct Lisp_Marker *m; | 1633 | struct Lisp_Marker *m; |
| 1710 | struct gcpro gcpro1; | ||
| 1711 | 1634 | ||
| 1712 | if (NILP (buffer_or_name)) | 1635 | if (NILP (buffer_or_name)) |
| 1713 | buffer = Fcurrent_buffer (); | 1636 | buffer = Fcurrent_buffer (); |
| @@ -1728,15 +1651,14 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1728 | /* Run hooks with the buffer to be killed the current buffer. */ | 1651 | /* Run hooks with the buffer to be killed the current buffer. */ |
| 1729 | { | 1652 | { |
| 1730 | ptrdiff_t count = SPECPDL_INDEX (); | 1653 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1731 | Lisp_Object arglist[1]; | ||
| 1732 | 1654 | ||
| 1733 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1655 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 1734 | set_buffer_internal (b); | 1656 | set_buffer_internal (b); |
| 1735 | 1657 | ||
| 1736 | /* First run the query functions; if any query is answered no, | 1658 | /* First run the query functions; if any query is answered no, |
| 1737 | don't kill the buffer. */ | 1659 | don't kill the buffer. */ |
| 1738 | arglist[0] = Qkill_buffer_query_functions; | 1660 | tem = CALLN (Frun_hook_with_args_until_failure, |
| 1739 | tem = Frun_hook_with_args_until_failure (1, arglist); | 1661 | Qkill_buffer_query_functions); |
| 1740 | if (NILP (tem)) | 1662 | if (NILP (tem)) |
| 1741 | return unbind_to (count, Qnil); | 1663 | return unbind_to (count, Qnil); |
| 1742 | 1664 | ||
| @@ -1744,10 +1666,8 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1744 | if (INTERACTIVE && !NILP (BVAR (b, filename)) | 1666 | if (INTERACTIVE && !NILP (BVAR (b, filename)) |
| 1745 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | 1667 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) |
| 1746 | { | 1668 | { |
| 1747 | GCPRO1 (buffer); | 1669 | AUTO_STRING (format, "Buffer %s modified; kill anyway? "); |
| 1748 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", | 1670 | tem = do_yes_or_no_p (CALLN (Fformat, format, BVAR (b, name))); |
| 1749 | BVAR (b, name), make_number (0))); | ||
| 1750 | UNGCPRO; | ||
| 1751 | if (NILP (tem)) | 1671 | if (NILP (tem)) |
| 1752 | return unbind_to (count, Qnil); | 1672 | return unbind_to (count, Qnil); |
| 1753 | } | 1673 | } |
| @@ -1757,7 +1677,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1757 | return unbind_to (count, Qt); | 1677 | return unbind_to (count, Qt); |
| 1758 | 1678 | ||
| 1759 | /* Then run the hooks. */ | 1679 | /* Then run the hooks. */ |
| 1760 | Frun_hooks (1, &Qkill_buffer_hook); | 1680 | run_hook (Qkill_buffer_hook); |
| 1761 | unbind_to (count, Qnil); | 1681 | unbind_to (count, Qnil); |
| 1762 | } | 1682 | } |
| 1763 | 1683 | ||
| @@ -1781,8 +1701,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1781 | { | 1701 | { |
| 1782 | struct buffer *other; | 1702 | struct buffer *other; |
| 1783 | 1703 | ||
| 1784 | GCPRO1 (buffer); | ||
| 1785 | |||
| 1786 | FOR_EACH_BUFFER (other) | 1704 | FOR_EACH_BUFFER (other) |
| 1787 | if (other->base_buffer == b) | 1705 | if (other->base_buffer == b) |
| 1788 | { | 1706 | { |
| @@ -1791,8 +1709,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1791 | Fkill_buffer (buf); | 1709 | Fkill_buffer (buf); |
| 1792 | } | 1710 | } |
| 1793 | 1711 | ||
| 1794 | UNGCPRO; | ||
| 1795 | |||
| 1796 | /* Exit if we now have killed the base buffer (Bug#11665). */ | 1712 | /* Exit if we now have killed the base buffer (Bug#11665). */ |
| 1797 | if (!BUFFER_LIVE_P (b)) | 1713 | if (!BUFFER_LIVE_P (b)) |
| 1798 | return Qt; | 1714 | return Qt; |
| @@ -1801,7 +1717,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1801 | /* Run replace_buffer_in_windows before making another buffer current | 1717 | /* Run replace_buffer_in_windows before making another buffer current |
| 1802 | since set-window-buffer-start-and-point will refuse to make another | 1718 | since set-window-buffer-start-and-point will refuse to make another |
| 1803 | buffer current if the selected window does not show the current | 1719 | buffer current if the selected window does not show the current |
| 1804 | buffer. (Bug#10114) */ | 1720 | buffer (bug#10114). */ |
| 1805 | replace_buffer_in_windows (buffer); | 1721 | replace_buffer_in_windows (buffer); |
| 1806 | 1722 | ||
| 1807 | /* Exit if replacing the buffer in windows has killed our buffer. */ | 1723 | /* Exit if replacing the buffer in windows has killed our buffer. */ |
| @@ -1827,14 +1743,10 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1827 | 1743 | ||
| 1828 | /* Now there is no question: we can kill the buffer. */ | 1744 | /* Now there is no question: we can kill the buffer. */ |
| 1829 | 1745 | ||
| 1830 | #ifdef CLASH_DETECTION | ||
| 1831 | /* Unlock this buffer's file, if it is locked. */ | 1746 | /* Unlock this buffer's file, if it is locked. */ |
| 1832 | unlock_buffer (b); | 1747 | unlock_buffer (b); |
| 1833 | #endif /* CLASH_DETECTION */ | ||
| 1834 | 1748 | ||
| 1835 | GCPRO1 (buffer); | ||
| 1836 | kill_buffer_processes (buffer); | 1749 | kill_buffer_processes (buffer); |
| 1837 | UNGCPRO; | ||
| 1838 | 1750 | ||
| 1839 | /* Killing buffer processes may run sentinels which may have killed | 1751 | /* Killing buffer processes may run sentinels which may have killed |
| 1840 | our buffer. */ | 1752 | our buffer. */ |
| @@ -1875,6 +1787,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1875 | 1787 | ||
| 1876 | if (b->base_buffer) | 1788 | if (b->base_buffer) |
| 1877 | { | 1789 | { |
| 1790 | INTERVAL i; | ||
| 1878 | /* Unchain all markers that belong to this indirect buffer. | 1791 | /* Unchain all markers that belong to this indirect buffer. |
| 1879 | Don't unchain the markers that belong to the base buffer | 1792 | Don't unchain the markers that belong to the base buffer |
| 1880 | or its other indirect buffers. */ | 1793 | or its other indirect buffers. */ |
| @@ -1889,6 +1802,14 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1889 | else | 1802 | else |
| 1890 | mp = &m->next; | 1803 | mp = &m->next; |
| 1891 | } | 1804 | } |
| 1805 | /* Intervals should be owned by the base buffer (Bug#16502). */ | ||
| 1806 | i = buffer_intervals (b); | ||
| 1807 | if (i) | ||
| 1808 | { | ||
| 1809 | Lisp_Object owner; | ||
| 1810 | XSETBUFFER (owner, b->base_buffer); | ||
| 1811 | set_interval_object (i, owner); | ||
| 1812 | } | ||
| 1892 | } | 1813 | } |
| 1893 | else | 1814 | else |
| 1894 | { | 1815 | { |
| @@ -2077,7 +1998,7 @@ the current buffer's major mode. */) | |||
| 2077 | count = SPECPDL_INDEX (); | 1998 | count = SPECPDL_INDEX (); |
| 2078 | 1999 | ||
| 2079 | /* To select a nonfundamental mode, | 2000 | /* To select a nonfundamental mode, |
| 2080 | select the buffer temporarily and then call the mode function. */ | 2001 | select the buffer temporarily and then call the mode function. */ |
| 2081 | 2002 | ||
| 2082 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 2003 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 2083 | 2004 | ||
| @@ -2117,7 +2038,7 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2117 | 2038 | ||
| 2118 | old_buf = current_buffer; | 2039 | old_buf = current_buffer; |
| 2119 | current_buffer = b; | 2040 | current_buffer = b; |
| 2120 | last_known_column_point = -1; /* invalidate indentation cache */ | 2041 | last_known_column_point = -1; /* Invalidate indentation cache. */ |
| 2121 | 2042 | ||
| 2122 | if (old_buf) | 2043 | if (old_buf) |
| 2123 | { | 2044 | { |
| @@ -2141,7 +2062,7 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2141 | fetch_buffer_markers (b); | 2062 | fetch_buffer_markers (b); |
| 2142 | 2063 | ||
| 2143 | /* Look down buffer's list of local Lisp variables | 2064 | /* Look down buffer's list of local Lisp variables |
| 2144 | to find and update any that forward into C variables. */ | 2065 | to find and update any that forward into C variables. */ |
| 2145 | 2066 | ||
| 2146 | do | 2067 | do |
| 2147 | { | 2068 | { |
| @@ -2185,11 +2106,12 @@ set_buffer_temp (struct buffer *b) | |||
| 2185 | 2106 | ||
| 2186 | DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, | 2107 | DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, |
| 2187 | doc: /* Make buffer BUFFER-OR-NAME current for editing operations. | 2108 | doc: /* Make buffer BUFFER-OR-NAME current for editing operations. |
| 2188 | BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See | 2109 | BUFFER-OR-NAME may be a buffer or the name of an existing buffer. |
| 2189 | also `with-current-buffer' when you want to make a buffer current | 2110 | See also `with-current-buffer' when you want to make a buffer current |
| 2190 | temporarily. This function does not display the buffer, so its effect | 2111 | temporarily. This function does not display the buffer, so its effect |
| 2191 | ends when the current command terminates. Use `switch-to-buffer' or | 2112 | ends when the current command terminates. Use `switch-to-buffer' or |
| 2192 | `pop-to-buffer' to switch buffers permanently. */) | 2113 | `pop-to-buffer' to switch buffers permanently. |
| 2114 | The return value is the buffer made current. */) | ||
| 2193 | (register Lisp_Object buffer_or_name) | 2115 | (register Lisp_Object buffer_or_name) |
| 2194 | { | 2116 | { |
| 2195 | register Lisp_Object buffer; | 2117 | register Lisp_Object buffer; |
| @@ -2218,12 +2140,20 @@ set_buffer_if_live (Lisp_Object buffer) | |||
| 2218 | } | 2140 | } |
| 2219 | 2141 | ||
| 2220 | DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, | 2142 | DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, |
| 2221 | Sbarf_if_buffer_read_only, 0, 0, 0, | 2143 | Sbarf_if_buffer_read_only, 0, 1, 0, |
| 2222 | doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) | 2144 | doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. |
| 2223 | (void) | 2145 | If the text under POSITION (which defaults to point) has the |
| 2146 | `inhibit-read-only' text property set, the error will not be raised. */) | ||
| 2147 | (Lisp_Object pos) | ||
| 2224 | { | 2148 | { |
| 2149 | if (NILP (pos)) | ||
| 2150 | XSETFASTINT (pos, PT); | ||
| 2151 | else | ||
| 2152 | CHECK_NUMBER (pos); | ||
| 2153 | |||
| 2225 | if (!NILP (BVAR (current_buffer, read_only)) | 2154 | if (!NILP (BVAR (current_buffer, read_only)) |
| 2226 | && NILP (Vinhibit_read_only)) | 2155 | && NILP (Vinhibit_read_only) |
| 2156 | && NILP (Fget_text_property (pos, Qinhibit_read_only, Qnil))) | ||
| 2227 | xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); | 2157 | xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); |
| 2228 | return Qnil; | 2158 | return Qnil; |
| 2229 | } | 2159 | } |
| @@ -2259,7 +2189,7 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e) | |||
| 2259 | } | 2189 | } |
| 2260 | 2190 | ||
| 2261 | if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV)) | 2191 | if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV)) |
| 2262 | args_out_of_range (*b, *e); | 2192 | args_out_of_range_3 (Fcurrent_buffer (), *b, *e); |
| 2263 | } | 2193 | } |
| 2264 | 2194 | ||
| 2265 | /* Advance BYTE_POS up to a character boundary | 2195 | /* Advance BYTE_POS up to a character boundary |
| @@ -2424,6 +2354,14 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2424 | make_number | 2354 | make_number |
| 2425 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), | 2355 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), |
| 2426 | XWINDOW (w)->contents); | 2356 | XWINDOW (w)->contents); |
| 2357 | /* Blindly copied from pointm part. */ | ||
| 2358 | if (MARKERP (XWINDOW (w)->old_pointm) | ||
| 2359 | && (EQ (XWINDOW (w)->contents, buf1) | ||
| 2360 | || EQ (XWINDOW (w)->contents, buf2))) | ||
| 2361 | Fset_marker (XWINDOW (w)->old_pointm, | ||
| 2362 | make_number | ||
| 2363 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), | ||
| 2364 | XWINDOW (w)->contents); | ||
| 2427 | if (MARKERP (XWINDOW (w)->start) | 2365 | if (MARKERP (XWINDOW (w)->start) |
| 2428 | && (EQ (XWINDOW (w)->contents, buf1) | 2366 | && (EQ (XWINDOW (w)->contents, buf1) |
| 2429 | || EQ (XWINDOW (w)->contents, buf2))) | 2367 | || EQ (XWINDOW (w)->contents, buf2))) |
| @@ -2464,7 +2402,6 @@ current buffer is cleared. */) | |||
| 2464 | bool narrowed = (BEG != BEGV || Z != ZV); | 2402 | bool narrowed = (BEG != BEGV || Z != ZV); |
| 2465 | bool modified_p = !NILP (Fbuffer_modified_p (Qnil)); | 2403 | bool modified_p = !NILP (Fbuffer_modified_p (Qnil)); |
| 2466 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); | 2404 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); |
| 2467 | struct gcpro gcpro1; | ||
| 2468 | 2405 | ||
| 2469 | if (current_buffer->base_buffer) | 2406 | if (current_buffer->base_buffer) |
| 2470 | error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); | 2407 | error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); |
| @@ -2473,8 +2410,6 @@ current buffer is cleared. */) | |||
| 2473 | if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters))) | 2410 | if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 2474 | return flag; | 2411 | return flag; |
| 2475 | 2412 | ||
| 2476 | GCPRO1 (old_undo); | ||
| 2477 | |||
| 2478 | /* Don't record these buffer changes. We will put a special undo entry | 2413 | /* Don't record these buffer changes. We will put a special undo entry |
| 2479 | instead. */ | 2414 | instead. */ |
| 2480 | bset_undo_list (current_buffer, Qt); | 2415 | bset_undo_list (current_buffer, Qt); |
| @@ -2490,6 +2425,8 @@ current buffer is cleared. */) | |||
| 2490 | if (narrowed) | 2425 | if (narrowed) |
| 2491 | error ("Changing multibyteness in a narrowed buffer"); | 2426 | error ("Changing multibyteness in a narrowed buffer"); |
| 2492 | 2427 | ||
| 2428 | invalidate_buffer_caches (current_buffer, BEGV, ZV); | ||
| 2429 | |||
| 2493 | if (NILP (flag)) | 2430 | if (NILP (flag)) |
| 2494 | { | 2431 | { |
| 2495 | ptrdiff_t pos, stop; | 2432 | ptrdiff_t pos, stop; |
| @@ -2526,7 +2463,7 @@ current buffer is cleared. */) | |||
| 2526 | p = GAP_END_ADDR; | 2463 | p = GAP_END_ADDR; |
| 2527 | stop = Z; | 2464 | stop = Z; |
| 2528 | } | 2465 | } |
| 2529 | if (ASCII_BYTE_P (*p)) | 2466 | if (ASCII_CHAR_P (*p)) |
| 2530 | p++, pos++; | 2467 | p++, pos++; |
| 2531 | else if (CHAR_BYTE8_HEAD_P (*p)) | 2468 | else if (CHAR_BYTE8_HEAD_P (*p)) |
| 2532 | { | 2469 | { |
| @@ -2598,7 +2535,7 @@ current buffer is cleared. */) | |||
| 2598 | stop = Z; | 2535 | stop = Z; |
| 2599 | } | 2536 | } |
| 2600 | 2537 | ||
| 2601 | if (ASCII_BYTE_P (*p)) | 2538 | if (ASCII_CHAR_P (*p)) |
| 2602 | p++, pos++; | 2539 | p++, pos++; |
| 2603 | else if (EQ (flag, Qt) | 2540 | else if (EQ (flag, Qt) |
| 2604 | && ! CHAR_BYTE8_HEAD_P (*p) | 2541 | && ! CHAR_BYTE8_HEAD_P (*p) |
| @@ -2702,13 +2639,11 @@ current buffer is cleared. */) | |||
| 2702 | old_undo)); | 2639 | old_undo)); |
| 2703 | } | 2640 | } |
| 2704 | 2641 | ||
| 2705 | UNGCPRO; | ||
| 2706 | |||
| 2707 | current_buffer->prevent_redisplay_optimizations_p = 1; | 2642 | current_buffer->prevent_redisplay_optimizations_p = 1; |
| 2708 | 2643 | ||
| 2709 | /* If buffer is shown in a window, let redisplay consider other windows. */ | 2644 | /* If buffer is shown in a window, let redisplay consider other windows. */ |
| 2710 | if (buffer_window_count (current_buffer)) | 2645 | if (buffer_window_count (current_buffer)) |
| 2711 | ++windows_or_buffers_changed; | 2646 | windows_or_buffers_changed = 10; |
| 2712 | 2647 | ||
| 2713 | /* Copy this buffer's new multibyte status | 2648 | /* Copy this buffer's new multibyte status |
| 2714 | into all of its indirect buffers. */ | 2649 | into all of its indirect buffers. */ |
| @@ -2755,7 +2690,7 @@ The first thing this function does is run | |||
| 2755 | the normal hook `change-major-mode-hook'. */) | 2690 | the normal hook `change-major-mode-hook'. */) |
| 2756 | (void) | 2691 | (void) |
| 2757 | { | 2692 | { |
| 2758 | Frun_hooks (1, &Qchange_major_mode_hook); | 2693 | run_hook (Qchange_major_mode_hook); |
| 2759 | 2694 | ||
| 2760 | /* Make sure none of the bindings in local_var_alist | 2695 | /* Make sure none of the bindings in local_var_alist |
| 2761 | remain swapped in, in their symbols. */ | 2696 | remain swapped in, in their symbols. */ |
| @@ -2768,7 +2703,7 @@ the normal hook `change-major-mode-hook'. */) | |||
| 2768 | 2703 | ||
| 2769 | /* Force mode-line redisplay. Useful here because all major mode | 2704 | /* Force mode-line redisplay. Useful here because all major mode |
| 2770 | commands call this function. */ | 2705 | commands call this function. */ |
| 2771 | update_mode_lines++; | 2706 | update_mode_lines = 12; |
| 2772 | 2707 | ||
| 2773 | return Qnil; | 2708 | return Qnil; |
| 2774 | } | 2709 | } |
| @@ -3079,13 +3014,15 @@ mouse_face_overlay_overlaps (Lisp_Object overlay) | |||
| 3079 | ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3014 | ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 3080 | ptrdiff_t n, i, size; | 3015 | ptrdiff_t n, i, size; |
| 3081 | Lisp_Object *v, tem; | 3016 | Lisp_Object *v, tem; |
| 3017 | Lisp_Object vbuf[10]; | ||
| 3018 | USE_SAFE_ALLOCA; | ||
| 3082 | 3019 | ||
| 3083 | size = 10; | 3020 | size = ARRAYELTS (vbuf); |
| 3084 | v = alloca (size * sizeof *v); | 3021 | v = vbuf; |
| 3085 | n = overlays_in (start, end, 0, &v, &size, NULL, NULL); | 3022 | n = overlays_in (start, end, 0, &v, &size, NULL, NULL); |
| 3086 | if (n > size) | 3023 | if (n > size) |
| 3087 | { | 3024 | { |
| 3088 | v = alloca (n * sizeof *v); | 3025 | SAFE_NALLOCA (v, 1, n); |
| 3089 | overlays_in (start, end, 0, &v, &n, NULL, NULL); | 3026 | overlays_in (start, end, 0, &v, &n, NULL, NULL); |
| 3090 | } | 3027 | } |
| 3091 | 3028 | ||
| @@ -3095,6 +3032,7 @@ mouse_face_overlay_overlaps (Lisp_Object overlay) | |||
| 3095 | !NILP (tem))) | 3032 | !NILP (tem))) |
| 3096 | break; | 3033 | break; |
| 3097 | 3034 | ||
| 3035 | SAFE_FREE (); | ||
| 3098 | return i < n; | 3036 | return i < n; |
| 3099 | } | 3037 | } |
| 3100 | 3038 | ||
| @@ -3142,6 +3080,7 @@ struct sortvec | |||
| 3142 | Lisp_Object overlay; | 3080 | Lisp_Object overlay; |
| 3143 | ptrdiff_t beg, end; | 3081 | ptrdiff_t beg, end; |
| 3144 | EMACS_INT priority; | 3082 | EMACS_INT priority; |
| 3083 | EMACS_INT spriority; /* Secondary priority. */ | ||
| 3145 | }; | 3084 | }; |
| 3146 | 3085 | ||
| 3147 | static int | 3086 | static int |
| @@ -3149,19 +3088,28 @@ compare_overlays (const void *v1, const void *v2) | |||
| 3149 | { | 3088 | { |
| 3150 | const struct sortvec *s1 = v1; | 3089 | const struct sortvec *s1 = v1; |
| 3151 | const struct sortvec *s2 = v2; | 3090 | const struct sortvec *s2 = v2; |
| 3091 | /* Return 1 if s1 should take precedence, -1 if v2 should take precedence, | ||
| 3092 | and 0 if they're equal. */ | ||
| 3152 | if (s1->priority != s2->priority) | 3093 | if (s1->priority != s2->priority) |
| 3153 | return s1->priority < s2->priority ? -1 : 1; | 3094 | return s1->priority < s2->priority ? -1 : 1; |
| 3154 | if (s1->beg != s2->beg) | 3095 | /* If the priority is equal, give precedence to the one not covered by the |
| 3155 | return s1->beg < s2->beg ? -1 : 1; | 3096 | other. If neither covers the other, obey spriority. */ |
| 3156 | if (s1->end != s2->end) | 3097 | else if (s1->beg < s2->beg) |
| 3098 | return (s1->end < s2->end && s1->spriority > s2->spriority ? 1 : -1); | ||
| 3099 | else if (s1->beg > s2->beg) | ||
| 3100 | return (s1->end > s2->end && s1->spriority < s2->spriority ? -1 : 1); | ||
| 3101 | else if (s1->end != s2->end) | ||
| 3157 | return s2->end < s1->end ? -1 : 1; | 3102 | return s2->end < s1->end ? -1 : 1; |
| 3158 | /* Avoid the non-determinism of qsort by choosing an arbitrary ordering | 3103 | else if (s1->spriority != s2->spriority) |
| 3159 | between "equal" overlays. The result can still change between | 3104 | return (s1->spriority < s2->spriority ? -1 : 1); |
| 3160 | invocations of Emacs, but it won't change in the middle of | 3105 | else if (EQ (s1->overlay, s2->overlay)) |
| 3161 | `find_field' (bug#6830). */ | 3106 | return 0; |
| 3162 | if (!EQ (s1->overlay, s2->overlay)) | 3107 | else |
| 3108 | /* Avoid the non-determinism of qsort by choosing an arbitrary ordering | ||
| 3109 | between "equal" overlays. The result can still change between | ||
| 3110 | invocations of Emacs, but it won't change in the middle of | ||
| 3111 | `find_field' (bug#6830). */ | ||
| 3163 | return XLI (s1->overlay) < XLI (s2->overlay) ? -1 : 1; | 3112 | return XLI (s1->overlay) < XLI (s2->overlay) ? -1 : 1; |
| 3164 | return 0; | ||
| 3165 | } | 3113 | } |
| 3166 | 3114 | ||
| 3167 | /* Sort an array of overlays by priority. The array is modified in place. | 3115 | /* Sort an array of overlays by priority. The array is modified in place. |
| @@ -3204,10 +3152,23 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w) | |||
| 3204 | sortvec[j].beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3152 | sortvec[j].beg = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 3205 | sortvec[j].end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3153 | sortvec[j].end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 3206 | tem = Foverlay_get (overlay, Qpriority); | 3154 | tem = Foverlay_get (overlay, Qpriority); |
| 3207 | if (INTEGERP (tem)) | 3155 | if (NILP (tem)) |
| 3208 | sortvec[j].priority = XINT (tem); | 3156 | { |
| 3209 | else | 3157 | sortvec[j].priority = 0; |
| 3210 | sortvec[j].priority = 0; | 3158 | sortvec[j].spriority = 0; |
| 3159 | } | ||
| 3160 | else if (INTEGERP (tem)) | ||
| 3161 | { | ||
| 3162 | sortvec[j].priority = XINT (tem); | ||
| 3163 | sortvec[j].spriority = 0; | ||
| 3164 | } | ||
| 3165 | else if (CONSP (tem)) | ||
| 3166 | { | ||
| 3167 | Lisp_Object car = XCAR (tem); | ||
| 3168 | Lisp_Object cdr = XCDR (tem); | ||
| 3169 | sortvec[j].priority = INTEGERP (car) ? XINT (car) : 0; | ||
| 3170 | sortvec[j].spriority = INTEGERP (cdr) ? XINT (cdr) : 0; | ||
| 3171 | } | ||
| 3211 | j++; | 3172 | j++; |
| 3212 | } | 3173 | } |
| 3213 | } | 3174 | } |
| @@ -3305,17 +3266,18 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, | |||
| 3305 | } | 3266 | } |
| 3306 | } | 3267 | } |
| 3307 | 3268 | ||
| 3308 | /* Return the concatenation of the strings associated with overlays that | 3269 | /* Concatenate the strings associated with overlays that begin or end |
| 3309 | begin or end at POS, ignoring overlays that are specific to a window | 3270 | at POS, ignoring overlays that are specific to windows other than W. |
| 3310 | other than W. The strings are concatenated in the appropriate order: | 3271 | The strings are concatenated in the appropriate order: shorter |
| 3311 | shorter overlays nest inside longer ones, and higher priority inside | 3272 | overlays nest inside longer ones, and higher priority inside lower. |
| 3312 | lower. Normally all of the after-strings come first, but zero-sized | 3273 | Normally all of the after-strings come first, but zero-sized |
| 3313 | overlays have their after-strings ride along with the before-strings | 3274 | overlays have their after-strings ride along with the |
| 3314 | because it would look strange to print them inside-out. | 3275 | before-strings because it would look strange to print them |
| 3276 | inside-out. | ||
| 3315 | 3277 | ||
| 3316 | Returns the string length, and stores the contents indirectly through | 3278 | Returns the concatenated string's length, and return the pointer to |
| 3317 | PSTR, if that variable is non-null. The string may be overwritten by | 3279 | that string via PSTR, if that variable is non-NULL. The storage of |
| 3318 | subsequent calls. */ | 3280 | the concatenated strings may be overwritten by subsequent calls. */ |
| 3319 | 3281 | ||
| 3320 | ptrdiff_t | 3282 | ptrdiff_t |
| 3321 | overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) | 3283 | overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) |
| @@ -3826,16 +3788,17 @@ DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0, | |||
| 3826 | } | 3788 | } |
| 3827 | 3789 | ||
| 3828 | DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0, | 3790 | DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0, |
| 3829 | doc: /* Create a new overlay with range BEG to END in BUFFER. | 3791 | doc: /* Create a new overlay with range BEG to END in BUFFER and return it. |
| 3830 | If omitted, BUFFER defaults to the current buffer. | 3792 | If omitted, BUFFER defaults to the current buffer. |
| 3831 | BEG and END may be integers or markers. | 3793 | BEG and END may be integers or markers. |
| 3832 | The fourth arg FRONT-ADVANCE, if non-nil, makes the marker | 3794 | The fourth arg FRONT-ADVANCE, if non-nil, makes the marker |
| 3833 | for the front of the overlay advance when text is inserted there | 3795 | for the front of the overlay advance when text is inserted there |
| 3834 | \(which means the text *is not* included in the overlay). | 3796 | (which means the text *is not* included in the overlay). |
| 3835 | The fifth arg REAR-ADVANCE, if non-nil, makes the marker | 3797 | The fifth arg REAR-ADVANCE, if non-nil, makes the marker |
| 3836 | for the rear of the overlay advance when text is inserted there | 3798 | for the rear of the overlay advance when text is inserted there |
| 3837 | \(which means the text *is* included in the overlay). */) | 3799 | (which means the text *is* included in the overlay). */) |
| 3838 | (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, Lisp_Object front_advance, Lisp_Object rear_advance) | 3800 | (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, |
| 3801 | Lisp_Object front_advance, Lisp_Object rear_advance) | ||
| 3839 | { | 3802 | { |
| 3840 | Lisp_Object overlay; | 3803 | Lisp_Object overlay; |
| 3841 | struct buffer *b; | 3804 | struct buffer *b; |
| @@ -3844,12 +3807,11 @@ for the rear of the overlay advance when text is inserted there | |||
| 3844 | XSETBUFFER (buffer, current_buffer); | 3807 | XSETBUFFER (buffer, current_buffer); |
| 3845 | else | 3808 | else |
| 3846 | CHECK_BUFFER (buffer); | 3809 | CHECK_BUFFER (buffer); |
| 3847 | if (MARKERP (beg) | 3810 | |
| 3848 | && ! EQ (Fmarker_buffer (beg), buffer)) | 3811 | if (MARKERP (beg) && !EQ (Fmarker_buffer (beg), buffer)) |
| 3849 | error ("Marker points into wrong buffer"); | 3812 | signal_error ("Marker points into wrong buffer", beg); |
| 3850 | if (MARKERP (end) | 3813 | if (MARKERP (end) && !EQ (Fmarker_buffer (end), buffer)) |
| 3851 | && ! EQ (Fmarker_buffer (end), buffer)) | 3814 | signal_error ("Marker points into wrong buffer", end); |
| 3852 | error ("Marker points into wrong buffer"); | ||
| 3853 | 3815 | ||
| 3854 | CHECK_NUMBER_COERCE_MARKER (beg); | 3816 | CHECK_NUMBER_COERCE_MARKER (beg); |
| 3855 | CHECK_NUMBER_COERCE_MARKER (end); | 3817 | CHECK_NUMBER_COERCE_MARKER (end); |
| @@ -3909,17 +3871,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) | |||
| 3909 | 3871 | ||
| 3910 | BUF_COMPUTE_UNCHANGED (buf, start, end); | 3872 | BUF_COMPUTE_UNCHANGED (buf, start, end); |
| 3911 | 3873 | ||
| 3912 | /* If BUF is visible, consider updating the display if ... */ | 3874 | bset_redisplay (buf); |
| 3913 | if (buffer_window_count (buf) > 0) | ||
| 3914 | { | ||
| 3915 | /* ... it's visible in other window than selected, */ | ||
| 3916 | if (buf != XBUFFER (XWINDOW (selected_window)->contents)) | ||
| 3917 | windows_or_buffers_changed = 1; | ||
| 3918 | /* ... or if we modify an overlay at the end of the buffer | ||
| 3919 | and so we cannot be sure that window end is still valid. */ | ||
| 3920 | else if (end >= ZV && start <= ZV) | ||
| 3921 | windows_or_buffers_changed = 1; | ||
| 3922 | } | ||
| 3923 | 3875 | ||
| 3924 | ++BUF_OVERLAY_MODIFF (buf); | 3876 | ++BUF_OVERLAY_MODIFF (buf); |
| 3925 | } | 3877 | } |
| @@ -3975,12 +3927,10 @@ buffer. */) | |||
| 3975 | if (NILP (Fbuffer_live_p (buffer))) | 3927 | if (NILP (Fbuffer_live_p (buffer))) |
| 3976 | error ("Attempt to move overlay to a dead buffer"); | 3928 | error ("Attempt to move overlay to a dead buffer"); |
| 3977 | 3929 | ||
| 3978 | if (MARKERP (beg) | 3930 | if (MARKERP (beg) && !EQ (Fmarker_buffer (beg), buffer)) |
| 3979 | && ! EQ (Fmarker_buffer (beg), buffer)) | 3931 | signal_error ("Marker points into wrong buffer", beg); |
| 3980 | error ("Marker points into wrong buffer"); | 3932 | if (MARKERP (end) && !EQ (Fmarker_buffer (end), buffer)) |
| 3981 | if (MARKERP (end) | 3933 | signal_error ("Marker points into wrong buffer", end); |
| 3982 | && ! EQ (Fmarker_buffer (end), buffer)) | ||
| 3983 | error ("Marker points into wrong buffer"); | ||
| 3984 | 3934 | ||
| 3985 | CHECK_NUMBER_COERCE_MARKER (beg); | 3935 | CHECK_NUMBER_COERCE_MARKER (beg); |
| 3986 | CHECK_NUMBER_COERCE_MARKER (end); | 3936 | CHECK_NUMBER_COERCE_MARKER (end); |
| @@ -4096,17 +4046,7 @@ BUFFER omitted or nil means delete all overlays of the current | |||
| 4096 | buffer. */) | 4046 | buffer. */) |
| 4097 | (Lisp_Object buffer) | 4047 | (Lisp_Object buffer) |
| 4098 | { | 4048 | { |
| 4099 | register struct buffer *buf; | 4049 | delete_all_overlays (decode_buffer (buffer)); |
| 4100 | |||
| 4101 | if (NILP (buffer)) | ||
| 4102 | buf = current_buffer; | ||
| 4103 | else | ||
| 4104 | { | ||
| 4105 | CHECK_BUFFER (buffer); | ||
| 4106 | buf = XBUFFER (buffer); | ||
| 4107 | } | ||
| 4108 | |||
| 4109 | delete_all_overlays (buf); | ||
| 4110 | return Qnil; | 4050 | return Qnil; |
| 4111 | } | 4051 | } |
| 4112 | 4052 | ||
| @@ -4152,9 +4092,10 @@ OVERLAY. */) | |||
| 4152 | } | 4092 | } |
| 4153 | 4093 | ||
| 4154 | 4094 | ||
| 4155 | DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | 4095 | DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 2, 0, |
| 4156 | doc: /* Return a list of the overlays that contain the character at POS. */) | 4096 | doc: /* Return a list of the overlays that contain the character at POS. |
| 4157 | (Lisp_Object pos) | 4097 | If SORTED is non-nil, then sort them by decreasing priority. */) |
| 4098 | (Lisp_Object pos, Lisp_Object sorted) | ||
| 4158 | { | 4099 | { |
| 4159 | ptrdiff_t len, noverlays; | 4100 | ptrdiff_t len, noverlays; |
| 4160 | Lisp_Object *overlay_vec; | 4101 | Lisp_Object *overlay_vec; |
| @@ -4162,6 +4103,9 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 4162 | 4103 | ||
| 4163 | CHECK_NUMBER_COERCE_MARKER (pos); | 4104 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 4164 | 4105 | ||
| 4106 | if (!buffer_has_overlays ()) | ||
| 4107 | return Qnil; | ||
| 4108 | |||
| 4165 | len = 10; | 4109 | len = 10; |
| 4166 | /* We can't use alloca here because overlays_at can call xrealloc. */ | 4110 | /* We can't use alloca here because overlays_at can call xrealloc. */ |
| 4167 | overlay_vec = xmalloc (len * sizeof *overlay_vec); | 4111 | overlay_vec = xmalloc (len * sizeof *overlay_vec); |
| @@ -4171,6 +4115,10 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 4171 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 4115 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 4172 | NULL, NULL, 0); | 4116 | NULL, NULL, 0); |
| 4173 | 4117 | ||
| 4118 | if (!NILP (sorted)) | ||
| 4119 | noverlays = sort_overlays (overlay_vec, noverlays, | ||
| 4120 | WINDOWP (sorted) ? XWINDOW (sorted) : NULL); | ||
| 4121 | |||
| 4174 | /* Make a list of them all. */ | 4122 | /* Make a list of them all. */ |
| 4175 | result = Flist (noverlays, overlay_vec); | 4123 | result = Flist (noverlays, overlay_vec); |
| 4176 | 4124 | ||
| @@ -4194,6 +4142,9 @@ end of the buffer. */) | |||
| 4194 | CHECK_NUMBER_COERCE_MARKER (beg); | 4142 | CHECK_NUMBER_COERCE_MARKER (beg); |
| 4195 | CHECK_NUMBER_COERCE_MARKER (end); | 4143 | CHECK_NUMBER_COERCE_MARKER (end); |
| 4196 | 4144 | ||
| 4145 | if (!buffer_has_overlays ()) | ||
| 4146 | return Qnil; | ||
| 4147 | |||
| 4197 | len = 10; | 4148 | len = 10; |
| 4198 | overlay_vec = xmalloc (len * sizeof *overlay_vec); | 4149 | overlay_vec = xmalloc (len * sizeof *overlay_vec); |
| 4199 | 4150 | ||
| @@ -4222,6 +4173,9 @@ the value is (point-max). */) | |||
| 4222 | 4173 | ||
| 4223 | CHECK_NUMBER_COERCE_MARKER (pos); | 4174 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 4224 | 4175 | ||
| 4176 | if (!buffer_has_overlays ()) | ||
| 4177 | return make_number (ZV); | ||
| 4178 | |||
| 4225 | len = 10; | 4179 | len = 10; |
| 4226 | overlay_vec = xmalloc (len * sizeof *overlay_vec); | 4180 | overlay_vec = xmalloc (len * sizeof *overlay_vec); |
| 4227 | 4181 | ||
| @@ -4261,6 +4215,9 @@ the value is (point-min). */) | |||
| 4261 | 4215 | ||
| 4262 | CHECK_NUMBER_COERCE_MARKER (pos); | 4216 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 4263 | 4217 | ||
| 4218 | if (!buffer_has_overlays ()) | ||
| 4219 | return make_number (BEGV); | ||
| 4220 | |||
| 4264 | /* At beginning of buffer, we know the answer; | 4221 | /* At beginning of buffer, we know the answer; |
| 4265 | avoid bug subtracting 1 below. */ | 4222 | avoid bug subtracting 1 below. */ |
| 4266 | if (XINT (pos) == BEGV) | 4223 | if (XINT (pos) == BEGV) |
| @@ -4425,7 +4382,6 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4425 | struct Lisp_Overlay *tail; | 4382 | struct Lisp_Overlay *tail; |
| 4426 | /* True if this change is an insertion. */ | 4383 | /* True if this change is an insertion. */ |
| 4427 | bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end)); | 4384 | bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end)); |
| 4428 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | ||
| 4429 | 4385 | ||
| 4430 | overlay = Qnil; | 4386 | overlay = Qnil; |
| 4431 | tail = NULL; | 4387 | tail = NULL; |
| @@ -4518,19 +4474,18 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4518 | } | 4474 | } |
| 4519 | } | 4475 | } |
| 4520 | 4476 | ||
| 4521 | GCPRO4 (overlay, arg1, arg2, arg3); | ||
| 4522 | { | 4477 | { |
| 4523 | /* Call the functions recorded in last_overlay_modification_hooks. | 4478 | /* Call the functions recorded in last_overlay_modification_hooks. |
| 4524 | First copy the vector contents, in case some of these hooks | 4479 | First copy the vector contents, in case some of these hooks |
| 4525 | do subsequent modification of the buffer. */ | 4480 | do subsequent modification of the buffer. */ |
| 4526 | ptrdiff_t size = last_overlay_modification_hooks_used; | 4481 | ptrdiff_t size = last_overlay_modification_hooks_used; |
| 4527 | Lisp_Object *copy = alloca (size * sizeof *copy); | 4482 | Lisp_Object *copy; |
| 4528 | ptrdiff_t i; | 4483 | ptrdiff_t i; |
| 4529 | 4484 | ||
| 4485 | USE_SAFE_ALLOCA; | ||
| 4486 | SAFE_ALLOCA_LISP (copy, size); | ||
| 4530 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, | 4487 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |
| 4531 | size * word_size); | 4488 | size * word_size); |
| 4532 | gcpro1.var = copy; | ||
| 4533 | gcpro1.nvars = size; | ||
| 4534 | 4489 | ||
| 4535 | for (i = 0; i < size;) | 4490 | for (i = 0; i < size;) |
| 4536 | { | 4491 | { |
| @@ -4539,18 +4494,15 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4539 | overlay_i = copy[i++]; | 4494 | overlay_i = copy[i++]; |
| 4540 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); | 4495 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); |
| 4541 | } | 4496 | } |
| 4497 | |||
| 4498 | SAFE_FREE (); | ||
| 4542 | } | 4499 | } |
| 4543 | UNGCPRO; | ||
| 4544 | } | 4500 | } |
| 4545 | 4501 | ||
| 4546 | static void | 4502 | static void |
| 4547 | call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after, | 4503 | call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after, |
| 4548 | Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | 4504 | Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| 4549 | { | 4505 | { |
| 4550 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | ||
| 4551 | |||
| 4552 | GCPRO4 (list, arg1, arg2, arg3); | ||
| 4553 | |||
| 4554 | while (CONSP (list)) | 4506 | while (CONSP (list)) |
| 4555 | { | 4507 | { |
| 4556 | if (NILP (arg3)) | 4508 | if (NILP (arg3)) |
| @@ -4559,7 +4511,6 @@ call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after, | |||
| 4559 | call5 (XCAR (list), overlay, after ? Qt : Qnil, arg1, arg2, arg3); | 4511 | call5 (XCAR (list), overlay, after ? Qt : Qnil, arg1, arg2, arg3); |
| 4560 | list = XCDR (list); | 4512 | list = XCDR (list); |
| 4561 | } | 4513 | } |
| 4562 | UNGCPRO; | ||
| 4563 | } | 4514 | } |
| 4564 | 4515 | ||
| 4565 | /* Delete any zero-sized overlays at position POS, if the `evaporate' | 4516 | /* Delete any zero-sized overlays at position POS, if the `evaporate' |
| @@ -4603,7 +4554,8 @@ evaporate_overlays (ptrdiff_t pos) | |||
| 4603 | Allocation with mmap | 4554 | Allocation with mmap |
| 4604 | ***********************************************************************/ | 4555 | ***********************************************************************/ |
| 4605 | 4556 | ||
| 4606 | #ifdef USE_MMAP_FOR_BUFFERS | 4557 | /* Note: WINDOWSNT implements this stuff on w32heap.c. */ |
| 4558 | #if defined USE_MMAP_FOR_BUFFERS && !defined WINDOWSNT | ||
| 4607 | 4559 | ||
| 4608 | #include <sys/mman.h> | 4560 | #include <sys/mman.h> |
| 4609 | 4561 | ||
| @@ -4623,8 +4575,6 @@ evaporate_overlays (ptrdiff_t pos) | |||
| 4623 | #include <fcntl.h> | 4575 | #include <fcntl.h> |
| 4624 | #endif | 4576 | #endif |
| 4625 | 4577 | ||
| 4626 | #include "coding.h" | ||
| 4627 | |||
| 4628 | 4578 | ||
| 4629 | /* Memory is allocated in regions which are mapped using mmap(2). | 4579 | /* Memory is allocated in regions which are mapped using mmap(2). |
| 4630 | The current implementation lets the system select mapped | 4580 | The current implementation lets the system select mapped |
| @@ -4669,11 +4619,6 @@ static struct mmap_region *mmap_regions; | |||
| 4669 | 4619 | ||
| 4670 | static int mmap_fd; | 4620 | static int mmap_fd; |
| 4671 | 4621 | ||
| 4672 | /* Temporary storage for mmap_set_vars, see there. */ | ||
| 4673 | |||
| 4674 | static struct mmap_region *mmap_regions_1; | ||
| 4675 | static int mmap_fd_1; | ||
| 4676 | |||
| 4677 | /* Page size on this system. */ | 4622 | /* Page size on this system. */ |
| 4678 | 4623 | ||
| 4679 | static int mmap_page_size; | 4624 | static int mmap_page_size; |
| @@ -4745,36 +4690,6 @@ mmap_init (void) | |||
| 4745 | mmap_page_size = getpagesize (); | 4690 | mmap_page_size = getpagesize (); |
| 4746 | } | 4691 | } |
| 4747 | 4692 | ||
| 4748 | /* Return a region overlapping address range START...END, or null if | ||
| 4749 | none. END is not including, i.e. the last byte in the range | ||
| 4750 | is at END - 1. */ | ||
| 4751 | |||
| 4752 | static struct mmap_region * | ||
| 4753 | mmap_find (void *start, void *end) | ||
| 4754 | { | ||
| 4755 | struct mmap_region *r; | ||
| 4756 | char *s = start, *e = end; | ||
| 4757 | |||
| 4758 | for (r = mmap_regions; r; r = r->next) | ||
| 4759 | { | ||
| 4760 | char *rstart = (char *) r; | ||
| 4761 | char *rend = rstart + r->nbytes_mapped; | ||
| 4762 | |||
| 4763 | if (/* First byte of range, i.e. START, in this region? */ | ||
| 4764 | (s >= rstart && s < rend) | ||
| 4765 | /* Last byte of range, i.e. END - 1, in this region? */ | ||
| 4766 | || (e > rstart && e <= rend) | ||
| 4767 | /* First byte of this region in the range? */ | ||
| 4768 | || (rstart >= s && rstart < e) | ||
| 4769 | /* Last byte of this region in the range? */ | ||
| 4770 | || (rend > s && rend <= e)) | ||
| 4771 | break; | ||
| 4772 | } | ||
| 4773 | |||
| 4774 | return r; | ||
| 4775 | } | ||
| 4776 | |||
| 4777 | |||
| 4778 | /* Unmap a region. P is a pointer to the start of the user-araa of | 4693 | /* Unmap a region. P is a pointer to the start of the user-araa of |
| 4779 | the region. */ | 4694 | the region. */ |
| 4780 | 4695 | ||
| @@ -4851,38 +4766,6 @@ mmap_enlarge (struct mmap_region *r, int npages) | |||
| 4851 | } | 4766 | } |
| 4852 | 4767 | ||
| 4853 | 4768 | ||
| 4854 | /* Set or reset variables holding references to mapped regions. | ||
| 4855 | If not RESTORE_P, set all variables to null. If RESTORE_P, set all | ||
| 4856 | variables to the start of the user-areas of mapped regions. | ||
| 4857 | |||
| 4858 | This function is called from Fdump_emacs to ensure that the dumped | ||
| 4859 | Emacs doesn't contain references to memory that won't be mapped | ||
| 4860 | when Emacs starts. */ | ||
| 4861 | |||
| 4862 | void | ||
| 4863 | mmap_set_vars (bool restore_p) | ||
| 4864 | { | ||
| 4865 | struct mmap_region *r; | ||
| 4866 | |||
| 4867 | if (restore_p) | ||
| 4868 | { | ||
| 4869 | mmap_regions = mmap_regions_1; | ||
| 4870 | mmap_fd = mmap_fd_1; | ||
| 4871 | for (r = mmap_regions; r; r = r->next) | ||
| 4872 | *r->var = MMAP_USER_AREA (r); | ||
| 4873 | } | ||
| 4874 | else | ||
| 4875 | { | ||
| 4876 | for (r = mmap_regions; r; r = r->next) | ||
| 4877 | *r->var = NULL; | ||
| 4878 | mmap_regions_1 = mmap_regions; | ||
| 4879 | mmap_regions = NULL; | ||
| 4880 | mmap_fd_1 = mmap_fd; | ||
| 4881 | mmap_fd = -1; | ||
| 4882 | } | ||
| 4883 | } | ||
| 4884 | |||
| 4885 | |||
| 4886 | /* Allocate a block of storage large enough to hold NBYTES bytes of | 4769 | /* Allocate a block of storage large enough to hold NBYTES bytes of |
| 4887 | data. A pointer to the data is returned in *VAR. VAR is thus the | 4770 | data. A pointer to the data is returned in *VAR. VAR is thus the |
| 4888 | address of some variable which will use the data area. | 4771 | address of some variable which will use the data area. |
| @@ -5117,12 +5000,99 @@ init_buffer_once (void) | |||
| 5117 | 5000 | ||
| 5118 | memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); | 5001 | memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); |
| 5119 | 5002 | ||
| 5003 | /* 0 means not a lisp var, -1 means always local, else mask. */ | ||
| 5004 | memset (&buffer_local_flags, 0, sizeof buffer_local_flags); | ||
| 5005 | bset_filename (&buffer_local_flags, make_number (-1)); | ||
| 5006 | bset_directory (&buffer_local_flags, make_number (-1)); | ||
| 5007 | bset_backed_up (&buffer_local_flags, make_number (-1)); | ||
| 5008 | bset_save_length (&buffer_local_flags, make_number (-1)); | ||
| 5009 | bset_auto_save_file_name (&buffer_local_flags, make_number (-1)); | ||
| 5010 | bset_read_only (&buffer_local_flags, make_number (-1)); | ||
| 5011 | bset_major_mode (&buffer_local_flags, make_number (-1)); | ||
| 5012 | bset_mode_name (&buffer_local_flags, make_number (-1)); | ||
| 5013 | bset_undo_list (&buffer_local_flags, make_number (-1)); | ||
| 5014 | bset_mark_active (&buffer_local_flags, make_number (-1)); | ||
| 5015 | bset_point_before_scroll (&buffer_local_flags, make_number (-1)); | ||
| 5016 | bset_file_truename (&buffer_local_flags, make_number (-1)); | ||
| 5017 | bset_invisibility_spec (&buffer_local_flags, make_number (-1)); | ||
| 5018 | bset_file_format (&buffer_local_flags, make_number (-1)); | ||
| 5019 | bset_auto_save_file_format (&buffer_local_flags, make_number (-1)); | ||
| 5020 | bset_display_count (&buffer_local_flags, make_number (-1)); | ||
| 5021 | bset_display_time (&buffer_local_flags, make_number (-1)); | ||
| 5022 | bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1)); | ||
| 5023 | |||
| 5024 | /* These used to be stuck at 0 by default, but now that the all-zero value | ||
| 5025 | means Qnil, we have to initialize them explicitly. */ | ||
| 5026 | bset_name (&buffer_local_flags, make_number (0)); | ||
| 5027 | bset_mark (&buffer_local_flags, make_number (0)); | ||
| 5028 | bset_local_var_alist (&buffer_local_flags, make_number (0)); | ||
| 5029 | bset_keymap (&buffer_local_flags, make_number (0)); | ||
| 5030 | bset_downcase_table (&buffer_local_flags, make_number (0)); | ||
| 5031 | bset_upcase_table (&buffer_local_flags, make_number (0)); | ||
| 5032 | bset_case_canon_table (&buffer_local_flags, make_number (0)); | ||
| 5033 | bset_case_eqv_table (&buffer_local_flags, make_number (0)); | ||
| 5034 | bset_minor_modes (&buffer_local_flags, make_number (0)); | ||
| 5035 | bset_width_table (&buffer_local_flags, make_number (0)); | ||
| 5036 | bset_pt_marker (&buffer_local_flags, make_number (0)); | ||
| 5037 | bset_begv_marker (&buffer_local_flags, make_number (0)); | ||
| 5038 | bset_zv_marker (&buffer_local_flags, make_number (0)); | ||
| 5039 | bset_last_selected_window (&buffer_local_flags, make_number (0)); | ||
| 5040 | |||
| 5041 | idx = 1; | ||
| 5042 | XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; | ||
| 5043 | XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; | ||
| 5044 | XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; | ||
| 5045 | XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; | ||
| 5046 | XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; | ||
| 5047 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; | ||
| 5048 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; | ||
| 5049 | XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; | ||
| 5050 | XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; | ||
| 5051 | XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; | ||
| 5052 | XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx; | ||
| 5053 | XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx; | ||
| 5054 | XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; | ||
| 5055 | XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; | ||
| 5056 | XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; | ||
| 5057 | XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; | ||
| 5058 | XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx; | ||
| 5059 | XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; | ||
| 5060 | XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; | ||
| 5061 | XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; | ||
| 5062 | XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx); | ||
| 5063 | /* Make this one a permanent local. */ | ||
| 5064 | buffer_permanent_local_flags[idx++] = 1; | ||
| 5065 | XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx; | ||
| 5066 | XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx; | ||
| 5067 | XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx; | ||
| 5068 | XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; | ||
| 5069 | XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; | ||
| 5070 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; | ||
| 5071 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_height), idx); ++idx; | ||
| 5072 | XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; | ||
| 5073 | XSETFASTINT (BVAR (&buffer_local_flags, horizontal_scroll_bar_type), idx); ++idx; | ||
| 5074 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; | ||
| 5075 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; | ||
| 5076 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; | ||
| 5077 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; | ||
| 5078 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; | ||
| 5079 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; | ||
| 5080 | XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; | ||
| 5081 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; | ||
| 5082 | XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; | ||
| 5083 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; | ||
| 5084 | |||
| 5085 | /* Need more room? */ | ||
| 5086 | if (idx >= MAX_PER_BUFFER_VARS) | ||
| 5087 | emacs_abort (); | ||
| 5088 | last_per_buffer_idx = idx; | ||
| 5089 | |||
| 5120 | /* Make sure all markable slots in buffer_defaults | 5090 | /* Make sure all markable slots in buffer_defaults |
| 5121 | are initialized reasonably, so mark_buffer won't choke. */ | 5091 | are initialized reasonably, so mark_buffer won't choke. */ |
| 5122 | reset_buffer (&buffer_defaults); | 5092 | reset_buffer (&buffer_defaults); |
| 5123 | eassert (EQ (BVAR (&buffer_defaults, name), make_number (0))); | 5093 | eassert (NILP (BVAR (&buffer_defaults, name))); |
| 5124 | reset_buffer_local_variables (&buffer_defaults, 1); | 5094 | reset_buffer_local_variables (&buffer_defaults, 1); |
| 5125 | eassert (EQ (BVAR (&buffer_local_symbols, name), make_number (0))); | 5095 | eassert (NILP (BVAR (&buffer_local_symbols, name))); |
| 5126 | reset_buffer (&buffer_local_symbols); | 5096 | reset_buffer (&buffer_local_symbols); |
| 5127 | reset_buffer_local_variables (&buffer_local_symbols, 1); | 5097 | reset_buffer_local_variables (&buffer_local_symbols, 1); |
| 5128 | /* Prevent GC from getting confused. */ | 5098 | /* Prevent GC from getting confused. */ |
| @@ -5178,7 +5148,7 @@ init_buffer_once (void) | |||
| 5178 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); | 5148 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); |
| 5179 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); | 5149 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); |
| 5180 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); | 5150 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); |
| 5181 | bset_cache_long_scans (&buffer_defaults, Qnil); | 5151 | bset_cache_long_scans (&buffer_defaults, Qt); |
| 5182 | bset_file_truename (&buffer_defaults, Qnil); | 5152 | bset_file_truename (&buffer_defaults, Qnil); |
| 5183 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); | 5153 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); |
| 5184 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); | 5154 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); |
| @@ -5187,7 +5157,9 @@ init_buffer_once (void) | |||
| 5187 | bset_right_fringe_width (&buffer_defaults, Qnil); | 5157 | bset_right_fringe_width (&buffer_defaults, Qnil); |
| 5188 | bset_fringes_outside_margins (&buffer_defaults, Qnil); | 5158 | bset_fringes_outside_margins (&buffer_defaults, Qnil); |
| 5189 | bset_scroll_bar_width (&buffer_defaults, Qnil); | 5159 | bset_scroll_bar_width (&buffer_defaults, Qnil); |
| 5160 | bset_scroll_bar_height (&buffer_defaults, Qnil); | ||
| 5190 | bset_vertical_scroll_bar_type (&buffer_defaults, Qt); | 5161 | bset_vertical_scroll_bar_type (&buffer_defaults, Qt); |
| 5162 | bset_horizontal_scroll_bar_type (&buffer_defaults, Qt); | ||
| 5191 | bset_indicate_empty_lines (&buffer_defaults, Qnil); | 5163 | bset_indicate_empty_lines (&buffer_defaults, Qnil); |
| 5192 | bset_indicate_buffer_boundaries (&buffer_defaults, Qnil); | 5164 | bset_indicate_buffer_boundaries (&buffer_defaults, Qnil); |
| 5193 | bset_fringe_indicator_alist (&buffer_defaults, Qnil); | 5165 | bset_fringe_indicator_alist (&buffer_defaults, Qnil); |
| @@ -5201,96 +5173,26 @@ init_buffer_once (void) | |||
| 5201 | to say that it has its own local value for the slot. | 5173 | to say that it has its own local value for the slot. |
| 5202 | The local flag bits are in the local_var_flags slot of the buffer. */ | 5174 | The local flag bits are in the local_var_flags slot of the buffer. */ |
| 5203 | 5175 | ||
| 5204 | /* Nothing can work if this isn't true */ | 5176 | /* Nothing can work if this isn't true. */ |
| 5205 | { verify (sizeof (EMACS_INT) == word_size); } | 5177 | { verify (sizeof (EMACS_INT) == word_size); } |
| 5206 | 5178 | ||
| 5207 | /* 0 means not a lisp var, -1 means always local, else mask */ | ||
| 5208 | memset (&buffer_local_flags, 0, sizeof buffer_local_flags); | ||
| 5209 | bset_filename (&buffer_local_flags, make_number (-1)); | ||
| 5210 | bset_directory (&buffer_local_flags, make_number (-1)); | ||
| 5211 | bset_backed_up (&buffer_local_flags, make_number (-1)); | ||
| 5212 | bset_save_length (&buffer_local_flags, make_number (-1)); | ||
| 5213 | bset_auto_save_file_name (&buffer_local_flags, make_number (-1)); | ||
| 5214 | bset_read_only (&buffer_local_flags, make_number (-1)); | ||
| 5215 | bset_major_mode (&buffer_local_flags, make_number (-1)); | ||
| 5216 | bset_mode_name (&buffer_local_flags, make_number (-1)); | ||
| 5217 | bset_undo_list (&buffer_local_flags, make_number (-1)); | ||
| 5218 | bset_mark_active (&buffer_local_flags, make_number (-1)); | ||
| 5219 | bset_point_before_scroll (&buffer_local_flags, make_number (-1)); | ||
| 5220 | bset_file_truename (&buffer_local_flags, make_number (-1)); | ||
| 5221 | bset_invisibility_spec (&buffer_local_flags, make_number (-1)); | ||
| 5222 | bset_file_format (&buffer_local_flags, make_number (-1)); | ||
| 5223 | bset_auto_save_file_format (&buffer_local_flags, make_number (-1)); | ||
| 5224 | bset_display_count (&buffer_local_flags, make_number (-1)); | ||
| 5225 | bset_display_time (&buffer_local_flags, make_number (-1)); | ||
| 5226 | bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1)); | ||
| 5227 | |||
| 5228 | idx = 1; | ||
| 5229 | XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; | ||
| 5230 | XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; | ||
| 5231 | XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; | ||
| 5232 | XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; | ||
| 5233 | XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; | ||
| 5234 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; | ||
| 5235 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; | ||
| 5236 | XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; | ||
| 5237 | XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; | ||
| 5238 | XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; | ||
| 5239 | XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx; | ||
| 5240 | XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx; | ||
| 5241 | XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; | ||
| 5242 | XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; | ||
| 5243 | XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; | ||
| 5244 | XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; | ||
| 5245 | XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx; | ||
| 5246 | XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; | ||
| 5247 | XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; | ||
| 5248 | XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; | ||
| 5249 | XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx); | ||
| 5250 | /* Make this one a permanent local. */ | ||
| 5251 | buffer_permanent_local_flags[idx++] = 1; | ||
| 5252 | XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx; | ||
| 5253 | XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx; | ||
| 5254 | XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx; | ||
| 5255 | XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx; | ||
| 5256 | XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx; | ||
| 5257 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx; | ||
| 5258 | XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx; | ||
| 5259 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx; | ||
| 5260 | XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx; | ||
| 5261 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx; | ||
| 5262 | XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx; | ||
| 5263 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; | ||
| 5264 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; | ||
| 5265 | XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; | ||
| 5266 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; | ||
| 5267 | XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; | ||
| 5268 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; | ||
| 5269 | |||
| 5270 | /* Need more room? */ | ||
| 5271 | if (idx >= MAX_PER_BUFFER_VARS) | ||
| 5272 | emacs_abort (); | ||
| 5273 | last_per_buffer_idx = idx; | ||
| 5274 | |||
| 5275 | Vbuffer_alist = Qnil; | 5179 | Vbuffer_alist = Qnil; |
| 5276 | current_buffer = 0; | 5180 | current_buffer = 0; |
| 5277 | all_buffers = 0; | 5181 | all_buffers = 0; |
| 5278 | 5182 | ||
| 5279 | QSFundamental = build_pure_c_string ("Fundamental"); | 5183 | QSFundamental = build_pure_c_string ("Fundamental"); |
| 5280 | 5184 | ||
| 5281 | Qfundamental_mode = intern_c_string ("fundamental-mode"); | 5185 | DEFSYM (Qfundamental_mode, "fundamental-mode"); |
| 5282 | bset_major_mode (&buffer_defaults, Qfundamental_mode); | 5186 | bset_major_mode (&buffer_defaults, Qfundamental_mode); |
| 5283 | 5187 | ||
| 5284 | Qmode_class = intern_c_string ("mode-class"); | 5188 | DEFSYM (Qmode_class, "mode-class"); |
| 5285 | 5189 | DEFSYM (Qprotected_field, "protected-field"); | |
| 5286 | Qprotected_field = intern_c_string ("protected-field"); | ||
| 5287 | |||
| 5288 | Qpermanent_local = intern_c_string ("permanent-local"); | ||
| 5289 | 5190 | ||
| 5290 | Qkill_buffer_hook = intern_c_string ("kill-buffer-hook"); | 5191 | DEFSYM (Qpermanent_local, "permanent-local"); |
| 5192 | DEFSYM (Qkill_buffer_hook, "kill-buffer-hook"); | ||
| 5291 | Fput (Qkill_buffer_hook, Qpermanent_local, Qt); | 5193 | Fput (Qkill_buffer_hook, Qpermanent_local, Qt); |
| 5292 | 5194 | ||
| 5293 | /* super-magic invisible buffer */ | 5195 | /* Super-magic invisible buffer. */ |
| 5294 | Vprin1_to_string_buffer = Fget_buffer_create (build_pure_c_string (" prin1")); | 5196 | Vprin1_to_string_buffer = Fget_buffer_create (build_pure_c_string (" prin1")); |
| 5295 | Vbuffer_alist = Qnil; | 5197 | Vbuffer_alist = Qnil; |
| 5296 | 5198 | ||
| @@ -5300,68 +5202,109 @@ init_buffer_once (void) | |||
| 5300 | } | 5202 | } |
| 5301 | 5203 | ||
| 5302 | void | 5204 | void |
| 5303 | init_buffer (void) | 5205 | init_buffer (int initialized) |
| 5304 | { | 5206 | { |
| 5305 | char *pwd; | 5207 | char *pwd; |
| 5306 | Lisp_Object temp; | 5208 | Lisp_Object temp; |
| 5307 | ptrdiff_t len; | 5209 | ptrdiff_t len; |
| 5308 | 5210 | ||
| 5309 | #ifdef USE_MMAP_FOR_BUFFERS | 5211 | #ifdef USE_MMAP_FOR_BUFFERS |
| 5310 | { | 5212 | if (initialized) |
| 5311 | /* When using the ralloc implementation based on mmap(2), buffer | 5213 | { |
| 5312 | text pointers will have been set to null in the dumped Emacs. | 5214 | struct buffer *b; |
| 5313 | Map new memory. */ | 5215 | |
| 5314 | struct buffer *b; | 5216 | #ifndef WINDOWSNT |
| 5315 | 5217 | /* These must be reset in the dumped Emacs, to avoid stale | |
| 5316 | FOR_EACH_BUFFER (b) | 5218 | references to mmap'ed memory from before the dump. |
| 5317 | if (b->text->beg == NULL) | 5219 | |
| 5318 | enlarge_buffer_text (b, 0); | 5220 | WINDOWSNT doesn't need this because it doesn't track mmap'ed |
| 5319 | } | 5221 | regions by hand (see w32heap.c, which uses system APIs for |
| 5222 | that purpose), and thus doesn't use mmap_regions. */ | ||
| 5223 | mmap_regions = NULL; | ||
| 5224 | mmap_fd = -1; | ||
| 5225 | #endif | ||
| 5226 | |||
| 5227 | /* The dumped buffers reference addresses of buffer text | ||
| 5228 | recorded by temacs, that cannot be used by the dumped Emacs. | ||
| 5229 | We map new memory for their text here. | ||
| 5230 | |||
| 5231 | Implementation note: the buffers we carry from temacs are: | ||
| 5232 | " prin1", "*scratch*", " *Minibuf-0*", "*Messages*", and | ||
| 5233 | " *code-conversion-work*". They are created by | ||
| 5234 | init_buffer_once and init_window_once (which are not called | ||
| 5235 | in the dumped Emacs), and by the first call to coding.c routines. */ | ||
| 5236 | FOR_EACH_BUFFER (b) | ||
| 5237 | { | ||
| 5238 | b->text->beg = NULL; | ||
| 5239 | enlarge_buffer_text (b, 0); | ||
| 5240 | } | ||
| 5241 | } | ||
| 5242 | else | ||
| 5243 | { | ||
| 5244 | struct buffer *b; | ||
| 5245 | |||
| 5246 | /* Only buffers with allocated buffer text should be present at | ||
| 5247 | this point in temacs. */ | ||
| 5248 | FOR_EACH_BUFFER (b) | ||
| 5249 | { | ||
| 5250 | eassert (b->text->beg != NULL); | ||
| 5251 | } | ||
| 5252 | } | ||
| 5253 | #else /* not USE_MMAP_FOR_BUFFERS */ | ||
| 5254 | /* Avoid compiler warnings. */ | ||
| 5255 | (void) initialized; | ||
| 5320 | #endif /* USE_MMAP_FOR_BUFFERS */ | 5256 | #endif /* USE_MMAP_FOR_BUFFERS */ |
| 5321 | 5257 | ||
| 5322 | Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); | 5258 | AUTO_STRING (scratch, "*scratch*"); |
| 5259 | Fset_buffer (Fget_buffer_create (scratch)); | ||
| 5323 | if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) | 5260 | if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) |
| 5324 | Fset_buffer_multibyte (Qnil); | 5261 | Fset_buffer_multibyte (Qnil); |
| 5325 | 5262 | ||
| 5326 | pwd = get_current_dir_name (); | 5263 | pwd = get_current_dir_name (); |
| 5327 | 5264 | ||
| 5328 | if (!pwd) | 5265 | if (!pwd) |
| 5329 | fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); | ||
| 5330 | |||
| 5331 | /* Maybe this should really use some standard subroutine | ||
| 5332 | whose definition is filename syntax dependent. */ | ||
| 5333 | len = strlen (pwd); | ||
| 5334 | if (!(IS_DIRECTORY_SEP (pwd[len - 1]))) | ||
| 5335 | { | 5266 | { |
| 5336 | /* Grow buffer to add directory separator and '\0'. */ | 5267 | fprintf (stderr, "Error getting directory: %s\n", |
| 5337 | pwd = realloc (pwd, len + 2); | 5268 | emacs_strerror (errno)); |
| 5338 | if (!pwd) | 5269 | bset_directory (current_buffer, Qnil); |
| 5339 | fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); | 5270 | } |
| 5340 | pwd[len] = DIRECTORY_SEP; | 5271 | else |
| 5341 | pwd[len + 1] = '\0'; | 5272 | { |
| 5342 | len++; | 5273 | /* Maybe this should really use some standard subroutine |
| 5274 | whose definition is filename syntax dependent. */ | ||
| 5275 | len = strlen (pwd); | ||
| 5276 | if (!(IS_DIRECTORY_SEP (pwd[len - 1]))) | ||
| 5277 | { | ||
| 5278 | /* Grow buffer to add directory separator and '\0'. */ | ||
| 5279 | pwd = realloc (pwd, len + 2); | ||
| 5280 | if (!pwd) | ||
| 5281 | fatal ("get_current_dir_name: %s\n", strerror (errno)); | ||
| 5282 | pwd[len] = DIRECTORY_SEP; | ||
| 5283 | pwd[len + 1] = '\0'; | ||
| 5284 | len++; | ||
| 5285 | } | ||
| 5286 | |||
| 5287 | /* At this moment, we still don't know how to decode the directory | ||
| 5288 | name. So, we keep the bytes in unibyte form so that file I/O | ||
| 5289 | routines correctly get the original bytes. */ | ||
| 5290 | bset_directory (current_buffer, make_unibyte_string (pwd, len)); | ||
| 5291 | |||
| 5292 | /* Add /: to the front of the name | ||
| 5293 | if it would otherwise be treated as magic. */ | ||
| 5294 | temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt); | ||
| 5295 | if (! NILP (temp) | ||
| 5296 | /* If the default dir is just /, TEMP is non-nil | ||
| 5297 | because of the ange-ftp completion handler. | ||
| 5298 | However, it is not necessary to turn / into /:/. | ||
| 5299 | So avoid doing that. */ | ||
| 5300 | && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) | ||
| 5301 | { | ||
| 5302 | AUTO_STRING (slash_colon, "/:"); | ||
| 5303 | bset_directory (current_buffer, | ||
| 5304 | concat2 (slash_colon, | ||
| 5305 | BVAR (current_buffer, directory))); | ||
| 5306 | } | ||
| 5343 | } | 5307 | } |
| 5344 | |||
| 5345 | bset_directory (current_buffer, make_unibyte_string (pwd, len)); | ||
| 5346 | if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) | ||
| 5347 | /* At this moment, we still don't know how to decode the | ||
| 5348 | directory name. So, we keep the bytes in multibyte form so | ||
| 5349 | that ENCODE_FILE correctly gets the original bytes. */ | ||
| 5350 | bset_directory | ||
| 5351 | (current_buffer, string_to_multibyte (BVAR (current_buffer, directory))); | ||
| 5352 | |||
| 5353 | /* Add /: to the front of the name | ||
| 5354 | if it would otherwise be treated as magic. */ | ||
| 5355 | temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt); | ||
| 5356 | if (! NILP (temp) | ||
| 5357 | /* If the default dir is just /, TEMP is non-nil | ||
| 5358 | because of the ange-ftp completion handler. | ||
| 5359 | However, it is not necessary to turn / into /:/. | ||
| 5360 | So avoid doing that. */ | ||
| 5361 | && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) | ||
| 5362 | bset_directory | ||
| 5363 | (current_buffer, | ||
| 5364 | concat2 (build_string ("/:"), BVAR (current_buffer, directory))); | ||
| 5365 | 5308 | ||
| 5366 | temp = get_minibuffer (0); | 5309 | temp = get_minibuffer (0); |
| 5367 | bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); | 5310 | bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); |
| @@ -5403,12 +5346,12 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | |||
| 5403 | 5346 | ||
| 5404 | if (PER_BUFFER_IDX (offset) == 0) | 5347 | if (PER_BUFFER_IDX (offset) == 0) |
| 5405 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding | 5348 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding |
| 5406 | slot of buffer_local_flags */ | 5349 | slot of buffer_local_flags. */ |
| 5407 | emacs_abort (); | 5350 | emacs_abort (); |
| 5408 | } | 5351 | } |
| 5409 | 5352 | ||
| 5410 | 5353 | ||
| 5411 | /* initialize the buffer routines */ | 5354 | /* Initialize the buffer routines. */ |
| 5412 | void | 5355 | void |
| 5413 | syms_of_buffer (void) | 5356 | syms_of_buffer (void) |
| 5414 | { | 5357 | { |
| @@ -5416,13 +5359,13 @@ syms_of_buffer (void) | |||
| 5416 | last_overlay_modification_hooks | 5359 | last_overlay_modification_hooks |
| 5417 | = Fmake_vector (make_number (10), Qnil); | 5360 | = Fmake_vector (make_number (10), Qnil); |
| 5418 | 5361 | ||
| 5419 | staticpro (&Qfundamental_mode); | ||
| 5420 | staticpro (&Qmode_class); | ||
| 5421 | staticpro (&QSFundamental); | 5362 | staticpro (&QSFundamental); |
| 5422 | staticpro (&Vbuffer_alist); | 5363 | staticpro (&Vbuffer_alist); |
| 5423 | staticpro (&Qprotected_field); | 5364 | |
| 5424 | staticpro (&Qpermanent_local); | 5365 | DEFSYM (Qchoice, "choice"); |
| 5425 | staticpro (&Qkill_buffer_hook); | 5366 | DEFSYM (Qleft, "left"); |
| 5367 | DEFSYM (Qright, "right"); | ||
| 5368 | DEFSYM (Qrange, "range"); | ||
| 5426 | 5369 | ||
| 5427 | DEFSYM (Qpermanent_local_hook, "permanent-local-hook"); | 5370 | DEFSYM (Qpermanent_local_hook, "permanent-local-hook"); |
| 5428 | DEFSYM (Qoverlayp, "overlayp"); | 5371 | DEFSYM (Qoverlayp, "overlayp"); |
| @@ -5439,6 +5382,18 @@ syms_of_buffer (void) | |||
| 5439 | DEFSYM (Qafter_change_functions, "after-change-functions"); | 5382 | DEFSYM (Qafter_change_functions, "after-change-functions"); |
| 5440 | DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); | 5383 | DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions"); |
| 5441 | 5384 | ||
| 5385 | DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar"); | ||
| 5386 | Fput (Qvertical_scroll_bar, Qchoice, list4 (Qnil, Qt, Qleft, Qright)); | ||
| 5387 | DEFSYM (Qhorizontal_scroll_bar, "horizontal-scroll-bar"); | ||
| 5388 | |||
| 5389 | DEFSYM (Qfraction, "fraction"); | ||
| 5390 | Fput (Qfraction, Qrange, Fcons (make_float (0.0), make_float (1.0))); | ||
| 5391 | |||
| 5392 | DEFSYM (Qoverwrite_mode, "overwrite-mode"); | ||
| 5393 | Fput (Qoverwrite_mode, Qchoice, | ||
| 5394 | list3 (Qnil, intern ("overwrite-mode-textual"), | ||
| 5395 | Qoverwrite_mode_binary)); | ||
| 5396 | |||
| 5442 | Fput (Qprotected_field, Qerror_conditions, | 5397 | Fput (Qprotected_field, Qerror_conditions, |
| 5443 | listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); | 5398 | listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); |
| 5444 | Fput (Qprotected_field, Qerror_message, | 5399 | Fput (Qprotected_field, Qerror_message, |
| @@ -5447,140 +5402,140 @@ syms_of_buffer (void) | |||
| 5447 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", | 5402 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", |
| 5448 | mode_line_format, | 5403 | mode_line_format, |
| 5449 | doc: /* Default value of `mode-line-format' for buffers that don't override it. | 5404 | doc: /* Default value of `mode-line-format' for buffers that don't override it. |
| 5450 | This is the same as (default-value 'mode-line-format). */); | 5405 | This is the same as (default-value \\='mode-line-format). */); |
| 5451 | 5406 | ||
| 5452 | DEFVAR_BUFFER_DEFAULTS ("default-header-line-format", | 5407 | DEFVAR_BUFFER_DEFAULTS ("default-header-line-format", |
| 5453 | header_line_format, | 5408 | header_line_format, |
| 5454 | doc: /* Default value of `header-line-format' for buffers that don't override it. | 5409 | doc: /* Default value of `header-line-format' for buffers that don't override it. |
| 5455 | This is the same as (default-value 'header-line-format). */); | 5410 | This is the same as (default-value \\='header-line-format). */); |
| 5456 | 5411 | ||
| 5457 | DEFVAR_BUFFER_DEFAULTS ("default-cursor-type", cursor_type, | 5412 | DEFVAR_BUFFER_DEFAULTS ("default-cursor-type", cursor_type, |
| 5458 | doc: /* Default value of `cursor-type' for buffers that don't override it. | 5413 | doc: /* Default value of `cursor-type' for buffers that don't override it. |
| 5459 | This is the same as (default-value 'cursor-type). */); | 5414 | This is the same as (default-value \\='cursor-type). */); |
| 5460 | 5415 | ||
| 5461 | DEFVAR_BUFFER_DEFAULTS ("default-line-spacing", | 5416 | DEFVAR_BUFFER_DEFAULTS ("default-line-spacing", |
| 5462 | extra_line_spacing, | 5417 | extra_line_spacing, |
| 5463 | doc: /* Default value of `line-spacing' for buffers that don't override it. | 5418 | doc: /* Default value of `line-spacing' for buffers that don't override it. |
| 5464 | This is the same as (default-value 'line-spacing). */); | 5419 | This is the same as (default-value \\='line-spacing). */); |
| 5465 | 5420 | ||
| 5466 | DEFVAR_BUFFER_DEFAULTS ("default-cursor-in-non-selected-windows", | 5421 | DEFVAR_BUFFER_DEFAULTS ("default-cursor-in-non-selected-windows", |
| 5467 | cursor_in_non_selected_windows, | 5422 | cursor_in_non_selected_windows, |
| 5468 | doc: /* Default value of `cursor-in-non-selected-windows'. | 5423 | doc: /* Default value of `cursor-in-non-selected-windows'. |
| 5469 | This is the same as (default-value 'cursor-in-non-selected-windows). */); | 5424 | This is the same as (default-value \\='cursor-in-non-selected-windows). */); |
| 5470 | 5425 | ||
| 5471 | DEFVAR_BUFFER_DEFAULTS ("default-abbrev-mode", | 5426 | DEFVAR_BUFFER_DEFAULTS ("default-abbrev-mode", |
| 5472 | abbrev_mode, | 5427 | abbrev_mode, |
| 5473 | doc: /* Default value of `abbrev-mode' for buffers that do not override it. | 5428 | doc: /* Default value of `abbrev-mode' for buffers that do not override it. |
| 5474 | This is the same as (default-value 'abbrev-mode). */); | 5429 | This is the same as (default-value \\='abbrev-mode). */); |
| 5475 | 5430 | ||
| 5476 | DEFVAR_BUFFER_DEFAULTS ("default-ctl-arrow", | 5431 | DEFVAR_BUFFER_DEFAULTS ("default-ctl-arrow", |
| 5477 | ctl_arrow, | 5432 | ctl_arrow, |
| 5478 | doc: /* Default value of `ctl-arrow' for buffers that do not override it. | 5433 | doc: /* Default value of `ctl-arrow' for buffers that do not override it. |
| 5479 | This is the same as (default-value 'ctl-arrow). */); | 5434 | This is the same as (default-value \\='ctl-arrow). */); |
| 5480 | 5435 | ||
| 5481 | DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters", | 5436 | DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters", |
| 5482 | enable_multibyte_characters, | 5437 | enable_multibyte_characters, |
| 5483 | doc: /* Default value of `enable-multibyte-characters' for buffers not overriding it. | 5438 | doc: /* Default value of `enable-multibyte-characters' for buffers not overriding it. |
| 5484 | This is the same as (default-value 'enable-multibyte-characters). */); | 5439 | This is the same as (default-value \\='enable-multibyte-characters). */); |
| 5485 | 5440 | ||
| 5486 | DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system", | 5441 | DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system", |
| 5487 | buffer_file_coding_system, | 5442 | buffer_file_coding_system, |
| 5488 | doc: /* Default value of `buffer-file-coding-system' for buffers not overriding it. | 5443 | doc: /* Default value of `buffer-file-coding-system' for buffers not overriding it. |
| 5489 | This is the same as (default-value 'buffer-file-coding-system). */); | 5444 | This is the same as (default-value \\='buffer-file-coding-system). */); |
| 5490 | 5445 | ||
| 5491 | DEFVAR_BUFFER_DEFAULTS ("default-truncate-lines", | 5446 | DEFVAR_BUFFER_DEFAULTS ("default-truncate-lines", |
| 5492 | truncate_lines, | 5447 | truncate_lines, |
| 5493 | doc: /* Default value of `truncate-lines' for buffers that do not override it. | 5448 | doc: /* Default value of `truncate-lines' for buffers that do not override it. |
| 5494 | This is the same as (default-value 'truncate-lines). */); | 5449 | This is the same as (default-value \\='truncate-lines). */); |
| 5495 | 5450 | ||
| 5496 | DEFVAR_BUFFER_DEFAULTS ("default-fill-column", | 5451 | DEFVAR_BUFFER_DEFAULTS ("default-fill-column", |
| 5497 | fill_column, | 5452 | fill_column, |
| 5498 | doc: /* Default value of `fill-column' for buffers that do not override it. | 5453 | doc: /* Default value of `fill-column' for buffers that do not override it. |
| 5499 | This is the same as (default-value 'fill-column). */); | 5454 | This is the same as (default-value \\='fill-column). */); |
| 5500 | 5455 | ||
| 5501 | DEFVAR_BUFFER_DEFAULTS ("default-left-margin", | 5456 | DEFVAR_BUFFER_DEFAULTS ("default-left-margin", |
| 5502 | left_margin, | 5457 | left_margin, |
| 5503 | doc: /* Default value of `left-margin' for buffers that do not override it. | 5458 | doc: /* Default value of `left-margin' for buffers that do not override it. |
| 5504 | This is the same as (default-value 'left-margin). */); | 5459 | This is the same as (default-value \\='left-margin). */); |
| 5505 | 5460 | ||
| 5506 | DEFVAR_BUFFER_DEFAULTS ("default-tab-width", | 5461 | DEFVAR_BUFFER_DEFAULTS ("default-tab-width", |
| 5507 | tab_width, | 5462 | tab_width, |
| 5508 | doc: /* Default value of `tab-width' for buffers that do not override it. | 5463 | doc: /* Default value of `tab-width' for buffers that do not override it. |
| 5509 | NOTE: This controls the display width of a TAB character, and not | 5464 | NOTE: This controls the display width of a TAB character, and not |
| 5510 | the size of an indentation step. | 5465 | the size of an indentation step. |
| 5511 | This is the same as (default-value 'tab-width). */); | 5466 | This is the same as (default-value \\='tab-width). */); |
| 5512 | 5467 | ||
| 5513 | DEFVAR_BUFFER_DEFAULTS ("default-case-fold-search", | 5468 | DEFVAR_BUFFER_DEFAULTS ("default-case-fold-search", |
| 5514 | case_fold_search, | 5469 | case_fold_search, |
| 5515 | doc: /* Default value of `case-fold-search' for buffers that don't override it. | 5470 | doc: /* Default value of `case-fold-search' for buffers that don't override it. |
| 5516 | This is the same as (default-value 'case-fold-search). */); | 5471 | This is the same as (default-value \\='case-fold-search). */); |
| 5517 | 5472 | ||
| 5518 | DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", | 5473 | DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", |
| 5519 | left_margin_cols, | 5474 | left_margin_cols, |
| 5520 | doc: /* Default value of `left-margin-width' for buffers that don't override it. | 5475 | doc: /* Default value of `left-margin-width' for buffers that don't override it. |
| 5521 | This is the same as (default-value 'left-margin-width). */); | 5476 | This is the same as (default-value \\='left-margin-width). */); |
| 5522 | 5477 | ||
| 5523 | DEFVAR_BUFFER_DEFAULTS ("default-right-margin-width", | 5478 | DEFVAR_BUFFER_DEFAULTS ("default-right-margin-width", |
| 5524 | right_margin_cols, | 5479 | right_margin_cols, |
| 5525 | doc: /* Default value of `right-margin-width' for buffers that don't override it. | 5480 | doc: /* Default value of `right-margin-width' for buffers that don't override it. |
| 5526 | This is the same as (default-value 'right-margin-width). */); | 5481 | This is the same as (default-value \\='right-margin-width). */); |
| 5527 | 5482 | ||
| 5528 | DEFVAR_BUFFER_DEFAULTS ("default-left-fringe-width", | 5483 | DEFVAR_BUFFER_DEFAULTS ("default-left-fringe-width", |
| 5529 | left_fringe_width, | 5484 | left_fringe_width, |
| 5530 | doc: /* Default value of `left-fringe-width' for buffers that don't override it. | 5485 | doc: /* Default value of `left-fringe-width' for buffers that don't override it. |
| 5531 | This is the same as (default-value 'left-fringe-width). */); | 5486 | This is the same as (default-value \\='left-fringe-width). */); |
| 5532 | 5487 | ||
| 5533 | DEFVAR_BUFFER_DEFAULTS ("default-right-fringe-width", | 5488 | DEFVAR_BUFFER_DEFAULTS ("default-right-fringe-width", |
| 5534 | right_fringe_width, | 5489 | right_fringe_width, |
| 5535 | doc: /* Default value of `right-fringe-width' for buffers that don't override it. | 5490 | doc: /* Default value of `right-fringe-width' for buffers that don't override it. |
| 5536 | This is the same as (default-value 'right-fringe-width). */); | 5491 | This is the same as (default-value \\='right-fringe-width). */); |
| 5537 | 5492 | ||
| 5538 | DEFVAR_BUFFER_DEFAULTS ("default-fringes-outside-margins", | 5493 | DEFVAR_BUFFER_DEFAULTS ("default-fringes-outside-margins", |
| 5539 | fringes_outside_margins, | 5494 | fringes_outside_margins, |
| 5540 | doc: /* Default value of `fringes-outside-margins' for buffers that don't override it. | 5495 | doc: /* Default value of `fringes-outside-margins' for buffers that don't override it. |
| 5541 | This is the same as (default-value 'fringes-outside-margins). */); | 5496 | This is the same as (default-value \\='fringes-outside-margins). */); |
| 5542 | 5497 | ||
| 5543 | DEFVAR_BUFFER_DEFAULTS ("default-scroll-bar-width", | 5498 | DEFVAR_BUFFER_DEFAULTS ("default-scroll-bar-width", |
| 5544 | scroll_bar_width, | 5499 | scroll_bar_width, |
| 5545 | doc: /* Default value of `scroll-bar-width' for buffers that don't override it. | 5500 | doc: /* Default value of `scroll-bar-width' for buffers that don't override it. |
| 5546 | This is the same as (default-value 'scroll-bar-width). */); | 5501 | This is the same as (default-value \\='scroll-bar-width). */); |
| 5547 | 5502 | ||
| 5548 | DEFVAR_BUFFER_DEFAULTS ("default-vertical-scroll-bar", | 5503 | DEFVAR_BUFFER_DEFAULTS ("default-vertical-scroll-bar", |
| 5549 | vertical_scroll_bar_type, | 5504 | vertical_scroll_bar_type, |
| 5550 | doc: /* Default value of `vertical-scroll-bar' for buffers that don't override it. | 5505 | doc: /* Default value of `vertical-scroll-bar' for buffers that don't override it. |
| 5551 | This is the same as (default-value 'vertical-scroll-bar). */); | 5506 | This is the same as (default-value \\='vertical-scroll-bar). */); |
| 5552 | 5507 | ||
| 5553 | DEFVAR_BUFFER_DEFAULTS ("default-indicate-empty-lines", | 5508 | DEFVAR_BUFFER_DEFAULTS ("default-indicate-empty-lines", |
| 5554 | indicate_empty_lines, | 5509 | indicate_empty_lines, |
| 5555 | doc: /* Default value of `indicate-empty-lines' for buffers that don't override it. | 5510 | doc: /* Default value of `indicate-empty-lines' for buffers that don't override it. |
| 5556 | This is the same as (default-value 'indicate-empty-lines). */); | 5511 | This is the same as (default-value \\='indicate-empty-lines). */); |
| 5557 | 5512 | ||
| 5558 | DEFVAR_BUFFER_DEFAULTS ("default-indicate-buffer-boundaries", | 5513 | DEFVAR_BUFFER_DEFAULTS ("default-indicate-buffer-boundaries", |
| 5559 | indicate_buffer_boundaries, | 5514 | indicate_buffer_boundaries, |
| 5560 | doc: /* Default value of `indicate-buffer-boundaries' for buffers that don't override it. | 5515 | doc: /* Default value of `indicate-buffer-boundaries' for buffers that don't override it. |
| 5561 | This is the same as (default-value 'indicate-buffer-boundaries). */); | 5516 | This is the same as (default-value \\='indicate-buffer-boundaries). */); |
| 5562 | 5517 | ||
| 5563 | DEFVAR_BUFFER_DEFAULTS ("default-fringe-indicator-alist", | 5518 | DEFVAR_BUFFER_DEFAULTS ("default-fringe-indicator-alist", |
| 5564 | fringe_indicator_alist, | 5519 | fringe_indicator_alist, |
| 5565 | doc: /* Default value of `fringe-indicator-alist' for buffers that don't override it. | 5520 | doc: /* Default value of `fringe-indicator-alist' for buffers that don't override it. |
| 5566 | This is the same as (default-value 'fringe-indicator-alist'). */); | 5521 | This is the same as (default-value \\='fringe-indicator-alist). */); |
| 5567 | 5522 | ||
| 5568 | DEFVAR_BUFFER_DEFAULTS ("default-fringe-cursor-alist", | 5523 | DEFVAR_BUFFER_DEFAULTS ("default-fringe-cursor-alist", |
| 5569 | fringe_cursor_alist, | 5524 | fringe_cursor_alist, |
| 5570 | doc: /* Default value of `fringe-cursor-alist' for buffers that don't override it. | 5525 | doc: /* Default value of `fringe-cursor-alist' for buffers that don't override it. |
| 5571 | This is the same as (default-value 'fringe-cursor-alist'). */); | 5526 | This is the same as (default-value \\='fringe-cursor-alist). */); |
| 5572 | 5527 | ||
| 5573 | DEFVAR_BUFFER_DEFAULTS ("default-scroll-up-aggressively", | 5528 | DEFVAR_BUFFER_DEFAULTS ("default-scroll-up-aggressively", |
| 5574 | scroll_up_aggressively, | 5529 | scroll_up_aggressively, |
| 5575 | doc: /* Default value of `scroll-up-aggressively'. | 5530 | doc: /* Default value of `scroll-up-aggressively'. |
| 5576 | This value applies in buffers that don't have their own local values. | 5531 | This value applies in buffers that don't have their own local values. |
| 5577 | This is the same as (default-value 'scroll-up-aggressively). */); | 5532 | This is the same as (default-value \\='scroll-up-aggressively). */); |
| 5578 | 5533 | ||
| 5579 | DEFVAR_BUFFER_DEFAULTS ("default-scroll-down-aggressively", | 5534 | DEFVAR_BUFFER_DEFAULTS ("default-scroll-down-aggressively", |
| 5580 | scroll_down_aggressively, | 5535 | scroll_down_aggressively, |
| 5581 | doc: /* Default value of `scroll-down-aggressively'. | 5536 | doc: /* Default value of `scroll-down-aggressively'. |
| 5582 | This value applies in buffers that don't have their own local values. | 5537 | This value applies in buffers that don't have their own local values. |
| 5583 | This is the same as (default-value 'scroll-down-aggressively). */); | 5538 | This is the same as (default-value \\='scroll-down-aggressively). */); |
| 5584 | 5539 | ||
| 5585 | DEFVAR_PER_BUFFER ("header-line-format", | 5540 | DEFVAR_PER_BUFFER ("header-line-format", |
| 5586 | &BVAR (current_buffer, header_line_format), | 5541 | &BVAR (current_buffer, header_line_format), |
| @@ -5753,7 +5708,7 @@ The values of `right-to-left' and `left-to-right' override that. | |||
| 5753 | Any other value is treated as nil. | 5708 | Any other value is treated as nil. |
| 5754 | 5709 | ||
| 5755 | This variable has no effect unless the buffer's value of | 5710 | This variable has no effect unless the buffer's value of |
| 5756 | \`bidi-display-reordering' is non-nil. */); | 5711 | `bidi-display-reordering' is non-nil. */); |
| 5757 | 5712 | ||
| 5758 | DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, | 5713 | DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, |
| 5759 | doc: /* Non-nil means do not display continuation lines. | 5714 | doc: /* Non-nil means do not display continuation lines. |
| @@ -5785,7 +5740,7 @@ visual lines rather than logical lines. See the documentation of | |||
| 5785 | 5740 | ||
| 5786 | DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), | 5741 | DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), |
| 5787 | Qstringp, | 5742 | Qstringp, |
| 5788 | doc: /* Name of default directory of current buffer. Should end with slash. | 5743 | doc: /* Name of default directory of current buffer. |
| 5789 | To interactively change the default directory, use command `cd'. */); | 5744 | To interactively change the default directory, use command `cd'. */); |
| 5790 | 5745 | ||
| 5791 | DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), | 5746 | DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), |
| @@ -5798,7 +5753,8 @@ its value may not be a list of functions. */); | |||
| 5798 | 5753 | ||
| 5799 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), | 5754 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), |
| 5800 | Qstringp, | 5755 | Qstringp, |
| 5801 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); | 5756 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. |
| 5757 | This should be an absolute file name. */); | ||
| 5802 | 5758 | ||
| 5803 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), | 5759 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), |
| 5804 | Qstringp, | 5760 | Qstringp, |
| @@ -5843,7 +5799,8 @@ in a file, save the ^M as a newline. */); | |||
| 5843 | Qnil, | 5799 | Qnil, |
| 5844 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); | 5800 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); |
| 5845 | 5801 | ||
| 5846 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, | 5802 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), |
| 5803 | Qoverwrite_mode, | ||
| 5847 | doc: /* Non-nil if self-insertion should replace existing text. | 5804 | doc: /* Non-nil if self-insertion should replace existing text. |
| 5848 | The value should be one of `overwrite-mode-textual', | 5805 | The value should be one of `overwrite-mode-textual', |
| 5849 | `overwrite-mode-binary', or nil. | 5806 | `overwrite-mode-binary', or nil. |
| @@ -5891,7 +5848,7 @@ See also the functions `display-table-slot' and `set-display-table-slot'. */); | |||
| 5891 | 5848 | ||
| 5892 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), | 5849 | DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), |
| 5893 | Qintegerp, | 5850 | Qintegerp, |
| 5894 | doc: /* Width of left marginal area for display of a buffer. | 5851 | doc: /* Width in columns of left marginal area for display of a buffer. |
| 5895 | A value of nil means no marginal area. | 5852 | A value of nil means no marginal area. |
| 5896 | 5853 | ||
| 5897 | Setting this variable does not take effect until a new buffer is displayed | 5854 | Setting this variable does not take effect until a new buffer is displayed |
| @@ -5899,7 +5856,7 @@ in a window. To make the change take effect, call `set-window-buffer'. */); | |||
| 5899 | 5856 | ||
| 5900 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), | 5857 | DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), |
| 5901 | Qintegerp, | 5858 | Qintegerp, |
| 5902 | doc: /* Width of right marginal area for display of a buffer. | 5859 | doc: /* Width in columns of right marginal area for display of a buffer. |
| 5903 | A value of nil means no marginal area. | 5860 | A value of nil means no marginal area. |
| 5904 | 5861 | ||
| 5905 | Setting this variable does not take effect until a new buffer is displayed | 5862 | Setting this variable does not take effect until a new buffer is displayed |
| @@ -5933,11 +5890,16 @@ in a window. To make the change take effect, call `set-window-buffer'. */); | |||
| 5933 | 5890 | ||
| 5934 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), | 5891 | DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), |
| 5935 | Qintegerp, | 5892 | Qintegerp, |
| 5936 | doc: /* Width of this buffer's scroll bars in pixels. | 5893 | doc: /* Width of this buffer's vertical scroll bars in pixels. |
| 5937 | A value of nil means to use the scroll bar width from the window's frame. */); | 5894 | A value of nil means to use the scroll bar width from the window's frame. */); |
| 5938 | 5895 | ||
| 5896 | DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), | ||
| 5897 | Qintegerp, | ||
| 5898 | doc: /* Height of this buffer's horizontal scroll bars in pixels. | ||
| 5899 | A value of nil means to use the scroll bar height from the window's frame. */); | ||
| 5900 | |||
| 5939 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), | 5901 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), |
| 5940 | Qnil, | 5902 | Qvertical_scroll_bar, |
| 5941 | doc: /* Position of this buffer's vertical scroll bar. | 5903 | doc: /* Position of this buffer's vertical scroll bar. |
| 5942 | The value takes effect whenever you tell a window to display this buffer; | 5904 | The value takes effect whenever you tell a window to display this buffer; |
| 5943 | for instance, with `set-window-buffer' or when `display-buffer' displays it. | 5905 | for instance, with `set-window-buffer' or when `display-buffer' displays it. |
| @@ -5946,6 +5908,17 @@ A value of `left' or `right' means put the vertical scroll bar at that side | |||
| 5946 | of the window; a value of nil means don't show any vertical scroll bars. | 5908 | of the window; a value of nil means don't show any vertical scroll bars. |
| 5947 | A value of t (the default) means do whatever the window's frame specifies. */); | 5909 | A value of t (the default) means do whatever the window's frame specifies. */); |
| 5948 | 5910 | ||
| 5911 | DEFVAR_PER_BUFFER ("horizontal-scroll-bar", &BVAR (current_buffer, horizontal_scroll_bar_type), | ||
| 5912 | Qnil, | ||
| 5913 | doc: /* Position of this buffer's horizontal scroll bar. | ||
| 5914 | The value takes effect whenever you tell a window to display this buffer; | ||
| 5915 | for instance, with `set-window-buffer' or when `display-buffer' displays it. | ||
| 5916 | |||
| 5917 | A value of `bottom' means put the horizontal scroll bar at the bottom of | ||
| 5918 | the window; a value of nil means don't show any horizontal scroll bars. | ||
| 5919 | A value of t (the default) means do whatever the window's frame | ||
| 5920 | specifies. */); | ||
| 5921 | |||
| 5949 | DEFVAR_PER_BUFFER ("indicate-empty-lines", | 5922 | DEFVAR_PER_BUFFER ("indicate-empty-lines", |
| 5950 | &BVAR (current_buffer, indicate_empty_lines), Qnil, | 5923 | &BVAR (current_buffer, indicate_empty_lines), Qnil, |
| 5951 | doc: /* Visually indicate empty lines after the buffer end. | 5924 | doc: /* Visually indicate empty lines after the buffer end. |
| @@ -6012,7 +5985,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical | |||
| 6012 | cursor type. */); | 5985 | cursor type. */); |
| 6013 | 5986 | ||
| 6014 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", | 5987 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", |
| 6015 | &BVAR (current_buffer, scroll_up_aggressively), Qfloatp, | 5988 | &BVAR (current_buffer, scroll_up_aggressively), Qfraction, |
| 6016 | doc: /* How far to scroll windows upward. | 5989 | doc: /* How far to scroll windows upward. |
| 6017 | If you move point off the bottom, the window scrolls automatically. | 5990 | If you move point off the bottom, the window scrolls automatically. |
| 6018 | This variable controls how far it scrolls. The value nil, the default, | 5991 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -6025,7 +5998,7 @@ window scrolls by a full window height. Meaningful values are | |||
| 6025 | between 0.0 and 1.0, inclusive. */); | 5998 | between 0.0 and 1.0, inclusive. */); |
| 6026 | 5999 | ||
| 6027 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", | 6000 | DEFVAR_PER_BUFFER ("scroll-down-aggressively", |
| 6028 | &BVAR (current_buffer, scroll_down_aggressively), Qfloatp, | 6001 | &BVAR (current_buffer, scroll_down_aggressively), Qfraction, |
| 6029 | doc: /* How far to scroll windows downward. | 6002 | doc: /* How far to scroll windows downward. |
| 6030 | If you move point off the top, the window scrolls automatically. | 6003 | If you move point off the top, the window scrolls automatically. |
| 6031 | This variable controls how far it scrolls. The value nil, the default, | 6004 | This variable controls how far it scrolls. The value nil, the default, |
| @@ -6041,7 +6014,7 @@ between 0.0 and 1.0, inclusive. */); | |||
| 6041 | doc: /* List of functions to call before each text change. | 6014 | doc: /* List of functions to call before each text change. |
| 6042 | Two arguments are passed to each function: the positions of | 6015 | Two arguments are passed to each function: the positions of |
| 6043 | the beginning and end of the range of old text to be changed. | 6016 | the beginning and end of the range of old text to be changed. |
| 6044 | \(For an insertion, the beginning and end are at the same place.) | 6017 | (For an insertion, the beginning and end are at the same place.) |
| 6045 | No information is given about the length of the text after the change. | 6018 | No information is given about the length of the text after the change. |
| 6046 | 6019 | ||
| 6047 | Buffer changes made while executing the `before-change-functions' | 6020 | Buffer changes made while executing the `before-change-functions' |
| @@ -6057,9 +6030,9 @@ from happening repeatedly and making Emacs nonfunctional. */); | |||
| 6057 | doc: /* List of functions to call after each text change. | 6030 | doc: /* List of functions to call after each text change. |
| 6058 | Three arguments are passed to each function: the positions of | 6031 | Three arguments are passed to each function: the positions of |
| 6059 | the beginning and end of the range of changed text, | 6032 | the beginning and end of the range of changed text, |
| 6060 | and the length in bytes of the pre-change text replaced by that range. | 6033 | and the length in chars of the pre-change text replaced by that range. |
| 6061 | \(For an insertion, the pre-change length is zero; | 6034 | (For an insertion, the pre-change length is zero; |
| 6062 | for a deletion, that length is the number of bytes deleted, | 6035 | for a deletion, that length is the number of chars deleted, |
| 6063 | and the post-change beginning and end are at the same place.) | 6036 | and the post-change beginning and end are at the same place.) |
| 6064 | 6037 | ||
| 6065 | Buffer changes made while executing the `after-change-functions' | 6038 | Buffer changes made while executing the `after-change-functions' |
| @@ -6103,7 +6076,7 @@ was modified between BEG and END. PROPERTY is the property name, | |||
| 6103 | and VALUE is the old value. | 6076 | and VALUE is the old value. |
| 6104 | 6077 | ||
| 6105 | An entry (apply FUN-NAME . ARGS) means undo the change with | 6078 | An entry (apply FUN-NAME . ARGS) means undo the change with |
| 6106 | \(apply FUN-NAME ARGS). | 6079 | (apply FUN-NAME ARGS). |
| 6107 | 6080 | ||
| 6108 | An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo | 6081 | An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo |
| 6109 | in the active region. BEG and END is the range affected by this entry | 6082 | in the active region. BEG and END is the range affected by this entry |
| @@ -6117,7 +6090,7 @@ An entry of the form POSITION indicates that point was at the buffer | |||
| 6117 | location given by the integer. Undoing an entry of this form places | 6090 | location given by the integer. Undoing an entry of this form places |
| 6118 | point at POSITION. | 6091 | point at POSITION. |
| 6119 | 6092 | ||
| 6120 | Entries with value `nil' mark undo boundaries. The undo command treats | 6093 | Entries with value nil mark undo boundaries. The undo command treats |
| 6121 | the changes between two undo boundaries as a single step to be undone. | 6094 | the changes between two undo boundaries as a single step to be undone. |
| 6122 | 6095 | ||
| 6123 | If the value of the variable is t, undo information is not recorded. */); | 6096 | If the value of the variable is t, undo information is not recorded. */); |
| @@ -6128,6 +6101,8 @@ If the value of the variable is t, undo information is not recorded. */); | |||
| 6128 | DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil, | 6101 | DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil, |
| 6129 | doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans. | 6102 | doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans. |
| 6130 | 6103 | ||
| 6104 | There is no reason to set this to nil except for debugging purposes. | ||
| 6105 | |||
| 6131 | Normally, the line-motion functions work by scanning the buffer for | 6106 | Normally, the line-motion functions work by scanning the buffer for |
| 6132 | newlines. Columnar operations (like `move-to-column' and | 6107 | newlines. Columnar operations (like `move-to-column' and |
| 6133 | `compute-motion') also work by scanning the buffer, summing character | 6108 | `compute-motion') also work by scanning the buffer, summing character |
| @@ -6177,13 +6152,16 @@ same format as a regular save would use. */); | |||
| 6177 | DEFVAR_PER_BUFFER ("buffer-invisibility-spec", | 6152 | DEFVAR_PER_BUFFER ("buffer-invisibility-spec", |
| 6178 | &BVAR (current_buffer, invisibility_spec), Qnil, | 6153 | &BVAR (current_buffer, invisibility_spec), Qnil, |
| 6179 | doc: /* Invisibility spec of this buffer. | 6154 | doc: /* Invisibility spec of this buffer. |
| 6180 | The default is t, which means that text is invisible | 6155 | The default is t, which means that text is invisible if it has a non-nil |
| 6181 | if it has a non-nil `invisible' property. | 6156 | `invisible' property. |
| 6182 | If the value is a list, a text character is invisible if its `invisible' | 6157 | This variable can also be a list. The list can have two kinds of elements: |
| 6183 | property is an element in that list (or is a list with members in common). | 6158 | `ATOM' and `(ATOM . ELLIPSIS)'. A text character is invisible if its |
| 6184 | If an element is a cons cell of the form (PROP . ELLIPSIS), | 6159 | `invisible' property is `ATOM', or has an `invisible' property that is a list |
| 6185 | then characters with property value PROP are invisible, | 6160 | that contains `ATOM'. |
| 6186 | and they have an ellipsis as well if ELLIPSIS is non-nil. */); | 6161 | If the `(ATOM . ELLIPSIS)' form is used, and `ELLIPSIS' is non-nil, an |
| 6162 | ellipsis will be displayed after the invisible characters. | ||
| 6163 | Setting this variable is very fast, much faster than scanning all the text in | ||
| 6164 | the buffer looking for properties to change. */); | ||
| 6187 | 6165 | ||
| 6188 | DEFVAR_PER_BUFFER ("buffer-display-count", | 6166 | DEFVAR_PER_BUFFER ("buffer-display-count", |
| 6189 | &BVAR (current_buffer, display_count), Qintegerp, | 6167 | &BVAR (current_buffer, display_count), Qintegerp, |
| @@ -6202,6 +6180,7 @@ If the buffer has never been shown in a window, the value is nil. */); | |||
| 6202 | See the command `transient-mark-mode' for a description of this minor mode. | 6180 | See the command `transient-mark-mode' for a description of this minor mode. |
| 6203 | 6181 | ||
| 6204 | Non-nil also enables highlighting of the region whenever the mark is active. | 6182 | Non-nil also enables highlighting of the region whenever the mark is active. |
| 6183 | The region is highlighted with the `region' face. | ||
| 6205 | The variable `highlight-nonselected-windows' controls whether to highlight | 6184 | The variable `highlight-nonselected-windows' controls whether to highlight |
| 6206 | all windows or just the selected window. | 6185 | all windows or just the selected window. |
| 6207 | 6186 | ||
| @@ -6257,9 +6236,9 @@ to the default frame line height. A value of nil means add no extra space. */) | |||
| 6257 | doc: /* Non-nil means show a cursor in non-selected windows. | 6236 | doc: /* Non-nil means show a cursor in non-selected windows. |
| 6258 | If nil, only shows a cursor in the selected window. | 6237 | If nil, only shows a cursor in the selected window. |
| 6259 | If t, displays a cursor related to the usual cursor type | 6238 | If t, displays a cursor related to the usual cursor type |
| 6260 | \(a solid box becomes hollow, a bar becomes a narrower bar). | 6239 | (a solid box becomes hollow, a bar becomes a narrower bar). |
| 6261 | You can also specify the cursor type as in the `cursor-type' variable. | 6240 | You can also specify the cursor type as in the `cursor-type' variable. |
| 6262 | Use Custom to set this variable and update the display." */); | 6241 | Use Custom to set this variable and update the display. */); |
| 6263 | 6242 | ||
| 6264 | DEFVAR_LISP ("kill-buffer-query-functions", Vkill_buffer_query_functions, | 6243 | DEFVAR_LISP ("kill-buffer-query-functions", Vkill_buffer_query_functions, |
| 6265 | doc: /* List of functions called with no args to query before killing a buffer. | 6244 | doc: /* List of functions called with no args to query before killing a buffer. |
| @@ -6277,9 +6256,9 @@ The function `kill-all-local-variables' runs this before doing anything else. * | |||
| 6277 | 6256 | ||
| 6278 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, | 6257 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, |
| 6279 | doc: /* Hook run when the buffer list changes. | 6258 | doc: /* Hook run when the buffer list changes. |
| 6280 | Functions running this hook are `get-buffer-create', | 6259 | Functions running this hook are, `get-buffer-create', |
| 6281 | `make-indirect-buffer', `rename-buffer', `kill-buffer', | 6260 | `make-indirect-buffer', `rename-buffer', `kill-buffer', |
| 6282 | and `bury-buffer-internal'. */); | 6261 | `bury-buffer-internal' and `select-window'. */); |
| 6283 | Vbuffer_list_update_hook = Qnil; | 6262 | Vbuffer_list_update_hook = Qnil; |
| 6284 | DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); | 6263 | DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); |
| 6285 | 6264 | ||
| @@ -6296,6 +6275,7 @@ and `bury-buffer-internal'. */); | |||
| 6296 | defsubr (&Sbuffer_local_value); | 6275 | defsubr (&Sbuffer_local_value); |
| 6297 | defsubr (&Sbuffer_local_variables); | 6276 | defsubr (&Sbuffer_local_variables); |
| 6298 | defsubr (&Sbuffer_modified_p); | 6277 | defsubr (&Sbuffer_modified_p); |
| 6278 | defsubr (&Sforce_mode_line_update); | ||
| 6299 | defsubr (&Sset_buffer_modified_p); | 6279 | defsubr (&Sset_buffer_modified_p); |
| 6300 | defsubr (&Sbuffer_modified_tick); | 6280 | defsubr (&Sbuffer_modified_tick); |
| 6301 | defsubr (&Sbuffer_chars_modified_tick); | 6281 | defsubr (&Sbuffer_chars_modified_tick); |
| @@ -6331,6 +6311,8 @@ and `bury-buffer-internal'. */); | |||
| 6331 | defsubr (&Soverlay_get); | 6311 | defsubr (&Soverlay_get); |
| 6332 | defsubr (&Soverlay_put); | 6312 | defsubr (&Soverlay_put); |
| 6333 | defsubr (&Srestore_buffer_modified_p); | 6313 | defsubr (&Srestore_buffer_modified_p); |
| 6314 | |||
| 6315 | Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); | ||
| 6334 | } | 6316 | } |
| 6335 | 6317 | ||
| 6336 | void | 6318 | void |
| @@ -6338,8 +6320,4 @@ keys_of_buffer (void) | |||
| 6338 | { | 6320 | { |
| 6339 | initial_define_key (control_x_map, 'b', "switch-to-buffer"); | 6321 | initial_define_key (control_x_map, 'b', "switch-to-buffer"); |
| 6340 | initial_define_key (control_x_map, 'k', "kill-buffer"); | 6322 | initial_define_key (control_x_map, 'k', "kill-buffer"); |
| 6341 | |||
| 6342 | /* This must not be in syms_of_buffer, because Qdisabled is not | ||
| 6343 | initialized when that function gets called. */ | ||
| 6344 | Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); | ||
| 6345 | } | 6323 | } |