aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-09-12 12:56:25 +0000
committerDave Love2000-09-12 12:56:25 +0000
commitd6c22d46ab6798b1b41016e4d56cd52d559afb5d (patch)
tree4d64f173bc1befa48d75085f6141699612da1fd4
parenta2b07751dc5970c4195d78e77b20c16b216e813e (diff)
downloademacs-d6c22d46ab6798b1b41016e4d56cd52d559afb5d.tar.gz
emacs-d6c22d46ab6798b1b41016e4d56cd52d559afb5d.zip
(add-minor-mode): Use toggle-fun arg.
-rw-r--r--lisp/subr.el25
1 files changed, 23 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 767e2a8cde3..0078709cc42 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -658,6 +658,7 @@ Please convert your programs to use the variable `baud-rate' directly."
658(defalias 'search-backward-regexp (symbol-function 're-search-backward)) 658(defalias 'search-backward-regexp (symbol-function 're-search-backward))
659(defalias 'int-to-string 'number-to-string) 659(defalias 'int-to-string 'number-to-string)
660(defalias 'store-match-data 'set-match-data) 660(defalias 'store-match-data 'set-match-data)
661;; These are the XEmacs names:
661(defalias 'point-at-eol 'line-end-position) 662(defalias 'point-at-eol 'line-end-position)
662(defalias 'point-at-bol 'line-beginning-position) 663(defalias 'point-at-bol 'line-beginning-position)
663 664
@@ -1509,13 +1510,33 @@ to `minor-mode-map-alist'.
1509Optional AFTER specifies that TOGGLE should be added after AFTER 1510Optional AFTER specifies that TOGGLE should be added after AFTER
1510in `minor-mode-alist'. 1511in `minor-mode-alist'.
1511 1512
1512Optional TOGGLE-FUN is there for compatiblity with other Emacsen. 1513Optional TOGGLE-FUN is an interactive function to toggle the mode. If
1513It is currently not used. 1514supplied, it is used to make mouse clicks on the mode-line string turn
1515off the mode.
1516
1517If TOGGLE-FUN is supplied and TOGGLE has a non-nil `:included'
1518property, an entry for the mode is included in the mode-line minor
1519mode menu. If TOGGLE has a `:menu-tag', that is used for the menu
1520item's label instead of NAME.
1514 1521
1515In most cases, `define-minor-mode' should be used instead." 1522In most cases, `define-minor-mode' should be used instead."
1516 (when name 1523 (when name
1517 (let ((existing (assq toggle minor-mode-alist)) 1524 (let ((existing (assq toggle minor-mode-alist))
1518 (name (if (symbolp name) (symbol-value name) name))) 1525 (name (if (symbolp name) (symbol-value name) name)))
1526 (when (functionp toggle-fun)
1527 (setq name
1528 (apply 'propertize name
1529 'local-map (make-mode-line-mouse2-map toggle-fun)
1530 (unless (get-text-property 0 'help-echo name)
1531 (list 'help-echo
1532 (format "mouse-2: turn off %S" toggle)))))
1533 (when (get toggle :included)
1534 (define-key mode-line-mode-menu
1535 (vector toggle)
1536 (list 'menu-item
1537 (or (get toggle :menu-tag) name)
1538 toggle-fun
1539 :button (cons :toggle toggle)))))
1519 (cond ((null existing) 1540 (cond ((null existing)
1520 (let ((tail minor-mode-alist) found) 1541 (let ((tail minor-mode-alist) found)
1521 (while (and tail (not found)) 1542 (while (and tail (not found))