unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: "Johan Bockgård" <bojohan+news@dd.chalmers.se>
Cc: emacs-devel@gnu.org
Subject: Re: 23.0.50; delete-seletion-mode and read-only text
Date: Mon, 21 Jan 2008 23:03:10 +0100	[thread overview]
Message-ID: <4795169E.5060704@gmx.at> (raw)
In-Reply-To: <yoijbq7f78uc.fsf@remote1.student.chalmers.se>

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

> In delete-seletion-mode, trying to self insert in read-only text when
> there is a selection signals an error that clears pre-command-hook.
> 
> emacs -Q
> 
>     (delete-selection-mode 1)
>     (insert (propertize "12345" 'read-only t))
> 
> Select read only text with C-SPC + moving. Press a self-inserting key ("x").
> 
> => pre-command-hook is cleared.
> 
> delete-selection-mode does check buffer-read-only, but it does not
> protect against read-only text.

Does the attached patch fix it?


[-- Attachment #2: delsel.patch --]
[-- Type: text/plain, Size: 886 bytes --]

*** delsel.el.~1.43.~	Wed Oct 31 01:30:54 2007
--- delsel.el	Mon Jan 21 23:01:08 2008
***************
*** 80,86 ****
  
  (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
--- 80,90 ----
  
  (defun delete-selection-pre-hook ()
    (when (and delete-selection-mode transient-mark-mode mark-active
! 	     (not buffer-read-only)
! 	     (let ((from (min (point) (mark)))
! 		   (to (max (point) (mark))))
! 	       (not (or (get-text-property from 'read-only)
! 			(< (next-single-property-change from 'read-only nil to) to)))))
      (let ((type (and (symbolp this-command)
  		     (get this-command 'delete-selection))))
        (condition-case data

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2008-01-21 22:03 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 [this message]
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
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=4795169E.5060704@gmx.at \
    --to=rudalics@gmx.at \
    --cc=bojohan+news@dd.chalmers.se \
    --cc=emacs-devel@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).