From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: how to make next-error work on non-grep non-compilation
Date: Fri, 20 May 2011 09:53:25 -0300 [thread overview]
Message-ID: <jwvfwo9wnb9.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 488618d5-7787-4c18-876d-622852f33350@k3g2000prl.googlegroups.com
> 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
next prev parent reply other threads:[~2011-05-20 12:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-20 11:41 how to make next-error work on non-grep non-compilation jimka
2011-05-20 11:47 ` Jim Newton
2011-05-20 12:53 ` Stefan Monnier [this message]
2011-05-20 13:48 ` Jim Newton
2011-05-20 14:11 ` Stefan Monnier
2011-05-20 14:18 ` Jim Newton
2011-05-20 14:06 ` Jim Newton
2011-05-20 14:54 ` Jim Newton
2011-05-20 16:20 ` Stefan Monnier
2011-05-20 15:39 ` Ted Zlatanov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvfwo9wnb9.fsf-monnier+gnu.emacs.help@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=help-gnu-emacs@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.