Fork me on GitHub
#emacs
<
2019-07-17
>
Daouda10:07:55

Hey Folks, I am struggling to find out the way to select a form. I need to delete only a form and don`t know how to achieve that in emacs. Any help please?

practicalli-johnny11:07:53

@quieterkali If you are using smartparens then use the function sp-kill-sexp to kill the balanced expression following point. If point is inside an expression and there is no following expression, kill the topmost enclosing expression.

Daouda20:07:47

sorry @U05254DQM for taking so long to answer your message, actually I am using paredit

practicalli-johnny03:07:38

paredit-kill looks like it does what you want from the paredit cheetsheet http://pub.gajendra.net/src/paredit-refcard.pdf. I haven’t used paredit in about 5 years, so can’t confirm, sorry

ag20:07:21

Very often I need to convert a single line string to multi-line, I’d use fill-paragraph, but that’s not enough - Clojure (sadly) doesn’t support multi-line strings, so I have to wrap it into (str ,,,). Has anyone already written a function that does that conversion (and back to single line)? e.g.:

(foo "bla-bla-bla ,,,,,,")
becomes:
(foo (str "bla-bla-bla"
           ",,,,"
           ",,,,"))

ag20:07:35

elisp function I mean

andy.fingerhut20:07:33

Clojure does support multi-line strings. It doesn't support Python and some other language's feature of a triple-quoted string.

andy.fingerhut20:07:14

e.g. most doc strings are multi-line strings.

andy.fingerhut21:07:50

fill-paragraph works on them, with some limitations I haven't quite figured out completely, or tried to change fill-paragraph to improve upon. When writing doc strings, I often put the leading and ending double-quote on lines of their own, which seems to avoid a behavior of fill-paragraph that it will not do anything if there is a double-quote at the beginning and end of the string on one line.

ag21:07:53

ah, yeah, my bad… what I meant to say that :

(foo "foo bar")
and
(foo "foo
      bar")
won’t eval the same way, but
(foo (str "foo"
           "bar"))
would

ag21:07:14

that is why very often I have to convert from the first type to the last one

ag21:07:58

it shouldn’t be crazy difficult to write an elisp function that does that transform, that’s why I thought maybe someone already wrote one

andy.fingerhut22:07:07

understood. makes sense. I haven't.