summaryrefslogtreecommitdiff
path: root/lisp/window.el
AgeCommit message (Collapse)Author
2026-03-27; Fix last fix to 'window--make-major-side-window'Martin Rudalics
* lisp/window.el (window--make-major-side-window): Fix last fix which was broken by the committer.
2026-03-27Fix recombination of side windows (Bug#80665)Emil Ingelman Sahlén
* lisp/window.el (window--make-major-side-window): Protect the sibling (the main-window group) from recombination. Without this, deleting a side window can flatten the group into the root, causing subsequent side windows on other sides to be placed incorrectly (Bug#80665). Copyright-paperwork-exempt: yes
2026-03-11; Fix quit-window-kill-buffer condition.Basil L. Contovounesios
2026-02-16Change the default value of 'split-width-threshold' from 160 to 150Juri Linkov
* lisp/window.el (split-width-threshold): Change the default value from 160 to 150 (bug#80050). (split-window-preferred-function): Mention 'split-window-preferred-direction' in the docstring.
2026-02-05; * lisp/window.el (window--frame-landscape-p): Tweak wording.Sean Whitton
2026-01-29; * lisp/window.el (window--frame-landscape-p): Improve docstring.Sean Whitton
2026-01-29Use frame-pixel-width/height to determine if frame is landscapeSpencer Baugh
* lisp/window.el (window--frame-landscape-p): New function. (split-window-sensibly): Call it (bug#80053).
2026-01-24Support cons cell for 'line-spacing'Daniel Mendler
* etc/NEWS: Announce the change. * src/dispextern.h (struct glyph_row): Add 'extra_line_spacing_above' member. (struct it): Add 'extra_line_spacing_above' member. * src/frame.h (struct frame): Add 'extra_line_spacing_above' member. Update comment for 'extra_line_spacing.' * src/buffer.c (syms_of_buffer): Update the docstring of 'line-spacing' to describe the cons cell usage. * src/buffer.h (struct buffer): Update comment for 'extra_line_spacing'. * src/frame.c (gui_set_line_spacing): Handle cons cell value for 'line-spacing'. Calculate and set 'extra_line_spacing_above' for both integer and float pairs. * src/xdisp.c (init_iterator): Initialize 'extra_line_spacing_above' from buffer or frame 'line-spacing', handling cons cells for both integer and float values. (gui_produce_glyphs): Use 'extra_line_spacing_above' to distribute spacing between ascent and descent. Update 'max_extra_line_spacing' calculation. (resize_mini_window): Take line spacing into account when resizing the mini window. Pass height of a single line to 'grow_mini_window' and 'shrink_mini_window'. * src/window.c (grow_mini_window, shrink_mini_window): Add unit argument which defines height of a single line. * src/window.h (grow_mini_window, shrink_mini_window): Adjust function prototypes accordingly with unit argument. * lisp/subr.el (total-line-spacing): New function to calculate total spacing from a number or cons cell. (posn-col-row): Use total-line-spacing. * lisp/simple.el (default-line-height): Use 'total-line-spacing'. * lisp/textmodes/picture.el (picture-mouse-set-point): Use 'total-line-spacing'. * lisp/window.el (window-default-line-height): Use 'total-line-spacing'. (window--resize-mini-window): Take 'line-spacing' into account. * test/lisp/subr-tests.el (total-line-spacing): New test. * test/src/buffer-tests.el (test-line-spacing): New test. * doc/emacs/display.texi (Display Custom): Document that 'line-spacing' can be a cons cell. (Line Height): Document the new cons cell format for 'line-spacing' to allow vertical centering. Co-authored-by: Przemysław Alexander Kamiński <alexander@kaminski.se> Co-authored-by: Daniel Mendler <mail@daniel-mendler.de>
2026-01-21Fix thinko in 'quit-restore-window'Martin Rudalics
* lisp/window.el (quit-restore-window): Try to restore the previously selected window only if WINDOW is either the selected window or BURY-OR-KILL is neither 'burying' nor 'killing'. Otherwise, this might deliberately change the selected window, for example, when 'kill-buffer-quit-windows' is non-nil and WINDOW shows the buffer to kill.
2026-01-03; * lisp/window.el (display-buffer): Fix quotation.Eli Zaretskii
2026-01-03Document more display actions in `display-buffer' (bug#80092)Phil Sainty
* lisp/window.el (display-buffer): Add docs for several missing actions: - display-buffer-in-atom-window - display-buffer-in-direction - display-buffer-in-side-window - display-buffer-reuse-mode-window - display-buffer-use-some-frame Re-arrange the actions into a less-arbitrary sequence. Re-word some descriptions to use a more consistent phrasing. Re-wrap some lines (based on the longest pre-existing line), to reduce the line count. Un-link the `pop-up-frames' symbol in the alist entry listing. (display-buffer--action-function-custom-type): Add missing actions, and re-order as above. (display-buffer-reuse-mode-window): Tweak the docstring for better consistency with other display actions.
2026-01-03Improve documentation for tab-bar buffer display actions (bug#80092)Phil Sainty
* doc/lispref/windows.texi: Document the display actions `display-buffer-in-tab' and `display-buffer-in-new-tab' and the associated alist entries `tab-name' and `tab-group'. * lisp/tab-bar.el (display-buffer-in-tab): Restructure docstring for clarity. Describe the `reusable-frames' behaviour first (as if it finds a frame with a suitable tab then the `tab-name' entry is not used). (display-buffer-in-new-tab): Use consistent wording. * lisp/window.el (display-buffer--action-function-custom-type): Add the display actions as customize choices for user options. (display-buffer): Document the display actions and alist entries.
2026-01-01; Add 2026 to copyright years.Sean Whitton
2025-12-06Merge from origin/emacs-30Eli Zaretskii
998d45d5d10 ; * lisp/calc/calc-units.el: Better reference for CODATA ... fae83f1eb8b ; Improve documentation of 'char-script-table' 3e489ed8049 ; * src/font.c (Flist_fonts): Doc fix. 4c292b6f703 ; vc-dir-clean-files: Improve docstring and message (bug#... 8a6b84dbcbc Fix doc string of 'display-buffer'
2025-11-30Fix doc string of 'display-buffer'Eli Zaretskii
* lisp/window.el (display-buffer): Add missing actions and fix quoting to avoid showing hyper-links to non-existent or irrelevant symbols. (Bug#79912)
2025-11-27(display-buffer-overriding-action): Try and discourage abuseStefan Monnier
* lisp/window.el (display-buffer-overriding-action): Document the intended use in the deluded hope to reduce the current abuse.
2025-11-22Default split-window-preferred-direction to 'longest'Sean Whitton
* lisp/window.el (split-window-preferred-direction): Change default value to 'longest'.
2025-11-16; Improve documentation of 'clone-of' window parameterMartin Rudalics
* lisp/window.el (window-state-get, window-state-put): Mention 'clone-of' parameter in doc-strings. * doc/lispref/windows.texi (Window Configurations, Window Parameters): Improve description of 'clone-of' parameter.
2025-10-18Merge from origin/emacs-30Eli Zaretskii
53aac6aecd2 ; Improve documentation of commands that split current wi...
2025-10-18; Improve documentation of commands that split current windowEli Zaretskii
* doc/emacs/sending.texi (Sending Mail): * doc/emacs/dired.texi (Dired Enter, Dired Visiting): * doc/emacs/maintaining.texi (Old Revisions) (Change Log Commands, Looking Up Identifiers): * doc/emacs/windows.texi (Displaying Buffers): * doc/emacs/files.texi (Visiting): Add cross-references to where user options are described which control how windows are split. * lisp/mail/sendmail.el (mail-other-window): * lisp/gnus/message.el (message-mail-other-window) (message-news-other-window): * lisp/replace.el (occur-mode-goto-occurrence-other-window): * lisp/vc/vc.el (vc-revision-other-window): * lisp/vc/vc-dir.el (vc-dir-find-file-other-window): * lisp/progmodes/xref.el (xref-find-definitions-other-window): * lisp/simple.el (compose-mail-other-window) (clone-indirect-buffer-other-window): * lisp/vc/add-log.el (add-change-log-entry-other-window): * lisp/view.el (view-file-other-window) (view-buffer-other-window): * lisp/window.el (switch-to-buffer-other-window): * lisp/files.el (find-file-other-window) (find-file-read-only-other-window) (find-alternate-file-other-window): * lisp/dired.el (dired-other-window) (dired-mouse-find-file-other-window) (dired-find-file-other-window, dired-jump-other-window): Mention in the doc strings how to control the way the current window is split.
2025-09-24* lisp/window.el (display-buffer-alist): Fix :key-type (bug#79496).Eli Zaretskii
2025-08-02Add 'other-window-backward' for a default binding (bug#78803)James Thomas
This moves in the opposite direction to 'other-window' by default, and is consistent with its repeat map. * lisp/window.el (other-window-backward): New function bound to 'C-x O'. (ctl-x-map): Update definition. * doc/emacs/windows.texi (Other Window): Update docs. * etc/NEWS: Annouce the new command.
2025-07-27* lisp/window.el (window--quit-restore-select-window): Use 'select-frame'.Juri Linkov
Replace 'select-frame-set-input-focus' with the less obtrusive 'select-frame' (bug#79098).
2025-07-26Merge from origin/emacs-30Eli Zaretskii
a44e9139c2f loaddefs-generate--rubric: Note about committing ldefs-bo... e4908623f23 ; Fix documentation of 'other-window' 5f3cbd62b1c ; * lisp/international/quail.el (quail-insert-kbd-layout)... 47deb38f214 ; face-font-family-alternatives, fixed-pitch: Comments. dd29b0ab66d Fix Eshell call to 'string-suffix-p' when checking for tr... cbfc095ed42 * etc/PROBLEMS: Describe how to work around screen reader... 8f00d36b63d (gnus)Scoring Tips: New tip regarding header continuation...
2025-07-26; Fix documentation of 'other-window'Eli Zaretskii
* doc/lispref/windows.texi (Cyclic Window Ordering): * lisp/window.el (other-window): Document ALL-FRAMES in interactive invocations.
2025-07-21Improve documentation of 'quit-window'Eli Zaretskii
* lisp/window.el (quit-window): Mention 'quit-window-kill-buffer'. (quit-window): Doc fix. * doc/lispref/windows.texi (Quitting Windows): * etc/NEWS: Improve documentation of 'quit-window-kill-buffer'.
2025-07-16Merge from origin/emacs-30Sean Whitton
24db9b79623 ; * lisp/vc/diff-mode.el (diff-mode): Scare-quote 'normal'. 756e7e52439 ; * lisp/window.el (window-state-put): Fix a typo (bug#79... 0fb20adf8e7 ; define-globalized-minor-mode: Fix info node link in doc...
2025-07-14; * lisp/window.el (window-state-put): Fix a typo (bug#79013).Eli Zaretskii
2025-07-09Handle multiple mouse events in display-buffer-override-next-commandJuri Linkov
* lisp/window.el (display-buffer-override-next-command): Use 'mouse-event-p' to wait for more following mouse events. * lisp/frame.el (other-frame-prefix): * lisp/tab-bar.el (other-tab-prefix): * lisp/windmove.el (windmove-display-in-direction): * lisp/window.el (other-window-prefix, same-window-prefix): Update the docstring to explain the behavior in regard to multiple consecutive mouse events (bug#78945).
2025-07-03Don't ignore mouse release event in display-buffer-override-next-commandJuri Linkov
* lisp/window.el (display-buffer-override-next-command): Don't exit on mouse down event, thus waiting for the incoming mouse up event (bug#78945).
2025-06-20Have 'split-window' forget previous window height (Bug#78835)Martin Rudalics
* lisp/window.el (split-window): When WINDOW has a 'quit-restore' parameter that specifies a previous height to restore, remove that when splitting vertically. It does more harm than good now (Bug#78835).
2025-05-19Fix thinko in 'fit-frame-to-buffer-1' (Bug#78418)Martin Rudalics
* lisp/window.el (fit-frame-to-buffer-1): Don't add extra line when character sizes evenly divide decorations sizes (Bug#78418).
2025-05-02Move documentation of this-command buffer display condition entrySean Whitton
* doc/lispref/buffers.texi (Buffer List): Document this-command buffer display condition entry. * doc/lispref/windows.texi (Choosing Window): Give an example of using this-command buffer display condition entry in display-buffer-alist. (Buffer Display Action Alists): * lisp/window.el (display-buffer): Delete documentation of this-command buffer display condition entry from these locations because it is not a buffer display action alist entry. * lisp/subr.el (buffer-match-p): Update cross reference.
2025-05-01; Fix wording of recently added documentationEli Zaretskii
* lisp/window.el (display-buffer): * doc/lispref/windows.texi (Buffer Display Action Alists): Fix wording.
2025-05-01New this-command buffer display action alist entrySean Whitton
* lisp/subr.el (buffer-match-p): New this-command cons cell condition to implement new this-command buffer display action alist entry (bug#78082). * lisp/window.el (display-buffer): * doc/lispref/windows.texi (Buffer Display Action Alists): * etc/NEWS: Document the new buffer display action alist entry.
2025-04-18Bind new window layout commands under C-x wSean Whitton
* lisp/window.el (rotate-windows-repeat-map) (window-layout-rotate-repeat-map, window-layout-flip-repeat-map): New keymaps. (window-prefix-map): Bind new window layout commands. * etc/NEWS: Rewrite entry for the new commands.
2025-04-17Don't switch to another frame if window is not on the selected frame.Juri Linkov
* lisp/window.el (window--quit-restore-select-window): Add optional arg 'frame'. Don't switch to another frame if window is not on the selected frame (bug#71386). (quit-restore-window): Provide the 'frame' arg to 'window--quit-restore-select-window' calls. Patch by martin rudalics <rudalics@gmx.at>. * test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window): No need to reselect the frame after 'quit-window'.
2025-04-03* lisp/window.el (window-deletable-p): Improve tab handling.Juri Linkov
Use frame parameter 'tab-bar-lines' instead of 'tab-bar-mode'. Remove 'window-dedicated-p' (bug#71386). Doc fix. Add 'frame' arg to 'window-list-1' (bug#59862).
2025-03-31Improve logic of tab handling when quitting windows (bug#71386)Juri Linkov
* lisp/window.el (window-deletable-p): Add tab logic that returns the symbol 'tab' for a set of predefined conditions. (window--delete): Call 'tab-bar-close-tab' when 'window-deletable-p' returns the symbol 'tab'. (quit-restore-window): Remove tab logic and merge it with frame logic. * test/lisp/tab-bar-tests.el (tab-bar-tests-close-other-tabs-default) (tab-bar-tests-close-other-tabs-with-arg): Clean up tabs afterwards. (tab-bar-tests-quit-restore-window): New test.
2025-03-31; Twice mention 'tab' value in buffer display doc-strings (Bug#71386)Martin Rudalics
* lisp/window.el (display-buffer-record-window) (window--display-buffer): Mention value 'tab' for TYPE argument (Bug#71386).
2025-03-22; Fix last change (bug#76980)Eli Zaretskii
* lisp/window.el (window--state-normalize-buffer-name): Doc fix. * doc/lispref/windows.texi (Window Configurations): Add indexing.
2025-03-22'window-state-normalize-buffer-name' option for `uniquify' buffersshipmints
If 'window-state-normalize-buffer-name' is non-nil, 'window-state-get' will normalize stored buffer names, making them easier to restore for users that use 'uniquify' buffer naming. * doc/lispref/windows.texi (Window Configurations): Document 'window-state-normalize-buffer-name'. * lisp/window.el (window-state-normalize-buffer-name): New defvar. (window--state-normalize-buffer-name): New function. (window--state-get-1): Call 'window--state-normalize-buffer-name' rather than 'buffer-name'. * etc/NEWS: Announce 'window-state-normalize-buffer-name'. (Bug#76980)
2025-03-10Fix setting dedicatedness of WINDOW in 'window--display-buffer' (Bug#76911)Martin Rudalics
* lisp/window.el (window--display-buffer): Consult WINDOW's 'window-side' parameter in order to find out whether it is a side window (Bug#76911).
2025-03-01Ignore dedicated windows in 'display-buffer-reuse-mode-window'Trevor Murphy
Ignore the dedicated windows unless the dedicated window is already displaying the buffer-to-be-displayed. In that case, the window may be reused, according to the setting of 'inhibit-same-window'. * lisp/window.el (display-buffer-reuse-mode-window): Check 'window-dedicated-p' before pushing the candidate window onto the stack. (Bug#76216)
2025-02-24Optionally have 'display-buffer' reuse windows of indirect buffersMartin Rudalics
* lisp/window.el (window-indirect-buffer-p): New function. (get-buffer-window-list): New argument INDIRECT. (display-buffer-reuse-window): New alist entry 'reuse-indirect' to reuse a window indirectly related to the BUFFER argument. * doc/lispref/windows.texi (Buffers and Windows): Describe new function 'window-indirect-buffer-p' and new argument INDIRECT of 'get-buffer-window-list'. (Buffer Display Action Functions): Describe new action alist entry 'reuse-indirect'. * etc/NEWS: Announce new argument for 'get-buffer-window-list' and new 'display-buffer' action alist entry 'reuse-indirect'.
2025-02-23Implement new user option 'quit-window-kill-buffer' (Bug#76248)Martin Rudalics
* lisp/window.el (quit-window-kill-buffer): New option. (quit-window): Handle it. * doc/lispref/windows.texi (Quitting Windows): Describe new option 'quit-window-kill-buffer'. * etc/NEWS: Announce new option 'quit-window-kill-buffer'.
2025-02-17When ignoring parameters let 'split-window' split root window (Bug#76317)Martin Rudalics
This fixes a behavior introduced by the fix of Bug#73527 that splits the main window when the caller asks for splitting the root window. * lisp/window.el (window--make-major-side-window): Bind 'ignore-window-parameters' to t so 'split-window' won't mess with the WINDOW argument when it specifies the root window. (split-window): If 'ignore-window-parameters' is non-nil, don't try to split the main window instead of the root window.
2025-02-11Delete redundant lambdas around unary functionsStefan Kangas
This is not just stylistic, but also slightly faster. These are all regular defuns, of course, as this won't work with macros and defsubsts. * lisp/calc/calc-nlfit.el (math-nlfit-fit-curve) (calc-fit-hubbert-linear-curve): * lisp/calendar/cal-tex.el (cal-tex-latexify-list): * lisp/calendar/todo-mode.el (todo-sort): * lisp/cedet/semantic/ctxt.el (semantic-ctxt-end-of-symbol-default) (semantic-ctxt-current-symbol-default): * lisp/cedet/semantic/symref.el (semantic-symref-result-get-files): * lisp/cedet/semantic/texi.el (semantic-texi-command-completion-list): * lisp/descr-text.el (describe-char): * lisp/emacs-lisp/eieio-datadebug.el (data-debug-add-specialized-thing): * lisp/emacs-lisp/rmc.el (read-multiple-choice--short-answers): * lisp/eshell/em-pred.el (eshell-modifier-alist): * lisp/gnus/gnus-cache.el (gnus-cache-articles-in-group): * lisp/gnus/gnus-dired.el (gnus-dired-attach): * lisp/help-mode.el (help-package-def): * lisp/ibuf-ext.el (ibuffer-mark-modified-buffers): * lisp/image/image-dired.el: * lisp/international/quail.el (quail-keyseq-translate) (quail-get-translations): * lisp/isearch.el (isearch-pre-command-hook) (search-within-boundaries): * lisp/mail/supercite.el (sc-ask): * lisp/mh-e/mh-e.el (mh-variant-set): * lisp/net/rcirc.el (rcirc-nick-channels, rcirc-channel-nicks): (rcirc-browse-url): * lisp/obsolete/thumbs.el (thumbs-cleanup-thumbsdir): * lisp/org/org-agenda.el (org-agenda-filter-completion-function): * lisp/org/org-table.el (org-table-eval-formula): * lisp/org/org.el (org-set-regexps-and-options): * lisp/org/ox.el (org-export--get-inbuffer-options): * lisp/ses.el (ses-range): * lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize): * lisp/textmodes/ispell.el (ispell-begin-tex-skip-regexp): * lisp/vc/vc-cvs.el (vc-cvs-stay-local-p): * lisp/window.el (window--state-get-1): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-all-groups-work): Delete redundant lambdas around unary functions. (Bug#66816)
2025-02-08Prioritize split along the longest edge by default.Nicolas Despres
Currently, `split-window-sensibly' prefers to try to split vertically first, disregarding the actual shape of the frame or the user preferences. This is a good default when Emacs is taller than wider. However, when Emacs is in full-screen (landscape screen layout), trying to split vertically may not be what the user expected, since there is plenty of space available on the right. Typical scenario: Emacs is in landscape layout, one buffer is open in a window covering the entire frame. Another buffer is opened in a second window (C-x 4 f). Both splits are feasible but users may prefer the horizontal one. This patch preserves the behavior of the `split-height-threshold' and `split-width-threshold' variables. Splitting continues not to be permitted if the edge length is below the threshold. * lisp/window.el (split-window-sensibly): First tried split direction follows user preferences. * etc/NEWS: Add an entry for new variable `split-window-preferred-direction'. * doc/emacs/windows.texi: Document new variable.
2025-01-31In 'replace-buffer-in-windows' try to preserve current buffer (Bug#75949)Martin Rudalics
* lisp/window.el (replace-buffer-in-windows): Preserve current buffer when 'kill-buffer-quit-windows' is non-nil and a window showing BUFFER shall be quit. Running 'kill-buffer-hook' relies on it (Bug#75949).