AmaiKinono / puni

Structured editing (soft deletion, expression navigating & manipulating) that supports many major modes out of the box.
GNU General Public License v3.0
403 stars 21 forks source link

Delete indentations with backward-delete-char-untabify #43

Closed roife closed 1 year ago

roife commented 1 year ago

backward-delete-char-untabify is a useful built-in command for deleting indentations quickly. Here's an example (setting (setq backward-delete-char-untabify-method 'hungry)):

(use-package ialign
  :straight t
  :config
  (defun ()
      |...))

when I press backspace, it changes to

(use-package ialign
  :straight t
  :config
  (defun ()
|...))

It does not work with puni. Since DEL is bond with puni-backward-delete-char, how can I delete indentations quickly?

AmaiKinono commented 1 year ago

Sorry for the late response.

A simple fix is:

(defun my-backspace ()
  (interactive)
  (if (looking-back (rx line-start (+ blank)))
      (delete-region (line-beginning-position) (point))
    (puni-backward-delete-char)))

then bind it to DEL.