aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sainty2019-11-17 02:11:20 +1300
committerPhil Sainty2019-11-18 21:25:36 +1300
commit83c50cc6efacf701ba64c2f4175ece7ebff9b338 (patch)
tree73f1bec4fc5c9a4c15eff2c8eb98dafbb034276c
parent6b361d95302c23dc65468ff9f5828577625e0fe2 (diff)
downloademacs-83c50cc6efacf701ba64c2f4175ece7ebff9b338.tar.gz
emacs-83c50cc6efacf701ba64c2f4175ece7ebff9b338.zip
* lisp/so-long.el (so-long): Firstly revert the existing action, if any
This makes `so-long' consistent with the action commands in the menu. If multiple actions were to be layered on top of one another, we would lose the ability to revert to the normal state. Custom actions combining multiple other actions can be defined if necessary.
-rw-r--r--lisp/so-long.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/so-long.el b/lisp/so-long.el
index 6928c902d12..e80abc76a53 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
1576 1576
1577The effects of the action can be undone by calling `so-long-revert'. 1577The effects of the action can be undone by calling `so-long-revert'.
1578 1578
1579If ACTION is provided, it is used instead of `so-long-action'. With a prefix 1579If ACTION is provided, it is used instead of `so-long-action'.
1580argument, select the action to use interactively." 1580
1581With a prefix argument, select the action to use interactively.
1582
1583If an action was already active in the buffer, it will be reverted before
1584invoking the new action."
1581 (interactive 1585 (interactive
1582 (list (and current-prefix-arg 1586 (list (and current-prefix-arg
1583 (intern 1587 (intern
@@ -1587,6 +1591,10 @@ argument, select the action to use interactively."
1587 ;; Ensure that `so-long-deferred' only triggers `so-long' once (at most). 1591 ;; Ensure that `so-long-deferred' only triggers `so-long' once (at most).
1588 (remove-hook 'window-configuration-change-hook #'so-long :local) 1592 (remove-hook 'window-configuration-change-hook #'so-long :local)
1589 (unless so-long--calling 1593 (unless so-long--calling
1594 ;; Revert the existing action, if any.
1595 (when so-long--active
1596 (so-long-revert))
1597 ;; Invoke the new action.
1590 (let ((so-long--calling t)) 1598 (let ((so-long--calling t))
1591 (so-long--ensure-enabled) 1599 (so-long--ensure-enabled)
1592 ;; ACTION takes precedence if supplied. 1600 ;; ACTION takes precedence if supplied.