[PATCH] Re: [Bug: 21.5-b29] ediff "= h" doesn't mark sessions for hiding

Aidan Kehoe kehoea at parhasard.net
Sun Nov 22 11:31:31 EST 2009



SUPERSEDES 19209.23893.869279.431060 at parhasard.net

 Ar an dara lá is fiche de mí na Samhain, scríobh Aidan Kehoe: 

 >  Ar an fichiú lá de mí na Samhain, scríobh Jerry James: 
 > 
 >  > That's not the only keybinding weirdness with ediff.  See
 >  > https://bugzilla.redhat.com/show_bug.cgi?id=537531 for another such
 >  > report.  I asked the package maintainer, Michael Kifer, for help on
 >  > that bug.  Perhaps he can chime in on this issue as well.
 > 
 > These GNU changes are the root of the problem: 
 > http://mid.gmane.org/E1LL83Q-0005bM-7U@cvs.savannah.gnu.org
 > http://mid.gmane.org/E1LL84c-0005md-P2@cvs.savannah.gnu.org

I am sorry, the first patch I posted was too invasive in some parts and not
invasive enough in others. 

2009-11-22  Aidan Kehoe  <kehoea at parhasard.net>

	* ediff-init.el (ediff-last-command-char): New macro, giving
	`last-command-char' on XEmacs, `last-command-event' under GNU
	Emacs.
	* ediff-util.el (ediff-toggle-read-only)
	(ediff-scroll-vertically, ediff-scroll-horizontally)
	(ediff-jump-to-difference-at-point, ediff-restore-diff)
	(ediff-toggle-regexp-match, ediff-toggle-regexp-match)
	(ediff-save-buffer): Use it. 
	* ediff-mult.el (ediff-meta-mark-equal-files): 
	Use it. 

Index: ediff-init.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/ediff/ediff-init.el,v
retrieving revision 1.43
diff -u -r1.43 ediff-init.el
--- ediff-init.el	15 Aug 2009 06:16:34 -0000	1.43
+++ ediff-init.el	22 Nov 2009 16:28:22 -0000
@@ -1802,6 +1802,15 @@
 	       (set-buffer ,old-buffer)
 	       (set-syntax-table ,old-table))))))))
 
+(defmacro ediff-last-command-char ()
+  (if (featurep 'xemacs)
+      ;; last-command-event is an event object, never a character, under
+      ;; XEmacs; if last-command-char is non-nil, it corresponds to the
+      ;; character of last-command-event. 
+      'last-command-char
+    ;; last-command-event is occasionally a character under GNU Emacs, and
+    ;; they've deprecated last-command-char there.
+    'last-command-event))
 
 (provide 'ediff-init)
 
Index: ediff-mult.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/ediff/ediff-mult.el,v
retrieving revision 1.34
diff -u -r1.34 ediff-mult.el
--- ediff-mult.el	15 Aug 2009 06:16:34 -0000	1.34
+++ ediff-mult.el	22 Nov 2009 16:28:22 -0000
@@ -2347,7 +2347,7 @@
 `last-command-event' is used to decide which action to take."
   (interactive)
   (if (null action)
-      (setq action last-command-event))
+      (setq action (ediff-last-command-char)))
   (let ((list (cdr ediff-meta-list))
 	marked1 marked2 marked3
 	fileinfo1 fileinfo2 fileinfo3 elt)
Index: ediff-util.el
===================================================================
RCS file: /cvsroot/xemacs/XEmacs/packages/xemacs-packages/ediff/ediff-util.el,v
retrieving revision 1.43
diff -u -r1.43 ediff-util.el
--- ediff-util.el	15 Aug 2009 06:16:34 -0000	1.43
+++ ediff-util.el	22 Nov 2009 16:28:22 -0000
@@ -1012,7 +1012,7 @@
   (interactive)
   (ediff-barf-if-not-control-buffer)
   (let ((ctl-buf (if (null buf) (current-buffer)))
-	(buf-type (ediff-char-to-buftype last-command-event)))
+	(buf-type (ediff-char-to-buftype (ediff-last-command-char))))
     (or buf (ediff-recenter))
     (or buf
 	(setq buf (ediff-get-buffer buf-type)))
@@ -1514,7 +1514,7 @@
       (error ediff-KILLED-VITAL-BUFFER))
 
   (ediff-operate-on-windows
-   (if (memq last-command-event '(?v ?\C-v))
+   (if (memq (ediff-last-command-char) '(?v ?\C-v))
        'scroll-up
      'scroll-down)
    ;; calculate argument to scroll-up/down
@@ -1562,7 +1562,7 @@
    ;; interactively so that they set the window's min_hscroll.
    ;; Otherwise, automatic hscrolling will undo the effect of
    ;; hscrolling.
-   (if (= last-command-event ?<)
+   (if (= (ediff-last-command-char) ?<)
        (lambda (arg)
 	 (let ((prefix-arg arg))
 	   (call-interactively 'scroll-left)))
@@ -1826,7 +1826,7 @@
 in the specified buffer."
   (interactive "P")
   (ediff-barf-if-not-control-buffer)
-  (let* ((buf-type (ediff-char-to-buftype last-command-event))
+  (let* ((buf-type (ediff-char-to-buftype (ediff-last-command-char)))
 	 (buffer (ediff-get-buffer buf-type))
 	 (pt (ediff-with-current-buffer buffer (point)))
 	 (diff-no (ediff-diff-at-point buf-type nil (if arg 'after)))
@@ -2168,7 +2168,7 @@
   (if (numberp arg)
       (ediff-jump-to-difference arg))
   (ediff-pop-diff ediff-current-difference
-		  (ediff-char-to-buftype (or key last-command-event)))
+		  (ediff-char-to-buftype (or key (ediff-last-command-char))))
   ;; recenter with rehighlighting, but no messages
   (let (ediff-verbose-p)
     (ediff-recenter)))
@@ -2192,13 +2192,13 @@
     (cond
      ((or (and (eq ediff-skip-diff-region-function
 		   ediff-focus-on-regexp-matches-function)
-	       (eq last-command-event ?f))
+	       (eq (ediff-last-command-char) ?f))
 	  (and (eq ediff-skip-diff-region-function
 		   ediff-hide-regexp-matches-function)
-	       (eq last-command-event ?h)))
+	       (eq (ediff-last-command-char) ?h)))
       (message "Selective browsing by regexp turned off")
       (setq ediff-skip-diff-region-function 'ediff-show-all-diffs))
-     ((eq last-command-event ?h)
+     ((eq (ediff-last-command-char) ?h)
       (setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function
 	    regexp-A
 	    (read-string
@@ -2236,7 +2236,7 @@
       (or (string= regexp-B "") (setq ediff-regexp-hide-B regexp-B))
       (or (string= regexp-C "") (setq ediff-regexp-hide-C regexp-C)))
 
-     ((eq last-command-event ?f)
+     ((eq (ediff-last-command-char) ?f)
       (setq ediff-skip-diff-region-function
 	    ediff-focus-on-regexp-matches-function
 	    regexp-A
@@ -3302,10 +3302,10 @@
   (ediff-barf-if-not-control-buffer)
   (ediff-compute-custom-diffs-maybe)
   (ediff-with-current-buffer
-      (cond ((memq last-command-event '(?a ?b ?c))
+      (cond ((memq (ediff-last-command-char) '(?a ?b ?c))
 	     (ediff-get-buffer
-	      (ediff-char-to-buftype last-command-event)))
-	    ((eq last-command-event ?d)
+	      (ediff-char-to-buftype (ediff-last-command-char))))
+	    ((eq (ediff-last-command-char) ?d)
 	     (message "Saving diff output ...")
 	     (sit-for 1) ; let the user see the message
 	     (cond ((and arg (ediff-buffer-live-p ediff-diff-buffer))

-- 
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
  -- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research



More information about the XEmacs-Beta mailing list