mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-11 09:20:51 +00:00
(backward-kill-sentence): Don't test minibuffer-prompt-end here.
(forward-sentence): Do handle it here. (backward-kill-paragraph): Don't test it here. (forward-paragraph): Handle it here.
This commit is contained in:
parent
e82d09c942
commit
779e6e56f2
@ -185,6 +185,11 @@ to which the end of the previous line belongs, or the end of the buffer."
|
||||
(concat paragraph-separate "\\|"
|
||||
fill-prefix-regexp "[ \t]*$")
|
||||
paragraph-separate))
|
||||
;; The end of the prompt is treated as a paragraph boundary.
|
||||
(prompt-end (if (window-minibuffer-p)
|
||||
(minibuffer-prompt-end)
|
||||
1))
|
||||
(orig-point (point))
|
||||
;; This is used for searching.
|
||||
(sp-paragraph-start (concat "^[ \t]*\\(" paragraph-start "\\)"))
|
||||
start found-start)
|
||||
@ -285,7 +290,13 @@ to which the end of the previous line belongs, or the end of the buffer."
|
||||
(forward-char 1))
|
||||
(if (< (point) (point-max))
|
||||
(goto-char start)))
|
||||
(setq arg (1- arg)))))
|
||||
(setq arg (1- arg)))
|
||||
(when (and (< orig-point prompt-end)
|
||||
(< prompt-end (point)))
|
||||
(goto-char prompt-end))
|
||||
(when (and (> orig-point prompt-end)
|
||||
(> prompt-end (point)))
|
||||
(goto-char prompt-end))))
|
||||
|
||||
(defun backward-paragraph (&optional arg)
|
||||
"Move backward to start of paragraph.
|
||||
@ -324,10 +335,7 @@ With arg N, kill back to Nth start of paragraph;
|
||||
negative arg -N means kill forward to Nth end of paragraph."
|
||||
(interactive "*p")
|
||||
(let ((start (point))
|
||||
(end (progn (backward-paragraph arg) (point)))
|
||||
(prompt-end (minibuffer-prompt-end)))
|
||||
(when (> end prompt-end)
|
||||
(goto-char (setq end prompt-end)))
|
||||
(end (progn (backward-paragraph arg) (point))))
|
||||
(kill-region start end)))
|
||||
|
||||
(defun transpose-paragraphs (arg)
|
||||
@ -369,13 +377,25 @@ sentences. Also, every paragraph boundary terminates sentences as well."
|
||||
(interactive "p")
|
||||
(or arg (setq arg 1))
|
||||
(while (< arg 0)
|
||||
(let ((par-beg (save-excursion (start-of-paragraph-text) (point))))
|
||||
(let ((par-beg (save-excursion (start-of-paragraph-text) (point)))
|
||||
(prompt-end (if (window-minibuffer-p)
|
||||
(minibuffer-prompt-end)
|
||||
1)))
|
||||
(if (and (< prompt-end (point))
|
||||
(> prompt-end par-beg))
|
||||
(setq par-beg prompt-end))
|
||||
(if (re-search-backward (concat sentence-end "[^ \t\n]") par-beg t)
|
||||
(goto-char (1- (match-end 0)))
|
||||
(goto-char par-beg)))
|
||||
(setq arg (1+ arg)))
|
||||
(while (> arg 0)
|
||||
(let ((par-end (save-excursion (end-of-paragraph-text) (point))))
|
||||
(let ((par-end (save-excursion (end-of-paragraph-text) (point)))
|
||||
(prompt-end (if (window-minibuffer-p)
|
||||
(minibuffer-prompt-end)
|
||||
1)))
|
||||
(if (and (> prompt-end (point))
|
||||
(< prompt-end par-end))
|
||||
(setq par-end prompt-end))
|
||||
(if (re-search-forward sentence-end par-end t)
|
||||
(skip-chars-backward " \t\n")
|
||||
(goto-char par-end)))
|
||||
@ -399,10 +419,7 @@ With arg, repeat; negative arg -N means kill back to Nth start of sentence."
|
||||
With arg, repeat, or kill forward to Nth end of sentence if negative arg -N."
|
||||
(interactive "*p")
|
||||
(let ((start (point))
|
||||
(end (progn (backward-sentence arg) (point)))
|
||||
(prompt-end (minibuffer-prompt-end)))
|
||||
(when (> end prompt-end)
|
||||
(goto-char (setq end prompt-end)))
|
||||
(end (progn (backward-sentence arg) (point))))
|
||||
(kill-region start end)))
|
||||
|
||||
(defun mark-end-of-sentence (arg)
|
||||
|
Loading…
Reference in New Issue
Block a user