unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43586: Flymake can't understand `cl-loop' and `if-let*'.
       [not found] <839ce061-6550-666e-bb2e-40cface2549c@protonmail.com>
@ 2020-09-24  2:10 ` ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-09-24 14:44   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-09-24  2:10 UTC (permalink / raw)
  To: 43586

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.






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

* bug#43586: Flymake can't understand `cl-loop' and `if-let*'.
  2020-09-24  2:10 ` bug#43586: Flymake can't understand `cl-loop' and `if-let*' ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-09-24 14:44   ` Lars Ingebrigtsen
  2020-09-26  0:24     ` ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-24 14:44 UTC (permalink / raw)
  To: ej32u; +Cc: 43586

ej32u@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





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

* bug#43586: Flymake can't understand `cl-loop' and `if-let*'.
  2020-09-24 14:44   ` Lars Ingebrigtsen
@ 2020-09-26  0:24     ` ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 3+ messages in thread
From: ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-09-26  0:24 UTC (permalink / raw)
  To: 43586-done

Thank you, I had missed adding those.

On 9/24/20 10:44 AM, Lars Ingebrigtsen wrote:
> ej32u@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







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

end of thread, other threads:[~2020-09-26  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <839ce061-6550-666e-bb2e-40cface2549c@protonmail.com>
2020-09-24  2:10 ` bug#43586: Flymake can't understand `cl-loop' and `if-let*' ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-24 14:44   ` Lars Ingebrigtsen
2020-09-26  0:24     ` ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

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