diff lib-src/gnuclient.c @ 4684:15c42a3f4065

Do not move cursor position in gnuclient started buffer if user did not requested..
author It's me FKtPp \;) <m_pupil@yahoo.com.cn>
date Sat, 29 Aug 2009 22:37:50 +0800
parents 2161ac78b41e
children aa5ed11f473b
line wrap: on
line diff
--- a/lib-src/gnuclient.c	Thu Aug 27 15:18:51 2009 +0100
+++ b/lib-src/gnuclient.c	Sat Aug 29 22:37:50 2009 +0800
@@ -299,7 +299,7 @@
 int
 main (int argc, char *argv[])
 {
-  int starting_line = 1;	/* line to start editing at */
+  int starting_line = 0;	/* line to start editing at */
   char command[QXE_PATH_MAX+50];/* emacs command buffer */
   char fullpath[QXE_PATH_MAX+1];/* full pathname to file */
   char *eval_form = NULL;	/* form to evaluate with `-eval' */
@@ -661,14 +661,10 @@
 	{
 	  if (i < argc - 1 && *argv[i] == '+')
 	    starting_line = atoi (argv[i++]);
-	  else
-	    starting_line = 1;
+
 	  /* If the last argument is +something, treat it as a file. */
-	  if (i == argc)
-	    {
-	      starting_line = 1;
-	      --i;
-	    }
+	  if (i == argc) --i;
+
 	  filename_expand (fullpath, argv[i]);
 #ifdef INTERNET_DOMAIN_SOCKETS
 	  path = (char *) malloc (strlen (remotepath) + strlen (fullpath) + 1);
@@ -676,7 +672,12 @@
 #else
 	  path = my_strdup (fullpath);
 #endif
-	  sprintf (command, "(%d . %s)", starting_line, clean_string (path));
+	  if ( starting_line ) {
+	    sprintf (command, "(%d . %s)", starting_line, clean_string (path));
+	  } else {
+	    sprintf (command, "(nil . %s)", clean_string (path));
+	  }
+
 	  send_string (s, command);
 	  free (path);
 	} /* for */