From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.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 wEqIFyMX/GYNWAEAqHPOHw:P1 (envelope-from ) for ; Tue, 01 Oct 2024 15:37:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wEqIFyMX/GYNWAEAqHPOHw (envelope-from ) for ; Tue, 01 Oct 2024 17:37:07 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cWnedfgu; dmarc=pass (policy=none) header.from=gmail.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=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727797027; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yUi9i483onwrke4l65KXNUVlw2NWhqvDF2ViIGszWiw=; b=RqNRFy/L8CpVW1jasX+5fldZcUkNiiWFflkYVGvyC5DSd1wW+CCbbhqE/MWwS/T8MKQ8x6 m4n271qgBoT8ggvuXEgu2dYbFU/wr2D1+BPTzjj+zOGxSdZsRMVZGWfUg7NrFinkXa5J7C 50oCYy+cMUCa3U9VBY0ee/OIPFkkmPC2UiIJyM5VKIGbQgVYu/EyguW8Cfij81catTpAr3 OZuz1FeZhS1nc8s/vJ5Mg/zdqOqvEZOjf1Tz1CKkZdWDmk5Wsyv9l24P/uCYqQcwi7AObT Z6pD9jXkWAf8Jw0bTHXjfectkLSpLztQwI6TGIAiV6eG1sB5MQXG7+S06U7tiQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cWnedfgu; dmarc=pass (policy=none) header.from=gmail.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=1; s=key1; d=yhetil.org; t=1727797027; a=rsa-sha256; cv=none; b=nptX5BF03aRoE2V3yrXiJzk+0aXvO1vLS9wBVpbFTcixyhsCL7fKbVojZnAYsEkFNu8IEW zkPyP92FCYkgCPEV5q9e3sycJognwE/Tv3s6UCUDPtNBizPYFjhqS3Xv3OeZhofuLVSyHZ au2FdvWYH4B3B7yiQlQoN8BnSt/Zqrv1//vTnTOl5M2N2rThiv0hF2VQEaqsRDBjb8a4iR KAAspnqv97OYrb1np8k00zoe/t4UqQLZAHl+T42hDp66P0WJt8bv1ItNUmo6YqVin3okEl t8qmftGw4huywxgvbZLgps12UbHJ+9gLwYV0vGLTFh5SLjx7wU2RRvj4pKKwKw== 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 23F41815DC for ; Tue, 01 Oct 2024 17:37:07 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svevJ-0006BH-Qc; Tue, 01 Oct 2024 11:36:26 -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 1sveHg-0008Vd-3u for emacs-orgmode@gnu.org; Tue, 01 Oct 2024 10:55:28 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sveHe-0006s9-2S for emacs-orgmode@gnu.org; Tue, 01 Oct 2024 10:55:27 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-20b0b2528d8so62060405ad.2 for ; Tue, 01 Oct 2024 07:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727794524; x=1728399324; darn=gnu.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=yUi9i483onwrke4l65KXNUVlw2NWhqvDF2ViIGszWiw=; b=cWnedfguxwWoKFy9D0OiuMtYoq83PNgenRK34hM2hyslxmG5AhqNkLYfWC5nqxV4tx /2qMhv8HgcmSCGW87uPwmrEL/YTcR33A24MOUhTd7OMFZILOD/egT/iMRoqF1jnoSzu/ 5+5w+jd/rQD8p43z1HeQ2V1Yv16ZXNQchBnGs4q08n7oN89gLdIp/iF+7TZ9oUlTOtAH 2gUdiYvDgKH0vn7x/oa6Rdp7GCLtUa3Feio9aI9aw4M1fBn18s1Q958pF5syHcmJpVie siwdOVdl2lN2km0m+PxG19xtc0BT9jdX3sIf94AM9ny45qee29gbmhIjsdJS8SR1f/lH kEbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727794524; x=1728399324; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yUi9i483onwrke4l65KXNUVlw2NWhqvDF2ViIGszWiw=; b=WJcJvoX+NWIcpc6tDXByc/PCzhbFZam6x0FrcN1oIs79gyISkAaWQH5uC4plR9be9s J+U9krQJqrQ4uaUUbpmGU1rMk2/wxMq+/+BOKK49SgHVteM8u9ZQStA3XVKKoiTASQ6B 3HW7XQF8MRA0RgNPHkS7CYuTxrQdcq5QV1pi3okBvP5/A67xsMz+X0J+Xxa6gHFVUiX7 WFPmrY46WZc0kDP5KIsHces2YSTAW8S8nEfUNUnZEm74XTmakBa1erUuvGVYfvHCNYi2 0g54AJFdnv9GVxmVm8PHiSoQsMpdUe2QmkBPxtKFEdSyuVaOqDSXb3YBKOYXcPMIiDgu tzKw== X-Gm-Message-State: AOJu0YxctKiSHf0SDaqsbV08Ii0oHpyvO85FSXkTnTHX/wBfBLF7+nkF 01SIUYURfNu1NeB5ykFxgn02AOB18ItUwEFlT9HhV/vR5m1onTXFltuTl1+Uw62abxBTHKm0JOC iKlca5JC7ntE2ee3mZ/6hC2zEsXAa+hI7ct9lBiY= X-Google-Smtp-Source: AGHT+IFZUWkL8Aon08qV3YJz3KVFNMzlANU2Xe175+376mX32PsBhRjU3xSi+0lpJxHwBO+JDKetEGvHRwmhJVr086c= X-Received: by 2002:a05:6a00:1956:b0:710:591e:b52f with SMTP id d2e1a72fcca58-71b25f01b93mr22551471b3a.5.1727762901561; Mon, 30 Sep 2024 23:08:21 -0700 (PDT) MIME-Version: 1.0 From: Stephanus Comnenus Date: Tue, 1 Oct 2024 14:08:10 +0800 Message-ID: Subject: [BUG] org-comment-dwim comments some chars in the unselected line below To: emacs-orgmode@gnu.org Cc: yantar92@posteo.net Content-Type: multipart/alternative; boundary="00000000000000f8c506236426bb" Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=linjt267@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: 23F41815DC X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -4.39 X-Spam-Score: -4.39 X-TUID: AxxjMRNR86UL --00000000000000f8c506236426bb Content-Type: text/plain; charset="UTF-8" Hello, 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 1 and 2. #+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 + Max_Common_Indent * Lines_To_Comment`, in the example which is 8 chars more than expected. Thanks. --00000000000000f8c506236426bb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I found that co= mmit
1014296344a75fa08e0a8814e4fbbd767e7eba4c=C2=A0brought some bugs.
Step to reproduce (In vanilla Emacs, with latest org-mode):
<= div style=3D"font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calib= ri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)" class=3D"gmail-x_e= lementToProof">
1. Set these variables.

(setq org-src-content-ind= entation 4)
(setq org-src-preserve-indentation nil)

2. Try to com= ment some lines in a source block. For example, line 1
and 2.

#+b= egin_src emacs-lisp
=C2=A0=C2=A0=C2=A0=C2=A0 (setq foo 1)
=C2=A0=C2= =A0=C2=A0=C2=A0 (setq bar 2)
=C2=A0=C2=A0=C2=A0=C2=A0 (setq buz 3)
#+= end_src

Expected:

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

Got:

#+beg= in_src emacs-lisp
=C2=A0=C2=A0=C2=A0=C2=A0 ;; (setq foo 1)
=C2=A0=C2= =A0=C2=A0=C2=A0 ;; (setq bar 2)
=C2=A0=C2=A0=C2=A0=C2=A0 ;; (setq bu
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 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-uncomm= ent-region` :

#+begin_src emacs-lisp
(let ((off= set (- end beg)))
=C2=A0=C2=A0=C2=A0=C2=A0 (save-excursion
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (goto-char beg)
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-babel-do-in-edit-buffer
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (comment-or-uncomment-region (point) (+ offset (point))))))
#+= end_src

the value of `offset` is wrong, it became `Expected_Value +<= br>Max_Common_Indent * Lines_To_Comment`, in the example which is 8 chars m= ore
than expected.


Thanks.


--00000000000000f8c506236426bb--