Skip to content

Instantly share code, notes, and snippets.

@noqisofon
Created December 3, 2010 06:58
Show Gist options
  • Save noqisofon/726666 to your computer and use it in GitHub Desktop.
Save noqisofon/726666 to your computer and use it in GitHub Desktop.
クリップボードに貼り付ける系関数(xyzzy lisp 的な意味で)。
(defun clipboard-to-datetime()
"現在時刻をクリップボードに貼り付けます。"
(interactive)
(copy-to-clipboard (format-date-string "%Y-%m-%dT%H:%M:%S%Z")))
(defun get-basename-from-fullpath (fullpath)
"フルパスから最後のスラッシュまで削除した部分を返します。"
(let ((parts (split-string fullpath "/")))
(car (last parts))))
(defun clipboard-to-selection-buffer-name ()
"現在選択しているバッファのファイル名または、バッファ名をクリップボードに貼り付けます。"
(interactive)
(copy-to-clipboard (let ((file-name (get-buffer-file-name)))
(if file-name
(get-basename-from-fullpath file-name)
;; else
(buffer-name (selected-buffer))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment