unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el
@ 2022-10-29 11:58 Arash Esbati
  2022-10-29 12:45 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Arash Esbati @ 2022-10-29 11:58 UTC (permalink / raw)
  To: 58864

Hi all,

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.

Best, Arash





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el
  2022-10-29 11:58 bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el Arash Esbati
@ 2022-10-29 12:45 ` Eli Zaretskii
  2022-10-30  7:26   ` Jaft
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-10-29 12:45 UTC (permalink / raw)
  To: Arash Esbati, Jaft; +Cc: 58864

> From: Arash Esbati <arash@gnu.org>
> 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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el
  2022-10-29 12:45 ` Eli Zaretskii
@ 2022-10-30  7:26   ` Jaft
  2022-10-30  8:05     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Jaft @ 2022-10-30  7:26 UTC (permalink / raw)
  To: Arash Esbati, Eli Zaretskii; +Cc: 58864@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]

 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 <eliz@gnu.org> wrote:  
 
 > From: Arash Esbati <arash@gnu.org>
> 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?
  

[-- Attachment #2: Type: text/html, Size: 3686 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el
  2022-10-30  7:26   ` Jaft
@ 2022-10-30  8:05     ` Eli Zaretskii
  2022-10-30 11:42       ` Arash Esbati
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-10-30  8:05 UTC (permalink / raw)
  To: Jaft; +Cc: 58864, arash

> Date: Sun, 30 Oct 2022 07:26:34 +0000 (UTC)
> From: Jaft <jaft.r@outlook.com>
> Cc: "58864@debbugs.gnu.org" <58864@debbugs.gnu.org>
> 
> I'm not sure why this warning occurs? Can you not have unused arguments (marked as unused) in lexical
> scope?

You can, but the argument should indeed be marked as unused, by
prepending the '_' to its name.  Basil already did that, so the
problem is now solved.

> 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.

This explanation should be best put in a comment to that function, I
think.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el
  2022-10-30  8:05     ` Eli Zaretskii
@ 2022-10-30 11:42       ` Arash Esbati
  0 siblings, 0 replies; 5+ messages in thread
From: Arash Esbati @ 2022-10-30 11:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58864, Jaft

tags 58864 fixed
close 58864
thanks

Eli Zaretskii <eliz@gnu.org> writes:

> You can, but the argument should indeed be marked as unused, by
> prepending the '_' to its name.  Basil already did that, so the
> problem is now solved.

Yes, the issue is gone.  Closing and thanks to Basil for the prompt
action.

Best, Arash





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-30 11:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 11:58 bug#58864: 29.0.50; Warning when compiling emacs-lisp/hierarchy.el Arash Esbati
2022-10-29 12:45 ` Eli Zaretskii
2022-10-30  7:26   ` Jaft
2022-10-30  8:05     ` Eli Zaretskii
2022-10-30 11:42       ` Arash Esbati

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).