On 03/04/21 2:56 pm, Nicolas Goaziou wrote:
> Hello,
>
> Ramesh Nedunchezian <rameshnedunchez...@outlook.com> writes:
>
>> I was expecting that the linter report will be in
>> `compilation-minor-mode`.
>
> Well, it isn't, obviously.
>
>> With things as it is now, is there a way I can quickly move between
>> next or previous errors, when I am in _either_ of the source buffer or
>> the linter report?
>
> You move back to the linter report and proceed from there. I cannot
> think of any other way.
Here is an attempt.
(defun my-org-lint ()
(interactive)
(let* ((file (buffer-file-name))
(file (file-relative-name (buffer-file-name) default-directory))
(lint-alist (org-lint))
(inhibit-read-only t)
;; Choose a format that matches any of error regexps in
;; `compilation-error-regexp-alist-alist'
(msg-fmt "%f: line %l: %m"))
(with-current-buffer
(or
(get-buffer-create "*My Org Lint*"))
(pop-to-buffer
(current-buffer))
(erase-buffer)
(let ((filename (buffer-file-name)))
(save-excursion
(insert
(mapconcat #'identity
(cl-loop for (_ inf) in lint-alist collect
(pcase-let ((`[,line ,trust ,msg ,rest] inf))
(format-spec msg-fmt
(list
(cons ?f file)
(cons ?l line)
(cons ?t trust)
(cons ?m msg)))))
"\n"))))
(compilation-mode 1))))
Let myfile.org be a file with following content
* Getting the source
- Start with source that is cloned directly from Savannah[fn:1].
Using a clone of a clone does not work.
If you are a member of Emacs Project use,
#+begin_src
git clone <membername>@git.savannah.gnu.org:/srv/git/emacs/elpa.git
#+end_src
If you are not a member use,
#+begin_src shell
git clone https://git.savannah.gnu.org/git/emacs/elpa.git
#+end_src
- You must then do some setup:
#+begin_src
make setup
#+end_src
That leaves the =packages= directory empty; you must check out the
ones you want.
then
1. C-x C-f myfile.org
2. M-x my-org-lint
3. M-g M-n to move between the errors. M-g M-n would work both in
linter output buffer and the org source buffer
The advantage is you move to an error, fix it, then M-g M-n, fix it
and so on and so forth.