branch: elpa/magit
commit e11c71b53f426ee23e8e5ffad19dfc88b9d883b5
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
Use ensure-list more
---
lisp/magit-apply.el | 4 ++--
lisp/magit-mode.el | 2 +-
lisp/magit-section.el | 6 ++----
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index 861d781ae0a..de298482c07 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -337,7 +337,7 @@ With prefix argument FORCE, offer ignored files for
completion."
;; For backward compatibility, and because of
;; the function's name, don't require a list.
(magit-stage-1 (and force "--force")
- (if (listp files) files (list files)))))
+ (ensure-list files))))
;;;###autoload
(defun magit-stage-modified (&optional all)
@@ -465,7 +465,7 @@ ignored) files."
(magit-with-toplevel
;; For backward compatibility, and because of
;; the function's name, don't require a list.
- (magit-unstage-1 (if (listp files) files (list files)))))
+ (magit-unstage-1 (ensure-list files))))
(defun magit-unstage-1 (files)
(magit-wip-commit-before-change files " before unstage")
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 62881d2b7db..c347db87a75 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -896,7 +896,7 @@ The returned name is based on `magit-buffer-name-format' and
takes `magit-uniquify-buffer-names' and VALUE, if non-nil, into
account."
(let ((m (substring (symbol-name mode) 0 -5))
- (v (and value (format "%s" (if (listp value) value (list value)))))
+ (v (and value (format "%s" (ensure-list value))))
(n (if magit-uniquify-buffer-names
(file-name-nondirectory
(directory-file-name default-directory))
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index ba2dbf1484e..cdde1c833e6 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1597,9 +1597,7 @@ is explicitly expanded."
(cons (lambda ()
(push magit-insert-section--current
header-sections))
- (if (listp magit-insert-section-hook)
- magit-insert-section-hook
- (list magit-insert-section-hook)))))
+ (ensure-list magit-insert-section-hook))))
(magit-run-section-hook hook)
(when header-sections
(insert "\n")
@@ -2271,7 +2269,7 @@ Configuration'."
(while (< beg end)
(let* ((pos (next-single-property-change beg 'font-lock-face object end))
(val (get-text-property beg 'font-lock-face object))
- (val (if (listp val) val (list val))))
+ (val (ensure-list val)))
(put-text-property beg pos 'font-lock-face
(if append
(append val (list face))