diff options
| -rw-r--r-- | lisp/ChangeLog | 70 | ||||
| -rw-r--r-- | lisp/smerge-mode.el | 112 |
2 files changed, 129 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2b0d53b511c..04dc5f66cf9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2005-08-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * smerge-mode.el (smerge-basic-map): Bind smerge-combine-with-next. | ||
| 4 | (smerge-auto-leave): Make undo re-enable the mode. | ||
| 5 | (debug-ignored-errors): Add the user-error of impossible resolution. | ||
| 6 | (smerge-resolve): Move things around a bit, in preparation for later. | ||
| 7 | (smerge-diff): Don't fail if the buffer has no associated file. | ||
| 8 | (ediff-ancestor-buffer, ediff-quit-hook): Quieten byte-compiler. | ||
| 9 | (smerge-conflict-overlay): New function. | ||
| 10 | (smerge-match-conflict): Don't add text properties here. | ||
| 11 | (smerge-find-conflict): Instead, add an overlay here. | ||
| 12 | Also check for the case where we're inside a conflict already, so as to | ||
| 13 | obviate the need for font-lock-multiline, which is unbearably slow with | ||
| 14 | large conflicts and ciomplex font-lock patterns. | ||
| 15 | (smerge-remove-props): Remove overlay rather than text-properties. | ||
| 16 | (smerge-mode): Don't set font-lock-multiline. | ||
| 17 | Remove overlays when turned off. | ||
| 18 | |||
| 1 | 2005-08-21 Kim F. Storm <storm@cua.dk> | 19 | 2005-08-21 Kim F. Storm <storm@cua.dk> |
| 2 | 20 | ||
| 3 | * ido.el (ido-ignore-item-p): Use save-match-data. | 21 | * ido.el (ido-ignore-item-p): Use save-match-data. |
| @@ -123,7 +141,7 @@ | |||
| 123 | (tree-widget-image-properties): Look up in the default theme too. | 141 | (tree-widget-image-properties): Look up in the default theme too. |
| 124 | (tree-widget--cursors): Only for images with arrow pointer shape. | 142 | (tree-widget--cursors): Only for images with arrow pointer shape. |
| 125 | (tree-widget-lookup-image): Pointer shape is hand by default. | 143 | (tree-widget-lookup-image): Pointer shape is hand by default. |
| 126 | (tree-widget-icon): Generic icon widget renamed from | 144 | (tree-widget-icon): Rename generic icon widget from |
| 127 | `tree-widget-control'. | 145 | `tree-widget-control'. |
| 128 | (tree-widget-*-icon): Rename from `tree-widget-*-control' and | 146 | (tree-widget-*-icon): Rename from `tree-widget-*-control' and |
| 129 | derive from `tree-widget-icon'. | 147 | derive from `tree-widget-icon'. |
| @@ -147,8 +165,8 @@ | |||
| 147 | 165 | ||
| 148 | 2005-08-15 Richard M. Stallman <rms@gnu.org> | 166 | 2005-08-15 Richard M. Stallman <rms@gnu.org> |
| 149 | 167 | ||
| 150 | * textmodes/flyspell.el (flyspell-large-region): Fix doc and custom type. | 168 | * textmodes/flyspell.el (flyspell-mark-duplications-flag): Doc fix. |
| 151 | (flyspell-mark-duplications-flag): Doc fix. | 169 | (flyspell-large-region): Fix doc and custom type. |
| 152 | 170 | ||
| 153 | 2005-08-14 Richard M. Stallman <rms@gnu.org> | 171 | 2005-08-14 Richard M. Stallman <rms@gnu.org> |
| 154 | 172 | ||
| @@ -158,11 +176,11 @@ | |||
| 158 | (rmail-clear-headers): Use it. | 176 | (rmail-clear-headers): Use it. |
| 159 | (rmail-reply): Better handling of mail-followup-to header. | 177 | (rmail-reply): Better handling of mail-followup-to header. |
| 160 | 178 | ||
| 161 | * progmodes/sh-script.el (sh-font-lock-keywords-var): Variable | 179 | * progmodes/sh-script.el (sh-font-lock-keywords-var): |
| 162 | renamed from sh-font-lock-keywords. In the `shell' entry, don't | 180 | Rename variable from sh-font-lock-keywords. In the `shell' entry, |
| 163 | try to refer to executable-font-lock-keywords. | 181 | don't try to refer to executable-font-lock-keywords. |
| 164 | (sh-font-lock-keywords-var-1): Renamed from sh-font-lock-keywords-1. | 182 | (sh-font-lock-keywords-var-1): Rename from sh-font-lock-keywords-1. |
| 165 | (sh-font-lock-keywords-var-2): Renamed from sh-font-lock-keywords-2. | 183 | (sh-font-lock-keywords-var-2): Rename from sh-font-lock-keywords-2. |
| 166 | (sh-font-lock-keywords): Append executable-font-lock-keywords here. | 184 | (sh-font-lock-keywords): Append executable-font-lock-keywords here. |
| 167 | (sh-mode): Set comment-start-skip, local-abbrev-table, | 185 | (sh-mode): Set comment-start-skip, local-abbrev-table, |
| 168 | imenu-case-fold-search. | 186 | imenu-case-fold-search. |
| @@ -178,8 +196,7 @@ | |||
| 178 | 196 | ||
| 179 | 2005-08-15 Andreas Schwab <schwab@suse.de> | 197 | 2005-08-15 Andreas Schwab <schwab@suse.de> |
| 180 | 198 | ||
| 181 | * desktop.el: Put autoload cookie at risky-local-variable | 199 | * desktop.el: Put autoload cookie at risky-local-variable declarations. |
| 182 | declarations. | ||
| 183 | 200 | ||
| 184 | * dired.el, info.el, mail/rmail.el: Revert last change. | 201 | * dired.el, info.el, mail/rmail.el: Revert last change. |
| 185 | 202 | ||
| @@ -217,8 +234,8 @@ | |||
| 217 | 234 | ||
| 218 | 2005-08-12 Eli Zaretskii <eliz@gnu.org> | 235 | 2005-08-12 Eli Zaretskii <eliz@gnu.org> |
| 219 | 236 | ||
| 220 | * cus-edit.el (custom-save-all, custom-save-delete): Bind | 237 | * cus-edit.el (custom-save-all, custom-save-delete): |
| 221 | recentf-exclude to exclude custom-file. | 238 | Bind recentf-exclude to exclude custom-file. |
| 222 | 239 | ||
| 223 | 2005-08-12 Ehud Karni <ehud@unix.mvs.co.il> | 240 | 2005-08-12 Ehud Karni <ehud@unix.mvs.co.il> |
| 224 | 241 | ||
| @@ -227,17 +244,17 @@ | |||
| 227 | `rmail-summary-mode-map' with key "/". | 244 | `rmail-summary-mode-map' with key "/". |
| 228 | (rmail-summary-show-message): New (internal) function for use by | 245 | (rmail-summary-show-message): New (internal) function for use by |
| 229 | both `rmail-summary-beginning/end-of-message'. | 246 | both `rmail-summary-beginning/end-of-message'. |
| 230 | (rmail-summary-beginning-of-message): Changed to use | 247 | (rmail-summary-beginning-of-message): Change to use |
| 231 | rmail-summary-show-message. | 248 | rmail-summary-show-message. |
| 232 | 249 | ||
| 233 | * mail/rmail.el (rmail-end-of-message): New command to go to the | 250 | * mail/rmail.el (rmail-end-of-message): New command to go to the |
| 234 | end of the current message. Added to `rmail-mode-map' with key "/". | 251 | end of the current message. Added to `rmail-mode-map' with key "/". |
| 235 | (rmail-beginning-of-message): Fixed to work as documented. | 252 | (rmail-beginning-of-message): Fix to work as documented. |
| 236 | (rmail-mode): Change documentation. | 253 | (rmail-mode): Change documentation. |
| 237 | 254 | ||
| 238 | * progmodes/compile.el (compilation-start): Add the line | 255 | * progmodes/compile.el (compilation-start): Add the line |
| 239 | "Compilation started" with compilation start time. | 256 | "Compilation started" with compilation start time. |
| 240 | (compilation-mode-font-lock-keywords): Add `started' to keywords. | 257 | (compilation-mode-font-lock-keywords): Add `started' to keywords. |
| 241 | 258 | ||
| 242 | 2005-08-11 Luc Teirlinck <teirllm@auburn.edu> | 259 | 2005-08-11 Luc Teirlinck <teirllm@auburn.edu> |
| 243 | 260 | ||
| @@ -275,16 +292,16 @@ | |||
| 275 | 292 | ||
| 276 | * desktop.el (desktop-buffer-mode-handlers): | 293 | * desktop.el (desktop-buffer-mode-handlers): |
| 277 | Make non-customizable. Add autoload cookie. Change initial value to | 294 | Make non-customizable. Add autoload cookie. Change initial value to |
| 278 | nil; add elements in respective modules instead. Fix doc string. | 295 | nil; add elements in respective modules instead. Fix doc string. |
| 279 | (desktop-load-file): New function. | 296 | (desktop-load-file): New function. |
| 280 | (desktop-minor-mode-handlers): New autoloaded variable. | 297 | (desktop-minor-mode-handlers): New autoloaded variable. |
| 281 | (desktop-create-buffer): Call minor mode handlers. | 298 | (desktop-create-buffer): Call minor mode handlers. |
| 282 | Use desktop-load-file to load major and minor mode modules prior to | 299 | Use desktop-load-file to load major and minor mode modules prior to |
| 283 | checking for a handler. | 300 | checking for a handler. |
| 284 | (desktop-save): Don't add nil to desktop-minor-modes for minor | 301 | (desktop-save): Don't add nil to desktop-minor-modes for minor |
| 285 | modes with nil function in desktop-minor-mode-table. Don't delete | 302 | modes with nil function in desktop-minor-mode-table. Don't delete |
| 286 | desktop file before rewriting it. | 303 | desktop file before rewriting it. |
| 287 | (desktop-locals-to-save): Add autoload cookie. Don't make | 304 | (desktop-locals-to-save): Add autoload cookie. Don't make |
| 288 | automatically buffer-local. Add variables column-number-mode, | 305 | automatically buffer-local. Add variables column-number-mode, |
| 289 | size-indication-mode, indent-tabs-mode, | 306 | size-indication-mode, indent-tabs-mode, |
| 290 | indicate-buffer-boundaries, indicate-empty-lines and | 307 | indicate-buffer-boundaries, indicate-empty-lines and |
| @@ -344,15 +361,13 @@ | |||
| 344 | (compilation-info-text-face): Delete face variables. | 361 | (compilation-info-text-face): Delete face variables. |
| 345 | (compilation-text-face): Delete function. | 362 | (compilation-text-face): Delete function. |
| 346 | 363 | ||
| 347 | * progmodes/grep.el (grep-regexp-alist): Use `.+?' instead of | 364 | * progmodes/grep.el (grep-regexp-alist): Use `.+?' instead of `[^:\n]+'. |
| 348 | `[^:\n]+'. | ||
| 349 | (grep-mode-font-lock-keywords): Use `.+?' instead of `[^\n-]+'. | 365 | (grep-mode-font-lock-keywords): Use `.+?' instead of `[^\n-]+'. |
| 350 | (grep-error-face): Set to `compilation-error' instead of | 366 | (grep-error-face): Set to `compilation-error' instead of |
| 351 | `compilation-error-face' (which is redefined to `grep-hit-face' in | 367 | `compilation-error-face' (which is redefined to `grep-hit-face' in |
| 352 | grep buffers). | 368 | grep buffers). |
| 353 | (grep-mode-font-lock-keywords): Remove `-text' from face variable | 369 | (grep-mode-font-lock-keywords): Remove `-text' from face variable |
| 354 | names. Use `grep-error-face' instead of | 370 | names. Use `grep-error-face' instead of `compilation-error-text-face'. |
| 355 | `compilation-error-text-face'. | ||
| 356 | 371 | ||
| 357 | * dired-aux.el (dired-do-query-replace-regexp): | 372 | * dired-aux.el (dired-do-query-replace-regexp): |
| 358 | Use `query-replace-read-args'. | 373 | Use `query-replace-read-args'. |
| @@ -598,9 +613,9 @@ | |||
| 598 | 613 | ||
| 599 | 2005-08-06 Luc Teirlinck <teirllm@auburn.edu> | 614 | 2005-08-06 Luc Teirlinck <teirllm@auburn.edu> |
| 600 | 615 | ||
| 601 | * wid-edit.el (widget-choice-value-create): Unconditionally | 616 | * wid-edit.el (widget-choice-value-create): |
| 602 | respect user choice. Set :explicit-choice back to nil when no | 617 | Unconditionally respect user choice. Set :explicit-choice back to nil |
| 603 | longer needed. | 618 | when no longer needed. |
| 604 | (widget-choice-action): Unconditionally respect user choice. | 619 | (widget-choice-action): Unconditionally respect user choice. |
| 605 | Eliminate :explicit-choice-value. | 620 | Eliminate :explicit-choice-value. |
| 606 | 621 | ||
| @@ -779,6 +794,11 @@ | |||
| 779 | 794 | ||
| 780 | 2005-07-29 Stefan Monnier <monnier@iro.umontreal.ca> | 795 | 2005-07-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 781 | 796 | ||
| 797 | * simple.el (next-error-follow-minor-mode): | ||
| 798 | make-variable-buffer-local -> make-local-variable. | ||
| 799 | |||
| 800 | * emacs-lisp/cl-extra.el: Require CL also when compiling. | ||
| 801 | |||
| 782 | * emacs-lisp/bytecomp.el (byte-compile-make-variable-buffer-local) | 802 | * emacs-lisp/bytecomp.el (byte-compile-make-variable-buffer-local) |
| 783 | (byte-compile-form-make-variable-buffer-local): New functions to warn | 803 | (byte-compile-form-make-variable-buffer-local): New functions to warn |
| 784 | about misuses of make-variable-buffer-local where make-local-variable | 804 | about misuses of make-variable-buffer-local where make-local-variable |
diff --git a/lisp/smerge-mode.el b/lisp/smerge-mode.el index 6ffbdc50cf5..912f3289158 100644 --- a/lisp/smerge-mode.el +++ b/lisp/smerge-mode.el | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | (defvar smerge-mode) | 53 | (defvar smerge-mode) |
| 54 | 54 | ||
| 55 | (defgroup smerge () | 55 | (defgroup smerge () |
| 56 | "Minor mode to resolve diff3 conflicts." | 56 | "Minor mode to highlight and resolve diff3 conflicts." |
| 57 | :group 'tools | 57 | :group 'tools |
| 58 | :prefix "smerge-") | 58 | :prefix "smerge-") |
| 59 | 59 | ||
| @@ -69,13 +69,13 @@ | |||
| 69 | (defcustom smerge-diff-switches | 69 | (defcustom smerge-diff-switches |
| 70 | (append '("-d" "-b") | 70 | (append '("-d" "-b") |
| 71 | (if (listp diff-switches) diff-switches (list diff-switches))) | 71 | (if (listp diff-switches) diff-switches (list diff-switches))) |
| 72 | "*A list of strings specifying switches to be passed to diff. | 72 | "A list of strings specifying switches to be passed to diff. |
| 73 | Used in `smerge-diff-base-mine' and related functions." | 73 | Used in `smerge-diff-base-mine' and related functions." |
| 74 | :group 'smerge | 74 | :group 'smerge |
| 75 | :type '(repeat string)) | 75 | :type '(repeat string)) |
| 76 | 76 | ||
| 77 | (defcustom smerge-auto-leave t | 77 | (defcustom smerge-auto-leave t |
| 78 | "*Non-nil means to leave `smerge-mode' when the last conflict is resolved." | 78 | "Non-nil means to leave `smerge-mode' when the last conflict is resolved." |
| 79 | :group 'smerge | 79 | :group 'smerge |
| 80 | :type 'boolean) | 80 | :type 'boolean) |
| 81 | 81 | ||
| @@ -138,6 +138,7 @@ Used in `smerge-diff-base-mine' and related functions." | |||
| 138 | ("o" . smerge-keep-other) | 138 | ("o" . smerge-keep-other) |
| 139 | ("m" . smerge-keep-mine) | 139 | ("m" . smerge-keep-mine) |
| 140 | ("E" . smerge-ediff) | 140 | ("E" . smerge-ediff) |
| 141 | ("C" . smerge-combine-with-next) | ||
| 141 | ("\C-m" . smerge-keep-current) | 142 | ("\C-m" . smerge-keep-current) |
| 142 | ("=" . ,(make-sparse-keymap "Diff")) | 143 | ("=" . ,(make-sparse-keymap "Diff")) |
| 143 | ("=<" "base-mine" . smerge-diff-base-mine) | 144 | ("=<" "base-mine" . smerge-diff-base-mine) |
| @@ -257,6 +258,8 @@ Can be nil if the style is undecided, or else: | |||
| 257 | (when (and smerge-auto-leave | 258 | (when (and smerge-auto-leave |
| 258 | (save-excursion (goto-char (point-min)) | 259 | (save-excursion (goto-char (point-min)) |
| 259 | (not (re-search-forward smerge-begin-re nil t)))) | 260 | (not (re-search-forward smerge-begin-re nil t)))) |
| 261 | (when (and (listp buffer-undo-list) smerge-mode) | ||
| 262 | (push (list 'apply 'smerge-mode 1) buffer-undo-list)) | ||
| 260 | (smerge-mode -1))) | 263 | (smerge-mode -1))) |
| 261 | 264 | ||
| 262 | 265 | ||
| @@ -316,6 +319,7 @@ Can be nil if the style is undecided, or else: | |||
| 316 | "Mode-specific merge function. | 319 | "Mode-specific merge function. |
| 317 | The function is called with no argument and with the match data set | 320 | The function is called with no argument and with the match data set |
| 318 | according to `smerge-match-conflict'.") | 321 | according to `smerge-match-conflict'.") |
| 322 | (add-to-list 'debug-ignored-errors "Don't know how to resolve") | ||
| 319 | 323 | ||
| 320 | (defvar smerge-text-properties | 324 | (defvar smerge-text-properties |
| 321 | `(help-echo "merge conflict: mouse-3 shows a menu" | 325 | `(help-echo "merge conflict: mouse-3 shows a menu" |
| @@ -323,10 +327,7 @@ according to `smerge-match-conflict'.") | |||
| 323 | keymap (keymap (down-mouse-3 . smerge-popup-context-menu)))) | 327 | keymap (keymap (down-mouse-3 . smerge-popup-context-menu)))) |
| 324 | 328 | ||
| 325 | (defun smerge-remove-props (&optional beg end) | 329 | (defun smerge-remove-props (&optional beg end) |
| 326 | (remove-text-properties | 330 | (remove-overlays beg end 'smerge 'conflict)) |
| 327 | (or beg (match-beginning 0)) | ||
| 328 | (or end (match-end 0)) | ||
| 329 | smerge-text-properties)) | ||
| 330 | 331 | ||
| 331 | (defun smerge-popup-context-menu (event) | 332 | (defun smerge-popup-context-menu (event) |
| 332 | "Pop up the Smerge mode context menu under mouse." | 333 | "Pop up the Smerge mode context menu under mouse." |
| @@ -368,8 +369,16 @@ some major modes. Uses `smerge-resolve-function' to do the actual work." | |||
| 368 | ;; Trivial diff3 -A non-conflicts. | 369 | ;; Trivial diff3 -A non-conflicts. |
| 369 | ((and (eq (match-end 1) (match-end 3)) | 370 | ((and (eq (match-end 1) (match-end 3)) |
| 370 | (eq (match-beginning 1) (match-beginning 3))) | 371 | (eq (match-beginning 1) (match-beginning 3))) |
| 371 | ;; FIXME: Add "if [ diff -b MINE OTHER ]; then select OTHER; fi" | ||
| 372 | (smerge-keep-n 3)) | 372 | (smerge-keep-n 3)) |
| 373 | ;; Mode-specific conflict resolution. | ||
| 374 | ((condition-case nil | ||
| 375 | (atomic-change-group | ||
| 376 | (funcall smerge-resolve-function) | ||
| 377 | t) | ||
| 378 | (error nil)) | ||
| 379 | ;; Nothing to do: the resolution function has done it already. | ||
| 380 | nil) | ||
| 381 | ;; FIXME: Add "if [ diff -b MINE OTHER ]; then select OTHER; fi" | ||
| 373 | ((and (match-end 2) | 382 | ((and (match-end 2) |
| 374 | ;; FIXME: Add "diff -b BASE MINE | patch OTHER". | 383 | ;; FIXME: Add "diff -b BASE MINE | patch OTHER". |
| 375 | ;; FIXME: Add "diff -b BASE OTHER | patch MINE". | 384 | ;; FIXME: Add "diff -b BASE OTHER | patch MINE". |
| @@ -380,8 +389,7 @@ some major modes. Uses `smerge-resolve-function' to do the actual work." | |||
| 380 | nil) | 389 | nil) |
| 381 | ) | 390 | ) |
| 382 | (t | 391 | (t |
| 383 | ;; Mode-specific conflict resolution. | 392 | (error "Don't know how to resolve"))) |
| 384 | (funcall smerge-resolve-function))) | ||
| 385 | (smerge-auto-leave)) | 393 | (smerge-auto-leave)) |
| 386 | 394 | ||
| 387 | (defun smerge-keep-base () | 395 | (defun smerge-keep-base () |
| @@ -500,6 +508,10 @@ An error is raised if not inside a conflict." | |||
| 500 | (re-search-forward smerge-begin-re end t)) | 508 | (re-search-forward smerge-begin-re end t)) |
| 501 | ;; There's a nested conflict and we're after the the beginning | 509 | ;; There's a nested conflict and we're after the the beginning |
| 502 | ;; of the outer one but before the beginning of the inner one. | 510 | ;; of the outer one but before the beginning of the inner one. |
| 511 | ;; Of course, maybe this is not a nested conflict but in that | ||
| 512 | ;; case it can only be something nastier that we don't know how | ||
| 513 | ;; to handle, so may as well arbitrarily decide to treat it as | ||
| 514 | ;; a nested conflict. --Stef | ||
| 503 | (error "There is a nested conflict")) | 515 | (error "There is a nested conflict")) |
| 504 | 516 | ||
| 505 | ((re-search-backward smerge-base-re start t) | 517 | ((re-search-backward smerge-base-re start t) |
| @@ -524,13 +536,6 @@ An error is raised if not inside a conflict." | |||
| 524 | (setq mine-start other-start) | 536 | (setq mine-start other-start) |
| 525 | (setq mine-end other-end))) | 537 | (setq mine-end other-end))) |
| 526 | 538 | ||
| 527 | (let ((inhibit-read-only t) | ||
| 528 | (inhibit-modification-hooks t) | ||
| 529 | (m (buffer-modified-p))) | ||
| 530 | (unwind-protect | ||
| 531 | (add-text-properties start end smerge-text-properties) | ||
| 532 | (restore-buffer-modified-p m))) | ||
| 533 | |||
| 534 | (store-match-data (list start end | 539 | (store-match-data (list start end |
| 535 | mine-start mine-end | 540 | mine-start mine-end |
| 536 | base-start base-end | 541 | base-start base-end |
| @@ -540,17 +545,60 @@ An error is raised if not inside a conflict." | |||
| 540 | t) | 545 | t) |
| 541 | (search-failed (error "Point not in conflict region"))))) | 546 | (search-failed (error "Point not in conflict region"))))) |
| 542 | 547 | ||
| 548 | (defun smerge-conflict-overlay (pos) | ||
| 549 | "Return the conflict overlay at POS if any." | ||
| 550 | (let ((ols (overlays-at pos)) | ||
| 551 | conflict) | ||
| 552 | (dolist (ol ols) | ||
| 553 | (if (and (eq (overlay-get ol 'smerge) 'conflict) | ||
| 554 | (> (overlay-end ol) pos)) | ||
| 555 | (setq conflict ol))) | ||
| 556 | conflict)) | ||
| 557 | |||
| 543 | (defun smerge-find-conflict (&optional limit) | 558 | (defun smerge-find-conflict (&optional limit) |
| 544 | "Find and match a conflict region. Intended as a font-lock MATCHER. | 559 | "Find and match a conflict region. Intended as a font-lock MATCHER. |
| 545 | The submatches are the same as in `smerge-match-conflict'. | 560 | The submatches are the same as in `smerge-match-conflict'. |
| 546 | Returns non-nil if a match is found between the point and LIMIT. | 561 | Returns non-nil if a match is found between point and LIMIT. |
| 547 | The point is moved to the end of the conflict." | 562 | Point is moved to the end of the conflict." |
| 548 | (when (re-search-forward smerge-begin-re limit t) | 563 | (let ((found nil) |
| 549 | (condition-case err | 564 | (pos (point)) |
| 550 | (progn | 565 | conflict) |
| 551 | (smerge-match-conflict) | 566 | ;; First check to see if point is already inside a conflict, using |
| 552 | (goto-char (match-end 0))) | 567 | ;; the conflict overlays. |
| 553 | (error (smerge-find-conflict limit))))) | 568 | (while (and (not found) (setq conflict (smerge-conflict-overlay pos))) |
| 569 | ;; Check the overlay's validity and kill it if it's out of date. | ||
| 570 | (condition-case nil | ||
| 571 | (progn | ||
| 572 | (goto-char (overlay-start conflict)) | ||
| 573 | (smerge-match-conflict) | ||
| 574 | (goto-char (match-end 0)) | ||
| 575 | (if (<= (point) pos) | ||
| 576 | (error "Matching backward!") | ||
| 577 | (setq found t))) | ||
| 578 | (error (smerge-remove-props | ||
| 579 | (overlay-start conflict) (overlay-end conflict)) | ||
| 580 | (goto-char pos)))) | ||
| 581 | ;; If we're not already inside a conflict, look for the next conflict | ||
| 582 | ;; and add/update its overlay. | ||
| 583 | (while (and (not found) (re-search-forward smerge-begin-re limit t)) | ||
| 584 | (condition-case nil | ||
| 585 | (progn | ||
| 586 | (smerge-match-conflict) | ||
| 587 | (goto-char (match-end 0)) | ||
| 588 | (let ((conflict (smerge-conflict-overlay (1- (point))))) | ||
| 589 | (if conflict | ||
| 590 | ;; Update its location, just in case it got messed up. | ||
| 591 | (move-overlay conflict (match-beginning 0) (match-end 0)) | ||
| 592 | (setq conflict (make-overlay (match-beginning 0) (match-end 0) | ||
| 593 | nil 'front-advance nil)) | ||
| 594 | (overlay-put conflict 'evaporate t) | ||
| 595 | (overlay-put conflict 'smerge 'conflict) | ||
| 596 | (let ((props smerge-text-properties)) | ||
| 597 | (while props | ||
| 598 | (overlay-put conflict (pop props) (pop props)))))) | ||
| 599 | (setq found t)) | ||
| 600 | (error nil))) | ||
| 601 | found)) | ||
| 554 | 602 | ||
| 555 | (defun smerge-diff (n1 n2) | 603 | (defun smerge-diff (n1 n2) |
| 556 | (smerge-match-conflict) | 604 | (smerge-match-conflict) |
| @@ -566,7 +614,12 @@ The point is moved to the end of the conflict." | |||
| 566 | (file1 (make-temp-file "smerge1")) | 614 | (file1 (make-temp-file "smerge1")) |
| 567 | (file2 (make-temp-file "smerge2")) | 615 | (file2 (make-temp-file "smerge2")) |
| 568 | (dir default-directory) | 616 | (dir default-directory) |
| 569 | (file (file-relative-name buffer-file-name)) | 617 | (file (if buffer-file-name (file-relative-name buffer-file-name))) |
| 618 | ;; We would want to use `emacs-mule-unix' for read&write, but we | ||
| 619 | ;; bump into problems with the coding-system used by diff to write | ||
| 620 | ;; the file names and the time stamps in the header. | ||
| 621 | ;; `buffer-file-coding-system' is not always correct either, but if | ||
| 622 | ;; the OS/user uses only one coding-system, then it works. | ||
| 570 | (coding-system-for-read buffer-file-coding-system)) | 623 | (coding-system-for-read buffer-file-coding-system)) |
| 571 | (write-region beg1 end1 file1 nil 'nomessage) | 624 | (write-region beg1 end1 file1 nil 'nomessage) |
| 572 | (write-region beg2 end2 file2 nil 'nomessage) | 625 | (write-region beg2 end2 file2 nil 'nomessage) |
| @@ -594,6 +647,8 @@ The point is moved to the end of the conflict." | |||
| 594 | (defvar ediff-buffer-A) | 647 | (defvar ediff-buffer-A) |
| 595 | (defvar ediff-buffer-B) | 648 | (defvar ediff-buffer-B) |
| 596 | (defvar ediff-buffer-C) | 649 | (defvar ediff-buffer-C) |
| 650 | (defvar ediff-ancestor-buffer) | ||
| 651 | (defvar ediff-quit-hook) | ||
| 597 | 652 | ||
| 598 | ;;;###autoload | 653 | ;;;###autoload |
| 599 | (defun smerge-ediff (&optional name-mine name-other name-base) | 654 | (defun smerge-ediff (&optional name-mine name-other name-base) |
| @@ -687,7 +742,6 @@ buffer names." | |||
| 687 | \\{smerge-mode-map}" | 742 | \\{smerge-mode-map}" |
| 688 | :group 'smerge :lighter " SMerge" | 743 | :group 'smerge :lighter " SMerge" |
| 689 | (when (and (boundp 'font-lock-mode) font-lock-mode) | 744 | (when (and (boundp 'font-lock-mode) font-lock-mode) |
| 690 | (set (make-local-variable 'font-lock-multiline) t) | ||
| 691 | (save-excursion | 745 | (save-excursion |
| 692 | (if smerge-mode | 746 | (if smerge-mode |
| 693 | (font-lock-add-keywords nil smerge-font-lock-keywords 'append) | 747 | (font-lock-add-keywords nil smerge-font-lock-keywords 'append) |
| @@ -695,7 +749,9 @@ buffer names." | |||
| 695 | (goto-char (point-min)) | 749 | (goto-char (point-min)) |
| 696 | (while (smerge-find-conflict) | 750 | (while (smerge-find-conflict) |
| 697 | (save-excursion | 751 | (save-excursion |
| 698 | (font-lock-fontify-region (match-beginning 0) (match-end 0) nil)))))) | 752 | (font-lock-fontify-region (match-beginning 0) (match-end 0) nil))))) |
| 753 | (unless smerge-mode | ||
| 754 | (smerge-remove-props (point-min) (point-max)))) | ||
| 699 | 755 | ||
| 700 | 756 | ||
| 701 | (provide 'smerge-mode) | 757 | (provide 'smerge-mode) |