From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax Date: Fri, 8 Jan 2016 10:54:10 -0500 Message-ID: References: <838u40qw8j.fsf@gnu.org> <837fjkozax.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2abe475a2280528d49b33 X-Trace: ger.gmane.org 1452268525 11012 80.91.229.3 (8 Jan 2016 15:55:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Jan 2016 15:55:25 +0000 (UTC) Cc: Jorge Alberto Garcia , Yuri Khan , Emacs developers To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 08 16:55:24 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 1aHZNo-0000r5-09 for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2016 16:55:20 +0100 Original-Received: from localhost ([::1]:37015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHZNn-0001xm-F9 for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2016 10:55:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHZNN-0001sM-HP for emacs-devel@gnu.org; Fri, 08 Jan 2016 10:54:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHZNM-0006jZ-8Z for emacs-devel@gnu.org; Fri, 08 Jan 2016 10:54:53 -0500 Original-Received: from mail-ob0-x230.google.com ([2607:f8b0:4003:c01::230]:35439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHZNK-0006iv-Hn; Fri, 08 Jan 2016 10:54:50 -0500 Original-Received: by mail-ob0-x230.google.com with SMTP id xn1so83033809obc.2; Fri, 08 Jan 2016 07:54: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; bh=TJHG34NMRIWGggFOQgXtE3LdxTszdGMf9FheEgPho7s=; b=tYk2SKLiWE0NBJScwpPCerDmpY7QPGv4bCAxi5FreB9SkIsNP2Bt5rZ+xxOMfT08mm HZjZhWYhK0oYf4fgfewwIwaQhR2JZv0uoUhdKKHnCBANuEddNVSlyo518bfdHvLRS7L1 vRNvx5hFgzH3VyO0fFN4weM6Ahp07SxWORomCAl7NvHTv9bNy8RYzUAUp/kiLGyttm8Q OQ+ALIoNdZjmGzcT4rCAlcxNB96yp784W22i8UqWwhWQ75NLb8TglZ0D52rtI4FsXbbM YKV8ayOBKbXkVGEWQz3fPw9Z8tDui8lpCXnD5VzAyuNnKu9jHPv7Eboh+Bs6b3FpQxC6 gfIA== X-Received: by 10.182.245.167 with SMTP id xp7mr77933119obc.63.1452268489906; Fri, 08 Jan 2016 07:54:49 -0800 (PST) Original-Received: by 10.202.201.78 with HTTP; Fri, 8 Jan 2016 07:54:10 -0800 (PST) In-Reply-To: <837fjkozax.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c01::230 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:197834 Archived-At: --001a11c2abe475a2280528d49b33 Content-Type: text/plain; charset=UTF-8 As Yuri said, I just have a wrapper to provide the line number to emacsclient appropriately. Here's my csh alias: ===== # (P)ercol $SEARCHLOG created by (AG)/ack and open emacs at matched (L)ine # below alias helps quickly open one of the files from the list of files # that matched the last 'ag'. Awesomeness is that the file opens in emacs # at the matched line! alias pagl 'cat ${SEARCHLOG} | percol --query=\!* | \\ (e2 `awk -F: '"'"'{ if ( $2 ) {print "+" $2 " " $1} else {print} }'"'"'` &)' ===== (1) $SEARCHLOG is a temporary file containing the output of ag[1] Here's a sample $SEARCHLOG file: setup-misc.el:226: ("C-t" toggle-theme) setup-htmlize.el:23: ;; theme, the squiggly underlines can either show up in the html file setup-fci.el:66:Running this function after changing themes updates the fci rule color in setup-linum.el:41:background color to that of the theme." setup-visual.el:13:;; Themes setup-visual.el:46:(defvar dark-theme t setup-visual.el:47: "Variable to store the nature of theme whether it is light or dark. setup-visual.el:48:This variable is to be updated when changing themes.") (2) percol[2] is a command line utility to allow ido-vertical-like selection from terminal (3) e2 is my alias for "emacsclient -a '' \!* >& /dev/null" (4) That awk snippet is what rearranges the FILE:LINENUM in $SEARCHLOG to +LINENUM FILE when providing the arguments to e2. [1]: https://github.com/ggreer/the_silver_searcher [2]: https://github.com/mooz/percol --001a11c2abe475a2280528d49b33 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
As Yuri said, I just have a wra= pper to provide the line number to emacsclient appropriately.

Here's my csh a= lias:

= =3D=3D=3D=3D=3D

# (P)ercol $SEARCHLOG created by (AG)/= ack and open emacs at matched (L)ine
# belo= w alias helps quickly open one of the files from the list of files
# that matched the last 'ag'. Awesomeness i= s that the file opens in emacs
# at the mat= ched line!
alias pagl =C2=A0'cat ${SEAR= CHLOG} | percol --query=3D\!* | \\
=C2=A0 = =C2=A0 =C2=A0 (e2 `awk -F: '"'"'{ if ( $2 ) {print &q= uot;+" $2 " " $1} else {print} }'"'"'`= &)'

=3D=3D=3D=3D=3D

<= div>(1)

$SEARCHLOG is a temporary file containing = the output of ag[1]

Here's a sample $SEARCHLOG= file:

setup-misc.el:226: =C2=A0("C-t&qu= ot; =C2=A0 toggle-theme)
setup-htmlize.el:23: =C2=A0 =C2=A0 =C2= =A0;; theme, the squiggly underlines can either show up in the html file
setup-fci.el:66:Running this function after changing themes updates= the fci rule color in
setup-linum.el:41:background color to that= of the theme."
setup-visual.el:13:;; =C2=A0Themes
setup-visual.el:46:(defvar dark-theme t
setup-visual.el:47: =C2= =A0"Variable to store the nature of theme whether it is light or dark.=
setup-visual.el:48:This variable is to be updated when changing = themes.")

(2)

= percol[2] is a command line utility to allow ido-vertical-like selection fr= om terminal

(3)

e2 is my = alias for "emacsclient -a '' \!* >& /dev/null"=C2= =A0

(4)

That awk snippet = is what rearranges the FILE:LINENUM in $SEARCHLOG to +LINENUM FILE when pro= viding the arguments to e2.



--001a11c2abe475a2280528d49b33--