unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu>
Cc: emacs-devel@gnu.org
Subject: Re: `scroll-all-mode' hard to customize
Date: Fri, 09 Aug 2002 04:02:24 -0400	[thread overview]
Message-ID: <200208090802.g7982OP12334@rum.cs.yale.edu> (raw)
In-Reply-To: E17YOJF-0002bi-00@bundalo.shootybangbang.com

> --- 125,136 ----
>   (defun scroll-all-mode (arg)
>     "Toggle Scroll-All minor mode."
>     (interactive "P")
> !   (setq scroll-all-mode
> ! 	(if (null arg) (not scroll-all-mode)
> ! 	  (> (prefix-numeric-value arg) 0)))
> !   (if scroll-all-mode
> !       (add-hook 'post-command-hook 'scroll-all-check-to-scroll)
> !     (remove-hook 'post-command-hook 'scroll-all-check-to-scroll)))
>   
>   (provide 'scroll-all)

Better yet, use define-minor-mode.


	Stefan

--- scroll-all.el.~1.10.~	Fri Apr 26 14:03:51 2002
+++ scroll-all.el	Fri Aug  9 00:03:15 2002
@@ -39,26 +39,6 @@
 
 ;;; Code:
 
-(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
-
-;;;###autoload
-(defcustom scroll-all-mode nil
-  "Control/track scroll locking.
-
-Setting this variable directly does not take effect;
-use either \\[customize] or the function `scroll-all-mode'."
-  :set (lambda (symbol value) (scroll-all-mode (if value 1 0)))
-  :initialize 'custom-initialize-default
-  :require 'scroll-all
-  :type 'boolean
-  :group 'windows)
-
-(if running-xemacs
-    (add-minor-mode 'scroll-all-mode " *SL*")
-  (or (assq 'scroll-all-mode minor-mode-alist)
-      (setq minor-mode-alist
-	    (cons '(scroll-all-mode " *SL*") minor-mode-alist))))
-
 (defun scroll-all-function-all (func arg)
   "Apply function FUNC with argument ARG to all visible windows."
   (let ((num-windows (count-windows))
@@ -122,15 +102,12 @@
  
 
 ;;;###autoload
-(defun scroll-all-mode (arg)
+(define-minor-mode scroll-all-mode " *SL*"
   "Toggle Scroll-All minor mode."
-  (interactive "P")
-  (setq scroll-all-mode (not scroll-all-mode))
-  (cond
-   ((eq scroll-all-mode 't)
-    (add-hook 'post-command-hook 'scroll-all-check-to-scroll))
-   ((eq scroll-all-mode 'nil)
-    (remove-hook 'post-command-hook 'scroll-all-check-to-scroll))))
+  :global t
+  (if scroll-all-mode
+      (add-hook 'post-command-hook 'scroll-all-check-to-scroll)
+    (remove-hook 'post-command-hook 'scroll-all-check-to-scroll)))
 
 (provide 'scroll-all)

      parent reply	other threads:[~2002-08-09  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E17YOJF-0002bi-00@bundalo.shootybangbang.com>
2002-07-29  1:12 ` `scroll-all-mode' hard to customize Richard Stallman
2002-07-29  3:11   ` John Paul Wallington
2002-07-29 13:14     ` Glenn Morris
2002-07-30  1:00       ` Richard Stallman
2002-08-09  8:02 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208090802.g7982OP12334@rum.cs.yale.edu \
    --to=monnier+gnu/emacs/pretest@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).