From 0c7c5d2d9a65c4b0bf6261f2c69bb2df6012da70 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 26 Nov 2022 16:10:04 +0200 Subject: [PATCH] ADDED: make flymake optionally complain about implicit autoloads * sweeprolog.el (sweeprolog-note-implicit-autoloads): new user-option. (sweeprolog-analyze-fragment-flymake): use it. * README.org ("Managing Dependencies"): mention it. --- README.org | 7 +++++++ sweeprolog.el | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.org b/README.org index 2e29bec..c85916a 100644 --- a/README.org +++ b/README.org @@ -1157,6 +1157,13 @@ sweeprolog-update-dependencies~ bound to ~C-c C-u~. This command analyzes the current buffer and adds or updates ~autoload/2~ and ~use_module/2~ as needed. +#+VINDEX: sweeprolog-note-implicit-autoloads +By default, when ~flymake~ integration is enabled (see [[#diagnostics][Examining +diagnostics]]), calls to implicitly autoloaded predicates are detected +and marked as note-level diagnostics. To inhibit ~flymake~ from +diagnosing implicit autoloads, customize the user option +~sweeprolog-note-implicit-autoloads~ to nil. + * Prolog Help :PROPERTIES: :CUSTOM_ID: prolog-help diff --git a/sweeprolog.el b/sweeprolog.el index 4476f0f..b726e66 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -295,6 +295,12 @@ inserted to the input history in `sweeprolog-top-level-mode' buffers." :type 'boolean :group 'sweeprolog) +(defcustom sweeprolog-note-implicit-autoloads t + "If non-nil, `flymake' notes implicitly autoload predicates." + :package-version '((sweeprolog "0.9.2")) + :type 'boolean + :group 'sweeprolog) + (defcustom sweeprolog-enable-eldoc t "If non-nil, enable `eldoc' suport in `sweeprolog-mode' buffers." :package-version '((sweeprolog "0.4.7")) @@ -2062,6 +2068,12 @@ resulting list even when found in the current clause." (`("goal" "undefined" ,f ,a) (cons :warning (format "Undefined predicate %s/%s" f a))) + (`("goal" ("autoload" . ,file) . ,_) + (when sweeprolog-note-implicit-autoloads + (cons :note + (substitute-command-keys + (format "Implicit autoload from %s, use \\[sweeprolog-update-dependencies] to add dependecy directive" + file))))) ("instantiation_error" (cons :warning "Instantiation error")) ("type_error" -- 2.39.2