# HG changeset patch # User Paul Eggert # Date 1295039577 28800 # Node ID ba9f26694b92a3c1ebd0001bbcb4ed391f248774 # Parent 17e0028efc29383e2094a4ecf2cc2fa82404a860# Parent 3b840e622de1976a903b6f747bd157f2acdc4777 Merge from mainline. diff -r 17e0028efc29 -r ba9f26694b92 ChangeLog --- a/ChangeLog Fri Jan 14 10:14:17 2011 -0800 +++ b/ChangeLog Fri Jan 14 13:12:57 2011 -0800 @@ -1,4 +1,4 @@ -2011-01-13 Paul Eggert +2011-01-14 Paul Eggert * Makefile.in (GNULIB_MODULES): Change ftoastr to dtoastr. This avoids building ftoastr and ldtoastr, which aren't needed. See @@ -69,8 +69,6 @@ Use gnulib's ftoastr module. * Makefile.in (GNULIB_MODULES): Add ftoastr. Remove dummy. -2011-01-08 Paul Eggert - Regenerate. * aclocal.m4, compile, depcomp, lib/Makefile.in, lib/dummy.c: * lib/gnulib.mk, m4/00gnulib.m4, m4/gnulib-cache.m4: @@ -106,6 +104,14 @@ * make-dist: Also put into the distribution aclocal.m4, compile, depcomp, missing, and the files under lib/. +2011-01-14 Paul Eggert + + * make-dist: Distribute test/ files too. + Distribute every file under test/ that is under version control, + using patterns like *.el to capture files that are added later. + Without this change, "configure" would fail, because it would + attempt to build from a Makefile.in that was not distributed. + 2011-01-13 Christian Ohler * Makefile.in (INFO_FILES): Add ERT. diff -r 17e0028efc29 -r ba9f26694b92 lisp/ChangeLog --- a/lisp/ChangeLog Fri Jan 14 10:14:17 2011 -0800 +++ b/lisp/ChangeLog Fri Jan 14 13:12:57 2011 -0800 @@ -1,3 +1,12 @@ +2011-01-14 Stefan Monnier + + * vc/smerge-mode.el: Resolve comment conflicts more aggressively. + (smerge-resolve--normalize-re): New var. + (smerge-resolve--extract-comment, smerge-resolve--normalize): New funs. + (smerge-resolve): Use them. + * newcomment.el (comment-only-p): New function. + (comment-or-uncomment-region): Use it. + 2011-01-14 Brent Goodrick (tiny change) * abbrev.el (prepare-abbrev-list-buffer): If listing local abbrev diff -r 17e0028efc29 -r ba9f26694b92 lisp/newcomment.el --- a/lisp/newcomment.el Fri Jan 14 10:14:17 2011 -0800 +++ b/lisp/newcomment.el Fri Jan 14 13:12:57 2011 -0800 @@ -1185,6 +1185,12 @@ 'box-multi 'box))) (comment-region beg end (+ comment-add arg)))) +(defun comment-only-p (beg end) + "Return non-nil if the text between BEG and END is all comments." + (save-excursion + (goto-char beg) + (comment-forward (point-max)) + (<= end (point)))) ;;;###autoload (defun comment-or-uncomment-region (beg end &optional arg) @@ -1193,10 +1199,7 @@ is passed on to the respective function." (interactive "*r\nP") (comment-normalize-vars) - (funcall (if (save-excursion ;; check for already commented region - (goto-char beg) - (comment-forward (point-max)) - (<= end (point))) + (funcall (if (comment-only-p beg end) 'uncomment-region 'comment-region) beg end arg)) diff -r 17e0028efc29 -r ba9f26694b92 lisp/vc/smerge-mode.el --- a/lisp/vc/smerge-mode.el Fri Jan 14 10:14:17 2011 -0800 +++ b/lisp/vc/smerge-mode.el Fri Jan 14 13:12:57 2011 -0800 @@ -46,7 +46,7 @@ (eval-when-compile (require 'cl)) (require 'diff-mode) ;For diff-auto-refine-mode. - +(require 'newcomment) ;;; The real definition comes later. (defvar smerge-mode) @@ -455,6 +455,37 @@ (insert ">>>>>>> " name3 "\n") (setq line endline)))))))) +(defconst smerge-resolve--normalize-re "[\n\t][ \t\n]*\\| [ \t\n]+") + +(defun smerge-resolve--extract-comment (beg end) + "Extract the text within the comments that span BEG..END." + (save-excursion + (let ((comments ()) + combeg) + (goto-char beg) + (while (and (< (point) end) + (setq combeg (comment-search-forward end t))) + (let ((beg (point))) + (goto-char combeg) + (comment-forward 1) + (save-excursion + (comment-enter-backward) + (push " " comments) + (push (buffer-substring-no-properties beg (point)) comments)))) + (push " " comments) + (with-temp-buffer + (apply #'insert (nreverse comments)) + (goto-char (point-min)) + (while (re-search-forward smerge-resolve--normalize-re + nil t) + (replace-match " ")) + (buffer-string))))) + +(defun smerge-resolve--normalize (beg end) + (replace-regexp-in-string + smerge-resolve--normalize-re " " + (concat " " (buffer-substring-no-properties beg end) " "))) + (defun smerge-resolve (&optional safe) "Resolve the conflict at point intelligently. This relies on mode-specific knowledge and thus only works in some @@ -472,7 +503,8 @@ (m2e (match-end 2)) (m3e (match-end 3)) (buf (generate-new-buffer " *smerge*")) - m b o) + m b o + choice) (unwind-protect (progn (cond @@ -557,6 +589,43 @@ (narrow-to-region m0b m0e) (smerge-remove-props m0b m0e) (insert-file-contents m nil nil nil t))) + ;; If the conflict is only made of comments, and one of the two + ;; changes is only rearranging spaces (e.g. reflowing text) while + ;; the other is a real change, drop the space-rearrangement. + ((and m2e + (comment-only-p m1b m1e) + (comment-only-p m2b m2e) + (comment-only-p m3b m3e) + (let ((t1 (smerge-resolve--extract-comment m1b m1e)) + (t2 (smerge-resolve--extract-comment m2b m2e)) + (t3 (smerge-resolve--extract-comment m3b m3e))) + (cond + ((and (equal t1 t2) (not (equal t2 t3))) + (setq choice 3)) + ((and (not (equal t1 t2)) (equal t2 t3)) + (setq choice 1))))) + (set-match-data md) + (smerge-keep-n choice)) + ;; Idem, when the conflict is contained within a single comment. + ((save-excursion + (and m2e + (nth 4 (syntax-ppss m0b)) + ;; If there's a conflict earlier in the file, + ;; syntax-ppss is not reliable. + (not (re-search-backward smerge-begin-re nil t)) + (progn (goto-char (nth 8 (syntax-ppss m0b))) + (forward-comment 1) + (> (point) m0e)) + (let ((t1 (smerge-resolve--normalize m1b m1e)) + (t2 (smerge-resolve--normalize m2b m2e)) + (t3 (smerge-resolve--normalize m3b m3e))) + (cond + ((and (equal t1 t2) (not (equal t2 t3))) + (setq choice 3)) + ((and (not (equal t1 t2)) (equal t2 t3)) + (setq choice 1)))))) + (set-match-data md) + (smerge-keep-n choice)) (t (error "Don't know how to resolve")))) (if (buffer-name buf) (kill-buffer buf)) diff -r 17e0028efc29 -r ba9f26694b92 make-dist --- a/make-dist Fri Jan 14 10:14:17 2011 -0800 +++ b/make-dist Fri Jan 14 13:12:57 2011 -0800 @@ -298,6 +298,7 @@ nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \ `find etc lisp -type d` \ doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \ + test test/automated test/cedet test/cedet/tests test/indent \ info m4 msdos \ nextstep nextstep/Cocoa nextstep/Cocoa/Emacs.base \ nextstep/Cocoa/Emacs.base/Contents \ @@ -483,6 +484,26 @@ ln ChangeLog* *.1 ../../${tempdir}/doc/man cd ../../${tempdir}/doc/man) +echo "Making links to \`test'" +(cd test + ln *.el ChangeLog README ../${tempdir}/test) + +echo "Making links to \`test/automated'" +(cd test/automated + ln *.el Makefile.in ../../${tempdir}/test/automated) + +echo "Making links to \`test/cedet'" +(cd test/cedet + ln *.el ../../${tempdir}/test/cedet) + +echo "Making links to \`test/cedet/tests'" +(cd test/cedet/tests + ln *.c *.[ch]pp *.el *.hh *.java *.make ../../../${tempdir}/test/cedet/tests) + +echo "Making links to \`test/indent'" +(cd test/indent + ln *.m *.mod *.prolog Makefile ../../${tempdir}/test/indent) + ### It would be nice if they could all be symlinks to top-level copy, but ### you're not supposed to have any symlinks in distribution tar files. echo "Making sure copying notices are all copies of \`COPYING'"