[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115064: * lisp/subr.el (force-mode-line-update): De
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r115064: * lisp/subr.el (force-mode-line-update): Delete, move to buffer.c. |
Date: |
Mon, 11 Nov 2013 18:06:18 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115064
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-11-11 13:05:47 -0500
message:
* lisp/subr.el (force-mode-line-update): Delete, move to buffer.c.
* src/buffer.c (Frestore_buffer_modified_p): Sync it with
Fset_buffer_modified_p.
(Fforce_mode_line_update): New function, moved from subr.el.
(Fset_buffer_modified_p): Use them.
(syms_of_buffer): Defsubr Fforce_mode_line_update.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/subr.el subr.el-20091113204419-o5vbwnq5f7feedwu-151
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/buffer.c buffer.c-20091113204419-o5vbwnq5f7feedwu-264
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-11-11 15:18:07 +0000
+++ b/lisp/ChangeLog 2013-11-11 18:05:47 +0000
@@ -1,3 +1,7 @@
+2013-11-11 Stefan Monnier <address@hidden>
+
+ * subr.el (force-mode-line-update): Delete, move to buffer.c.
+
2013-11-11 Michael Albinus <address@hidden>
* net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer)
=== modified file 'lisp/subr.el'
--- a/lisp/subr.el 2013-11-04 14:09:36 +0000
+++ b/lisp/subr.el 2013-11-11 18:05:47 +0000
@@ -2382,14 +2382,6 @@
(define-obsolete-function-alias 'redraw-modeline
'force-mode-line-update "24.3")
-(defun force-mode-line-update (&optional all)
- "Force redisplay of the current buffer's mode line and header line.
-With optional non-nil ALL, force redisplay of all mode lines and
-header lines. This function also forces recomputation of the
-menu bar menus and the frame title."
- (if all (with-current-buffer (other-buffer)))
- (set-buffer-modified-p (buffer-modified-p)))
-
(defun momentary-string-display (string pos &optional exit-char message)
"Momentarily display STRING in the buffer at POS.
Display remains until next event is input.
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-11-11 16:37:54 +0000
+++ b/src/ChangeLog 2013-11-11 18:05:47 +0000
@@ -1,3 +1,11 @@
+2013-11-11 Stefan Monnier <address@hidden>
+
+ * buffer.c (Frestore_buffer_modified_p): Sync it with
+ Fset_buffer_modified_p.
+ (Fforce_mode_line_update): New function, moved from subr.el.
+ (Fset_buffer_modified_p): Use them.
+ (syms_of_buffer): Defsubr Fforce_mode_line_update.
+
2013-11-11 Paul Eggert <address@hidden>
* search.c (find_newline): Rewrite to prefer offsets to pointers.
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2013-11-08 10:21:35 +0000
+++ b/src/buffer.c 2013-11-11 18:05:47 +0000
@@ -1328,15 +1328,55 @@
return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil;
}
+DEFUN ("force-mode-line-update", Fforce_mode_line_update,
+ Sforce_mode_line_update, 0, 1, 0,
+ doc: /* Force redisplay of the current buffer's mode line and header
line.
+With optional non-nil ALL, force redisplay of all mode lines and
+header lines. This function also forces recomputation of the
+menu bar menus and the frame title. */)
+ (Lisp_Object all)
+{
+ if (!NILP (all) || buffer_window_count (current_buffer))
+ {
+ update_mode_lines = 10;
+ current_buffer->prevent_redisplay_optimizations_p = 1;
+ }
+}
+
DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1, 1, 0,
doc: /* Mark current buffer as modified or unmodified according to FLAG.
A non-nil FLAG means mark the buffer modified. */)
(Lisp_Object flag)
{
+ Frestore_buffer_modified_p (flag);
+
+ /* Set update_mode_lines only if buffer is displayed in some window.
+ Packages like jit-lock or lazy-lock preserve a buffer's modified
+ state by recording/restoring the state around blocks of code.
+ Setting update_mode_lines makes redisplay consider all windows
+ (on all frames). Stealth fontification of buffers not displayed
+ would incur additional redisplay costs if we'd set
+ update_modes_lines unconditionally.
+
+ Ideally, I think there should be another mechanism for fontifying
+ buffers without "modifying" buffers, or redisplay should be
+ smarter about updating the `*' in mode lines. --gerd */
+ Fforce_mode_line_update (Qnil);
+
+ return flag;
+}
+
+DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
+ Srestore_buffer_modified_p, 1, 1, 0,
+ doc: /* Like `set-buffer-modified-p', with a difference concerning
redisplay.
+It is not ensured that mode lines will be updated to show the modified
+state of the current buffer. Use with care. */)
+ (Lisp_Object flag)
+{
+#ifdef CLASH_DETECTION
Lisp_Object fn;
-#ifdef CLASH_DETECTION
/* If buffer becoming modified, lock the file.
If buffer becoming unmodified, unlock the file. */
@@ -1376,52 +1416,6 @@
or increase MODIFF. */
: MODIFF++);
- /* Set update_mode_lines only if buffer is displayed in some window.
- Packages like jit-lock or lazy-lock preserve a buffer's modified
- state by recording/restoring the state around blocks of code.
- Setting update_mode_lines makes redisplay consider all windows
- (on all frames). Stealth fontification of buffers not displayed
- would incur additional redisplay costs if we'd set
- update_modes_lines unconditionally.
-
- Ideally, I think there should be another mechanism for fontifying
- buffers without "modifying" buffers, or redisplay should be
- smarter about updating the `*' in mode lines. --gerd */
- if (buffer_window_count (current_buffer))
- {
- update_mode_lines = 10;
- current_buffer->prevent_redisplay_optimizations_p = 1;
- }
-
- return flag;
-}
-
-DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
- Srestore_buffer_modified_p, 1, 1, 0,
- doc: /* Like `set-buffer-modified-p', with a difference concerning
redisplay.
-It is not ensured that mode lines will be updated to show the modified
-state of the current buffer. Use with care. */)
- (Lisp_Object flag)
-{
-#ifdef CLASH_DETECTION
- Lisp_Object fn;
-
- /* If buffer becoming modified, lock the file.
- If buffer becoming unmodified, unlock the file. */
-
- fn = BVAR (current_buffer, file_truename);
- /* Test buffer-file-name so that binding it to nil is effective. */
- if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
- {
- bool already = SAVE_MODIFF < MODIFF;
- if (!already && !NILP (flag))
- lock_file (fn);
- else if (already && NILP (flag))
- unlock_file (fn);
- }
-#endif /* CLASH_DETECTION */
-
- SAVE_MODIFF = NILP (flag) ? MODIFF : 0;
return flag;
}
@@ -1794,7 +1788,7 @@
/* Run replace_buffer_in_windows before making another buffer current
since set-window-buffer-start-and-point will refuse to make another
buffer current if the selected window does not show the current
- buffer. (Bug#10114) */
+ buffer (bug#10114). */
replace_buffer_in_windows (buffer);
/* Exit if replacing the buffer in windows has killed our buffer. */
@@ -5403,12 +5397,12 @@
if (PER_BUFFER_IDX (offset) == 0)
/* Did a DEFVAR_PER_BUFFER without initializing the corresponding
- slot of buffer_local_flags */
+ slot of buffer_local_flags. */
emacs_abort ();
}
-/* initialize the buffer routines */
+/* Initialize the buffer routines. */
void
syms_of_buffer (void)
{
@@ -5798,7 +5792,8 @@
DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename),
Qstringp,
- doc: /* Name of file visited in current buffer, or nil if
not visiting a file. */);
+ doc: /* Name of file visited in current buffer, or nil if
not visiting a file.
+This should be an absolute file name. */);
DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer,
file_truename),
Qstringp,
@@ -6298,6 +6293,7 @@
defsubr (&Sbuffer_local_value);
defsubr (&Sbuffer_local_variables);
defsubr (&Sbuffer_modified_p);
+ defsubr (&Sforce_mode_line_update);
defsubr (&Sset_buffer_modified_p);
defsubr (&Sbuffer_modified_tick);
defsubr (&Sbuffer_chars_modified_tick);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115064: * lisp/subr.el (force-mode-line-update): Delete, move to buffer.c.,
Stefan Monnier <=