summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Nelson <ultrono@gmail.com>2025-04-13 23:05:35 +0200
committerPaul Nelson <ultrono@gmail.com>2025-04-13 23:05:35 +0200
commitb876f634a4f448384a15ecb7fd7bb079b292d4cd (patch)
treebd2b880068e3c710f6a455b13337e6591b7af7d6
parent55384318cdca17335ce81e03cff105023e36fce3 (diff)
Improve doc-view-follow--hijack function
* doc-view-follow.el (doc-view-follow--hijack): Rewrite using funcall-interactively, following Stefan Monnier's suggestion.
-rw-r--r--doc-view-follow.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/doc-view-follow.el b/doc-view-follow.el
index 8150c03..b032cce 100644
--- a/doc-view-follow.el
+++ b/doc-view-follow.el
@@ -165,12 +165,14 @@ document buffers."
Called non-interactively, calls ORIG-FUN with ARGS. Called
interactively, toggles `doc-view-follow-mode' when supported, otherwise
toggles `follow-mode'."
- (if (called-interactively-p 'any)
- (let ((target-fun (if (doc-view-follow-supported-p major-mode)
- #'doc-view-follow-mode
- orig-fun)))
- (call-interactively target-fun))
- (apply orig-fun args)))
+ (apply (if (called-interactively-p 'any)
+ #'funcall-interactively #'funcall)
+ (if (and (doc-view-follow-supported-p major-mode)
+ ;; Let's not overdo it.
+ (called-interactively-p 'any))
+ #'doc-view-follow-mode
+ orig-fun)
+ args))
;;;###autoload
(define-minor-mode doc-view-follow-mode