diff options
| author | Gerd Moellmann | 2000-04-26 17:33:40 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-04-26 17:33:40 +0000 |
| commit | d7d47268cc8f5df63e1d68fedce83f91127d8074 (patch) | |
| tree | deaf1f18480372d3396593229f15ef7826d00a9d | |
| parent | 47640244832685429b9b7891706782856702bd8f (diff) | |
| download | emacs-d7d47268cc8f5df63e1d68fedce83f91127d8074.tar.gz emacs-d7d47268cc8f5df63e1d68fedce83f91127d8074.zip | |
(add-minor-mode): New function.
| -rw-r--r-- | lisp/subr.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 88526bd98cc..fd2f968dc20 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1485,4 +1485,19 @@ If DIR-FLAG is non-nil, create a new empty directory instead of a file." | |||
| 1485 | nil) | 1485 | nil) |
| 1486 | file)) | 1486 | file)) |
| 1487 | 1487 | ||
| 1488 | |||
| 1489 | (defun add-minor-mode (symbol name map) | ||
| 1490 | "Register a new minor mode. | ||
| 1491 | SYMBOL is the name of a buffer-local variable that is toggled on | ||
| 1492 | or off to say whether the minor mode is active or not. NAME is the | ||
| 1493 | string that will appear in the mode line when the minor mode is | ||
| 1494 | active. MAP is the keymap for the minor mode." | ||
| 1495 | (make-local-variable symbol) | ||
| 1496 | (setq symbol t) | ||
| 1497 | (unless (assq symbol minor-mode-alist) | ||
| 1498 | (add-to-list 'minor-mode-alist (list symbol name))) | ||
| 1499 | (unless (assq symbol minor-mode-map-alist) | ||
| 1500 | (add-to-list 'minor-mode-map-alist (cons symbol map)))) | ||
| 1501 | |||
| 1502 | |||
| 1488 | ;;; subr.el ends here | 1503 | ;;; subr.el ends here |