aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-09-05 23:44:56 +0000
committerRichard M. Stallman1999-09-05 23:44:56 +0000
commit779e6e56f2877cc63070243781e2692d0ac54ecd (patch)
tree9067656d5948859ac2124e1640215ef46a9c0ebe
parente82d09c94233befaf76a01ca4ab5753c2efcfcf2 (diff)
downloademacs-779e6e56f2877cc63070243781e2692d0ac54ecd.tar.gz
emacs-779e6e56f2877cc63070243781e2692d0ac54ecd.zip
(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.
-rw-r--r--lisp/textmodes/paragraphs.el39
1 files changed, 28 insertions, 11 deletions
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 6f958ce5aac..2271bdab036 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -185,6 +185,11 @@ to which the end of the previous line belongs, or the end of the buffer."
185 (concat paragraph-separate "\\|" 185 (concat paragraph-separate "\\|"
186 fill-prefix-regexp "[ \t]*$") 186 fill-prefix-regexp "[ \t]*$")
187 paragraph-separate)) 187 paragraph-separate))
188 ;; The end of the prompt is treated as a paragraph boundary.
189 (prompt-end (if (window-minibuffer-p)
190 (minibuffer-prompt-end)
191 1))
192 (orig-point (point))
188 ;; This is used for searching. 193 ;; This is used for searching.
189 (sp-paragraph-start (concat "^[ \t]*\\(" paragraph-start "\\)")) 194 (sp-paragraph-start (concat "^[ \t]*\\(" paragraph-start "\\)"))
190 start found-start) 195 start found-start)
@@ -285,7 +290,13 @@ to which the end of the previous line belongs, or the end of the buffer."
285 (forward-char 1)) 290 (forward-char 1))
286 (if (< (point) (point-max)) 291 (if (< (point) (point-max))
287 (goto-char start))) 292 (goto-char start)))
288 (setq arg (1- arg))))) 293 (setq arg (1- arg)))
294 (when (and (< orig-point prompt-end)
295 (< prompt-end (point)))
296 (goto-char prompt-end))
297 (when (and (> orig-point prompt-end)
298 (> prompt-end (point)))
299 (goto-char prompt-end))))
289 300
290(defun backward-paragraph (&optional arg) 301(defun backward-paragraph (&optional arg)
291 "Move backward to start of paragraph. 302 "Move backward to start of paragraph.
@@ -324,10 +335,7 @@ With arg N, kill back to Nth start of paragraph;
324negative arg -N means kill forward to Nth end of paragraph." 335negative arg -N means kill forward to Nth end of paragraph."
325 (interactive "*p") 336 (interactive "*p")
326 (let ((start (point)) 337 (let ((start (point))
327 (end (progn (backward-paragraph arg) (point))) 338 (end (progn (backward-paragraph arg) (point))))
328 (prompt-end (minibuffer-prompt-end)))
329 (when (> end prompt-end)
330 (goto-char (setq end prompt-end)))
331 (kill-region start end))) 339 (kill-region start end)))
332 340
333(defun transpose-paragraphs (arg) 341(defun transpose-paragraphs (arg)
@@ -369,13 +377,25 @@ sentences. Also, every paragraph boundary terminates sentences as well."
369 (interactive "p") 377 (interactive "p")
370 (or arg (setq arg 1)) 378 (or arg (setq arg 1))
371 (while (< arg 0) 379 (while (< arg 0)
372 (let ((par-beg (save-excursion (start-of-paragraph-text) (point)))) 380 (let ((par-beg (save-excursion (start-of-paragraph-text) (point)))
381 (prompt-end (if (window-minibuffer-p)
382 (minibuffer-prompt-end)
383 1)))
384 (if (and (< prompt-end (point))
385 (> prompt-end par-beg))
386 (setq par-beg prompt-end))
373 (if (re-search-backward (concat sentence-end "[^ \t\n]") par-beg t) 387 (if (re-search-backward (concat sentence-end "[^ \t\n]") par-beg t)
374 (goto-char (1- (match-end 0))) 388 (goto-char (1- (match-end 0)))
375 (goto-char par-beg))) 389 (goto-char par-beg)))
376 (setq arg (1+ arg))) 390 (setq arg (1+ arg)))
377 (while (> arg 0) 391 (while (> arg 0)
378 (let ((par-end (save-excursion (end-of-paragraph-text) (point)))) 392 (let ((par-end (save-excursion (end-of-paragraph-text) (point)))
393 (prompt-end (if (window-minibuffer-p)
394 (minibuffer-prompt-end)
395 1)))
396 (if (and (> prompt-end (point))
397 (< prompt-end par-end))
398 (setq par-end prompt-end))
379 (if (re-search-forward sentence-end par-end t) 399 (if (re-search-forward sentence-end par-end t)
380 (skip-chars-backward " \t\n") 400 (skip-chars-backward " \t\n")
381 (goto-char par-end))) 401 (goto-char par-end)))
@@ -399,10 +419,7 @@ With arg, repeat; negative arg -N means kill back to Nth start of sentence."
399With arg, repeat, or kill forward to Nth end of sentence if negative arg -N." 419With arg, repeat, or kill forward to Nth end of sentence if negative arg -N."
400 (interactive "*p") 420 (interactive "*p")
401 (let ((start (point)) 421 (let ((start (point))
402 (end (progn (backward-sentence arg) (point))) 422 (end (progn (backward-sentence arg) (point))))
403 (prompt-end (minibuffer-prompt-end)))
404 (when (> end prompt-end)
405 (goto-char (setq end prompt-end)))
406 (kill-region start end))) 423 (kill-region start end)))
407 424
408(defun mark-end-of-sentence (arg) 425(defun mark-end-of-sentence (arg)