/r/spacemacs
Subreddit for the Spacemacs project
Related Subreddits:
Related Links: * Emacs Stack Exchange
/r/spacemacs
I'm working on a huge project and helm-projectile-find-file delays for 1-2 secs before printing the files tree
Is there a way to speed it up? I was thinking maybe there's a way to change the backend to fzf somehow, haven't found any solutions though
I was also thinking about playing with projectile caching, but from what I understood cache invalidation might be a problem resulting in unwanted behaviour
Profiler
423,430,216 99% - command-execute
423,430,216 99% - funcall-interactively
330,351,405 77% - helm-projectile-find-file
330,287,309 77% - helm
330,284,213 77% - helm
330,284,213 77% - helm-internal
324,952,212 76% - helm-read-from-minibuffer
221,212,085 52% - helm-update
219,426,009 51% - helm--collect-matches
219,426,009 51% - helm-compute-matches
219,399,929 51% - helm-get-cached-candidates
219,399,929 51% - helm-get-candidates
219,399,929 51% - helm-interpret-value
219,399,929 51% - helm-apply-functions-from-source
218,351,321 51% + #<compiled 0x19d5000d8128a216>
17,632 0% + helm-process-filtered-candidate-transformer
8,448 0% + helm-take
641,448 0% + helm-render-source
573,342 0% + helm--update-move-first-line
568,190 0% + #<compiled 0x1b4a3b9d71e7886c>
3,096 0% + helm-update-source-p
100,792,576 23% + timer-event-handler
2,030,950 0% + redisplay_internal (C function)
203,959 0% + command-execute
53,552 0% + helm--update-header-line
39,930 0% + minibuffer-setup
12,104 0% + minibuffer-inactive-mode
7,600 0% + highlight-parentheses--initiate-highlight
6,762 0% + minibuffer-setup
6,512 0% + minibuffer-mode
6,480 0% + highlight-parentheses-minibuffer-setup
4,096 0% + thing-at-point
3,096 0% + winum--update
2,112 0% + helm-get-candidate-number
2,112 0% + winner-save-unconditionally
1,056 0% + global-spacemacs-leader-override-mode-check-buffers
1,056 0% + evil-mode-check-buffers
1,056 0% + global-origami-mode-check-buffers
1,056 0% + yas-global-mode-check-buffers
48 0% + run-hooks
Thanks for your tips in advance
Config:
(use-package nov
:config
(setq nov-text-width 80
shr-use-css nil) ;; Disable external CSS to allow Emacs faces to take precedence
;; Customize faces for code rendering
(defun my-nov-setup-shr-styles ()
"Customize faces for code blocks and inline code in nov.el."
;; Set monospace font and dark background for inline code
(set-face-attribute 'shr-code nil
:family "Courier New" ;; Preferred monospace font
:background "#333333" ;; Dark background
:foreground "#E5E5E5" ;; Light foreground
:weight 'normal)
;; Set monospace font and dark background for block code
(set-face-attribute 'shr-tag-pre nil
:family "Courier New" ;; Monospace font for block code
:background "#333333" ;; Dark background for block code
:foreground "#E5E5E5" ;; Light foreground
:weight 'normal
:height 1.0) ;; Adjust font size if needed
;; Ensure <code> tags are also styled
(set-face-attribute 'shr-tag-code nil
:family "Courier New"
:background "#333333"
:foreground "#E5E5E5"
:weight 'normal
:height 1.0)
;; Customize the LiteralGray span class for gray text in code blocks
(set-face-attribute 'font-lock-comment-face nil
:foreground "#A0A0A0") ;; Change this color as needed for readability
)
;; Apply the custom styling when nov-mode is activated
(add-hook 'nov-mode-hook 'my-nov-setup-shr-styles))
this will highlight inline code, but does nothing to code blocks. I have tested all kinds of variations but I cannot figure this out.
Here is a snippet of the source code for one epub-file:
<p class="CodeLabel"><b>src/main.rs</b></p>
<pre><code><span class="LiteralGray">fn main() {</span>
<span class="LiteralGray"> let number_list = vec![34, 50, 25, 100, 65];</span>
<span class="LiteralGray"> let mut largest = &number_list[0];</span>
<span class="LiteralGray"> for number in &number_list {</span>
<span class="LiteralGray"> if number > largest {</span>
<span class="LiteralGray"> largest = number;</span>
<span class="LiteralGray"> }</span>
<span class="LiteralGray"> }</span>
<span class="LiteralGray"> println!("The largest number is {largest}");</span>
let number_list = vec![102, 34, 6000, 89, 54, 2, 43, 8];
let mut largest = &number_list[0];
for number in &number_list {
if number > largest {
largest = number;
}
}
println!("The largest number is {largest}");
<span class="LiteralGray">}</span></code></pre>
Any ideas how to fix the config?
emacs --version
GNU Emacs 29.4
Copyright (C) 2024 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.
OS: Arch Linux x86_64
Host: ASUS TUF Gaming A16 FA607PI_FA607PI (1.0)
Kernel: Linux 6.11.4-arch1-1
0.999.0@29.4 (spacemacs)
link img: https://imgur.com/a/vge3zpp
So I think I have all the stuff right, but only 1 or a few major mode icons are shown. The rest are squares with 4 numbers inside.
Can anyone tell me what I do wrong?
Hello
Following these instructions, I tried to installe llm-client layer to my spacemacs.
Spacemacs tells me "Unknown layer llm-client declared in dot file".
Have you any idea what to do ?
I was new to Emacs when I was introduced to Spacemacs - and that was 5 years ago. I have always used it to write code and Latex, without ever really getting too deep into the elisp world. I was just loading up Spacemacs for the first time on my new machine and can't seem to get everything working like it did.
Now, 5 years on there are different versions of literally everything - and I guess it is to be expected that some things won't work like they did back on my old machine (which was spacemacs 0.300 and emacs 26.1 or something). Now with spacemacs 0.999@29.3 I can't even get python jump-to-definition working within one git repo!
It's been days and at this point I am wondering if spacemacs' python layer is straight broke. I have fresh re-installed multiple times, but nothing works as simply as you think it would..
Struggling to keep the will the will to use spacemacs - probably because I don't understand how it really works and how to fix things. I just google endlessly (and ask ChatGPT these days).
How did you all learn? And how often do you find yourselves troubleshooting some tiny detail rather than actually working?
All I want, and all I had for 4 years, was auto-complete and yapfify mode on save, and "g d" taking me to whatever it was I wanted to see. That, and Latex mode auto completing the \cite{} calls I made. Nothing else matters to me.
sigh - I'm tired
Hi Spacers (Spacemacers? Spacemacsers?),
First off thank you so much for reading this post - here is a screenshot of my problem:
I have a fairly fresh installation of Spacemacs on my new machine (went from using 0.300 with Emacs 26.3 to 0.999 with the latest Emacs). Things have been alright with setup but re-building my virtual environment with a new python version has been tricky.
(I know I am supposed to ACTUALLY keep everything the same in a virtualenv, I'm just not an expert and my code is not all that complex. It's working with Python 3.12.3 even though its originally written in 3.8.)
Anyway, I have this issue where LSP is throwing a ton of errors - even though the code runs fine - and I'm not sure how to fix it.
For more detail, below is the pip list of my virutalenv (kinda long my apologies). I have mypy installed, which has given me issues in the past, but in my main environment my computer doesn't like me pip installing anything so I am trying not to (it literally doesn't let me do "pip install" outside a virtualenv and says "you can force me to do it but it might break your python entirely"...)
Any ideas here? I can also post my config file details or other stuff, this is my python layer config:
(python :variables
python-backend 'lsp
python-lsp-server 'pyright
python-test-runner 'pytest
python-formatter 'yapf
python-enable-yapf-format-on-save t
python-fill-column 80
python-sort-imports-on-save t
;; python-pipenv-activate t
)
Ok finally the pip list, and that it. Thanks for your help!!!
Package Version
astroid 3.2.4
asttokens 2.4.1
backcall 0.2.0
contourpy 1.1.1
cycler 0.12.1
decorator 5.1.1
dill 0.3.9
docstring-to-markdown 0.15
executing 2.1.0
flake8 7.1.1
fonttools 4.54.1
importlib_metadata 8.5.0
importlib_resources 6.4.5
ipython 8.12.3
isort 5.13.2
jedi 0.19.1
kiwisolver 1.4.7
matplotlib 3.7.5
matplotlib-inline 0.1.7
mccabe 0.7.0
mpmath 1.3.0
mypy 1.11.2
mypy-extensions 1.0.0
networkx 3.1
nodeenv 1.9.1
numpy 1.24.4
packaging 24.1
pandas 2.0.3
parso 0.8.4
pexpect 4.9.0
pickleshare 0.7.5
pillow 10.4.0
pip 24.0
platformdirs 4.3.6
pluggy 1.5.0
prompt_toolkit 3.0.48
ptyprocess 0.7.0
pure_eval 0.2.3
pycodestyle 2.12.1
pyflakes 3.2.0
Pygments 2.18.0
pylint 3.2.7
pyparsing 3.1.4
PyQt5 5.15.11
PyQt5-Qt5 5.15.15
PyQt5_sip 12.15.0
pyright 1.1.382.post1
python-dateutil 2.9.0.post0
python-lsp-jsonrpc 1.1.2
python-lsp-server 1.12.0
pytz 2024.2
qutip 4.7.3
ruff 0.6.9
scipy 1.10.1
setuptools 68.1.2
six 1.16.0
stack-data 0.6.3
sympy 1.13.3
tomli 2.0.1
tomlkit 0.13.2
tqdm 4.66.5
traitlets 5.14.3
typing_extensions 4.12.2
tzdata 2024.2
ujson 5.10.0
wcwidth 0.2.13
wheel 0.42.0
yapf 0.40.2
zipp 3.20.2
I added (menu-bar-mode 1) to my dotspacemacs/user-config () function, and when I reload the configuration it shows the menu-bar, but it doesn't show it when I restart emacs. What's the issue?
emacs 27.1
In short, I'm making some changes to a layer that's already available, namely, the asm layer. I'm looking for a method to reload the layer once I change something. I'm struggling to make that happen. Loading relevant files isn't working (either through ielm or directly calling the function through M-:
). I hoped restarting emacs (not using a service) would make it work, but that was a bust as well.
I also tried moving asm to private/local
and adding (asm :location local)
to dotspacemacs-additional-packages
.
Would love some guidance on how to make it work. Thanks in advance!
For example, in a TSX file, when in vscode, I can have my cursor within a component and press C-SPC to show a complete list of intellisense completion options.
I can accomplish somewhat similar if I put my cursor in the same place within a component in Typescript-tsx mode, and then press any character, such as a
, however that will only show results that match with a
in some way. I'd like to show all possible results, similar to vscode's C-SPC functionality.
Anyone know of a way to get something like this? I don't need it bound to C-SPC of course.
I've recently made the jump from Vim to Spacemacs and it's mostly great, Magit and org-mode are killer!
One thing that is really interrupting my flow is how to exit vterm-mode / enter normal mode whilst in a vterm shell without using ESC.
I've mapped Ctrl-q to insert-mode which works well (inside user-init):
(define-key global-map (kbd "C-q") nil)
(define-key evil-insert-state-map (kbd "C-q") 'evil-normal-state)
But cannot for the life of my figure out how to do something similar for vterm. I've tried:
(defun my-setup-vterm-keys ()
"Set up key bindings for vterm mode."
(define-key vterm-mode-map (kbd "C-q") 'evil-normal-state))
;; Wait until Evil is loaded, then define the key binding for vterm mode
(eval-after-load 'evil
'(progn
(require 'evil)
(evil-define-key 'insert vterm-mode-map (kbd "C-q") 'evil-normal-state)))
;; Set up the vterm mode hook to apply the key bindings
(add-hook 'term-mode-hook 'my-setup-vterm-keys))
But nothing I add seems to work. It's as if vterm is completely trumping any config. Has anyone got any similar flows? Would love to see your config!
Help a Vim escapee!
confused about how setup my pom.xml to use junit in spacemacs
my java folder:
/main/Pos.java
/test/PosTest.java
they are both under the root folder /betterChess
All I want to do is use chatgpt in spacemacs.
I've followed this workflow:
https://develop.spacemacs.org/layers/+web-services/openai/README.html#configuration
I added:
export OPENAI_API_KEY="xxxxxx"
..to my .zshrc. And, I've added:
openai
..to dotspacemacs-configuration-layers. Lastly, I've added:
;; Set the OpenAI API key
(setq openai-key (getenv "OPENAI_API_KEY"))
;; Set user for OpenAI requests
(setq openai-user "Chad")
...to dotspacemacs/user-config in my .spacemacs.
Trying to use ChatGPT in Spacemacs:
I see "Chad" in the top right corner for my user, but when I send a query I always get this response:
[INFO] Invalid API key, please set it to the correct value: nil
Things I've tried:
I've created a project api key and a user api key and neither has ever worked. What in the f*** am I doing wrong? Please help.
Anyone knows how I can copy my configuration from Windows to MacOS?
hey,
I created my first layer on spacemacs to integrate tailwindcss but I am having issues.
packages.el (defconst tailwindcss-packages '((lsp-tailwindcss :location (recipe :fetcher github :repo "merrickluo/lsp-tailwindcss")) ))
(defun tailwindcss/init-lsp-tailwindcss ()
(use-package lsp-tailwindcss
:init
(setq lsp-tailwindcss-add-on-mode t)
:config
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . svelte-mode))
))
config.el
(use-package! lsp-tailwindcss)
tailwindcss is installed along tailwindcss-language-server.
I can't seem to get completion in svelte files .e.g. <div class="bg-red-500 ...
. I do have it working in neovim but not on emacs.
Any help is appreciated
Hello, folks! So in my journey to trying to code within org-mode using org-babel, I've eventually stumbled upon this very relevant article-slash-guide by dalanicolai.
I've checked the relevant .el
~/.config/emacs/elpa/29.2/develop/org-contrib-0.4.2/org-eldoc.el
and, yeah, the fixes are there, only seemingly further evolved.
Frustratingly, while src code block's header lines' eldoc's documentation is (and has been) working, the emacs-lisp's own eldoc support within the src block isn't working. It's working when editting from within an .el file - or when using org-edit-special (M-m m ')
Could you help with my thought process on what is my next search query should look like?
I am using emacs 28.1 + spacemacs. Aside from that I haven't added anything overly custom to my .spacemacs. As I spend time editing .cpp files, I will get many (10+ instances) of gtags running that were spawned by emacs and each one will consume 8-10% of my CPU. Any ideas on determining why emacs is doing this, or how to prevent it, are appreciated.
More background: I'm running emacs on a Windows system that's using cygwin gtags. I've tried disabling all of the packages that have an obvious tie-in to gtags (counsel/swiper, ggtags, helm-gtags) and that hasn't changed behavior. I also changed: (ggtags-update-on-save nil)
, also with no change. It appears to me that a new instance of gtags gets run anytime I save a .cpp file, but could be wrong (I'm just observing taskmgr at the time I save). My codebase is quite large, it takes a very long time for gtags to re-index.
Hi, I work in org mode using ess-r. I'm not able to lets eglot automatically start while I open the src temp buffer. Emacs recognize the major mode (ess-r-mode) but eglot do not start. I try to open a .R file and eglot start as expected, so the issue is relative the src buffer. Do you have the same issue? How do you menage it?
I'm a noob to (spac)emacs. Recently I need to use debugging feature for python on spacemacs. I found that dap-mode is the way to do it.
I have read the dap-mode config for python. I have installed debugpy. I tried to debug my python file using , d d d
to start debug. I select the Python :: Run file (buffer)
. But I always got this error
Debug session process exited status: exited abnormally with code 1
How do I solve this? Am I missing any step to activate the dap-mode?
I haven't managed to find a way to have Spacemacs use the development version of Org mode, rather than the Org mode from Elpa. I want the main development branch, rather than the bugfix branch that Elpa follows. Is there a simple way to do this? Ideally, I'd only do this until the main development branch is released and appears on Elpa.
I'm on a work computer that's pretty locked down in terms of Internet access, so Melpa is unavailable. I’m trying to get my SpaceMacs configuration up and running to be productive. I have manually copied all of the files from the .emacs.d/elpa onto my computer, but when I start SpaceMacs, it still wants to go reinstall everything. Is there a way to prevent this behavior?
Hi all,
I'm having issues using yasnippet completion in modes that also use lsp for completion. That means, in those modes, snippets will no longer be shown in the completion window nor will they complete if I enter the keyword.
For comparison, I looked at org-mode. Everything is working as expected there: I have some context sensitive completion as well as snippets from yasnippets. I get the following output from company-diag
:
Emacs 29.1 (aarch64-apple-darwin22.5.0) of 2023-08-08 on admins-Virtual-Machine.local
Company 0.10.2
company-backends: ((company-files :with company-yasnippet)
(company-capf :with company-yasnippet))
Used backend: (company-capf :with company-yasnippet)
Value of c-a-p-f: (yasnippet-capf pcomplete-completions-at-point t)
Major mode: org-mode
Prefix: nil
Completions: none
So the active backend company-capf
with company-yasnippet
enabled. Just as I expected.
Now if I compare that to go-mode, I do get completion candidates from the go lsp server but I no longer get snippets. The output from company-dial
confirms that:
Emacs 29.1 (aarch64-apple-darwin22.5.0) of 2023-08-08 on admins-Virtual-Machine.local
Company 0.10.2
company-backends: (company-capf
(company-go :with company-yasnippet)
(company-files :with company-yasnippet)
(company-capf :with company-yasnippet))
Used backend: company-capf
Value of c-a-p-f: (lsp-completion-at-point semantic-analyze-completion-at-point-function semantic-analyze-notc-completion-at-point-function semantic-analyze-nolongprefix-completion-at-point-function tags-completion-at-point-function)
Major mode: go-mode
Prefix: ""
Completions:
....
It looks like it replaced the yasnippet enabled company-capf
.
From what I understand I want the backend to always be (company-capf :with company-yasnippet)
.
Does anyone know what's going on here? How do I get capf and yasnippet working at the same time with lsp?
minibuffer is hiding all other windows
Observed behaviour: 👀 💔you can see, when the minibuffer is open its hiding all the windows except that active one
Expected behaviour: ❤️ 😄mini buffer should open without hiding all the other windows
issue:https://github.com/syl20bnr/spacemacs/issues/16317
Hi all.
I am having a strange issue with my spacemacs installation. As you can see in the picture, I have an issue where my flycheck-mode throws a ton of errors for things that shouldn't be errors at all (eg. np.multiply!). This happens sporadically, sometimes I open this class file and it has 0 errors and warnings, and sometimes it just decides to freak out.
My best guess is that this is a lsp or flycheck issue, but I unfortunately do not have the know how to fix it. Have tried looking around the interwebs for help to no avail.
Anyone with any insight? Much appreciated!
Also happy to add any versioning information I can upon request, I just am not sure what to include here..
I tried installing the packages with the insecure flag but that didn't do anything. I've removed the previous install and updated the Fedora system packages.
```
An error occurred while installing treemacs-magit (error: (error Package ‘compat’ (version 29.1.4.4) is unavailable))
-
An error occurred while installing paradox (error: (error Package ‘spinner’ (version 1.7.3) is unavailable))
```
Any suggestions?
My .spacemacs has dotspacemacs-line-numbers 'visual
Since that didn't work, for good measure, I added the following to dotspacemacs/user-config
(spaceamcs/toggle-visual-line-numbers-on)
(spacemacs/toggle-visual-line-navigation-globally-on)
Nothing. Every time I start, there are no line numbers shown, and text goes all the way off the screen to the right. I have to physically type SPC t n v
and SPC t l
every time I open a new buffer. What am I doing wrong?
Hi, my Spacemacs stopped showing keybindings hints when I press Space key (actually it shows hints when emacs has just launched but as soon as I open a file it stops working), does anyone know how to reactivate it or why is it happening??
I'm trying to move to spacemacs from vanilla, but I have some custom configuration files I need.
I have placed them in .emacs.d/private/fixes. There are a bunch of files, but basically I just need to load before-init.el as early as possible, and after-init.el just before finishing startup. Those two then load the various other .el files.
I've tried playing around in .spacemacs, but I can't seem to get them to load. Does anyone have a similar setup they could share?