Subject: bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el

From: Jaft <[email-masked]>
Date: Sun, 30 Oct 2022 07:26:34 +0000 (UTC)

I'm not sure why this warning occurs? Can you not have unused arguments (marked as unused) in lexical scope?
hierarchy--create-delayed-tree-widget calls widget-convert to create tree-widgets but, in the case of delayed children, provides an :expander to load when the child is called for; the :expander expects a function that can take a single argument: the widget you're making children for.I assume it's so your function can figure out what the children should be, depending on what the parent widget is.
However, Hierarchy already computes the children with the childrenfn a user can pass in so the parent widget is entirely unnecessary for us; so I marked is as unused by prefacing the variable name with an underscore, as I thought was the convention.
Is my understanding mistaken? Does it, say, have to only be an underscore for the argument rather than a name which starts with an underscore? I thought just starting with an underscore sufficed.    On Saturday, October 29, 2022 at 07:46:29 AM CDT, Eli Zaretskii <[email-masked]> wrote:  
 
 > From: Arash Esbati <[email-masked]>
> Date: Sat, 29 Oct 2022 13:58:45 +0200
> 
> building Emacs from master (f826f56a41) issues this warning:
> 
>  In hierarchy--create-delayed-tree-widget:
>  emacs-lisp/hierarchy.el:570:12: Warning: Unused lexical argument `widget'
> 
> I'm not familiar with the code, but I think this is due to commit
> c6ec08e49a and how `hierarchy--create-delayed-tree-widget' is defined.

Jonathan, could you please fix this?