emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: the_wurfkreuz <the_wurfkreuz@proton.me>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Incorrect application of 'comment-region' in code blocks
Date: Sat, 13 Jul 2024 16:15:44 +0000	[thread overview]
Message-ID: <87frsdp8sv.fsf@localhost> (raw)
In-Reply-To: <HCkTNlq00DJCqKYbN1PPA5smHPuiAmGGuHdg_PffhnW1JiIddRvs976pxnd2Sp2cVBE__yeAKlhzUTGuIUU-jubuN7Yb-rf54EAxPuouJ78=@proton.me>

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>


      parent reply	other threads:[~2024-07-13 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13  7:32 [BUG] Incorrect application of 'comment-region' in code blocks the_wurfkreuz
2024-07-13 13:29 ` Ihor Radchenko
     [not found]   ` <HCkTNlq00DJCqKYbN1PPA5smHPuiAmGGuHdg_PffhnW1JiIddRvs976pxnd2Sp2cVBE__yeAKlhzUTGuIUU-jubuN7Yb-rf54EAxPuouJ78=@proton.me>
2024-07-13 16:15     ` Ihor Radchenko [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=87frsdp8sv.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=the_wurfkreuz@proton.me \
    /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).