diff options
| author | Daniel Colascione | 2014-01-05 23:33:06 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2014-01-05 23:33:06 -0800 |
| commit | bf6a77f31c3c5618cd37cb7c70b6e9a29df9bce2 (patch) | |
| tree | b40419d41cf834a3f8d003f281f150ef494dc772 | |
| parent | d5081c1ed8e0dd509007b7a617d2640686e91f75 (diff) | |
| download | emacs-bf6a77f31c3c5618cd37cb7c70b6e9a29df9bce2.tar.gz emacs-bf6a77f31c3c5618cd37cb7c70b6e9a29df9bce2.zip | |
Fix defun navigation in vc log view.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/vc/log-view.el | 45 |
2 files changed, 47 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 41e267efe1d..93e22172af2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2014-01-06 Daniel Colascione <dancol@dancol.org> | ||
| 2 | |||
| 3 | Fix defun navigation in vc log view. | ||
| 4 | |||
| 5 | * vc/log-view.el (log-view-beginning-of-defun): Rewrite to behave | ||
| 6 | like `beginning-of-defun'. | ||
| 7 | (log-view-end-of-defun,log-view-end-of-defun-1): Rename old | ||
| 8 | log-view-end-of-defun to log-view-end-of-defun-1. Replace | ||
| 9 | log-view-end-of-defun with wrapper that behaves like | ||
| 10 | `end-of-defun'. | ||
| 11 | (log-view-extract-comment): Call `log-view-current-entry' directly | ||
| 12 | instead of relying on broken `log-view-beginning-of-defun' | ||
| 13 | behavior. | ||
| 14 | |||
| 1 | 2014-01-06 Paul Eggert <eggert@cs.ucla.edu> | 15 | 2014-01-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 16 | ||
| 3 | Spelling fixes. | 17 | Spelling fixes. |
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el index 3006081fb55..bacf96c4677 100644 --- a/lisp/vc/log-view.el +++ b/lisp/vc/log-view.el | |||
| @@ -429,18 +429,28 @@ to the beginning of the ARGth following entry. | |||
| 429 | This is Log View mode's default `beginning-of-defun-function'. | 429 | This is Log View mode's default `beginning-of-defun-function'. |
| 430 | It assumes that a log entry starts with a line matching | 430 | It assumes that a log entry starts with a line matching |
| 431 | `log-view-message-re'." | 431 | `log-view-message-re'." |
| 432 | (if (or (null arg) (zerop arg)) | 432 | (when (null arg) (setf arg 1)) |
| 433 | (setq arg 1)) | ||
| 434 | (if (< arg 0) | 433 | (if (< arg 0) |
| 435 | (dotimes (_n (- arg)) | 434 | (log-view-end-of-defun (- arg)) |
| 436 | (log-view-end-of-defun)) | 435 | (let ((found t)) |
| 437 | (catch 'beginning-of-buffer | 436 | (while (> arg 0) |
| 438 | (dotimes (_n arg) | 437 | (setf arg (1- arg)) |
| 439 | (or (log-view-current-entry nil t) | 438 | (let ((cur-start (log-view-current-entry))) |
| 440 | (throw 'beginning-of-buffer nil))) | 439 | (setf found |
| 441 | (point)))) | 440 | (cond ((null cur-start) |
| 442 | 441 | (goto-char (point-min)) | |
| 443 | (defun log-view-end-of-defun () | 442 | nil) |
| 443 | ((>= (car cur-start) (point)) | ||
| 444 | (unless (bobp) | ||
| 445 | (forward-line -1) | ||
| 446 | (setf arg (1+ arg))) | ||
| 447 | nil) | ||
| 448 | (t | ||
| 449 | (goto-char (car cur-start)) | ||
| 450 | t))))) | ||
| 451 | found))) | ||
| 452 | |||
| 453 | (defun log-view-end-of-defun-1 () | ||
| 444 | "Move forward to the next Log View entry." | 454 | "Move forward to the next Log View entry." |
| 445 | (let ((looping t)) | 455 | (let ((looping t)) |
| 446 | (if (looking-at log-view-message-re) | 456 | (if (looking-at log-view-message-re) |
| @@ -457,6 +467,16 @@ It assumes that a log entry starts with a line matching | |||
| 457 | (setq looping nil) | 467 | (setq looping nil) |
| 458 | (forward-line -1)))))) | 468 | (forward-line -1)))))) |
| 459 | 469 | ||
| 470 | (defun log-view-end-of-defun (&optional arg) | ||
| 471 | "Move forward to the next Log View entry. | ||
| 472 | Works like `end-of-defun'." | ||
| 473 | (when (null arg) (setf arg 1)) | ||
| 474 | (if (< arg 0) | ||
| 475 | (log-view-beginning-of-defun (- arg)) | ||
| 476 | (dotimes (_n arg) | ||
| 477 | (log-view-end-of-defun-1) | ||
| 478 | t))) | ||
| 479 | |||
| 460 | (defvar cvs-minor-current-files) | 480 | (defvar cvs-minor-current-files) |
| 461 | (defvar cvs-branch-prefix) | 481 | (defvar cvs-branch-prefix) |
| 462 | (defvar cvs-secondary-branch-prefix) | 482 | (defvar cvs-secondary-branch-prefix) |
| @@ -511,7 +531,8 @@ If called interactively, visit the version at point." | |||
| 511 | (cond ((eq backend 'SVN) | 531 | (cond ((eq backend 'SVN) |
| 512 | (forward-line -1))) | 532 | (forward-line -1))) |
| 513 | (setq en (point)) | 533 | (setq en (point)) |
| 514 | (log-view-beginning-of-defun) | 534 | (or (log-view-current-entry nil t) |
| 535 | (throw 'beginning-of-buffer nil)) | ||
| 515 | (cond ((memq backend '(SCCS RCS CVS MCVS SVN)) | 536 | (cond ((memq backend '(SCCS RCS CVS MCVS SVN)) |
| 516 | (forward-line 2)) | 537 | (forward-line 2)) |
| 517 | ((eq backend 'Hg) | 538 | ((eq backend 'Hg) |