Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.45
diff -u -p -r1.45 pathauto.inc
--- pathauto.inc	18 Jun 2008 20:02:40 -0000	1.45
+++ pathauto.inc	5 Feb 2009 20:00:18 -0000
@@ -317,6 +317,10 @@ function pathauto_create_alias($module, 
     }
   }
 
+  if ($op == 'return') {
+    return $alias;
+  }
+
   // If $pid is NULL, a new alias is created - otherwise, the existing
   // alias for the designated src is replaced
   _pathauto_set_alias($src, $alias, $module, $entity_id, $pid, $verbose, $old_alias, $language);
Index: pathauto.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.118
diff -u -p -r1.118 pathauto.module
--- pathauto.module	20 Jun 2008 20:01:01 -0000	1.118
+++ pathauto.module	5 Feb 2009 20:00:18 -0000
@@ -265,7 +265,7 @@ function pathauto_nodeapi(&$node, $op, $
  */
 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') {
+  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id && isset($form['path']['path'])) {
     $node = $form['#node'];
 
     // See if there is a pathauto pattern or default applicable
@@ -280,19 +280,23 @@ function pathauto_form_alter(&$form, $fo
       }
     }
     // If there is a pattern AND the user is allowed to create aliases AND the path textbox is present on this form
-    if (!empty($pattern) && user_access('create url aliases') && isset($form['path']['path'])) {
+    if (!empty($pattern)) {
       $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/build/path/pathauto')));
       }
 
       drupal_add_js(drupal_get_path('module', 'pathauto') .'/pathauto.js');
-      $form['path']['#collapsed'] = FALSE;
+
+      if (isset($node->nid)) {
+        $placeholders = pathauto_get_placeholders('node', $node);
+        $node->pathauto_alias = pathauto_create_alias('node', 'return', $placeholders, "node/{$node->nid}", $node->nid, $node->type, $node->language);
+      }
 
       $form['path']['pathauto_perform_alias'] = array(
         '#type' => 'checkbox',
         '#title' => t('Automatic alias'),
-        '#default_value' => isset($node->pathauto_perform_alias) ? $node->pathauto_perform_alias : TRUE,
+        '#default_value' => !empty($node->pathauto_perform_alias) || (isset($node->pathauto_alias) && isset($node->path) && $node->pathauto_alias == $node->path),
         '#description' => $output,
         '#weight' => -1,
       );
