[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] add emacsclient support to open with file:linum syntax
From: |
Jorge Alberto Garcia |
Subject: |
[PATCH] add emacsclient support to open with file:linum syntax |
Date: |
Thu, 7 Jan 2016 16:35:40 -0600 |
Hi !
I wrote a little patch to emacsclient,
Could you review it ?, this is my first attempt to contribute :)
Description
With this you can do this from cmdline:
$ emacsclient -q -c lib-src/emacsclient.c:1593
in addition to have our already trusted way
lib-src/emacsclient -q +1593 -c lib-src/emacsclient.c
- Why I did it ?
I found myself using tools that provides text location using
filepath:line but couldn't use it directly by emacsclient.
-Jorge
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index c3e5635..be9c9cc 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1593,7 +1593,7 @@ main (int argc, char **argv)
char string[BUFSIZ+1];
int start_daemon_if_needed;
int exit_status = EXIT_SUCCESS;
-
+ char *lineDst;
main_argv = argv;
progname = argv[0];
@@ -1747,6 +1747,21 @@ main (int argc, char **argv)
continue;
}
}
+
+ lineDst = index(argv[i],':');
+ if ( lineDst != NULL)
+ {
+ char *p = lineDst + 1;
+ while (isdigit ((unsigned char) *p) || *p == ':') p++;
+ if (*p == 0)
+ {
+ send_to_emacs (emacs_socket, "-position ");
+ *lineDst='+';
+ quote_argument (emacs_socket, lineDst);
+ send_to_emacs (emacs_socket, " ");
+ }
+ }
+
#ifdef WINDOWSNT
else if (! file_name_absolute_p (argv[i])
&& (isalpha (argv[i][0]) && argv[i][1] == ':'))
@@ -1768,7 +1783,10 @@ main (int argc, char **argv)
}
#endif
- send_to_emacs (emacs_socket, "-file ");
+ send_to_emacs (emacs_socket, "-file ");
+ if(lineDst != NULL){
+ *lineDst = 0;
+ }
quote_argument (emacs_socket, argv[i]);
send_to_emacs (emacs_socket, " ");
}
- [PATCH] add emacsclient support to open with file:linum syntax,
Jorge Alberto Garcia <=
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Yuri Khan, 2016/01/08
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Eli Zaretskii, 2016/01/08
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Jorge Alberto Garcia, 2016/01/08
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Eli Zaretskii, 2016/01/08
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Kaushal Modi, 2016/01/08
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Jorge Alberto Garcia, 2016/01/08
- Re: [PATCH] add emacsclient support to open with file:linum syntax, Kaushal Modi, 2016/01/08