Fork me on GitHub
#emacs
<
2022-10-22
>
macrobartfast06:10:08

I asked a variant of this before but can’t find the answer… is there any shortcut (paredit or otherwise) that will prepend the discard symbol #_ to a form the pointer is in?

tomd07:10:22

With smart-parens:

(defun discard-form ()
  (interactive)
  (save-excursion
    (sp-backward-up-sexp)
    (insert "#_")))

tomd07:10:53

or you could use paredit-backward-up if you use paredit

ag07:10:09

folks, the command you're looking for already exists in clojure-mode. it's clojure-toggle-ignore

metal 2
tomd07:10:18

Ah, nice! Much simpler

magnars08:10:37

Regardless of what already exists, I think it is a good idea to learn some basic emacs lisp in order to start the journey of improving your own editor.

2
ag08:10:09

What do you mean by "it is a good idea"? I'd put it differently. It's a requirement. You don't say: "it's a good idea to learn how to be calm and control your body to learn aikido..." - that's the whole purpose of it. Emacs is like aikido - the whole purpose of it is to run Lisp. And as you said - it's a journey, just like with aikido, there's no "completion", you just keep learning it.

lread13:10:03

I feel like the grasshopper who has not yet snatched the pebble

macrobartfast18:10:56

I am a grasshopper who has not grasped the pebble.

macrobartfast18:10:19

I appreciate all the answers… what exists already and also examples of how to do it myself. Both are great. Thank you all!

macrobartfast18:10:35

I didn’t find clojure-toggle-ignore as an option in my Emacs; I found this online, too: https://gist.github.com/yuhan0/38ac43c764017917fc3f3e5dc9104f1b

macrobartfast18:10:21

I’ll try @UE1N3HAJH’s code… I’m not sure actually how to make that something I can run with a binding… diving into the init.el… send help if I’m not back in five days.

tomd20:10:13

It was added in Feb 2021, so you may need to upgrade your clojure-mode package if it's older than that. If you want to stick with my code (whose behaviour is different, and may be what you prefer) or some code that you write, running with a binding would simply look like:

(define-key clojure-mode-map (kbd "C-#") #'discard-form)

otfrom17:10:03

another weekend where I'm going to try to have a working and shareable emacs config that plays well with nix (and includes things like org-roam, evil, emacs 29, pdf-tools)

👍 2
jjttjj20:10:15

i've also been fully trying to convert to nix this weekend (with mixed results so far)

lilactown18:10:45

nix: not even once

😂 1
elken19:10:09

It doesn't mix well with emacs, the nix version of Emacs has always been plagued with random issues that packaged versions just don't have. It's nice for .files until I move it to guix home though

lilactown19:10:11

I wish guix worked on macOS

upvote 1
lukasz19:10:13

I'm testing switching from lsp-mode to eglot - so far so good, but one thing I'm missing is code action for adding requires to the namespace macro - is that not supported by eglot or something?

vemv20:10:51

maybe Eric @ #CPABC1H61 knows this sort of thing well?

lukasz15:10:01

Yeah, i figured it's better to ask here first since it's more related to Emacs, but I'll there, thanks!