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

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

Re: blue underscores


From: Andreas Röhler
Subject: Re: blue underscores
Date: Wed, 19 Dec 2007 12:22:39 +0100
User-agent: KMail/1.9.5

Am Mittwoch, 19. Dezember 2007 11:24 schrieb Peter Dyballa:
> Am 19.12.2007 um 10:09 schrieb Andreas Röhler:
> > Any ideas what the cause may be?
>
> NO-BREAK SPACE (U+00A0)
>
> Position the cursor on such a character and type: C-u C-x =
>
> Probably the environment from which you copy tries to preserve some
> of its beloved features ... (I get brown ones)
>
> --
> Greetings
>
>    Pete
>

Thanks, I see, according to 

hardcoded face: nobreak-space

Notwithstanding, wouldn't it be good, to have a
mode-hook which weeps them out?

Customized `delete-nobreak-spaces' as text-mode-hook
displays correctly after reload/revert.

(defun delete-nobreak-spaces ()
  "Delete nobreak space, char 2208, #o4240, #x8a0 from buffer or region. "
  (interactive "*")
  (let ((beg (cond ((region-active-p)
                    (region-beginning))
                   (t (point-min))))
        (end (cond ((region-active-p)
                    (region-end))
                   (t (point-max)))))
    (save-excursion
      (goto-char beg)
      (while (re-search-forward (char-to-string 2208) end t 1)
        (replace-match "")))))

(defun region-active-p ()
  "Provide mark-active transient-mark-mode
 (not (eq (region-beginning) (region-end))))"
  (if (featurep 'xemacs)
      'region-active-p
    (and mark-active transient-mark-mode
         (not (eq (region-beginning) (region-end))))))

Any idea how to realise that on the fly?

Andreas Röhler




reply via email to

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