Fork me on GitHub
#emacs
<
2020-03-01
>
lispyclouds12:03:05

Any *Doom Emacs* users use any safe structural editing modes here? If yes, how do you configure it?

Nir Rubinstein12:03:53

I use doom. As for safe editing, I use it. I’ts pretty much auto configured. I added in my config the following:

(add-hook! smartparens-mode
  (evil-cleverparens-mode)
  (evil-unimpaired-mode)
  (smartparnes-strict-mode))

Nir Rubinstein12:03:33

Since smartparens is enabled by default (AFAIK) Keep in mind that I’m an emacs noob so this my be overkill/incorrect - YMMV

lispyclouds12:03:38

would i need to install evil-cleverparens-mode for it?

lispyclouds12:03:12

dont think that exists by default? I too am just starting out with Doom

Nir Rubinstein12:03:33

Yup - just add it to packages.el in your doom directory

Nir Rubinstein12:03:25

I also added unimpared - you can just delete it if you don’t use it (it’s from my vim days)

lispyclouds12:03:51

I added (package! evil-cleverparens) in packages.el and

(add-hook! smartparens-mode
  (evil-cleverparens-mode)
  (smartparens-strict-mode))
in config.el but i can still delete the closing braces, what i am missing?

lispyclouds13:03:28

what i want is the (spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks) like behaviour. But cant find its source to copy too 😕

lispyclouds13:03:10

yeah i did that

lispyclouds13:03:54

I should not be able to delete closing parens, braces right?

lispyclouds15:03:50

ah, the mode is activated. the spacemacs one doesnt let me delete the closing ones in addition to this too. was hoping i can get that behavior here too

Nir Rubinstein16:03:33

For me, deleting occurs, but it deletes both the opening AND the closing parens - thus keeping my s-expression balanced

lispyclouds18:03:33

@U0JLDMT9P does it work for example in (def a (+ 1 2)) and I delete the ) after 2? The one before + is deleted too? Or only if the sexp is empty? The first case is not possible in spacemacs.

lispyclouds18:03:30

@U8QBZBHGD that was my intent too. But failing to find where that could be defined

lispyclouds18:03:27

Or I guess I will reset my head and muscles and just follow doom 😄 really liking its snappy speeds and lean features, specially compared to spacemacs. Thanks for the pointers @U8QBZBHGD

practicalli-john20:03:00

Sounds like smart-parens is not in strict mode, if you can delete parens and leave them unbalanced.

romain20:03:47

After modifying config files you have to do doom refresh :)

lispyclouds20:03:06

@U050PEFK2 yes i did that pretty much after every change 🙂

4
lispyclouds20:03:00

@U05254DQM where can i find the impl of (spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks) ?

lispyclouds20:03:40

@U050PEFK2 still I'm able to delete the closing braces and leave it unbalanced. These are all the changes I made in config.el:

(add-hook! smartparens-mode
  (smartparens-global-strict-mode))
it says the strict mode is on and also I cannot _add a ) back after i have unbalanced it. it says cannot do that in strict mode 😕

practicalli-john20:03:41

I believe that toggle code is generated by other code, so no explicit code to copy.

practicalli-john20:03:16

Are you deleting close parens in Evil insert mode or Evil normal mode

lispyclouds20:03:30

in insert mode

practicalli-john20:03:57

Very strange then. Unless something is broken with the package, then it sounds like something is conflicting with something else in doom or another package. I am just guessing now (not a doom user)

lispyclouds20:03:58

yeah im beginning to think so too. I have asked this on their discord channel now. fingers crossed! Thanks for the help @U05254DQM

romain22:03:42

Maybe Try to reach henrik on doom’s discord?

4
iammiles16:03:50

I removed smartparens in favor of paredit. Works pretty well for me.

ag23:03:35

> I removed smartparens in favor of paredit. Why though? you could just do M-x sp-use-paredit-bindings

iammiles00:03:26

For the reason that was mentioned earlier: smartparens allows me to unbalance parens a little too easily. I find that paredit makes that a bit more difficult.

nmkip01:03:18

Is there a package that prevents me from deleting parens in normal mode?

practicalli-john09:03:23

@UJCC6CE9E smartparens in strict mode prevents deletion of parens where that would make them unbalanced. smartparens is included in Spacemacs (a simple config to set to strict mode). There seems to be an issue using smartparens in Doom for some people.

nmkip01:03:23

It seems to be working with evil-paredit in Doom

nmkip01:03:52

I'm still deciding between Doom and Spacemacs (and cursive which is the one I usually use 🙂 )