all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Proposed new minor mode
@ 2003-06-07  1:51 Luc Teirlinck
  2003-06-07  1:57 ` Luc Teirlinck
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Luc Teirlinck @ 2003-06-07  1:51 UTC (permalink / raw)


I propose to add the following new minor mode to Emacs.  Direct
motivation is Info, where I propose to bind it to `i', but it could be
used elsewhere.

It makes all invisible text visible, after saving the old value of
buffer-invisibility-spec.  Disabling the minor mode restores the old
value.  Switching major modes automatically disables, because the new
major mode might want to set its own value of
buffer-invisibility-spec.

The main motivation is that killing and yanking, saving to file,
copying parts of the buffer to file, mailing, printing, make all
invisible text visible.  It is good to let the user see which text he
really is going to yank, save or copy to file, mail, print and so on.
Also, to allow him to figure why various commands like M-x man, C-h f
and the like might be behaving strangely.  Also to allow him to edit
in a way that he really knows what he is editing.  

This is not meant as a substitute for similar commands in specialized
modes, say outline mode, which should have commands to make only the
text they made invisible back visible.

A good place to try it out would be the dir file in info.  Doing so
will also show that there are still some problems with Stefan's new
node hiding implementation.  I believe these problems can be fixed.  I
will go into that separately.

I would not know in which file exactly the stuff would need to go.
Info is the main motivation, but it is much more general.


===File ~/vis-mode.el=======================================
(make-variable-buffer-local 'saved-buffer-invisibility-spec)

(defvar saved-buffer-invisibility-spec nil
  "Saved value of buffer-invisibility-spec when `vis-mode' is on.")

;; The next function is needed for use in change-major-mode-hook.
(defun vis-mode-disable ()
  "Disable vis-mode."
  (vis-mode 0))

(define-minor-mode vis-mode
  "Toggle vis-mode.
With argument ARG turn vis-mode on iff ARG is positive..

Enabling vis-mode sets `buffer-invisibility-spec' to nil, after
saving the old value in the variable
`saved-buffer-invisibility-spec', making all invisible text in
the buffer visible.

Disabling vis-mode restores the saved value of
`buffer-invisibility-spec'.

Cannging the major mode always disables vis-mode"
  :lighter " Vis"
  (if vis-mode
      (progn
	(setq saved-buffer-invisibility-spec buffer-invisibility-spec
	      buffer-invisibility-spec nil)
	(add-hook 'change-major-mode-hook 'vis-mode-disable nil t))
    (setq buffer-invisibility-spec saved-buffer-invisibility-spec
	  saved-buffer-invisibility-spec nil)))

  
============================================================

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

end of thread, other threads:[~2003-06-08  1:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-07  1:51 Proposed new minor mode Luc Teirlinck
2003-06-07  1:57 ` Luc Teirlinck
2003-06-07  6:55 ` David Kastrup
2003-06-07  9:13   ` Eli Zaretskii
2003-06-07 10:30     ` Luc Teirlinck
2003-06-07 10:47       ` David Kastrup
2003-06-07 11:59         ` Luc Teirlinck
2003-06-07 13:52         ` { SPAM 2 }::Re: " Luc Teirlinck
2003-06-07  9:52   ` Luc Teirlinck
2003-06-07 12:20   ` Miles Bader
2003-06-07  9:11 ` Eli Zaretskii
2003-06-07  9:45   ` Luc Teirlinck
2003-06-08  1:09 ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.