From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [RFC] Org linting library Date: Wed, 20 May 2015 23:15:08 +0200 Message-ID: References: <87a8y4fdmv.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvBKe-0007hW-Fu for emacs-orgmode@gnu.org; Wed, 20 May 2015 17:15:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvBKZ-0005pH-NU for emacs-orgmode@gnu.org; Wed, 20 May 2015 17:15:16 -0400 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:36519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvBKZ-0005pC-Dg for emacs-orgmode@gnu.org; Wed, 20 May 2015 17:15:11 -0400 Received: by wgbgq6 with SMTP id gq6so65938435wgb.3 for ; Wed, 20 May 2015 14:15:10 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Leha Cc: "emacs-orgmode@gnu.org" Envoy=C3=A9 de mon iPhone > Le 20 mai 2015 =C3=A0 22:42, Andreas Leha a =C3=A9crit : >=20 > Hi Rainer, >=20 > Rainer M Krug writes: >> Rainer M Krug writes: >>=20 >>> Rainer M Krug writes: >>>=20 >>>> Andreas Leha writes: >>>>=20 >>>>> Hi Rainer, >>>>>=20 >>>>> Rainer M Krug writes: >>>>>> Nicolas Goaziou writes: >>>>>>=20 >>>>>>> Hello, >>>>>>>=20 >>>>>>> The following library implements linting for Org syntax. The sole pu= blic >>>>>>> function is `org-lint', which see. >>>>>>>=20 >>>>>>> Internally, the library defines a new structure: `org-lint-checker',= >>>>>>> with the following slots: >>>>>>>=20 >>>>>>> - NAME: Unique check identifier, as a symbol. The check is done >>>>>>> calling the function `org-lint-NAME' with one mandatory argument,= >>>>>>> the parse tree describing the current Org buffer. Such function >>>>>>> calls are wrapped within a `save-excursion' and point is always a= t >>>>>>> `point-min'. Its return value has to be an alist (POSITION MESSAG= E) >>>>>>> when POSITION refer to the buffer position of the error, as an >>>>>>> integer, and MESSAGE is a strings describing the error. >>>>>>>=20 >>>>>>> - DESCRIPTION: Summary about the check, as a string. >>>>>>>=20 >>>>>>> - CATEGORIES: Categories relative to the check, as a list of symbol= . >>>>>>> They are used for filtering when calling `org-lint'. Checkers not= >>>>>>> explicitly associated to a category are collected in the `default= ' >>>>>>> one. >>>>>>>=20 >>>>>>> - TRUST: The trust level one can have in the check. It is either `l= ow' >>>>>>> or `high', depending on the heuristics implemented and the nature= of >>>>>>> the check. This has an indicative value only and is displayed alo= ng >>>>>>> reports. >>>>>>>=20 >>>>>>> All checks have to be listed in `org-lint--checkers'. >>>>>>>=20 >>>>>>> Results are displayed in a special "*Org Lint*" buffer with a dedica= ted >>>>>>> major mode, derived from `tabulated-list-mode'. In addition to the u= sual >>>>>>> key-bindings inherited from it, "C-j" displays problematic line repo= rted >>>>>>> under point and "RET" jumps to it. >>>>>>>=20 >>>>>>> Checks currently implemented are: >>>>>>>=20 >>>>>>> - duplicates CUSTOM_ID properties >>>>>>> - duplicate NAME values >>>>>>> - duplicate targets >>>>>>> - duplicate footnote definitions >>>>>>> - orphaned affiliated keywords >>>>>>> - obsolete affiliated keywords >>>>>>> - missing language in src blocks >>>>>>> - NAME values with a colon >>>>>>> - wrong header arguments in src blocks >>>>>>> - misuse of CATEGORY keyword >>>>>>> - "coderef" links with unknown destination >>>>>>> - "custom-id" links with unknown destination >>>>>>> - "fuzzy" links with unknown destination >>>>>>> - "id" links with unknown destination >>>>>>> - links to non-existent local files >>>>>>> - special properties in properties drawer >>>>>>> - obsolete syntax for PROPERTIES drawers >>>>>>> - missing definition for footnote references >>>>>>> - missing reference for footnote definitions >>>>>>> - non-footnote definitions in footnote section >>>>>>> - probable invalid keywords >>>>>>> - invalid blocks >>>>>>> - probable incomplete drawers >>>>>>> - obsolete QUOTE section >>>>>>>=20 >>>>>>> Since it relies on lexical binding, `pcase' and `string-prefix-p', i= t >>>>>>> cannot be added to Org 8.3, but can make it into Org 8.4, if deemed >>>>>>> useful enough. >>>>>>=20 >>>>>> This sounds very interesting and I would like to try it out. I >>>>>> understand that it can't be put into master, but could it be put into= a >>>>>> branch? >>>>>>=20 >>>>>> This would make testing a bit easier. >>>>>=20 >>>>> It is. The branch is called `wip-lint'. >>>>=20 >>>> Thanks (also to Nicolas) - I found it. Just expected the branch to be >>>> tracked automatically. >>>>=20 >>>> This is really brilliant! >>>>=20 >>>> But I now get a message in one .org file: >>>>=20 >>>> ,---- >>>> | Org linting process starting... >>>> | Search failed: "^[ ]*#\\+NAME: +tab:sensVar" >>>> `---- >>>>=20 >>>> and no results. >>>>=20 >>>> Works in other .org files. >>>>=20 >>>> This one is rather long (11570 lines) and many code blocks. >>>>=20 >>>> Just let me know how I can trace down where this is coming from and wha= t >>>> the message tells me. >>>=20 >>> It seems that the error comes from the fact that ~#+LABEL: sensVar~ was >>> defined twice. >>>=20 >>> Renaming these results in working linting. >>=20 >> OK - please ignore this last comment. >>=20 >> There is an example where I get the error: >>=20 >> * Fitting the kernel to the data >> The parameter which will be fitted can be found in Table [[tab:fitInitial= ]] >>=20 >> #+CAPTION: Variables used for the initial fit of the wind profile using t= he function and the initial values. >> #+LABEL: tab:fitInitial >> | variable | initial value | remark = | >> |--------------------+---------------+-----------------------------------= ---------------| >>=20 >> The cause is the link [[tab:initial]] If I remove everything below and >> including the line #+CAPTION the linting works. >>=20 >> ,---- >> | 2 high Unknown fuzzy location "tab:fitInitial" >> `---- >=20 > Untested - but should that not be > #+NAME: tab:fitInitial > rather than #+LABEL? >=20 Yes - that would be correct. But the linting should tell me that instead of f= ailing with this message=20 Cheers, Rainer > Cheers, > Andreas >=20 >=20