Fork me on GitHub
#emacs
<
2018-10-04
>
orestis06:10:43

Thanks @chase-lambert! I love Vim keybindings when moving around code, since they are objectively more ergonomical. But I am now learning the pure Emacs way, I have a hunch it’s a better fit for Lispy stuff. Plus yes, all the guides out there really are made for the default keybindings.

Chase18:10:26

I can agree with this. One thing I started doing with Vim (and I was never a huge power user) and now with Emacs keybindings is using search to navigate as quickly and efficiently as possible. C-s really gets me somewhere pretty fast and I still have a lot to learn in terms of navigating in such a manner. Something to think about if you aren't already doing so.

practicalli-johnny13:10:45

@U7PBP4UVA I have made the transition the other way, from Emacs to Vim bindings. As a long term Emacs user, I find Vim keybindings so much faster and easier to type. I use Spacemacs as my base configuration, as it provides Vim bindings for all modes. There is also lisp state which is great for structural editing of lisp code.

bozhidar07:10:05

> he’s just kept pushing the 2.1 release out so now “develop” is ~3k+ commits ahead of the last release

bozhidar07:10:43

Well, I think Prelude doesn’t have so many commits for its entire existence. 😄 I wonder what those people are doing - that’s just an Emacs config after all. 😄 😄 😄

bozhidar07:10:28

As a comparison - my personal config has just 71 commits (https://github.com/bbatsov/emacs.d)

orestis07:10:20

So you don’t use prelude @bozhidar ?

orestis07:10:03

Aaargh, I thought I was done with editor customization but it’s sooo addictive :)

bozhidar07:10:49

It used to be my own configuration for a long period of time, but then I got annoyed that I had to add a lot of flexibility there, which I didn’t really need myself, as I know exactly what I want to use. It also became harder to make baseline changes, as I had to think about impacting the users. At this point I decided that Prelude and my config become separate things. 🙂

bozhidar07:10:46

In general I think that most Clojure devs need simply a 100-lines of config with 5-10 packages in it and they’ll be fine.

orestis07:10:37

Yeah, that’s the direction I’m going for. For JS stuff I’ve resigned myself to VSCode these days.

bozhidar07:10:56

I’m not into JS, but it looks pretty sweet.

orestis08:10:56

Interesting, I’ll have a look.

orestis08:10:24

Vs code has some pretty nice static analysis which is very useful when exploring a codebase.

orestis08:10:12

Which is I think something of a divide between tools. Modern IDEs seem to target exploration, old editors creation. Perhaps I’m just making things up though :)

bozhidar08:10:18

Very interesting perspective!

bozhidar08:10:36

I have to say I somewhat agree with it - I recall I was thinking along the same lines when I made the switch from IDEs to Emacs. The exploration features of the ide-s were something I really missed (especially for Java development). Turned out that if you put your mind to it you can get similar results with Emacs and Vim, but it’s certainly non-trivial to get there. 🙂

theeternalpulse11:10:55

I've switched to ivy and noticed all my ivy related searches start with ^. I can't seem to find the setting specifically for the initial search pattern in ivy, is something else controlling this? actually I somehow got a search to find an article with the ^ https://oremacs.com/2016/01/06/ivy-flx/

Chase21:10:07

i'm probably in an extreme minority but so far i am not liking how heavy handed the auto pair-ing functionality works in things like paredit (like I can't delete the closing paren) and smartparens, etc. Tbh, I always struggled with that in vim too. Right now i just want to go super minimal on that stuff. rainbow delimiters lets me see if i have parens balanced for now. but i know i will definitely want to have structural editing of s-expression capability, right? does emacs have built in functionality for that? if not, what is the most non invasive way to go about this? do some folks actually find they are ok without it or am i getting too minimal here and really holding myself back?

dpsutton21:10:03

i'm not sure i follow. if you don't have balanced parens at all time how could you do structural editing?

Chase21:10:43

hmmm, that's a good point. but why can't i just be balancing the parens myself?

Chase21:10:51

i'm still in the learning phase so most of my programming is following along in books and tutorials and writing small functions. a lot of stuff straight in the repl. maybe i'm not grasping just how unwieldy it will eventually get?

dpsutton22:10:18

well you can

dpsutton22:10:53

but it will probably often do the wrong thing. "kill until this closing parens" will wipe your buffer if there is no closing parens

dpsutton22:10:25

i can't imagine when i would ever not want a closing paren. And since everything is balanced, I can easily slurp things in, or delete entire forms at a time, etc

Chase22:10:17

i see where you are going with this. in my head i was thinking you are using structural editing on an already completed function and s-expressions that you want to edit.

Chase22:10:30

my main workflow is putting things in the repl so without that closing paren I can just hit enter and enter the rest of the expression like normal without it evaluating. then when i'm ready i hit Ctl-Enter and it autocompletes all the closing parens needed and evaluates. I'm suspecting this is not an idiomatic way of developing in clojure

dpsutton22:10:45

ah. yes i do something to inhibit evaluation as well

dpsutton22:10:00

(define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
(define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return)

👍 8
practicalli-johnny13:10:11

@U11BV7MTK Excellent. I was just about to figure out how to do multi-line editing in the repl buffer, so thanks for sharing.

dpsutton22:10:09

makes a world of difference

dpsutton22:10:20

i want enter to give a new line and control enter to "submit"

dpsutton22:10:27

i think cursive it like this and it is super nice

Chase22:10:38

Aha! This might be exactly what solves my pain point. Thank you!

dpsutton22:10:56

yes i have felt that pain. i think this will be much nicer for you as you learn to use structural editing

Chase22:10:06

So what do you prefer for your auto pairing/structural editing while I have ya?

dpsutton22:10:08

are you using terminal emacs or gui?

dpsutton22:10:37

ok good. i ran into some issues ensuring there was a control-enter in terminal emacs on osx. but shouldn't be a problem for you

dpsutton22:10:59

i use paredit. It's less "magical" and therefore predictive. I haven't ever used parinfer and i've heard some people rave about it though

Chase22:10:14

i'm using use-package so where exactly do i put those two functions?

Chase22:10:03

i think i will just go back to trying to learn paredit too.

dpsutton22:10:28

(use-package foo
  :init
  (setq foo-variable t))

dpsutton22:10:43

i think you put it in an :init form. I don't use use-package though so i'm not positive

Chase22:10:42

can't get it to work. i'll keep trying though, i think that is basically exactly what i wanted without realizing it.

dpsutton22:10:52

what are your symptoms of it not working?

dpsutton22:10:01

error message or it just doesn't seem to take?

dpsutton22:10:21

and did you put them there and then restart emacs? if you eval them manually do they work?

dpsutton22:10:48

use package is macro-y so you probably want to put them there and then just eval-expression on those forms so they work now

Chase22:10:45

got it! I just didn't have it in the right spot. sweet! thanks a bunch. I'm probably too attached to this way of working but for now it works for me and now i can slowly learn paredit without it completely overhauling my learning workflow

dpsutton22:10:21

make emacs work for you 🙂

Chase22:10:00

i'm so geeking out over emacs/lisps! i'm wondering if use-package goes against my trying to have real control over my config and learn emacs from "first principles" minimalism kind of reboot. i always loved vim-plug though cuz it just works and it is dead simple.

dpsutton22:10:18

i think use-package gives you quite a bit of control and makes sure you do lots of things right. it makes it quite nice. if i were to start over i'd probably use it

dpsutton22:10:37

it's also from the current maintainer of emacs so it's got some real quality behind it

Chase22:10:20

awesome. i appreciate all the advice

dadair23:10:27

There is a youtube video where the creator of use-package shows exactly how it works (he shows what it macroexpands to in different situations). That might lift the veil.