- ;FSFmacs huh?? It says:
- ;; "This is for temporary compatibility with pre-release Emacs 19."
- ;(if (stringp type)
- ; (setq type (intern type)))
- (or (valid-simple-selection-p data)
- (and (vectorp data)
- (let ((valid t)
- (i (1- (length data))))
- (while (>= i 0)
- (or (valid-simple-selection-p (aref data i))
- (setq valid nil))
- (setq i (1- i)))
- valid))
- (signal 'error (list "invalid selection" data)))
- (or type (setq type 'PRIMARY))
- (if (null data)
- (disown-selection-internal type)
- (own-selection-internal type data)
- (when (and (eq type 'PRIMARY)
- selection-sets-clipboard)
- (own-selection-internal 'CLIPBOARD data)))
- (cond ((eq type 'PRIMARY)
- (setq primary-selection-extent
- (select-make-extent-for-selection
- data primary-selection-extent)))
- ((eq type 'SECONDARY)
- (setq secondary-selection-extent
- (select-make-extent-for-selection
- data secondary-selection-extent))))
- (setq zmacs-region-stays t)
+ ;; calling own-selection-internal will mess this up, so preserve it.
+ (let ((zmacs-region-stays zmacs-region-stays))
+ ;FSFmacs huh?? It says:
+ ;; "This is for temporary compatibility with pre-release Emacs 19."
+ ;(if (stringp type)
+ ; (setq type (intern type)))
+ (or (valid-simple-selection-p data)
+ (and (vectorp data)
+ (let ((valid t)
+ (i (1- (length data))))
+ (while (>= i 0)
+ (or (valid-simple-selection-p (aref data i))
+ (setq valid nil))
+ (setq i (1- i)))
+ valid))
+ (signal 'error (list "invalid selection" data)))
+ (or type (setq type 'PRIMARY))
+ (flet ((own-selection-1
+ (type data append)
+ (when append
+ (unless (stringp data)
+ ;; kludge!
+ (setq data (select-convert-to-text type 'STRING data))
+ (if (stringp data)
+ (setq data (concat (get-selection type) data)))))
+ (own-selection-internal type data)))
+ (if (null data)
+ (disown-selection-internal type)
+ (own-selection-1 type data append)
+ (when (and (eq type 'PRIMARY)
+ selection-sets-clipboard)
+ (own-selection-internal 'CLIPBOARD data append))))
+ (cond ((eq type 'PRIMARY)
+ (setq primary-selection-extent
+ (select-make-extent-for-selection
+ data primary-selection-extent)))
+ ((eq type 'SECONDARY)
+ (setq secondary-selection-extent
+ (select-make-extent-for-selection
+ data secondary-selection-extent)))))
+ ;; zmacs-region-stays is for commands, not low-level functions.
+ ;; when behaving as the latter, we better not set it, or we will
+ ;; cause unwanted sticky-region behavior in kill-region and friends.
+ (if (interactive-p)
+ (setq zmacs-region-stays t))