BetterThanTomorrow / BetterThanTomorrow/calva

Add paredit function `paredit-backward-kill-word`

Open
#2,003 4 comments 0 reactions 0 assignees View on GitHub
paredit
Dominant language
TypeScript
Stars
2.1k
Forks
249
Avg merge
6h 24m
Merged PRs (30d)
9

Description

As an Emacs user, I am accustomed to using the "paredit-backwards-kill-word" function to delete words backwards while preserving parentheses. This function doesn't appear to be available in Calva (unless I'm missing something?).

My VSCode-fu is not up to the task of porting the Emacs code to VSCode but I've included the Emacs implementation below for reference.

Many thanks!

http://paredit.org/releases/26/paredit.el

```elisp
(defun paredit-backward-kill-word ()
"Kill a word backward, skipping over any intervening delimiters."
(interactive)
(if (not (or (bobp)
(eq (char-syntax (char-before)) ?w)))
(let ((end (point)))
(backward-word 1)
(forward-word 1)
(goto-char (min end (point)))
(let* ((parse-state (paredit-current-parse-state))
(state
(paredit-kill-word-state parse-state 'char-before)))
(while (and (< (point) end)
(progn
(setq parse-state
(parse-partial-sexp (point) (1+ (point))
nil nil parse-state))
(or (eq state
(paredit-kill-word-state parse-state
'char-before))
(progn (backward-char 1) nil)))))
(if (and (eq state 'comment)
(eq ?\# (char-after (point)))
(eq ?\| (char-before (point))))
(backward-char 1)))))
(backward-kill-word 1))
```

Contributor guide

Open the contributing guide

Research direction

Use the linked paredit.el implementation as the behavioral reference, then locate Calva's existing paredit commands and their tests or command registrations. Confirm how backward word deletion currently works, implement the missing command while preserving parentheses, and verify deletion across delimiters and ordinary words.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.