Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
3b4cf5db
Commit
3b4cf5db
authored
Dec 08, 2000
by
Andrew Innes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add clipboard support from term/w32-win.el, so it is
accessible in -nw mode.
parent
9ab80679
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
lisp/w32-fns.el
lisp/w32-fns.el
+55
-0
No files found.
lisp/w32-fns.el
View file @
3b4cf5db
...
...
@@ -408,4 +408,59 @@ bit output with no translation."
(
make-obsolete-variable
'w32-charset-to-codepage-alist
'w32-charset-info-alist
"21.1"
)
;;;; Selections and cut buffers
;;; We keep track of the last text selected here, so we can check the
;;; current selection against it, and avoid passing back our own text
;;; from x-cut-buffer-or-selection-value.
(
defvar
x-last-selected-text
nil
)
;;; It is said that overlarge strings are slow to put into the cut buffer.
;;; Note this value is overridden below.
(
defvar
x-cut-buffer-max
20000
"Max number of characters to put in the cut buffer."
)
(
defcustom
x-select-enable-clipboard
t
"Non-nil means cutting and pasting uses the clipboard.
This is in addition to the primary selection."
:type
'boolean
:group
'killing
)
(
defun
x-select-text
(
text
&optional
push
)
"Make TEXT the last selected text.
If `x-select-enable-clipboard' is non-nil, copy the text to the system
clipboard as well. Optional PUSH is ignored on Windows."
(
if
x-select-enable-clipboard
(
w32-set-clipboard-data
text
))
(
setq
x-last-selected-text
text
))
(
defun
x-get-selection-value
()
"Return the value of the current selection.
Consult the selection, then the cut buffer. Treat empty strings as if
they were unset."
(
if
x-select-enable-clipboard
(
let
(
text
)
;; Don't die if x-get-selection signals an error.
(
condition-case
c
(
setq
text
(
w32-get-clipboard-data
))
(
error
(
message
"w32-get-clipboard-data:%s"
c
)))
(
if
(
string=
text
""
)
(
setq
text
nil
))
(
cond
((
not
text
)
nil
)
((
eq
text
x-last-selected-text
)
nil
)
((
string=
text
x-last-selected-text
)
;; Record the newer string, so subsequent calls can use the 'eq' test.
(
setq
x-last-selected-text
text
)
nil
)
(
t
(
setq
x-last-selected-text
text
))))))
(
defalias
'x-cut-buffer-or-selection-value
'x-get-selection-value
)
;;; Arrange for the kill and yank functions to set and check the clipboard.
(
setq
interprogram-cut-function
'x-select-text
)
(
setq
interprogram-paste-function
'x-get-selection-value
)
;;; w32-fns.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment