Skip to content

Instantly share code, notes, and snippets.

@binshengliu
Forked from kristianhellquist/custom.el
Created April 12, 2013 14:37
Show Gist options
  • Save binshengliu/5372467 to your computer and use it in GitHub Desktop.
Save binshengliu/5372467 to your computer and use it in GitHub Desktop.
(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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment