all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* change textheight and set position
@ 2004-06-27 16:41 Fabian Braennstroem
  2004-06-28 21:24 ` Jesper Harder
  2004-06-30  9:28 ` Kai Grossjohann
  0 siblings, 2 replies; 6+ messages in thread
From: Fabian Braennstroem @ 2004-06-27 16:41 UTC (permalink / raw)


Hello,

I'm looking for a way to copy some text and yank it with a different font-size
in the middle of the line.
I tried using 'set-face-font', but that changes the font for some existing
faces. It would be the best, if I would be able to choose just a different font
style before I yank the text, e.g. Info-title-1-face. Does anybody have an idea?

Greetings!
-- 
Fabian Braennstroem
Duesseldorf/Berlin

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

* Re: change textheight and set position
  2004-06-27 16:41 change textheight and set position Fabian Braennstroem
@ 2004-06-28 21:24 ` Jesper Harder
  2004-06-29  5:54   ` Fabian Braennstroem
  2004-06-30  9:28 ` Kai Grossjohann
  1 sibling, 1 reply; 6+ messages in thread
From: Jesper Harder @ 2004-06-28 21:24 UTC (permalink / raw)


Fabian Braennstroem <f.braennstroem@gmx.de> writes:

> I'm looking for a way to copy some text and yank it with a different
> font-size in the middle of the line.  I tried using 'set-face-font',
> but that changes the font for some existing faces. It would be the
> best, if I would be able to choose just a different font style
> before I yank the text, e.g. Info-title-1-face. Does anybody have an
> idea?

You could do something like this:

(defun my-yank (face)
  (interactive (list (read-face-name "Use face")))
  (save-restriction
    (narrow-to-region (point) (point))
    (yank)
    (put-text-property (point-min) (point-max) 'face face)))

-- 
Jesper Harder                                <http://purl.org/harder/>

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

* Re: change textheight and set position
  2004-06-28 21:24 ` Jesper Harder
@ 2004-06-29  5:54   ` Fabian Braennstroem
  2004-06-29  8:29     ` Jesper Harder
  0 siblings, 1 reply; 6+ messages in thread
From: Fabian Braennstroem @ 2004-06-29  5:54 UTC (permalink / raw)


Hi,

Jesper Harder <harder@myrealbox.com> writes:

> Fabian Braennstroem <f.braennstroem@gmx.de> writes:
>
>> I'm looking for a way to copy some text and yank it with a different
>> font-size in the middle of the line.  I tried using 'set-face-font',
>> but that changes the font for some existing faces. It would be the
>> best, if I would be able to choose just a different font style
>> before I yank the text, e.g. Info-title-1-face. Does anybody have an
>> idea?
>
> You could do something like this:
>
> (defun my-yank (face)
>   (interactive (list (read-face-name "Use face")))
>   (save-restriction
>     (narrow-to-region (point) (point))
>     (yank)
>     (put-text-property (point-min) (point-max) 'face face)))

Thanks! I think this is exactly what I want, but when I choose some face,
e.g. 'italic' or 'Info-title-2-face', there is no change in my
text-property. It does not change compared to the old one.

One question to this function. Shouldn't I be able to call the function
'put-text-property' with 'M-x'? I can't find it... Ah, I see, probably just
because it is a build-in function!?

Greetings!
-- 
Fabian Braennstroem
Duesseldorf/Berlin

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

* Re: change textheight and set position
  2004-06-29  5:54   ` Fabian Braennstroem
@ 2004-06-29  8:29     ` Jesper Harder
  2004-07-01  9:41       ` Fabian Braennstroem
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Harder @ 2004-06-29  8:29 UTC (permalink / raw)


Fabian Braennstroem <f.braennstroem@gmx.de> writes:

> Jesper Harder <harder@myrealbox.com> writes:
>
>> (defun my-yank (face)
>>   (interactive (list (read-face-name "Use face")))
>>   (save-restriction
>>     (narrow-to-region (point) (point))
>>     (yank)
>>     (put-text-property (point-min) (point-max) 'face face)))
>
> Thanks! I think this is exactly what I want, but when I choose some
> face, e.g. 'italic' or 'Info-title-2-face', there is no change in my
> text-property. It does not change compared to the old one.

Strange, it works for me.

> One question to this function. Shouldn't I be able to call the
> function 'put-text-property' with 'M-x'?

No.  It's not an interactive function.

> Ah, I see, probably just because it is a build-in function!?

It doesn't matter if it's built-in or not.  It's only a question about
if it's interactive or non-interactive.

-- 
Jesper Harder                                <http://purl.org/harder/>

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

* Re: change textheight and set position
  2004-06-27 16:41 change textheight and set position Fabian Braennstroem
  2004-06-28 21:24 ` Jesper Harder
@ 2004-06-30  9:28 ` Kai Grossjohann
  1 sibling, 0 replies; 6+ messages in thread
From: Kai Grossjohann @ 2004-06-30  9:28 UTC (permalink / raw)


Fabian Braennstroem <f.braennstroem@gmx.de> writes:

> I'm looking for a way to copy some text and yank it with a different
> font-size in the middle of the line.  I tried using 'set-face-font',
> but that changes the font for some existing faces. It would be the
> best, if I would be able to choose just a different font style
> before I yank the text, e.g. Info-title-1-face. Does anybody have an
> idea?

Suggestion: yank the text with C-y.  Then reactivate the region with
C-x C-x.  Then use M-g to apply some text properties you like.  For
example, M-g o Info-title-1-face RET might do something you like.

Note, however, that if the buffer where you yank has font-lock
activated, then font-lock will override this manually specified
face.  This is a consequence of how font-lock works.  Perhaps it
helps to switch the buffer to enriched-mode before M-g.

Kai

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

* Re: change textheight and set position
  2004-06-29  8:29     ` Jesper Harder
@ 2004-07-01  9:41       ` Fabian Braennstroem
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Braennstroem @ 2004-07-01  9:41 UTC (permalink / raw)


Jesper Harder <harder@myrealbox.com> writes:

> Fabian Braennstroem <f.braennstroem@gmx.de> writes:
>
>> Jesper Harder <harder@myrealbox.com> writes:
>>
>>> (defun my-yank (face)
>>>   (interactive (list (read-face-name "Use face")))
>>>   (save-restriction
>>>     (narrow-to-region (point) (point))
>>>     (yank)
>>>     (put-text-property (point-min) (point-max) 'face face)))
>>
>> Thanks! I think this is exactly what I want, but when I choose some
>> face, e.g. 'italic' or 'Info-title-2-face', there is no change in my
>> text-property. It does not change compared to the old one.
>
> Strange, it works for me.


Now, it works for me too :-) The first time I tried it in the scratch-buffer;
probably I should not do that.


>> One question to this function. Shouldn't I be able to call the
>> function 'put-text-property' with 'M-x'?
>
> No.  It's not an interactive function.
>
>> Ah, I see, probably just because it is a build-in function!?
>
> It doesn't matter if it's built-in or not.  It's only a question about
> if it's interactive or non-interactive.

Thanks I didn't know this!

Greetings!
-- 
Fabian Braennstroem
Duesseldorf/Berlin

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

end of thread, other threads:[~2004-07-01  9:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-27 16:41 change textheight and set position Fabian Braennstroem
2004-06-28 21:24 ` Jesper Harder
2004-06-29  5:54   ` Fabian Braennstroem
2004-06-29  8:29     ` Jesper Harder
2004-07-01  9:41       ` Fabian Braennstroem
2004-06-30  9:28 ` Kai Grossjohann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.