comparison lisp/smerge-mode.el @ 49597:e88404e8f2cf

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 12:29:42 +0000
parents 9d7b63dcf005
children 695cf19ef79e d7ddb3e565de
comparison
equal deleted inserted replaced
49596:b06535145619 49597:e88404e8f2cf
2 2
3 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4 4
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu> 5 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
6 ;; Keywords: merge diff3 cvs conflict 6 ;; Keywords: merge diff3 cvs conflict
7 ;; Revision: $Id: smerge-mode.el,v 1.19 2002/10/10 13:01:14 monnier Exp $ 7 ;; Revision: $Id: smerge-mode.el,v 1.20 2002/10/10 17:30:20 monnier Exp $
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
10 10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify 11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by 12 ;; it under the terms of the GNU General Public License as published by
201 (defun smerge-auto-leave () 201 (defun smerge-auto-leave ()
202 (when (and smerge-auto-leave 202 (when (and smerge-auto-leave
203 (save-excursion (goto-char (point-min)) 203 (save-excursion (goto-char (point-min))
204 (not (re-search-forward smerge-begin-re nil t)))) 204 (not (re-search-forward smerge-begin-re nil t))))
205 (smerge-mode -1))) 205 (smerge-mode -1)))
206 206
207 207
208 (defun smerge-keep-all () 208 (defun smerge-keep-all ()
209 "Keep all three versions. 209 "Keep all three versions.
210 Convenient for the kind of conflicts that can arise in ChangeLog files." 210 Convenient for the kind of conflicts that can arise in ChangeLog files."
211 (interactive) 211 (interactive)
335 (mine-start (match-end 0)) 335 (mine-start (match-end 0))
336 (filename (or (match-string 1) "")) 336 (filename (or (match-string 1) ""))
337 337
338 (_ (re-search-forward smerge-end-re)) 338 (_ (re-search-forward smerge-end-re))
339 (_ (assert (< orig-point (match-end 0)))) 339 (_ (assert (< orig-point (match-end 0))))
340 340
341 (other-end (match-beginning 0)) 341 (other-end (match-beginning 0))
342 (end (match-end 0)) 342 (end (match-end 0))
343 343
344 (_ (re-search-backward smerge-other-re start)) 344 (_ (re-search-backward smerge-other-re start))
345 345
368 ;; a same-diff conflict 368 ;; a same-diff conflict
369 (setq base-start mine-start) 369 (setq base-start mine-start)
370 (setq base-end mine-end) 370 (setq base-end mine-end)
371 (setq mine-start other-start) 371 (setq mine-start other-start)
372 (setq mine-end other-end))) 372 (setq mine-end other-end)))
373 373
374 (store-match-data (list start end 374 (store-match-data (list start end
375 mine-start mine-end 375 mine-start mine-end
376 base-start base-end 376 base-start base-end
377 other-start other-end 377 other-start other-end
378 (when base-start (1- base-start)) base-start 378 (when base-start (1- base-start)) base-start
467 (while (smerge-find-conflict) 467 (while (smerge-find-conflict)
468 (replace-match (match-string 3) t t)) 468 (replace-match (match-string 3) t t))
469 (buffer-enable-undo) 469 (buffer-enable-undo)
470 (set-buffer-modified-p nil) 470 (set-buffer-modified-p nil)
471 (funcall mode)) 471 (funcall mode))
472 472
473 (when base 473 (when base
474 (setq base (generate-new-buffer 474 (setq base (generate-new-buffer
475 (or name-base (concat "*" filename " BASE*")))) 475 (or name-base (concat "*" filename " BASE*"))))
476 (with-current-buffer base 476 (with-current-buffer base
477 (buffer-disable-undo) 477 (buffer-disable-undo)
480 (while (smerge-find-conflict) 480 (while (smerge-find-conflict)
481 (replace-match (or (match-string 2) "") t t)) 481 (replace-match (or (match-string 2) "") t t))
482 (buffer-enable-undo) 482 (buffer-enable-undo)
483 (set-buffer-modified-p nil) 483 (set-buffer-modified-p nil)
484 (funcall mode))) 484 (funcall mode)))
485 485
486 ;; the rest of the code is inspired from vc.el 486 ;; the rest of the code is inspired from vc.el
487 ;; Fire up ediff. 487 ;; Fire up ediff.
488 (set-buffer 488 (set-buffer
489 (if base 489 (if base
490 (ediff-merge-buffers-with-ancestor mine other base) 490 (ediff-merge-buffers-with-ancestor mine other base)
491 ;; nil 'ediff-merge-revisions-with-ancestor buffer-file-name) 491 ;; nil 'ediff-merge-revisions-with-ancestor buffer-file-name)
492 (ediff-merge-buffers mine other))) 492 (ediff-merge-buffers mine other)))
493 ;; nil 'ediff-merge-revisions buffer-file-name))) 493 ;; nil 'ediff-merge-revisions buffer-file-name)))
494 494
495 ;; Ediff is now set up, and we are in the control buffer. 495 ;; Ediff is now set up, and we are in the control buffer.
496 ;; Do a few further adjustments and take precautions for exit. 496 ;; Do a few further adjustments and take precautions for exit.
497 (set (make-local-variable 'smerge-ediff-windows) config) 497 (set (make-local-variable 'smerge-ediff-windows) config)
498 (set (make-local-variable 'smerge-ediff-buf) buf) 498 (set (make-local-variable 'smerge-ediff-buf) buf)
499 (set (make-local-variable 'ediff-quit-hook) 499 (set (make-local-variable 'ediff-quit-hook)