From 184dc7957f2b5b878239f45aecd317aa3da1d9f4 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 25 Mar 2022 06:54:29 -0700 Subject: web-extra: function to do a search on github --- emacs/elisp/my-web.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/emacs/elisp/my-web.el b/emacs/elisp/my-web.el index 12e5c97..75951f4 100644 --- a/emacs/elisp/my-web.el +++ b/emacs/elisp/my-web.el @@ -4,7 +4,7 @@ (require 'my-strings) -(defun fcuny/get-page-title (url) +(defun my/get-page-title (url) "Make URL into an 'org-mode' link." (let ((title)) (with-current-buffer (url-retrieve-synchronously url) @@ -17,5 +17,16 @@ (decode-coding-string title 'utf-8)) (concat "[[" url "][" title "]]")))) +(defun my/github-code-search () + "Search code on github for a given language." + (interactive) + (let ((language (completing-read + "Language: " + '("Emacs Lisp" "Python" "Go"))) + (code (read-string "Code: "))) + (browse-url + (concat "https://github.com/search?l=" language + "&type=code&q=" code)))) + (provide 'my-web) ;;; my-web.el ends here -- cgit 1.4.1