aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-03-22 04:04:53 +0000
committerRichard M. Stallman1997-03-22 04:04:53 +0000
commit7962a441e707c0e59e39023d9ef44e697eba3e2b (patch)
tree37b87c0380a94a423d6180dec873f26474092d2e /src
parenta0e1f1855ce90dbb64fead6dd4ced7a4ff3dd63f (diff)
downloademacs-7962a441e707c0e59e39023d9ef44e697eba3e2b.tar.gz
emacs-7962a441e707c0e59e39023d9ef44e697eba3e2b.zip
(reset_buffer): Initialize display_count slot.
(Fkill_buffer): Call frames_discard_buffer. (record_buffer): Move buffer to front of frame_buffer_list. (Fother_buffer): Use frame_buffer_list. (init_buffer_once): Set up display_count. (syms_of_buffer): Set up Lisp variable.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 97a179e171f..24b86351de0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -477,6 +477,7 @@ reset_buffer (b)
477 b->point_before_scroll = Qnil; 477 b->point_before_scroll = Qnil;
478 b->file_format = Qnil; 478 b->file_format = Qnil;
479 b->last_selected_window = Qnil; 479 b->last_selected_window = Qnil;
480 XSETINT (b->display_count, 0);
480 b->extra2 = Qnil; 481 b->extra2 = Qnil;
481 b->extra3 = Qnil; 482 b->extra3 = Qnil;
482} 483}
@@ -848,10 +849,26 @@ If BUFFER is omitted or nil, some interesting buffer is returned.")
848 register Lisp_Object buffer, visible_ok; 849 register Lisp_Object buffer, visible_ok;
849{ 850{
850 Lisp_Object Fset_buffer_major_mode (); 851 Lisp_Object Fset_buffer_major_mode ();
851 register Lisp_Object tail, buf, notsogood, tem; 852 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons;
852 notsogood = Qnil; 853 notsogood = Qnil;
853 854
854 for (tail = Vbuffer_alist; !NILP (tail); tail = Fcdr (tail)) 855 tail = Vbuffer_alist;
856 pred = frame_buffer_predicate ();
857
858 /* Consider buffers that have been seen in the selected frame
859 before other buffers. */
860
861 tem = frame_buffer_list ();
862 add_ons = Qnil;
863 while (CONSP (tem))
864 {
865 if (BUFFERP (XCONS (tem)->car))
866 add_ons = Fcons (Fcons (Qnil, XCONS (tem)->car), add_ons);
867 tem = XCONS (tem)->cdr;
868 }
869 tail = nconc2 (Fnreverse (add_ons), tail);
870
871 for (; !NILP (tail); tail = Fcdr (tail))
855 { 872 {
856 buf = Fcdr (Fcar (tail)); 873 buf = Fcdr (Fcar (tail));
857 if (EQ (buf, buffer)) 874 if (EQ (buf, buffer))
@@ -860,10 +877,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned.")
860 continue; 877 continue;
861 /* If the selected frame has a buffer_predicate, 878 /* If the selected frame has a buffer_predicate,
862 disregard buffers that don't fit the predicate. */ 879 disregard buffers that don't fit the predicate. */
863 tem = frame_buffer_predicate (); 880 if (!NILP (pred))
864 if (!NILP (tem))
865 { 881 {
866 tem = call1 (tem, buf); 882 tem = call1 (pred, buf);
867 if (NILP (tem)) 883 if (NILP (tem))
868 continue; 884 continue;
869 } 885 }
@@ -1063,6 +1079,7 @@ with SIGHUP.")
1063 Vinhibit_quit = Qt; 1079 Vinhibit_quit = Qt;
1064 replace_buffer_in_all_windows (buf); 1080 replace_buffer_in_all_windows (buf);
1065 Vbuffer_alist = Fdelq (Frassq (buf, Vbuffer_alist), Vbuffer_alist); 1081 Vbuffer_alist = Fdelq (Frassq (buf, Vbuffer_alist), Vbuffer_alist);
1082 frames_discard_buffer (buf);
1066 Vinhibit_quit = tem; 1083 Vinhibit_quit = tem;
1067 1084
1068 /* Delete any auto-save file, if we saved it in this session. */ 1085 /* Delete any auto-save file, if we saved it in this session. */
@@ -1167,8 +1184,33 @@ record_buffer (buf)
1167 else 1184 else
1168 XCONS (prev)->cdr = XCONS (XCONS (prev)->cdr)->cdr; 1185 XCONS (prev)->cdr = XCONS (XCONS (prev)->cdr)->cdr;
1169 1186
1170 XCONS(link)->cdr = Vbuffer_alist; 1187 XCONS (link)->cdr = Vbuffer_alist;
1171 Vbuffer_alist = link; 1188 Vbuffer_alist = link;
1189
1190 /* Now move this buffer to the front of frame_buffer_list also. */
1191
1192 prev = Qnil;
1193 for (link = frame_buffer_list (); CONSP (link); link = XCONS (link)->cdr)
1194 {
1195 if (EQ (XCONS (link)->car, buf))
1196 break;
1197 prev = link;
1198 }
1199
1200 /* Effectively do delq. */
1201
1202 if (CONSP (link))
1203 {
1204 if (NILP (prev))
1205 set_frame_buffer_list (XCONS (frame_buffer_list ())->cdr);
1206 else
1207 XCONS (prev)->cdr = XCONS (XCONS (prev)->cdr)->cdr;
1208
1209 XCONS (link)->cdr = frame_buffer_list ();
1210 set_frame_buffer_list (link);
1211 }
1212 else
1213 set_frame_buffer_list (Fcons (buf, frame_buffer_list ()));
1172} 1214}
1173 1215
1174DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, 1216DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0,
@@ -3521,6 +3563,7 @@ init_buffer_once ()
3521 XSETFASTINT (buffer_defaults.left_margin, 0); 3563 XSETFASTINT (buffer_defaults.left_margin, 0);
3522 buffer_defaults.cache_long_line_scans = Qnil; 3564 buffer_defaults.cache_long_line_scans = Qnil;
3523 buffer_defaults.file_truename = Qnil; 3565 buffer_defaults.file_truename = Qnil;
3566 XSETFASTINT (buffer_defaults.display_count, 0);
3524 3567
3525 /* Assign the local-flags to the slots that have default values. 3568 /* Assign the local-flags to the slots that have default values.
3526 The local flag is a bit that is used in the buffer 3569 The local flag is a bit that is used in the buffer
@@ -3546,6 +3589,7 @@ init_buffer_once ()
3546 XSETINT (buffer_local_flags.file_truename, -1); 3589 XSETINT (buffer_local_flags.file_truename, -1);
3547 XSETINT (buffer_local_flags.invisibility_spec, -1); 3590 XSETINT (buffer_local_flags.invisibility_spec, -1);
3548 XSETINT (buffer_local_flags.file_format, -1); 3591 XSETINT (buffer_local_flags.file_format, -1);
3592 XSETINT (buffer_local_flags.display_count, -1);
3549 3593
3550 XSETFASTINT (buffer_local_flags.mode_line_format, 1); 3594 XSETFASTINT (buffer_local_flags.mode_line_format, 1);
3551 XSETFASTINT (buffer_local_flags.abbrev_mode, 2); 3595 XSETFASTINT (buffer_local_flags.abbrev_mode, 2);
@@ -4137,6 +4181,10 @@ If an element is a cons cell of the form (PROP . ELLIPSIS),\n\
4137then characters with property value PROP are invisible,\n\ 4181then characters with property value PROP are invisible,\n\
4138and they have an ellipsis as well if ELLIPSIS is non-nil."); 4182and they have an ellipsis as well if ELLIPSIS is non-nil.");
4139 4183
4184 DEFVAR_PER_BUFFER ("buffer-display-count",
4185 &current_buffer->display_count, Qnil,
4186 "A number incremented each time the buffer is displayed in a window.");
4187
4140 DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, 4188 DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode,
4141 "*Non-nil means deactivate the mark when the buffer contents change.\n\ 4189 "*Non-nil means deactivate the mark when the buffer contents change.\n\
4142Non-nil also enables highlighting of the region whenever the mark is active.\n\ 4190Non-nil also enables highlighting of the region whenever the mark is active.\n\