all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jimka <jimka.velizy@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: how to make next-error work on non-grep non-compilation
Date: Fri, 20 May 2011 04:41:54 -0700 (PDT)	[thread overview]
Message-ID: <488618d5-7787-4c18-876d-622852f33350@k3g2000prl.googlegroups.com> (raw)

Hi elisp experts,  I have a file which contains grep/compilation style
output.
I'd like to insert that into an emacs buffer and provide the next-
error capability to the user.
I can't seem to make it work, but I feel like I'm almost there.

Any suggestions?  I cannot use the normal compile nor grep interface,
because the information in the mini-buffer is precious and cannot be
changed.  the compile-interface prints something like "compilation
finished" in the mini-buffer.

Here is what I have so far, which displays the file in the perspecitve
buffer, and colorizes it but next-error doesn't do anything useful.

(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))))
    (when interesting-output
      (display-buffer buf))))


             reply	other threads:[~2011-05-20 11:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20 11:41 jimka [this message]
2011-05-20 11:47 ` how to make next-error work on non-grep non-compilation Jim Newton
2011-05-20 12:53 ` Stefan Monnier
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=488618d5-7787-4c18-876d-622852f33350@k3g2000prl.googlegroups.com \
    --to=jimka.velizy@googlemail.com \
    --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.