[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] Incorrect application of 'comment-region' in code blocks
From: |
Ihor Radchenko |
Subject: |
Re: [BUG] Incorrect application of 'comment-region' in code blocks |
Date: |
Sat, 13 Jul 2024 16:15:44 +0000 |
the_wurfkreuz <the_wurfkreuz@proton.me> writes:
> I don't really know for sure what exactly i should do.
> I cloned the repo 'git clone
> https://git.savannah.gnu.org/git/emacs/org-mode.git'.
> Created minimal config ~/minimal_config.el:
>
> (require 'org)
> (setq initial-major-mode 'org-mode)
>
> Created the repro file /tmp/bug.org.
> Then from the cloned directory i did this:
>
> make repro REPRO_ARGS="-l ~/minimal_config.el /tmp/bug.org"
>
> Then i made the action that produces the bug and i got it.
Confirmed.
It was important that src block code should be indented.
The culprit is that `org-comment-or-uncomment-region' assumes that the
region size will remain unchanged when in Org src buffer. It is not true
when the code in Org mode is indented.
> #+begin_src emacs-lisp
>
> ;; (with-eval-after-load 'evil
> ;; (define-key evil-insert-state-map (kbd "C-S-v") 'yank)
> ;; (define-key evil-visual-state-map (kbd "{") 'evil-backward-paragraph)
> ;; (define-key evil-visual-state-map (kbd "}") 'evil-forward-paragraph)
> ;; (define-key evil-insert-state-map (kbd "M-w") 'evil-forward-word-begin)
> ;; (define-key evil-insert-state-map (kbd "M-b")
> 'evil-backward-word-begin)
> ;; (define-key evil-insert-state-map (kbd "M-W") 'evil-forward-WORD-begin)
> ;; (define-key evil-insert-state-map (kbd "M-B")
> 'evil-backward-WORD-begin)
>
> ;; (define-key e
> vil-normal-state-map (kbd "gq") 'FormatToThreshold)
> (define-key evil-visual-state-map (kbd "gq") 'FormatToThreshold))
>
> (defun my-move-beginning-of-line ()
> "Move point to the first non-whitespace character of the line and enter
> insert mode."
> (interactive)
> (evil-first-non-blank)
> (evil-insert-state))
>
> #+end_src
>
> (with-eval-after-load 'evil
> (define-key evil-insert-state-map (kbd "C-S-v") 'yank)
> (define-key evil-visual-state-map (kbd "{") 'evil-backward-paragraph)
> (define-key evil-visual-state-map (kbd "}") 'evil-forward-paragraph)
> (define-key evil-insert-state-map (kbd "M-w") 'evil-forward-word-begin)
> (define-key evil-insert-state-map (kbd "M-b") 'evil-backward-word-begin)
> (define-key evil-insert-state-map (kbd "M-W") 'evil-forward-WORD-begin)
> (define-key evil-insert-state-map (kbd "M-B") 'evil-backward-WORD-begin)
>
> (define-key evil-normal-state-map (kbd "gq") 'FormatToThreshold)
> (define-key evil-visual-state-map (kbd "gq") 'FormatToThreshold))
>
> (defun my-move-beginning-of-line ()
> "Move point to the first non-whitespace character of the line and enter
> insert mode."
> (interactive)
> (evil-first-non-blank)
> (evil-insert-state))
--
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>