🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1247

Changing shape/color of cursorS according to buffer/mode

#1247
From: XIAO Yan
Date: Fri, 19 Jun 1992 04:46
77 lines
3231 bytes
Want to do:
	Changing cursor/glyph shapes/colors according to buffer
	and mode
Questions:
	Possible?
	Done before?
	Why my solution is so poor?
Key problems for me:
	1. within one screen, MOUSE cursor shape does not change
	      with window change
	2. within one window, MOUSE cursor shape does not change
	      with buffer change
	3. TEXT cursor does not change cursor immediately but after
	      a TEXT cursor movement.
Background:
I am an ex-vi user and of course I stick to VIP package, 
with occasionally epoch mode.  
One problem in use is to keep track what mode I am in:
	insert-mode
	vi-mode
	emacs-mode
(please don't say "you stupid!! Why not look at the modeline") 

As my vision is mostly around TEXT cursor or MOUSE cursor glyph,
I am thinking of change the color of TEXT cursor, 
             and change the shape of MOUSE cursor.

Achieved/Problems: 
	1. Within one window, switching among mode will
	   change the color of TEXT cursor, but I have to
	   move the TEXT cursor to activate the color
	   change.  (Example: in vi-mode, "o" and "a" will
	   change the color right away. But \C-Z doesn't)
	2. MOUSE cursor changes withing one window according
	   to mode change, but not across window and buffer.
My attempt:
	See below
	
Xiao
<xiaoy@bullet.ecf.utoronto.ca>
	
(defun cursor-to-emacs()
  "change TEXT cursor's color and MOUSE cursor according to  emacs mode"
  (cursor-glyph 60) 			; hand
  (epoch::cursor-color "purple"   )  	; sexy color to match epoch
  )

(defun cursor-to-vi()
  "change TEXT cursor's color and MOUSE cursor according to  vi mode"
  (cursor-glyph 22) 			; arrow up
  (epoch::cursor-color "blue"   )	; safe color for vi command mode
  )

(defun cursor-to-insert()
 "change TEXT cursor's color and MOUSE cursor according to  vi insert mode"
	(cursor-glyph 152)		; A Mac style "I" cursor
	(epoch::cursor-color "red"   )	; what you type is what you get!!
	)


(defun vip-change-mode-to-vi ()
  "Change mode to vi mode. Modified VIP function"
  (interactive)
  (cursor-to-vi)			; Added line
  (vip-change-mode 'vi-mode))

(defun vip-change-mode-to-insert ()
  "Change mode to insert mode. Modified VIP function"
  (interactive)
  (cursor-to-insert)			; Added line
  (vip-change-mode 'insert-mode))

(defun vip-change-mode-to-emacs ()
  "Change mode to emacs mode. Modified VIP function"
  (interactive)
  (cursor-to-emacs)			; Added line
  (vip-change-mode 'emacs-mode))
Technical Details
Message-ID: <Bq2t8q.4GG@helios.physics.utoronto.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!utgpu!news-server.ecf!helios.physics.utoronto.ca!bullet.ecf.toronto.edu!xiaoy

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,53d3ff692f712de5,start
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1992-06-18 18:09:54 PST
Newsgroups: gnu.epoch.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!utgpu!news-server.ecf!helios.physics.utoronto.ca!bullet.ecf.toronto.edu!xiaoy
From: xiaoy@bullet.ecf.utoronto.ca (XIAO  Yan)
Subject: Changing shape/color of cursorS according to buffer/mode
Message-ID: <Bq2t8q.4GG@helios.physics.utoronto.ca>
Originator: xiaoy@bullet.ecf.toronto.edu
Keywords:  vip mode, color, glyph
Sender: news@helios.physics.utoronto.ca (News Administrator)
Organization: University of Toronto, Engineering Computing Facility
Date: Fri, 19 Jun 1992 04:46:01 GMT
Lines: 80