emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Patch to implement sorting Org tables by IP address


From: Jon Snader
Subject: Re: [O] Patch to implement sorting Org tables by IP address
Date: Sat, 13 Dec 2014 13:47:24 -0500

> On Dec 13, 2014, at 11:01 AM, Nicolas Goaziou <address@hidden> wrote:

> `org-do-sort' is an internal function, which isn't meant to be used
> publicly. It really should be named `org-table--do-sort' and be moved
> within "org-table.el". OTOH, we can extend `org-table-sort-lines' to
> allow custom sorting function as a parameter.

I like the idea of providing optional parameters to org-table-sort-lines.

The extraction function varies with the type of sort so it has to be specified 
one way or the other. In org-sort-list, that’s what the getkey-func parameter 
supplies. Thus if we wanted an alist we’d need to provide it too. If you want 
simplicity, how about this: Add ?f ?F and two optional parameters for 
getkey-func and compare-func to org-table-sort-lines. Then add optional 
parameters to org-do-sort for the getkey-func and compare-func functions. If 
the sort type is ?f or ?F org-do-sort would use getkey-func and compare-func 
instead of the built-in functions.

This would make org-table-sort-lines behave the same way that org-sort-list 
does. Then I could solve my original problem by writing a local function that 
calls org-table-sort-lines with the ?f or ?F sort type and appropriate 
extraction and compare functions.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

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