Mercurial > emacs
comparison lisp/simple.el @ 91302:56a72e2bd635
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-306
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 29 Dec 2007 02:39:17 +0000 |
parents | 53108e6cea98 cdd30283527d |
children | 606f2d163a64 |
comparison
equal
deleted
inserted
replaced
91301:7774e5860c70 | 91302:56a72e2bd635 |
---|---|
1164 (error "There are no previous complex commands to repeat"))))) | 1164 (error "There are no previous complex commands to repeat"))))) |
1165 | 1165 |
1166 (defvar minibuffer-history nil | 1166 (defvar minibuffer-history nil |
1167 "Default minibuffer history list. | 1167 "Default minibuffer history list. |
1168 This is used for all minibuffer input | 1168 This is used for all minibuffer input |
1169 except when an alternate history list is specified.") | 1169 except when an alternate history list is specified. |
1170 | |
1171 Maximum length of the history list is determined by the value | |
1172 of `history-length', which see.") | |
1170 (defvar minibuffer-history-sexp-flag nil | 1173 (defvar minibuffer-history-sexp-flag nil |
1171 "Control whether history list elements are expressions or strings. | 1174 "Control whether history list elements are expressions or strings. |
1172 If the value of this variable equals current minibuffer depth, | 1175 If the value of this variable equals current minibuffer depth, |
1173 they are expressions; otherwise they are strings. | 1176 they are expressions; otherwise they are strings. |
1174 \(That convention is designed to do the right thing for | 1177 \(That convention is designed to do the right thing for |
1899 :warning) | 1902 :warning) |
1900 (setq buffer-undo-list nil) | 1903 (setq buffer-undo-list nil) |
1901 t)) | 1904 t)) |
1902 | 1905 |
1903 (defvar shell-command-history nil | 1906 (defvar shell-command-history nil |
1904 "History list for some commands that read shell commands.") | 1907 "History list for some commands that read shell commands. |
1908 | |
1909 Maximum length of the history list is determined by the value | |
1910 of `history-length', which see.") | |
1905 | 1911 |
1906 (defvar shell-command-switch "-c" | 1912 (defvar shell-command-switch "-c" |
1907 "Switch used to have the shell execute its command line argument.") | 1913 "Switch used to have the shell execute its command line argument.") |
1908 | 1914 |
1909 (defvar shell-command-default-error-buffer nil | 1915 (defvar shell-command-default-error-buffer nil |
2657 (kill-new (if before-p (concat string cur) (concat cur string)) | 2663 (kill-new (if before-p (concat string cur) (concat cur string)) |
2658 (or (= (length cur) 0) | 2664 (or (= (length cur) 0) |
2659 (equal yank-handler (get-text-property 0 'yank-handler cur))) | 2665 (equal yank-handler (get-text-property 0 'yank-handler cur))) |
2660 yank-handler))) | 2666 yank-handler))) |
2661 | 2667 |
2668 (defcustom yank-pop-change-selection nil | |
2669 "If non-nil, rotating the kill ring changes the window system selection." | |
2670 :type 'boolean | |
2671 :group 'killing | |
2672 :version "23.1") | |
2673 | |
2662 (defun current-kill (n &optional do-not-move) | 2674 (defun current-kill (n &optional do-not-move) |
2663 "Rotate the yanking point by N places, and then return that kill. | 2675 "Rotate the yanking point by N places, and then return that kill. |
2664 If N is zero, `interprogram-paste-function' is set, and calling it returns a | 2676 If N is zero, `interprogram-paste-function' is set, and calling it returns a |
2665 string or list of strings, then that string (or list) is added to the front | 2677 string or list of strings, then that string (or list) is added to the front |
2666 of the kill ring and the string (or first string in the list) is returned as | 2678 of the kill ring and the string (or first string in the list) is returned as |
2667 the latest kill. If optional arg DO-NOT-MOVE is non-nil, then don't | 2679 the latest kill. |
2668 actually move the yanking point; just return the Nth kill forward." | 2680 |
2681 If N is not zero, and if `yank-pop-change-selection' is | |
2682 non-nil, use `interprogram-cut-function' to transfer the | |
2683 kill at the new yank point into the window system selection. | |
2684 | |
2685 If optional arg DO-NOT-MOVE is non-nil, then don't actually | |
2686 move the yanking point; just return the Nth kill forward." | |
2687 | |
2669 (let ((interprogram-paste (and (= n 0) | 2688 (let ((interprogram-paste (and (= n 0) |
2670 interprogram-paste-function | 2689 interprogram-paste-function |
2671 (funcall interprogram-paste-function)))) | 2690 (funcall interprogram-paste-function)))) |
2672 (if interprogram-paste | 2691 (if interprogram-paste |
2673 (progn | 2692 (progn |
2682 (or kill-ring (error "Kill ring is empty")) | 2701 (or kill-ring (error "Kill ring is empty")) |
2683 (let ((ARGth-kill-element | 2702 (let ((ARGth-kill-element |
2684 (nthcdr (mod (- n (length kill-ring-yank-pointer)) | 2703 (nthcdr (mod (- n (length kill-ring-yank-pointer)) |
2685 (length kill-ring)) | 2704 (length kill-ring)) |
2686 kill-ring))) | 2705 kill-ring))) |
2687 (or do-not-move | 2706 (unless do-not-move |
2688 (setq kill-ring-yank-pointer ARGth-kill-element)) | 2707 (setq kill-ring-yank-pointer ARGth-kill-element) |
2708 (when (and yank-pop-change-selection | |
2709 (> n 0) | |
2710 interprogram-cut-function) | |
2711 (funcall interprogram-cut-function (car ARGth-kill-element)))) | |
2689 (car ARGth-kill-element))))) | 2712 (car ARGth-kill-element))))) |
2690 | 2713 |
2691 | 2714 |
2692 | 2715 |
2693 ;;;; Commands for manipulating the kill ring. | 2716 ;;;; Commands for manipulating the kill ring. |
3298 (setq transient-mark-mode nil)) | 3321 (setq transient-mark-mode nil)) |
3299 (transient-mark-mode | 3322 (transient-mark-mode |
3300 (setq mark-active nil) | 3323 (setq mark-active nil) |
3301 (run-hooks 'deactivate-mark-hook)))) | 3324 (run-hooks 'deactivate-mark-hook)))) |
3302 | 3325 |
3326 (defcustom select-active-regions nil | |
3327 "If non-nil, an active region automatically becomes the window selection." | |
3328 :type 'boolean | |
3329 :group 'killing | |
3330 :version "23.1") | |
3331 | |
3303 (defun set-mark (pos) | 3332 (defun set-mark (pos) |
3304 "Set this buffer's mark to POS. Don't use this function! | 3333 "Set this buffer's mark to POS. Don't use this function! |
3305 That is to say, don't use this function unless you want | 3334 That is to say, don't use this function unless you want |
3306 the user to see that the mark has moved, and you want the previous | 3335 the user to see that the mark has moved, and you want the previous |
3307 mark position to be lost. | 3336 mark position to be lost. |
3319 | 3348 |
3320 (if pos | 3349 (if pos |
3321 (progn | 3350 (progn |
3322 (setq mark-active t) | 3351 (setq mark-active t) |
3323 (run-hooks 'activate-mark-hook) | 3352 (run-hooks 'activate-mark-hook) |
3353 (and select-active-regions | |
3354 (x-set-selection | |
3355 nil (buffer-substring (region-beginning) (region-end)))) | |
3324 (set-marker (mark-marker) pos (current-buffer))) | 3356 (set-marker (mark-marker) pos (current-buffer))) |
3325 ;; Normally we never clear mark-active except in Transient Mark mode. | 3357 ;; Normally we never clear mark-active except in Transient Mark mode. |
3326 ;; But when we actually clear out the mark value too, | 3358 ;; But when we actually clear out the mark value too, |
3327 ;; we must clear mark-active in any mode. | 3359 ;; we must clear mark-active in any mode. |
3328 (setq mark-active nil) | 3360 (setq mark-active nil) |
3329 (run-hooks 'deactivate-mark-hook) | 3361 (run-hooks 'deactivate-mark-hook) |
3330 (set-marker (mark-marker) nil))) | 3362 (set-marker (mark-marker) nil))) |
3363 | |
3364 (defcustom use-empty-active-region nil | |
3365 "If non-nil, an active region takes control even if empty. | |
3366 This applies to certain commands which, in Transient Mark mode, | |
3367 apply to the active region if there is one. If the setting is t, | |
3368 these commands apply to an empty active region if there is one. | |
3369 If the setting is nil, these commands treat an empty active | |
3370 region as if it were not active." | |
3371 :type 'boolean | |
3372 :version "23.1" | |
3373 :group 'editing-basics) | |
3374 | |
3375 (defun use-region-p () | |
3376 "Return t if certain commands should apply to the region. | |
3377 Certain commands normally apply to text near point, | |
3378 but in Transient Mark mode when the mark is active they apply | |
3379 to the region instead. Such commands should use this subroutine to | |
3380 test whether to do that. | |
3381 | |
3382 This function also obeys `use-empty-active-region'." | |
3383 (and transient-mark-mode mark-active | |
3384 (or use-empty-active-region (> (region-end) (region-beginning))))) | |
3385 | |
3386 (defun region-active-p () | |
3387 "Return t if Transient Mark mode is enabled and the mark is active. | |
3388 This is NOT the best function to use to test whether a command should | |
3389 operate on the region instead of the usual behavior -- for that, | |
3390 use `use-region-p'." | |
3391 (and transient-mark-mode mark-active)) | |
3331 | 3392 |
3332 (defvar mark-ring nil | 3393 (defvar mark-ring nil |
3333 "The list of former marks of the current buffer, most recent first.") | 3394 "The list of former marks of the current buffer, most recent first.") |
3334 (make-variable-buffer-local 'mark-ring) | 3395 (make-variable-buffer-local 'mark-ring) |
3335 (put 'mark-ring 'permanent-local t) | 3396 (put 'mark-ring 'permanent-local t) |
4958 (list nil nil nil current-prefix-arg)) | 5019 (list nil nil nil current-prefix-arg)) |
4959 (compose-mail to subject other-headers continue | 5020 (compose-mail to subject other-headers continue |
4960 'switch-to-buffer-other-frame yank-action send-actions)) | 5021 'switch-to-buffer-other-frame yank-action send-actions)) |
4961 | 5022 |
4962 (defvar set-variable-value-history nil | 5023 (defvar set-variable-value-history nil |
4963 "History of values entered with `set-variable'.") | 5024 "History of values entered with `set-variable'. |
5025 | |
5026 Maximum length of the history list is determined by the value | |
5027 of `history-length', which see.") | |
4964 | 5028 |
4965 (defun set-variable (variable value &optional make-local) | 5029 (defun set-variable (variable value &optional make-local) |
4966 "Set VARIABLE to VALUE. VALUE is a Lisp object. | 5030 "Set VARIABLE to VALUE. VALUE is a Lisp object. |
4967 VARIABLE should be a user option variable name, a Lisp variable | 5031 VARIABLE should be a user option variable name, a Lisp variable |
4968 meant to be customized by users. You should enter VALUE in Lisp syntax, | 5032 meant to be customized by users. You should enter VALUE in Lisp syntax, |