GNU bug report logs - #41250
28.0.50; Dired displays unconditionally ls-switches on modeline

Previous Next

Package: emacs;

Reported by: Arthur Miller <arthur.miller <at> live.com>

Date: Thu, 14 May 2020 01:43:01 UTC

Severity: minor

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 41250 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>, Arthur Miller <arthur.miller <at> live.com>
Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline
Date: Fri, 02 Oct 2020 09:54:17 +0300
[Message part 1 (text/plain, inline)]
> 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:

[truncate-string-ellipsis.patch (text/x-diff, inline)]
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))

This bug report was last modified 4 years and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.