Subject: 26.3; Package install fails if read-only-mode hooked to find-file

From: Pablo Aguado <[email-masked]>
Date: Wed, 16 Sep 2020 21:57:00 +0000

I have set the following to always open files in read-only-mode:
    (add-hook 'find-file-hook 'read-only-mode)

When I tried to install a new package through package-install, I got
(buffer-read-only #<buffer adaptive-wrap-autoloads.el>)

In https://emacs.stackexchange.com/a/46655 I found a working solution
for someone else having the same problem,
that seems to be telling package-install to inhibit read-only-mode:
    (advice-add
     'package-install-from-archive
     :around (lambda (orig-fun &rest args)
               (let ((inhibit-read-only t))
                  (apply orig-fun args))))

This worked but I think the behavior I expected should be a default.

Thanks!

--------

In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2020-05-19 built on felixonmars2
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description:	Manjaro Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int
 --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LC_MONETARY: es_AR.UTF-8
  value of $LC_NUMERIC: es_AR.UTF-8
  value of $LC_TIME: es_AR.UTF-8
  value of $LANG: es_AR.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  winner-mode: t
  show-paren-mode: t
  on-screen-global-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-superword-mode: t
  superword-mode: t
  electric-pair-mode: t
  display-battery-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-quote-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t