unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Toon Claes <toon@iotcl.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: jorge.garcia.gonzalez@gmail.com, kaushal.modi@gmail.com,
	eggert@cs.ucla.edu, Emacs Devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax
Date: Tue, 14 Feb 2017 14:57:45 +0100	[thread overview]
Message-ID: <7EB59F19-1484-41A3-9D9B-3F5599A3EE8D@iotcl.com> (raw)
In-Reply-To: <jwv1sv733ew.fsf-monnier+emacs@gnu.org>


> On 9 Feb 2017, at 14:22, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
> Put the advice on `find-file-noselect`?
> 
> 
>        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


  reply	other threads:[~2017-02-14 13:57 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  9:58 [PATCH] add emacsclient support to open with file:linum syntax Toon Claes
2017-02-09 13:22 ` Stefan Monnier
2017-02-14 13:57   ` Toon Claes [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-01-07 22:35 Jorge Alberto Garcia
2016-01-08  7:42 ` Yuri Khan
2016-01-08  8:08   ` Jorge Alberto Garcia
2016-01-08  8:59     ` Yuri Khan
2016-01-08 14:11       ` Jorge Alberto Garcia
2016-01-08  9:03   ` Eli Zaretskii
2016-01-08 14:13     ` Jorge Alberto Garcia
2016-01-08 15:39       ` Eli Zaretskii
2016-01-08 15:54         ` Kaushal Modi
2016-01-08 16:13           ` Jorge Alberto Garcia
2016-01-08 16:38             ` Kaushal Modi
2016-01-08 16:44               ` Jorge Alberto Garcia
2016-01-08 16:54                 ` Kaushal Modi
2016-01-08 17:52                   ` Jorge Alberto Garcia
2016-01-08 19:06                     ` Eli Zaretskii
2016-01-08 19:05                   ` Eli Zaretskii
2016-01-12 21:04                     ` John Wiegley
2016-01-12 21:26                       ` Jorge Alberto Garcia
2016-01-13  0:10                         ` John Wiegley
2016-01-13  0:46                           ` Jorge Alberto Garcia
2016-03-29 16:22                             ` Kaushal Modi
2016-03-29 17:30                               ` Jorge Alberto Garcia
2016-03-29 21:27                                 ` Paul Eggert
2016-03-29 22:35                                   ` Kaushal Modi
2016-03-29 23:08                                     ` Paul Eggert
2016-03-29 23:29                                       ` Jorge Alberto Garcia
2016-03-30  0:37                                         ` Paul Eggert
2016-03-30 14:21                                           ` Kaushal Modi
2016-03-30 16:42                                             ` Jorge Alberto Garcia
2016-03-31 12:31                                             ` Stefan Monnier
2016-03-31 14:24                                               ` Jorge Alberto Garcia
2016-01-08 19:19                   ` David Caldwell
2016-01-08 19:43                     ` Eli Zaretskii
2016-01-08 19:52                       ` David Caldwell
2016-01-08 20:33                         ` Jorge Alberto Garcia
2016-01-09 22:51                           ` Jorge Alberto Garcia
2016-01-10  8:22                             ` Yuri Khan
2016-01-10  8:37                               ` Jorge Alberto Garcia
2016-01-12 16:24                                 ` Jorge Alberto Garcia
2016-01-08 16:10         ` Jorge Alberto Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7EB59F19-1484-41A3-9D9B-3F5599A3EE8D@iotcl.com \
    --to=toon@iotcl.com \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jorge.garcia.gonzalez@gmail.com \
    --cc=kaushal.modi@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).