help-gnu-emacs
[Top][All Lists]
Advanced

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

how to make next-error work on non-grep non-compilation


From: jimka
Subject: how to make next-error work on non-grep non-compilation
Date: Fri, 20 May 2011 04:41:54 -0700 (PDT)
User-agent: G2/1.0

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 via email to

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