emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Steven Lin <linjt267@outlook.com>
To: jschmidt4gnu@vodafonemail.de
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-comment-dwim does not work with temporary Transient Mark mode [9.7-pre (release_9.6.10-902-g41ff56 @ /home/jschmidt/work/org-mode/lisp/)]
Date: Mon, 30 Sep 2024 20:41:47 +0800	[thread overview]
Message-ID: <OSZPR01MB87049CFAE08A7446D90A1D409A762@OSZPR01MB8704.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <d8dc0cca-00d9-4349-a123-6ea6776b00cc@vodafonemail.de>

I found that current bugfix (commit 
1014296344a75fa08e0a8814e4fbbd767e7eba4c) brought new bugs.

Step to reproduce:

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.




      parent reply	other threads:[~2024-10-01 15:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 19:30 [BUG] org-comment-dwim does not work with temporary Transient Mark mode [9.7-pre (release_9.6.10-902-g41ff56 @ /home/jschmidt/work/org-mode/lisp/)] Jens Schmidt
2023-11-06  9:18 ` Ihor Radchenko
2024-09-30 12:41 ` Steven Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OSZPR01MB87049CFAE08A7446D90A1D409A762@OSZPR01MB8704.jpnprd01.prod.outlook.com \
    --to=linjt267@outlook.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).