[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add emacsclient support to open with file:linum syntax

From: Jorge Alberto Garcia
Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax
Date: Fri, 8 Jan 2016 08:11:10 -0600

On Fri, Jan 8, 2016 at 2:59 AM, Yuri Khan <address@hidden> wrote:
> On Fri, Jan 8, 2016 at 2:08 PM, Jorge Alberto Garcia
>> We could extend the meaning of  '+' to indicate a linenum:column will
>> be present,
>> So we could use one of these syntax:
>> (new)      emacsclient  +  filepath:LINENUM:COL
>> (current) emacsclient  +LINENUM:COL filepath
> Or, you could solve your specific use case with a wrapper script and
> keep emacsclient’s CLI simple and unambiguous and avoid the need to
> invent more syntax.
> The script could look like this (which is not sophisticated enough to
> handle :DIGITS in options and may especially interfere with the
> --display option, but will get you a long way):
> ```
> #!/usr/bin/python
> import itertools
> import re
> import sys
> import subprocess
> RE_LINE_COL = re.compile(r'^(.*?)((?::[0-9]+){,2})$')
> sys.exit(subprocess.call(itertools.chain(
>     ['emacsclient'],
>     *[['+%s' % line_col[1:], filename] if line_col else [filename]
>        for arg in sys.argv[1:]
>        for filename, line_col in RE_LINE_COL.findall(arg)]))
> ```

I actually like this approach, I wrote and similar wrapper some time
ago tho this one
is more sophisticate

I guess this was my reason of why I wrote this patch, this way people
don't need to write scripts for something
like that, that as you mention can be more complex due to the digits handling.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]