From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11726: closed (Re: bug#11726: 24.1; `C-x C-q' should say that the buffer is now read only or writable) Date: Wed, 27 Jun 2012 10:06:51 -0400 Message-ID: References: <87a9zvcu2f.fsf@gnu.org> <4AD2AA78BD354EB6B48381EC0C0B3CD0@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1340806098 29899 80.91.229.3 (27 Jun 2012 14:08:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jun 2012 14:08:18 +0000 (UTC) Cc: Bastien Guerry , 11726@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 27 16:08:17 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sjsuk-0003be-C7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 16:08:14 +0200 Original-Received: from localhost ([::1]:54219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjsuk-00042t-21 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 10:08:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjsuY-0003uO-Ei for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 10:08:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjsuS-0005nd-5x for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 10:08:02 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjsuS-0005nS-3D for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 10:07:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SjsyQ-0007kC-BT for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 10:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jun 2012 14:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11726 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11726-submit@debbugs.gnu.org id=B11726.134080626229701 (code B ref 11726); Wed, 27 Jun 2012 14:12:02 +0000 Original-Received: (at 11726) by debbugs.gnu.org; 27 Jun 2012 14:11:02 +0000 Original-Received: from localhost ([127.0.0.1]:60421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SjsxS-0007j0-13 for submit@debbugs.gnu.org; Wed, 27 Jun 2012 10:11:02 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:42844) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SjsxQ-0007ic-7C for 11726@debbugs.gnu.org; Wed, 27 Jun 2012 10:11:00 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlAQAG6Zu09sr+Nd/2dsb2JhbABEgieuIYNJgQiCFQEBBAEnLyMQCw4mBwsUGA0kiBwFugmQRAOjM4FYgwWBOho X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="192189739" Original-Received: from 108-175-227-93.dsl.teksavvy.com (HELO pastel.home) ([108.175.227.93]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Jun 2012 10:06:52 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id C4C1852030; Wed, 27 Jun 2012 10:06:51 -0400 (EDT) In-Reply-To: (Glenn Morris's message of "Wed, 27 Jun 2012 02:50:58 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61325 Archived-At: >> I added a message after `C-x C-q' -- thanks. > This is an annoyance. > emacs -Q > M-x custom TAB > -> "Read-only enabled for this buffer" in the echo area define-minor-mode only outputs such messages when the function is called interactively, so we should do the same for toggle-read-only. Or rather we should probably use something like the patch below. But it's also the case that toggle-read-only should not be called from Elisp, so another bug is to call toggle-read-only rather than to set buffer-read-only. Stefan === modified file 'lisp/files.el' --- lisp/files.el 2012-06-26 16:23:01 +0000 +++ lisp/files.el 2012-06-27 14:02:59 +0000 @@ -4842,7 +4842,7 @@ "Modification-flag cleared")) (set-buffer-modified-p arg)) -(defun toggle-read-only (&optional arg) +(define-minor-mode toggle-read-only "Change whether this buffer is read-only. With prefix argument ARG, make the buffer read-only if ARG is positive, otherwise make it writable. If buffer is read-only @@ -4855,27 +4855,17 @@ set `buffer-read-only'. To ignore read-only status (whether due to text properties or buffer state) and make changes, temporarily bind `inhibit-read-only'." - (interactive "P") - (if (and arg - (if (> (prefix-numeric-value arg) 0) buffer-read-only - (not buffer-read-only))) ; If buffer-read-only is set correctly, - nil ; do nothing. - ;; Toggle. - (progn + :variable buffer-read-only (cond - ((and buffer-read-only view-mode) + ((and (not buffer-read-only) view-mode) (View-exit-and-edit) (make-local-variable 'view-read-only) (setq view-read-only t)) ; Must leave view mode. - ((and (not buffer-read-only) view-read-only + ((and buffer-read-only view-read-only ;; If view-mode is already active, `view-mode-enter' is a nop. (not view-mode) (not (eq (get major-mode 'mode-class) 'special))) - (view-mode-enter)) - (t (setq buffer-read-only (not buffer-read-only)) - (force-mode-line-update)))) - (message "Read-only %s for this buffer" - (if buffer-read-only "enabled" "disabled")))) + (view-mode-enter)))) (defun insert-file (filename) "Insert contents of file FILENAME into buffer after point.