* [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
@ 2024-06-04 18:50 Suhail Singh
2024-06-05 13:07 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Suhail Singh @ 2024-06-04 18:50 UTC (permalink / raw)
To: emacs-orgmode
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
Any code block in a language that isn't intended to be executed results in a
warning from 'suspicious-language-in-src-block checker. For instance:
#+begin_src conf
[Unit]
Description=Blah
#+end_src
In the above example, conf-mode exists and is used by Org to provide
syntax highlighting and yet, org-lint reports a warning.
Emacs : GNU Emacs 29.3 (build 2, x86_64-suse-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
Package: Org mode version 9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)
--
Suhail
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-04 18:50 [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)] Suhail Singh
@ 2024-06-05 13:07 ` Ihor Radchenko
2024-06-05 13:37 ` Suhail Singh
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2024-06-05 13:07 UTC (permalink / raw)
To: Suhail Singh; +Cc: emacs-orgmode
"Suhail Singh" <suhailsingh247@gmail.com> writes:
> Any code block in a language that isn't intended to be executed results in a
> warning from 'suspicious-language-in-src-block checker. For instance:
>
> #+begin_src conf
> [Unit]
> Description=Blah
> #+end_src
>
> In the above example, conf-mode exists and is used by Org to provide
> syntax highlighting and yet, org-lint reports a warning.
Org mode has no idea which languages are intended to be executed, but
happen to not have their ob-lang.el backend loaded; and
which languages do not need execution. So, Org mode warns just in case.
You can always ignore this warning.
Not a bug.
Canceled.
(If you have better ideas about how to approach the problem of
misspelled language names, feel free to share them)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 13:07 ` Ihor Radchenko
@ 2024-06-05 13:37 ` Suhail Singh
2024-06-05 15:12 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Suhail Singh @ 2024-06-05 13:37 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> Org mode has no idea which languages are intended to be executed, but
> happen to not have their ob-lang.el backend loaded; and which
> languages do not need execution. So, Org mode warns just in case.
If the primary function of this check is to ensure that the user isn't
missing an ob-lang.el requirement, then I propose that the check be
renamed to something specific to babel. Perhaps
'suspcious-babel-language-in-src-block ?
> You can always ignore this warning.
I presently update (via setq) org-lint--checker after filtering out this
checker. Is there a better way (i.e., one that doesn't rely on an
internal variable) for non-interactive use? Perhaps an
#'org-lint-remove-checker could be added to org-lint.el. For context, I
have code that non-interactively invokes org-lint and reports the
warnings. As such, ignoring by pressing "i" in the *Org Lint* buffer
isn't an option.
> (If you have better ideas about how to approach the problem of
> misspelled language names, feel free to share them)
I don't have a recommendation specific to the languages that only
support code execution, however, for languages in general wouldn't it be
better to consult something like the output of #'org-src-get-lang-mode
and see if that mode is either defined or can be loaded (depending on
whether or not we require the user to ensure whether the feature
representing the mode is already loaded or simply that it be possible to
be loaded)?
--
Suhail
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 13:37 ` Suhail Singh
@ 2024-06-05 15:12 ` Ihor Radchenko
2024-06-05 16:04 ` Suhail Singh
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2024-06-05 15:12 UTC (permalink / raw)
To: Suhail Singh; +Cc: emacs-orgmode
Suhail Singh <suhailsingh247@gmail.com> writes:
>> You can always ignore this warning.
>
> I presently update (via setq) org-lint--checker after filtering out this
> checker. Is there a better way (i.e., one that doesn't rely on an
> internal variable) for non-interactive use? Perhaps an
> #'org-lint-remove-checker could be added to org-lint.el. For context, I
> have code that non-interactively invokes org-lint and reports the
> warnings. As such, ignoring by pressing "i" in the *Org Lint* buffer
> isn't an option.
There is currently no such way. Although, it would be nice to have such
a feature. Patches welcome!
>> (If you have better ideas about how to approach the problem of
>> misspelled language names, feel free to share them)
>
> I don't have a recommendation specific to the languages that only
> support code execution, however, for languages in general wouldn't it be
> better to consult something like the output of #'org-src-get-lang-mode
> and see if that mode is either defined or can be loaded (depending on
> whether or not we require the user to ensure whether the feature
> representing the mode is already loaded or simply that it be possible to
> be loaded)?
Thanks! It is indeed a good idea.
I added this check on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=51aea4946
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 15:12 ` Ihor Radchenko
@ 2024-06-05 16:04 ` Suhail Singh
2024-06-05 18:59 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Suhail Singh @ 2024-06-05 16:04 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 166 bytes --]
Ihor Radchenko <yantar92@posteo.net> writes:
> There is currently no such way. Although, it would be nice to have such
> a feature. Patches welcome!
See attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add org-lint-remove-checker --]
[-- Type: text/x-patch, Size: 1200 bytes --]
From 7d7a240d82202fcb3323453648dd2d8b78d22a6f Mon Sep 17 00:00:00 2001
From: Suhail <suhail@bayesians.ca>
Date: Wed, 5 Jun 2024 11:55:10 -0400
Subject: [PATCH] org-lint: Add function to remove checker(s)
* lisp/org-lint.el (org-lint-remove-checker): Remove one or more
checkers from org-lint--checkers.
TINYCHANGE
---
lisp/org-lint.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index aed774ee2..ec28f5255 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -159,6 +159,16 @@ (defun org-lint-add-checker
(seq-remove (lambda (c) (eq name (org-lint-checker-name c)))
org-lint--checkers))))
+;;;###autoload
+(defun org-lint-remove-checker (name &rest names)
+ "Remove checker(s) from linter.
+NAME is the unique check identifier, as a non-nil symbol. NAMES
+are additional check identifiers to be removed."
+ (let ((removelist (cons name names)))
+ (setq org-lint--checkers
+ (seq-remove (lambda (c) (memq (org-lint-checker-name c) removelist))
+ org-lint--checkers))))
+
\f
;;; Reports UI
base-commit: bb633b67400de67b37317b6ae0741034c196c8d9
--
2.45.1
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
> Thanks! It is indeed a good idea.
> I added this check on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=51aea4946
Thank you!
--
Suhail
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 16:04 ` Suhail Singh
@ 2024-06-05 18:59 ` Ihor Radchenko
2024-06-05 19:38 ` Suhail Singh
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2024-06-05 18:59 UTC (permalink / raw)
To: Suhail Singh; +Cc: emacs-orgmode
Suhail Singh <suhailsingh247@gmail.com> writes:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> There is currently no such way. Although, it would be nice to have such
>> a feature. Patches welcome!
>
> See attached.
Thanks!
> +;;;###autoload
> +(defun org-lint-remove-checker (name &rest names)
> + "Remove checker(s) from linter.
> +NAME is the unique check identifier, as a non-nil symbol. NAMES
> +are additional check identifiers to be removed."
> + (let ((removelist (cons name names)))
> + (setq org-lint--checkers
> + (seq-remove (lambda (c) (memq (org-lint-checker-name c) removelist))
> + org-lint--checkers))))
This would work, but it modifies the checker list destructively.
What about introducing some kind of selector variable instead?
Something like
org-lint-default-selector
= '((not misspelled-export-option) :categories export :trust high)
Then, we can make `org-lint' accept ARG to have this
`org-lint-default-selector' format, in addition to currently supported
list of checker names.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 18:59 ` Ihor Radchenko
@ 2024-06-05 19:38 ` Suhail Singh
2024-06-05 20:25 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Suhail Singh @ 2024-06-05 19:38 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> This would work, but it modifies the checker list destructively.
Yes, as does org-lint-add-checker. In the same vein,
org-lint-remove-checker is intended to be able to undo the "effect" of
one or more org-lint-add-checker invocations.
> What about introducing some kind of selector variable instead?
That could also work; there is more than one way to achieve the end.
However, I am not convinced that it's the "better" approach. It's
altering an existing API for, what I deem to be, little value.
--
Suhail
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 19:38 ` Suhail Singh
@ 2024-06-05 20:25 ` Ihor Radchenko
2024-06-05 23:49 ` Suhail Singh
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2024-06-05 20:25 UTC (permalink / raw)
To: Suhail Singh; +Cc: emacs-orgmode
Suhail Singh <suhailsingh247@gmail.com> writes:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> This would work, but it modifies the checker list destructively.
>
> Yes, as does org-lint-add-checker. In the same vein,
> org-lint-remove-checker is intended to be able to undo the "effect" of
> one or more org-lint-add-checker invocations.
Indeed. But I wanted to nudge you to do a bit better :)
>> What about introducing some kind of selector variable instead?
>
> That could also work; there is more than one way to achieve the end.
> However, I am not convinced that it's the "better" approach. It's
> altering an existing API for, what I deem to be, little value.
A new custom variable is not altering the existing API, it is extending
it. The extension is also not entirely out of nowhere - `org-lint'
already accepts a list of checkers as an argument.
Further, the distant goal is to implement integration of org-lint into
flycheck/flymake. And we do need user-level config for which checkers
should be enabled for "full" org-lint check and for "quick" check on the
fly then.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 20:25 ` Ihor Radchenko
@ 2024-06-05 23:49 ` Suhail Singh
2024-06-06 15:36 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Suhail Singh @ 2024-06-05 23:49 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Suhail Singh, emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> Indeed. But I wanted to nudge you to do a bit better :)
"Better" here is subjective and we have a difference in opinion, which
is okay. While I am not motivated to submit such an alternative patch,
I also am not aware of any common usecases that would become much more
complicated as a result of it.
> Further, the distant goal is to implement integration of org-lint into
> flycheck/flymake. And we do need user-level config for which checkers
> should be enabled for "full" org-lint check and for "quick" check on
> the fly then.
I am unfamiliar with flymake, but since flycheck checkers run in a
different Emacs process, the patch I sent is sufficient. FWIW, I have
been using an org-lint flycheck checker for several months now. The
code for the checker, if curious, is adapted from
<https://github.com/flycheck/flycheck/pull/2031>. If flymake doesn't
use a different Emacs process and your goal is to be able to support it
easily, it makes sense to extend the current API in a manner similar to
what you proposed.
--
Suhail
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]
2024-06-05 23:49 ` Suhail Singh
@ 2024-06-06 15:36 ` Ihor Radchenko
0 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2024-06-06 15:36 UTC (permalink / raw)
To: Suhail Singh; +Cc: emacs-orgmode
Suhail Singh <suhailsingh247@gmail.com> writes:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Indeed. But I wanted to nudge you to do a bit better :)
>
> "Better" here is subjective and we have a difference in opinion, which
> is okay. While I am not motivated to submit such an alternative patch,
> I also am not aware of any common usecases that would become much more
> complicated as a result of it.
Ok. I thus installed your patch - it is an improvement.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=96eb9f0b4
You are now listed as one of Org mode contributors:
https://git.sr.ht/~bzg/worg/commit/7f498b97
>> Further, the distant goal is to implement integration of org-lint into
>> flycheck/flymake. And we do need user-level config for which checkers
>> should be enabled for "full" org-lint check and for "quick" check on
>> the fly then.
>
> I am unfamiliar with flymake, but since flycheck checkers run in a
> different Emacs process, the patch I sent is sufficient.
They do not have to. And in Org mode case, it is not the best idea -
some checkers behave differently depending on which libraries are loaded
and Org mode syntax may be altered by user settings.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-06 16:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 18:50 [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)] Suhail Singh
2024-06-05 13:07 ` Ihor Radchenko
2024-06-05 13:37 ` Suhail Singh
2024-06-05 15:12 ` Ihor Radchenko
2024-06-05 16:04 ` Suhail Singh
2024-06-05 18:59 ` Ihor Radchenko
2024-06-05 19:38 ` Suhail Singh
2024-06-05 20:25 ` Ihor Radchenko
2024-06-05 23:49 ` Suhail Singh
2024-06-06 15:36 ` Ihor Radchenko
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).