- (when (setq inv (overlay-get ol 'invisible))
- (when (or (overlay-get ol 'isearch-open-invisible)
- (and (consp buffer-invisibility-spec)
- (assq inv buffer-invisibility-spec)))
- (overlay-put ol 'reveal-invisible inv)
- (overlay-put ol 'invisible nil)
- (when (setq open (get inv 'reveal-toggle-invisible))
+ (let ((open (overlay-get ol 'reveal-toggle-invisible)))
+ (when (or open
+ (let ((inv (overlay-get ol 'invisible)))
+ (and inv (symbolp inv)
+ (or (setq open (or (get inv 'reveal-toggle-invisible)
+ (get ol 'isearch-open-invisible-temporary)))
+ (overlay-get ol 'isearch-open-invisible)
+ (and (consp buffer-invisibility-spec)
+ (assq inv buffer-invisibility-spec)))
+ (overlay-put ol 'reveal-invisible inv))))
+ (if (null open)
+ (overlay-put ol 'invisible nil)