help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comments within Org src block move point unexpectedly


From: Jean Louis
Subject: Re: Comments within Org src block move point unexpectedly
Date: Sun, 11 Apr 2021 00:34:13 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* excalamus@tutanota.com <excalamus@tutanota.com> [2021-04-10 23:31]:

(defun my-comment-line ()
  (interactive)
  (comment-region (point-at-bol) (point-at-eol)))

It should be as above. To me it just comments the line and cursor
remains where it is on specific letter. I am using Emacs development version. 

>  Are you executing it with org-mode enabled?  (I failed to mention that in my 
> original email and specified it in my follow up.  Please excuse me!)

Good question, in Org mode it does not work as expected, cursor
jumps. But then, I have this workaround:

(defun my-comment-line ()
  (interactive)
  (major-mode-suspend)
  (emacs-lisp-mode)
  (comment-region (point-at-bol) (point-at-eol))
  (major-mode-restore))

As that way, when you are in Org mode and wish to comment Emacs Lisp
mode, Org mode will be suspended, you finish commenting, and it will
be restored in a breeze withou cursor jumping.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://rms-support-letter.github.io/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]