unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* tabulated-list sort icon is reversed
@ 2018-07-28 18:14 Philippe Vaucher
  2018-07-28 19:03 ` Eli Zaretskii
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2018-07-28 18:14 UTC (permalink / raw)
  To: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

Hello,

The sort icon in tabulated-list are opposite of what they should.

This is visible in `package-list-packages` when sorting the "Package"
column, when they are alphabetically sorted the icon is like "\/" when it
should be like "/\"

I tried to figure out where/how this icon is display, but after a while I
got frustrated and thought it'd be easier to ask here.

If you point me to the right place I can do the patch, but as I suspect the
fix is trivial it's probably simpler for the one that knows where to
look to do the patch.

Thanks,
Philippe

[-- Attachment #2: Type: text/html, Size: 746 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2018-07-28 19:03 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sat, 28 Jul 2018 20:14:28 +0200
> 
> The sort icon in tabulated-list are opposite of what they should.

They show the direction in which the key's value increases.

> I tried to figure out where/how this icon is display, but after a while I got frustrated and thought it'd be easier to
> ask here.

See tabulated-list-init-header.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-28 19:03 ` Eli Zaretskii
@ 2018-07-28 22:00   ` Philippe Vaucher
  2018-07-29 17:34     ` Eli Zaretskii
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2018-07-28 22:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1159 bytes --]

>
> > The sort icon in tabulated-list are opposite of what they should.
>
> They show the direction in which the key's value increases.


Right, thanks for the explanation.

I think it's counter-intuitive. It's the first time I see this way of
representing the sorting. Usually, the triangle is used as a representation
of the position of where the largest element is.

See https://ux.stackexchange.com/a/38654 for a better explanation.

Here are examples to illustrate what I'm saying:

https://datatables.net/examples/basic_init/zero_configuration.html
https://i.stack.imgur.com/j6bkB.png
https://docs.oracle.com/cd/B40099_02/books/Fundamentals/images/sort_ascending.png
https://i.stack.imgur.com/RLcug.png

Given that this issue is not a mistake but intended behavior it's difficult
to decide what is the right path here. Maybe that the paradigm Emacs uses
is the one that most Emacs users expect, so it's actually the right one?
I'm pretty sure that most people used to GUIs with columns would think the
arrows are oriented the wrong way, but I might be mistaken.

What do you reckon should be done, switch the direction or let it as it is
now?

Philippe

[-- Attachment #2: Type: text/html, Size: 1949 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-28 22:00   ` Philippe Vaucher
@ 2018-07-29 17:34     ` Eli Zaretskii
  2018-07-30  7:14       ` Robert Pluim
                         ` (2 more replies)
  0 siblings, 3 replies; 71+ messages in thread
From: Eli Zaretskii @ 2018-07-29 17:34 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sun, 29 Jul 2018 00:00:34 +0200
> Cc: Emacs developers <emacs-devel@gnu.org>
> 
> What do you reckon should be done, switch the direction or let it as it is now?

Not sure.  I'd like others to chime in with their opinions.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-29 17:34     ` Eli Zaretskii
@ 2018-07-30  7:14       ` Robert Pluim
  2018-07-30 10:47       ` Joost Kremers
  2018-07-30 17:33       ` Stefan Monnier
  2 siblings, 0 replies; 71+ messages in thread
From: Robert Pluim @ 2018-07-30  7:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Philippe Vaucher, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philippe Vaucher <philippe.vaucher@gmail.com>
>> Date: Sun, 29 Jul 2018 00:00:34 +0200
>> Cc: Emacs developers <emacs-devel@gnu.org>
>> 
>> What do you reckon should be done, switch the direction or let it as it is now?
>
> Not sure.  I'd like others to chime in with their opinions.

I think it looks correct the way it is now, ie indicating the
direction of increase.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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 17:33       ` Stefan Monnier
  2 siblings, 1 reply; 71+ messages in thread
From: Joost Kremers @ 2018-07-30 10:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Philippe Vaucher, emacs-devel


On Sun, Jul 29 2018, Eli Zaretskii wrote:
>> From: Philippe Vaucher <philippe.vaucher@gmail.com>
>> Date: Sun, 29 Jul 2018 00:00:34 +0200
>> Cc: Emacs developers <emacs-devel@gnu.org>
>> 
>> What do you reckon should be done, switch the direction or let 
>> it as it is now?
>
> Not sure.  I'd like others to chime in with their opinions.

Perhaps it should be noted that Emacs is not alone in using the 
arrow heads this way. The file manager on my Elementary OS system 
(Patheon) uses ▼ (i.e., a down-pointing triangle) to indicate 
sorting A-Z and 0-9, the Rhythmbox music player does as well, and 
the same goes for the image viewer Geeqie (e.g., in its Exif 
metadata window).

Could be a GNU/Linux vs. Windows / MacOS thing, I don't know. I 
find Emacs' current way of doing things more intuitive, but that's 
just me. I don't think you're ever gonna reach consensus on this 
one.

But I must also say that I generally only look at these indicators 
to see which column is sorted, not to find out how it's sorted, 
because I find it's quicker (for me) to just look at a few items.

Just my €0.02, though.

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 71+ messages in thread

* RE: tabulated-list sort icon is reversed
  2018-07-30 10:47       ` Joost Kremers
@ 2018-07-30 14:48         ` Drew Adams
  2018-07-30 15:17           ` Robert Pluim
  0 siblings, 1 reply; 71+ messages in thread
From: Drew Adams @ 2018-07-30 14:48 UTC (permalink / raw)
  To: Joost Kremers, Eli Zaretskii; +Cc: Philippe Vaucher, emacs-devel

> Perhaps it should be noted that Emacs is not alone in using the
> arrow heads this way. The file manager on my Elementary OS system
> (Patheon) uses ▼ (i.e., a down-pointing triangle) to indicate
> sorting A-Z and 0-9, the Rhythmbox music player does as well, and
> the same goes for the image viewer Geeqie (e.g., in its Exif
> metadata window).
> 
> Could be a GNU/Linux vs. Windows / MacOS thing, I don't know. I
> find Emacs' current way of doing things more intuitive, but that's
> just me. I don't think you're ever gonna reach consensus on this
> one.

It's the case that MS Windows does it the other way around:
^ means values are currently sorted from low to high (going
down the column). IOW, the triangle _reflects_ the current
sort order - it is a depiction, in a way, of the sorted values.

To me, that makes more sense. But I agree with this statement:

> But I must also say that I generally only look at these indicators
> to see which column is sorted, not to find out how it's sorted,
> because I find it's quicker (for me) to just look at a few items.

Still, for some kinds of data looking quickly at the topmost few
values might not be as quick as looking at the column symbol,
once you are used to its meaning.

If this is mainly (only?) a platform thing then maybe Emacs
should do something different for different platforms - dunno.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-30 14:48         ` Drew Adams
@ 2018-07-30 15:17           ` Robert Pluim
  2018-07-30 15:24             ` Eli Zaretskii
  0 siblings, 1 reply; 71+ messages in thread
From: Robert Pluim @ 2018-07-30 15:17 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, emacs-devel, Philippe Vaucher, Joost Kremers

Drew Adams <drew.adams@oracle.com> writes:

>> Perhaps it should be noted that Emacs is not alone in using the
>> arrow heads this way. The file manager on my Elementary OS system
>> (Patheon) uses ▼ (i.e., a down-pointing triangle) to indicate
>> sorting A-Z and 0-9, the Rhythmbox music player does as well, and
>> the same goes for the image viewer Geeqie (e.g., in its Exif
>> metadata window).
>> 
>> Could be a GNU/Linux vs. Windows / MacOS thing, I don't know. I
>> find Emacs' current way of doing things more intuitive, but that's
>> just me. I don't think you're ever gonna reach consensus on this
>> one.
>
> It's the case that MS Windows does it the other way around:
> ^ means values are currently sorted from low to high (going
> down the column). IOW, the triangle _reflects_ the current
> sort order - it is a depiction, in a way, of the sorted values.
>
> To me, that makes more sense. But I agree with this statement:

To me it doesnʼt. It explains why Iʼm always confused and end up
having to click at least twice when using Windows.

>> But I must also say that I generally only look at these indicators
>> to see which column is sorted, not to find out how it's sorted,
>> because I find it's quicker (for me) to just look at a few items.
>
> Still, for some kinds of data looking quickly at the topmost few
> values might not be as quick as looking at the column symbol,
> once you are used to its meaning.
>
> If this is mainly (only?) a platform thing then maybe Emacs
> should do something different for different platforms - dunno.

Please no. One of the fine properties of Emacs is that it generally
doesnʼt vary much between platforms.

Robert



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-30 15:17           ` Robert Pluim
@ 2018-07-30 15:24             ` Eli Zaretskii
  0 siblings, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2018-07-30 15:24 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Joost Kremers <joost.kremers@phil.uni-goettingen.de>,  Eli Zaretskii <eliz@gnu.org>,  Philippe Vaucher <philippe.vaucher@gmail.com>,  emacs-devel@gnu.org
> Date: Mon, 30 Jul 2018 17:17:00 +0200
> 
> > If this is mainly (only?) a platform thing then maybe Emacs
> > should do something different for different platforms - dunno.
> 
> Please no. One of the fine properties of Emacs is that it generally
> doesnʼt vary much between platforms.

Agreed.  At least by default the behavior should be the same.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-29 17:34     ` Eli Zaretskii
  2018-07-30  7:14       ` Robert Pluim
  2018-07-30 10:47       ` Joost Kremers
@ 2018-07-30 17:33       ` Stefan Monnier
  2018-07-30 17:57         ` Clément Pit-Claudel
  2018-07-31 18:34         ` Philippe Vaucher
  2 siblings, 2 replies; 71+ messages in thread
From: Stefan Monnier @ 2018-07-30 17:33 UTC (permalink / raw)
  To: emacs-devel

>> What do you reckon should be done, switch the direction or let it as
>> it is now?
> Not sure.  I'd like others to chime in with their opinions.

If you want my opinion on the color of this shed, I'd prefer for the
color to be circular.

More seriously, I hate those arrows exactly because I never know what
they mean.  I think it's just like the "split window
vertically/horizontally" issue: it's a bad UI and the right solution is
to choose neither of those options.

I'm afraid that while I figured out the problem, I don't have any solution
to offer :-(

Maybe we should just not display the direction of the ordering at all:
just put a bullet or something to indicate which column is sorted and
let the user look at the data if she wants to know how this column
is sorted.


        Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Clément Pit-Claudel @ 2018-07-30 17:57 UTC (permalink / raw)
  To: emacs-devel

On 2018-07-30 13:33, Stefan Monnier wrote:
> I'm afraid that while I figured out the problem, I don't have any solution
> to offer :-(

The trick used on old macs was pretty good: instead of a solid triangle (which can mean "pyramid" or "arrow"), use increasingly narrow or increasingly wide layers:

This means "sorted small to large":

   _
  ___
 _____
_______


This means "sorted large to small":

_______
 _____
  ___
   _

Alternatively, we can just write which comparison operator we used: ≤ or ≥.  When the sorting indicator is ≤, each element in the list is ≤ to the next one, and conversely with ≥.

Or we can use a horizontal symbol with increasing or decreasing bars: ▂▅▉ means increasing, ▉▅▂ means decreasing.

Apologies for the ASCII art.

Clément.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-30 17:57         ` Clément Pit-Claudel
@ 2018-07-31 18:28           ` Philippe Vaucher
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-07-31 18:28 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

>
> The trick used on old macs was pretty good: instead of a solid triangle
> (which can mean "pyramid" or "arrow"), use increasingly narrow or
> increasingly wide layers:
>
> This means "sorted small to large":
>
>    _
>   ___
>  _____
> _______
>
>
> This means "sorted large to small":
>
> _______
>  _____
>   ___
>    _
>

I think that would be the best solution indeed.

Would the ones in favor of "not changing" (Robert Pluim, Joost Kremers) be
ok with such a change or do they still find it counter-intuitive?

I also agree that no matter what is chosen, it'd behave the same on all
platforms.

Philippe

[-- Attachment #2: Type: text/html, Size: 1030 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-30 17:33       ` Stefan Monnier
  2018-07-30 17:57         ` Clément Pit-Claudel
@ 2018-07-31 18:34         ` Philippe Vaucher
  2018-07-31 18:35           ` Philippe Vaucher
  2018-07-31 19:24           ` Stefan Monnier
  1 sibling, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-07-31 18:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

> More seriously, I hate those arrows exactly because I never know what
> they mean.  I think it's just like the "split window
> vertically/horizontally" issue: it's a bad UI and the right solution is
> to choose neither of those options.


There actually is an icon that is unambiguous: the "a-z" or "z-a" one:

https://www.iconfinder.com/icons/905641/ascending_az_filters_sort_sorting_icon
https://www.iconfinder.com/icons/905640/descending_filter_sort_sorting_za_icon

I'd be happy with that or Clément's stacked layers' solution.

Philippe

[-- Attachment #2: Type: text/html, Size: 1121 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-31 18:34         ` Philippe Vaucher
@ 2018-07-31 18:35           ` Philippe Vaucher
  2018-07-31 19:24           ` Stefan Monnier
  1 sibling, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-07-31 18:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

>
> There actually is an icon that is unambiguous: the "a-z" or "z-a" one:
>

My point being that the arrow direction is still ambiguous, but the "a-z"
part disambiguates it.

Still, I prefer the length-increasing stacked layers solution.

Philippe

[-- Attachment #2: Type: text/html, Size: 578 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2018-07-31 19:24 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: Emacs developers

> There actually is an icon that is unambiguous: the "a-z" or "z-a" one:

I'd actually prefer it to be 0-9 rather a-z (for non-latin-script
users), but yes, this is a fairly clear choice.  The main downside is
that when scaled to the size of a normal character it can be
nigh-on illegible (I like my font to be "just big enough to be
legible", in order to maximize the amount of text displayed, so
two-chars stacked within the space of a normal char will be illegible
almost by definition).


        Stefan



^ permalink raw reply	[flat|nested] 71+ messages in thread

* RE: tabulated-list sort icon is reversed
  2018-07-31 19:24           ` Stefan Monnier
@ 2018-07-31 19:37             ` Drew Adams
  2018-07-31 20:19               ` Stefan Monnier
  0 siblings, 1 reply; 71+ messages in thread
From: Drew Adams @ 2018-07-31 19:37 UTC (permalink / raw)
  To: Stefan Monnier, Philippe Vaucher; +Cc: Emacs developers

> > There actually is an icon that is unambiguous: the "a-z" or "z-a" one:
> 
> I'd actually prefer it to be 0-9 rather a-z (for non-latin-script
> users), but yes, this is a fairly clear choice.  

1. Neither is great, IMO. The icon should express low-to-high or small-to-large in a _general_ way, and not suggest either an alphabetic or a numeric order.

What do you do with a date column whose values might be any ISO date format? Assuming that the actual sorting is by date (not its representation), neither a-z nor 0-9 suggests what's happening.

2.  Personally, I don't see the difference between this proposal:

   _
  ___
 _____
_______

and a triangle with vertex on top (like ^). The same ambiguity arises:
Does it represent the current sort order (low-to-high / small-to-large)?
Or does it represent the new sort order you'll get if you use that button?

IIUC, the MS Windows approach (for column-sort indicators) is to reflect the current sort order, the same way that a bold or underlined column header indicates that the column is selected (current).

And apparently other, non-Windows contexts take the approach that the icon represents the new order you'll get if you click the icon.

How does the proposed sequence of lines of increasing/decreasing length solve the problem of ambiguity?



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-31 19:37             ` Drew Adams
@ 2018-07-31 20:19               ` Stefan Monnier
  2018-07-31 21:46                 ` Drew Adams
  0 siblings, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2018-07-31 20:19 UTC (permalink / raw)
  To: emacs-devel

> and a triangle with vertex on top (like ^). The same ambiguity arises:
> Does it represent the current sort order (low-to-high / small-to-large)?
> Or does it represent the new sort order you'll get if you use that button?

You can click on any column to cause it to be sorted, so it wouldn't
make much sense for that triangle to be a button (i.e. why have
a button in that one column and not in all others?).

> And apparently other, non-Windows contexts take the approach that the
> icon represents the new order you'll get if you click the icon.

I don't think so.


        Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* RE: tabulated-list sort icon is reversed
  2018-07-31 20:19               ` Stefan Monnier
@ 2018-07-31 21:46                 ` Drew Adams
  2018-08-01 20:48                   ` Joost Kremers
  0 siblings, 1 reply; 71+ messages in thread
From: Drew Adams @ 2018-07-31 21:46 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

> > and a triangle with vertex on top (like ^). The same ambiguity arises:
> > Does it represent the current sort order (low-to-high / small-to-large)?
> > Or does it represent the new sort order you'll get if you use that button?
> 
> You can click on any column to cause it to be sorted, so it wouldn't
> make much sense for that triangle to be a button (i.e. why have
> a button in that one column and not in all others?).

Emacs seems to (at least in some cases) add such a triangle icon to the column header, after its text. And yes, it is shown only in the header of the current column.

I meant the same thing you mean: click the column header (not necessarily the icon in the header) to toggle the sort direction.

> > And apparently other, non-Windows contexts take the approach that the
> > icon represents the new order you'll get if you click the icon.
> 
> I don't think so.

Read "click the column header" anywhere, not just on the icon.

I thought this discussion had pointed out that for some people the icon orientation reflects (and should reflect) the new sort direction you will get, whereas for others the icon orientation should reflect the current sort direction.

At least on MS Windows, in `Buffer Menu', it seems:

* For numerical sorting (e.g. column Size) ) the icon orientation reflects the current sort direction, in the sense that if the small end (vertex) is on top then the first row is the smallest/lowest value etc.

* But for alphabetical sorting (e.g. column Mode) the icon orientation is reversed: when the small end is on the bottom (not the top) sorting is alphabetical (A before Z). You can say that the icon orientation reflects not the current sort order but the new sort order you'll get if you click the header to toggle the order.

So it seems not even to be consistent.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-07-31 21:46                 ` Drew Adams
@ 2018-08-01 20:48                   ` Joost Kremers
  2018-08-02  2:09                     ` Richard Stallman
  2018-08-02  8:56                     ` Philippe Vaucher
  0 siblings, 2 replies; 71+ messages in thread
From: Joost Kremers @ 2018-08-01 20:48 UTC (permalink / raw)
  To: Drew Adams; +Cc: Stefan Monnier, emacs-devel


On Tue, Jul 31 2018, Drew Adams wrote:
> I thought this discussion had pointed out that for some people 
> the icon orientation reflects (and should reflect) the new sort 
> direction you will get, whereas for others the icon orientation 
> should reflect the current sort direction.

My understanding of the discussion is that for some, a downward 
pointing triangle indicates an ascending sort order, while for 
others it indicates a descending sort order.

The idea that the icon is a button that indicates what happens 
when you click it has also been mentioned, but since it's only the 
sorted column that has such an indicator, this seems unlikely. 
(There are systems such as at <http://wals.info/feature>, which 
have two greyed-out triangles indicating that you can sort a 
column, and one single triangle for the sorted column. For me, 
that sorted column triangle points in the wrong direction, BTW...)



-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-01 20:48                   ` Joost Kremers
@ 2018-08-02  2:09                     ` Richard Stallman
  2018-08-02  5:02                       ` Stefan Monnier
  2018-08-05  4:01                       ` Van L
  2018-08-02  8:56                     ` Philippe Vaucher
  1 sibling, 2 replies; 71+ messages in thread
From: Richard Stallman @ 2018-08-02  2:09 UTC (permalink / raw)
  To: Joost Kremers; +Cc: monnier, drew.adams, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > My understanding of the discussion is that for some, a downward 
  > pointing triangle indicates an ascending sort order, while for 
  > others it indicates a descending sort order.

Can anyone suggest an icon whose meaning would be clear?
Perhaps < and >?
Those two characters turned 90 degrees?

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-02  2:09                     ` Richard Stallman
@ 2018-08-02  5:02                       ` Stefan Monnier
  2018-08-02  8:56                         ` Philippe Vaucher
                                           ` (2 more replies)
  2018-08-05  4:01                       ` Van L
  1 sibling, 3 replies; 71+ messages in thread
From: Stefan Monnier @ 2018-08-02  5:02 UTC (permalink / raw)
  To: emacs-devel

>   > My understanding of the discussion is that for some, a downward 
>   > pointing triangle indicates an ascending sort order, while for 
>   > others it indicates a descending sort order.
>
> Can anyone suggest an icon whose meaning would be clear?
> Perhaps < and >?
> Those two characters turned 90 degrees?

I think the "stack of lines of increasing/decreasing length" is
a good choice.  Tho instead of

    -
   ---
  -----
 -------

I'd go with

  -
  ---
  -----
  -------
  ---------

so it can't be confused with an arrow at small sizes.


        Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-01 20:48                   ` Joost Kremers
  2018-08-02  2:09                     ` Richard Stallman
@ 2018-08-02  8:56                     ` Philippe Vaucher
  1 sibling, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-02  8:56 UTC (permalink / raw)
  To: Joost Kremers; +Cc: Stefan Monnier, Drew Adams, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

On Wed, Aug 1, 2018 at 10:50 PM Joost Kremers <joostkremers@fastmail.fm>
wrote:

>
> On Tue, Jul 31 2018, Drew Adams wrote:
> > I thought this discussion had pointed out that for some people
> > the icon orientation reflects (and should reflect) the new sort
> > direction you will get, whereas for others the icon orientation
> > should reflect the current sort direction.
>
> My understanding of the discussion is that for some, a downward
> pointing triangle indicates an ascending sort order, while for
> others it indicates a descending sort order.
>

I just wanted to confirm that for everyone the icon represents the current
sort order.

Some interpret the icon as a "stack of lines of increasing/decreasing
length" and others as the "direction in which the length grow", hence the
ambiguity.

Philippe

[-- Attachment #2: Type: text/html, Size: 1652 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  2 siblings, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-02  8:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

On Thu, Aug 2, 2018 at 7:04 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

>
> I'd go with
>
>   -
>   ---
>   -----
>   -------
>   ---------
>
> so it can't be confused with an arrow at small sizes.


I also think it's the best option.

Philippe

[-- Attachment #2: Type: text/html, Size: 601 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  2 siblings, 0 replies; 71+ messages in thread
From: Clément Pit-Claudel @ 2018-08-02 13:09 UTC (permalink / raw)
  To: emacs-devel

On 2018-08-02 01:02, Stefan Monnier wrote:
> I'd go with
> 
>   -
>   ---
>   -----
>   -------
>   ---------
> 
> so it can't be confused with an arrow at small sizes.

+1



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  2 siblings, 1 reply; 71+ messages in thread
From: Joost Kremers @ 2018-08-03 11:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel


On Thu, Aug 02 2018, Stefan Monnier wrote:
> I'd go with
>
>   -
>   ---
>   -----
>   -------
>   ---------

1+



-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-03 11:13                         ` Joost Kremers
@ 2018-08-03 11:23                           ` Robert Pluim
  0 siblings, 0 replies; 71+ messages in thread
From: Robert Pluim @ 2018-08-03 11:23 UTC (permalink / raw)
  To: Joost Kremers; +Cc: Stefan Monnier, emacs-devel

Joost Kremers <joostkremers@fastmail.fm> writes:

> On Thu, Aug 02 2018, Stefan Monnier wrote:
>> I'd go with
>>
>>   -
>>   ---
>>   -----
>>   -------
>>   ---------
>
> 1+

Iʼll take "meh" for 5 points please. Change it if you feel you must,
just continue having it be the same on all platforms.

Robert



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-02  2:09                     ` Richard Stallman
  2018-08-02  5:02                       ` Stefan Monnier
@ 2018-08-05  4:01                       ` Van L
  2018-08-10  9:56                         ` Philippe Vaucher
  1 sibling, 1 reply; 71+ messages in thread
From: Van L @ 2018-08-05  4:01 UTC (permalink / raw)
  To: Emacs-Devel devel


> Can anyone suggest an icon whose meaning would be clear?
> Perhaps < and >?
> Those two characters turned 90 degrees?

Is there an international standard for visual language applied to medical equipment in emergency room setting that may help? rapid repeat fire rifles toggle from one to two to four symbol for bullets is at the opposite end.


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-05  4:01                       ` Van L
@ 2018-08-10  9:56                         ` Philippe Vaucher
  2018-08-10 12:18                           ` Eli Zaretskii
  2018-08-10 13:20                           ` Clément Pit-Claudel
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-10  9:56 UTC (permalink / raw)
  To: van; +Cc: Emacs developers


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

Here's a patch that could work. There's no unicode character that exactly
matches what most of us want, but this one seems unambiguous enough for me.

Philippe

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

[-- Attachment #2: 0001-Use-less-ambiguous-sort-icons-for-tabulated-list.patch --]
[-- Type: text/x-patch, Size: 881 bytes --]

From 88cb78d97bcbaa83d5ccfa61a4ac8145676363bf Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@stvs.com>
Date: Fri, 10 Aug 2018 11:52:13 +0200
Subject: [PATCH] Use less ambiguous sort icons for tabulated list

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

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 58619ecda..79df5b795 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -229,8 +229,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) " ◤")
+			   (t " ◣")))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10  9:56                         ` Philippe Vaucher
@ 2018-08-10 12:18                           ` Eli Zaretskii
  2018-08-10 12:37                             ` Philippe Vaucher
  2018-08-10 13:20                           ` Clément Pit-Claudel
  1 sibling, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2018-08-10 12:18 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: van, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Fri, 10 Aug 2018 11:56:07 +0200
> Cc: Emacs developers <emacs-devel@gnu.org>
> 
> Here's a patch that could work. There's no unicode character that exactly matches what most of us want, but
> this one seems unambiguous enough for me.

Thanks, but I'm probably missing something, because I don't really see
what will this change solve.  And what about the ASCII equivalent?



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10 12:18                           ` Eli Zaretskii
@ 2018-08-10 12:37                             ` Philippe Vaucher
  2018-08-10 12:49                               ` Eli Zaretskii
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-10 12:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: van, Emacs developers


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

>
> Thanks, but I'm probably missing something, because I don't really see
> what will this change solve.  And what about the ASCII equivalent?
>

It's less ambiguous than what is used right now.

It looks a lot like what a lot people agreed was the best option:

On Thu, Aug 02 2018, Stefan Monnier wrote:
> I'd go with
>
>   -
>   ---
>   -----
>   -------
>   ---------

The only missing thing are the "lines" layers but the shape is there.

About the ASCII equivalent, this is even worse because there's no good way
of doing ascii art. I've tried various things like "|_", "|/", "|\" but
they look too ugly. I finally settled on the classic "asc/desc", tho "a-z"
and "z-a" looked ok too.

Here attached is an updated patch.

Kind regards,
Philippe

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

[-- Attachment #2: 0001-Use-less-ambiguous-sort-icons-for-tabulated-list.patch --]
[-- Type: text/x-patch, Size: 1485 bytes --]

From 587c9885f95c290160382aaa01b67816f2468652 Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@stvs.com>
Date: Fri, 10 Aug 2018 11:52:13 +0200
Subject: [PATCH] Use less ambiguous sort icons for tabulated list

* lisp/emacs-lisp/tabulated-list.el: change sort icons and use
  "asc/desc" for ASCII.
---
 lisp/emacs-lisp/tabulated-list.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 58619ecda..5488471e2 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -176,8 +176,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 "desc"))
+    (aset table 9660 (cons nil "asc"))
     table)
   "The `glyphless-char-display' table in Tabulated List buffers.")
 
@@ -229,8 +229,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) " ◤")
+			   (t " ◣")))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10 12:37                             ` Philippe Vaucher
@ 2018-08-10 12:49                               ` Eli Zaretskii
  2018-08-10 14:07                                 ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2018-08-10 12:49 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: van, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Fri, 10 Aug 2018 14:37:08 +0200
> Cc: van@scratch.space, Emacs developers <emacs-devel@gnu.org>
> 
>  Thanks, but I'm probably missing something, because I don't really see
>  what will this change solve.  And what about the ASCII equivalent?
> 
> It's less ambiguous than what is used right now.

Can you explain why it is less ambiguous?

> It looks a lot like what a lot people agreed was the best option:

I probably missed that, sorry.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10  9:56                         ` Philippe Vaucher
  2018-08-10 12:18                           ` Eli Zaretskii
@ 2018-08-10 13:20                           ` Clément Pit-Claudel
  2018-08-10 14:11                             ` Philippe Vaucher
  1 sibling, 1 reply; 71+ messages in thread
From: Clément Pit-Claudel @ 2018-08-10 13:20 UTC (permalink / raw)
  To: emacs-devel

On 2018-08-10 05:56, Philippe Vaucher wrote:
> Here's a patch that could work. There's no unicode character that exactly matches what most of us want, but this one seems unambiguous enough for me.
> 
> Philippe

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.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10 12:49                               ` Eli Zaretskii
@ 2018-08-10 14:07                                 ` Philippe Vaucher
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-10 14:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: van, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

>
> > It's less ambiguous than what is used right now.
>
> Can you explain why it is less ambiguous?
>

Because it's not an arrow and should force the viewer to think, and I don't
see how you could interpret this icon as something else than
https://www.freepik.com/free-icon/sort-descending-interface-symbol_731985.htm

But the fact you ask seems to imply it's not as evident as in my mind.

Philippe

[-- Attachment #2: Type: text/html, Size: 777 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10 13:20                           ` Clément Pit-Claudel
@ 2018-08-10 14:11                             ` Philippe Vaucher
  2018-08-10 14:52                               ` Yuri Khan
  2019-02-12 19:13                               ` Clément Pit-Claudel
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-10 14:11 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

>
> 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).

Kind regards,
Philippe

[-- Attachment #2: Type: text/html, Size: 704 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Yuri Khan @ 2018-08-10 14:52 UTC (permalink / raw)
  To: philippe.vaucher; +Cc: Clément Pit-Claudel, Emacs developers

On Fri, Aug 10, 2018 at 9:15 PM Philippe Vaucher
<philippe.vaucher@gmail.com> wrote:

> 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).

Fortunately there’s an easy escape hatch from this problem: Make it a
defcustom. Then we can spend an inordinate amount of time bikeshedding
the default.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10 14:52                               ` Yuri Khan
@ 2018-08-10 20:10                                 ` Philippe Vaucher
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2018-08-10 20:10 UTC (permalink / raw)
  To: yurivkhan; +Cc: Clément Pit-Claudel, Emacs developers


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

On Fri, Aug 10, 2018 at 4:52 PM Yuri Khan <yurivkhan@gmail.com> wrote:

> On Fri, Aug 10, 2018 at 9:15 PM Philippe Vaucher
> <philippe.vaucher@gmail.com> wrote:
>
> > 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).
>
> Fortunately there’s an easy escape hatch from this problem: Make it a
> defcustom. Then we can spend an inordinate amount of time bikeshedding
> the default.
>

Good idea! Here's a patch in that direction, here are things that I'm not
sure about:

   - variable name? `tabulated-list-sort-ascending-indicator`?
   `tabulated-list-sort-ascending-icon`? For ASCII, `-ascii` or `-glyphless`?
   - group definition: does tabulated-list belong to another group?
   - 4 defcustoms or 2? For example, it could be `(defcustom
   tabulated-list-sort-ascending-texts '(" ▼" "v"))`, that way you customize
   both icons at the same time (it could even be only one defcustom with :asc
   keywords etc)

Thanks,
Philippe

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

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

From 0b3264ecddc5b23b00055387e8cd9c5c4d9da766 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] 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 58619ecda0..4552ef7f98 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-ascending-icon " ▼"
+  "Icon to display when sort order is ascending."
+  :group 'tabulated-list
+  :type 'string)
+
+(defcustom tabulated-list-sort-descending-icon " ▲"
+  "Icon to display when sort order is descending."
+  :group 'tabulated-list
+  :type 'string)
+
+(defcustom tabulated-list-sort-ascending-glyphless "v"
+  "Glyphless icon to display when sort order is ascending."
+  :group 'tabulated-list
+  :type 'string)
+
+(defcustom tabulated-list-sort-descending-glyphless "^"
+  "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
@@ -176,8 +199,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-sort-descending-glyphless))
+    (aset table 9660 (cons nil tabulated-list-sort-ascending-glyphless))
     table)
   "The `glyphless-char-display' table in Tabulated List buffers.")
 
@@ -229,8 +252,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-descending-icon)
+			   (t tabulated-list-sort-ascending-icon)))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2018-08-10 14:11                             ` Philippe Vaucher
  2018-08-10 14:52                               ` Yuri Khan
@ 2019-02-12 19:13                               ` Clément Pit-Claudel
  2019-02-12 19:43                                 ` Eli Zaretskii
  1 sibling, 1 reply; 71+ messages in thread
From: Clément Pit-Claudel @ 2019-02-12 19:13 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: Emacs developers

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.



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  0 siblings, 2 replies; 71+ messages in thread
From: Eli Zaretskii @ 2019-02-12 19:43 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: philippe.vaucher, emacs-devel

> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Tue, 12 Feb 2019 14:13:59 -0500
> Cc: Emacs developers <emacs-devel@gnu.org>
> 
> 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).

That's just a simplified example, though, right?  Because we cannot
unconditionally use an SVG image; cannot even assume any kind of
images is always supported, in fact.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-12 19:43                                 ` Eli Zaretskii
@ 2019-02-12 20:54                                   ` Clément Pit-Claudel
  2019-02-15 13:38                                   ` Philippe Vaucher
  1 sibling, 0 replies; 71+ messages in thread
From: Clément Pit-Claudel @ 2019-02-12 20:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: philippe.vaucher, emacs-devel

On 12/02/2019 14.43, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
>> Date: Tue, 12 Feb 2019 14:13:59 -0500
>> Cc: Emacs developers <emacs-devel@gnu.org>
>>
>> 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).
> 
> That's just a simplified example, though, right?

Of course: that patch doesn't work on text terminals, for example.




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-02-15 13:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Clément Pit-Claudel, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

>
> > 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).
>

Thanks for the example.

That's just a simplified example, though, right?  Because we cannot
> unconditionally use an SVG image; cannot even assume any kind of
> images is always supported, in fact.
>

So, what do you reckon is the way forward about this issue? I'm willing to
make a better attempt at my defcustom patch, but I'm not sure there's
enough consensus for it to then be accepted.

[-- Attachment #2: Type: text/html, Size: 1021 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-15 13:38                                   ` Philippe Vaucher
@ 2019-02-15 14:05                                     ` Clément Pit-Claudel
  2019-02-15 14:15                                     ` Eli Zaretskii
  1 sibling, 0 replies; 71+ messages in thread
From: Clément Pit-Claudel @ 2019-02-15 14:05 UTC (permalink / raw)
  To: Philippe Vaucher, Eli Zaretskii; +Cc: Emacs developers

On 15/02/2019 08.38, Philippe Vaucher wrote:
> So, what do you reckon is the way forward about this issue? I'm willing to make a better attempt at my defcustom patch, but I'm not sure there's enough consensus for it to then be accepted.

I'm not sure.  I think there should be little opposition to making the symbols customizable, but changing to an image in a robust way might be trickier (we want the image to scale to match the font size).

I wonder: instead of an image, can we use a glyph? IOW, is there a platform-independent way to either load a custom font into Emacs, or create a custom font and tell it which characters it contains?  This would be a nice solution for this issue: we would just display the sorting indicator with that custom font and be all done.

This would actually improve the status quo in many situations where things are currently done with images.  For example, it would make it easy to display icons that scale nicely (e.g. in mu4e) or to implement new powerline separators (https://github.com/milkypostman/powerline/blob/master/powerline-separators.el).

Cheers,
Clément.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2019-02-15 14:15 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: cpitclaudel, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Fri, 15 Feb 2019 14:38:48 +0100
> Cc: Clément Pit-Claudel <cpitclaudel@gmail.com>, 
> 	Emacs developers <emacs-devel@gnu.org>
> 
> So, what do you reckon is the way forward about this issue? I'm willing to make a better attempt at my
> defcustom patch, but I'm not sure there's enough consensus for it to then be accepted.

Why do you think it might not be accepted, if it is an optional
behavior?



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-15 14:15                                     ` Eli Zaretskii
@ 2019-02-15 14:42                                       ` Philippe Vaucher
  2019-02-27 20:08                                         ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-02-15 14:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Clément Pit-Claudel, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

>
> > So, what do you reckon is the way forward about this issue? I'm willing
> to make a better attempt at my
> > defcustom patch, but I'm not sure there's enough consensus for it to
> then be accepted.
>
> Why do you think it might not be accepted, if it is an optional behavior?
>

Just an impression based on the initial reaction and lack of answers to my
defcustom patch.

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

Changing the actual default to an image/font can happen (or not) at a later
time.

[-- Attachment #2: Type: text/html, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-15 14:42                                       ` Philippe Vaucher
@ 2019-02-27 20:08                                         ` Philippe Vaucher
  2019-02-27 20:21                                           ` Clément Pit-Claudel
  2019-02-27 21:23                                           ` Stefan Monnier
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-02-27 20:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Clément Pit-Claudel, Emacs developers


[-- 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


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-27 20:08                                         ` Philippe Vaucher
@ 2019-02-27 20:21                                           ` Clément Pit-Claudel
  2019-02-27 21:23                                           ` Stefan Monnier
  1 sibling, 0 replies; 71+ messages in thread
From: Clément Pit-Claudel @ 2019-02-27 20:21 UTC (permalink / raw)
  To: Philippe Vaucher, Eli Zaretskii; +Cc: Emacs developers

On 27/02/2019 15.08, Philippe Vaucher wrote:
> 
> 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.

Oh, of course, that patch shouldn't be applied as is



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-27 20:08                                         ` Philippe Vaucher
  2019-02-27 20:21                                           ` Clément Pit-Claudel
@ 2019-02-27 21:23                                           ` Stefan Monnier
  2019-02-28  7:55                                             ` Philippe Vaucher
  1 sibling, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2019-02-27 21:23 UTC (permalink / raw)
  To: emacs-devel

> +(defcustom tabulated-list-sort-icon-asc " ▼"
> +(defcustom tabulated-list-sort-icon-desc " ▲"
> +(defcustom tabulated-list-glyphless-sort-icon-asc "v"
> +(defcustom tabulated-list-glyphless-sort-icon-desc "^"
[...]
> -    (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))

[ 9650 and 9660 should really have been written ?▲ and ?▼.  ]

The above code should be changed so that the table's entries that are
set correspond to the chars configured in tabulated-list-sort-icon-*sc.


        Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-27 21:23                                           ` Stefan Monnier
@ 2019-02-28  7:55                                             ` Philippe Vaucher
  2019-03-01  9:48                                               ` Philippe Vaucher
  2019-03-02 11:53                                               ` Eli Zaretskii
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-02-28  7:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers


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

On Wed, Feb 27, 2019 at 10:27 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > +(defcustom tabulated-list-sort-icon-asc " ▼"
> > +(defcustom tabulated-list-sort-icon-desc " ▲"
> > +(defcustom tabulated-list-glyphless-sort-icon-asc "v"
> > +(defcustom tabulated-list-glyphless-sort-icon-desc "^"
> [...]
> > -    (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))
>
> [ 9650 and 9660 should really have been written ?▲ and ?▼.  ]
>
> The above code should be changed so that the table's entries that are
> set correspond to the chars configured in tabulated-list-sort-icon-*sc.
>

Thanks, here attached is a patch doing that.

I noticed a problem: I can customize the unicode char just fine, but
whenever I try to customize the glyphless char and use `emacs -nw` it
doesn't work, it still uses "^"  or "v". My wild guess is that
`glyphless-char-display` is used instead of the custom table... if anyone
has an idea...

Regards,
Philippe

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

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

From f13bf05db5a6b18ce4b9916bf63dce3f4288f76b 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] 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 12d0151d6..a1af196bd 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 'character)
+
+(defcustom tabulated-list-sort-icon-desc ?▲
+  "Icon to display when sort order is descending."
+  :group 'tabulated-list
+  :type 'character)
+
+(defcustom tabulated-list-glyphless-sort-icon-asc ?v
+  "Glyphless icon to display when sort order is ascending."
+  :group 'tabulated-list
+  :type 'character)
+
+(defcustom tabulated-list-glyphless-sort-icon-desc ?^
+  "Glyphless icon to display when sort order is descending."
+  :group 'tabulated-list
+  :type 'character)
+
 ;; 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 tabulated-list-sort-icon-desc (cons nil (char-to-string tabulated-list-glyphless-sort-icon-desc)))
+    (aset table tabulated-list-sort-icon-asc (cons nil (char-to-string 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) (format " %c" tabulated-list-sort-icon-desc))
+			   (t (format " %c" tabulated-list-sort-icon-asc))))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-28  7:55                                             ` Philippe Vaucher
@ 2019-03-01  9:48                                               ` Philippe Vaucher
  2019-03-01 13:56                                                 ` Stefan Monnier
  2019-03-02 11:53                                               ` Eli Zaretskii
  1 sibling, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-01  9:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]

>
> Thanks, here attached is a patch doing that.
>

Anything else that patch should contain? I remember the commit message is
supposed to contain the list of modified files.



> I noticed a problem: I can customize the unicode char just fine, but
> whenever I try to customize the glyphless char and use `emacs -nw` it
> doesn't work, it still uses "^"  or "v".
>

Okay I found that it works if I re-eval the whole `defvar
tabulated-list-glyphless-char-display`, but not if I `eval-buffer` the
whole buffer. I cannot understand why. I guess that `eval-buffer` triggers
the loading of `tabulated-list.elc`, which resets the table to its default
value.

Also I was wondering if this:

(defvar tabulated-list-glyphless-char-display
  (let ((table (make-char-table 'glyphless-char-display nil)))

Should `make-char-table` purpose really be 'glyphless-char-display? I'm not
familiar enough with it, but I was wondering if it could clash with the
real `glyphless-char-display` variable purpose.

Kind regards,
Philippe

[-- Attachment #2: Type: text/html, Size: 1994 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-01  9:48                                               ` Philippe Vaucher
@ 2019-03-01 13:56                                                 ` Stefan Monnier
  2019-03-01 16:34                                                   ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2019-03-01 13:56 UTC (permalink / raw)
  To: emacs-devel

> Okay I found that it works if I re-eval the whole `defvar
> tabulated-list-glyphless-char-display`, but not if I `eval-buffer` the
> whole buffer.

`eval-buffer` will evaluate (defvar ...) in the normal way, which does
*nothing* if the variable is already defined.

So I suspect that "re-eval the whole ..." above meant to use C-M-x which
has special support for `defvar` to force re-evaluation.

> (defvar tabulated-list-glyphless-char-display
>   (let ((table (make-char-table 'glyphless-char-display nil)))
>
> Should `make-char-table` purpose really be 'glyphless-char-display?

Of course, that's what it's for.  This "purpose" should be thought
of as a type.


        Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-01 13:56                                                 ` Stefan Monnier
@ 2019-03-01 16:34                                                   ` Philippe Vaucher
  2019-03-01 17:34                                                     ` Stefan Monnier
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-01 16:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

>
> `eval-buffer` will evaluate (defvar ...) in the normal way, which does
> *nothing* if the variable is already defined.
>

Aaaah, with your explanations it clicked. I tested with "emacs -Q" and
though tabulated-list was not loaded before my eval-buffer, but I just
checked and it is.

So we have a problem in the sense that we cannot actually tweak this
character through the defcustom like it is done currently:

    (defcustom tabulated-list-sort-icon-asc ?▼)
    (defcustom tabulated-list-glyphless-sort-icon-asc ?v)
    ....
   (defvar tabulated-list-glyphless-char-display
     (let ((table (make-char-table 'glyphless-char-display nil)))
       (aset table tabulated-list-sort-icon-asc (cons nil (char-to-string
tabulated-list-glyphless-sort-icon-asc)))

I can imagine two solutions: either we make
`tabulated-list-glyphless-char-display` "dynamic" everytime it is accessed
(is that even possible?) or we do some magic that resets it whenever the
custom value changes.

Feel free to point me to "the right thing" I have no clue.


> So I suspect that "re-eval the whole ..." above meant to use C-M-x which
> has special support for `defvar` to force re-evaluation.
>

Yes this is what I used, ok thanks for the explanation a lot of other
weirdnesses make sense now :-)


> > Should `make-char-table` purpose really be 'glyphless-char-display?
>
> Of course, that's what it's for.  This "purpose" should be thought
> of as a type.
>

Alright.

Thanks,
Philippe

[-- Attachment #2: Type: text/html, Size: 2478 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-01 16:34                                                   ` Philippe Vaucher
@ 2019-03-01 17:34                                                     ` Stefan Monnier
  2019-03-01 18:14                                                       ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2019-03-01 17:34 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: Emacs developers

> Feel free to point me to "the right thing" I have no clue.

TRT is easy: write the code such that it behaves like we expect, and
you're done.

More seriously, we could refresh the table every time the major mode
is activated, or we could rely on a `:set`ter function (i.e. add a :set
argument to those defcustoms to recompute the table when the var is
modified by Custom).

> Yes this is what I used, ok thanks for the explanation a lot of other
> weirdnesses make sense now :-)

That's what Emacs is all about: make weirdness look natural,


        Stefan



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-01 17:34                                                     ` Stefan Monnier
@ 2019-03-01 18:14                                                       ` Philippe Vaucher
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-01 18:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

>
> More seriously, we could refresh the table every time the major mode
> is activated, or we could rely on a `:set`ter function (i.e. add a :set
> argument to those defcustoms to recompute the table when the var is
> modified by Custom).
>

Thanks, I think the `:set` solution is the one that makes more sense
because you only re-set the table once instead of multiple times, but at
the same time I kinda hate when simple code like `(setq
tabulated-list-glyphless-sort-icon-asc ?a)` does not work in configs.


> > Yes this is what I used, ok thanks for the explanation a lot of other
> > weirdnesses make sense now :-)
>
> That's what Emacs is all about: make weirdness look natural,
>

Well TBH I don't find the difference between `eval-buffer`, `eval-defun`
and `eval-last-sexp` natural at all. It's been a while since I wonder why
sometimes when evaling code it would appear to change the defcustom/defvar
values and sometimes not. With your explanations now I understand that was
simply because of how I evaled the code.

My "natural" expectation is for all of them to always re-evaluate
everything.

Kind regards,
Philippe

[-- Attachment #2: Type: text/html, Size: 1617 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-02-28  7:55                                             ` Philippe Vaucher
  2019-03-01  9:48                                               ` Philippe Vaucher
@ 2019-03-02 11:53                                               ` Eli Zaretskii
  2019-03-02 17:48                                                 ` Philippe Vaucher
  1 sibling, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-02 11:53 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Thu, 28 Feb 2019 08:55:47 +0100
> Cc: Emacs developers <emacs-devel@gnu.org>
> 
> * lisp/emacs-lisp/tabulated-list.el: add customization group, add
>   defcustoms.

Please use the ChangeLog style in the commit log messages; CONTRIBUTE
has the details.

> +(defcustom tabulated-list-sort-icon-asc ?▼
> +  "Icon to display when sort order is ascending."
> +  :group 'tabulated-list
> +  :type 'character)
> +
> +(defcustom tabulated-list-sort-icon-desc ?▲
> +  "Icon to display when sort order is descending."
> +  :group 'tabulated-list
> +  :type 'character)
> +
> +(defcustom tabulated-list-glyphless-sort-icon-asc ?v
> +  "Glyphless icon to display when sort order is ascending."
> +  :group 'tabulated-list
> +  :type 'character)
> +
> +(defcustom tabulated-list-glyphless-sort-icon-desc ?^
> +  "Glyphless icon to display when sort order is descending."
> +  :group 'tabulated-list
> +  :type 'character)

The doc strings for these options are too laconic, they should tell
what they are used for, and explain when the "glyphless" indicators
will be used instead of the other kind (and calling the "glyphless"
ones "icons" only adds to the confusion, so please don't).  Also,
please always include :version tags with new options.

> -    (aset table 9650 (cons nil "^"))
> -    (aset table 9660 (cons nil "v"))
> +    (aset table tabulated-list-sort-icon-desc (cons nil (char-to-string tabulated-list-glyphless-sort-icon-desc)))
> +    (aset table tabulated-list-sort-icon-asc (cons nil (char-to-string tabulated-list-glyphless-sort-icon-asc)))

Please break these long lines into shorter ones.

Finally, these changes should be accompanied by a suitable entry in
NEWS and by updates for the user manual, since this changes
user-visible behavior.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-02 17:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]

> Please use the ChangeLog style in the commit log messages; CONTRIBUTE
> has the details.
>

Will do.



> > +(defcustom tabulated-list-glyphless-sort-icon-desc ?^
> > +  "Glyphless icon to display when sort order is descending."
> > +  :group 'tabulated-list
> > +  :type 'character)
>
> The doc strings for these options are too laconic, they should tell
> what they are used for, and explain when the "glyphless" indicators
> will be used instead of the other kind (and calling the "glyphless"
> ones "icons" only adds to the confusion, so please don't).  Also,
> please always include :version tags with new options.
>

Well I used `glyphless` because that was the nomenclature already used
everywhere else. If it was me I'd talk about "the symbol displayed when
using the terminal" vs "the symbol displayed when using the GUI".

Would you be ok with `tabulated-list-gui-sort-symbol-asc` and
`tabulated-list-terminal-sort-symbol-asc` ?



> > -    (aset table 9650 (cons nil "^"))
> > -    (aset table 9660 (cons nil "v"))
> > +    (aset table tabulated-list-sort-icon-desc (cons nil (char-to-string
> tabulated-list-glyphless-sort-icon-desc)))
> > +    (aset table tabulated-list-sort-icon-asc (cons nil (char-to-string
> tabulated-list-glyphless-sort-icon-asc)))
>
> Please break these long lines into shorter ones.
>
> Finally, these changes should be accompanied by a suitable entry in
> NEWS and by updates for the user manual, since this changes
> user-visible behavior.
>

Alright.

Thanks,
Philippe

[-- Attachment #2: Type: text/html, Size: 2360 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-02 17:48                                                 ` Philippe Vaucher
@ 2019-03-02 17:51                                                   ` Philippe Vaucher
  2019-03-02 18:15                                                     ` Eli Zaretskii
  2019-03-02 18:15                                                   ` Eli Zaretskii
  1 sibling, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-02 17:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

>
> Would you be ok with `tabulated-list-gui-sort-symbol-asc` and
> `tabulated-list-terminal-sort-symbol-asc` ?
>

Maybe better ones would be `tabulated-list-gui-sort-indicator-asc` &
`tabulated-list-terminal-sort-indicator-asc`.

Philippe

[-- Attachment #2: Type: text/html, Size: 534 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-02 17:48                                                 ` Philippe Vaucher
  2019-03-02 17:51                                                   ` Philippe Vaucher
@ 2019-03-02 18:15                                                   ` Eli Zaretskii
  1 sibling, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-02 18:15 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sat, 2 Mar 2019 18:48:37 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Emacs developers <emacs-devel@gnu.org>
> 
> Would you be ok with `tabulated-list-gui-sort-symbol-asc` and `tabulated-list-terminal-sort-symbol-asc` ?

Yes, except that please consider "tty" instead of "terminal", it's
both shorter and more accurate (as a terminal can be a GUI terminal).

Thanks.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-02 17:51                                                   ` Philippe Vaucher
@ 2019-03-02 18:15                                                     ` Eli Zaretskii
  2019-03-02 19:06                                                       ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-02 18:15 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sat, 2 Mar 2019 18:51:06 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Emacs developers <emacs-devel@gnu.org>
> 
> Maybe better ones would be `tabulated-list-gui-sort-indicator-asc` & `tabulated-list-terminal-sort-indicator-asc
> `.

Using "indicator" is fine with me.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-02 18:15                                                     ` Eli Zaretskii
@ 2019-03-02 19:06                                                       ` Philippe Vaucher
  2019-03-08  9:43                                                         ` Eli Zaretskii
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-02 19:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers


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

Here we go. I'm not familiar with the NEWS redaction so feel free to change
the text.

Regards,
Philippe

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

[-- Attachment #2: 0001-Customize-tabulated-list-sort-indicators.patch --]
[-- Type: text/x-patch, Size: 5071 bytes --]

From f1a316fb834566dae1b76c815af32e51987166cd Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@gmail.com>
Date: Sat, 2 Mar 2019 20:03:41 +0100
Subject: [PATCH] Customize tabulated-list sort indicators

This allows the user to customize the sorting indicators displayed
near the current column.

* etc/NEWS: Mention changes
* lisp/emacs-lisp/tabulated-list.el (tabulated-list): New group.
(tabulated-list-gui-sort-indicator-asc): New defcustom.
(tabulated-list-gui-sort-indicator-desc): New defcustom.
(tabulated-list-tty-sort-indicator-asc): New defcustom.
(tabulated-list-tty-sort-indicator-desc): New defcustom.
(tabulated-list-glyphless-char-display): Removal.
(tabulated-list-make-glyphless-char-display-table): New function.
---
 etc/NEWS                          |  9 ++++++
 lisp/emacs-lisp/tabulated-list.el | 52 +++++++++++++++++++++++++------
 2 files changed, 52 insertions(+), 9 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index b265185567..a2cdec0083 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -279,6 +279,15 @@ matches strings where the pattern appears as a subsequence.  Put
 simply, makes "foo" complete to both "barfoo" and "frodo".  Add 'flex'
 to 'completion-styles' or 'completion-category-overrides' to use it.
 
++++
+** New user options for tabulated list sort indicators
+The user can customize which sorting indicator character to display
+near the current column in Tabulated Lists:
+- tabulated-list-gui-sort-indicator-asc
+- tabulated-list-gui-sort-indicator-desc
+- tabulated-list-tty-sort-indicator-asc
+- tabulated-list-tty-sort-indicator-desc
+
 \f
 * Editing Changes in Emacs 27.1
 
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 12d0151d67..cc82d3397d 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -36,6 +36,37 @@
 
 ;;; Code:
 
+(defgroup tabulated-list nil
+  "Tabulated-list customization group.")
+
+(defcustom tabulated-list-gui-sort-indicator-asc ?▼
+  "GUI indicator displayed near the current column when the sort order
+is ascending."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-gui-sort-indicator-desc ?▲
+  "GUI indicator displayed near the current column when the sort order
+is descending."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-asc ?v
+  "TTY indicator displayed near the current column when the sort order
+is ascending."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-desc ?^
+  "TTY indicator displayed near the current column when the sort order
+is descending."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
 ;; 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
@@ -174,14 +205,17 @@ If ADVANCE is non-nil, move forward by one line afterwards."
     map)
   "Local keymap for `tabulated-list-mode' sort buttons.")
 
-(defvar tabulated-list-glyphless-char-display
+(defun tabulated-list-make-glyphless-char-display-table ()
+  "Make the `glyphless-char-display' table used in Tabulated List buffers."
   (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"))
-    table)
-  "The `glyphless-char-display' table in Tabulated List buffers.")
+    (aset table
+          tabulated-list-gui-sort-indicator-desc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-desc)))
+    (aset table
+          tabulated-list-gui-sort-indicator-asc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-asc)))
+    table))
 
 (defvar tabulated-list--header-string nil
   "Holds the header if `tabulated-list-use-header-line' is nil.
@@ -231,8 +265,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) (format " %c" tabulated-list-gui-sort-indicator-desc))
+			   (t (format " %c" tabulated-list-gui-sort-indicator-asc))))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
@@ -655,7 +689,7 @@ as the ewoc pretty-printer."
   (setq-local truncate-lines t)
   (setq-local buffer-undo-list t)
   (setq-local revert-buffer-function #'tabulated-list-revert)
-  (setq-local glyphless-char-display tabulated-list-glyphless-char-display)
+  (setq-local glyphless-char-display (tabulated-list-make-glyphless-char-display-table))
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-02 19:06                                                       ` Philippe Vaucher
@ 2019-03-08  9:43                                                         ` Eli Zaretskii
  2019-03-08 13:38                                                           ` Stefan Monnier
  2019-03-09 10:18                                                           ` Philippe Vaucher
  0 siblings, 2 replies; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-08  9:43 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sat, 2 Mar 2019 20:06:49 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Emacs developers <emacs-devel@gnu.org>
> 
> Here we go. I'm not familiar with the NEWS redaction so feel free to change the text.

Thanks.  See some minor comments below.

Also, what about updating the Emacs user manual with the description
of the new user options?

> (tabulated-list-gui-sort-indicator-asc): New defcustom.
> (tabulated-list-gui-sort-indicator-desc): New defcustom.
> (tabulated-list-tty-sort-indicator-asc): New defcustom.
> (tabulated-list-tty-sort-indicator-desc): New defcustom.

This is not wrong, but could be abbreviated:

(tabulated-list-gui-sort-indicator-asc)
(tabulated-list-gui-sort-indicator-desc)
(tabulated-list-tty-sort-indicator-asc)
(tabulated-list-tty-sort-indicator-desc): New defcustom.

> (tabulated-list-glyphless-char-display): Removal.

We use "Removed".

> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -279,6 +279,15 @@ matches strings where the pattern appears as a subsequence.  Put
>  simply, makes "foo" complete to both "barfoo" and "frodo".  Add 'flex'
>  to 'completion-styles' or 'completion-category-overrides' to use it.
>  
> ++++

the "+++" marker means the manuals have been updated, but I don't see
the patch for the manuals.

> +** New user options for tabulated list sort indicators

The header should end in a period.

> +The user can customize which sorting indicator character to display
> +near the current column in Tabulated Lists:
> +- tabulated-list-gui-sort-indicator-asc
> +- tabulated-list-gui-sort-indicator-desc
> +- tabulated-list-tty-sort-indicator-asc
> +- tabulated-list-tty-sort-indicator-desc

We don't use itemized lists in NEWS, and also we quote Lisp symbols
'like this'.

> +(defcustom tabulated-list-gui-sort-indicator-asc ?▼
> +  "GUI indicator displayed near the current column when the sort order
> +is ascending."

the first line of a doc string should be a single complete sentence,
fr the benefit of the apropos* commands, which only show the first
line.  If the first sentence is too long, say the most important part
in the first sentence, and leave the details for the rest of the doc
string.  In this case, I'd suggest something like this:

    "Indicator for column sorted in ascending order, for GUI frames.
  See `tabulated-list-tty-sort-indicator-asc' for indicator used on
  text-mode frames."

> -(defvar tabulated-list-glyphless-char-display
> +(defun tabulated-list-make-glyphless-char-display-table ()
> +  "Make the `glyphless-char-display' table used in Tabulated List buffers."

I'd suggest to mention here that this table is used for displaying the
soring indicators.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2019-03-08 13:38 UTC (permalink / raw)
  To: emacs-devel

>> (tabulated-list-glyphless-char-display): Removal.
> We use "Removed".

Actually, we use the imperative in ChangeLog text (because it's supposed
to describe what the patch *does* rather than what you *did* when you
wrote it), so "Remove".


        Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-08 13:38                                                           ` Stefan Monnier
@ 2019-03-08 14:35                                                             ` Eli Zaretskii
  0 siblings, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-08 14:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 08 Mar 2019 08:38:08 -0500
> 
> >> (tabulated-list-glyphless-char-display): Removal.
> > We use "Removed".
> 
> Actually, we use the imperative in ChangeLog text (because it's supposed
> to describe what the patch *does* rather than what you *did* when you
> wrote it), so "Remove".

Actually, we use both.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-08  9:43                                                         ` Eli Zaretskii
  2019-03-08 13:38                                                           ` Stefan Monnier
@ 2019-03-09 10:18                                                           ` Philippe Vaucher
  2019-03-09 10:20                                                             ` Philippe Vaucher
  2019-03-09 15:06                                                             ` Eli Zaretskii
  1 sibling, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-09 10:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers


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

> Thanks.  See some minor comments below.
>

Thanks for the feekback. Here is a patch with all your suggested
modifications.

About the manual, given it's the first time I edit it I went for a very
minimalist approach, please tell me if I should mention the default values,
or the type of the defcustom in there.

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

[-- Attachment #2: 0001-Customize-tabulated-list-sort-indicators.patch --]
[-- Type: text/x-patch, Size: 7077 bytes --]

From 83e9058179405f44f95f493320121313d307d56e Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@gmail.com>
Date: Sat, 2 Mar 2019 20:03:41 +0100
Subject: [PATCH] Customize tabulated-list sort indicators

This allows the user to customize the sorting indicators displayed
near the current column.

* etc/NEWS: Mention changes
* doc/lispref/modes.texi: Add documentation for
  'tabulated-list-gui-sort-indicator-asc',
  'tabulated-list-gui-sort-indicator-desc',
  'tabulated-list-tty-sort-indicator-asc' and
  'tabulated-list-tty-sort-indicator-desc'.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list): New group.
(tabulated-list-gui-sort-indicator-asc)
(tabulated-list-gui-sort-indicator-desc)
(tabulated-list-tty-sort-indicator-asc)
(tabulated-list-tty-sort-indicator-desc): New defcustom.
(tabulated-list-glyphless-char-display): Remove.
(tabulated-list-make-glyphless-char-display-table): New function.
---
 doc/lispref/modes.texi            | 16 ++++++++
 etc/NEWS                          |  9 +++++
 lisp/emacs-lisp/tabulated-list.el | 62 ++++++++++++++++++++++++++-----
 3 files changed, 77 insertions(+), 10 deletions(-)

diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 22592a57b0..d30bd9854e 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1015,6 +1015,22 @@ list-processes}).  The listing command should create or switch to a
 buffer, turn on the derived mode, specify the tabulated data, and
 finally call @code{tabulated-list-print} to populate the buffer.
 
+@defopt tabulated-list-gui-sort-indicator-asc
+Indicator for column sorted in ascending order, for GUI frames.
+@end defopt
+
+@defopt tabulated-list-gui-sort-indicator-desc
+Indicator for column sorted in descending order, for GUI frames.
+@end defopt
+
+@defopt tabulated-list-tty-sort-indicator-asc
+Indicator for column sorted in ascending order, for text-mode frames.
+@end defopt
+
+@defopt tabulated-list-tty-sort-indicator-desc
+Indicator for column sorted in ascending order, for text-mode frames.
+@end defopt
+
 @defvar tabulated-list-format
 This buffer-local variable specifies the format of the Tabulated List
 data.  Its value should be a vector.  Each element of the vector
diff --git a/etc/NEWS b/etc/NEWS
index 3e347b5318..6119acdf15 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -279,6 +279,15 @@ matches strings where the pattern appears as a subsequence.  Put
 simply, makes "foo" complete to both "barfoo" and "frodo".  Add 'flex'
 to 'completion-styles' or 'completion-category-overrides' to use it.
 
++++
+** New user options for tabulated list sort indicators.
+The user can customize which sorting indicator character to display
+near the current column in Tabulated Lists (see variables
+'tabulated-list-gui-sort-indicator-asc',
+'tabulated-list-gui-sort-indicator-desc',
+'tabulated-list-tty-sort-indicator-asc' and
+'tabulated-list-tty-sort-indicator-desc')
+
 \f
 * Editing Changes in Emacs 27.1
 
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 12d0151d67..9021f825b2 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -36,10 +36,45 @@
 
 ;;; Code:
 
+(defgroup tabulated-list nil
+  "Tabulated-list customization group.")
+
+(defcustom tabulated-list-gui-sort-indicator-asc ?▼
+ "Indicator for column sorted in ascending order, for GUI frames. See
+  `tabulated-list-tty-sort-indicator-asc' for indicator used on
+  text-mode frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-gui-sort-indicator-desc ?▲
+ "Indicator for column sorted in descending order, for GUI frames. See
+  `tabulated-list-tty-sort-indicator-desc' for indicator used on
+  text-mode frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-asc ?v
+ "Indicator for column sorted in ascending order, for text-mode
+  frames. See `tabulated-list-gui-sort-indicator-asc' for indicator
+  used on GUI frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-desc ?^
+ "Indicator for column sorted in ascending order, for text-mode
+  frames. See `tabulated-list-gui-sort-indicator-asc' for indicator
+  used on GUI frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
 ;; 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
-;; still valid.  See, for example, ebuff-menu.el.
+;; still valid. See, for example, ebuff-menu.el.
 
 (defvar-local tabulated-list-format nil
   "The format of the current Tabulated List mode buffer.
@@ -174,14 +209,21 @@ If ADVANCE is non-nil, move forward by one line afterwards."
     map)
   "Local keymap for `tabulated-list-mode' sort buttons.")
 
-(defvar tabulated-list-glyphless-char-display
+(defun tabulated-list-make-glyphless-char-display-table ()
+  "Make the `glyphless-char-display' table used in Tabulated List
+buffers for text-mode frames. This table is used for displaying the
+sorting indicators, see variables
+`tabulated-list-tty-sort-indicator-asc' and
+`tabulated-list-tty-sort-indicator-desc' for more information."
   (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"))
-    table)
-  "The `glyphless-char-display' table in Tabulated List buffers.")
+    (aset table
+          tabulated-list-gui-sort-indicator-desc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-desc)))
+    (aset table
+          tabulated-list-gui-sort-indicator-asc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-asc)))
+    table))
 
 (defvar tabulated-list--header-string nil
   "Holds the header if `tabulated-list-use-header-line' is nil.
@@ -231,8 +273,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) (format " %c" tabulated-list-gui-sort-indicator-desc))
+			   (t (format " %c" tabulated-list-gui-sort-indicator-asc))))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
@@ -655,7 +697,7 @@ as the ewoc pretty-printer."
   (setq-local truncate-lines t)
   (setq-local buffer-undo-list t)
   (setq-local revert-buffer-function #'tabulated-list-revert)
-  (setq-local glyphless-char-display tabulated-list-glyphless-char-display)
+  (setq-local glyphless-char-display (tabulated-list-make-glyphless-char-display-table))
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-09 10:18                                                           ` Philippe Vaucher
@ 2019-03-09 10:20                                                             ` Philippe Vaucher
  2019-03-09 15:06                                                             ` Eli Zaretskii
  1 sibling, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-09 10:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

-;; still valid.  See, for example, ebuff-menu.el.
+;; still valid. See, for example, ebuff-menu.el.

The patch also contains this change, this was not intentional
(replace-string mishap) so feel free to remove it. Or I could resubmit a
patch without it, tell me.

Philippe

>

[-- Attachment #2: Type: text/html, Size: 577 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-09 15:06 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sat, 9 Mar 2019 11:18:31 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Emacs developers <emacs-devel@gnu.org>
> 
> Thanks for the feekback. Here is a patch with all your suggested modifications.

Thanks.  We are almost there.

> About the manual, given it's the first time I edit it I went for a very minimalist approach, please tell me if I should
> mention the default values, or the type of the defcustom in there.

What is needed is a bit more descriptive text about these options.
You could write that text only once, for the first option, and in the
others say something like

  Like @code{tabulated-list-gui-sort-indicator-asc}, but used
  when ...

> +(defcustom tabulated-list-gui-sort-indicator-asc ?▼
> + "Indicator for column sorted in ascending order, for GUI frames. See
> +  `tabulated-list-tty-sort-indicator-asc' for indicator used on
> +  text-mode frames."

The first line of the doc string should be a single complete sentence.

> -(defvar tabulated-list-glyphless-char-display
> +(defun tabulated-list-make-glyphless-char-display-table ()
> +  "Make the `glyphless-char-display' table used in Tabulated List

Likewise here.

> +buffers for text-mode frames. This table is used for displaying the
                               ^^
Two spaces between sentences, please.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-09 17:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

>
> > About the manual, given it's the first time I edit it I went for a very
> minimalist approach, please tell me if I should
> > mention the default values, or the type of the defcustom in there.
>
> What is needed is a bit more descriptive text about these options.
> You could write that text only once, for the first option, and in the
> others say something like
>
>   Like @code{tabulated-list-gui-sort-indicator-asc}, but used
>   when ...
>

Will do.



> > +(defcustom tabulated-list-gui-sort-indicator-asc ?▼
> > + "Indicator for column sorted in ascending order, for GUI frames. See
> > +  `tabulated-list-tty-sort-indicator-asc' for indicator used on
> > +  text-mode frames."
>
> The first line of the doc string should be a single complete sentence.
>

Just to be clear, if I wrote "It is the indicator used for the column
sorted in ascending order (for GUI frames)." would that be ok? I know a
complete sentence is subject + verb + complement but sometimes I have
trouble figuring what is missing.


> +buffers for text-mode frames. This table is used for displaying the
>                                ^^
> Two spaces between sentences, please.
>

Ah, I didn't know that rule. Thanks.

Philippe

[-- Attachment #2: Type: text/html, Size: 1947 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-09 17:08                                                               ` Philippe Vaucher
@ 2019-03-09 17:19                                                                 ` Eli Zaretskii
  2019-03-09 19:57                                                                 ` Stefan Monnier
  1 sibling, 0 replies; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-09 17:19 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Sat, 9 Mar 2019 18:08:02 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, Emacs developers <emacs-devel@gnu.org>
> 
>  > +(defcustom tabulated-list-gui-sort-indicator-asc ?▼
>  > + "Indicator for column sorted in ascending order, for GUI frames. See
>  > +  `tabulated-list-tty-sort-indicator-asc' for indicator used on
>  > +  text-mode frames."
> 
>  The first line of the doc string should be a single complete sentence.
> 
> Just to be clear, if I wrote "It is the indicator used for the column sorted in ascending order (for GUI frames)."
> would that be ok?

Yes.

>  > +buffers for text-mode frames. This table is used for displaying the
>                                 ^^
>  Two spaces between sentences, please.
> 
> Ah, I didn't know that rule. Thanks.

We use the US English conventions in our documentation, see
CONTRIBUTE.

Thanks.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  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
  1 sibling, 1 reply; 71+ messages in thread
From: Stefan Monnier @ 2019-03-09 19:57 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: Eli Zaretskii, Emacs developers

>> > + "Indicator for column sorted in ascending order, for GUI frames. See
>> > +  `tabulated-list-tty-sort-indicator-asc' for indicator used on
>> > +  text-mode frames."
>> The first line of the doc string should be a single complete sentence.
> Just to be clear, if I wrote "It is the indicator used for the column
> sorted in ascending order (for GUI frames)." would that be ok?

I think there's a misunderstanding here: the only real problem in the
code above is the "See" which should be moved to the next line.
The reason for that is that the first line will sometimes be shown
without showing the rest.

We usually skip the "It is the" because it carries no useful information
and eats up space which is often a limitation since we don't want to go
over the 80 columns limit.


        Stefan



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-09 19:57                                                                 ` Stefan Monnier
@ 2019-03-11  9:08                                                                   ` Philippe Vaucher
  2019-03-11 10:54                                                                     ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-11  9:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]

On Sat, Mar 9, 2019 at 8:57 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> >> > + "Indicator for column sorted in ascending order, for GUI frames. See
> >> > +  `tabulated-list-tty-sort-indicator-asc' for indicator used on
> >> > +  text-mode frames."
> >> The first line of the doc string should be a single complete sentence.
> > Just to be clear, if I wrote "It is the indicator used for the column
> > sorted in ascending order (for GUI frames)." would that be ok?
>
> I think there's a misunderstanding here: the only real problem in the
> code above is the "See" which should be moved to the next line.
> The reason for that is that the first line will sometimes be shown
> without showing the rest.
>
> We usually skip the "It is the" because it carries no useful information
> and eats up space which is often a limitation since we don't want to go
> over the 80 columns limit.
>

Thanks, I missunderstood indeed, I thought it was about the sentence... not
that there should be only one single sentence on the first line.

Alright, hopefully the next patch will be the final one :-)

Regards,
Philippe

[-- Attachment #2: Type: text/html, Size: 1645 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-11  9:08                                                                   ` Philippe Vaucher
@ 2019-03-11 10:54                                                                     ` Philippe Vaucher
  2019-03-15  9:11                                                                       ` Eli Zaretskii
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-11 10:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, Emacs developers


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

Okay this should be OK.

What maybe remains to be improved is the manual text... I tried to add a
bit of description but it's already quite self-explicit for most of us so I
have a bit of trouble figuring how much we need to explain.

Regards,
Philippe

>

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

[-- Attachment #2: 0001-Customize-tabulated-list-sort-indicators.patch --]
[-- Type: text/x-patch, Size: 7109 bytes --]

From ca03942bce64e1b00d5af5e8d63f1bb7e3fc8db9 Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@gmail.com>
Date: Sat, 2 Mar 2019 20:03:41 +0100
Subject: [PATCH] Customize tabulated-list sort indicators

This allows the user to customize the sorting indicators displayed
near the current column.

* etc/NEWS: Mention changes
* doc/lispref/modes.texi: Add documentation for
  'tabulated-list-gui-sort-indicator-asc',
  'tabulated-list-gui-sort-indicator-desc',
  'tabulated-list-tty-sort-indicator-asc' and
  'tabulated-list-tty-sort-indicator-desc'.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list): New group.
(tabulated-list-gui-sort-indicator-asc)
(tabulated-list-gui-sort-indicator-desc)
(tabulated-list-tty-sort-indicator-asc)
(tabulated-list-tty-sort-indicator-desc): New defcustom.
(tabulated-list-glyphless-char-display): Remove.
(tabulated-list-make-glyphless-char-display-table): New function.
---
 doc/lispref/modes.texi            | 23 ++++++++++++
 etc/NEWS                          |  9 +++++
 lisp/emacs-lisp/tabulated-list.el | 59 ++++++++++++++++++++++++++-----
 3 files changed, 82 insertions(+), 9 deletions(-)

diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 22592a57b0..0d4f0b12fe 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1015,6 +1015,29 @@ list-processes}).  The listing command should create or switch to a
 buffer, turn on the derived mode, specify the tabulated data, and
 finally call @code{tabulated-list-print} to populate the buffer.
 
+@defopt tabulated-list-gui-sort-indicator-asc
+This is the ascending character indicator displayed next to the currently sorted
+column, for GUI frames.
+
+Whenever you change the sort direction in Tabulated List buffers, you
+toggle this indicator between ascending (asc) and descending
+(desc).
+@end defopt
+
+@defopt tabulated-list-gui-sort-indicator-desc
+Like @code{tabulated-list-gui-sort-indicator-asc}, but used when the
+sort order is descending.
+@end defopt
+
+@defopt tabulated-list-tty-sort-indicator-asc
+Like @code{tabulated-list-gui-sort-indicator-asc}, but used for text-mode frames.
+@end defopt
+
+@defopt tabulated-list-tty-sort-indicator-desc
+Like @code{tabulated-list-tty-sort-indicator-asc}, but used when the
+sort order is descending.
+@end defopt
+
 @defvar tabulated-list-format
 This buffer-local variable specifies the format of the Tabulated List
 data.  Its value should be a vector.  Each element of the vector
diff --git a/etc/NEWS b/etc/NEWS
index 3e347b5318..6119acdf15 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -279,6 +279,15 @@ matches strings where the pattern appears as a subsequence.  Put
 simply, makes "foo" complete to both "barfoo" and "frodo".  Add 'flex'
 to 'completion-styles' or 'completion-category-overrides' to use it.
 
++++
+** New user options for tabulated list sort indicators.
+The user can customize which sorting indicator character to display
+near the current column in Tabulated Lists (see variables
+'tabulated-list-gui-sort-indicator-asc',
+'tabulated-list-gui-sort-indicator-desc',
+'tabulated-list-tty-sort-indicator-asc' and
+'tabulated-list-tty-sort-indicator-desc')
+
 \f
 * Editing Changes in Emacs 27.1
 
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 12d0151d67..5a54f2d68a 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -36,6 +36,41 @@
 
 ;;; Code:
 
+(defgroup tabulated-list nil
+  "Tabulated-list customization group.")
+
+(defcustom tabulated-list-gui-sort-indicator-asc ?▼
+  "Indicator for column sorted in ascending order, for GUI frames.
+See `tabulated-list-tty-sort-indicator-asc' for the indicator used on
+text-mode frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-gui-sort-indicator-desc ?▲
+  "Indicator for column sorted in descending order, for GUI frames.
+See `tabulated-list-tty-sort-indicator-desc' for the indicator used on
+text-mode frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-asc ?v
+  "Indicator for column sorted in ascending order, for text-mode frames.
+See `tabulated-list-gui-sort-indicator-asc' for the indicator used on GUI
+frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-desc ?^
+  "Indicator for column sorted in ascending order, for text-mode frames.
+See `tabulated-list-gui-sort-indicator-asc' for the indicator used on GUI
+frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
 ;; 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
@@ -174,14 +209,20 @@ If ADVANCE is non-nil, move forward by one line afterwards."
     map)
   "Local keymap for `tabulated-list-mode' sort buttons.")
 
-(defvar tabulated-list-glyphless-char-display
+(defun tabulated-list-make-glyphless-char-display-table ()
+  "Make the `glyphless-char-display' table used for text-mode frames.
+This table is used for displaying the sorting indicators, see
+variables `tabulated-list-tty-sort-indicator-asc' and
+`tabulated-list-tty-sort-indicator-desc' for more information."
   (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"))
-    table)
-  "The `glyphless-char-display' table in Tabulated List buffers.")
+    (aset table
+          tabulated-list-gui-sort-indicator-desc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-desc)))
+    (aset table
+          tabulated-list-gui-sort-indicator-asc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-asc)))
+    table))
 
 (defvar tabulated-list--header-string nil
   "Holds the header if `tabulated-list-use-header-line' is nil.
@@ -231,8 +272,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) (format " %c" tabulated-list-gui-sort-indicator-desc))
+			   (t (format " %c" tabulated-list-gui-sort-indicator-asc))))
 		  'face 'bold
 		  'tabulated-list-column-name label
 		  button-props))
@@ -655,7 +696,7 @@ as the ewoc pretty-printer."
   (setq-local truncate-lines t)
   (setq-local buffer-undo-list t)
   (setq-local revert-buffer-function #'tabulated-list-revert)
-  (setq-local glyphless-char-display tabulated-list-glyphless-char-display)
+  (setq-local glyphless-char-display (tabulated-list-make-glyphless-char-display-table))
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-11 10:54                                                                     ` Philippe Vaucher
@ 2019-03-15  9:11                                                                       ` Eli Zaretskii
  2019-03-17 11:55                                                                         ` Philippe Vaucher
  0 siblings, 1 reply; 71+ messages in thread
From: Eli Zaretskii @ 2019-03-15  9:11 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: monnier, emacs-devel

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Mon, 11 Mar 2019 11:54:08 +0100
> Cc: Eli Zaretskii <eliz@gnu.org>, Emacs developers <emacs-devel@gnu.org>
> 
> Okay this should be OK. 
> 
> What maybe remains to be improved is the manual text... I tried to add a bit of description but it's already quite
> self-explicit for most of us so I have a bit of trouble figuring how much we need to explain.

Thanks, I pushed this with several changes that reformatted test and
code to be consistent with our style.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: tabulated-list sort icon is reversed
  2019-03-15  9:11                                                                       ` Eli Zaretskii
@ 2019-03-17 11:55                                                                         ` Philippe Vaucher
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Vaucher @ 2019-03-17 11:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

>
> Thanks, I pushed this with several changes that reformatted test and
> code to be consistent with our style.
>

Thanks for your help along the way ;-)

[-- Attachment #2: Type: text/html, Size: 369 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2019-03-17 11:55 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).