Mercurial > emacs
changeset 25551:5cd9adabaee5
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 05 Sep 1999 23:44:56 +0000 |
parents | 05f27fc24f81 |
children | fbfe59033eaf |
files | lisp/textmodes/paragraphs.el |
diffstat | 1 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/paragraphs.el Sun Sep 05 21:22:48 1999 +0000 +++ b/lisp/textmodes/paragraphs.el Sun Sep 05 23:44:56 1999 +0000 @@ -185,6 +185,11 @@ (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 @@ (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 @@ 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 @@ (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, 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)