unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: keymap in yank-excluded-properties
Date: 23 Aug 2002 11:52:15 +0200	[thread overview]
Message-ID: <5xd6s9c374.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <20020822.173129.01368056.Takaaki.Ota@am.sony.com>

Tak Ota <Takaaki.Ota@am.sony.com> writes:

> Since the following change was made to yank's underpinning, a table
> created by `table.el' becomes dead after copying because keymap text
> property is stripped off at yank.
> 
> 2002-04-29  Kim F. Storm  <storm@cua.dk>
> 
> 	* subr.el (remove-yank-excluded-properties): New helper function.
> 	(insert-for-yank, insert-buffer-substring-as-yank): Use it.
> 
> 	* simple.el (yank-excluded-properties): Added help-echo to list.

I cannot take all the credit for this :-)  It was actually Richard who
added the yank-excluded-properties feature in the first place.

> Is it generally a good idea not to copy keymap text property? 

Definitely!

Depending on the target, keeping a keymap text property is like
burying a landmine waiting for someone to step on it.


> If
> majority of you agree that yank normally should not copy keymap
> property, is the following modification to the function
> `remove-yank-excluded-properties' acceptable?  The idea is if a
> special text property `yank-preserve-all-properties' exists in the
> region and its value is non-nil then yank will not strip any text
> properties off.

Again, it depends on what the target is.  I would say that if the
source and target buffers are the same, or have the same major-mode,
then probably keeping (more) text properties when yanking might be
acceptable.  But doing that requires saving some context info with
each kill, so its not trivial to do.


An alternative would be to have a simple function:

(defun yank-with-properties (&optional arg)
  "Like `yank', but does not remove text properties from inserted text."
  (interactive "*P")
  (let ((yank-excluded-properties nil))
    (yank arg)))        

Then you can make an alias if you like.

(defalias 'yank-table 'yank-with-properties)

Of course, the problem is how to put this functionality on C-y ...

Maybe something like this could be used:

(defun yank-keep-tables (&optional arg)
  "Like `yank' but knows about tables."
  (interactive ...)
  (let ((start (point)) end)
    (let ((yank-excluded-properties nil))
      (yank nil)
      (setq end (point)))
    (unless (table-recognize-table start end)  ;; <--- new function
      (remove-yank-excluded-properties start end))
    (if arg
      (goto-char start))))



-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  parent reply	other threads:[~2002-08-23  9:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-23  0:31 keymap in yank-excluded-properties Tak Ota
2002-08-23  1:55 ` Miles Bader
2002-08-23 22:21   ` Tak Ota
2002-08-23 22:29     ` Stefan Monnier
2002-08-23 23:04       ` Tak Ota
2002-08-23  9:52 ` Kim F. Storm [this message]
2002-08-25  5:25 ` Richard Stallman
2002-08-25 22:49   ` Kim F. Storm
2002-08-30 19:43     ` Tak Ota
2002-09-01 13:14       ` Richard Stallman
2002-09-02 15:02         ` Kim F. Storm
2002-09-03 13:26           ` Richard Stallman
2002-09-03 20:36             ` Tak Ota
2002-10-23 13:53               ` Kim F. Storm
2002-10-24 20:27                 ` Tak Ota
2002-09-04  1:11           ` Miles Bader
2002-09-04  6:32             ` Juanma Barranquero
2002-09-04  8:45               ` Kim F. Storm
2002-09-04  8:02                 ` Miles Bader
2002-09-04  8:50                   ` Juanma Barranquero
2002-09-04  8:49                 ` Juanma Barranquero
2002-09-04 12:48                   ` Kim F. Storm
2002-09-04 14:10                     ` Juanma Barranquero
2002-09-04 10:34                 ` Per Abrahamsen
2002-09-04 12:35                   ` Kim F. Storm
2002-09-05  1:10                     ` Miles Bader
2002-09-05 13:18                       ` Robert J. Chassell
2002-09-05 15:00                         ` Kim F. Storm
2002-09-05 14:34                           ` Per Abrahamsen
2002-09-05 15:15                           ` Robert J. Chassell
2002-09-06  1:09                           ` Miles Bader
2002-09-05  2:46             ` Richard Stallman
2002-09-05 14:48               ` Robert J. Chassell
2002-09-06  1:05                 ` Miles Bader
2002-09-06 11:30                   ` Andreas Schwab
2002-09-06 11:57                   ` Modes: major, minor, context specific Robert J. Chassell
2002-09-06 20:03                   ` keymap in yank-excluded-properties Richard Stallman
2002-09-01 13:15     ` 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=5xd6s9c374.fsf@kfs2.cua.dk \
    --to=storm@cua.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).