GNU bug report logs - #79390
31.0.50; oauth2.el; error in byte-compiling

Previous Next

Package: emacs;

Reported by: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>

Date: Fri, 5 Sep 2025 15:32:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 79390 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79390; Package emacs. (Fri, 05 Sep 2025 15:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 05 Sep 2025 15:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; oauth2.el; error in byte-compiling
Date: Sat, 06 Sep 2025 00:30:03 +0900
When I byte-compile oauth2.el (0.18), below errors and warnings are
displayed and fail to byte-compiling.


In oauth2--build-url-param-str:
oauth2.el:164:12: Error: ‘add-to-list’ can’t use lexical var ‘data-list’;
    use ‘push’ or ‘cl-pushnew’

In oauth2--generate-code-verifier:
oauth2.el:187:11: Warning: Unused lexical variable ‘func-name’

In oauth2-request-authorization:
oauth2.el:223:16: Error: ‘add-to-list’ can’t use lexical var ‘param’; use
    ‘push’ or ‘cl-pushnew’

In end of data:
oauth2.el:124:8: Warning: the function ‘org-plist-delete’ is not known to be
    defined.


-- 
Kazuhiro Ito




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79390; Package emacs. (Fri, 05 Sep 2025 17:31:01 GMT) Full text and rfc822 format available.

Message #8 received at 79390 <at> debbugs.gnu.org (full text, mbox):

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: 79390 <at> debbugs.gnu.org, Xiyue Deng <manphiz <at> gmail.com>
Subject: Re: bug#79390: 31.0.50; oauth2.el; error in byte-compiling
Date: Fri, 05 Sep 2025 18:30:32 +0100
Hello,

Thanks.  Adding Xiyue.

On Sat 06 Sep 2025 at 12:30am +09, Kazuhiro Ito wrote:

> When I byte-compile oauth2.el (0.18), below errors and warnings are
> displayed and fail to byte-compiling.
>
>
> In oauth2--build-url-param-str:
> oauth2.el:164:12: Error: ‘add-to-list’ can’t use lexical var ‘data-list’;
>     use ‘push’ or ‘cl-pushnew’
>
> In oauth2--generate-code-verifier:
> oauth2.el:187:11: Warning: Unused lexical variable ‘func-name’
>
> In oauth2-request-authorization:
> oauth2.el:223:16: Error: ‘add-to-list’ can’t use lexical var ‘param’; use
>     ‘push’ or ‘cl-pushnew’
>
> In end of data:
> oauth2.el:124:8: Warning: the function ‘org-plist-delete’ is not known to be
>     defined.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79390; Package emacs. (Sat, 06 Sep 2025 00:02:03 GMT) Full text and rfc822 format available.

Message #11 received at 79390 <at> debbugs.gnu.org (full text, mbox):

From: Xiyue Deng <manphiz <at> gmail.com>
To: Sean Whitton <spwhitton <at> spwhitton.name>, Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: 79390 <at> debbugs.gnu.org
Subject: Re: bug#79390: 31.0.50; oauth2.el; error in byte-compiling
Date: Fri, 05 Sep 2025 17:01:28 -0700
[Message part 1 (text/plain, inline)]
Hi Ito-san, Sean,

Sean Whitton <spwhitton <at> spwhitton.name> writes:

> Hello,
>
> Thanks.  Adding Xiyue.
>
> On Sat 06 Sep 2025 at 12:30am +09, Kazuhiro Ito wrote:
>
>> When I byte-compile oauth2.el (0.18), below errors and warnings are
>> displayed and fail to byte-compiling.
>>
>>
>> In oauth2--build-url-param-str:
>> oauth2.el:164:12: Error: ‘add-to-list’ can’t use lexical var ‘data-list’;
>>     use ‘push’ or ‘cl-pushnew’
>>
>> In oauth2--generate-code-verifier:
>> oauth2.el:187:11: Warning: Unused lexical variable ‘func-name’
>>
>> In oauth2-request-authorization:
>> oauth2.el:223:16: Error: ‘add-to-list’ can’t use lexical var ‘param’; use
>>     ‘push’ or ‘cl-pushnew’
>>
>> In end of data:
>> oauth2.el:124:8: Warning: the function ‘org-plist-delete’ is not known to be
>>     defined.
>
> -- 
> Sean Whitton

Thanks for the report!  I have now pushed a few fixes which should
handle those warnings/errors plus a few other fixes.  I have also added
build checks in Gitlab CI.  Now tagged v0.18.1.  Please help check
whether those fixes work for you.

-- 
Regards,
Xiyue Deng
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79390; Package emacs. (Sat, 06 Sep 2025 06:38:03 GMT) Full text and rfc822 format available.

Message #14 received at 79390 <at> debbugs.gnu.org (full text, mbox):

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: Xiyue Deng <manphiz <at> gmail.com>
Cc: 79390 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#79390: 31.0.50; oauth2.el; error in byte-compiling
Date: Sat, 06 Sep 2025 15:37:45 +0900
[Message part 1 (text/plain, inline)]
> >> When I byte-compile oauth2.el (0.18), below errors and warnings are
> >> displayed and fail to byte-compiling.
(snip)

> Thanks for the report!  I have now pushed a few fixes which should
> handle those warnings/errors plus a few other fixes.  I have also added
> build checks in Gitlab CI.  Now tagged v0.18.1.  Please help check
> whether those fixes work for you.

I've tested on 0.18.2 and confirmed errors and warnings were fixed,
thank you.
But I have one question.  

In oauth2--update-request-cache, 

> (when host-name
>   (let ((host-name (intern host-name)))
>     (org-plist-delete request-cache host-name)
>     (setq request-cache
>         (plist-put request-cache host-name
>                    `( :access-token ,access-token
>                       :request-timestamp ,request-timestamp)))))
> request-cache)

org-plist-delete returns newly created plist and doesn't modify
arguement PLIST, so it does nothing in the above code.  Moreover,
because next plist-put set new property value, it is no need to delete
old property value explicitly.

Please see attached patch.

-- 
Kazuhiro Ito
[0001-oauth2.el-oauth2-update-request-cache-Remove-unneede.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79390; Package emacs. (Sat, 06 Sep 2025 09:24:02 GMT) Full text and rfc822 format available.

Message #17 received at 79390 <at> debbugs.gnu.org (full text, mbox):

From: Xiyue Deng <manphiz <at> gmail.com>
To: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: 79390 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#79390: 31.0.50; oauth2.el; error in byte-compiling
Date: Sat, 06 Sep 2025 02:22:50 -0700
[Message part 1 (text/plain, inline)]
Hi Ito-san,

Kazuhiro Ito <kzhr <at> d1.dion.ne.jp> writes:

>> >> When I byte-compile oauth2.el (0.18), below errors and warnings are
>> >> displayed and fail to byte-compiling.
> (snip)
>
>> Thanks for the report!  I have now pushed a few fixes which should
>> handle those warnings/errors plus a few other fixes.  I have also added
>> build checks in Gitlab CI.  Now tagged v0.18.1.  Please help check
>> whether those fixes work for you.
>
> I've tested on 0.18.2 and confirmed errors and warnings were fixed,
> thank you.
> But I have one question.  
>
> In oauth2--update-request-cache, 
>
>> (when host-name
>>   (let ((host-name (intern host-name)))
>>     (org-plist-delete request-cache host-name)
>>     (setq request-cache
>>         (plist-put request-cache host-name
>>                    `( :access-token ,access-token
>>                       :request-timestamp ,request-timestamp)))))
>> request-cache)
>
> org-plist-delete returns newly created plist and doesn't modify
> arguement PLIST, so it does nothing in the above code.

Hmm, when I look at the `org-plist-delete' doc in my 30.1 it seems to
suggest it does remove in-place:

,----
| (org-plist-delete PLIST PROPERTY)
| 
| Delete PROPERTY from PLIST.
| This is in contrast to merely setting it to 0.
`----

And on my test in a previous version of code it did seem to work (for my
kinda wrong usage.  See below.)

> Moreover,
> because next plist-put set new property value, it is no need to delete
> old property value explicitly.

I think you are correct here.

[ Well the full story is a bit long: previously I used a string as the
  key for plist, which partially works because you can use `plist-get'
  with `string=' so that you can get the value back, but when doing
  `plist-put' I forgot to add a predicate which ended up with many
  entries with the same string key.  Well I could have fixed it by
  adding the predicate, but it was probably quite late in the night and
  somehow I ended up trying to remove all previous entries before adding
  a new one using `org-plist-delete', which also worked. ]

Anyway, now I use interned account string as keys (which I think should
be faster than using strings with `string=') so `plist-put' should just
DTRT, and `org-plist-delete' is indeed not needed.  I have applied your
patch and initial testing shows it is working fine.  I'll see if there
are any other issues, and tag another release soon.

Thanks again!

>
> Please see attached patch.
>
> -- 
> Kazuhiro Ito
> From 4661b972491084d35c23351bd05438cec05e8440 Mon Sep 17 00:00:00 2001
> From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
> Date: Sat, 6 Sep 2025 15:22:01 +0900
> Subject: [PATCH] * oauth2.el (oauth2--update-request-cache): Remove unneeded
>  code.
>
> ---
>  oauth2.el | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/oauth2.el b/oauth2.el
> index c0aca41c66..612881a615 100644
> --- a/oauth2.el
> +++ b/oauth2.el
> @@ -39,7 +39,6 @@
>  ;;; Code:
>  
>  (eval-when-compile (require 'cl-lib))
> -(require 'org-macs)
>  (require 'plstore)
>  (require 'json)
>  (require 'url-http)
> @@ -122,7 +121,6 @@ HOST-NAME is nil, do nothing.
>  Returns the newly updated request-cache."
>    (when host-name
>      (let ((host-name (intern host-name)))
> -      (org-plist-delete request-cache host-name)
>        (setq request-cache
>            (plist-put request-cache host-name
>                       `( :access-token ,access-token
> -- 
> 2.45.1
>

-- 
Regards,
Xiyue Deng
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.