-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
leaf + (emacs-lisp) flycheck #464
Comments
Thanks, report. But I think, I think your Emacs doesn't load
And please fix leaf form like below
byte-compile happy now. |
Hi, thanks for your feedback, and yes, indeed,
I haven't byte-compiled my code - so far -, but I will give it a try.
I have been using _straight.el_ (instead of the emacs built in
package-initialize / package-install ), like so
```elisp
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'leaf)
(straight-use-package 'leaf-keywords)
(straight-use-package 'leaf-convert)
(straight-use-package 'use-package)
(straight-use-package 'flycheck)
...
```
(more details to be found on the _straight.el_ website), and all
this on top of my emacs installed from debian bullseye/testing,
i.e. debian packages `emacs`, `auto-complete-el`, `elpa-dash`, `elpa-s`,
`hasktags`, `elpa-magit`, `elpa-ivy`, ...
This may already be some source of confusion: installing _some_ _emacs_ packages
from _Debian_, and _some_ via _straight.el_ (which in turn uses _elpa_,
_melpa_, _gnu_, ...), but so far this has worked well for me: having
some packages installed from Debian made my list of _straight.el_
installed packages shorter.
Now adding _leaf_ to that mix (in my naive way) seems to break some
bits. - I did see akhan's initfile
`https://github.com/arkhan/emacs.d` (via
`#306`),
and apparently he uses straight's develpment branch:
```
(setq straight-repository-branch "develop"
straight-base-dir conf:cache-dir
straight-check-for-modifications '(check-on-save-find-when-checking))
;;straight-vc-git-default-clone-depth 100)
...
```
(I am not quite sure, if this is needed really ?), and likewise later:
```
(require 'straight-x)
```
(haven't seen this before either), but this config seems to work for
him.
OK, I will thus continue to experiment with my config, and start from a
clean (minimal) init.el, and byte-compile my code, as you suggest,
and hopefully will be able to do so with _straight.el_
OK, thanks so far.
-Andreas
Naoya Yamashita <[email protected]> writes:
… Thanks, report. But I think, I think your Emacs doesn't load `leaf` in compiling-time?
I try this init.el and byte-compille made missing variable and missing function warning.
```
;;; init.el --- Sample clean init.el -*- lexical-binding: t; -*-
;; ~/.debug.emacs.d/leaf-byte-compile-ivy/init.el
;; you can run like 'emacs -q -l ~/.debug.emacs.d/leaf-byte-compile-ivy/init.el'
(when load-file-name
(setq user-emacs-directory
(expand-file-name (file-name-directory load-file-name))))
(eval-when-compile
(setq user-emacs-directory
(expand-file-name (file-name-directory default-directory))))
(eval-and-compile
(prog1 "leaf"
(custom-set-variables
'(package-archives '(("org" . "https://orgmode.org/elpa/")
("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/"))))
(package-initialize)
(unless (package-installed-p 'leaf)
(package-refresh-contents)
(package-install 'leaf))))
(load (locate-user-emacs-file "../essentials.el"))
(leaf ivy
:bind ((global-map
("C-c C-r" . ivy-resume))
(ivy-minibuffer-map
("<return>" . ivy-alt-done)
("C-j" . ivy-done)
("<tab>" . ivy-partial)
("M-y" . ivy-next-line)))
:setq ((ivy-use-virtual-buffers . t)
(ivy-display-style 'fancy))
:config
(ivy-mode 1))
```
```
$ emacs --version
GNU Emacs 27.1
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
$ emacs --batch -f batch-byte-compile init.el
In toplevel form:
init.el:37:11:Warning: assignment to free variable ‘ivy-use-virtual-buffers’
init.el:38:11:Warning: assignment to free variable ‘ivy-display-style’
In end of data:
init.el:41:1:Warning: the function ‘ivy-mode’ is not known to be defined.
```
---
And please fix leaf form like below
```
(leaf ivy
:bind ((global-map
("C-c C-r" . ivy-resume))
(ivy-minibuffer-map
("<return>" . ivy-alt-done)
("C-j" . ivy-done)
("<tab>" . ivy-partial)
("M-y" . ivy-next-line)))
:custom ((ivy-use-virtual-buffers . t)
(ivy-display-style 'fancy))
:global-minor-mode t)
```
```
$ emacs --batch -f batch-byte-compile init.el
```
byte-compile happy now.
|
OK, I am progressing slowly.
With the advice you have given me, I have a rather minimal init.el
(in terms of straight.el even, and wich uses my debian emacs packages
as well). - And I am byte-compiling my init file now: so I can
see many errors early on.
Now, next problem (in the context of an otherwise working init.el file
-- showing just the relevant part here):
I cannot use lambdas in :bind like so
```
(leaf flycheck
:bind
(
("C-<f5>" . flycheck-next-error)
("C-<f6>" . flycheck-previous-error)
( "C-S-<f5>" . (lambda ()
(interactive)
(progn
(flycheck-compile flycheck-checker)
)
))
)
)
```
In use-package this was not a problem, and it would be nice
to bind lambdas to key sequences as well.
[edited later:] I am adding the error message of
```
emacs --batch -f batch-byte-compile init.el
```
```
In toplevel form:
init.el:272:1:Error: Wrong type argument: listp, "C-S-<f5>"
```
If I comment out the offending binding, everythings works
fine:
```
(leaf flycheck
:bind
(
("C-<f5>" . flycheck-next-error)
("C-<f6>" . flycheck-previous-error)
;; ( "C-S-<f5>" . (lambda ()
;; (interactive)
;; (progn
;; (flycheck-compile flycheck-checker)
;; )
;; ))
)
```
Thanks in advance.
Andreas
PS: And I really don't know why my (gh flavoured) markup didn't show up last time,
(I can only hope it works this time). I am using a normal mail client
(Gnus), not the github webinterface.
|
It seems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am just starting out with leaf, so bear with me, please,
and I am rewriting my use-package config to use leaf.
All this is emacs-lisp code, of course, and I had - since a long time -
flycheck turned on to help me in this regard, like so
Now, take my leaf config for ivy just as an example - created with the help of leaf-convert -
(the problem that I am about to describe holds for any other leaf config as well)
This seems to work (emacs starts fine with this) - however my emacs-lisp flychecker complains:
and I can make it happy by function-quoting ivy-alt-done and ivy-done in the :bind section
instead of just
however, now that flycheck is happy, my emacs won't start up properly any more
It would certainly be nice to have both working: leaf and emacs-lisp flycheck.
Thanks,
Andreas
The text was updated successfully, but these errors were encountered: