help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Clearning a keymap completely


From: Joost Kremers
Subject: Re: Clearning a keymap completely
Date: 9 Sep 2016 09:04:28 GMT
User-agent: slrn/1.0.1 (Linux)

Narendra Joshi wrote:
> I need to remove all the self-insert commands in a buffer. I want to
> be able to insert text into the buffer through emacs lisp but don't
> want the user to be able to insert text. How can this be done?

Easiest way is to set the buffer to read-only, then whenever you want to
insert text programmatically, do:

```
(let ((inhibit-read-only t))
  (insert-text)
  ...)
```

You can of course use a keymap that binds every normal key to `nil`, but
you'll have to install it in such a way that it actually overrides all
other keymaps in that buffer. You'd have to read up on keymaps in the
Elisp manual to learn how to do that.



-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

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