You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using sharp-quoted functions with the :general-config keyword in a use-package declaration, flycheck raises warnings on some functions for possibly not being defined at runtime.
NB: In the following text, I am using user-defined key-definers tyrant-def and despot-def. They are both defined in the same manner as in the README, with the only difference being that despot-def has an additional (:major-modes t) declared.
An example of a use-package declaration for `org-roam', with only the relevant lines of codes:
All three functions, i.e., org-roam-buffer-toggle, org-roam-alias-add, and org-roam-make-permanent, raised the same warnings about the functions possibly not being defined at runtime. The last function is a function defined within the :config keyword (not in frame).
Note that the issue is also present in despot-def, which is made clear when the lines with warnings in tyrant-def are commented out:
Attempt 1 to Fix the Issue: Using the :functions keyword
My first attempt to fix the issue was to declare dummy functions with the same name, as suggested in the use-package documentation. An image of the result is as follows:
Now, only the issue with the user-defined function org-roam-make-permanent is resolved. The other two functions still remain.
Attempt 2 to Fix the Issue: Moving to the :config keyword
My next attempt was to simply push these keybindings into the :config keyword, with the hopes that the macro will be expanded in a way such as to ensure that these sharp-quoted functions are understood to be defined by the time the package actually loads. An image of the result is as follows:
Now, the user-defined key-definers raise warnings about not being known to be defined, whilst two other sharp-quoted functions raise warnings about possibly not being defined at runtime. The former is easily resolved by declaring dummy functions with the same name, but the latter remains even after doing so.
Attempt 3 to Fix the Issue: Using the :general keyword
My third attempt was instead, to use the :general keyword. An image of the result is as follows:
All is well! Sharp-quoted functions work without an issue, but I definitely do not need these keybindings to be defined before the package even loads.
I also noticed that using the :general keyword, there is no need to declare the functions in the :functions keyword as it automatically creates autoloads for these functions, as described here. An image of the result of removing the :functions keyword is as follows:
Attempt 4 to Fix the Issue: Removing the Sharp-quotations
My fourth attempt was to consider removing sharp quotations. This step is supposedly inconsequential since sharp-quoting a symbol that points to a function only serves to declare that the symbol points to a function. However, the result is not inconsequential in the image that follows:
All is well again! Removing the :functions keyword does not affect the result as well, as in the image that follows:
I will expand a little more about this in the next section.
Comments
Although a workaround to the warnings has been found in the fourth attempt, I would personally prefer to be able to use sharp-quotations to make it clear to myself which symbols point to functions. I also find it very curious that the action of sharp-quoting a symbol pointing to a function, which is supposedly inconsequential logically, is not idempotent when (presumably) expanded in a macro. I'm not sure where to begin to identify where the issue lies, but this is a bug that I think I have found and hope a resolution can be found for it soon, as the flycheck warnings are really not so pleasant to the eye.
The text was updated successfully, but these errors were encountered:
Describing the Issue and its Fixes
Using sharp-quoted functions with the
:general-config
keyword in ause-package
declaration,flycheck
raises warnings on some functions for possibly not being defined at runtime.NB: In the following text, I am using user-defined key-definers
tyrant-def
anddespot-def
. They are both defined in the same manner as in the README, with the only difference being thatdespot-def
has an additional(:major-modes t)
declared.An example of a
use-package
declaration for `org-roam', with only the relevant lines of codes:All three functions, i.e.,
org-roam-buffer-toggle
,org-roam-alias-add
, andorg-roam-make-permanent
, raised the same warnings about the functions possibly not being defined at runtime. The last function is a function defined within the:config
keyword (not in frame).Note that the issue is also present in
despot-def
, which is made clear when the lines with warnings intyrant-def
are commented out:Attempt 1 to Fix the Issue: Using the
:functions
keywordMy first attempt to fix the issue was to declare dummy functions with the same name, as suggested in the
use-package
documentation. An image of the result is as follows:Now, only the issue with the user-defined function
org-roam-make-permanent
is resolved. The other two functions still remain.Attempt 2 to Fix the Issue: Moving to the
:config
keywordMy next attempt was to simply push these keybindings into the
:config
keyword, with the hopes that the macro will be expanded in a way such as to ensure that these sharp-quoted functions are understood to be defined by the time the package actually loads. An image of the result is as follows:Now, the user-defined key-definers raise warnings about not being known to be defined, whilst two other sharp-quoted functions raise warnings about possibly not being defined at runtime. The former is easily resolved by declaring dummy functions with the same name, but the latter remains even after doing so.
Attempt 3 to Fix the Issue: Using the
:general
keywordMy third attempt was instead, to use the
:general
keyword. An image of the result is as follows:All is well! Sharp-quoted functions work without an issue, but I definitely do not need these keybindings to be defined before the package even loads.
I also noticed that using the
:general
keyword, there is no need to declare the functions in the:functions
keyword as it automatically creates autoloads for these functions, as described here. An image of the result of removing the:functions
keyword is as follows:Attempt 4 to Fix the Issue: Removing the Sharp-quotations
My fourth attempt was to consider removing sharp quotations. This step is supposedly inconsequential since sharp-quoting a symbol that points to a function only serves to declare that the symbol points to a function. However, the result is not inconsequential in the image that follows:
All is well again! Removing the
:functions
keyword does not affect the result as well, as in the image that follows:I will expand a little more about this in the next section.
Comments
Although a workaround to the warnings has been found in the fourth attempt, I would personally prefer to be able to use sharp-quotations to make it clear to myself which symbols point to functions. I also find it very curious that the action of sharp-quoting a symbol pointing to a function, which is supposedly inconsequential logically, is not idempotent when (presumably) expanded in a macro. I'm not sure where to begin to identify where the issue lies, but this is a bug that I think I have found and hope a resolution can be found for it soon, as the
flycheck
warnings are really not so pleasant to the eye.The text was updated successfully, but these errors were encountered: