bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeli


From: Juri Linkov
Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline
Date: Fri, 02 Oct 2020 09:54:17 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> The variable doesn't work as is (because of the problem of mixed
> frames), and `auto-detect' doesn't have much meaning, which is why this
> should never have been a variable in the first place.
>
> Instead of trying to fix that mess, I thought it would be easier to
> introduce a new function that does the right thing automatically, and
> without a gazillion optional parameters, and then make the old function
> obsolete.

I have no opinion about a new function.  Like everyone else, I'm using
truncate-string-to-width, and happy with it, except of one complaint:
on every use I need to wrap it with such code:

  (let ((ellipsis (cond
                   (truncate-string-ellipsis)
                   ((char-displayable-p ?…) "…")
                   ("..."))))
    (truncate-string-to-width string max nil nil ellipsis))

Preferably, this should be fixed with this patch:

diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index 660ac58e02..a2bd5802cc 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -44,10 +44,16 @@ store-substring
        (setq i (1+ i)))))
   string)
 
-(defvar truncate-string-ellipsis "..."  ;"…"
+(defvar truncate-string-ellipsis nil
   "String to use to indicate truncation.
 Serves as default value of ELLIPSIS argument to `truncate-string-to-width'.")
 
+(defun truncate-string-ellipsis ()
+  (cond
+   (truncate-string-ellipsis)
+   ((char-displayable-p ?…) "…")
+   ("...")))
+
 ;;;###autoload
 (defun truncate-string-to-width (str end-column
                                     &optional start-column padding ellipsis
@@ -81,7 +87,7 @@ truncate-string-to-width
   (or start-column
       (setq start-column 0))
   (when (and ellipsis (not (stringp ellipsis)))
-    (setq ellipsis truncate-string-ellipsis))
+    (setq ellipsis (truncate-string-ellipsis)))
   (let ((str-len (length str))
        (str-width (string-width str))
        (ellipsis-width (if ellipsis (string-width ellipsis) 0))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]