From: Stefan Kangas <stefan@marxist.se>
To: SK Kim <tttuuu888@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 31800@debbugs.gnu.org
Subject: bug#31800: suggestion of improvement for sort-numeric-fields function.
Date: Mon, 20 Jan 2020 20:55:04 +0100 [thread overview]
Message-ID: <87v9p5rjhj.fsf@marxist.se> (raw)
In-Reply-To: <CAKYNWwTQ9JqJb8njyEMTT2_jUTR+bJUjYKwU_3qqqwRpbTRKTg@mail.gmail.com> (SK Kim's message of "Sat, 13 Jul 2019 17:21:18 +0900")
SK Kim <tttuuu888@gmail.com> writes:
> I made this patch from github emacs-mirror repository.
> I hope this will be of help.
>
> Thanks.
>
> 2019년 7월 13일 (토) 오후 12:42, Lars Ingebrigtsen <larsi@gnus.org>님이 작성:
>
> SK Kim <tttuuu888@gmail.com> writes:
>
> > This is not likely a bug but sort-numeric-fields function does not
> > allow region with blank lines, while sort-lines does.
> >
> > This was because sort-skip-fields occurs error with blank line. And
> > when I added condition for sort-skip-fields like below,
> > sort-numeric-fields was working with blank lines too.
> >
> > (when (not (string-match-p "^\\s-*$" (thing-at-point 'line)))
> > (sort-skip-fields field))
> >
> > So, I just hope sort-numeric-fields would work for region with blank
> > lines too.
The patch below looks good to me. Does anyone else have an opinion
here, or should I go ahead and commit it to master?
Best regards,
Stefan Kangas
> From d08c5d368337ee49bb72d9915c409edcbc73b4e0 Mon Sep 17 00:00:00 2001
> From: SeungKi Kim <tttuuu888@gmail.com>
> Date: Sat, 13 Jul 2019 17:12:46 +0900
> Subject: [PATCH] Improve `sort-numeric-fields'
>
> * lisp/sort.el (sort-numeric-fields) : Allow including empty lines.
> ---
> lisp/sort.el | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/sort.el b/lisp/sort.el
> index 6ea1c44060..3e9413e4af 100644
> --- a/lisp/sort.el
> +++ b/lisp/sort.el
> @@ -281,7 +281,8 @@ FIELD, BEG and END. BEG and END specify region to sort."
> ((inhibit-field-text-motion t))
> (sort-fields-1 field beg end
> (lambda ()
> - (sort-skip-fields field)
> + (unless (string-match-p "^\\s-*$" (thing-at-point 'line))
> + (sort-skip-fields field))
> (let* ((case-fold-search t)
> (base
> (if (looking-at "\\(0x\\)[0-9a-f]\\|\\(0\\)[0-7]")
next prev parent reply other threads:[~2020-01-20 19:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 16:09 bug#31800: suggestion of improvement for sort-numeric-fields function SK Kim
2019-07-13 3:41 ` Lars Ingebrigtsen
2019-07-13 8:21 ` SK Kim
2020-01-20 19:55 ` Stefan Kangas [this message]
2020-01-22 13:44 ` Lars Ingebrigtsen
2020-01-23 14:50 ` Stefan Kangas
2020-01-24 15:30 ` Lars Ingebrigtsen
2022-02-03 19:34 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9p5rjhj.fsf@marxist.se \
--to=stefan@marxist.se \
--cc=31800@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=tttuuu888@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.