emacs-devel
[Top][All Lists]
Advanced

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

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


From: Yuri Khan
Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax
Date: Fri, 8 Jan 2016 14:59:44 +0600

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)]))
```



reply via email to

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