[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108524: lisp/textmodes/texinfmt.el:
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108524: lisp/textmodes/texinfmt.el: Fix bug#11640 (reverts part of revno:89810). |
Date: |
Fri, 08 Jun 2012 14:24:27 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108524
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Fri 2012-06-08 14:24:27 +0200
message:
lisp/textmodes/texinfmt.el: Fix bug#11640 (reverts part of revno:89810).
(texinfo-format-printindex): Use `texinfo-sort-region' in all platforms,
instead of calling external sort utility.
(texinfo-sort-region, texinfo-sort-startkeyfun): Restore functions.
modified:
lisp/ChangeLog
lisp/textmodes/texinfmt.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-06-08 08:44:45 +0000
+++ b/lisp/ChangeLog 2012-06-08 12:24:27 +0000
@@ -1,3 +1,10 @@
+2012-06-08 Juanma Barranquero <address@hidden>
+
+ * textmodes/texinfmt.el: Fix bug#11640 (reverts part of revno:89810).
+ (texinfo-format-printindex): Use `texinfo-sort-region' in all platforms,
+ instead of calling external sort utility.
+ (texinfo-sort-region, texinfo-sort-startkeyfun): Restore functions.
+
2012-06-08 Eli Zaretskii <address@hidden>
* descr-text.el (describe-char): Mention how to insert the
=== modified file 'lisp/textmodes/texinfmt.el'
--- a/lisp/textmodes/texinfmt.el 2012-04-09 13:05:48 +0000
+++ b/lisp/textmodes/texinfmt.el 2012-06-08 12:24:27 +0000
@@ -2958,6 +2958,28 @@
("ky" . texinfo-format-kindex)))
+;;; 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))
+
+
;;; @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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108524: lisp/textmodes/texinfmt.el: Fix bug#11640 (reverts part of revno:89810).,
Juanma Barranquero <=