Skip to content

Instantly share code, notes, and snippets.

@iocanel
Created October 18, 2021 19:45
Show Gist options
  • Save iocanel/acb240650095baac571ffc371f9bde83 to your computer and use it in GitHub Desktop.
Save iocanel/acb240650095baac571ffc371f9bde83 to your computer and use it in GitHub Desktop.
Get the current user from the github buffer
(defun github-current-user ()
"Get the curently logged in user."
(let ((page-source (if (web-buffer-p (current-buffer))
(plump:serialize (document-model (current-buffer)) nil)
(ffi-buffer-get-document (current-buffer)))))
(ppcre:register-groups-bind (user) (".*<meta name=\"user-login\" content=\"([a-zA-Z0-9_-]+)\">.*" page-source) user)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment