Created
February 20, 2017 19:25
-
-
Save gdevanla/b663ca6034bf080a51a87c4dbb69d36a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;;; package --- Something here | |
;;; Commentary: | |
;;; Code: | |
(defun get-line-no () | |
"Returns line no of first argument" | |
(interactive) | |
(let* (lineno) | |
(save-excursion | |
(start-of-paragraph-text) | |
(setq lineno (line-number-at-pos (point))) | |
) | |
lineno)) | |
(defun remove-base-folder (path) | |
"PATH path of hs file." | |
(interactive) | |
(let ((base-path "/home/user/fsf/scotty/")) | |
(string-remove-prefix base-path path) | |
) | |
) | |
(defun scotty-href (buf) | |
"BUF to append to href." | |
(interactive | |
(list (read-buffer | |
"Append to buffer:" (other-buffer (current-buffer) t)) | |
)) | |
(let* ((lineno (get-line-no)) | |
(url "https://github.com/user/scotty/blob/master/%s\#%s") | |
(rel-file-path (remove-base-folder (buffer-file-name)))) | |
(with-current-buffer buf | |
(save-excursion | |
(message "linenon=%s" lineno) | |
(insert (format url rel-file-path lineno)))) | |
) | |
) | |
(provide 't.el) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment