diff -up ./pathauto.module ../pathauto6x/pathauto.module
--- ./pathauto.module	2008-06-12 20:51:38.000000000 +0200
+++ ../pathauto6x/pathauto.module	2008-06-18 22:07:14.000000000 +0200
@@ -134,16 +134,9 @@ function pathauto_token_values($type, $o
             }
             $values[$label .'path'] = $catpath .'/'. check_plain($category->name);
             $values[$label .'path-raw'] = $catpath_raw .'/'. $category->name;
-
-            // We only do this for taxonomy because token already provides the [term] value but has problem with [cat] TODO: fix that?
-            if ($type == 'taxonomy') {
-              $values[$label] = check_plain($category->name);
-              $values[$label .'-raw'] = $category->name;
-            }
-
             $values[$label .'alias'] = drupal_get_path_alias('taxonomy/term/'. $category->tid);
             if (!strncasecmp($values[$label .'alias'], 'taxonomy', 8)) {
-              $values[$label .'alias'] = $values[$label];
+              $values[$label .'alias'] = check_plain($category->name);
             }
           }
           else { // Provide some defaults if they aren't set.
@@ -214,12 +207,30 @@ function pathauto_nodeapi(&$node, $op, $
   _pathauto_include();
   if (module_exists('path')) {
     switch ($op) {
+      case 'presave':
+        // About to be saved (before insert/update)
+        if (!empty($node->pathauto_perform_alias) && isset($node->old_alias)
+            && $node->path == '' && $node->old_alias != '') {
+          /**
+           * There was an old alias, but when pathauto_perform_alias was checked
+           * the javascript disabled the textbox which led to an empty value being
+           * submitted. Restoring the old path-value here prevents the Path module
+           * from deleting any old alias before Pathauto gets control.
+           */
+          $node->path = $node->old_alias;
+        }
+        break;
       case 'insert':
       case 'update':
         // Get the specific pattern or the default
-        $pattern = trim(variable_get('pathauto_node_'. $node->type .'_pattern', FALSE));
-        if (!$pattern) {
-          $pattern = trim(variable_get('pathauto_node_pattern', FALSE));
+        if (variable_get('language_content_type_'. $node->type, 0)) {
+          $pattern = trim(variable_get('pathauto_node_'. $node->type .'_'. $node->language .'_pattern', FALSE));
+        }
+        if (empty($pattern)) {
+          $pattern = trim(variable_get('pathauto_node_'. $node->type .'_pattern', FALSE));
+          if (empty($pattern)) {
+            $pattern = trim(variable_get('pathauto_node_pattern', FALSE));
+          }
         }
         // Only do work if there's a pattern
         if ($pattern) {
@@ -248,30 +259,47 @@ function pathauto_nodeapi(&$node, $op, $
  * own aliases (Pathauto will be invisible to other users). Inserted
  * into the path module's fieldset in the node form.
  */
-function pathauto_form_alter($formid, &$form) {
+function pathauto_form_alter(&$form, $form_state, $form_id) {
   // Only do this for node forms
   if (isset($form['#id']) && ($form['#id'] == 'node-form') && arg(0) == 'node') {
+    $node = $form['#node'];
+
     // See if there is a pathauto pattern or default applicable
-    $pattern = trim(variable_get('pathauto_node_'. $form['type']['#value'] .'_pattern', FALSE));
-    if (!$pattern) {
-      $pattern = trim(variable_get('pathauto_node_pattern', FALSE));
+    if (isset($form['language'])) {
+      $language = isset($form['language']['#value']) ? $form['language']['#value'] : $form['language']['#default_value'];
+      $pattern = trim(variable_get('pathauto_node_'. $form['type']['#value'] .'_'. $language .'_pattern', ''));
+    }
+    if (empty($pattern)) {
+      $pattern = trim(variable_get('pathauto_node_'. $form['type']['#value'] .'_pattern', ''));
+      if (empty($pattern)) {
+        $pattern = trim(variable_get('pathauto_node_pattern', ''));
+      }
     }
     // If there is a pattern AND the user is allowed to create aliases AND the path textbox is present on this form
-    if ($pattern && user_access('create url aliases') && isset($form['path']['path'])) {
+    if (!empty($pattern) && user_access('create url aliases') && isset($form['path']['path'])) {
       $output = t('An alias will be generated for you. If you wish to create your own alias below, untick this option.');
       if (user_access('administer pathauto')) {
         $output .= t(' To control the format of the generated aliases, see the <a href="@pathauto">Pathauto settings</a>.', array('@pathauto' => url('admin/settings/pathauto')));
       }
 
       drupal_add_js(drupal_get_path('module', 'pathauto') .'/pathauto.js');
+      $form['path']['#collapsed'] = FALSE;
 
       $form['path']['pathauto_perform_alias'] = array(
         '#type' => 'checkbox',
         '#title' => t('Automatic alias'),
-        '#default_value' => TRUE,
+        '#default_value' => isset($node->pathauto_perform_alias) ? $node->pathauto_perform_alias : TRUE,
         '#description' => $output,
         '#weight' => -1,
       );
+
+      if (!empty($node->pathauto_perform_alias) && !empty($node->old_alias) && $node->path == '') {
+        $form['path']['path']['#default_value'] = $node->old_alias;
+        $node->path = $node->old_alias;
+      }
+
+      //For Pathauto to remember the old alias and prevent the Path-module from deleteing it when Pathauto wants to preserve it
+      $form['path']['old_alias'] = array('#type' => 'value', '#value' => $node->path);
     }
   }
 }
@@ -369,7 +397,7 @@ function pathauto_user($op, &$edit, &$us
             $new_user->roles = isset($edit['roles']) ? $edit['roles'] : array();
             $new_user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; // Add this back
           }
-          if (user_access('edit own blog', $new_user)) {
+          if (user_access('create blog entries', $new_user)) {
             $src = 'blog/'. $user->uid;
             $alias = pathauto_create_alias('blog', $op, $placeholders, $src, $user->uid);
           }
@@ -773,7 +807,7 @@ function pathauto_admin_settings_validat
 }
 
 /**
- * Menu callback: select certain alias types to delete.
+ * Menu callback; select certain alias types to delete.
  */
 function pathauto_admin_delete() {
   /* TODO:
