From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.help Subject: Re: Arbitrary folding in emacs Date: Sun, 30 Mar 2014 12:19:38 +0200 Message-ID: <8738i09ef9.fsf@yahoo.fr> References: <834n2iy9dz.fsf@gnu.org> <83ob0qslyi.fsf@gnu.org> <87bnwqa4qt.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1396174818 16168 80.91.229.3 (30 Mar 2014 10:20:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Mar 2014 10:20:18 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 30 12:20:12 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1WUCqZ-00066H-Tb for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Mar 2014 12:20:12 +0200 Original-Received: from localhost ([::1]:43605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUCqZ-0005s0-EG for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Mar 2014 06:20:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUCqH-0005kQ-CG for help-gnu-emacs@gnu.org; Sun, 30 Mar 2014 06:19:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUCqB-00018w-GK for help-gnu-emacs@gnu.org; Sun, 30 Mar 2014 06:19:53 -0400 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:45915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUCqB-00018h-9y for help-gnu-emacs@gnu.org; Sun, 30 Mar 2014 06:19:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAH3vN1OkD4Xx/2dsb2JhbABZxymBJHSCJgEBBHkQCAMhJQ8BBEkTh2QBFK9KmVoBiAYXh2+HEAeEOAEDmE6GNot/gzI7 Original-Received: from mathsrv4.ulb.ac.be (HELO geodiff-mac3) ([164.15.133.241]) by smtp.ulb.ac.be with ESMTP; 30 Mar 2014 12:19:18 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 28 Mar 2014 18:32:47 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 164.15.128.112 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96859 Archived-At: Stefan Monnier writes: > But obviously, it'll be a bit crude (e.g. no commands to unhide, tho you > might be able to use reveal-mode for that). Here's a "toggling" version : (defun my-toggle-hide-region (beg end) "Hide region. Unless it contains already hidden text, then show it." (interactive "r") (let ((has-invisible-p (catch 'invisible (dolist (ov (overlays-in beg end)) (when (eq 'outline (overlay-get ov 'invisible)) (throw 'invisible t)))))) (outline-flag-region beg end (not has-invisible-p)))) -- Nico.