clojure-europe

thomas 2025-10-14T07:07:12.498359Z

mogge

imre 2025-10-14T07:20:58.722499Z

Morning

ray 2025-10-14T07:25:12.024519Z

W Good Morning (👋)

teodorlu 2025-10-14T07:42:28.750139Z

M GUD

danieroux 2025-10-14T07:43:27.742799Z

morning

2025-10-14T08:03:08.262239Z

Morning

reefersleep 2025-10-14T08:11:39.939239Z

Good morning!

lread 2025-10-14T10:32:14.246569Z

X Good Morning (Ray)

grav 2025-10-14T12:15:22.958199Z

Morning!

borkdude 2025-10-14T12:54:07.037039Z

Did you know that Clojure has string interpolation these days?

😂 4
imre 2025-10-14T12:54:53.629859Z

was that not always the case?

borkdude 2025-10-14T12:55:34.020349Z

It's a joke (with some truth to it) that I stole from @andersmurphy

imre 2025-10-14T12:56:36.319289Z

ouch

borkdude 2025-10-14T12:57:08.831159Z

I think he wasn't cynical but really likes it

borkdude 2025-10-14T12:57:33.202689Z

when you're not using whitespace in str it does look strangely close like string interpolation, except for the quotes

imre 2025-10-14T12:58:26.079899Z

(str "string "(+ 1 2 3)" interpolation looks good")

imre 2025-10-14T12:58:30.091259Z

works with spaces too

imre 2025-10-14T12:58:53.780219Z

you could say for interpolation use double quotes 😛

borkdude 2025-10-14T12:58:54.800929Z

lol, yeah I mean not using spaces in between arguments

borkdude 2025-10-14T12:59:05.013349Z

indeed :) the right mindset :)

imre 2025-10-14T12:59:17.781619Z

unescaped double quotes that is

borkdude 2025-10-14T12:59:24.169099Z

yes

borkdude 2025-10-14T13:16:06.974149Z

Hmm, this is pretty awesome, why didn't I think about this sooner.

(defun split-string-at-point ()
  "Split the string at point into two quoted strings, keeping syntax correct."
  (interactive)
  (when (nth 3 (syntax-ppss))  ; are we inside a string?
    (insert "\"\"")
    (backward-char 1)))
Break the string into two parts at cursor, so you can type an expression

borkdude 2025-10-14T13:16:15.888719Z

This works beautifully with str

seancorfield 2025-10-14T13:27:23.368199Z

Don't most editors have a split s-exp that works on strings already? In Calva it's ctrl+shift+s

borkdude 2025-10-14T13:28:24.977339Z

ah yes, why is it called split-sexpr?

borkdude 2025-10-14T13:28:46.293229Z

I see, it works for (...) -> (..)(..) too

borkdude 2025-10-14T13:28:54.363859Z

TIL!

🔥 1
seancorfield 2025-10-14T13:29:07.872549Z

(+ 1 2| 3) => (+ 1 2) ( 3)

seancorfield 2025-10-14T13:29:31.214599Z

"Hello, |World!" => "Hello, " "World!"

seancorfield 2025-10-14T13:29:47.842159Z

I mostly use it with strings 🙂

borkdude 2025-10-14T13:30:31.540479Z

nice, thanks!

borkdude 2025-10-14T13:35:16.197059Z

I didn't know you could do M+shift+s, to get M-S, you know, my emacs habits are pretty basic but this one will stay in my toolbox!

borkdude 2025-10-14T13:40:28.055339Z

lol... using an emacs overlay I have something that looks like string templating..

🤣 2
borkdude 2025-10-14T13:41:21.259209Z

you can try it if you want:

(defun clojure-hide-str-quotes ()
  "Visually hide quotes around Clojure str expressions like (+ 1 2 3)."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    ;; look for a pattern: "something"
    (while (re-search-forward "\"\\(([^)]*)\\)\"" nil t)
      (let ((start (match-beginning 0))
            (end (match-end 0))
            (expr (match-string 1)))
        ;; create overlay
        (let ((ov (make-overlay start end)))
          (overlay-put ov 'display (concat "{" expr "}"))
          (overlay-put ov 'face 'default)
          (overlay-put ov 'evaporate t))))))

borkdude 2025-10-14T13:41:41.129069Z

it will mess up your editor experience though 😆

borkdude 2025-10-14T13:41:56.510299Z

e.g. I can't get rid of the code part in the template anymore

ray 2025-10-14T14:57:57.386309Z

(format "url: `\\${window.location.origin}/%s`," schema-name)
to enable JS string interpolation that we ship out from CLJ 🪢

ray 2025-10-14T14:59:17.764289Z

I knew the feature existed but it's hilarious to me that this is the only time I've used it 😅

borkdude 2025-10-14T15:03:10.935349Z

what feature?

ray 2025-10-14T18:23:35.694849Z

The string templates in JS

borkdude 2025-10-14T18:25:26.720739Z

ah yeah. I'm currently working on a str version in squint which is likely going to compile down to JS templates

👌🏼 1
2025-10-15T22:02:43.371749Z

Haha, yeah it was mostly a realisation that if you remove the spaces, you are less likely to miss a space (which is what always happened to me when using str) + as you said it basically looks like string interpolation, with automatic syntax highlights etc. I have a similar split string function in emacs. Or to be more precise if I insert a " without a preceding \ in a string it will insert "" and move the cursor into the middle so "|".

2025-10-15T22:04:03.187799Z

Definitely considering stealing the overlay you've come up with. 🤣