unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: Copying preserves font-lock-face
Date: Sat, 23 Sep 2006 18:12:16 +0200	[thread overview]
Message-ID: <45155CE0.6040200@gmx.at> (raw)
In-Reply-To: <17684.33575.513181.276604@kahikatea.snap.net.nz>

 > 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	other threads:[~2006-09-23 16:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-23  0:43 Copying preserves font-lock-face Nick Roberts
2006-09-23 16:12 ` martin rudalics [this message]
2006-09-24  6:13   ` Nick Roberts
2006-09-24  9:43     ` martin rudalics
2006-09-24 21:07       ` Nick Roberts
2006-09-25  2:22       ` Miles Bader
2006-09-25  3:17       ` Richard Stallman
2006-09-25 22:02         ` Chong Yidong
2006-09-26 15:41           ` Richard Stallman
2006-09-26 17:02             ` Stefan Monnier
2006-09-26 22:10               ` Richard Stallman
2006-09-23 18:01 ` Richard Stallman
2006-09-25 22:32   ` Kevin Rodgers
2006-09-26 15:41     ` Richard Stallman
2006-10-02  4:04       ` Richard Stallman

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=45155CE0.6040200@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).