unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* comint read only prompt "leaking" properties
@ 2007-02-07 17:28 JD Smith
  2007-02-07 18:31 ` David Kastrup
  0 siblings, 1 reply; 3+ messages in thread
From: JD Smith @ 2007-02-07 17:28 UTC (permalink / raw)
  To: emacs-devel


The read only prompt enabled in COMINT modes by
`comint-prompt-read-only' can "leak" the read-only text property into
subsequent input.  This inhibits the printing of the next prompt, and
garbles the input.  The misplaced properties will also get saved on the
input ring, and can re-inject the troublesome text upon recalling
earlier input, even after the buffer is cleared.  Steps to reproduce:

M-x shell
M-x set-variable [Ret] comint-prompt-read-only [Ret] t [Ret]

In the shell buffer:

host% echo "foo" [Ret]

Drag to highlight the prior command, including the space before "echo".
Paste it in at the new prompt.

host%  echo "foo"

Hit Return to send the command.  Note that a new prompt is not sent,
and that the input line keeps doubling in length.  Examine the
properties along the input, to find that `front-sticky (read-only)
read-only t' has been littered across the input fields.

I know of know general means to inhibit any property transfer when
pasting text in a given buffer, but if one did exist, that would be a
(heavy handed) solution.  As another option, is there a text property
for "don't copy any of these properties"?  I doubt anyone is ever
interested in copying properties from the prompt.  In reality, though,
any read-only property pasted in from anywhere can cause trouble on the
COMINT command line.

This is the list of prompt properties:

(front-sticky (read-only) read-only t inhibit-line-move-field-capture t
field output rear-nonsticky t fontified t)

JD

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: comint read only prompt "leaking" properties
  2007-02-07 17:28 comint read only prompt "leaking" properties JD Smith
@ 2007-02-07 18:31 ` David Kastrup
  2007-02-07 18:42   ` JD Smith
  0 siblings, 1 reply; 3+ messages in thread
From: David Kastrup @ 2007-02-07 18:31 UTC (permalink / raw)
  To: JD Smith; +Cc: emacs-devel

JD Smith <jdsmith@as.arizona.edu> writes:

> The read only prompt enabled in COMINT modes by
> `comint-prompt-read-only' can "leak" the read-only text property into
> subsequent input.  This inhibits the printing of the next prompt, and
> garbles the input.  The misplaced properties will also get saved on the
> input ring, and can re-inject the troublesome text upon recalling
> earlier input, even after the buffer is cleared.  Steps to reproduce:
>
> M-x shell
> M-x set-variable [Ret] comint-prompt-read-only [Ret] t [Ret]
>
> In the shell buffer:
>
> host% echo "foo" [Ret]
>
> Drag to highlight the prior command, including the space before "echo".
> Paste it in at the new prompt.
>
> host%  echo "foo"
>
> Hit Return to send the command.  Note that a new prompt is not sent,
> and that the input line keeps doubling in length.  Examine the
> properties along the input, to find that `front-sticky (read-only)
> read-only t' has been littered across the input fields.
>
> I know of know general means to inhibit any property transfer when
> pasting text in a given buffer, but if one did exist, that would be a
> (heavy handed) solution.  As another option, is there a text property
> for "don't copy any of these properties"?  I doubt anyone is ever
> interested in copying properties from the prompt.  In reality, though,
> any read-only property pasted in from anywhere can cause trouble on the
> COMINT command line.
>
> This is the list of prompt properties:
>
> (front-sticky (read-only) read-only t inhibit-line-move-field-capture t
> field output rear-nonsticky t fontified t)

Strange, this should not happen:

yank-excluded-properties is a variable defined in `simple.el'.
Its value is 
(read-only invisible intangible field mouse-face help-echo local-map keymap yank-handler follow-link fontified)



Documentation:
*Text properties to discard when yanking.
The value should be a list of text properties to discard or t,
which means to discard all text properties.

You can customize this variable.


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: comint read only prompt "leaking" properties
  2007-02-07 18:31 ` David Kastrup
@ 2007-02-07 18:42   ` JD Smith
  0 siblings, 0 replies; 3+ messages in thread
From: JD Smith @ 2007-02-07 18:42 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

On Wed, 2007-02-07 at 19:31 +0100, David Kastrup wrote:

> > This is the list of prompt properties:
> >
> > (front-sticky (read-only) read-only t inhibit-line-move-field-capture t
> > field output rear-nonsticky t fontified t)
> 
> Strange, this should not happen:
> 
> yank-excluded-properties is a variable defined in `simple.el'.
> Its value is 
> (read-only invisible intangible field mouse-face help-echo local-map keymap yank-handler follow-link fontified)

That's interesting.  I can confirm my yank-excluded-properties has
read-only as well.  However, both C-y and mouse yanks include the
properties read-only, field, mouse-face, etc. with the text, even when
yanking into *scratch*.  So it's not comint specific.

Thanks,

JD

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-07 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-07 17:28 comint read only prompt "leaking" properties JD Smith
2007-02-07 18:31 ` David Kastrup
2007-02-07 18:42   ` JD Smith

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