Created
March 24, 2017 11:43
-
-
Save fatfingererr/1fda91865dd17cf9683750d0b215fa2d to your computer and use it in GitHub Desktop.
The question about "copy" in Emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun build-variable () | |
(interactive) | |
(let | |
;; 擷取當前那行程式碼並依照空格分開來 | |
((line-string (split-string (thing-at-point 'line t)))) | |
;; 刪除原本那行 | |
(kill-whole-line) | |
;; 新的一行會從原本那行第一個元素和剩下元素但首字大寫做合併 | |
(setq new-line-string (apply 'concat (append (list (first line-string)) (mapcar 'capitalize (cdr line-string))))) | |
;; 插入新的那行 | |
(insert new-line-string) | |
;; 複製新的那行 | |
(copy new-line-string) | |
) | |
) | |
aaa bbb ddd | |
;; 在上面這行執行會變成: aaaBbbDdd | |
;; 但是當我用 C-y 貼上卻還是原本的 aaa bbb ddd | |
;; 為什麼呢? 謝謝! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment