From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 11:56:21 2025 Received: (at submit) by debbugs.gnu.org; 2 Sep 2025 15:56:21 +0000 Received: from localhost ([127.0.0.1]:36070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utTMq-00075I-Or for submit@debbugs.gnu.org; Tue, 02 Sep 2025 11:56:21 -0400 Received: from lists.gnu.org ([2001:470:142::17]:39922) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utTMm-000750-1j for submit@debbugs.gnu.org; Tue, 02 Sep 2025 11:56:16 -0400 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 1utTMc-0000Yj-RC for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 11:56:09 -0400 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1utTMY-0000uV-57 for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 11:56:06 -0400 Received: by mail-yb1-xb42.google.com with SMTP id 3f1490d57ef6-e931c71a1baso7898232276.0 for ; Tue, 02 Sep 2025 08:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756828558; x=1757433358; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=JZka8xkzakwKi3ab+j6zVNWle4SzamO31N97sqMe3wA=; b=kXlpUvRKsCxj8px1K5s5ARvKiEE4I21H09hyqQES5jPC1qUHHxGv6/TJ2MqzrIFlyJ 8STqLhy/dSFpQpwZkf57NFFI2Mt1dWrBLRX1F3TQlEAWD7aJeXJ5s5OdWG9j89afnflc 1TUV53BtORi5jbJjXMpjD3mlZc7KfwTijcJgQgJclq6qEsBHa8K3H6K6T5hhLp/STWRo hMPwU1898nhl/IoB+rbDWvcFpJQIz73GiUyzBofKistmfkRzYr2PqqwlFsZc3DMdoG17 9ijTIMEkMz8hjanSnNe+ihY9c/stpe+iKB460tnsUXSsSXvGDEL9W8BdBJRaiqG3WK/e Hq3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756828558; x=1757433358; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JZka8xkzakwKi3ab+j6zVNWle4SzamO31N97sqMe3wA=; b=KMmCjycp6ftCyktg6fJq63rGop5lyLEIuOE561C5Pe6Ag6pacxsA+r3XOJFpbczduE YksLiSQyEw3U4haqjj9PIRvLmG/IQ049nkzoAI2i7hRsU05J3zlUmxsE+V7T0HZcWSi6 835o5ExNBkm9X6eYsrcKmV93OpoKt2gauKFeHHXqoHuy8sfJPFcCrucW3jb8RU+IuBzD 3OsIZ4viiTCFwNO4PMJDbkeSnE7Bv3omuFzItEmlX1otPIc4Y2uw6NspGMePO8Y8Nicd /pf8bxrirTi6toMJra1AykiQMOBxuJvdqkGAu48ef4qU+KtQtDF6IJ3TwMdyeTgaqekU HsRw== X-Gm-Message-State: AOJu0YwaW4lHamgV//hPpkOS+rgQRE89u2dnFzsq5ZS923TQzMy9Sdj8 TvTCCT9S4ef6sfAc3KPVIz6IC2LiHA3Ydezh2nmHdt7FGKkiXPK2L0OQoeHiiIGb X-Gm-Gg: ASbGncvdttQMWDMNXor+002HZyVn7i1gghjz00g+lqi7JozKCtc9JvIhnWt5/vLaRkH hjrHU1Ia5Q0qxJaPErl02LC3VuJXwuHjtB4MoaPPUM0CfFkLmD6PTHZ3/VkDlU3Wl7wv6Ev4cRg CPWiRfmXBxWPkmsfpFtKOeHJLjgLaiug1F/b/njSboiyTYOVDZfu9uyf818zoDOjLMrx449RWKB xy6dmVKu1sWAXhXH7zmmcPxs+FmbM4G/wdbVyT4U6ttDjCb7NEY8NjVqJEOdhjUSE9v2TlhOmfe n+nwwfowOi2LgaP8zH2y5ZHdhcjPgdpPrYCyZbx1x+iW8p/u23FTaYJOA62rnExrP4IjQ9m9L+2 qkTZyjBIOT7+cN4hqzUffsrBbgR0= X-Google-Smtp-Source: AGHT+IGZZOZBCqsGnGtPit8t6XTh06WMgONq4IoD9egmelGJcukS0nUf8nbYhIO+sXkHd1S84S26JQ== X-Received: by 2002:a05:690c:4d84:b0:71b:f83a:afa0 with SMTP id 00721157ae682-7227640e8a2mr149789687b3.22.1756828557821; Tue, 02 Sep 2025 08:55:57 -0700 (PDT) Received: from fedora ([189.215.164.177]) by smtp.gmail.com with ESMTPSA id 00721157ae682-723a83793besm5987367b3.31.2025.09.02.08.55.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 08:55:57 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: bug-gnu-emacs@gnu.org Subject: [PATCH] Make yank-in-context also can indent the yanked text. X-Debbugs-Cc: Date: Tue, 02 Sep 2025 09:55:55 -0600 Message-ID: <87plc8df1w.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::b42; envelope-from=eg642616@gmail.com; helo=mail-yb1-xb42.google.com X-Spam_score_int: 15 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 4.8 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Tags: patch This patch makes `yank-in-context` can optionally indent the yanked text. The indentation is done calling `indent-region`, but the function to use can be changed. Content analysis details: (4.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) X-Debbugs-Envelope-To: submit 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.8 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Tags: patch This patch makes `yank-in-context` can optionally indent the yanked text. The indentation is done calling `indent-region`, but the function to use can be changed. Content analysis details: (3.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain Tags: patch This patch makes `yank-in-context` can optionally indent the yanked text. The indentation is done calling `indent-region`, but the function to use can be changed. Additionally, i added support for `delete-selection-mode` in `yank-in-context`. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-yank-in-context-can-also-indent-the-yanked-text.patch >From 83c37fb609b40a6cc5cd657b224cfd1db5c14db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= Date: Mon, 1 Sep 2025 13:31:49 -0600 Subject: [PATCH] Make yank-in-context can also indent the yanked text. (Bug#) * etc/NEWS: Announce changes. * lisp/delsel.el: Add missing 'yank-in-context'. * lisp/simple.el (yank-in-context-indent) (yank-in-context-indent-function): New user options. (yank-in-context): Rework. --- etc/NEWS | 13 +++++++++++++ lisp/delsel.el | 1 + lisp/simple.el | 28 ++++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 630d03a1fa0..9aa5436c322 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2371,6 +2371,19 @@ connected, to facilitate enabling 'strokes-mode' in sessions where the availability of a mouse device varies during execution (as is frequently observed on Android). +** Yank + +--- +*** New user option 'yank-in-context-indent'. +If this option is non-nil, 'yank-in-context' will indent yanked text, +according to current major mode indentation. By default this is +disabled. + +--- +*** New user option 'yank-in-context-indent-function'. +This option specifies the function to use for indent the yanked text in +'yank-in-context'. By default this is set to 'indent-region'. + ** Yank Media +++ diff --git a/lisp/delsel.el b/lisp/delsel.el index f5badf62c2c..a94b0f58a36 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el @@ -317,6 +317,7 @@ delete-selection-uses-region-p (put 'yank 'delete-selection 'yank) (put 'yank-pop 'delete-selection 'yank) (put 'yank-from-kill-ring 'delete-selection 'yank) +(put 'yank-in-context 'delete-selection 'yank) (put 'clipboard-yank 'delete-selection 'yank) (put 'insert-register 'delete-selection t) ;; delete-backward-char and delete-forward-char already delete the selection by diff --git a/lisp/simple.el b/lisp/simple.el index 2a13d59e5cd..5d194908e37 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6416,6 +6416,24 @@ rotate-yank-pointer (interactive "p") (current-kill arg)) +(declare-function indent-region "indent" (start end &optional column)) + +(defcustom yank-in-context-indent nil + "If non-nil, `yank-in-context' will indent yanked text. +The indentation is done calling the function in +`yank-in-context-indent-function' (which see)." + :type 'boolean + :group 'killing + :version "31.1") + +(defcustom yank-in-context-indent-function #'indent-region + "Function to call to indent the yanked region in `yank-in-context'. +The function is called with 2 arguments, which are the yanked region +positions." + :type 'function + :group 'killing + :version "31.1") + (defun yank-in-context (&optional arg) "Insert the last stretch of killed text while preserving syntax. In particular, if point is inside a string, any quote characters @@ -6425,6 +6443,8 @@ yank-in-context If point is inside a comment, ensure that the inserted text is also marked as a comment. +If `yank-indent' is non-nil, yanked text will be indented. + This command otherwise behaves as `yank'. See that command for explanation of ARG. @@ -6432,8 +6452,12 @@ yank-in-context variable to determine how strings should be escaped." (interactive "*P") (let ((yank-transform-functions (cons #'yank-in-context--transform - yank-transform-functions))) - (yank arg))) + yank-transform-functions)) + (beg (point)) end) + (yank arg) + (setq end (point)) + (if yank-in-context-indent + (funcall yank-in-context-indent-function beg end)))) (defun yank-in-context--transform (string) (let ((ppss (syntax-ppss))) -- 2.51.0 --=-=-= Content-Type: text/plain -- - E.G via Gnus and Org. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 12:23:03 2025 Received: (at 79371) by debbugs.gnu.org; 2 Sep 2025 16:23:03 +0000 Received: from localhost ([127.0.0.1]:36223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utTmg-00006I-L3 for submit@debbugs.gnu.org; Tue, 02 Sep 2025 12:23:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33108) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utTme-00005m-Ln for 79371@debbugs.gnu.org; Tue, 02 Sep 2025 12:23:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1utTmY-0005py-M3; Tue, 02 Sep 2025 12:22:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=BX5sgfUSvhnTNUj748FtV2imYcOEz4FG3f7z+oFoBkw=; b=LT9zv4YL+8UT4SVvTr1t yLHzvUkBDpvwyygkAggbQYPs/yIdfzaqUeI0DXwYNqycxwpUUVMz6OpIWO8lkhAJ/iSWVomJxfg9q Cn2vTn7L1Ml2hzz+nwM9epKL6u2CD4uhcz2er6/4jZCLQVWBBrlvE2kV0oH4IUDlFkQ7dUgXcHQdz ppAk5gk9+wDQbRGJvOTzCFCcFds4MObaML1rqMfkfstBIeoUhi9Bw5tTle+kTScr3o77IQoAucwxg pzx8zfzPXwCGKEzL34W6feac5OZ/n3A5MYDBl0Ec7GM5MDCByDJDhwwPKV208Tl5pRsRPyapdUKUy sMVDAu7/4RG5Fw==; Date: Tue, 02 Sep 2025 19:22:52 +0300 Message-Id: <86iki0lt7n.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= , Stefan Monnier In-Reply-To: <87plc8df1w.fsf@gmail.com> (message from Elijah Gabe =?iso-8859-1?Q?P=E9rez?= on Tue, 02 Sep 2025 09:55:55 -0600) Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. References: <87plc8df1w.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79371 Cc: 79371@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 (---) > From: Elijah Gabe Pérez > Date: Tue, 02 Sep 2025 09:55:55 -0600 > > This patch makes `yank-in-context` can optionally indent the yanked > text. > > The indentation is done calling `indent-region`, but the function to use > can be changed. Thanks, but I wonder whether this indeed justifies yet another user option, given that indenting the yanked text, if that is desired, can be obtained by typing C-M-\ immediately after yanking. What do others think about this? > Additionally, i added support for `delete-selection-mode` in > `yank-in-context`. This should be a separate change, because I believe it is correct to do that by default regardless of anything else. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 12:55:38 2025 Received: (at 79371) by debbugs.gnu.org; 2 Sep 2025 16:55:38 +0000 Received: from localhost ([127.0.0.1]:36366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utUID-0001sX-TH for submit@debbugs.gnu.org; Tue, 02 Sep 2025 12:55:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62976) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utUIB-0001sK-Ca for 79371@debbugs.gnu.org; Tue, 02 Sep 2025 12:55:36 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 887EF1002F0; Tue, 2 Sep 2025 12:55:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1756832128; bh=ReqrgKaNUXXfELpI3Ni7rd044sEIriKzvxfBTTUpoT0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=j4bTpQprIKw0O2JTwO22iE7BVj2rrB80coFq6G2txzyPa5sqaL6W0UizUTuQ4XTA+ 2vpLBeO61Hzd+G4wyJjEVP7vBsPmWaF6QeLb4s9MPIPN+8QrJfzSaa3j0JXkpDgXqC IQ0czP267ZIBTDQGN8HlIXqkwzSYdj0Z9nBZZIorlpdwJSQjXwvlVvx1gIJKaHEp9l irJ8UXx7ZFOSQkvUS7hnkD7vQeeDRI5X/sQH0y9fd+xpeJeHuhxEv0z/4XTr4TIjq/ ang05Hwp16aRfOPQuKsHD8isjW6N64JAf9lZmyKyIoJg09rpboCFkVzIHe6U6EqM0U PoZCKmXtaJgsQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B405C10013E; Tue, 2 Sep 2025 12:55:28 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9CCCC1205F8; Tue, 2 Sep 2025 12:55:28 -0400 (EDT) From: Stefan Monnier To: Elijah Gabe =?windows-1252?Q?P=E9rez?= Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: <87plc8df1w.fsf@gmail.com> Message-ID: References: <87plc8df1w.fsf@gmail.com> Date: Tue, 02 Sep 2025 12:55:23 -0400 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.122 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: 79371 Cc: 79371@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 (---) > This patch makes `yank-in-context` can optionally indent the yanked text. [...] > @@ -6432,8 +6452,12 @@ yank-in-context > variable to determine how strings should be escaped." > (interactive "*P") > (let ((yank-transform-functions (cons #'yank-in-context--transform > - yank-transform-functions))) > - (yank arg))) > + yank-transform-functions)) > + (beg (point)) end) > + (yank arg) > + (setq end (point)) > + (if yank-in-context-indent > + (funcall yank-in-context-indent-function beg end)))) Hmm... what's the intended use case? `yank-in-context` differs from `yank` only inside strings and comments, but in most major modes `indent-region` doesn't know how to indent inside strings and comments because we don't know if it holds plain text or code or whatnot. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 13:00:43 2025 Received: (at 79371) by debbugs.gnu.org; 2 Sep 2025 17:00:43 +0000 Received: from localhost ([127.0.0.1]:36387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utUN9-00028A-87 for submit@debbugs.gnu.org; Tue, 02 Sep 2025 13:00:43 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:38886) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utUN6-00027w-7g for 79371@debbugs.gnu.org; Tue, 02 Sep 2025 13:00:41 -0400 DKIM-Signature: a=rsa-sha256; b=ZF5PE3TUA2+BgSegY7+TJfq6+xxCLypj/Ummiq/pOhkz/H5qSWpE70jE1QK10c3vDiBOMqtEZWZePflgTx1QB+3pmZXcfAeUBYzcjWogL1xnK4DlO2lcVF5wMKgSpmwLDPHaIZs99w+TPhELkZfvzKUj7bsZ4Q77gsFD/J1Cf5DtB0EFqgSqdHOyBbENnyeyItlfytd+tBxO7rEhEytn+SprX4Ft2mQ/IDKJPfyc3sv1qEk1IfemKcavErbgw15SvqYHXoxwxnihzmRPUd+2/o5eceIZGxsdmWc0aUmAch1qliopiQ85mpX+ugrEaiTjbwSVkAIeWK0Ru9gntJ4/dw==; s=purelymail1; d=spwhitton.name; v=1; bh=dm9+wHUgI8LMGkaYFIde/1N1jcz/VDib2OeR9EsrhGA=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=NYoN7HsfuuC4tFUTpmNT6j0dVQESUQjh6dGpBUoquV9PfPX0A2eSNR1qIufsygtPYSnG7D3vLRn/AxrynOb1OvC0Ezil7yD9kbRPVX0YWMXepFN2eWTieBAhzW/8CtdpUqHrHZfjREFZRb46V1vn8aocl9toQBSBH6mz6xgyHn9RLizhw+adZmKHTEPN8gcyY3LXq0iY8bOTLV0ZLcfC15sSch3hOH1JMvxb5To/+tR+lT6lSgREyea4L3kfNflCYqMxmaeFMSUC8pl/W0t8zhUMGSqlu+j23AIU5rjT52EcCvFHnI85cA1EQ4Y80+r7ZuMFLR8WEzUB1ZgcxuUAuw==; s=purelymail1; d=purelymail.com; v=1; bh=dm9+wHUgI8LMGkaYFIde/1N1jcz/VDib2OeR9EsrhGA=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 79371@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 2046008883; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 02 Sep 2025 17:00:33 +0000 (UTC) Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 9AF849405FC; Tue, 02 Sep 2025 18:00:32 +0100 (BST) From: Sean Whitton To: Eli Zaretskii Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: <86iki0lt7n.fsf@gnu.org> References: <87plc8df1w.fsf@gmail.com> <86iki0lt7n.fsf@gnu.org> Date: Tue, 02 Sep 2025 18:00:32 +0100 Message-ID: <87cy88eqmn.fsf@zephyr.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79371 Cc: 79371@debbugs.gnu.org, Elijah Gabe =?utf-8?Q?P=C3=A9rez?= , Stefan Monnier 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: -1.0 (-) Hello, On Tue 02 Sep 2025 at 07:22pm +03, Eli Zaretskii wrote: >> From: Elijah Gabe P=C3=A9rez >> Date: Tue, 02 Sep 2025 09:55:55 -0600 >> >> This patch makes `yank-in-context` can optionally indent the yanked >> text. >> >> The indentation is done calling `indent-region`, but the function to use >> can be changed. > > Thanks, but I wonder whether this indeed justifies yet another user > option, given that indenting the yanked text, if that is desired, can > be obtained by typing C-M-\ immediately after yanking. > > What do others think about this? Sometimes you want indentation and sometimes you don't, so requiring the user to type C-M-\ seems preferable to me, too. --=20 Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 14:14:24 2025 Received: (at submit) by debbugs.gnu.org; 2 Sep 2025 18:14:24 +0000 Received: from localhost ([127.0.0.1]:36562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utVWS-0005bp-6m for submit@debbugs.gnu.org; Tue, 02 Sep 2025 14:14:24 -0400 Received: from lists.gnu.org ([2001:470:142::17]:54726) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utVWP-0005bS-TC for submit@debbugs.gnu.org; Tue, 02 Sep 2025 14:14:22 -0400 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 1utVWH-0007CA-UY for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 14:14:14 -0400 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1utVWF-0006uG-J9 for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 14:14:13 -0400 Received: by mail-yb1-xb42.google.com with SMTP id 3f1490d57ef6-e931c858dbbso4704737276.0 for ; Tue, 02 Sep 2025 11:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756836849; x=1757441649; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=y53FBBwQ6igC7aqv2L+EO02CVuj3ke4MkcTKcE+NrVc=; b=YFZgh3GaKZTqTsJDIocX4nRAAcwUMA1pJeuy5Iw8GwXx0vYKk/Vp5Mqf7G+JKoY9mP Kl0wXgHODMjz9hdP0lajz4uCcQvhGNAZAkAH9AtsbX9QYntURW7P1QeFTddj5Qrj9ltY 43wS2pX/jh2Dw3RleJQm+AaogEm4FjvQH4AmuV0fEzKc9Nc+ExSFGzIQiGUPKRSzBjhj MSb8EQ/tiF98xZsppNRM7S62g1MpeIuKLPnlwQzDG9eGEQnR8GZh5issUEkFA1ZFkyQ1 Jc6izj5Yjz0vtf3fQcxi6eKAqDY9pHVNT0K8V/KhdMgUfVr6ZQz3ZU9E63uIG4XMhRWn /c3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756836849; x=1757441649; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=y53FBBwQ6igC7aqv2L+EO02CVuj3ke4MkcTKcE+NrVc=; b=W3e2H484r69/cpHmJlnvH/VXbe8Y0vpq8jeuPHC+pHpCz6q5+zKm9uPCIfSxsW1SSG vOG2lzRBGTMaPPk5If7DfFi64MW2/q3H60hmwLvI0nLFI/g8/kixU0FWvSSLBVVSwDXj 12w0r8NwrFNjp65SuwAEUg9oizYGU0ZWy/z6QulIIZR8RUlJN9BD65MXBEwRjfy+L+mo PSfJq+yz+e0sDkOfZoTzn3PVFA7e3CdWYPXLFcUdUJqrjLVtMy27ZmnGiP3Kkt/N6zsx hwzhFY4sq15udeUkK5BwnAH+pYHfkbKlhYOszb15llJvdYU1K0kzCpC5sX89lK4ZMF9V uSsQ== X-Gm-Message-State: AOJu0YyYe+NGLhGTOqsv8szMKxwMyMio++lAchr3yTBXZFek/jjDuLkv zRJforGV72wrNyEmjegwv0msgqNDs0vEzbAxT6YYZmngamWci2J2I0orU78jECqU X-Gm-Gg: ASbGncs/cqO9ssvpqyftETvThWtK5EZxbak4MXiQTUVVEygG5YmXcVfrspvIWRupp+7 mxlSyl4TA9kYPW4TU6aUOwxFir02WGEXVaeDJUrf+PZ2fcEeA8q8cDntAWb4MirMaSPrL/r6o+g JIxUX1/UPwdob7K/3iWUPLxMl/oBmjhTl21UQNP7n56Ye8XZG1+QiJduD+LoifVeHBsGfcXAKLK Z5UAZIiOW678clcbMz9JXrkrz2rcWZSVDyZWK+cfDoRwdzTVbn1fPCpXU/Hmu+bK7kUkw8pYu+4 /zxBu4LeIz6E3z4IjWq0hhnETeRLPSmYUlu5WuqbvvM1DdG6ryEoo0e8nXoJYGQtN/tKDNvvkXs kOxwp1gk9KhYVVKdT0Q1HqD60nAk= X-Google-Smtp-Source: AGHT+IH/o5Ba4DTS5or94+SZSe3ZhlAnYBDv2IZ86EQTt/JKaWVd1dIkZ7PzALvVaF4SbgQgllPy5Q== X-Received: by 2002:a05:6902:1a46:b0:e97:4ae:608f with SMTP id 3f1490d57ef6-e98a5787b60mr16447826276.13.1756836849177; Tue, 02 Sep 2025 11:14:09 -0700 (PDT) Received: from fedora ([189.215.164.177]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e9bbe05cad6sm759437276.17.2025.09.02.11.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 11:14:08 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: References: <87plc8df1w.fsf@gmail.com> Date: Tue, 02 Sep 2025 12:14:07 -0600 Message-ID: <878qiwsowg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::b42; envelope-from=eg642616@gmail.com; helo=mail-yb1-xb42.google.com X-Spam_score_int: 15 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 4.8 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >> This patch makes `yank-in-context` can optionally indent the yanked text. > [...] >> @@ -6432, 8 +6452, 12 @@ yank-in-context >> variable to determine how strings should be escaped." >> (interactive [...] Content analysis details: (4.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) X-Debbugs-Envelope-To: submit Cc: 79371@debbugs.gnu.org, , Stefan Monnier 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.8 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >> This patch makes `yank-in-context` can optionally indent the yanked text. > [...] >> @@ -6432,8 +6452,12 @@ yank-in-context >> variable to determine how strings should be escaped." >> (interactive [...] Content analysis details: (3.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >> This patch makes `yank-in-context` can optionally indent the yanked text. > [...] >> @@ -6432,8 +6452,12 @@ yank-in-context >> variable to determine how strings should be escaped." >> (interactive "*P") >> (let ((yank-transform-functions (cons #'yank-in-context--transform >> - yank-transform-functions))) >> - (yank arg))) >> + yank-transform-functions)) >> + (beg (point)) end) >> + (yank arg) >> + (setq end (point)) >> + (if yank-in-context-indent >> + (funcall yank-in-context-indent-function beg end)))) > > Hmm... what's the intended use case? > > `yank-in-context` differs from `yank` only inside strings and comments, > but in most major modes `indent-region` doesn't know how to indent > inside strings and comments because we don't know if it holds plain text > or code or whatnot. This can be fixed not indenting the yanked text if it's in a comment or string. In my opinion, this feature can be useful since some users often prefer commands to be automated rather than having to pressing multiple keys. This can be inconvenient in some cases, but I think it can be useful for people who know what they're doing. Another alternative is to create a hook for yank or that electric-indent can also handle this. -- - E.G via Gnus and Org. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 14:40:40 2025 Received: (at 79371) by debbugs.gnu.org; 2 Sep 2025 18:40:40 +0000 Received: from localhost ([127.0.0.1]:36604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utVvs-0006yX-5p for submit@debbugs.gnu.org; Tue, 02 Sep 2025 14:40:40 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:2158) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utVvp-0006yG-L9 for 79371@debbugs.gnu.org; Tue, 02 Sep 2025 14:40:38 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 730FC1002F0; Tue, 2 Sep 2025 14:40:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1756838430; bh=w1emcTX3vUpZKO8hufPk0b33sPCHmKLd5xZ5VSYAaak=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fwybiiWgriCNO8Jn3NhkPdwAOppbRmZyev6k/vPOvRiGnPIVDuP5I8m9XLHXdTHbD HT/ZBm0RBfa4bMyxPRpD03h6JKG2oSb2SaV1MsMUjz+zRJ9QH0XiZNfEp/Po3sgjHV AJa84KWUpOJX9s2NjEyKrlCa54vrdQETfLULnsTnvXS+gmkvMdPs0yFs+hK9L9wsFg p84BAWWZDk4V+udqGwCJ6q2bZ+K0H1+nRwAGclcOTTN6RfnH9d7LHiP99yzySLeV7c WsSQVEEjvzTJkzhGe74xYZWTT+p1TN86SdrLRAtivkvSnCs2Pj00gGQxLiO2ny/u4C CemMYcGvYx8cA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A250C10013E; Tue, 2 Sep 2025 14:40:30 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 977331203D5; Tue, 2 Sep 2025 14:40:30 -0400 (EDT) From: Stefan Monnier To: Elijah Gabe =?windows-1252?Q?P=E9rez?= Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: <878qiwsowg.fsf@gmail.com> Message-ID: References: <87plc8df1w.fsf@gmail.com> <878qiwsowg.fsf@gmail.com> Date: Tue, 02 Sep 2025 14:40:30 -0400 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.120 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: 79371 Cc: 79371@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 (---) >>> This patch makes `yank-in-context` can optionally indent the yanked text. >> [...] >>> @@ -6432,8 +6452,12 @@ yank-in-context >>> variable to determine how strings should be escaped." >>> (interactive "*P") >>> (let ((yank-transform-functions (cons #'yank-in-context--transform >>> - yank-transform-functions))) >>> - (yank arg))) >>> + yank-transform-functions)) >>> + (beg (point)) end) >>> + (yank arg) >>> + (setq end (point)) >>> + (if yank-in-context-indent >>> + (funcall yank-in-context-indent-function beg end)))) >> >> Hmm... what's the intended use case? >> >> `yank-in-context` differs from `yank` only inside strings and comments, >> but in most major modes `indent-region` doesn't know how to indent >> inside strings and comments because we don't know if it holds plain text >> or code or whatnot. > > This can be fixed not indenting the yanked text if it's in a comment or string. Ah... so your intended use case is using `yank-in-context` to yank inside code? I see... Then why limit it to `yank-in-context`? [ I see that limiting it to `yank-in-context` means that it's limited to a command that already cares about the difference between code/comments/strings. So there's some logic to it. ] > Another alternative is to create a hook for yank or that electric-indent > can also handle this. It also occurred to me that it could make sense to link it to electric-indent. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 15:14:56 2025 Received: (at submit) by debbugs.gnu.org; 2 Sep 2025 19:14:56 +0000 Received: from localhost ([127.0.0.1]:36650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utWT2-00006U-EX for submit@debbugs.gnu.org; Tue, 02 Sep 2025 15:14:56 -0400 Received: from lists.gnu.org ([2001:470:142::17]:44522) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utWT1-000065-1v for submit@debbugs.gnu.org; Tue, 02 Sep 2025 15:14:55 -0400 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 1utWSp-0005kR-PJ for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 15:14:44 -0400 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1utWSn-0001ma-GX for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 15:14:43 -0400 Received: by mail-yb1-xb43.google.com with SMTP id 3f1490d57ef6-e96e987fc92so5620990276.2 for ; Tue, 02 Sep 2025 12:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756840480; x=1757445280; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=872oHx8+guJAqgCnu94dN5yAOIejgajtNWV9DYg037A=; b=kOgkb804usPqtlkqoAcEMRec+6wGU6KW3K7qsOOkXjo/KgbZAriBRkE9/muL0ABRcw 6lYlLJsPSmMpwwwV2IrohW8Rywpja8JLEsMAeOx/lPF9PFe9aMo++WqibDL3sngGNpR2 ZVP9PFRUJkDvk7m+MLFqItBlKiKA8s4o2DhBtzGPslFGXW2gPtzTHvdk9uPcwCsTb/FV lEKXW4vAubKiT5JpFaoCThcqy5bAemKMZf7JzVdd1k/k46BuTwY48+cynmeTTDKunpsS 3iAnxTRpQJZcphvhQp1A2CoRQ+nycZhs5aLAy0eeonufp+yjUCIF3m2y7dRVwQT/+9tE czDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756840480; x=1757445280; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=872oHx8+guJAqgCnu94dN5yAOIejgajtNWV9DYg037A=; b=h/BHR6SVbUsUZ6gQesebdzlIQ2fj8CdWQ87Wgjirn8piGhokD9jqMRC2DAg8WNUTdN azZ2NoV8ZlOFnJ1EhxrqBEBG+xG7zi3NQY+dmFX/QTXOjrMIW5x/3Fy/0ti3dN9KjUJL /J+J3i5J6ErPC1VJ2bDT4UwcBTHUWpuVHTyVaHgVBALcaRYLkmYed+XP1HyjzY3Ku9RH ELrxn41Y3ylzKbpVLk55Ayy9MnJTZrr2okapTBLa5THMpGW1cCp24JfMOpGDSVmW+Dio Ria5QKbuz8DZMFYwqRTEveuRNNGwIXzBcA/DZYvn9mZ1WHJAH/fG+835bIPsYAqevxrX QiRw== X-Gm-Message-State: AOJu0YxFNhc0DrZ5+b4hggPBj1tOuJ4QhB8FiPz+ReQ/3Sm+BdT31nA9 QzDlvbAWVIw4Mtc9fqJJvEqKkdN+8CYFpv1vK6+PhlvzI0kiTke9N5FZ X-Gm-Gg: ASbGncsJhg8IidfpSQCrfv1r3OgC52GnoROMB689rzX9hGVJDXIsxwSszVr7OmT5fUc gKH72ovOfingpynV89LiJQ47Ud/lb+FySuf7ncY5d9oVJ/0wMSBvJdmQECbDrauK65OgBeYiMF3 dqli3cHRZ955hqy1teCrh8nGS5bYnvYanf7B6RTJ8X82I7UI0ikzFoOHbEDwCKzHni2gEQ4myX6 G++DYlCkC3BArRvVAW0vausftL0SRhN43rgLWRqNjTly9rwc5aGm73rDZJYyEXx3drhlGn7OjF2 x2hMhhrKjaWu/RJYkc1fR8xbBWdF6x5gdP4sXKC0//RKCiwu6vUuhGdZSFLHzRDf6RaQuwriRdY WgrbHXOomKmf1vDEd X-Google-Smtp-Source: AGHT+IFaW0uKdgV19JCo8xYsS0qCzeClPnndLNjxoRbBuN2ORKK9dxbxeWc+48IF2kubNLgpHZcWCA== X-Received: by 2002:a05:690c:ecc:b0:71f:b944:103a with SMTP id 00721157ae682-72276515220mr127771557b3.43.1756840479695; Tue, 02 Sep 2025 12:14:39 -0700 (PDT) Received: from fedora ([189.215.164.177]) by smtp.gmail.com with ESMTPSA id 00721157ae682-723a85028d2sm7410217b3.43.2025.09.02.12.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 12:14:39 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: References: <87plc8df1w.fsf@gmail.com> <878qiwsowg.fsf@gmail.com> Date: Tue, 02 Sep 2025 13:14:34 -0600 Message-ID: <87v7m08y5h.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::b43; envelope-from=eg642616@gmail.com; helo=mail-yb1-xb43.google.com X-Spam_score_int: 15 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 4.8 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >>>> This patch makes `yank-in-context` can optionally indent the yanked text. >>> [...] >>>> @@ -6432,8 +6452,12 @@ yank-in-context >>>> variable to determine how strings should be escaped." >>>> (in [...] Content analysis details: (4.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] X-Debbugs-Envelope-To: submit Cc: 79371@debbugs.gnu.org, Stefan Monnier 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.8 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >>>> This patch makes `yank-in-context` can optionally indent the yanked text. >>> [...] >>>> @@ -6432,8 +6452,12 @@ yank-in-context >>>> variable to determine how strings should be escaped." >>>> (in [...] Content analysis details: (3.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >>>> This patch makes `yank-in-context` can optionally indent the yanked text. >>> [...] >>>> @@ -6432,8 +6452,12 @@ yank-in-context >>>> variable to determine how strings should be escaped." >>>> (interactive "*P") >>>> (let ((yank-transform-functions (cons #'yank-in-context--transform >>>> - yank-transform-functions))) >>>> - (yank arg))) >>>> + yank-transform-functions)) >>>> + (beg (point)) end) >>>> + (yank arg) >>>> + (setq end (point)) >>>> + (if yank-in-context-indent >>>> + (funcall yank-in-context-indent-function beg end)))) >>> >>> Hmm... what's the intended use case? >>> >>> `yank-in-context` differs from `yank` only inside strings and comments, >>> but in most major modes `indent-region` doesn't know how to indent >>> inside strings and comments because we don't know if it holds plain text >>> or code or whatnot. >> >> This can be fixed not indenting the yanked text if it's in a comment or string. > > Ah... so your intended use case is using `yank-in-context` to yank inside code? > I see... > > Then why limit it to `yank-in-context`? > > [ I see that limiting it to `yank-in-context` means that it's limited to > a command that already cares about the difference between > code/comments/strings. So there's some logic to it. ] Originally, my idea was to implement this in yank (and its other commands), but the yank code base is (for some reason) separated into subr.el, so it was going to be difficult and inconvenient for me, i decided to add it to `yank-in-context`, since this command is intended for yanking code[1]. > It also occurred to me that it could make sense to link it to > electric-indent. Fine, I'll see how to implement it in electric-indent. 1. Although yank-in-context can also be used outside of prog modes for non-code text (e.g message-mode), it is buggy for some reason. -- - E.G via Gnus and Org. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 02 19:11:46 2025 Received: (at submit) by debbugs.gnu.org; 2 Sep 2025 23:11:46 +0000 Received: from localhost ([127.0.0.1]:37107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1utaAE-0002w7-8J for submit@debbugs.gnu.org; Tue, 02 Sep 2025 19:11:46 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53064) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1utaAB-0002vb-Qv for submit@debbugs.gnu.org; Tue, 02 Sep 2025 19:11:44 -0400 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 1utaA6-0008Tf-6E for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 19:11:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1utaA4-0005Ep-A8 for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2025 19:11:37 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 907684422C5; Tue, 2 Sep 2025 19:11:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1756854693; bh=OJ7wrpKQzkUu/uj09kinWR4YToPneuPzd9t01ao09/4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=X+GVaxnfljuEvx3/RnSajJjP9dotqyqYJcptrVpiPIgIQmdC6/R6S3qpVgEaHfbIm eJC8bDbKOuktWBsSGCZ9TadATaseb1gKCLudEEF3JyHtTmFZfgziRb8chyvPzt4fo8 UzbTAYqbuX+3Vkdg/t/2GB1ddW/dq8tsJwcX7r7lRjeg3QIlX8TvqnVyDqxmwTMvXv ++R5XHhc0tGVz45aPtCol5g0wKSAefAXBi64McMp7VI0VfVJm0O+tmEU31TZkI4S+o UHwy767KuuSuIMLkTxL5HIqb38R+LigSGfZPslbqaiRVBs/L1cUF/GkLO+KaXOoec3 rmxEJZVTllnCg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 71B244422BD; Tue, 2 Sep 2025 19:11:33 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4E1611206D0; Tue, 2 Sep 2025 19:11:33 -0400 (EDT) From: Stefan Monnier To: Elijah Gabe =?windows-1252?Q?P=E9rez?= Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: <87v7m08y5h.fsf@gmail.com> Message-ID: References: <87plc8df1w.fsf@gmail.com> <878qiwsowg.fsf@gmail.com> <87v7m08y5h.fsf@gmail.com> Date: Tue, 02 Sep 2025 19:11:32 -0400 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.158 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: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: 79371@debbugs.gnu.org, "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors" 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: -1.0 (-) >> [ I see that limiting it to `yank-in-context` means that it's limited to >> a command that already cares about the difference between >> code/comments/strings. So there's some logic to it. ] > > Originally, my idea was to implement this in yank (and its other > commands), but the yank code base is (for some reason) separated into > subr.el, so it was going to be difficult and inconvenient for me, i > decided to add it to `yank-in-context`, since this command is intended > for yanking code[1]. Yeah, I think it makes sense. >> It also occurred to me that it could make sense to link it to >> electric-indent. > Fine, I'll see how to implement it in electric-indent. I'm not sure that's such a good idea. At some point I did consider implementing `electric-indent` in a different way, which would automatically cover things like `yank`, but in the end electric-indent is fairly "conservative" in terms of when it reindents. But conceptually the two are somewhat related, tho your functionality might be closer to modes like `aggressive-indent-mode`. If you're careful to place an undo boundary before doing the `indent-region`, it ends up being a choice between: - Don't reindent by default, let user hit `C-M-\` if they want to reindent. - Reindent by default, let user hit `C-/` if they didn't want to reindent. IOW, I'm rather favorable to your proposition. It seems worth a try. Tho, maybe you want to pay attention to (or (memq indent-line-function electric-indent-functions-without-reindent) electric-indent-inhibit) so as not to call `indent-region` when that function is unlikely to do a good job. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 04 21:45:39 2025 Received: (at 79371) by debbugs.gnu.org; 5 Sep 2025 01:45:39 +0000 Received: from localhost ([127.0.0.1]:50010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uuLWE-0001gJ-Hj for submit@debbugs.gnu.org; Thu, 04 Sep 2025 21:45:39 -0400 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]:60905) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uuLW7-0001fy-6C for 79371@debbugs.gnu.org; Thu, 04 Sep 2025 21:45:34 -0400 Received: by mail-yb1-xb43.google.com with SMTP id 3f1490d57ef6-e9d6cb1df67so1449206276.1 for <79371@debbugs.gnu.org>; Thu, 04 Sep 2025 18:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757036724; x=1757641524; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=9TnRzJnT8bXAiq3FFGu4dk3lJlhuXeULmKZXPi9ZXg0=; b=DtWLUPJddeSRl5qOEkXJ6h+y6ZqWC/TraGiMAxRztMrEopiP1f/EjumMSD8XAKsZoP S8HjspmvW46cNDS8K+QFad+J5yombiIacg3QggnYCTU1dUG4iu2Fke0/GyJhAmv+2gix TDCSpbRwFlyX6AzAHSR6Oc7kptTJl/Qgn0rhDKzi0JhLc9e4xj4hBDHw5LVH1/tYkExc iqzl7LKgb8aHjEOU8TbCGAiVgGGUJz5nzXRLs82Rv3w4mARGFeiobTuba3gHqDYQt7IU dd3xUofdVFe+oZqEY11kfr15CaZ+QjhMnBScfZRje7G5QQf5l56CsUuEw8O9siHFq5Nj VU5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757036724; x=1757641524; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9TnRzJnT8bXAiq3FFGu4dk3lJlhuXeULmKZXPi9ZXg0=; b=NBpSvFRxb2eKjHy14NIdQj/OPBMRbOBJVte891wI4QP5qp7CIFtUGQhdBwyKNDa7By AAhp95JQad69Vu6sRf2jgg7zP+7JX1EgUTYM9x8N+XqOoOF08YIP0hUQAvYERhkl6p7M +tm2POo1Dg+GmNM6ARZRUryajbpIsq95tm/VocipnUy5ej74AJ6bzRdFzbjgfY2o61DS ERbLPohlOEgmy06Ah62p6y1gaUjitvNuQqMNLyBTIOGDFru8Y7cS5oeSXI7J0+glmhR/ xIw8iSpQYOYhLrHpJ+0J4ED2qMokQr0EoWgl78qP6sTLed91PCFe+kThyxHVVe9AYq/L xczQ== X-Gm-Message-State: AOJu0Ywa+3iShHhgzMQzLfVyXF9LpsoVxzN4wXy27SS09LtCAnqpIoCE PF7whRjDklFptCMnuRDdadFq56tFoYlpgHwQUgA8nE1h0JJ4JaRzLAXn8/loZqUx X-Gm-Gg: ASbGncuJ2J3anP8CVKK7ZFK2X7ERnLbfWHxDgvHNequLZvRqy/EBbwdRnzTGtfNcdbd 1g4Y9MNJiiaYbWwFw1yCbtJBIe8YMfTFYL1KX82ks9uuRiJcwT47Ie13InKmRr39Txe2/8hVUD6 WHw7kSHvEhBOPKT3yV+4zefdEeYggwju+5U3UiXU2J6IbdAOtic5inZrJtntlqwPigHpY6cdEAq hJ1lX1UqIPFHVX8bZfRHVZuLWR3/R6PJsntzlRUm9PBjnNZaw1cThTP3s/zlotyFa3rbsFs1aep igmiBmBlRCb22K5WI0HurMnLfL45gmyF8N3vVqDMzT5gG0Nlz0hPE746gpQGFhskuCcCohCOykL 8G6XKPYyybPKs4V1HNCLdN8iGjn4= X-Google-Smtp-Source: AGHT+IH+r56kBUJ+IeBuH0iI9UZSnpacz0pcy/vE8wuvj7pvp9KmfuCXT3G6O3kO4jTksbQqudY7JA== X-Received: by 2002:a05:6902:1023:b0:e9d:6879:78ac with SMTP id 3f1490d57ef6-e9d687979b4mr5576617276.31.1757036724271; Thu, 04 Sep 2025 18:45:24 -0700 (PDT) Received: from fedora ([189.215.164.177]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e9bbe08b780sm2737805276.26.2025.09.04.18.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 18:45:23 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Stefan Monnier Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text. In-Reply-To: References: <87plc8df1w.fsf@gmail.com> <878qiwsowg.fsf@gmail.com> <87v7m08y5h.fsf@gmail.com> Date: Thu, 04 Sep 2025 19:45:20 -0600 Message-ID: <87zfb9k6z3.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 3.8 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >> Fine, I'll see how to implement it in electric-indent. > I'm not sure that's such a good idea. > > At some point I did consider implementing `electric-indent` in > a different way, which would automatically cover things like `yank`, but > in the end elect [...] Content analysis details: (3.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] X-Debbugs-Envelope-To: 79371 Cc: 79371@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: 2.8 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >> Fine, I'll see how to implement it in electric-indent. > I'm not sure that's such a good idea. > > At some point I did consider implementing `electric-indent` in > a different way, which would automatically cover things like `yank`, but > in the end elect [...] Content analysis details: (2.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [189.215.164.177 listed in zen.spamhaus.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:b43 listed in] [list.dnswl.org] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: >> Fine, I'll see how to implement it in electric-indent. > I'm not sure that's such a good idea. > > At some point I did consider implementing `electric-indent` in > a different way, which would automatically cover things like `yank`, but > in the end electric-indent is fairly "conservative" in terms of when it > reindents. Probably this should be an additional and optional feature for electric-indent e.g. only indent a region when some command has been called. This could extend it to other things, e.g. indent the buffer on save. > If you're careful to place an undo boundary before doing the > `indent-region`, it ends up being a choice between: > > - Don't reindent by default, let user hit `C-M-\` if they want to reindent. > - Reindent by default, let user hit `C-/` if they didn't want to reindent. > > IOW, I'm rather favorable to your proposition. It seems worth a try. > Tho, maybe you want to pay attention to > > (or (memq indent-line-function > electric-indent-functions-without-reindent) > electric-indent-inhibit) > > so as not to call `indent-region` when that function is unlikely to do > a good job. Thanks, I'll keep that in mind. -- - E.G via Gnus and Org.