Code Monkey home page Code Monkey logo

clipmon's Introduction

clipmon's People

Contributors

bburns avatar ylluminarious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clipmon's Issues

Clipboard doesn't work when no Emacs frames are active

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).

not working with emacs-nox?

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.

Unreadable codes when dealing with chinese.

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.

Clipmon only getting the first one or two values copied to the system clipboard - Linux

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.

  1. yank:
    • before: i think it was adding everything to the kill ring when the clipboard contents changed.
    • now: seems to be tracking the most recent thing. so yanking will behave as expected (i.e. paste the most recent thing copied to the clipboard from any application), BUT, searching the kill ring BEFORE the yank won't show any of the most recent clipboard content changes
  2. insert: similarly
    • before: upon any change in the clipboard content, the new content would be yanked into the current buffer
    • now: not seeing any new clipboard contents auto yanked into the current buffer

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.

Does not work on Emacs Mac Port

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.

clipmon messes up UTF-8 copy and paste

Environment

  • GNU Emacs 27.1
  • Kubuntu 20.10
  • config

Issue

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.

clipmon auto start in init file with emacsclient

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

Keeping save highlighted region to kill ring

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?

Sometimes Portuguese characters are pasted as gibberish

Runtime Environment

  • OS: MX Linux 18.3
  • GNU Emacs 27.0.50
  • clipmon 20180129.1054
  • Evil version 1.2.14
  • ~/.emacs.d
  • i3 version 4.13 (2016-11-08)
  • i3/config
  • dotfiles

use-package

(use-package clipmon
  :defer nil
  :ensure t
  :config
  (clipmon-mode +1))

Issue

When clipmonmode is enabled, sometimes accentuated Portuguese characters are pasted as gibberish.

  • With clipmon-mode disabled (correctly pasted):

Eu não sei qual é a ação

  • With clipmon-mode enable (incorrectly pasted):

Eu não sei qual é a ação

Edit

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.

Clipmon not working on OS X?

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) ?

Clipmon on Windows Modifies Existing Clipboard Text

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.