help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About abbrevs and spaces at end of line


From: duthen . mac . 01
Subject: Re: About abbrevs and spaces at end of line
Date: Wed, 11 Dec 2013 12:54:06 -0800 (PST)
User-agent: G2/1.0

Well, actually, I don't like trailing spaces.
So I always get rid of them with:

(defun jd-replace-alist (start end alist)
  "Make all replacements described in alist."
  (save-excursion
    (save-restriction
      (narrow-to-region start end)
      (mapc (lambda (modif)
              (let ((from (car modif)) (to (cdr modif)))
                (goto-char (point-min))
                (while (re-search-forward from (null 'bound) 'noerror)
                  (replace-match to))))
            alist))))

(defun jd-zap-trailing-blanks ()
  (interactive)
  (jd-replace-alist (point-min) (point-max) '(("[ \t]+$" . ""))))

(add-hook 'write-file-functions 'id-zap-trailing-blanks)

This is another way to handle the problem!

HTH


reply via email to

[Prev in Thread] Current Thread [Next in Thread]