* [BUG] org-comment-dwim comments some chars in the unselected line below
@ 2024-09-30 13:30 Steven Lin
2024-10-12 8:58 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Steven Lin @ 2024-09-30 13:30 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 3244 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [BUG] org-comment-dwim comments some chars in the unselected line below
@ 2024-10-01 6:08 Stephanus Comnenus
2024-10-12 8:55 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Stephanus Comnenus @ 2024-10-01 6:08 UTC (permalink / raw)
To: emacs-orgmode; +Cc: yantar92
[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 2476 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] org-comment-dwim comments some chars in the unselected line below
2024-10-01 6:08 [BUG] org-comment-dwim comments some chars in the unselected line below Stephanus Comnenus
@ 2024-10-12 8:55 ` Ihor Radchenko
0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-10-12 8:55 UTC (permalink / raw)
To: Stephanus Comnenus; +Cc: emacs-orgmode
Stephanus Comnenus <linjt267@gmail.com> writes:
> 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
> ...
> Got:
>
> #+begin_src emacs-lisp
> ;; (setq foo 1)
> ;; (setq bar 2)
> ;; (setq bu
> z 3)
> #+end_src
Thanks for reporting!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=19d462e7a7
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] org-comment-dwim comments some chars in the unselected line below
2024-09-30 13:30 Steven Lin
@ 2024-10-12 8:58 ` Ihor Radchenko
0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-10-12 8:58 UTC (permalink / raw)
To: Steven Lin; +Cc: emacs-orgmode@gnu.org
Steven Lin <linjt267@outlook.com> writes:
> Hi.
>
> I found that commit
> 1014296344a75fa08e0a8814e4fbbd767e7eba4c brought some bugs.
>
> Step to reproduce (In vanilla Emacs, with latest org-mode):
> ...
Duplicate of
https://orgmode.org/list/CAHqtn=fWq6E5_pm72AB9vFxwjS0a8ma=UvVjMrgeivE9pa13ZQ@mail.gmail.com
Fixed.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-12 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 6:08 [BUG] org-comment-dwim comments some chars in the unselected line below Stephanus Comnenus
2024-10-12 8:55 ` Ihor Radchenko
-- strict thread matches above, loose matches on Subject: below --
2024-09-30 13:30 Steven Lin
2024-10-12 8:58 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.