aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorJim Blandy1993-06-22 07:39:26 +0000
committerJim Blandy1993-06-22 07:39:26 +0000
commit718cde7d8ee9ae85f61f11654a9df44ba628a332 (patch)
tree83137a3a031ff892d094d8b5c4cc57f557937091 /src/buffer.c
parent28f7279833b8593f936a87fac417b77160d3a9b6 (diff)
downloademacs-718cde7d8ee9ae85f61f11654a9df44ba628a332.tar.gz
emacs-718cde7d8ee9ae85f61f11654a9df44ba628a332.zip
* buffer.c (list_buffers_1): Make desired_point a lisp object; set
it to nil, unless we find the current buffer. (Flist_buffers): Don't try to set point in the buffer list unless list_buffers_1 actually returns an integer. Don't use a full save_excursion; just save and restore the buffer.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d1680961e3b..403d1ef22b0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1035,9 +1035,10 @@ list_buffers_1 (files)
1035 register Lisp_Object tail, tem, buf; 1035 register Lisp_Object tail, tem, buf;
1036 Lisp_Object col1, col2, col3, minspace; 1036 Lisp_Object col1, col2, col3, minspace;
1037 register struct buffer *old = current_buffer, *b; 1037 register struct buffer *old = current_buffer, *b;
1038 int desired_point = 0; 1038 Lisp_Object desired_point;
1039 Lisp_Object other_file_symbol; 1039 Lisp_Object other_file_symbol;
1040 1040
1041 desired_point = Qnil;
1041 other_file_symbol = intern ("list-buffers-directory"); 1042 other_file_symbol = intern ("list-buffers-directory");
1042 1043
1043 XFASTINT (col1) = 19; 1044 XFASTINT (col1) = 19;
@@ -1070,7 +1071,7 @@ list_buffers_1 (files)
1070 continue; 1071 continue;
1071 /* Identify the current buffer. */ 1072 /* Identify the current buffer. */
1072 if (b == old) 1073 if (b == old)
1073 desired_point = point; 1074 XFASTINT (desired_point) = point;
1074 write_string (b == old ? "." : " ", -1); 1075 write_string (b == old ? "." : " ", -1);
1075 /* Identify modified buffers */ 1076 /* Identify modified buffers */
1076 write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1); 1077 write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1);
@@ -1106,7 +1107,7 @@ list_buffers_1 (files)
1106 1107
1107 current_buffer->read_only = Qt; 1108 current_buffer->read_only = Qt;
1108 set_buffer_internal (old); 1109 set_buffer_internal (old);
1109 return make_number (desired_point); 1110 return desired_point;
1110} 1111}
1111 1112
1112DEFUN ("list-buffers", Flist_buffers, Slist_buffers, 0, 1, "P", 1113DEFUN ("list-buffers", Flist_buffers, Slist_buffers, 0, 1, "P",
@@ -1120,18 +1121,20 @@ The R column contains a % for buffers that are read-only.")
1120 (files) 1121 (files)
1121 Lisp_Object files; 1122 Lisp_Object files;
1122{ 1123{
1123 int count = specpdl_ptr - specpdl;
1124 Lisp_Object desired_point; 1124 Lisp_Object desired_point;
1125 1125
1126 desired_point = 1126 desired_point =
1127 internal_with_output_to_temp_buffer ("*Buffer List*", 1127 internal_with_output_to_temp_buffer ("*Buffer List*",
1128 list_buffers_1, files); 1128 list_buffers_1, files);
1129 1129
1130 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 1130 if (NUMBERP (desired_point))
1131 Fset_buffer (build_string ("*Buffer List*")); 1131 {
1132 SET_PT (XINT (desired_point)); 1132 int count = specpdl_ptr - specpdl;
1133 1133 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
1134 return unbind_to (count, Qnil); 1134 Fset_buffer (build_string ("*Buffer List*"));
1135 SET_PT (XINT (desired_point));
1136 return unbind_to (count, Qnil);
1137 }
1135} 1138}
1136 1139
1137DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables, 1140DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables,