From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Halliday Newsgroups: gmane.emacs.help Subject: Re: move point to first error, without opening target buffer Date: Thu, 24 Dec 2015 15:32:25 -0800 (PST) Message-ID: References: <4bd36afe-1422-4300-bbc2-fc516d780bd9@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1451000119 27302 80.91.229.3 (24 Dec 2015 23:35:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Dec 2015 23:35:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 25 00:35:19 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1aCFPj-00072t-6y for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Dec 2015 00:35:19 +0100 Original-Received: from localhost ([::1]:33731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCFPi-0002AX-CM for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Dec 2015 18:35:18 -0500 X-Received: by 10.98.64.195 with SMTP id f64mr23543682pfd.1.1450999946604; Thu, 24 Dec 2015 15:32:26 -0800 (PST) X-Received: by 10.50.114.163 with SMTP id jh3mr655724igb.1.1450999946515; Thu, 24 Dec 2015 15:32:26 -0800 (PST) Original-Path: usenet.stanford.edu!mv3no20787637igc.0!news-out.google.com!l1ni1412igd.0!nntp.google.com!mv3no20787626igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <4bd36afe-1422-4300-bbc2-fc516d780bd9@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2.101.49.251; posting-account=kRukCAoAAAANs-vsVh9dFwo5kp5pwnPz Original-NNTP-Posting-Host: 2.101.49.251 User-Agent: G2/1.0 Injection-Date: Thu, 24 Dec 2015 23:32:26 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:216181 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108471 Archived-At: On Thursday, 24 December 2015 23:15:33 UTC, Sam Halliday wrote: > Dear Emacs users, >=20 > I am using a package called `ag' as a faster replacement for grep (silver= searcher), installing the emacs package like so: >=20 > (use-package ag > :commands ag > :config > (add-hook 'ag-search-finished-hook 'next-error-no-select)) >=20 > for all intents and purposes, this could be any subprocess that uses the = `compile' support and search results are shown as "errors". >=20 > Ag has a hook (see above) which runs when the search is complete. What I'= m trying to do is to make the point jump to the first search result, so tha= t I don't have to manually `C-x o' and then `C-s' to the hits (sometimes th= e preamble can be quite long). >=20 > What I have above is nearly there, but it opens the first search result i= n a buffer and I don't want that. I just want the point to move to the firs= t hit so I can manually select which ones I care about. Reading through `si= mple.el' I'm pretty confused about how I can achieve that, could somebody p= lease help? >=20 > In addition, it would be far better if the hook was run when the first se= arch result (or "error") was detected. There doesn't appear to be a hook po= int for this, but maybe I'm wrong. Thanks to Sasha on #emacs for pointing me at compilation-next-error, used l= ike this in the hook, it works a treat! (defun next-match-jump () "Jump the point and user's focus to first match in a `compile'." (pop-to-buffer next-error-last-buffer) (compilation-next-error 1))