[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 2bc6aaf527 02/11: Avoid using called-interactiv
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 2bc6aaf527 02/11: Avoid using called-interactively-p |
Date: |
Mon, 13 Mar 2023 14:00:24 -0400 (EDT) |
branch: elpa/git-commit
commit 2bc6aaf5277e762c1a71ee36d1e2c2ded17a20dd
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Avoid using called-interactively-p
This function is very brittle, as described in its docstring.
---
lisp/magit-blame.el | 4 +++-
lisp/magit-section.el | 13 +++++++------
lisp/magit-wip.el | 9 ++-------
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el
index 1b9ea262dc..9048c71a05 100644
--- a/lisp/magit-blame.el
+++ b/lisp/magit-blame.el
@@ -319,8 +319,10 @@ in `magit-blame-read-only-mode-map' instead."
(define-minor-mode magit-blame-mode
"Display blame information inline."
:lighter magit-blame-mode-lighter
+ :interactive nil
(cond (magit-blame-mode
- (when (called-interactively-p 'any)
+ (unless arg
+ ;; Emacs < 28.1 doesn't support `:interactive'.
(setq magit-blame-mode nil)
(user-error
(concat "Don't call `magit-blame-mode' directly; "
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index a955603e69..3844e13780 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1064,11 +1064,12 @@ silently ignored."
;;;; Auxiliary
-(defun magit-describe-section-briefly (section &optional ident)
+(defun magit-describe-section-briefly (section &optional ident interactive)
"Show information about the section at point.
With a prefix argument show the section identity instead of the
-section lineage. This command is intended for debugging purposes."
- (interactive (list (magit-current-section) current-prefix-arg))
+section lineage. This command is intended for debugging purposes.
+\n(fn SECTION &optional IDENT)"
+ (interactive (list (magit-current-section) current-prefix-arg t))
(let ((str (format "#<%s %S %S %s-%s%s>"
(eieio-object-class section)
(let ((val (oref section value)))
@@ -1089,9 +1090,9 @@ section lineage. This command is intended for debugging
purposes."
"")
(and-let* ((m (oref section end)))
(marker-position m)))))
- (if (called-interactively-p 'any)
- (message "%s" str)
- str)))
+ (when interactive
+ (message "%s" str))
+ str))
(cl-defmethod cl-print-object ((section magit-section) stream)
"Print `magit-describe-section' result of SECTION."
diff --git a/lisp/magit-wip.el b/lisp/magit-wip.el
index cf494e1c33..6f9642c996 100644
--- a/lisp/magit-wip.el
+++ b/lisp/magit-wip.el
@@ -159,18 +159,13 @@ variant `magit-wip-after-save-mode'."
Also see `magit-wip-after-save-mode' which calls this function
automatically whenever a buffer visiting a tracked file is saved."
- (interactive)
+ (interactive (list "wip-save %s after save"))
(--when-let (magit-wip-get-ref)
(magit-with-toplevel
(let ((file (file-relative-name buffer-file-name)))
(magit-wip-commit-worktree
it (list file)
- (format (cond (msg)
- ((called-interactively-p 'any)
- "wip-save %s after save")
- (t
- "autosave %s after save"))
- file))))))
+ (format (or msg "autosave %s after save") file))))))
;;;###autoload
(define-minor-mode magit-wip-after-apply-mode
- [nongnu] elpa/git-commit updated (dec25b407b -> 9b6ae49dd1), ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit 2bc6aaf527 02/11: Avoid using called-interactively-p,
ELPA Syncer <=
- [nongnu] elpa/git-commit 6b4f7f5811 05/11: Remove magit-section-when, obsolete since v2.90.0, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit df2f6e3f5d 01/11: magit-xref-setup: Limit number of items, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit 5b31ec985f 03/11: Cleanup whitespace, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit a8c92cc35d 06/11: Remove face aliases, obsolete since v2.12.0 and v3.0.0, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit ed8067830f 07/11: Remove variables and functions obsolete since v3.3.0, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit 02f4d3366e 08/11: Remove kludge for unmaintained third-party packages, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit 9b6ae49dd1 11/11: test: Compile magit-tests.el, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit 9e888be5ac 09/11: Remove magit-obsolete.el, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit 26a705fffe 10/11: test: Stop using removed magit-status-internal alias, ELPA Syncer, 2023/03/13
- [nongnu] elpa/git-commit bc18ba942f 04/11: Remove git-commit-fill-column, obsolete since v2.11.0, ELPA Syncer, 2023/03/13