From: martin rudalics <rudalics@gmx.at>
To: rms@gnu.org
Cc: emacs-devel@gnu.org, bojohan+news@dd.chalmers.se
Subject: Re: 23.0.50; delete-seletion-mode and read-only text
Date: Wed, 23 Jan 2008 10:19:12 +0100 [thread overview]
Message-ID: <47970690.4040607@gmx.at> (raw)
In-Reply-To: <E1JHRcP-0000ib-KN@fencepost.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]
> I think it is clearer to catch the error than to check the property by
> hand. But the question is where to do this? Where you did it, in
> delete-selection-pre-hook, or where I did it, in delete-active-region?
Honestly, mine was a simple-minded attempt to handle read-only buffers
and read-only text analogously.
> The question is, if you type a self-inserting character, is it right
> to skip just the deletion done by delete-active-region and do the
> insertion, or should it skip both? My patch does the former, yours
> does the latter.
I suppose your patch has the flaw that when `overwrite-mode' is on, the
following part
(if (and overwrite-mode (eq this-command 'self-insert-command))
(let ((overwrite-mode nil))
(self-insert-command (prefix-numeric-value current-prefix-arg))
(setq this-command 'ignore)))))
will still cause an error and clear `pre-command-hook'.
Maybe just add buffer-read-only and text-read-only to the handler in
`delete-selection-pre-hook' as in the attached patch?
[-- Attachment #2: delsel.patch --]
[-- Type: text/plain, Size: 1384 bytes --]
*** delsel.el.~1.43.~ Wed Oct 31 01:30:54 2007
--- delsel.el Wed Jan 23 08:42:28 2008
***************
*** 79,86 ****
t)
(defun delete-selection-pre-hook ()
! (when (and delete-selection-mode transient-mark-mode mark-active
! (not buffer-read-only))
(let ((type (and (symbolp this-command)
(get this-command 'delete-selection))))
(condition-case data
--- 79,85 ----
t)
(defun delete-selection-pre-hook ()
! (when (and delete-selection-mode transient-mark-mode mark-active)
(let ((type (and (symbolp this-command)
(get this-command 'delete-selection))))
(condition-case data
***************
*** 113,119 ****
;; stop safe_run_hooks from clearing out pre-command-hook.
(and (eq inhibit-quit 'pre-command-hook)
(setq inhibit-quit 'delete-selection-dummy))
! (signal 'file-supersession (cdr data)))))))
(put 'self-insert-command 'delete-selection t)
(put 'self-insert-iso 'delete-selection t)
--- 112,120 ----
;; stop safe_run_hooks from clearing out pre-command-hook.
(and (eq inhibit-quit 'pre-command-hook)
(setq inhibit-quit 'delete-selection-dummy))
! (signal 'file-supersession (cdr data)))
! ((buffer-read-only text-read-only)
! (message "Text is read-only"))))))
(put 'self-insert-command 'delete-selection t)
(put 'self-insert-iso 'delete-selection t)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2008-01-23 9:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 10:48 23.0.50; delete-seletion-mode and read-only text Johan Bockgård
2008-01-21 22:03 ` martin rudalics
2008-01-22 13:12 ` before-change-functions (was: 23.0.50; delete-seletion-mode and read-only text) Johan Bockgård
2008-01-23 9:32 ` before-change-functions martin rudalics
2008-01-22 13:20 ` read-only overlays (was: 23.0.50; delete-seletion-mode and read-only text) Johan Bockgård
2008-01-22 14:12 ` read-only overlays martin rudalics
2008-01-23 21:41 ` read-only overlays (was: 23.0.50; delete-seletion-mode and read-only text) Richard Stallman
2008-01-24 1:52 ` read-only overlays Stefan Monnier
2008-01-24 23:42 ` Richard Stallman
2008-01-22 22:29 ` 23.0.50; delete-seletion-mode and read-only text Richard Stallman
2008-01-23 9:19 ` martin rudalics [this message]
2008-01-23 16:20 ` Richard Stallman
2008-01-22 11:31 ` Richard Stallman
2008-01-22 13:02 ` Johan Bockgård
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47970690.4040607@gmx.at \
--to=rudalics@gmx.at \
--cc=bojohan+news@dd.chalmers.se \
--cc=emacs-devel@gnu.org \
--cc=rms@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).