auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] Preview: Toggling all previews' visibility on/off at once?


From: David Kastrup
Subject: Re: [AUCTeX] Preview: Toggling all previews' visibility on/off at once?
Date: Thu, 20 Aug 2015 21:19:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

address@hidden writes:

> On 150820 Thu 9:00, David Kastrup wrote:
>
>> I tend to right-click on the preview, copy the preview content and paste
>> it above where I am editing.  Cleaning up afterwards is also easy with
>> the mouse (two right mouse clicks in a row delete the current mouse
>> selection).
>>
>> That is not to say that the requested feature wouldn't be useful,
>> particularly for a keyboard-centric workflow.
>>
>
>
> Thank you for the feedback & tip, David. In my case I often need only
> to take a peek at the code of some previous formula, eg to see which
> macro I used to produce a particular symbol (I have a very short
> memory). That's why to push only a button to quickly toggle on/off
> would be useful.

Several other options come to mind, like a mode where mouse-over removes
the preview.  Or two parallel (synchronized?) windows where one is
without previews (that's only possible on Emacs rather than XEmacs since
one can restrict overlays to show only on a particular window).

> As a temporary solution I'm making a function that does a backward or
> forward regexp-search to the beginning of any inline or display math
> (like "\\begin{\(eq\|al\|ga\)" or "\\(" etc), so as to automatically
> toggle the preview as the search cycles. This way I can cyclically
> open them and come back at point by quitting the search.

On Emacs, I think that you could use

(preview-open-overlays (overlays-in BEG END))

Preview overlays should have a non-nil state of the 'preview-state
property, and there also is
preview-toggle is a compiled Lisp function in ‘prv-emacs.el’.

(preview-toggle OV &optional ARG EVENT)

Toggle visibility of preview overlay OV.
ARG can be one of the following: t displays the overlay,
nil displays the underlying text, and 'toggle toggles.
If EVENT is given, it indicates the window where the event
occured, either by being a mouse event or by directly being
the window in question.  This may be used for cursor restoration
purposes.


So filtering the output of overlays-at (possibly given window-start and
window-end ?) for preview overlays and then calling preview-toggle with
some settings on all of them should be reasonably simple.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]