[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/so-long-updates bcf697b 5/6: * lisp/so-long.el (so-long): Firstl
From: |
Phil |
Subject: |
scratch/so-long-updates bcf697b 5/6: * lisp/so-long.el (so-long): Firstly revert the existing action, if any |
Date: |
Sat, 16 Nov 2019 20:40:59 -0500 (EST) |
branch: scratch/so-long-updates
commit bcf697b6690ce46ec081b21dad3591b117339468
Author: Phil Sainty <address@hidden>
Commit: Phil Sainty <address@hidden>
* lisp/so-long.el (so-long): Firstly revert the existing action, if any
If multiple actions were to be layered on top of one another, we would
lose the ability to revert to the normal state.
This makes `so-long' consistent with the action commands in the menu.
A custom action combining multiple other actions could be defined, if
such behaviour was desired.
---
lisp/so-long.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/so-long.el b/lisp/so-long.el
index 6928c90..e80abc7 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -1576,8 +1576,12 @@ This command is called automatically when long lines are
detected, when
The effects of the action can be undone by calling `so-long-revert'.
-If ACTION is provided, it is used instead of `so-long-action'. With a prefix
-argument, select the action to use interactively."
+If ACTION is provided, it is used instead of `so-long-action'.
+
+With a prefix argument, select the action to use interactively.
+
+If an action was already active in the buffer, it will be reverted before
+invoking the new action."
(interactive
(list (and current-prefix-arg
(intern
@@ -1587,6 +1591,10 @@ argument, select the action to use interactively."
;; Ensure that `so-long-deferred' only triggers `so-long' once (at most).
(remove-hook 'window-configuration-change-hook #'so-long :local)
(unless so-long--calling
+ ;; Revert the existing action, if any.
+ (when so-long--active
+ (so-long-revert))
+ ;; Invoke the new action.
(let ((so-long--calling t))
(so-long--ensure-enabled)
;; ACTION takes precedence if supplied.
- branch scratch/so-long-updates created (now ca84ddd), Phil, 2019/11/16
- scratch/so-long-updates 690d065 3/6: ; * lisp/so-long.el: Use declare-function nearer the code that needs it, Phil, 2019/11/16
- scratch/so-long-updates d985eba 1/6: ; * lisp/so-long.el: Delete redundant :group declarations, Phil, 2019/11/16
- scratch/so-long-updates 95b499d 4/6: * lisp/so-long.el: Use (interactive "@") for menu commands, Phil, 2019/11/16
- scratch/so-long-updates caa1630 2/6: ; * lisp/so-long.el: Use function quoting in example configuration, Phil, 2019/11/16
- scratch/so-long-updates bcf697b 5/6: * lisp/so-long.el (so-long): Firstly revert the existing action, if any,
Phil <=
- scratch/so-long-updates ca84ddd 6/6: * lisp/so-long.el (so-long-menu): Refactor action commands, Phil, 2019/11/16