Skip to content

Instantly share code, notes, and snippets.

Avatar

Pranav Kant pranavk

View GitHub Profile
@kristianhellquist
kristianhellquist / custom.el
Created Jul 10, 2012
Emacs, copy current file and line number to clipboard
View custom.el
(defun copy-current-line-position-to-clipboard ()
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'"
(interactive)
(let ((path-with-line-number
(concat (buffer-file-name) ":" (number-to-string (line-number-at-pos)))))
(x-select-text path-with-line-number)
(message (concat path-with-line-number " copied to clipboard"))))
(define-key global-map (kbd "M-l") 'copy-current-line-position-to-clipboard)