summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-02-19 11:38:09 +0100
committerStefan Kangas <stefankangas@gmail.com>2023-02-19 11:38:09 +0100
commit34f44ae07e0a3ba7ae43d79ab71b03795cb4acf5 (patch)
tree4e0cb51e380efd9c6e91e2f6557604e1a554ea79 /src/window.c
parent750bc57cbb8d081566e671e8fc3e27a82588c197 (diff)
parent871cf33a450a34fcace7fe7c5448fe3043697005 (diff)
downloademacs-34f44ae07e0a3ba7ae43d79ab71b03795cb4acf5.tar.gz
Merge from origin/emacs-29
871cf33a450 ; * admin/make-tarball.txt: Minor copyedit. 4faebba2fed Fix invocation of File->Close from the menu bar cd05fca5f78 ; Improve documentation of 'native-comp-enable-subr-tramp... c61a30e1601 Update thumbnail buffer's header more 4c49452cdef (treesit-query-validate): Fix reusing the output buffer d560dc5044a (rust-ts-mode--font-lock-settings): Highlight closure par... c15bc91e1bf * Fix `native-comp-enable-subr-trampolines' semantic 774051873d5 Fix documentation of 'just-one-space' and 'delete-horizon... 7337f072500 ; Remove NEWS entry about deleted variable. fb5299ba099 ; Fix wording of last change. 9f508cef85d Fix 'display-buffer-use-least-recent-window' 5190ea6259a Fix point moving when calling python-shell-send-region 6c0d8210175 (project-try-vc): Remove unused defvar/require 4f9862e4356 ; Fix typo a638c79bc5c Delete redundant question from Gnus FAQ 4a90d67eb68 Slightly improve hashcash documentation 6ea3c105ab1 Fix cursor motion when there's line-prefix and display st... e985466556c Fix comment in treesit_record_change (bug#61369) 1e5cebc88bb Spell out RPN abbreviation in Calc manual intro # Conflicts: # etc/NEWS # lisp/window.el
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/window.c b/src/window.c
index 9334f922f89..bf89261e79c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -762,10 +762,15 @@ future use. */)
DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
doc: /* Return the use time of window WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-The window with the highest use time is the most recently selected
-one. The window with the lowest use time is the least recently
-selected one. */)
+WINDOW must specify a live window and defaults to the selected one.
+
+The window with the highest use time is usually the one most recently
+selected by calling `select-window' with NORECORD nil. The window with
+the lowest use time is usually the least recently selected one chosen in
+such a way.
+
+Note that the use time of a window can be also changed by calling
+`window-bump-use-time' for that window. */)
(Lisp_Object window)
{
return make_fixnum (decode_live_window (window)->use_time);
@@ -773,15 +778,27 @@ selected one. */)
DEFUN ("window-bump-use-time", Fwindow_bump_use_time,
Swindow_bump_use_time, 0, 1, 0,
- doc: /* Mark WINDOW as having been most recently used.
-WINDOW must be a live window and defaults to the selected one. */)
+ doc: /* Mark WINDOW as second most recently used.
+WINDOW must specify a live window.
+
+If WINDOW is not selected and the selected window has the highest use
+time of all windows, set the use time of WINDOW to that of the selected
+window, increase the use time of the selected window by one and return
+the new use time of WINDOW. Otherwise, do nothing and return nil. */)
(Lisp_Object window)
{
struct window *w = decode_live_window (window);
+ struct window *sw = XWINDOW (selected_window);
- w->use_time = ++window_select_count;
+ if (w != sw && sw->use_time == window_select_count)
+ {
+ w->use_time = window_select_count;
+ sw->use_time = ++window_select_count;
- return Qnil;
+ return make_fixnum (w->use_time);
+ }
+ else
+ return Qnil;
}
DEFUN ("window-pixel-width", Fwindow_pixel_width, Swindow_pixel_width, 0, 1, 0,