|
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)
|
@@ -367,7 +369,10 @@ CHOICE is a \(key function documentation allows-capitals\).
|
367 | 369 | If SCALED, then call action with the `resize-window-uppercase-argument'."
|
368 | 370 | (let ((action (resize-window--choice-lambda choice))
|
369 | 371 | (description (resize-window--choice-documentation choice)))
|
370 |
| - (resize-window--notify "%s" description) |
| 372 | + (if (resize-window--keys-equal |
| 373 | + (resize-window--choice-keybinding choice) [?x]) |
| 374 | + (resize-window--cancel-notify) |
| 375 | + (resize-window--notify "%s" description)) |
371 | 376 | (condition-case nil
|
372 | 377 | (if scaled
|
373 | 378 | (funcall action (resize-window-uppercase-argument))
|
@@ -922,6 +927,33 @@ If STACK-SIZE is nil use `resize-window-stack-size'."
|
922 | 927 | (delq old-member resize-window--window-stack))))
|
923 | 928 | oldest-members))))
|
924 | 929 |
|
| 930 | +(defun resize-window--window-drop () |
| 931 | + "Drop the current window configuration from the stack. |
| 932 | +Ask the user for confirmation then return the removed member. |
| 933 | +
|
| 934 | +Abort if the configuration isn't in the stack or the user decided |
| 935 | +otherwise. If the configuration is dropped, switch to another one |
| 936 | +in respect to `resize-window--restore-forward' direction flag." |
| 937 | + (if (or (resize-window--stack-config-modified) |
| 938 | + (not (let ((query-replace-map (copy-keymap query-replace-map))) |
| 939 | + (define-key query-replace-map [? ] 'skip) |
| 940 | + (y-or-n-p "Drop saved state? ")))) |
| 941 | + (resize-window--notify-status) |
| 942 | + (prog1 |
| 943 | + (resize-window--pop-stack-member) |
| 944 | + (unless resize-window--restore-forward |
| 945 | + (resize-window--stack-shift-member t)) |
| 946 | + (let* ((curr-member (resize-window--get-stack-member)) |
| 947 | + (curr-config (car curr-member))) |
| 948 | + (when curr-config |
| 949 | + (resize-window--restore-config curr-config) |
| 950 | + (setq curr-config (resize-window--window-config)) |
| 951 | + (resize-window--stack-member-config curr-config) |
| 952 | + (resize-window--stack-member-svtime (current-time)))) |
| 953 | + (setq resize-window--config-modified |
| 954 | + (resize-window--stack-config-modified)) |
| 955 | + (resize-window--notify "Drop saved state")))) |
| 956 | + |
925 | 957 | (defun resize-window--window-save ()
|
926 | 958 | "Save the current window configuration in the stack.
|
927 | 959 | If the configuration is saved return its stack member.
|
|
0 commit comments