From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Toon Claes Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax Date: Thu, 9 Feb 2017 10:58:01 +0100 Message-ID: <7F18527B-AF90-4B4B-A074-88D563559B1A@iotcl.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1486634344 22326 195.159.176.226 (9 Feb 2017 09:59:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Feb 2017 09:59:04 +0000 (UTC) Cc: jorge.garcia.gonzalez@gmail.com, eggert@cs.ucla.edu, monnier@iro.umontreal.ca, kaushal.modi@gmail.com To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 09 10:59:00 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cblVD-0005Tk-MB for ged-emacs-devel@m.gmane.org; Thu, 09 Feb 2017 10:58:59 +0100 Original-Received: from localhost ([::1]:36697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cblVH-0006Xr-S7 for ged-emacs-devel@m.gmane.org; Thu, 09 Feb 2017 04:59:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cblUT-0006Wf-OA for emacs-devel@gnu.org; Thu, 09 Feb 2017 04:58:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cblUO-0002uV-Qx for emacs-devel@gnu.org; Thu, 09 Feb 2017 04:58:13 -0500 Original-Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:33244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cblUO-0002u5-Lt for emacs-devel@gnu.org; Thu, 09 Feb 2017 04:58:08 -0500 Original-Received: from mfilter42-d.gandi.net (mfilter42-d.gandi.net [217.70.178.172]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 476CCA80CD; Thu, 9 Feb 2017 10:58:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter42-d.gandi.net Original-Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter42-d.gandi.net (mfilter42-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id B4zMgwVL3WXu; Thu, 9 Feb 2017 10:58:05 +0100 (CET) X-Originating-IP: 94.227.10.94 Original-Received: from [192.168.1.101] (94-227-10-94.access.telenet.be [94.227.10.94]) (Authenticated sender: toon@iotcl.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 41C0EA8102; Thu, 9 Feb 2017 10:58:02 +0100 (CET) X-Mailer: Apple Mail (2.3259) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4b98:c:538::195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:212157 Archived-At: On Thu, Mar 31, 2016 at 6:31 AM, Stefan Monnier wrote: > FWIW, I think we should try and arrange it so that the way emacsclient = and > server.el work together makes it possible to add such a new FILE:LINE > syntax via an ELPA package (even if it might require an advice). > > > Stefan I am a bit sad this patch didn=E2=80=99t get applied, but I understand. But I found this advice on SO: http://stackoverflow.com/a/3141456/89376 #+BEGIN_SRC emacs-lisp ;; Open files and goto lines like we see from g++ etc. i.e. file:line (defadvice find-file (around find-file-line-number (filename &optional wildcards) activate) "Turn files like file.cpp:14 into file.cpp and going to the 14-th = line." (save-match-data (let* ((matched (string-match "^\\(.*\\):\\([0-9]+\\):?$" filename)) (line-number (and matched (match-string 2 filename) (string-to-number (match-string 2 = filename)))) (filename (if matched (match-string 1 filename) filename))) ad-do-it (when line-number ;; goto-line is for interactive use (goto-char (point-min)) (forward-line (1- line-number)))))) #+END_SRC Unfortunately it does not work with emacsclient. So I could use some pointers on how to make it work with emacsclient. Would it be possible to achieve this with an advice, since the original patch was written in c. Regards, Toon=