all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Kremers <joost.m.kremers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Clearning a keymap completely
Date: 9 Sep 2016 09:04:28 GMT	[thread overview]
Message-ID: <e3fc8sFnp5pU1@mid.individual.net> (raw)
In-Reply-To: mailman.1893.1473362103.22741.help-gnu-emacs@gnu.org

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)


  parent reply	other threads:[~2016-09-09  9:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1893.1473362103.22741.help-gnu-emacs@gnu.org>
2016-09-09  8:41 ` Clearning a keymap completely Ralf Fassel
2016-09-09  9:04 ` Joost Kremers [this message]
2016-09-04 21:40 Narendra Joshi
2016-09-04 22:27 ` Søren Pilgård
2016-09-05  3:54 ` Yuri Khan
2016-09-05  4:03 ` John Mastro
2016-09-05  6:27   ` Narendra Joshi
2016-09-05  7:27 ` Marcin Borkowski
2016-09-06 12:53 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3fc8sFnp5pU1@mid.individual.net \
    --to=joost.m.kremers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.