spacemacs/layers/+source-control/github/funcs.el

51 lines
1.6 KiB
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; funcs.el --- GitHub layer functions File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; Forge
(defun spacemacs/forge-get-info-from-fetched-notification-error (err)
"Return info for given s-exp error return by `forge-pull-notifications'.
Call this function interactively and paste the s-exp from the error returned by
the `forge-pull-notifications' function.
Example of error:
error in process filter: ghub--signal-error: peculiar error:
((path \"query\" \"_Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTI5MDM3NDE6NTI0NzY1\")
(extensions (code . \"undefinedField\")
(typeName . \"Query\")
(fieldName . \"nil\"))
(locations ((line . 2) (column . 1)))
(message . \"Field 'nil' doesn't exist on type 'Query'\"))
Function adapted from issue:
https://github.com/magit/forge/issues/80#issuecomment-456103195
"
(interactive "xs-exp: ")
(message "%s" err)
(let* ((query_value (third (car err)))
(result (car (forge-sql
[:select [owner name]
:from repository
:where (= id $s1)]
(base64-encode-string
(mapconcat
#'identity
(butlast
(split-string
(base64-decode-string (substring query_value 1))
":"))
":")
t)))))
(message "repository: %s/%s" (car result) (cadr result))))