unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Per Abrahamsen <abraham@dina.kvl.dk>
Cc: emacs-devel@gnu.org
Subject: Re: Question about copy-region-as-kill
Date: Tue, 09 Apr 2002 17:26:36 +0200	[thread overview]
Message-ID: <rju1qk28r7.fsf@zuse.dina.kvl.dk> (raw)
In-Reply-To: <87zo0dc2em.fsf@alice.dynodns.net> (John Wiegley's message of "Mon, 08 Apr 2002 14:21:21 -0700")

John Wiegley <johnw@gnu.org> writes:

>>>>>> On Mon Apr  8, Stefan writes:
>
>> I think this points to a good compromise: strip any property whose
>> value is the same across the whole copied text.
>
> This still does not solve the problem of copying the read-only
> property that's attached to Eshell prompts.
>
> Why can't a mode author decide to inhibit property copying in his
> buffer? 

Gnus does that for message buffers:

From message-mode:

  ;; Mmmm... Forbidden properties...
  (add-hook 'after-change-functions 'message-strip-forbidden-properties
	    nil 'local)

The implementation of message-strip-forbidden-properties:

(defcustom message-strip-special-text-properties t
  "Strip special properties from the message buffer.

Emacs has a number of special text properties which can break message
composing in various ways.  If this option is set, message will strip
these properties from the message composition buffer.  However, some
packages requires these properties to be present in order to work.
If you use one of these packages, turn this option off, and hope the
message composition doesn't break too bad."
  :group 'message-various
  :type 'boolean)

(defconst message-forbidden-properties
  ;; No reason this should be clutter up customize.  We make it a
  ;; property list (rather than a list of property symbols), to be
  ;; directly useful for `remove-text-properties'.
  '(field nil read-only nil intangible nil invisible nil
	  mouse-face nil modification-hooks nil insert-in-front-hooks nil
	  insert-behind-hooks nil point-entered nil point-left nil)
  ;; Other special properties:
  ;; category, face, display: probably doesn't do any harm.
  ;; fontified: is used by font-lock.
  ;; syntax-table, local-map: I dunno.
  ;; We need to add XEmacs names to the list.
  "Property list of with properties.forbidden in message buffers.
The values of the properties are ignored, only the property names are used.")

(defun message-tamago-not-in-use-p (pos)
  "Return t when tamago version 4 is not in use at the cursor position.
Tamago version 4 is a popular input method for writing Japanese text.
It uses the properties `intangible', `invisible', `modification-hooks'
and `read-only' when translating ascii or kana text to kanji text.
These properties are essential to work, so we should never strip them."
  (not (and (boundp 'egg-modefull-mode)
	    (symbol-value 'egg-modefull-mode)
	    (or (memq (get-text-property pos 'intangible)
		      '(its-part-1 its-part-2))
		(get-text-property pos 'egg-end)
		(get-text-property pos 'egg-lang)
		(get-text-property pos 'egg-start)))))

(defun message-strip-forbidden-properties (begin end &optional old-length)
  "Strip forbidden properties between BEGIN and END, ignoring the third arg.
This function is intended to be called from `after-change-functions'.
See also `message-forbidden-properties'."
  (when (and message-strip-special-text-properties
	     (message-tamago-not-in-use-p begin))
    (remove-text-properties begin end message-forbidden-properties)))

  parent reply	other threads:[~2002-04-09 15:26 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-03 23:23 Question about copy-region-as-kill John Wiegley
2002-04-05  6:02 ` Richard Stallman
2002-04-05 21:39   ` John Wiegley
2002-04-06  7:19     ` Eli Zaretskii
2002-04-06  8:21       ` John Wiegley
2002-04-06 10:29         ` Karl Eichwalder
2002-04-06 17:46           ` Kai Großjohann
2002-04-06 18:05             ` Alex Schroeder
2002-04-07 18:50               ` Richard Stallman
2002-04-08  1:23                 ` Miles Bader
2002-04-06 18:30             ` Karl Eichwalder
2002-04-06 23:03               ` Alan Shutko
2002-04-07  7:42                 ` Karl Eichwalder
2002-04-08 15:53                   ` Stefan Monnier
2002-04-08 21:21                     ` John Wiegley
2002-04-09  9:31                       ` Kim F. Storm
2002-04-09 11:03                         ` Eli Zaretskii
2002-04-09 10:23                           ` Miles Bader
2002-04-09 13:05                             ` Kim F. Storm
2002-04-09 13:24                               ` Miles Bader
2002-04-09 14:42                               ` Eli Zaretskii
2002-04-10 14:24                           ` Richard Stallman
2002-04-10 14:24                         ` Richard Stallman
2002-04-10 16:27                           ` Kim F. Storm
2002-04-11 14:53                             ` Richard Stallman
2002-04-11 16:27                               ` Kim F. Storm
2002-04-12 19:49                                 ` Richard Stallman
2002-04-12 10:36                               ` Francesco Potorti`
2002-04-09 15:26                       ` Per Abrahamsen [this message]
2002-04-09 21:28                         ` John Wiegley
2002-04-07  3:56               ` Tak Ota
2002-04-06 15:05         ` Andreas Schwab
2002-04-06 17:32     ` Richard Stallman
2002-04-06 20:38       ` John Wiegley
2002-04-06 23:03         ` Alex Schroeder
2002-04-07  0:12           ` Colin Walters
2002-04-07  0:56             ` Miles Bader
2002-04-07  2:53               ` John Wiegley
2002-04-07  4:44                 ` Colin Walters
2002-04-07  4:58                   ` Miles Bader
2002-04-07  5:32                     ` Colin Walters
2002-04-07  6:53                       ` Miles Bader
2002-04-07  7:46                         ` Colin Walters
2002-04-07  8:18                           ` Alex Schroeder
2002-04-07 12:20                           ` Miles Bader
2002-04-08  3:09                             ` Colin Walters
2002-04-08  6:18                               ` Miles Bader
2002-04-09 22:04                                 ` Colin Walters
2002-04-10 20:17                                   ` Richard Stallman
2002-04-09 12:07                               ` Richard Stallman
2002-04-09 22:12                                 ` Colin Walters
2002-04-07  6:36                   ` John Wiegley
2002-04-07  6:55                     ` Colin Walters
2002-04-07 23:42                   ` Richard Stallman
2002-04-08  3:14                     ` Colin Walters
2002-04-09 12:07                       ` Richard Stallman
2002-04-09 22:06                         ` Colin Walters
2002-04-07  4:41               ` Colin Walters
2002-04-07  4:58                 ` Miles Bader
2002-04-07  5:43                   ` Colin Walters
2002-04-07 10:52         ` Kai Großjohann
2002-04-06 17:43     ` Kai Großjohann

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=rju1qk28r7.fsf@zuse.dina.kvl.dk \
    --to=abraham@dina.kvl.dk \
    --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).