From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jorge Alberto Garcia Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax Date: Fri, 8 Jan 2016 08:11:10 -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 1452262360 1654 80.91.229.3 (8 Jan 2016 14:12:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Jan 2016 14:12:40 +0000 (UTC) Cc: Emacs developers To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 08 15:12:35 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 1aHXmJ-0003NV-72 for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2016 15:12:31 +0100 Original-Received: from localhost ([::1]:36265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHXmI-0006aM-Bi for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2016 09:12:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHXlf-0005UL-Q7 for emacs-devel@gnu.org; Fri, 08 Jan 2016 09:11:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHXle-0007ol-T8 for emacs-devel@gnu.org; Fri, 08 Jan 2016 09:11:51 -0500 Original-Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]:35553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHXle-0007oZ-PN for emacs-devel@gnu.org; Fri, 08 Jan 2016 09:11:50 -0500 Original-Received: by mail-oi0-x231.google.com with SMTP id l9so307225985oia.2 for ; Fri, 08 Jan 2016 06:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=VYKQmbLX4exlFmTiy9a+J2pkP5wDWQOOz2CbXwxc1p0=; b=AdtAmyP5xBMwEKwqWolv/PkZ9o+l5NLUN/AR0rpQtUL1MzfWvqTMXbNgq5P4bv5qBS uj7WMBTqnIxbrykFGjscty/2qfyb44R+EEBJ7TI+G+lxYSpLuldYic8v8MyRr6MWKjh7 tDfQaOy3MoWx8FFlNI8YXgNJ98kzjDZnCJL7+snAviAxC6iLJPe4ivXcmsgyIClafDUC iTjdioqSWiVtQNfP8kqIg2x0ZXe79UlFxHXf8YzaEwKKlgfal6kPErcksao0YA+L2vzJ SOH+9To8NZiX7pkflEm25ljKhbz038s+czYvCV7qmlh5u5I7o11IbuiipwMiE2rizm31 r+VA== X-Received: by 10.202.73.69 with SMTP id w66mr76525708oia.85.1452262310225; Fri, 08 Jan 2016 06:11:50 -0800 (PST) Original-Received: by 10.202.92.213 with HTTP; Fri, 8 Jan 2016 06:11:10 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::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:197827 Archived-At: On Fri, Jan 8, 2016 at 2:59 AM, Yuri Khan 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=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)])) > ``` 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 handli= ng.