From unknown Fri Aug 15 03:37:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#15659 <15659@debbugs.gnu.org> To: bug#15659 <15659@debbugs.gnu.org> Subject: Status: 24.1; (wishlist) Simple method for preserving minor-mode Reply-To: bug#15659 <15659@debbugs.gnu.org> Date: Fri, 15 Aug 2025 10:37:56 +0000 retitle 15659 24.1; (wishlist) Simple method for preserving minor-mode reassign 15659 emacs submitter 15659 yary severity 15659 wishlist tag 15659 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 20:23:11 2013 Received: (at submit) by debbugs.gnu.org; 20 Oct 2013 00:23:11 +0000 Received: from localhost ([127.0.0.1]:58383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXgnW-0005je-5p for submit@debbugs.gnu.org; Sat, 19 Oct 2013 20:23:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49034) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXgnQ-0005iz-SD for submit@debbugs.gnu.org; Sat, 19 Oct 2013 20:23:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXgnK-00010C-5c for submit@debbugs.gnu.org; Sat, 19 Oct 2013 20:22:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXgnK-000106-1V for submit@debbugs.gnu.org; Sat, 19 Oct 2013 20:22:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXgnI-0005Ac-IL for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2013 20:22:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXgnG-0000zd-J0 for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2013 20:22:56 -0400 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]:41278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXgnG-0000zY-Bw for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2013 20:22:54 -0400 Received: by mail-wg0-f46.google.com with SMTP id m15so5089316wgh.1 for ; Sat, 19 Oct 2013 17:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=h3A75cXs7UKnmeJFyQbM4kr7bqV0uAIyMIPBVB1Z2Bk=; b=VjtjDFE+6jWN8JHAQKGl+wA3Ejc/WseU+efHz36R029p4cdyFPzlpw9WGMTcFsv983 u9xCs7YUVWw6ZA8SWl/bulEkzLvjAbjWFH/VC24u/PurLWFTwQhNwoaPj/pKrzoVBgWq bxNCe7v5PC+iJGHQH8sbhcTxu7OTjtEoJl/RHNQExpfHx/sGUSGFSp5+X3dWMtBfrPM/ 3gkNwC5PIU2m3FAJk6ewE5ZZSeKOfYsvy6tRR9Ippa9HqkuqXXnV64RWgMTWv7m+zzUu 3PsafJlGtUbfGsVbtGXerygJjFVWAqbrwTb0zqiocfdGToWePYXX2fM3KtJP52B8fFMw njbw== X-Received: by 10.194.222.2 with SMTP id qi2mr8128290wjc.14.1382228573470; Sat, 19 Oct 2013 17:22:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.83.72 with HTTP; Sat, 19 Oct 2013 17:22:33 -0700 (PDT) From: yary Date: Sat, 19 Oct 2013 20:22:33 -0400 Message-ID: Subject: 24.1; (wishlist) Simple method for preserving minor-mode To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) There are times when I wish to set a minor-mode permanently for a buffer, even through major-mode changes. They are display-related minor-modes, such as buffer-face-mode or text-scale-mode. Ideally I'd like a simple way to preserve a minor-mode between major-mode changes. I started discussing this in Bug #15577, which is about dir-locals, but am moving it here as this is a separate issue. Also bug #15396 "permanent-local truncate-lines" is related, Stefan sets a display-related local variable and would like it preserved across mode changes (or in this case, revert-buffer). Yet setting `permanent-local' on the `truncate-lines' variable does not protect it: `toggle-truncate-lines' behaves like a minor mode. A function could take a minor-mode to preserve, and then either set up hooks needed to re-enable it after a major-mode change, or prevent `kill-all-local-variables' from disabling it in the first place. Or perhaps marking the minor-mode's function-symbol itself as `permanent-local' could protect it, along with all its buffer-locals. I have a personal workaround which works for modes I use posted at http://stackoverflow.com/a/19439236/379333 - though it isn't fully generalized and has other flaws. It checks if specified minor-modes are active during `change-major-mode-hook', and if so, then tries to figure out which variables they use, and then restores those variables and minor modes in the `after-change-major-mode-hook' Answering a question from bug #15577 about this issue: >> a. Get all of that mode's customizable buffer-locals. > >Not sure what that is. The modes I wanted to preserve have buffer-locals for the face, and for the size adjustment. It's not enough to just re-enable the modes, we have to know which buffer-locals the mode reads. >> Ideally the minor-mode, or emacs core, would provide a function for >> that purpose. > >It's probably not possible (not reliably at least) with the way minor >modes are defined currently. Tho depending on what you mean it might be >a non-issue. What I meant was, since any proposed minor-mode-preserving mechanism needs to know what buffer-local variables also would need to be set `permanent-local', then "Ideally the minor-mode, or emacs core, would provide a function" listing those variables. So for example, the `define-minor-mode' macro might get a `:local-variables' keyword allowing the author to declare that mode's buffer-locals, along with their documentation and defaults. Would not be required in general, but would make it easier for anything that wants to manipulate minor modes. >> b. Mark those variables as permanent-local > >There's no such thing, currently (we instead have to use a hack with >change-major-mode-hook, along the lines of what you did). Must be a mis-communication here. The docs to `kill-all-local-variables' say: As a special exception, local variables whose names have a non-nil `permanent-local' property are not eliminated by this function. I just tried (put 'foo 'permanent-local 't) and `foo' survived `kill-all-local-variables' and several mode changes. So we do have the `permanent-local' property for keeping local variables around. >But there are some issues: >- we have to find out which buffer-local minor-modes are enabled, which > presumes we have some kind of list of minor-modes. We can probably > use minor-mode-list for that, tho. Searching minor-mode-list would work, as would checking that the symbol "name-of-minor-mide' is buffer-local and has a non-nil value. >- some minor modes are mode-specific; e.g. it doesn't make much sense to > preserve reftex-mode when switching from latex-mode to haskell-mode. This sounds like another mis-communication- proposal is to let a user (or by extension a minor-mode-author) to easily mark a minor-mode as "to-be-preserved." As another example, I do not want flymake still on when switching into css-mode. It's not up to this method to decide which minor-modes to preserve; it is up to the user. -y From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 21:33:23 2013 Received: (at 15659) by debbugs.gnu.org; 20 Oct 2013 01:33:24 +0000 Received: from localhost ([127.0.0.1]:58415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXhtT-0007YE-8d for submit@debbugs.gnu.org; Sat, 19 Oct 2013 21:33:23 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:23551) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXhtR-0007Xw-3y for 15659@debbugs.gnu.org; Sat, 19 Oct 2013 21:33:21 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxLCX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFxLCX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35895303" Received: from 69-196-176-151.dsl.teksavvy.com (HELO pastel.home) ([69.196.176.151]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 19 Oct 2013 21:33:15 -0400 Received: by pastel.home (Postfix, from userid 20848) id CBBA960475; Sat, 19 Oct 2013 21:33:14 -0400 (EDT) From: Stefan Monnier To: yary Subject: Re: bug#15659: 24.1; (wishlist) Simple method for preserving minor-mode Message-ID: References: Date: Sat, 19 Oct 2013 21:33:14 -0400 In-Reply-To: (yary's message of "Sat, 19 Oct 2013 20:22:33 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15659 Cc: 15659@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > There are times when I wish to set a minor-mode permanently for a > buffer, even through major-mode changes. They are display-related > minor-modes, such as buffer-face-mode or text-scale-mode. Indeed, those two should probably be make "permanent local". Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 20 09:27:15 2013 Received: (at 15659) by debbugs.gnu.org; 20 Oct 2013 13:27:15 +0000 Received: from localhost ([127.0.0.1]:58826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXt2I-0001TT-4l for submit@debbugs.gnu.org; Sun, 20 Oct 2013 09:27:14 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:58255) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXt2D-0001TB-S3 for 15659@debbugs.gnu.org; Sun, 20 Oct 2013 09:27:11 -0400 Received: by mail-wg0-f45.google.com with SMTP id z12so5456629wgg.0 for <15659@debbugs.gnu.org>; Sun, 20 Oct 2013 06:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SDpa5C74oEeIvJaLeBNKzEAOnj9jqhnZxzem0Rd9Lak=; b=Z8sHFCL0Ecamjjk4gggJZ0yg6alTg2upERPKp3BBULKtrpsAV9dMomcv4T8Uar8Yub hee0vu8Pcya14SDd0Hm/QGf2TTS61Niyt041egek4Yah77YAt1VfDMeZ874ZCddI7DII uRez0iBnooO7PcZFLwoJlvvg15lt+8Bxb59kcY61HVRtaMdrMkhZXUCeMymGUB9fhO8b VNy16oheKVUP2LRGZsOywOiWCQQdH4/ZEkLuDbdyzepyykt8naEk/weYxspn8wKet+Ma Bp2Sj1Gr6RAZp75HKmpEuJm3zkdu+FkMBmyRaq7O2CRnq4WSztk9maOjwH1kiO4agwcK fcng== X-Received: by 10.194.201.225 with SMTP id kd1mr1342591wjc.35.1382275624082; Sun, 20 Oct 2013 06:27:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.83.72 with HTTP; Sun, 20 Oct 2013 06:26:44 -0700 (PDT) In-Reply-To: References: From: yary Date: Sun, 20 Oct 2013 09:26:44 -0400 Message-ID: Subject: Re: bug#15659: 24.1; (wishlist) Simple method for preserving minor-mode To: Stefan Monnier Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15659 Cc: 15659@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Sat, Oct 19, 2013 at 9:33 PM, Stefan Monnier wrote: >> There are times when I wish to set a minor-mode permanently for a >> buffer, even through major-mode changes. They are display-related >> minor-modes, such as buffer-face-mode or text-scale-mode. > > Indeed, those two should probably be make "permanent local". That's a better solution than prompting people to make permanent those minor-modes themselves, via some new generic method for preserving any minor mode. I can still see a reason to have something like a `:local-variables' keyword for any mode definition, minor or major- to help `desktop save/recover' properly handle the buffer state. Doubtless there would be yet more uses I haven't thought of. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 30 06:54:15 2013 Received: (at control) by debbugs.gnu.org; 30 Oct 2013 10:54:15 +0000 Received: from localhost ([127.0.0.1]:52235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbTPh-0003OP-5S for submit@debbugs.gnu.org; Wed, 30 Oct 2013 06:54:14 -0400 Received: from mail1.vodafone.ie ([213.233.128.43]:52327) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbTPZ-0003NX-VG; Wed, 30 Oct 2013 06:54:09 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4BAC7kcFJda9/8/2dsb2JhbAANTIZXT7w6gTqDGQEBAQQMFw8BRhAJAg0LAgIFFgsCAgkDAgECAToLEwEFAgEBiAiMK5podpJUgSmOJgcWglSBQgOebo0NgT4 Received: from unknown (HELO [192.168.1.79]) ([93.107.223.252]) by mail1.vodafone.ie with ESMTP; 30 Oct 2013 10:53:58 +0000 Message-ID: <5270E546.6090801@draigBrady.com> Date: Wed, 30 Oct 2013 10:53:58 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: jidanni@jidanni.org Subject: Re: bug#15650: "cp: warning: source file =?UTF-8?B?4oCYZuKAmSBzcA==?= =?UTF-8?B?ZWNpZmllZCBtb3JlIHRoYW4gb25jZSIgc2FpZCBtb3JlIHRoYW4gb25jZSB0b28=?= =?UTF-8?B?IQ==?= References: <87ppr1imfs.fsf@jidanni.org> In-Reply-To: <87ppr1imfs.fsf@jidanni.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: 15650-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tag 15659 wontfix stop On 10/19/2013 11:28 AM, jidanni@jidanni.org wrote: > $ touch f > $ mkdir w > $ cp f f f w > cp: warning: source file ‘f’ specified more than once > cp: warning: source file ‘f’ specified more than once > > Hey, you yourself say that more than once itself! > > So either say > cp: warning: source file ‘f’ specified more than once > just once, or say > cp: warning: source file ‘f’ specified again > n-1 times. So we record this about each arg: struct F_triple { char *name; ino_t st_ino; dev_t st_dev; }; I suppose we could add a 'count' member, and a corresponding seen_file_count() function. Though I don't think the complication/clarification is warranted in this case. thanks, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 08 15:29:24 2013 Received: (at 15659) by debbugs.gnu.org; 8 Nov 2013 20:29:25 +0000 Received: from localhost ([127.0.0.1]:42316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VesgG-0006Rj-G4 for submit@debbugs.gnu.org; Fri, 08 Nov 2013 15:29:24 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:54818) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VesgE-0006Rb-9f for 15659@debbugs.gnu.org; Fri, 08 Nov 2013 15:29:22 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id rA8KTLlb015100; Fri, 8 Nov 2013 15:29:21 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 08DEFB4327; Fri, 8 Nov 2013 15:29:20 -0500 (EST) From: Stefan Monnier To: yary Subject: Re: bug#15659: 24.1; (wishlist) Simple method for preserving minor-mode Message-ID: References: Date: Fri, 08 Nov 2013 15:29:20 -0500 In-Reply-To: (yary's message of "Sat, 19 Oct 2013 20:22:33 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4756=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4756> : inlines <209> : streams <1070306> : uri <1589554> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 15659 Cc: 15659@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > A function could take a minor-mode to preserve, and then either set up > hooks needed to re-enable it after a major-mode change, or prevent > `kill-all-local-variables' from disabling it in the first place. Or > perhaps marking the minor-mode's function-symbol itself as > `permanent-local' could protect it, along with all its buffer-locals. We could start with something like the following (guaranteed 100% untested): (put 'after-change-major-mode-hook 'permanent-local-hook t) (defvar permanent-local--modes nil) (defun permanent-local--reenable () (mapc #'funcall permanent-local--modes)) (put 'permanent-local--reenable 'permanent-local-hook t) (defun permanent-local-mode (mode) "Enable MODE permanently in this buffer." (interactive (list (intern (completing-read "Minor mode: " obarray (lambda (sym) (or (memq mode minor-mode-list) (string-match "-mode\\'" (symbol-name sym)))) t)))) (funcall mode) ;Enable. (add-hook 'after-change-major-mode-hook #'permanent-local--reenable nil t)) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 01 02:12:59 2014 Received: (at control) by debbugs.gnu.org; 1 Feb 2014 07:12:59 +0000 Received: from localhost ([127.0.0.1]:43645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W9Ul8-0000gg-Py for submit@debbugs.gnu.org; Sat, 01 Feb 2014 02:12:59 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:39464) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W9Ul6-0000gV-9S for control@debbugs.gnu.org; Sat, 01 Feb 2014 02:12:56 -0500 Received: from [204.14.154.233] (helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1W9Uks-0001kS-DK for control@debbugs.gnu.org; Sat, 01 Feb 2014 08:12:42 +0100 Date: Fri, 31 Jan 2014 23:11:50 -0800 Message-Id: <87fvo3qpc9.fsf@building.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #15659 X-MailScanner-ID: 1W9Uks-0001kS-DK X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1391843563.2063@N6N+9m3R3tZRSH+J7cYmCQ X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 15659 - wontfix From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 03 22:37:26 2021 Received: (at 15659) by debbugs.gnu.org; 4 Dec 2021 03:37:26 +0000 Received: from localhost ([127.0.0.1]:52628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtLra-0004uA-0W for submit@debbugs.gnu.org; Fri, 03 Dec 2021 22:37:26 -0500 Received: from quimby.gnus.org ([95.216.78.240]:59734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtLrY-0004tu-Dk for 15659@debbugs.gnu.org; Fri, 03 Dec 2021 22:37:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dQknuNZxdK3GbcwfRv23/EnfbXoCjUHZymiiZN88kCY=; b=XI7OAD4fT1836oxtGaSsAuN/x+ hGP611hVq4145fSqrFpIi2Stpv0uUZ/eXai+mngANHpp3Llkm2mO4oiFTP1Sx5uBCQuIBxL7a1A4m ppeIrMYb2Ek+7VgRT1diIW0jucw7UDfCc+gXFr3kpcmjS43J02KEuDs9iqS1rg1QvdwI=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mtLrO-0001vq-0a; Sat, 04 Dec 2021 04:37:16 +0100 From: Lars Ingebrigtsen To: Stefan Monnier Subject: Re: bug#15659: 24.1; (wishlist) Simple method for preserving minor-mode References: X-Now-Playing: Janis Joplin's _Pearl_: "Cry Baby" Date: Sat, 04 Dec 2021 04:37:13 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 08 Nov 2013 15:29:20 -0500") Message-ID: <87y251qbva.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Monnier writes: >> A function could take a minor-mode to preserve, and then either set up >> hooks needed to re-enable it after a major-mode change, or prevent >> `kill-all-local-variables' from disabling it in the f [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 15659 Cc: yary , 15659@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Monnier writes: >> A function could take a minor-mode to preserve, and then either set up >> hooks needed to re-enable it after a major-mode change, or prevent >> `kill-all-local-variables' from disabling it in the first place. Or >> perhaps marking the minor-mode's function-symbol itself as >> `permanent-local' could protect it, along with all its buffer-locals. (I'm going through old bug reports that unfortunately weren't resolved at the time.) > We could start with something like the following (guaranteed 100% untested): > > (put 'after-change-major-mode-hook 'permanent-local-hook t) > > (defvar permanent-local--modes nil) > > (defun permanent-local--reenable () > (mapc #'funcall permanent-local--modes)) > (put 'permanent-local--reenable 'permanent-local-hook t) > > (defun permanent-local-mode (mode) > "Enable MODE permanently in this buffer." > (interactive > (list > (intern > (completing-read "Minor mode: " > obarray > (lambda (sym) > (or (memq mode minor-mode-list) > (string-match "-mode\\'" (symbol-name sym)))) > t)))) > (funcall mode) ;Enable. > (add-hook 'after-change-major-mode-hook #'permanent-local--reenable nil t)) I think this could work... but I don't really see it being used a lot. Changing a major mode is a relatively rare thing to do, and I don't see people using `permanent-local-mode' first -- because it'd be more work than just re-enabling the minor modes. And if you are in the habit of changing modes a lot (for instance, between two modes like cperl-mode and perl-mode), then I think you'd be more likely to want to put the minor modes into the major mode hooks. So, while it would be possible to add something like this, I just don't see the use case, so I don't think we should add this, and I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 03 22:37:29 2021 Received: (at control) by debbugs.gnu.org; 4 Dec 2021 03:37:29 +0000 Received: from localhost ([127.0.0.1]:52631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtLrd-0004uQ-9G for submit@debbugs.gnu.org; Fri, 03 Dec 2021 22:37:29 -0500 Received: from quimby.gnus.org ([95.216.78.240]:59750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtLrb-0004tz-Sn for control@debbugs.gnu.org; Fri, 03 Dec 2021 22:37:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0jmNOV1uxRI7Z5l+lexNPwaGBJa8fXDIiBn5C+NrlKg=; b=vWFYhmG0hxgnr3yeRIq79gda2t ci185vc5FyQOL4lcgj5JDb2IEJcnwrC5tBY76hvm8ADWF99RK9anbJUkHMQ14lsH+cBDOJYdo+PTj P+dMr5BM1ojv82Mwz6d/DHn28mgcXPKU1/yuBhVn0djzk3JkP4HA2TByhG9qEH+DUcqY=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mtLrU-0001vy-6p for control@debbugs.gnu.org; Sat, 04 Dec 2021 04:37:22 +0100 Date: Sat, 04 Dec 2021 04:37:19 +0100 Message-Id: <87wnklqbv4.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #15659 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 15659 wontfix close 15659 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 15659 wontfix close 15659 quit From unknown Fri Aug 15 03:37:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 01 Jan 2022 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator