From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Thorsten Jolitz <tjolitz@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: awesome feature (yet to be added?)
Date: Fri, 30 May 2014 21:30:39 -0400 [thread overview]
Message-ID: <jwv1tvaeobv.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ppivne52.fsf@gmail.com> (Thorsten Jolitz's message of "Fri, 30 May 2014 23:35:37 +0200")
> Emacs. My use case is outorg.el that converts programming language buffers
> (structured the outshine way, i.e. with outcommented Org-mode headers)
> temporarily to org-mode for text editing and then back to the
> programming major-mode.
After uncommenting, how do you know which lines should be recommented?
Do you remember them in some variable? Or do you wrap the code parts in
those (ugly) +begin...+end "brackets"?
Do you uncomment all comments, or only those that "look like Org stuff"?
> the original major-mode. I do this linewise, and in fact outorg can't
> handle those special multiline comments like in C or Java.
Why do it line-wise?
> A robust generic (= major-mode agnostic) `invert-comment' function as
> part of Emacs that knows how to handle multiline comments too would come
> very handy.
It looks like the exact meaning of such a function is slightly different
for every one, so such a function would need lots of hooks and config
vars to cover all cases.
But you can write your own function starting with
(defun my-uncomment-region (beg end)
(let (spt)
(while (and (< (point) end)
(setq spt (comment-search-forward end t)))
(let ((ept (progn
(goto-char spt)
(unless (or (comment-forward)
;; Allow non-terminated comments.
(eobp))
(error "Can't find the comment end"))
(point))))
(uncomment-region spt ept)))))
-- Stefan
next prev parent reply other threads:[~2014-05-31 1:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-03 18:47 awesome feature (yet to be added?) Bric
2014-05-04 1:23 ` Bric
2014-05-04 11:12 ` Stephen Berman
2014-05-04 18:33 ` Andreas Röhler
2014-05-06 2:32 ` Le Wang
2014-05-06 2:45 ` Davis Herring
2014-05-06 8:19 ` Stephen J. Turnbull
2014-05-06 22:27 ` Robert Thorpe
2014-05-30 21:35 ` Thorsten Jolitz
2014-05-31 1:30 ` Stefan Monnier [this message]
2014-05-31 10:46 ` Thorsten Jolitz
2014-06-09 11:01 ` Thorsten Jolitz
2014-06-09 15:30 ` Stefan Monnier
2014-05-31 6:26 ` Andreas Röhler
2014-05-31 10:52 ` Thorsten Jolitz
2014-05-31 17:20 ` Andreas Röhler
2014-05-31 20:04 ` Thorsten Jolitz
2014-06-01 7:00 ` Andreas Röhler
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv1tvaeobv.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=tjolitz@gmail.com \
/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 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.