emacs-devel
[Top][All Lists]
Advanced

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

Re: Copying preserves font-lock-face


From: martin rudalics
Subject: Re: Copying preserves font-lock-face
Date: Sat, 23 Sep 2006 18:12:16 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> If I copy text with a face into a fontified buffer it gets a face according
> to it's context e.g a word in a comment in c-mode to a keyword location
> (face goes from font-lock-comment-face to font-lock-keyword-face)
>
> If I copy text with a font-lock-face it keeps that property and doesn't 
acquire
> the face appropriate to it's new location e.g text from the grep buffer with
> font-lock-face `match' looks the same after being copied into a C file.  I
> realise that I can remove font-lock-face with facemenu-remove-all but I don't
> see why I should need to.

Does this happen with emacs -Q too?

(defun font-lock-default-unfontify-region (beg end)
  (remove-list-of-text-properties
   beg end (append
            font-lock-extra-managed-props
            (if font-lock-syntactic-keywords
                '(syntax-table face font-lock-multiline)
              '(face font-lock-multiline)))))

removes _all_ face properties.  Hence, either the properties you mention
are not face properties or something goes wrong with fontification after
a buffer change.

> Is there a reason why font-lock-face should be preserved on copying?

In some rare cases, I find it useful to see remnants of faces assigned
by font-lock when I copy a stretch of code to a plain text buffer.
Hence, in principle, preserving such face properties does not seem
wrong.  I do think, however, that, copying the `fontified' property by
default can be confusing.  Hence, I'd prefer something like

(defcustom yank-excluded-properties
  '(read-only invisible intangible field mouse-face help-echo local-map keymap
    yank-handler follow-link fontified)





reply via email to

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