emacs-devel
[Top][All Lists]
Advanced

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

Re: tabulated-list sort icon is reversed


From: Clément Pit-Claudel
Subject: Re: tabulated-list sort icon is reversed
Date: Tue, 12 Feb 2019 14:13:59 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 10/08/2018 10.11, Philippe Vaucher wrote:>     I think that won't work — one 
of the key parts of that proposal was separating individual lines.
> I think we need an image, not a character.
> 
> 
> Fair enough. To be honest I'm losing a bit of steam here, I now
> suspect this patch will never land because the ACSII part is
> unsolvable, and because I guess that using an image requires quite a
> lot of refactoring (displaying an inline image instead of a character
> is likely to be complicated).

Displaying inline images instead of characters us rather straightforward, 
actually; here's what a patch might look like (with your defcustom patch, it 
would be even simpler: only the defcustom would change).

diff --git a/lisp/emacs-lisp/tabulated-list.el 
b/lisp/emacs-lisp/tabulated-list.el
index 6fdca2c..7249351 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -199,6 +199,19 @@ tabulated-list-line-number-width
             (line-number-display-width 'columns))
         4))))
 
+(defvar tabulated-list-sort-asc-icon ; " ▼"
+  (propertize " "  'display (create-image "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>
+<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" 
\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\";>
+<svg xmlns=\"http://www.w3.org/2000/svg\"; 
xmlns:xlink=\"http://www.w3.org/1999/xlink\"; version=\"1.1\"  width=\"24\" 
height=\"24\" viewBox=\"0 0 24 24\">
+   <path fill=\"#000000\" d=\"M7,10L12,15L17,10H7Z\" />
+</svg>" 'svg t)))
+(defvar tabulated-list-sort-desc-icon ; " ▲"
+  (propertize " "  'display (create-image "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>
+<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" 
\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\";>
+<svg xmlns=\"http://www.w3.org/2000/svg\"; 
xmlns:xlink=\"http://www.w3.org/1999/xlink\"; version=\"1.1\"  width=\"24\" 
height=\"24\" viewBox=\"0 0 24 24\">
+   <path fill=\"#000000\" d=\"M7,10L12,15L17,10H7Z\" />
+</svg>" 'svg t)))
+
 (defun tabulated-list-init-header ()
   "Set up header line for the Tabulated List buffer."
   ;; FIXME: Should share code with tabulated-list-print-col!
@@ -229,8 +242,8 @@ tabulated-list-init-header
                  (concat label
                          (cond
                           ((> (+ 2 (length label)) width) "")
-                          ((cdr tabulated-list-sort-key) " ▲")
-                          (t " ▼")))
+                          ((cdr tabulated-list-sort-key) 
tabulated-list-sort-desc-icon)
+                          (t tabulated-list-sort-asc-icon)))
                  'face 'bold
                  'tabulated-list-column-name label
                  button-props))
-- 
2.7.4

On the other hand, it might be tricky to resize this image properly, especially 
given bug #34024.

Clément.



reply via email to

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