summaryrefslogtreecommitdiff
path: root/lisp/so-long.el
diff options
context:
space:
mode:
authorPhil Sainty <psainty@orcon.net.nz>2019-11-16 15:48:44 +1300
committerPhil Sainty <psainty@orcon.net.nz>2019-11-18 21:25:36 +1300
commit33676820bdb0fac8ebd43ab098ad13d8098f3586 (patch)
treea4e00fdc443747599ed042e863756a81f331bd64 /lisp/so-long.el
parent83c50cc6efacf701ba64c2f4175ece7ebff9b338 (diff)
downloademacs-33676820bdb0fac8ebd43ab098ad13d8098f3586.tar.gz
emacs-33676820bdb0fac8ebd43ab098ad13d8098f3586.tar.bz2
emacs-33676820bdb0fac8ebd43ab098ad13d8098f3586.zip
lisp/so-long.el: Refactor menu action commands
* lisp/so-long.el (so-long-menu): Call `so-long' with an ACTION argument instead of using `so-long-menu-item-replace-action'. (so-long-menu-item-replace-action): Remove the deprecated function. * test/lisp/so-long-tests/so-long-tests.el (so-long-tests-so-long-menu-item-replace-action): Update the test.
Diffstat (limited to 'lisp/so-long.el')
-rw-r--r--lisp/so-long.el35
1 files changed, 13 insertions, 22 deletions
diff --git a/lisp/so-long.el b/lisp/so-long.el
index e80abc76a53..33b7155d044 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -902,14 +902,19 @@ If RESET is non-nil, remove any existing values before storing the new ones."
`(menu-item
,label
,(let ((sym (make-symbol "so-long-menu-item-replace-action")))
- ;; Using a symbol here, so that `describe-key' on the menu item
- ;; produces the `so-long-menu-item-replace-action' documentation.
- (defalias sym
- (apply-partially #'so-long-menu-item-replace-action item)
- (documentation #'so-long-menu-item-replace-action))
- (put sym 'interactive-form '(interactive "@"))
- ;; We use "@" as commands in the mode-line menu may be
- ;; triggered by mouse when some other window is selected.
+ ;; We make a symbol so that `describe-key' on the menu item
+ ;; produces something more descriptive than byte code. There is
+ ;; no interned `so-long-menu-item-replace-action' which might
+ ;; make this slightly confusing -- but only in the rare situation
+ ;; when someone uses `describe-key' on one of these menu items,
+ ;; and then wants to find more information. We mitigate this by
+ ;; making the following docstring very clear.
+ (defalias sym (lambda () (interactive "@") (so-long key))
+ ;; We use "@" as commands in the mode-line menu may be
+ ;; triggered by mouse when some other window is selected.
+ "Revert the current action and invoke the chosen replacement.
+
+This commmand calls `so-long' with the selected action as an argument.")
sym)
:enable (not (and so-long--active
(eq ',actionfunc so-long-function)
@@ -925,20 +930,6 @@ If RESET is non-nil, remove any existing values before storing the new ones."
'(menu-item "Customize" so-long-customize))
map))
-(defun so-long-menu-item-replace-action (replacement)
- "Revert the current action and invoke the specified replacement.
-
-REPLACEMENT is a `so-long-action-alist' item."
- (interactive)
- (when so-long--active
- (so-long-revert))
- (cl-destructuring-bind (_key _label actionfunc revertfunc)
- replacement
- (setq so-long-function actionfunc)
- (setq so-long-revert-function revertfunc)
- (setq this-command 'so-long)
- (so-long)))
-
;;;###autoload
(defun so-long-commentary ()
"View the so-long documentation in `outline-mode'."