emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* C-c ^ not fully useful
@ 2013-02-18 19:36 François Pinard
  2013-02-21  9:59 ` Suvayu Ali
  2013-02-25  9:28 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: François Pinard @ 2013-02-18 19:36 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Org people.

"C-c ^" (org-sort) is not as useful to me as I would like it to be.  I
often have lists in which each item start with a link.  When sorting
such lists, because of the  [[URL][TITLE]] coding, entries are sorted
along the domain of the link (the URL), which is useful in itself of
course, but often not as comfortable as if the sort was done on TITLE.

One could provide a function for extracting the sorting key out of the
current line (I did not try this facility yet, I presume this is how it
works), so I could likely solve my own problem, as described above.

The ideal for me would be that some Lisp function exists to extract the
visual line out of the physical line, that is, the line once all
invisible parts have been removed.  This would take care not only for
links, but also for highlighting marks (like =~*/) when they happen to
be hidden.

However, I guess I'm not alone wanting "C-c ^" to do what is most
expected.  So, these few suggestions:

- Could org-sort, by default and for most of its current option letters,
  sort alphabetically (or lexicographically as they say!) over the
  visual aspect of the line instead of its physical contents?  It might
  be difficult if Emacs has no function to reach the visual aspect of a
  line.  I guess that most users would expect a visual sort.

- Options might be added to sort over the physical contents of the line
  instead.  And there always is M-x sort-lines RET !).

- Could some parameterisation be added so one could map user written
  functions over (free) option letters?

François

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

* Re: C-c ^ not fully useful
  2013-02-18 19:36 C-c ^ not fully useful François Pinard
@ 2013-02-21  9:59 ` Suvayu Ali
  2013-02-25  9:28 ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Suvayu Ali @ 2013-02-21  9:59 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Feb 18, 2013 at 02:36:57PM -0500, François Pinard wrote:
> 
> - Could org-sort, by default and for most of its current option letters,
>   sort alphabetically (or lexicographically as they say!) over the
>   visual aspect of the line instead of its physical contents?  It might
>   be difficult if Emacs has no function to reach the visual aspect of a
>   line.  I guess that most users would expect a visual sort.

I think this is a good idea.  It should be possible to just test if the
first entity is a "link" and extract the title part using org-elements

> - Options might be added to sort over the physical contents of the line
>   instead.  And there always is M-x sort-lines RET !).

Agreed.

> - Could some parameterisation be added so one could map user written
>   functions over (free) option letters?

Again, a good idea.  :)

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: C-c ^ not fully useful
  2013-02-18 19:36 C-c ^ not fully useful François Pinard
  2013-02-21  9:59 ` Suvayu Ali
@ 2013-02-25  9:28 ` Bastien
  2013-02-25  9:35   ` Carsten Dominik
  1 sibling, 1 reply; 7+ messages in thread
From: Bastien @ 2013-02-25  9:28 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi François,

sorting list items and headlines is now done against the visible
part of the item and headlines, i.e., it ignores hidden links and
emphasis markers.

I am not sure it is useful to add a parameter to `org-sort-list' and
`org-sort-entries' to let the user change this default behavior: do
you have a significant use-case for this?

François Pinard <pinard@iro.umontreal.ca> writes:

> - Could some parameterisation be added so one could map user written
>   functions over (free) option letters?

Here again, my feeling is that it would be over-engineered -- would
you use it yourself?  How?

Thanks for suggesting this improvements!

-- 
 Bastien

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

* Re: C-c ^ not fully useful
  2013-02-25  9:28 ` Bastien
@ 2013-02-25  9:35   ` Carsten Dominik
  2013-02-25 10:22     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2013-02-25  9:35 UTC (permalink / raw)
  To: Bastien; +Cc: François Pinard, emacs-orgmode


On 25 feb. 2013, at 10:28, Bastien <bzg@altern.org> wrote:

> Hi François,
> 
> sorting list items and headlines is now done against the visible
> part of the item and headlines, i.e., it ignores hidden links and
> emphasis markers.

Hi Bastien,

are you sure it removes emphasis markers as well?  Looks to me that org-sort-remove-invisible only removes links.  I guess it could be rewritten looking at invisibility properties, but that might be problematic when sorting includes a part of the buffer that has not yet been visible in a window and therefore might not be propertized properly.

- Carsten

> 
> I am not sure it is useful to add a parameter to `org-sort-list' and
> `org-sort-entries' to let the user change this default behavior: do
> you have a significant use-case for this?
> 
> François Pinard <pinard@iro.umontreal.ca> writes:
> 
>> - Could some parameterisation be added so one could map user written
>>  functions over (free) option letters?
> 
> Here again, my feeling is that it would be over-engineered -- would
> you use it yourself?  How?
> 
> Thanks for suggesting this improvements!
> 
> -- 
> Bastien
> 


-- 
Having an entire horizon of things you half-care about. -- Merlin Mann in "Inbox Zero"

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

* Re: C-c ^ not fully useful
  2013-02-25  9:35   ` Carsten Dominik
@ 2013-02-25 10:22     ` Bastien
  2013-02-25 14:46       ` François Pinard
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2013-02-25 10:22 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: François Pinard, emacs-orgmode

Hi Carsten,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> are you sure it removes emphasis markers as well?  Looks to me that
> org-sort-remove-invisible only removes links.  I guess it could be
> rewritten looking at invisibility properties, but that might be problematic
> when sorting includes a part of the buffer that has not yet been visible in
> a window and therefore might not be propertized properly.

You are right, the version that removes emphasis markers based on the
visibility[1] specs is buggy.  I tweaked `org-sort-remove-invisible'
so that it removes emphasis markers for good[2].  I did some testing
and it works okay, let me know if you anticipate any other problem.

Thanks,

[1] http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=30d6dc
[2] http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=662cb9

-- 
 Bastien

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

* Re: C-c ^ not fully useful
  2013-02-25 10:22     ` Bastien
@ 2013-02-25 14:46       ` François Pinard
  2013-02-26  9:47         ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: François Pinard @ 2013-02-25 14:46 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> [1] http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=30d6dc
> [2] http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=662cb9

While your commits are rather small, I would likely never have figured
out how to do them, the magic goes over my head.  It's a little like
playing go against someone who is far from your own level: you
objectively observe that the heavens is falling apart on your head, but
you just don't understand how nor why it is happening. :-)

By the way, Bastien, it seems that your correction wonderfully works.
It's so comfortable being able to see long lists of links (visually)
sorted in a correct way.  Thanks a lot for this.

François

P.S. About an option to sort the previous way, that is, by the physical
contents of the line, visible or not, I do not have a use case for it, I
would not need such an option.

I sometimes, yet not often, need to group together links by their
originating site, and then, the standard Emacs line sorting function
gave me a very good approximation, good enough for my little needs.

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

* Re: C-c ^ not fully useful
  2013-02-25 14:46       ` François Pinard
@ 2013-02-26  9:47         ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2013-02-26  9:47 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi François,

François Pinard <pinard@iro.umontreal.ca> writes:

> P.S. About an option to sort the previous way, that is, by the physical
> contents of the line, visible or not, I do not have a use case for it, I
> would not need such an option.
>
> I sometimes, yet not often, need to group together links by their
> originating site, and then, the standard Emacs line sorting function
> gave me a very good approximation, good enough for my little needs.

Thanks for your feedback on this.  We will announce the feature widely
enough so that users who need the parameter can chime in.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2013-02-26 10:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-18 19:36 C-c ^ not fully useful François Pinard
2013-02-21  9:59 ` Suvayu Ali
2013-02-25  9:28 ` Bastien
2013-02-25  9:35   ` Carsten Dominik
2013-02-25 10:22     ` Bastien
2013-02-25 14:46       ` François Pinard
2013-02-26  9:47         ` Bastien

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).