From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74637: [PATCH] Make view-read-only behave like view-file Date: Sun, 01 Dec 2024 22:40:16 +0200 Message-ID: <22136.7087493249$1733085692@news.gmane.org> Reply-To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37382"; mail-complaints-to="usenet@ciao.gmane.io" To: 74637@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 21:41:23 2024 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 1tHqkt-0009aR-Jk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 21:41:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHqkb-0006to-N8; Sun, 01 Dec 2024 15:41:05 -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 1tHqkZ-0006tR-9O for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 15:41:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHqkZ-0007jr-1d for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 15:41:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=2qaclz5FZ5cVqu9zDUJCM7cDXsGRFADdMHJICn+OnkY=; b=aglJkGAYVACUXw1RfvnvCPMQc4BjFfMW4WaMzugjH+RwiRiSxyAgF6oSwnWzWQd9S9Quh8qjfWTBUbd705RDfw86koRp8EsYApdH4YSnLG4WP5MCjYf7Qxmi1ahKV3aCFq6/GIB9SyJf7e8ADkf/3OxAOq/3Oe1kuHDAdR1881FeNRYP/NmhBTLW8auwxKGb4ZCwwQ6pBEjcZxmNM+bjf6sUeqkhkXm5s5qkPMLzQskurg1ft35ANhCiK5LnuQdFrhCrurEyDqhki3VEc1diaXDSICjOjc//I9Zd/XbtkndN3o6RFFfaFkz54SPgwynW0NuIKr9nx1A7pfqzqPBguA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHqkY-0007OK-Kz for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 15:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 20:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74637 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173308564428369 (code B ref -1); Sun, 01 Dec 2024 20:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Dec 2024 20:40:44 +0000 Original-Received: from localhost ([127.0.0.1]:53202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHqkF-0007NV-JU for submit@debbugs.gnu.org; Sun, 01 Dec 2024 15:40:44 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:56178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHqkA-0007NH-Kw for submit@debbugs.gnu.org; Sun, 01 Dec 2024 15:40:41 -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 1tHqk9-0006ns-HT for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 15:40:38 -0500 Original-Received: from thaodan.de ([2a03:4000:4f:f15::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHqk7-0007Ys-A6 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 15:40:37 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id 144DBD00043 for ; Sun, 1 Dec 2024 22:40:18 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1733085618; bh=kN6Y8bXzm4HKR6wvt2EXr1dj194rGHcGAMURPCIoIO4=; h=From:To:Subject:Date; b=o93K5qAKkySFWdcfGB7+rgWsy2QQ8CwN9uvp+ixPn8ii/szYPEUllOeM9Ki/kxzON +ZXa2hnPrdh5gmBt8k7/V/5y4UGs/XQdb5Ve2EVLLnEwOnFmJbDnmMQrGvnPLNZpDg yL1F+Q53XBwu5cdQ0p5aH2y15FpXMNsFTSI92sXve9uvA9k4ncyr3u540oe08pPRuX d2IVNUwlH3H+mHh1BId7H25KyVIaYVdGJ6O+7e0n+/t+u/wnMdsiKXllXF5elrCfNL g00L/oq8Q2xz04vofbLyKwD9JWFMCoSslF0HF5OC6jjWk+b1mzZbulfvJyLmKh+tiM EBhZ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7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH Received-SPF: pass client-ip=2a03:4000:4f:f15::1; envelope-from=bjorn.bidar@thaodan.de; helo=thaodan.de X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, INVALID_MSGID=0.568, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:296278 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Make view-mode behave like when called in view-file when entered because `view-read-only' is true on a file which is not writable. The change makes the view-read-only behave better on files which are not writable. Now it makes Emacs behave more like less on these files. In GNU Emacs 31.0.50 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) Repository revision: eee0ed8442aa78320a3e578ab290df145fb49624 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101014 System Description: openSUSE Tumbleweed Configured using: 'configure --disable-build-details --without-pop --with-mailutils --without-hesiod --with-gameuser=:games --with-kerberos --with-kerberos5 --with-file-notification=inotify --with-modules --enable-autodepend --enable-link-time-optimization --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --localstatedir=/var --sharedstatedir=/var/lib --libexecdir=/usr/libexec --with-file-notification=yes --libdir=/usr/lib64 --with-native-compilation=aot --enable-locallisppath=/usr/share/emacs/31.0.50/site-lisp:/usr/share/emacs/site-lisp --with-x --with-xim --with-sound --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-rsvg --with-dbus --with-xft --without-gpm --with-tree-sitter --with-x-toolkit=gtk --without-pgtk --with-toolkit-scroll-bars --x-includes=/usr/include --x-libraries=/usr/lib64 --with-libotf --with-m17n-flt --with-cairo --build=x86_64-suse-linux --with-dumping=pdumper build_alias=x86_64-suse-linux 'CC=sccache cc' 'CFLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -march=znver3 -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -msse4a -mno-fma4 -mno-xop -mfma -mbmi -mbmi2 -maes -mpclmul -mno-gfni -mvpclmulqdq -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mclzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mmwaitx -mno-pconfig -mpku -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mno-waitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver3 -fno-optimize-sibling-calls -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -D_GNU_SOURCE -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS -pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label -DPDMP_BASE='\''"emacs-gtk"'\''' LDFLAGS=-Wl,-O2 'CXX=sccache c++' PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Make-view-read-only-behave-like-view-file.patch >From d77d0880871061820b1cdf61f1d74f2a7e5224aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sun, 1 Dec 2024 22:22:24 +0200 Subject: [PATCH] Make view-read-only behave like view-file Make view-mode also behave like less when entered through the view-read-only option similarly as done in in '1997-06-14 "Make view mode more similar to `less'' (ab7782fc244). * lisp/files.el (after-find-file): When opening a file which is read only and `view-read-only' is true leave view-mode with `kill-buffer-if-not-modified'. * lisp/view.el (view-mode): Document new behavior. --- lisp/files.el | 2 +- lisp/view.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index a65bc4a4ea2..2f062b45daf 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2874,7 +2874,7 @@ after-find-file (when (and buffer-read-only view-read-only (not (eq (get major-mode 'mode-class) 'special))) - (view-mode-enter)) + (view-mode-enter nil 'kill-buffer-if-not-modified)) (run-hooks 'find-file-hook))) (define-obsolete-function-alias 'report-errors 'with-demoted-errors "25.1") diff --git a/lisp/view.el b/lisp/view.el index 2ac7479739f..422d8a1f537 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -416,7 +416,7 @@ view-mode The effect of \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] depends on how view-mode was entered. If it was entered by view-file, view-file-other-window, view-file-other-frame, or \\[dired-view-file] \(\\[view-file], \\[view-file-other-window], -\\[view-file-other-frame], or the Dired mode v command), +\\[view-file-other-frame], `view-read-only', or the Dired mode v command), then \\[View-quit] will try to kill the current buffer. If view-mode was entered from another buffer, by \\[view-buffer], \\[view-buffer-other-window], \\[view-buffer-other frame], \\[view-file], -- 2.45.2 --=-=-=--