unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* rel-22 to trunk merge failures  2008-02-24
@ 2008-02-24 10:20 Miles Bader
  2008-02-24 15:48 ` Stefan Monnier
  2008-02-24 15:49 ` Jason Rumney
  0 siblings, 2 replies; 4+ messages in thread
From: Miles Bader @ 2008-02-24 10:20 UTC (permalink / raw)
  To: emacs-devel, jasonr, mituharu, monnier

[Remember, all changes below are _not_ in the trunk, and will not be
 merged later, so somebody needs to either make the appropriate change to
 the trunk (including the ChangeLog entry), or confirm that it isn't
 needed (e.g., the trunk already contains an equivalent change.
 Thanks,   -Miles]


M  src/w32term.c
M  src/macterm.c
M  lisp/diff-mode.el


2008-02-15  Jason Rumney  <jasonr@gnu.org>

	* w32term.c (x_draw_glyph_string_background): Clear the background
	manually when cleartype is in use.
	(x_draw_glyph_string_foreground): Draw text transparently when
	cleartype is in use.

2008-02-05  Jason Rumney  <jasonr@gnu.org>

	* w32term.c (w32_read_socket) <WM_CHAR>: Use locale-coding-system
	instead of using mule-unicode-* charsets directly.

--- orig/src/w32term.c
+++ mod/src/w32term.c
@@ -1519,6 +1519,7 @@
 	       || s->font_not_found_p
 	       || s->extends_to_end_of_line_p
                || s->font->bdf
+               || cleartype_active
 	       || force_p)
 	{
 	  x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
@@ -1547,7 +1548,8 @@
   else
     x = s->x;
 
-  if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
+  if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR)
+      || cleartype_active)
     SetBkMode (s->hdc, TRANSPARENT);
   else
     SetBkMode (s->hdc, OPAQUE);
@@ -4338,7 +4340,7 @@
                         }
                     }
 
-                  /* Now process unicode input as per xterm.c */
+                  /* Process unicode input for ASCII and ISO Control only. */
                   if (code < 0x80)
                     {
                       inev.kind = ASCII_KEYSTROKE_EVENT;
@@ -4346,82 +4348,56 @@
                     }
                   else if (code < 0xA0)
                     inev.code = MAKE_CHAR (CHARSET_8_BIT_CONTROL, code, 0);
-                  else if (code < 0x100)
-                    inev.code = MAKE_CHAR (charset_latin_iso8859_1, code, 0);
                   else
                     {
-                      int c1, c2;
-                      int charset_id;
+                      /* Many locales do not have full mapping from
+                         unicode on save, so use the locale coding to
+                         decode them. Windows only allows non-Unicode
+                         Windows to receive characters in the system
+                         locale anyway, so this doesn't really limit
+                         us.  */
+                      int nbytes, nchars, require, i, len;
+                      unsigned char *dest;
+                      struct coding_system coding;
 
-                      if (code < 0x2500)
+                      if (dbcs[0] == 0)
                         {
-                          charset_id = charset_mule_unicode_0100_24ff;
-                          code -= 0x100;
-                        }
-                      else if (code < 0x3400)
-                        {
-                          charset_id = charset_mule_unicode_2500_33ff;
-                          code -= 0x2500;
-                        }
-                      else if (code >= 0xE000)
-                        {
-                          charset_id = charset_mule_unicode_e000_ffff;
-                          code -= 0xE000;
+                          nbytes = 1;
+                          dbcs[0] = dbcs[1];
                         }
                       else
-                        {
-                          /* Not in the unicode range that we can handle in
-                             Emacs-22, so decode the original character
-                             using the locale  */
-                          int nbytes, nchars, require, i, len;
-                          unsigned char *dest;
-                          struct coding_system coding;
+                        nbytes = 2;
 
-                          if (dbcs[0] == 0)
-                            {
-                              nbytes = 1;
-                              dbcs[0] = dbcs[1];
-                            }
-                          else
-                            nbytes = 2;
-
-                          setup_coding_system (Vlocale_coding_system, &coding);
-                          coding.src_multibyte = 0;
-                          coding.dst_multibyte = 1;
-                          coding.composing = COMPOSITION_DISABLED;
-                          require = decoding_buffer_size (&coding, nbytes);
-                          dest = (unsigned char *) alloca (require);
-                          coding.mode |= CODING_MODE_LAST_BLOCK;
-
-                          decode_coding (&coding, dbcs, dest, nbytes, require);
-                          nbytes = coding.produced;
-                          nchars = coding.produced_char;
+                      setup_coding_system (Vlocale_coding_system, &coding);
+                      coding.src_multibyte = 0;
+                      coding.dst_multibyte = 1;
+                      coding.composing = COMPOSITION_DISABLED;
+                      require = decoding_buffer_size (&coding, nbytes);
+                      dest = (unsigned char *) alloca (require);
+                      coding.mode |= CODING_MODE_LAST_BLOCK;
+
+                      decode_coding (&coding, dbcs, dest, nbytes, require);
+                      nbytes = coding.produced;
+                      nchars = coding.produced_char;
 
-                          for (i = 0; i < nbytes; i += len)
+                      for (i = 0; i < nbytes; i += len)
+                        {
+                          if (nchars == nbytes)
                             {
-                              if (nchars == nbytes)
-                                {
-                                  inev.code = dest[i];
-                                  len = 1;
-                                }
-                              else
-                                inev.code = STRING_CHAR_AND_LENGTH (dest + i,
-                                                                    nbytes - 1,
-                                                                    len);
-                              inev.kind = (SINGLE_BYTE_CHAR_P (inev.code)
-                                           ? ASCII_KEYSTROKE_EVENT
-                                           : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
-                              kbd_buffer_store_event_hold (&inev, hold_quit);
-                              count++;
+                              inev.code = dest[i];
+                              len = 1;
                             }
-                          inev.kind = NO_EVENT; /* Already handled */
-                          break;
+                          else
+                            inev.code = STRING_CHAR_AND_LENGTH (dest + i,
+                                                                nbytes - 1,
+                                                                len);
+                          inev.kind = (SINGLE_BYTE_CHAR_P (inev.code)
+                                       ? ASCII_KEYSTROKE_EVENT
+                                       : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+                          kbd_buffer_store_event_hold (&inev, hold_quit);
+                          count++;
                         }
-
-                      /* Unicode characters from above.  */
-                      c1 = (code / 96) + 32;
-                      c2 = (code % 96) + 32;
-                      inev.code = MAKE_CHAR (charset_id, c1, c2);
+                      inev.kind = NO_EVENT; /* Already handled */
                     }
                 }
               else
@@ -4430,7 +4406,6 @@
                      in non-Unicode message handlers.  */
                   DebPrint (("Non-byte WM_CHAR: %d\n", msg.msg.wParam));
                   inev.kind = NO_EVENT;
-                  break;
                 }
 	    }
 	  break;



2008-02-04  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>

	* macterm.c (mac_to_emacs_modifiers): New argument UNMAPPED_MODS.
	All callers changed.
	(mac_quit_char_key_p, XTread_socket): Get Emacs modifiers from
	mapped modifiers together with original ones.

--- orig/src/macterm.c
+++ mod/src/macterm.c
@@ -9045,13 +9045,13 @@
 
 static int
 #if USE_CARBON_EVENTS
-mac_to_emacs_modifiers (UInt32 mods)
+mac_to_emacs_modifiers (UInt32 mods, UInt32 unmapped_mods)
 #else
-mac_to_emacs_modifiers (EventModifiers mods)
+mac_to_emacs_modifiers (EventModifiers mods, EventModifiers unmapped_mods)
 #endif
 {
   unsigned int result = 0;
-  if (mods & shiftKey)
+  if ((mods | unmapped_mods) & shiftKey)
     result |= shift_modifier;
 
   /* Deactivated to simplify configuration:
@@ -9153,7 +9153,7 @@
   if (char_code & ~0xff)
     return 0;
 
-  emacs_modifiers = mac_to_emacs_modifiers (mapped_modifiers);
+  emacs_modifiers = mac_to_emacs_modifiers (mapped_modifiers, modifiers);
   if (emacs_modifiers & ctrl_modifier)
     c = make_ctrl_char (char_code);
 
@@ -9179,7 +9179,7 @@
     {
       mods &= ~(optionKey | cmdKey);
     }
-  return mac_to_emacs_modifiers (mods);
+  return mac_to_emacs_modifiers (mods, 0);
 }
 
 /* Given an event ref, return the code to use for the mouse button
@@ -9769,7 +9769,7 @@
   EVENT_INIT (buf);
 
   buf.kind = DRAG_N_DROP_EVENT;
-  buf.modifiers = mac_to_emacs_modifiers (modifiers);
+  buf.modifiers = mac_to_emacs_modifiers (modifiers, 0);
   buf.timestamp = TickCount () * (1000 / 60);
   XSETINT (buf.x, mouse_pos.h);
   XSETINT (buf.y, mouse_pos.v);
@@ -10255,7 +10255,7 @@
 		    read_socket_inev->kind = ASCII_KEYSTROKE_EVENT;
 		    read_socket_inev->code = code;
 		    read_socket_inev->modifiers =
-		      mac_to_emacs_modifiers (modifiers);
+		      mac_to_emacs_modifiers (modifiers, 0);
 		    read_socket_inev->modifiers |=
 		      (extra_keyboard_modifiers
 		       & (meta_modifier | alt_modifier
@@ -10901,7 +10901,7 @@
 		    inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
 #else
 		    inev.code = mac_get_emulated_btn (er.modifiers);
-		    inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
+		    inev.modifiers = mac_to_emacs_modifiers (er.modifiers, 0);
 #endif
 		    XSETINT (inev.x, mouse_loc.h);
 		    XSETINT (inev.y, mouse_loc.v);
@@ -11430,7 +11430,8 @@
 		inev.code = er.message & charCodeMask;
 	      }
 
-	    inev.modifiers = mac_to_emacs_modifiers (mapped_modifiers);
+	    inev.modifiers = mac_to_emacs_modifiers (mapped_modifiers,
+						     modifiers);
 	    inev.modifiers |= (extra_keyboard_modifiers
 			       & (meta_modifier | alt_modifier
 				  | hyper_modifier | super_modifier));



2008-02-24  Stefan Monnier  <monnier@iro.umontreal.ca>

	* diff-mode.el (diff-file-junk-re): New const.
	(diff-beginning-of-file-and-junk): Use it.
	(diff-file-kill): Make sure we were really inside a file diff.

	* diff-mode.el: Make it more robust in the presence of empty context
	lines in unified hunks.
	(diff-valid-unified-empty-line): New var.
	(diff-unified->context, diff-sanity-check-hunk): Obey it.
	(diff-end-of-hunk): Obey it.  New arg `donttrustheader'.
	(diff-fixup-modifs, diff-post-command-hook): Use this new arg.
	(diff-hunk-header-re-unified): New const.
	(diff-font-lock-keywords, diff-hunk-header-re, diff-split-hunk)
	(diff-fixup-modifs, diff-unified->context, diff-next-complex-hunk)
	(diff-sanity-check-hunk): Use it.

2008-02-24  Stefan Monnier  <monnier@iro.umontreal.ca>

	* diff-mode.el (diff-beginning-of-file-and-junk): If we're on the
	Index: line, don't search backward for the previous one.

--- orig/lisp/diff-mode.el
+++ mod/lisp/diff-mode.el
@@ -341,10 +341,12 @@
 	  (while (re-search-backward re start t)
 	    (replace-match "" t t)))))))
 
+(defconst diff-hunk-header-re-unified
+  "^@@ -\\([0-9]+\\),\\([0-9]+\\) \\+\\([0-9]+\\),\\([0-9]+\\) @@")
 
 (defvar diff-font-lock-keywords
-  `(("^\\(@@ -[0-9,]+ \\+[0-9,]+ @@\\)\\(.*\\)$"          ;unified
-     (1 diff-hunk-header-face) (2 diff-function-face))
+  `((,(concat "\\(" diff-hunk-header-re-unified "\\)\\(.*\\)$")
+     (1 diff-hunk-header-face) (6 diff-function-face))
     ("^\\(\\*\\{15\\}\\)\\(.*\\)$"                        ;context
      (1 diff-hunk-header-face) (2 diff-function-face))
     ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context
@@ -381,25 +383,51 @@
 ;;;; Movement
 ;;;;
 
-(defconst diff-hunk-header-re "^\\(@@ -[0-9,]+ \\+[0-9,]+ @@.*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")
+(defvar diff-valid-unified-empty-line t
+  "If non-nil, empty lines are valid in unified diffs.
+Some versions of diff replace all-blank context lines in unified format with
+empty lines.  This makes the format less robust, but is tolerated.
+See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
+
+(defconst diff-hunk-header-re
+  (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$"))
 (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* ]\\).+\n" (substring diff-hunk-header-re 1)))
 (defvar diff-narrowed-to nil)
 
-(defun diff-end-of-hunk (&optional style)
-  (when (looking-at diff-hunk-header-re)
-    (unless style
-      ;; Especially important for unified (because headers are ambiguous).
-      (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context))))))
-    (goto-char (match-end 0)))
-  (let ((end (and (re-search-forward (case style
-				       ;; A `unified' header is ambiguous.
-				       (unified (concat "^[^-+# \\]\\|"
-							diff-file-header-re))
-				       (context "^[^-+#! \\]")
-				       (normal "^[^<>#\\]")
-				       (t "^[^-+#!<> \\]"))
-				     nil t)
-		  (match-beginning 0))))
+(defun diff-end-of-hunk (&optional style donttrustheader)
+  (let (end)
+    (when (looking-at diff-hunk-header-re)
+      (unless style
+        ;; Especially important for unified (because headers are ambiguous).
+        (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context))))))
+      (goto-char (match-end 0))
+      (when (and (not donttrustheader) (match-end 2))
+        (save-excursion
+          (re-search-forward (if diff-valid-unified-empty-line
+                                 "^[- \n]" "^[- ]")
+                             nil t
+                             (string-to-number (match-string 2)))
+          (setq end (line-beginning-position 2)))))
+    ;; We may have a first evaluation of `end' thanks to the hunk header.
+    (unless end
+      (setq end (and (re-search-forward
+                      (case style
+                        (unified (concat (if diff-valid-unified-empty-line
+                                             "^[^-+# \\\n]\\|" "^[^-+# \\]\\|")
+                                         ;; A `unified' header is ambiguous.
+                                         diff-file-header-re))
+                        (context "^[^-+#! \\]")
+                        (normal "^[^<>#\\]")
+                        (t "^[^-+#!<> \\]"))
+                      nil t)
+                     (match-beginning 0)))
+      (when diff-valid-unified-empty-line
+        ;; While empty lines may be valid inside hunks, they are also likely
+        ;; to be unrelated to the hunk.
+        (goto-char (or end (point-max)))
+        (while (eq ?\n (char-before (1- (point))))
+          (forward-char -1)
+          (setq end (point)))))
     ;; The return value is used by easy-mmode-define-navigation.
     (goto-char (or end (point-max)))))
 
@@ -473,11 +501,19 @@
       (diff-end-of-hunk)
       (kill-region start (point)))))
 
+(defconst diff-file-junk-re "diff \\|index ") ; "index " is output by git-diff.
+
 (defun diff-beginning-of-file-and-junk ()
   "Go to the beginning of file-related diff-info.
 This is like `diff-beginning-of-file' except it tries to skip back over leading
 data such as \"Index: ...\" and such."
-  (let ((start (point))
+  (let ((orig (point))
+        ;; Skip forward over what might be "leading junk" so as to get
+        ;; closer to the actual diff.
+        (_ (progn (beginning-of-line)
+                  (while (looking-at diff-file-junk-re)
+                    (forward-line 1))))
+        (start (point))
         (file (condition-case err (progn (diff-beginning-of-file) (point))
                 (error err)))
         ;; prevhunk is one of the limits.
@@ -489,23 +525,32 @@
       (diff-file-next)
       (setq file (point)))
     (let ((index (save-excursion
+                   (forward-line 1)  ;In case we're looking at "Index:".
                    (re-search-backward "^Index: " prevhunk t))))
       (when index (setq file index))
       (if (<= file start)
-          (goto-char file)
+          (progn
+            (goto-char file)
+            ;; Now skip backward over the leading junk we may have before the
+            ;; diff itself.
+            (while (save-excursion
+                     (and (zerop (forward-line -1))
+                          (looking-at diff-file-junk-re)))
+              (forward-line -1)))
         ;; File starts *after* the starting point: we really weren't in
         ;; a file diff but elsewhere.
-        (goto-char start)
+        (goto-char orig)
         (signal (car err) (cdr err))))))
           
 (defun diff-file-kill ()
   "Kill current file's hunks."
   (interactive)
-  (diff-beginning-of-file-and-junk)
-  (let* ((start (point))
+  (let ((orig (point))
+        (start (progn (diff-beginning-of-file-and-junk) (point)))
 	 (inhibit-read-only t))
     (diff-end-of-file)
     (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs.
+    (if (> orig (point)) (error "Not inside a file diff"))
     (kill-region start (point))))
 
 (defun diff-kill-junk ()
@@ -536,11 +581,11 @@
   (beginning-of-line)
   (let ((pos (point))
 	(start (progn (diff-beginning-of-hunk) (point))))
-    (unless (looking-at "@@ -\\([0-9]+\\),[0-9]+ \\+\\([0-9]+\\),[0-9]+ @@")
+    (unless (looking-at diff-hunk-header-re-unified)
       (error "diff-split-hunk only works on unified context diffs"))
     (forward-line 1)
     (let* ((start1 (string-to-number (match-string 1)))
-	   (start2 (string-to-number (match-string 2)))
+	   (start2 (string-to-number (match-string 3)))
 	   (newstart1 (+ start1 (diff-count-matches "^[- \t]" (point) pos)))
 	   (newstart2 (+ start2 (diff-count-matches "^[+ \t]" (point) pos)))
 	   (inhibit-read-only t))
@@ -698,7 +743,10 @@
 	(inhibit-read-only t))
     (save-excursion
       (goto-char start)
-      (while (and (re-search-forward "^\\(\\(---\\) .+\n\\(\\+\\+\\+\\) .+\\|@@ -\\([0-9]+\\),\\([0-9]+\\) \\+\\([0-9]+\\),\\([0-9]+\\) @@.*\\)$" nil t)
+      (while (and (re-search-forward
+                   (concat "^\\(\\(---\\) .+\n\\(\\+\\+\\+\\) .+\\|"
+                           diff-hunk-header-re-unified ".*\\)$")
+                   nil t)
 		  (< (point) end))
 	(combine-after-change-calls
 	  (if (match-beginning 2)
@@ -717,9 +765,11 @@
 		       (number-to-string (+ (string-to-number line1)
 					    (string-to-number lines1)
 					    -1)) " ****"))
-	      (forward-line 1)
 	      (save-restriction
-		(narrow-to-region (point)
+		(narrow-to-region (line-beginning-position 2)
+                                  ;; Call diff-end-of-hunk from just before
+                                  ;; the hunk header so it can use the hunk
+                                  ;; header info.
 				  (progn (diff-end-of-hunk 'unified) (point)))
 		(let ((hunk (buffer-string)))
 		  (goto-char (point-min))
@@ -741,6 +791,8 @@
 			  (?\\ (when (save-excursion (forward-line -1)
 						     (= (char-after) ?+))
 				 (delete-region (point) last-pt) (setq modif t)))
+                          ;; diff-valid-unified-empty-line.
+                          (?\n (insert "  ") (setq modif nil) (backward-char 2))
 			  (t (setq modif nil))))))
 		  (goto-char (point-max))
 		  (save-excursion
@@ -766,6 +818,8 @@
 			  (?\\ (when (save-excursion (forward-line 1)
 						     (not (eobp)))
 				 (setq delete t) (setq modif t)))
+                          ;; diff-valid-unified-empty-line.
+                          (?\n (insert "  ") (setq modif nil) (backward-char 2))
 			  (t (setq modif nil)))
 			(let ((last-pt (point)))
 			  (forward-line 1)
@@ -907,7 +961,8 @@
 		       (t (when (and first last (< first last))
 			    (insert (delete-and-extract-region first last)))
 			  (setq first nil last nil)
-			  (equal ?\s c)))
+			  (memq c (if diff-valid-unified-empty-line
+                                      '(?\s ?\n) '(?\s)))))
 		(forward-line 1))))))))))
 
 (defun diff-fixup-modifs (start end)
@@ -919,11 +974,11 @@
 		 (list (point-min) (point-max))))
   (let ((inhibit-read-only t))
     (save-excursion
-      (goto-char end) (diff-end-of-hunk)
+      (goto-char end) (diff-end-of-hunk nil 'donttrustheader)
       (let ((plus 0) (minus 0) (space 0) (bang 0))
 	(while (and (= (forward-line -1) 0) (<= start (point)))
 	  (if (not (looking-at
-		    (concat "@@ -[0-9,]+ \\+[0-9,]+ @@"
+		    (concat diff-hunk-header-re-unified
 			    "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$"
 			    "\\|--- .+\n\\+\\+\\+ ")))
 	      (case (char-after)
@@ -934,13 +989,13 @@
 		((?\\ ?#) nil)
 		(t  (setq space 0 plus 0 minus 0 bang 0)))
 	    (cond
-	     ((looking-at "@@ -[0-9]+,\\([0-9]*\\) \\+[0-9]+,\\([0-9]*\\) @@.*$")
-	      (let* ((old1 (match-string 1))
-		     (old2 (match-string 2))
+	     ((looking-at diff-hunk-header-re-unified)
+	      (let* ((old1 (match-string 2))
+		     (old2 (match-string 4))
 		     (new1 (number-to-string (+ space minus)))
 		     (new2 (number-to-string (+ space plus))))
-		(unless (string= new2 old2) (replace-match new2 t t nil 2))
-		(unless (string= new1 old1) (replace-match new1 t t nil 1))))
+		(unless (string= new2 old2) (replace-match new2 t t nil 4))
+		(unless (string= new1 old1) (replace-match new1 t t nil 2))))
 	     ((looking-at "--- \\([0-9]+\\),\\([0-9]*\\) ----$")
 	      (when (> (+ space bang plus) 0)
 		(let* ((old1 (match-string 1))
@@ -1008,7 +1063,7 @@
 	;; (diff-fixup-modifs (point) (cdr diff-unhandled-changes))
 	(diff-beginning-of-hunk)
 	(when (save-excursion
-		(diff-end-of-hunk)
+		(diff-end-of-hunk nil 'donttrustheader)
 		(>= (point) (cdr diff-unhandled-changes)))
 	  (diff-fixup-modifs (point) (cdr diff-unhandled-changes)))))
     (setq diff-unhandled-changes nil)))
@@ -1123,9 +1178,8 @@
 Only works for unified diffs."
   (interactive)
   (while
-      (and (re-search-forward "^@@ [-0-9]+,\\([0-9]+\\) [+0-9]+,\\([0-9]+\\) @@"
-			      nil t)
-	   (equal (match-string 1) (match-string 2)))))
+      (and (re-search-forward diff-hunk-header-re-unified nil t)
+	   (equal (match-string 2) (match-string 4)))))
 
 (defun diff-sanity-check-context-hunk-half (lines)
   (let ((count lines))
@@ -1174,11 +1228,10 @@
 
        ;; A unified diff.
        ((eq (char-after) ?@)
-        (if (not (looking-at
-                  "@@ -[0-9]+,\\([0-9]+\\) \\+[0-9]+,\\([0-9]+\\) @@"))
+        (if (not (looking-at diff-hunk-header-re-unified))
             (error "Unrecognized unified diff hunk header format")
-          (let ((before (string-to-number (match-string 1)))
-                (after (string-to-number (match-string 2))))
+          (let ((before (string-to-number (match-string 2)))
+                (after (string-to-number (match-string 4))))
             (forward-line)
             (while
                 (case (char-after)
@@ -1196,12 +1249,16 @@
                   (?+ (decf after) t)
                   (t
                    (cond
+                    ((and diff-valid-unified-empty-line
+                          ;; Not just (eolp) so we don't infloop at eob.
+                          (eq (char-after) ?\n))
+                     (decf before) (decf after) t)
                     ((and (zerop before) (zerop after)) nil)
                     ((or (< before 0) (< after 0))
                      (error (if (or (zerop before) (zerop after))
                                 "End of hunk ambiguously marked"
                               "Hunk seriously messed up")))
-                    ((not (y-or-n-p "Try to auto-fix whitespace loss and word-wrap damage? "))
+                    ((not (y-or-n-p (concat "Try to auto-fix " (if (eolp) "whitespace loss" "word-wrap damage") "? ")))
                      (error "Abort!"))
                     ((eolp) (insert " ") (forward-line -1) t)
                     (t (insert " ")




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rel-22 to trunk merge failures  2008-02-24
  2008-02-24 10:20 rel-22 to trunk merge failures 2008-02-24 Miles Bader
@ 2008-02-24 15:48 ` Stefan Monnier
  2008-02-24 15:49 ` Jason Rumney
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-02-24 15:48 UTC (permalink / raw)
  To: Miles Bader; +Cc: jasonr, mituharu, emacs-devel

> [Remember, all changes below are _not_ in the trunk, and will not be
>  merged later, so somebody needs to either make the appropriate change to
>  the trunk (including the ChangeLog entry), or confirm that it isn't
>  needed (e.g., the trunk already contains an equivalent change.
>  Thanks,   -Miles]


> M  src/w32term.c
> M  src/macterm.c
> M  lisp/diff-mode.el

I'll take care of the diff-mode.el changes, thanks Miles,


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rel-22 to trunk merge failures  2008-02-24
  2008-02-24 10:20 rel-22 to trunk merge failures 2008-02-24 Miles Bader
  2008-02-24 15:48 ` Stefan Monnier
@ 2008-02-24 15:49 ` Jason Rumney
  2008-02-24 19:07   ` Miles Bader
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Rumney @ 2008-02-24 15:49 UTC (permalink / raw)
  To: Miles Bader; +Cc: monnier, mituharu, emacs-devel

Miles Bader wrote:
> 2008-02-15  Jason Rumney  <jasonr@gnu.org>
>
> 	* w32term.c (x_draw_glyph_string_background): Clear the background
> 	manually when cleartype is in use.
> 	(x_draw_glyph_string_foreground): Draw text transparently when
> 	cleartype is in use.
>   

Applied manually (I can't see why this failed to merge automatically, 
the code was identical between the branches within about 10 lines of 
that change).


> 2008-02-05  Jason Rumney  <jasonr@gnu.org>
>
> 	* w32term.c (w32_read_socket) <WM_CHAR>: Use locale-coding-system
> 	instead of using mule-unicode-* charsets directly.
>   
This change does not apply, since using unicode directly is now safe.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rel-22 to trunk merge failures  2008-02-24
  2008-02-24 15:49 ` Jason Rumney
@ 2008-02-24 19:07   ` Miles Bader
  0 siblings, 0 replies; 4+ messages in thread
From: Miles Bader @ 2008-02-24 19:07 UTC (permalink / raw)
  To: Jason Rumney; +Cc: monnier, mituharu, emacs-devel

Jason Rumney <jasonr@gnu.org> writes:
>> 	* w32term.c (x_draw_glyph_string_background): Clear the background
>> 	manually when cleartype is in use.
>> 	(x_draw_glyph_string_foreground): Draw text transparently when
>> 	cleartype is in use.
>
> Applied manually (I can't see why this failed to merge automatically,
> the code was identical between the branches within about 10 lines of
> that change).

Those hunks did apply, but I reverted everything in the same file, just
in case there's some connection I don't grasp (that can still happen
across files of course, but it's usually a bit less likely I think).

-Miles

-- 
Cannon, n. An instrument employed in the rectification of national boundaries.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-24 19:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 10:20 rel-22 to trunk merge failures 2008-02-24 Miles Bader
2008-02-24 15:48 ` Stefan Monnier
2008-02-24 15:49 ` Jason Rumney
2008-02-24 19:07   ` Miles Bader

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).