Fix xclip-mode to not print an error when there is no selection
This commit is contained in:
		
							
								
								
									
										24
									
								
								init.el
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								init.el
									
									
									
									
									
								
							@ -633,7 +633,27 @@ in the region and indents once)."
 | 
				
			|||||||
;; allow copy from terminal
 | 
					;; allow copy from terminal
 | 
				
			||||||
(use-package xclip
 | 
					(use-package xclip
 | 
				
			||||||
  :config
 | 
					  :config
 | 
				
			||||||
  (xclip-mode 1))
 | 
					  (xclip-mode 1)
 | 
				
			||||||
 | 
					  (defun my/-xclip-detect-wl-paste-error (oldfun type)
 | 
				
			||||||
 | 
					    (if (eq xclip-method 'wl-copy)
 | 
				
			||||||
 | 
					        ;; Direct from `xclip-get-selection'
 | 
				
			||||||
 | 
					        (when (and (getenv "WAYLAND_DISPLAY")
 | 
				
			||||||
 | 
					                   (memq type '(clipboard CLIPBOARD primary PRIMARY)))
 | 
				
			||||||
 | 
					          (let* ((exit-code 0)
 | 
				
			||||||
 | 
					                 (output
 | 
				
			||||||
 | 
					                  (with-output-to-string
 | 
				
			||||||
 | 
					                    (setq exit-code
 | 
				
			||||||
 | 
					                          (apply #'call-process (replace-regexp-in-string
 | 
				
			||||||
 | 
					                                                 "\\(.*\\)copy" "\\1paste"
 | 
				
			||||||
 | 
					                                                 xclip-program 'fixedcase)
 | 
				
			||||||
 | 
					                                 nil standard-output nil
 | 
				
			||||||
 | 
					                                 "-n" (if (memq type '(primary PRIMARY))
 | 
				
			||||||
 | 
					                                          '("-p")))))))
 | 
				
			||||||
 | 
					            (if (zerop exit-code)
 | 
				
			||||||
 | 
					                output
 | 
				
			||||||
 | 
					              "")))
 | 
				
			||||||
 | 
					      (funcall oldfun type)))
 | 
				
			||||||
 | 
					  (advice-add 'xclip-get-selection :around 'my/-xclip-detect-wl-paste-error))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; which-key
 | 
					;; which-key
 | 
				
			||||||
(use-package which-key
 | 
					(use-package which-key
 | 
				
			||||||
@ -1939,6 +1959,8 @@ If no name is given, list all bookmarks instead."
 | 
				
			|||||||
(use-package proced
 | 
					(use-package proced
 | 
				
			||||||
  :bind ("C-x j" . proced)
 | 
					  :bind ("C-x j" . proced)
 | 
				
			||||||
  :init
 | 
					  :init
 | 
				
			||||||
 | 
					  (evil-define-key '(motion visual normal) proced-mode-map
 | 
				
			||||||
 | 
					    "u" 'proced-unmark)
 | 
				
			||||||
  (setq proced-auto-update-flag t
 | 
					  (setq proced-auto-update-flag t
 | 
				
			||||||
        proced-auto-update-interval 1)
 | 
					        proced-auto-update-interval 1)
 | 
				
			||||||
  (defun my/-setup-proced-mode ()
 | 
					  (defun my/-setup-proced-mode ()
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user