Skip to content

Commit

Permalink
Backspace always deletes charactres if region is specified (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
syohex authored and jrblevin committed Sep 20, 2016
1 parent 3f11a4a commit e89c377
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -4298,14 +4298,16 @@ before the current point, then exdent the line one level.
Otherwise, do normal delete by repeating
`backward-delete-char-untabify' ARG times."
(interactive "*p")
(let ((cur-pos (current-column))
(start-of-indention (save-excursion
(back-to-indentation)
(current-column)))
(positions (markdown-calc-indents)))
(if (and (> cur-pos 0) (= cur-pos start-of-indention))
(indent-line-to (markdown-exdent-find-next-position cur-pos positions))
(backward-delete-char-untabify arg))))
(if (use-region-p)
(backward-delete-char-untabify arg)
(let ((cur-pos (current-column))
(start-of-indention (save-excursion
(back-to-indentation)
(current-column)))
(positions (markdown-calc-indents)))
(if (and (> cur-pos 0) (= cur-pos start-of-indention))
(indent-line-to (markdown-exdent-find-next-position cur-pos positions))
(backward-delete-char-untabify arg)))))

(defun markdown-find-leftmost-column (beg end)
"Find the leftmost column in the region from BEG to END."
Expand Down

0 comments on commit e89c377

Please sign in to comment.