diff options
| author | Eli Zaretskii | 2015-10-24 17:58:34 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-10-24 17:58:34 +0300 |
| commit | 7a6968b45f2b93d984c5c3fcd5fce68d6e5b6ea9 (patch) | |
| tree | a76a59a8fb35f84b507d02a4580bd58c15fa1939 | |
| parent | 59a2ad3e75442f89f88e2cac304b09fb50e70cb6 (diff) | |
| download | emacs-7a6968b45f2b93d984c5c3fcd5fce68d6e5b6ea9.tar.gz emacs-7a6968b45f2b93d984c5c3fcd5fce68d6e5b6ea9.zip | |
An even better fix for bug#21739
* src/window.c (set_window_buffer): If the window is the frame's
selected window, set update_mode_lines, not the window's
update_mode_line flag. (Bug#21739)
* src/buffer.c (Fkill_buffer): Undo last change.
(set_update_modelines_for_buf): Function deleted.
| -rw-r--r-- | src/buffer.c | 47 | ||||
| -rw-r--r-- | src/window.c | 9 |
2 files changed, 14 insertions, 42 deletions
diff --git a/src/buffer.c b/src/buffer.c index 84768767c6b..380a7af33c1 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1611,19 +1611,6 @@ compact_buffer (struct buffer *buffer) | |||
| 1611 | } | 1611 | } |
| 1612 | } | 1612 | } |
| 1613 | 1613 | ||
| 1614 | /* Set the global update_mode_lines variable non-zero if the buffer | ||
| 1615 | was displayed in some window. This is needed to catch the | ||
| 1616 | attention of redisplay to changes that might require redisplay of | ||
| 1617 | the frame title (which uses the same variables as mode lines) when | ||
| 1618 | the buffer object cannot be used for recording that fact, e.g. if | ||
| 1619 | the buffer is killed. */ | ||
| 1620 | static void | ||
| 1621 | set_update_modelines_for_buf (bool disp) | ||
| 1622 | { | ||
| 1623 | if (disp) | ||
| 1624 | update_mode_lines = 42; | ||
| 1625 | } | ||
| 1626 | |||
| 1627 | DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", | 1614 | DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", |
| 1628 | doc: /* Kill the buffer specified by BUFFER-OR-NAME. | 1615 | doc: /* Kill the buffer specified by BUFFER-OR-NAME. |
| 1629 | The argument may be a buffer or the name of an existing buffer. | 1616 | The argument may be a buffer or the name of an existing buffer. |
| @@ -1646,7 +1633,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1646 | struct buffer *b; | 1633 | struct buffer *b; |
| 1647 | Lisp_Object tem; | 1634 | Lisp_Object tem; |
| 1648 | struct Lisp_Marker *m; | 1635 | struct Lisp_Marker *m; |
| 1649 | bool buffer_was_displayed = false; | ||
| 1650 | 1636 | ||
| 1651 | if (NILP (buffer_or_name)) | 1637 | if (NILP (buffer_or_name)) |
| 1652 | buffer = Fcurrent_buffer (); | 1638 | buffer = Fcurrent_buffer (); |
| @@ -1661,8 +1647,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1661 | if (!BUFFER_LIVE_P (b)) | 1647 | if (!BUFFER_LIVE_P (b)) |
| 1662 | return Qnil; | 1648 | return Qnil; |
| 1663 | 1649 | ||
| 1664 | buffer_was_displayed = buffer_window_count (b); | ||
| 1665 | |||
| 1666 | /* Run hooks with the buffer to be killed the current buffer. */ | 1650 | /* Run hooks with the buffer to be killed the current buffer. */ |
| 1667 | { | 1651 | { |
| 1668 | ptrdiff_t count = SPECPDL_INDEX (); | 1652 | ptrdiff_t count = SPECPDL_INDEX (); |
| @@ -1689,10 +1673,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1689 | 1673 | ||
| 1690 | /* If the hooks have killed the buffer, exit now. */ | 1674 | /* If the hooks have killed the buffer, exit now. */ |
| 1691 | if (!BUFFER_LIVE_P (b)) | 1675 | if (!BUFFER_LIVE_P (b)) |
| 1692 | { | 1676 | return unbind_to (count, Qt); |
| 1693 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1694 | return unbind_to (count, Qt); | ||
| 1695 | } | ||
| 1696 | 1677 | ||
| 1697 | /* Then run the hooks. */ | 1678 | /* Then run the hooks. */ |
| 1698 | run_hook (Qkill_buffer_hook); | 1679 | run_hook (Qkill_buffer_hook); |
| @@ -1701,10 +1682,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1701 | 1682 | ||
| 1702 | /* If the hooks have killed the buffer, exit now. */ | 1683 | /* If the hooks have killed the buffer, exit now. */ |
| 1703 | if (!BUFFER_LIVE_P (b)) | 1684 | if (!BUFFER_LIVE_P (b)) |
| 1704 | { | 1685 | return Qt; |
| 1705 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1706 | return Qt; | ||
| 1707 | } | ||
| 1708 | 1686 | ||
| 1709 | /* We have no more questions to ask. Verify that it is valid | 1687 | /* We have no more questions to ask. Verify that it is valid |
| 1710 | to kill the buffer. This must be done after the questions | 1688 | to kill the buffer. This must be done after the questions |
| @@ -1732,10 +1710,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1732 | 1710 | ||
| 1733 | /* Exit if we now have killed the base buffer (Bug#11665). */ | 1711 | /* Exit if we now have killed the base buffer (Bug#11665). */ |
| 1734 | if (!BUFFER_LIVE_P (b)) | 1712 | if (!BUFFER_LIVE_P (b)) |
| 1735 | { | 1713 | return Qt; |
| 1736 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1737 | return Qt; | ||
| 1738 | } | ||
| 1739 | } | 1714 | } |
| 1740 | 1715 | ||
| 1741 | /* Run replace_buffer_in_windows before making another buffer current | 1716 | /* Run replace_buffer_in_windows before making another buffer current |
| @@ -1746,10 +1721,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1746 | 1721 | ||
| 1747 | /* Exit if replacing the buffer in windows has killed our buffer. */ | 1722 | /* Exit if replacing the buffer in windows has killed our buffer. */ |
| 1748 | if (!BUFFER_LIVE_P (b)) | 1723 | if (!BUFFER_LIVE_P (b)) |
| 1749 | { | 1724 | return Qt; |
| 1750 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1751 | return Qt; | ||
| 1752 | } | ||
| 1753 | 1725 | ||
| 1754 | /* Make this buffer not be current. Exit if it is the sole visible | 1726 | /* Make this buffer not be current. Exit if it is the sole visible |
| 1755 | buffer. */ | 1727 | buffer. */ |
| @@ -1778,10 +1750,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1778 | /* Killing buffer processes may run sentinels which may have killed | 1750 | /* Killing buffer processes may run sentinels which may have killed |
| 1779 | our buffer. */ | 1751 | our buffer. */ |
| 1780 | if (!BUFFER_LIVE_P (b)) | 1752 | if (!BUFFER_LIVE_P (b)) |
| 1781 | { | 1753 | return Qt; |
| 1782 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1783 | return Qt; | ||
| 1784 | } | ||
| 1785 | 1754 | ||
| 1786 | /* These may run Lisp code and into infinite loops (if someone | 1755 | /* These may run Lisp code and into infinite loops (if someone |
| 1787 | insisted on circular lists) so allow quitting here. */ | 1756 | insisted on circular lists) so allow quitting here. */ |
| @@ -1813,10 +1782,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1813 | 1782 | ||
| 1814 | /* Deleting an auto-save file could have killed our buffer. */ | 1783 | /* Deleting an auto-save file could have killed our buffer. */ |
| 1815 | if (!BUFFER_LIVE_P (b)) | 1784 | if (!BUFFER_LIVE_P (b)) |
| 1816 | { | 1785 | return Qt; |
| 1817 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1818 | return Qt; | ||
| 1819 | } | ||
| 1820 | 1786 | ||
| 1821 | if (b->base_buffer) | 1787 | if (b->base_buffer) |
| 1822 | { | 1788 | { |
| @@ -1915,7 +1881,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1915 | if (!NILP (Vrun_hooks)) | 1881 | if (!NILP (Vrun_hooks)) |
| 1916 | call1 (Vrun_hooks, Qbuffer_list_update_hook); | 1882 | call1 (Vrun_hooks, Qbuffer_list_update_hook); |
| 1917 | 1883 | ||
| 1918 | set_update_modelines_for_buf (buffer_was_displayed); | ||
| 1919 | return Qt; | 1884 | return Qt; |
| 1920 | } | 1885 | } |
| 1921 | 1886 | ||
diff --git a/src/window.c b/src/window.c index 8ed0f32a694..a8605ee628c 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3271,7 +3271,14 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3271 | /* Maybe we could move this into the `if' but it's not obviously safe and | 3271 | /* Maybe we could move this into the `if' but it's not obviously safe and |
| 3272 | I doubt it's worth the trouble. */ | 3272 | I doubt it's worth the trouble. */ |
| 3273 | wset_redisplay (w); | 3273 | wset_redisplay (w); |
| 3274 | w->update_mode_line = true; | 3274 | /* If this window is the selected window on its frame, set the |
| 3275 | global variable update_mode_lines, so that x_consider_frame_title | ||
| 3276 | will consider this frame's title for rtedisplay. */ | ||
| 3277 | Lisp_Object fselected_window = XFRAME (WINDOW_FRAME (w))->selected_window; | ||
| 3278 | if (WINDOWP (fselected_window) && XWINDOW (fselected_window) == w) | ||
| 3279 | update_mode_lines = 42; | ||
| 3280 | else | ||
| 3281 | w->update_mode_line = true; | ||
| 3275 | 3282 | ||
| 3276 | /* We must select BUFFER to run the window-scroll-functions and to look up | 3283 | /* We must select BUFFER to run the window-scroll-functions and to look up |
| 3277 | the buffer-local value of Vwindow_point_insertion_type. */ | 3284 | the buffer-local value of Vwindow_point_insertion_type. */ |