From: Jorge Alberto Garcia <jorge.garcia.gonzalez@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] add emacsclient support to open with file:linum syntax
Date: Thu, 7 Jan 2016 16:35:40 -0600 [thread overview]
Message-ID: <CAPfrtUdQCW8u1RnP+B_V4-stH81QR4nVg-cMTnAo_OFHsYJLyw@mail.gmail.com> (raw)
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, " ");
}
next reply other threads:[~2016-01-07 22:35 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 22:35 Jorge Alberto Garcia [this message]
2016-01-08 7:42 ` [PATCH] add emacsclient support to open with file:linum syntax Yuri Khan
2016-01-08 8:08 ` Jorge Alberto Garcia
2016-01-08 8:59 ` Yuri Khan
2016-01-08 14:11 ` Jorge Alberto Garcia
2016-01-08 9:03 ` Eli Zaretskii
2016-01-08 14:13 ` Jorge Alberto Garcia
2016-01-08 15:39 ` Eli Zaretskii
2016-01-08 15:54 ` Kaushal Modi
2016-01-08 16:13 ` Jorge Alberto Garcia
2016-01-08 16:38 ` Kaushal Modi
2016-01-08 16:44 ` Jorge Alberto Garcia
2016-01-08 16:54 ` Kaushal Modi
2016-01-08 17:52 ` Jorge Alberto Garcia
2016-01-08 19:06 ` Eli Zaretskii
2016-01-08 19:05 ` Eli Zaretskii
2016-01-12 21:04 ` John Wiegley
2016-01-12 21:26 ` Jorge Alberto Garcia
2016-01-13 0:10 ` John Wiegley
2016-01-13 0:46 ` Jorge Alberto Garcia
2016-03-29 16:22 ` Kaushal Modi
2016-03-29 17:30 ` Jorge Alberto Garcia
2016-03-29 21:27 ` Paul Eggert
2016-03-29 22:35 ` Kaushal Modi
2016-03-29 23:08 ` Paul Eggert
2016-03-29 23:29 ` Jorge Alberto Garcia
2016-03-30 0:37 ` Paul Eggert
2016-03-30 14:21 ` Kaushal Modi
2016-03-30 16:42 ` Jorge Alberto Garcia
2016-03-31 12:31 ` Stefan Monnier
2016-03-31 14:24 ` Jorge Alberto Garcia
2016-01-08 19:19 ` David Caldwell
2016-01-08 19:43 ` Eli Zaretskii
2016-01-08 19:52 ` David Caldwell
2016-01-08 20:33 ` Jorge Alberto Garcia
2016-01-09 22:51 ` Jorge Alberto Garcia
2016-01-10 8:22 ` Yuri Khan
2016-01-10 8:37 ` Jorge Alberto Garcia
2016-01-12 16:24 ` Jorge Alberto Garcia
2016-01-08 16:10 ` Jorge Alberto Garcia
-- strict thread matches above, loose matches on Subject: below --
2017-02-09 9:58 Toon Claes
2017-02-09 13:22 ` Stefan Monnier
2017-02-14 13:57 ` Toon Claes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPfrtUdQCW8u1RnP+B_V4-stH81QR4nVg-cMTnAo_OFHsYJLyw@mail.gmail.com \
--to=jorge.garcia.gonzalez@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.