mailing-list for TeXmacs Users

Text archives Help


Re: Selection and replacement, macro expansion


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: Re: Selection and replacement, macro expansion
  • Date: Mon, 25 Feb 2002 22:48:39 +0100

On Monday 25 February 2002 20:12, Álvaro Tejero Cantero wrote:
> I am not sure this solves my problem. In emacs I use C-w for "cutting", and
> this is precisely what I get in TeXmacs: the text is cut, but next I have
> to type something in its place. The standard functionality in most text
> editors is that if you start typing with something selected, the selection
> goes away when you press any key. This is a combo-op: "C-w" + "write the
> first letter" where the first letter may be a long pasted text as well.

Actually there are currently two conventions intermixed in TeXmacs

Macintosh convention (that Window uses too):
Typed text replace selection
Backspace deletes selection

Unix convention:
Selection is ignored, typing text or pressing backspace operates on the
cursor position

"Backspace deletes selection" behavior is relatively new in TeXmacs, I agree
that the current situation is confusing. Moreover Scheme sessions (maybe
other contexts too) still use the Unix convention for backspace.

> In this direction I would like to point out that it should be possible to
> have alternate keybinding groups, as in LyX, bundled by default with
> texmacs, so that people from the C-x, C-c, C-v world don't get annoyed too
> early to appreciate TeXmacs virtues. This boils down to somebody writing a
> win32like keybinding file, but also to avoiding tying TeXmacs to an
> exclusively emacsish behaviour (in this respect).

I have done some Scheme hacking for this.

(define keymaps ())
(define saved-set-keymap-body set-keymap-body)

(set! set-keymap-body
(lambda l
(apply saved-set-keymap-body l)
(set! keymaps (cons (car l) keymaps))))

(define (clear-keymaps)
(letrec ((clear-keymap (lambda (km)
(apply remove-keymap-body
(list (strip-keymap km)))))
(strip-keymap (lambda (km)
(cons (car km)
(map car (cdr km))))))
(for-each clear-keymap keymaps)
(set! keymaps ())))

(define (keymap-major-standard)
(clear-keymaps)
(exec-file "$TEXMACS_PATH/progs/keyboard" "latex.scm")
(exec-file "$TEXMACS_PATH/progs/keyboard" "keymaps.scm")
(exec-file "$TEXMACS_PATH/progs/keyboard" "emacs.scm")
(exec-file "$TEXMACS_PATH/progs/keyboard" "shorthands.scm")
(exec-file "$TEXMACS_PATH/progs/keyboard" "accents.scm")
(exec-file "$TEXMACS_PATH/progs/keyboard/russian" "translit.scm")
(exec-file "$TEXMACS_PATH/progs/keyboard/russian" "cp1251.scm"))

(keymap-major-standard) ; initialize the keymaps variable

After this, clear-keymap will effectively remove all keybindings. This is the
first step to on-the-fly keymap-profile switching... Now you "just" have to
define the keybindings you want and add the menu items to set them.

Happy hacking.
--

-- David --




Archive powered by MHonArc 2.6.19.

Top of page