From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: awesome feature (yet to be added?) Date: Fri, 30 May 2014 21:30:39 -0400 Message-ID: References: <112075085.1028629.1399142864865.open-xchange@email.1and1.com> <53684CB6.1050601@lanl.gov> <87ppivne52.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1401499867 12374 80.91.229.3 (31 May 2014 01:31:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 May 2014 01:31:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thorsten Jolitz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 31 03:31:00 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WqY8S-0003vE-4O for ged-emacs-devel@m.gmane.org; Sat, 31 May 2014 03:31:00 +0200 Original-Received: from localhost ([::1]:57288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqY8R-0002MD-PO for ged-emacs-devel@m.gmane.org; Fri, 30 May 2014 21:30:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqY8H-0002Ly-BM for emacs-devel@gnu.org; Fri, 30 May 2014 21:30:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqY89-0000Ai-SI for emacs-devel@gnu.org; Fri, 30 May 2014 21:30:49 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:36237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqY89-0000AS-O7 for emacs-devel@gnu.org; Fri, 30 May 2014 21:30:41 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVPO+IOj/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIYEsJA X-IPAS-Result: ArUGAIDvNVPO+IOj/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIYEsJA X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="65128480" Original-Received: from 206-248-131-163.dsl.teksavvy.com (HELO pastel.home) ([206.248.131.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 30 May 2014 21:30:39 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 8922E602E6; Fri, 30 May 2014 21:30:39 -0400 (EDT) In-Reply-To: <87ppivne52.fsf@gmail.com> (Thorsten Jolitz's message of "Fri, 30 May 2014 23:35:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:172202 Archived-At: > 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