I hit some strange incantation of keystrokes in emacs while using ACL2, and a region in my buffer becomes read-only. What can cause this? How do I unmark a region as read-only?
Asked
Active
Viewed 36 times
1 Answers
0
A Cause:
Suppose you have emacs-acl2.el loaded and the following in your ~/.emacs file:
(fset 'copy-and-advance
[?\C-t ?\C-e return ?\C-x ?o ?\C-\M-f ?\C-\M-f ?\C-\M-b])
(global-set-key "\C-tn" 'copy-and-advance)
(global-set-key (kbd "<backtab>") 'copy-and-advance) ; backtab is Shift+tab
Then performing the following causes the problem:
<switch to *shell* buffer>
ctrl+x b
shift+tab
<"SwitchSwitch" now appears as a read-only region at the prompt of my *shell* buffer>
A solution:
Put this in your ~/.emacs
file and reload your ~/.emacs
file (note the credit to stack overflow question 7410125):
(defun set-region-writeable (begin end)
"See http://stackoverflow.com/questions/7410125"
(interactive "r")
(let ((modified (buffer-modified-p))
(inhibit-read-only t))
(remove-text-properties begin end '(read-only t))
(set-buffer-modified-p modified)))
Then execute the above function with:
ctrl-x h
meta-x set-region-writable
<enter>

interestedparty333
- 2,386
- 1
- 21
- 35