unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: bojohan+news@dd.chalmers.se (Johan Bockgård)
To: emacs-devel@gnu.org
Subject: Re: Spreadsheet display mode
Date: Fri, 23 Nov 2007 13:03:48 +0100	[thread overview]
Message-ID: <yoij4pfdxj6j.fsf@remote1.student.chalmers.se> (raw)
In-Reply-To: 64bfe3d50711221703n6a2aa803refcae006b68a022a@mail.gmail.com

"David O'Toole" <dto@gnu.org> 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

  parent reply	other threads:[~2007-11-23 12:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-23  1:03 Spreadsheet display mode David O'Toole
2007-11-23  8:18 ` Bastien
2007-11-24  3:12   ` Richard Stallman
2007-11-23 12:03 ` Johan Bockgård [this message]
2007-11-23 13:35   ` Johan Bockgård
2007-11-24 15:20     ` Richard Stallman
2007-11-23 14:00   ` David O'Toole
2007-11-24  3:13 ` Richard Stallman
2007-11-24 11:49   ` David O'Toole
2007-11-24 22:05     ` Richard Stallman
2007-11-25  5:31       ` David O'Toole
  -- strict thread matches above, loose matches on Subject: below --
2007-11-22 16:23 Richard Stallman
2007-11-22 19:19 ` Glenn Morris
2007-11-23  4:35   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yoij4pfdxj6j.fsf@remote1.student.chalmers.se \
    --to=bojohan+news@dd.chalmers.se \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).