[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to make next-error work on non-grep non-compilation
From: |
Stefan Monnier |
Subject: |
Re: how to make next-error work on non-grep non-compilation |
Date: |
Fri, 20 May 2011 13:20:24 -0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> (defun skill-vlint-present (file-name)
> (let (size
> (vlint (get-buffer-create "vlint")))
> (with-current-buffer vlint
> (let ((inhibit-read-only t))
> (erase-buffer)
> (insert-file-contents-literally file-name)
> (when (setq size (- (point-max) (point-min)))
> (grep-mode))))
> (when (plusp size)
> (switch-to-buffer-other-window vlint))))
Looks much better than the code you sent before. Note that 0 when
interpreted as a boolean in Elisp is the same as true, so the
"(when (setq size (- (point-max) (point-min)))" will always call the
`grep-mode'. And you can use (buffer-size) instead of (- (point-max)
(point-min)). Oh, and I'd use (unless (zerop size)...) since `plusp' is
not standard Elisp but only provided by the CL library.
Stefan
Re: how to make next-error work on non-grep non-compilation, Ted Zlatanov, 2011/05/24