From: Ralf Angeli <angeli@iwi.uni-sb.de>
Subject: Re: [reveal-mode] Hiding short expressions
Date: Sat, 03 Jul 2004 14:07:09 +0200 [thread overview]
Message-ID: <cc67gb$t3i$1@sea.gmane.org> (raw)
In-Reply-To: m17jtm3xm5.fsf-monnier+emacs@gnu.org
* 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
next prev parent reply other threads:[~2004-07-03 12:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-02 21:05 [reveal-mode] Hiding short expressions Ralf Angeli
2004-07-02 21:37 ` Stefan
2004-07-03 12:07 ` Ralf Angeli [this message]
2004-07-03 17:01 ` Stefan
2004-07-03 18:03 ` Ralf Angeli
2004-07-03 18:56 ` Stefan
2004-07-03 19:26 ` Ralf Angeli
2004-07-06 19:07 ` Kevin Rodgers
2004-07-06 19:34 ` Ralf Angeli
2004-07-06 19:56 ` David Kastrup
2004-07-07 13:32 ` Stefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='cc67gb$t3i$1@sea.gmane.org' \
--to=angeli@iwi.uni-sb.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).