Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1015
diff -u -p -r1.1015 common.inc
--- includes/common.inc	13 Oct 2009 05:37:45 -0000	1.1015
+++ includes/common.inc	13 Oct 2009 16:43:35 -0000
@@ -4322,6 +4322,40 @@ function drupal_set_page_content($conten
 }
 
 /**
+ * #pre_render callback to construct a link.
+ *
+ * Doing so during pre_render gives modules a chance to alter the link parts.
+ *
+ * @param $elements
+ *   A structured array whose keys form the arguments to l():
+ *   - #title: The link text to pass as argument to l().
+ *   - #href: The URL path component to pass as argument to l().
+ *   - #options: (optional) An array of options to pass to l().
+ *
+ * @return
+ *   The passed in elements containing a rendered link in '#markup'.
+ */
+function drupal_pre_render_link($elements) {
+  $options = isset($elements['#options']) ? $elements['#options'] : array();
+  $elements['#markup'] = l($elements['#title'], $elements['#href'], $options);
+  return $elements;
+}
+
+/**
+ * #pre_render callback to append contents in #markup to #prefix.
+ *
+ * @param $elements
+ *   A structured array using the #markup key.
+ *
+ * @return
+ *   The passed in elements, but #markup appended to #prefix.
+ */
+function drupal_pre_render_markup($elements) {
+  $elements['#prefix'] .= $elements['#markup'];
+  return $elements;
+}
+
+/**
  * Renders the page, including all theming.
  *
  * @param $page
@@ -4429,6 +4463,12 @@ function drupal_render(&$elements) {
   if (isset($elements['#cache']) && $cached_output = drupal_render_cache_get($elements)) {
     return $cached_output;
   }
+  
+  // If #markup is not empty, set #type. This allows to specify just #markup on
+  // an element without setting #type.
+  if (!empty($elements['#markup'])) {
+    $elements['#type'] = 'markup';
+  }
 
   // If the default values for this element have not been loaded yet, populate
   // them.
@@ -4442,12 +4482,6 @@ function drupal_render(&$elements) {
     $elements += $defaults;
   }
 
-  // If #markup is not empty and no theme function is set, use theme_markup.
-  // This allows to specify just #markup on an element without setting the #type.
-  if (!empty($elements['#markup']) && empty($elements['#theme'])) {
-    $elements['#theme'] = 'markup';
-  }
-
   // Make any final changes to the element before it is rendered. This means
   // that the $element or the children can be altered or corrected before the
   // element is rendered into the final text.
@@ -4990,9 +5024,6 @@ function drupal_common_theme() {
     'textarea' => array(
       'arguments' => array('element' => NULL),
     ),
-    'markup' => array(
-      'arguments' => array('element' => NULL),
-    ),
     'password' => array(
       'arguments' => array('element' => NULL),
     ),
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.382
diff -u -p -r1.382 form.inc
--- includes/form.inc	10 Oct 2009 16:48:37 -0000	1.382
+++ includes/form.inc	13 Oct 2009 16:19:35 -0000
@@ -2595,24 +2595,6 @@ function theme_textarea($variables) {
 }
 
 /**
- * Theme HTML markup for use in forms.
- *
- * @param $variables
- *   An associative array containing:
- *   - element: An associative array containing the properties of the element.
- *     Properties used: #markup, #children.
- *
- * @return
- *   A themed HTML string representing the HTML markup.
- *
- * @ingroup themeable
- */
-function theme_markup($variables) {
-  $element = $variables['element'];
-  return (!empty($element['#markup']) ? $element['#markup'] : '') . drupal_render_children($element);
-}
-
-/**
  * Theme a password form element.
  *
  * @param $variables
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.49
diff -u -p -r1.49 filter.admin.inc
--- modules/filter/filter.admin.inc	13 Oct 2009 15:39:41 -0000	1.49
+++ modules/filter/filter.admin.inc	13 Oct 2009 16:19:35 -0000
@@ -32,7 +32,7 @@ function filter_admin_overview($form) {
       $roles_markup = $roles ? implode(', ', $roles) : t('No roles may use this format');
     }
     $form['formats'][$id]['roles'] = array('#markup' => $roles_markup);
-    $form['formats'][$id]['configure'] = array('#markup' => l(t('configure'), 'admin/config/content/formats/' . $id));
+    $form['formats'][$id]['configure'] = array('#type' => 'link', '#title' => t('configure'), '#href' => 'admin/config/content/formats/' . $id);
     $form['formats'][$id]['delete'] = array('#markup' => $form['formats'][$id]['#is_fallback'] ? '' : l(t('delete'), 'admin/config/content/formats/' . $id . '/delete'));
     $form['formats'][$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
   }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.807
diff -u -p -r1.807 system.module
--- modules/system/system.module	13 Oct 2009 05:26:57 -0000	1.807
+++ modules/system/system.module	13 Oct 2009 16:42:52 -0000
@@ -444,7 +444,13 @@ function system_element_info() {
   );
   $types['markup'] = array(
     '#markup' => '',
-    '#theme' => 'markup',
+    '#prefix' => '',
+    '#pre_render' => array('drupal_pre_render_markup'),
+  );
+  $types['link'] = array(
+    '#markup' => '',
+    '#prefix' => '',
+    '#pre_render' => array('drupal_pre_render_link', 'drupal_pre_render_markup'),
   );
   $types['fieldset'] = array(
     '#collapsible' => FALSE,
