emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

command loop untouchable; ARGGHHH!


From: Jonathan Walther
Subject: command loop untouchable; ARGGHHH!
Date: Fri, 23 Aug 2002 21:29:06 -0700
User-agent: Mutt/1.4i

I have a MUD client called moo.el (source attached to this email).

A mud client merely sends typed text to the network connection, and
copies text from the network connection to the buffer.

At all times, there is the "history", which is the text already sent to
the connection, and text already recieved.  At the end of the buffer is
the text still being prepared to be sent to the network connection.

It is my desire that all text except the text at the end of the buffer
be immune to tampering via keyboard.  The protection doesn't have to be
strong; I just don't want keystrokes that alter the buffer to have any
effect when typed while the cursor is in the "history" section of the
buffer.

My first attempt was to make all history text have the read-only
property.  This worked great for me, using GNU Emacs in X.  But everyone
who used moo.el in console mode, or in XEmacs, reported that when they
copy and pasted such read-only text, they could not edit the resulting
copied text in it's new buffer, because the read-only property had
travelled with the text.

So I though, "alright, I will advise the self-insert-command function to
do nothing when in the history section".  Unfortunately this didn't do a
thing.  Hober on IRC told me this was because primitive functions don't take
kindly to advice.

Hober then suggested that I do the following for the keymap for the
major mode of moo.el (which I would like to add, seems to be totally
undocumented):

(define-key moo-mode-map [t] 'moo-self-insert-command)
(defun moo-self-insert-command (N)
 "Do nothing if cursor is in the buffer history."
 (interactive "P")
 (if (>= (point) (marker-position (moo-mark)))
     (self-insert-command (or N 1))))

(moo-mark) is the point in the buffer where the history ends and the
start of the part where the next bit of text (possibly multiple lines)
is prepared to be sent to the network connection.

Alas, this also does not work; it seems to make no difference at all
other than making it so I can't hit "enter" to send a line of text to a
MOO.

Can someone please tell me, what is the correct way to do this in elisp,
without using text properties, or templates?  Templates are out, because
XEmacs doesn't support them.  This code needs to work in XEmacs and
GNU Emacs, X and console versions.

Please help!

Jonathan

--
                    Geek House Productions, Ltd.

 Providing Unix & Internet Contracting and Consulting,
 QA Testing, Technical Documentation, Systems Design & Implementation,
 General Programming, E-commerce, Web & Mail Services since 1998

Phone:   604-435-1205
Email:   address@hidden
Webpage: http://reactor-core.org
Address: 2459 E 41st Ave, Vancouver, BC  V5R2W2

Attachment: moo.el
Description: Text document

Attachment: m2.el
Description: Text document

Attachment: pgpFJe_P4VE3J.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]