GNU bug report logs - #43586
Flymake can't understand `cl-loop' and `if-let*'.

Previous Next

Package: emacs;

Reported by: ej32u <at> protonmail.com

Date: Thu, 24 Sep 2020 02:11:01 UTC

Severity: normal

Done: ej32u <at> protonmail.com

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43586 in the body.
You can then email your comments to 43586 AT debbugs.gnu.org in the normal way.

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#43586; Package emacs. (Thu, 24 Sep 2020 02:11:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to ej32u <at> protonmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Sep 2020 02:11:01 GMT) Full text and rfc822 format available.

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

From: ej32u <at> protonmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: Flymake can't understand `cl-loop' and `if-let*'.
Date: Thu, 24 Sep 2020 02:10:41 +0000
Hello,

Flymake is giving many errors, for a command that I believe works. This happens 
with a clean init file.


The command so far is this:

;;;###autoload
(defun selectrum-bookmark ()
   "Go to or create a bookmark.
To create a bookmark with the same name, use `bookmark-set' (\\[bookmark-set])."
   (interactive)
   ;; Require `bookmark' to load the bookmark list.
   (require 'bookmark)
   ;; Make sure bookmarks are available.
   (unless bookmark-alist
     (if (file-exists-p bookmark-default-file)
         (bookmark-load bookmark-default-file)
       (user-error "selectrum-bookmark: File not found: %s"
                   bookmark-default-file)))
   (let ((formatted-bookmarks
          (and bookmark-alist
               (cl-loop
                for bm in bookmark-alist
                for name = (car bm)
                collect (propertize
                         (replace-regexp-in-string
                          "\n"
                          (propertize "\\n" 'face 'warning )
                          (concat (propertize name 'face 'bold)
                                  ": "
                                  (propertize
                                   (concat (alist-get 'filename bm)
                                           "@"
                                           (number-to-string (alist-get 
'position bm)))
                                   'face 'underline)
                                  ": "
                                  (alist-get 'front-context-string bm)
                                  (propertize "|" 'face 'highlight)
                                  (alist-get 'rear-context-string bm))
                          'fixed-case 'literal)
                         'bm bm)))))
     (if-let* ((chosen-cand (selectrum-read "Bookmark: " formatted-bookmarks))
               (actual-data (get-text-property 0 'bm chosen-cand)))
         (bookmark-jump actual-data)
       (bookmark-set chosen-cand))))

Here are some of the errors Flymake reports:

    19   0 warning  Unused lexical variable ‘formatted-bookmarks’
    22   3 warning  ‘(chosen-cand (selectrum-read "Bookmark: " 
formatted-bookmarks))’ is a malformed function
    34  15 warning  reference to free variable ‘for’
    34  19 warning  reference to free variable ‘bm’
    34  22 warning  reference to free variable ‘in’
    35  19 warning  reference to free variable ‘name’
    35  24 warning  reference to free variable ‘=’
    36  15 warning  reference to free variable ‘collect’
    54  52 warning  reference to free variable ‘chosen-cand’
    55   9 warning  reference to free variable ‘actual-data’

You can see that it is treating key words as variables in `cl-loop', and cannot 
see that `actual-data' is defined in `if-let*'. The command works fine when 
evaluated.

Thank you.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43586; Package emacs. (Thu, 24 Sep 2020 14:45:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: ej32u <at> protonmail.com
Cc: 43586 <at> debbugs.gnu.org
Subject: Re: bug#43586: Flymake can't understand `cl-loop' and `if-let*'.
Date: Thu, 24 Sep 2020 16:44:05 +0200
ej32u <at> protonmail.com writes:

> Flymake is giving many errors, for a command that I believe works. This happens 
> with a clean init file.

[...]

> Here are some of the errors Flymake reports:
>
>     19   0 warning  Unused lexical variable ‘formatted-bookmarks’
>     22   3 warning  ‘(chosen-cand (selectrum-read "Bookmark: " 

[...]

> You can see that it is treating key words as variables in `cl-loop', and cannot 
> see that `actual-data' is defined in `if-let*'. The command works fine when 
> evaluated.

Do the warnings go away if you put

(require 'cl-lib)
(require 'subr-x)

in your file?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Reply sent to ej32u <at> protonmail.com:
You have taken responsibility. (Sat, 26 Sep 2020 00:25:01 GMT) Full text and rfc822 format available.

Notification sent to ej32u <at> protonmail.com:
bug acknowledged by developer. (Sat, 26 Sep 2020 00:25:01 GMT) Full text and rfc822 format available.

Message #13 received at 43586-done <at> debbugs.gnu.org (full text, mbox):

From: ej32u <at> protonmail.com
To: 43586-done <at> debbugs.gnu.org
Subject: Re: bug#43586: Flymake can't understand `cl-loop' and `if-let*'.
Date: Sat, 26 Sep 2020 00:24:32 +0000
Thank you, I had missed adding those.

On 9/24/20 10:44 AM, Lars Ingebrigtsen wrote:
> ej32u <at> protonmail.com writes:
>
>> Flymake is giving many errors, for a command that I believe works. This happens
>> with a clean init file.
> [...]
>
>> Here are some of the errors Flymake reports:
>>
>>      19   0 warning  Unused lexical variable ‘formatted-bookmarks’
>>      22   3 warning  ‘(chosen-cand (selectrum-read "Bookmark: "
> [...]
>
>> You can see that it is treating key words as variables in `cl-loop', and cannot
>> see that `actual-data' is defined in `if-let*'. The command works fine when
>> evaluated.
> Do the warnings go away if you put
>
> (require 'cl-lib)
> (require 'subr-x)
>
> in your file?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>     bloggy blog: http://lars.ingebrigtsen.no






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 24 Oct 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 184 days ago.

Previous Next


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