comparison lisp/term/x-win.el @ 66640:eb72b7c5a0b9

Various comment syntax fixes.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 02 Nov 2005 21:43:21 +0000
parents 58043855503e
children 067115a6e738 693e794b57bf 7beb78bc1f8e
comparison
equal deleted inserted replaced
66639:4408f56ebb87 66640:eb72b7c5a0b9
2114 ;; #x0dde THAI MAIHANAKAT Thai 2114 ;; #x0dde THAI MAIHANAKAT Thai
2115 2115
2116 2116
2117 ;;;; Selections and cut buffers 2117 ;;;; Selections and cut buffers
2118 2118
2119 ;;; We keep track of the last text selected here, so we can check the 2119 ;; We keep track of the last text selected here, so we can check the
2120 ;;; current selection against it, and avoid passing back our own text 2120 ;; current selection against it, and avoid passing back our own text
2121 ;;; from x-cut-buffer-or-selection-value. We track all three 2121 ;; from x-cut-buffer-or-selection-value. We track all three
2122 ;;; seperately in case another X application only sets one of them 2122 ;; seperately in case another X application only sets one of them
2123 ;;; (say the cut buffer) we aren't fooled by the PRIMARY or 2123 ;; (say the cut buffer) we aren't fooled by the PRIMARY or
2124 ;;; CLIPBOARD selection staying the same. 2124 ;; CLIPBOARD selection staying the same.
2125 (defvar x-last-selected-text-clipboard nil 2125 (defvar x-last-selected-text-clipboard nil
2126 "The value of the CLIPBOARD X selection last time we selected or 2126 "The value of the CLIPBOARD X selection last time we selected or
2127 pasted text.") 2127 pasted text.")
2128 (defvar x-last-selected-text-primary nil 2128 (defvar x-last-selected-text-primary nil
2129 "The value of the PRIMARY X selection last time we selected or 2129 "The value of the PRIMARY X selection last time we selected or
2133 The actual text stored in the X cut buffer is what encoded from this value.") 2133 The actual text stored in the X cut buffer is what encoded from this value.")
2134 (defvar x-last-selected-text-cut-encoded nil 2134 (defvar x-last-selected-text-cut-encoded nil
2135 "The value of the X cut buffer last time we selected or pasted text. 2135 "The value of the X cut buffer last time we selected or pasted text.
2136 This is the actual text stored in the X cut buffer.") 2136 This is the actual text stored in the X cut buffer.")
2137 2137
2138 ;;; It is said that overlarge strings are slow to put into the cut buffer. 2138 (defvar x-cut-buffer-max 20000 ; Note this value is overridden below.
2139 ;;; Note this value is overridden below. 2139 "Max number of characters to put in the cut buffer.
2140 (defvar x-cut-buffer-max 20000 2140 It is said that overlarge strings are slow to put into the cut buffer.")
2141 "Max number of characters to put in the cut buffer.")
2142 2141
2143 (defcustom x-select-enable-clipboard nil 2142 (defcustom x-select-enable-clipboard nil
2144 "Non-nil means cutting and pasting uses the clipboard. 2143 "Non-nil means cutting and pasting uses the clipboard.
2145 This is in addition to, but in preference to, the primary selection." 2144 This is in addition to, but in preference to, the primary selection."
2146 :type 'boolean 2145 :type 'boolean
2147 :group 'killing) 2146 :group 'killing)
2148 2147
2149 ;;; Make TEXT, a string, the primary X selection.
2150 ;;; Also, set the value of X cut buffer 0, for backward compatibility
2151 ;;; with older X applications.
2152 ;;; gildea@stop.mail-abuse.org says it's not desirable to put kills
2153 ;;; in the clipboard.
2154 (defun x-select-text (text &optional push) 2148 (defun x-select-text (text &optional push)
2149 "Make TEXT, a string, the primary X selection.
2150 Also, set the value of X cut buffer 0, for backward compatibility
2151 with older X applications.
2152 gildea@stop.mail-abuse.org says it's not desirable to put kills
2153 in the clipboard."
2155 ;; Don't send the cut buffer too much text. 2154 ;; Don't send the cut buffer too much text.
2156 ;; It becomes slow, and if really big it causes errors. 2155 ;; It becomes slow, and if really big it causes errors.
2157 (cond ((>= (length text) x-cut-buffer-max) 2156 (cond ((>= (length text) x-cut-buffer-max)
2158 (x-set-cut-buffer "" push) 2157 (x-set-cut-buffer "" push)
2159 (setq x-last-selected-text-cut "" 2158 (setq x-last-selected-text-cut ""
2274 2273
2275 (if text 2274 (if text
2276 (remove-text-properties 0 (length text) '(foreign-selection nil) text)) 2275 (remove-text-properties 0 (length text) '(foreign-selection nil) text))
2277 text)) 2276 text))
2278 2277
2279 ;;; Return the value of the current X selection. 2278 ;; Return the value of the current X selection.
2280 ;;; Consult the selection, and the cut buffer. Treat empty strings 2279 ;; Consult the selection, and the cut buffer. Treat empty strings
2281 ;;; as if they were unset. 2280 ;; as if they were unset.
2282 ;;; If this function is called twice and finds the same text, 2281 ;; If this function is called twice and finds the same text,
2283 ;;; it returns nil the second time. This is so that a single 2282 ;; it returns nil the second time. This is so that a single
2284 ;;; selection won't be added to the kill ring over and over. 2283 ;; selection won't be added to the kill ring over and over.
2285 (defun x-cut-buffer-or-selection-value () 2284 (defun x-cut-buffer-or-selection-value ()
2286 (let (clip-text primary-text cut-text) 2285 (let (clip-text primary-text cut-text)
2287 (when x-select-enable-clipboard 2286 (when x-select-enable-clipboard
2288 (setq clip-text (x-selection-value 'CLIPBOARD)) 2287 (setq clip-text (x-selection-value 'CLIPBOARD))
2289 (if (string= clip-text "") (setq clip-text nil)) 2288 (if (string= clip-text "") (setq clip-text nil))
2371 ;; checked again). 2370 ;; checked again).
2372 (or clip-text primary-text cut-text) 2371 (or clip-text primary-text cut-text)
2373 )) 2372 ))
2374 2373
2375 2374
2376 ;;; Do the actual X Windows setup here; the above code just defines 2375 ;; Do the actual X Windows setup here; the above code just defines
2377 ;;; functions and variables that we use now. 2376 ;; functions and variables that we use now.
2378 2377
2379 (setq command-line-args (x-handle-args command-line-args)) 2378 (setq command-line-args (x-handle-args command-line-args))
2380 2379
2381 ;;; Make sure we have a valid resource name. 2380 ;; Make sure we have a valid resource name.
2382 (or (stringp x-resource-name) 2381 (or (stringp x-resource-name)
2383 (let (i) 2382 (let (i)
2384 (setq x-resource-name (invocation-name)) 2383 (setq x-resource-name (invocation-name))
2385 2384
2386 ;; Change any . or * characters in x-resource-name to hyphens, 2385 ;; Change any . or * characters in x-resource-name to hyphens,
2472 2471
2473 (defun x-win-suspend-error () 2472 (defun x-win-suspend-error ()
2474 (error "Suspending an Emacs running under X makes no sense")) 2473 (error "Suspending an Emacs running under X makes no sense"))
2475 (add-hook 'suspend-hook 'x-win-suspend-error) 2474 (add-hook 'suspend-hook 'x-win-suspend-error)
2476 2475
2477 ;;; Arrange for the kill and yank functions to set and check the clipboard. 2476 ;; Arrange for the kill and yank functions to set and check the clipboard.
2478 (setq interprogram-cut-function 'x-select-text) 2477 (setq interprogram-cut-function 'x-select-text)
2479 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) 2478 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
2480 2479
2481 ;;; Turn off window-splitting optimization; X is usually fast enough 2480 ;; Turn off window-splitting optimization; X is usually fast enough
2482 ;;; that this is only annoying. 2481 ;; that this is only annoying.
2483 (setq split-window-keep-point t) 2482 (setq split-window-keep-point t)
2484 2483
2485 ;; Don't show the frame name; that's redundant with X. 2484 ;; Don't show the frame name; that's redundant with X.
2486 (setq-default mode-line-frame-identification " ") 2485 (setq-default mode-line-frame-identification " ")
2487 2486
2515 2514
2516 ;; Initiate drag and drop 2515 ;; Initiate drag and drop
2517 (add-hook 'after-make-frame-functions 'x-dnd-init-frame) 2516 (add-hook 'after-make-frame-functions 'x-dnd-init-frame)
2518 (global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) 2517 (global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
2519 2518
2520 ;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 2519 ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
2521 ;;; x-win.el ends here 2520 ;;; x-win.el ends here