[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Spreadsheet display mode
From: |
Johan Bockgård |
Subject: |
Re: Spreadsheet display mode |
Date: |
Fri, 23 Nov 2007 13:03:48 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) |
"David O'Toole" <address@hidden> writes:
> I did have a version that supported embedding an interactive
> spreadsheet UI into random buffers as a minor mode, using display
> properties. You can't put point inside the text, but it can still
> receive mouse clicks and keyboard events, so I could just draw a fake
> cursor (with an overlay) and map keystrokes to commands that move the
> fake cursor. The illusion was pretty good.
`cursor'
Normally, the cursor is displayed at the end of any overlay and
text property strings present at the current window position. You
can place the cursor on any desired character of these strings by
giving that character a non-`nil' CURSOR text property.
(setq foo-map
(let ((map (make-sparse-keymap)))
(define-key map [down-mouse-1] 'foo)
map))
(defun foo (e)
(interactive "e")
(let* ((x (posn-string (event-start e)))
(str (car x))
(pos (cdr x)))
(mouse-set-point e)
(remove-text-properties 0 (length str) '(cursor nil) str)
(put-text-property pos (1+ pos) 'cursor t str)
;; `redisplay' doesn't work!!
(force-mode-line-update)))
(insert (propertize "$" 'display (propertize "123456" 'keymap foo-map)))
;; Click to place point
--
Johan Bockgård