[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 3450970: * lisp/windmove.el (windmove-create-window
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master 3450970: * lisp/windmove.el (windmove-create-window): New defcustom (bug#32790). |
Date: |
Thu, 8 Nov 2018 16:27:56 -0500 (EST) |
branch: master
commit 3450970dacd73506ef3d6eed6709375be5ccf2b6
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
* lisp/windmove.el (windmove-create-window): New defcustom (bug#32790).
(windmove-do-window-select): Use it.
---
etc/NEWS | 5 +++++
lisp/windmove.el | 30 +++++++++++++++++++++++++-----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 1020a2a..29bbde9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -292,6 +292,11 @@ In the current follow group of windows, "ghost" cursors
are no longer
displayed in the non-selected follow windows. To get the old behavior
back, customize follow-hide-ghost-cursors to nil.
+** Windmove
+
+*** windmove-create-window when non-nil makes a new window on moving off
+the edge of the frame.
+
** Octave mode
The mode is automatically enabled in files that start with the
'function' keyword.
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 42e10b5..598e495 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -149,6 +149,15 @@ is inactive."
:type 'boolean
:group 'windmove)
+(defcustom windmove-create-window nil
+ "Whether movement off the edge of the frame creates a new window.
+If this variable is set to t, moving left from the leftmost window in
+a frame will create a new window on the left, and similarly for the other
+directions."
+ :type 'boolean
+ :group 'windmove
+ :version "27.1")
+
;; If your Emacs sometimes places an empty column between two adjacent
;; windows, you may wish to set this delta to 2.
(defcustom windmove-window-distance-delta 1
@@ -471,8 +480,15 @@ DIR, ARG, and WINDOW are handled as by
`windmove-other-window-loc'."
(defun windmove-do-window-select (dir &optional arg window)
"Move to the window at direction DIR.
DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'.
-If no window is at direction DIR, an error is signaled."
+If no window is at direction DIR, an error is signaled.
+If `windmove-create-window' is non-nil, instead of signalling an error
+it creates a new window at direction DIR ."
(let ((other-window (windmove-find-other-window dir arg window)))
+ (when (and windmove-create-window
+ (or (null other-window)
+ (and (window-minibuffer-p other-window)
+ (not (minibuffer-window-active-p other-window)))))
+ (setq other-window (split-window window nil dir)))
(cond ((null other-window)
(user-error "No window %s from selected window" dir))
((and (window-minibuffer-p other-window)
@@ -493,7 +509,8 @@ With no prefix argument, or with prefix argument equal to
zero,
\"left\" is relative to the position of point in the window; otherwise
it is relative to the top edge (for positive ARG) or the bottom edge
\(for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil that creates a new window."
(interactive "P")
(windmove-do-window-select 'left arg))
@@ -504,7 +521,8 @@ With no prefix argument, or with prefix argument equal to
zero, \"up\"
is relative to the position of point in the window; otherwise it is
relative to the left edge (for positive ARG) or the right edge (for
negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil that creates a new window."
(interactive "P")
(windmove-do-window-select 'up arg))
@@ -515,7 +533,8 @@ With no prefix argument, or with prefix argument equal to
zero,
\"right\" is relative to the position of point in the window;
otherwise it is relative to the top edge (for positive ARG) or the
bottom edge (for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil that creates a new window."
(interactive "P")
(windmove-do-window-select 'right arg))
@@ -526,7 +545,8 @@ With no prefix argument, or with prefix argument equal to
zero,
\"down\" is relative to the position of point in the window; otherwise
it is relative to the left edge (for positive ARG) or the right edge
\(for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil that creates a new window."
(interactive "P")
(windmove-do-window-select 'down arg))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 3450970: * lisp/windmove.el (windmove-create-window): New defcustom (bug#32790).,
Juri Linkov <=