GNU bug report logs -
#41706
26.1; sort-subr predicate cannot be set successfully
Previous Next
Full log
View this message in rfc822 format
Marvin Gülker <post+ebugs <at> 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.
This bug report was last modified 5 years and 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.