Function: just-ts-backspace-whitespace-to-tab-stop

just-ts-backspace-whitespace-to-tab-stop is an interactive and natively compiled function defined in just-ts-mode.el.

Signature

(just-ts-backspace-whitespace-to-tab-stop)

Documentation

Delete whitespace backwards to the next tab-stop, or delete one text char.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/1vmf8s52d6vniw28ckf3szxslimhfphb-emacs-packages-deps/share/emacs/site-lisp/elpa/just-ts-mode-20260319.1513/just-ts-mode.el
(defun just-ts-backspace-whitespace-to-tab-stop ()
  "Delete whitespace backwards to the next tab-stop, or delete one text char."
  (interactive)
  (if (or indent-tabs-mode
          (region-active-p)
          (save-excursion
            (> (point) (progn (back-to-indentation)
                              (point)))))
      (call-interactively #'backward-delete-char-untabify)
    (let ((movement (% (current-column) just-ts-indent-offset))
          (p (point)))
      (when (= movement 0) (setq movement just-ts-indent-offset))
      ;; Account for edge case near beginning of buffer
      (setq movement (min (- p 1) movement))
      (save-match-data
        (if (string-match "[^\t ]*\\([\t ]+\\)$" (buffer-substring-no-properties (- p movement) p))
            (delete-char (- (match-beginning 1) (match-end 1)))
          (call-interactively #'backward-delete-char))))))