Mercurial > emacs
comparison lisp/simple.el @ 111626:3655cc4062e4
Merge from emacs-23
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 17 Nov 2010 22:54:14 -0500 |
parents | 3855698b7f05 0f82907d5a26 |
children | 52e0dfc06f6c |
comparison
equal
deleted
inserted
replaced
111625:586a15d21905 | 111626:3655cc4062e4 |
---|---|
2988 Set `kill-ring-yank-pointer' to point to it. | 2988 Set `kill-ring-yank-pointer' to point to it. |
2989 If `interprogram-cut-function' is non-nil, apply it to STRING. | 2989 If `interprogram-cut-function' is non-nil, apply it to STRING. |
2990 Optional second argument REPLACE non-nil means that STRING will replace | 2990 Optional second argument REPLACE non-nil means that STRING will replace |
2991 the front of the kill ring, rather than being added to the list. | 2991 the front of the kill ring, rather than being added to the list. |
2992 | 2992 |
2993 Optional third arguments YANK-HANDLER controls how the STRING is later | |
2994 inserted into a buffer; see `insert-for-yank' for details. | |
2995 When a yank handler is specified, STRING must be non-empty (the yank | |
2996 handler, if non-nil, is stored as a `yank-handler' text property on STRING). | |
2997 | |
2998 When `save-interprogram-paste-before-kill' and `interprogram-paste-function' | 2993 When `save-interprogram-paste-before-kill' and `interprogram-paste-function' |
2999 are non-nil, saves the interprogram paste string(s) into `kill-ring' before | 2994 are non-nil, saves the interprogram paste string(s) into `kill-ring' before |
3000 STRING. | 2995 STRING. |
3001 | 2996 |
3002 When the yank handler has a non-nil PARAM element, the original STRING | 2997 When the yank handler has a non-nil PARAM element, the original STRING |
3032 (if (> (length kill-ring) kill-ring-max) | 3027 (if (> (length kill-ring) kill-ring-max) |
3033 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))) | 3028 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))) |
3034 (setq kill-ring-yank-pointer kill-ring) | 3029 (setq kill-ring-yank-pointer kill-ring) |
3035 (if interprogram-cut-function | 3030 (if interprogram-cut-function |
3036 (funcall interprogram-cut-function string))) | 3031 (funcall interprogram-cut-function string))) |
3032 (set-advertised-calling-convention | |
3033 'kill-new '(string &optional replace) "23.3") | |
3037 | 3034 |
3038 (defun kill-append (string before-p &optional yank-handler) | 3035 (defun kill-append (string before-p &optional yank-handler) |
3039 "Append STRING to the end of the latest kill in the kill ring. | 3036 "Append STRING to the end of the latest kill in the kill ring. |
3040 If BEFORE-P is non-nil, prepend STRING to the kill. | 3037 If BEFORE-P is non-nil, prepend STRING to the kill. |
3041 Optional third argument YANK-HANDLER, if non-nil, specifies the | |
3042 yank-handler text property to be set on the combined kill ring | |
3043 string. If the specified yank-handler arg differs from the | |
3044 yank-handler property of the latest kill string, this function | |
3045 adds the combined string to the kill ring as a new element, | |
3046 instead of replacing the last kill with it. | |
3047 If `interprogram-cut-function' is set, pass the resulting kill to it." | 3038 If `interprogram-cut-function' is set, pass the resulting kill to it." |
3048 (let* ((cur (car kill-ring))) | 3039 (let* ((cur (car kill-ring))) |
3049 (kill-new (if before-p (concat string cur) (concat cur string)) | 3040 (kill-new (if before-p (concat string cur) (concat cur string)) |
3050 (or (= (length cur) 0) | 3041 (or (= (length cur) 0) |
3051 (equal yank-handler (get-text-property 0 'yank-handler cur))) | 3042 (equal yank-handler (get-text-property 0 'yank-handler cur))) |
3052 yank-handler))) | 3043 yank-handler))) |
3044 (set-advertised-calling-convention 'kill-append '(string before-p) "23.3") | |
3053 | 3045 |
3054 (defcustom yank-pop-change-selection nil | 3046 (defcustom yank-pop-change-selection nil |
3055 "If non-nil, rotating the kill ring changes the window system selection." | 3047 "If non-nil, rotating the kill ring changes the window system selection." |
3056 :type 'boolean | 3048 :type 'boolean |
3057 :group 'killing | 3049 :group 'killing |
3128 Supply two arguments, character positions indicating the stretch of text | 3120 Supply two arguments, character positions indicating the stretch of text |
3129 to be killed. | 3121 to be killed. |
3130 Any command that calls this function is a \"kill command\". | 3122 Any command that calls this function is a \"kill command\". |
3131 If the previous command was also a kill command, | 3123 If the previous command was also a kill command, |
3132 the text killed this time appends to the text killed last time | 3124 the text killed this time appends to the text killed last time |
3133 to make one entry in the kill ring. | 3125 to make one entry in the kill ring." |
3134 | |
3135 In Lisp code, optional third arg YANK-HANDLER, if non-nil, | |
3136 specifies the yank-handler text property to be set on the killed | |
3137 text. See `insert-for-yank'." | |
3138 ;; Pass point first, then mark, because the order matters | 3126 ;; Pass point first, then mark, because the order matters |
3139 ;; when calling kill-append. | 3127 ;; when calling kill-append. |
3140 (interactive (list (point) (mark))) | 3128 (interactive (list (point) (mark))) |
3141 (unless (and beg end) | 3129 (unless (and beg end) |
3142 (error "The mark is not set now, so there is no region")) | 3130 (error "The mark is not set now, so there is no region")) |
3164 (progn (message "Read only text copied to kill ring") nil) | 3152 (progn (message "Read only text copied to kill ring") nil) |
3165 ;; Signal an error if the buffer is read-only. | 3153 ;; Signal an error if the buffer is read-only. |
3166 (barf-if-buffer-read-only) | 3154 (barf-if-buffer-read-only) |
3167 ;; If the buffer isn't read-only, the text is. | 3155 ;; If the buffer isn't read-only, the text is. |
3168 (signal 'text-read-only (list (current-buffer))))))) | 3156 (signal 'text-read-only (list (current-buffer))))))) |
3157 (set-advertised-calling-convention 'kill-region '(beg end) "23.3") | |
3169 | 3158 |
3170 ;; copy-region-as-kill no longer sets this-command, because it's confusing | 3159 ;; copy-region-as-kill no longer sets this-command, because it's confusing |
3171 ;; to get two copies of the text when the user accidentally types M-w and | 3160 ;; to get two copies of the text when the user accidentally types M-w and |
3172 ;; then corrects it with the intended C-w. | 3161 ;; then corrects it with the intended C-w. |
3173 (defun copy-region-as-kill (beg end) | 3162 (defun copy-region-as-kill (beg end) |