|
53 | 53 | ;; 3 : Split the window vertically.
|
54 | 54 | ;; 0 : Delete the current window.
|
55 | 55 | ;; k : Delete other windows and save the state on the stack.
|
| 56 | +;; x : Drop the current saved state. Switch to another one. |
56 | 57 | ;; s : Save the state on the stack so you may restore it later.
|
57 | 58 | ;; > : Restore to a previous saved state.
|
58 | 59 | ;; < Restore in the opposite direction.
|
@@ -160,6 +161,7 @@ should return the fine adjustment (default 1)."
|
160 | 161 | (?3 resize-window--split-window-right "Split right (save state)" nil)
|
161 | 162 | (?0 resize-window--delete-window "Delete window (save state)" nil)
|
162 | 163 | (?k resize-window--kill-other-windows "Delete other windows (save state)" nil)
|
| 164 | + (?x resize-window--window-drop "Drop state" nil) |
163 | 165 | (?s resize-window--window-save "Save state" nil)
|
164 | 166 | (?> resize-window--restore-head "Restore succeding (save state)" nil)
|
165 | 167 | (?< resize-window--restore-tail "Restore preceding (save state)" nil)
|
@@ -366,7 +368,10 @@ CHOICE is a \(key function documentation allows-capitals\).
|
366 | 368 | If SCALED, then call action with the `resize-window-uppercase-argument'."
|
367 | 369 | (let ((action (resize-window--choice-lambda choice))
|
368 | 370 | (description (resize-window--choice-documentation choice)))
|
369 |
| - (resize-window--notify "%s" description) |
| 371 | + (if (resize-window--keys-equal |
| 372 | + (resize-window--choice-keybinding choice) [?x]) |
| 373 | + (resize-window--cancel-notify) |
| 374 | + (resize-window--notify "%s" description)) |
370 | 375 | (condition-case nil
|
371 | 376 | (if scaled
|
372 | 377 | (funcall action (resize-window-uppercase-argument))
|
@@ -870,6 +875,32 @@ Return the removed stack members."
|
870 | 875 | (delq old-member resize-window--window-stack))))
|
871 | 876 | oldest-members))))
|
872 | 877 |
|
| 878 | +(defun resize-window--window-drop () |
| 879 | + "Drop the current window configuration from the stack. |
| 880 | +
|
| 881 | +Silently quit if the current window configuration is not saved. |
| 882 | +Ask the user confirmation before dropping the state then switch |
| 883 | +to another one in respect to `resize-window--restore-forward'." |
| 884 | + (if (or resize-window--config-modified |
| 885 | + (not (let ((query-replace-map (copy-keymap query-replace-map))) |
| 886 | + (define-key query-replace-map [? ] 'skip) |
| 887 | + (y-or-n-p "Drop state? ")))) |
| 888 | + (resize-window--notify-status) |
| 889 | + (resize-window--pop-stack-member) |
| 890 | + (unless resize-window--restore-forward |
| 891 | + (resize-window--push-stack-member |
| 892 | + (resize-window--pop-stack-member t))) |
| 893 | + (let* ((curr-member (resize-window--get-stack-member)) |
| 894 | + (curr-config (car curr-member))) |
| 895 | + (when curr-config |
| 896 | + (resize-window--restore-config curr-config) |
| 897 | + (setq curr-config (resize-window--window-config)) |
| 898 | + (resize-window--stack-member-config curr-config) |
| 899 | + (resize-window--stack-member-svtime (current-time)))) |
| 900 | + (setq resize-window--config-modified |
| 901 | + (resize-window--stack-config-modified)) |
| 902 | + (resize-window--notify "Drop state"))) |
| 903 | + |
873 | 904 | (defun resize-window--window-save ()
|
874 | 905 | "Save the current window configuration in the stack.
|
875 | 906 | Return its stack member if the configuration is saved.
|
|
0 commit comments