Created
July 25, 2012 08:02
-
-
Save syohex/3175009 to your computer and use it in GitHub Desktop.
Sample program of popup-cascade-menu
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
(require 'popup) | |
(defun cui-about (user) | |
(with-temp-buffer | |
(let* ((url (format "http://cui-about.me/%s" user)) | |
(cmd (format "curl %s" url)) | |
(ret (call-process-shell-command cmd nil t nil))) | |
(unless (= ret 0) | |
(error (format "Failed: %s" cmd))) | |
(goto-char (point-min)) | |
(save-excursion | |
(let ((regexp (format "%s : User Not Found" user))) | |
(if (re-search-forward regexp nil t nil) | |
(error regexp)))) | |
(let (info) | |
(while (re-search-forward "^\\([^ ]+\\) = \\(.+\\)$" nil t nil) | |
(let ((key (match-string 1)) | |
(value (match-string 2))) | |
(if (string-match "^http://" value) | |
(push (list key value) info)))) | |
info)))) | |
(defun test (user) | |
(interactive | |
(list (read-string "User name >> "))) | |
(browse-url (popup-cascade-menu (cui-about user)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment