🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #188936

Re: Elisp challenges: narrowing without hiding, display unlike buffer

#188936
From: Jamie Zawinski
Date: Tue, 04 Jun 1991 15:47
26 lines
2065 bytes
In article <9106041751.AA21076@anywhere> aks%anywhere@hub.ucsb.edu (Alan Stebbens) wrote:
>> An ugly solution would involve remembering the modifiable region or
>> rectangle and rebinding every key so that its behavior did not extend
>> outside that area.
> 
> Why is this ugly?  Each key can be rebound to a common function which
> checks the location of the cursor, and if in an editable field, does
> "self-insert-character", otherwise does nothing or an error.

Well, it just *is* ugly :-)  But one reason that it is bad is that it 
causes too many undo boundaries to be pushed.  Self-insert is somewhat
of a special case down in the guts of the command, and there doesn't
seem to be any way to exactly duplicate its funtionality in elisp.  If
you type a sequence of N characters which are all bound to self-insert,
and then execute undo, all of those characters will be uninserted.  But
if they're not bound to the self-insert subr, undo will pull up one
character at a time.  

I shadow the definition of self-insert for mail-abbrevs.el, and get around
this to some extent by stomping on the buffer-undo-list directly, but it's
not 100% accurate (sometimes it removes too many undo boundaries.)

And as someone else pointed out, ^W will still work on readonly regions
if point is in a writable region.

	-- Jamie
Technical Details
Message-ID: <JWZ.91Jun4174722@thalidomide.lucid.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!stanford.edu!lucid.com!karoshi!jwz
References: <9106031813.AA00868@emu> <9106041751.AA21076@anywhere>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,3e38738b0012435
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-06-04 22:55:10 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!stanford.edu!lucid.com!karoshi!jwz
From: jwz@lucid.com (Jamie Zawinski)
Newsgroups: gnu.emacs.help
Subject: Re: Elisp challenges: narrowing without hiding, display unlike buffer
Message-ID: <JWZ.91Jun4174722@thalidomide.lucid.com>
Date: 4 Jun 91 15:47:22 GMT
References: <9106031813.AA00868@emu> <9106041751.AA21076@anywhere>
Sender: usenet@lucid.com
Organization: Lucid, Inc., Menlo Park, CA
Lines: 26
In-Reply-To: aks%anywhere@hub.ucsb.edu's message of 4 Jun 91 17:51:35 GMT
X-Windows: No hardware is safe.