unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Toon Claes <toon@iotcl.com>
To: Emacs Devel <emacs-devel@gnu.org>
Cc: jorge.garcia.gonzalez@gmail.com, eggert@cs.ucla.edu,
	monnier@iro.umontreal.ca, kaushal.modi@gmail.com
Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax
Date: Thu, 9 Feb 2017 10:58:01 +0100	[thread overview]
Message-ID: <7F18527B-AF90-4B4B-A074-88D563559B1A@iotcl.com> (raw)

On Thu, Mar 31, 2016 at 6:31 AM, Stefan Monnier <address@hidden> 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’t 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


             reply	other threads:[~2017-02-09  9:58 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  9:58 Toon Claes [this message]
2017-02-09 13:22 ` [PATCH] add emacsclient support to open with file:linum syntax Stefan Monnier
2017-02-14 13:57   ` Toon Claes
  -- 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=7F18527B-AF90-4B4B-A074-88D563559B1A@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).