help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to make keybindings for color changes


From: Ron House
Subject: Trying to make keybindings for color changes
Date: Wed, 14 May 2003 17:24:03 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.0.1) Gecko/20021003

I have been trying to get key bindings going to change colours and boldness conveniently, but I am not getting exactly what I expect.

In .emacs, I have:

(defun setred (&optional start end)
  (interactive (list))
  (let ((face (intern "fg:red")))
    (or (facemenu-get-face face)
        (error "Unknown color"))
    (facemenu-set-face face start end)))

...and other colours...

And I have key bindings:

(global-set-key [C-f5] 'facemenu-set-default)
(global-set-key [C-f6] 'facemenu-set-bold)
(global-set-key [C-f7] 'setgreen)
(global-set-key [C-f8] 'setblue)
(global-set-key [C-f9] 'setviolet)
(global-set-key [C-f10] 'setmagenta)
(global-set-key [C-f11] 'setred)
(global-set-key [C-f12] 'setblack)

My problem is that the 'bold' key and the colour keys completely cancel each other. That is, if I select a colour and then select bold, the colour goes back to black, or if I select bold and then select a colour, the boldness goes away. I would like to be able to press C-f6 and, say, C-f9 (in either order) to get bold violet, for example. I can't remember where I got the function for setting the colour in the first place - I am not knowledgeable enough to have written it myself and I only barely understand it from what documentation I can find about the functions it calls.

I tried using facemenu-add-face instead of facemenu-set-face, but that turned my colour fns into no-ops.

--
Ron House     address@hidden
              http://www.sci.usq.edu.au/staff/house



reply via email to

[Prev in Thread] Current Thread [Next in Thread]