Le 04/03/25 à 10h48, David Masterson a écrit :

> 2. When you select the region, where is the cursor? 

Let me answer this question first: in my above experiment, the cursor is
at the very beginning of the 4th line.

> 1. What's the difference between comment-region and comment-line?

- With the cursor as above, with:
  - comment-region, the result is (without indentation):
      #+BEGIN_SRC emacs-lisp
        ;; (defun org-xor (a b)
        ;;   "Exclusive or."
        ;;   (i
           f a (not b) b))
      #+END_SRC
  - comment-line, the result is (without indentation):
      #+BEGIN_SRC emacs-lisp
        ;; (defun org-xor (a b)
        ;;   "Exclusive or."
        ;;   (if a (not b) b))
      #+END_SRC
- With the cursor at the end of the 3rd line, both with comment-region
  and comment-line, the result is (without indentation):
    #+BEGIN_SRC emacs-lisp
      ;; (defun org-xor (a b)
      ;;   "Exclusive or."
      ;;   (
         if a (not b) b))
    #+END_SRC

> I think comment-region, like comment-line, considers the cursor to be
> part of what is being asked to be commented.

In fact, sorry, I mixed comment-region and comment-dwim: I don't know
what was the previous behavior of comment-region and comment-line but
the change I observe concerns comment-dwim.

And, regarding comment-dwim, with the cursor:

- at the beginning of the 4th line, the result is (without indentation): 
    #+BEGIN_SRC emacs-lisp
      ;; (defun org-xor (a b)
      ;;   "Exclusive or."
      ;;   (i
         f a (not b) b))
    #+END_SRC
- at the end of the 3rd line, the result is (without indentation):
    #+BEGIN_SRC emacs-lisp
      ;; (defun org-xor (a b)
      ;;   "Exclusive or."
      ;;   (
         if a (not b) b))
    #+END_SRC
-- 
Denis

Reply via email to