Skip to content

Instantly share code, notes, and snippets.

@syohex
Created July 25, 2012 08:02
Show Gist options
  • Save syohex/3175009 to your computer and use it in GitHub Desktop.
Save syohex/3175009 to your computer and use it in GitHub Desktop.
Sample program of popup-cascade-menu
(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