* Clearning a keymap completely
@ 2016-09-04 21:40 Narendra Joshi
2016-09-04 22:27 ` Søren Pilgård
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Narendra Joshi @ 2016-09-04 21:40 UTC (permalink / raw
To: help-gnu-emacs@gnu.org
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?
Best,
Narendra Joshi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Clearning a keymap completely
2016-09-04 21:40 Clearning a keymap completely Narendra Joshi
@ 2016-09-04 22:27 ` Søren Pilgård
2016-09-05 3:54 ` Yuri Khan
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Søren Pilgård @ 2016-09-04 22:27 UTC (permalink / raw
To: Narendra Joshi; +Cc: help-gnu-emacs@gnu.org
On Sun, Sep 4, 2016 at 11:40 PM, Narendra Joshi <narendraj9@gmail.com> 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?
>
That is now how you want to solve it.
Instead look into the buffer-read-only and inhibit-read-only variables [0].
You can let bind them to temporarily edit the buffer from your code.
Messing with all the keybindings is not the way to go.
[0] https://www.gnu.org/software/emacs/manual/html_node/elisp/Read-Only-Buffers.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Clearning a keymap completely
2016-09-04 21:40 Clearning a keymap completely 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
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Yuri Khan @ 2016-09-05 3:54 UTC (permalink / raw
To: Narendra Joshi; +Cc: help-gnu-emacs@gnu.org
On Mon, Sep 5, 2016 at 4:40 AM, Narendra Joshi <narendraj9@gmail.com> 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 is to set (read-only-mode 1). (insert "foo") still works but
self-insert-command tells the user “Buffer is read-only”.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Clearning a keymap completely
2016-09-04 21:40 Clearning a keymap completely 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
4 siblings, 1 reply; 9+ messages in thread
From: John Mastro @ 2016-09-05 4:03 UTC (permalink / raw
To: help-gnu-emacs@gnu.org; +Cc: Narendra Joshi
> Narendra Joshi <narendraj9@gmail.com> 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?
Just make the buffer read only, and then let-bind inhibit-read-only
to t where necessary in your Lisp.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Read-Only-Buffers.html
Hope that helps
John
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Clearning a keymap completely
2016-09-04 21:40 Clearning a keymap completely Narendra Joshi
` (2 preceding siblings ...)
2016-09-05 4:03 ` John Mastro
@ 2016-09-05 7:27 ` Marcin Borkowski
2016-09-06 12:53 ` Stefan Monnier
4 siblings, 0 replies; 9+ messages in thread
From: Marcin Borkowski @ 2016-09-05 7:27 UTC (permalink / raw
To: Narendra Joshi; +Cc: help-gnu-emacs@gnu.org
On 2016-09-04, at 23:40, Narendra Joshi <narendraj9@gmail.com> 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?
Also, you may want to make a mode derived from special-mode.
> Best,
> Narendra Joshi
Hth,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Clearning a keymap completely
2016-09-04 21:40 Clearning a keymap completely Narendra Joshi
` (3 preceding siblings ...)
2016-09-05 7:27 ` Marcin Borkowski
@ 2016-09-06 12:53 ` Stefan Monnier
4 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2016-09-06 12:53 UTC (permalink / raw
To: help-gnu-emacs
> 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?
The traditional way to do that is with suppress-keymap or by deriving
from special-mode.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.1893.1473362103.22741.help-gnu-emacs@gnu.org>]
end of thread, other threads:[~2016-09-09 9:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-04 21:40 Clearning a keymap completely 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
[not found] <mailman.1893.1473362103.22741.help-gnu-emacs@gnu.org>
2016-09-09 8:41 ` Ralf Fassel
2016-09-09 9:04 ` Joost Kremers
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.