2013-06-15 5 views
6

इस सवाल का संबंधित क्लिपबोर्ड: How to disable x paste in emacsकैसे Emacs ईविल चयन ऑटो प्रतियां निष्क्रिय करने के लिए

यह माउस

(setq mouse-drag-copy-region nil) 

मैं बुराई Emacs में मोड के लिए भी ऐसा ही करने के लिए कैसे करते हैं के लिए काम करता है?

मै मैक ओएस पर हूं, Emacs 24.2.91 चला रहा हूं।

क्लिपबोर्ड इतिहास के साथ कोई समस्या और चयन

सभी कर्सर आंदोलन के लिए एक्स-चयन: सक्षम-क्लिपबोर्ड कॉल एक्स-चयन-पाठ का वर्तमान क्रियान्वयन:

उत्तर

0

मैं बुराई मोड मेलिंग सूची के लिए यह भेजा एक चयन के साथ। गैर-बुराई मोड का उपयोग करते समय यह व्यवहार नहीं है। असल में, emacs मेरे क्लिपबोर्ड इतिहास पर ले जाता है जब तक कि नीचे पैच नहीं किया जाता है। मैं मैक पर हूं और अल्फ्रेड क्लिपबोर्ड इतिहास का उपयोग करता हूं।

बोल्ड में नीचे मेरा परिवर्तन इस समस्या को ठीक करने लगता है।

  1. क्या यह सही काम है?
  2. क्या कोई योगदान जानकारी पृष्ठ है जो बताता है कि इस परियोजना में योगदान कैसे करें। मैं जिथब कांटे से परिचित हूं और अनुरोध खींचता हूं।

धन्यवाद,

जस्टिन

(setq x-select-enable-clipboard nil) 
(defun evil-visual-update-x-selection (&optional buffer) 
    "Update the X selection with the current visual region." 
    (let ((buf (or buffer (current-buffer)))) 
    (when (buffer-live-p buf) 
     (with-current-buffer buf 
     (when (and (evil-visual-state-p) 
        (fboundp 'x-select-text) 
        (or (not (boundp 'ns-initialized)) 
         (with-no-warnings ns-initialized)) 
        (not (eq evil-visual-selection 'block))) 
      ;; CHANGE 
      ;; ONLY call x-select-text if x-select-enable-clipboard is true 
      (if x-select-enable-clipboard 
       (x-select-text (buffer-substring-no-properties 
           evil-visual-beginning 
           evil-visual-end)))))))) 
2

कुछ इसी अंक की खुदाई करने के बाद, मुझे विश्वास है कि इस मुद्दे को वास्तव में Emacs x-select-text समारोह है, जो स्पष्ट रूप से पर x-select-enable-clipboard का मूल्य पर ध्यान नहीं देता में निहित है नेक्स्टस्टेप (और ओएस एक्स एक नेक्स्टस्टेप है)।

मैं एक नहीं सेशन समारोह के साथ x-select-text की जगह है, तो स्पष्ट रूप से ns- का उपयोग करके इस समस्या "हल" किया है {, मिल सेट} {interprogram कट, पेस्ट} समारोह के लिए पेस्टबोर्ड:

; Override the default x-select-text function because it doesn't 
; respect x-select-enable-clipboard on OS X. 
(defun x-select-text (text)) 
(setq x-select-enable-clipboard nil) 
(setq x-select-enable-primary nil) 
(setq mouse-drag-copy-region nil) 

(setq interprogram-cut-function 'ns-set-pasteboard) 
(setq interprogram-paste-function 'ns-get-pasteboard) 

यहाँ मूल x-select-text कोड है:

 
(defun x-select-text (text) 
    "Select TEXT, a string, according to the window system. 

On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the 
clipboard. If `x-select-enable-primary' is non-nil, put TEXT in 
the primary selection. 

On MS-Windows, make TEXT the current selection. If 
`x-select-enable-clipboard' is non-nil, copy the text to the 
clipboard as well. 

On Nextstep, put TEXT in the pasteboard (`x-select-enable-clipboard' 
is not used)." 
    (cond ((eq (framep (selected-frame)) 'w32) 
     (if x-select-enable-clipboard 
      (w32-set-clipboard-data text)) 
     (setq x-last-selected-text text)) 
     ((featurep 'ns) ; This is OS X 
     ;; Don't send the pasteboard too much text. 
     ;; It becomes slow, and if really big it causes errors. 
     (ns-set-pasteboard text) 
     (setq ns-last-selected-text text)) 
     (t 
     ;; With multi-tty, this function may be called from a tty frame. 
     (when (eq (framep (selected-frame)) 'x) 
      (when x-select-enable-primary 
      (x-set-selection 'PRIMARY text) 
      (setq x-last-selected-text-primary text)) 
      (when x-select-enable-clipboard 
      (x-set-selection 'CLIPBOARD text) 
      (setq x-last-selected-text-clipboard text)))))) 
+0

कोई कारण यह उत्तर बेहतर है? – justingordon

+0

यह सिर्फ ऐविल से नहीं, बल्कि हर जगह कीबोर्ड पर चुने गए चयनित पाठ की समस्या को हल करता है। –

+0

मेरे लिए उन एनएस-सेट-पेस्टबोर्ड, एनएस-गेट-पेस्टबोर्ड मौजूद नहीं प्रतीत होते हैं इसलिए टेक्स्ट इत्यादि करते समय मुझे त्रुटियां मिलती हैं। (Emacs-mac) –

3

इस जबकि इस समस्या का समाधान के लिए Googling बारे में जाना। मुझे जो काम मिला वह Spacemacs FAQ का हिस्सा है:

(fset 'evil-visual-update-x-selection 'ignore) 
संबंधित मुद्दे