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

[xyzzy:05274] Re: テキストの一部を色付きにするには



こんにちは、山本です。

From: "YAMAMOTO, TAKAFUMI (MED,GTO TKY JP )"
Subject: [xyzzy:05272] Re: テキストの一部を色付きにするには
Date: Thu, 14 Sep 2000 17:24:56 +0900

> Wordみたいに簡単に色をつけれる機能がないのなら諦めます。

へなちょこなのを作ってみました。
# Word みたいかどうか知りませんが。:)
~/.xyzzy ファイルに書いて立ち上げ直して下さい。
使い方はShiftを押しながらマウス右とか。

-=-=-=-=-
(global-set-key #\S-RBtnDown 'color-string-popup)

(defun color-string-region (beg end col)
  (interactive "r\nnColor: ")
  (set-text-attribute beg end nil :foreground col))

(defun color-string-selection (col)
  (color-string-region (selection-point) (selection-mark) col))

(defun clear-color-string ()
  (interactive)
  (clear-all-text-attributes))

(defun color-string-popup ()
  (interactive)
  (set-window *last-mouse-window*)
  (continue-pre-selection)
  (track-popup-menu *color-popup-menu*))

(defvar *color-popup-menu* nil)
(unless *color-popup-menu*
  (setq *color-popup-menu*
	(define-popup-menu
	  (:item nil "赤(&R)"
	   #'(lambda () (interactive) (color-string-selection 1))
	   :selection)
	  (:item nil "緑(&G)"
	   #'(lambda () (interactive) (color-string-selection 2))
	   :selection)
	  (:item nil "黄(&Y)"
	   #'(lambda () (interactive) (color-string-selection 3))
	   :selection)
	  (:item nil "青(&B)"
	   #'(lambda () (interactive) (color-string-selection 4))
	   :selection)
	  (:item nil "紫(&M)"
	   #'(lambda () (interactive) (color-string-selection 5))
	   :selection)
	  (:item nil "水色(&C)"
	   #'(lambda () (interactive) (color-string-selection 6))
	   :selection)
	  (:item nil "白(&W)"
	   #'(lambda () (interactive) (color-string-selection 7))
	   :selection)
	  (:item nil "黒(&N)"
	   #'(lambda () (interactive) (color-string-selection 8))
	   :selection)
	  :sep
	  (:item nil "消す(&D)" 'clear-color-string))))

-- 
山本真二
mailto:sinj@xxxxxxxxxxxx

Index Home