Mercurial > emacs
comparison lisp/simple.el @ 111623:0f82907d5a26
Make the yank-handler argument obsolete.
* simple.el (kill-new, kill-append, kill-region):
* comint.el (comint-kill-region): Make the yank-handler argument obsolete.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 17 Nov 2010 21:09:41 -0500 |
parents | cda2045a5ee8 |
children | 3655cc4062e4 f475600c36d9 |
comparison
equal
deleted
inserted
replaced
111622:df422e3ae879 | 111623:0f82907d5a26 |
---|---|
2829 Set `kill-ring-yank-pointer' to point to it. | 2829 Set `kill-ring-yank-pointer' to point to it. |
2830 If `interprogram-cut-function' is non-nil, apply it to STRING. | 2830 If `interprogram-cut-function' is non-nil, apply it to STRING. |
2831 Optional second argument REPLACE non-nil means that STRING will replace | 2831 Optional second argument REPLACE non-nil means that STRING will replace |
2832 the front of the kill ring, rather than being added to the list. | 2832 the front of the kill ring, rather than being added to the list. |
2833 | 2833 |
2834 Optional third arguments YANK-HANDLER controls how the STRING is later | |
2835 inserted into a buffer; see `insert-for-yank' for details. | |
2836 When a yank handler is specified, STRING must be non-empty (the yank | |
2837 handler, if non-nil, is stored as a `yank-handler' text property on STRING). | |
2838 | |
2839 When `save-interprogram-paste-before-kill' and `interprogram-paste-function' | 2834 When `save-interprogram-paste-before-kill' and `interprogram-paste-function' |
2840 are non-nil, saves the interprogram paste string(s) into `kill-ring' before | 2835 are non-nil, saves the interprogram paste string(s) into `kill-ring' before |
2841 STRING. | 2836 STRING. |
2842 | 2837 |
2843 When the yank handler has a non-nil PARAM element, the original STRING | 2838 When the yank handler has a non-nil PARAM element, the original STRING |
2870 (if (> (length kill-ring) kill-ring-max) | 2865 (if (> (length kill-ring) kill-ring-max) |
2871 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))) | 2866 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))) |
2872 (setq kill-ring-yank-pointer kill-ring) | 2867 (setq kill-ring-yank-pointer kill-ring) |
2873 (if interprogram-cut-function | 2868 (if interprogram-cut-function |
2874 (funcall interprogram-cut-function string (not replace)))) | 2869 (funcall interprogram-cut-function string (not replace)))) |
2870 (set-advertised-calling-convention | |
2871 'kill-new '(string &optional replace) "23.3") | |
2875 | 2872 |
2876 (defun kill-append (string before-p &optional yank-handler) | 2873 (defun kill-append (string before-p &optional yank-handler) |
2877 "Append STRING to the end of the latest kill in the kill ring. | 2874 "Append STRING to the end of the latest kill in the kill ring. |
2878 If BEFORE-P is non-nil, prepend STRING to the kill. | 2875 If BEFORE-P is non-nil, prepend STRING to the kill. |
2879 Optional third argument YANK-HANDLER, if non-nil, specifies the | |
2880 yank-handler text property to be set on the combined kill ring | |
2881 string. If the specified yank-handler arg differs from the | |
2882 yank-handler property of the latest kill string, this function | |
2883 adds the combined string to the kill ring as a new element, | |
2884 instead of replacing the last kill with it. | |
2885 If `interprogram-cut-function' is set, pass the resulting kill to it." | 2876 If `interprogram-cut-function' is set, pass the resulting kill to it." |
2886 (let* ((cur (car kill-ring))) | 2877 (let* ((cur (car kill-ring))) |
2887 (kill-new (if before-p (concat string cur) (concat cur string)) | 2878 (kill-new (if before-p (concat string cur) (concat cur string)) |
2888 (or (= (length cur) 0) | 2879 (or (= (length cur) 0) |
2889 (equal yank-handler (get-text-property 0 'yank-handler cur))) | 2880 (equal yank-handler (get-text-property 0 'yank-handler cur))) |
2890 yank-handler))) | 2881 yank-handler))) |
2882 (set-advertised-calling-convention 'kill-append '(string before-p) "23.3") | |
2891 | 2883 |
2892 (defcustom yank-pop-change-selection nil | 2884 (defcustom yank-pop-change-selection nil |
2893 "If non-nil, rotating the kill ring changes the window system selection." | 2885 "If non-nil, rotating the kill ring changes the window system selection." |
2894 :type 'boolean | 2886 :type 'boolean |
2895 :group 'killing | 2887 :group 'killing |
2966 Supply two arguments, character positions indicating the stretch of text | 2958 Supply two arguments, character positions indicating the stretch of text |
2967 to be killed. | 2959 to be killed. |
2968 Any command that calls this function is a \"kill command\". | 2960 Any command that calls this function is a \"kill command\". |
2969 If the previous command was also a kill command, | 2961 If the previous command was also a kill command, |
2970 the text killed this time appends to the text killed last time | 2962 the text killed this time appends to the text killed last time |
2971 to make one entry in the kill ring. | 2963 to make one entry in the kill ring." |
2972 | |
2973 In Lisp code, optional third arg YANK-HANDLER, if non-nil, | |
2974 specifies the yank-handler text property to be set on the killed | |
2975 text. See `insert-for-yank'." | |
2976 ;; Pass point first, then mark, because the order matters | 2964 ;; Pass point first, then mark, because the order matters |
2977 ;; when calling kill-append. | 2965 ;; when calling kill-append. |
2978 (interactive (list (point) (mark))) | 2966 (interactive (list (point) (mark))) |
2979 (unless (and beg end) | 2967 (unless (and beg end) |
2980 (error "The mark is not set now, so there is no region")) | 2968 (error "The mark is not set now, so there is no region")) |
3002 (progn (message "Read only text copied to kill ring") nil) | 2990 (progn (message "Read only text copied to kill ring") nil) |
3003 ;; Signal an error if the buffer is read-only. | 2991 ;; Signal an error if the buffer is read-only. |
3004 (barf-if-buffer-read-only) | 2992 (barf-if-buffer-read-only) |
3005 ;; If the buffer isn't read-only, the text is. | 2993 ;; If the buffer isn't read-only, the text is. |
3006 (signal 'text-read-only (list (current-buffer))))))) | 2994 (signal 'text-read-only (list (current-buffer))))))) |
2995 (set-advertised-calling-convention 'kill-region '(beg end) "23.3") | |
3007 | 2996 |
3008 ;; copy-region-as-kill no longer sets this-command, because it's confusing | 2997 ;; copy-region-as-kill no longer sets this-command, because it's confusing |
3009 ;; to get two copies of the text when the user accidentally types M-w and | 2998 ;; to get two copies of the text when the user accidentally types M-w and |
3010 ;; then corrects it with the intended C-w. | 2999 ;; then corrects it with the intended C-w. |
3011 (defun copy-region-as-kill (beg end) | 3000 (defun copy-region-as-kill (beg end) |