Fork me on GitHub
#emacs
<
2022-07-26
>
borkdude13:07:45

Is it possible to disable paren matching within strings?

jkxyz12:07:48

With smartparens you can do

(sp-local-pair sp-lisp-modes "(" ")" :unless '(sp-in-string-p))

jkxyz12:07:14

Although that seems to break strictness when it's not in a string. I'm not sure how to modify the existing pair config

jkxyz15:07:04

(defun jk/smartparens-clojure-mode-init ()
  (sp-update-local-pairs '(:open "("
                           :close ")"
                           :actions (wrap insert autoskip navigate)
                           :unless (sp-in-string-p sp-point-before-same-p))))

(add-hook 'clojure-mode-hook 'jk/smartparens-clojure-mode-init)

borkdude15:07:50

Thanks, I'll try :)

borkdude15:07:18

Damn, it works, thanks a bunch!

jkxyz15:07:48

No problem! It always bothered me too. Makes writing doc strings annoying. If I want editor help with the syntax I just put it into a separate file and slurp it

borkdude15:07:51

Indeed or first write outside of the string and then wrap it

borkdude18:07:51

@UE72GJS7J This seems to not behave correct in this case:

(fw/watch "." (fn [event]
                             (when
                                 
                                 (#{:write :write|chmod} (:type event))
                               (println "hello!"))))
I was trying to wrap parens around _ (#{:write ... at the underscore, but it didn't balance there anymore

jkxyz12:08:36

Hmm I'm not sure what you mean. If I have |#{:foo} and I do sp-wrap-round it gives me (#{:foo}) as it should. I'm also using evil-cleverparens and it works correctly there

borkdude13:08:13

That exact example above didn't work for me

jkxyz16:08:51

Weird! Even if you directly do M-x sp-wrap-round?

pppaul13:07:29

for what mode? clojure-mode, paredit? by matching do you mean highlighting?

vemv19:07:28

I'm trying Emacs on an M2 mac for my first time ever. I'm trying the simplest thing for now, namely emacsformacosx universal. It works fine, also not noticeably slow. But the control key doesn't work - M-x describe-key and then <control> <any letter> will pretend I pressed nothing at all. Does that sound familiar?

vemv19:07:55

mac-command-modifier is set to control - same setup I've used for a long time

dpsutton19:07:45

verify in System Preferences > Keyboard > Modifier keys that nothing funky is going on?

dpsutton19:07:01

it is possible to map Control to the value no action

vemv20:07:10

almost, thanks for the pointer :) I had to disable these guys :man-facepalming:

dpsutton20:07:38

ah yeah. i keep those off. i think slurp keybindings conflict by default maybe?

dpsutton20:07:55

oh yeah that’s exactly it. those mission control left and right movements

jmayaalv20:07:59

i’ve been using emacsformacosx fine in m1 for about 3 months. should be fine in m2. Didn’t have to tweak anything else besides the mission control shortcuts.

👍 1