changeset 109420:c166807ffc89

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Tue, 29 Jun 2010 22:51:37 +0000
parents 4caffbf18f4c (current diff) c70ff40ac4ce (diff)
children 10cf940285f9
files lisp/vc/diff-mode.el lisp/vc/vc.el
diffstat 5 files changed, 42 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Jun 28 22:47:32 2010 +0000
+++ b/lisp/ChangeLog	Tue Jun 29 22:51:37 2010 +0000
@@ -1,3 +1,12 @@
+2010-06-29  Chong Yidong  <cyd@stupidchicken.com>
+
+	* vc/vc.el (vc-deduce-backend): New fun.  Handle diff buffers.
+	(vc-root-diff, vc-print-root-log, vc-log-incoming)
+	(vc-log-outgoing): Use it.
+	(vc-diff-internal): Set diff-vc-backend.
+
+	* vc/diff-mode.el (diff-vc-backend): New var.
+
 2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* dynamic-setting.el (font-setting-change-default-font): Remove
--- a/lisp/vc/diff-mode.el	Mon Jun 28 22:47:32 2010 +0000
+++ b/lisp/vc/diff-mode.el	Tue Jun 29 22:51:37 2010 +0000
@@ -97,6 +97,9 @@
   :options '(diff-delete-empty-files diff-make-unified)
   :group 'diff-mode)
 
+(defvar diff-vc-backend nil
+  "The VC backend that created the current Diff buffer, if any.")
+
 (defvar diff-outline-regexp
   "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
 
--- a/lisp/vc/vc.el	Mon Jun 28 22:47:32 2010 +0000
+++ b/lisp/vc/vc.el	Tue Jun 29 22:51:37 2010 +0000
@@ -913,6 +913,16 @@
     (nreverse flattened)))
 
 (defvar vc-dir-backend)
+(defvar log-view-vc-backend)
+(defvar diff-vc-backend)
+
+(defun vc-deduce-backend ()
+  (cond ((derived-mode-p 'vc-dir-mode)   vc-dir-backend)
+	((derived-mode-p 'log-view-mode) log-view-vc-backend)
+	((derived-mode-p 'diff-mode)     diff-vc-backend)
+	((derived-mode-p 'dired-mode)
+	 (vc-responsible-backend default-directory))
+	(vc-mode (vc-backend buffer-file-name))))
 
 (declare-function vc-dir-current-file "vc-dir" ())
 (declare-function vc-dir-deduce-fileset "vc-dir" (&optional state-model-only-files))
@@ -1547,6 +1557,7 @@
           (message "%s" (cdr messages))
           nil)
       (diff-mode)
+      (set (make-local-variable 'diff-vc-backend) (car vc-fileset))
       (set (make-local-variable 'revert-buffer-function)
 	   `(lambda (ignore-auto noconfirm)
 	      (vc-diff-internal ,async ',vc-fileset ,rev1 ,rev2 ,verbose)))
@@ -1656,10 +1667,7 @@
       ;; that's not what we want here, we want the diff for the VC root dir.
       (call-interactively 'vc-version-diff)
     (when buffer-file-name (vc-buffer-sync not-urgent))
-    (let ((backend
-	   (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
-		 ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
-		 (vc-mode (vc-backend buffer-file-name))))
+    (let ((backend (vc-deduce-backend))
 	  rootdir working-revision)
       (unless backend
 	(error "Buffer is not version controlled"))
@@ -1956,7 +1964,6 @@
 If it contains `file' then show short logs for files.
 Not all VC backends support short logs!")
 
-(defvar log-view-vc-backend)
 (defvar log-view-vc-fileset)
 
 (defun vc-print-log-setup-buttons (working-revision is-start-revision limit pl-return)
@@ -2105,10 +2112,7 @@
        (list lim)))
     (t
      (list (when (> vc-log-show-limit 0) vc-log-show-limit)))))
-  (let ((backend
-	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
-	       ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
-	       (vc-mode (vc-backend buffer-file-name))))
+  (let ((backend (vc-deduce-backend))
 	rootdir working-revision)
     (unless backend
       (error "Buffer is not version controlled"))
@@ -2120,10 +2124,7 @@
 (defun vc-log-incoming (&optional remote-location)
   "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION."
   (interactive "sRemote location (empty for default): ")
-  (let ((backend
-	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
-	       ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
-	       (vc-mode (vc-backend buffer-file-name))))
+  (let ((backend (vc-deduce-backend))
 	rootdir working-revision)
     (unless backend
       (error "Buffer is not version controlled"))
@@ -2133,10 +2134,7 @@
 (defun vc-log-outgoing (&optional remote-location)
   "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION."
   (interactive "sRemote location (empty for default): ")
-  (let ((backend
-	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
-	       ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory))
-	       (vc-mode (vc-backend buffer-file-name))))
+  (let ((backend (vc-deduce-backend))
 	rootdir working-revision)
     (unless backend
       (error "Buffer is not version controlled"))
--- a/src/ChangeLog	Mon Jun 28 22:47:32 2010 +0000
+++ b/src/ChangeLog	Tue Jun 29 22:51:37 2010 +0000
@@ -1,3 +1,9 @@
+2010-06-29  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* nsfns.m: extern declare Vmenu_bar_mode, Vtool_bar_mode.
+	(ns_get_screen): Don't assign integer to f.
+	(Fx_display_color_cells): Declarations before statements.
+
 2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xfns.c (x_default_font_parameter): Remove got_from_system
--- a/src/nsfns.m	Mon Jun 28 22:47:32 2010 +0000
+++ b/src/nsfns.m	Tue Jun 29 22:51:37 2010 +0000
@@ -83,6 +83,10 @@
 extern Lisp_Object Qnone;
 extern Lisp_Object Vframe_title_format;
 
+/* The below are defined in frame.c.  */
+
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
+
 Lisp_Object Qbuffered;
 Lisp_Object Qfontsize;
 
@@ -224,7 +228,8 @@
   else
     {
       struct ns_display_info *dpyinfo = terminal->display_info.ns;
-      f = (dpyinfo->x_focus_frame || dpyinfo->x_highlight_frame);
+      f = dpyinfo->x_focus_frame
+        ? dpyinfo->x_focus_frame : dpyinfo->x_highlight_frame;
     }
 
   return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen]
@@ -2381,9 +2386,10 @@
      (display)
      Lisp_Object display;
 {
+  struct ns_display_info *dpyinfo;
   check_ns ();
-  struct ns_display_info *dpyinfo = check_ns_display_info (display);
-
+  
+  dpyinfo = check_ns_display_info (display);
   /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
   return make_number (1 << min (dpyinfo->n_planes, 24));
 }