Handle buffer move/select/swap to last win nr +1 (#14015)
problem: The following error messages are shown. When trying to move, select or swap the current buffer, to a window nr greater than the total number of open windows. For example: With only one window open. `SPC b 2` >ad-Advice-select-window: Wrong type argument: window-live-p, nil In the Buffer Transient State (`SPC b .`): - `C-2` (`spacemacs/buffer-transient-state/winum-select-window-2`) >Wrong type argument: window-valid-p, #<window 12> - `2` (`spacemacs/buffer-transient-state/move-buffer-window-no-follow-2`) >Wrong type argument: window-live-p, #<window 14> - `M-2` (`spacemacs/buffer-transient-state/swap-buffer-window-no-follow-2`) >Wrong type argument: stringp, nil Solution: Show a descriptive message, if the target window nr is greater than the number of open windows. And ignore the LV buffer (hydra).
This commit is contained in:
parent
b5e74cd463
commit
0f65b000da
|
@ -1363,6 +1363,7 @@ Other:
|
|||
- Fixed ~SPC h f~ =helm-spacemacs-help-faq= (thanks to duianto)
|
||||
- Fixed =cl= package deprecated =letf= (thanks to duianto)
|
||||
- Fixed origami bindings in normal mode (thanks to Tomasz Kowal)
|
||||
- Handled buffer move/select/swap to last window nr +1 (thanks to duianto)
|
||||
- Set =evil-undo-system= to =undo-tree= (thanks to duianto)
|
||||
*** Layer changes and fixes
|
||||
**** Agda
|
||||
|
|
|
@ -261,30 +261,35 @@ Dedicated (locked) windows are left untouched."
|
|||
"Moves a buffer to a window, using the spacemacs numbering. follow-focus-p
|
||||
controls whether focus moves to new window (with buffer), or stays on current"
|
||||
(interactive)
|
||||
(let ((b (current-buffer))
|
||||
(w1 (selected-window))
|
||||
(w2 (winum-get-window-by-number windownum)))
|
||||
(unless (eq w1 w2)
|
||||
(set-window-buffer w2 b)
|
||||
(switch-to-prev-buffer)
|
||||
(unrecord-window-buffer w1 b)))
|
||||
(when follow-focus-p (select-window (winum-get-window-by-number windownum))))
|
||||
(if (> windownum (length (window-list)))
|
||||
(message "No window numbered %s" windownum)
|
||||
(let ((b (current-buffer))
|
||||
(w1 (selected-window))
|
||||
(w2 (winum-get-window-by-number windownum)))
|
||||
(unless (eq w1 w2)
|
||||
(set-window-buffer w2 b)
|
||||
(switch-to-prev-buffer)
|
||||
(unrecord-window-buffer w1 b))
|
||||
(when follow-focus-p
|
||||
(select-window (winum-get-window-by-number windownum))))))
|
||||
|
||||
(defun spacemacs/swap-buffers-to-window (windownum follow-focus-p)
|
||||
"Swaps visible buffers between active window and selected window.
|
||||
follow-focus-p controls whether focus moves to new window (with buffer), or
|
||||
stays on current"
|
||||
(interactive)
|
||||
(let* ((b1 (current-buffer))
|
||||
(w1 (selected-window))
|
||||
(w2 (winum-get-window-by-number windownum))
|
||||
(b2 (window-buffer w2)))
|
||||
(unless (eq w1 w2)
|
||||
(set-window-buffer w1 b2)
|
||||
(set-window-buffer w2 b1)
|
||||
(unrecord-window-buffer w1 b1)
|
||||
(unrecord-window-buffer w2 b2)))
|
||||
(when follow-focus-p (winum-select-window-by-number windownum)))
|
||||
(if (> windownum (length (window-list)))
|
||||
(message "No window numbered %s" windownum)
|
||||
(let* ((b1 (current-buffer))
|
||||
(w1 (selected-window))
|
||||
(w2 (winum-get-window-by-number windownum))
|
||||
(b2 (window-buffer w2)))
|
||||
(unless (eq w1 w2)
|
||||
(set-window-buffer w1 b2)
|
||||
(set-window-buffer w2 b1)
|
||||
(unrecord-window-buffer w1 b1)
|
||||
(unrecord-window-buffer w2 b2)))
|
||||
(when follow-focus-p (winum-select-window-by-number windownum))))
|
||||
|
||||
(dotimes (i 9)
|
||||
(let ((n (+ i 1)))
|
||||
|
|
|
@ -431,7 +431,7 @@
|
|||
(progn
|
||||
(setq winum-auto-assign-0-to-minibuffer nil
|
||||
winum-auto-setup-mode-line nil
|
||||
winum-ignored-buffers '(" *which-key*"))
|
||||
winum-ignored-buffers '(" *LV*" " *which-key*"))
|
||||
(spacemacs/set-leader-keys
|
||||
"`" 'winum-select-window-by-number
|
||||
"²" 'winum-select-window-by-number
|
||||
|
|
Loading…
Reference in New Issue