From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bernd Rellermeyer Newsgroups: gmane.emacs.bugs Subject: bug#61652: 28.2; Read-only mode and View mode Date: Mon, 20 Feb 2023 09:41:33 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33213"; mail-complaints-to="usenet@ciao.gmane.io" To: 61652@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 15:09:11 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pU6qs-0008Ve-HZ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 15:09:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU6qp-0002Aw-7R; Mon, 20 Feb 2023 09:09:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU6qk-00028c-Pr for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 09:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU6qk-0001do-HI for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 09:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pU6qk-0003t1-Cf for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 09:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bernd Rellermeyer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2023 14:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61652 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167690213514908 (code B ref -1); Mon, 20 Feb 2023 14:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Feb 2023 14:08:55 +0000 Original-Received: from localhost ([127.0.0.1]:51061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU6qc-0003sI-4t for submit@debbugs.gnu.org; Mon, 20 Feb 2023 09:08:54 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU1kg-0000hh-MO for submit@debbugs.gnu.org; Mon, 20 Feb 2023 03:42:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU1kW-00017l-HY for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 03:42:21 -0500 Original-Received: from mailout02.t-online.de ([194.25.134.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU1kT-0006MW-6r for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 03:42:15 -0500 Original-Received: from fwd76.dcpf.telekom.de (fwd76.aul.t-online.de [10.223.144.102]) by mailout02.t-online.de (Postfix) with SMTP id 3A65033AC for ; Mon, 20 Feb 2023 09:41:56 +0100 (CET) Original-Received: from Bernds-Mac-mini.fritz.box ([62.216.207.90]) by fwd76.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1pU1kB-1IDbaT0; Mon, 20 Feb 2023 09:41:55 +0100 X-TOI-EXPURGATEID: 150726::1676882515-E5D7A2C2-13E740D5/0/0 CLEAN NORMAL X-TOI-MSGID: 03ffb622-471b-4a3c-b4eb-5eb072c1ac34 Received-SPF: none client-ip=194.25.134.17; envelope-from=bernd.rellermeyer@t-online.de; helo=mailout02.t-online.de X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 20 Feb 2023 09:08:49 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256175 Archived-At: I have the following scenario: 1. View a buffer in View mode. 2. Turn off Read-Only mode, e.g. by pressing `C-x C-q`. 3. Turn on Read-Only mode and View mode again, eg. by pressing `C-x C-q`- 4. Exit View mode by `View-exit`, e.g. by pressing `e`. Now the buffer is in Read-Only mode. In my opinion it should be writable. The reason is the variable `view-old-buffer-read-only`, which is set on entering View mode (`view--enable`) to the (old) value of `buffer-read-only`. But in my scenario, the value of `buffer-read-only` is already the new one, as set in `read-only-mode`. I think the solution is to reset `read-only-mode` to nil in the specific branch of `read-only-mode` and depend on the fact that it is set to t in `view--enable`: ``` (cond ((and (not buffer-read-only) view-mode) (View-exit-and-edit) (setq-local view-read-only t)) ; Must leave view mode. ((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))) (setq buffer-read-only nil) (view-mode-enter)))) ``` In GNU Emacs 28.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2022-09-12 built on builder10-14.lan Windowing system distributor 'Apple', version 10.3.2299 System Description: macOS 13.2.1 Configured using: 'configure --with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS TOOLKIT_SCROLL_BARS ZLIB Important settings: value of $LANG: de_DE.UTF-8 locale-coding-system: utf-8-unix Major mode: Help Minor modes in effect: which-function-mode: t delete-selection-mode: t cua-mode: t global-auto-revert-mode: t global-display-glyphs-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: /Users/bernd/.config/emacs/elpa/magit-3.3.0/magit-section-pkg hides /Users/bernd/.config/emacs/elpa/magit-section-3.3.0/magit-section-pkg /Users/bernd/.config/emacs/elpa/transient-0.3.7/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient /Users/bernd/.config/emacs/elpa/xref-1.6.1/xref hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/xref /Users/bernd/.config/emacs/elpa/project-0.9.8/project hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/project Features: (shadow sort mail-extr emacsbug calc-alg calc-ext calc-menu calc calc-loaddefs rect calc-macs pandoc-mode pandoc-mode-utils hydra lv markdown-mode edit-indirect transient magit-utils dash org-colview org-clock disp-table zetteltags-global zetteltags pcre2el rxt pcase re-builder crm adaptive-wrap text-face face-remap org-element avl-tree generator ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win ol-docview doc-view image-mode exif ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi org-agenda org-refile reftxt reftex-cite reftex reftex-loaddefs reftex-vars org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601 org-keys oc org-loaddefs ol rx org-compat advice org-macs format-spec cal-menu calendar cal-loaddefs eieio-opt speedbar ezimage dframe shortdoc undo-fu debug dabbrev misearch multi-isearch pulse thai-util thai-word help-fns radix-tree cl-print edebug backtrace find-func dired-aux dired-x dired dired-loaddefs add-log which-func imenu delsel cua-base quail autorevert filenotify view-x hi-lock scroll-lock view god-mode cl-extra help-mode ns-plist jka-compr display-glyphs unfill color modus-vivendi-theme modus-operandi-theme modus-themes launch my-skeletons skeleton xref project bind-key easy-mmode zetteldeft ace-window thingatpt avy ring deft gnus nnheader gnus-util rmail rmail-loaddefs text-property-search time-date sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cus-edit pp cus-load wid-edit edmacro kmacro tex-site info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 605640 36594) (symbols 48 36818 4) (strings 32 124518 7449) (string-bytes 1 4182471) (vectors 16 67356) (vector-slots 8 1431598 28878) (floats 8 501 324) (intervals 56 10795 698) (buffers 992 32))