[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sort-regexp-fields and no matching fields
From: |
Karl Berry |
Subject: |
sort-regexp-fields and no matching fields |
Date: |
Wed, 8 Jan 2003 20:39:30 -0500 |
Emacs 21.2. I had a function that did:
(sort-regexp-fields nil "^.*>\\([^<]*\\)</a.*$" "\\1" start (point))
(sorting on values of html links, not that it matters),
and there happened to be no matching lines. The result was that
sort-regexp-fields threw an error:
Search failed: "^.*>\\([^<]\\)</a.*$"
instead of silently returning, since there's nothing to sort (as it does
in other such cases).
The fix is simple:
*** /usr/local/gnu/src/emacs-21.2/lisp/ORIG/sort.el Sun Jul 15 09:15:34 2001
--- /usr/local/gnu/src/emacs-21.2/lisp/sort.el Wed Jan 8 16:53:23 2003
***************
*** 433,439 ****
(goto-char (point-min))
(let (sort-regexp-record-end
(sort-regexp-fields-regexp record-regexp))
! (re-search-forward sort-regexp-fields-regexp)
(setq sort-regexp-record-end (point))
(goto-char (match-beginning 0))
(sort-subr reverse
--- 433,439 ----
(goto-char (point-min))
(let (sort-regexp-record-end
(sort-regexp-fields-regexp record-regexp))
! (re-search-forward sort-regexp-fields-regexp (point-max) t)
(setq sort-regexp-record-end (point))
(goto-char (match-beginning 0))
(sort-subr reverse
Thanks,
karl
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sort-regexp-fields and no matching fields,
Karl Berry <=