From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#11640: 24.1.50; texinfo-format-printindex fails on Windows with Windows's sort Date: Thu, 7 Jun 2012 20:47:57 +0200 Message-ID: References: <20120606165632.760632C803A@msa105.auone-net.jp> <831ulrw0od.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1339095011 5391 80.91.229.3 (7 Jun 2012 18:50:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Jun 2012 18:50:11 +0000 (UTC) Cc: 11640@debbugs.gnu.org, kzhr@d1.dion.ne.jp, schwab@linux-m68k.org, Chong Yidong To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 07 20:50:07 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SchmO-0005fg-Uq for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Jun 2012 20:49:57 +0200 Original-Received: from localhost ([::1]:42019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SchmO-0002dk-Ra for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Jun 2012 14:49:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SchmH-0002N7-Kz for bug-gnu-emacs@gnu.org; Thu, 07 Jun 2012 14:49:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SchmG-0004Qx-07 for bug-gnu-emacs@gnu.org; Thu, 07 Jun 2012 14:49:49 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SchmF-0004Qs-QK for bug-gnu-emacs@gnu.org; Thu, 07 Jun 2012 14:49:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SchoQ-0007bR-Fc for bug-gnu-emacs@gnu.org; Thu, 07 Jun 2012 14:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Jun 2012 18:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11640 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11640-submit@debbugs.gnu.org id=B11640.133909507929169 (code B ref 11640); Thu, 07 Jun 2012 18:52:02 +0000 Original-Received: (at 11640) by debbugs.gnu.org; 7 Jun 2012 18:51:19 +0000 Original-Received: from localhost ([127.0.0.1]:33857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Schnj-0007aP-7M for submit@debbugs.gnu.org; Thu, 07 Jun 2012 14:51:19 -0400 Original-Received: from mail-pb0-f44.google.com ([209.85.160.44]:37372) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SchnP-0007ZN-EJ for 11640@debbugs.gnu.org; Thu, 07 Jun 2012 14:51:18 -0400 Original-Received: by pbcwy7 with SMTP id wy7so1364586pbc.3 for <11640@debbugs.gnu.org>; Thu, 07 Jun 2012 11:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=Z/prupkpNZfY9CH3E/Uxd/81Ei2+ZAT92oWX7xaSXTo=; b=ZdMHM/nLVvwNuajJThFOxG7z51WMlBOLyZaey2mqP/AxxBlel9tUgQPNfns6DBeHWf OwoQBpowZS6r3j0ndNecb1eZ9NkMdUA9LNeAUwetuF1rUZCLookDE9kHQ/qu8Bd3XDks uelfxymyNFpMMbNtsqUFIl7EJE96CnFKoPE5VqTQZJj3+WXNLlyJMol2ZiLEAV12WgZ0 WfEq0esqm/BP9Y1xWzzb5qAfeaZQGKRNYvH+Crg+AO7ZnmSJtg1koK0EEpjvS67U7gRp lB1UwQ1PBML8AFrDjeNcLmGsDC3pHOvhPcVslOr8LM3bRWRm4h1BP2cOfsiFepfZF8M7 5JUg== Original-Received: by 10.68.202.99 with SMTP id kh3mr10762240pbc.157.1339094917945; Thu, 07 Jun 2012 11:48:37 -0700 (PDT) Original-Received: by 10.142.164.7 with HTTP; Thu, 7 Jun 2012 11:47:57 -0700 (PDT) In-Reply-To: <831ulrw0od.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60770 Archived-At: On Thu, Jun 7, 2012 at 6:23 PM, Eli Zaretskii wrote: > Seriously, I find it hard to believe that performance matters in this > case, especially since texinfmt.el is no longer the main recommended > way of producing Info from Texinfo, which is why it doesn't get > updated with the latest features of the Texinfo language. I'm perfectly willing to believe you. As I said, I don't know why was it done otherwise. > Stefan, Chong, any objections to sorting the indices in Lisp in this > case? The patch is even simpler. 2012-06-07 Juanma Barranquero * textmodes/texinfmt.el: Use internal sort (partial revert of revno:89810)= . (texinfo-sort-region, texinfo-sort-startkeyfun): Restore functions. (texinfo-format-printindex): Use `texinfo-sort-region' instead of calling external sort utility. =3D=3D=3D modified file 'lisp/textmodes/texinfmt.el' --- lisp/textmodes/texinfmt.el 2012-04-09 13:05:48 +0000 +++ lisp/textmodes/texinfmt.el 2012-06-07 18:38:56 +0000 @@ -2958,6 +2958,28 @@ ("ky" . texinfo-format-kindex))) =0C +;;; Sort and index + +;; Sort an index which is in the current buffer between START and END. +(defun texinfo-sort-region (start end) + (require 'sort) + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (sort-subr nil 'forward-line 'end-of-line 'texinfo-sort-startkeyfun))) + +;; Subroutine for sorting an index. +;; At start of a line, return a string to sort the line under. +(defun texinfo-sort-startkeyfun () + (let ((line (buffer-substring-no-properties (point) (line-end-position))= )) + ;; Canonicalize whitespace and eliminate funny chars. + (while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line) + (setq line (concat (substring line 0 (match-beginning 0)) + " " + (substring line (match-end 0))))) + line)) + +=0C ;;; @printindex (put 'printindex 'texinfo-format 'texinfo-format-printindex) @@ -2974,7 +2996,7 @@ (insert "\n* Menu:\n\n") (setq opoint (point)) (texinfo-print-index nil indexelts) - (shell-command-on-region opoint (point) "sort -fd" 1))) + (texinfo-sort-region opoint (point)))) (defun texinfo-print-index (file indexelts) (while indexelts