Update packages

This commit is contained in:
Gergely Polonkai 2016-10-12 10:42:37 +02:00
parent 370e6e91af
commit 23962832ec
175 changed files with 343 additions and 186 deletions

View File

@ -1,9 +1,9 @@
;;; async-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "async" "async.el" (22404 60275 161929 555000))
;;;### (autoloads nil "async" "async.el" (22525 59329 588470 914000))
;;; Generated autoloads from async.el
(autoload 'async-start-process "async" "\
@ -68,8 +68,8 @@ returns nil. It can still be useful, however, as an argument to
;;;***
;;;### (autoloads nil "async-bytecomp" "async-bytecomp.el" (22404
;;;;;; 60275 153929 514000))
;;;### (autoloads nil "async-bytecomp" "async-bytecomp.el" (22525
;;;;;; 59329 584470 885000))
;;; Generated autoloads from async-bytecomp.el
(autoload 'async-byte-recompile-directory "async-bytecomp" "\
@ -80,7 +80,8 @@ All *.elc files are systematically deleted before proceeding.
(defvar async-bytecomp-package-mode nil "\
Non-nil if Async-Bytecomp-Package mode is enabled.
See the command `async-bytecomp-package-mode' for a description of this minor mode.
See the `async-bytecomp-package-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `async-bytecomp-package-mode'.")
@ -96,13 +97,14 @@ Async compilation of packages can be controlled by
;;;***
;;;### (autoloads nil "dired-async" "dired-async.el" (22404 60275
;;;;;; 137929 430000))
;;;### (autoloads nil "dired-async" "dired-async.el" (22525 59329
;;;;;; 572470 801000))
;;; Generated autoloads from dired-async.el
(defvar dired-async-mode nil "\
Non-nil if Dired-Async mode is enabled.
See the command `dired-async-mode' for a description of this minor mode.
See the `dired-async-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `dired-async-mode'.")
@ -116,8 +118,8 @@ Do dired actions asynchronously.
;;;***
;;;### (autoloads nil nil ("async-pkg.el" "smtpmail-async.el") (22404
;;;;;; 60275 190952 741000))
;;;### (autoloads nil nil ("async-pkg.el" "smtpmail-async.el") (22525
;;;;;; 59329 592470 942000))
;;;***

View File

@ -1,4 +1,4 @@
(define-package "async" "20160711.2235" "Asynchronous processing in Emacs" 'nil :keywords
(define-package "async" "20161010.2322" "Asynchronous processing in Emacs" 'nil :keywords
'("async")
:url "https://github.com/jwiegley/emacs-async")
;; Local Variables:

View File

@ -262,7 +262,7 @@ ESC or `q' to not overwrite any of the remaining files,
for destp = (file-exists-p to)
do (and bf destp
(with-current-buffer bf
(set-visited-file-name to nil t))))))))
(set-visited-file-name to t t))))))))
;; Start async process.
(when async-fn-list
(async-start `(lambda ()

View File

@ -3,8 +3,8 @@
;;; Code:
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "git-rebase" "git-rebase.el" (22523 21243 636405
;;;;;; 758000))
;;;### (autoloads nil "git-rebase" "git-rebase.el" (22525 59336 620520
;;;;;; 53000))
;;; Generated autoloads from git-rebase.el
(autoload 'git-rebase-mode "git-rebase" "\
@ -23,7 +23,7 @@ running 'man git-rebase' at the command line) for details.
;;;***
;;;### (autoloads nil "magit" "magit.el" (22523 21243 716406 348000))
;;;### (autoloads nil "magit" "magit.el" (22525 59336 712520 692000))
;;; Generated autoloads from magit.el
(autoload 'magit-status "magit" "\
@ -501,8 +501,8 @@ Git, and Emacs in the echo area.
;;;***
;;;### (autoloads nil "magit-apply" "magit-apply.el" (22523 21243
;;;;;; 656405 906000))
;;;### (autoloads nil "magit-apply" "magit-apply.el" (22525 59336
;;;;;; 648520 248000))
;;; Generated autoloads from magit-apply.el
(autoload 'magit-stage-file "magit-apply" "\
@ -538,8 +538,8 @@ Remove all changes from the staging area.
;;;***
;;;### (autoloads nil "magit-autorevert" "magit-autorevert.el" (22523
;;;;;; 21243 588405 405000))
;;;### (autoloads nil "magit-autorevert" "magit-autorevert.el" (22525
;;;;;; 59336 588519 830000))
;;; Generated autoloads from magit-autorevert.el
(defvar magit-revert-buffers t)
@ -568,8 +568,8 @@ See `auto-revert-mode' for more information on Auto-Revert mode.
;;;***
;;;### (autoloads nil "magit-bisect" "magit-bisect.el" (22523 21243
;;;;;; 652405 876000))
;;;### (autoloads nil "magit-bisect" "magit-bisect.el" (22525 59336
;;;;;; 640520 192000))
;;; Generated autoloads from magit-bisect.el
(autoload 'magit-bisect-popup "magit-bisect" nil t)
@ -620,8 +620,8 @@ bisect run'.
;;;***
;;;### (autoloads nil "magit-blame" "magit-blame.el" (22523 21243
;;;;;; 704406 260000))
;;;### (autoloads nil "magit-blame" "magit-blame.el" (22525 59336
;;;;;; 700520 609000))
;;; Generated autoloads from magit-blame.el
(autoload 'magit-blame-popup "magit-blame" nil t)
@ -645,8 +645,8 @@ only arguments available from `magit-blame-popup' should be used.
;;;***
;;;### (autoloads nil "magit-commit" "magit-commit.el" (22523 21243
;;;;;; 604405 523000))
;;;### (autoloads nil "magit-commit" "magit-commit.el" (22525 59336
;;;;;; 592519 858000))
;;; Generated autoloads from magit-commit.el
(autoload 'magit-commit "magit-commit" "\
@ -728,8 +728,8 @@ Create a squash commit targeting COMMIT and instantly rebase.
;;;***
;;;### (autoloads nil "magit-diff" "magit-diff.el" (22523 21243 696406
;;;;;; 200000))
;;;### (autoloads nil "magit-diff" "magit-diff.el" (22525 59336 696520
;;;;;; 581000))
;;; Generated autoloads from magit-diff.el
(autoload 'magit-diff-popup "magit-diff" "\
@ -813,8 +813,8 @@ for a revision.
;;;***
;;;### (autoloads nil "magit-ediff" "magit-ediff.el" (22523 21243
;;;;;; 684406 112000))
;;;### (autoloads nil "magit-ediff" "magit-ediff.el" (22525 59336
;;;;;; 684520 498000))
;;; Generated autoloads from magit-ediff.el
(autoload 'magit-ediff-popup "magit-ediff" nil t)
@ -902,8 +902,8 @@ stash that were staged.
;;;***
;;;### (autoloads nil "magit-extras" "magit-extras.el" (22523 21243
;;;;;; 608405 552000))
;;;### (autoloads nil "magit-extras" "magit-extras.el" (22525 59336
;;;;;; 596519 887000))
;;; Generated autoloads from magit-extras.el
(autoload 'magit-run-git-gui "magit-extras" "\
@ -973,8 +973,8 @@ on a position in a file-visiting buffer.
;;;***
;;;### (autoloads nil "magit-log" "magit-log.el" (22523 21243 692406
;;;;;; 171000))
;;;### (autoloads nil "magit-log" "magit-log.el" (22525 59336 692520
;;;;;; 553000))
;;; Generated autoloads from magit-log.el
(autoload 'magit-log-buffer-file-popup "magit-log" "\
@ -1056,8 +1056,8 @@ Show commits in a branch that are not merged in the upstream branch.
;;;***
;;;### (autoloads nil "magit-remote" "magit-remote.el" (22523 21243
;;;;;; 740406 526000))
;;;### (autoloads nil "magit-remote" "magit-remote.el" (22525 59336
;;;;;; 728520 804000))
;;; Generated autoloads from magit-remote.el
(autoload 'magit-clone "magit-remote" "\
@ -1289,8 +1289,8 @@ is asked to pull. START has to be reachable from that commit.
;;;***
;;;### (autoloads nil "magit-sequence" "magit-sequence.el" (22523
;;;;;; 21243 724406 407000))
;;;### (autoloads nil "magit-sequence" "magit-sequence.el" (22525
;;;;;; 59336 716520 720000))
;;; Generated autoloads from magit-sequence.el
(autoload 'magit-sequencer-continue "magit-sequence" "\
@ -1440,8 +1440,8 @@ Abort the current rebase operation, restoring the original branch.
;;;***
;;;### (autoloads nil "magit-stash" "magit-stash.el" (22523 21243
;;;;;; 672406 24000))
;;;### (autoloads nil "magit-stash" "magit-stash.el" (22525 59336
;;;;;; 668520 386000))
;;; Generated autoloads from magit-stash.el
(autoload 'magit-stash-popup "magit-stash" nil t)
@ -1540,8 +1540,8 @@ Show all diffs of a stash in a buffer.
;;;***
;;;### (autoloads nil "magit-submodule" "magit-submodule.el" (22523
;;;;;; 21243 760406 672000))
;;;### (autoloads nil "magit-submodule" "magit-submodule.el" (22525
;;;;;; 59336 744520 915000))
;;; Generated autoloads from magit-submodule.el
(autoload 'magit-submodule-popup "magit-submodule" nil t)
@ -1631,8 +1631,8 @@ Display a list of the current repository's submodules.
;;;***
;;;### (autoloads nil "magit-subtree" "magit-subtree.el" (22523 21243
;;;;;; 640405 788000))
;;;### (autoloads nil "magit-subtree" "magit-subtree.el" (22525 59336
;;;;;; 628520 107000))
;;; Generated autoloads from magit-subtree.el
(autoload 'magit-subtree-popup "magit-subtree" nil t)
@ -1668,8 +1668,8 @@ Extract the history of the subtree PREFIX.
;;;***
;;;### (autoloads nil "magit-wip" "magit-wip.el" (22523 21243 620405
;;;;;; 640000))
;;;### (autoloads nil "magit-wip" "magit-wip.el" (22525 59336 608519
;;;;;; 969000))
;;; Generated autoloads from magit-wip.el
(defvar magit-wip-after-save-mode nil "\
@ -1739,7 +1739,7 @@ command which is about to be called are committed.
;;;### (autoloads nil nil ("magit-core.el" "magit-git.el" "magit-mode.el"
;;;;;; "magit-pkg.el" "magit-process.el" "magit-section.el" "magit-utils.el")
;;;;;; (22523 21243 744406 555000))
;;;;;; (22525 59336 732520 832000))
;;;***

View File

@ -1065,8 +1065,7 @@ the buffer in another window."
(--when-let (car magit-refresh-args)
(and (string-match "\\.\\.\\([^.].*\\)?[ \t]*\\'" it)
(match-string 1 it))))
((derived-mode-p 'magit-status-mode)
(magit-rev-name "HEAD"))))
))
(unmerged-p (magit-anything-unmerged-p file))
hunk line col buffer)
(pcase (magit-diff-scope)
@ -1083,6 +1082,8 @@ the buffer in another window."
(`list
(setq hunk (car (magit-section-children
(car (magit-section-children current)))))))
(when (and rev (magit-rev-head-p rev))
(setq rev nil))
(when (and hunk
;; Currently the `hunk' type is also abused for file
;; mode changes. Luckily such sections have no value.
@ -1096,12 +1097,16 @@ the buffer in another window."
(magit-display-file-buffer buffer)
(with-current-buffer buffer
(when line
(save-restriction
(widen)
(goto-char (point-min))
(forward-line (1- line))
(when col
(move-to-column col))))
(let ((pos (save-restriction
(widen)
(goto-char (point-min))
(forward-line (1- line))
(when col
(move-to-column col))
(point))))
(unless (<= (point-min) pos (point-max))
(widen)
(goto-char pos))))
(when unmerged-p
(smerge-start-session))
(run-hooks 'magit-diff-visit-file-hook)))))
@ -1151,9 +1156,12 @@ or `HEAD'."
(stop (line-number-at-pos))
(cstart (save-excursion (goto-char cpos)
(line-number-at-pos)))
(prior (save-excursion (goto-char (line-beginning-position))
(looking-at "-")))
(line (nth (if prior 1 2) value)))
(prior (and (= (length value) 3)
(save-excursion (goto-char (line-beginning-position))
(looking-at "-"))))
(line (if prior
(cadr value)
(car (last value)))))
(string-match (format "^%s\\([0-9]+\\)" (if prior "-" "\\+")) line)
(setq line (string-to-number (match-string 1 line)))
(when (> cstart stop)

View File

@ -1,4 +1,4 @@
(define-package "magit" "20161009.1658" "A Git porcelain inside Emacs"
(define-package "magit" "20161011.1700" "A Git porcelain inside Emacs"
'((emacs "24.4")
(async "20160711.223")
(dash "20160820.501")

View File

@ -791,7 +791,8 @@ as argument."
default-dir (process-get arg 'default-dir)
section (process-get arg 'section)
arg (process-exit-status arg)))
(magit-process-unset-mode-line)
(with-current-buffer process-buf
(magit-process-unset-mode-line))
(when (featurep 'dired)
(dired-uncache default-dir))
(when (buffer-live-p process-buf)
@ -866,8 +867,8 @@ as argument."
;;; magit-process.el ends soon
(define-obsolete-variable-alias 'magit-git-output-coding-system
'magit-log-output-coding-system "Magit 2.9.0")
(define-obsolete-variable-alias 'magit-log-output-coding-system
'magit-git-output-coding-system "Magit 2.9.0")
(provide 'magit-process)
;; Local Variables:

View File

@ -559,9 +559,15 @@ Both the source and the target are read in the minibuffer."
(interactive
(let ((source (magit-read-local-branch-or-commit "Push")))
(list source
(magit-read-remote-branch (format "Push %s to" source) nil
(magit-get-upstream-branch source)
source 'confirm)
(magit-read-remote-branch
(format "Push %s to" source) nil
(if (magit-local-branch-p source)
(or (magit-get-push-branch source)
(magit-get-upstream-branch source))
(and (magit-rev-ancestor-p source "HEAD")
(or (magit-get-push-branch)
(magit-get-upstream-branch))))
source 'confirm)
(magit-push-arguments))))
(magit-git-push source target args))

View File

@ -490,6 +490,22 @@ FORMAT-STRING to be displayed, then don't."
(unless (--first (string-prefix-p it format-string) magit-no-message)
(apply #'message format-string args)))
(defvar whitespace-mode)
(defun whitespace-dont-turn-on-in-magit-mode ()
"Prevent `whitespace-mode' from being turned on in Magit buffers.
Because `whitespace-mode' uses font-lock and Magit does not,
they are not compatible. See `magit-diff-paint-whitespace'
for an alternative."
(when (derived-mode-p 'magit-mode)
(setq whitespace-mode nil)
(user-error
"Whitespace-Mode isn't compatible with Magit. %s"
"See `magit-diff-paint-whitespace' for an alternative.")))
(advice-add 'whitespace-turn-on :before
'whitespace-dont-turn-on-in-magit-mode)
;;; magit-utils.el ends soon
(provide 'magit-utils)
;; Local Variables:

View File

@ -4,8 +4,8 @@
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil nil ("magithub-cache.el" "magithub-ci.el" "magithub-core.el"
;;;;;; "magithub-issue.el" "magithub-pkg.el" "magithub.el") (22516
;;;;;; 57895 765484 157000))
;;;;;; "magithub-issue.el" "magithub-pkg.el" "magithub.el") (22525
;;;;;; 59330 912480 205000))
;;;***

View File

@ -81,7 +81,7 @@ If CACHE is nil, the entire cache is cleared."
(defun magithub-refresh ()
"Refresh all GitHub data."
(interactive)
(magithub-cache-clear)
(magithub-cache-clear (magithub-repo-id))
(magit-refresh))
(provide 'magithub-cache)

View File

@ -27,10 +27,27 @@
(require 'magit)
(require 'magit-section)
(require 'magit-popup)
(require 'dash)
(require 'magithub-core)
(require 'magithub-cache)
(defconst magithub-ci-status-symbol-alist
'(("" . success)
("" . failure) ; also means `error'... gross
("" . pending))
"Because hub 2.3 is silly and does silly things.
Reference: https://github.com/github/hub/blob/master/commands/ci_status.go#L107")
(defconst magithub-ci-status-regex
(rx bos
(group any) (* any) "\t"
(group (* any)) "\t"
(? (group (* any))) eos))
(defvar magithub-ci-urls nil
"An alist mapping of repositories to CI urls.")
(defun magithub-ci-enabled-p ()
"Non-nil if CI is enabled for this repository.
If magithub.ci.enabled is not set, CI is considered to be enabled."
@ -79,34 +96,75 @@ If magithub.ci.enabled is not set, CI is considered to be enabled."
(if new-value (apply #'magit-set new-value keys)
(apply #'magit-get keys))))
(defun magithub-ci-update-urls (statuses)
"Updates `magithub-ci-urls' according to STATUSES.
See also `magithub-repo-id'."
(let* ((id (magithub-repo-id))
(repo-urls (assoc id magithub-ci-urls))
(urls (mapcar (lambda (s) (plist-get s :url)) statuses)))
(if repo-urls (setcdr repo-urls urls)
(add-to-list 'magithub-ci-urls (cons id urls))
urls)))
(defun magithub-ci-status--parse-2.2.8 (output)
"Backwards compatibility for old versions of hub.
See `magithub-ci-status--parse'."
(--when-let (cdr (s-match (rx bos (group (+ (any alpha space)))
(? ": " (group (+ (not (any " "))))) eos)
output))
(let ((status (list :status (intern (replace-regexp-in-string "\s" "-" (car it)))
:url (cadr it))))
(magithub-ci-update-urls (list status))
status)))
(defun magithub-ci-status--internal (&optional for-commit)
"One of 'success, 'error, 'failure, 'pending, or 'no-status."
(with-temp-message "Updating CI status..."
(let* ((current-commit (magit-rev-parse "HEAD"))
(last-commit (or for-commit current-commit))
(output (car (magithub--command-output "ci-status" `("-v" ,last-commit)))))
(if (string-match (rx bos (group (+ (any alpha space)))
(? ": " (group (+ (not (any " "))))) eos)
output)
(let (status url)
(setq status (intern (replace-regexp-in-string "\s" "-" (match-string 1 output)))
url (match-string 2 output))
(when url (magit-set url "magithub" "ci" "url"))
(if (and (not for-commit) (eq status 'no-status))
(let ((last-commit (magithub-ci-status--last-commit)))
(unless (string-equal current-commit last-commit)
(magithub-ci-status--internal last-commit))
(magithub-ci-status-current-commit current-commit)
status)
(magithub-ci-status-current-commit current-commit)
status))
(beep)
(setq magithub-hub-error
(message
(concat "Hub didn't have any output for \"ci-status\"!\n"
"Are you connected to the internet?\n"
"Consider submitting an issue to github/hub.")))
'internal-error))))
(let* ((current-commit (magit-rev-parse "HEAD"))
(last-commit (or for-commit current-commit))
(output (magithub--command-output "ci-status" `("-v" ,last-commit))))
(--if-let (if (magithub-hub-version-at-least "2.3")
(car (magithub-ci-status--parse output))
(magithub-ci-status--parse-2.2.8 (car output)))
(prog1 (or (plist-get it :status) 'no-status)
(if (not (or for-commit (plist-get it :status)))
(let ((last-commit (magithub-ci-status--last-commit)))
(unless (string-equal current-commit last-commit)
(magithub-ci-status--internal last-commit))
(magithub-ci-status-current-commit current-commit))
(magithub-ci-status-current-commit current-commit)))
(beep)
(setq magithub-hub-error
(message
(concat "Hub didn't have any recognizable output for \"ci-status\"!\n"
"Are you connected to the internet?\n"
"Consider submitting an issue to github/hub.")))
'internal-error)))
(defun magithub-ci-status--parse (output)
"Parse a string OUTPUT into a list of statuses.
The first status will be an `overall' status."
(let ((statuses (mapcar #'magithub-ci-status--parse-line output))
(get-status (lambda (status) (lambda (s) (eq (plist-get s :status) status)))))
(magithub-ci-update-urls statuses)
(cons
(list :check 'overall
:status
(cond
((-all? (funcall get-status 'success) statuses) 'success)
((-some? (funcall get-status 'pending) statuses) 'pending)
((-some? (funcall get-status 'error) statuses) 'error)
((-some? (funcall get-status 'failure) statuses) 'failure)))
statuses)))
(defun magithub-ci-status--parse-line (line)
"Parse a single LINE of status into a status plist."
(--if-let (cdr (s-match magithub-ci-status-regex line))
(list :status (cdr (assoc (car it) magithub-ci-status-symbol-alist))
:url (car (cddr it))
:check (cadr it))
(if (string= line "no-status")
'no-status
(if (string= line "") 'no-output))))
(defun magithub-ci-status--last-commit ()
"Find the commit considered to have the current CI status.
@ -178,13 +236,12 @@ See the following resources:
"Browse the CI.
Sets up magithub.ci.url if necessary."
(interactive)
(let ((var-value (magit-get "magithub" "ci" "url")))
(unless var-value
(magit-set
(setq var-value (read-from-minibuffer "I don't know the CI URL yet -- what is it? I'll remember: ")
var-value (if (string-equal "" var-value) nil var-value))
"magithub" "ci" "url"))
(browse-url var-value)))
(let* ((urls (cdr (assoc (magithub-repo-id) magithub-ci-urls)))
(target-url (if (= 1 (length urls)) (car urls)
(when urls (completing-read "CI Dashboard URL: " urls)))))
(when (or (null target-url) (string= "" target-url))
(user-error "No CI URL detected"))
(browse-url target-url)))
(defvar magit-magithub-ci-status-section-map
(let ((map (make-sparse-keymap)))
@ -215,17 +272,11 @@ Sets up magithub.ci.url if necessary."
'face (if (facep face) face 'magithub-ci-unknown)))
(insert ?\n))))
(defun magithub-toggle-ci-status-header ()
(interactive)
(if (memq #'magithub-maybe-insert-ci-status-header magit-status-headers-hook)
(remove-hook 'magit-status-headers-hook #'magithub-maybe-insert-ci-status-header)
(if (executable-find magithub-hub-executable)
(add-hook 'magit-status-headers-hook #'magithub-maybe-insert-ci-status-header t)
(message "Magithub: (magithub-toggle-ci-status-header) `hub' isn't installed, so I can't insert the CI header")))
(when (derived-mode-p 'magit-status-mode)
(magit-refresh)))
(magithub--deftoggle magithub-toggle-ci-status-header
magit-status-headers-hook #'magithub-maybe-insert-ci-status-header "the CI header")
(magithub-toggle-ci-status-header)
(when (executable-find magithub-hub-executable)
(magithub-toggle-ci-status-header))
(provide 'magithub-ci)
;;; magithub-ci.el ends here

View File

@ -25,13 +25,13 @@
;;; Code:
(require 'magit)
(require 'dash)
(defun magithub-github-repository-p ()
"Non-nil if \"origin\" points to GitHub or a whitelisted domain."
(let ((url (magit-get "remote" "origin" "url")))
(when url
(cl-some (lambda (domain) (s-contains? domain url))
(cons "github.com" (magit-get-all "hub" "host"))))))
(--when-let (magit-get "remote" "origin" "url")
(-some? (lambda (domain) (s-contains? domain it))
(cons "github.com" (magit-get-all "hub" "host")))))
(defun magithub-repo-id ()
"Returns an identifying value for this repository."
@ -111,6 +111,17 @@ and returns its output as a list of lines."
"Quickly execute COMMAND with ARGS."
(ignore (magithub--command-output command args)))
(defun magithub-hub-version ()
"Return the `hub' version as a string."
(-> "--version"
magithub--command-output cadr
split-string cddr car
(split-string "-") car))
(defun magithub-hub-version-at-least (version-string)
"Return t if `hub's version is at least VERSION-STRING."
(version<= version-string (magithub-hub-version)))
(defun magithub--meta-new-issue ()
"Open a new Magithub issue.
See /.github/ISSUE_TEMPLATE.md in this repository."
@ -118,7 +129,7 @@ See /.github/ISSUE_TEMPLATE.md in this repository."
(browse-url "https://github.com/vermiculus/magithub/issues/new"))
(defun magithub--meta-help ()
"Opens Magithub help."
"Open Magithub help."
(interactive)
(browse-url "https://gitter.im/vermiculus/magithub"))
@ -180,5 +191,20 @@ See /.github/ISSUE_TEMPLATE.md in this repository."
(magithub--meta-new-issue))
(error err-message))
(defmacro magithub--deftoggle (name hook func s)
"Define a section-toggle command."
(declare (indent defun))
`(defun ,name ()
,(concat "Toggle the " s " section.")
(interactive)
(if (memq ,func ,hook)
(remove-hook ',hook ,func)
(if (executable-find magithub-hub-executable)
(add-hook ',hook ,func t)
(message ,(concat "`hub' isn't installed, so I can't insert " s))))
(when (derived-mode-p 'magit-status-mode)
(magit-refresh))
(memq ,func ,hook)))
(provide 'magithub-core)
;;; magithub-core.el ends here

View File

@ -26,6 +26,7 @@
(require 'magit)
(require 'magit-section)
(require 'dash)
(require 'magithub-core)
(require 'magithub-cache)
@ -71,7 +72,19 @@ are in DEFAULT are not prompted for again."
(let* ((default-labels (when default (s-split "," default t))))
(cl-set-difference (magithub-issue-label-list) default-labels)))))
(defun magithub-issue--process-line (s)
(defun magithub-issue--sort (issues)
"Sort ISSUES by issue number."
(sort issues
(lambda (a b) (< (plist-get a :number)
(plist-get b :number)))))
(defun magithub-issue--url-type (url)
"If URL corresponds to an issue, the symbol `issue'.
If URL correponds to a pull request, the symbol `pull-request'."
(if (string-match-p (rx "/pull/" (+ digit) eos) url)
'pull-request 'issue))
(defun magithub-issue--process-line-2.2.8 (s)
"Process a line S into an issue.
Returns a plist with the following properties:
@ -98,25 +111,49 @@ Returns a plist with the following properties:
(setq url (buffer-substring-no-properties (point) (point-max)))
t))
(list :number number
:type (if (string-match-p (rx "/pull/" (+ digit) eos) url)
'pull-request 'issue)
:type (magithub-issue--url-type url)
:title title
:url url)
(magithub-error
"failed to parse issue"
"There was an error parsing issues."))))
(defun magithub-issue-list--internal-2.2.8 ()
"Backwards compatibility for old versions of hub.
See `magithub-issue-list--internal'."
(magithub-issue--sort
(mapcar #'magithub-issue--process-line-2.2.8
(magithub--command-output "issue"))))
(defun magithub-issue--process-line (s)
"Process a line S into an issue.
Returns a plist with the following properties:
:number issue or pull request number
:type either 'pull-request or 'issue
:title the title of the issue or pull request
:url link to issue or pull request"
(let ((ss (split-string s ",")))
(list
:number (string-to-number (car ss))
:url (cadr ss)
:title (s-join "," (cddr ss))
:type (magithub-issue--url-type (cadr ss)))))
(defun magithub-issue-list--internal ()
"Return a new list of issues for the current repository."
(magithub-issue--sort
(mapcar #'magithub-issue--process-line
(magithub--command-output "issue" '("--format=%I,%U,%t%n")))))
(defun magithub-issue-list ()
"Return a list of issues for the current repository."
(magithub-cache (magithub-repo-id) :issues
'(with-temp-message "Retrieving issue list..."
(magithub-issue-list--internal))))
(defun magithub-issue-list--internal ()
(sort (mapcar #'magithub-issue--process-line
(magithub--command-output "issue"))
(lambda (a b) (< (plist-get a :number)
(plist-get b :number)))))
(if (magithub-hub-version-at-least "2.3")
(magithub-issue-list--internal)
(magithub-issue-list--internal-2.2.8)))))
(defun magithub-issue--insert (issue)
"Insert an `issue' as a Magit section into the buffer."
@ -129,11 +166,7 @@ Returns a plist with the following properties:
(let ((key (car formats)) (fmt (cadr formats)))
(setq s (concat s (format fmt (plist-get issue key)))))
(setq formats (cddr formats)))
(insert
(propertize
s 'face
(when (eq (plist-get issue :type) 'pull-request)
'magit-branch-remote))))
(insert s))
(insert ?\n))))
(defun magithub-issue-browse (issue)
@ -168,28 +201,42 @@ If `issue' is nil, open the repository's issues page."
map)
"Keymap for `magithub-issue-list' sections.")
(defun magithub-issue--insert-section ()
(defvar magit-magithub-pull-request-list-section-map
(let ((map (make-sparse-keymap)))
(define-key map [remap magit-visit-thing] #'magithub-issue-browse)
(define-key map [remap magit-refresh] #'magithub-issue-refresh)
map)
"Keymap for `magithub-pull-request-list' sections.")
(defun magithub-issue--insert-issue-section ()
"Insert GitHub issues if appropriate."
(when (magithub-usable-p)
(let* ((issues (magithub-issue-list)))
(--when-let (-filter (lambda (i) (eq (plist-get i :type) 'issue))
(magithub-issue-list))
(magit-insert-section (magithub-issue-list)
(magit-insert-heading "Issues and Pull Requests:")
(if issues (mapc #'magithub-issue--insert issues)
(insert " No issues.\n"))))))
(magit-insert-heading "Issues:")
(mapc #'magithub-issue--insert it)
(insert ?\n)))))
(defun magithub-issue--insert-pr-section ()
"Insert GitHub pull requests if appropriate."
(when (magithub-usable-p)
(--when-let (-filter (lambda (i) (eq (plist-get i :type) 'pull-request))
(magithub-issue-list))
(magit-insert-section (magithub-pull-request-list)
(magit-insert-heading "Pull Requests:")
(mapc #'magithub-issue--insert it)
(insert ?\n)))))
;;; Hook into the status buffer
(defun magithub-toggle-issues ()
(interactive)
(if (memq #'magithub-issue--insert-section magit-status-sections-hook)
(remove-hook 'magit-status-sections-hook #'magithub-issue--insert-section)
(if (executable-find magithub-hub-executable)
(add-hook ' magit-status-sections-hook #'magithub-issue--insert-section t)
(message "Magithub: (magithub-toggle-issues) `hub' isn't installed, so I can't insert issues")))
(when (derived-mode-p 'magit-status-mode)
(magit-refresh))
(memq #'magithub-issue--insert-section magit-status-sections-hook))
(magithub--deftoggle magithub-toggle-issues
magit-status-sections-hook #'magithub-issue--insert-issue-section "issues")
(magithub--deftoggle magithub-toggle-pull-requests
magit-status-sections-hook #'magithub-issue--insert-pr-section "pull requests")
(magithub-toggle-issues)
(when (executable-find magithub-hub-executable)
(magithub-toggle-pull-requests)
(magithub-toggle-issues))
(provide 'magithub-issue)
;;; magithub-issue.el ends here

View File

@ -1,5 +1,5 @@
(define-package "magithub" "20161004.523" "Magit interfaces for GitHub"
'((emacs "24.3")
(define-package "magithub" "20161011.2129" "Magit interfaces for GitHub"
'((emacs "24.4")
(magit "2.8.0")
(git-commit "20160821.1338")
(with-editor "20160828.1025")

View File

@ -5,7 +5,7 @@
;; Author: Sean Allred <code@seanallred.com>
;; Keywords: git, tools, vc
;; Homepage: https://github.com/vermiculus/magithub
;; Package-Requires: ((emacs "24.3") (magit "2.8.0") (git-commit "20160821.1338") (with-editor "20160828.1025") (cl-lib "1.0") (s "20160711.525"))
;; Package-Requires: ((emacs "24.4") (magit "2.8.0") (git-commit "20160821.1338") (with-editor "20160828.1025") (cl-lib "1.0") (s "20160711.525"))
;; Package-Version: 0.1
;; This program is free software; you can redistribute it and/or modify
@ -48,6 +48,7 @@
(require 'with-editor)
(require 'cl-lib)
(require 's)
(require 'dash)
(require 'magithub-core)
(require 'magithub-issue)
@ -197,11 +198,10 @@ This function will return nil for matches to
(defun magithub-check-buffer ()
"If this is a buffer created by hub, perform setup."
(let ((type (magithub--edit-file-type buffer-file-name)))
(when type
(magithub-setup-edit-buffer)
(when (eq type 'issue)
(magithub-setup-new-issue-buffer)))))
(--when-let (magithub--edit-file-type buffer-file-name)
(magithub-setup-edit-buffer)
(when (eq it 'issue)
(magithub-setup-new-issue-buffer))))
(add-hook 'find-file-hook #'magithub-check-buffer)
(defun magithub-clone--get-repo ()

View File

@ -1,3 +0,0 @@
(define-package "org"
"20161003" "Outline-based notes management and organizer" ( ))
;; no-byte-compile: t

Some files were not shown because too many files have changed in this diff Show More