bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#41706: 26.1; sort-subr predicate cannot be set successfully


From: Michael Heerdegen
Subject: bug#41706: 26.1; sort-subr predicate cannot be set successfully
Date: Thu, 04 Jun 2020 14:11:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Marvin Gülker <post+ebugs@guelker.eu> writes:

> I copied the source code of `sort-lines' and
> adapted the call to `sort-subr' to use `string-collate-lessp',
> resulting in this function:
>
> (defun my-sort-lines-collate (reverse beg end)
>  (interactive "P\nr")
>  (save-excursion
>    (save-restriction
>      (narrow-to-region beg end)
>      (goto-char (point-min))
>      (let ;; To make `end-of-line' and etc. to ignore fields.
>         ((inhibit-field-text-motion t))
>       (sort-subr reverse 'forward-line 'end-of-line nil nil 
> 'string-collate-lessp)))))
>
> This function, when called, only results in an error "Wrong type
> argument: stringp" (tested in `emacs -Q')

> Wrong type argument: stringp, (193 . 215)

I think you use it wrong: the keys are not strings but cons cells.  So
the predicate function should be something like
`compare-buffer-substrings'.

I guess it would be better to specify a STARTKEYFUN to return a value to
be used as the key.

Michael.





reply via email to

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