unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: duthen.mac.01@gmail.com
To: help-gnu-emacs@gnu.org
Subject: Re: About abbrevs and spaces at end of line
Date: Wed, 11 Dec 2013 12:54:06 -0800 (PST)	[thread overview]
Message-ID: <b95a54c0-c138-48c3-80a2-22aef3616cb6@googlegroups.com> (raw)
In-Reply-To: <mailman.8702.1386625654.10748.help-gnu-emacs@gnu.org>

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	other threads:[~2013-12-11 20:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.8702.1386625654.10748.help-gnu-emacs@gnu.org>
2013-12-11 20:54 ` duthen.mac.01 [this message]
2013-12-11 20:55 ` About abbrevs and spaces at end of line duthen.mac.01
2013-12-09 21:46 Harry Putnam
2013-12-10  8:07 ` Andreas Röhler
2013-12-10 11:08   ` Harry Putnam
2013-12-10 11:47     ` Andreas Röhler
2013-12-10 11:53       ` Matthias Pfeifer
2013-12-11 12:29       ` Harry Putnam
2013-12-11 13:03         ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b95a54c0-c138-48c3-80a2-22aef3616cb6@googlegroups.com \
    --to=duthen.mac.01@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).