unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7101: Please reveal-mode, don't hide my overlays!
@ 2010-09-25 13:23 Lennart Borgman
  2010-09-25 20:57 ` Lennart Borgman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lennart Borgman @ 2010-09-25 13:23 UTC (permalink / raw)
  To: 7101

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

Am I the only one that gets crazy when reveal hides the overlays
again? At least I mostly find it very frustrating when moving around
in a buffer that uses org-mode.

I can see it is useful sometimes though I do not know how to best
separate those times when it is useful and when it is not. So I will
not try that.

Instead in the attached patch I made the automatic hiding optional and
add a new command for hiding

[-- Attachment #2: reveal-dont-hide.diff --]
[-- Type: application/octet-stream, Size: 1349 bytes --]

=== modified file 'lisp/reveal.el'
--- trunk/lisp/reveal.el	2010-03-12 17:47:22 +0000
+++ patched/lisp/reveal.el	2010-09-25 13:22:19 +0000
@@ -56,6 +56,11 @@
   :type 'boolean
   :group 'reveal)
 
+(defcustom reveal-auto-close nil
+  "Close revealed overlays when leaving them."
+  :type 'boolean
+  :group 'reveal)
+
 (defvar reveal-open-spots nil
   "List of spots in the buffer which are open.
 Each element has the form (WINDOW . OVERLAY).")
@@ -92,7 +97,8 @@
                           (cdr x))))
                       reveal-open-spots))))
           (setq old-ols (reveal-open-new-overlays old-ols))
-          (reveal-close-old-overlays old-ols))
+          (when reveal-auto-close
+            (reveal-close-old-overlays old-ols)))
       (error (message "Reveal: %s" err)))))
 
 (defun reveal-open-new-overlays (old-ols)
@@ -180,6 +186,14 @@
                 (delq (rassoc ol reveal-open-spots)
                       reveal-open-spots)))))))
 
+(defun reveal-close-revealed ()
+  "Close revealed overlays.
+This does not close the overlay where point is in the selected
+window."
+  (interactive)
+  (let ((reveal-auto-close t))
+    (reveal-post-command)))
+
 (defvar reveal-mode-map
   (let ((map (make-sparse-keymap)))
     ;; Override the default move-beginning-of-line and move-end-of-line


^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7101: Please reveal-mode, don't hide my overlays!
  2010-09-25 13:23 bug#7101: Please reveal-mode, don't hide my overlays! Lennart Borgman
@ 2010-09-25 20:57 ` Lennart Borgman
  2010-10-07 10:23 ` Stefan Monnier
  2020-09-19 15:46 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2010-09-25 20:57 UTC (permalink / raw)
  To: 7101

> Instead in the attached patch I made the automatic hiding optional and
> add a new command for hiding

If this is accepted then please also change the default of
reveal-at-mark to nil since that seems to be a more useful default
then.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7101: Please reveal-mode, don't hide my overlays!
  2010-09-25 13:23 bug#7101: Please reveal-mode, don't hide my overlays! Lennart Borgman
  2010-09-25 20:57 ` Lennart Borgman
@ 2010-10-07 10:23 ` Stefan Monnier
  2010-10-07 10:33   ` Lennart Borgman
  2020-09-19 15:46 ` Lars Ingebrigtsen
  2 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2010-10-07 10:23 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7101

> Am I the only one that gets crazy when reveal hides the overlays
> again? At least I mostly find it very frustrating when moving around
> in a buffer that uses org-mode.

I love this feature, since it lets me open&close things without ever
having to remember a keybinding: I hide everything in the major mode
hook and then use reveal-mode to hide&show.

> I can see it is useful sometimes though I do not know how to best
> separate those times when it is useful and when it is not. So I will
> not try that.

> Instead in the attached patch I made the automatic hiding optional and
> add a new command for hiding

Maybe I could live with that, and I think it's going in the right
direction (e.g. the reveal-close-revealed functionality sounds good),
but I don't think having it as a defcustom is right: it's something
you'll likely want to change dynamically at run time.

One thing I've considered is to add a "keep-pos/region-shown" command that
would mark the current buffer position (or region) as something that
should stay revealed, so it won't be auto-closed when you move elsewhere.
Of course, it would want to come with something like
reveal-close-revealed to later re-hide them.

Another thing I'd be interested to see is a hook that major/minor modes
can use to have some control over showing/hiding.  The main such use for
me would be to let smerge-mode teach reveal-mode that if one conflict
marker is revealed, all the corresponding markers should also be
revealed (or maybe just: if part of a conflict is revealed, always
reveal the whole conflict).


        Stefan







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7101: Please reveal-mode, don't hide my overlays!
  2010-10-07 10:23 ` Stefan Monnier
@ 2010-10-07 10:33   ` Lennart Borgman
  0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2010-10-07 10:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7101

On Thu, Oct 7, 2010 at 12:23 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> Am I the only one that gets crazy when reveal hides the overlays
>> again? At least I mostly find it very frustrating when moving around
>> in a buffer that uses org-mode.
>
> I love this feature, since it lets me open&close things without ever
> having to remember a keybinding: I hide everything in the major mode
> hook and then use reveal-mode to hide&show.
>
>> I can see it is useful sometimes though I do not know how to best
>> separate those times when it is useful and when it is not. So I will
>> not try that.
>
>> Instead in the attached patch I made the automatic hiding optional and
>> add a new command for hiding
>
> Maybe I could live with that, and I think it's going in the right
> direction (e.g. the reveal-close-revealed functionality sounds good),
> but I don't think having it as a defcustom is right: it's something
> you'll likely want to change dynamically at run time.


Maybe it should be buffer local most of the time and take default
value from a defcustom?

I wonder whether searching should be made a special case here? I
prefer to see my hits when searching (at least around point), but if
it is the wrong place then I might want to close the revealed overlay
immediately. How about something like that?


> One thing I've considered is to add a "keep-pos/region-shown" command that
> would mark the current buffer position (or region) as something that
> should stay revealed, so it won't be auto-closed when you move elsewhere.
> Of course, it would want to come with something like
> reveal-close-revealed to later re-hide them.


It is similar to my idea above. I think my idea above could be
implemented with something like that.


> Another thing I'd be interested to see is a hook that major/minor modes
> can use to have some control over showing/hiding.  The main such use for
> me would be to let smerge-mode teach reveal-mode that if one conflict
> marker is revealed, all the corresponding markers should also be
> revealed (or maybe just: if part of a conflict is revealed, always
> reveal the whole conflict).


Could also be implemented with the above ideas.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7101: Please reveal-mode, don't hide my overlays!
  2010-09-25 13:23 bug#7101: Please reveal-mode, don't hide my overlays! Lennart Borgman
  2010-09-25 20:57 ` Lennart Borgman
  2010-10-07 10:23 ` Stefan Monnier
@ 2020-09-19 15:46 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-19 15:46 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7101, Stefan Monnier

Lennart Borgman <lennart.borgman@gmail.com> writes:

> Am I the only one that gets crazy when reveal hides the overlays
> again? At least I mostly find it very frustrating when moving around
> in a buffer that uses org-mode.
>
> I can see it is useful sometimes though I do not know how to best
> separate those times when it is useful and when it is not. So I will
> not try that.
>
> Instead in the attached patch I made the automatic hiding optional and
> add a new command for hiding

I've reworked your patch a bit (avoiding terms like "close" and
"overlay") and applied it to Emacs 28.

Stefan was concerned that having just a defcustom wouldn't be enough
here -- that auto-reveal should/could be done via a command.  That's a
good point, but I think it's quite likely that people that prefer to
have this off will set the variable from a mode hook or something, so I
think the variable itself is useful.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-19 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-25 13:23 bug#7101: Please reveal-mode, don't hide my overlays! Lennart Borgman
2010-09-25 20:57 ` Lennart Borgman
2010-10-07 10:23 ` Stefan Monnier
2010-10-07 10:33   ` Lennart Borgman
2020-09-19 15:46 ` Lars Ingebrigtsen

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).