* [BUG] Incorrect application of 'comment-region' in code blocks
@ 2024-07-13 7:32 the_wurfkreuz
2024-07-13 13:29 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: the_wurfkreuz @ 2024-07-13 7:32 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1.1: Type: text/plain, Size: 3942 bytes --]
Reproduction:
1. emacs -Q
2. Enable org-mode in the scratch buffer (M-x org-mode)
3. Paste this code:
#+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 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))
#+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))
4. Highlight the first code paragrapth in the org code block:
(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)
5. Execute 'comment-region'. It will apply partial commenting on the
next line like this:
;; (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)
6. Now apply highlighting and comment the same code, but outside of the
org code block, and the end result will be correct:
# (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)
Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
of 2024-04-23
Package: Org mode version 9.8-pre (release_9.7.6-101-g4f6aab @ /home/wurfkreuz/.emacs.d/straight/build/org/)
[-- Attachment #1.2: Type: text/html, Size: 6773 bytes --]
[-- Attachment #2: emacs1.png --]
[-- Type: image/png, Size: 48674 bytes --]
[-- Attachment #3: emacs2.png --]
[-- Type: image/png, Size: 46624 bytes --]
[-- Attachment #4: emacs3.png --]
[-- Type: image/png, Size: 102469 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-13 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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.