unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: excalamus@tutanota.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Comments within Org src block move point unexpectedly
Date: Sun, 11 Apr 2021 00:34:13 +0300	[thread overview]
Message-ID: <YHIZ1XsPS85vbsdK@protected.localdomain> (raw)
In-Reply-To: <MXxTlwx--3-2@tutanota.com>

* 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	other threads:[~2021-04-10 21:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 13:13 Comments within Org src block move point unexpectedly excalamus--- via Users list for the GNU Emacs text editor
2021-04-09 13:27 ` excalamus--- via Users list for the GNU Emacs text editor
2021-04-09 14:27 ` Jean Louis
2021-04-10 20:31   ` excalamus--- via Users list for the GNU Emacs text editor
2021-04-10 21:34     ` Jean Louis [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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHIZ1XsPS85vbsdK@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=excalamus@tutanota.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).