bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61652: 28.2; Read-only mode and View mode


From: Bernd Rellermeyer
Subject: bug#61652: 28.2; Read-only mode and View mode
Date: Mon, 20 Feb 2023 09:41:33 +0100

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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]