diff options
| author | Stefan Monnier | 2009-09-25 17:57:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-09-25 17:57:09 +0000 |
| commit | 8390fb808bbbef1fe085b4ef3075454d495249ec (patch) | |
| tree | 6fedd1b49a0d133cf06a7d8caa655955467c3fca | |
| parent | 4ff670a8b8c0c34e021106cd005a7815b4e98ce3 (diff) | |
| download | emacs-8390fb808bbbef1fe085b4ef3075454d495249ec.tar.gz emacs-8390fb808bbbef1fe085b4ef3075454d495249ec.zip | |
(log-edit-changelog-entries): Avoid inf-loops.
Try and avoid copying twice the same paragraph.
(log-edit-changelog-paragraph, log-edit-changelog-subparagraph):
Remove save-excursion.
(log-edit-changelog-entry): Do it here instead.
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/log-edit.el | 45 |
2 files changed, 36 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5c248e94cd2..6b064509986 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-09-25 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * log-edit.el (log-edit-changelog-entries): Avoid inf-loops. | ||
| 4 | Try and avoid copying twice the same paragraph. | ||
| 5 | (log-edit-changelog-paragraph, log-edit-changelog-subparagraph): | ||
| 6 | Remove save-excursion. | ||
| 7 | (log-edit-changelog-entry): Do it here instead. | ||
| 8 | |||
| 1 | 2009-09-25 Juanma Barranquero <lekktu@gmail.com> | 9 | 2009-09-25 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 10 | ||
| 3 | * bs.el (bs--get-file-name): Use `list-buffers-directory' | 11 | * bs.el (bs--get-file-name): Use `list-buffers-directory' |
| @@ -16,8 +24,8 @@ | |||
| 16 | 24 | ||
| 17 | 2009-09-25 Devon Sean McCullough <emacs-hacker@Jovi.Net> | 25 | 2009-09-25 Devon Sean McCullough <emacs-hacker@Jovi.Net> |
| 18 | 26 | ||
| 19 | * comint.el (comint-exec, comint-run, make-comint): Doc | 27 | * comint.el (comint-exec, comint-run, make-comint): |
| 20 | fixes (Bug#4542). | 28 | Doc fixes (Bug#4542). |
| 21 | 29 | ||
| 22 | 2009-09-25 Glenn Morris <rgm@gnu.org> | 30 | 2009-09-25 Glenn Morris <rgm@gnu.org> |
| 23 | 31 | ||
| @@ -58,8 +66,7 @@ | |||
| 58 | * textmodes/sgml-mode.el: Remove xml-mode alias. | 66 | * textmodes/sgml-mode.el: Remove xml-mode alias. |
| 59 | 67 | ||
| 60 | * files.el (auto-mode-alist, conf-mode-maybe) | 68 | * files.el (auto-mode-alist, conf-mode-maybe) |
| 61 | (magic-fallback-mode-alist): Revert 2009-09-18 and 2009-09-21 | 69 | (magic-fallback-mode-alist): Revert 2009-09-18 and 2009-09-21 changes. |
| 62 | changes. | ||
| 63 | 70 | ||
| 64 | 2009-09-24 Alan Mackenzie <acm@muc.de> | 71 | 2009-09-24 Alan Mackenzie <acm@muc.de> |
| 65 | 72 | ||
diff --git a/lisp/log-edit.el b/lisp/log-edit.el index a9816ea6649..f648d1f1fb4 100644 --- a/lisp/log-edit.el +++ b/lisp/log-edit.el | |||
| @@ -560,23 +560,21 @@ A \"page\" in a ChangeLog file is the area between two dates." | |||
| 560 | (defun log-edit-changelog-paragraph () | 560 | (defun log-edit-changelog-paragraph () |
| 561 | "Return the bounds of the ChangeLog paragraph containing point. | 561 | "Return the bounds of the ChangeLog paragraph containing point. |
| 562 | If we are between paragraphs, return the previous paragraph." | 562 | If we are between paragraphs, return the previous paragraph." |
| 563 | (save-excursion | 563 | (beginning-of-line) |
| 564 | (beginning-of-line) | 564 | (if (looking-at "^[ \t]*$") |
| 565 | (if (looking-at "^[ \t]*$") | 565 | (skip-chars-backward " \t\n" (point-min))) |
| 566 | (skip-chars-backward " \t\n" (point-min))) | 566 | (list (progn |
| 567 | (list (progn | 567 | (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit) |
| 568 | (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit) | 568 | (goto-char (match-end 0))) |
| 569 | (goto-char (match-end 0))) | 569 | (point)) |
| 570 | (point)) | 570 | (if (re-search-forward "^[ \t\n]*$" nil t) |
| 571 | (if (re-search-forward "^[ \t\n]*$" nil t) | 571 | (match-beginning 0) |
| 572 | (match-beginning 0) | 572 | (point-max)))) |
| 573 | (point-max))))) | ||
| 574 | 573 | ||
| 575 | (defun log-edit-changelog-subparagraph () | 574 | (defun log-edit-changelog-subparagraph () |
| 576 | "Return the bounds of the ChangeLog subparagraph containing point. | 575 | "Return the bounds of the ChangeLog subparagraph containing point. |
| 577 | A subparagraph is a block of non-blank lines beginning with an asterisk. | 576 | A subparagraph is a block of non-blank lines beginning with an asterisk. |
| 578 | If we are between sub-paragraphs, return the previous subparagraph." | 577 | If we are between sub-paragraphs, return the previous subparagraph." |
| 579 | (save-excursion | ||
| 580 | (end-of-line) | 578 | (end-of-line) |
| 581 | (if (search-backward "*" nil t) | 579 | (if (search-backward "*" nil t) |
| 582 | (list (progn (beginning-of-line) (point)) | 580 | (list (progn (beginning-of-line) (point)) |
| @@ -585,16 +583,17 @@ If we are between sub-paragraphs, return the previous subparagraph." | |||
| 585 | (if (re-search-forward "^[ \t]*[\n*]" nil t) | 583 | (if (re-search-forward "^[ \t]*[\n*]" nil t) |
| 586 | (match-beginning 0) | 584 | (match-beginning 0) |
| 587 | (point-max)))) | 585 | (point-max)))) |
| 588 | (list (point) (point))))) | 586 | (list (point) (point)))) |
| 589 | 587 | ||
| 590 | (defun log-edit-changelog-entry () | 588 | (defun log-edit-changelog-entry () |
| 591 | "Return the bounds of the ChangeLog entry containing point. | 589 | "Return the bounds of the ChangeLog entry containing point. |
| 592 | The variable `log-edit-changelog-full-paragraphs' decides whether an | 590 | The variable `log-edit-changelog-full-paragraphs' decides whether an |
| 593 | \"entry\" is a paragraph or a subparagraph; see its documentation string | 591 | \"entry\" is a paragraph or a subparagraph; see its documentation string |
| 594 | for more details." | 592 | for more details." |
| 595 | (if log-edit-changelog-full-paragraphs | 593 | (save-excursion |
| 596 | (log-edit-changelog-paragraph) | 594 | (if log-edit-changelog-full-paragraphs |
| 597 | (log-edit-changelog-subparagraph))) | 595 | (log-edit-changelog-paragraph) |
| 596 | (log-edit-changelog-subparagraph)))) | ||
| 598 | 597 | ||
| 599 | (defvar user-full-name) | 598 | (defvar user-full-name) |
| 600 | (defvar user-mail-address) | 599 | (defvar user-mail-address) |
| @@ -663,11 +662,17 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each | |||
| 663 | pattern | 662 | pattern |
| 664 | "\\($\\|[^[:alnum:]]\\)")) | 663 | "\\($\\|[^[:alnum:]]\\)")) |
| 665 | 664 | ||
| 666 | (let (texts) | 665 | (let (texts |
| 667 | (while (re-search-forward pattern nil t) | 666 | (pos (point))) |
| 667 | (while (and (not (eobp)) (re-search-forward pattern nil t)) | ||
| 668 | (let ((entry (log-edit-changelog-entry))) | 668 | (let ((entry (log-edit-changelog-entry))) |
| 669 | (push entry texts) | 669 | (if (< (elt entry 1) (max (1+ pos) (point))) |
| 670 | (goto-char (elt entry 1)))) | 670 | ;; This is not relevant, actually. |
| 671 | nil | ||
| 672 | (push entry texts)) | ||
| 673 | ;; Make sure we make progress. | ||
| 674 | (setq pos (max (1+ pos) (elt entry 1))) | ||
| 675 | (goto-char pos))) | ||
| 671 | 676 | ||
| 672 | (cons (current-buffer) texts)))))))) | 677 | (cons (current-buffer) texts)))))))) |
| 673 | 678 | ||