From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id oMN1Jnoc/Gb3FwAA62LTzQ:P1 (envelope-from ) for ; Tue, 01 Oct 2024 15:59:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id oMN1Jnoc/Gb3FwAA62LTzQ (envelope-from ) for ; Tue, 01 Oct 2024 17:59:54 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=i8gQuYXa; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=none) header.from=outlook.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727798394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GyTiNVN5SnaE6evoL1FrifKVBZ1r0OXGHBmfyJY9OY0=; b=ohjq7rUHBt27GMy3EE/1YRFSuGk7cKPYKaGTl674DxJF4XkUGyX7NuR0UlwDw9MNUdlLxf 7cHCbnGgh1dMKdpPpB03S3Ysov3aPX/zyX6t3+fmN+L+x8tD2vmfu6WAp3IJO3XXvxOcXk tGRjQCFtENdLsDQaZcnBjNAq97M92JGoubd2SNL5v3a/umdF637M6QgE/5YjKHG5tXYEjw lQD3VlInckXwm3LERkxcrPqPcwgMMfkO3kkEkwkCmCCCxb8qblR0erJvi+hsQqGbFicyVy zAQ9nn+vaXtyUtzfCJYdncVCTUR1sdufVAUA5bCR4pRwMr/EMVOZJ3qvHPQlGw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=i8gQuYXa; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=none) header.from=outlook.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=2; s=key1; d=yhetil.org; t=1727798394; a=rsa-sha256; cv=pass; b=aSSgHkGeMb2WkBbU6Nk5K/60J8Nf5o0UCfANus4y88XE4ywO1AJIYOisiFh/7g7a8E7w+9 ygWrxizoUwwPWG9O6L9BpzpFYsy1AUdHROqV3w/jzo65Fo2SWvJgfmHzILZv1wlEbsNgpv dP+XAmO1cX2ocJL1OxfdDk0DhqyweXJrZPVmmChhXM4P+Vw/dFNlfQGNYxYBqhxyPdUC5K qa/Vvfc1fotYla5i9Q8TPMhGeqHdO1UZu0/cAzHL6cwfoT68sKaJNOSi9sylHStvaVg7yg ofPZIpYD9VZ/uObe3Nr+5EolGJfp85rKEd216/WSIRx9uBK8fHkmZa6m7OQuKg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 34C3A83C95 for ; Tue, 01 Oct 2024 17:59:54 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svevO-0006Qo-RW; Tue, 01 Oct 2024 11:36:31 -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 1svGUJ-0008DO-Ck for emacs-orgmode@gnu.org; Mon, 30 Sep 2024 09:30:55 -0400 Received: from mail-japaneastazolkn19011031.outbound.protection.outlook.com ([52.103.43.31] helo=TYVP286CU001.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svGUH-0002Hh-Hx for emacs-orgmode@gnu.org; Mon, 30 Sep 2024 09:30:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qkZay306jLVrZpZKNXDt9jUn4vT17QW/OfLjIXDrBqUIjx8rbPDndBNIiC9/dUV/Irf2H9d8lL/Wjom9hfmpAcbLn8iQQsB7MVY4VZZQTynJEi9vow6FDOqjNBwLpNxGlKMeguWWzF/GRv9vwvoQsMJZJbuAr0VQQV9Ja183G2JALccq9mnLUgaoBfXWhFu73Y0Q5oQFrQZpNNt3cWAl2EBQ449cl1ep5WYGUNrvFilDl8rgfg+LTTgT0AGyZJaZd8Ozr9XU+gBpf7tH1i/twOacXgYYVSOc7rf4KiYYf+CkGg8i1MvoWKZXy5qAJ6w8Uo6WURxBiOsI78XgyU4SNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GyTiNVN5SnaE6evoL1FrifKVBZ1r0OXGHBmfyJY9OY0=; b=LYYYzCotCdMo53IJjzdXBmVcq8F4Dlvvv4hCO/DwiLT96dq4s47/bpRq3cW8//Imm8RTuKh6GpY7Inc+5mZdPuqGV7NCK6PJ1kEkKGOIsLyXTxsuBhIeFtBlilbtIQLJlpZbYq+2AKcR/f5sDaxbWsE1V15yw1HKoluojjttOizYlMAGLcsuwBzKYSoHOCR4xLFMK/I7lTKdwGbLAbuttxK9PQqJ3AFYBbVpK+voABrwCAlm9s378E0H5hpgqXkU9Nftm7pnqG6Pr6OGgMP0Pvrz8xwwp+/XwSe10pzVgBzdcJbwVKCANGbIVSYheqZoXNDBmAj/caxUkxP42P75LQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GyTiNVN5SnaE6evoL1FrifKVBZ1r0OXGHBmfyJY9OY0=; b=i8gQuYXazQ/HhFci8wIW4wqoDe2H+wFUJR+SHzQv0Fw67mOIqbmHyp0FwSyYOxI4udPrkuCHZQVBX9cEwRM6/i0Gg3op0+HQrtK+uvdoonFymdSX/oMwQ3sp7LQwp2s4HegaiFS8+JgLqBfY2HEJq9vwLAWDeFTtbWDBz54LfLPXg+aJ6mCnTRp3U2mr9e38MF/cjECYzwirHYytaOCDa88gnW14ljx9t9d76p8wDFZ8e1erZDBdVvnbwdvpHg9h4AAXlgSn/axoyW6HktzGHDriejjBR+aU+OJrZN6+bMVgNxUzl4v/oFyP6hsvaTuRGAcw3M2tqj1BvXGOK0lJyA== Received: from OSZPR01MB8704.jpnprd01.prod.outlook.com (2603:1096:604:15d::7) by OSAPR01MB7398.jpnprd01.prod.outlook.com (2603:1096:604:143::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Mon, 30 Sep 2024 13:30:48 +0000 Received: from OSZPR01MB8704.jpnprd01.prod.outlook.com ([fe80::e0ac:399f:3236:ddf8]) by OSZPR01MB8704.jpnprd01.prod.outlook.com ([fe80::e0ac:399f:3236:ddf8%3]) with mapi id 15.20.8005.024; Mon, 30 Sep 2024 13:30:47 +0000 From: Steven Lin To: "emacs-orgmode@gnu.org" Subject: [BUG] org-comment-dwim comments some chars in the unselected line below Thread-Topic: [BUG] org-comment-dwim comments some chars in the unselected line below Thread-Index: AQHbEzvCP+cyuq+mikWK/0c0/ldCow== Date: Mon, 30 Sep 2024 13:30:47 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: OSZPR01MB8704:EE_|OSAPR01MB7398:EE_ x-ms-office365-filtering-correlation-id: 8238d658-67d4-45d6-6b52-08dce154182e x-microsoft-antispam: BCL:0; ARA:14566002|19110799003|8062599003|8060799006|15030799003|7092599003|461199028|15080799006|102099032|440099028|3412199025; x-microsoft-antispam-message-info: SxfcIQbJYNh2IL+gYJ6lvgSJ8kmE5iAmsDcWaAib5F1qsAZZDA1iTqGnqTg7gihsGT5zXUyh/rXJGBaMfjHUEKds/pqBz1Se7A/zpCg5IvaBP4hDOFKPB7Bg6vJUgYAvq94dDnOcfYl+WuCKPkLTBldjm7DJzj1UIzqrydzXpgBu5rQ03qbu5iLqCNL64Yu929FYowDkQ7W4tJVJuz6CP3TX8NUmRlx5qmsO4XaF0YQH/WhWnDnNlebk88RUGmjqtIW0ziax/iddoOQdPS1BZdUhBkhmZqSXs/g2NdfNrpQOUPRvUKP4xhBYt+djB5/aG6xZoTvBP1T6HCvX6tmLdpngRHdKHhuoXsyVGEtCHyn1hNN9XJU5OU1LfC1FpXCcELxAw6uDr+MO3M10U4WmEPuVocX3JpAn0I0p6h6gvMPQ0ImiqkP+XmhjhaBbz96CtDgZimLhlXMHWiyXMM8Pgif2IvPUm0RB+w0imFI5StpTLaQn70UhnWJxmc7JhMQxjcLGUNqkwXw/aL6Idm8WyfyEkAHoCG0PIXFFF39cl5TycKXteejBRuC0xJSFqXpcmTjmW547GHPwSMlVy/vwQCVDZvcJwQLRnMUvkghN6UGTu4HvnLdi3HfFKWHsig851SUhswyUhsyltpMILGVW4QghSUk2KuukmEDz/hQx3iGJrpWkkAmbzxHI2C06jKhpglWZ7boNNPpCbcUtPNcLf1dj6Z2qAK3X8utEQa2F3P5N5oy+h3LdyTYVJ/mYosQmn+A902m8L7Ofqor1j33cIw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?aCg296682O5KKgFalnqXKfVfXf37Ll3nf8VLtKvpMOcHSGycKR/2eTaULb?= =?iso-8859-1?Q?8Qh3oFMQyNMRDfbtIEqzmbF33h8HbtM/N2qU20Yor0m1urI84HtpfTHm74?= =?iso-8859-1?Q?tjkbIuS7ve8D5yFxHj8dmPE+vyxWbxL0nrCvcoTUbBi6gJLy0uRPUBcWgS?= =?iso-8859-1?Q?xmZalFKkS9J2BGOhgtNWVZQKEA6inAJ7ihQk8P/wwkneU73Qv+8ONXCPcd?= =?iso-8859-1?Q?wmC0IVtWU15mhOFFXkqsRO5a3bOyLZAUUnY5FFBJ2lBy+uthpkpW68gix0?= =?iso-8859-1?Q?C0cUzlj+4ncBA2xmb5Hx+jU8vlovl2qhk3zveiuXzn9uMje3W8qzuzKP53?= =?iso-8859-1?Q?Hi6K6eRCzrkBgFQocr9hrxR+RxBMH0Mi77GbEGam1QTp7TeIKlp64VpAZ3?= =?iso-8859-1?Q?Dt3YFO6Du1vstAT0uATq69nMdzWtzUNAU05EJEIk1pRK7LcVbjbd1LrCXJ?= =?iso-8859-1?Q?N4d6yRDPxN17IeL7wWtKCaNrB7Fk9XL1rSLohu2UyYy5T/cDs5ni/wyPh2?= =?iso-8859-1?Q?RC/NCYzcN+Yoq+aV+3MbXY3zxRHDTGMOHtbqlnNgIumofMN7NSMCEEVUi5?= =?iso-8859-1?Q?UPauKnkBaNSEvqHuesFyc2KOxwcg501IqOfaf1Qw19As2vjrO1nYBIIbnh?= =?iso-8859-1?Q?llgXQvj9SzYqaNjsK85pBlwyqGny1S/+vpiDhtoh7EYYsqSFJ4L9bFcZ9X?= =?iso-8859-1?Q?mlob+l6W+4iDMNeFtL1jej2UpJmJX6z2o+OcoyhmRFEU7YYOT2b37a14ih?= =?iso-8859-1?Q?YVhQ1oAM3/XVvTdlkVd36oKrMe2dy/G2ZpXsGUwV69UmjrRMNtlHdm3CwS?= =?iso-8859-1?Q?eYTZpgSpKVY18APFn8yzmEjsu3lpa0exXGK5c87E0LTcVuEOt/7UNFNgOF?= =?iso-8859-1?Q?FPP4jkK3W0qBDYKqPAsP81dwAJhIF+l1BW2BSwT3QJMczMbMs5nYvx2FEa?= =?iso-8859-1?Q?3b0m0wxyM8WCjlejfyFxGBu6QVd9bW91jD9is7irKstzhETD/peKV3WBrA?= =?iso-8859-1?Q?81H7hV+DZutuf7fMh4ov6J8iw4SPJUGFTf7d6ngSpciyW6CwDhkiJJ8xBn?= =?iso-8859-1?Q?1EmAeAemjavx1yoHU2kGFNaZz7akc78eqa9MyreFmot8WdZ1oNvoPvay41?= =?iso-8859-1?Q?XVYEsRges9/4UqAbC3rQqvgZ/ioWZ74E2GMf3hMcP+sPb3xFc17j2rH9w4?= =?iso-8859-1?Q?UkQVRPwnyNNdlUM3Co6yOT0gHWHTjeD0g1aGoTsF2DtKm6KF359ypAdwam?= =?iso-8859-1?Q?XpFKKyGIOzbLvWV7LRRA=3D=3D?= Content-Type: multipart/alternative; boundary="_000_OSZPR01MB87040D68B5548313B168BB8B9A762OSZPR01MB8704jpnp_" MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: OSZPR01MB8704.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 8238d658-67d4-45d6-6b52-08dce154182e X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2024 13:30:47.8804 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSAPR01MB7398 Received-SPF: pass client-ip=52.103.43.31; envelope-from=linjt267@outlook.com; helo=TYVP286CU001.outbound.protection.outlook.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 01 Oct 2024 11:36:17 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 34C3A83C95 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -2.93 X-Spam-Score: -2.93 X-TUID: bcqJxCez6NVC --_000_OSZPR01MB87040D68B5548313B168BB8B9A762OSZPR01MB8704jpnp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi. I found that commit 1014296344a75fa08e0a8814e4fbbd767e7eba4c brought some bugs. Step to reproduce (In vanilla Emacs, with latest org-mode): 1. Set these variables. (setq org-src-content-indentation 4) (setq org-src-preserve-indentation nil) 2. Try to comment some lines in a source block. For example, line foo and bar. #+begin_src emacs-lisp (setq foo 1) (setq bar 2) (setq buz 3) #+end_src Expected: #+begin_src emacs-lisp ;; (setq foo 1) ;; (setq bar 2) (setq buz 3) #+end_src Got: #+begin_src emacs-lisp ;; (setq foo 1) ;; (setq bar 2) ;; (setq bu z 3) #+end_src Then I found that there is a problem in function `org-comment-or-uncomment-region` in lisp/org.el. in func `org-comment-or-uncomment-region` : #+begin_src emacs-lisp (let ((offset (- end beg))) (save-excursion (goto-char beg) (org-babel-do-in-edit-buffer (comment-or-uncomment-region (point) (+ offset (point)))))) #+end_src the value of `offset` is wrong, it became `Expected_Value + Org_Src_Indent * Lines_To_Comment`, in the example which is 8 chars more than expected. Thanks. --_000_OSZPR01MB87040D68B5548313B168BB8B9A762OSZPR01MB8704jpnp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi.

I found that commit
1014296344a75fa08e0a8814e4fbbd767e7eba4c brought some bugs.

Step to reproduce (In vanilla Emacs, with latest org-mode):

1. Set these variables.

(setq org-src-content-indentation 4)
(setq org-src-preserve-indentation nil)

2. Try to comment some lines in a source block. For example, line foo
and bar.

#+begin_src emacs-lisp
     (setq foo 1)
     (setq bar 2)
     (setq buz 3)
#+end_src

Expected:

#+begin_src emacs-lisp
     ;; (setq foo 1)
     ;; (setq bar 2)
     (setq buz 3)
#+end_src

Got:

#+begin_src emacs-lisp
     ;; (setq foo 1)
     ;; (setq bar 2)
     ;; (setq bu
           z 3)
#+end_src

Then I found that there is a problem in function
`org-comment-or-uncomment-region` in lisp/org.el.

in func `org-comment-or-uncomment-region` :

#+begin_src emacs-lisp

(let ((offset (- end beg)))
     (save-excursion
       (goto-char beg)
       (org-babel-do-in-edit-buffer
        (comment-or-uncomment-region (po= int) (+ offset (point))))))
#+end_src

the value of `offset` is wrong, it became `Expected_Value +
Org_Src_Indent * Lines_To_Comment`, in the example which is 8 chars more than expected.


Thanks.

--_000_OSZPR01MB87040D68B5548313B168BB8B9A762OSZPR01MB8704jpnp_--