Subject: bug#31800: suggestion of improvement for sort-numeric-fields function.

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 24 Jan 2020 16:30:10 +0100

Stefan Kangas <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>>>> -		     (sort-skip-fields field)
>>>> + (unless (string-match-p "^\\s-*$" (thing-at-point 'line))
>>>> +                       (sort-skip-fields field))
>>
>> I don't think this patch makes sense as is -- I think that's a
>> convoluted way of saying `looking-at'?  But it makes conceptual sense, I
>> think.
>
> I'm not sure.  Do you mean to use:
>
>     (looking-at "\\s*$")
>
> Are we sure point is at the beginning of line here though?  The above
> code doesn't require that, but also seems to be wrong if region is in
> the middle of a line.  But I'm not sure how people typically use this
> in that case.

I assumed that

  (thing-at-point 'line)

returns the current line, but I haven't actually looked at the code, but
you're right -- we don't know where point is, so that has to be moved
before checking.  In any case, using thing-at-point is not the right
thing.

> BTW, shouldn't we also fix the same bug in sort-fields while we're at
> it?

Yes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no