Elvind Fonn's Spacemacs ABC Series A lot of tricks I didn't know I could do easily before, and upon seeing it I knew it would improve my efficiency vastly: find pattern in all files in a project (SPC s p), iedit (SPC s e), handle multiple projects with projectile (SPC p l), quick navigation and preview with ranger,
Apart from org-mode, magit is another killer feature for me. Git's native command line is unnecessarily complex. It's difficult to perform line-based commit, ediff, rebase without typos, and soon I lost patience. Now with magit, VC becomes such a breeze. I don't miss the days I tried aliasing in .zshrc or git config.
Also just discover ledger. And oh yes, it's wonderful.
>What are the pros and cons of using emacs over spacemacs if I don’t want the vim experience?
Spacemacs has configuration layers that make it easy to add functionality and it offers you otherwise a out-of-the-box preconfigured experience. With vanilla Emacs you're expected to configure it extensively to reach anywhere near similar functionality.
However since Spacemacs is just a set of configuration for Emacs, there is nothing you can't technically do with just vanilla Emacs.
>Can I use emacs default controls in spacemacs?
Yes, it asks you on first startup to select either Emacs, or Vim-like controls.
From <code>c-c++</code> layer documentation:
> Support auto-completion (when auto-completion
layer is included) via company-clang
(when c-c++-enable-clang-support
is turned on), or company-ycmd
(when ycmd
layer is included).
So, check if you have:
clang
installedc-c++
layer enabledauto-completion
layer enabledc-c++-enable-clang-support
set to t
The simplest way to enable this would be to add the following to your enabled layers:
auto-completion
(c-c++ :variables
c-c++-enable-clang-support t)
Have a look at the documentation of the python layer either through SPC h l python RET
or here. At the bottom is a list of keybindings including those to execute your files/buffers.
I don't think I could tell you anything that isn't covered there. (Note that SPC m
as a prefix is equivalent to ,
)
Download it, then either
load-path
variableload-path
via (add-to-list 'load-path "your/path")
(do this in the user-config section of your .spacemacs file)then add (eval-after-load 'ox '(require 'ox-g-brief))
to the user-config section of your .spacemacs file.
Then the backend should appear in the exporter, everything else is dependent on the package and hopefully documented in the file.
​
Just as an aside: there is an org mode exporter for letters that is already included and works quite well. See here. (for installation in spacemacs you can skip the "add to load path step" in this case)
​
\edit: Fixed a few typos and an oversight in smth I copy/pasted.
I don't think it's dying but it is being thoroughly mismanaged. The maintainers still cannot cope with all the external contributions (let alone bug reports) and have don't seem to have an effective plan to address this. On the other hand, slimmer, faster, stabler, and better designed frameworks like doom-emacs have learned from the mistakes of spacemacs.
I think that spacemacs will stay usable for a long time, but it is being demoted in status to "yet another configuration framework" rather than being the premier choice that it was for many years.
Probably some issue with the load order of your config.
Try using with-eval-after-load
.
(with-eval-after-load 'org (setq org-directory "~/Dropbox/org"))
If this doesn't work try putting ALL your org-mode configuration in your .spacemacs file into a (with-eval-after-load 'org ... )
block. My guess is that you somehow load two different versions of org mode and overwrite your settings in the process. (Here's why this can happen)
The other way to make sure this does not happen is configuring org-mode with a custom layer rather than in the .spacemacs file.
Yes if you want to use virtual environments. If yo just want emacs to use a different python installation you could add a shebang at the top of your file:
#! /usr/local/bin/python3
or wherever you desire.
There are other suggestions here though I haven't tried them.
The thing that took me a while to figure out was how to run stuff like in rust/python. From this awnser I constructed this solution:
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode "cx" 'inferior-haskell-load-and-run )
This makes emacs execute the current file (ie calling the main function in ghci) by pressing space c x.
> Well i tried! It’s working. I thought in-built anaconda-mode would do that but i guess reading docs wrong way. > >
the auto-completion layer provides company
, the completion engine. If company is installed, anaconda provides the company python backend.
I don't use the python layer so I'm not too familiar with the specifics. What needs configuration? According to this it should just work.
\edit: (I assume you read this)
> ## Why am I getting a message about environment variables on startup?
Spacemacs uses the exec-path-from-shell
package to set the executable path
when Emacs starts up. This is done by launching a shell and reading the values
of variables such as PATH
and MANPATH
from it. If your shell configuration
sets the values of these variables inconsistently, this could be problematic. It
is recommended to set such variables in shell configuration files that are
sourced unconditionally, such as .profile
, .bash_profile
or .zshenv
, as
opposed to files that are sourced only for interactive shells, such as .bashrc
or .zshrc
. If you are willing to neglect this advice, you may disable the
warning, e.g. from dotspacemacs/user-init
:
> (setq exec-path-from-shell-check-startup-files nil)
> You can also disable this feature entirely by adding exec-path-from-shell
to
the list dotspacemacs-excluded-packages
if you prefer setting exec-path
yourself.
From the FAQ.
There seem to be some changes to how this is handled on the develop branch so you might want to check that out. Not sure if that'd solve your problems.
> Next question I got is regarding remapping the leader key.
There's a varible dotspacemacs-leader-key
in the dotspacemacs/init
section of your .spacemacs
file that handles that.
I highly recommend going through all the variables that are set in that file, will save you lot's of googling.
For company you don't need to change anything just enable the auto-completion
layer. Which engine is used is then defined by each language layer, most use company.
For more info on that you should read the documentation of the autocompletion layer (SPC h SPC auto-completion RET
or here).
Just to make sure: have you checked the Documentation of the Java script layer, there's a section regarding indentation. (SPC h SPC javascript
or here)
It's described in the official documentation at: http://spacemacs.org/doc/DOCUMENTATION.html#orgheadline21 .
Also in the FAQ: http://spacemacs.org/doc/FAQ#orgheadline3
In short:
> To declare new packages you have to create a new configuration layer or add the package name to the variable dotspacemacs-additonal-packages
of your dotfile, see the quick start guide for more info.
I haven't tried it with docker, but you can chain tramp hops:
/ssh:user@host|docker:foobar:/etc/whatever
See https://www.gnu.org/software/emacs/manual/html_node/tramp/Ad_002dhoc-multi_002dhops.html
Private Layers are a possibility but imo an overkill if they're not supposed to install packages.
Easiest way to give everyone some personal configuration is probably just putting all the personal stuff into one file (maybe called personal-config.el
) that is not part of the repo and including it into your shared .spacemacs
via (load-file "path/to/personal-config.el")
.
If you want to get a bit more fancy you can use the proper structure for emacs packages, eg:
;;; personal-config.el --- description
;;; Commentary: ;; Some Commentary
;;; Code:
Some Code
(provide 'personal-config)
;;; personal-config.el ends here
add it's location into the load-path
with add-to-list
and load it up with (require 'personal-config)
Yes. This script is in fact one line long and involves no lisp :) It is:
emacsclient -a'' -c
A full script would be:
#!/bin/bash emacsclient -a'' -c "$@"
See https://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html if you want to know what those options mean.
Has the org file where you're scheduling your items been added to the variable org-agenda-files?
While viewing that file containing your scheduled item you can add it to org-agenda-files using C-c [
Because emacs tries to be smart in how it splits windows: https://www.gnu.org/software/emacs/manual/html_node/elisp/Choosing-Window-Options.html
Basically, there are two variables split-height-threshold
and split-width-threshold
for you to set. If you always want vertical split then:
(setq split-height-threshold nil)
The manual says that you can do this by setting the variable find-file-run-dired
to nil
. It is described in the section 18.2: <em>Visiting Files</em>.
The emacs download page recommends using msys2, and that's what I've done for several years now.
Personally, I use chocolatey to install msys2, but that's really not necessary.
I will take a guess.
If the interpretation is being done outside of Emacs, then my guess is no, since Emacs probably only sees the end result.
If you set the input method inside Emacs (see links), then you could probably set the input method in hooks. I assume that Emacs has an input method that would do what you want.
First comment nailed it: use narrowing. Emacs can temporarily restrict your buffer to only a certain region of its underlying file, then you run a full-buffer search (on only the subset of your file you care about), then SPC n w
to widen
again.
Welcome to one of emacs’ coolest features!
Maybe you want selective display or hide-show? There are probably a lot of extensions for folding lines.
It's the same process as it is on Linux. Clone the spacemacs config into your .emacs.d
If you're wondering how to download emacs on Windows, you can either download it from the gnu webpage directly https://www.gnu.org/software/emacs/download.html or use a package manager like chocolatey.
If you work on anything important don't do that in a scratch buffer , always save it first with SPC f s
.
That being said you could start Emacs again and type the command M-x recover-session
and see if that works . Alos check out this link
> struggle to find simple resources for Nix on osx
There are very few resources on Nix and even fewer simple ones. The learn page would be the best point to start I think.
Have you tried Tramp
?
But I have used in a terminal without any problem.
Your experience depends on which terminal emulator you're using.
Try something like alacritty ?
That did it. Thanks! I am not facing another problem so I hope you can help. Thanks in advance
​
Hi, currently you need to add the line below to ~/.doom.d/init.el
(setq evil-respect-visual-line-mode t)
Follow this issue https://github.com/hlissner/doom-emacs/issues/401 for probable change.
Hya, I'm the guy who wrote the tex-fold config in [#2812](https://github.com/hlissner/doom-emacs/pull/2812) :)
Not a spacemacs user, I stumbled upon post this accidentally, but here's my reasoning: Having the 2 `:hook (... . ...)` is important, as well as the order they appear in. The last one ensures TeX-fold-mode is enabled in the buffer. The first one runs *after* the last one and folds the buffer after the mode is enabled.
As for confusion with (tex|TeX|latex|LaTeX)-mode, I'm not sure about what's the purpose of all these names either, but using TeX-mode-hook or LaTeX-mode-hook hasn't failed me yet.
As to what to advice for auto folding, depends entirely on your workflow. I mostly use cdlatex and yasnippets, so that's what I have advices on....
Thanks for your answer mate.
I'm new to emacs / spacemacs indeed so really appreciate your advise about choosing Doom Emacs. I did install it and if am going to spend sometime on this transition will be using Doom Emacs now. Thanks again.
About the tags issue: was trying to make it work with Doom Emacs and failing to correct load the Tags Tables too. But in this case I found that my issue was the way I generated the tags file. An extra flag "-e" is required when generating tags to be emacs compatible. So, this worked for me:
cd /path/to/my/project ctags -e -R .
Again, I was no longer using spacemacs neither gtags. It worked for me using Doom Emacs with etags-select plugin.
Cheers.
Check the documentation, you are most likely using hooks wrong way.
https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#configuring-doom
Also don't expect to have spacemacs functions present in doom emacs. Have a look if your function is present by running `M-x search for you function`
I'm about a week in as my daily driver for Python and R (as well as chat/productivity), been loving it so far. The creator is very active on Git and Discord.
Emacs Lisp is tetris-complete, so you can do anything in Emacs you could do in other editor - but it might take you to write that functionality :)
With this said, there is a way of doing that without being a programmer:
(1) Get Projectile - this package allows to navigate projects (Spacemacs should have it by default).
(2) Read the docs! Quick find over their "Usage" page shows that projectile has capability to:
- Run a standard test command for your type of project.
- Display a list of all test files(specs, features, etc) in the project.
- Toggle between an implementation file and its test file.
etc. - I don't remember the usage off top of my head, but this should be all you need. It works with the help of git - be sure to work in the repo. To help you work with the repo, I recommend Magit - although that should be included with spacemacs as well :)
Well, I guess you could exclude the tern package, use the "javascript" and "typescript" layers, and manually enable <strong>tide</strong> features for JavaScript.
Probably.
Maybe a dumb question, but are you using the develop branch of Spacemacs? Are the layer folders of Neotree or Treemacs actually there?
I don't think there are those layers on the stable branch of Spacemacs. I think master branch just has Neotree commands bound on the normal keys given in the documentation, without the use of a layer.
1.
Spacemacs does auto save dirty buffers. By default, it stores auto save in a hidden file, so it requires you to do M-x recover-this-file
when you lose some data. Alternatively you can change dotspacemacs-auto-save-file-location
to save it directly to the file.
You can probably set it up like this https://github.com/syl20bnr/spacemacs/issues/11453#issuecomment-430274145
2. Unfortunately there is no easy way to achieve exactly this afaik. There are layouts, and worksspaces which work fine but their workflow is a bit different. There is no tab bar that is always visible for example. http://spacemacs.org/doc/DOCUMENTATION.html#layouts-and-workspaces
For navigating a project's files, SPC p f
and SPC p b
are particularly useful.
3.
I rarely use neotree but dired (e.g. SPC j d
) instead which probably suffers from the same problems.
Some things can be done quite nicely with that, for example if you create a split of two dired buffers and mark some files and then copy them, the directory of the other buffer is the default destination.
Try something like
(with-eval-after-load 'org (setq org-default-notes-file "/home/username/capture.org"))
This is advised for any org configurations in your user config anyway. See here.
package-install
doesn't work in Spacemacs with the default configuration as Spacemacs uninstalls any package that isn't used by a layer on every restart. So you can either write a layer to configure cider-hydra
or add it to dotspacemacs-additional-packages
in your dotfile.
Spacemacs only allows packages that are used by a layer to be installed.
If you want to install a package from melpa without creating a layer you can just add it to dotspacemacs-additional-packages '()
under he dotspacemacs/layers
function in the .spacemacs file.
http://spacemacs.org/doc/DOCUMENTATION.html#without-a-layer
If you install the package like this you'll need to create the spacemaces-like keybindings yourself though, as there's no layer that does it for you.
I think you may want to have a look at major modes (I think it is the "equivalent" to Vim's filetype). Also check out the Spacemacs haskell layer, it might be useful.
Well, I add it to the end. I don't think I ever tried adding it to the beginning of the file. But yes: no additional configuration is needed. You will, however, most likely be asked if it's OK to evaluate the snippet statements the first time you open a LaTeX file containing them. If you accept for all future sessions your .spacemacs file will be updated (search for safe-local-variable-values if you want to see what it looks like) and you won't be asked in the future about those particular lines.
You'll find more information on file variables in the emacs manual. I would think you could do the same thing with directory variables as described here. Since I sometimes want to use auto-fill-mode when writing LaTeX I prefer to initialize the two variables on a per file basis.
You can also enable the profiler which will show you the functions called. The docs for this are here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html
I don't use js2-mode I just use web-mode. Sorry I don't have more help.
This works only if you use a single client, but it doesn't work for multiple with the Emacs-daemon. To be clear, I try to make a dedicated compilation <em>frame</em>, and n editor frames, so I can select the right frame with help of i3-wm bindings.
I'm sorry for the confusion, I didn't know they renamed x-windows to frames.
There's a list of "special properties" org-mode tracks that you can query using the agenda "match TAGS/PROP/TODO" option from the dispatcher (", a m" for my spacemacs):
https://orgmode.org/manual/Special-Properties.html
The "CLOSED" property corresponds to a timestamp which means we need to supply our query using the proper syntax:
https://orgmode.org/manual/Matching-tags-and-properties.html
From this documentation, we see:
If the comparison value is enclosed in double-quotes and angular brackets (like ‘DEADLINE<="<2008-12-24 18:30>"’), both values are assumed to be date/time specifications in the standard Org way, and the comparison is done accordingly. Valid values also include ‘"<now>"’ for now (including time), ‘"<today>"’, and ‘"<tomorrow>"’ for these days at 0:00 hours, i.e., without a time specification. You can also use strings like ‘"<+5d>"’ or ‘"<-2m>"’ with units ‘d’, ‘w’, ‘m’, and ‘y’ for day, week, month, and year, respectively.
So I can match items that were closed within the last week with the following query:
CLOSED>="<-1w>"
> If you use a different TeX typesetting engine or would like to customize how Org-mode produces the pdf file, then you will want to modify the variable org-latex-to-pdf-process
. This is a list of strings, each of which contains a call to one of the TeX typesetting engines or to an auxiliary program, such as BibTeX, makeindex, etc. ...
https://orgmode.org/worg/org-tutorials/org-latex-export.html
Nice post about your transition to emacs side where the grass is always greener. > I’m turning into one of those people, and I’m loving it.
It certainly is addicting.
My 2 cents on:
#+header: :wrap (my-org-src-decorate "Project commit history." '("#+tblname: commit-history")) #+begin_src sh :exports none :async
This evaluates because it should. The #+Header keyword defines arguments specificly for the following codeblock. The :wrap keyword argument is an org-babel function, that is used to define the attributes of the sourceblog which is wrapped around the results of the source block it's associated with. So it's an formatting function and has to be evaluated on export.
I see you have a solution that works for you, but this might be of help to others: https://orgmode.org/manual/Template-elements.html#Template-elements
tl;dr you can use file-olp
to specify a child node via its full hierarchical path vs ensuring uniqueness of the heading/node