Mercurial > emacs
comparison lisp/simple.el @ 892:3a9943a4a440
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 29 Jul 1992 02:15:26 +0000 |
parents | b945f592b94d |
children | c5c4c2ee8f26 |
comparison
equal
deleted
inserted
replaced
891:f7de428cb8bf | 892:3a9943a4a440 |
---|---|
54 (insert char) | 54 (insert char) |
55 (setq arg (1- arg))))) | 55 (setq arg (1- arg))))) |
56 | 56 |
57 (defun delete-indentation (&optional arg) | 57 (defun delete-indentation (&optional arg) |
58 "Join this line to previous and fix up whitespace at join. | 58 "Join this line to previous and fix up whitespace at join. |
59 If there is a fill prefix, delete it from the beginning of this line. | |
59 With argument, join this line to following line." | 60 With argument, join this line to following line." |
60 (interactive "*P") | 61 (interactive "*P") |
61 (beginning-of-line) | 62 (beginning-of-line) |
62 (if arg (forward-line 1)) | 63 (if arg (forward-line 1)) |
63 (if (eq (preceding-char) ?\n) | 64 (if (eq (preceding-char) ?\n) |
64 (progn | 65 (progn |
65 (delete-region (point) (1- (point))) | 66 (delete-region (point) (1- (point))) |
67 ;; If the second line started with the fill prefix, | |
68 ;; delete the prefix. | |
69 (if (and fill-prefix | |
70 (string= fill-prefix | |
71 (buffer-substring (point) | |
72 (+ (point) (length fill-prefix))))) | |
73 (delete-region (point) (+ (point) (length fill-prefix)))) | |
66 (fixup-whitespace)))) | 74 (fixup-whitespace)))) |
67 | 75 |
68 (defun fixup-whitespace () | 76 (defun fixup-whitespace () |
69 "Fixup white space between objects around point. | 77 "Fixup white space between objects around point. |
70 Leave one space or none, according to the context." | 78 Leave one space or none, according to the context." |
420 | 428 |
421 (put 'previous-matching-history-element 'enable-recursive-minibuffers t) | 429 (put 'previous-matching-history-element 'enable-recursive-minibuffers t) |
422 (defun previous-matching-history-element (regexp n) | 430 (defun previous-matching-history-element (regexp n) |
423 (interactive "sPrevious element matching (regexp): \np") | 431 (interactive "sPrevious element matching (regexp): \np") |
424 (let ((history (symbol-value minibuffer-history-variable)) | 432 (let ((history (symbol-value minibuffer-history-variable)) |
433 prevpos | |
425 (pos minibuffer-history-position)) | 434 (pos minibuffer-history-position)) |
426 (while (/= n 0) | 435 (while (/= n 0) |
427 (setq prevpos pos) | 436 (setq prevpos pos) |
428 (setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history))) | 437 (setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history))) |
429 (if (= pos prevpos) | 438 (if (= pos prevpos) |
430 (error (if (= pos 1) | 439 (error (if (= pos 1) |
431 "No following item in minibuffer history" | 440 "No later matching history item" |
432 "No preceding item in minibuffer history"))) | 441 "No earlier matching history item"))) |
433 (if (string-match regexp | 442 (if (string-match regexp |
434 (if minibuffer-history-sexp-flag | 443 (if minibuffer-history-sexp-flag |
435 (prin1-to-string (nth (1- pos) history)) | 444 (prin1-to-string (nth (1- pos) history)) |
436 (nth (1- pos) history))) | 445 (nth (1- pos) history))) |
437 (setq n (+ n (if (< n 0) -1 1))))) | 446 (setq n (+ n (if (< n 0) -1 1))))) |
453 (interactive "p") | 462 (interactive "p") |
454 (let ((narg (min (max 1 (- minibuffer-history-position n)) | 463 (let ((narg (min (max 1 (- minibuffer-history-position n)) |
455 (length (symbol-value minibuffer-history-variable))))) | 464 (length (symbol-value minibuffer-history-variable))))) |
456 (if (= minibuffer-history-position narg) | 465 (if (= minibuffer-history-position narg) |
457 (error (if (= minibuffer-history-position 1) | 466 (error (if (= minibuffer-history-position 1) |
458 "No following item in minibuffer history" | 467 "End of history; no next item" |
459 "No preceding item in minibuffer history")) | 468 "Beginning of history; no preceding item")) |
460 (erase-buffer) | 469 (erase-buffer) |
461 (setq minibuffer-history-position narg) | 470 (setq minibuffer-history-position narg) |
462 (let ((elt (nth (1- minibuffer-history-position) | 471 (let ((elt (nth (1- minibuffer-history-position) |
463 (symbol-value minibuffer-history-variable)))) | 472 (symbol-value minibuffer-history-variable)))) |
464 (insert | 473 (insert |