summary refs log tree commit diff
path: root/emacs/elisp
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-03-25 06:54:29 -0700
committerFranck Cuny <franck@fcuny.net>2022-03-25 06:54:29 -0700
commit184dc7957f2b5b878239f45aecd317aa3da1d9f4 (patch)
tree33460be659ebd2df6034f2559ddfd64016692e13 /emacs/elisp
parentgit-extra: fix docstring (diff)
downloademacs.d-184dc7957f2b5b878239f45aecd317aa3da1d9f4.tar.gz
web-extra: function to do a search on github
Diffstat (limited to 'emacs/elisp')
-rw-r--r--emacs/elisp/my-web.el13
1 files changed, 12 insertions, 1 deletions
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