質問編集履歴
3
typo
title
CHANGED
File without changes
|
body
CHANGED
@@ -76,7 +76,7 @@
|
|
76
76
|
(shell-command-to-string "xsel --clipboard < ~/__tmp")
|
77
77
|
```
|
78
78
|
|
79
|
-
### 下のコードで、とりあえず last copy を clipboard に
|
79
|
+
### 下のコードで、とりあえず last copy を clipboard にコピーできるようにできました。 add date:2018/07/10 (火) time:00:58
|
80
80
|
|
81
81
|
``` elsep
|
82
82
|
(defun last-copy-to-clipboard ()
|
2
xsel option を変えました
title
CHANGED
File without changes
|
body
CHANGED
@@ -74,4 +74,35 @@
|
|
74
74
|
(shell-command "xsel --clipboard < ~/__tmp")
|
75
75
|
↓
|
76
76
|
(shell-command-to-string "xsel --clipboard < ~/__tmp")
|
77
|
-
```
|
77
|
+
```
|
78
|
+
|
79
|
+
### 下のコードで、とりあえず last copy を clipboard にこぴーできるうよにできました。 add date:2018/07/10 (火) time:00:58
|
80
|
+
|
81
|
+
``` elsep
|
82
|
+
(defun last-copy-to-clipboard ()
|
83
|
+
"set last copy to x-clipboard."
|
84
|
+
(interactive)
|
85
|
+
(let (bufferAt (buffer-name))
|
86
|
+
|
87
|
+
(switch-to-buffer "__tmp")
|
88
|
+
(insert (car kill-ring-yank-pointer))
|
89
|
+
(write-file "~/__tmp")
|
90
|
+
(sit-for 0.1)
|
91
|
+
(shell-command "xsel -ib < ~/__tmp")
|
92
|
+
(spacemacs/kill-this-buffer)
|
93
|
+
(switch-to-buffer bufferAt)
|
94
|
+
)
|
95
|
+
)
|
96
|
+
~~~
|
97
|
+
|
98
|
+
xsel コマンドのの option が --clipboard だけでは足りないらしく標準入力も指定しなければならないのが誤動作の原因のようです。 terminal ではデフォルトで標準入力になっているようです。
|
99
|
+
|
100
|
+
ただし、このコードだと buffer が別のところに変わってしまいます。下の (switch-to-buffer ...) で元の buffer に戻しているつもりですが、予想外のバッファになってしまいます。
|
101
|
+
``` elsep
|
102
|
+
(let (bufferAt (buffer-name))
|
103
|
+
snipped
|
104
|
+
(switch-to-buffer bufferAt)
|
105
|
+
)
|
106
|
+
```
|
107
|
+
|
108
|
+
何か拙い箇所があったら指摘してやってください。
|
1
(shell-command-to-string ...) を試した
title
CHANGED
File without changes
|
body
CHANGED
@@ -65,4 +65,13 @@
|
|
65
65
|
1. last-copy-to-clipbard() 関数が上手く動かない理由と対策についての情報
|
66
66
|
2. このような process 間にまたがる elisp 関数のデバッグの仕方についての情報
|
67
67
|
|
68
|
-
について、ご意見をいただけますでしょうか
|
68
|
+
について、ご意見をいただけますでしょうか
|
69
|
+
|
70
|
+
### 追加で試したこと add at time:15:38
|
71
|
+
|
72
|
+
下のように変更してみましたが、同じ結果でした。
|
73
|
+
``` elisp
|
74
|
+
(shell-command "xsel --clipboard < ~/__tmp")
|
75
|
+
↓
|
76
|
+
(shell-command-to-string "xsel --clipboard < ~/__tmp")
|
77
|
+
```
|