Mercurial > emacs
comparison lisp/subr.el @ 31563:96b9757bfd45
(add-minor-mode): Use toggle-fun arg.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 12 Sep 2000 12:56:25 +0000 |
parents | 6165183bc490 |
children | 6085a3297ebc |
comparison
equal
deleted
inserted
replaced
31562:a2d8210661c8 | 31563:96b9757bfd45 |
---|---|
656 (defalias 'backward-delete-char 'delete-backward-char) | 656 (defalias 'backward-delete-char 'delete-backward-char) |
657 (defalias 'search-forward-regexp (symbol-function 're-search-forward)) | 657 (defalias 'search-forward-regexp (symbol-function 're-search-forward)) |
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 |
664 ;;; Should this be an obsolete name? If you decide it should, you get | 665 ;;; Should this be an obsolete name? If you decide it should, you get |
665 ;;; to go through all the sources and change them. | 666 ;;; to go through all the sources and change them. |
1507 to `minor-mode-map-alist'. | 1508 to `minor-mode-map-alist'. |
1508 | 1509 |
1509 Optional AFTER specifies that TOGGLE should be added after AFTER | 1510 Optional AFTER specifies that TOGGLE should be added after AFTER |
1510 in `minor-mode-alist'. | 1511 in `minor-mode-alist'. |
1511 | 1512 |
1512 Optional TOGGLE-FUN is there for compatiblity with other Emacsen. | 1513 Optional TOGGLE-FUN is an interactive function to toggle the mode. If |
1513 It is currently not used. | 1514 supplied, it is used to make mouse clicks on the mode-line string turn |
1515 off the mode. | |
1516 | |
1517 If TOGGLE-FUN is supplied and TOGGLE has a non-nil `:included' | |
1518 property, an entry for the mode is included in the mode-line minor | |
1519 mode menu. If TOGGLE has a `:menu-tag', that is used for the menu | |
1520 item's label instead of NAME. | |
1514 | 1521 |
1515 In most cases, `define-minor-mode' should be used instead." | 1522 In 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)) |
1522 (if (eq after (caar tail)) | 1543 (if (eq after (caar tail)) |
1523 (setq found tail) | 1544 (setq found tail) |