* font faces across a copy and paste
@ 2013-07-30 6:30 Luca Ferrari
2013-07-30 9:05 ` Peter Dyballa
2013-07-30 11:27 ` Jambunathan K
0 siblings, 2 replies; 8+ messages in thread
From: Luca Ferrari @ 2013-07-30 6:30 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
this is just a curiosity: I noted that if I'm editing a text buffer
and a code buffer, let's say C/Java, and I copy and paste the code
from the code buffer into the text one than the pasted text maintains
the faces (e.g., colors). I was thinking that faces were applied at a
buffer level, and therefore the code should become faced as a text
chunk, but apparently Emacs stores faces somewhere in memory related
to the text chunk itself. Is this correct? There is something I'm
missing?
Thanks,
Luca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
[not found] <mailman.2078.1375165817.12400.help-gnu-emacs@gnu.org>
@ 2013-07-30 7:37 ` Sebastien Vauban
0 siblings, 0 replies; 8+ messages in thread
From: Sebastien Vauban @ 2013-07-30 7:37 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
Hi Luca,
Luca Ferrari wrote:
> this is just a curiosity: I noted that if I'm editing a text buffer
> and a code buffer, let's say C/Java, and I copy and paste the code
> from the code buffer into the text one than the pasted text maintains
> the faces (e.g., colors). I was thinking that faces were applied at a
> buffer level, and therefore the code should become faced as a text
> chunk, but apparently Emacs stores faces somewhere in memory related
> to the text chunk itself. Is this correct? There is something I'm
> missing?
AFAIK, fontification can be obtained through either "overlays" or "text
properties".
When overlays, it is in the buffer itself, and not copied across other
buffers.
When text properties, it is a property (face) "attached" to the text, and thus
copied across other buffers.
So, it comes down to how fontification is made in the particular mode or
situation you face.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
2013-07-30 6:30 Luca Ferrari
@ 2013-07-30 9:05 ` Peter Dyballa
2013-07-30 11:29 ` Jambunathan K
2013-07-30 11:27 ` Jambunathan K
1 sibling, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2013-07-30 9:05 UTC (permalink / raw)
To: Luca Ferrari; +Cc: help-gnu-emacs
Am 30.07.2013 um 08:30 schrieb Luca Ferrari:
> There is something I'm missing?
I think since GNU Emacs 24.2 copy&paste also handles text attributes. When one is compiling a line from a series of snippets this line is not one, i.e., C-a, C-e, C-k, or a RET in *shell* buffer does not affect the whole line but only a piece.
I want to find a solution for this behaviour but have not found yet one in the documentation. Guess I would just need to find the proper key word…
--
Greetings
Pete
To most people solutions mean finding the answers. But to chemists solutions
are things that are still all mixed up.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
2013-07-30 6:30 Luca Ferrari
2013-07-30 9:05 ` Peter Dyballa
@ 2013-07-30 11:27 ` Jambunathan K
1 sibling, 0 replies; 8+ messages in thread
From: Jambunathan K @ 2013-07-30 11:27 UTC (permalink / raw)
To: Luca Ferrari; +Cc: help-gnu-emacs
Luca Ferrari <fluca1978@infinito.it> writes:
> Hi,
> this is just a curiosity: I noted that if I'm editing a text buffer
> and a code buffer, let's say C/Java, and I copy and paste the code
> from the code buffer into the text one than the pasted text maintains
> the faces (e.g., colors). I was thinking that faces were applied at a
> buffer level, and therefore the code should become faced as a text
> chunk, but apparently Emacs stores faces somewhere in memory related
> to the text chunk itself. Is this correct? There is something I'm
> missing?
When you move the text, the text properties (face is one of the
properties) also move with it.
1. Put your cursor on a piece of text.
2. C-u C-x =
3. Go to the end of the resulting buffer.
4. You will see text properties (usually fontified t, and a
font-lock-face-*), overlay etc.
But when you copy the pasted text in to buffer that has font-lock-mode
on, the copied text will usually change colors. This "changing of
colors", (I believe) happens very fast that it is barely noticeable.
>
> Thanks,
> Luca
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
2013-07-30 9:05 ` Peter Dyballa
@ 2013-07-30 11:29 ` Jambunathan K
2013-07-30 12:44 ` Peter Dyballa
2013-08-01 22:50 ` Peter Dyballa
0 siblings, 2 replies; 8+ messages in thread
From: Jambunathan K @ 2013-07-30 11:29 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs, Luca Ferrari
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> I think since GNU Emacs 24.2 copy&paste also handles text
> attributes.
Does
C-h d yank properties
help?
> When one is compiling a line from a series of snippets
> this line is not one, i.e., C-a, C-e, C-k, or a RET in *shell* buffer
> does not affect the whole line but only a piece.
I have difficulty parsing the above sentence and make sense out of it.
Could you re-phrase what you are saying here?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
2013-07-30 11:29 ` Jambunathan K
@ 2013-07-30 12:44 ` Peter Dyballa
2013-07-30 13:36 ` Jambunathan K
2013-08-01 22:50 ` Peter Dyballa
1 sibling, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2013-07-30 12:44 UTC (permalink / raw)
To: Jambunathan K; +Cc: help-gnu-emacs, Luca Ferrari
Am 30.07.2013 um 13:29 schrieb Jambunathan K:
> C-h d yank properties
Ahh! This sound promising!
>
>> When one is compiling a line from a series of snippets
>> this line is not one, i.e., C-a, C-e, C-k, or a RET in *shell* buffer
>> does not affect the whole line but only a piece.
>
> I have difficulty parsing the above sentence and make sense out of it.
> Could you re-phrase what you are saying here?
When I try to "write" in *shell* buffer a command and re-use one and have to insert some addition text I just copy&yank, then
• C-a does not put the cursor to the beginning of the command, just right of the prompt
• C-e does not put the cursor to the end of the command line
• C-k does not kill to the end of the command line
• and RET does not send the whole command but only the portion between the prompt and the cursor.
C-a, C-e, C-k stop working at boundaries of different text properties.
--
Greetings
Pete
Clovis' Consideration of an Atmospheric Anomaly:
The perversity of nature is nowhere better demonstrated than by the fact that, when exposed to the same atmosphere, bread becomes hard while crackers become soft
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
2013-07-30 12:44 ` Peter Dyballa
@ 2013-07-30 13:36 ` Jambunathan K
0 siblings, 0 replies; 8+ messages in thread
From: Jambunathan K @ 2013-07-30 13:36 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs, Luca Ferrari
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> When I try to "write" in *shell* buffer a command and re-use one and
> have to insert some addition text I just copy&yank, then
>
> • C-a does not put the cursor to the beginning of the command, just right of the prompt
> • C-e does not put the cursor to the end of the command line
> • C-k does not kill to the end of the command line
> • and RET does not send the whole command but only the portion between the prompt and the cursor.
>
> C-a, C-e, C-k stop working at boundaries of different text properties.
A cursory look suggests that the following snippet will do the trick
(setq inhibit-field-text-motion t)
Consult
(info "(elisp) Word Motion")
Ofcourse, you could cook up a defadvice that let binds the above
variable to t so that point movement happens in an "un-constrained"
manner.
----------------------------------------------------------------
Notes to self:
1. M-x shell
2. M-h, C-w
3. C-x b *scratch*
4. M-x font-lock-mode (Disable font-lock-mode)
5. C-y
6. C-a
7. C-u C-x =
The help buffer shows following text properties.
There are text properties here:
face font-lock-string-face
front-sticky (field inhibit-line-move-field-capture)
inhibit-line-move-field-capture t
rear-nonsticky t
8. A simple source code search for `inhibit-line-move-field-capture'
yields hits in - simple.el, ielm.el and comint.el - which in turn
hint at
C-h f constrain-to-field
which makes mention of
C-h v inhibit-field-text-motion
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: font faces across a copy and paste
2013-07-30 11:29 ` Jambunathan K
2013-07-30 12:44 ` Peter Dyballa
@ 2013-08-01 22:50 ` Peter Dyballa
1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2013-08-01 22:50 UTC (permalink / raw)
To: Jambunathan K; +Cc: help-gnu-emacs, Luca Ferrari
Am 30.07.2013 um 13:29 schrieb Jambunathan K:
> C-h d yank properties
Setting yank-handled-properties to nil might be the proper and easy means.
--
Greetings
Pete
There's no place like ~
– (UNIX Guru)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-01 22:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.2078.1375165817.12400.help-gnu-emacs@gnu.org>
2013-07-30 7:37 ` font faces across a copy and paste Sebastien Vauban
2013-07-30 6:30 Luca Ferrari
2013-07-30 9:05 ` Peter Dyballa
2013-07-30 11:29 ` Jambunathan K
2013-07-30 12:44 ` Peter Dyballa
2013-07-30 13:36 ` Jambunathan K
2013-08-01 22:50 ` Peter Dyballa
2013-07-30 11:27 ` Jambunathan K
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).