Index: includes/ajax.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/ajax.inc,v
retrieving revision 1.19
diff -u -p -r1.19 ajax.inc
--- includes/ajax.inc	22 Nov 2009 02:48:37 -0000	1.19
+++ includes/ajax.inc	28 Nov 2009 16:52:59 -0000
@@ -755,8 +755,9 @@ function ajax_command_css($selector, $ar
 /**
  * Creates a Drupal AJAX 'settings' command.
  *
- * The 'settings' command instructs the client to extend Drupal.settings with
- * the given array.
+ * The 'settings' command instructs the client either to use the given array as
+ * the settings for ajax-loaded content or to extend Drupal.settings with the
+ * given array, depending on the value of the $merge parameter.
  *
  * This command is implemented by Drupal.ajax.prototype.commands.settings()
  * defined in misc/ajax.js.
@@ -765,14 +766,20 @@ function ajax_command_css($selector, $ar
  *   An array of key/value pairs to add to the settings. This will be utilized
  *   for all commands after this if they do not include their own settings
  *   array.
+ * @param $merge
+ *   Whether or not the passed settings in $argument should be merged into the
+ *   global Drupal.settings on the page. By default (FALSE), the settings that
+ *   are passed to Drupal.attachBehaviors will not include the global
+ *   Drupal.settings.
  *
  * @return
  *   An array suitable for use with the ajax_render() function.
  */
-function ajax_command_settings($argument) {
+function ajax_command_settings($argument, $merge = FALSE) {
   return array(
     'command' => 'settings',
     'settings' => $argument,
+    'merge' => $merge,
   );
 }
 
Index: misc/ajax.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/ajax.js,v
retrieving revision 1.6
diff -u -p -r1.6 ajax.js
--- misc/ajax.js	26 Nov 2009 03:05:42 -0000	1.6
+++ misc/ajax.js	28 Nov 2009 16:49:52 -0000
@@ -399,7 +399,12 @@ Drupal.ajax.prototype.commands = {
    * Command to set the settings that will be used for other commands in this response.
    */
   settings: function (ajax, response, status) {
-    ajax.settings = response.settings;
+    if (response.merge) {
+      $.extend(true, Drupal.settings, response.settings);
+    }
+    else {
+      ajax.settings = response.settings;
+    }
   },
 
   /**
