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: Tue, 14 Feb 2017 14:57:45 +0100 Message-ID: <7EB59F19-1484-41A3-9D9B-3F5599A3EE8D@iotcl.com> References: <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=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1487080714 25645 195.159.176.226 (14 Feb 2017 13:58:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2017 13:58:34 +0000 (UTC) Cc: jorge.garcia.gonzalez@gmail.com, kaushal.modi@gmail.com, eggert@cs.ucla.edu, Emacs Devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 14 14:58:29 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 1cddcj-0006LS-3b for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2017 14:58:29 +0100 Original-Received: from localhost ([::1]:34998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cddco-0005GG-Ou for ged-emacs-devel@m.gmane.org; Tue, 14 Feb 2017 08:58:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cddcC-0005Ar-Ca for emacs-devel@gnu.org; Tue, 14 Feb 2017 08:58:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cddc9-0005XE-9e for emacs-devel@gnu.org; Tue, 14 Feb 2017 08:57:56 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:37594) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cddc9-0005Ug-2e for emacs-devel@gnu.org; Tue, 14 Feb 2017 08:57:53 -0500 Original-Received: from mfilter2-d.gandi.net (mfilter2-d.gandi.net [217.70.178.140]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 24437C5A77; Tue, 14 Feb 2017 14:57:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter2-d.gandi.net Original-Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter2-d.gandi.net (mfilter2-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id jdUIzwTBY8h1; Tue, 14 Feb 2017 14:57:48 +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 relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6E741C5A49; Tue, 14 Feb 2017 14:57:47 +0100 (CET) In-Reply-To: X-Mailer: Apple Mail (2.3259) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.194 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:212367 Archived-At: > On 9 Feb 2017, at 14:22, Stefan Monnier = wrote: >=20 > Put the advice on `find-file-noselect`? >=20 >=20 > Stefan Thanks a lot Stefan! This is in fact the working defadvice: #+begin_src emacs-lisp :tangle yes (defadvice find-file-noselect (around find-file-noselect-at-line (filename &optional nowarn = rawfile 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)) (buffer-name ad-do-it)) (when line-number (with-current-buffer buffer-name (goto-char (point-min)) (forward-line (1- line-number))))))) #+end_src Enjoy! Toon=