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

2014-12-20 Thread Nicolas Goaziou
Hello, Jon Snader writes: > I moved EXTRACT-STRING-P to a lower let but TEMPFUN has to be > available to the call to sort so I left it in the outer let. Not in the snippet I suggested, but it doesn't matter much. > The attached patch was against the latest master branch at the time I > generat

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

2014-12-20 Thread Jon Snader
On Dec 20, 2014, at 6:57 AM, Nicolas Goaziou wrote:+ extractfun comparefun tempfun extract-string-p)EXTRACT-STRING-P, and possibly TEMPFUN, are bound too early. See below.I moved EXTRACT-STRING-P to a lower let but TEMPFUN has to be available to the call to sort so I left i

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

2014-12-20 Thread Nicolas Goaziou
Jon Snader writes: >> On Dec 14, 2014, at 12:18 PM, Nicolas Goaziou wrote: > >>> As I said above, you’ve convinced me that ?f ?F is the right solution. >> >> Fair enough. Let's settle on that, then. > > Here is the new patch. It extends org-table-sort-lines to allow a user > to specify custom e

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

2014-12-17 Thread Jon Snader
> On Dec 14, 2014, at 12:18 PM, Nicolas Goaziou wrote: >> As I said above, you’ve convinced me that ?f ?F is the right solution. > > Fair enough. Let's settle on that, then. Here is the new patch. It extends org-table-sort-lines to allow a user to specify custom extraction and comparison func

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

2014-12-14 Thread Nicolas Goaziou
Jon Snader writes: > As I see it, we’ve reached the conclusion that we should either have > some sort of minimal table-driven mechanism or duplicate the > functionality in org-sort-list. I like duplicating the org-sort-list > functionality best. As you pointed out before, org-do-sort is an > inte

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

2014-12-14 Thread Jon Snader
> On Dec 14, 2014, at 6:25 AM, Nicolas Goaziou wrote: > > Jon Snader writes: >> Really, this doesn’t matter because I was >> merely commenting on why (prompt . comparison) isn’t enough. Of >> course, you could roll any special extraction functionality into the >> comparison but I don’t really

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

2014-12-14 Thread Nicolas Goaziou
Jon Snader writes: > Well, I’m just going by what happens now. In org-do-sort, each of the > sort options sets a different extraction function. For example, if you > want a numeric sort, the extraction function calls string-to-number, > while if you want an alphabetic sort it calls > org-sort-rem

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

2014-12-13 Thread Jon Snader
> On Dec 13, 2014, at 5:07 PM, Nicolas Goaziou wrote: > I don't think it needs to vary. As I suggested already, we can use cells > contents (in the appropriate column) as trimmed strings. So, it could be > built-in. > > Do you see any downside to it? Well, I’m just going by what happens now. I

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

2014-12-13 Thread Nicolas Goaziou
Jon Snader writes: > The extraction function varies with the type of sort so it has to be > specified one way or the other. I don't think it needs to vary. As I suggested already, we can use cells contents (in the appropriate column) as trimmed strings. So, it could be built-in. Do you see any

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

2014-12-13 Thread Jon Snader
> On Dec 13, 2014, at 11:01 AM, Nicolas Goaziou 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 funct

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

2014-12-13 Thread Nicolas Goaziou
Jon Snader writes: > The problem with that solution is that the user has to answer the > additional prompts every time he calls org-table-sort-lines with > a custom sort. Imagine, for example, a networking researcher who often > builds tables that he or she wants to sort by IP address (or any oth

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

2014-12-13 Thread Jon Snader
> On Dec 13, 2014, at 9:29 AM, Nicolas Goaziou wrote: > I think my proposal is simpler: add ?f and ?F to built-in options, in > which case user is prompted for a custom sorting function (in your case, > `org-ip-lessp'). It is also more consistent with `org-sort-list’. The problem with that solu

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

2014-12-13 Thread Nicolas Goaziou
Jon Snader writes: > My idea for making it table driven is to add an alist whose elements look > something like > > (prompt-char prompt extraction-function compare-function > reverse-compare-function with-case-extraction-function) > > The alist would be initialized with the built-in options (in

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

2014-12-13 Thread Jon Snader
> On Dec 12, 2014, at 5:58 PM, Nicolas Goaziou wrote: > However I think the feature implemented is too specific. Instead, > `org-do-sort' could provide a way to pass an arbitrary predicate, > like ?f and ?F in `org-sort-list'. > > WDYT? Actually, when I originally looked at org-do-sort, my fir

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

2014-12-12 Thread Nicolas Goaziou
Hello, Jon Snader writes: > There is currently no easy way to sort an Org table by IP address. The > only method I could find involves selecting the IP addresses in > a rectangle and piping them to sort with a complicated sort recipe. > Even though I am not a system administrator, I sometimes ne

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

2014-12-10 Thread Jon Snader
There is currently no easy way to sort an Org table by IP address. The only method I could find involves selecting the IP addresses in a rectangle and piping them to sort with a complicated sort recipe. Even though I am not a system administrator, I sometimes need to maintain tables that I’d lik