]> git.eshelyaron.com Git - emacs.git/commitdiff
; Ensure 'seq-max' argument is non empty
authorEshel Yaron <me@eshelyaron.com>
Sat, 17 Feb 2024 07:45:09 +0000 (08:45 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 17 Feb 2024 07:45:09 +0000 (08:45 +0100)
* lisp/faces.el (completion-face-name-affixation)
* lisp/minibuffer.el (completion-styles-affixation)
(completion-file-name-affixation)
(minibuffer-narrow-buffer-completions)
(completion-buffer-name-affixation)
* lisp/simple.el (read-extended-command--affixation): Add 0 to
beginning of 'seq-max' argument to ensure it is non empty.

lisp/faces.el
lisp/minibuffer.el
lisp/simple.el

index 272c714871f349b31f7811a065f3354e657780ef..2cbf1e56583f0aa34fd8e82c53b312ec8690755b 100644 (file)
@@ -1143,11 +1143,11 @@ of `read-face-name-sample-text', which see."
             (samp-list (mapcar (lambda (name)
                                  (cons name (propertize text 'face name)))
                                names))
-            (max-samp (seq-max (mapcar #'string-pixel-width
-                                       (mapcar #'cdr samp-list)))))
+            (max-samp (seq-max (cons 0 (mapcar #'string-pixel-width
+                                               (mapcar #'cdr samp-list))))))
        (if (eq (cdr-safe read-face-name-sample-text) 'after)
            ;; Sample comes after the face name.
-           (let ((max-name (seq-max (mapcar #'string-width names))))
+           (let ((max-name (seq-max (cons 0 (mapcar #'string-width names)))))
              (lambda (name)
                (let* ((samp (cdr (assoc name samp-list)))
                       (padw (- max-samp (string-pixel-width samp))))
index 911412e2b8cf970da671e5f77fc93da8110b3de0..d4b808b15846db7c96ff7d2e57e07b0fe2a61228 100644 (file)
@@ -2756,7 +2756,7 @@ current order instead."
 
 (defun completion-styles-affixation (names)
   "Return completion affixations for completion styles list NAMES."
-  (let ((max-name (seq-max (mapcar #'string-width names))))
+  (let ((max-name (seq-max (cons 0 (mapcar #'string-width names)))))
     (mapcar
      (lambda (name)
        (list name
@@ -3576,7 +3576,7 @@ same as `substitute-in-file-name'."
 
 (defun completion-file-name-affixation (files)
   "Return completion affixations for file list FILES."
-  (let ((max-file (seq-max (mapcar #'string-width files))))
+  (let ((max-file (seq-max (cons 0 (mapcar #'string-width files)))))
     (mapcar
      (lambda (file)
        (let ((full (substitute-in-file-name
@@ -4063,7 +4063,7 @@ See `read-file-name' for the meaning of the arguments."
                    (mapcar
                     (apply-partially #'buffer-local-value 'major-mode)
                     (mapcar #'get-buffer names))))))
-         (max (seq-max (mapcar #'string-width modes)))
+         (max (seq-max (cons 0 (mapcar #'string-width modes))))
          (name
           (completing-read
            "Restrict to mode: "
@@ -4089,14 +4089,14 @@ See `read-file-name' for the meaning of the arguments."
 
 (defun completion-buffer-name-affixation (names)
   "Return completion affixations for buffer name list NAMES."
-  (let ((max-name (seq-max (mapcar #'string-width names)))
+  (let ((max-name (seq-max (cons 0 (mapcar #'string-width names))))
         (max-mode
          (seq-max
-          (mapcar #'string-width
-                  (mapcar #'symbol-name
-                          (mapcar (apply-partially #'buffer-local-value
-                                                   'major-mode)
-                                  (mapcar #'get-buffer names)))))))
+          (cons 0 (mapcar #'string-width
+                          (mapcar #'symbol-name
+                                  (mapcar (apply-partially #'buffer-local-value
+                                                           'major-mode)
+                                          (mapcar #'get-buffer names))))))))
     (mapcar
      (lambda (name)
        (let* ((buf (get-buffer name))
index e80e33a963062732aa67d20be7baaf4db297925c..b36a04c93efee35eabf41eebdcef2d965b65393f 100644 (file)
@@ -2480,9 +2480,9 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER."
          (eq (get-text-property (point) 'category) category))))
 
 (defun read-extended-command--affixation (command-names)
-  (let* ((max-name (seq-max (mapcar #'string-width
-                                    (or (remove nil command-names)
-                                        '("")))))
+  (let* ((max-name (seq-max
+                    (cons 0 (mapcar #'string-width
+                                    (remove nil command-names)))))
          (bindings
           (when suggest-key-bindings
             (with-selected-window (or (minibuffer-selected-window)
@@ -2496,9 +2496,9 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER."
                    (cons fun (and binding (not (stringp binding))
                                   (key-description binding)))))
                command-names))))
-         (max-bind (seq-max (mapcar #'string-width
-                                    (or (remove nil (mapcar #'cdr bindings))
-                                        '(""))))))
+         (max-bind (seq-max
+                    (cons 0 (mapcar #'string-width
+                                    (remove nil (mapcar #'cdr bindings)))))))
     (mapcar
      (lambda (command-name)
        (let* ((fun (and (stringp command-name) (intern-soft command-name)))