comparison lisp/simple.el @ 47408:2239db3433ca

(transient-mark-mode, line-number-mode, column-number-mode): Use define-minor-mode. (define-mail-user-agent): Delete. Moved to subr.el.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 11 Sep 2002 20:46:33 +0000
parents 1eea6f92f279
children 1bbef0cbbf67
comparison
equal deleted inserted replaced
47407:32ab444f1795 47408:2239db3433ca
2482 (error "No mark set in this buffer")) 2482 (error "No mark set in this buffer"))
2483 (set-mark (point)) 2483 (set-mark (point))
2484 (goto-char omark) 2484 (goto-char omark)
2485 nil))) 2485 nil)))
2486 2486
2487 (defun transient-mark-mode (arg) 2487 (define-minor-mode transient-mark-mode
2488 "Toggle Transient Mark mode. 2488 "Toggle Transient Mark mode.
2489 With arg, turn Transient Mark mode on if arg is positive, off otherwise. 2489 With arg, turn Transient Mark mode on if arg is positive, off otherwise.
2490 2490
2491 In Transient Mark mode, when the mark is active, the region is highlighted. 2491 In Transient Mark mode, when the mark is active, the region is highlighted.
2492 Changing the buffer \"deactivates\" the mark. 2492 Changing the buffer \"deactivates\" the mark.
2503 \\[comment-dwim], \\[flush-lines], \\[ispell], \\[keep-lines], 2503 \\[comment-dwim], \\[flush-lines], \\[ispell], \\[keep-lines],
2504 \\[query-replace], \\[query-replace-regexp], and \\[undo]. Invoke 2504 \\[query-replace], \\[query-replace-regexp], and \\[undo]. Invoke
2505 \\[apropos-documentation] and type \"transient\" or \"mark.*active\" at 2505 \\[apropos-documentation] and type \"transient\" or \"mark.*active\" at
2506 the prompt, to see the documentation of commands which are sensitive to 2506 the prompt, to see the documentation of commands which are sensitive to
2507 the Transient Mark mode." 2507 the Transient Mark mode."
2508 (interactive "P") 2508 :global t :group 'editing-basics)
2509 (setq transient-mark-mode
2510 (if (null arg)
2511 (not transient-mark-mode)
2512 (> (prefix-numeric-value arg) 0)))
2513 (if (interactive-p)
2514 (if transient-mark-mode
2515 (message "Transient Mark mode enabled")
2516 (message "Transient Mark mode disabled"))))
2517 2509
2518 (defun pop-global-mark () 2510 (defun pop-global-mark ()
2519 "Pop off global mark ring and jump to the top location." 2511 "Pop off global mark ring and jump to the top location."
2520 (interactive) 2512 (interactive)
2521 ;; Pop entries which refer to non-existent buffers. 2513 ;; Pop entries which refer to non-existent buffers.
3282 (not (eq overwrite-mode 'overwrite-mode-binary)) 3274 (not (eq overwrite-mode 'overwrite-mode-binary))
3283 (> (prefix-numeric-value arg) 0)) 3275 (> (prefix-numeric-value arg) 0))
3284 'overwrite-mode-binary)) 3276 'overwrite-mode-binary))
3285 (force-mode-line-update)) 3277 (force-mode-line-update))
3286 3278
3287 (defcustom line-number-mode t 3279 (define-minor-mode line-number-mode
3288 "*Non-nil means display line number in mode line."
3289 :type 'boolean
3290 :group 'editing-basics)
3291
3292 (defun line-number-mode (arg)
3293 "Toggle Line Number mode. 3280 "Toggle Line Number mode.
3294 With arg, turn Line Number mode on iff arg is positive. 3281 With arg, turn Line Number mode on iff arg is positive.
3295 When Line Number mode is enabled, the line number appears 3282 When Line Number mode is enabled, the line number appears
3296 in the mode line. 3283 in the mode line.
3297 3284
3298 Line numbers do not appear for very large buffers and buffers 3285 Line numbers do not appear for very large buffers and buffers
3299 with very long lines; see variables `line-number-display-limit' 3286 with very long lines; see variables `line-number-display-limit'
3300 and `line-number-display-limit-width'." 3287 and `line-number-display-limit-width'."
3301 (interactive "P") 3288 :init-value t :global t :group 'editing-basics)
3302 (setq line-number-mode 3289
3303 (if (null arg) (not line-number-mode) 3290 (define-minor-mode column-number-mode
3304 (> (prefix-numeric-value arg) 0)))
3305 (force-mode-line-update))
3306
3307 (defcustom column-number-mode nil
3308 "*Non-nil means display column number in mode line."
3309 :type 'boolean
3310 :group 'editing-basics)
3311
3312 (defun column-number-mode (arg)
3313 "Toggle Column Number mode. 3291 "Toggle Column Number mode.
3314 With arg, turn Column Number mode on iff arg is positive. 3292 With arg, turn Column Number mode on iff arg is positive.
3315 When Column Number mode is enabled, the column number appears 3293 When Column Number mode is enabled, the column number appears
3316 in the mode line." 3294 in the mode line."
3317 (interactive "P") 3295 :global t :group 'editing-basics)
3318 (setq column-number-mode
3319 (if (null arg) (not column-number-mode)
3320 (> (prefix-numeric-value arg) 0)))
3321 (force-mode-line-update))
3322 3296
3323 (defgroup paren-blinking nil 3297 (defgroup paren-blinking nil
3324 "Blinking matching of parens and expressions." 3298 "Blinking matching of parens and expressions."
3325 :prefix "blink-matching-" 3299 :prefix "blink-matching-"
3326 :group 'paren-matching) 3300 :group 'paren-matching)
3541 :format "%t\n" 3515 :format "%t\n"
3542 gnus-user-agent) 3516 gnus-user-agent)
3543 (function :tag "Other")) 3517 (function :tag "Other"))
3544 :group 'mail) 3518 :group 'mail)
3545 3519
3546 (defun define-mail-user-agent (symbol composefunc sendfunc
3547 &optional abortfunc hookvar)
3548 "Define a symbol to identify a mail-sending package for `mail-user-agent'.
3549
3550 SYMBOL can be any Lisp symbol. Its function definition and/or
3551 value as a variable do not matter for this usage; we use only certain
3552 properties on its property list, to encode the rest of the arguments.
3553
3554 COMPOSEFUNC is program callable function that composes an outgoing
3555 mail message buffer. This function should set up the basics of the
3556 buffer without requiring user interaction. It should populate the
3557 standard mail headers, leaving the `to:' and `subject:' headers blank
3558 by default.
3559
3560 COMPOSEFUNC should accept several optional arguments--the same
3561 arguments that `compose-mail' takes. See that function's documentation.
3562
3563 SENDFUNC is the command a user would run to send the message.
3564
3565 Optional ABORTFUNC is the command a user would run to abort the
3566 message. For mail packages that don't have a separate abort function,
3567 this can be `kill-buffer' (the equivalent of omitting this argument).
3568
3569 Optional HOOKVAR is a hook variable that gets run before the message
3570 is actually sent. Callers that use the `mail-user-agent' may
3571 install a hook function temporarily on this hook variable.
3572 If HOOKVAR is nil, `mail-send-hook' is used.
3573
3574 The properties used on SYMBOL are `composefunc', `sendfunc',
3575 `abortfunc', and `hookvar'."
3576 (put symbol 'composefunc composefunc)
3577 (put symbol 'sendfunc sendfunc)
3578 (put symbol 'abortfunc (or abortfunc 'kill-buffer))
3579 (put symbol 'hookvar (or hookvar 'mail-send-hook)))
3580
3581 (define-mail-user-agent 'sendmail-user-agent 3520 (define-mail-user-agent 'sendmail-user-agent
3582 'sendmail-user-agent-compose 3521 'sendmail-user-agent-compose
3583 'mail-send-and-exit) 3522 'mail-send-and-exit)
3584 3523
3585 (defun rfc822-goto-eoh () 3524 (defun rfc822-goto-eoh ()