emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] org-comment-dwim comments some chars in the unselected line below


From: Stephanus Comnenus
Subject: [BUG] org-comment-dwim comments some chars in the unselected line below
Date: Tue, 1 Oct 2024 14:08:10 +0800

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]