From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: how to make next-error work on non-grep non-compilation Date: Fri, 20 May 2011 09:53:25 -0300 Organization: A noiseless patient Spider Message-ID: References: <488618d5-7787-4c18-876d-622852f33350@k3g2000prl.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306269264 22422 80.91.229.12 (24 May 2011 20:34:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 May 2011 20:34:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 24 22:34:20 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QOyJ0-00065m-Vs for geh-help-gnu-emacs@m.gmane.org; Tue, 24 May 2011 22:34:19 +0200 Original-Received: from localhost ([::1]:39934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOyJ0-0007EK-E7 for geh-help-gnu-emacs@m.gmane.org; Tue, 24 May 2011 16:34:18 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Injection-Info: mx04.eternal-september.org; posting-host="XiIAvY72ZUxKiQYrt+73Dw"; logging-data="20321"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HJx4mxVbbxy5cGAJkSrxp" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:SDq9mR/sQCMcRRF4mYz4yvrrzfc= sha1:mh+zlJ36axwSWOH1WaSEHq7BCLc= Original-Xref: usenet.stanford.edu gnu.emacs.help:186871 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:81195 Archived-At: > Hi elisp experts, I have a file which contains grep/compilation style > output. Does its name have something specific to its format (e.g. it uses a particular extension)? > I'd like to insert that into an Emacs buffer and provide the next- > error capability to the user. Do you also want it to be editable at the same time? > I can't seem to make it work, but I feel like I'm almost there. Maybe you need to set compilation-error-regexp-alist. > Any suggestions? I cannot use the normal compile nor grep interface, > because the information in the mini-buffer is precious and cannot be > changed. Your code seems to add a "-*- grep -*-". If it can be added to the file rather than to the buffer, it can reduce the needed code even further. > (defun skill-vlint-present (file-name) > (let ((interesting-output nil) > (buf (get-buffer-create " vlint"))) > (with-current-buffer buf > (let ((inhibit-read-only t)) > (erase-buffer) > (compilation-shell-minor-mode t) > (setq compilation-auto-jump-to-first-error t) > (setq next-error-function `(lambda (n &optional reset) > (set-buffer ,buf) > (setq next-error-last- > buffer ,buf) > (compilation-next-error n > reset))) > (insert "-*- mode: " "grep-mode" > "; default-directory: " (prin1-to-string default- > directory) > " -*-\n\n") > (let ((pos (point-max))) > (insert-file-contents-literally file-name) > (setq interesting-output (not (equal pos (point-max))))) > (font-lock-fontify-buffer) > (goto-char 0) > (compilation-compat-parse-errors (point-max)))) Calling `compilation-compat-parse-errors' is a bad idea: just remove the call, it should not make any difference. I'd recommend you try something simpler based around something like: (let ((buf (find-file-noselect file-name))) (grep-mode)) -- Stefan