unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Marvin Gülker" <post+ebugs@guelker.eu>
Cc: michael_heerdegen@web.de, 41706@debbugs.gnu.org
Subject: bug#41706: 26.1; sort-subr predicate cannot be set successfully
Date: Fri, 05 Jun 2020 11:32:51 +0300	[thread overview]
Message-ID: <83d06dc3po.fsf@gnu.org> (raw)
In-Reply-To: <20200604190526.GA14104@atlantis> (message from Marvin Gülker on Thu, 4 Jun 2020 21:05:26 +0200)

> Date: Thu, 4 Jun 2020 21:05:26 +0200
> From: Marvin Gülker <post+ebugs@guelker.eu>
> Cc: 41706@debbugs.gnu.org
> 
> >To understand how ‘sort-subr’ works, consider the whole accessible
> >portion of the buffer as being divided into disjoint pieces called
> >“sort records”.  The records may or may not be contiguous, but they
> >must not overlap.  A portion of each sort record (perhaps all of
> >it) is designated as the sort key. [...]
> >The argument PREDICATE is the function to use to compare keys.  If
> >keys are numbers, it defaults to ‘<’; otherwise it defaults to
> >string<’.
> 
> No further mention of how to use PREDICATE is made, and the manual 
> continues with reproducing the source code of `sort-lines'. I took that 
> section to mean that the PREDICATE is in the default case `<' and 
> with strings `string<'. From the manual's text it became not clear to me 
> under which condition the keys are not strings, and I assumed they will 
> normally always be strings as buffer substrings are always strings.
> 
> Now I see that the documentation for the `sort-subr' function is a 
> little more specific, but still it doesn't really make clear which kind 
> of "key" is received as arguments in the PREDICATE under which 
> conditions. The call above appearently yields cons cell keys whose CAR 
> and CDR correspond to buffer positions, but the documentation makes me 
> suspect that calling `sort-subr' differently will yield other kinds of 
> keys.
> 
> I would suggest to amend the manual to be more precise about the 
> arguments that PREDICATE receives, and perhaps add an example.

It is hard to be specific about the arguments to PREDICATE, because
they depend on what the other arguments to sort-subr return.  I
augmented the manual to at least have the same information as the doc
string; more detail is only possible if we discuss specific values of
STARTKEYFUN and ENDKEYFUN.

Thanks.





  reply	other threads:[~2020-06-05  8:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 11:09 bug#41706: 26.1; sort-subr predicate cannot be set successfully Marvin Gülker
2020-06-04 12:11 ` Michael Heerdegen
2020-06-04 19:05   ` Marvin Gülker
2020-06-05  8:32     ` Eli Zaretskii [this message]
2020-06-05  9:43       ` Michael Heerdegen
2020-06-05 11:43         ` Eli Zaretskii
2020-06-10 18:59           ` Michael Heerdegen
2020-06-10 19:08             ` Eli Zaretskii
2020-06-11 12:55               ` Michael Heerdegen
2020-06-11 13:39                 ` Eli Zaretskii
2020-06-11 13:59                   ` Michael Heerdegen
2020-06-11 16:36                     ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83d06dc3po.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=41706@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=post+ebugs@guelker.eu \
    /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 public inbox

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