From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Ihm Subject: Small code fragment to make zone-mode play well with org Date: Tue, 8 Aug 2017 19:02:32 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df7u6-0000Hj-0u for emacs-orgmode@gnu.org; Tue, 08 Aug 2017 13:02:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1df7u1-0001rw-Uv for emacs-orgmode@gnu.org; Tue, 08 Aug 2017 13:02:50 -0400 Received: from [195.159.176.226] (port=56766 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1df7u1-0001rf-Nu for emacs-orgmode@gnu.org; Tue, 08 Aug 2017 13:02:45 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1df7tr-00051V-DH for emacs-orgmode@gnu.org; Tue, 08 Aug 2017 19:02:35 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hi, with the fragment below in my startup-file, zone-mode handles hidden text correctly (does not reveal it) and thus plays well with orgmode. (Of course the correct way to handle this would be to create a proper patch for zone.el instead of fixing this locally; but I am sending it here anyway: maybe someone has commit-rights to emacs core itself ...) best regards Marc Ihm (advice-add 'zone :around (lambda (orig-fun &rest args) (interactive) (let (result text name) (when (string= major-mode "org-mode") (setq text (org-copy-visible (window-start) (window-end))) (setq name (generate-new-buffer-name (buffer-name))) (switch-to-buffer (get-buffer-create name)) (erase-buffer) (insert text)) (setq result (apply orig-fun args)) (if name (kill-buffer name)) result)))