all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philippe Vaucher <philippe.vaucher@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Clément Pit-Claudel" <cpitclaudel@gmail.com>,
	"Emacs developers" <emacs-devel@gnu.org>
Subject: Re: tabulated-list sort icon is reversed
Date: Wed, 27 Feb 2019 21:08:15 +0100	[thread overview]
Message-ID: <CAGK7Mr5BqvO9GkAEbeashsjmuiCgpoBzEqJauMmu9MuNvR8MHA@mail.gmail.com> (raw)
In-Reply-To: <CAGK7Mr45vqOPvRewO9VhvUNm-6oM9Cx1edqOO27iKeY+05sa0w@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 686 bytes --]

> Anway, good news! I'll polish the defcustom patch a little bit and
> resubmit in the next days.
>

Okay here are two patches. The first one is "ready" and works for my
usecase.

The second is Clément's idea but seems to be incomplete, the two SVGs being
the same, and I'm not sure how to modify it (it displays fine but makes an
error when we try to change the sorting order). It can serve as a base for
later modifications, personnally I'd be satisfied with just the first patch.

Please let me know if I should modify something else, like for example the
tabulated-list group definition: should tabulated-list belong to other(s)
group(s)?

Kind regards,
Philippe

[-- Attachment #1.2: Type: text/html, Size: 1086 bytes --]

[-- Attachment #2: 0001-Allow-customization-of-sort-indicators-in-tabulated-.patch --]
[-- Type: text/x-patch, Size: 2559 bytes --]

From 2389b61af11fe507481b86b78e2ffd164afe3c4a Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@gmail.com>
Date: Fri, 10 Aug 2018 21:59:24 +0200
Subject: [PATCH 1/2] Allow customization of sort indicators in tabulated-list

* lisp/emacs-lisp/tabulated-list.el: add customization group, add
  defcustoms.
---
 lisp/emacs-lisp/tabulated-list.el | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 12d0151d67..7162334822 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -36,6 +36,29 @@
 
 ;;; Code:
 
+(defgroup tabulated-list nil
+  "Tabulated-list customization group.")
+
+(defcustom tabulated-list-sort-icon-asc " ▼"
+  "Icon to display when sort order is ascending."
+  :group 'tabulated-list
+  :type 'string)
+
+(defcustom tabulated-list-sort-icon-desc " ▲"
+  "Icon to display when sort order is descending."
+  :group 'tabulated-list
+  :type 'string)
+
+(defcustom tabulated-list-glyphless-sort-icon-asc "v"
+  "Glyphless icon to display when sort order is ascending."
+  :group 'tabulated-list
+  :type 'string)
+
+(defcustom tabulated-list-glyphless-sort-icon-desc "^"
+  "Glyphless icon to display when sort order is descending."
+  :group 'tabulated-list
+  :type 'string)
+
 ;; The reason `tabulated-list-format' and other variables are
 ;; permanent-local is to make it convenient to switch to a different
 ;; major mode, switch back, and have the original Tabulated List data
@@ -178,8 +201,8 @@ If ADVANCE is non-nil, move forward by one line afterwards."
   (let ((table (make-char-table 'glyphless-char-display nil)))
     (set-char-table-parent table glyphless-char-display)
     ;; Some text terminals can't display the Unicode arrows; be safe.
-    (aset table 9650 (cons nil "^"))
-    (aset table 9660 (cons nil "v"))
+    (aset table 9650 (cons nil tabulated-list-glyphless-sort-icon-desc))
+    (aset table 9660 (cons nil tabulated-list-glyphless-sort-icon-asc))
     table)
   "The `glyphless-char-display' table in Tabulated List buffers.")
 
@@ -231,8 +254,8 @@ Populated by `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-icon-desc)
+			   (t tabulated-list-sort-icon-asc)))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
-- 
2.17.1


[-- Attachment #3: 0002-Use-inline-images-for-sort-icons.patch --]
[-- Type: text/x-patch, Size: 1838 bytes --]

From 7b5368d489fbc0aae9938ee33bc8453bed06cf32 Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@gmail.com>
Date: Wed, 27 Feb 2019 20:37:10 +0100
Subject: [PATCH 2/2] Use inline images for sort icons

---
 lisp/emacs-lisp/tabulated-list.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 7162334822..ff43b3a2ae 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -39,12 +39,20 @@
 (defgroup tabulated-list nil
   "Tabulated-list customization group.")
 
-(defcustom tabulated-list-sort-icon-asc " ▼"
+(defcustom tabulated-list-sort-icon-asc (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))
   "Icon to display when sort order is ascending."
   :group 'tabulated-list
   :type 'string)
 
-(defcustom tabulated-list-sort-icon-desc " ▲"
+(defcustom tabulated-list-sort-icon-desc (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))
   "Icon to display when sort order is descending."
   :group 'tabulated-list
   :type 'string)
-- 
2.17.1


  reply	other threads:[~2019-02-27 20:08 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-28 18:14 tabulated-list sort icon is reversed Philippe Vaucher
2018-07-28 19:03 ` Eli Zaretskii
2018-07-28 22:00   ` Philippe Vaucher
2018-07-29 17:34     ` Eli Zaretskii
2018-07-30  7:14       ` Robert Pluim
2018-07-30 10:47       ` Joost Kremers
2018-07-30 14:48         ` Drew Adams
2018-07-30 15:17           ` Robert Pluim
2018-07-30 15:24             ` Eli Zaretskii
2018-07-30 17:33       ` Stefan Monnier
2018-07-30 17:57         ` Clément Pit-Claudel
2018-07-31 18:28           ` Philippe Vaucher
2018-07-31 18:34         ` Philippe Vaucher
2018-07-31 18:35           ` Philippe Vaucher
2018-07-31 19:24           ` Stefan Monnier
2018-07-31 19:37             ` Drew Adams
2018-07-31 20:19               ` Stefan Monnier
2018-07-31 21:46                 ` Drew Adams
2018-08-01 20:48                   ` Joost Kremers
2018-08-02  2:09                     ` Richard Stallman
2018-08-02  5:02                       ` Stefan Monnier
2018-08-02  8:56                         ` Philippe Vaucher
2018-08-02 13:09                         ` Clément Pit-Claudel
2018-08-03 11:13                         ` Joost Kremers
2018-08-03 11:23                           ` Robert Pluim
2018-08-05  4:01                       ` Van L
2018-08-10  9:56                         ` Philippe Vaucher
2018-08-10 12:18                           ` Eli Zaretskii
2018-08-10 12:37                             ` Philippe Vaucher
2018-08-10 12:49                               ` Eli Zaretskii
2018-08-10 14:07                                 ` Philippe Vaucher
2018-08-10 13:20                           ` Clément Pit-Claudel
2018-08-10 14:11                             ` Philippe Vaucher
2018-08-10 14:52                               ` Yuri Khan
2018-08-10 20:10                                 ` Philippe Vaucher
2019-02-12 19:13                               ` Clément Pit-Claudel
2019-02-12 19:43                                 ` Eli Zaretskii
2019-02-12 20:54                                   ` Clément Pit-Claudel
2019-02-15 13:38                                   ` Philippe Vaucher
2019-02-15 14:05                                     ` Clément Pit-Claudel
2019-02-15 14:15                                     ` Eli Zaretskii
2019-02-15 14:42                                       ` Philippe Vaucher
2019-02-27 20:08                                         ` Philippe Vaucher [this message]
2019-02-27 20:21                                           ` Clément Pit-Claudel
2019-02-27 21:23                                           ` Stefan Monnier
2019-02-28  7:55                                             ` Philippe Vaucher
2019-03-01  9:48                                               ` Philippe Vaucher
2019-03-01 13:56                                                 ` Stefan Monnier
2019-03-01 16:34                                                   ` Philippe Vaucher
2019-03-01 17:34                                                     ` Stefan Monnier
2019-03-01 18:14                                                       ` Philippe Vaucher
2019-03-02 11:53                                               ` Eli Zaretskii
2019-03-02 17:48                                                 ` Philippe Vaucher
2019-03-02 17:51                                                   ` Philippe Vaucher
2019-03-02 18:15                                                     ` Eli Zaretskii
2019-03-02 19:06                                                       ` Philippe Vaucher
2019-03-08  9:43                                                         ` Eli Zaretskii
2019-03-08 13:38                                                           ` Stefan Monnier
2019-03-08 14:35                                                             ` Eli Zaretskii
2019-03-09 10:18                                                           ` Philippe Vaucher
2019-03-09 10:20                                                             ` Philippe Vaucher
2019-03-09 15:06                                                             ` Eli Zaretskii
2019-03-09 17:08                                                               ` Philippe Vaucher
2019-03-09 17:19                                                                 ` Eli Zaretskii
2019-03-09 19:57                                                                 ` Stefan Monnier
2019-03-11  9:08                                                                   ` Philippe Vaucher
2019-03-11 10:54                                                                     ` Philippe Vaucher
2019-03-15  9:11                                                                       ` Eli Zaretskii
2019-03-17 11:55                                                                         ` Philippe Vaucher
2019-03-02 18:15                                                   ` Eli Zaretskii
2018-08-02  8:56                     ` Philippe Vaucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGK7Mr5BqvO9GkAEbeashsjmuiCgpoBzEqJauMmu9MuNvR8MHA@mail.gmail.com \
    --to=philippe.vaucher@gmail.com \
    --cc=cpitclaudel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.