unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Disable self-insert-command
@ 2019-05-17 10:59 Joost Kremers
  2019-05-17 11:17 ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: Joost Kremers @ 2019-05-17 10:59 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I've been trying to  figure out if there's a straightforward way 
to disable all self-inserting characters through a minor mode, but 
I haven't been able to find something. Two options come to mind, 
but they both don't feel "right". One would be to simply bind all 
self-inserting characters to `ignore', which seems cumbersome and 
error-prone, however. The other option that comes to mind is 
advising `self-insert-command`, though I haven't (yet) tested 
whether that would actually work and wouldn't cause any other 
problems, given that it's a primitive function.

I guess I could also make the relevant buffer read-only, but then 
every key that's not bound to something else produces a "Buffer is 
read-only" error...

Any ideas? Anything I'm overlooking?

TIA

Joost



-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Disable self-insert-command
  2019-05-17 10:59 Disable self-insert-command Joost Kremers
@ 2019-05-17 11:17 ` Noam Postavsky
  2019-05-17 12:54   ` Mauro Aranda
  0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2019-05-17 11:17 UTC (permalink / raw)
  To: Joost Kremers; +Cc: help-gnu-emacs

On Fri, 17 May 2019 at 07:13, Joost Kremers <joostkremers@fastmail.fm> wrote:

> I've been trying to  figure out if there's a straightforward way
> to disable all self-inserting characters through a minor mode,

> Any ideas? Anything I'm overlooking?

(define-key my-minor-mode-map [remap self-insert-command] 'ignore)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Disable self-insert-command
  2019-05-17 11:17 ` Noam Postavsky
@ 2019-05-17 12:54   ` Mauro Aranda
  0 siblings, 0 replies; 3+ messages in thread
From: Mauro Aranda @ 2019-05-17 12:54 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Joost Kremers, help-gnu-emacs

Noam Postavsky <npostavs@gmail.com> writes:

> On Fri, 17 May 2019 at 07:13, Joost Kremers <joostkremers@fastmail.fm>
wrote:
>
>> I've been trying to  figure out if there's a straightforward way
>> to disable all self-inserting characters through a minor mode,
>
>> Any ideas? Anything I'm overlooking?
>
> (define-key my-minor-mode-map [remap self-insert-command] 'ignore)

Maybe suppress-keymap can help here?  It does something similar,
although it remaps to 'undefined rather than 'ignore.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-17 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-17 10:59 Disable self-insert-command Joost Kremers
2019-05-17 11:17 ` Noam Postavsky
2019-05-17 12:54   ` Mauro Aranda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).