This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-03
Channels
- # beginners (167)
- # boot (22)
- # chestnut (3)
- # cider (9)
- # clojure (107)
- # clojure-berlin (1)
- # clojure-greece (3)
- # clojure-italy (6)
- # clojure-losangeles (6)
- # clojure-russia (8)
- # clojure-spec (71)
- # clojure-uk (42)
- # clojurescript (186)
- # community-development (1)
- # core-async (12)
- # core-typed (1)
- # css (15)
- # cursive (29)
- # data-science (11)
- # datomic (8)
- # defnpodcast (28)
- # duct (2)
- # fulcro (169)
- # graphql (6)
- # hoplon (3)
- # jobs-discuss (1)
- # kekkonen (5)
- # leiningen (11)
- # lumo (7)
- # off-topic (14)
- # om (1)
- # other-languages (14)
- # portkey (7)
- # re-frame (27)
- # reagent (14)
- # remote-jobs (1)
- # ring-swagger (5)
- # rum (15)
- # shadow-cljs (52)
- # spacemacs (59)
- # specter (78)
- # test-check (3)
- # vim (9)
- # yada (23)
I was also contemplating of switching to develop because of Parinfer, but it looks that 0.300 is almost ready for release: https://github.com/syl20bnr/spacemacs/blob/65d5e42b8ea603abe25cbf3a832a204c15aeedd8/core/info/release-notes/0.300.txt
Is there a way to “stash” all open buffers so I can switch to a new project without accidentally open an unrelated buffer?
In other editors I’d just start a new instance, but with emacs I do “emacsclient -n .” to open the current directory; the problem is, all my previous buffers are still there.
There is a M-x helm-persp-switch-project
to create a new layer
to your project, to switch between then use M-x layouts-transient-state
@U7PBP4UVA so this is little script I wrote awhile ago:
#!/bin/bash
# Selected options for "emacsclient"
#
# -c Create a new frame instead of trying to use the current
# Emacs frame.
#
# -e Evaluate the FILE arguments as ELisp expressions.
#
# -n Don't wait for the server to return.
#
# -t Open a new Emacs frame on the current terminal.
#
# Note that the "-t" and "-n" options are contradictory: "-t" says to
# take control of the current text terminal to create a new client frame,
# while "-n" says not to take control of the text terminal. If you
# supply both options, Emacs visits the specified files(s) in an existing
# frame rather than a new client frame, negating the effect of "-t".
# check whether an Emacs server is already running
pgrep -l "^Emacs$" > /dev/null
# otherwise, start Emacs server daemon
if [ $? -ne 0 ]; then
## get the path to emacs-app
open -g $(brew info emacs-plus | sed -n '4p' | sed 's/ .*$//g')/Emacs.app
sleep 15
emacsclient -e "(progn (persp-add-new \"$(pwd)\") (persp-switch \"$(pwd)\"))"
# exit 1
fi
# return a list of all frames on $DISPLAY
emacsclient -e "(frames-on-display-list)" &>/dev/null
# open frames detected, so open files in current frame
if [ $? -eq 0 ]; then
emacsclient -e "(progn (persp-add-new \"$(pwd | grep -o '[^/]*$')\") (persp-switch \"$(pwd | grep -o '[^/]*$')\"))"
emacsclient -n -t $*
# no open frames detected, so open new frame
else
emacsclient -e "(progn (persp-add-new \"$(pwd | grep -o '[^/]*$')\") (persp-switch \"$(pwd | grep -o '[^/]*$')\"))"
emacsclient -n -c $*
fi
if you put it say in ~/.ec and `alias ec='~/.ec'` then you can do something like cd ~/proj & ec .
the script can be improved - I just haven't had time to do it. I've been using eshell lately, so I almost don't use it anymore
I actually do generally start new instances for separate projects, although I'm sure there's a more emacsy way to do it.
@eggsyntax use layouts aka perps
everyone is excited about parinfer and I'm 95% fed up with lisp state enough to attempt porting vim-sexp
I haven't heard of vim-sexp before. What are your pain points for evil-lisp-state @bja?
@bja - I don't have that pain at present, but I'm definitely open to an alternative approach. I may just not know what I'm missing.
I used vim for about 15 years. I've become very accustomed to using motions and operators as the basics of my editing experience. vim-sexp added sexp-aware motions
You have my attention.
That does sound cool.
but the paint point is that I want to select using evil commands without prefixing everything with a V so that my selection is put somewhere something like cider-eval-region can find it
Like <eval-motion>a)
to evaluate the present s-expression?
I can do this pretty easily:
(defvar spacemacs--generic-eval-region-alist
'((clojure-mode . cider-eval-region)
(emacs-lisp-mode . spacemacs//emacs-lisp-eval-region-and-print)
(python-mode . python-shell-send-region)
(lisp-mode . lisp-eval-region)))
(defun spacemacs//get-eval-region-for-current-mode ()
(interactive)
(catch 'break
(dolist (test spacemacs--generic-eval-region-alist)
(let ((mode (car test))
(val (cdr test)))
(when (and (symbolp mode)
(derived-mode-p mode)
(symbolp val))
(throw 'break val))))))
(defun spacemacs//generic-eval-region (beg end)
(interactive)
(let ((f (spacemacs//get-eval-region-for-current-mode)))
(when (functionp f)
(funcall f beg end))))
(evil-define-operator spacemacs//generic-evil-eval-operator (beg end)
(spacemacs//generic-eval-region beg end))
(I define the stuff generically because I hate having separate keybindings for different languages)
Yeah, I've got a pretty similar eval-operator defined, but it's not great with recognizing the beginnings and ends of sexps.
So I can do, eg <alt> e %
from a paren to say (effectively) eval around paren, but it's a bit wonky.
so I don't actually need to use visual mode...another example, I can do <alt> e a ]
for eval-around-square-brackets, or <alt> e $
for eval to end of line. Is that how yours works as well? I'm just not clear on the issue w/ visual mode.
(I could decipher it from your code, but it'd take me a while, my emacs-lisp-fu isn't that hot)
That's the best I've been able to do; if you find something better, I'd love to hear abuot it.
but the selection of sexps isn't as crisp as I'd like in evil. Maybe cleverparens can help with that
I learned a few things about elisp by reading your code, @bja. Thanks for sharing that.
Crap, I'm sorry, I totally misled folks yesterday. The built-in SM structural editing, built on top of paredit, is smartparens, not cleverparens. cleverparens is something totally different (which seemed cool but conflicted with too many bindings for me personally). I just got thrown off by the names being so similar. @ag @drewverlee https://practicalli.github.io/spacemacs/structured-editing/
I should be doing more work on practicalli spacemacs over the winter holidays. I've got a lot of notes to add 🙂