Function: org-delete-backward-char

org-delete-backward-char is an interactive and byte-compiled function defined in org.el.gz.

Signature

(org-delete-backward-char N)

Documentation

Like delete-backward-char, insert whitespace at field end in tables.

When deleting backwards, in tables this function will insert whitespace in front of the next "|" separator, to keep the table aligned. The table will still be marked for re-alignment if the field did fill the entire column, because, in this case the deletion might narrow the column.

This function has :before advice: org-fold-check-before-invisible-edit-maybe.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-delete-backward-char (N)
  "Like `delete-backward-char', insert whitespace at field end in tables.
When deleting backwards, in tables this function will insert whitespace in
front of the next \"|\" separator, to keep the table aligned.  The table will
still be marked for re-alignment if the field did fill the entire column,
because, in this case the deletion might narrow the column."
  (interactive "p")
  (save-match-data
    (if (and (= N 1)
	     (not overwrite-mode)
	     (not (org-region-active-p))
	     (not (eq (char-before) ?|))
	     (save-excursion (skip-chars-backward " \t") (not (bolp)))
	     (looking-at-p ".*?|")
	     (org-at-table-p))
	(progn (forward-char -1) (org-delete-char 1))
      (funcall-interactively #'backward-delete-char N)
      (when org-auto-align-tags (org-fix-tags-on-the-fly)))))