From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: Is there a save-outline-visibility excursion or so? Date: Wed, 22 May 2013 18:09:24 +0530 Message-ID: <87txlvyyrn.fsf@gmail.com> References: <877gircr8b.fsf@gmail.com> <87sj1ffk53.fsf@gmail.com> <87y5b7b9c1.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369226400 21239 80.91.229.3 (22 May 2013 12:40:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 May 2013 12:40:00 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thorsten Jolitz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 22 14:39:59 2013 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 1Uf8Kf-0004tK-Pp for geh-help-gnu-emacs@m.gmane.org; Wed, 22 May 2013 14:39:53 +0200 Original-Received: from localhost ([::1]:57921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8Ke-0000tP-DE for geh-help-gnu-emacs@m.gmane.org; Wed, 22 May 2013 08:39:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8KN-0000tH-JN for help-gnu-emacs@gnu.org; Wed, 22 May 2013 08:39:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uf8KL-0002Vc-WD for help-gnu-emacs@gnu.org; Wed, 22 May 2013 08:39:35 -0400 Original-Received: from mail-pa0-f51.google.com ([209.85.220.51]:43291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8KL-0002VK-O3 for help-gnu-emacs@gnu.org; Wed, 22 May 2013 08:39:33 -0400 Original-Received: by mail-pa0-f51.google.com with SMTP id lf10so730060pab.10 for ; Wed, 22 May 2013 05:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=mmq1z5Yb/ew99nVaMr+dWZZZFIRq84/w3UHT+akDTXQ=; b=dUnS0ku36hMHLP4VrCmVuMMIuz+Z9lgc9nWz1P8OA/a7eA/q/3ZX+Hc5L/ukqIoVf8 oMPK+nT0y5XP9qEUGYtZbO65Q96WZnMXfFEzgaueGOY3J08MPcnjWO4APUvFnmyswalN O2ddG+LRyUZCTXic6V2y3+9lfPnUrfrhsU6uK+mfw9esUsj4gfE8ZCEH/X3BVrvZmlKM 2zBQwWW4GkO0B+GpQMw4cW4EKuj8/W6XwwSCCynCg7K9pPuI/DJ8xOHOXExgYg4WfGle X5OarJgYEasOsKe3zFfvdm+ztsyaznH2apyVoMbBqlkrt0xe/Xzr4nwRejS9YRj+wno7 oZ5A== X-Received: by 10.66.163.5 with SMTP id ye5mr8062004pab.60.1369226372950; Wed, 22 May 2013 05:39:32 -0700 (PDT) Original-Received: from debian-6.05 ([115.242.239.102]) by mx.google.com with ESMTPSA id ri8sm7147843pbc.3.2013.05.22.05.39.29 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 22 May 2013 05:39:32 -0700 (PDT) In-Reply-To: <87y5b7b9c1.fsf@gmail.com> (Thorsten Jolitz's message of "Wed, 22 May 2013 12:25:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.51 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:90979 Archived-At: Thorsten Jolitz writes: > Jambunathan K writes: > >> C-h f save-restriction >> >> You will find plenty of examples in Orgmode codebase. > > Well, I tried it out, and in this case it does not really reset the > buffer to its original (partly folded) visibility state, but rather > leaves it in show-all state. So I guess narrowing/widening and > outline-visibility changes are, at least at this level, not the same. Mmmm. Restriction apparently applies to (virtual) bounds of the buffer - beg and end positions and has nothing to do with invisibility. ---------------------------------------------------------------- You may find it easier to work with `make-indirect-buffer' and `clone-indirect-buffer' (See Elisp manual). (I think) In the first case, the indirect buffer starts with no overlays. In the second case, the indirect buffer starts with same *overlay values* as the first one. You can see that any visibility operation on the indirect buffer doesn't affect the visibility of the original buffer. ---------------------------------------------------------------- If you lookup the `org-export--generate-copy-script', towards the end of that defun you will see a snippet like this. ,---- | ;; Overlays with invisible property. | ,@(let (ov-set) | (mapc | (lambda (ov) | (let ((invis-prop (overlay-get ov 'invisible))) | (when invis-prop | (push `(overlay-put | (make-overlay ,(overlay-start ov) | ,(overlay-end ov)) | 'invisible (quote ,invis-prop)) | ov-set)))) | (overlays-in (point-min) (point-max))) | ov-set) `---- Visibility is controlled by `buffer-invisibility-spec'. This should be a good starting point.