Mercurial > emacs
comparison lisp/simple.el @ 34141:799f637fbc35
(delete-trailing-whitespace): Don't delete newlines too.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 03 Dec 2000 02:28:07 +0000 |
parents | 559c35839090 |
children | 599c8d8e833a |
comparison
equal
deleted
inserted
replaced
34140:0e73fed6473e | 34141:799f637fbc35 |
---|---|
230 All whitespace after the last non-whitespace character in a line is deleted. | 230 All whitespace after the last non-whitespace character in a line is deleted. |
231 This respects narrowing, created by \\[narrow-to-region] and friends." | 231 This respects narrowing, created by \\[narrow-to-region] and friends." |
232 (interactive "*") | 232 (interactive "*") |
233 (save-match-data | 233 (save-match-data |
234 (save-excursion | 234 (save-excursion |
235 (let (eol bol) | |
235 (goto-char (point-min)) | 236 (goto-char (point-min)) |
236 (while (re-search-forward "\\s-+$" nil t) | 237 (while (re-search-forward "\\s-$" nil t) |
237 (delete-region (match-beginning 0) (match-end 0)))))) | 238 (skip-syntax-backward "-" (save-excursion (forward-line 0) (point))) |
239 (delete-region (point) (match-end 0))))))) | |
238 | 240 |
239 (defun newline-and-indent () | 241 (defun newline-and-indent () |
240 "Insert a newline, then indent according to major mode. | 242 "Insert a newline, then indent according to major mode. |
241 Indentation is done using the value of `indent-line-function'. | 243 Indentation is done using the value of `indent-line-function'. |
242 In programming language modes, this is the same as TAB. | 244 In programming language modes, this is the same as TAB. |