-
Notifications
You must be signed in to change notification settings - Fork 151
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
Emacs freezes at the compiling step while installing vterm-module
via straight's use-package integration.
#891
Comments
Yes. We don't handle user input during package installation. Because you aren't deferring the loading of One solution is to defer the loading of vterm and you will be prompted in your session to compile the module when vterm is loaded. This can be achieved by several use-package keywords ( The second is to use straight's |
I inspected your configurartion here, as follows: (use-package vterm
:straight (:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)
:config
(evil-set-initial-state 'vterm-mode 'emacs)) I've some questions for adapting it to my scenario:
|
|
If I understand correctly, you use general here to define key definitions.
|
Apologies. |
I tried the following, and it seems to work: (use-package vterm
:straight (:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)) |
That's good. Though I don't see how the |
This is just what puzzles me. Where is the definition of this key binding macro? What additional bits should be added to my above configuration in order to use the general settings you customized? |
Thank you again. The following macro needs to be put into my Emacs initialization file before the above configuration mentioned in this issue: (defmacro +general-global-menu! (name infix-key &rest body)
"Create a definer named +general-global-NAME wrapping global-definer.
Create prefix map: +general-global-NAME. Prefix bindings in BODY with INFIX-KEY."
(declare (indent 2))
`(progn
(general-create-definer ,(intern (concat "+general-global-" name))
:wrapping global-definer
:prefix-map (quote ,(intern (concat "+general-global-" name "-map")))
:infix ,infix-key
:wk-full-keys nil
"" '(:ignore t :which-key ,name))
(,(intern (concat "+general-global-" name))
,@body))) So, the complete configuration used by me is as follows: (defmacro +general-global-menu! (name infix-key &rest body)
"Create a definer named +general-global-NAME wrapping global-definer.
Create prefix map: +general-global-NAME. Prefix bindings in BODY with INFIX-KEY."
(declare (indent 2))
`(progn
(general-create-definer ,(intern (concat "+general-global-" name))
:wrapping global-definer
:prefix-map (quote ,(intern (concat "+general-global-" name "-map")))
:infix ,infix-key
:wk-full-keys nil
"" '(:ignore t :which-key ,name))
(,(intern (concat "+general-global-" name))
,@body)))
(use-package vterm
:straight (:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)) But for the above configuration, when Emacs started, I didn't notice the installation of vterm. |
You still need to define
The compilation should only run after the build steps are run. So unless the package needs to be rebuilt or you trigger that manually via |
I follow up this question here. Hope to get some further help and clues.
With the configuration discussed here, the
Due to the |
What happens with |
See the following: Another very strange problem will occur when I try to use the following configuration according to the comment you have given on the gist: (defmacro +general-global-menu! (name infix-key &rest body)
"Create a definer named +general-global-NAME wrapping global-definer.
Create prefix map: +general-global-NAME. Prefix bindings in BODY with INFIX-KEY."
(declare (indent 2))
`(progn
(general-create-definer ,(intern (concat "+general-global-" name))
:wrapping global-definer
:prefix-map (quote ,(intern (concat "+general-global-" name "-map")))
:infix ,infix-key
:wk-full-keys nil
"" '(:ignore t :which-key ,name))
(,(intern (concat "+general-global-" name))
,@body)))
;; https://gist.github.com/progfolio/1c96a67fcec7584b31507ef664de36cc#gistcomment-3978515
(+general-global-menu! "application" "a")
(use-package vterm
:straight (:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)) With the above configuration, i.e., by adding the following line:
My Emacs will only load part of the initialization file. If I commented out the above line, Emacs will clone the vterm repository and build it, but still will freeze: |
I think it's likely that you are experiencing a configuration issue that isn't straight specific. |
I try to do the test with a separate, almost the same configuration ( #!/usr/bin/env bash
:;#/home/werner/.emacs.d/debug/.emacs.d/init.el
:; realpath $0
:;# Use the following command to test:
:;#bash /home/werner/.emacs.d/debug/.emacs.d/init.el
:;#https://groups.google.com/g/comp.unix.shell/c/krxzfCd_8qM/m/ryoNs9AGCQAJ
:;# https://groups.google.com/g/comp.unix.shell/c/3vrq7pqoG-A/m/Hnk0lsKfAwAJ
:;# https://lists.gnu.org/archive/html/help-gnu-emacs/2021-10/msg00698.html
:;# https://github.com/company-mode/company-mode/discussions/1248#discussioncomment-1535692
:; HOME=$(dirname $(dirname $(realpath -e $0))) proxychains-ng-socks5 /usr/local/bin/emacs -- "$@"; exit
:;# or
:;# HOME=$(dirname $(dirname $(realpath -e $0))) exec proxychains-ng-socks5 /usr/local/bin/emacs -- "$@"
;;Bootstrap straight
(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 'use-package)
(setq straight-use-package-by-default t)
;; https://github.com/progfolio/.emacs.d#general-key-bindings
;; general.el provides a more convenient method for binding keys in emacs (for both evil and non-evil users).
;; https://github.com/noctuid/general.el#about
;; Load general before the remaining packages so they can make use of the :general keyword in their declarations.
(use-package general
:demand t
:config
(general-override-mode)
(general-auto-unbind-keys)
<<general-config>>)
;; https://github.com/progfolio/.emacs.d#config
;; The global definer allows me to use a leader key in most states.
(general-create-definer global-definer
:keymaps 'override
:states '(insert normal hybrid motion visual operator)
:prefix "SPC"
:non-normal-prefix "S-SPC")
(global-definer
"!" 'shell-command
":" 'eval-expression
"." 'repeat)
;; We define a global-leader definer to access major-mode specific bindings:
(general-create-definer global-leader
:keymaps 'override
:states '(insert normal hybrid motion visual operator)
:prefix "SPC m"
:non-normal-prefix "S-SPC m"
"" '( :ignore t
:which-key
(lambda (arg)
(cons (cadr (split-string (car arg) " "))
(replace-regexp-in-string "-mode$" "" (symbol-name major-mode))))))
;; And a macro to ease the creation of nested menu bindings:
;; https://github.com/raxod502/straight.el/issues/891#issuecomment-982384771
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-11/msg00404.html
(defmacro +general-global-menu! (name infix-key &rest body)
"Create a definer named +general-global-NAME wrapping global-definer.
Create prefix map: +general-global-NAME. Prefix bindings in BODY with INFIX-KEY."
(declare (indent 2))
`(progn
(general-create-definer ,(intern (concat "+general-global-" name))
:wrapping global-definer
:prefix-map (quote ,(intern (concat "+general-global-" name "-map")))
:infix ,infix-key
:wk-full-keys nil
"" '(:ignore t :which-key ,name))
(,(intern (concat "+general-global-" name))
,@body)))
;; https://github.com/progfolio/.emacs.d#applications
;; https://gist.github.com/progfolio/1c96a67fcec7584b31507ef664de36cc#gistcomment-3978515
(+general-global-menu! "application" "a")
;; https://github.com/progfolio/.emacs.d#vterm
;; Emacs-libvterm (vterm) is fully-fledged terminal emulator inside GNU Emacs based on libvterm, a C library.
;; https://github.com/akermu/emacs-libvterm
(use-package vterm
:straight (:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)) But Emacs still freezes at the compiling step. After I cancelled the compilation with |
Please use Unless the issue is graphical, please share the text of a buffer instead of a screenshot of the text of a buffer. Text is easier to search and copy. The main issue here is that you're adding in too many variables at once to diagnose the issue. You want to start from the minimal configuration which exhibits the issue and work from there. This following test works on my system: Yodel Report (2021-11-30 14:59:31): (yodel
:save "vterm.straight"
:formatter yodel-format-as-github-markdown
:packages*
(vterm
:post-build
(progn
(setq vterm-always-compile-module t)
(require 'vterm)))
:post*
(let
((default-directory
(straight--build-dir "vterm")))
(print
(straight--process-output "ls" "-lah" "vterm-module.so")))) STDOUT:Loading /tmp/vterm.straight/straight-bootstrap-snippet.el (source)...
"-rwxr-xr-x 1 n n 134K Nov 30 14:57 vterm-module.so" Environment
Packages
The gist I made is a rough guide, but anyone using it should read over general's documentation and understand how to use that package first. Copying bits and pieces of someone's configuration is not guaranteed to work for various reasons. As you've seen here, functions may rely on other functions. There may be some configuration context missing, etc. For example, the last test you've posted contains Org noweb syntax: <<general-config>> This is not valid elisp. It's a syntax used in Org src blocks which only results in a valid elisp file after tangling. See if the issue persists with the following test case: Test Case(straight-bug-report
:pre-bootstrap
(setq straight-repository-branch "develop")
:post-bootstrap
(straight-use-package
'(vterm :post-build
(progn
(setq vterm-always-compile-module t)
(require 'vterm))))
(let
((default-directory
(straight--build-dir "vterm")))
(print
(straight--process-output "ls" "-lah" "vterm-module.so"))))
OutputBootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe -> Cloning melpa...
Looking for gnu-elpa-mirror recipe -> Cloning melpa...done
Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe -> Cloning el-get...
Looking for emacsmirror-mirror recipe -> Cloning el-get...done
Looking for straight recipe -> Cloning emacsmirror-mirror...
Looking for straight recipe -> Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Test run with version: prerelease (HEAD -> develop, origin/develop) 92d4153 2021-11-23
Cloning emacs-libvterm (for vterm)...
Cloning emacs-libvterm (for vterm)...done
Building vterm...
Compilation of `emacs-libvterm' module succeeded
Building vterm...done
"-rwxr-xr-x 1 n n 134K Nov 30 15:13 vterm-module.so"
Packages:
"org-elpa" n/a n/a
"melpa" n/a master 76e7a6c9 2021-11-29
"gnu-elpa-mirror" n/a master 98cfebc 2021-11-30
"el-get" melpa master 960f3fb9 2021-10-31
"emacsmirror-mirror" n/a master 659f28e 2021-11-30
"straight" n/a develop 92d4153 2021-11-23
"vterm" melpa master 2681120 2021-09-08
If it does, we can continue troubleshooting. |
OK. I try to reproduce your above test as follows:
(use-package yodel
:straight (:host github :repo "progfolio/yodel"))
(yodel
:save "vterm.straight"
:formatter yodel-format-as-github-markdown
:packages*
(vterm
:post-build
(progn
(setq vterm-always-compile-module t)
(require 'vterm)))
:post*
(let
((default-directory
(straight--build-dir "vterm")))
(print
(straight--process-output "ls" "-lah" "vterm-module.so")))) Emacs will freeze at the following step, as shown in the |
This sounds a lot like an earlier issue you submitted about auctex: Which, unless I'm mistaken, ended up being a configuration issue and not an issue with straight. |
|
Ok. Then I would remove the module, and atttempt to compile it via the commands we were executing via the |
I tried with the following configuration: (use-package vterm
:straight (
:pre-build (
("rm -fr build")
("mkdir build")
("cd build")
("cmake ..")
("make")
)
:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)) But the following warnings/errors are triggered while Emacs is starting: Warning (initialization): An error occurred while loading ‘/home/werner/.emacs.d/init.el’:
But if I use the following configuration, though the compilation process will not be triggered automatically during the Emacs' initialization, it will be done by manually run (use-package vterm
:straight (
:pre-build (
(shell-command "rm -fr build && mkdir build && cd $_ && cmake .. && make")
)
:post-build (cl-letf (((symbol-function #'pop-to-buffer)
(lambda (buffer) (with-current-buffer buffer (message (buffer-string))))))
(setq vterm-always-compile-module t)
(require 'vterm)))
:commands (vterm vterm-other-window)
:general
(+general-global-application
"t" '(:ignore t :which-key "terminal")
"tt" 'vterm-other-window
"t." 'vterm)) I also tried by running |
Your In the second test, you've added a
This indicates that the issue is most likely not due to straight.el. I would seek support on one of the appropriate channels I mentioned (reddit, IRC, mailing list). Again, this looks similar to the issue you were having with auctex. If you were able to fix that issue, I would follow a similar process. Unfortunately, since I am unable to reproduce this issue I don't think I'll be able to offer any more support. |
I now try with the following recipe: (use-package vterm
:straight (
:pre-build (
("rm" "-fr" "build")
("mkdir" "build")
("cd" "build")
("cmake" "..")
("make")))) But meet the following error while starting Emacs:
Do you mean that only one of the Another thing puzzles me most is that even I manually compile the
But |
"cd" is not a program. It is a shell command. See previous discussion here for why this also won't work the way you think it will:
I would stick with this then. |
Yes. As the comment above points out, even the following command cannot affect any subsequent commands:
So, how can I do the OTOH, I also tried without creating the build folder as follows: :pre-build (("cmake" ".")
("make")) But Emacs will freeze too, as shown below:
I just confused about how it works. |
Two methods were explained in later comments in that same thread.
I understand. As I mentioned, I'm unable to reproduce this. So unfortunately, I can't offer any new help. I have provided several ways to diagnose this type of problem in the issue you filed about auctex freezing. Please try those methods. |
According to the method suggested here, I tried the following two methods, but both failed:
As for another method proposed by you, I still can't figure out how to use it to this example. If the problem discussed here can't be solved on my scenario, I must manually compile the |
The
Probably doesn't work because bash's "-c" arg is expected to be a commad string. ("bash" "-c" "build && cmake .. && make") Again, the problem seems to be when |
You're right. I confirmed the following two equivalent working forms when using in ("rm" "-fr" "build")
("mkdir" "build")
("bash" "-c" "cd build && cmake .. && make") and (shell-command "rm -fr build && mkdir build && cd $_ && cmake .. && make") Both of the above forms work. But I observed the following strange phenomena: After the In this case, if I hit If I hit I also tried the following lisp code, but it didn't work: `("bash" "-c" "cd \"$1\" && cmake .. && make" "--" ,(concat (straight--repos-dir "emacs-libvterm") "build")) Based on my tries, when putting the backquote symbol at the beginning of the whole (use-package vterm
:straight `(
:pre-build (
("rm" "-fr" "build")
("mkdir" "build")
("bash" "-c" "cd \"$1\" && cmake .. && make" "--" ,(concat (straight--repos-dir "emacs-libvterm") "build"))
))) See here and here for the relevant discussions.
Here I try to understand the problem that I cannot understand as far as possible, which will help me to further describe and locate the problem in other places. I would like to thank you again for your help and careful analysis. |
Really. I confirmed your judgement. The problem discussed here belongs to the same type of the auctex installation with straight. The configuration I've posted here also has the same problem as this issue. I verified this conclusion by the following method: First run the following commands under
Then restart Emacs with the P.S. All the above testings are done with the git master version of |
What's the meaning of |
In general, please follow the issue template's instructions when filing an issue.
Off topic, but see the documentation of the |
Thank you for your suggestion. I'll try to do so and using your
But it doesn't have the "develop" branch at all:
|
Stick with
You need to |
Thank you for your comment.
I now use the following configuration immediately prior to the bootstrap code of (setq straight-check-for-modifications '(check-on-save find-when-checking)
straight-repository-branch "develop") Then I remove the already cloned
Finally, I restart Emacs to re-install the "develop" branch of
BTW, the following command can also do the same job:
Thank you for your hint. |
This is also probably why straight is not automatically rebuilding packages unless you call |
Wonderful. I really admire your insight. Using the default value of |
On Ubuntu 20.04.3 LTS, I use the following version of self-compiled GNU Emacs:
GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2021-11-14
At the same time, the following command was used to install
emacs-libvterm
with straight's use-package integration:(use-package vterm)
But Emacs will freeze at the following step:
For more related discussions, please see here. Any hints for fixing this problem?
Regards,
HZ
The text was updated successfully, but these errors were encountered: