From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Per Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Question about copy-region-as-kill Date: Tue, 09 Apr 2002 17:26:36 +0200 Organization: The Church of Emacs Sender: emacs-devel-admin@gnu.org Message-ID: References: <87ofh09xjq.fsf@alice.dynodns.net> <200204050602.g3562Dl18586@aztec.santafe.edu> <87bscx7rlf.fsf@alice.dynodns.net> <3791-Sat06Apr2002101927+0300-eliz@is.elta.co.il> <873cy9nsom.fsf@alice.dynodns.net> <87wuvk77mc.fsf@wesley.springies.com> <200204081553.g38FrFM10159@rum.cs.yale.edu> <87zo0dc2em.fsf@alice.dynodns.net> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1018366098 30859 127.0.0.1 (9 Apr 2002 15:28:18 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 9 Apr 2002 15:28:18 +0000 (UTC) Cc: emacs-devel@gnu.org Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16uxXd-00081c-00 for ; Tue, 09 Apr 2002 17:28:17 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16uxmV-0005yI-00 for ; Tue, 09 Apr 2002 17:43:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16uxX7-0000z1-00; Tue, 09 Apr 2002 11:27:45 -0400 Original-Received: from sheridan.dina.kvl.dk ([130.225.40.227]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16uxW3-0000v0-00; Tue, 09 Apr 2002 11:26:39 -0400 Original-Received: from zuse.dina.kvl.dk (zuse.dina.kvl.dk [130.225.40.245]) by sheridan.dina.kvl.dk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id RAA27434; Tue, 9 Apr 2002 17:26:37 +0200 Original-Received: (from abraham@localhost) by zuse.dina.kvl.dk (8.9.3+Sun/8.9.3) id RAA23856; Tue, 9 Apr 2002 17:26:36 +0200 (MEST) X-Authentication-Warning: zuse.dina.kvl.dk: abraham set sender to abraham@dina.kvl.dk using -f Original-To: John Wiegley X-Face: +kRV2]2q}lixHkE{U)mY#+6]{AH=yN~S9@IFiOa@X6?GM|8MBp/ In-Reply-To: <87zo0dc2em.fsf@alice.dynodns.net> (John Wiegley's message of "Mon, 08 Apr 2002 14:21:21 -0700") Original-Lines: 72 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (sparc-sun-solaris2.8) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2493 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2493 John Wiegley 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)))