From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ralf Angeli Newsgroups: gmane.emacs.devel Subject: Re: [reveal-mode] Hiding short expressions Date: Sat, 03 Jul 2004 14:07:09 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088856922 30923 80.91.224.253 (3 Jul 2004 12:15:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 3 Jul 2004 12:15:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Jul 03 14:15:16 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BgjQK-00011L-00 for ; Sat, 03 Jul 2004 14:15:16 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BgjQK-0005Hd-00 for ; Sat, 03 Jul 2004 14:15:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BgjSB-0003gU-NA for emacs-devel@quimby.gnus.org; Sat, 03 Jul 2004 08:17:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BgjNG-0001CW-FA for emacs-devel@gnu.org; Sat, 03 Jul 2004 08:12:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BgjMH-0000eT-Av for emacs-devel@gnu.org; Sat, 03 Jul 2004 08:11:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BgjJs-0007qX-Pw for emacs-devel@gnu.org; Sat, 03 Jul 2004 08:08:37 -0400 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BgjHz-000767-Oz for emacs-devel@gnu.org; Sat, 03 Jul 2004 08:06:40 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BgjHy-0000DP-00 for ; Sat, 03 Jul 2004 14:06:38 +0200 Original-Received: from du-006-097.access.de.clara.net ([212.82.229.97]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Jul 2004 14:06:38 +0200 Original-Received: from angeli by du-006-097.access.de.clara.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Jul 2004 14:06:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-To: emacs-devel@gnu.org Original-Lines: 72 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: du-006-097.access.de.clara.net Mail-Copies-To: nobody User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:wr/3NShBNh7BvyqVUBW7pP0NtFU= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25409 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25409 * Stefan (2004-07-02) writes: >> currently I am trying to make use of reveal-mode for hiding and >> revealing \footnote{...} expressions in Emacs. Now the problem is >> that visible expressions under the control of reveal-mode only get >> hidden if the cursor moves before the beginning of the line with the >> expression or past its end. If you have short expressions within a >> line it would be nice if the expression became invisible as soon as >> the cursor moves out of it. > >> Are there any reasons why this is not handled like this in reveal.el >> and would it be possible to change it if there aren't any? [...] > The behavior you seem to want is actually simpler than the current > behavior (in other words, I first implemented the behavior you want and > then added code to keep the overlays open even after the cursor moves out > of the overlay), and it should be easy to change the code such that you can > choose between different behaviors. One could add a variable which lets you choose what behavior is used. But if you wanted to use outline-minor-mode and hiding of footnotes at the same time in a latex-mode or LaTeX-mode buffer, it would probably be better to choose the behavior depending on a special attribute of the overlays. This could be done e.g. by adding a 'reveal-close attribute to the 'category property of the overlay: (put 'some-category 'reveal-close 'on-cursor-out) (overlay-put ov 'category 'some-category) Then this gets checked in reveal.el: --8<---------------cut here---------------start------------->8--- --- /usr/local/share/emacs/21.3.50/lisp/reveal.el 2004-07-02 22:08:23.000000000 +0200 +++ reveal.el 2004-07-03 12:44:47.000000000 +0200 @@ -116,12 +116,20 @@ (dolist (ol old-ols) (when (and (eq (current-buffer) (overlay-buffer ol)) (not (rassq ol reveal-open-spots))) - (if (and (>= (point) (save-excursion - (goto-char (overlay-start ol)) - (line-beginning-position 1))) - (<= (point) (save-excursion - (goto-char (overlay-end ol)) - (line-beginning-position 2)))) + (if (and (>= (point) + (if (eq (get (overlay-get ol 'category) 'reveal-close) + 'on-cursor-out) + (overlay-start ol) + (save-excursion + (goto-char (overlay-start ol)) + (line-beginning-position 1)))) + (<= (point) + (if (eq (get (overlay-get ol 'category) 'reveal-close) + 'on-cursor-out) + (overlay-end ol) + (save-excursion + (goto-char (overlay-end ol)) + (line-beginning-position 2))))) ;; Still near the overlay: keep it open. (push (cons (selected-window) ol) reveal-open-spots) ;; Really close it. --8<---------------cut here---------------end--------------->8--- How does this look like? I am considering to add some code to AUCTeX in order to support hiding of LaTeX macros with reveal-mode. (This hasn't been discussed yet on the AUCTeX mailing list, though.) So it would be nice if the above or something similar could be integrated into Emacs. -- Ralf