On Twitter at https://twitter.com/bburnskm.
From PyVoyager:
Clipboard monitor for Emacs - monitors clipboard and pastes contents on change
On Twitter at https://twitter.com/bburnskm.
From PyVoyager:
Hi, thanks for writing this excellent mode! I have one small possible issue. clipmon-mode works perfectly when I have an emacs frame open in any workspace. However, when I do not have an emacs frame open, it does not copy text from other X applications on copy and selection actions. Moreover, it is not possible to paste from the clipboard in this case. This occurs even if emacs is running in daemon mode (so clipmon mode is active).
e.g. with autosave on and autoinserting text from the web, sometimes emacs asks what coding system to use, and the text gets inserted into the minibuffer instead of the buffer. need to check if the minibuffer is active, and change the beep sound, or don't beep at all.
Hello, I'm trying to use clipmon to insert system clipboard in emacs (I run it from my terminal emulator, not with X)
I installed it, and added to my .emacs
config the following
(add-to-list 'after-init-hook 'clipmon-mode-start)
(setq clipmon-timer-interval 1) ; check system clipboard every n secs
I restarted emacs, clipmon-mode is enabled, I see Clipboard monitor started - watching system clipboard, adding changes to kill ring.
in `Messages but when I copy something into the system clipboard, nothing is added to the emacs kill-ring, even waiting more than the interval.
If I kill or copy something my system clipboard is not updated. (I don't understand if this feature exists, but it's my main objective for this issue)
I used to use the primary selection to get text copied from/to emacs, but it's limiting because I can copy from emacs only what's fully visible in my screen, and I have to disable global-display-line-numbers-mode
and reenable it each time, so I just use cat in another terminal to copy it from there if it's the case.
Thanks.
When i copy and paste chinese chars, the result will be some unreadable codes. I fixed it by replacing (x-get-selection 'CLIPBOARD) with (x-get-selection 'CLIPBOARD 'UTF8_STRING) in clipmon--clipboard-contents. I don't know whether this is appropriate.
The encoding problem only exists on linux, everything works fine on windows.
Great job though.
i'm on OSX, emacs 25.1, the latest push fixed all my issues with #9, #8 and #5 , but now there are some other behaviors that don't seem to be functioning like they were before.
IMHO, i personally would vote for the emacs 25 compatible push over reverting for the old functionality (assuming the old functionality is on some path to being restored), but not sure how the rest of the user base and/or you feels?
all that aside, this project is awesome.
Somehow reading the clipboard contents resets it to just have plain ascii format
How can I set (org-cliplink) as clipmon-transform-function so it works?
I tried just setting (org-cliplink) it transform function requires s I guess, so this form does not work, any tips and hints? Thanks in advance.
clipmon--play-sound can throw this error if no audio device available
On the Emacs Mac Port by Yamamoto Mitsuharu, this mode does not work. It seems that this is because gui-get-selection
has been redefined in this version of Emacs as such:
(defun gui-get-selection (&optional type data-type)
"Return the value of an X Windows selection.
The argument TYPE (default `PRIMARY') says which selection,
and the argument DATA-TYPE (default `STRING') says
how to convert the data.
TYPE may be any symbol \(but nil stands for `PRIMARY'). However,
only a few symbols are commonly used. They conventionally have
all upper-case names. The most often used ones, in addition to
`PRIMARY', are `SECONDARY' and `CLIPBOARD'.
DATA-TYPE is usually `STRING', but can also be one of the symbols
in `selection-converter-alist', which see. This argument is
ignored on NS, MS-Windows and MS-DOS."
(let ((data (gui-backend-get-selection (or type 'PRIMARY)
(or data-type 'STRING))))
(when (and (stringp data)
(setq data-type (get-text-property 0 'foreign-selection data)))
(if (eq window-system 'mac)
(let ((coding (or next-selection-coding-system
selection-coding-system)))
(if (eq data-type 'NSStringPboardType)
(setq data (mac-pasteboard-string-to-string data coding))))
(let ((coding (or next-selection-coding-system
selection-coding-system
(pcase data-type
('UTF8_STRING 'utf-8)
('COMPOUND_TEXT 'compound-text-with-extensions)
('C_STRING nil)
('STRING 'iso-8859-1)
(_ (error "Unknown selection data type: %S"
type))))))
(setq data (if coding (decode-coding-string data coding)
(string-to-multibyte data)))))
(setq next-selection-coding-system nil)
(put-text-property 0 (length data) 'foreign-selection data-type data))
data))
Whereas, in the NS port it is defined as this:
(defun gui-get-selection (&optional type data-type)
"Return the value of an X Windows selection.
The argument TYPE (default `PRIMARY') says which selection,
and the argument DATA-TYPE (default `STRING') says
how to convert the data.
TYPE may be any symbol \(but nil stands for `PRIMARY'). However,
only a few symbols are commonly used. They conventionally have
all upper-case names. The most often used ones, in addition to
`PRIMARY', are `SECONDARY' and `CLIPBOARD'.
DATA-TYPE is usually `STRING', but can also be one of the symbols
in `selection-converter-alist', which see. This argument is
ignored on NS, MS-Windows and MS-DOS."
(let ((data (gui-backend-get-selection (or type 'PRIMARY)
(or data-type 'STRING))))
(when (and (stringp data)
(setq data-type (get-text-property 0 'foreign-selection data)))
(let ((coding (or next-selection-coding-system
selection-coding-system
(pcase data-type
('UTF8_STRING 'utf-8)
('COMPOUND_TEXT 'compound-text-with-extensions)
('C_STRING nil)
('STRING 'iso-8859-1)
(_ (error "Unknown selection data type: %S"
type))))))
(setq data (if coding (decode-coding-string data coding)
(string-to-multibyte data))))
(setq next-selection-coding-system nil)
(put-text-property 0 (length data) 'foreign-selection data-type data))
data))
This should not be too difficult to work around and I would be happy to help in getting this mode to work properly once again.
When clipmon is enabled, copying text in UTF-8 that uses Portuguese accentuation (such as "não") doesn't work and pastes garbled text like n\343o
.
Sometimes that also happens outside of Emacs.
Somehow reading the clipboard causes it to lose the rich formatting.
This seems to be an odd behavior of x-get-selection-value
(Windows) and x-get-selection
(Linux) - will need to look into those to see what is going on.
not sure if this is related to this or not, but if i put the
(add-to-list 'after-init-hook 'clipmon-mode-start)
line in my init file and start emacsclient (using this plugin but also happens if i call emacsclient directly) then it hangs :(
this is awesome functionality! i just want it on all the time from when the emacs daemon/server starts, don't realize it's an issue till i go to the kill ring and realize, "shit, it wasn't capturing those things i highlighted :("
using emacs 24.5 with the cocoa app (brew installed) on mac osx 10.9.5
so can copy stuff from Info, or copy or move text from another buffer, or another location in a buffer.
I just have this configuration.
(add-to-list 'after-init-hook 'clipmon-mode-start)
Upon highlighting a region, no matter in emacs or in other applications, it keeps pushing the highlighted text to the kill ring. Can it be configured so that text only push to kill ring when I copy it?
(Transferring from other thread)
(use-package clipmon
:defer nil
:ensure t
:config
(clipmon-mode +1))
When clipmonmode
is enabled, sometimes accentuated Portuguese characters are pasted as gibberish.
clipmon-mode
disabled (correctly pasted):Eu não sei qual é a ação
clipmon-mode
enable (incorrectly pasted):Eu não sei qual é a ação
I added
(setq selection-coding-system 'utf-8-unix)
to my configuration after reading this issue. So it looks like this:
(use-package clipmon
:defer nil
:ensure t
:config
(setq selection-coding-system 'utf-8-unix)
(clipmon-mode +1))
It seems to be working for now. Let's see.
Hello,
On OS X, when I activate clipmon, I get:
clipmon--clipboard-contents: Symbol’s function definition is void: x-selection-owner-p
Could it be related to: #4 (comment) ?
Please see http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22214. Since I'm unsure if this is a problem in Emacs 25 or clipmon (or both) I copy the debbug report here.
Regards,
Joseph
Not supposed to do that. The text is also doubled inside the kill ring.
Works alright on Windows/Emacs24.5.
Fails on Linux/Emacs24.5 and 25.1.
clipmon--on-clipboard-change
calls (kill-new s)
, which, if interprogram-cut-function
is not nil, winds up placing the new clipboard text right back to the clipboard. Unfortunately, on Windows (at least) this can result in the clipboard text being changed from what the user actually cut or copied.
The reason lies in the fact that by the time clipmon--on-clipboard-change
gets the clipboard text it's been altered by emacs -- carriage returns, which are a part of the cr/lf Windows line break, get removed and the text encoding can be altered. This altered text is then used by kill-new
to paste back to the Clipboard, replacing the originally copied/cut text.
(I don't know if it would result in any problems, but I think emacs also becomes the Clipboard owner for every newly-copied piece of text, regardless of the application the cut or copy originates from.)
I've made the following advice function to get around the problem:
(defadvice clipmon--on-clipboard-change (around stop-clipboard-parsing activate) (let ((interprogram-cut-function nil)) ad-do-it))
Basically, it prevents (kill-new s)
from disturbing the Clipboard.
Thanks for the nice package. While inserting current buffer is nice, it would be nicer if we have an option to insert it into the kill ring and later use packages like browse-kill-ring or helm-kill-ring to retrieve the content.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.