GNU bug report logs - #75993
Special mode-class for diff-mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Juri Linkov <juri@HIDDEN>; Keywords: patch; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 31.0.50, send any further explanations to 75993 <at> debbugs.gnu.org and Juri Linkov <juri@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 9 Feb 2025 07:45:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 02:45:01 2025
Received: from localhost ([127.0.0.1]:42876 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1th1zw-0007sP-WE
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 02:45:01 -0500
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:58229)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1th1zm-0007rb-Gd; Sun, 09 Feb 2025 02:44:51 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 4DBDC43309;
 Sun,  9 Feb 2025 07:44:42 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <87tt96syb8.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
 <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
 <87frkrwk06.fsf@HIDDEN>
 <jwvwme3gk4x.fsf-monnier+emacs@HIDDEN>
 <87a5azt2lk.fsf@HIDDEN>
 <jwv4j17gcsb.fsf-monnier+emacs@HIDDEN>
 <87tt96syb8.fsf@HIDDEN>
Date: Sun, 09 Feb 2025 09:40:58 +0200
Message-ID: <87h6537egb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefgeehjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopeefpdhrtghpthhtoheptghonhhtrhholhesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopeejheelleefseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

close 75993 31.0.50
thanks

>> So why don't we make `diff-mode` inherit from `special-mode`?
>
> Because it doesn't allow self-inserting keys in editable mode.

Ok, so now pushed.  The only problem was dependence of
view-mode activation on the symbol property with unrelated name
that is quite confusing.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 6 Feb 2025 18:50:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 13:50:40 2025
Received: from localhost ([127.0.0.1]:59466 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tg6xT-0005No-Qu
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2025 13:50:40 -0500
Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:40621)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tg6xR-0005NV-12
 for 75993 <at> debbugs.gnu.org; Thu, 06 Feb 2025 13:50:37 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id CED3444389;
 Thu,  6 Feb 2025 18:50:24 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <jwv4j17gcsb.fsf-monnier+emacs@HIDDEN>
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
 <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
 <87frkrwk06.fsf@HIDDEN>
 <jwvwme3gk4x.fsf-monnier+emacs@HIDDEN>
 <87a5azt2lk.fsf@HIDDEN>
 <jwv4j17gcsb.fsf-monnier+emacs@HIDDEN>
Date: Thu, 06 Feb 2025 20:49:47 +0200
Message-ID: <87tt96syb8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvjeduhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepjeehleelfeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> So why don't we make `diff-mode` inherit from `special-mode`?

Because it doesn't allow self-inserting keys in editable mode.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 6 Feb 2025 18:23:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 13:23:04 2025
Received: from localhost ([127.0.0.1]:59431 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tg6Wl-00044x-Tk
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2025 13:23:04 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17593)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tg6Wi-00044A-Vq
 for 75993 <at> debbugs.gnu.org; Thu, 06 Feb 2025 13:23:01 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F2BED8091C;
 Thu,  6 Feb 2025 13:22:53 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1738866172;
 bh=mGBT/XP3cn+HOqDWnjeYik/znK1/3wLxp2TpMufTSeg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=P6XTVl1l0SPDK5PZvFoSpqodEDGxiwvqq965/+lwBCmU53m1fjncFVbx8kTU/g9Rl
 eDrF40SSjUKc2iw/tpstkQJG32FF5l1sFn/GJDGRm1jmmfXFvSSq+CqjHz6KTDKbLD
 /MIIn5GmHJtVgoe+kfPq8wGx5IhE77tnYH8A2MrijdWRIxrEjJRs2Di/g+DawhKEJM
 Jw9J0U935XznbnoKlGCCbv6Os+wri37xUjuXY/zgNWdvGsrZxtHSXvBM8T4bUb7P2K
 wrb/ubazmjb18QoU8+toqO8XDykqL41nQ106UO2xTFB/TC724XQVCgKnGDtuLSYAkn
 F4h7OiU735ZIg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BA69480030;
 Thu,  6 Feb 2025 13:22:52 -0500 (EST)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ABA271201D1;
 Thu,  6 Feb 2025 13:22:52 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <87a5azt2lk.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 06 Feb 2025 19:17:11 +0200")
Message-ID: <jwv4j17gcsb.fsf-monnier+emacs@HIDDEN>
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
 <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
 <87frkrwk06.fsf@HIDDEN>
 <jwvwme3gk4x.fsf-monnier+emacs@HIDDEN>
 <87a5azt2lk.fsf@HIDDEN>
Date: Thu, 06 Feb 2025 13:22:52 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.218 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Hmm... when you `(setq diff-default-read-only nil)`, `w` is not bound to
>> `diff-kill-ring-save` but to `self-insert-command`, so I think we *do*
>> want `view-read-only` to apply in this case.
> `w` is bound to `diff-kill-ring-save` because of
> the read-only file and therefore read-only buffer.

Hmm... looks like you're right.

So why don't we make `diff-mode` inherit from `special-mode`?


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 6 Feb 2025 17:19:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 12:19:46 2025
Received: from localhost ([127.0.0.1]:59324 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tg5XW-00013G-HO
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2025 12:19:46 -0500
Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]:44429)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tg5XU-00012x-60
 for 75993 <at> debbugs.gnu.org; Thu, 06 Feb 2025 12:19:45 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 878EC1F764;
 Thu,  6 Feb 2025 17:19:32 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <jwvwme3gk4x.fsf-monnier+emacs@HIDDEN>
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
 <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
 <87frkrwk06.fsf@HIDDEN>
 <jwvwme3gk4x.fsf-monnier+emacs@HIDDEN>
Date: Thu, 06 Feb 2025 19:17:11 +0200
Message-ID: <87a5azt2lk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieeljecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepjeehleelfeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>>> I tested with special mode-class, and see no negative side effect.
>>>
>>> Have you tried to
>>>
>>>     (setq diff-default-read-only nil)
>>>     (setq view-read-only t)
>>>
>>> and then open a read-only `.patch` file?
>>> I think your patch will hinder
>>> the auto-activation of `view-mode` in that case.
>>
>> Indeed, `view-mode` is not activated in this case,
>> and this is the right thing to do to allow using
>> diff-mode single letters like 'w' (diff-kill-ring-save)
>> instead of overriding it with
>> 'View-scroll-page-backward-set-page-size'.
>
> Hmm... when you `(setq diff-default-read-only nil)`, `w` is not bound to
> `diff-kill-ring-save` but to `self-insert-command`, so I think we *do*
> want `view-read-only` to apply in this case.

`w` is bound to `diff-kill-ring-save` because of
the read-only file and therefore read-only buffer.

There is no place for view-mode keybindings
since there are only 2 states:

- editable where `w` is `self-insert-command`
- read-only where `w` is `diff-kill-ring-save`




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 6 Feb 2025 15:40:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 10:40:03 2025
Received: from localhost ([127.0.0.1]:59048 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tg3z0-0004XM-Us
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2025 10:40:03 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:38905)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tg3yz-0004Wj-3W
 for 75993 <at> debbugs.gnu.org; Thu, 06 Feb 2025 10:40:01 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 65A074410C5;
 Thu,  6 Feb 2025 10:39:55 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1738856394;
 bh=byw2QfCMVUNlWPyoHh0Yt2b2imhXsvZ/PH5LdMV33Yg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=K3qIz1epR1suVeGtNmQyZ7jDV/1gd8dHLoKw8XXRogxl+rzbww+h36FX1/qIaGNbE
 dVsGPtVqfgJCsNhX/09NGh2Xi31OiOYIy0GKZ5Z0wLcknvu1ZaxtCEPnDTYcBRXS7+
 6Q8347brJXb5vZ2+HTILldZjrYQrwU05JA4kVQHvR9vm4YeioDEL34BlT+9Q5OmmqS
 s+5ikelf2FsML0w8eKtKOtZdy0NGRQybnEwC9l0KKfkjfLkXy/yd89l7ljaBXv9a4G
 xMcl5YsiAcADJ1BMyvNMl/1sUWV/RedZo6NyDq3arOJ/XAI4w7mWtSFPjrp7pbI20s
 AShY390NdbwBw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6FE3944199E;
 Thu,  6 Feb 2025 10:39:54 -0500 (EST)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6342912044C;
 Thu,  6 Feb 2025 10:39:54 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <87frkrwk06.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 06 Feb 2025 09:58:59 +0200")
Message-ID: <jwvwme3gk4x.fsf-monnier+emacs@HIDDEN>
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
 <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
 <87frkrwk06.fsf@HIDDEN>
Date: Thu, 06 Feb 2025 10:39:53 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.229 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>>> I tested with special mode-class, and see no negative side effect.
>>
>> Have you tried to
>>
>>     (setq diff-default-read-only nil)
>>     (setq view-read-only t)
>>
>> and then open a read-only `.patch` file?
>> I think your patch will hinder
>> the auto-activation of `view-mode` in that case.
>
> Indeed, `view-mode` is not activated in this case,
> and this is the right thing to do to allow using
> diff-mode single letters like 'w' (diff-kill-ring-save)
> instead of overriding it with
> 'View-scroll-page-backward-set-page-size'.

Hmm... when you `(setq diff-default-read-only nil)`, `w` is not bound to
`diff-kill-ring-save` but to `self-insert-command`, so I think we *do*
want `view-read-only` to apply in this case.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 6 Feb 2025 08:34:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 03:34:33 2025
Received: from localhost ([127.0.0.1]:54233 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfxLF-0003qU-BT
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2025 03:34:33 -0500
Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229]:36465)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tfxLC-0003q1-MD
 for 75993 <at> debbugs.gnu.org; Thu, 06 Feb 2025 03:34:31 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id CE78E442DD;
 Thu,  6 Feb 2025 08:34:21 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
 <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
Date: Thu, 06 Feb 2025 09:58:59 +0200
Message-ID: <87frkrwk06.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvheeludcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepjeehleelfeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> I tested with special mode-class, and see no negative side effect.
>
> Have you tried to
>
>     (setq diff-default-read-only nil)
>     (setq view-read-only t)
>
> and then open a read-only `.patch` file?
> I think your patch will hinder
> the auto-activation of `view-mode` in that case.

Indeed, `view-mode` is not activated in this case,
and this is the right thing to do to allow using
diff-mode single letters like 'w' (diff-kill-ring-save)
instead of overriding it with
'View-scroll-page-backward-set-page-size'.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 4 Feb 2025 20:52:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 04 15:52:26 2025
Received: from localhost ([127.0.0.1]:46889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfPuD-0006VB-UY
	for submit <at> debbugs.gnu.org; Tue, 04 Feb 2025 15:52:26 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54598)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tfPuB-0006Um-9V
 for 75993 <at> debbugs.gnu.org; Tue, 04 Feb 2025 15:52:24 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 767F78086A;
 Tue,  4 Feb 2025 15:52:17 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1738702336;
 bh=ifKobZ/x+x/upO6mRS84mQ7W0LG449tDHVhVERWTHho=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=RI8xQCAXuAKokZXQPZMOV+SWt84JqsRwx+Ji/ubQsA5YloDPx/wkLPERyhyB5vwG1
 rgQ5qzMcQq0+f3Y2Fd6N5EyaCY11lJnFlnZrjP03XVv+38H82XblquEeAblc/ZMTlM
 NuJQ+IR8gm4oL4KPnvQJ0gz3u4kbBQzuogJllnzwI2Yg3gLRLnBnqKjIsyarTlT+rf
 h7QQyPMoxTMeFZkZMbyJf/vhCGfDYxSoYWxKeQ/bDgUJPnkT1Y3LCjxzT2jcfutti1
 8zGFnu6OnJbExplfV3j5G/CaYCEWr1DZ6FusO2eM91NSOins8WxnGmZLx7iusN8VSp
 LgDxhlTsQN/vw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6EE478056D;
 Tue,  4 Feb 2025 15:52:16 -0500 (EST)
Received: from pastel (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3D7FE1205FA;
 Tue,  4 Feb 2025 15:52:16 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <877c657aqz.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 04 Feb 2025 21:37:32 +0200")
Message-ID: <jwvr04dl9p7.fsf-monnier+emacs@HIDDEN>
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN> <877c657aqz.fsf@HIDDEN>
Date: Tue, 04 Feb 2025 15:52:15 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.038 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> I still don't understand implications from the above text.
> Dired is read-only by default but can be switched to editable mode,

Note that when you make it writable, Dired changes the `major-mode`.
Also, AFAIK you can't open a Dired buffer in writable mode.

> so is Diff mode.

In contrast, `diff-mode` can be used both read-only and writable without
changing `major-mode`.

> I tested with special mode-class, and see no negative side effect.

Have you tried to

    (setq diff-default-read-only nil)
    (setq view-read-only t)

and then open a read-only `.patch` file?
I think your patch will hinder
the auto-activation of `view-mode` in that case.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 4 Feb 2025 19:48:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 04 14:48:45 2025
Received: from localhost ([127.0.0.1]:46757 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfOub-0008K8-6j
	for submit <at> debbugs.gnu.org; Tue, 04 Feb 2025 14:48:45 -0500
Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]:50529)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tfOuY-0008Jo-8H
 for 75993 <at> debbugs.gnu.org; Tue, 04 Feb 2025 14:48:43 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id AFDE944424;
 Tue,  4 Feb 2025 19:48:32 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <87msf23o4c.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 03 Feb 2025 19:59:03 +0200")
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
 <87msf23o4c.fsf@HIDDEN>
Date: Tue, 04 Feb 2025 21:37:32 +0200
Message-ID: <877c657aqz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvudegudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtgfesthekredttderjeenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeeiffetjeegheffjeeutdeihfdukeegjeetkeeigfevueehtedvfeegkeekveekudenucfkphepledurdduvdelrdeliedrledtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrdeliedrledtpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejheelleefseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>>> Hmm... this doesn't smell right:
>>>>
>>>> - I hate distinguishing between "mode-class = special" and "derives from
>>>>   `special-mode`".
>>>> - Whether we want to do that depends on `diff-mode-read-only` which is
>>>>   buffer-local.
>>>
>>> AFAICS, the special mode-class is handled only in `read-only-mode`:
>>>
>>>    ((and buffer-read-only view-read-only
>>>          (not view-mode)
>>>          (not (eq (get major-mode 'mode-class) 'special)))
>>>     (view-mode-enter))
>>>
>>> This is exactly what is needed in diff-mode when it switches to read-only
>>> it should not enable view-mode.
>>
>> Maybe, but:
>>
>> - Nothing in its name or in its doc says so, AFAICT.  IOW, it's just an accident.
>> - As a symbol property, it's not buffer-local.
>
> This description seems to fit the purpose of diff-mode:
>
>    • If this mode is appropriate only for specially-prepared text
>      produced by the mode itself (rather than by the user typing at the
>      keyboard or by an external file), then the major mode command
>      symbol should have a property named ‘mode-class’ with value
>      ‘special’, put on as follows:
>
>           (put 'funny-mode 'mode-class 'special)
>
>      This tells Emacs that new buffers created while the current buffer
>      is in Funny mode should not be put in Funny mode, even though the
>      default value of ‘major-mode’ is ‘nil’.  By default, the value of
>      ‘nil’ for ‘major-mode’ means to use the current buffer's major mode
>      when creating new buffers (*note Auto Major Mode::), but with such
>      ‘special’ modes, Fundamental mode is used instead.  Modes such as
>      Dired, Rmail, and Buffer List use this feature.

I still don't understand implications from the above text.
Dired is read-only by default but can be switched to editable mode,
so is Diff mode.

I tested with special mode-class, and see no negative side effect.

>      The function ‘view-buffer’ does not enable View mode in buffers
>      whose mode-class is special, because such modes usually provide
>      their own View-like bindings.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 3 Feb 2025 18:06:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 13:06:05 2025
Received: from localhost ([127.0.0.1]:41119 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tf0pg-0005JB-NZ
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 13:06:05 -0500
Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]:50007)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tf0pe-0005IA-4H
 for 75993 <at> debbugs.gnu.org; Mon, 03 Feb 2025 13:06:02 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id AA52241B45;
 Mon,  3 Feb 2025 18:05:52 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Mon, 03 Feb 2025 06:16:56 -0500")
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
 <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
Date: Mon, 03 Feb 2025 19:59:03 +0200
Message-ID: <87msf23o4c.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukedvjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepjeehleelfeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

>>> Hmm... this doesn't smell right:
>>>
>>> - I hate distinguishing between "mode-class = special" and "derives from
>>>   `special-mode`".
>>> - Whether we want to do that depends on `diff-mode-read-only` which is
>>>   buffer-local.
>>
>> AFAICS, the special mode-class is handled only in `read-only-mode`:
>>
>>    ((and buffer-read-only view-read-only
>>          (not view-mode)
>>          (not (eq (get major-mode 'mode-class) 'special)))
>>     (view-mode-enter))
>>
>> This is exactly what is needed in diff-mode when it switches to read-only
>> it should not enable view-mode.
>
> Maybe, but:
>
> - Nothing in its name or in its doc says so, AFAICT.  IOW, it's just an accident.
> - As a symbol property, it's not buffer-local.

This description seems to fit the purpose of diff-mode:

   • If this mode is appropriate only for specially-prepared text
     produced by the mode itself (rather than by the user typing at the
     keyboard or by an external file), then the major mode command
     symbol should have a property named ‘mode-class’ with value
     ‘special’, put on as follows:

          (put 'funny-mode 'mode-class 'special)

     This tells Emacs that new buffers created while the current buffer
     is in Funny mode should not be put in Funny mode, even though the
     default value of ‘major-mode’ is ‘nil’.  By default, the value of
     ‘nil’ for ‘major-mode’ means to use the current buffer's major mode
     when creating new buffers (*note Auto Major Mode::), but with such
     ‘special’ modes, Fundamental mode is used instead.  Modes such as
     Dired, Rmail, and Buffer List use this feature.

     The function ‘view-buffer’ does not enable View mode in buffers
     whose mode-class is special, because such modes usually provide
     their own View-like bindings.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 3 Feb 2025 11:17:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 06:17:07 2025
Received: from localhost ([127.0.0.1]:37999 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1teuRv-0000K8-4Q
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 06:17:07 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27374)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1teuRs-0000JI-Ib
 for 75993 <at> debbugs.gnu.org; Mon, 03 Feb 2025 06:17:05 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F007044042A;
 Mon,  3 Feb 2025 06:16:58 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1738581417;
 bh=+T+F6U2HCSxenUnxuSII3hnML718igvFr/yPQAahDQM=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=eI4M+OfUHZqVydtq/jFpfDGvxto2sqKcMC5MdVC1eq+PhtrixPBBoloH2JnAS8DMQ
 POjkZ19aSO6PaImBN6fYxXpCT5EpU8LsF8E4UrKwZ2huLCpUFKk4Ad414lm0xiz/jB
 q5+jSF0mrtOMgsTF2f0SX972G13afWOgwRB0iy2HBSH6C1P8vTQpKlFiLv8Vuj9PaL
 PSZM1Eg4rmguqDe6qH6ar7S0m4UdAHC2auAXEvu/+KcgP8fhMsqMpIm0R0K4gxFu0J
 ZwH28SpdRzOsnqS6QJEdyjbCKFVxN52Wm5c/nuXvXJZ39KpyZRa0EdkBMp9oo2P3F/
 ps6ZwMeERruhA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E109A440B94;
 Mon,  3 Feb 2025 06:16:57 -0500 (EST)
Received: from pastel (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B8E3E120755;
 Mon,  3 Feb 2025 06:16:57 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <87zfj34g2p.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 03 Feb 2025 09:56:14 +0200")
Message-ID: <jwvfrkvp9e0.fsf-monnier+emacs@HIDDEN>
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
 <87zfj34g2p.fsf@HIDDEN>
Date: Mon, 03 Feb 2025 06:16:56 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.002 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Hmm... this doesn't smell right:
>>
>> - I hate distinguishing between "mode-class = special" and "derives from
>>   `special-mode`".
>> - Whether we want to do that depends on `diff-mode-read-only` which is
>>   buffer-local.
>
> AFAICS, the special mode-class is handled only in `read-only-mode`:
>
>    ((and buffer-read-only view-read-only
>          (not view-mode)
>          (not (eq (get major-mode 'mode-class) 'special)))
>     (view-mode-enter))
>
> This is exactly what is needed in diff-mode when it switches to read-only
> it should not enable view-mode.

Maybe, but:

- Nothing in its name or in its doc says so, AFAICT.  IOW, it's just an accident.
- As a symbol property, it's not buffer-local.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 3 Feb 2025 07:58:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 02:58:41 2025
Received: from localhost ([127.0.0.1]:37593 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1terLt-0001Wd-K8
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 02:58:41 -0500
Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:42483)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1terLr-0001Vy-I6
 for 75993 <at> debbugs.gnu.org; Mon, 03 Feb 2025 02:58:40 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 6EE014436B;
 Mon,  3 Feb 2025 07:58:31 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Sun, 02 Feb 2025 18:35:48 -0500")
Organization: LINKOV.NET
References: <87wme9in8w.fsf@HIDDEN>
 <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
Date: Mon, 03 Feb 2025 09:56:14 +0200
Message-ID: <87zfj34g2p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujedtgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepjeehleelfeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> Visiting a diff file and trying to copy lines with 'w' (diff-kill-ring-save)
>> does something unexpected since view-mode overrides 'w' with
>> 'View-scroll-page-backward-set-page-size' for non-nil 'view-read-only'.
>>
>> Here is the fix like for all modes that use single-letter keys:
> [...]
>> +(put 'diff-mode 'mode-class 'special)
>>  ;;;###autoload
>>  (define-derived-mode diff-mode fundamental-mode "Diff"
>>    "Major mode for viewing/editing context diffs.
>
> Hmm... this doesn't smell right:
>
> - I hate distinguishing between "mode-class = special" and "derives from
>   `special-mode`".
> - Whether we want to do that depends on `diff-mode-read-only` which is
>   buffer-local.

AFAICS, the special mode-class is handled only in `read-only-mode`:

   ((and buffer-read-only view-read-only
         (not view-mode)
         (not (eq (get major-mode 'mode-class) 'special)))
    (view-mode-enter))

This is exactly what is needed in diff-mode when it switches to read-only
it should not enable view-mode.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at 75993 <at> debbugs.gnu.org:


Received: (at 75993) by debbugs.gnu.org; 2 Feb 2025 23:35:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 18:35:58 2025
Received: from localhost ([127.0.0.1]:36725 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tejVO-0008KJ-39
	for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 18:35:58 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20197)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tejVL-0008K4-KU
 for 75993 <at> debbugs.gnu.org; Sun, 02 Feb 2025 18:35:56 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 10132100182;
 Sun,  2 Feb 2025 18:35:50 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1738539349;
 bh=U3tDCo2vLNIbArAkropBD7N5iA7JBmZ6O6S6avjpkMM=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=nHxqr6bPRpK0ALGOC0GumJWjcVKAvIsvH8cmk3X/1OVAvhJAOlml1RiuxgaoqrtXa
 I15aZrveogajS1EmHsyhbylc0iikMwGBDTNbP7MNBA4/CUWmQ1LSTc6ECcrxPi/U/l
 3eHz3g0/BSpyGvQIrJqVRyqCbifdbtf4QVjuku7PvuZECax5G5sztweUdtU7F/LIBi
 asKdpr6hI/eF07fEU1I2hjPzpD2qn5gCO6OTmry83eDoanD4oBwJbt+9vD0LfgBqaZ
 nBrxs4kG14hmKcZBU1NYt8WrW1UkLa4kMwIVGRkyLP+YSq/i33prRStnjT4AxW2lRA
 tc+ZScmeFG2pw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1949D100128;
 Sun,  2 Feb 2025 18:35:49 -0500 (EST)
Received: from alfajor (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D1C1112021A;
 Sun,  2 Feb 2025 18:35:48 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#75993: Special mode-class for diff-mode
In-Reply-To: <87wme9in8w.fsf@HIDDEN> (Juri Linkov's message of "Sat, 
 01 Feb 2025 19:33:03 +0200")
Message-ID: <jwvy0ynly8w.fsf-monnier+emacs@HIDDEN>
References: <87wme9in8w.fsf@HIDDEN>
Date: Sun, 02 Feb 2025 18:35:48 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.075 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75993
Cc: 75993 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Visiting a diff file and trying to copy lines with 'w' (diff-kill-ring-save)
> does something unexpected since view-mode overrides 'w' with
> 'View-scroll-page-backward-set-page-size' for non-nil 'view-read-only'.
>
> Here is the fix like for all modes that use single-letter keys:
[...]
> +(put 'diff-mode 'mode-class 'special)
>  ;;;###autoload
>  (define-derived-mode diff-mode fundamental-mode "Diff"
>    "Major mode for viewing/editing context diffs.

Hmm... this doesn't smell right:

- I hate distinguishing between "mode-class = special" and "derives from
  `special-mode`".
- Whether we want to do that depends on `diff-mode-read-only` which is
  buffer-local.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Feb 2025 17:36:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 01 12:36:58 2025
Received: from localhost ([127.0.0.1]:59863 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1teHQQ-0002pr-8U
	for submit <at> debbugs.gnu.org; Sat, 01 Feb 2025 12:36:58 -0500
Received: from lists.gnu.org ([2001:470:142::17]:46872)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1teHQN-0002pa-IY
 for submit <at> debbugs.gnu.org; Sat, 01 Feb 2025 12:36:55 -0500
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 <juri@HIDDEN>) id 1teHQG-0000ay-Km
 for bug-gnu-emacs@HIDDEN; Sat, 01 Feb 2025 12:36:49 -0500
Received: from relay9-d.mail.gandi.net ([217.70.183.199])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1teHQE-0004fi-W9
 for bug-gnu-emacs@HIDDEN; Sat, 01 Feb 2025 12:36:48 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 5C029442A0
 for <bug-gnu-emacs@HIDDEN>; Sat,  1 Feb 2025 17:36:40 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Special mode-class for diff-mode
Organization: LINKOV.NET
X-Debbugs-Cc: Stefan Monnier <monnier@HIDDEN>
Date: Sat, 01 Feb 2025 19:33:03 +0200
Message-ID: <87wme9in8w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: 0
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdefhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucenucfjughrpefhvffuohffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepjefggfdttdfhleetjeekjeeugedvkefgudffgfdthedvtdekteevhefgffejueetnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrgh
X-GND-Sasl: juri@HIDDEN
Received-SPF: pass client-ip=217.70.183.199; envelope-from=juri@HIDDEN;
 helo=relay9-d.mail.gandi.net
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, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Tags: patch

Visiting a diff file and trying to copy lines with 'w' (diff-kill-ring-save)
does something unexpected since view-mode overrides 'w' with
'View-scroll-page-backward-set-page-size' for non-nil 'view-read-only'.

Here is the fix like for all modes that use single-letter keys:

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 77807fc4f35..b88dd4bf736 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1550,6 +1550,7 @@ diff-mode-read-only
 (defvar whitespace-style)
 (defvar whitespace-trailing-regexp)
 
+(put 'diff-mode 'mode-class 'special)
 ;;;###autoload
 (define-derived-mode diff-mode fundamental-mode "Diff"
   "Major mode for viewing/editing context diffs.




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#75993; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 9 Feb 2025 08:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.