diff options
| author | Eli Zaretskii | 2009-07-18 11:13:03 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2009-07-18 11:13:03 +0000 |
| commit | f22693fc454b156005fdf786bb26036b1a543df0 (patch) | |
| tree | 2075d6afa2e2a638976c131183fa988e51a88b86 | |
| parent | c055a7dc5792ce490514c5f120466c03822a73d1 (diff) | |
| download | emacs-f22693fc454b156005fdf786bb26036b1a543df0.tar.gz emacs-f22693fc454b156005fdf786bb26036b1a543df0.zip | |
(x-selection-owner-p, x-own-selection-internal)
(x-disown-selection-internal): New functions.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/term/pc-win.el | 41 |
2 files changed, 46 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7775cd79b93..2849d3639ac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-07-18 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * term/pc-win.el (x-selection-owner-p, x-own-selection-internal) | ||
| 4 | (x-disown-selection-internal): New functions. | ||
| 5 | |||
| 1 | 2009-07-18 Nick Roberts <nickrob@snap.net.nz> | 6 | 2009-07-18 Nick Roberts <nickrob@snap.net.nz> |
| 2 | 7 | ||
| 3 | * progmodes/gdb-mi.el (speedbar-frame): Declare to avoid compiler | 8 | * progmodes/gdb-mi.el (speedbar-frame): Declare to avoid compiler |
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index 6fb714c1412..332e151a86f 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el | |||
| @@ -227,6 +227,47 @@ support other types of selections." | |||
| 227 | (t | 227 | (t |
| 228 | (setq x-last-selected-text text)))))) | 228 | (setq x-last-selected-text text)))))) |
| 229 | 229 | ||
| 230 | ;; x-selection-owner-p is used in simple.el. | ||
| 231 | (defun x-selection-owner-p (&optional type) | ||
| 232 | "Whether the current Emacs process owns the given X Selection. | ||
| 233 | The arg should be the name of the selection in question, typically one of | ||
| 234 | the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. | ||
| 235 | \(Those are literal upper-case symbol names, since that's what X expects.) | ||
| 236 | For convenience, the symbol nil is the same as `PRIMARY', | ||
| 237 | and t is the same as `SECONDARY'." | ||
| 238 | (if x-select-enable-clipboard | ||
| 239 | (let (text) | ||
| 240 | ;; Don't die if w16-get-clipboard-data signals an error. | ||
| 241 | (ignore-errors | ||
| 242 | (setq text (w16-get-clipboard-data))) | ||
| 243 | ;; We consider ourselves the owner of the selection if it does | ||
| 244 | ;; not exist, or exists and compares equal with the last text | ||
| 245 | ;; we've put into the Windows clipboard. | ||
| 246 | (cond | ||
| 247 | ((not text) t) | ||
| 248 | ((or (eq text x-last-selected-text) | ||
| 249 | (string= text x-last-selected-text)) | ||
| 250 | text) | ||
| 251 | (t nil))))) | ||
| 252 | |||
| 253 | ;; x-own-selection-internal and x-disown-selection-internal are used | ||
| 254 | ;; in select.el:x-set-selection. | ||
| 255 | (defun x-own-selection-internal (type value) | ||
| 256 | "Assert an X selection of the given TYPE with the given VALUE. | ||
| 257 | TYPE is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. | ||
| 258 | \(Those are literal upper-case symbol names, since that's what X expects.) | ||
| 259 | VALUE is typically a string, or a cons of two markers, but may be | ||
| 260 | anything that the functions on `selection-converter-alist' know about." | ||
| 261 | (ignore-errors | ||
| 262 | (x-select-text value)) | ||
| 263 | value) | ||
| 264 | |||
| 265 | (defun x-disown-selection-internal (selection &optional time) | ||
| 266 | "If we own the selection SELECTION, disown it. | ||
| 267 | Disowning it means there is no such selection." | ||
| 268 | (if (x-selection-owner-p selection) | ||
| 269 | t)) | ||
| 270 | |||
| 230 | ;; From lisp/faces.el: we only have one font, so always return | 271 | ;; From lisp/faces.el: we only have one font, so always return |
| 231 | ;; it, no matter which variety they've asked for. | 272 | ;; it, no matter which variety they've asked for. |
| 232 | (defun x-frob-font-slant (font which) | 273 | (defun x-frob-font-slant (font which) |