From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax Date: Fri, 8 Jan 2016 14:59:44 +0600 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1452243632 12720 80.91.229.3 (8 Jan 2016 09:00:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Jan 2016 09:00:32 +0000 (UTC) Cc: Emacs developers To: Jorge Alberto Garcia Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 08 10:00:31 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aHSuM-0001Gb-0p for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2016 10:00:30 +0100 Original-Received: from localhost ([::1]:34574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHSuG-000321-DJ for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2016 04:00:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHStx-0002yL-Gr for emacs-devel@gnu.org; Fri, 08 Jan 2016 04:00:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHStw-0003Ji-Ny for emacs-devel@gnu.org; Fri, 08 Jan 2016 04:00:05 -0500 Original-Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:35374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHStw-0003Hg-Hc for emacs-devel@gnu.org; Fri, 08 Jan 2016 04:00:04 -0500 Original-Received: by mail-lf0-x231.google.com with SMTP id c192so171346519lfe.2 for ; Fri, 08 Jan 2016 01:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=Y8Zd+/XDExW+JvDex0ylYpn48Hy5ZPEwisDXOLKdb2I=; b=rY7vhaka5HR7wLhjdgkLbJZ2BhWoBC8HtbEhpKkhI1lgABzn30/V9VP4hz2SX9RoQE I+FhDC82Q/qZwpTmiAnePBLPOq2HB6Tkv06NG5fp42WgYzBZ1N5Qv6boKMRFFhMAKNDE 0zAFQ+3gKhnQ9gPk59p7S+grIIbEZ+eV5kt7Q2s7vG7CTtj/xZvDtrt+jiLlzdjYy0Ol WmcZQY3blRCILzuIS0VhiycOjL0BpdxfDFZkTscWEu3uZYaeTWNolfoUhk1IRfsx2VxO aBgu/y4y3kszp01VG2UOMoKz6OmImpr+or/vEow8egdyp2PlDwgbxjnund81qgfRonAU QBfA== X-Received: by 10.25.165.133 with SMTP id o127mr30967361lfe.105.1452243603685; Fri, 08 Jan 2016 01:00:03 -0800 (PST) Original-Received: by 10.112.129.163 with HTTP; Fri, 8 Jan 2016 00:59:44 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: EAOUnwkIR0qYjtwISvCbt3FU8eI X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:197806 Archived-At: 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=E2=80=99s 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 =3D 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)])) ```