From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: 23.0.50; delete-seletion-mode and read-only text Date: Wed, 23 Jan 2008 10:19:12 +0100 Message-ID: <47970690.4040607@gmx.at> References: <4795169E.5060704@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000201030500040702050405" X-Trace: ger.gmane.org 1201080022 13498 80.91.229.12 (23 Jan 2008 09:20:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Jan 2008 09:20:22 +0000 (UTC) Cc: emacs-devel@gnu.org, bojohan+news@dd.chalmers.se To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 23 10:20:41 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JHbmj-0005w7-AF for ged-emacs-devel@m.gmane.org; Wed, 23 Jan 2008 10:20:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHbmJ-0006le-7U for ged-emacs-devel@m.gmane.org; Wed, 23 Jan 2008 04:20:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHbmD-0006iX-NC for emacs-devel@gnu.org; Wed, 23 Jan 2008 04:20:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHbmC-0006gF-22 for emacs-devel@gnu.org; Wed, 23 Jan 2008 04:20:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHbmB-0006fx-RI for emacs-devel@gnu.org; Wed, 23 Jan 2008 04:20:07 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JHbmB-0001GB-Ap for emacs-devel@gnu.org; Wed, 23 Jan 2008 04:20:07 -0500 Original-Received: (qmail invoked by alias); 23 Jan 2008 09:20:05 -0000 Original-Received: from N807P005.adsl.highway.telekom.at (EHLO [62.47.44.197]) [62.47.44.197] by mail.gmx.net (mp057) with SMTP; 23 Jan 2008 10:20:05 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/1K8YLKJ31+6ZdCodlD4MY1AcjjnmxiLkLdjeZqn l7p1DyUlEs+ArE User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:87359 Archived-At: This is a multi-part message in MIME format. --------------000201030500040702050405 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > 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? --------------000201030500040702050405 Content-Type: text/plain; name="delsel.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="delsel.patch" *** 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) --------------000201030500040702050405 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------000201030500040702050405--