-;;; reveal.el --- Automatically reveal hidden text at point
+;;; reveal.el --- Automatically reveal hidden text at point -*- lexical-binding: t -*-
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2014 Free Software Foundation, Inc.
-;; Author: Stefan Monnier <monnier@cs.yale.edu>
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
;; Keywords: outlines
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(defgroup reveal nil
"Reveal hidden text on the fly."
- :group 'editing)
+ :group 'convenience)
(defcustom reveal-around-mark t
"Reveal text around the mark, if active."
;; - we only refresh spots in the current window.
;; FIXME: do we actually know that (current-buffer) = (window-buffer) ?
(with-local-quit
- (condition-case err
- (let ((old-ols
- (delq nil
- (mapcar
- (lambda (x)
- ;; We refresh any spot in the current window as well
- ;; as any spots associated with a dead window or
- ;; a window which does not show this buffer any more.
- (cond
- ((eq (car x) (selected-window)) (cdr x))
- ((not (and (window-live-p (car x))
- (eq (window-buffer (car x)) (current-buffer))))
- ;; Adopt this since it's owned by a window that's
- ;; either not live or at least not showing this
- ;; buffer any more.
- (setcar x (selected-window))
- (cdr x))))
- reveal-open-spots))))
- (setq old-ols (reveal-open-new-overlays old-ols))
- (reveal-close-old-overlays old-ols))
- (error (message "Reveal: %s" err)))))
+ (with-demoted-errors "Reveal: %s"
+ (let ((old-ols
+ (delq nil
+ (mapcar
+ (lambda (x)
+ ;; We refresh any spot in the current window as well
+ ;; as any spots associated with a dead window or
+ ;; a window which does not show this buffer any more.
+ (cond
+ ((eq (car x) (selected-window)) (cdr x))
+ ((not (and (window-live-p (car x))
+ (eq (window-buffer (car x)) (current-buffer))))
+ ;; Adopt this since it's owned by a window that's
+ ;; either not live or at least not showing this
+ ;; buffer any more.
+ (setcar x (selected-window))
+ (cdr x))))
+ reveal-open-spots))))
+ (setq old-ols (reveal-open-new-overlays old-ols))
+ (reveal-close-old-overlays old-ols)))))
(defun reveal-open-new-overlays (old-ols)
(let ((repeat t))
(let ((inv (overlay-get ol 'invisible)) open)
(when (and inv
;; There's an `invisible' property. Make sure it's
- ;; actually invisible, and ellipsised.
+ ;; actually invisible, and ellipsized.
(and (consp buffer-invisibility-spec)
(cdr (assq inv buffer-invisibility-spec)))
(or (setq open
;;;###autoload
(define-minor-mode reveal-mode
- "Toggle Reveal mode on or off.
-Reveal mode renders invisible text around point visible again.
+ "Toggle uncloaking of invisible text near point (Reveal mode).
+With a prefix argument ARG, enable Reveal mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+Reveal mode if ARG is omitted or nil.
-Interactively, with no prefix argument, toggle the mode.
-With universal prefix ARG (or if ARG is nil) turn mode on.
-With zero or negative ARG turn mode off."
+Reveal mode is a buffer-local minor mode. When enabled, it
+reveals invisible text around point."
:group 'reveal
:lighter (global-reveal-mode nil " Reveal")
:keymap reveal-mode-map
;;;###autoload
(define-minor-mode global-reveal-mode
- "Toggle Reveal mode in all buffers on or off.
+ "Toggle Reveal mode in all buffers (Global Reveal mode).
Reveal mode renders invisible text around point visible again.
-Interactively, with no prefix argument, toggle the mode.
-With universal prefix ARG (or if ARG is nil) turn mode on.
-With zero or negative ARG turn mode off."
+With a prefix argument ARG, enable Global Reveal mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+the mode if ARG is omitted or nil."
:global t :group 'reveal
(setq-default reveal-mode global-reveal-mode)
(if global-reveal-mode
(provide 'reveal)
-;; arch-tag: 96ba0242-2274-4ed7-8e10-26bc0707b4d8
;;; reveal.el ends here