From: Eshel Yaron Date: Sat, 26 Nov 2022 14:10:04 +0000 (+0200) Subject: ADDED: make flymake optionally complain about implicit autoloads X-Git-Tag: V9.1.0-sweep-0.9.2~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0c7c5d2d9a65c4b0bf6261f2c69bb2df6012da70;p=sweep.git 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. --- 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"