emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add emacsclient support to open with file:linum syntax


From: Kaushal Modi
Subject: Re: [PATCH] add emacsclient support to open with file:linum syntax
Date: Fri, 8 Jan 2016 10:54:10 -0500

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]