emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Lint multiple files at once
@ 2017-10-11 22:12 Luciano Passuello
  2017-10-12  1:48 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Luciano Passuello @ 2017-10-11 22:12 UTC (permalink / raw)
  To: emacs-orgmode

Hello all,

I love org-lint, but I couldn't find an easy way to get a report on
multiple files.
I'd like to analyze all files in a folder, getting all problems found
using a single command.

Any suggestions?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Lint multiple files at once
  2017-10-11 22:12 Lint multiple files at once Luciano Passuello
@ 2017-10-12  1:48 ` Nick Dokos
  2017-10-12 21:00   ` Luciano Passuello
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2017-10-12  1:48 UTC (permalink / raw)
  To: emacs-orgmode

Luciano Passuello <lucianop@litemind.com> writes:

> Hello all,
>
> I love org-lint, but I couldn't find an easy way to get a report on
> multiple files.
> I'd like to analyze all files in a folder, getting all problems found
> using a single command.
>
> Any suggestions?
>

Here's one way:

--8<---------------cut here---------------start------------->8---
(defun org-lint-dir (directory)
  (let* ((files (directory-files directory t ".*\\.org$")))
    (org-lint-list files)))

(defun org-lint-list (files)
  (cond (files
         (org-lint-file (car files))
         (org-lint-list (cdr files)))))

(defun org-lint-file (file)
  (let ((buf)
        (lint))
    (setq buf (find-file-noselect file))
    (with-current-buffer buf (if (setq lint (org-lint)) (print (list file lint))))))

(org-lint-dir "/home/nick/lib/org")
--8<---------------cut here---------------end--------------->8---

-- 
Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Lint multiple files at once
  2017-10-12  1:48 ` Nick Dokos
@ 2017-10-12 21:00   ` Luciano Passuello
  0 siblings, 0 replies; 3+ messages in thread
From: Luciano Passuello @ 2017-10-12 21:00 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi Nick,

Thank you very much, it works!
Being an elips newbie, it helped me a lot reading and understanding
your code snippet.
Next step is beautify the output, and send it to a buffer/file. I'll
try to do that myself as a learning exercise.

Regards




On Wed, Oct 11, 2017 at 10:48 PM, Nick Dokos <ndokos@gmail.com> wrote:
> Luciano Passuello <lucianop@litemind.com> writes:
>
>> Hello all,
>>
>> I love org-lint, but I couldn't find an easy way to get a report on
>> multiple files.
>> I'd like to analyze all files in a folder, getting all problems found
>> using a single command.
>>
>> Any suggestions?
>>
>
> Here's one way:
>
> --8<---------------cut here---------------start------------->8---
> (defun org-lint-dir (directory)
>   (let* ((files (directory-files directory t ".*\\.org$")))
>     (org-lint-list files)))
>
> (defun org-lint-list (files)
>   (cond (files
>          (org-lint-file (car files))
>          (org-lint-list (cdr files)))))
>
> (defun org-lint-file (file)
>   (let ((buf)
>         (lint))
>     (setq buf (find-file-noselect file))
>     (with-current-buffer buf (if (setq lint (org-lint)) (print (list file lint))))))
>
> (org-lint-dir "/home/nick/lib/org")
> --8<---------------cut here---------------end--------------->8---
>
> --
> Nick
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-12 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 22:12 Lint multiple files at once Luciano Passuello
2017-10-12  1:48 ` Nick Dokos
2017-10-12 21:00   ` Luciano Passuello

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).