]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove 'completion-tab-width'
authorEshel Yaron <me@eshelyaron.com>
Mon, 15 Jul 2024 17:38:23 +0000 (19:38 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 15 Jul 2024 17:38:23 +0000 (19:38 +0200)
Manually align annotations in only place this variable is used.

lisp/international/mule-cmds.el
lisp/minibuffer.el
lisp/simple.el

index 363e99c20a701d28a573913ff62576089203d782..27aad2dd266816512b3ef4d9fea96b5b11ef822e 100644 (file)
@@ -3174,10 +3174,20 @@ on encoding."
 
 (defun mule--ucs-names-affixation (names)
   "Return Unicode character NAMES with completion affixations."
-  (mapcar (lambda (name)
-            (let ((char (gethash name ucs-names)))
-              (list name (concat (if char (list char) " ") "\t") "")))
-          names))
+  (let ((max (seq-max (cons 0 (mapcar (lambda (n)
+                                        (if-let ((c (gethash n ucs-names)))
+                                            (char-width c)
+                                          0))
+                                      names)))))
+    (mapcar (lambda (name)
+              (let* ((char (gethash name ucs-names))
+                     (str (if char (char-to-string char) "")))
+                (list name
+                      (concat
+                       str
+                       (make-string (1+ (- max (string-width str))) ?\s))
+                      "")))
+            names)))
 
 (defun mule--ucs-categories-annotation (cat-name)
   "Return completion annotation for Unicode category name CAT-NAME."
@@ -3304,9 +3314,7 @@ as names, not numbers.
 
 Optional arg ALLOW-SINGLE non-nil means to additionally allow
 single characters to be treated as standing for themselves."
-  (let* ((completion-ignore-case t)
-        (completion-tab-width 4)
-         (sort-fun (when (eq read-char-by-name-sort 'code)
+  (let* ((sort-fun (when (eq read-char-by-name-sort 'code)
                     #'mule--ucs-names-sort-by-code))
          (group-fun (when completions-group #'mule--ucs-names-group))
         (input
@@ -3316,7 +3324,8 @@ single characters to be treated as standing for themselves."
                             (cons '(?c "code" "Sort by character code"
                                        mule--ucs-names-sort-by-code
                                        "sorted by character code")
-                                  minibuffer-completions-sort-orders)))
+                                  minibuffer-completions-sort-orders)
+                            completion-ignore-case t))
            (completing-read
             prompt (completion-table-with-metadata
                      (ucs-names)
index 1846f4039f37901a6824c50b55f097b68dc1d638..6ba11312d4d5173cc8f1e732d0db86624cda6d50 100644 (file)
@@ -1534,7 +1534,6 @@ pair of a group title string and a list of group candidate strings."
 
 (defvar-local completion-all-sorted-completions nil)
 (defvar-local completion-history nil)
-(defvar completion-tab-width nil)
 
 (defvar completion-fail-discreetly nil
   "If non-nil, stay quiet when there is no match.")
@@ -2434,11 +2433,6 @@ function as described in the documentation of `completion-metadata'."
                     ;; Windows can't show less than 3 lines anyway.
                     (max 1 (/ (length strings) 2))))
           (colwidth (/ wwidth columns)))
-      (unless (or tab-stop-list (null completion-tab-width)
-                  (zerop (mod colwidth completion-tab-width)))
-        ;; Align to tab positions for the case
-        ;; when the caller uses tabs inside prefix.
-        (setq colwidth (- colwidth (mod colwidth completion-tab-width))))
       (funcall (intern (format "completion--insert-%s" completions-format))
                strings group-fun length wwidth colwidth columns))))
 
@@ -2471,10 +2465,6 @@ function as described in the documentation of `completion-metadata'."
          ;; already past the goal column, there is still
          ;; a space displayed.
          (set-text-properties (1- (point)) (point)
-                              ;; We can set tab-width using
-                              ;; completion-tab-width, but
-                              ;; the caller can prefer using
-                              ;; \t to align prefixes.
                               `(display (space :align-to ,column)))
          nil))
       (setq first nil)
@@ -6485,6 +6475,9 @@ interactions is customizable via `minibuffer-regexp-prompts'."
 (defvar enable-recursive-minibuffers nil "Unused obsolete variable.")
 (make-obsolete-variable 'enable-recursive-minibuffers nil "31.1")
 
+(defvar completion-tab-width nil "Unused obsolete variable.")
+(make-obsolete-variable 'completion-tab-width nil "31.1")
+
 (defcustom minibuffer-auto-completion-idle-time 0.4
   "Number for seconds to wait before auto-completion in the minibuffer."
   :type 'float
index 38db0450a4d8fc06888fbda4a3f1500d08c7e247..9eb4c062694c881e78fdfe87f5b262e77627c2e9 100644 (file)
@@ -10134,7 +10134,6 @@ back on `completion-list-insert-choice-function' when nil."
 
 (define-derived-mode completion-list-mode special-mode "Completions"
   "Major mode for buffers showing lists of possible completions."
-  (when completion-tab-width (setq tab-width completion-tab-width))
   (when completions-highlight-face (cursor-face-highlight-mode 1))
   (face-remap-add-relative 'header-line 'completions-heading))