[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Re: axiom-mode
From: |
Martin Rubey |
Subject: |
Re: [Axiom-developer] Re: axiom-mode |
Date: |
23 May 2007 00:41:11 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Dear Jay,
Jay Belanger <address@hidden> writes:
> Martin Rubey <address@hidden> writes:
> ...
> > Another, maybe simpler idea: have a command axiom-set-face which allows the
> > user to specify a face and make within the output region the up, down, right
> > and left paint.
>
> Is there any reason the paint would be disabled outside the output
> region?
Not really. Accordingly, I drop this specification.
> > left/right/up/down: move ordinarily (i.e., one line)
> > Shift-left/right/up/down: paint within output region
> > Ctrl-up/down fetch previous/next input
> > M-up/down move to previous / next input.
> >
> > What do you think?
>
> It looks pretty slick. You might want different paint commands, though,
> since I think "shift-arrow" is the same as "arrow" in a terminal.
Well, I think I'll hack together a prototype that works in gnu emacs under X,
and leave the more difficult part of making it run under xemacs and in a
terminal for others. I'm really not an elisp expert.
> I noticed that overlays can be used to give different regions of text
> different keymaps, by the way.
Oh, that sounds extremely useful, since we could easily give all of the output
region some overlay property. Very nice idea!
Below is what I have so far. One thing I'm stuck with: how can I allow the
user to change the face, or at least the color?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defface axiom-output-paint '((t (:background "lightblue")))
"Face to use for painting."
:group 'axiom)
(defun make-space-if-necessary-and-paint ()
;; The following is to make sure that a line does not end with a painted
;; character. This would have the unwanted effect, that spaces appended by
;; either axiom-paint-previous-line or axiom-paint-next-line inherit the face
;; of the last character.
(when (eolp)
(insert-char 32 2)
(backward-char 2))
(forward-char 1)
(when (eolp)
(insert-char 32 1)
(backward-char 1))
(backward-char 1)
(let* ((beg (point))
(end (1+ beg))
(overlays (overlays-at beg))
(over nil))
(while (and overlays (not over))
(setq over (car overlays))
(unless (overlay-get over 'face)
(setq over nil))
(setq overlays (cdr overlays)))
(unless over (setq over (make-overlay beg end nil nil t)))
(overlay-put over 'face 'axiom-output-paint)))
(defun axiom-paint-previous-line ()
(interactive)
(let ((inhibit-read-only t)
(old-column (current-column)))
(make-space-if-necessary-and-paint)
(previous-line 1)
(if (> old-column (current-column))
(insert-char 32 (- old-column (current-column))))))
(defun axiom-paint-next-line ()
(interactive)
(let ((inhibit-read-only t)
(old-column (current-column)))
(make-space-if-necessary-and-paint)
(next-line 1)
(if (> old-column (current-column))
(insert-char 32 (- old-column (current-column))))))
(defun axiom-paint-previous-char ()
(interactive)
(let ((inhibit-read-only t))
(make-space-if-necessary-and-paint)
(backward-char 1)))
(defun axiom-paint-next-char ()
(interactive)
(let ((inhibit-read-only t))
(make-space-if-necessary-and-paint)
(forward-char 1)))
(define-key axiom-mode-map [\S-up] 'axiom-paint-previous-line)
(define-key axiom-mode-map [\S-down] 'axiom-paint-next-line)
(define-key axiom-mode-map [\S-left] 'axiom-paint-previous-char)
(define-key axiom-mode-map [\S-right] 'axiom-paint-next-char)
- Re: [Axiom-developer] Re: axiom-mode, (continued)
- Re: [Axiom-developer] Re: axiom-mode, C Y, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Martin Rubey, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Martin Rubey, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, C Y, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Martin Rubey, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Ralf Hemmecke, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, C Y, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Martin Rubey, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Martin Rubey, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Jay Belanger, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode,
Martin Rubey <=
- Re: [Axiom-developer] Re: axiom-mode, Jay Belanger, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, C Y, 2007/05/23
- Re: [Axiom-developer] Re: axiom-mode, Jay Belanger, 2007/05/22
- Re: [Axiom-developer] Re: axiom-mode, Martin Rubey, 2007/05/22
- [Axiom-developer] Re: axiom-mode, C Y, 2007/05/22
- Re: [Axiom-developer] RE: TeXmacs+Axiom, Ralf Hemmecke, 2007/05/22
- [Axiom-developer] Re: TeXmacs+Axiom, Ralf Hemmecke, 2007/05/21
Re: [Axiom-developer] New blood in Axiom (was: Community), Gabriel Dos Reis, 2007/05/20
RE: [Axiom-developer] New blood in Axiom (was: Community), Bill Page, 2007/05/21