aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/subr.el8
-rw-r--r--src/ChangeLog8
-rw-r--r--src/buffer.c98
4 files changed, 59 insertions, 59 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7c4c76eeb12..e12b9252df8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12013-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * subr.el (force-mode-line-update): Delete, move to buffer.c.
4
12013-11-11 Michael Albinus <michael.albinus@gmx.de> 52013-11-11 Michael Albinus <michael.albinus@gmx.de>
2 6
3 * net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer) 7 * net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer)
diff --git a/lisp/subr.el b/lisp/subr.el
index 6bcbe6b9687..e8d3245ff10 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2382,14 +2382,6 @@ This finishes the change group by reverting all of its changes."
2382(define-obsolete-function-alias 'redraw-modeline 2382(define-obsolete-function-alias 'redraw-modeline
2383 'force-mode-line-update "24.3") 2383 'force-mode-line-update "24.3")
2384 2384
2385(defun force-mode-line-update (&optional all)
2386 "Force redisplay of the current buffer's mode line and header line.
2387With optional non-nil ALL, force redisplay of all mode lines and
2388header lines. This function also forces recomputation of the
2389menu bar menus and the frame title."
2390 (if all (with-current-buffer (other-buffer)))
2391 (set-buffer-modified-p (buffer-modified-p)))
2392
2393(defun momentary-string-display (string pos &optional exit-char message) 2385(defun momentary-string-display (string pos &optional exit-char message)
2394 "Momentarily display STRING in the buffer at POS. 2386 "Momentarily display STRING in the buffer at POS.
2395Display remains until next event is input. 2387Display remains until next event is input.
diff --git a/src/ChangeLog b/src/ChangeLog
index 03d806ee7f1..7a727482d7b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12013-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * buffer.c (Frestore_buffer_modified_p): Sync it with
4 Fset_buffer_modified_p.
5 (Fforce_mode_line_update): New function, moved from subr.el.
6 (Fset_buffer_modified_p): Use them.
7 (syms_of_buffer): Defsubr Fforce_mode_line_update.
8
12013-11-11 Paul Eggert <eggert@cs.ucla.edu> 92013-11-11 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 * search.c (find_newline): Rewrite to prefer offsets to pointers. 11 * search.c (find_newline): Rewrite to prefer offsets to pointers.
diff --git a/src/buffer.c b/src/buffer.c
index 7a424ffd901..a528397a9d2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1328,15 +1328,55 @@ No argument or nil as argument means use current buffer as BUFFER. */)
1328 return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; 1328 return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil;
1329} 1329}
1330 1330
1331DEFUN ("force-mode-line-update", Fforce_mode_line_update,
1332 Sforce_mode_line_update, 0, 1, 0,
1333 doc: /* Force redisplay of the current buffer's mode line and header line.
1334With optional non-nil ALL, force redisplay of all mode lines and
1335header lines. This function also forces recomputation of the
1336menu bar menus and the frame title. */)
1337 (Lisp_Object all)
1338{
1339 if (!NILP (all) || buffer_window_count (current_buffer))
1340 {
1341 update_mode_lines = 10;
1342 current_buffer->prevent_redisplay_optimizations_p = 1;
1343 }
1344}
1345
1331DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1346DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1332 1, 1, 0, 1347 1, 1, 0,
1333 doc: /* Mark current buffer as modified or unmodified according to FLAG. 1348 doc: /* Mark current buffer as modified or unmodified according to FLAG.
1334A non-nil FLAG means mark the buffer modified. */) 1349A non-nil FLAG means mark the buffer modified. */)
1335 (Lisp_Object flag) 1350 (Lisp_Object flag)
1336{ 1351{
1337 Lisp_Object fn; 1352 Frestore_buffer_modified_p (flag);
1353
1354 /* Set update_mode_lines only if buffer is displayed in some window.
1355 Packages like jit-lock or lazy-lock preserve a buffer's modified
1356 state by recording/restoring the state around blocks of code.
1357 Setting update_mode_lines makes redisplay consider all windows
1358 (on all frames). Stealth fontification of buffers not displayed
1359 would incur additional redisplay costs if we'd set
1360 update_modes_lines unconditionally.
1361
1362 Ideally, I think there should be another mechanism for fontifying
1363 buffers without "modifying" buffers, or redisplay should be
1364 smarter about updating the `*' in mode lines. --gerd */
1365 Fforce_mode_line_update (Qnil);
1338 1366
1367 return flag;
1368}
1369
1370DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
1371 Srestore_buffer_modified_p, 1, 1, 0,
1372 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay.
1373It is not ensured that mode lines will be updated to show the modified
1374state of the current buffer. Use with care. */)
1375 (Lisp_Object flag)
1376{
1339#ifdef CLASH_DETECTION 1377#ifdef CLASH_DETECTION
1378 Lisp_Object fn;
1379
1340 /* If buffer becoming modified, lock the file. 1380 /* If buffer becoming modified, lock the file.
1341 If buffer becoming unmodified, unlock the file. */ 1381 If buffer becoming unmodified, unlock the file. */
1342 1382
@@ -1376,52 +1416,6 @@ A non-nil FLAG means mark the buffer modified. */)
1376 or increase MODIFF. */ 1416 or increase MODIFF. */
1377 : MODIFF++); 1417 : MODIFF++);
1378 1418
1379 /* Set update_mode_lines only if buffer is displayed in some window.
1380 Packages like jit-lock or lazy-lock preserve a buffer's modified
1381 state by recording/restoring the state around blocks of code.
1382 Setting update_mode_lines makes redisplay consider all windows
1383 (on all frames). Stealth fontification of buffers not displayed
1384 would incur additional redisplay costs if we'd set
1385 update_modes_lines unconditionally.
1386
1387 Ideally, I think there should be another mechanism for fontifying
1388 buffers without "modifying" buffers, or redisplay should be
1389 smarter about updating the `*' in mode lines. --gerd */
1390 if (buffer_window_count (current_buffer))
1391 {
1392 update_mode_lines = 10;
1393 current_buffer->prevent_redisplay_optimizations_p = 1;
1394 }
1395
1396 return flag;
1397}
1398
1399DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
1400 Srestore_buffer_modified_p, 1, 1, 0,
1401 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay.
1402It is not ensured that mode lines will be updated to show the modified
1403state of the current buffer. Use with care. */)
1404 (Lisp_Object flag)
1405{
1406#ifdef CLASH_DETECTION
1407 Lisp_Object fn;
1408
1409 /* If buffer becoming modified, lock the file.
1410 If buffer becoming unmodified, unlock the file. */
1411
1412 fn = BVAR (current_buffer, file_truename);
1413 /* Test buffer-file-name so that binding it to nil is effective. */
1414 if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
1415 {
1416 bool already = SAVE_MODIFF < MODIFF;
1417 if (!already && !NILP (flag))
1418 lock_file (fn);
1419 else if (already && NILP (flag))
1420 unlock_file (fn);
1421 }
1422#endif /* CLASH_DETECTION */
1423
1424 SAVE_MODIFF = NILP (flag) ? MODIFF : 0;
1425 return flag; 1419 return flag;
1426} 1420}
1427 1421
@@ -1794,7 +1788,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1794 /* Run replace_buffer_in_windows before making another buffer current 1788 /* Run replace_buffer_in_windows before making another buffer current
1795 since set-window-buffer-start-and-point will refuse to make another 1789 since set-window-buffer-start-and-point will refuse to make another
1796 buffer current if the selected window does not show the current 1790 buffer current if the selected window does not show the current
1797 buffer. (Bug#10114) */ 1791 buffer (bug#10114). */
1798 replace_buffer_in_windows (buffer); 1792 replace_buffer_in_windows (buffer);
1799 1793
1800 /* Exit if replacing the buffer in windows has killed our buffer. */ 1794 /* Exit if replacing the buffer in windows has killed our buffer. */
@@ -5403,12 +5397,12 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5403 5397
5404 if (PER_BUFFER_IDX (offset) == 0) 5398 if (PER_BUFFER_IDX (offset) == 0)
5405 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding 5399 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
5406 slot of buffer_local_flags */ 5400 slot of buffer_local_flags. */
5407 emacs_abort (); 5401 emacs_abort ();
5408} 5402}
5409 5403
5410 5404
5411/* initialize the buffer routines */ 5405/* Initialize the buffer routines. */
5412void 5406void
5413syms_of_buffer (void) 5407syms_of_buffer (void)
5414{ 5408{
@@ -5798,7 +5792,8 @@ its value may not be a list of functions. */);
5798 5792
5799 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), 5793 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename),
5800 Qstringp, 5794 Qstringp,
5801 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); 5795 doc: /* Name of file visited in current buffer, or nil if not visiting a file.
5796This should be an absolute file name. */);
5802 5797
5803 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), 5798 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename),
5804 Qstringp, 5799 Qstringp,
@@ -6298,6 +6293,7 @@ and `bury-buffer-internal'. */);
6298 defsubr (&Sbuffer_local_value); 6293 defsubr (&Sbuffer_local_value);
6299 defsubr (&Sbuffer_local_variables); 6294 defsubr (&Sbuffer_local_variables);
6300 defsubr (&Sbuffer_modified_p); 6295 defsubr (&Sbuffer_modified_p);
6296 defsubr (&Sforce_mode_line_update);
6301 defsubr (&Sset_buffer_modified_p); 6297 defsubr (&Sset_buffer_modified_p);
6302 defsubr (&Sbuffer_modified_tick); 6298 defsubr (&Sbuffer_modified_tick);
6303 defsubr (&Sbuffer_chars_modified_tick); 6299 defsubr (&Sbuffer_chars_modified_tick);