all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Inserting background colour at column
@ 2022-12-03  3:28 Heime
  2022-12-03  3:36 ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2022-12-03  3:28 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Altough I know how to introduce a letter in a buffer using "insert", how can I insert
a blank column with a background colour.







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

* Re: Inserting background colour at column
  2022-12-03  3:28 Inserting background colour at column Heime
@ 2022-12-03  3:36 ` Heime
  2022-12-03  3:46   ` Eduardo Ochs
  2022-12-03  7:20   ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Heime @ 2022-12-03  3:36 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, December 3rd, 2022 at 3:28 AM, Heime <heimeborgia@protonmail.com> wrote:


> Altough I know how to introduce a letter in a buffer using "insert", how can I insert
> a blank column with a background colour.

The following did not colourise the letter "T".
 
(insert (propertize "T" 'face '(:foreground "green" :background "blue")))




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

* Re: Inserting background colour at column
  2022-12-03  3:36 ` Heime
@ 2022-12-03  3:46   ` Eduardo Ochs
  2022-12-03  3:54     ` Heime
  2022-12-03  7:20   ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Eduardo Ochs @ 2022-12-03  3:46 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

On Sat, 3 Dec 2022 at 00:37, Heime <heimeborgia@protonmail.com> wrote:
> The following did not colourise the letter "T".
>
> (insert (propertize "T" 'face '(:foreground "green" :background "blue")))

This

  (insert (propertize "T" 'face '(:foreground "green" :background "blue")))

works in fundamental mode for me. Did you try it in fundamental mode?

Jean Louis was discussing something similar to that here on the list a
few weeks ago, and I sent this detailed answer to him:

  https://lists.gnu.org/archive/html/help-gnu-emacs/2022-11/msg00368.html

Look at the last lines of my message...

  In emacs-lisp-mode the "Hello" had this among its text properties,

    (face font-lock-comment-face)

  and this took precedence over the face from the category.

Does that help?
Cheers,
  Eduardo Ochs
  http://angg.twu.net/eepitch.html



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

* Re: Inserting background colour at column
  2022-12-03  3:46   ` Eduardo Ochs
@ 2022-12-03  3:54     ` Heime
  2022-12-03  4:08       ` Eduardo Ochs
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2022-12-03  3:54 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, December 3rd, 2022 at 3:46 AM, Eduardo Ochs <eduardoochs@gmail.com> wrote:


> On Sat, 3 Dec 2022 at 00:37, Heime heimeborgia@protonmail.com wrote:
> 
> > The following did not colourise the letter "T".
> > 
> > (insert (propertize "T" 'face '(:foreground "green" :background "blue")))
> 
> 
> This
> 
> (insert (propertize "T" 'face '(:foreground "green" :background "blue")))
> 
> works in fundamental mode for me. Did you try it in fundamental mode?

I have also tried this one

  (insert (format
           (propertize "%s"
              'face '(:foreground "green" :background "blue"))) "T")
 
> Jean Louis was discussing something similar to that here on the list a
> few weeks ago, and I sent this detailed answer to him:
> 
> https://lists.gnu.org/archive/html/help-gnu-emacs/2022-11/msg00368.html
> 
> Look at the last lines of my message...
> 
> In emacs-lisp-mode the "Hello" had this among its text properties,
> 
> (face font-lock-comment-face)
> 
> and this took precedence over the face from the category.
> 
> Does that help?
> Cheers,
> Eduardo Ochs
> http://angg.twu.net/eepitch.html



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

* Re: Inserting background colour at column
  2022-12-03  3:54     ` Heime
@ 2022-12-03  4:08       ` Eduardo Ochs
  2022-12-03  4:23         ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Eduardo Ochs @ 2022-12-03  4:08 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

On Sat, 3 Dec 2022 at 00:54, Heime <heimeborgia@protonmail.com> wrote:
> I have also tried this one
>
>   (insert (format
>            (propertize "%s"
>               'face '(:foreground "green" :background "blue"))) "T")

Try to run this in a shell,

cat > /tmp/foo <<'%%%'
(insert (propertize "T" 'face '(:foreground "green" :background "blue")))
%%%
emacs -Q /tmp/foo

and then execute the (insert ...) with C-e C-x C-e.
  [[]], Eduardo



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

* Re: Inserting background colour at column
  2022-12-03  4:08       ` Eduardo Ochs
@ 2022-12-03  4:23         ` Heime
  2022-12-03  6:45           ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2022-12-03  4:23 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, December 3rd, 2022 at 4:08 AM, Eduardo Ochs <eduardoochs@gmail.com> wrote:


> On Sat, 3 Dec 2022 at 00:54, Heime heimeborgia@protonmail.com wrote:
> 
> > I have also tried this one
> > 
> > (insert (format
> > (propertize "%s"
> > 'face '(:foreground "green" :background "blue"))) "T")
> 
> 
> Try to run this in a shell,
> 
> cat > /tmp/foo <<'%%%'
> 
> (insert (propertize "T" 'face '(:foreground "green" :background "blue")))
> %%%
> emacs -Q /tmp/foo
> 
> and then execute the (insert ...) with C-e C-x C-e.
> [[]], Eduardo

That works good.




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

* Re: Inserting background colour at column
  2022-12-03  4:23         ` Heime
@ 2022-12-03  6:45           ` Heime
  0 siblings, 0 replies; 9+ messages in thread
From: Heime @ 2022-12-03  6:45 UTC (permalink / raw)
  To: Heime; +Cc: Eduardo Ochs, Heime via Users list for the GNU Emacs text editor


------- Original Message -------
On Saturday, December 3rd, 2022 at 4:23 AM, Heime <heimeborgia@protonmail.com> wrote:


> 
> 
> 
> 
> 
> Sent with Proton Mail secure email.
> 
> 
> ------- Original Message -------
> On Saturday, December 3rd, 2022 at 4:08 AM, Eduardo Ochs eduardoochs@gmail.com wrote:
> 
> 
> 
> > On Sat, 3 Dec 2022 at 00:54, Heime heimeborgia@protonmail.com wrote:
> > 
> > > I have also tried this one
> > > 
> > > (insert (format
> > > (propertize "%s"
> > > 'face '(:foreground "green" :background "blue"))) "T")
> > 
> > Try to run this in a shell,
> > 
> > cat > /tmp/foo <<'%%%'
> > 
> > (insert (propertize "T" 'face '(:foreground "green" :background "blue")))
> > %%%
> > emacs -Q /tmp/foo
> > 
> > and then execute the (insert ...) with C-e C-x C-e.
> > [[]], Eduardo
> 
> 
> That works good.

Managed to get things working with 

(insert (propertize "B"
             'font-lock-face '(:background "blue"
                               :foreground "red")))



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

* Re: Inserting background colour at column
  2022-12-03  3:36 ` Heime
  2022-12-03  3:46   ` Eduardo Ochs
@ 2022-12-03  7:20   ` Eli Zaretskii
  2022-12-03  7:31     ` Heime
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2022-12-03  7:20 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 03 Dec 2022 03:36:27 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> The following did not colourise the letter "T".
>  
> (insert (propertize "T" 'face '(:foreground "green" :background "blue")))

You cannot add faces in a buffer with font-lock-mode turned on, because
font-lock wants to control all faces.  Use 'font-lock-face' instead of
'face' in that case.



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

* Re: Inserting background colour at column
  2022-12-03  7:20   ` Eli Zaretskii
@ 2022-12-03  7:31     ` Heime
  0 siblings, 0 replies; 9+ messages in thread
From: Heime @ 2022-12-03  7:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, December 3rd, 2022 at 7:20 AM, Eli Zaretskii <eliz@gnu.org> wrote:


> > Date: Sat, 03 Dec 2022 03:36:27 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org
> > The following did not colourise the letter "T".
> > 
> > (insert (propertize "T" 'face '(:foreground "green" :background "blue")))
> 
> 
> You cannot add faces in a buffer with font-lock-mode turned on, because
> font-lock wants to control all faces. Use 'font-lock-face' instead of
> 'face' in that case.

Thank you.  That works very well.



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

end of thread, other threads:[~2022-12-03  7:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-03  3:28 Inserting background colour at column Heime
2022-12-03  3:36 ` Heime
2022-12-03  3:46   ` Eduardo Ochs
2022-12-03  3:54     ` Heime
2022-12-03  4:08       ` Eduardo Ochs
2022-12-03  4:23         ` Heime
2022-12-03  6:45           ` Heime
2022-12-03  7:20   ` Eli Zaretskii
2022-12-03  7:31     ` Heime

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.