From ecb7d72593a2373b244048f233554284e1ef6feb Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 28 May 2024 10:25:18 +0200 Subject: [PATCH] update magit and friends Signed-off-by: Andreas Gerler --- .../gh-api.el | 0 .../gh-auth.el | 1 + .../gh-autoloads.el | 53 +- .../gh-cache.el | 0 .../gh-comments.el | 0 .../gh-common.el | 0 .../gh-gist.el | 0 .../gh-issue-comments.el | 0 .../gh-issues.el | 0 .../gh-oauth.el | 0 .../gh-orgs.el | 0 .../gh-pkg.el | 4 +- .../gh-profile.el | 2 +- .../gh-pull-comments.el | 0 .../gh-pulls.el | 0 .../gh-repos.el | 0 .../gh-search.el | 0 .../gh-url.el | 0 .../gh-users.el | 0 .../gh.el | 0 elpa/ghub-20230513.1619/buck.el | 129 -- elpa/ghub-20230513.1619/dir | 18 - elpa/ghub-20230513.1619/ghub-autoloads.el | 78 -- elpa/ghub-20230513.1619/ghub-graphql.el | 564 -------- elpa/ghub-20230513.1619/ghub-pkg.el | 15 - elpa/ghub-20230513.1619/ghub.el | 1013 -------------- elpa/ghub-20230513.1619/ghub.info | 1170 ----------------- elpa/ghub-20230513.1619/glab.el | 168 --- elpa/ghub-20230513.1619/gogs.el | 141 -- elpa/ghub-20230513.1619/gsexp.el | 102 -- elpa/ghub-20230513.1619/gtea.el | 141 -- .../git-commit-pkg.el | 18 - .../git-commit-autoloads.el | 0 .../git-commit-pkg.el | 18 + .../git-commit.el | 198 ++- elpa/git-commit-readme.txt | 76 -- elpa/magit-20231219.2243/magit-pkg.el | 20 - .../AUTHORS.md | 2 + .../LICENSE | 0 .../dir | 0 .../git-rebase.el | 10 +- .../magit-apply.el | 11 +- .../magit-autoloads.el | 25 +- .../magit-autorevert.el | 6 +- .../magit-base.el | 160 +-- .../magit-bisect.el | 32 +- .../magit-blame.el | 8 +- .../magit-bookmark.el | 31 +- .../magit-branch.el | 69 +- .../magit-bundle.el | 6 +- .../magit-clone.el | 6 +- .../magit-commit.el | 10 +- .../magit-core.el | 6 +- .../magit-diff.el | 117 +- .../magit-ediff.el | 6 +- .../magit-extras.el | 39 +- .../magit-fetch.el | 6 +- .../magit-files.el | 6 +- .../magit-git.el | 51 +- .../magit-gitignore.el | 6 +- .../magit-log.el | 39 +- .../magit-margin.el | 9 +- .../magit-merge.el | 10 +- .../magit-mode.el | 230 +--- .../magit-notes.el | 6 +- .../magit-patch.el | 6 +- elpa/magit-20240522.204/magit-pkg.el | 20 + .../magit-process.el | 59 +- .../magit-pull.el | 6 +- .../magit-push.el | 12 +- .../magit-reflog.el | 6 +- .../magit-refs.el | 36 +- .../magit-remote.el | 6 +- .../magit-repos.el | 11 +- .../magit-reset.el | 6 +- .../magit-sequence.el | 6 +- .../magit-sparse-checkout.el | 4 +- .../magit-stash.el | 14 +- .../magit-status.el | 25 +- .../magit-submodule.el | 39 +- .../magit-subtree.el | 6 +- .../magit-tag.el | 18 +- .../magit-transient.el | 6 +- .../magit-wip.el | 14 +- .../magit-worktree.el | 6 +- .../magit.el | 17 +- .../magit.info | 489 +++---- .../magit-section-pkg.el | 14 - .../dir | 0 .../magit-section-autoloads.el | 0 .../magit-section-pkg.el | 14 + .../magit-section.el | 548 +++++--- .../magit-section.info | 16 +- .../magit-todos-autoloads.el | 53 - .../magit-todos-pkg.el | 2 - .../magit-todos-autoloads.el | 64 + .../magit-todos-pkg.el | 22 + .../magit-todos.el | 471 ++++--- 98 files changed, 1759 insertions(+), 5093 deletions(-) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-api.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-auth.el (99%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-autoloads.el (56%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-cache.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-comments.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-common.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-gist.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-issue-comments.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-issues.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-oauth.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-orgs.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-pkg.el (70%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-profile.el (99%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-pull-comments.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-pulls.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-repos.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-search.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-url.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh-users.el (100%) rename elpa/{gh-20221204.1817 => gh-20230825.1217}/gh.el (100%) delete mode 100644 elpa/ghub-20230513.1619/buck.el delete mode 100644 elpa/ghub-20230513.1619/dir delete mode 100644 elpa/ghub-20230513.1619/ghub-autoloads.el delete mode 100644 elpa/ghub-20230513.1619/ghub-graphql.el delete mode 100644 elpa/ghub-20230513.1619/ghub-pkg.el delete mode 100644 elpa/ghub-20230513.1619/ghub.el delete mode 100644 elpa/ghub-20230513.1619/ghub.info delete mode 100644 elpa/ghub-20230513.1619/glab.el delete mode 100644 elpa/ghub-20230513.1619/gogs.el delete mode 100644 elpa/ghub-20230513.1619/gsexp.el delete mode 100644 elpa/ghub-20230513.1619/gtea.el delete mode 100644 elpa/git-commit-20231204.1839/git-commit-pkg.el rename elpa/{git-commit-20231204.1839 => git-commit-20240520.1135}/git-commit-autoloads.el (100%) create mode 100644 elpa/git-commit-20240520.1135/git-commit-pkg.el rename elpa/{git-commit-20231204.1839 => git-commit-20240520.1135}/git-commit.el (89%) delete mode 100644 elpa/git-commit-readme.txt delete mode 100644 elpa/magit-20231219.2243/magit-pkg.el rename elpa/{magit-20231219.2243 => magit-20240522.204}/AUTHORS.md (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/LICENSE (100%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/dir (100%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/git-rebase.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-apply.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-autoloads.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-autorevert.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-base.el (92%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-bisect.el (95%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-blame.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-bookmark.el (78%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-branch.el (95%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-bundle.el (96%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-clone.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-commit.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-core.el (95%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-diff.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-ediff.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-extras.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-fetch.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-files.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-git.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-gitignore.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-log.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-margin.el (96%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-merge.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-mode.el (87%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-notes.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-patch.el (98%) create mode 100644 elpa/magit-20240522.204/magit-pkg.el rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-process.el (96%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-pull.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-push.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-reflog.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-refs.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-remote.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-repos.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-reset.el (96%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-sequence.el (99%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-sparse-checkout.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-stash.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-status.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-submodule.el (96%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-subtree.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-tag.el (94%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-transient.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-wip.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit-worktree.el (97%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit.el (98%) rename elpa/{magit-20231219.2243 => magit-20240522.204}/magit.info (98%) delete mode 100644 elpa/magit-section-20231213.48/magit-section-pkg.el rename elpa/{magit-section-20231213.48 => magit-section-20240508.2349}/dir (100%) rename elpa/{magit-section-20231213.48 => magit-section-20240508.2349}/magit-section-autoloads.el (100%) create mode 100644 elpa/magit-section-20240508.2349/magit-section-pkg.el rename elpa/{magit-section-20231213.48 => magit-section-20240508.2349}/magit-section.el (83%) rename elpa/{magit-section-20231213.48 => magit-section-20240508.2349}/magit-section.info (97%) delete mode 100644 elpa/magit-todos-20201101.2240/magit-todos-autoloads.el delete mode 100644 elpa/magit-todos-20201101.2240/magit-todos-pkg.el create mode 100644 elpa/magit-todos-20240519.247/magit-todos-autoloads.el create mode 100644 elpa/magit-todos-20240519.247/magit-todos-pkg.el rename elpa/{magit-todos-20201101.2240 => magit-todos-20240519.247}/magit-todos.el (78%) diff --git a/elpa/gh-20221204.1817/gh-api.el b/elpa/gh-20230825.1217/gh-api.el similarity index 100% rename from elpa/gh-20221204.1817/gh-api.el rename to elpa/gh-20230825.1217/gh-api.el diff --git a/elpa/gh-20221204.1817/gh-auth.el b/elpa/gh-20230825.1217/gh-auth.el similarity index 99% rename from elpa/gh-20221204.1817/gh-auth.el rename to elpa/gh-20230825.1217/gh-auth.el index 20bf202d..bd5f4a76 100644 --- a/elpa/gh-20221204.1817/gh-auth.el +++ b/elpa/gh-20230825.1217/gh-auth.el @@ -84,6 +84,7 @@ :token)))) (setq token (or tok (read-string "GitHub OAuth token: "))) (gh-set-config "oauth-token" token))) + (when (functionp token) (setq token (funcall token))) (gh-auth-remember profile :token token) token)) diff --git a/elpa/gh-20221204.1817/gh-autoloads.el b/elpa/gh-20230825.1217/gh-autoloads.el similarity index 56% rename from elpa/gh-20221204.1817/gh-autoloads.el rename to elpa/gh-20230825.1217/gh-autoloads.el index 6fede93f..927dc377 100644 --- a/elpa/gh-20221204.1817/gh-autoloads.el +++ b/elpa/gh-20230825.1217/gh-autoloads.el @@ -1,125 +1,98 @@ -;;; gh-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; gh-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "gh-api" "gh-api.el" (0 0 0 0)) ;;; Generated autoloads from gh-api.el (register-definition-prefixes "gh-api" '("gh-api")) -;;;*** -;;;### (autoloads nil "gh-auth" "gh-auth.el" (0 0 0 0)) ;;; Generated autoloads from gh-auth.el (register-definition-prefixes "gh-auth" '("gh-")) -;;;*** -;;;### (autoloads nil "gh-cache" "gh-cache.el" (0 0 0 0)) ;;; Generated autoloads from gh-cache.el (register-definition-prefixes "gh-cache" '("gh-cache")) -;;;*** -;;;### (autoloads nil "gh-comments" "gh-comments.el" (0 0 0 0)) ;;; Generated autoloads from gh-comments.el (register-definition-prefixes "gh-comments" '("gh-comments-api-mixin")) -;;;*** -;;;### (autoloads nil "gh-common" "gh-common.el" (0 0 0 0)) ;;; Generated autoloads from gh-common.el (register-definition-prefixes "gh-common" '("gh-")) -;;;*** -;;;### (autoloads nil "gh-gist" "gh-gist.el" (0 0 0 0)) ;;; Generated autoloads from gh-gist.el (register-definition-prefixes "gh-gist" '("gh-gist-api")) -;;;*** -;;;### (autoloads nil "gh-issues" "gh-issues.el" (0 0 0 0)) ;;; Generated autoloads from gh-issues.el (register-definition-prefixes "gh-issues" '("gh-issues-")) -;;;*** -;;;### (autoloads nil "gh-oauth" "gh-oauth.el" (0 0 0 0)) ;;; Generated autoloads from gh-oauth.el (register-definition-prefixes "gh-oauth" '("gh-oauth-")) -;;;*** -;;;### (autoloads nil "gh-orgs" "gh-orgs.el" (0 0 0 0)) ;;; Generated autoloads from gh-orgs.el (register-definition-prefixes "gh-orgs" '("gh-orgs-api")) -;;;*** -;;;### (autoloads nil "gh-profile" "gh-profile.el" (0 0 0 0)) ;;; Generated autoloads from gh-profile.el (register-definition-prefixes "gh-profile" '("gh-profile-")) -;;;*** -;;;### (autoloads nil "gh-pulls" "gh-pulls.el" (0 0 0 0)) ;;; Generated autoloads from gh-pulls.el (register-definition-prefixes "gh-pulls" '("gh-pulls-")) -;;;*** -;;;### (autoloads nil "gh-repos" "gh-repos.el" (0 0 0 0)) ;;; Generated autoloads from gh-repos.el (register-definition-prefixes "gh-repos" '("gh-repos-api")) -;;;*** -;;;### (autoloads nil "gh-search" "gh-search.el" (0 0 0 0)) ;;; Generated autoloads from gh-search.el (register-definition-prefixes "gh-search" '("gh-search-")) -;;;*** -;;;### (autoloads nil "gh-url" "gh-url.el" (0 0 0 0)) ;;; Generated autoloads from gh-url.el (register-definition-prefixes "gh-url" '("gh-url-")) -;;;*** -;;;### (autoloads nil "gh-users" "gh-users.el" (0 0 0 0)) ;;; Generated autoloads from gh-users.el (register-definition-prefixes "gh-users" '("gh-users-api")) - -;;;*** -;;;### (autoloads nil nil ("gh-issue-comments.el" "gh-pkg.el" "gh-pull-comments.el" -;;;;;; "gh.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'gh-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; gh-autoloads.el ends here diff --git a/elpa/gh-20221204.1817/gh-cache.el b/elpa/gh-20230825.1217/gh-cache.el similarity index 100% rename from elpa/gh-20221204.1817/gh-cache.el rename to elpa/gh-20230825.1217/gh-cache.el diff --git a/elpa/gh-20221204.1817/gh-comments.el b/elpa/gh-20230825.1217/gh-comments.el similarity index 100% rename from elpa/gh-20221204.1817/gh-comments.el rename to elpa/gh-20230825.1217/gh-comments.el diff --git a/elpa/gh-20221204.1817/gh-common.el b/elpa/gh-20230825.1217/gh-common.el similarity index 100% rename from elpa/gh-20221204.1817/gh-common.el rename to elpa/gh-20230825.1217/gh-common.el diff --git a/elpa/gh-20221204.1817/gh-gist.el b/elpa/gh-20230825.1217/gh-gist.el similarity index 100% rename from elpa/gh-20221204.1817/gh-gist.el rename to elpa/gh-20230825.1217/gh-gist.el diff --git a/elpa/gh-20221204.1817/gh-issue-comments.el b/elpa/gh-20230825.1217/gh-issue-comments.el similarity index 100% rename from elpa/gh-20221204.1817/gh-issue-comments.el rename to elpa/gh-20230825.1217/gh-issue-comments.el diff --git a/elpa/gh-20221204.1817/gh-issues.el b/elpa/gh-20230825.1217/gh-issues.el similarity index 100% rename from elpa/gh-20221204.1817/gh-issues.el rename to elpa/gh-20230825.1217/gh-issues.el diff --git a/elpa/gh-20221204.1817/gh-oauth.el b/elpa/gh-20230825.1217/gh-oauth.el similarity index 100% rename from elpa/gh-20221204.1817/gh-oauth.el rename to elpa/gh-20230825.1217/gh-oauth.el diff --git a/elpa/gh-20221204.1817/gh-orgs.el b/elpa/gh-20230825.1217/gh-orgs.el similarity index 100% rename from elpa/gh-20221204.1817/gh-orgs.el rename to elpa/gh-20230825.1217/gh-orgs.el diff --git a/elpa/gh-20221204.1817/gh-pkg.el b/elpa/gh-20230825.1217/gh-pkg.el similarity index 70% rename from elpa/gh-20221204.1817/gh-pkg.el rename to elpa/gh-20230825.1217/gh-pkg.el index 29af669e..f3aefb08 100644 --- a/elpa/gh-20221204.1817/gh-pkg.el +++ b/elpa/gh-20230825.1217/gh-pkg.el @@ -1,10 +1,10 @@ -(define-package "gh" "20221204.1817" "A GitHub library for Emacs" +(define-package "gh" "20230825.1217" "A GitHub library for Emacs" '((emacs "25.1") (pcache "0.4.2") (logito "0.1") (marshal "0.9.0") (cl-lib "0.3")) - :commit "e1423a54fc97924e75d1fde27911c3c678a7d6c3" :authors + :commit "b5a8d8209340d49ad82dab22d23dae0434499fdf" :authors '(("Yann Hodique" . "yhodique@gmail.com")) :maintainer '("Yann Hodique" . "yhodique@gmail.com") diff --git a/elpa/gh-20221204.1817/gh-profile.el b/elpa/gh-20230825.1217/gh-profile.el similarity index 99% rename from elpa/gh-20221204.1817/gh-profile.el rename to elpa/gh-20230825.1217/gh-profile.el index d1d53118..6d9139c7 100644 --- a/elpa/gh-20221204.1817/gh-profile.el +++ b/elpa/gh-20230825.1217/gh-profile.el @@ -89,7 +89,7 @@ to here." (defun gh-profile-completing-read () (let ((profiles (mapcar #'car gh-profile-alist))) (if (> (length profiles) 1) - (completing-read "Github profile: " profiles nil t nil nil (first profiles)) + (completing-read "Github profile: " profiles nil t nil nil (cl-first profiles)) (car profiles)))) (defun gh-profile-get-remote-profile (remote-url) diff --git a/elpa/gh-20221204.1817/gh-pull-comments.el b/elpa/gh-20230825.1217/gh-pull-comments.el similarity index 100% rename from elpa/gh-20221204.1817/gh-pull-comments.el rename to elpa/gh-20230825.1217/gh-pull-comments.el diff --git a/elpa/gh-20221204.1817/gh-pulls.el b/elpa/gh-20230825.1217/gh-pulls.el similarity index 100% rename from elpa/gh-20221204.1817/gh-pulls.el rename to elpa/gh-20230825.1217/gh-pulls.el diff --git a/elpa/gh-20221204.1817/gh-repos.el b/elpa/gh-20230825.1217/gh-repos.el similarity index 100% rename from elpa/gh-20221204.1817/gh-repos.el rename to elpa/gh-20230825.1217/gh-repos.el diff --git a/elpa/gh-20221204.1817/gh-search.el b/elpa/gh-20230825.1217/gh-search.el similarity index 100% rename from elpa/gh-20221204.1817/gh-search.el rename to elpa/gh-20230825.1217/gh-search.el diff --git a/elpa/gh-20221204.1817/gh-url.el b/elpa/gh-20230825.1217/gh-url.el similarity index 100% rename from elpa/gh-20221204.1817/gh-url.el rename to elpa/gh-20230825.1217/gh-url.el diff --git a/elpa/gh-20221204.1817/gh-users.el b/elpa/gh-20230825.1217/gh-users.el similarity index 100% rename from elpa/gh-20221204.1817/gh-users.el rename to elpa/gh-20230825.1217/gh-users.el diff --git a/elpa/gh-20221204.1817/gh.el b/elpa/gh-20230825.1217/gh.el similarity index 100% rename from elpa/gh-20221204.1817/gh.el rename to elpa/gh-20230825.1217/gh.el diff --git a/elpa/ghub-20230513.1619/buck.el b/elpa/ghub-20230513.1619/buck.el deleted file mode 100644 index b7a5cba9..00000000 --- a/elpa/ghub-20230513.1619/buck.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; buck.el --- Client library for the Bitbucket API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Buck is a library that provides basic support for using the Bitbucket API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Buck does -;; not support the guided creation of tokens because Bitbucket lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst buck-default-host "api.bitbucket.org/2.0" - "The default host that is used if `buck.host' is not set.") - -;; HEAD and PATCH are not supported according to -;; https://developer.atlassian.com/bitbucket/api/2/reference/meta/uri-uuid - -(cl-defun buck-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `GET' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"GET\" as METHOD -and `bitbucket' as FORGE." - (ghub-request "GET" resource params :forge 'bitbucket - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PUT' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PUT\" as METHOD -and `bitbucket' as FORGE." - (ghub-request "PUT" resource params :forge 'bitbucket - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `POST' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"POST\" as METHOD -and `bitbucket' as FORGE." - (ghub-request "POST" resource params :forge 'bitbucket - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"DELETE\" as METHOD -and `bitbucket' as FORGE." - (ghub-request "DELETE" resource params :forge 'bitbucket - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a request for RESOURCE and return the response body. -Like calling `ghub-request' (which see) with `bitbucket' as FORGE." - (ghub-request method resource params :forge 'bitbucket - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun buck-repository-id (owner name &key username auth host) - "Return the id of the repository specified by OWNER, NAME and HOST." - (substring (cdr (assq 'uuid - (buck-get (format "/repositories/%s/%s" owner name) - nil - :username username :auth auth :host host))) - 1 -1)) - -;;; _ -(provide 'buck) -;;; buck.el ends here diff --git a/elpa/ghub-20230513.1619/dir b/elpa/ghub-20230513.1619/dir deleted file mode 100644 index b703bcac..00000000 --- a/elpa/ghub-20230513.1619/dir +++ /dev/null @@ -1,18 +0,0 @@ -This is the file .../info/dir, which contains the -topmost node of the Info hierarchy, called (dir)Top. -The first time you invoke Info you start off looking at this node. - -File: dir, Node: Top This is the top of the INFO tree - - This (the Directory node) gives a menu of major topics. - Typing "q" exits, "H" lists all Info commands, "d" returns here, - "h" gives a primer for first-timers, - "mEmacs" visits the Emacs manual, etc. - - In Emacs, you can click mouse button 2 on a menu item or cross reference - to select it. - -* Menu: - -Emacs -* Ghub: (ghub). Client library for the Github API. diff --git a/elpa/ghub-20230513.1619/ghub-autoloads.el b/elpa/ghub-20230513.1619/ghub-autoloads.el deleted file mode 100644 index 8ddfa370..00000000 --- a/elpa/ghub-20230513.1619/ghub-autoloads.el +++ /dev/null @@ -1,78 +0,0 @@ -;;; ghub-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "buck" "buck.el" (0 0 0 0)) -;;; Generated autoloads from buck.el - -(register-definition-prefixes "buck" '("buck-default-host")) - -;;;*** - -;;;### (autoloads nil "ghub" "ghub.el" (0 0 0 0)) -;;; Generated autoloads from ghub.el - -(autoload 'ghub-clear-caches "ghub" "\ -Clear all caches that might negatively affect Ghub. - -If a library that is used by Ghub caches incorrect information -such as a mistyped password, then that can prevent Ghub from -asking the user for the correct information again. - -Set `url-http-real-basic-auth-storage' to nil -and call `auth-source-forget+'." t nil) - -(register-definition-prefixes "ghub" '("ghub-")) - -;;;*** - -;;;### (autoloads nil "ghub-graphql" "ghub-graphql.el" (0 0 0 0)) -;;; Generated autoloads from ghub-graphql.el - -(register-definition-prefixes "ghub-graphql" '("ghub-")) - -;;;*** - -;;;### (autoloads nil "glab" "glab.el" (0 0 0 0)) -;;; Generated autoloads from glab.el - -(register-definition-prefixes "glab" '("glab-default-host")) - -;;;*** - -;;;### (autoloads nil "gogs" "gogs.el" (0 0 0 0)) -;;; Generated autoloads from gogs.el - -(register-definition-prefixes "gogs" '("gogs-default-host")) - -;;;*** - -;;;### (autoloads nil "gsexp" "gsexp.el" (0 0 0 0)) -;;; Generated autoloads from gsexp.el - -(register-definition-prefixes "gsexp" '("gsexp-")) - -;;;*** - -;;;### (autoloads nil "gtea" "gtea.el" (0 0 0 0)) -;;; Generated autoloads from gtea.el - -(register-definition-prefixes "gtea" '("gtea-default-host")) - -;;;*** - -;;;### (autoloads nil nil ("ghub-pkg.el") (0 0 0 0)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; ghub-autoloads.el ends here diff --git a/elpa/ghub-20230513.1619/ghub-graphql.el b/elpa/ghub-20230513.1619/ghub-graphql.el deleted file mode 100644 index 1e40c5c6..00000000 --- a/elpa/ghub-20230513.1619/ghub-graphql.el +++ /dev/null @@ -1,564 +0,0 @@ -;;; ghub-graphql.el --- Access Github API using GrapthQL -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Code: - -(require 'ghub) -(require 'gsexp) -(require 'treepy) - -;; Needed for Emacs < 27. -(eval-when-compile (require 'json)) -(declare-function json-read-from-string "json" (string)) -(declare-function json-encode "json" (object)) - -(eval-when-compile (require 'pp)) ; Needed for Emacs < 29. -(eval-when-compile (require 'subr-x)) - -;;; Api - -(defvar ghub-graphql-items-per-request 100 - "Number of GraphQL items to query for entities that return a collection. - -Adjust this value if you're hitting query timeouts against larger -repositories.") - -(cl-defun ghub-graphql (graphql &optional variables - &key username auth host forge - headers silent - callback errorback value extra) - "Make a GraphQL request using GRAPHQL and VARIABLES. -Return the response as a JSON-like alist. Even if the response -contains `errors', do not raise an error. GRAPHQL is a GraphQL -string. VARIABLES is a JSON-like alist. The other arguments -behave as for `ghub-request' (which see)." - (cl-assert (not (stringp variables))) - (cl-assert (or (stringp graphql) - (memq (car-safe graphql) '(query mutation)))) - (unless (stringp graphql) - (setq graphql (gsexp-encode (ghub--graphql-prepare-query graphql)))) - (ghub-request "POST" - (if (eq forge 'gitlab) "/api/graphql" "/graphql") - nil - :payload `((query . ,graphql) - ,@(and variables `((variables ,@variables)))) - :headers headers :silent silent - :username username :auth auth :host host :forge forge - :callback callback :errorback errorback - :extra extra :value value)) - -(cl-defun ghub-graphql-rate-limit (&key username auth host) - "Return rate limit information." - (let-alist (ghub-graphql - '(query (rateLimit limit cost remaining resetAt)) - nil :username username :auth auth :host host) - .data.rateLimit)) - -(cl-defun ghub--repository-id (owner name &key username auth host) - "Return the id of the repository specified by OWNER, NAME and HOST." - (let-alist (ghub-graphql - '(query (repository [(owner $owner String!) - (name $name String!)] - id)) - `((owner . ,owner) - (name . ,name)) - :username username :auth auth :host host) - .data.repository.id)) - -;;; Api (drafts) - -(defconst ghub-fetch-repository-sparse - '(query - (repository - [(owner $owner String!) - (name $name String!)] - name - id - createdAt - updatedAt - nameWithOwner - (parent nameWithOwner) - description - homepageUrl - (defaultBranchRef name) - isArchived - isFork - isLocked - isMirror - isPrivate - hasIssuesEnabled - hasWikiEnabled - (licenseInfo name) - (stargazers totalCount) - (watchers totalCount)))) - -(defconst ghub-fetch-repository - `(query - (repository - ,@(cdr (cadr ghub-fetch-repository-sparse)) - (assignableUsers [(:edges t)] - id - login - name) - (issues [(:edges t) - (:singular issue number) - (orderBy ((field UPDATED_AT) (direction DESC)))] - number - id - state - (author login) - title - createdAt - updatedAt - closedAt - locked - (milestone id) - body - (assignees [(:edges t)] - id) - (comments [(:edges t)] - databaseId - (author login) - createdAt - updatedAt - body) - (labels [(:edges t)] - id)) - (labels [(:edges t) - (:singular label id)] - id - name - color - description) - (milestones [(:edges t) - (:singular milestone id)] - id - number - title - createdAt - updatedAt - dueOn - closedAt - description) - (pullRequests [(:edges t) - (:singular pullRequest number) - (orderBy ((field UPDATED_AT) (direction DESC)))] - number - id - state - (author login) - title - createdAt - updatedAt - closedAt - mergedAt - isDraft - locked - maintainerCanModify - isCrossRepository - (milestone id) - body - (baseRef name - (repository nameWithOwner)) - baseRefOid - (headRef name - (repository (owner login) - nameWithOwner)) - headRefOid - (assignees [(:edges t)] - id) - (reviewRequests [(:edges t)] - (requestedReviewer "... on User { id }\n")) - (comments [(:edges t)] - databaseId - (author login) - createdAt - updatedAt - body) - (labels [(:edges t)] - id))))) - -(defconst ghub-fetch-repository-review-threads - '(query - (repository - [(owner $owner String!) - (name $name String!)] - (pullRequests [(:edges t) - (:singular pullRequest number) - (orderBy ((field UPDATED_AT) (direction DESC)))] - number - baseRefOid - headRefOid - (reviewThreads [(:edges t)] - id - line - originalLine - diffSide - (resolvedBy login) - (comments [(:edges t)] - id - databaseId - (author login) - createdAt - updatedAt - body - (replyTo databaseId) - (originalCommit oid) - path)))))) - -(cl-defun ghub-fetch-repository (owner name callback - &optional until - &key username auth host forge - headers errorback sparse) - "Asynchronously fetch forge data about the specified repository. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (if sparse - ghub-fetch-repository-sparse - ghub-fetch-repository) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository) - :username username - :auth auth - :host host - :forge forge - :headers headers - :errorback errorback)) - -(cl-defun ghub-fetch-issue (owner name number callback - &optional until - &key username auth host forge - headers errorback) - "Asynchronously fetch forge data about the specified issue. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (ghub--graphql-prepare-query - ghub-fetch-repository - `(repository issues (issue . ,number))) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository issue) - :username username - :auth auth - :host host - :forge forge - :headers headers - :errorback errorback)) - -(cl-defun ghub-fetch-pullreq (owner name number callback - &optional until - &key username auth host forge - headers errorback) - "Asynchronously fetch forge data about the specified pull-request. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (ghub--graphql-prepare-query - ghub-fetch-repository - `(repository pullRequests (pullRequest . ,number))) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository pullRequest) - :username username - :auth auth - :host host - :forge forge - :headers headers - :errorback errorback)) - -(cl-defun ghub-fetch-review-threads (owner name number callback - &optional until - &key username auth host forge - headers errorback) - "Asynchronously fetch forge data about the review threads from a pull-request. -Once all data has been collected, CALLBACK is called with the -data as the only argument." - (ghub--graphql-vacuum (ghub--graphql-prepare-query - ghub-fetch-repository-review-threads - `(repository pullRequests (pullRequest . ,number))) - `((owner . ,owner) - (name . ,name)) - callback until - :narrow '(repository pullRequest) - :username username - :auth auth - :host host - :forge forge - :headers headers - :errorback errorback)) - -;;; Internal - -(cl-defstruct (ghub--graphql-req - (:include ghub--req) - (:constructor ghub--make-graphql-req) - (:copier nil)) - (query nil :read-only t) - (query-str nil :read-only nil) - (variables nil :read-only t) - (until nil :read-only t) - (buffer nil :read-only t) - (pages 0 :read-only nil)) - -(cl-defun ghub--graphql-vacuum (query variables callback - &optional until - &key narrow username auth host forge - headers errorback) - "Make a GraphQL request using QUERY and VARIABLES. -See Info node `(ghub)GraphQL Support'." - (unless host - (setq host (ghub--host forge))) - (unless (or username (stringp auth) (eq auth 'none)) - (setq username (ghub--username host forge))) - (ghub--graphql-retrieve - (ghub--make-graphql-req - :url (url-generic-parse-url - (format "https://%s/graphql" - (if (string-suffix-p "/v3" host) - (substring host 0 -3) - host))) - :method "POST" - :headers (ghub--headers headers host auth username forge) - :handler #'ghub--graphql-handle-response - :query query - :variables variables - :until until - :buffer (current-buffer) - :callback (and (not (eq callback 'synchronous)) - (let ((buf (current-buffer))) - (if narrow - (lambda (data) - (let ((path narrow) key) - (while (setq key (pop path)) - (setq data (cdr (assq key data))))) - (ghub--graphql-set-mode-line buf nil) - (funcall (or callback #'ghub--graphql-pp-response) - data)) - (lambda (data) - (ghub--graphql-set-mode-line buf nil) - (funcall (or callback #'ghub--graphql-pp-response) - data))))) - :errorback (and (not (eq callback 'synchronous)) - errorback)))) - -(cl-defun ghub--graphql-retrieve (req &optional lineage cursor) - (let ((p (cl-incf (ghub--graphql-req-pages req)))) - (when (> p 1) - (ghub--graphql-set-mode-line req "Fetching page %s" p))) - (setf (ghub--graphql-req-query-str req) - (gsexp-encode - (ghub--graphql-prepare-query - (ghub--graphql-req-query req) - lineage cursor))) - (ghub--retrieve - (let ((json-false nil)) - (ghub--encode-payload - `((query . ,(ghub--graphql-req-query-str req)) - (variables . ,(ghub--graphql-req-variables req))))) - req)) - -(defun ghub--graphql-prepare-query (query &optional lineage cursor) - (when lineage - (setq query (ghub--graphql-narrow-query query lineage cursor))) - (let ((loc (ghub--alist-zip query)) - variables) - (cl-block nil - (while t - (let ((node (treepy-node loc))) - (when (and (vectorp node) - (listp (aref node 0))) - (let ((alist (cl-coerce node 'list)) - vars) - (when (cadr (assq :edges alist)) - (push (list 'first ghub-graphql-items-per-request) vars) - (setq loc (treepy-up loc)) - (setq node (treepy-node loc)) - (setq loc (treepy-replace - loc `(,(car node) - ,(cadr node) - (pageInfo endCursor hasNextPage) - (edges (node ,@(cddr node)))))) - (setq loc (treepy-down loc)) - (setq loc (treepy-next loc))) - (dolist (elt alist) - (cond ((keywordp (car elt))) - ((length= elt 3) - (push (list (nth 0 elt) (nth 1 elt)) vars) - (push (list (nth 1 elt) (nth 2 elt)) variables)) - ((length= elt 2) - (push elt vars)))) - (setq loc (treepy-replace loc (vconcat (nreverse vars))))))) - (if (treepy-end-p loc) - (let ((node (copy-sequence (treepy-node loc)))) - (when variables - (push (cl-coerce variables 'vector) - (cdr node))) - (cl-return node)) - (setq loc (treepy-next loc))))))) - -(defun ghub--graphql-handle-response (status req) - (let ((buffer (current-buffer))) - (unwind-protect - (progn - (set-buffer-multibyte t) - (let* ((headers (ghub--handle-response-headers status req)) - (payload (ghub--handle-response-payload req)) - (payload (ghub--handle-response-error status payload req)) - (err (plist-get status :error)) - (errors (cdr (assq 'errors payload))) - (errors (and errors (cons 'ghub-graphql-error errors)))) - (if (or err errors) - (if-let ((errorback (ghub--req-errorback req))) - (funcall errorback (or err errors) headers status req) - (ghub--signal-error (or err errors))) - (ghub--graphql-walk-response req (assq 'data payload))))) - (when (buffer-live-p buffer) - (kill-buffer buffer))))) - -(defun ghub--graphql-walk-response (req data) - (let* ((loc (ghub--req-value req)) - (loc (if (not loc) - (ghub--alist-zip data) - (setq data (ghub--graphql-narrow-data - data (ghub--graphql-lineage loc))) - (setf (alist-get 'edges data) - (append (alist-get 'edges (treepy-node loc)) - (or (alist-get 'edges data) - (error "BUG: Expected new nodes")))) - (treepy-replace loc data)))) - (cl-block nil - (while t - (when (eq (car-safe (treepy-node loc)) 'edges) - (setq loc (treepy-up loc)) - (pcase-let ((`(,key . ,val) (treepy-node loc))) - (let-alist val - (let* ((cursor (and .pageInfo.hasNextPage - .pageInfo.endCursor)) - (until (cdr (assq (intern (format "%s-until" key)) - (ghub--graphql-req-until req)))) - (nodes (mapcar #'cdar .edges)) - (nodes (if until - (seq-take-while - (lambda (node) - (or (string> (cdr (assq 'updatedAt node)) - until) - (setq cursor nil))) - nodes) - nodes))) - (if cursor - (progn - (setf (ghub--req-value req) loc) - (ghub--graphql-retrieve req - (ghub--graphql-lineage loc) - cursor) - (cl-return)) - (setq loc (treepy-replace loc (cons key nodes)))))))) - (cond ((not (treepy-end-p loc)) - (setq loc (treepy-next loc))) - ((ghub--req-callback req) - (funcall (ghub--req-callback req) - (treepy-root loc)) - (cl-return)) - ((cl-return (treepy-root loc)))))))) - -(defun ghub--graphql-lineage (loc) - (let (lineage) - (while (treepy-up loc) - (push (car (treepy-node loc)) lineage) - (setq loc (treepy-up loc))) - lineage)) - -(defun ghub--graphql-narrow-data (data lineage) - (let (key) - (while (setq key (pop lineage)) - (if (consp (car lineage)) - (progn (pop lineage) - (setf data (cadr data))) - (setq data (assq key (cdr data)))))) - data) - -(defun ghub--graphql-narrow-query (query lineage cursor) - (if (consp (car lineage)) - (let* ((child (cddr query)) - (alist (cl-coerce (cadr query) 'list)) - (single (cdr (assq :singular alist)))) - `(,(car single) - ,(vector (list (cadr single) (cdr (car lineage)))) - ,@(if (cdr lineage) - (ghub--graphql-narrow-query child (cdr lineage) cursor) - child))) - (let* ((child (or (assq (car lineage) (cdr query)) - ;; Alias - (cl-find-if (lambda (c) - (eq (car-safe (car-safe c)) - (car lineage))) - query) - ;; Edges - (cl-find-if (lambda (c) - (and (listp c) - (vectorp (cadr c)) - (eq (cadr (assq :singular - (cl-coerce (cadr c) - 'list))) - (car lineage)))) - (cdr query)) - (error "BUG: Failed to narrow query"))) - (object (car query)) - (args (and (vectorp (cadr query)) - (cadr query)))) - `(,object - ,@(and args (list args)) - ,(cond ((cdr lineage) - (ghub--graphql-narrow-query child (cdr lineage) cursor)) - (cursor - `(,(car child) - ,(vconcat `((after ,cursor)) - (cadr child)) - ,@(cddr child))) - (t - child)))))) - -(defun ghub--alist-zip (root) - (let ((branchp (lambda (elt) (and (listp elt) (listp (cdr elt))))) - (make-node (lambda (_ children) children))) - (treepy-zipper branchp #'identity make-node root))) - -(defun ghub--graphql-set-mode-line (buf string &rest args) - (when (ghub--graphql-req-p buf) - (setq buf (ghub--graphql-req-buffer buf))) - (when (buffer-live-p buf) - (with-current-buffer buf - (setq mode-line-process - (and string (concat " " (apply #'format string args)))) - (force-mode-line-update t)))) - -(defun ghub--graphql-pp-response (data) - (require 'pp) ; needed for Emacs < 29. - (pp-display-expression data "*Pp Eval Output*")) - -;;; _ -(provide 'ghub-graphql) -;;; ghub-graphql.el ends here diff --git a/elpa/ghub-20230513.1619/ghub-pkg.el b/elpa/ghub-20230513.1619/ghub-pkg.el deleted file mode 100644 index 3757703f..00000000 --- a/elpa/ghub-20230513.1619/ghub-pkg.el +++ /dev/null @@ -1,15 +0,0 @@ -(define-package "ghub" "20230513.1619" "Client libraries for Git forge APIs." - '((emacs "25.1") - (compat "29.1.4.1") - (let-alist "1.0.6") - (treepy "0.1.2")) - :commit "0fd648f0529f34b5da441d54c9dbff7810477d12" :authors - '(("Jonas Bernoulli" . "jonas@bernoul.li")) - :maintainer - '("Jonas Bernoulli" . "jonas@bernoul.li") - :keywords - '("tools") - :url "https://github.com/magit/ghub") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/ghub-20230513.1619/ghub.el b/elpa/ghub-20230513.1619/ghub.el deleted file mode 100644 index f169ad01..00000000 --- a/elpa/ghub-20230513.1619/ghub.el +++ /dev/null @@ -1,1013 +0,0 @@ -;;; ghub.el --- Client libraries for Git forge APIs -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Ghub provides basic support for using the APIs of various Git forges -;; from Emacs packages. Originally it only supported the Github REST -;; API, but now it also supports the Github GraphQL API as well as the -;; REST APIs of Gitlab, Gitea, Gogs and Bitbucket. - -;; Ghub abstracts access to API resources using only a handful of basic -;; functions such as `ghub-get'. These are convenience wrappers around -;; `ghub-request'. Additional forge-specific wrappers like `glab-put', -;; `gtea-put', `gogs-post' and `buck-delete' are also available. Ghub -;; does not provide any resource-specific functions, with the exception -;; of `FORGE-repository-id'. - -;; When accessing Github, then Ghub handles the creation and storage of -;; access tokens using a setup wizard to make it easier for users to get -;; started. The tokens for other forges have to be created manually. - -;; Ghub is intentionally limited to only provide these two essential -;; features — basic request functions and guided setup — to avoid being -;; too opinionated, which would hinder wide adoption. It is assumed that -;; wide adoption would make life easier for users and maintainers alike, -;; because then all packages that talk to forge APIs could be configured -;; the same way. - -;; Please consult the manual (info "ghub") for more information. - -;;; Code: - -(require 'auth-source) -(require 'cl-lib) -(require 'compat) -(require 'gnutls) -(require 'let-alist) -(require 'url) -(require 'url-auth) -(require 'url-http) - -(eval-when-compile (require 'subr-x)) - -;; Needed for Emacs < 27. -(eval-when-compile (require 'json)) -(declare-function json-read-from-string "json" (string)) -(declare-function json-encode "json" (object)) - -(declare-function glab-repository-id "glab" (owner name &key username auth host)) -(declare-function gtea-repository-id "gtea" (owner name &key username auth host)) -(declare-function gogs-repository-id "gogs" (owner name &key username auth host)) -(declare-function buck-repository-id "buck" (owner name &key username auth host)) - -(defvar url-callback-arguments) -(defvar url-http-end-of-headers) -(defvar url-http-extra-headers) -(defvar url-http-response-status) - -;;; Settings - -(defconst ghub-default-host "api.github.com" - "The default host that is used if `ghub.host' is not set.") - -(defvar ghub-github-token-scopes '(repo) - "The Github API scopes that your private tools need. - -You have to manually create or update the token at -https://github.com/settings/tokens. This variable -only serves as documentation.") - -(defvar ghub-insecure-hosts nil - "List of hosts that use http instead of https.") - -(defvar ghub-json-use-jansson nil - "Whether to use the Jansson library, if available. -This is experimental. Only let-bind this but do not enable it -globally because doing that is likely to break other packages -that use `ghub'. As a user also do not enable this yet. -See https://github.com/magit/ghub/pull/149.") - -(defvar ghub-json-object-type 'alist - "The object type that is used for json payload decoding.") - -(defvar ghub-json-array-type 'list - "The array type that is used for json payload decoding.") - -;;; Request -;;;; Object - -(cl-defstruct (ghub--req - (:constructor ghub--make-req) - (:copier nil)) - (url nil :read-only nil) - (forge nil :read-only t) - (silent nil :read-only t) - (method nil :read-only t) - (headers nil :read-only t) - (handler nil :read-only t) - (unpaginate nil :read-only nil) - (noerror nil :read-only t) - (reader nil :read-only t) - (callback nil :read-only t) - (errorback nil :read-only t) - (value nil :read-only nil) - (extra nil :read-only nil)) - -(defalias 'ghub-req-extra #'ghub--req-extra) - -;;;; API - -(define-error 'ghub-error "Ghub/Url Error" 'error) -(define-error 'ghub-http-error "HTTP Error" 'ghub-error) - -(defvar ghub-response-headers nil - "The headers returned in response to the last request. -`ghub-request' returns the response body and stores the -response headers in this variable.") - -(cl-defun ghub-head (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `HEAD' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"HEAD\" as METHOD." - (ghub-request "HEAD" resource params - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun ghub-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `GET' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"GET\" as METHOD." - (ghub-request "GET" resource params - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun ghub-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PUT' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PUT\" as METHOD." - (ghub-request "PUT" resource params - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun ghub-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `POST' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"POST\" as METHOD." - (ghub-request "POST" resource params - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun ghub-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PATCH\" as METHOD." - (ghub-request "PATCH" resource params - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun ghub-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"DELETE\" as METHOD." - (ghub-request "DELETE" resource params - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun ghub-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host forge - callback errorback value extra) - "Make a request for RESOURCE and return the response body. - -Also place the response headers in `ghub-response-headers'. - -METHOD is the HTTP method, given as a string. -RESOURCE is the resource to access, given as a string beginning - with a slash. - -PARAMS, QUERY, PAYLOAD and HEADERS are alists used to specify - data. The Github API documentation is vague on how data has - to be transmitted and for a particular resource usually just - talks about \"parameters\". Generally speaking when the METHOD - is \"HEAD\" or \"GET\", then they have to be transmitted as a - query, otherwise as a payload. -Use PARAMS to automatically transmit like QUERY or PAYLOAD would - depending on METHOD. -Use QUERY to explicitly transmit data as a query. -Use PAYLOAD to explicitly transmit data as a payload. - Instead of an alist, PAYLOAD may also be a string, in which - case it gets encoded as UTF-8 but is otherwise transmitted as-is. -Use HEADERS for those rare resources that require that the data - is transmitted as headers instead of as a query or payload. - When that is the case, then the API documentation usually - mentions it explicitly. - -If SILENT is non-nil, then don't message progress reports and - the like. - -If UNPAGINATE is t, then make as many requests as necessary to - get all values. If UNPAGINATE is a natural number, then get - at most that many pages. For any other non-nil value raise - an error. -If NOERROR is non-nil, then do not raise an error if the request - fails and return nil instead. If NOERROR is `return', then - return the error payload instead of nil. -If READER is non-nil, then it is used to read and return from the - response buffer. The default is `ghub--read-json-payload'. - For the very few resources that do not return JSON, you might - want to use `ghub--decode-payload'. - -If USERNAME is non-nil, then make a request on behalf of that - user. It is better to specify the user using the Git variable - `github.user' for \"api.github.com\", or `github.HOST.user' if - connecting to a Github Enterprise instance. - -Each package that uses `ghub' should use its own token. If AUTH - is nil, then the generic `ghub' token is used instead. This - is only acceptable for personal utilities. A packages that - is distributed to other users should always use this argument - to identify itself, using a symbol matching its name. - - Package authors who find this inconvenient should write a - wrapper around this function and possibly for the - method-specific functions as well. - - Some symbols have a special meaning. `none' means to make an - unauthorized request. `basic' means to make a password based - request. If the value is a string, then it is assumed to be - a valid token. `basic' and an explicit token string are only - intended for internal and debugging uses. - -If HOST is non-nil, then connect to that Github instance. This - defaults to \"api.github.com\". When a repository is connected - to a Github Enterprise instance, then it is better to specify - that using the Git variable `github.host' instead of using this - argument. - -If FORGE is `gitlab', then connect to Gitlab.com or, depending - on HOST, to another Gitlab instance. This is only intended for - internal use. Instead of using this argument you should use - function `glab-request' and other `glab-*' functions. - -If CALLBACK and/or ERRORBACK is non-nil, then make one or more - asynchronous requests and call CALLBACK or ERRORBACK when - finished. If no error occurred, then call CALLBACK, unless - that is nil. - - If an error occurred, then call ERRORBACK, or if that is nil, - then CALLBACK. ERRORBACK can also be t, in which case an error - is signaled instead. NOERROR is ignored for all asynchronous - requests. - -Both callbacks are called with four arguments. - 1. For CALLBACK, the combined value of the retrieved pages. - For ERRORBACK, the error that occurred when retrieving the - last page. - 2. The headers of the last page as an alist. - 3. Status information provided by `url-retrieve'. Its `:error' - property holds the same information as ERRORBACK's first - argument. - 4. A `ghub--req' struct, which can be passed to `ghub-continue' - (which see) to retrieve the next page, if any." - (cl-assert (or (booleanp unpaginate) (natnump unpaginate))) - (unless (string-prefix-p "/" resource) - (setq resource (concat "/" resource))) - (unless host - (setq host (ghub--host forge))) - (unless (or username (stringp auth) (eq auth 'none)) - (setq username (ghub--username host forge))) - (cond ((not params)) - ((member method '("GET" "HEAD")) - (when query - (error "PARAMS and QUERY are mutually exclusive for METHOD %S" - method)) - (setq query params)) - (t - (when payload - (error "PARAMS and PAYLOAD are mutually exclusive for METHOD %S" - method)) - (setq payload params))) - (when (or callback errorback) - (setq noerror t)) - (ghub--retrieve - (ghub--encode-payload payload) - (ghub--make-req - :url (url-generic-parse-url - (concat (if (member host ghub-insecure-hosts) "http://" "https://") - (cond ((and (equal resource "/graphql") - (string-suffix-p "/v3" host)) - ;; Needed for some Github Enterprise instances. - (substring host 0 -3)) - ((and (equal resource "/api/graphql") - (string-suffix-p "/api/v4" host)) - ;; Needed for all Gitlab instances. - (substring host 0 -7)) - (host)) - resource - (and query (concat "?" (ghub--url-encode-params query))))) - :forge forge - :silent silent - ;; Encode in case caller used (symbol-name 'GET). #35 - :method (encode-coding-string method 'utf-8) - :headers (ghub--headers headers host auth username forge) - :handler #'ghub--handle-response - :unpaginate unpaginate - :noerror noerror - :reader reader - :callback callback - :errorback errorback - :value value - :extra extra))) - -(defun ghub-continue (req) - "If there is a next page, then retrieve that. - -This function is only intended to be called from callbacks. If -there is a next page, then retrieve that and return the buffer -that the result will be loaded into, or t if the process has -already completed. If there is no next page, then return nil. - -Callbacks are called with four arguments (see `ghub-request'). -The forth argument is a `ghub--req' struct, intended to be passed -to this function. A callback may use the struct's `extra' slot -to pass additional information to the callback that will be -called after the next request has finished. Use the function -`ghub-req-extra' to get and set the value of this slot." - (and (assq 'next (ghub-response-link-relations req)) - (or (ghub--retrieve nil req) t))) - -(cl-defun ghub-wait (resource &optional duration - &key username auth host forge) - "Busy-wait up to DURATION seconds for RESOURCE to become available. - -DURATION specifies how many seconds to wait at most. It defaults -to 64 seconds. The first attempt is made immediately, the second -after two seconds, and each subsequent attempt is made after -waiting as long again as we already waited between all preceding -attempts combined. - -See `ghub-request' for information about the other arguments." - (unless duration - (setq duration 64)) - (with-local-quit - (let ((total 0)) - (while (not (ghub-request "GET" resource nil - :noerror t - :username username - :auth auth - :host host - :forge forge)) - (message "Waited (%3ss of %ss) for %s..." total duration resource) - (if (= total duration) - (error "%s is taking too long to create %s" - (if forge (capitalize (symbol-name forge)) "Github") - resource) - (if (> total 0) - (let ((wait (min total (- duration total)))) - (sit-for wait) - (cl-incf total wait)) - (sit-for (setq total 2)))))))) - -(defun ghub-response-link-relations (req &optional headers payload) - "Return an alist of link relations in HEADERS. -If optional HEADERS is nil, then return those that were -previously stored in the variable `ghub-response-headers'. - -When accessing a Bitbucket instance then the link relations -are in PAYLOAD instead of HEADERS, making their API merely -RESTish and forcing this function to append those relations -to the value of `ghub-response-headers', for later use when -this function is called with nil for PAYLOAD." - (if (eq (ghub--req-forge req) 'bitbucket) - (if payload - (let* ((page (cl-mapcan (lambda (key) - (and-let* ((elt (assq key payload))) - (list elt))) - '(size page pagelen next previous))) - (headers (cons (cons 'link-alist page) headers))) - (if (and req (or (ghub--req-callback req) - (ghub--req-errorback req))) - (setq-local ghub-response-headers headers) - (setq-default ghub-response-headers headers)) - page) - (cdr (assq 'link-alist ghub-response-headers))) - (and-let* ((rels (cdr (assoc "Link" (or headers ghub-response-headers))))) - (mapcar (lambda (elt) - (pcase-let ((`(,url ,rel) (split-string elt "; "))) - (cons (intern (substring rel 5 -1)) - (substring url 1 -1)))) - (split-string rels ", "))))) - -(cl-defun ghub-repository-id (owner name &key username auth host forge noerror) - "Return the id of the specified repository. -Signal an error if the id cannot be determined." - (let ((fn (cl-case forge - ((nil ghub github) #'ghub--repository-id) - (gitlab #'glab-repository-id) - (gitea #'gtea-repository-id) - (gogs #'gogs-repository-id) - (bitbucket #'buck-repository-id) - (t (intern (format "%s-repository-id" forge)))))) - (unless (fboundp fn) - (error "ghub-repository-id: Forge type/abbreviation `%s' is unknown" - forge)) - (or (funcall fn owner name :username username :auth auth :host host) - (and (not noerror) - (error "Repository %S does not exist on %S.\n%s%S?" - (concat owner "/" name) - (or host (ghub--host forge)) - "Maybe it was renamed and you have to update " - "remote..url"))))) - -;;;; Internal - -(defvar ghub-use-workaround-for-emacs-bug t - "Whether to work around Emacs bug debbugs#34341. - -First see https://github.com/magit/ghub/wiki/Known-Issues, -for information about this bug and another related bug. - -Because our under of these bugs evolved over time, the possible -values of this variable are a bit odd: If t, enable workaround if -necessary (i.e., if Emacs < 26.3 and GnuTLS >= 3.6.3 are used). -If `force', enable workaround even if that is believed to be -unnecessary. If nil, do not enable the workaround. The default -is t.") - -(defvar ghub-use-workaround-for-emacs-bug-54989 t - "Whether to work around Emacs bug debbugs#54989. - -First see https://github.com/magit/ghub/wiki/Known-Issues, -for information about this bug and another related bug. - -If t, work around the bug if necessary (i.e., if not using Emacs' -\"master\" branch). If nil, then don't work around the bug. The -default is t. Setting this variable only has an effect if it is -done before `ghub' is loaded.") - -(cl-defun ghub--retrieve (payload req) - (let ((url-request-extra-headers - (let ((headers (ghub--req-headers req))) - (if (functionp headers) (funcall headers) headers))) - (url-request-method (ghub--req-method req)) - (url-request-data payload) - (url-show-status nil) - (url (ghub--req-url req)) - (handler (ghub--req-handler req)) - (silent (ghub--req-silent req)) - (gnutls-algorithm-priority - (if (and ghub-use-workaround-for-emacs-bug - (or (eq ghub-use-workaround-for-emacs-bug 'force) - (and (not gnutls-algorithm-priority) - (>= libgnutls-version 30603) - (version< emacs-version "26.3") - ;; (memq (ghub--req-forge req) '(github nil)) - ))) - "NORMAL:-VERS-TLS1.3" - gnutls-algorithm-priority))) - (if (or (ghub--req-callback req) - (ghub--req-errorback req)) - (url-retrieve url handler (list req) silent) - (with-current-buffer - (url-retrieve-synchronously url silent) - (funcall handler (car url-callback-arguments) req))))) - -(defun ghub--handle-response (status req) - (let ((buffer (current-buffer))) - (unwind-protect - (progn - (set-buffer-multibyte t) - (let* ((unpaginate (ghub--req-unpaginate req)) - (headers (ghub--handle-response-headers status req)) - (payload (ghub--handle-response-payload req)) - (payload (ghub--handle-response-error status payload req)) - (value (ghub--handle-response-value payload req)) - (prev (ghub--req-url req)) - (next (cdr (assq 'next (ghub-response-link-relations - req headers payload))))) - (when (numberp unpaginate) - (cl-decf unpaginate)) - (setf (ghub--req-url req) - (url-generic-parse-url next)) - (setf (ghub--req-unpaginate req) unpaginate) - (or (and next - unpaginate - (or (eq unpaginate t) - (> unpaginate 0)) - (ghub-continue req)) - (let ((callback (ghub--req-callback req)) - (errorback (ghub--req-errorback req)) - (err (plist-get status :error))) - (cond ((and err errorback) - (setf (ghub--req-url req) prev) - (funcall (if (eq errorback t) - 'ghub--errorback - errorback) - err headers status req)) - (callback - (funcall callback value headers status req)) - (t value)))))) - (when (buffer-live-p buffer) - (kill-buffer buffer))))) - -(defun ghub--handle-response-headers (_status req) - (goto-char (point-min)) - (forward-line 1) - (let (headers) - (when (memq url-http-end-of-headers '(nil 0)) - (setq url-debug t) - (error "BUG: missing headers; but there's a patch for that \ -see https://github.com/magit/ghub/wiki/Known-Issues")) - (while (re-search-forward "^\\([^:]*\\): \\(.+\\)" - url-http-end-of-headers t) - (push (cons (match-string 1) - (match-string 2)) - headers)) - (setq headers (nreverse headers)) - (goto-char (1+ url-http-end-of-headers)) - (if (and req (or (ghub--req-callback req) - (ghub--req-errorback req))) - (setq-local ghub-response-headers headers) - (setq-default ghub-response-headers headers)) - headers)) - -(defun ghub--handle-response-error (status payload req) - (let ((noerror (ghub--req-noerror req)) - (err (plist-get status :error))) - (if err - (if noerror - (if (eq noerror 'return) - payload - (setcdr (last err) (list payload)) - nil) - (ghub--signal-error err payload req)) - payload))) - -(defun ghub--signal-error (err &optional payload req) - (pcase-let ((`(,symb . ,data) err)) - (if (eq symb 'error) - (if (eq (car-safe data) 'http) - (signal 'ghub-http-error - (let ((code (car (cdr-safe data)))) - (list code - (nth 2 (assq code url-http-codes)) - (and req (url-filename (ghub--req-url req))) - payload))) - (signal 'ghub-error data)) - (signal symb data)))) - -(defun ghub--errorback (err _headers _status req) - (ghub--signal-error err (nth 3 err) req)) - -(defun ghub--handle-response-value (payload req) - (setf (ghub--req-value req) - (nconc (ghub--req-value req) - (if-let ((nested (and (eq (ghub--req-forge req) 'bitbucket) - (assq 'values payload)))) - (cdr nested) - payload)))) - -(defun ghub--handle-response-payload (req) - (funcall (or (ghub--req-reader req) - 'ghub--read-json-payload) - url-http-response-status)) - -(defun ghub--read-json-payload (_status) - (let ((raw (ghub--decode-payload))) - (and raw - (condition-case nil - (if (and ghub-json-use-jansson - (fboundp 'json-parse-string)) - (json-parse-string - raw - :object-type ghub-json-object-type - :array-type ghub-json-array-type - :false-object nil - :null-object nil) - (require 'json) - (let ((json-object-type ghub-json-object-type) - (json-array-type ghub-json-array-type) - (json-false nil) - (json-null nil)) - (json-read-from-string raw))) - ((json-parse-error json-readtable-error) - `((message - . ,(if (looking-at "") - (if (re-search-forward - "

\\(?:\\)?\\([^<]+\\)" nil t) - (match-string 1) - "error description missing") - (string-trim (buffer-substring (point) (point-max))))) - (documentation_url - . "https://github.com/magit/ghub/wiki/Github-Errors"))))))) - -(defun ghub--decode-payload (&optional _status) - (and (not (eobp)) - (decode-coding-string - (buffer-substring-no-properties (point) (point-max)) - 'utf-8))) - -(defun ghub--encode-payload (payload) - (and payload - (progn - (unless (stringp payload) - (setq payload - (if (and ghub-json-use-jansson - (fboundp 'json-serialize)) - (json-serialize payload - ;; :object-type and :array-type - ;; are not supported here. - :false-object nil - :null-object :null) - (require 'json) - (let ((json-object-type ghub-json-object-type) - (json-array-type ghub-json-array-type) - (json-false nil) - (json-null :null)) - ;; Unfortunately `json-encode' may modify the input. - ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40693. - ;; and https://github.com/magit/forge/issues/267 - (json-encode (copy-tree payload)))))) - (encode-coding-string payload 'utf-8)))) - -(defun ghub--url-encode-params (params) - (mapconcat (lambda (param) - (pcase-let ((`(,key . ,val) param)) - (concat (url-hexify-string (symbol-name key)) "=" - (cl-typecase val - (integer (number-to-string val)) - (boolean (if val "true" "false")) - (t (url-hexify-string val)))))) - params "&")) - -;;; Authentication -;;;; API - -;;;###autoload -(defun ghub-clear-caches () - "Clear all caches that might negatively affect Ghub. - -If a library that is used by Ghub caches incorrect information -such as a mistyped password, then that can prevent Ghub from -asking the user for the correct information again. - -Set `url-http-real-basic-auth-storage' to nil -and call `auth-source-forget+'." - (interactive) - (setq url-http-real-basic-auth-storage nil) - (auth-source-forget+)) - -;;;; Internal - -(defun ghub--headers (headers host auth username forge) - (push (cons "Content-Type" "application/json") headers) - (if (eq auth 'none) - headers - (unless (or username (stringp auth)) - (setq username (ghub--username host forge))) - (lambda () - (if (eq auth 'basic) - (cons (cons "Authorization" (ghub--basic-auth host username)) - headers) - (cons (ghub--auth host auth username forge) headers))))) - -(cl-defgeneric ghub--auth (host auth &optional username forge) - (unless username - (setq username (ghub--username host forge))) - (if (eq auth 'basic) - (cl-ecase forge - ((nil gitea gogs bitbucket) - (cons "Authorization" (ghub--basic-auth host username))) - ((github gitlab) - (error "%s does not support basic authentication" - (capitalize (symbol-name forge))))) - (cons (cl-ecase forge - ((nil github gitea gogs bitbucket) - "Authorization") - (gitlab - "Private-Token")) - (if (eq forge 'bitbucket) - ;; For some undocumented reason Bitbucket supports - ;; values of the form "token " only for GET - ;; requests. For PUT requests we have to use basic - ;; authentication. Note that the secret is a token - ;; (aka "app password"), not the actual password. - ;; The documentation fails to mention this little - ;; detail. See #97. - (concat "Basic " - (base64-encode-string - (concat username ":" - (ghub--token host username auth nil forge)) - t)) - (concat - (and (not (eq forge 'gitlab)) "token ") - (encode-coding-string - (cl-typecase auth - (string auth) - (null (ghub--token host username 'ghub nil forge)) - (symbol (ghub--token host username auth nil forge)) - (t (signal 'wrong-type-argument - `((or stringp symbolp) ,auth)))) - 'utf-8)))))) - -(defun ghub--basic-auth (host username) - (let ((url (url-generic-parse-url - (if (member host ghub-insecure-hosts) "http://" "https://")))) - (setf (url-user url) username) - (url-basic-auth url t))) - -(defun ghub--token (host username package &optional nocreate forge) - (let* ((user (ghub--ident username package)) - (token - (or (car (ghub--auth-source-get (list :secret) - :host host :user user)) - (progn - ;; Auth-Source caches the information that there is no - ;; value, but in our case that is a situation that needs - ;; fixing so we want to keep trying by invalidating that - ;; information. - ;; The (:max 1) is needed and has to be placed at the - ;; end for Emacs releases before 26.1. #24 #64 #72 - (auth-source-forget (list :host host :user user :max 1)) - (and (not nocreate) - (error "\ -Required %s token (\"%s\" for \"%s\") does not exist. -See https://magit.vc/manual/ghub/Getting-Started.html -or (info \"(ghub)Getting Started\") for instructions. -\(The setup wizard no longer exists.)" - (capitalize (symbol-name (or forge 'github))) - user host)))))) - (if (functionp token) (funcall token) token))) - -(cl-defgeneric ghub--host (&optional forge) - (cl-ecase forge - ((nil github) - (or (ignore-errors (car (process-lines "git" "config" "github.host"))) - ghub-default-host)) - (gitlab - (or (ignore-errors (car (process-lines "git" "config" "gitlab.host"))) - (bound-and-true-p glab-default-host))) - (gitea - (or (ignore-errors (car (process-lines "git" "config" "gitea.host"))) - (bound-and-true-p gtea-default-host))) - (gogs - (or (ignore-errors (car (process-lines "git" "config" "gogs.host"))) - (bound-and-true-p gogs-default-host))) - (bitbucket - (or (ignore-errors (car (process-lines "git" "config" "bitbucket.host"))) - (bound-and-true-p buck-default-host))))) - -(cl-defgeneric ghub--username (host &optional forge) - (let ((var - (cl-ecase forge - ((nil github) - (if (equal host ghub-default-host) - "github.user" - (format "github.%s.user" host))) - (gitlab - (if (equal host "gitlab.com/api/v4") - "gitlab.user" - (format "gitlab.%s.user" host))) - (bitbucket - (if (equal host "api.bitbucket.org/2.0") - "bitbucket.user" - (format "bitbucket.%s.user" host))) - (gitea - (when (zerop (call-process "git" nil nil nil "config" "gitea.host")) - (error "gitea.host is set but always ignored")) - (format "gitea.%s.user" host)) - (gogs - (when (zerop (call-process "git" nil nil nil "config" "gogs.host")) - (error "gogs.host is set but always ignored")) - (format "gogs.%s.user" host))))) - (condition-case nil - (car (process-lines "git" "config" var)) - (error - (let ((user (read-string - (format "Git variable `%s' is unset. Set to: " var)))) - (if (equal user "") - (user-error "The empty string is not a valid username") - (call-process - "git" nil nil nil "config" - (if (eq (read-char-choice - (format "Set %s=%s [g]lobally (recommended) or [l]ocally? " - var user) - (list ?g ?l)) - ?g) - "--global" - "--local") - var user) - user)))))) - -(defun ghub--ident (username package) - (format "%s^%s" username package)) - -(defun ghub--auth-source-get (keys &rest spec) - (declare (indent 1)) - (let ((plist (car (apply #'auth-source-search - (append spec (list :max 1)))))) - (mapcar (lambda (k) - (plist-get plist k)) - keys))) - -(when (version< emacs-version "26.2") - ;; Fixed by Emacs commit 60ff8101449eea3a5ca4961299501efd83d011bd. - (advice-add 'auth-source-netrc-parse-next-interesting :around - 'auth-source-netrc-parse-next-interesting@save-match-data) - (defun auth-source-netrc-parse-next-interesting@save-match-data (fn) - "Save match-data for the benefit of caller `auth-source-netrc-parse-one'. -Without wrapping this function in `save-match-data' the caller -won't see the secret from a line that is followed by a commented -line." - (save-match-data (funcall fn)))) - -(when (< emacs-major-version 28) - ;; Fixed by Emacs commit 0b98ea5fbe276c67206896dca111c000f984ee0f. - (advice-add 'url-http-handle-authentication :around - 'url-http-handle-authentication@unauthorized-bugfix) - (defun url-http-handle-authentication@unauthorized-bugfix (fn proxy) - "If authorization failed then don't try again but fail properly. -For Emacs 27.1 prevent a useful `http' error from being replaced -by a generic one that omits all useful information. For earlier -releases prevent a new request from being made, which would -either result in an infinite loop or (e.g. in the case of `ghub') -the user being asked for their name." - (if (assoc "Authorization" url-http-extra-headers) - t ; Return "success", here also known as "successfully failed". - (funcall fn proxy)))) - -(when (and (< emacs-major-version 29) - ghub-use-workaround-for-emacs-bug-54989) - ;; Fixed in Emacs commit 0829c6836eff14dda0cf8b3047376967f7b000f4. - ;; Cleanup from 26faa2b943675107e1664b2fea7174137c473475 is not - ;; included in this copy because doing that would require changes - ;; to more functions. This function has seen a few other changes - ;; since Emacs 25.1, the oldest version we still support. Of these - ;; only 4f1df40db36b221e7842bd75d6281922dcb268ee makes a functional - ;; change, fixing debbug#35658. The first release to contain that - ;; commit is 27.1. That commit either fixes a related bug or it - ;; deals with the same bug but only partially fixes it. - (advice-add 'url-http-chunked-encoding-after-change-function :override - 'url-http-chunked-encoding-after-change-function@54989-backport) - (defvar url-http-chunked-last-crlf-missing nil) - (defvar url-http-content-type) - (defvar url-http-chunked-start) - (defvar url-http-chunked-length) - (defvar url-http-chunked-counter) - (defun url-http-chunked-encoding-after-change-function@54989-backport - (st nd length) - "Backport bugfix from https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54989." - (if url-http-chunked-last-crlf-missing - (progn - (goto-char url-http-chunked-last-crlf-missing) - (if (not (looking-at "\r\n")) - (url-http-debug - "Still spinning for the terminator of last chunk...") - (url-http-debug "Saw the last CRLF.") - (delete-region (match-beginning 0) (match-end 0)) - (when (url-http-parse-headers) - (url-http-activate-callback)))) - (save-excursion - (goto-char st) - (let ((read-next-chunk t) - (case-fold-search t) - (regexp nil) - (no-initial-crlf nil)) - ;; We need to loop thru looking for more chunks even within - ;; one after-change-function call. - (while read-next-chunk - (setq no-initial-crlf (= 0 url-http-chunked-counter)) - (with-no-warnings - (if url-http-content-type - (url-display-percentage nil - "Reading [%s]... chunk #%d" - url-http-content-type url-http-chunked-counter) - (url-display-percentage nil - "Reading... chunk #%d" - url-http-chunked-counter))) - (url-http-debug "Reading chunk %d (%d %d %d)" - url-http-chunked-counter st nd length) - (setq regexp (if no-initial-crlf - "\\([0-9a-z]+\\).*\r?\n" - "\r?\n\\([0-9a-z]+\\).*\r?\n")) - - (if url-http-chunked-start - ;; We know how long the chunk is supposed to be, skip over - ;; leading crap if possible. - (if (> nd (+ url-http-chunked-start url-http-chunked-length)) - (progn - (url-http-debug "Got to the end of chunk #%d!" - url-http-chunked-counter) - (goto-char (+ url-http-chunked-start - url-http-chunked-length))) - (url-http-debug "Still need %d bytes to hit end of chunk" - (- (+ url-http-chunked-start - url-http-chunked-length) - nd)) - (setq read-next-chunk nil))) - (if (not read-next-chunk) - (url-http-debug "Still spinning for next chunk...") - (if no-initial-crlf (skip-chars-forward "\r\n")) - (if (not (looking-at regexp)) - (progn - ;; Must not have received the entirety of the chunk header, - ;; need to spin some more. - (url-http-debug "Did not see start of chunk @ %d!" (point)) - (setq read-next-chunk nil)) - ;; The data we got may have started in the middle of the - ;; initial chunk header, so move back to the start of the - ;; line and re-compute. - (when (= url-http-chunked-counter 0) - (beginning-of-line) - (looking-at regexp)) - (add-text-properties (match-beginning 0) (match-end 0) - (list 'chunked-encoding t - 'face 'cursor - 'invisible t)) - (setq url-http-chunked-length - (string-to-number (buffer-substring (match-beginning 1) - (match-end 1)) - 16) - url-http-chunked-counter (1+ url-http-chunked-counter) - url-http-chunked-start (set-marker - (or url-http-chunked-start - (make-marker)) - (match-end 0))) - (delete-region (match-beginning 0) (match-end 0)) - (url-http-debug "Saw start of chunk %d (length=%d, start=%d" - url-http-chunked-counter url-http-chunked-length - (marker-position url-http-chunked-start)) - (if (= 0 url-http-chunked-length) - (progn - ;; Found the end of the document! Wheee! - (url-http-debug "Saw end of stream chunk!") - (setq read-next-chunk nil) - (with-no-warnings - (url-display-percentage nil nil)) - ;; Every chunk, even the last 0-length one, is - ;; terminated by CRLF. Skip it. - (if (not (looking-at "\r?\n")) - (progn - (url-http-debug - "Spinning for the terminator of last chunk...") - (setq-local url-http-chunked-last-crlf-missing - (point))) - (url-http-debug "Removing terminator of last chunk") - (delete-region (match-beginning 0) (match-end 0)) - (when (re-search-forward "^\r?\n" nil t) - (url-http-debug "Saw end of trailers...")) - (when (url-http-parse-headers) - (url-http-activate-callback))))))))))))) - -;;; _ -(provide 'ghub) -(require 'ghub-graphql) -;;; ghub.el ends here diff --git a/elpa/ghub-20230513.1619/ghub.info b/elpa/ghub-20230513.1619/ghub.info deleted file mode 100644 index 8de5b13c..00000000 --- a/elpa/ghub-20230513.1619/ghub.info +++ /dev/null @@ -1,1170 +0,0 @@ -This is ghub.info, produced by makeinfo version 6.7 from ghub.texi. - - Copyright (C) 2017-2023 Jonas Bernoulli - - You can redistribute this document and/or modify it under the terms - of the GNU General Public License as published by the Free Software - Foundation, either version 3 of the License, or (at your option) - any later version. - - This document is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - -INFO-DIR-SECTION Emacs -START-INFO-DIR-ENTRY -* Ghub: (ghub). Client library for the Github API. -END-INFO-DIR-ENTRY - - -File: ghub.info, Node: Top, Next: Introduction, Up: (dir) - -Ghub User and Developer Manual -****************************** - -Ghub is an Emacs library that is used by various packages to access the -APIs of various instances of various Git forge implementations. - -This manual is for Ghub version 3.6.0. - - Copyright (C) 2017-2023 Jonas Bernoulli - - You can redistribute this document and/or modify it under the terms - of the GNU General Public License as published by the Free Software - Foundation, either version 3 of the License, or (at your option) - any later version. - - This document is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - -* Menu: - -* Introduction:: -* Getting Started:: -* API:: -* Notes:: -* Function Index:: -* Variable Index:: - -— The Detailed Node Listing — - -Getting Started - -* Basic Concepts, Arguments and Variables: Basic Concepts Arguments and Variables. -* Setting the Username:: -* Creating and Storing a Token:: -* Github Configuration Variables:: - -Creating and Storing a Token - -* Creating a Token:: -* Storing a Token:: - - -API - -* Their APIs:: -* Making REST Requests:: -* Making GraphQL Requests:: -* Github Convenience Wrappers:: -* Non-Github Convenience Wrappers:: - -Notes - -* Using Ghub in Personal Scripts:: -* Using Ghub in Your Own Package:: -* Forge Limitations and Notes:: - - - -File: ghub.info, Node: Introduction, Next: Getting Started, Prev: Top, Up: Top - -1 Introduction -************** - -Ghub is an Emacs library that is used by various packages to access the -APIs of various instances of various Git forge implementations. - - A forge is a web-based collaborative software platform for developing -and distributing computer applications. Examples include Github and -Gitlab. - - -File: ghub.info, Node: Getting Started, Next: API, Prev: Introduction, Up: Top - -2 Getting Started -***************** - -This manual guides you through the steps that are necessary to use the -Forge package and/or to make a request using just Ghub itself, such as -this: - - (ghub-request "GET" "/user") - - To be able to do that, Ghub needs to know who you want to talk to, -who you are, and how you are going to prove the latter to the former. - - Additionally Ghub wants to know on behalf of which Emacs package it -is making a request. So the question of "who is making the request" has -to be rephrased as "which human (or bot) is using what (Emacs) package -to make the request". If for example, the human known as "tarsius" is -using the ‘forge’ package, then that is represented in some places using -the string "tarsius^forge". - - This package used to attempt to get the answers to these questions -using a setup wizard. Unfortunately that had to be removed because (a) -it only ever supported Github, (b) by now Github has removed support for -that on their end, (c) it did not always work, and (d) when it couldn’t -be used, or failed, then it made things _more_ complicated. - - So now it is necessary for users to read some documentation and -because many things can go wrong, those instructions have to be fairly -detailed. You can of course skip over most of this, but if things go -wrong, then I would like to kindly request that you take another look -before asking me for help. - -* Menu: - -* Basic Concepts, Arguments and Variables: Basic Concepts Arguments and Variables. -* Setting the Username:: -* Creating and Storing a Token:: -* Github Configuration Variables:: - - -File: ghub.info, Node: Basic Concepts Arguments and Variables, Next: Setting the Username, Up: Getting Started - -2.1 Basic Concepts, Arguments and Variables -=========================================== - -Originally Ghub supported only Github but now it also supports Gitlab, -Gitea, Gogs and Bitbucket. For the historic reason just given, the -function ‘ghub-request’ defaults to acting on a ‘github’ forge, but can -be told to act on another forge using the FORGE argument. - - The FORGE argument only specifies what kind of forge to act on, not -which instance. The HOST argument can be used to select the instance. -For some forges a default instance is defined: - - • Forge ‘github’ defaults to host ‘api.github.com’. - • Forge ‘gitlab’ defaults to host ‘gitlab.com/api/v4’. - • Forge ‘bitbucket’ defaults to host ‘api.bitbucket.org/2.0’. - • No canonical host exists for the ‘gitea’ and ‘gogs’ forges and - ‘localhost:3000/api/v1’ is used as the default host in both cases. - - Together the FORGE and HOST arguments specify the forge type and -instance. In addition to that, it is also necessary to specify on whose -behalf the request is being made, which can be done using the USERNAME -and AUTH arguments. For example: - - (ghub-request "GET" "/user" nil - :forge 'github - :host "api.github.com" - :username "tarsius" - :auth 'forge) - - Having to specify these arguments for every request is inconvenient. -Additional variables and convenience functions can be used to make that -unnecessary in most cases. - - (But for debugging purposes the above explicit form is very useful. -You will obviously have to change the value of USERNAME and you should -use ‘ghub’ as AUTH when first trying this at home.) - - These variables can be set globally and/or for a specific repository. - - • For "api.github.com" (aka the API of ) the Git - variable ‘github.user’ specifies the user. - • For another ‘github’ instance the Git variable ‘github.HOST.user’ - specifies the user. The HOST in that variable name is the same as - the value of the HOST argument of the called function. - • Instead of specifying the HOST in every function call, the Git - variable ‘github.host’ can be used. This should only be set - locally. - - These ‘github’ specific variables are discussed in more detail in -*note Github Configuration Variables::. - -For ‘gitlab’ and ‘bitbucket’ forges similar variables are available: - - • ‘gitlab.user’ specifies the user. - • ‘gitlab.HOST.user’ specifies the user for the HOST ‘gitlab’ - instance. - • ‘gitlab.host’ specifies the ‘gitlab’ host, unless the HOST argument - is non-nil - • ‘bitbucket.user’ specifies the user. - • ‘bitbucket.HOST.user’ specifies the user for the HOST ‘bitbucket’ - instance. - • ‘bitbucket.host’ specifies the ‘bitbucket’ host, unless the HOST - argument is non-nil. - - For the ‘gitea’ and ‘gogs’ forges some similar variables are -available, however for some of the ‘ghub.*’ variables no equivalent -variable exist for these two forges: - - • ‘gitea.user’ is *not* used because no canonical ‘gitea’ instance - exists. - • ‘gitea.HOST.user’ specifies the user for the HOST ‘gitea’ instance. - • ‘gitea.host’ specifies the ‘gitea’ host, unless the HOST argument - is non-nil - • ‘gogs.user’ is *not* used because no canonical ‘gogs’ instance - exists. - • ‘gogs.HOST.user’ specifies the user for the HOST ‘gogs’ instance. - • ‘gogs.host’ specifies the ‘gogs’ host, unless the HOST argument is - non-nil - - -File: ghub.info, Node: Setting the Username, Next: Creating and Storing a Token, Prev: Basic Concepts Arguments and Variables, Up: Getting Started - -2.2 Setting the Username -======================== - -Ghub needs to know your username that you use on the host that you want -it to connect to. For each host a different Git variable has to be set -to specify the username on that host. More than one variable is needed -because you might use different usernames on different hosts. - -Setting your Github.com Username --------------------------------- - -To inform Ghub about your "github.com" username do this: - - git config --global github.user USERNAME - - If you need to identify as another user in a particular repository, -then you have to set that variable locally: - - cd /path/to/repo - git config --local github.user USERNAME - -Setting your Gitlab.com Username --------------------------------- - -To inform Ghub about your "gitlab.com" username do this: - - git config --global gitlab.user USERNAME - - If you need to identify as another user in a particular repository, -then you have to set that variable locally: - - cd /path/to/repo - git config --local gitlab.user USERNAME - - Make sure you use the correct USERNAME for this forge/host. It might -not be the same as on "github.com"! - -Setting your Github Enterprise Username ---------------------------------------- - -For Github Enterprise instances you have to specify where the API can be -accessed and a different variable has to be used to set the username. - - For example if the API is available at ‘https://example.com/api/v3’, -then you should do this: - - git config --global github.example.com/api/v3.user USERNAME - - Make sure you use the correct USERNAME for this instance. It might -not be the same as on "github.com"! - - Doing this only tells Ghub who you are on this host, additionally you -have to tell Ghub which repositories are connected to that forge/host, -like so: - - cd /path/to/repo - git config --local github.host example.com/api/v3 - -Setting your Username for Other Hosts and/or Forges ---------------------------------------------------- - -To inform Ghub about your username on HOST (a FORGE instance) do this: - - git config --global FORGE.HOST.user USERNAME - - FORGE can be one of ‘bitbucket’, ‘gitea’ or ‘gogs’. It can also be -‘github’ or ‘gitlab’; but if that is the case, then you should look at -the preceding sections instead, which discuss these cases specifically. - - HOST identifies the instance. This actually points at the top-level -endpoint of the API and may contain path components, e.g.: -‘example.com/api’. - - If you need to identify as another user in a particular repository, -then you have to set that variable locally: - - cd /path/to/repo - git config --local FORGE.HOST.user USERNAME - - -File: ghub.info, Node: Creating and Storing a Token, Next: Github Configuration Variables, Prev: Setting the Username, Up: Getting Started - -2.3 Creating and Storing a Token -================================ - -* Menu: - -* Creating a Token:: -* Storing a Token:: - - -File: ghub.info, Node: Creating a Token, Next: Storing a Token, Up: Creating and Storing a Token - -2.3.1 Creating a Token ----------------------- - -To create a token, use the web interface of the forge/host you want to -connect to. Here is a list of pages to do this for certain popular -hosts: - - • - • - - For other forges we cannot provide a functioning URL because they -contain unknown values such as your name. Just go to the general -settings page of the respective host and then go from there. - - Except on ‘gitea’ and ‘gogs’ each token can be limited to certain -"scopes", i.e., it is possible to limit for which purposes any given -token can be used. - - Before you create a token to be used for a certain package, you -should consult the documentation of that package, which in turn should -tell you which scopes are needed and why. The Forge package for example -does so in *note (forge)Token Creation::. - - -File: ghub.info, Node: Storing a Token, Prev: Creating a Token, Up: Creating and Storing a Token - -2.3.2 Storing a Token ---------------------- - -Please also see *note (auth)Top:: for all the gory details about -Auth-Source. - - The variable ‘auth-sources’ controls how and where Auth-Source keeps -its secrets. The default value is a list of three files: -‘("~/.authinfo" "~/.authinfo.gpg" "~/.netrc")’, but to avoid confusion -you should make sure that only one of these files exists and then you -should also adjust the value of the variable to only ever use that file, -for example: - - (setq auth-sources '("~/.authinfo")) - - In ‘~/.authinfo’ secrets are stored in plain text. If you don’t want -that, then you should use the encrypted ‘~/.authinfo.gpg’ instead: - - (setq auth-sources '("~/.authinfo.gpg")) - - Auth-Source also supports storing secrets in various external -key-chains. See *note (auth)Top:: for more information. - - The default Auth-Source backends only support storing three values -per entry; the "machine", the "login" and the "password". Because Ghub -uses separate tokens for each package, it has to squeeze four values -into those three slots, and it does that by using "USERNAME^PACKAGE" as -the "login". - - Assuming your *Github* username is "ziggy", the package is named -"forge", and you want to access *Github.com* with the *token* -"012345abcdef...", an entry in one of the three mentioned files would -then look like this: - - machine api.github.com login ziggy^forge password 012345abcdef... - - Assuming your *Gitlab* username is "ziggy", the package is named -"forge", and you want to access *Gitlab.com* with the *token* -"012345abcdef...", an entry in one of the three mentioned files would -then look like this: - - machine gitlab.com/api/v4 login ziggy^forge password 012345abcdef... - - -File: ghub.info, Node: Github Configuration Variables, Prev: Creating and Storing a Token, Up: Getting Started - -2.4 Github Configuration Variables -================================== - -The username and, unless you only use Github.com itself, the Github -Enterprise instance have to be configured using Git variables. In rare -cases it might also be necessary to specify the identity of the local -machine, which is done using a lisp variable. - - -- Variable: github.user - The Github.com username. This should be set globally and if you - have multiple Github.com user accounts, then you should set this - locally only for those repositories that you want to access using - the secondary identity. - - -- Variable: github.HOST.user - This variable serves the same purpose as ‘github.user’ but for the - Github Enterprise instance identified by ‘HOST’. - - The reason why separate variables are used is that this makes it - possible to set both values globally instead of having to set one - of the values locally in each and every repository that is - connected to the Github Enterprise instance, not Github.com. - - -- Variable: github.host - This variable should only be set locally for a repository and - specifies the Github Enterprise edition that that repository is - connected to. You should not set this globally because then each - and every repository becomes connected to the specified Github - Enterprise instance, including those that should actually be - connected to Github.com. - - When this is undefined, then "api.github.com" is used (defined in - the constant ‘ghub-default-host’, which you should never attempt to - change.) - - -File: ghub.info, Node: API, Next: Notes, Prev: Getting Started, Up: Top - -3 API -***** - -* Menu: - -* Their APIs:: -* Making REST Requests:: -* Making GraphQL Requests:: -* Github Convenience Wrappers:: -* Non-Github Convenience Wrappers:: - - -File: ghub.info, Node: Their APIs, Next: Making REST Requests, Up: API - -3.1 Their APIs -============== - -Of course this manual does not cover the APIs of all forges that it -supports, but for your convenience, here are the links to their API -manuals: - - • Github: - • (GraphQl) - • (REST) - • Gitlab: - • - • Gitea: - • - • - • Gogs: - • - • Bitbucket: - • - - -File: ghub.info, Node: Making REST Requests, Next: Making GraphQL Requests, Prev: Their APIs, Up: API - -3.2 Making REST Requests -======================== - - -- Function: ghub-request method resource &optional params &key query - payload headers unpaginate noerror reader username auth host - callback errorback url value error extra method* - This function makes a request for ‘RESOURCE’ using ‘METHOD’. - ‘PARAMS’, ‘QUERY’, ‘PAYLOAD’ and/or ‘HEADERS’ are alists holding - additional request data. The response body is returned and the - response headers are stored in the variable - ‘ghub-response-headers’. - - • ‘METHOD’ is the HTTP method, given as a string. - • ‘RESOURCE’ is the resource to access, given as a string - beginning with a slash. - - • ‘PARAMS’, ‘QUERY’, ‘PAYLOAD’ and ‘HEADERS’ are alists and are - used to specify request data. All these arguments are alists - that resemble the JSON expected and returned by the Github - API. The keys are symbols and the values stored in the ‘cdr’ - (not the ‘cadr’) can be strings, integers, or lists of strings - and integers. - - The Github API documentation is vague on how data has to be - transmitted and for a particular resource usually just talks - about "parameters". Generally speaking when the ‘METHOD’ is - "HEAD" or "GET", then they have to be transmitted as a query, - otherwise as a payload. - - • Use ‘PARAMS’ to automatically transmit like ‘QUERY’ or - ‘PAYLOAD’ would depending on ‘METHOD’. - • Use ‘QUERY’ to explicitly transmit data as a query. - • Use ‘PAYLOAD’ to explicitly transmit data as a payload. - Instead of an alist, ‘PAYLOAD’ may also be a string, in - which case it gets encoded as UTF-8 but is otherwise - transmitted as-is. - • Use ‘HEADERS’ for those rare resources that require that - the data is transmitted as headers instead of as a query - or payload. When that is the case, then the Github API - documentation usually mentions it explicitly. - - • If ‘SILENT’ is non-nil, then progress reports and the like are - not messaged. - - • If ‘UNPAGINATE’ is t, then this function makes as many - requests as necessary to get all values. If ‘UNPAGINATE’ is a - natural number, then it gets at most that many pages. For any - other non-nil value it raises an error. - - • If ‘NOERROR’ is non-nil, then no error is raised if the - request fails and ‘nil’ is returned instead. If ‘NOERROR’ is - ‘return’, then the error payload is returned instead of ‘nil’. - - • If ‘READER’ is non-nil, then it is used to read and return - from the response buffer. The default is - ‘ghub--read-json-payload’. For the very few resources that do - not return JSON, you might want to use ‘ghub--decode-payload’. - - • If ‘USERNAME’ is non-nil, then the request is made on behalf - of that user. It is better to specify the user using the Git - variable ‘github.user’ for "api.github.com", or - ‘github.HOST.user’ if connecting to a Github Enterprise - instance. - - • Each package that uses Ghub should use its own token. If - ‘AUTH’ is ‘nil’ or unspecified, then the generic ‘ghub’ token - is used instead. This is only acceptable for personal - utilities. A package that is distributed to other users - should always use this argument to identify itself, using a - symbol matching its name. - - Package authors who find this inconvenient should write a - wrapper around this function and possibly for the - method-specific functions as well. - - Beside ‘nil’, some other symbols have a special meaning too. - ‘none’ means to make an unauthorized request. ‘basic’ means - to make a password based request. If the value is a string, - then it is assumed to be a valid token. ‘basic’ and an - explicit token string are only intended for internal and - debugging uses. - - If ‘AUTH’ is a package symbol, then the scopes are specified - using the variable ‘AUTH-github-token-scopes’. It is an error - if that is not specified. See ‘ghub-github-token-scopes’ for - an example. - - • If ‘HOST’ is non-nil, then connect to that Github instance. - This defaults to "api.github.com". When a repository is - connected to a Github Enterprise instance, then it is better - to specify that using the Git variable ‘github.host’ instead - of using this argument. - - • If ‘FORGE’ is ‘gitlab’, then connect to Gitlab.com or, - depending on ‘HOST’, to another Gitlab instance. This is only - intended for internal use. Instead of using this argument you - should use function ‘glab-request’ and other ‘glab-*’ - functions. - - • If ‘CALLBACK’ and/or ‘ERRORBACK’ is non-nil, then this - function makes one or more asynchronous requests and calls - ‘CALLBACK’ or ‘ERRORBACK’ when finished. If no error - occurred, then it calls ‘CALLBACK’, unless that is ‘nil’. - - If an error occurred, then it calls ‘ERRORBACK’, or if that is - nil, then ‘CALLBACK’. ‘ERRORBACK’ can also be ‘t’, in which - case it signals instead. ‘NOERROR’ is ignored for all - asynchronous requests. - - Both callbacks are called with four arguments. - - 1. For ‘CALLBACK’, the combined value of the retrieved - pages. For ‘ERRORBACK’, the error that occurred when - retrieving the last page. - 2. The headers of the last page as an alist. - 3. Status information provided by ‘url-retrieve’. Its - ‘:error’ property holds the same information as the first - argument to ‘ERRORBACK’. - 4. A ‘ghub--req’ struct, which can be passed to - ‘ghub-continue’ (which see) to retrieve the next page, if - any. - - -- Function: ghub-continue args - If there is a next page, then this function retrieves that. - - This function is only intended to be called from callbacks. If - there is a next page, then that is retrieved and the buffer that - the result will be loaded into is returned, or t if the process has - already completed. If there is no next page, then return nil. - - Callbacks are called with four arguments (see ‘ghub-request’). The - forth argument is a ‘ghub--req’ struct, intended to be passed to - this function. A callback may use the struct’s ‘extra’ slot to - pass additional information to the callback that will be called - after the next request. Use the function ‘ghub-req-extra’ to get - and set the value of that slot. - - As an example, using ‘ghub-continue’ in a callback like so: - - (ghub-get "/users/tarsius/repos" nil - :callback (lambda (value _headers _status req) - (unless (ghub-continue req) - (setq my-value value)))) - - is equivalent to: - - (ghub-get "/users/tarsius/repos" nil - :unpaginate t - :callback (lambda (value _headers _status _req) - (setq my-value value))) - - To demonstrate how to pass information from one callback to the - next, here we record when we start fetching each page: - - (ghub-get "/users/tarsius/repos" nil - :extra (list (current-time)) - :callback (lambda (value _headers _status req) - (push (current-time) (ghub-req-extra req)) - (unless (ghub-continue req) - (setq my-times (ghub-req-extra req)) - (setq my-value value)))) - - -- Variable: ghub-response-headers - A select few Github API resources respond by transmitting data in - the response header instead of in the response body. Because there - are so few of these inconsistencies, ‘ghub-request’ always returns - the response body. - - To access the response headers use this variable after - ‘ghub-request’ has returned. - - -- Function: ghub-response-link-relations req headers payload - This function returns an alist of the link relations in ‘HEADERS’, - or if optional ‘HEADERS’ is nil, then those in - ‘ghub-response-headers’. - - When accessing a Bitbucket instance then the link relations are in - ‘PAYLOAD’ instead of ‘HEADERS’, making their API merely RESTish and - forcing this function to append those relations to the value of - ‘ghub-response-headers’, for later use when this function is called - with ‘nil’ for ‘PAYLOAD’. - - -File: ghub.info, Node: Making GraphQL Requests, Next: Github Convenience Wrappers, Prev: Making REST Requests, Up: API - -3.3 Making GraphQL Requests -=========================== - - -- Function: ghub-graphql graphql &optional variables &key username - auth host callback silent callback errorback value extra - This function makes a GraphQL request using ‘GRAPHQL’ and - ‘VARIABLES’ as inputs. ‘GRAPHQL’ is a GraphQL string. ‘VARIABLES’ - is a JSON-like alist. The other arguments behave as for - ‘ghub-request’ (which see). - - The response is returned as a JSON-like alist. Even if the - response contains ‘errors’, this function does not raise an error. - Cursor-handling is likewise left to the caller. - - ‘ghub-graphql’ is a thin convenience wrapper around ‘ghub-request’, -similar to ‘ghub-post’ and friends. While the latter only hard-code the -value of the ‘METHOD’ argument, the former also hard-codes ‘RESOURCE’ -and constructs ‘PAYLOAD’ from ‘GRAPHQL’ and ‘VARIABLES’. It also drops -‘UNPAGINATE’, ‘NOERROR’, ‘READER’ (internal functions expect alist-ified -JSON) and ‘FORGE’ (only Github currently supports GraphQL). - - ‘ghub-graphql’ does not account for the fact that pagination works -differently in GraphQL than it does in REST, so users of this function -have to deal with that themselves. Likewise error handling works -differently and has to be done by the caller too. - - An early attempt at implementing automatic unpaginating for GraphQL -can be found in the ‘faithful-graphql’ branch, provided I haven’t -deleted that by now. On that branch I try to do things as intended by -the designers of GraphQL, using variables and fragments, and drowning in -a sea of boilerplate. - - The problem with that approach is that it only works for applications -that fetch specific information on demand and actually want things to be -paginated. I am convinced that GraphQL is very nice for web apps. - - However the Forge package for which I have implemented all of this -has very different needs. It wants to fetch "all the data" and "cache" -it locally, so that it is available even when there is no internet -connection. GraphQL was designed around the idea that you should be -able to "ask for what you need and get exactly that". But when that -boils down to "look, if I persist, then you are going to hand me over -all the data anyway, so just caught it up already", then things start to -fall apart. If Github’s GraphQL allowed pagination to be turned off -completely, then teaching ‘ghub-graphql’ about error handling would be -enough. - - But it doesn’t and when doing things as intended, then that leads to -huge amounts of repetitive boilerplate, which is so boring to write that -doing it without introducing bugs left and right is near impossible; so -I decided to give up on GraphQL variables, fragments and conditions, and -instead implement something more powerful, though also more opinionated. - - -- Function: ghub--graphql-vacuum query variables callback &optional - until &key narrow username auth host forge - This function is an opinionated alternative to ‘ghub-graphql’. It - relies on dark magic to get the job done. - - It makes an initial request using ‘QUERY’. It then looks for - paginated edges in the returned data and makes more requests to - resolve them. In order to do so it automatically transforms the - initial ‘QUERY’ into another query suitable for that particular - edge. The data retrieved by subsequent requests is then injected - into the data of the original request before that is returned or - passed to the callback. If subsequently retrieved data features - new paginated edges, then those are followed recursively. - - The end result is essentially the same as using ‘ghub-graphql’, if - only it were possible to say "do not paginate anything". The - implementation is much more complicated because it is not possible - to do that. - - ‘QUERY’ is a GraphQL query expressed as an s-expression. The - bundled ‘gsexp’ library is used to turn that into a GraphQL query - string. Only a subset of the GraphQL features are supported; - fragments for example are not, and magical stuff happens to - variables. This is not documented yet, I am afraid. Look at - existing callers. - - ‘VARIABLES’ is a JSON-like alist as for ‘ghub-graphql’. - - ‘UNTIL’ is an alist ‘((EDGE-until . VALUE)...)’. When unpaginating - ‘EDGE’ try not to fetch beyond the element whose first field has - the value ‘VALUE’ and remove that element as well as all "lesser" - elements from the retrieved data if necessary. Look at - ‘forge--pull-repository’ for an example. This is only useful if - you "cache" the response locally and want to avoid fetching data - again that you already have. - - Other arguments behave as for ‘ghub-graphql’ and ‘ghub-request’, - more or less. If ‘CALLBACK’ is nil, pretty-print the response. - - Using ‘ghub--graphql-vacuum’, the following resource specific -functions are implemented. These functions are not part of the public -API yet and are very much subject to change. - - -- Function: ghub-fetch-repository owner name callback &optional until - &key username auth host forge - This function asynchronously fetches forge data about the specified - repository. Once all data has been collected, ‘CALLBACK’ is called - with the data as the only argument. - - -- Function: ghub-fetch-issue owner name callback &optional until &key - username auth host forge - This function asynchronously fetches forge data about the specified - issue. Once all data has been collected, ‘CALLBACK’ is called with - the data as the only argument. - - -- Function: ghub-fetch-pullreq owner name callback &optional until - &key username auth host forge - This function asynchronously fetches forge data about the specified - pull-request. Once all data has been collected, ‘CALLBACK’ is - called with the data as the only argument. - - Note that in order to avoid duplication all of these functions base -their initial query on the query stored in ‘ghub-fetch-repository’. The -latter two pass that query through ‘ghub--graphql-prepare-query’, which -then uses ‘ghub--graphql-narrow-query’ to remove parts the caller is not -interested in. These two functions are also used internally, when -unpaginating, but as demonstrated here they can be useful even before -making an initial request. - - -File: ghub.info, Node: Github Convenience Wrappers, Next: Non-Github Convenience Wrappers, Prev: Making GraphQL Requests, Up: API - -3.4 Github Convenience Wrappers -=============================== - - -- Function: ghub-head resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: ghub-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - These functions are simple wrappers around ‘ghub-request’. Their - signature is identical to that of the latter, except that they do - not have an argument named ‘METHOD’. The HTTP method is instead - given by the second word in the function name. - - As described in the documentation for ‘ghub-request’, it depends on - the used method whether the value of the ‘PARAMS’ argument is used - as the query or the payload. For the "HEAD" and "GET" methods it - is used as the query. - - -- Function: ghub-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: ghub-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: ghub-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: ghub-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - These functions are simple wrappers around ‘ghub-request’. Their - signature is identical to that of the latter, except that they do - not have an argument named ‘METHOD’. The HTTP method is instead - given by the second word in the function name. - - As described in the documentation for ‘ghub-request’, it depends on - the used method whether the value of the ‘PARAMS’ argument is used - as the query or the payload. For the "PUT", "POST", "PATCH" and - "DELETE" methods it is used as the payload. - - -- Function: ghub-wait resource &optional duration &key username auth - host - Some API requests result in an immediate successful response even - when the requested action has not actually been carried out yet. - An example is the request for the creation of a new repository, - which doesn’t cause the repository to immediately become available. - The Github API documentation usually mentions this when describing - an affected resource. - - If you want to do something with some resource right after making a - request for its creation, then you might have to wait for it to - actually be created. This function can be used to do so. It - repeatedly tries to access the resource until it becomes available - or until a timeout is reached. In the latter case it signals - ‘ghub-error’. - - ‘RESOURCE’ specifies the resource that this function waits for. - - ‘DURATION’ specifies the maximum number of seconds to wait for, - defaulting to 64 seconds. Emacs will block during that time, but - the user can abort using ‘C-g’. - - The first attempt is made immediately and will often succeed. If - not, then another attempt is made after two seconds, and each - subsequent attempt is made after waiting as long as we already - waited between all preceding attempts combined. - - See ‘ghub-request’’s documentation above for information about the - other arguments. - - -File: ghub.info, Node: Non-Github Convenience Wrappers, Prev: Github Convenience Wrappers, Up: API - -3.5 Non-Github Convenience Wrappers -=================================== - -‘ghub-request’ and ‘ghub-METHOD’ can be used to make a request for any -of the supported forge types, but except when making a request for a -‘github’ instance, then that requires the use of the FORGE argument. - - To avoid that, functions named ‘FORGE-request’ and ‘FORGE-METHOD’ are -also available. The following forms are equivalent, for example: - - (ghub-get ... :auth 'PACKAGE :forge 'gitlab) - (glab-get ... :auth 'PACKAGE) - - These forms would remain equivalent even if you did not specify a -value for the AUTH arguments — but you should not do that if you plan to -share your code with others (see *note Using Ghub in Your Own -Package::). If you do omit AUTH, then the request is made on behalf of -the ‘ghub’ package, *regardless* of the symbol prefix of the function -you use to do so. - - All ‘FORGE-request’ and ‘FORGE-METHOD’ functions, including but not -limited to ‘ghub-METHOD’, are very simple wrappers around -‘ghub-request’. They take fewer arguments than ‘ghub-request’ and -instead pass constant values for the arguments METHOD and/or FORGE. - - -- Function: buck-request resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-request resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-request resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - Wrappers around ‘ghub-request’ which hardcode the FORGE to either - ‘bitbucket’, ‘gitlab’, ‘gogs’ or ‘gitea’. - - -- Function: buck-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: buck-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: buck-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: buck-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-head resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: glab-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gogs-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-get resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-put resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-post resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-patch resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - -- Function: gtea-delete resource &optional params &key query payload - headers unpaginate noerror reader username auth host callback - errorback - Wrappers around ‘FORGE-METHOD’ which hardcode the FORGE to either - ‘bitbucket’, ‘gitlab’, ‘gogs’ or ‘gitea’, and the METHOD to the - implied method. - - Note that ‘buck-head’, ‘buck-patch’, ‘gogs-head’ and ‘gtea-head’ do - not exist because the respective APIs do not appear to support - these methods. - - -File: ghub.info, Node: Notes, Next: Function Index, Prev: API, Up: Top - -4 Notes -******* - -* Menu: - -* Using Ghub in Personal Scripts:: -* Using Ghub in Your Own Package:: -* Forge Limitations and Notes:: - - -File: ghub.info, Node: Using Ghub in Personal Scripts, Next: Using Ghub in Your Own Package, Up: Notes - -4.1 Using Ghub in Personal Scripts -================================== - -You can of course use ‘ghub-request’ and its wrapper functions in your -personal scripts. Unlike when you use Ghub in a package that you -distribute for others to use, you don’t have to explicitly specify a -package in personal scripts. - - ;; This is perfectly acceptable in personal scripts ... - (ghub-get "/user") - - ;; ... and actually equals to - (ghub-get "/user" nil :auth 'ghub) - - ;; In packages you have to specify the package using AUTH. - (ghub-get "/user" nil :auth 'some-package) - - When the ‘AUTH’ argument is not specified, then a request is made on -behalf of the ‘ghub’ package itself. Like for any other package you -have to create a dedicated token of coures. - - -File: ghub.info, Node: Using Ghub in Your Own Package, Next: Forge Limitations and Notes, Prev: Using Ghub in Personal Scripts, Up: Notes - -4.2 Using Ghub in Your Own Package -================================== - -Every package should use its own token. This allows you as the author -of some package to only request access to API scopes that are actually -needed, which in turn might make it easier for users to trust your -package not to do unwanted things. - - You have to tell ‘ghub-request’ on behalf of which package a request -is being made by passing the symbol ‘PACKAGE’ as the value of its ‘AUTH’ -argument. - - (ghub-request "GET" "/user" nil :auth 'PACKAGE) - - Keep in mind that the users of your package will have to manually -create a suitable token. To make that easier, you should not only link -to this manual but also prominently mention the scopes the token needs; -and explain what they are needed for. - - -File: ghub.info, Node: Forge Limitations and Notes, Prev: Using Ghub in Your Own Package, Up: Notes - -4.3 Forge Limitations and Notes -=============================== - - • There are no default Gitea and Gogs instances so the variables - ‘gitea.host’ and ‘gogs.host’ are not taken into account. - - • Gitea and Gogs do not support limiting a token to certain scopes. - - • The Bitbucket API is fairly broken and my willingness to deal with - that is extremely limited unless someone pays me vast amounts of - money. - - • The Gitlab API documentation is not always accurate, though I don’t - have an example at hand. It also isn’t structured well, making it - occasionally difficult to find the information one is looking for. - - • Where one would use ‘user/repo’ when accessing another forge, one - has to use ‘user%2Frepo’ when accessing Gitlab, e.g.: - - (glab-get "/projects/python-mode-devs%2Fpython-mode") - - -File: ghub.info, Node: Function Index, Next: Variable Index, Prev: Notes, Up: Top - -Appendix A Function Index -************************* - -[index] -* Menu: - -* buck-delete: Non-Github Convenience Wrappers. - (line 49) -* buck-get: Non-Github Convenience Wrappers. - (line 40) -* buck-post: Non-Github Convenience Wrappers. - (line 46) -* buck-put: Non-Github Convenience Wrappers. - (line 43) -* buck-request: Non-Github Convenience Wrappers. - (line 28) -* ghub--graphql-vacuum: Making GraphQL Requests. - (line 56) -* ghub-continue: Making REST Requests. - (line 125) -* ghub-delete: Github Convenience Wrappers. - (line 31) -* ghub-fetch-issue: Making GraphQL Requests. - (line 105) -* ghub-fetch-pullreq: Making GraphQL Requests. - (line 111) -* ghub-fetch-repository: Making GraphQL Requests. - (line 99) -* ghub-get: Github Convenience Wrappers. - (line 9) -* ghub-graphql: Making GraphQL Requests. - (line 6) -* ghub-head: Github Convenience Wrappers. - (line 6) -* ghub-patch: Github Convenience Wrappers. - (line 28) -* ghub-post: Github Convenience Wrappers. - (line 25) -* ghub-put: Github Convenience Wrappers. - (line 22) -* ghub-request: Making REST Requests. - (line 6) -* ghub-response-link-relations: Making REST Requests. - (line 174) -* ghub-wait: Github Convenience Wrappers. - (line 44) -* glab-delete: Non-Github Convenience Wrappers. - (line 67) -* glab-get: Non-Github Convenience Wrappers. - (line 55) -* glab-head: Non-Github Convenience Wrappers. - (line 52) -* glab-patch: Non-Github Convenience Wrappers. - (line 64) -* glab-post: Non-Github Convenience Wrappers. - (line 61) -* glab-put: Non-Github Convenience Wrappers. - (line 58) -* glab-request: Non-Github Convenience Wrappers. - (line 31) -* gogs-delete: Non-Github Convenience Wrappers. - (line 82) -* gogs-get: Non-Github Convenience Wrappers. - (line 70) -* gogs-patch: Non-Github Convenience Wrappers. - (line 79) -* gogs-post: Non-Github Convenience Wrappers. - (line 76) -* gogs-put: Non-Github Convenience Wrappers. - (line 73) -* gogs-request: Non-Github Convenience Wrappers. - (line 34) -* gtea-delete: Non-Github Convenience Wrappers. - (line 97) -* gtea-get: Non-Github Convenience Wrappers. - (line 85) -* gtea-patch: Non-Github Convenience Wrappers. - (line 94) -* gtea-post: Non-Github Convenience Wrappers. - (line 91) -* gtea-put: Non-Github Convenience Wrappers. - (line 88) - - -File: ghub.info, Node: Variable Index, Prev: Function Index, Up: Top - -Appendix B Variable Index -************************* - -[index] -* Menu: - -* ghub-response-headers: Making REST Requests. - (line 165) -* github.host: Github Configuration Variables. - (line 26) -* github.HOST.user: Github Configuration Variables. - (line 17) -* github.user: Github Configuration Variables. - (line 11) - - - -Tag Table: -Node: Top754 -Node: Introduction2278 -Node: Getting Started2683 -Node: Basic Concepts Arguments and Variables4365 -Node: Setting the Username8219 -Ref: Setting your Githubcom Username8703 -Ref: Setting your Gitlabcom Username9059 -Ref: Setting your Github Enterprise Username9525 -Ref: Setting your Username for Other Hosts and/or Forges10258 -Node: Creating and Storing a Token11064 -Node: Creating a Token11328 -Node: Storing a Token12348 -Node: Github Configuration Variables14193 -Node: API15904 -Node: Their APIs16142 -Node: Making REST Requests16867 -Node: Making GraphQL Requests26280 -Node: Github Convenience Wrappers32963 -Node: Non-Github Convenience Wrappers36667 -Node: Notes42171 -Node: Using Ghub in Personal Scripts42378 -Node: Using Ghub in Your Own Package43269 -Node: Forge Limitations and Notes44204 -Node: Function Index45177 -Node: Variable Index50826 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/ghub-20230513.1619/glab.el b/elpa/ghub-20230513.1619/glab.el deleted file mode 100644 index 9dd2608a..00000000 --- a/elpa/ghub-20230513.1619/glab.el +++ /dev/null @@ -1,168 +0,0 @@ -;;; glab.el --- Client library for the Gitlab API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Glab is a library that provides basic support for using the Gitlab API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Glab does -;; not support the guided creation of tokens because Gitlab lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst glab-default-host "gitlab.com/api/v4" - "The default host that is used if `glab.host' is not set.") - -(cl-defun glab-head (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `HEAD' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"HEAD\" as METHOD -and `gitlab' as FORGE." - (ghub-request "HEAD" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `GET' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"GET\" as METHOD -and `gitlab' as FORGE." - (ghub-request "GET" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PUT' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PUT\" as METHOD -and `gitlab' as FORGE." - (ghub-request "PUT" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `POST' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"POST\" as METHOD -and `gitlab' as FORGE." - (ghub-request "POST" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PATCH\" as METHOD -and `gitlab' as FORGE." - (ghub-request "PATCH" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"DELETE\" as METHOD -and `gitlab' as FORGE." - (ghub-request "DELETE" resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a request for RESOURCE and return the response body. -Like calling `ghub-request' (which see) with `gitlab' as FORGE." - (ghub-request method resource params :forge 'gitlab - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun glab-graphql (graphql &optional variables - &key username auth host - headers silent - callback errorback value extra) - "Make a GraphQL request using GRAPHQL and VARIABLES. -Like calling `ghub-graphql' (which see) with `gitlab' as FORGE." - (ghub-graphql graphql variables :forge 'gitlab - :username username :auth auth :host host - :headers headers :silent silent - :callback callback :errorback errorback - :value value :extra extra)) - -(cl-defun glab-repository-id (owner name &key username auth host) - "Return the id of the repository specified by OWNER, NAME and HOST." - (number-to-string - (cdr (assq 'id (glab-get (format "/projects/%s%%2F%s" - (string-replace "/" "%2F" owner) - name) - nil :username username :auth auth :host host))))) - -;;; _ -(provide 'glab) -;;; glab.el ends here diff --git a/elpa/ghub-20230513.1619/gogs.el b/elpa/ghub-20230513.1619/gogs.el deleted file mode 100644 index f191ea93..00000000 --- a/elpa/ghub-20230513.1619/gogs.el +++ /dev/null @@ -1,141 +0,0 @@ -;;; gogs.el --- Client library for the Gogs API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Gogs is a library that provides basic support for using the Gogs API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Gogs does -;; not support the guided creation of tokens because Gogs lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst gogs-default-host "localhost:3000/api/v1" - "The default Gogs host.") - -;; HEAD does not appear to be supported. - -(cl-defun gogs-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `GET' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"GET\" as METHOD -and `gogs' as FORGE." - (ghub-request "GET" resource params :forge 'gogs - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PUT' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PUT\" as METHOD -and `gogs' as FORGE." - (ghub-request "PUT" resource params :forge 'gogs - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `POST' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"POST\" as METHOD -and `gogs' as FORGE." - (ghub-request "POST" resource params :forge 'gogs - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PATCH\" as METHOD -and `gogs' as FORGE." - (ghub-request "PATCH" resource params :forge 'gogs - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"DELETE\" as METHOD -and `gogs' as FORGE." - (ghub-request "DELETE" resource params :forge 'gogs - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a request for RESOURCE and return the response body. -Like calling `ghub-request' (which see) with `gogs' as FORGE." - (ghub-request method resource params :forge 'gogs - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gogs-repository-id (owner name &key username auth host) - "Return the id of the repository specified by OWNER, NAME and HOST." - (number-to-string - (cdr (assq 'id (gogs-get (format "/repos/%s/%s" owner name) - nil :username username :auth auth :host host))))) - -;;; _ -(provide 'gogs) -;;; gogs.el ends here diff --git a/elpa/ghub-20230513.1619/gsexp.el b/elpa/ghub-20230513.1619/gsexp.el deleted file mode 100644 index 4e578550..00000000 --- a/elpa/ghub-20230513.1619/gsexp.el +++ /dev/null @@ -1,102 +0,0 @@ -;;; gsexp.el --- GraphQl as S-expressions -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; This library encodes S-expressions as GraphQl documents. Currently -;; it is rather incomplete and only intended for use by `ghub-graphql' -;; but I might fill the gaps and add documentation eventually. I am -;; not in a hurry though. - -;;; Code: - -(require 'cl-lib) - -(defvar gsexp-one-variable-per-line nil) - -(defun gsexp-encode (document) - (gsexp--pp (gsexp--encode-field document))) - -(defun gsexp--encode-field (field) - (cond - ((stringp field) - field) - ((symbolp field) - (symbol-name field)) - ((listp (car field)) - (concat (format "%s: " (caar field)) - (gsexp--encode-field (cons (car (cdar field)) - (cdr field))))) - ((concat - (pcase (pop field) - (`[] "") - ((and (pred symbolp) op) (symbol-name op)) - (`[,op] (symbol-name op)) - (`[,op ,name] (format "%s %s" op name))) - (and (vectorp (car field)) - (format " (%s%s)" - (if gsexp-one-variable-per-line "\n" "") - (mapconcat #'gsexp--encode-argument - (append (pop field) nil) - (if gsexp-one-variable-per-line ",\n" ",")))) - (and field - (format " {\n%s\n}" - (mapconcat #'gsexp--encode-field field "\n"))))))) - -(cl-defun gsexp--encode-argument ((argument value)) - (format "%s: %s" argument (gsexp--encode-value value))) - -(defun gsexp--encode-value (value) - (cond - ((numberp value) - (number-to-string value)) - ((symbolp value) ; including variables, enums, booleans and null - (symbol-name value)) - ((stringp value) - (prin1-to-string value)) - ((vectorp value) - (format "(%s)" (mapconcat #'gsexp--encode-value value ""))) - ((listp value) - (format "{%s}" (mapconcat - (pcase-lambda (`(,name ,value)) - (format "%s: %s" name (gsexp--encode-value value))) - value ", "))) - ((error "Invalid field value: %S" value)))) - -(defun gsexp--pp (string) - (with-temp-buffer - (save-excursion - (insert string)) - (while (< (point) (point-max)) - (unless (and (bolp) (eolp)) - (save-excursion - (let ((level (car (syntax-ppss (line-beginning-position))))) - (when (looking-at "\\s-*\\s)") - (cl-decf level)) - (indent-line-to (* 2 level))))) - (forward-line 1)) - (buffer-string))) - -;;; _ -(provide 'gsexp) -;;; gsexp.el ends here diff --git a/elpa/ghub-20230513.1619/gtea.el b/elpa/ghub-20230513.1619/gtea.el deleted file mode 100644 index 267a0b46..00000000 --- a/elpa/ghub-20230513.1619/gtea.el +++ /dev/null @@ -1,141 +0,0 @@ -;;; gtea.el --- Client library for the Gitea API -*- lexical-binding:t -*- - -;; Copyright (C) 2016-2023 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/ghub -;; Keywords: tools - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Gtea is a library that provides basic support for using the Gitea API -;; from Emacs packages. It abstracts access to API resources using only -;; a handful of functions that are not resource-specific. - -;; This library is implemented on top of Ghub. Unlike Ghub, Gtea does -;; not support the guided creation of tokens because Gitea lacks the -;; features that would be necessary to implement that. Users have to -;; create tokens through the web interface. - -;;; Code: - -(require 'ghub) - -(defconst gtea-default-host "localhost:3000/api/v1" - "The default Gitea host.") - -;; HEAD does not appear to be supported. - -(cl-defun gtea-get (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `GET' request for RESOURCE, with optional query PARAMS. -Like calling `ghub-request' (which see) with \"GET\" as METHOD -and `gitea' as FORGE." - (ghub-request "GET" resource params :forge 'gitea - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-put (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PUT' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PUT\" as METHOD -and `gitea' as FORGE." - (ghub-request "PUT" resource params :forge 'gitea - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-post (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `POST' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"POST\" as METHOD -and `gitea' as FORGE." - (ghub-request "POST" resource params :forge 'gitea - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-patch (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"PATCH\" as METHOD -and `gitea' as FORGE." - (ghub-request "PATCH" resource params :forge 'gitea - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-delete (resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. -Like calling `ghub-request' (which see) with \"DELETE\" as METHOD -and `gitea' as FORGE." - (ghub-request "DELETE" resource params :forge 'gitea - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-request (method resource &optional params - &key query payload headers - silent unpaginate noerror reader - username auth host - callback errorback extra) - "Make a request for RESOURCE and return the response body. -Like calling `ghub-request' (which see) with `gitea' as FORGE." - (ghub-request method resource params :forge 'gitea - :query query :payload payload :headers headers - :silent silent :unpaginate unpaginate - :noerror noerror :reader reader - :username username :auth auth :host host - :callback callback :errorback errorback :extra extra)) - -(cl-defun gtea-repository-id (owner name &key username auth host) - "Return the id of the repository specified by OWNER, NAME and HOST." - (number-to-string - (cdr (assq 'id (gtea-get (format "/repos/%s/%s" owner name) - nil :username username :auth auth :host host))))) - -;;; _ -(provide 'gtea) -;;; gtea.el ends here diff --git a/elpa/git-commit-20231204.1839/git-commit-pkg.el b/elpa/git-commit-20231204.1839/git-commit-pkg.el deleted file mode 100644 index 30208a45..00000000 --- a/elpa/git-commit-20231204.1839/git-commit-pkg.el +++ /dev/null @@ -1,18 +0,0 @@ -(define-package "git-commit" "20231204.1839" "Edit Git commit messages." - '((emacs "25.1") - (compat "29.1.4.4") - (transient "20231204") - (with-editor "20230917")) - :commit "51fc450b6eb440381708bdfcade351c9efc31f2d" :authors - '(("Jonas Bernoulli" . "jonas@bernoul.li") - ("Sebastian Wiesner" . "lunaryorn@gmail.com") - ("Florian Ragwitz" . "rafl@debian.org") - ("Marius Vollmer" . "marius.vollmer@gmail.com")) - :maintainer - '("Jonas Bernoulli" . "jonas@bernoul.li") - :keywords - '("git" "tools" "vc") - :url "https://github.com/magit/magit") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/git-commit-20231204.1839/git-commit-autoloads.el b/elpa/git-commit-20240520.1135/git-commit-autoloads.el similarity index 100% rename from elpa/git-commit-20231204.1839/git-commit-autoloads.el rename to elpa/git-commit-20240520.1135/git-commit-autoloads.el diff --git a/elpa/git-commit-20240520.1135/git-commit-pkg.el b/elpa/git-commit-20240520.1135/git-commit-pkg.el new file mode 100644 index 00000000..81480580 --- /dev/null +++ b/elpa/git-commit-20240520.1135/git-commit-pkg.el @@ -0,0 +1,18 @@ +(define-package "git-commit" "20240520.1135" "Edit Git commit messages." + '((emacs "26.1") + (compat "29.1.4.5") + (transient "20240421") + (with-editor "20240415")) + :commit "22fd8f8594202a0679ccc2f7d02bca44d48b8039" :authors + '(("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev") + ("Sebastian Wiesner" . "lunaryorn@gmail.com") + ("Florian Ragwitz" . "rafl@debian.org") + ("Marius Vollmer" . "marius.vollmer@gmail.com")) + :maintainer + '("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev") + :keywords + '("git" "tools" "vc") + :url "https://github.com/magit/magit") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/git-commit-20231204.1839/git-commit.el b/elpa/git-commit-20240520.1135/git-commit.el similarity index 89% rename from elpa/git-commit-20231204.1839/git-commit.el rename to elpa/git-commit-20240520.1135/git-commit.el index 5b94a84a..717ea7bb 100644 --- a/elpa/git-commit-20231204.1839/git-commit.el +++ b/elpa/git-commit-20240520.1135/git-commit.el @@ -1,22 +1,22 @@ ;;; git-commit.el --- Edit Git commit messages -*- lexical-binding:t; coding:utf-8 -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli +;; Author: Jonas Bernoulli ;; Sebastian Wiesner ;; Florian Ragwitz ;; Marius Vollmer -;; Maintainer: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; Homepage: https://github.com/magit/magit ;; Keywords: git tools vc ;; Package-Version: 3.3.0.50-git ;; Package-Requires: ( -;; (emacs "25.1") -;; (compat "29.1.4.4") +;; (emacs "26.1") +;; (compat "29.1.4.5") ;; (seq "2.24") -;; (transient "0.5.0") +;; (transient "0.6.0") ;; (with-editor "3.3.2")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -114,7 +114,7 @@ (require 'compat) (require 'subr-x) -(when (and (featurep' seq) +(when (and (featurep 'seq) (not (fboundp 'seq-keep))) (unload-feature 'seq 'force)) (require 'seq) @@ -142,6 +142,13 @@ (defvar font-lock-end) (defvar recentf-exclude) +(defvar git-commit-need-summary-line) + +(define-obsolete-variable-alias + 'git-commit-known-pseudo-headers + 'git-commit-trailers + "git-commit 4.0.0") + ;;; Options ;;;; Variables @@ -170,13 +177,22 @@ full loading." :type 'boolean :global t :init-value t - :initialize (lambda (symbol exp) - (custom-initialize-default symbol exp) - (when global-git-commit-mode - (add-hook 'find-file-hook #'git-commit-setup-check-buffer))) - (if global-git-commit-mode - (add-hook 'find-file-hook #'git-commit-setup-check-buffer) - (remove-hook 'find-file-hook #'git-commit-setup-check-buffer))) + :initialize + (lambda (symbol exp) + (custom-initialize-default symbol exp) + (when global-git-commit-mode + (add-hook 'find-file-hook #'git-commit-setup-check-buffer) + (remove-hook 'after-change-major-mode-hook + #'git-commit-setup-font-lock-in-buffer))) + (cond + (global-git-commit-mode + (add-hook 'find-file-hook #'git-commit-setup-check-buffer) + (add-hook 'after-change-major-mode-hook + #'git-commit-setup-font-lock-in-buffer)) + (t + (remove-hook 'find-file-hook #'git-commit-setup-check-buffer) + (remove-hook 'after-change-major-mode-hook + #'git-commit-setup-font-lock-in-buffer)))) (defcustom git-commit-major-mode #'text-mode "Major mode used to edit Git commit messages. @@ -199,8 +215,13 @@ The major mode configured here is turned on by the minor mode ;;;###autoload fundamental-mode ;;;###autoload git-commit-elisp-text-mode)))) +(defvaralias 'git-commit-mode-hook 'git-commit-setup-hook + "This variable is an alias for `git-commit-setup-hook' (which see). +Also note that `git-commit-mode' (which see) is not a major-mode.") + (defcustom git-commit-setup-hook - '(git-commit-save-message + '(git-commit-ensure-comment-gap + git-commit-save-message git-commit-setup-changelog-support git-commit-turn-on-auto-fill git-commit-propertize-diff @@ -209,7 +230,8 @@ The major mode configured here is turned on by the minor mode :group 'git-commit :type 'hook :get (and (featurep 'magit-base) #'magit-hook-custom-get) - :options '(git-commit-save-message + :options '(git-commit-ensure-comment-gap + git-commit-save-message git-commit-setup-changelog-support magit-generate-changelog git-commit-turn-on-auto-fill @@ -320,6 +342,26 @@ no effect." :safe 'booleanp :type 'boolean) +(defcustom git-commit-cd-to-toplevel nil + "Whether to set `default-directory' to the worktree in message buffer. + +Editing a commit message is done by visiting a file located in the git +directory, usually \"COMMIT_EDITMSG\". As is done when visiting any +file, the local value of `default-directory' is set to the directory +that contains the file. + +If this option is non-nil, then the local `default-directory' is changed +to the working tree from which the commit command was invoked. You may +wish to do that, to make it easier to open a file that is located in the +working tree, directly from the commit message buffer. + +If the git variable `safe.bareRepository' is set to \"explicit\", then +you have to enable this, to be able to commit at all. See issue #5100. + +This option only has an effect if the commit was initiated from Magit." + :group 'git-commit + :type 'boolean) + ;;;; Faces (defgroup git-commit-faces nil @@ -472,8 +514,6 @@ the redundant bindings, then set this to nil, before loading (string-match-p git-commit-filename-regexp buffer-file-name)) (git-commit-setup-font-lock))) -(add-hook 'after-change-major-mode-hook #'git-commit-setup-font-lock-in-buffer) - (defun git-commit-setup-check-buffer () (when (and buffer-file-name (string-match-p git-commit-filename-regexp buffer-file-name)) @@ -534,27 +574,36 @@ Used as the local value of `header-line-format', in buffer using (setq git-commit-usage-message nil) ; show a shorter message") (defun git-commit-setup () - (when (fboundp 'magit-toplevel) - ;; `magit-toplevel' is autoloaded and defined in magit-git.el, - ;; That library declares this functions without loading - ;; magit-process.el, which defines it. - (require 'magit-process nil t)) - ;; Pretend that git-commit-mode is a major-mode, - ;; so that directory-local settings can be used. - (let ((default-directory - (or (and (not (file-exists-p ".dir-locals.el")) - ;; When $GIT_DIR/.dir-locals.el doesn't exist, - ;; fallback to $GIT_WORK_TREE/.dir-locals.el, - ;; because the maintainer can use the latter - ;; to enforce conventions, while s/he has no - ;; control over the former. - (fboundp 'magit-toplevel) ; silence byte-compiler - (magit-toplevel)) - default-directory))) - (let ((buffer-file-name nil) ; trick hack-dir-local-variables - (major-mode 'git-commit-mode)) ; trick dir-locals-collect-variables - (hack-dir-local-variables) - (hack-local-variables-apply))) + (let ((gitdir default-directory) + (cd nil)) + (when (and (fboundp 'magit-toplevel) + (boundp 'magit--separated-gitdirs)) + ;; `magit-toplevel' is autoloaded and defined in magit-git.el. That + ;; library declares this function without loading magit-process.el, + ;; which defines it. + (require 'magit-process nil t) + (when git-commit-cd-to-toplevel + (setq cd (or (car (rassoc default-directory magit--separated-gitdirs)) + (magit-toplevel))))) + ;; Pretend that git-commit-mode is a major-mode, + ;; so that directory-local settings can be used. + (let ((default-directory + (or (and (not (file-exists-p + (expand-file-name ".dir-locals.el" gitdir))) + ;; When $GIT_DIR/.dir-locals.el doesn't exist, + ;; fallback to $GIT_WORK_TREE/.dir-locals.el, + ;; because the maintainer can use the latter + ;; to enforce conventions, while s/he has no + ;; control over the former. + (fboundp 'magit-toplevel) + (or cd (magit-toplevel))) + gitdir))) + (let ((buffer-file-name nil) ; trick hack-dir-local-variables + (major-mode 'git-commit-mode)) ; trick dir-locals-collect-variables + (hack-dir-local-variables) + (hack-local-variables-apply))) + (when cd + (setq default-directory cd))) (when git-commit-major-mode (let ((auto-mode-alist ;; `set-auto-mode--apply-alist' removes the remote part from @@ -603,24 +652,21 @@ Used as the local value of `header-line-format', in buffer using (magit-wip-maybe-add-commit-hook))) (setq with-editor-cancel-message #'git-commit-cancel-message) - (git-commit-mode 1) (git-commit-setup-font-lock) (git-commit-prepare-message-ring) (when (boundp 'save-place) (setq save-place nil)) - (save-excursion - (goto-char (point-min)) - (when (looking-at "\\`\\(\\'\\|\n[^\n]\\)") - (open-line 1))) + (let ((git-commit-mode-hook nil)) + (git-commit-mode 1)) (with-demoted-errors "Error running git-commit-setup-hook: %S" (run-hooks 'git-commit-setup-hook)) - (when git-commit-usage-message - (setq with-editor-usage-message git-commit-usage-message)) - (with-editor-usage-message) + (set-buffer-modified-p nil) (when-let ((format git-commit-header-line-format)) (setq header-line-format (if (stringp format) (substitute-command-keys format) format))) - (set-buffer-modified-p nil)) + (when git-commit-usage-message + (setq with-editor-usage-message git-commit-usage-message)) + (with-editor-usage-message)) (defun git-commit-run-post-finish-hook (previous) (when (and git-commit-post-finish-hook @@ -641,11 +687,23 @@ Used as the local value of `header-line-format', in buffer using (define-minor-mode git-commit-mode "Auxiliary minor mode used when editing Git commit messages. This mode is only responsible for setting up some key bindings. -Don't use it directly, instead enable `global-git-commit-mode'." +Don't use it directly; instead enable `global-git-commit-mode'. +Variable `git-commit-major-mode' controls which major-mode is +used." :lighter "") (put 'git-commit-mode 'permanent-local t) +(defun git-commit-ensure-comment-gap () + "Separate initial empty line from initial comment. +If the buffer begins with an empty line followed by a comment, insert +an additional newline inbetween, so that once the users start typing, +the input isn't tacked to the comment." + (save-excursion + (goto-char (point-min)) + (when (looking-at (format "\\`\n%s" comment-start)) + (open-line 1)))) + (defun git-commit-setup-changelog-support () "Treat ChangeLog entries as unindented paragraphs." (when (fboundp 'log-indent-fill-entry) ; New in Emacs 27. @@ -654,9 +712,16 @@ Don't use it directly, instead enable `global-git-commit-mode'." (setq-local paragraph-start (concat paragraph-start "\\|\\*\\|("))) (defun git-commit-turn-on-auto-fill () - "Unconditionally turn on Auto Fill mode." + "Unconditionally turn on Auto Fill mode. +Ensure auto filling happens everywhere, except in the summary line." + (turn-on-auto-fill) (setq-local comment-auto-fill-only-comments nil) - (turn-on-auto-fill)) + (when git-commit-need-summary-line + (setq-local auto-fill-function #'git-commit-auto-fill-except-summary))) + +(defun git-commit-auto-fill-except-summary () + (unless (eq (line-beginning-position) 1) + (do-auto-fill))) (defun git-commit-turn-on-orglink () "Turn on Orglink mode if it is available. @@ -670,16 +735,21 @@ turning on `orglink-mode'." (defun git-commit-turn-on-flyspell () "Unconditionally turn on Flyspell mode. -Also prevent comments from being checked and -finally check current non-comment text." +Also check text that is already in the buffer, while avoiding to check +most text that Git will strip from the final message, such as the last +comment and anything below the cut line (\"--- >8 ---\")." (require 'flyspell) (turn-on-flyspell) (setq flyspell-generic-check-word-predicate #'git-commit-flyspell-verify) - (let ((end) + (let ((end nil) + ;; The "cut line" is defined in "git/wt-status.c". It appears + ;; in the commit message when `commit.verbose' is set to true. + (cut-line-regex (format "^%s -\\{8,\\} >8 -\\{8,\\}$" comment-start)) (comment-start-regex (format "^\\(%s\\|$\\)" comment-start))) (save-excursion - (goto-char (point-max)) + (goto-char (or (re-search-forward cut-line-regex nil t) + (point-max))) (while (and (not (bobp)) (looking-at comment-start-regex)) (forward-line -1)) (unless (looking-at comment-start-regex) @@ -762,9 +832,8 @@ With a numeric prefix ARG, go forward ARG comments." "Search backward through message history for a match for STRING. Save current message first." (interactive - ;; Avoid `format-prompt' because it isn't available until Emacs 28. - (list (read-string (format "Comment substring (default %s): " - log-edit-last-comment-match) + (list (read-string (format-prompt "Comment substring" + log-edit-last-comment-match) nil nil log-edit-last-comment-match))) (cl-letf (((symbol-function #'log-edit-previous-comment) (symbol-function #'git-commit-prev-message))) @@ -774,9 +843,8 @@ Save current message first." "Search forward through message history for a match for STRING. Save current message first." (interactive - ;; Avoid `format-prompt' because it isn't available until Emacs 28. - (list (read-string (format "Comment substring (default %s): " - log-edit-last-comment-match) + (list (read-string (format-prompt "Comment substring" + log-edit-last-comment-match) nil nil log-edit-last-comment-match))) (cl-letf (((symbol-function #'log-edit-previous-comment) (symbol-function #'git-commit-prev-message))) @@ -1197,8 +1265,8 @@ Added to `font-lock-extend-region-functions'." (font-lock-ensure) (with-no-warnings (font-lock-fontify-buffer)))) - (let (next (pos (point-min))) - (while (setq next (next-single-property-change pos 'face)) + (let ((pos (point-min))) + (while-let ((next (next-single-property-change pos 'face))) (put-text-property pos next 'font-lock-face (get-text-property pos 'face)) (setq pos next)) @@ -1231,10 +1299,6 @@ Elisp doc-strings, including this one. Unlike in doc-strings, 'git-commit-insert-header 'git-commit--insert-ident-trailer "git-commit 4.0.0") -(define-obsolete-variable-alias - 'git-commit-known-pseudo-headers - 'git-commit-trailer - "git-commit 4.0.0") (define-obsolete-face-alias 'git-commit-pseudo-header 'git-commit-trailer-value diff --git a/elpa/git-commit-readme.txt b/elpa/git-commit-readme.txt deleted file mode 100644 index a8c2f7a6..00000000 --- a/elpa/git-commit-readme.txt +++ /dev/null @@ -1,76 +0,0 @@ -This package assists the user in writing good Git commit messages. - -While Git allows for the message to be provided on the command -line, it is preferable to tell Git to create the commit without -actually passing it a message. Git then invokes the `$GIT_EDITOR' -(or if that is undefined `$EDITOR') asking the user to provide the -message by editing the file ".git/COMMIT_EDITMSG" (or another file -in that directory, e.g. ".git/MERGE_MSG" for merge commits). - -When `global-git-commit-mode' is enabled, which it is by default, -then opening such a file causes the features described below, to -be enabled in that buffer. Normally this would be done using a -major-mode but to allow the use of any major-mode, as the user sees -fit, it is done here by running a setup function, which among other -things turns on the preferred major-mode, by default `text-mode'. - -Git waits for the `$EDITOR' to finish and then either creates the -commit using the contents of the file as commit message, or, if the -editor process exited with a non-zero exit status, aborts without -creating a commit. Unfortunately Emacsclient (which is what Emacs -users should be using as `$EDITOR' or at least as `$GIT_EDITOR') -does not differentiate between "successfully" editing a file and -aborting; not out of the box that is. - -By making use of the `with-editor' package this package provides -both ways of finish an editing session. In either case the file -is saved, but Emacseditor's exit code differs. - - C-c C-c Finish the editing session successfully by returning - with exit code 0. Git then creates the commit using - the message it finds in the file. - - C-c C-k Aborts the edit editing session by returning with exit - code 1. Git then aborts the commit. - -Aborting the commit does not cause the message to be lost, but -relying solely on the file not being tampered with is risky. This -package additionally stores all aborted messages for the duration -of the current session (i.e. until you close Emacs). To get back -an aborted message use M-p and M-n while editing a message. - - M-p Replace the buffer contents with the previous message - from the message ring. Of course only after storing - the current content there too. - - M-n Replace the buffer contents with the next message from - the message ring, after storing the current content. - -Some support for pseudo headers as used in some projects is -provided by these commands: - - C-c C-s Insert a Signed-off-by header. - C-c C-a Insert a Acked-by header. - C-c C-m Insert a Modified-by header. - C-c C-t Insert a Tested-by header. - C-c C-r Insert a Reviewed-by header. - C-c C-o Insert a Cc header. - C-c C-p Insert a Reported-by header. - C-c C-i Insert a Suggested-by header. - -When Git requests a commit message from the user, it does so by -having her edit a file which initially contains some comments, -instructing her what to do, and providing useful information, such -as which files were modified. These comments, even when left -intact by the user, do not become part of the commit message. This -package ensures these comments are propertizes as such and further -prettifies them by using different faces for various parts, such as -files. - -Finally this package highlights style errors, like lines that are -too long, or when the second line is not empty. It may even nag -you when you attempt to finish the commit without having fixed -these issues. The style checks and many other settings can easily -be configured: - - M-x customize-group RET git-commit RET diff --git a/elpa/magit-20231219.2243/magit-pkg.el b/elpa/magit-20231219.2243/magit-pkg.el deleted file mode 100644 index 14bd5c84..00000000 --- a/elpa/magit-20231219.2243/magit-pkg.el +++ /dev/null @@ -1,20 +0,0 @@ -(define-package "magit" "20231219.2243" "A Git porcelain inside Emacs." - '((emacs "25.1") - (compat "29.1.4.4") - (dash "20221013") - (git-commit "20231030") - (magit-section "20231202") - (seq "2.24") - (transient "20231204") - (with-editor "20230917")) - :commit "c7ab6931c61e63db02edd2f9ad3688312936cf0b" :authors - '(("Marius Vollmer" . "marius.vollmer@gmail.com") - ("Jonas Bernoulli" . "jonas@bernoul.li")) - :maintainer - '("Jonas Bernoulli" . "jonas@bernoul.li") - :keywords - '("git" "tools" "vc") - :url "https://github.com/magit/magit") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-20231219.2243/AUTHORS.md b/elpa/magit-20240522.204/AUTHORS.md similarity index 99% rename from elpa/magit-20231219.2243/AUTHORS.md rename to elpa/magit-20240522.204/AUTHORS.md index 08210d8a..ed39a9c9 100644 --- a/elpa/magit-20231219.2243/AUTHORS.md +++ b/elpa/magit-20240522.204/AUTHORS.md @@ -232,6 +232,7 @@ All Contributors - Louis Roché - Luís Oliveira - Luke Amdor +- Magnar Sveen - Magnus Malm - Mak Kolybabi - Manuel Vázquez Acosta @@ -286,6 +287,7 @@ All Contributors - Orivej Desh - Óscar Fuentes - Pancho Horrillo +- Paul Pogonyshev - Paul Stadig - Pavel Holejsovsky - Pekka Pessi diff --git a/elpa/magit-20231219.2243/LICENSE b/elpa/magit-20240522.204/LICENSE similarity index 100% rename from elpa/magit-20231219.2243/LICENSE rename to elpa/magit-20240522.204/LICENSE diff --git a/elpa/magit-20231219.2243/dir b/elpa/magit-20240522.204/dir similarity index 100% rename from elpa/magit-20231219.2243/dir rename to elpa/magit-20240522.204/dir diff --git a/elpa/magit-20231219.2243/git-rebase.el b/elpa/magit-20240522.204/git-rebase.el similarity index 99% rename from elpa/magit-20231219.2243/git-rebase.el rename to elpa/magit-20240522.204/git-rebase.el index 2a0fbb3d..92a4b433 100644 --- a/elpa/magit-20231219.2243/git-rebase.el +++ b/elpa/magit-20240522.204/git-rebase.el @@ -1,9 +1,9 @@ ;;; git-rebase.el --- Edit Git rebase files -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors ;; Author: Phil Jackson -;; Maintainer: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -718,8 +718,10 @@ running \"man git-rebase\" at the command line) for details." (when git-rebase-confirm-cancel (add-hook 'with-editor-cancel-query-functions #'git-rebase-cancel-confirm nil t)) - (setq-local redisplay-highlight-region-function #'git-rebase-highlight-region) - (setq-local redisplay-unhighlight-region-function #'git-rebase-unhighlight-region) + (setq-local redisplay-highlight-region-function + #'git-rebase-highlight-region) + (setq-local redisplay-unhighlight-region-function + #'git-rebase-unhighlight-region) (add-hook 'with-editor-pre-cancel-hook #'git-rebase-autostash-save nil t) (add-hook 'with-editor-post-cancel-hook #'git-rebase-autostash-apply nil t) (setq imenu-prev-index-position-function diff --git a/elpa/magit-20231219.2243/magit-apply.el b/elpa/magit-20240522.204/magit-apply.el similarity index 99% rename from elpa/magit-20231219.2243/magit-apply.el rename to elpa/magit-20240522.204/magit-apply.el index ece58385..bdac5e13 100644 --- a/elpa/magit-20231219.2243/magit-apply.el +++ b/elpa/magit-20240522.204/magit-apply.el @@ -1,9 +1,9 @@ ;;; magit-apply.el --- Apply Git diffs -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -49,11 +49,6 @@ (path &optional prefer-short)) (defvar borg-user-emacs-directory) -(cl-eval-when (compile load) - (when (< emacs-major-version 26) - (defalias 'smerge-keep-upper 'smerge-keep-mine) - (defalias 'smerge-keep-lower 'smerge-keep-other))) - ;;; Options (defcustom magit-delete-by-moving-to-trash t diff --git a/elpa/magit-20231219.2243/magit-autoloads.el b/elpa/magit-20240522.204/magit-autoloads.el similarity index 99% rename from elpa/magit-20231219.2243/magit-autoloads.el rename to elpa/magit-20240522.204/magit-autoloads.el index 30d2ee44..133be212 100644 --- a/elpa/magit-20231219.2243/magit-autoloads.el +++ b/elpa/magit-20240522.204/magit-autoloads.el @@ -515,9 +515,9 @@ Amend the last commit, without editing the message. With a prefix argument keep the committer date, otherwise change it. The option `magit-commit-extend-override-date' can be used -to inverse the meaning of the prefix argument. -(git commit ---amend --no-edit) +to inverse the meaning of the prefix argument. + +(git commit --amend --no-edit) (fn &optional ARGS OVERRIDE-DATE)" t) (autoload 'magit-commit-reword "magit-commit" "\ @@ -770,23 +770,14 @@ Run `gitk --all' in the current repository." t) (autoload 'ido-enter-magit-status "magit-extras" "\ Drop into `magit-status' from file switching. -This command does not work in Emacs 26.1. -See https://github.com/magit/magit/issues/3634 -and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31707. - To make this command available use something like: - (add-hook \\='ido-setup-hook - (lambda () - (keymap-set ido-completion-map - \"C-x g\" \\='ido-enter-magit-status))) - -Starting with Emacs 25.1 the Ido keymaps are defined just once -instead of every time Ido is invoked, so now you can modify it -like pretty much every other keymap: - (keymap-set ido-common-completion-map - \"C-x g\" \\='ido-enter-magit-status)" t) + \"C-x g\" \\='ido-enter-magit-status) + +This command does not work in Emacs 26.1. +See https://github.com/magit/magit/issues/3634 +and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31707." t) (autoload 'magit-project-status "magit-extras" "\ Run `magit-status' in the current project's root." t) (autoload 'magit-dired-jump "magit-extras" "\ diff --git a/elpa/magit-20231219.2243/magit-autorevert.el b/elpa/magit-20240522.204/magit-autorevert.el similarity index 98% rename from elpa/magit-20231219.2243/magit-autorevert.el rename to elpa/magit-20240522.204/magit-autorevert.el index 7099cd62..e6a98d45 100644 --- a/elpa/magit-20231219.2243/magit-autorevert.el +++ b/elpa/magit-20240522.204/magit-autorevert.el @@ -1,9 +1,9 @@ ;;; magit-autorevert.el --- Revert buffers when files in repository change -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-base.el b/elpa/magit-20240522.204/magit-base.el similarity index 92% rename from elpa/magit-20231219.2243/magit-base.el rename to elpa/magit-20240522.204/magit-base.el index 407652f8..2d6f7a01 100644 --- a/elpa/magit-20231219.2243/magit-base.el +++ b/elpa/magit-20240522.204/magit-base.el @@ -1,9 +1,9 @@ ;;; magit-base.el --- Early birds -*- lexical-binding:t; coding:utf-8 -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -33,7 +33,7 @@ ;;; Code: (defconst magit--minimal-git "2.2.0") -(defconst magit--minimal-emacs "25.1") +(defconst magit--minimal-emacs "26.1") (require 'cl-lib) (require 'compat) @@ -45,7 +45,7 @@ ;; GNU ELPA, for `seq-keep'. Unfortunately something else may already ;; have required `seq', before `package' had a chance to put the more ;; recent version earlier on the `load-path'. -(when (and (featurep' seq) +(when (and (featurep 'seq) (not (fboundp 'seq-keep))) (unload-feature 'seq 'force)) (require 'seq) @@ -471,36 +471,41 @@ and delay of your graphical environment or operating system." ;;; Section Classes -(defclass magit-commit-section (magit-section) ()) +(defclass magit-commit-section (magit-section) + ((keymap :initform 'magit-commit-section-map))) (setf (alist-get 'commit magit--section-type-alist) 'magit-commit-section) -(defclass magit-diff-section (magit-section) () :abstract t) +(defclass magit-diff-section (magit-section) + ((keymap :initform 'magit-diff-section-map)) + :abstract t) (defclass magit-file-section (magit-diff-section) ((keymap :initform 'magit-file-section-map) - (source :initform nil) - (header :initform nil) - (binary :initform nil))) + (source :initform nil :initarg :source) + (header :initform nil :initarg :header) + (binary :initform nil :initarg :binary))) (defclass magit-module-section (magit-file-section) ((keymap :initform 'magit-module-section-map) - (range :initform nil))) + (range :initform nil :initarg :range))) (defclass magit-hunk-section (magit-diff-section) ((keymap :initform 'magit-hunk-section-map) (refined :initform nil) - (combined :initform nil) - (from-range :initform nil) + (combined :initform nil :initarg :combined) + (from-range :initform nil :initarg :from-range) (from-ranges :initform nil) - (to-range :initform nil) - (about :initform nil))) + (to-range :initform nil :initarg :to-range) + (about :initform nil :initarg :about))) (setf (alist-get 'file magit--section-type-alist) 'magit-file-section) (setf (alist-get 'module magit--section-type-alist) 'magit-module-section) (setf (alist-get 'hunk magit--section-type-alist) 'magit-hunk-section) -(defclass magit-log-section (magit-section) () :abstract t) +(defclass magit-log-section (magit-section) + ((keymap :initform 'magit-log-section-map)) + :abstract t) (defclass magit-unpulled-section (magit-log-section) ()) (defclass magit-unpushed-section (magit-log-section) ()) (defclass magit-unmerged-section (magit-log-section) ()) @@ -515,9 +520,29 @@ and delay of your graphical environment or operating system." (defvar helm-crm-default-separator) (defvar ivy-sort-functions-alist) (defvar ivy-sort-matches-functions-alist) +(defvar vertico-sort-function) (defvar magit-completing-read--silent-default nil) +(defvar magit-completing-read-default-prompt-predicate + (lambda () + (and (eq magit-completing-read-function + 'magit-builtin-completing-read) + (not (or (bound-and-true-p helm-mode) + (bound-and-true-p ivy-mode) + (bound-and-true-p selectrum-mode) + (bound-and-true-p vertico-mode))))) + "Function used to determine whether to add default to prompt. + +This is used by `magit-completing-read' (which see). + +The default function returns nil, when a completion frameworks is used +for which this is undesirable. More precisely, it returns nil, when +`magit-completing-read-function' is not `magit-builtin-completing-read', +or one of `helm-mode', `ivy-mode', `selectrum-mode' or `vertico-mode' +is enabled. When this function returns nil, then nil is passed to +`format-prompt' (which see), instead of the default (DEF or FALLBACK).") + (defun magit-completing-read ( prompt collection &optional predicate require-match initial-input hist def fallback) @@ -557,13 +582,11 @@ acts similarly to `completing-read', except for the following: is not, then this function always asks the user to choose a candidate, just as if both defaults were nil. -- \": \" is appended to PROMPT. - -- PROMPT is modified to end with \" (default DEF|FALLBACK): \" - provided that DEF or FALLBACK is non-nil, that neither - `ivy-mode' nor `helm-mode' is enabled, and that - `magit-completing-read-function' is set to its default value of - `magit-builtin-completing-read'." +- `format-prompt' is called on PROMPT and DEF (or FALLBACK if + DEF is nil). This appends \": \" to the prompt and may also + add the default to the prompt, using the format specified by + `minibuffer-default-prompt-format' and depending on + `magit-completing-read-default-prompt-predicate'." (setq magit-completing-read--silent-default nil) (if-let ((dwim (and def (nth 2 (seq-find (pcase-lambda (`(,cmd ,re ,_)) @@ -580,13 +603,19 @@ acts similarly to `completing-read', except for the following: (unless def (setq def fallback)) (let ((command this-command) - (reply (funcall magit-completing-read-function - (concat prompt ": ") - (if (and def (not (member def collection))) - (cons def collection) - collection) - predicate - require-match initial-input hist def))) + (reply (funcall + magit-completing-read-function + (format-prompt + prompt + (and (funcall magit-completing-read-default-prompt-predicate) + def)) + (if (and (not (functionp collection)) + def + (not (member def collection))) + (cons def collection) + collection) + predicate + require-match initial-input hist def))) (setq this-command command) ;; Note: Avoid `string=' to support `helm-comp-read-use-marked'. (if (equal reply "") @@ -604,22 +633,14 @@ acts similarly to `completing-read', except for the following: (defun magit-builtin-completing-read (prompt choices &optional predicate require-match initial-input hist def) "Magit wrapper for standard `completing-read' function." - (unless (or (bound-and-true-p helm-mode) - (bound-and-true-p ivy-mode) - (bound-and-true-p vertico-mode) - (bound-and-true-p selectrum-mode)) - (setq prompt (magit-prompt-with-default prompt def))) (unless (or (bound-and-true-p helm-mode) (bound-and-true-p ivy-mode)) (setq choices (magit--completion-table choices))) - (cl-letf (((symbol-function #'completion-pcm--all-completions))) - (when (< emacs-major-version 26) - (fset 'completion-pcm--all-completions - 'magit-completion-pcm--all-completions)) - (let ((ivy-sort-functions-alist nil)) - (completing-read prompt choices - predicate require-match - initial-input hist def)))) + (let ((ivy-sort-functions-alist nil) + (vertico-sort-function nil)) + (completing-read prompt choices + predicate require-match + initial-input hist def))) (define-obsolete-function-alias 'magit-completing-read-multiple* 'magit-completing-read-multiple "Magit-Section 4.0.0") @@ -649,12 +670,6 @@ third-party completion frameworks." (equal omit-nulls t)) (setq input string)) (funcall split-string string separators omit-nulls trim))) - ;; In Emacs 25 this function has a bug, so we use a copy of the - ;; version from Emacs 26. bef9c7aa3 - ((symbol-function #'completion-pcm--all-completions) - (if (< emacs-major-version 26) - 'magit-completion-pcm--all-completions - (symbol-function #'completion-pcm--all-completions))) ;; Prevent `BUILT-IN' completion from messing up our existing ;; order of the completion candidates. aa5f098ab (table (magit--completion-table table)) @@ -694,12 +709,6 @@ back to built-in `completing-read' for now." :error) (magit-builtin-completing-read prompt choices predicate require-match initial-input hist def))) -(defun magit-prompt-with-default (prompt def) - (if (and def (length> prompt 2) - (string-equal ": " (substring prompt -2))) - (format "%s (default %s): " (substring prompt 0 -2) def) - prompt)) - (defvar-keymap magit-minibuffer-local-ns-map :parent minibuffer-local-map "SPC" #'magit-whitespace-disallowed @@ -722,7 +731,7 @@ This is similar to `read-string', but which case that is returned, * whitespace is not allowed and leading and trailing whitespace is removed automatically if NO-WHITESPACE is non-nil, -* \": \" is appended to PROMPT, and +* `format-prompt' is used internally. * an invalid DEFAULT-VALUE is silently ignored." (when default-value (when (consp default-value) @@ -731,7 +740,7 @@ This is similar to `read-string', but (setq default-value nil))) (let* ((minibuffer-completion-table nil) (val (read-from-minibuffer - (magit-prompt-with-default (concat prompt ": ") default-value) + (format-prompt prompt default-value) initial-input (and no-whitespace magit-minibuffer-local-ns-map) nil history default-value inherit-input-method)) (trim (lambda (regexp string) @@ -925,11 +934,8 @@ Unless optional argument KEEP-EMPTY-LINES is t, trim all empty lines." (split-string (buffer-string) "\n" (not keep-empty-lines))))) (defun magit-set-header-line-format (string) - "Set the header-line using STRING. -Propertize STRING with the `magit-header-line'. If the `face' -property of any part of STRING is already set, then that takes -precedence. Also pad the left side of STRING so that it aligns -with the text area." + "Set `header-line-format' in the current buffer based on STRING. +Pad the left side of STRING so that it aligns with the text area." (setq header-line-format (concat (propertize " " 'display '(space :align-to 0)) string))) @@ -1014,13 +1020,6 @@ This function should be named `version>=' and be part of Emacs." ;;; Kludges for Emacs Bugs -(defun magit-file-accessible-directory-p (filename) - "Like `file-accessible-directory-p' but work around an Apple bug. -See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21573#17 -and https://github.com/magit/magit/issues/2295." - (and (file-directory-p filename) - (file-accessible-directory-p filename))) - (when (< emacs-major-version 27) ;; Work around https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21559. ;; Fixed by cb55ccae8be946f1562d74718086a4c8c8308ee5 in Emacs 27.1. @@ -1064,27 +1063,6 @@ and https://github.com/magit/magit/issues/2295." (advice-add 'auto-revert-handler :around 'auto-revert-handler@bug21559) ) -(when (< emacs-major-version 26) - ;; In Emacs 25 `completion-pcm--all-completions' reverses the - ;; completion list. This is the version from Emacs 26, which - ;; fixes that issue. bug#24676 - (defun magit-completion-pcm--all-completions (prefix pattern table pred) - (if (completion-pcm--pattern-trivial-p pattern) - (all-completions (concat prefix (car pattern)) table pred) - (let* ((regex (completion-pcm--pattern->regex pattern)) - (case-fold-search completion-ignore-case) - (completion-regexp-list (cons regex completion-regexp-list)) - (compl (all-completions - (concat prefix - (if (stringp (car pattern)) (car pattern) "")) - table pred))) - (if (not (functionp table)) - compl - (let ((poss ())) - (dolist (c compl) - (when (string-match-p regex c) (push c poss))) - (nreverse poss))))))) - (defun magit-which-function () "Return current function name based on point. @@ -1227,6 +1205,8 @@ Magit." ,@body) ,@body))) +(put 'magit--with-connection-local-variables 'lisp-indent-function 'defun) + ;;; Miscellaneous (defun magit-message (format-string &rest args) diff --git a/elpa/magit-20231219.2243/magit-bisect.el b/elpa/magit-20240522.204/magit-bisect.el similarity index 95% rename from elpa/magit-20231219.2243/magit-bisect.el rename to elpa/magit-20240522.204/magit-bisect.el index b52b03bb..805b68b3 100644 --- a/elpa/magit-20231219.2243/magit-bisect.el +++ b/elpa/magit-20240522.204/magit-bisect.el @@ -1,9 +1,9 @@ ;;; magit-bisect.el --- Bisect support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -104,15 +104,7 @@ other actions from the bisect transient command (\ (interactive (if (magit-bisect-in-progress-p) (user-error "Already bisecting") (magit-bisect-start-read-args))) - (unless (magit-rev-ancestor-p good bad) - (user-error - "The %s revision (%s) has to be an ancestor of the %s one (%s)" - (or (transient-arg-value "--term-old=" args) "good") - good - (or (transient-arg-value "--term-new=" args) "bad") - bad)) - (when (magit-anything-modified-p) - (user-error "Cannot bisect with uncommitted changes")) + (magit-bisect-start--assert bad good args) (magit-repository-local-set 'bisect--first-parent (transient-arg-value "--first-parent" args)) (magit-git-bisect "start" (list args bad good) t)) @@ -130,6 +122,17 @@ other actions from the bisect transient command (\ bad) args))) +(defun magit-bisect-start--assert (bad good args) + (unless (magit-rev-ancestor-p good bad) + (user-error + "The %s revision (%s) has to be an ancestor of the %s one (%s)" + (or (transient-arg-value "--term-old=" args) "good") + good + (or (transient-arg-value "--term-new=" args) "bad") + bad)) + (when (magit-anything-modified-p) + (user-error "Cannot bisect with uncommitted changes"))) + ;;;###autoload (defun magit-bisect-reset () "After bisecting, cleanup bisection state and return to original `HEAD'." @@ -197,6 +200,7 @@ bisect run'." (magit-bisect-start-read-args)))) (cons (read-shell-command "Bisect shell command: ") args))) (when (and bad good) + (magit-bisect-start--assert bad good args) ;; Avoid `magit-git-bisect' because it's asynchronous, but the ;; next `git bisect run' call requires the bisect to be started. (magit-with-toplevel @@ -206,8 +210,8 @@ bisect run'." (list "bisect" "start" bad good args))) (magit-refresh))) (magit--with-connection-local-variables - (magit-git-bisect "run" (list shell-file-name - shell-command-switch cmdline)))) + (magit-git-bisect "run" (list shell-file-name + shell-command-switch cmdline)))) (defun magit-git-bisect (subcommand &optional args no-assert) (unless (or no-assert (magit-bisect-in-progress-p)) diff --git a/elpa/magit-20231219.2243/magit-blame.el b/elpa/magit-20240522.204/magit-blame.el similarity index 99% rename from elpa/magit-20231219.2243/magit-blame.el rename to elpa/magit-20240522.204/magit-blame.el index fcaeb468..084e1e19 100644 --- a/elpa/magit-20231219.2243/magit-blame.el +++ b/elpa/magit-20240522.204/magit-blame.el @@ -1,9 +1,9 @@ ;;; magit-blame.el --- Blame support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -274,7 +274,7 @@ Also see option `magit-blame-styles'." (error "Cannot get blame chunk at eob")) (car (magit-blame--parse-chunk type)))))) (noerror nil) - (t (error "Buffer does not visit a tracked file"))))))) + ((error "Buffer does not visit a tracked file"))))))) (defun magit-blame-chunk-at (pos) (--some (overlay-get it 'magit-blame-chunk) diff --git a/elpa/magit-20231219.2243/magit-bookmark.el b/elpa/magit-20240522.204/magit-bookmark.el similarity index 78% rename from elpa/magit-20231219.2243/magit-bookmark.el rename to elpa/magit-20240522.204/magit-bookmark.el index 3bef6a8d..19819122 100644 --- a/elpa/magit-20231219.2243/magit-bookmark.el +++ b/elpa/magit-20240522.204/magit-bookmark.el @@ -1,11 +1,11 @@ -;;; magit-bookmark.el --- Bookmark support for Magit -*- lexical-binding:t -*- +;;; magit-bookmark.el --- Bookmarks for Magit buffers -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors ;; Inspired by an earlier implementation by Yuri Khan. -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -30,6 +30,23 @@ (require 'magit) +(require 'bookmark) + +;;; Common + +(cl-defmethod magit-bookmark-get-filename (&context (major-mode magit-mode)) + (magit-toplevel)) + +(cl-defmethod magit-bookmark-get-buffer-create + (bookmark (mode (derived-mode magit-mode))) + (let ((default-directory (bookmark-get-filename bookmark)) + (magit-display-buffer-function #'identity) + (magit-display-buffer-noselect t)) + (apply (intern (format "%s-setup-buffer" + (substring (symbol-name mode) 0 -5))) + (--map (bookmark-prop-get bookmark it) + (get mode 'magit-bookmark-variables))))) + ;;; Diff ;;;; Diff @@ -79,6 +96,12 @@ (mapconcat #'identity magit-buffer-diff-files " ") (magit-rev-format "%s" magit-buffer-revision)))) +(cl-defmethod magit-bookmark--get-child-value + (section &context (major-mode magit-stash-mode)) + (string-replace magit-buffer-revision + magit-buffer-revision-hash + (oref section value))) + ;;; Log ;;;; Log diff --git a/elpa/magit-20231219.2243/magit-branch.el b/elpa/magit-20240522.204/magit-branch.el similarity index 95% rename from elpa/magit-20231219.2243/magit-branch.el rename to elpa/magit-20240522.204/magit-branch.el index 66fb59df..2ffb80e0 100644 --- a/elpa/magit-20231219.2243/magit-branch.el +++ b/elpa/magit-20240522.204/magit-branch.el @@ -1,9 +1,9 @@ ;;; magit-branch.el --- Branch support -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -208,18 +208,28 @@ has to be used to view and change branch related variables." (transient-define-prefix magit-branch (branch) "Add, configure or remove a branch." :man-page "git-branch" - ["Arguments" - (7 "-r" "Recurse submodules when checking out an existing branch" - "--recurse-submodules" - :if (lambda () (magit-git-version>= "2.13")))] - ["Variables" - :if (lambda () + [:if (lambda () (and magit-branch-direct-configure (oref (transient-prefix-object) scope))) + :description + (lambda () + (concat (propertize "Configure " 'face 'transient-heading) + (propertize (oref (transient-prefix-object) scope) + 'face 'magit-branch-local))) ("d" magit-branch..description) ("u" magit-branch..merge/remote) ("r" magit-branch..rebase) ("p" magit-branch..pushRemote)] + [:if-non-nil magit-branch-direct-configure + :description "Configure repository defaults" + ("R" magit-pull.rebase) + ("P" magit-remote.pushDefault) + ("B" "Update default branch" magit-update-default-branch + :inapt-if-not magit-get-some-remote)] + ["Arguments" + (7 "-r" "Recurse submodules when checking out an existing branch" + "--recurse-submodules" + :if (lambda () (magit-git-version>= "2.13")))] [["Checkout" ("b" "branch/revision" magit-checkout) ("l" "local branch" magit-branch-checkout) @@ -418,22 +428,23 @@ when using `magit-branch-and-checkout'." (defun magit-branch-read-args (prompt &optional default-start) (if magit-branch-read-upstream-first (let ((choice (magit-read-starting-point prompt nil default-start))) - (if (magit-rev-verify choice) - (list (magit-read-string-ns - (if magit-completing-read--silent-default - (format "%s (starting at `%s')" prompt choice) - "Name for new branch") - (let ((def (mapconcat #'identity - (cdr (split-string choice "/")) - "/"))) - (and (member choice (magit-list-remote-branch-names)) - (not (member def (magit-list-local-branch-names))) - def))) - choice) - (if (eq magit-branch-read-upstream-first 'fallback) - (list choice - (magit-read-starting-point prompt choice default-start)) - (user-error "Not a valid starting-point: %s" choice)))) + (cond + ((magit-rev-verify choice) + (list (magit-read-string-ns + (if magit-completing-read--silent-default + (format "%s (starting at `%s')" prompt choice) + "Name for new branch") + (let ((def (mapconcat #'identity + (cdr (split-string choice "/")) + "/"))) + (and (member choice (magit-list-remote-branch-names)) + (not (member def (magit-list-local-branch-names))) + def))) + choice)) + ((eq magit-branch-read-upstream-first 'fallback) + (list choice + (magit-read-starting-point prompt choice default-start))) + ((user-error "Not a valid starting-point: %s" choice)))) (let ((branch (magit-read-string-ns (concat prompt " named")))) (if (magit-branch-p branch) (magit-branch-read-args @@ -784,8 +795,10 @@ the remote." (not (eq magit-branch-rename-push-target 'local-only)) (or (not (eq magit-branch-rename-push-target 'forge-only)) (and (require (quote forge) nil t) - (fboundp 'forge--forge-remote-p) - (forge--forge-remote-p remote)))) + (fboundp 'forge--split-forge-url) + (and-let* ((url (magit-git-string + "remote" "get-url" remote))) + (forge--split-forge-url url))))) (let ((old-target (magit-get-push-branch old t)) (new-target (magit-get-push-branch new t)) (remote (magit-get-push-remote new))) @@ -861,7 +874,7 @@ and also rename the respective reflog file." ["Configure repository defaults" ("R" magit-pull.rebase) ("P" magit-remote.pushDefault) - ("b" "Update default branch" magit-update-default-branch + ("B" "Update default branch" magit-update-default-branch :inapt-if-not magit-get-some-remote)] ["Configure branch creation" ("a m" magit-branch.autoSetupMerge) diff --git a/elpa/magit-20231219.2243/magit-bundle.el b/elpa/magit-20240522.204/magit-bundle.el similarity index 96% rename from elpa/magit-20231219.2243/magit-bundle.el rename to elpa/magit-20240522.204/magit-bundle.el index a192d236..8b3ac88a 100644 --- a/elpa/magit-20231219.2243/magit-bundle.el +++ b/elpa/magit-20240522.204/magit-bundle.el @@ -1,9 +1,9 @@ ;;; magit-bundle.el --- Bundle support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-clone.el b/elpa/magit-20240522.204/magit-clone.el similarity index 98% rename from elpa/magit-20231219.2243/magit-clone.el rename to elpa/magit-20240522.204/magit-clone.el index 242113e9..ed44b085 100644 --- a/elpa/magit-20231219.2243/magit-clone.el +++ b/elpa/magit-20240522.204/magit-clone.el @@ -1,9 +1,9 @@ ;;; magit-clone.el --- Clone a repository -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-commit.el b/elpa/magit-20240522.204/magit-commit.el similarity index 99% rename from elpa/magit-20231219.2243/magit-commit.el rename to elpa/magit-20240522.204/magit-commit.el index d8d6bb62..be32e0af 100644 --- a/elpa/magit-20231219.2243/magit-commit.el +++ b/elpa/magit-20240522.204/magit-commit.el @@ -1,9 +1,9 @@ ;;; magit-commit.el --- Create Git commits -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -202,8 +202,8 @@ With a prefix argument, amend to the commit at `HEAD' instead. With a prefix argument keep the committer date, otherwise change it. The option `magit-commit-extend-override-date' can be used -to inverse the meaning of the prefix argument. \n(git commit ---amend --no-edit)" +to inverse the meaning of the prefix argument. +\n(git commit --amend --no-edit)" (interactive (list (magit-commit-arguments) (if current-prefix-arg (not magit-commit-extend-override-date) diff --git a/elpa/magit-20231219.2243/magit-core.el b/elpa/magit-20240522.204/magit-core.el similarity index 95% rename from elpa/magit-20231219.2243/magit-core.el rename to elpa/magit-20240522.204/magit-core.el index d0fa8d22..ff154866 100644 --- a/elpa/magit-20231219.2243/magit-core.el +++ b/elpa/magit-20240522.204/magit-core.el @@ -1,9 +1,9 @@ ;;; magit-core.el --- Core functionality -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-diff.el b/elpa/magit-20240522.204/magit-diff.el similarity index 98% rename from elpa/magit-20231219.2243/magit-diff.el rename to elpa/magit-20240522.204/magit-diff.el index e5bd8166..e36a38b2 100644 --- a/elpa/magit-20231219.2243/magit-diff.el +++ b/elpa/magit-20240522.204/magit-diff.el @@ -1,9 +1,9 @@ ;;; magit-diff.el --- Inspect Git diffs -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -465,25 +465,6 @@ image, accordingly. Either the car or the cdr may be nil." (choice (const :tag "No committer image" nil) (regexp :tag "Committer regexp" "^Commit: "))))) -(defcustom magit-revision-use-gravatar-kludge nil - "Whether to work around a bug which affects display of gravatars. - -Gravatar images are spliced into two halves which are then -displayed on separate lines. On macOS the splicing has a bug in -some Emacs builds, which causes the top and bottom halves to be -interchanged. Enabling this option works around this issue by -interchanging the halves once more, which cancels out the effect -of the bug. - -See https://github.com/magit/magit/issues/2265 -and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=7847. - -Starting with Emacs 26.1 this kludge should not be required for -any build." - :package-version '(magit . "2.3.0") - :group 'magit-revision - :type 'boolean) - (defcustom magit-revision-fill-summary-line nil "Whether to fill excessively long summary lines. @@ -1137,7 +1118,7 @@ The information can be in three forms: If no DWIM context is found, nil is returned." (cond ((and-let* ((commits (magit-region-values '(commit branch) t))) - (progn ; work around debbugs#31840 + (progn (deactivate-mark) (concat (car (last commits)) ".." (car commits))))) (magit-buffer-refname @@ -1191,7 +1172,7 @@ If no DWIM context is found, nil is returned." (and-let* ((commits (magit-region-values '(commit branch) t)) (revA (car (last commits))) (revB (car commits))) - (progn ; work around debbugs#31840 + (progn (when interactive (deactivate-mark)) (if mbase @@ -1382,10 +1363,9 @@ for a revision." (and (cl-typep section 'magit-file-section) (equal (oref section value) file))) (oref (or parent magit-root-section) children)))) - (let ((hunk nil) - (hunks (oref diff children))) + (let ((hunks (oref diff children))) (cl-block nil - (while (setq hunk (pop hunks)) + (while-let ((hunk (pop hunks))) (when-let ((range (oref hunk to-range))) (pcase-let* ((`(,beg ,len) range) (end (+ beg len))) @@ -1643,7 +1623,7 @@ Like `magit-diff-visit-worktree-file' but use If FORCE-WORKTREE is non-nil, then visit the worktree version of the file, even if the diff is about a committed change. Use FN to display the buffer in some window." - (if (magit-file-accessible-directory-p file) + (if (file-accessible-directory-p file) (magit-diff-visit-directory file force-worktree) (pcase-let ((`(,buf ,pos) (magit-diff-visit-file--noselect file force-worktree))) @@ -1734,7 +1714,7 @@ the Magit-Status buffer for DIRECTORY." (defun magit-diff-visit--hunk () (and-let* ((scope (magit-diff-scope)) (section (magit-current-section))) - (progn ; work around debbugs#31840 + (progn (cl-case scope ((file files) (setq section (car (oref section children)))) @@ -2022,7 +2002,8 @@ Staging and applying changes is documented in info node (0) (1 (concat " in file " (car magit-buffer-diff-files))) (_ (concat " in files " - (mapconcat #'identity magit-buffer-diff-files ", "))))))) + (mapconcat #'identity magit-buffer-diff-files + ", "))))))) (setq magit-buffer-range-hashed (and magit-buffer-range (magit-hash-range magit-buffer-range))) (magit-insert-section (diffbuf) @@ -2086,6 +2067,8 @@ keymap is the parent of their keymaps." '(unstaged staged)))))) (defvar-keymap magit-file-section-map + ;; Even though this derived map doesn't add any bindings by default, + ;; it is quite possible that some users would want to add their own. :doc "Keymap for `file' sections." :parent magit-diff-section-base-map) @@ -2170,7 +2153,9 @@ keymap is the parent of their keymaps." (setq magit-git-global-arguments (append magit-diff--reset-non-color-moved magit-git-global-arguments))) - (magit--git-wash #'magit-diff-wash-diffs keep-error cmd args))) + (magit--git-wash #'magit-diff-wash-diffs + (if (member "--no-index" args) 'wash-anyway keep-error) + cmd args))) (defun magit-diff--maybe-add-stat-arguments (args) (if (member "--stat" args) @@ -2417,9 +2402,12 @@ section or a child thereof." (defun magit-diff-insert-file-section (file orig status modes rename header binary long-status) - (magit-insert-section section - (file file (or (equal status "deleted") - (derived-mode-p 'magit-status-mode))) + (magit-insert-section + ( file file + (or (equal status "deleted") (derived-mode-p 'magit-status-mode)) + :source (and (not (equal orig file)) orig) + :header header + :binary binary) (insert (propertize (format "%-10s %s" status (if (or (not orig) (equal orig file)) file @@ -2430,10 +2418,6 @@ section or a child thereof." ((or binary long-status) (insert (format " (%s)" (if binary "binary" long-status))))) (magit-insert-heading) - (unless (equal orig file) - (oset section source orig)) - (oset section header header) - (oset section binary binary) (when modes (magit-insert-section (hunk '(chmod)) (insert modes) @@ -2465,7 +2449,7 @@ section or a child thereof." (when rewind (setq range (replace-regexp-in-string "[^.]\\(\\.\\.\\)[^.]" "..." range t t 1))) - (magit-insert-section (magit-module-section module t) + (magit-insert-section (module module t) (magit-insert-heading (propertize (concat "modified " module) 'font-lock-face 'magit-diff-file-heading) @@ -2480,23 +2464,24 @@ section or a child thereof." (and untracked "untracked") " content")) ")") - (let ((default-directory - (file-name-as-directory - (expand-file-name module (magit-toplevel))))) - (magit-git-wash (apply-partially #'magit-log-wash-log 'module) - "log" "--oneline" "--left-right" range) - (delete-char -1))))) + (magit-insert-section-body + (let ((default-directory + (file-name-as-directory + (expand-file-name module (magit-toplevel))))) + (magit-git-wash (apply-partially #'magit-log-wash-log 'module) + "log" "--oneline" "--left-right" range) + (delete-char -1)))))) ((and (looking-at "^Submodule \\([^ ]+\\) \\([^ ]+\\) (\\([^)]+\\))$") (equal (match-string 1) module)) (magit-bind-match-strings (_module _range msg) nil (magit-delete-line) - (magit-insert-section (magit-module-section module) + (magit-insert-section (module module) (magit-insert-heading (propertize (concat "submodule " module) 'font-lock-face 'magit-diff-file-heading) " (" msg ")")))) (t - (magit-insert-section (magit-module-section module) + (magit-insert-section (module module) (magit-insert-heading (propertize (concat "modified " module) 'font-lock-face 'magit-diff-file-heading) @@ -2523,20 +2508,18 @@ section or a child thereof." (combined (length= ranges 3)) (value (cons about ranges))) (magit-delete-line) - (magit-insert-section section (hunk value) + (magit-insert-section + ( hunk value nil + :washer #'magit-diff-paint-hunk + :combined combined + :from-range (if combined (butlast ranges) (car ranges)) + :to-range (car (last ranges)) + :about about) (insert (propertize (concat heading "\n") 'font-lock-face 'magit-diff-hunk-heading)) (magit-insert-heading) (while (not (or (eobp) (looking-at "^[^-+\s\\]"))) - (forward-line)) - (oset section end (point)) - (oset section washer #'magit-diff-paint-hunk) - (oset section combined combined) - (if combined - (oset section from-ranges (butlast ranges)) - (oset section from-range (car ranges))) - (oset section to-range (car (last ranges))) - (oset section about about))) + (forward-line)))) t)) (defun magit-diff-expansion-threshold (section) @@ -2639,9 +2622,9 @@ or a ref which is not a branch, then it inserts nothing." 'magit-section-secondary-heading))) (magit-insert-heading) (forward-line) - (magit-insert-section section (message) - (oset section heading-highlight-face - 'magit-diff-revision-summary-highlight) + (magit-insert-section + ( message nil nil + :heading-highlight-face 'magit-diff-revision-summary-highlight) (let ((beg (point))) (forward-line) (magit--add-face-text-property @@ -2670,8 +2653,9 @@ or a ref which is not a branch, then it inserts nothing." (defun magit-insert-revision-message () "Insert the commit message into a revision buffer." - (magit-insert-section section (commit-message) - (oset section heading-highlight-face 'magit-diff-revision-summary-highlight) + (magit-insert-section + ( commit-message nil nil + :heading-highlight-face 'magit-diff-revision-summary-highlight) (let ((beg (point)) (rev magit-buffer-revision)) (insert (with-temp-buffer @@ -2741,9 +2725,10 @@ or a ref which is not a branch, then it inserts nothing." "Insert commit notes into a revision buffer." (let* ((var "core.notesRef") (def (or (magit-get var) "refs/notes/commits"))) - (dolist (ref (or (magit-list-active-notes-refs))) - (magit-insert-section section (notes ref (not (equal ref def))) - (oset section heading-highlight-face 'magit-diff-hunk-heading-highlight) + (dolist (ref (magit-list-active-notes-refs)) + (magit-insert-section + ( notes ref (not (equal ref def)) + :heading-highlight-face 'magit-diff-hunk-heading-highlight) (let ((beg (point)) (rev magit-buffer-revision)) (insert (with-temp-buffer @@ -2904,8 +2889,6 @@ Refer to user option `magit-revision-insert-related-refs-display-alist'." (let ((top (list image '(slice 0.0 0.0 1.0 0.5))) (bot (list image '(slice 0.0 0.5 1.0 1.0))) (align `((space :align-to ,align-to)))) - (when magit-revision-use-gravatar-kludge - (cl-rotatef top bot)) (let ((inhibit-read-only t)) (insert (propertize " " 'display top)) (insert (propertize " " 'display align)) diff --git a/elpa/magit-20231219.2243/magit-ediff.el b/elpa/magit-20240522.204/magit-ediff.el similarity index 99% rename from elpa/magit-20231219.2243/magit-ediff.el rename to elpa/magit-20240522.204/magit-ediff.el index c7776d23..71721eb2 100644 --- a/elpa/magit-20231219.2243/magit-ediff.el +++ b/elpa/magit-20240522.204/magit-ediff.el @@ -1,9 +1,9 @@ ;;; magit-ediff.el --- Ediff extension for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-extras.el b/elpa/magit-20240522.204/magit-extras.el similarity index 97% rename from elpa/magit-20231219.2243/magit-extras.el rename to elpa/magit-20240522.204/magit-extras.el index c1db1b9e..e208f4a2 100644 --- a/elpa/magit-20231219.2243/magit-extras.el +++ b/elpa/magit-20240522.204/magit-extras.el @@ -1,9 +1,9 @@ ;;; magit-extras.el --- Additional functionality for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -197,27 +197,17 @@ blame to center around the line point is on." (defun ido-enter-magit-status () "Drop into `magit-status' from file switching. -This command does not work in Emacs 26.1. -See https://github.com/magit/magit/issues/3634 -and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31707. - To make this command available use something like: - (add-hook \\='ido-setup-hook - (lambda () - (keymap-set ido-completion-map - \"C-x g\" \\='ido-enter-magit-status))) - -Starting with Emacs 25.1 the Ido keymaps are defined just once -instead of every time Ido is invoked, so now you can modify it -like pretty much every other keymap: - (keymap-set ido-common-completion-map - \"C-x g\" \\='ido-enter-magit-status)" + \"C-x g\" \\='ido-enter-magit-status) + +This command does not work in Emacs 26.1. +See https://github.com/magit/magit/issues/3634 +and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31707." (interactive) (setq ido-exit 'fallback) - (setq ido-fallback #'magit-status) ; for Emacs >= 26.2 - (with-no-warnings (setq fallback #'magit-status)) ; for Emacs 25 + (setq ido-fallback #'magit-status) (exit-minibuffer)) ;;;###autoload @@ -235,10 +225,10 @@ well. If you want to use another key, then you must set this to nil before loading Magit to prevent \"m\" from being bound.") (with-eval-after-load 'project - ;; Only more recent versions of project.el have `project-prefix-map' and - ;; `project-switch-commands', though project.el is available in Emacs 25. (when (and magit-bind-magit-project-status + ;; Added in Emacs 28.1. (boundp 'project-prefix-map) + (boundp 'project-switch-commands) ;; Only modify if it hasn't already been modified. (equal project-switch-commands (eval (car (get 'project-switch-commands 'standard-value)) @@ -417,7 +407,7 @@ in HEAD as well as staged changes in the diff to check." (setq-local diff-vc-revisions (list rev1 rev2)) (setq-local diff-vc-backend 'Git) (diff-add-log-current-defuns))))) - (t (user-error "`magit-generate-changelog' requires Emacs 27 or greater")))) + ((user-error "`magit-generate-changelog' requires Emacs 27 or greater")))) ;;;###autoload (defun magit-add-change-log-entry (&optional whoami file-name other-window) @@ -550,7 +540,8 @@ list returned by `magit-rebase-arguments'." ((not rev) (when (and (magit-ref-p backup) (not (magit-y-or-n-p - (format "Backup ref %s already exists. Override? " backup)))) + (format "Backup ref %s already exists. Override? " + backup)))) (user-error "Abort")) (magit-log-select (lambda (rev) @@ -805,7 +796,7 @@ argument." (push (list value default-directory) magit-revision-stack) (kill-new (message "%s" (or (and current-prefix-arg ref) value))))) - (t (kill-new (message "%s" value)))))))) + ((kill-new (message "%s" value)))))))) ;;;###autoload (defun magit-copy-buffer-revision () diff --git a/elpa/magit-20231219.2243/magit-fetch.el b/elpa/magit-20240522.204/magit-fetch.el similarity index 97% rename from elpa/magit-20231219.2243/magit-fetch.el rename to elpa/magit-20240522.204/magit-fetch.el index 35e1c8e6..d19910f5 100644 --- a/elpa/magit-20231219.2243/magit-fetch.el +++ b/elpa/magit-20240522.204/magit-fetch.el @@ -1,9 +1,9 @@ ;;; magit-fetch.el --- Download objects and refs -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-files.el b/elpa/magit-20240522.204/magit-files.el similarity index 99% rename from elpa/magit-20231219.2243/magit-files.el rename to elpa/magit-20240522.204/magit-files.el index 0d359f42..e13491a2 100644 --- a/elpa/magit-20231219.2243/magit-files.el +++ b/elpa/magit-20240522.204/magit-files.el @@ -1,9 +1,9 @@ ;;; magit-files.el --- Finding files -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-git.el b/elpa/magit-20240522.204/magit-git.el similarity index 98% rename from elpa/magit-20231219.2243/magit-git.el rename to elpa/magit-20240522.204/magit-git.el index 474f4eab..a4163135 100644 --- a/elpa/magit-20231219.2243/magit-git.el +++ b/elpa/magit-20240522.204/magit-git.el @@ -1,9 +1,9 @@ ;;; magit-git.el --- Git functionality -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -597,7 +597,8 @@ call function WASHER with ARGS as its sole argument." (magit-cancel-section) (unless (bolp) (insert "\n")) - (when (equal exit 0) + (when (or (equal exit 0) + (eq keep-error 'wash-anyway)) (save-restriction (narrow-to-region beg (point)) (goto-char beg) @@ -670,9 +671,9 @@ using `magit-debug-git-executable'.") (push (cons host version) magit--host-git-version-cache) version)))) - (t (error "Unexpected \"%s --version\" output: %S" - (magit-git-executable) - output))))))))) + ((error "Unexpected \"%s --version\" output: %S" + (magit-git-executable) + output))))))))) (defun magit-git-version-assert (&optional minimal who) "Assert that the used Git version is greater than or equal to MINIMAL. @@ -820,7 +821,7 @@ Also see `magit-git-config-p'." (let ((dir (file-name-as-directory (expand-file-name (or file default-directory)))) (previous nil)) - (while (not (magit-file-accessible-directory-p dir)) + (while (not (file-accessible-directory-p dir)) (setq dir (file-name-directory (directory-file-name dir))) (when (equal dir previous) (throw 'unsafe-default-dir nil)) @@ -1003,7 +1004,7 @@ is non-nil, in which case return nil." (let ((gitdir (magit-gitdir))) (cond (gitdir (file-in-directory-p default-directory gitdir)) (noerror nil) - (t (signal 'magit-outside-git-repo default-directory)))))) + ((signal 'magit-outside-git-repo default-directory)))))) (defun magit-inside-worktree-p (&optional noerror) "Return t if `default-directory' is below the working directory. @@ -1303,7 +1304,7 @@ are considered." (defun magit-module-worktree-p (module) (magit-with-toplevel - (file-exists-p (expand-file-name (expand-file-name ".git" module))))) + (file-exists-p (expand-file-name ".git" module)))) (defun magit-module-no-worktree-p (module) (not (magit-module-worktree-p module))) @@ -1364,7 +1365,7 @@ string \"true\", otherwise return nil." If REV is nil or has the form \":/TEXT\", return REV itself." (cond ((not rev) nil) ((string-match-p "^:/" rev) rev) - (t (concat rev "^{commit}")))) + ((concat rev "^{commit}")))) (defun magit-rev-equal (a b) "Return t if there are no differences between the commits A and B." @@ -1456,7 +1457,7 @@ Git." (if (magit-ref-ambiguous-p (match-string 1 name)) name (match-string 1 name))) - (t (magit-ref-maybe-qualify name))))) + ((magit-ref-maybe-qualify name))))) (defun magit-name-branch (rev &optional lax) (or (magit-name-local-branch rev) @@ -1475,7 +1476,9 @@ Git." (defun magit-name-tag (rev &optional lax) (and-let* ((name (magit-rev-name rev "refs/tags/*"))) - (progn ; work around debbugs#31840 + ;; The progn is necessary to work around debbugs#31840. This, and all + ;; the other instances, can be removed once we require at least Emacs 27. + (progn (when (string-suffix-p "^0" name) (setq name (substring name 0 -2))) (and (or lax (not (string-match-p "[~^]" name))) @@ -1626,7 +1629,7 @@ to, or to some other symbolic-ref that points to the same ref." ([branch remote] (magit-section-parent-value it)))) (defun magit-module-at-point (&optional predicate) - (when (magit-section-match 'magit-module-section) + (when (magit-section-match 'module) (let ((module (oref (magit-current-section) value))) (and (or (not predicate) (funcall predicate module)) @@ -2281,12 +2284,12 @@ If `first-parent' is set, traverse only first parents." (defun magit-patch-id (rev) (magit--with-connection-local-variables - (magit--with-temp-process-buffer - (magit-process-file - shell-file-name nil '(t nil) nil shell-command-switch - (let ((exec (shell-quote-argument (magit-git-executable)))) - (format "%s diff-tree -u %s | %s patch-id" exec rev exec))) - (car (split-string (buffer-string)))))) + (magit--with-temp-process-buffer + (magit-process-file + shell-file-name nil '(t nil) nil shell-command-switch + (let ((exec (shell-quote-argument (magit-git-executable)))) + (format "%s diff-tree -u %s | %s patch-id" exec rev exec))) + (car (split-string (buffer-string)))))) (defun magit-rev-format (format &optional rev args) ;; Prefer `git log --no-walk' to `git show --no-patch' because it @@ -2308,7 +2311,7 @@ If `first-parent' is set, traverse only first parents." (defun magit-format-rev-summary (rev) (and-let* ((str (magit-rev-format "%h %s" rev))) - (progn ; work around debbugs#31840 + (progn (magit--put-face 0 (string-match " " str) 'magit-hash str) str))) @@ -2657,7 +2660,7 @@ and this option only controls what face is used.") (magit-read-range prompt (or (and-let* ((revs (magit-region-values '(commit branch) t))) - (progn ; work around debbugs#31840 + (progn (deactivate-mark) (concat (car (last revs)) ".." (car revs)))) (magit-branch-or-commit-at-point) @@ -2885,13 +2888,13 @@ out. Only existing branches can be selected." (if predicate (user-error "No modules satisfying %s available" predicate) (user-error "No modules available")))) - (setq modules (magit-region-values 'magit-module-section)) + (setq modules (magit-region-values 'module)) (when modules (when predicate (setq modules (seq-filter predicate modules))) (unless modules (user-error "No modules satisfying %s selected" predicate)))) - (if (length> modules 1) + (if (or (length> modules 1) current-prefix-arg) (magit-confirm t nil (format "%s %%d modules" verb) nil modules) (list (magit-read-module-path (format "%s module" verb) predicate))))) diff --git a/elpa/magit-20231219.2243/magit-gitignore.el b/elpa/magit-20240522.204/magit-gitignore.el similarity index 97% rename from elpa/magit-20231219.2243/magit-gitignore.el rename to elpa/magit-20240522.204/magit-gitignore.el index 2f60f8c0..82d494ef 100644 --- a/elpa/magit-20231219.2243/magit-gitignore.el +++ b/elpa/magit-20240522.204/magit-gitignore.el @@ -1,9 +1,9 @@ ;;; magit-gitignore.el --- Intentionally untracked files -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-log.el b/elpa/magit-20240522.204/magit-log.el similarity index 98% rename from elpa/magit-20231219.2243/magit-log.el rename to elpa/magit-20240522.204/magit-log.el index 763b529e..c71c51dd 100644 --- a/elpa/magit-20231219.2243/magit-log.el +++ b/elpa/magit-20240522.204/magit-log.el @@ -1,9 +1,9 @@ ;;; magit-log.el --- Inspect Git history -*- lexical-binding:t; coding:utf-8 -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -685,16 +685,16 @@ previously checked out branch and its upstream and push-target." (setq rebase (magit-ref-abbrev rebase)) (setq current rebase) (setq head "HEAD")) - (t (setq current (magit-get-previous-branch))))) + ((setq current (magit-get-previous-branch))))) (cond (current (setq current - (magit--propertize-face current'magit-branch-local)) + (magit--propertize-face current 'magit-branch-local)) (setq target (magit-get-push-branch current t)) (setq upstream (magit-get-upstream-branch current)) (when upstream (setq upup (and (magit-local-branch-p upstream) (magit-get-upstream-branch upstream))))) - (t (setq head "HEAD"))) + ((setq head "HEAD"))) (delq nil (list current head target upstream upup))) (magit-log-arguments))) (magit-log-setup-buffer revs args files)) @@ -1361,12 +1361,16 @@ Do not add this to a hook variable." ;; of the youngest expired reflog entry. (when (and (eq style 'reflog) (not date)) (cl-return-from magit-log-wash-rev t)) - (magit-insert-section section (commit hash) - (pcase style - ('stash (oset section type 'stash)) - ('module (oset section type 'module-commit)) - ('bisect-log (setq hash (magit-rev-parse "--short" hash)))) - (setq hash (propertize hash 'font-lock-face + (magit-insert-section + ((eval (pcase style + ('stash 'stash) + ('module 'module-commit) + (_ 'commit))) + hash) + (setq hash (propertize (if (eq style 'bisect-log) + (magit-rev-parse "--short" hash) + hash) + 'font-lock-face (pcase (and gpg (aref gpg 0)) (?G 'magit-signature-good) (?B 'magit-signature-bad) @@ -1595,7 +1599,8 @@ The shortstat style is experimental and rather slow." (defun magit-log-format-author-margin (author date &optional previous-line) (pcase-let ((`(,_ ,style ,width ,details ,details-width) (or magit-buffer-margin - (symbol-value (magit-margin-option))))) + (symbol-value (magit-margin-option)) + (error "No margin format specified for %s" major-mode)))) (magit-make-margin-overlay (concat (and details (concat (magit--propertize-face @@ -1845,10 +1850,6 @@ keymap is the parent of their keymaps." " " #'magit-diff-dwim "<1>" (magit-menu-item "Visit diff" #'magit-diff-dwim)) -(defvar-keymap magit-unpulled-section-map - :doc "Keymap for `unpulled' sections." - :parent magit-log-section-map) - (cl-defmethod magit-section-ident-value ((section magit-unpulled-section)) "\"..@{push}\" cannot be used as the value because that is ambiguous if `push.default' does not allow a 1:1 mapping, and @@ -1888,10 +1889,6 @@ in the pushremote case." (magit--insert-log nil range magit-buffer-log-args) (magit-log-insert-child-count))))) -(defvar-keymap magit-unpushed-section-map - :doc "Keymap for `unpushed' sections." - :parent magit-log-section-map) - (cl-defmethod magit-section-ident-value ((section magit-unpushed-section)) "\"..@{push}\" cannot be used as the value because that is ambiguous if `push.default' does not allow a 1:1 mapping, and diff --git a/elpa/magit-20231219.2243/magit-margin.el b/elpa/magit-20240522.204/magit-margin.el similarity index 96% rename from elpa/magit-20231219.2243/magit-margin.el rename to elpa/magit-20240522.204/magit-margin.el index c69b84a5..46d360f6 100644 --- a/elpa/magit-20231219.2243/magit-margin.el +++ b/elpa/magit-20240522.204/magit-margin.el @@ -1,9 +1,9 @@ ;;; magit-margin.el --- Margins in Magit buffers -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -126,7 +126,8 @@ does not carry to other options." ('magit-refs-mode 'magit-refs-margin) ('magit-stashes-mode 'magit-stashes-margin) ('magit-status-mode 'magit-status-margin) - ('forge-notifications-mode 'magit-status-margin))) + ('forge-notifications-mode 'magit-status-margin) + ('forge-topics-mode 'magit-status-margin))) (defun magit-set-buffer-margin (&optional reset refresh) (when-let ((option (magit-margin-option))) diff --git a/elpa/magit-20231219.2243/magit-merge.el b/elpa/magit-20240522.204/magit-merge.el similarity index 97% rename from elpa/magit-20231219.2243/magit-merge.el rename to elpa/magit-20240522.204/magit-merge.el index ac545a09..d6b0198c 100644 --- a/elpa/magit-20231219.2243/magit-merge.el +++ b/elpa/magit-20240522.204/magit-merge.el @@ -1,9 +1,9 @@ ;;; magit-merge.el --- Merge functionality -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -291,10 +291,6 @@ then also remove the respective remote branch." ;;; Sections -(defvar-keymap magit-unmerged-section-map - :doc "Keymap for `unmerged' sections." - :parent magit-log-section-map) - (defun magit-insert-merge-log () "Insert section for the on-going merge. Display the heads that are being merged. diff --git a/elpa/magit-20231219.2243/magit-mode.el b/elpa/magit-20240522.204/magit-mode.el similarity index 87% rename from elpa/magit-20231219.2243/magit-mode.el rename to elpa/magit-20240522.204/magit-mode.el index 08c5f84a..2548bb7b 100644 --- a/elpa/magit-20231219.2243/magit-mode.el +++ b/elpa/magit-20240522.204/magit-mode.el @@ -1,9 +1,9 @@ ;;; magit-mode.el --- Create and refresh Magit buffers -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -31,16 +31,11 @@ (require 'magit-base) (require 'magit-git) +(require 'browse-url) (require 'format-spec) (require 'help-mode) (require 'transient) -(unless (fboundp 'transient-prefix-object) - (display-warning 'magit (substitute-command-keys - (format magit--core-upgrade-instructions - 'transient "0.5.0" 'transient - 'transient 'transient 'transient)) - :emergency)) (defvar bookmark-make-record-function) (defvar magit--wip-inhibit-autosave) @@ -278,11 +273,22 @@ then fall back to regular region highlighting." :options '(magit-diff-update-hunk-region)) (defcustom magit-create-buffer-hook nil - "Normal hook run after creating a new `magit-mode' buffer." + "Normal hook run while creating a new `magit-mode' buffer. +Runs before the buffer is populated with sections. Also see +`magit-post-create-buffer-hook'." :package-version '(magit . "2.90.0") :group 'magit-refresh :type 'hook) +(defcustom magit-post-create-buffer-hook nil + "Normal hook run after creating a new `magit-mode' buffer. +Runs after the buffer is populated with sections for the first +time. Also see `magit-create-buffer-hook' (which runs earlier) +and `magit-refresh-buffer-hook' (which runs on every refresh)." + :package-version '(magit . "4.0.0") + :group 'magit-refresh + :type 'hook) + (defcustom magit-refresh-buffer-hook nil "Normal hook for `magit-refresh-buffer' to run after refreshing." :package-version '(magit . "2.1.0") @@ -417,6 +423,8 @@ Where applicable, other keymaps remap this command to another, which actually deletes the thing at point." (interactive) (user-error "There is no thing at point that could be deleted")) +;; Starting with Emacs 28.1 we could use (declare (completion ignore)). +(put 'magit-delete-thing 'completion-predicate #'ignore) (defun magit-visit-thing () "This is a placeholder command, which may signal an error if called. @@ -425,7 +433,10 @@ which actually visits the thing at point." (interactive) (if (eq transient-current-command 'magit-dispatch) (call-interactively (key-binding (this-command-keys))) - (user-error "There is no thing at point that could be visited"))) + (if-let ((url (browse-url-url-at-point))) + (browse-url url) + (user-error "There is no thing at point that could be visited")))) +(put 'magit-visit-thing 'completion-predicate #'ignore) (defun magit-edit-thing () "This is a placeholder command, which may signal an error if called. @@ -436,13 +447,17 @@ buffer." (if (eq transient-current-command 'magit-dispatch) (call-interactively (key-binding (this-command-keys))) (user-error "There is no thing at point that could be edited"))) +(put 'magit-edit-thing 'completion-predicate #'ignore) (defun magit-browse-thing () - "This is a placeholder command, which signals an error if called. + "This is a placeholder command, which may signal an error if called. Where applicable, other keymaps remap this command to another, which actually visits thing at point using `browse-url'." (interactive) - (user-error "There is no thing at point that could be browsed")) + (if-let ((url (browse-url-url-at-point))) + (browse-url url) + (user-error "There is no thing at point that could be browsed"))) +(put 'magit-browse-thing 'completion-predicate #'ignore) (defun magit-copy-thing () "This is a placeholder command, which signals an error if called. @@ -451,6 +466,7 @@ which actually copies some representation of the thing at point to the kill ring." (interactive) (user-error "There is no thing at point that we know how to copy")) +(put 'magit-copy-thing 'completion-predicate #'ignore) ;;;###autoload (defun magit-info () @@ -586,9 +602,6 @@ The buffer's major-mode should derive from `magit-section-mode'." (defvar-local magit-previous-section nil) (put 'magit-previous-section 'permanent-local t) -(defvar-local magit--imenu-group-types nil) -(defvar-local magit--imenu-item-types nil) - ;;; Setup Buffer (defmacro magit-setup-buffer (mode &optional locked &rest bindings) @@ -599,15 +612,16 @@ The buffer's major-mode should derive from `magit-section-mode'." `(list ',var ,form)) bindings)))) -(defun magit-setup-buffer-internal (mode locked bindings &optional buffer-name) +(defun magit-setup-buffer-internal ( mode locked bindings + &optional buffer-or-name) (let* ((value (and locked (with-temp-buffer (pcase-dolist (`(,var ,val) bindings) (set (make-local-variable var) val)) (let ((major-mode mode)) (magit-buffer-value))))) - (buffer (if buffer-name - (get-buffer-create buffer-name) + (buffer (if buffer-or-name + (get-buffer-create buffer-or-name) (magit-get-mode-buffer mode value))) (section (and buffer (magit-current-section))) (created (not buffer))) @@ -624,7 +638,9 @@ The buffer's major-mode should derive from `magit-section-mode'." (magit-display-buffer buffer) (with-current-buffer buffer (run-hooks 'magit-setup-buffer-hook) - (magit-refresh-buffer)) + (magit-refresh-buffer) + (when created + (run-hooks 'magit-post-create-buffer-hook))) buffer)) ;;; Display Buffer @@ -1062,6 +1078,18 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (float-time (time-subtract (current-time) magit-refresh-start-time))))))) +(defun magit-profile-refresh-buffer () + "Profile refreshing the current Magit buffer." + (interactive) + (require (quote elp)) + (when (fboundp 'elp-reset-all) + (elp-reset-all) + (elp-instrument-package "magit-") + (elp-instrument-package "forge-") + (magit-refresh-buffer) + (elp-results) + (elp-reset-all))) + ;;; Save File-Visiting Buffers (defvar magit--disable-save-buffers nil) @@ -1348,11 +1376,16 @@ Unless specified, REPOSITORY is the current buffer's repository." (defun magit-repository-local-delete (key &optional repository) "Delete the repository-local value for KEY. -Unless specified, REPOSITORY is the current buffer's repository." - (when-let ((cache (assoc (or repository - (magit-repository-local-repository)) - magit-repository-local-cache))) - (setf cache (compat-call assoc-delete-all key cache)))) +Unless specified, REPOSITORY is the current buffer's repository. +If REPOSITORY is `all', then delete the value for KEY for all +repositories." + (if (eq repository 'all) + (dolist (cache magit-repository-local-cache) + (setf cache (compat-call assoc-delete-all key cache))) + (when-let ((cache (assoc (or repository + (magit-repository-local-repository)) + magit-repository-local-cache))) + (setf cache (compat-call assoc-delete-all key cache))))) (defmacro magit--with-repository-local-cache (key &rest body) (declare (indent 1) (debug (form body))) @@ -1408,153 +1441,6 @@ mentioned caches completely." (setq magit-section-visibility-cache nil))))) (setq magit--libgit-available-p 'unknown)) -;;; Imenu Support - -(defun magit--imenu-create-index () - ;; If `which-function-mode' is active, then the create-index - ;; function is called at the time the major-mode is being enabled. - ;; Modes that derive from `magit-mode' have not populated the buffer - ;; at that time yet, so we have to abort. - (and magit-root-section - (or magit--imenu-group-types - magit--imenu-item-types) - (let ((index - (cl-mapcan - (lambda (section) - (cond - (magit--imenu-group-types - (and (if (eq (car-safe magit--imenu-group-types) 'not) - (not (magit-section-match - (cdr magit--imenu-group-types) - section)) - (magit-section-match magit--imenu-group-types section)) - (and-let* ((children (oref section children))) - `((,(magit--imenu-index-name section) - ,@(mapcar (lambda (s) - (cons (magit--imenu-index-name s) - (oref s start))) - children)))))) - (magit--imenu-item-types - (and (magit-section-match magit--imenu-item-types section) - `((,(magit--imenu-index-name section) - . ,(oref section start))))))) - (oref magit-root-section children)))) - (if (and magit--imenu-group-types (symbolp magit--imenu-group-types)) - (cdar index) - index)))) - -(defun magit--imenu-index-name (section) - (let ((heading (buffer-substring-no-properties - (oref section start) - (1- (or (oref section content) - (oref section end)))))) - (save-match-data - (cond - ((and (magit-section-match [commit logbuf] section) - (string-match "[^ ]+\\([ *|]*\\).+" heading)) - (replace-match " " t t heading 1)) - ((magit-section-match - '([branch local branchbuf] [tag tags branchbuf]) section) - (oref section value)) - ((magit-section-match [branch remote branchbuf] section) - (concat (oref (oref section parent) value) "/" - (oref section value))) - ((string-match " ([0-9]+)\\'" heading) - (substring heading 0 (match-beginning 0))) - (t heading))))) - -(defun magit--imenu-goto-function (_name position &rest _rest) - "Go to the section at POSITION. -Make sure it is visible, by showing its ancestors where -necessary. For use as `imenu-default-goto-function' in -`magit-mode' buffers." - (goto-char position) - (let ((section (magit-current-section))) - (while (setq section (oref section parent)) - (when (oref section hidden) - (magit-section-show section))))) - -;;; Bookmark support - -(declare-function bookmark-get-filename "bookmark" (bookmark-name-or-record)) -(declare-function bookmark-make-record-default "bookmark" - (&optional no-file no-context posn)) -(declare-function bookmark-prop-get "bookmark" (bookmark-name-or-record prop)) -(declare-function bookmark-prop-set "bookmark" (bookmark-name-or-record prop val)) - -(defun magit--make-bookmark () - "Create a bookmark for the current Magit buffer. -Input values are the major-mode's `magit-bookmark-name' method, -and the buffer-local values of the variables referenced in its -`magit-bookmark-variables' property." - (require 'bookmark) - (if (plist-member (symbol-plist major-mode) 'magit-bookmark-variables) - ;; `bookmark-make-record-default's return value does not match - ;; (NAME . ALIST), even though it is used as the default value - ;; of `bookmark-make-record-function', which states that such - ;; functions must do that. See #4356. - (let ((bookmark (cons nil (bookmark-make-record-default 'no-file)))) - (bookmark-prop-set bookmark 'handler #'magit--handle-bookmark) - (bookmark-prop-set bookmark 'mode major-mode) - (bookmark-prop-set bookmark 'filename (magit-toplevel)) - (bookmark-prop-set bookmark 'defaults (list (magit-bookmark-name))) - (dolist (var (get major-mode 'magit-bookmark-variables)) - (bookmark-prop-set bookmark var (symbol-value var))) - (bookmark-prop-set - bookmark 'magit-hidden-sections - (--keep (and (oref it hidden) - (cons (oref it type) - (if (derived-mode-p 'magit-stash-mode) - (string-replace magit-buffer-revision - magit-buffer-revision-hash - (oref it value)) - (oref it value)))) - (oref magit-root-section children))) - bookmark) - (user-error "Bookmarking is not implemented for %s buffers" major-mode))) - -(defun magit--handle-bookmark (bookmark) - "Open a bookmark created by `magit--make-bookmark'. -Call the `magit-*-setup-buffer' function of the the major-mode -with the variables' values as arguments, which were recorded by -`magit--make-bookmark'. Ignore `magit-display-buffer-function'." - (let ((buffer (let ((default-directory (bookmark-get-filename bookmark)) - (mode (bookmark-prop-get bookmark 'mode)) - (magit-display-buffer-function #'identity) - (magit-display-buffer-noselect t)) - (apply (intern (format "%s-setup-buffer" - (substring (symbol-name mode) 0 -5))) - (--map (bookmark-prop-get bookmark it) - (get mode 'magit-bookmark-variables)))))) - (set-buffer buffer) ; That is the interface we have to adhere to. - (when-let ((hidden (bookmark-prop-get bookmark 'magit-hidden-sections))) - (with-current-buffer buffer - (dolist (child (oref magit-root-section children)) - (if (member (cons (oref child type) - (oref child value)) - hidden) - (magit-section-hide child) - (magit-section-show child))))) - ;; Compatibility with `bookmark+' package. See #4356. - (when (bound-and-true-p bmkp-jump-display-function) - (funcall bmkp-jump-display-function (current-buffer))) - nil)) - -(put 'magit--handle-bookmark 'bookmark-handler-type "Magit") - -(cl-defgeneric magit-bookmark-name () - "Return name for bookmark to current buffer." - (format "%s%s" - (substring (symbol-name major-mode) 0 -5) - (if-let ((vars (get major-mode 'magit-bookmark-variables))) - (cl-mapcan (lambda (var) - (let ((val (symbol-value var))) - (if (and val (atom val)) - (list val) - val))) - vars) - ""))) - ;;; Utilities (defun magit-toggle-verbose-refresh () diff --git a/elpa/magit-20231219.2243/magit-notes.el b/elpa/magit-20240522.204/magit-notes.el similarity index 97% rename from elpa/magit-20231219.2243/magit-notes.el rename to elpa/magit-20240522.204/magit-notes.el index 12bac89b..08fcc303 100644 --- a/elpa/magit-20231219.2243/magit-notes.el +++ b/elpa/magit-20240522.204/magit-notes.el @@ -1,9 +1,9 @@ ;;; magit-notes.el --- Notes support -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-patch.el b/elpa/magit-20240522.204/magit-patch.el similarity index 98% rename from elpa/magit-20231219.2243/magit-patch.el rename to elpa/magit-20240522.204/magit-patch.el index b38c9baf..bd91fb45 100644 --- a/elpa/magit-20231219.2243/magit-patch.el +++ b/elpa/magit-20240522.204/magit-patch.el @@ -1,9 +1,9 @@ ;;; magit-patch.el --- Creating and applying patches -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20240522.204/magit-pkg.el b/elpa/magit-20240522.204/magit-pkg.el new file mode 100644 index 00000000..2c4e6990 --- /dev/null +++ b/elpa/magit-20240522.204/magit-pkg.el @@ -0,0 +1,20 @@ +(define-package "magit" "20240522.204" "A Git porcelain inside Emacs." + '((emacs "26.1") + (compat "29.1.4.5") + (dash "20240405") + (git-commit "20240429") + (magit-section "20240429") + (seq "2.24") + (transient "20240421") + (with-editor "20240415")) + :commit "f9268a959828d0c6ab26171dd2fb1ffc55e5ae70" :authors + '(("Marius Vollmer" . "marius.vollmer@gmail.com") + ("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev")) + :maintainer + '("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev") + :keywords + '("git" "tools" "vc") + :url "https://github.com/magit/magit") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/magit-20231219.2243/magit-process.el b/elpa/magit-20240522.204/magit-process.el similarity index 96% rename from elpa/magit-20231219.2243/magit-process.el rename to elpa/magit-20240522.204/magit-process.el index 69bb6e36..9f74469d 100644 --- a/elpa/magit-20231219.2243/magit-process.el +++ b/elpa/magit-20240522.204/magit-process.el @@ -1,9 +1,9 @@ ;;; magit-process.el --- Process functionality -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -35,6 +35,7 @@ (require 'magit-mode) (require 'ansi-color) +(require 'auth-source) (require 'with-editor) (defvar y-or-n-p-map) @@ -257,6 +258,26 @@ string in the heading of its section." :group 'magit-process :type '(choice (const :tag "none" nil) string)) +(defvar tramp-pipe-stty-settings) +(defvar magit-tramp-pipe-stty-settings "" + "Override `tramp-pipe-stty-settings' in `magit-start-process'. + +The default for that Tramp variable is \"-icanon min 1 time 0\", +which causes staging of individual hunks to hang. Using \"\" +prevents that, but apparently has other issues, which is why it +isn't the default. + +This variable defaults to \"\" and is used to override the Tramp +variable in `magit-start-process'. This only has an effect when +using Tramp 2.6.2 or greater. This can also be set to `pty', in +which case a pty is used instead of a pipe. That also prevents +the hanging, but comes with its own problems (see #20). To fall +back to the value of `tramp-pipe-stty-settings', set this +variable to nil. + +Also see https://github.com/magit/magit/issues/4720 +and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62093.") + (defface magit-process-ok '((t :inherit magit-section-heading :foreground "green")) "Face for zero exit-status." @@ -427,10 +448,9 @@ conversion." (apply #'process-file process infile buffer display args))) (defun magit-process-environment () - ;; The various w32 hacks are only applicable when running on the - ;; local machine. As of Emacs 25.1, a local binding of - ;; process-environment different from the top-level value affects - ;; the environment used in + ;; The various w32 hacks are only applicable when running on the local + ;; machine. A local binding of process-environment different from the + ;; top-level value affects the environment used in ;; tramp-sh-handle-{start-file-process,process-file}. (let ((local (not (file-remote-p default-directory)))) (append magit-git-environment @@ -580,10 +600,20 @@ Magit status buffer." ((`(,process-buf . ,section) (magit-process-setup program args)) (process - (let ((process-connection-type - ;; Don't use a pty, because it would set icrnl - ;; which would modify the input (issue #20). - (and (not input) magit-process-connection-type)) + (let ((process-connection-type ;t=pty nil=pipe + (or + ;; With Tramp, maybe force use a pty. #4720 + (and (file-remote-p default-directory) + (eq magit-tramp-pipe-stty-settings 'pty)) + ;; Without input, don't use a pty, because it would + ;; set icrnl, which would modify the input. #20 + (and (not input) magit-process-connection-type))) + (tramp-pipe-stty-settings + (or (and (not (eq magit-tramp-pipe-stty-settings 'pty)) + ;; Defaults to "", to allow staging hunks over + ;; Tramp again. #4720 + magit-tramp-pipe-stty-settings) + tramp-pipe-stty-settings)) (process-environment (magit-process-environment)) (default-process-coding-system (magit--process-coding-system))) (apply #'start-file-process @@ -639,6 +669,11 @@ Magit status buffer." ;;; Process Internals +(defclass magit-process-section (magit-section) + ((process :initform nil))) + +(setf (alist-get 'process magit--section-type-alist) 'magit-process-section) + (defun magit-process-setup (program args) (magit-process-set-mode-line program args) (let ((pwd default-directory) @@ -740,7 +775,7 @@ Magit status buffer." (when (memq (process-status process) '(exit signal)) (magit-process-sentinel process event) (when-let* ((process-buf (process-buffer process)) - (- (buffer-live-p process-buf)) + ((buffer-live-p process-buf)) (status-buf (with-current-buffer process-buf (magit-get-mode-buffer 'magit-status-mode)))) (with-current-buffer status-buf diff --git a/elpa/magit-20231219.2243/magit-pull.el b/elpa/magit-20240522.204/magit-pull.el similarity index 97% rename from elpa/magit-20231219.2243/magit-pull.el rename to elpa/magit-20240522.204/magit-pull.el index 819e294a..ae50cde5 100644 --- a/elpa/magit-20231219.2243/magit-pull.el +++ b/elpa/magit-20240522.204/magit-pull.el @@ -1,9 +1,9 @@ ;;; magit-pull.el --- Update local objects and refs -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-push.el b/elpa/magit-20240522.204/magit-push.el similarity index 97% rename from elpa/magit-20231219.2243/magit-push.el rename to elpa/magit-20240522.204/magit-push.el index 46a95fde..ddeeec94 100644 --- a/elpa/magit-20231219.2243/magit-push.el +++ b/elpa/magit-20240522.204/magit-push.el @@ -1,9 +1,9 @@ ;;; magit-push.el --- Update remote objects and refs -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -340,9 +340,9 @@ what this command will do. To add it use something like: ((not (string-match "/" ref)) (magit--propertize-face (format "%s/%s" remote ref) 'magit-branch-remote)) - (t (format "%s as %s" - (magit--propertize-face remote 'bold) - (magit--propertize-face ref 'bold))))) + ((format "%s as %s" + (magit--propertize-face remote 'bold) + (magit--propertize-face ref 'bold))))) "nothing (no upstream)"))) ("matching" (format "all matching to %s" (magit--propertize-face remote 'bold))))))))) diff --git a/elpa/magit-20231219.2243/magit-reflog.el b/elpa/magit-20240522.204/magit-reflog.el similarity index 97% rename from elpa/magit-20231219.2243/magit-reflog.el rename to elpa/magit-20240522.204/magit-reflog.el index b64e39d4..bb5cddbe 100644 --- a/elpa/magit-20231219.2243/magit-reflog.el +++ b/elpa/magit-20240522.204/magit-reflog.el @@ -1,9 +1,9 @@ ;;; magit-reflog.el --- Inspect ref history -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-refs.el b/elpa/magit-20240522.204/magit-refs.el similarity index 97% rename from elpa/magit-20231219.2243/magit-refs.el rename to elpa/magit-20240522.204/magit-refs.el index 6b5cc877..ee6b1e9a 100644 --- a/elpa/magit-20231219.2243/magit-refs.el +++ b/elpa/magit-20240522.204/magit-refs.el @@ -1,9 +1,9 @@ ;;; magit-refs.el --- Listing references -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -357,7 +357,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (and-let* ((buffer (magit-get-mode-buffer 'magit-refs-mode nil (eq use-buffer-args 'selected)))) - (progn ; work around debbugs#31840 + (progn (setq args (buffer-local-value 'magit-buffer-arguments buffer)) t)))) (t @@ -578,14 +578,18 @@ line is inserted at all." (cl-substitute nil "" (split-string line "\0") :test #'equal))) - (if head-branch - ;; Note: Use `ref' instead of `branch' for the check - ;; below because 'refname:short' shortens the remote - ;; HEAD to '' instead of '/HEAD' as of - ;; Git v2.40.0. - (progn (cl-assert - (equal ref (concat "refs/remotes/" remote "/HEAD"))) - (setq head head-branch)) + (cond + (head-branch + ;; Note: Use `ref' instead of `branch' for the check + ;; below because 'refname:short' shortens the remote + ;; HEAD to '' instead of '/HEAD' as of + ;; Git v2.40.0. + (cl-assert + (equal ref (concat "refs/remotes/" remote "/HEAD"))) + (setq head head-branch)) + ((not (equal ref (concat "refs/remotes/" remote "/HEAD"))) + ;; ^ Skip mis-configured remotes where HEAD is not a + ;; symref. See #5092. (when (magit-refs--insert-refname-p branch) (magit-insert-section (branch branch t) (let ((headp (equal branch head)) @@ -605,7 +609,7 @@ line is inserted at all." (and msg (magit-log-propertize-keywords nil msg)))) (when (magit-buffer-margin-p) (magit-refs--format-margin branch)) - (magit-refs--insert-cherry-commits branch))))))) + (magit-refs--insert-cherry-commits branch)))))))) (insert ?\n) (magit-make-margin-overlay nil t)))) @@ -616,9 +620,9 @@ line is inserted at all." (dolist (line (magit-refs--format-local-branches)) (pcase-let ((`(,branch . ,strings) line)) (magit-insert-section - ((eval (if branch 'branch 'commit)) - (or branch (magit-rev-parse "HEAD")) - t) + ((eval (if branch 'branch 'commit)) + (or branch (magit-rev-parse "HEAD")) + t) (apply #'magit-insert-heading strings) (when (magit-buffer-margin-p) (magit-refs--format-margin branch)) diff --git a/elpa/magit-20231219.2243/magit-remote.el b/elpa/magit-20240522.204/magit-remote.el similarity index 98% rename from elpa/magit-20231219.2243/magit-remote.el rename to elpa/magit-20240522.204/magit-remote.el index e010c92d..3cc22b88 100644 --- a/elpa/magit-20231219.2243/magit-remote.el +++ b/elpa/magit-20240522.204/magit-remote.el @@ -1,9 +1,9 @@ ;;; magit-remote.el --- Transfer Git commits -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-repos.el b/elpa/magit-20240522.204/magit-repos.el similarity index 98% rename from elpa/magit-20231219.2243/magit-repos.el rename to elpa/magit-20240522.204/magit-repos.el index 892d093e..769f29aa 100644 --- a/elpa/magit-20231219.2243/magit-repos.el +++ b/elpa/magit-20240522.204/magit-repos.el @@ -1,9 +1,9 @@ ;;; magit-repos.el --- Listing repositories -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -379,7 +379,8 @@ Usually this is just its basename." (when (match-end 2) (magit--put-face (match-beginning 2) (match-end 2) 'bold v)) (when (match-end 4) - (magit--put-face (match-beginning 4) (match-end 4) 'error v)) + (magit--put-face (or (match-beginning 3) (match-beginning 4)) + (match-end 4) 'error v)) (when (and (equal (match-string 2 v) "1") (string-match-p magit-repolist-column-version-resume-regexp (magit-rev-format "%s"))) @@ -504,7 +505,7 @@ instead." (defun magit-list-repos-1 (directory depth) (cond ((file-readable-p (expand-file-name ".git" directory)) (list (file-name-as-directory directory))) - ((and (> depth 0) (magit-file-accessible-directory-p directory)) + ((and (> depth 0) (file-accessible-directory-p directory)) (--mapcat (and (file-directory-p it) (magit-list-repos-1 it (1- depth))) (directory-files directory t diff --git a/elpa/magit-20231219.2243/magit-reset.el b/elpa/magit-20240522.204/magit-reset.el similarity index 96% rename from elpa/magit-20231219.2243/magit-reset.el rename to elpa/magit-20240522.204/magit-reset.el index 1d52b2a6..c576a175 100644 --- a/elpa/magit-20231219.2243/magit-reset.el +++ b/elpa/magit-20240522.204/magit-reset.el @@ -1,9 +1,9 @@ ;;; magit-reset.el --- Reset functionality -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-sequence.el b/elpa/magit-20240522.204/magit-sequence.el similarity index 99% rename from elpa/magit-20231219.2243/magit-sequence.el rename to elpa/magit-20240522.204/magit-sequence.el index bda39105..b4e9f51f 100644 --- a/elpa/magit-20231219.2243/magit-sequence.el +++ b/elpa/magit-20240522.204/magit-sequence.el @@ -1,9 +1,9 @@ ;;; magit-sequence.el --- History manipulation in Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-sparse-checkout.el b/elpa/magit-20240522.204/magit-sparse-checkout.el similarity index 98% rename from elpa/magit-20231219.2243/magit-sparse-checkout.el rename to elpa/magit-20240522.204/magit-sparse-checkout.el index 5e2f8808..a57d2301 100644 --- a/elpa/magit-20231219.2243/magit-sparse-checkout.el +++ b/elpa/magit-20240522.204/magit-sparse-checkout.el @@ -1,9 +1,9 @@ ;;; magit-sparse-checkout.el --- Sparse checkout support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors ;; Author: Kyle Meyer -;; Maintainer: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-stash.el b/elpa/magit-20240522.204/magit-stash.el similarity index 98% rename from elpa/magit-20231219.2243/magit-stash.el rename to elpa/magit-20240522.204/magit-stash.el index e01b5908..65f21892 100644 --- a/elpa/magit-20231219.2243/magit-stash.el +++ b/elpa/magit-20240522.204/magit-stash.el @@ -1,9 +1,9 @@ ;;; magit-stash.el --- Stash support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -607,13 +607,11 @@ If there is no stash buffer in the same frame, then do nothing." "Insert section showing notes for a stash. This shows the notes for stash@{N} but not for the other commits that make up the stash." - (magit-insert-section section (note) + (magit-insert-section (note) (magit-insert-heading "Notes") (magit-git-insert "notes" "show" magit-buffer-revision) - (if (= (point) - (oref section content)) - (magit-cancel-section) - (insert "\n")))) + (magit-cancel-section 'if-empty) + (insert "\n"))) (defun magit-insert-stash-index () "Insert section showing staged changes of the stash." diff --git a/elpa/magit-20231219.2243/magit-status.el b/elpa/magit-20240522.204/magit-status.el similarity index 97% rename from elpa/magit-20231219.2243/magit-status.el rename to elpa/magit-20240522.204/magit-status.el index 2deecb49..b2de4d91 100644 --- a/elpa/magit-20231219.2243/magit-status.el +++ b/elpa/magit-20240522.204/magit-status.el @@ -1,9 +1,9 @@ ;;; magit-status.el --- The grand overview -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -404,7 +404,7 @@ Type \\[magit-commit] to create a commit. :group 'magit-status (hack-dir-local-variables-non-file-buffer) (when magit-status-initial-section - (add-hook 'magit-refresh-buffer-hook + (add-hook 'magit-post-create-buffer-hook #'magit-status-goto-initial-section nil t)) (setq magit--imenu-group-types '(not branch commit))) @@ -426,8 +426,8 @@ Type \\[magit-commit] to create a commit. magit-status-use-buffer-arguments)) (file (and magit-status-goto-file-position (magit-file-relative-name))) - (line (and file (line-number-at-pos))) - (col (and file (current-column))) + (line (and file (save-restriction (widen) (line-number-at-pos)))) + (col (and file (save-restriction (widen) (current-column)))) (buf (magit-setup-buffer #'magit-status-mode nil (magit-buffer-diff-args (nth 0 d)) (magit-buffer-diff-files (nth 1 d)) @@ -465,9 +465,7 @@ Type \\[magit-commit] to create a commit. magit-section-initial-visibility-alist)))) (if (eq vis 'hide) (magit-section-hide section) - (magit-section-show section)))) - (remove-hook 'magit-refresh-buffer-hook - #'magit-status-goto-initial-section t)) + (magit-section-show section))))) (defun magit-status-maybe-update-revision-buffer (&optional _) "When moving in the status buffer, update the revision buffer. @@ -706,7 +704,8 @@ remote in alphabetic order." "<2>" (magit-menu-item "Discard files" #'magit-discard) "<1>" (magit-menu-item "Stage files" #'magit-stage)) -(magit-define-section-jumper magit-jump-to-untracked "Untracked files" untracked) +(magit-define-section-jumper magit-jump-to-untracked + "Untracked files" untracked) (defun magit-insert-untracked-files () "Maybe insert a list or tree of untracked files. @@ -772,7 +771,8 @@ of that variable can be set using \"D -- DIRECTORY RET g\"." (magit-insert-files files base) (insert ?\n))))) -(magit-define-section-jumper magit-jump-to-skip-worktree "Skip-worktree files" skip-worktree) +(magit-define-section-jumper magit-jump-to-skip-worktree + "Skip-worktree files" skip-worktree) (defun magit-insert-skip-worktree-files () "Insert a tree of skip-worktree files. @@ -788,7 +788,8 @@ of that variable can be set using \"D -- DIRECTORY RET g\"." (magit-insert-files files base) (insert ?\n))))) -(magit-define-section-jumper magit-jump-to-assume-unchanged "Assume-unchanged files" assume-unchanged) +(magit-define-section-jumper magit-jump-to-assume-unchanged + "Assume-unchanged files" assume-unchanged) (defun magit-insert-assume-unchanged-files () "Insert a tree of files that are assumed to be unchanged. diff --git a/elpa/magit-20231219.2243/magit-submodule.el b/elpa/magit-20240522.204/magit-submodule.el similarity index 96% rename from elpa/magit-20231219.2243/magit-submodule.el rename to elpa/magit-20240522.204/magit-submodule.el index a311247a..a6b77047 100644 --- a/elpa/magit-20231219.2243/magit-submodule.el +++ b/elpa/magit-20240522.204/magit-submodule.el @@ -1,9 +1,9 @@ ;;; magit-submodule.el --- Submodule support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -346,8 +346,8 @@ With a prefix argument act on all suitable modules. Otherwise, if the region selects modules, then act on those. Otherwise, if there is a module at point, then act on that. Otherwise read a single module from the user." - ;; Even though a package is "uninitialized" (it has no worktree) - ;; the super-projects $GIT_DIR/config may never-the-less set the + ;; Even when a submodule is "uninitialized" (it has no worktree) + ;; the super-project's $GIT_DIR/config may never-the-less set the ;; module's url. This may happen if you `deinit' and then `init' ;; to register (NOT initialize). Because the purpose of `deinit' ;; is to remove the working directory AND to remove the url, this @@ -488,7 +488,7 @@ or, failing that, the abbreviated HEAD commit hash." (dolist (module modules) (let ((default-directory (expand-file-name (file-name-as-directory module)))) - (magit-insert-section (magit-module-section module t) + (magit-insert-section (module module t) (insert (propertize (format path-format module) 'font-lock-face 'magit-diff-file-heading)) (if (not (file-exists-p ".git")) @@ -590,7 +590,7 @@ These sections can be expanded to show the respective commits." "For internal use, don't add to a hook." (unless (magit-ignore-submodules-p) (when-let ((modules (magit-list-module-paths))) - (magit-insert-section section ((eval type) nil t) + (magit-insert-section ((eval type) nil t) (string-match "\\`\\(.+\\) \\([^ ]+\\)\\'" heading) (magit-insert-heading (propertize (match-string 1 heading) @@ -604,23 +604,22 @@ These sections can be expanded to show the respective commits." (when (magit-module-worktree-p module) (let ((default-directory (expand-file-name (file-name-as-directory module)))) - (when (magit-file-accessible-directory-p default-directory) - (magit-insert-section sec (magit-module-section module t) + (when (file-accessible-directory-p default-directory) + (magit-insert-section + ( module module t + :range range) (magit-insert-heading (propertize module 'font-lock-face 'magit-diff-file-heading) ":") - (oset sec range range) - (magit-git-wash - (apply-partially #'magit-log-wash-log 'module) - "-c" "push.default=current" "log" "--oneline" range) - (when (> (point) - (oref sec content)) - (delete-char -1)))))))) - (if (> (point) - (oref section content)) - (insert ?\n) - (magit-cancel-section)))))) + (let ((pos (point))) + (magit-git-wash + (apply-partially #'magit-log-wash-log 'module) + "-c" "push.default=current" "log" "--oneline" range) + (when (> (point) pos) + (delete-char -1))))))))) + (magit-cancel-section 'if-empty) + (insert ?\n))))) ;;; List diff --git a/elpa/magit-20231219.2243/magit-subtree.el b/elpa/magit-20240522.204/magit-subtree.el similarity index 97% rename from elpa/magit-20231219.2243/magit-subtree.el rename to elpa/magit-20240522.204/magit-subtree.el index dae1661c..e56c47c6 100644 --- a/elpa/magit-20231219.2243/magit-subtree.el +++ b/elpa/magit-20240522.204/magit-subtree.el @@ -1,9 +1,9 @@ ;;; magit-subtree.el --- Subtree support for Magit -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-tag.el b/elpa/magit-20240522.204/magit-tag.el similarity index 94% rename from elpa/magit-20231219.2243/magit-tag.el rename to elpa/magit-20240522.204/magit-tag.el index b49e48b3..13a34740 100644 --- a/elpa/magit-20231219.2243/magit-tag.el +++ b/elpa/magit-20240522.204/magit-tag.el @@ -1,9 +1,9 @@ ;;; magit-tag.el --- Tag functionality -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -199,13 +199,13 @@ like \"/path/to/foo-bar\"." (replace-match ver t t pmsg)) ((and ptag (string-match (regexp-quote ptag) pmsg)) (replace-match tag t t pmsg)) - (t (format "%s %s" - (capitalize - (file-name-nondirectory - (directory-file-name (magit-toplevel)))) - ver))))) + ((format "%s %s" + (capitalize + (file-name-nondirectory + (directory-file-name (magit-toplevel)))) + ver))))) args)))) - (magit-run-git-async "tag" args (and msg (list "-m" msg)) tag) + (magit-run-git-with-editor "tag" args (and msg (list "-m" msg)) tag) (set-process-sentinel magit-this-process (lambda (process event) diff --git a/elpa/magit-20231219.2243/magit-transient.el b/elpa/magit-20240522.204/magit-transient.el similarity index 97% rename from elpa/magit-20231219.2243/magit-transient.el rename to elpa/magit-20240522.204/magit-transient.el index 364c20ac..06b0f12e 100644 --- a/elpa/magit-20231219.2243/magit-transient.el +++ b/elpa/magit-20240522.204/magit-transient.el @@ -1,9 +1,9 @@ ;;; magit-transient.el --- Support for transients -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit-wip.el b/elpa/magit-20240522.204/magit-wip.el similarity index 97% rename from elpa/magit-20231219.2243/magit-wip.el rename to elpa/magit-20240522.204/magit-wip.el index 2c522a6f..3cbdeeec 100644 --- a/elpa/magit-20231219.2243/magit-wip.el +++ b/elpa/magit-20240522.204/magit-wip.el @@ -1,9 +1,9 @@ ;;; magit-wip.el --- Commit snapshots to work-in-progress refs -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -359,9 +359,9 @@ commit message." (setq msg (concat (cond ((= len 0) "autosave tracked files") ((> len 1) (format "autosave %s files" len)) - (t (concat "autosave " - (file-relative-name (car files) - (magit-toplevel))))) + ((concat "autosave " + (file-relative-name (car files) + (magit-toplevel))))) msg)))) (magit-update-ref wipref msg (magit-git-string "commit-tree" "--no-gpg-sign" @@ -461,7 +461,7 @@ many \"branches\" of each wip ref are shown." (while (and reflog (> count 1)) ;; "start autosaving ..." is the current message, but it used ;; to be "restart autosaving ...", and those messages may - ;; still be around (e.g., if gc.reflogExpire is to "never"). + ;; still be around (e.g., if gc.reflogExpire is set to "never"). (setq reflog (cl-member "^[^ ]+ [^:]+: \\(?:re\\)?start autosaving" reflog :test #'string-match-p)) (when (and (cadr reflog) diff --git a/elpa/magit-20231219.2243/magit-worktree.el b/elpa/magit-20240522.204/magit-worktree.el similarity index 97% rename from elpa/magit-20231219.2243/magit-worktree.el rename to elpa/magit-20240522.204/magit-worktree.el index dd19a11e..63c49bd4 100644 --- a/elpa/magit-20231219.2243/magit-worktree.el +++ b/elpa/magit-20240522.204/magit-worktree.el @@ -1,9 +1,9 @@ ;;; magit-worktree.el --- Worktree support -*- lexical-binding:t -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; SPDX-License-Identifier: GPL-3.0-or-later diff --git a/elpa/magit-20231219.2243/magit.el b/elpa/magit-20240522.204/magit.el similarity index 98% rename from elpa/magit-20231219.2243/magit.el rename to elpa/magit-20240522.204/magit.el index 7fdfcc97..f7775994 100644 --- a/elpa/magit-20231219.2243/magit.el +++ b/elpa/magit-20240522.204/magit.el @@ -1,10 +1,10 @@ ;;; magit.el --- A Git porcelain inside Emacs -*- lexical-binding:t; coding:utf-8 -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors ;; Author: Marius Vollmer -;; Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; Kyle Meyer ;; Former-Maintainers: ;; Nicolas Dudebout @@ -19,13 +19,13 @@ ;; Package-Version: 3.3.0.50-git ;; Package-Requires: ( -;; (emacs "25.1") -;; (compat "29.1.4.4") +;; (emacs "26.1") +;; (compat "29.1.4.5") ;; (dash "2.19.1") ;; (git-commit "3.3.0") ;; (magit-section "3.3.0") ;; (seq "2.24") -;; (transient "0.5.0") +;; (transient "0.6.0") ;; (with-editor "3.3.2")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -483,8 +483,9 @@ is run in the top-level directory of the current working tree." (let ((default-directory (or directory default-directory))) (with-environment-variables (("GIT_PAGER" "cat")) (magit--with-connection-local-variables - (magit-start-process shell-file-name nil - shell-command-switch command)))) + (magit-with-editor + (magit-start-process shell-file-name nil + shell-command-switch command))))) (magit-process-buffer)) (defun magit-read-shell-command (&optional toplevel initial-input) diff --git a/elpa/magit-20231219.2243/magit.info b/elpa/magit-20240522.204/magit.info similarity index 98% rename from elpa/magit-20231219.2243/magit.info rename to elpa/magit-20240522.204/magit.info index b562bd26..94de5fe9 100644 --- a/elpa/magit-20231219.2243/magit.info +++ b/elpa/magit-20240522.204/magit.info @@ -1,6 +1,7 @@ This is magit.info, produced by makeinfo version 6.7 from magit.texi. - Copyright (C) 2015-2023 Jonas Bernoulli + Copyright (C) 2015-2024 Jonas Bernoulli + You can redistribute this document and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +34,8 @@ itself deserve to be called porcelains. This manual is for Magit version 3.3.0.50-git. - Copyright (C) 2015-2023 Jonas Bernoulli + Copyright (C) 2015-2024 Jonas Bernoulli + You can redistribute this document and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -668,7 +670,7 @@ a file, but then only a subset of the commands is available. The global key bindings mentioned in the previous two paragraphs are quite inconvenient. We recommend using ‘C-c g’ and ‘C-c f’ instead, but -cannot use those key sequences by default because they are strickly +cannot use those key sequences by default because they are strictly reserved for bindings added by the user. See *note Global Bindings::, if you want to explicitly opt-in to the recommended key bindings. @@ -1343,9 +1345,22 @@ but all you need to get started are the next two. ‘’ (‘magit-section-toggle’) Toggle the visibility of the body of the current section. +‘C-c ’ (‘magit-section-cycle’) ‘C-’ (‘magit-section-cycle’) Cycle the visibility of current section and its children. + If this command is invoked using ‘C-’ and that is globally + bound to ‘tab-next’, then this command pivots to behave like that + command, and you must instead use ‘C-c TAB’ to cycle section + visibility. + + If you would like to keep using ‘C-’ to cycle section + visibility but also want to use ‘tab-bar-mode’, then you have to + prevent that mode from using this key and instead bind another key + to ‘tab-next’. Because ‘tab-bar-mode’ does not use a mode map but + instead manipulates the global map, this involves advising + ‘tab-bar--define-keys’. + ‘M-’ (‘magit-section-cycle-diffs’) Cycle the visibility of diff-related sections in the current buffer. @@ -1815,11 +1830,11 @@ telling Magit to ask fewer questions. bisect operation loses all information collected so far. • ‘abort-cherry-pick’ Aborting a cherry-pick throws away - all conflict resolutions which has already been carried + all conflict resolutions which have already been carried out by the user. • ‘abort-revert’ Aborting a revert throws away all conflict - resolutions which has already been carried out by the + resolutions which have already been carried out by the user. • ‘abort-rebase’ Aborting a rebase throws away all already @@ -2156,13 +2171,11 @@ You will also have to install the ‘ido-completing-read+’ package and use FALLBACK is not, then this function always asks the user to choose a candidate, just as if both defaults were ‘nil’. - • ": " is appended to PROMPT. - - • PROMPT is modified to end with \" (default DEF|FALLBACK): \" - provided that DEF or FALLBACK is non-nil, that neither - ‘ivy-mode’ nor ‘helm-mode’ is enabled, and that - ‘magit-completing-read-function’ is set to its default value - of ‘magit-builtin-completing-read’. + • ‘format-prompt’ is called on PROMPT and DEF (or FALLBACK if + DEF is ‘nil’). This appends ": " to the prompt and may also + add the default to the prompt, using the format specified by + ‘minibuffer-default-prompt-format’ and depending on + ‘magit-completing-read-default-prompt-predicate’.  File: magit.info, Node: Additional Completion Options, Prev: Support for Completion Frameworks, Up: Completion Confirmation and the Selection @@ -2868,9 +2881,6 @@ File: magit.info, Node: Status Options, Prev: Status Module Sections, Up: Sta 5.1.4 Status Options -------------------- - -- User Option: magit-status-refresh-hook - Hook run after a status buffer has been refreshed. - -- User Option: magit-status-margin This option specifies whether the margin is initially shown in Magit-Status mode buffers and how it is formatted. @@ -3923,7 +3933,7 @@ information on how to use Ediff itself, see *note (ediff)Top::. already resolved some conflicts, that means that these buffers may not contain the actual versions from the respective blobs. -‘E m’ (‘magit-ediff-resolve-all’) +‘E M’ (‘magit-ediff-resolve-all’) This command allows you to resolve all conflicts in the file at point using Ediff. If there is no file at point or if it doesn’t have any unmerged changes, then this command prompts for a file. @@ -7021,9 +7031,10 @@ and the push-remote, see *note The Two Remotes::. ‘f a’ (‘magit-fetch-all’) This command fetches from all remotes. -‘f m’ (‘magit-submodule-fetch’) - This command fetches all submodules. With a prefix argument it - fetches all remotes of all submodules. +‘f m’ (‘magit-fetch-modules’) + This command fetches all submodules. With a prefix argument, it + acts as a transient prefix command, allowing the caller to set + options. -- User Option: magit-pull-or-fetch By default fetch and pull commands are available from separate @@ -7483,12 +7494,12 @@ modules. This command displays a list of the current repository’s modules. ‘o f’ (‘magit-fetch-modules’) - This command fetches all populated modules. + This command fetches all populated modules. With a prefix + argument, it acts as a transient prefix command, allowing the + caller to set options. - Option ‘magit-fetch-modules-jobs’ controls how many submodules are - being fetched in parallel. Also fetch the super-repository, - because ‘git fetch’ does not support not doing that. With a prefix - argument fetch all remotes. + Also fetch the super-repository, because ‘git fetch’ does not + support not doing that.  File: magit.info, Node: Subtree, Next: Worktree, Prev: Submodules, Up: Miscellaneous @@ -7944,7 +7955,7 @@ By default Magit defines a few global key bindings. These bindings are a compromise between providing no bindings at all and providing the better bindings I would have liked to use instead. Magit cannot provide the set of recommended bindings by default because those key sequences -are stricktly reserved for bindings added by the user. Also see *note +are strictly reserved for bindings added by the user. Also see *note Global Bindings:: and *note (elisp)Key Binding Conventions::. To use the recommended bindings, add this to your init file and @@ -8311,10 +8322,6 @@ error-prone, but also more costly. Keeping it simple and just re-creating everything from scratch is an old design decision and departing from that will require major refactoring. - I plan to do that in time for the next major release. I also intend -to create logs and diffs asynchronously, which should also help a lot -but also requires major refactoring. - Meanwhile you can tell Magit to only automatically refresh the current Magit buffer, but not the status buffer. If you do that, then the status buffer is only refreshed automatically if it is the current @@ -8323,14 +8330,16 @@ buffer. (setq magit-refresh-status-buffer nil) You should also check whether any third-party packages have added -anything to ‘magit-refresh-buffer-hook’, ‘magit-status-refresh-hook’, -‘magit-pre-refresh-hook’, and ‘magit-post-refresh-hook’. If so, then -check whether those additions impact performance significantly. +anything to ‘magit-refresh-buffer-hook’, ‘magit-pre-refresh-hook’, and +‘magit-post-refresh-hook’. If so, then check whether those additions +impact performance significantly. Magit can be told to refresh buffers verbosely using ‘M-x magit-toggle-verbose-refresh’. Enabling this helps figuring out which -sections are bottlenecks. The additional output can be found in the -‘*Messages*’ buffer. +sections are bottlenecks. Each line printed to the ‘*Messages*’ buffer +contains a section name, the number of seconds it took to show this +section, and from 0 to 2 exclamation marks: the more exclamation marks +the slower the section is. Magit also reverts buffers for visited files located inside the current repository when the visited file changes on disk. That is @@ -9815,10 +9824,10 @@ Appendix C Keystroke Index * -: Log Buffer. (line 67) * - <1>: Refreshing Diffs. (line 62) * 0: Refreshing Diffs. (line 68) -* 1: Section Visibility. (line 26) -* 2: Section Visibility. (line 26) -* 3: Section Visibility. (line 26) -* 4: Section Visibility. (line 26) +* 1: Section Visibility. (line 39) +* 2: Section Visibility. (line 39) +* 3: Section Visibility. (line 39) +* 4: Section Visibility. (line 39) * 5: Repository List. (line 115) * :: Running Git Manually. (line 25) @@ -9886,7 +9895,7 @@ Appendix C Keystroke Index * c w: Initiating a Commit. (line 30) * C-: Visiting Files and Blobs from a Diff. (line 50) -* C-: Section Visibility. (line 13) +* C-: Section Visibility. (line 14) * C-c C-a: Commit Pseudo Headers. (line 16) * C-c C-b: Log Buffer. (line 20) @@ -10058,6 +10067,7 @@ Appendix C Keystroke Index (line 35) * C-c M-s: Editing Commit Messages. (line 33) +* C-c TAB: Section Visibility. (line 14) * C-w: Common Commands. (line 22) * C-x g: Status Buffer. (line 23) * C-x M-g: Transient Commands. (line 20) @@ -10093,7 +10103,7 @@ Appendix C Keystroke Index * E c: Ediffing. (line 100) * E i: Ediffing. (line 94) * E m: Ediffing. (line 33) -* E m <1>: Ediffing. (line 48) +* E M: Ediffing. (line 48) * E r: Ediffing. (line 25) * E s: Ediffing. (line 87) * E t: Ediffing. (line 79) @@ -10174,11 +10184,11 @@ Appendix C Keystroke Index * M r: Remote Commands. (line 52) * m s: Merging. (line 67) * M u: Remote Commands. (line 56) -* M-1: Section Visibility. (line 32) -* M-2: Section Visibility. (line 32) -* M-3: Section Visibility. (line 32) -* M-4: Section Visibility. (line 32) -* M-: Section Visibility. (line 16) +* M-1: Section Visibility. (line 45) +* M-2: Section Visibility. (line 45) +* M-3: Section Visibility. (line 45) +* M-4: Section Visibility. (line 45) +* M-: Section Visibility. (line 29) * M-n: Section Movement. (line 24) * M-n <1>: Editing Commit Messages. (line 41) @@ -10271,7 +10281,7 @@ Appendix C Keystroke Index (line 36) * s <1>: Editing Rebase Sequences. (line 49) -* S-: Section Visibility. (line 20) +* S-: Section Visibility. (line 33) * SPC: Log Buffer. (line 41) * SPC <1>: Commands Available in Diffs. (line 53) @@ -10673,7 +10683,8 @@ Appendix D Function and Command Index * magit-fetch-branch: Fetching. (line 37) * magit-fetch-from-pushremote: Fetching. (line 15) * magit-fetch-from-upstream: Fetching. (line 22) -* magit-fetch-modules: Submodule Transient. (line 51) +* magit-fetch-modules: Fetching. (line 48) +* magit-fetch-modules <1>: Submodule Transient. (line 51) * magit-fetch-other: Fetching. (line 34) * magit-fetch-refspec: Fetching. (line 41) * magit-file-checkout: Resetting. (line 44) @@ -11000,29 +11011,29 @@ Appendix D Function and Command Index * magit-section-backward: Section Movement. (line 11) * magit-section-backward-siblings: Section Movement. (line 19) * magit-section-case: Matching Sections. (line 66) -* magit-section-cycle: Section Visibility. (line 13) -* magit-section-cycle-diffs: Section Visibility. (line 16) -* magit-section-cycle-global: Section Visibility. (line 20) +* magit-section-cycle: Section Visibility. (line 14) +* magit-section-cycle-diffs: Section Visibility. (line 29) +* magit-section-cycle-global: Section Visibility. (line 33) * magit-section-forward: Section Movement. (line 16) * magit-section-forward-siblings: Section Movement. (line 24) -* magit-section-hide: Section Visibility. (line 42) -* magit-section-hide-children: Section Visibility. (line 54) +* magit-section-hide: Section Visibility. (line 55) +* magit-section-hide-children: Section Visibility. (line 67) * magit-section-ident: Matching Sections. (line 10) * magit-section-match: Matching Sections. (line 18) * magit-section-set-window-start: Section Movement. (line 52) -* magit-section-show: Section Visibility. (line 39) -* magit-section-show-children: Section Visibility. (line 49) -* magit-section-show-headings: Section Visibility. (line 45) -* magit-section-show-level-1: Section Visibility. (line 26) -* magit-section-show-level-1-all: Section Visibility. (line 32) -* magit-section-show-level-2: Section Visibility. (line 26) -* magit-section-show-level-2-all: Section Visibility. (line 32) -* magit-section-show-level-3: Section Visibility. (line 26) -* magit-section-show-level-3-all: Section Visibility. (line 32) -* magit-section-show-level-4: Section Visibility. (line 26) -* magit-section-show-level-4-all: Section Visibility. (line 32) +* magit-section-show: Section Visibility. (line 52) +* magit-section-show-children: Section Visibility. (line 62) +* magit-section-show-headings: Section Visibility. (line 58) +* magit-section-show-level-1: Section Visibility. (line 39) +* magit-section-show-level-1-all: Section Visibility. (line 45) +* magit-section-show-level-2: Section Visibility. (line 39) +* magit-section-show-level-2-all: Section Visibility. (line 45) +* magit-section-show-level-3: Section Visibility. (line 39) +* magit-section-show-level-3-all: Section Visibility. (line 45) +* magit-section-show-level-4: Section Visibility. (line 39) +* magit-section-show-level-4-all: Section Visibility. (line 45) * magit-section-toggle: Section Visibility. (line 10) -* magit-section-toggle-children: Section Visibility. (line 57) +* magit-section-toggle-children: Section Visibility. (line 70) * magit-section-up: Section Movement. (line 28) * magit-section-value-if: Matching Sections. (line 57) * magit-sequence-abort: Cherry Picking. (line 91) @@ -11096,7 +11107,6 @@ Appendix D Function and Command Index * magit-status-quick: Status Buffer. (line 70) * magit-submodule: Submodule Transient. (line 7) * magit-submodule-add: Submodule Transient. (line 20) -* magit-submodule-fetch: Fetching. (line 48) * magit-submodule-populate: Submodule Transient. (line 32) * magit-submodule-register: Submodule Transient. (line 26) * magit-submodule-synchronize: Submodule Transient. (line 40) @@ -11327,7 +11337,7 @@ Appendix E Variable Index * magit-process-extreme-logging: Viewing Git Output. (line 56) * magit-process-raise-error: Calling Git for Effect. (line 125) -* magit-pull-or-fetch: Fetching. (line 51) +* magit-pull-or-fetch: Fetching. (line 52) * magit-reflog-margin: Reflog. (line 20) * magit-refresh-args: Refreshing Buffers. (line 52) * magit-refresh-buffer-hook: Automatic Refreshing of Magit Buffers. @@ -11356,19 +11366,18 @@ Appendix E Variable Index * magit-root-section: Matching Sections. (line 81) * magit-save-repository-buffers: Automatic Saving of File-Visiting Buffers. (line 13) -* magit-section-cache-visibility: Section Visibility. (line 82) -* magit-section-initial-visibility-alist: Section Visibility. (line 66) +* magit-section-cache-visibility: Section Visibility. (line 95) +* magit-section-initial-visibility-alist: Section Visibility. (line 79) * magit-section-movement-hook: Section Movement. (line 41) -* magit-section-set-visibility-hook: Section Visibility. (line 92) +* magit-section-set-visibility-hook: Section Visibility. (line 105) * magit-section-show-child-count: Section Options. (line 9) -* magit-section-visibility-indicator: Section Visibility. (line 109) +* magit-section-visibility-indicator: Section Visibility. (line 122) * magit-shell-command-verbose-prompt: Running Git Manually. (line 43) * magit-stashes-margin: Stashing. (line 123) * magit-status-headers-hook: Status Header Sections. (line 17) -* magit-status-margin: Status Options. (line 9) -* magit-status-refresh-hook: Status Options. (line 6) +* magit-status-margin: Status Options. (line 6) * magit-status-sections-hook: Status Sections. (line 10) * magit-submodule-list-columns: Listing Submodules. (line 20) * magit-this-process: Calling Git for Effect. @@ -11409,174 +11418,174 @@ Appendix E Variable Index  Tag Table: -Node: Top754 -Node: Introduction6526 -Node: Installation11242 -Node: Installing from Melpa11572 -Node: Installing from the Git Repository12647 -Node: Post-Installation Tasks15461 -Node: Getting Started16746 -Node: Interface Concepts22557 -Node: Modes and Buffers22936 -Node: Switching Buffers24647 -Node: Naming Buffers29386 -Node: Quitting Windows32461 -Node: Automatic Refreshing of Magit Buffers34396 -Node: Automatic Saving of File-Visiting Buffers37277 -Node: Automatic Reverting of File-Visiting Buffers38461 -Node: Risk of Reverting Automatically43446 -Node: Sections45828 -Node: Section Movement46754 -Node: Section Visibility51628 -Node: Section Hooks57643 -Node: Section Types and Values60049 -Node: Section Options61464 -Node: Transient Commands61935 -Node: Transient Arguments and Buffer Variables63411 -Node: Completion Confirmation and the Selection70428 -Node: Action Confirmation70874 -Node: Completion and Confirmation79377 -Node: The Selection82562 -Node: The hunk-internal region85460 -Node: Support for Completion Frameworks86549 -Node: Additional Completion Options91452 -Node: Mouse Support92050 -Node: Running Git92626 -Node: Viewing Git Output92871 -Node: Git Process Status95575 -Node: Running Git Manually96540 -Node: Git Executable99230 -Node: Global Git Arguments102238 -Node: Inspecting103043 -Node: Status Buffer104200 -Node: Status Sections109211 -Node: Status Header Sections114738 -Node: Status Module Sections117357 -Node: Status Options119854 -Node: Repository List121317 -Node: Logging126095 -Node: Refreshing Logs128937 -Node: Log Buffer130358 -Node: Log Margin135181 -Node: Select from Log138334 -Node: Reflog140544 -Node: Cherries142181 -Node: Diffing144019 -Node: Refreshing Diffs147053 -Node: Commands Available in Diffs150742 -Node: Diff Options153255 -Node: Revision Buffer158718 -Node: Ediffing162038 -Node: References Buffer168088 -Node: References Sections178682 -Node: Bisecting179539 -Node: Visiting Files and Blobs181850 -Node: General-Purpose Visit Commands182378 -Node: Visiting Files and Blobs from a Diff183331 -Node: Blaming186775 -Node: Manipulating193763 -Node: Creating Repository194105 -Node: Cloning Repository194642 -Node: Staging and Unstaging201083 -Node: Staging from File-Visiting Buffers205064 -Node: Applying206170 -Node: Committing208243 -Node: Initiating a Commit208826 -Node: Editing Commit Messages214016 -Node: Using the Revision Stack216789 -Node: Commit Pseudo Headers219834 -Node: Commit Mode and Hooks221129 -Node: Commit Message Conventions223987 -Node: Branching225974 -Node: The Two Remotes226200 -Node: Branch Commands228853 -Node: Branch Git Variables241703 -Node: Auxiliary Branch Commands247077 -Node: Merging248193 -Node: Resolving Conflicts252349 -Node: Rebasing257723 -Node: Editing Rebase Sequences262512 -Node: Information About In-Progress Rebase266728 -Ref: Information About In-Progress Rebase-Footnote-1275841 -Node: Cherry Picking276437 -Node: Reverting280771 -Node: Resetting282190 -Node: Stashing284016 -Node: Transferring290397 -Node: Remotes290619 -Node: Remote Commands290771 -Node: Remote Git Variables294810 -Node: Fetching296081 -Node: Pulling298527 -Node: Pushing299553 -Node: Plain Patches303844 -Node: Maildir Patches305315 -Node: Miscellaneous306794 -Node: Tagging307140 -Node: Notes309033 -Node: Submodules311368 -Node: Listing Submodules311586 -Node: Submodule Transient313734 -Node: Subtree316221 -Node: Worktree318152 -Node: Sparse checkouts319228 -Node: Bundle322004 -Node: Common Commands322379 -Node: Wip Modes325007 -Node: Wip Graph329898 -Node: Legacy Wip Modes332211 -Node: Commands for Buffers Visiting Files335098 -Node: Minor Mode for Buffers Visiting Blobs343326 -Node: Customizing344124 -Node: Per-Repository Configuration345720 -Node: Essential Settings347974 -Node: Safety348320 -Node: Performance350081 -Ref: Log Performance353109 -Ref: Diff Performance354414 -Ref: Refs Buffer Performance355755 -Ref: Committing Performance356330 -Node: Microsoft Windows Performance357312 -Node: MacOS Performance358503 -Ref: MacOS Performance-Footnote-1359526 -Node: Global Bindings359608 -Node: Plumbing361836 -Node: Calling Git362665 -Node: Getting a Value from Git364190 -Node: Calling Git for Effect367918 -Node: Section Plumbing373812 -Node: Creating Sections374040 -Node: Section Selection377936 -Node: Matching Sections379732 -Node: Refreshing Buffers385653 -Node: Conventions388797 -Node: Theming Faces388989 -Node: FAQ397094 -Node: FAQ - How to ...?397532 -Node: How to pronounce Magit?397889 -Node: How to show git's output?398692 -Node: How to install the gitman info manual?399478 -Node: How to show diffs for gpg-encrypted files?400448 -Node: How does branching and pushing work?401044 -Node: Should I disable VC?401377 -Node: FAQ - Issues and Errors401980 -Node: Magit is slow402925 -Node: I changed several thousand files at once and now Magit is unusable403218 -Node: I am having problems committing403944 -Node: I am using MS Windows and cannot push with Magit404425 -Node: I am using macOS and SOMETHING works in shell but not in Magit405043 -Node: Expanding a file to show the diff causes it to disappear405877 -Node: Point is wrong in the COMMIT_EDITMSG buffer406465 -Node: The mode-line information isn't always up-to-date407510 -Node: A branch and tag sharing the same name breaks SOMETHING408573 -Node: My Git hooks work on the command-line but not inside Magit409460 -Node: git-commit-mode isn't used when committing from the command-line410306 -Node: Point ends up inside invisible text when jumping to a file-visiting buffer412577 -Node: I am no longer able to save popup defaults413426 -Node: Debugging Tools414407 -Node: Keystroke Index417581 -Node: Function and Command Index459122 -Node: Variable Index517323 +Node: Top774 +Node: Introduction6566 +Node: Installation11282 +Node: Installing from Melpa11612 +Node: Installing from the Git Repository12687 +Node: Post-Installation Tasks15501 +Node: Getting Started16786 +Node: Interface Concepts22597 +Node: Modes and Buffers22976 +Node: Switching Buffers24687 +Node: Naming Buffers29426 +Node: Quitting Windows32501 +Node: Automatic Refreshing of Magit Buffers34436 +Node: Automatic Saving of File-Visiting Buffers37317 +Node: Automatic Reverting of File-Visiting Buffers38501 +Node: Risk of Reverting Automatically43486 +Node: Sections45868 +Node: Section Movement46794 +Node: Section Visibility51668 +Node: Section Hooks58355 +Node: Section Types and Values60761 +Node: Section Options62176 +Node: Transient Commands62647 +Node: Transient Arguments and Buffer Variables64123 +Node: Completion Confirmation and the Selection71140 +Node: Action Confirmation71586 +Node: Completion and Confirmation80091 +Node: The Selection83276 +Node: The hunk-internal region86174 +Node: Support for Completion Frameworks87263 +Node: Additional Completion Options92148 +Node: Mouse Support92746 +Node: Running Git93322 +Node: Viewing Git Output93567 +Node: Git Process Status96271 +Node: Running Git Manually97236 +Node: Git Executable99926 +Node: Global Git Arguments102934 +Node: Inspecting103739 +Node: Status Buffer104896 +Node: Status Sections109907 +Node: Status Header Sections115434 +Node: Status Module Sections118053 +Node: Status Options120550 +Node: Repository List121913 +Node: Logging126691 +Node: Refreshing Logs129533 +Node: Log Buffer130954 +Node: Log Margin135777 +Node: Select from Log138930 +Node: Reflog141140 +Node: Cherries142777 +Node: Diffing144615 +Node: Refreshing Diffs147649 +Node: Commands Available in Diffs151338 +Node: Diff Options153851 +Node: Revision Buffer159314 +Node: Ediffing162634 +Node: References Buffer168684 +Node: References Sections179278 +Node: Bisecting180135 +Node: Visiting Files and Blobs182446 +Node: General-Purpose Visit Commands182974 +Node: Visiting Files and Blobs from a Diff183927 +Node: Blaming187371 +Node: Manipulating194359 +Node: Creating Repository194701 +Node: Cloning Repository195238 +Node: Staging and Unstaging201679 +Node: Staging from File-Visiting Buffers205660 +Node: Applying206766 +Node: Committing208839 +Node: Initiating a Commit209422 +Node: Editing Commit Messages214612 +Node: Using the Revision Stack217385 +Node: Commit Pseudo Headers220430 +Node: Commit Mode and Hooks221725 +Node: Commit Message Conventions224583 +Node: Branching226570 +Node: The Two Remotes226796 +Node: Branch Commands229449 +Node: Branch Git Variables242299 +Node: Auxiliary Branch Commands247673 +Node: Merging248789 +Node: Resolving Conflicts252945 +Node: Rebasing258319 +Node: Editing Rebase Sequences263108 +Node: Information About In-Progress Rebase267324 +Ref: Information About In-Progress Rebase-Footnote-1276437 +Node: Cherry Picking277033 +Node: Reverting281367 +Node: Resetting282786 +Node: Stashing284612 +Node: Transferring290993 +Node: Remotes291215 +Node: Remote Commands291367 +Node: Remote Git Variables295406 +Node: Fetching296677 +Node: Pulling299160 +Node: Pushing300186 +Node: Plain Patches304477 +Node: Maildir Patches305948 +Node: Miscellaneous307427 +Node: Tagging307773 +Node: Notes309666 +Node: Submodules312001 +Node: Listing Submodules312219 +Node: Submodule Transient314367 +Node: Subtree316812 +Node: Worktree318743 +Node: Sparse checkouts319819 +Node: Bundle322595 +Node: Common Commands322970 +Node: Wip Modes325598 +Node: Wip Graph330489 +Node: Legacy Wip Modes332802 +Node: Commands for Buffers Visiting Files335689 +Node: Minor Mode for Buffers Visiting Blobs343916 +Node: Customizing344714 +Node: Per-Repository Configuration346310 +Node: Essential Settings348564 +Node: Safety348910 +Node: Performance350671 +Ref: Log Performance353634 +Ref: Diff Performance354939 +Ref: Refs Buffer Performance356280 +Ref: Committing Performance356855 +Node: Microsoft Windows Performance357837 +Node: MacOS Performance359028 +Ref: MacOS Performance-Footnote-1360051 +Node: Global Bindings360133 +Node: Plumbing362361 +Node: Calling Git363190 +Node: Getting a Value from Git364715 +Node: Calling Git for Effect368443 +Node: Section Plumbing374337 +Node: Creating Sections374565 +Node: Section Selection378461 +Node: Matching Sections380257 +Node: Refreshing Buffers386178 +Node: Conventions389322 +Node: Theming Faces389514 +Node: FAQ397619 +Node: FAQ - How to ...?398057 +Node: How to pronounce Magit?398414 +Node: How to show git's output?399217 +Node: How to install the gitman info manual?400003 +Node: How to show diffs for gpg-encrypted files?400973 +Node: How does branching and pushing work?401569 +Node: Should I disable VC?401902 +Node: FAQ - Issues and Errors402505 +Node: Magit is slow403450 +Node: I changed several thousand files at once and now Magit is unusable403743 +Node: I am having problems committing404469 +Node: I am using MS Windows and cannot push with Magit404950 +Node: I am using macOS and SOMETHING works in shell but not in Magit405568 +Node: Expanding a file to show the diff causes it to disappear406402 +Node: Point is wrong in the COMMIT_EDITMSG buffer406990 +Node: The mode-line information isn't always up-to-date408035 +Node: A branch and tag sharing the same name breaks SOMETHING409098 +Node: My Git hooks work on the command-line but not inside Magit409985 +Node: git-commit-mode isn't used when committing from the command-line410831 +Node: Point ends up inside invisible text when jumping to a file-visiting buffer413102 +Node: I am no longer able to save popup defaults413951 +Node: Debugging Tools414932 +Node: Keystroke Index418106 +Node: Function and Command Index459720 +Node: Variable Index517921  End Tag Table diff --git a/elpa/magit-section-20231213.48/magit-section-pkg.el b/elpa/magit-section-20231213.48/magit-section-pkg.el deleted file mode 100644 index fa9db4a4..00000000 --- a/elpa/magit-section-20231213.48/magit-section-pkg.el +++ /dev/null @@ -1,14 +0,0 @@ -(define-package "magit-section" "20231213.48" "Sections for read-only buffers." - '((emacs "25.1") - (compat "29.1.4.4") - (dash "20221013")) - :commit "b187753717b511ce0c732ef1e277b55253d1cb19" :authors - '(("Jonas Bernoulli" . "jonas@bernoul.li")) - :maintainer - '("Jonas Bernoulli" . "jonas@bernoul.li") - :keywords - '("tools") - :url "https://github.com/magit/magit") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-section-20231213.48/dir b/elpa/magit-section-20240508.2349/dir similarity index 100% rename from elpa/magit-section-20231213.48/dir rename to elpa/magit-section-20240508.2349/dir diff --git a/elpa/magit-section-20231213.48/magit-section-autoloads.el b/elpa/magit-section-20240508.2349/magit-section-autoloads.el similarity index 100% rename from elpa/magit-section-20231213.48/magit-section-autoloads.el rename to elpa/magit-section-20240508.2349/magit-section-autoloads.el diff --git a/elpa/magit-section-20240508.2349/magit-section-pkg.el b/elpa/magit-section-20240508.2349/magit-section-pkg.el new file mode 100644 index 00000000..42c24eed --- /dev/null +++ b/elpa/magit-section-20240508.2349/magit-section-pkg.el @@ -0,0 +1,14 @@ +(define-package "magit-section" "20240508.2349" "Sections for read-only buffers." + '((emacs "26.1") + (compat "29.1.4.5") + (dash "20240405")) + :commit "855d924969eb6231d62ab446f727c9f7ad5c4913" :authors + '(("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev")) + :maintainer + '("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev") + :keywords + '("tools") + :url "https://github.com/magit/magit") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/magit-section-20231213.48/magit-section.el b/elpa/magit-section-20240508.2349/magit-section.el similarity index 83% rename from elpa/magit-section-20231213.48/magit-section.el rename to elpa/magit-section-20240508.2349/magit-section.el index dbda4aa4..5e020c70 100644 --- a/elpa/magit-section-20231213.48/magit-section.el +++ b/elpa/magit-section-20240508.2349/magit-section.el @@ -1,17 +1,17 @@ ;;; magit-section.el --- Sections for read-only buffers -*- lexical-binding:t; coding:utf-8 -*- -;; Copyright (C) 2008-2023 The Magit Project Contributors +;; Copyright (C) 2008-2024 The Magit Project Contributors -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli ;; Homepage: https://github.com/magit/magit ;; Keywords: tools ;; Package-Version: 3.3.0.50-git ;; Package-Requires: ( -;; (emacs "25.1") -;; (compat "29.1.4.4") +;; (emacs "26.1") +;; (compat "29.1.4.5") ;; (dash "2.19.1") ;; (seq "2.24")) @@ -51,7 +51,7 @@ ;; For older Emacs releases we depend on an updated `seq' release from GNU ;; ELPA, for `seq-keep'. Unfortunately something else may require `seq' ;; before `package' had a chance to put this version on the `load-path'. -(when (and (featurep' seq) +(when (and (featurep 'seq) (not (fboundp 'seq-keep))) (unload-feature 'seq 'force)) (require 'seq) @@ -71,12 +71,16 @@ and typing \\[eval-last-sexp]. Once you have done that, you have to explicitly upgrade `%s': - \\[package-upgrade] %s \\`RET' + \\[package-install] %s \\`RET' Then you also must make sure the updated version is loaded, by evaluating this form: - (progn (unload-feature '%s t) (require '%s)) + (progn (unload-feature \\='%s t) (require \\='%s)) + +If this does not work, then try uninstalling Magit and all of its +dependencies. After that exit and restart Emacs, and only then +reinstalling Magit. If you don't use the `package' package manager but still get this warning, then your chosen package manager likely has a @@ -374,18 +378,17 @@ no effect. This also has no effect for Emacs >= 28, where (defvar magit--section-type-alist nil) (defclass magit-section () - ((keymap :initform nil) - (type :initform nil :initarg :type) - (value :initform nil :initarg :value) - (start :initform nil :initarg :start) + ((type :initform nil :initarg :type) + (keymap :initform nil) + (value :initform nil) + (start :initform nil) (content :initform nil) (end :initform nil) - (hidden :initform nil) - (washer :initform nil) - (process :initform nil) - (heading-highlight-face :initform nil) + (hidden) + (washer :initform nil :initarg :washer) (inserter :initform (symbol-value 'magit--current-section-hook)) - (parent :initform nil :initarg :parent) + (heading-highlight-face :initform nil :initarg :heading-highlight-face) + (parent :initform nil) (children :initform nil))) ;;; Mode @@ -419,6 +422,7 @@ if any." (keymap-set map " " #'magit-mouse-toggle-section) (keymap-set map " " #'magit-mouse-toggle-section) (keymap-set map "TAB" #'magit-section-toggle) + (keymap-set map "C-c TAB" #'magit-section-cycle) (keymap-set map "C-" #'magit-section-cycle) (keymap-set map "M-" #'magit-section-cycle) ;; is the most portable binding for Shift+Tab. @@ -556,9 +560,9 @@ purpose.") (cl-defmethod magit-section-ident-value ((section magit-section)) "Return the value unless it is an object. -Different object incarnations representing the same value then to -not be equal, so call this generic function on the object itself -to determine a constant value." +Different object incarnations representing the same value tend to not be +equal, so call this generic function on the object itself to determine a +constant value." (let ((value (oref section value))) (if (eieio-object-p value) (magit-section-ident-value value) @@ -917,6 +921,7 @@ With a prefix argument also expand it." heading) (oset section washer nil) (let ((inhibit-read-only t) (magit-insert-section--parent section) + (magit-insert-section--current section) (content (oref section content))) (save-excursion (if (and content (< content (oref section end))) @@ -952,7 +957,7 @@ With a prefix argument also expand it." heading) (user-error "Cannot hide root section")) ((oref section hidden) (magit-section-show section)) - (t (magit-section-hide section)))) + ((magit-section-hide section)))) (defun magit-section-toggle-children (section) "Toggle visibility of bodies of children of the current section." @@ -1001,19 +1006,33 @@ hidden." (magit-section-show-headings-1 child)))) (defun magit-section-cycle (section) - "Cycle visibility of current section and its children." + "Cycle visibility of current section and its children. + +If this command is invoked using \\`C-' and that is globally bound +to `tab-next', then this command pivots to behave like that command, and +you must instead use \\`C-c TAB' to cycle section visibility. + +If you would like to keep using \\`C-' to cycle section visibility +but also want to use `tab-bar-mode', then you have to prevent that mode +from using this key and instead bind another key to `tab-next'. Because +`tab-bar-mode' does not use a mode map but instead manipulates the +global map, this involves advising `tab-bar--define-keys'." (interactive (list (magit-current-section))) - (if (oref section hidden) - (progn (magit-section-show section) - (magit-section-hide-children section)) - (let ((children (oref section children))) + (cond + ((and (equal (this-command-keys) [C-tab]) + (eq (global-key-binding [C-tab]) 'tab-next) + (fboundp 'tab-bar-switch-to-next-tab)) + (tab-bar-switch-to-next-tab current-prefix-arg)) + ((oref section hidden) + (magit-section-show section) + (magit-section-hide-children section)) + ((let ((children (oref section children))) (cond ((and (--any-p (oref it hidden) children) (--any-p (oref it children) children)) (magit-section-show-headings section)) ((seq-some #'magit-section-hidden-body children) (magit-section-show-children section)) - (t - (magit-section-hide section)))))) + ((magit-section-hide section))))))) (defun magit-section-cycle-global () "Cycle visibility of all sections in the current buffer." @@ -1356,120 +1375,126 @@ a section by washing Git's output and Git didn't actually output anything this time around. \(fn [NAME] (CLASS &optional VALUE HIDE) &rest BODY)" - (declare (indent defun) + (declare (indent 1) (debug ([&optional symbolp] - (&or [("eval" form) &optional form form] - [symbolp &optional form form]) + (&or [("eval" form) &optional form form &rest form] + [symbolp &optional form form &rest form]) body))) - (let ((tp (cl-gensym "type")) - (s* (and (symbolp (car args)) - (pop args))) - (s (cl-gensym "section"))) - `(let* ((,tp ,(let ((type (nth 0 (car args)))) - (if (eq (car-safe type) 'eval) - (cadr type) - `',type))) - (,s (funcall (if (class-p ,tp) - ,tp - (or (cdr (assq ,tp magit--section-type-alist)) - 'magit-section)) - :type - (or (and (class-p ,tp) - (car (rassq ,tp magit--section-type-alist))) - ,tp) - :value ,(nth 1 (car args)) - :start (if magit-section-inhibit-markers - (point) - (point-marker)) - :parent magit-insert-section--parent))) - (oset ,s hidden - (if-let ((value (run-hook-with-args-until-success - 'magit-section-set-visibility-hook ,s))) - (eq value 'hide) - (if-let ((incarnation - (and (not magit-section-preserve-visibility) - magit-insert-section--oldroot - (magit-get-section - (magit-section-ident ,s) - magit-insert-section--oldroot)))) - (oref incarnation hidden) - (if-let ((value (magit-section-match-assoc - ,s magit-section-initial-visibility-alist))) - (progn (when (functionp value) - (setq value (funcall value ,s))) - (eq value 'hide)) - ,(nth 2 (car args)))))) - (let ((magit-insert-section--current ,s) - (magit-insert-section--parent ,s) - (magit-insert-section--oldroot - (or magit-insert-section--oldroot - (and (not magit-insert-section--parent) - (prog1 magit-root-section - (setq magit-root-section ,s)))))) - (catch 'cancel-section - ,@(if s* - `((let ((,s* ,s)) - ,@(cdr args))) - (cdr args)) - ;; `magit-insert-section-hook' should *not* be run with - ;; `magit-run-section-hook' because it's a hook that runs - ;; on section insertion, not a section inserting hook. - (run-hooks 'magit-insert-section-hook) - (magit-insert-child-count ,s) - (unless magit-section-inhibit-markers - (set-marker-insertion-type (oref ,s start) t)) - (let* ((end (oset ,s end - (if magit-section-inhibit-markers - (point) - (point-marker)))) - (class-map (oref ,s keymap)) - (magit-map (intern (format "magit-%s-section-map" - (oref ,s type)))) - (forge-map (intern (format "forge-%s-section-map" - (oref ,s type)))) - (map (and class-map (symbol-value class-map)))) - (unless map - (setq map (or (and (boundp magit-map) (symbol-value magit-map)) - (and (boundp forge-map) (symbol-value forge-map)))) - (oset ,s keymap map)) - (save-excursion - (goto-char (oref ,s start)) - (while (< (point) end) - (let ((next (or (next-single-property-change - (point) 'magit-section) - end))) - (unless (magit-section-at) - (put-text-property (point) next 'magit-section ,s) - (when map - (put-text-property (point) next 'keymap map))) - (magit-section-maybe-add-heading-map ,s) - (goto-char next))))) - (cond - ((eq ,s magit-root-section) - (when (eq magit-section-inhibit-markers 'delay) - (setq magit-section-inhibit-markers nil) - (magit-map-sections - (lambda (section) - (oset section start (copy-marker (oref section start) t)) - (oset section end (copy-marker (oref section end) t))))) - (let ((magit-section-cache-visibility nil)) - (magit-section-show ,s))) - (magit-section-insert-in-reverse - (push ,s (oref (oref ,s parent) children))) - ((let ((parent (oref ,s parent))) - (oset parent children - (nconc (oref parent children) - (list ,s))))))) - (when magit-section-insert-in-reverse - (setq magit-section-insert-in-reverse nil) - (oset ,s children (nreverse (oref ,s children)))) - ,s)))) - -(defun magit-cancel-section () + (pcase-let* ((bind (and (symbolp (car args)) + (pop args))) + (`((,class ,value ,hide . ,args) . ,body) args) + (obj (cl-gensym "section"))) + `(let* ((,obj (magit-insert-section--create + ,(if (eq (car-safe class) 'eval) (cadr class) `',class) + ,value ,hide ,@args)) + (magit-insert-section--current ,obj) + (magit-insert-section--oldroot + (or magit-insert-section--oldroot + (and (not magit-insert-section--parent) + (prog1 magit-root-section + (setq magit-root-section ,obj))))) + (magit-insert-section--parent ,obj)) + (catch 'cancel-section + ,@(if bind `((let ((,bind ,obj)) ,@body)) body) + (magit-insert-section--finish ,obj)) + ,obj))) + +(defun magit-insert-section--create (class value hide &rest args) + (let (type) + (if (class-p class) + (setq type (or (car (rassq class magit--section-type-alist)) + class)) + (setq type class) + (setq class (or (cdr (assq class magit--section-type-alist)) + 'magit-section))) + (let ((obj (apply class :type type args))) + (oset obj value value) + (oset obj parent magit-insert-section--parent) + (oset obj start (if magit-section-inhibit-markers (point) (point-marker))) + (unless (slot-boundp obj 'hidden) + (oset obj hidden + (let (set old) + (cond + ((setq set (run-hook-with-args-until-success + 'magit-section-set-visibility-hook obj)) + (eq set 'hide)) + ((setq old (and (not magit-section-preserve-visibility) + magit-insert-section--oldroot + (magit-get-section + (magit-section-ident obj) + magit-insert-section--oldroot))) + (oref old hidden)) + ((setq set (magit-section-match-assoc + obj magit-section-initial-visibility-alist)) + (eq (if (functionp set) (funcall set obj) set) 'hide)) + (hide))))) + (unless (oref obj keymap) + (let ((type (oref obj type))) + (oset obj keymap + (or (let ((sym (intern (format "magit-%s-section-map" type)))) + (and (boundp sym) sym)) + (let ((sym (intern (format "forge-%s-section-map" type)))) + (and (boundp sym) sym)))))) + obj))) + +(defun magit-insert-section--finish (obj) + (run-hooks 'magit-insert-section-hook) + (let ((beg (oref obj start)) + (end (oset obj end + (if magit-section-inhibit-markers + (point) + (point-marker)))) + (props `( magit-section ,obj + ,@(and-let* ((map (symbol-value (oref obj keymap)))) + (list 'keymap map))))) + (unless magit-section-inhibit-markers + (set-marker-insertion-type beg t)) + (cond ((eq obj magit-root-section)) + ((oref obj children) + (magit-insert-child-count obj) + (magit-section-maybe-add-heading-map obj) + (save-excursion + (goto-char beg) + (while (< (point) end) + (let ((next (or (next-single-property-change + (point) 'magit-section) + end))) + (unless (magit-section-at) + (add-text-properties (point) next props)) + (goto-char next))))) + ((add-text-properties beg end props))) + (cond ((eq obj magit-root-section) + (when (eq magit-section-inhibit-markers 'delay) + (setq magit-section-inhibit-markers nil) + (magit-map-sections + (lambda (section) + (oset section start (copy-marker (oref section start) t)) + (oset section end (copy-marker (oref section end) t))))) + (let ((magit-section-cache-visibility nil)) + (magit-section-show obj))) + (magit-section-insert-in-reverse + (push obj (oref (oref obj parent) children))) + ((let ((parent (oref obj parent))) + (oset parent children + (nconc (oref parent children) + (list obj)))))) + (when magit-section-insert-in-reverse + (oset obj children (nreverse (oref obj children)))))) + +(defun magit-cancel-section (&optional if-empty) "Cancel inserting the section that is currently being inserted. -Remove all traces of that section." - (when magit-insert-section--current - (if (not (oref magit-insert-section--current parent)) + +Canceling returns from the inner most use of `magit-insert-section' and +removes all text that was inserted by that. + +If optional IF-EMPTY is non-nil, then only cancel the section, if it is +empty. If a section is split into a heading and a body (i.e., when its +`content' slot is non-nil), then only check if the body is empty." + (when (and magit-insert-section--current + (or (not if-empty) + (= (point) (or (oref magit-insert-section--current content) + (oref magit-insert-section--current start))))) + (if (eq magit-insert-section--current magit-root-section) (insert "(empty)\n") (delete-region (oref magit-insert-section--current start) (point)) @@ -1528,19 +1553,19 @@ is explicitly expanded." (let ((f (cl-gensym)) (s (cl-gensym)) (l (cl-gensym))) - `(let ((,f (lambda () ,@body)) - (,s magit-insert-section--current)) - (if (oref ,s hidden) - (oset ,s washer - (lambda () - (let ((,l (magit-section-lineage ,s t))) - (dolist (s ,l) - (set-marker-insertion-type (oref s end) t)) - (funcall ,f) - (dolist (s ,l) - (set-marker-insertion-type (oref s end) nil)) - (magit-section-maybe-remove-heading-map ,s) - (magit-section-maybe-remove-visibility-indicator ,s)))) + `(let ((,f (lambda () ,@body))) + (if (oref magit-insert-section--current hidden) + (oset magit-insert-section--current washer + (let ((,s magit-insert-section--current)) + (lambda () + (let ((,l (magit-section-lineage ,s t))) + (dolist (s ,l) + (set-marker-insertion-type (oref s end) t)) + (funcall ,f) + (dolist (s ,l) + (set-marker-insertion-type (oref s end) nil)) + (magit-section-maybe-remove-heading-map ,s) + (magit-section-maybe-remove-visibility-indicator ,s))))) (funcall ,f))))) (defun magit-insert-headers (hook) @@ -1598,18 +1623,16 @@ with \" (N)\", where N is the number of child sections. This function is called by `magit-insert-section' after that has evaluated its BODY. Admittedly that's a bit of a hack." - ;; This has to be fast, not pretty! (let (content count) (when (and magit-section-show-child-count + (setq content (oref section content)) (setq count (length (oref section children))) (> count 0) - (setq content (oref section content)) (eq (char-before (1- content)) ?:)) (save-excursion (goto-char (- content 2)) - (insert (concat (magit--propertize-face " " 'magit-section-heading) - (magit--propertize-face (format "(%s)" count) - 'magit-section-child-count))) + (insert (magit--propertize-face (format " (%s)" count) + 'magit-section-child-count)) (delete-char 1))))) ;;; Highlight @@ -1631,10 +1654,14 @@ evaluated its BODY. Admittedly that's a bit of a hack." (setq magit-section-pre-command-section (magit-current-section))) (defun magit-section-post-command-hook () - (cursor-sensor-move-to-tangible (selected-window)) - (when (or magit--context-menu-buffer - magit--context-menu-section) - (magit-menu-highlight-point-section)) + (let ((window (selected-window))) + ;; The command may have used `set-window-buffer' to change + ;; the window's buffer without changing the current buffer. + (when (eq (current-buffer) (window-buffer window)) + (cursor-sensor-move-to-tangible window) + (when (or magit--context-menu-buffer + magit--context-menu-section) + (magit-menu-highlight-point-section)))) (unless (memq this-command '(magit-refresh magit-refresh-all)) (magit-section-update-highlight))) @@ -1738,7 +1765,7 @@ invisible." (display-warning 'magit "\ Emacs has enabled redisplay shortcuts in this buffer because there are lines whose length go beyond -`long-line-treshhold' \(%s characters). As a result, section +`long-line-treshold' \(%s characters). As a result, section highlighting and the special appearance of the region has been disabled. Some existing highlighting might remain in effect. @@ -2028,27 +2055,29 @@ If optional CONDITION is non-nil, then the selection not only has to be valid; all selected sections additionally have to match CONDITION, or nil is returned. See `magit-section-match' for the forms CONDITION can take." - (when (region-active-p) - (let* ((rbeg (region-beginning)) - (rend (region-end)) - (sbeg (magit-section-at rbeg)) - (send (magit-section-at rend))) - (when (and send - (not (eq send magit-root-section)) - (not (and multiple (eq send sbeg)))) - (let ((siblings (cons sbeg (magit-section-siblings sbeg 'next))) - sections) - (when (and (memq send siblings) + (and (region-active-p) + (let* ((rbeg (region-beginning)) + (rend (region-end)) + (sbeg (magit-section-at rbeg)) + (send (magit-section-at rend))) + (and send + (not (eq send magit-root-section)) + (not (and multiple (eq send sbeg))) + (let ((siblings (cons sbeg (magit-section-siblings sbeg 'next))) + (sections ())) + (and (memq send siblings) (magit-section-position-in-heading-p sbeg rbeg) - (magit-section-position-in-heading-p send rend)) - (while siblings - (push (car siblings) sections) - (when (eq (pop siblings) send) - (setq siblings nil))) - (setq sections (nreverse sections)) - (when (or (not condition) - (--all-p (magit-section-match condition it) sections)) - sections))))))) + (magit-section-position-in-heading-p send rend) + (progn + (while siblings + (push (car siblings) sections) + (when (eq (pop siblings) send) + (setq siblings nil))) + (setq sections (nreverse sections)) + (and (or (not condition) + (--all-p (magit-section-match condition it) + sections)) + sections)))))))) (defun magit-map-sections (function &optional section) "Apply FUNCTION to all sections for side effects only, depth first. @@ -2179,7 +2208,7 @@ Configuration'." (unless (memq entry magit-disabled-section-inserters) (if (bound-and-true-p magit-refresh-verbose) (let ((time (benchmark-elapse (apply entry args)))) - (message " %-50s %s %s" entry time + (message " %-50s %f %s" entry time (cond ((> time 0.03) "!!") ((> time 0.01) "!") (t "")))) @@ -2227,6 +2256,159 @@ Configuration'." (put-text-property beg end 'face face string) (put-text-property beg end 'font-lock-face face string)) +;;; Imenu Support + +(defvar-local magit--imenu-group-types nil) +(defvar-local magit--imenu-item-types nil) + +(defun magit--imenu-create-index () + ;; If `which-function-mode' is active, then the create-index + ;; function is called at the time the major-mode is being enabled. + ;; Modes that derive from `magit-mode' have not populated the buffer + ;; at that time yet, so we have to abort. + (and magit-root-section + (or magit--imenu-group-types + magit--imenu-item-types) + (let ((index + (cl-mapcan + (lambda (section) + (cond + (magit--imenu-group-types + (and (if (eq (car-safe magit--imenu-group-types) 'not) + (not (magit-section-match + (cdr magit--imenu-group-types) + section)) + (magit-section-match magit--imenu-group-types section)) + (and-let* ((children (oref section children))) + `((,(magit--imenu-index-name section) + ,@(mapcar (lambda (s) + (cons (magit--imenu-index-name s) + (oref s start))) + children)))))) + (magit--imenu-item-types + (and (magit-section-match magit--imenu-item-types section) + `((,(magit--imenu-index-name section) + . ,(oref section start))))))) + (oref magit-root-section children)))) + (if (and magit--imenu-group-types (symbolp magit--imenu-group-types)) + (cdar index) + index)))) + +(defun magit--imenu-index-name (section) + (let ((heading (buffer-substring-no-properties + (oref section start) + (1- (or (oref section content) + (oref section end)))))) + (save-match-data + (cond + ((and (magit-section-match [commit logbuf] section) + (string-match "[^ ]+\\([ *|]*\\).+" heading)) + (replace-match " " t t heading 1)) + ((magit-section-match + '([branch local branchbuf] [tag tags branchbuf]) section) + (oref section value)) + ((magit-section-match [branch remote branchbuf] section) + (concat (oref (oref section parent) value) "/" + (oref section value))) + ((string-match " ([0-9]+)\\'" heading) + (substring heading 0 (match-beginning 0))) + (t heading))))) + +(defun magit--imenu-goto-function (_name position &rest _rest) + "Go to the section at POSITION. +Make sure it is visible, by showing its ancestors where +necessary. For use as `imenu-default-goto-function' in +`magit-mode' buffers." + (goto-char position) + (let ((section (magit-current-section))) + (while (setq section (oref section parent)) + (when (oref section hidden) + (magit-section-show section))))) + +;;; Bookmark support + +(declare-function bookmark-get-filename "bookmark" (bookmark-name-or-record)) +(declare-function bookmark-make-record-default "bookmark" + (&optional no-file no-context posn)) +(declare-function bookmark-prop-get "bookmark" (bookmark-name-or-record prop)) +(declare-function bookmark-prop-set "bookmark" (bookmark-name-or-record prop val)) + +(cl-defgeneric magit-bookmark-get-filename () + (or (buffer-file-name) (buffer-name))) + +(cl-defgeneric magit-bookmark--get-child-value (section) + (oref section value)) + +(cl-defgeneric magit-bookmark-get-buffer-create (bookmark mode)) + +(defun magit--make-bookmark () + "Create a bookmark for the current Magit buffer. +Input values are the major-mode's `magit-bookmark-name' method, +and the buffer-local values of the variables referenced in its +`magit-bookmark-variables' property." + (require 'bookmark) + (if (plist-member (symbol-plist major-mode) 'magit-bookmark-variables) + ;; `bookmark-make-record-default's return value does not match + ;; (NAME . ALIST), even though it is used as the default value + ;; of `bookmark-make-record-function', which states that such + ;; functions must do that. See #4356. + (let ((bookmark (cons nil (bookmark-make-record-default 'no-file)))) + (bookmark-prop-set bookmark 'handler #'magit--handle-bookmark) + (bookmark-prop-set bookmark 'mode major-mode) + (bookmark-prop-set bookmark 'filename (magit-bookmark-get-filename)) + (bookmark-prop-set bookmark 'defaults (list (magit-bookmark-name))) + (dolist (var (get major-mode 'magit-bookmark-variables)) + (bookmark-prop-set bookmark var (symbol-value var))) + (bookmark-prop-set + bookmark 'magit-hidden-sections + (--keep (and (oref it hidden) + (cons (oref it type) + (magit-bookmark--get-child-value it))) + (oref magit-root-section children))) + bookmark) + (user-error "Bookmarking is not implemented for %s buffers" major-mode))) + +(defun magit--handle-bookmark (bookmark) + "Open a bookmark created by `magit--make-bookmark'. + +Call the generic function `magit-bookmark-get-buffer-create' to get +the appropriate buffer without displaying it. + +Then call the `magit-*-setup-buffer' function of the the major-mode +with the variables' values as arguments, which were recorded by +`magit--make-bookmark'." + (let ((buffer (magit-bookmark-get-buffer-create + bookmark + (bookmark-prop-get bookmark 'mode)))) + (set-buffer buffer) ; That is the interface we have to adhere to. + (when-let ((hidden (bookmark-prop-get bookmark 'magit-hidden-sections))) + (with-current-buffer buffer + (dolist (child (oref magit-root-section children)) + (if (member (cons (oref child type) + (oref child value)) + hidden) + (magit-section-hide child) + (magit-section-show child))))) + ;; Compatibility with `bookmark+' package. See #4356. + (when (bound-and-true-p bmkp-jump-display-function) + (funcall bmkp-jump-display-function (current-buffer))) + nil)) + +(put 'magit--handle-bookmark 'bookmark-handler-type "Magit") + +(cl-defgeneric magit-bookmark-name () + "Return name for bookmark to current buffer." + (format "%s%s" + (substring (symbol-name major-mode) 0 -5) + (if-let ((vars (get major-mode 'magit-bookmark-variables))) + (cl-mapcan (lambda (var) + (let ((val (symbol-value var))) + (if (and val (atom val)) + (list val) + val))) + vars) + ""))) + ;;; Bitmaps (when (fboundp 'define-fringe-bitmap) diff --git a/elpa/magit-section-20231213.48/magit-section.info b/elpa/magit-section-20240508.2349/magit-section.info similarity index 97% rename from elpa/magit-section-20231213.48/magit-section.info rename to elpa/magit-section-20240508.2349/magit-section.info index 13476522..9106cc76 100644 --- a/elpa/magit-section-20231213.48/magit-section.info +++ b/elpa/magit-section-20240508.2349/magit-section.info @@ -1,7 +1,8 @@ This is magit-section.info, produced by makeinfo version 6.7 from magit-section.texi. - Copyright (C) 2015-2023 Jonas Bernoulli + Copyright (C) 2015-2024 Jonas Bernoulli + You can redistribute this document and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -35,7 +36,8 @@ you can use sections in your own packages. This manual is for Magit-Section version 3.3.0.50-git. - Copyright (C) 2015-2023 Jonas Bernoulli + Copyright (C) 2015-2024 Jonas Bernoulli + You can redistribute this document and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -293,11 +295,11 @@ File: magit-section.info, Node: Matching Functions, Prev: Core Functions, Up:  Tag Table: -Node: Top788 -Node: Introduction2076 -Node: Creating Sections2846 -Node: Core Functions7354 -Node: Matching Functions10406 +Node: Top808 +Node: Introduction2116 +Node: Creating Sections2886 +Node: Core Functions7394 +Node: Matching Functions10446  End Tag Table diff --git a/elpa/magit-todos-20201101.2240/magit-todos-autoloads.el b/elpa/magit-todos-20201101.2240/magit-todos-autoloads.el deleted file mode 100644 index e7b1999f..00000000 --- a/elpa/magit-todos-20201101.2240/magit-todos-autoloads.el +++ /dev/null @@ -1,53 +0,0 @@ -;;; magit-todos-autoloads.el --- automatically extracted autoloads -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "magit-todos" "magit-todos.el" (0 0 0 0)) -;;; Generated autoloads from magit-todos.el - -(defvar magit-todos-mode nil "\ -Non-nil if Magit-Todos mode is enabled. -See the `magit-todos-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 `magit-todos-mode'.") - -(custom-autoload 'magit-todos-mode "magit-todos" nil) - -(autoload 'magit-todos-mode "magit-todos" "\ -Show list of to-do items in Magit status buffer for tracked files in repo. - -If called interactively, enable Magit-Todos mode if ARG is -positive, and disable it if ARG is zero or negative. If called -from Lisp, also enable the mode if ARG is omitted or nil, and -toggle it if ARG is `toggle'; disable the mode otherwise. - -\(fn &optional ARG)" t nil) - -(autoload 'magit-todos-list "magit-todos" "\ -Show to-do list of the current Git repository in a buffer. -With prefix, prompt for repository. - -\(fn &optional DIRECTORY)" t nil) - -(autoload 'magit-todos-list-internal "magit-todos" "\ -Open buffer showing to-do list of repository at DIRECTORY. - -\(fn DIRECTORY)" nil nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-todos" '("magit-todos-"))) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; magit-todos-autoloads.el ends here diff --git a/elpa/magit-todos-20201101.2240/magit-todos-pkg.el b/elpa/magit-todos-20201101.2240/magit-todos-pkg.el deleted file mode 100644 index 97e8ee1c..00000000 --- a/elpa/magit-todos-20201101.2240/magit-todos-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; Generated package description from /Users/baron/.emacs.d/elpa/magit-todos-20201101.2240/magit-todos.el -*- no-byte-compile: t -*- -(define-package "magit-todos" "20201101.2240" "Show source file TODOs in Magit" '((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) :commit "78d24cf419138b543460f40509c8c1a168b52ca0" :authors '(("Adam Porter" . "adam@alphapapa.net")) :maintainer '("Adam Porter" . "adam@alphapapa.net") :keywords '("magit" "vc") :url "http://github.com/alphapapa/magit-todos") diff --git a/elpa/magit-todos-20240519.247/magit-todos-autoloads.el b/elpa/magit-todos-20240519.247/magit-todos-autoloads.el new file mode 100644 index 00000000..7c782622 --- /dev/null +++ b/elpa/magit-todos-20240519.247/magit-todos-autoloads.el @@ -0,0 +1,64 @@ +;;; magit-todos-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from magit-todos.el + +(defvar magit-todos-mode nil "\ +Non-nil if Magit-Todos mode is enabled. +See the `magit-todos-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 `magit-todos-mode'.") +(custom-autoload 'magit-todos-mode "magit-todos" nil) +(autoload 'magit-todos-mode "magit-todos" "\ +Show list of to-do items in Magit status buffer for tracked files in repo. + +This is a global minor mode. If called interactively, toggle the +`Magit-Todos mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `(default-value \\='magit-todos-mode)'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + +(fn &optional ARG)" t) +(autoload 'magit-todos-list "magit-todos" "\ +Show to-do list of the current Git repository in a buffer. +With prefix, prompt for repository. Use repository in DIRECTORY, +or `default-directory' if nil. + +(fn &optional DIRECTORY)" t) +(autoload 'magit-todos-list-internal "magit-todos" "\ +Open buffer showing to-do list of repository at DIRECTORY. + +(fn DIRECTORY)") +(register-definition-prefixes "magit-todos" '("magit-todos-")) + +;;; End of scraped data + +(provide 'magit-todos-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; magit-todos-autoloads.el ends here diff --git a/elpa/magit-todos-20240519.247/magit-todos-pkg.el b/elpa/magit-todos-20240519.247/magit-todos-pkg.el new file mode 100644 index 00000000..352b977e --- /dev/null +++ b/elpa/magit-todos-20240519.247/magit-todos-pkg.el @@ -0,0 +1,22 @@ +(define-package "magit-todos" "20240519.247" "Show source file TODOs in Magit" + '((emacs "26.1") + (async "1.9.2") + (dash "2.13.0") + (f "0.17.2") + (hl-todo "1.9.0") + (magit "2.13.0") + (pcre2el "1.8") + (s "1.12.0") + (transient "0.2.0")) + :commit "501c8db90ab59f8b619618b9d10db2a32a113727" :authors + '(("Adam Porter" . "adam@alphapapa.net")) + :maintainers + '(("Adam Porter" . "adam@alphapapa.net")) + :maintainer + '("Adam Porter" . "adam@alphapapa.net") + :keywords + '("magit" "vc") + :url "http://github.com/alphapapa/magit-todos") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/magit-todos-20201101.2240/magit-todos.el b/elpa/magit-todos-20240519.247/magit-todos.el similarity index 78% rename from elpa/magit-todos-20201101.2240/magit-todos.el rename to elpa/magit-todos-20240519.247/magit-todos.el index 6686080f..dd30488a 100644 --- a/elpa/magit-todos-20201101.2240/magit-todos.el +++ b/elpa/magit-todos-20240519.247/magit-todos.el @@ -4,10 +4,8 @@ ;; Author: Adam Porter ;; URL: http://github.com/alphapapa/magit-todos -;; Package-Version: 20201101.2240 -;; Package-Commit: 78d24cf419138b543460f40509c8c1a168b52ca0 -;; Version: 1.6-pre -;; Package-Requires: ((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) +;; Version: 1.8-pre +;; Package-Requires: ((emacs "26.1") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0") (transient "0.2.0")) ;; Keywords: magit, vc ;;; Commentary: @@ -66,7 +64,6 @@ ;;;; Requirements (require 'cl-lib) -(require 'org) (require 'grep) (require 'seq) @@ -75,6 +72,7 @@ (require 'f) (require 'hl-todo) (require 'magit) +(require 'transient) (require 'pcre2el) (require 's) @@ -117,17 +115,10 @@ This should be set automatically by customizing (defvar-local magit-todos-active-scan nil "The current scan's process. Used to avoid running multiple simultaneous scans for a -magit-status buffer.") - -;; FIXME: Jumping binds. In `magit-status-mode-map' now, "j" is bound -;; to `magit-status-jump', which is a Transient command; it's no -;; longer bound to a prefix map. There doesn't seem to be a way to -;; add binds to that Transient command's body. +`magit-status' buffer.") (defvar magit-todos-section-map (let ((map (make-sparse-keymap))) - (define-key map "jT" #'magit-todos-jump-to-todos) - (define-key map "jl" #'magit-todos-list) (define-key map "b" #'magit-todos-branch-list-toggle) (define-key map "B" #'magit-todos-branch-list-set-commit) (define-key map [remap magit-visit-thing] #'magit-todos-list) @@ -157,12 +148,17 @@ A time value as returned by `current-time'.") (defvar-local magit-todos-item-cache nil "Items found by most recent scan.") +(defvar-local magit-todos-branch-item-cache nil + "Items found by most recent branch scan.") + (defvar magit-todos-scanners nil "Scanners defined by `magit-todos-defscanner'.") (defvar magit-todos-section-heading "TODOs" "Allows overriding of section heading.") +(defvar org-odd-levels-only) + ;;;; Customization (defgroup magit-todos nil @@ -172,7 +168,7 @@ A time value as returned by `current-time'.") (defcustom magit-todos-scanner nil "File scanning method. \"Automatic\" will attempt to use rg, ag, git-grep, and -find-grep, in that order. " +find-grep, in that order." :type '(choice (const :tag "Automatic" nil) (function :tag "Custom function")) :set (lambda (option value) @@ -211,11 +207,19 @@ items." (integer :tag "Automatically, but cache items for N seconds") (const :tag "Manually" nil))) +(defcustom magit-todos-update-remote nil + "Automatically scan in remote repositories. +If nil, remote repos are only scanned when a manual scan is +initiated (see command `magit-todos-update'). Remote repos +include ones accessed via TRAMP (i.e. any path for which +`file-remote-p' returns non-nil)." + :type 'boolean) + (defcustom magit-todos-fontify-keyword-headers t "Apply keyword faces to group keyword headers." :type 'boolean) -(defcustom magit-todos-keyword-suffix (rx (optional "(" (1+ (not (any ")"))) ")") ":") +(defcustom magit-todos-keyword-suffix (rx (optional (or "(" "[") (1+ (not (any ")" "]"))) (or ")" "]")) ":") "Regular expression matching suffixes after keywords. e.g. to match a keyword like \"TODO(user):\", use \"([^)]+):\". @@ -225,8 +229,10 @@ account for optional whitespace after the suffix, as this is done automatically. Note: the suffix applies only to non-Org files." - :type `(choice (const :tag "Optional username in parens, then required colon (matching e.g. \"TODO:\" or \"TODO(user):\")" + :type `(choice (const :tag "Optional suffix in parens, then required colon (matching e.g. \"TODO:\" or \"TODO(foo):\")" ,(rx (optional "(" (1+ (not (any ")"))) ")") ":")) + (const :tag "Optional suffix in parens or brackets, then required colon (matching e.g. \"TODO:\" or \"TODO(foo):\" or \"TODO[foo]:\")" + ,(rx (optional (or "(" "[") (1+ (not (any ")" "]"))) (or ")" "]")) ":")) (const :tag "Required colon (matching e.g. \"TODO:\"" ":") (string :tag "Custom regexp")) :package-version '(magit-todos . "1.2")) @@ -255,7 +261,9 @@ which the keys are the keywords. When set, sets `magit-todos-search-regexp' to the appropriate regular expression." :type '(choice (repeat :tag "Custom list" string) - (const :tag "Keywords from `hl-todo'" hl-todo-keyword-faces) + (const :tag "Keywords from `hl-todo'" + :doc "Note that the keywords in `hl-todo-keyword-faces' are treated by it as regexps, while this package treats them as strings. If this doesn't meet your needs, please use another option. See ." + hl-todo-keyword-faces) (variable :tag "List variable")) :set (lambda (option value) (set-default option value) @@ -279,7 +287,9 @@ regular expression." (const :tag "Never" never))) (defcustom magit-todos-buffer-item-factor 10 - "Multiply `magit-todos-auto-group-items' and `magit-todos-max-items' by this factor in dedicated `magit-todos' buffers." + "Adjustment to item grouping in dedicated `magit-todos' buffers. +Multiplies `magit-todos-auto-group-items' and +`magit-todos-max-items' by this factor." :type 'integer) (defcustom magit-todos-group-by '(magit-todos-item-keyword magit-todos-item-filename) @@ -315,21 +325,28 @@ this in a directory-local variable for certain projects." (const :tag "Repo root directory only" 0) (integer :tag "N levels below the repo root"))) -(defcustom magit-todos-insert-at 'bottom - "Insert the to-dos section after this section in the Magit status buffer. -Specific sections may be chosen, using the first symbol returned -by evaluating \"(magit-section-ident (magit-current-section))\" -in the status buffer with point on the desired section, -e.g. `recent' for the \"Recent commits\" section. Note that this -may not work exactly as desired when the built-in scanner is -used." - :type '(choice (const :tag "Top" top) - (const :tag "Bottom" bottom) - (const :tag "After untracked files" untracked) - (const :tag "After unstaged files" unstaged) - (symbol :tag "After selected section"))) - -(defcustom magit-todos-exclude-globs nil +(defcustom magit-todos-insert-after '(bottom) + "Where to insert the TODOs section in the Magit status buffer. +The TODOs section is inserted after the first of these sections +found, or at the bottom if none exist. Specific sections may be +chosen, using the first symbol returned by evaluating +\"(magit-section-ident (magit-current-section))\" in the status +buffer with point on the desired section, e.g. `recent' for the +\"Recent commits\" section. Note that this may not work exactly +as desired when the built-in scanner is used." + :type '(repeat + (choice (const :tag "Top" top) + (const :tag "Bottom" bottom) + (const :tag "Recent commits" unpushed) + (const :tag "Untracked files" untracked) + (const :tag "Unstaged files" unstaged) + (const :tag "Staged files" staged) + (const :tag "Stashes" stashes) + (const :tag "Pull requests (Forge)" pullreqs) + (const :tag "Issues (Forge)" issues) + (symbol :tag "Specified section")))) + +(defcustom magit-todos-exclude-globs '(".git/") "Glob patterns to exclude from searches." :type '(repeat string)) @@ -342,7 +359,7 @@ This can be toggled locally in Magit buffers with command (const :tag "In non-master branches" branch) (const :tag "Always" t))) -(defcustom magit-todos-branch-list-merge-base-ref "master" +(defcustom magit-todos-branch-list-merge-base-ref nil "Commit ref passed to command \"git merge-base HEAD\". Determines the ancestor commit from which the current branch's todos should be searched for. May be overridden in the case that @@ -359,12 +376,19 @@ By default, the branch todo list would show todos from both the \"topic\" branch and the \"topic2\" branch. To show only todos from the \"topic2\" branch, this option could be set to \"topic\"." - :type 'string) + :type '(choice (const :tag "Automatic" :doc "Value returned by `magit-main-branch'" nil) + (string :tag "Specified branch name"))) (defcustom magit-todos-submodule-list nil "Show submodule to-do list." :type 'boolean) +(defcustom magit-todos-filename-filter nil + "Filter applied to filenames." + :type '(choice (const :tag "None (show filename relative to repo)" nil) + (function-item :tag "Basename" file-name-nondirectory) + (function :tag "Custom function"))) + ;;;; Commands ;;;###autoload @@ -375,18 +399,16 @@ from the \"topic2\" branch, this option could be set to :global t (if magit-todos-mode (progn - (pcase (lookup-key magit-status-mode-map "jT") - ('nil (define-key magit-status-mode-map "jT" #'magit-todos-jump-to-todos)) - ('magit-todos-jump-to-todos nil) - (_ (message "magit-todos: Not overriding bind of \"jT\" in `magit-status-mode-map'."))) + (transient-append-suffix #'magit-status-jump + '(0 -1) '[("T" "Todos" magit-todos-jump-to-todos) + ("l" "List todos" magit-todos-list)]) (magit-add-section-hook 'magit-status-sections-hook #'magit-todos--insert-todos nil 'append) (add-hook 'magit-status-mode-hook #'magit-todos--add-to-status-buffer-kill-hook 'append)) ;; Disable mode - (when (equal (lookup-key magit-status-mode-map "jT") #'magit-todos-jump-to-todos) - (define-key magit-status-mode-map "jT" nil)) + (transient-remove-suffix #'magit-status-jump '(0 -1)) (remove-hook 'magit-status-sections-hook #'magit-todos--insert-todos) (remove-hook 'magit-status-mode-hook #'magit-todos--add-to-status-buffer-kill-hook))) @@ -407,17 +429,18 @@ Only necessary when option `magit-todos-update' is nil." (defun magit-todos-branch-list-toggle () "Toggle branch diff to-do list in current Magit buffer." (interactive) + ;; FIXME: If `magit-todos-branch-list' is not just nil/t, the value is lost. (setq-local magit-todos-branch-list (not magit-todos-branch-list)) (magit-todos-update)) (defun magit-todos-branch-list-set-commit (ref) - "Set commit ref used in branch to-do list." + "Set commit REF used in branch to-do list." (interactive (list (completing-read "Refname: " (magit-list-refnames)))) (setq-local magit-todos-branch-list-merge-base-ref ref) (magit-todos-update)) (cl-defun magit-todos-jump-to-item (&key peek (item (oref (magit-current-section) value))) - "Show current item. + "Show current ITEM. If PEEK is non-nil, keep focus in status buffer window." (interactive) (let* ((status-window (selected-window)) @@ -425,7 +448,14 @@ If PEEK is non-nil, keep focus in status buffer window." (pop-to-buffer buffer) (magit-todos--goto-item item) (when (derived-mode-p 'org-mode) - (org-show-entry)) + ;; Because `org-show-entry' was renamed and moved in Org 9.6, we + ;; have to silence warnings about it. If Org is loaded, the + ;; function will be. + (cond ((version<= "9.6" (org-version)) + (with-no-warnings + (org-fold-show-entry))) + (t (with-no-warnings + (org-show-entry))))) (when peek (select-window status-window)))) @@ -454,7 +484,8 @@ If PEEK is non-nil, keep focus in status buffer window." ;;;###autoload (defun magit-todos-list (&optional directory) "Show to-do list of the current Git repository in a buffer. -With prefix, prompt for repository." +With prefix, prompt for repository. Use repository in DIRECTORY, +or `default-directory' if nil." ;; Mostly copied from `magit-status' (interactive (let ((magit--refresh-cache (list (cons 0 0)))) @@ -466,15 +497,20 @@ With prefix, prompt for repository." (file-name-as-directory (expand-file-name directory)) default-directory)) (magit-todos-list-internal directory)) - ('magit-outside-git-repo (cl-letf (((symbol-function 'magit-toplevel) (lambda (&rest _) default-directory))) - (call-interactively #'magit-todos-list))))) + (magit-outside-git-repo + (cl-letf (((symbol-function 'magit-toplevel) (lambda (&rest _) default-directory))) + (call-interactively #'magit-todos-list))))) (put 'magit-todos-list 'interactive-only 'magit-todos-list-internal) ;;;###autoload (defun magit-todos-list-internal (directory) "Open buffer showing to-do list of repository at DIRECTORY." - (magit--tramp-asserts directory) + (if (fboundp 'magit--tramp-asserts) + (magit--tramp-asserts directory) + (when (file-remote-p directory) + (magit-git-version-assert))) + (let ((default-directory directory)) (magit-setup-buffer #'magit-todos-list-mode))) @@ -499,6 +535,29 @@ Type \\[magit-diff-show-or-scroll-up] to peek at the item at point." ;;;; Functions +(defun magit-todos--section-end (condition) + "Return end position of section matching CONDITION, or nil. +CONDITION may be one accepted by `magit-section-match', or `top' +or `bottom', which are handled specially." + (cl-labels ((find-section (condition) + (save-excursion + (goto-char (point-min)) + (ignore-errors + (cl-loop until (magit-section-match condition) + do (magit-section-forward) + finally return (magit-current-section)))))) + (save-excursion + (goto-char (point-min)) + (pcase condition + ('top (when-let ((section (or (find-section 'tags) + (find-section 'tag) + (find-section 'branch)))) + ;; Add 1 to leave blank line after top sections. + (1+ (oref section end)))) + ('bottom (oref (-last-item (oref magit-root-section children)) end)) + (_ (when-let ((section (find-section condition))) + (oref section end))))))) + (defun magit-todos--coalesce-groups (groups) "Return GROUPS, coalescing any groups with `equal' keys. GROUPS should be an alist. Assumes that each group contains @@ -542,7 +601,8 @@ Chooses automatically in order defined in `magit-todos-scanners'." (cl-defun magit-todos--scan-callback (&key callback magit-status-buffer results-regexp process &allow-other-keys) "Call CALLBACK with arguments MAGIT-STATUS-BUFFER and match items. -Match items are a list of `magit-todos-item' found in PROCESS's buffer for RESULTS-REGEXP." +Match items are a list of `magit-todos-item' found in PROCESS's +buffer for RESULTS-REGEXP." (funcall callback magit-status-buffer (with-current-buffer (process-buffer process) (magit-todos--buffer-items results-regexp)))) @@ -553,22 +613,20 @@ Match items are a list of `magit-todos-item' found in PROCESS's buffer for RESUL (save-excursion (goto-char (point-min)) (while (not (eobp)) - (--when-let (condition-case err - (magit-todos--line-item results-regexp) - ;; Files with very, very long lines may cause Emacs's regexp matcher to overflow. - ;; Rather than abort the whole scan and raise an error, try to handle it gracefully. - ;; FIXME: This may raise multiple warnings per file. - (error (if (string= "Stack overflow in regexp matcher" (error-message-string err)) - (let ((filename (buffer-substring (point) (1- (re-search-forward ":"))))) - (display-warning 'magit-todos (concat "File has lines too long for Emacs to search. Consider excluding it from scans: " filename))) - (signal (car err) (cdr err))))) + (--when-let (magit-todos--line-item results-regexp) (push it items)) (forward-line 1))) (nreverse items))) (cl-defun magit-todos--git-diff-callback (&key magit-status-buffer results-regexp search-regexp-elisp process heading exclude-globs &allow-other-keys) - "Callback for git diff scanner output." + "Callback for git diff scanner output. +Insert into MAGIT-STATUS-BUFFER. RESULTS-REGEXP matches a result +on each line. SEARCH-REGEXP-ELISP finds the next hunk of +results. PROCESS is the \"git diff\" process object. +`magit-todos-section-heading' is bound to HEADING when inserting +items. EXCLUDE-GLOBS is a list of glob patterns matching +filenames to be excluded." ;; NOTE: Doesn't handle newlines in filenames or diff.mnemonicPrefix. (cl-macrolet ((next-diff () `(re-search-forward (rx bol "diff --git ") nil t)) (next-filename () `(when (re-search-forward (rx bol "+++ b/" (group (1+ nonl))) nil t) @@ -612,6 +670,7 @@ Match items are a list of `magit-todos-item' found in PROCESS's buffer for RESUL (push item items))) (cl-incf line-number)))))) (let ((magit-todos-section-heading heading)) + (setf (buffer-local-value 'magit-todos-branch-item-cache magit-status-buffer) items) (magit-todos--insert-items magit-status-buffer items :branch-p t)))))) (defun magit-todos--delete-section (condition) @@ -660,44 +719,66 @@ Assumes current buffer is ITEM's buffer." "Insert to-do items into current buffer. This function should be called from inside a ‘magit-status’ buffer." (declare (indent defun)) - (when magit-todos-active-scan - ;; Avoid running multiple scans for a single magit-status buffer. - (let ((buffer (process-buffer magit-todos-active-scan))) - (when (process-live-p magit-todos-active-scan) - (delete-process magit-todos-active-scan)) - (when (buffer-live-p buffer) - (kill-buffer buffer))) - (setq magit-todos-active-scan nil)) - (pcase magit-todos-update - ((or 't ; Automatic - ;; Manual and updating now - (and 'nil (guard magit-todos-updating)) - ;; Caching and cache expired - (and (pred integerp) (guard (or magit-todos-updating ; Forced update - (>= (float-time - (time-subtract (current-time) - magit-todos-last-update-time)) - magit-todos-update) - (null magit-todos-last-update-time))))) - ;; Scan and insert. - ;; HACK: I don't like setting a special var here, because it seems like lexically binding a - ;; special var should follow down the chain, but it isn't working, so we'll do this. - (setq magit-todos-updating t) - (setq magit-todos-active-scan (funcall magit-todos-scanner - :callback #'magit-todos--insert-items - :magit-status-buffer (current-buffer) - :directory default-directory - :depth magit-todos-depth))) - (_ ; Caching and cache not expired, or not automatic and not manually updating now - (magit-todos--insert-items (current-buffer) magit-todos-item-cache))) + (when (or magit-todos-update-remote + magit-todos-updating + (not (file-remote-p default-directory))) + (when magit-todos-active-scan + ;; Avoid running multiple scans for a single magit-status buffer. + (let ((buffer (process-buffer magit-todos-active-scan))) + (when (process-live-p magit-todos-active-scan) + (delete-process magit-todos-active-scan)) + (when (buffer-live-p buffer) + (kill-buffer buffer))) + (setq magit-todos-active-scan nil)) + (pcase magit-todos-update + ((or 't ; Automatic + ;; Manual and updating now + (and 'nil (guard magit-todos-updating)) + ;; Caching and cache expired + (and (pred integerp) (guard (or magit-todos-updating ; Forced update + (>= (float-time + (time-subtract (current-time) + magit-todos-last-update-time)) + magit-todos-update) + (null magit-todos-last-update-time))))) + ;; Scan and insert. + ;; HACK: I don't like setting a special var here, because it seems like lexically binding a + ;; special var should follow down the chain, but it isn't working, so we'll do this. + (setq magit-todos-updating t) + (setq magit-todos-active-scan (funcall magit-todos-scanner + :callback #'magit-todos--insert-items + :magit-status-buffer (current-buffer) + :directory default-directory + :depth magit-todos-depth)) + (magit-todos--maybe-insert-branch-todos 'rescan)) + (_ ; Caching and cache not expired, or not automatic and not manually updating now + (magit-todos--insert-items (current-buffer) magit-todos-item-cache) + (magit-todos--maybe-insert-branch-todos 'cached))))) + +(defun magit-todos--maybe-insert-branch-todos (&optional type) + "Insert branch todos when appropriate. +If TYPE is `rescan', rescan for items; if `cached', only insert +cached items, if any; otherwise, use cached items if any, or +rescan." (when (or (eq magit-todos-branch-list t) (and (eq magit-todos-branch-list 'branch) - (not (string= "master" (magit-get-current-branch))))) - ;; Insert branch-local items. - (magit-todos--scan-with-git-diff :magit-status-buffer (current-buffer) - :directory default-directory - :depth magit-todos-depth - :heading (format "TODOs (branched from %s)" magit-todos-branch-list-merge-base-ref)))) + (not (equal (or magit-todos-branch-list-merge-base-ref (magit-main-branch)) + (magit-get-current-branch))))) + (if (or (eq 'rescan type) + (and (not (eq 'cached type)) + (null magit-todos-branch-item-cache))) + ;; TODO: Refactor to just return items and then insert separately. + (magit-todos--scan-with-git-diff + :magit-status-buffer (current-buffer) + :directory default-directory + :depth magit-todos-depth + :heading (format "TODOs (branched from %s)" + (or magit-todos-branch-list-merge-base-ref (magit-main-branch)))) + ;; Just insert cached items, if any. + (let ((magit-todos-section-heading + (format "TODOs (branched from %s)" + (or magit-todos-branch-list-merge-base-ref (magit-main-branch))))) + (magit-todos--insert-items (current-buffer) magit-todos-branch-item-cache :branch-p t))))) (cl-defun magit-todos--insert-items (magit-status-buffer items &key branch-p) "Insert to-do ITEMS into MAGIT-STATUS-BUFFER. @@ -710,13 +791,6 @@ If BRANCH-P is non-nil, do not update `magit-todos-item-cache', (message "`magit-todos--insert-items-callback': Callback called for deleted buffer")) (let* ((items (magit-todos--sort items)) (num-items (length items)) - (group-fns (pcase magit-todos-auto-group-items - ('never nil) - ('always magit-todos-group-by) - ((pred integerp) (when (> num-items magit-todos-auto-group-items) - magit-todos-group-by)) - (_ (error "Invalid value for magit-todos-auto-group-items")))) - (magit-todos-show-filenames (not (member 'magit-todos-item-filename group-fns))) (magit-section-show-child-count t) ;; HACK: "For internal use only." But this makes collapsing the new section work! (magit-insert-section--parent magit-root-section) @@ -738,17 +812,22 @@ If BRANCH-P is non-nil, do not update `magit-todos-item-cache', ;; Insert items (goto-char (point-min)) ;; Go to insertion position - (pcase magit-todos-insert-at - ('top (cl-loop for ((this-section . _) . _) = (magit-section-ident (magit-current-section)) - until (not (member this-section '(branch tags))) - do (magit-section-forward))) - ('bottom (goto-char (oref (-last-item (oref magit-root-section children)) end))) - (_ (magit-todos--skip-section (vector '* magit-todos-insert-at)))) + (goto-char (or (cl-loop for section in magit-todos-insert-after + for pos = (magit-todos--section-end section) + when pos return pos) + (magit-todos--section-end 'bottom))) ;; Insert section - (let ((reminder (if magit-todos-update - "" ; Automatic updates: no reminder - ;; Manual updates: remind user - " (update manually)"))) + (let* ((group-fns (pcase magit-todos-auto-group-items + ('never nil) + ('always magit-todos-group-by) + ((pred integerp) (when (> num-items magit-todos-auto-group-items) + magit-todos-group-by)) + (_ (error "Invalid value for magit-todos-auto-group-items")))) + (magit-todos-show-filenames (not (member 'magit-todos-item-filename group-fns))) + (reminder (if magit-todos-update + "" ; Automatic updates: no reminder + ;; Manual updates: remind user + " (update manually)"))) (if (not items) (unless magit-todos-update ;; Manual updates: Insert section to remind user @@ -763,7 +842,6 @@ If BRANCH-P is non-nil, do not update `magit-todos-item-cache', :group-fns group-fns :items items :depth 0))) - (insert "\n") (magit-todos--set-visibility :section section :num-items num-items))))))))) (cl-defun magit-todos--insert-groups (&key depth group-fns heading type items) @@ -825,7 +903,11 @@ sections." (if (= 1 (length group-fns)) ":" ; Let Magit add the count. ;; Add count ourselves. - (concat " " (format "(%s)" (length items)))))))))) + (concat " " (format "(%s)" (length items))))))) + (when (= 0 depth) + ;; Insert a blank line only in the body of the top-level section, so it + ;; will appear only when the section is expanded, matching other sections. + (insert "\n"))))) (magit-todos--set-visibility :depth depth :num-items (length items) :section section) ;; Add top-level section to root section's children (when (= 0 depth) @@ -859,6 +941,8 @@ sections." (let* ((filename (propertize (magit-todos-item-filename item) 'face 'magit-filename)) (string (--> (concat indent (when magit-todos-show-filenames + (when magit-todos-filename-filter + (setf filename (funcall magit-todos-filename-filter filename))) (concat filename " ")) (funcall (if (s-suffix? ".org" filename) #'magit-todos--format-org @@ -894,20 +978,6 @@ automatically hidden halves at each deeper level." ;; Not hidden: show section manually (necessary for some reason) (magit-section-show section))))) -(defun magit-todos--skip-section (condition) - "Move past the section matching CONDITION. -See `magit-section-match'." - (goto-char (point-min)) - (cl-loop until (magit-section-match condition) - do (magit-section-forward)) - (cl-loop until (not (magit-section-match condition)) - do (condition-case nil - ;; `magit-section-forward' raises an error when there are no more sections. - (magit-section-forward) - (error (progn - (goto-char (1- (point-max))) - (cl-return)))))) - (cl-defun magit-todos--line-item (regexp &optional filename) "Return item on current line, parsing current buffer with REGEXP. FILENAME is added to the item as its filename. Sets match data. @@ -915,7 +985,14 @@ This should be called in a process's output buffer from one of the async callback functions. The calling function should advance to the next line." (let ((case-fold-search magit-todos-ignore-case)) - (when (re-search-forward regexp (line-end-position) t) + (when (condition-case err + (re-search-forward regexp (line-end-position) t) + (error (if (string-match-p "Stack overflow in regexp matcher" (error-message-string err)) + ;; FIXME: This may raise multiple warnings per file. + (let ((filename (buffer-substring (point) (1- (re-search-forward ":"))))) + (message "magit-todos: File has lines too long for Emacs to search. Consider excluding it from scans: %s" filename) + nil) + (signal (car err) (cdr err))))) (make-magit-todos-item :filename (or filename (match-string 8)) :line (--when-let (match-string 2) @@ -942,6 +1019,7 @@ advance to the next line." (defun magit-todos--fontify-like-in-org-mode (s &optional odd-levels) "Fontify string S like in Org-mode. +Bind `org-odd-levels-only' to ODD-LEVELS. `org-fontify-like-in-org-mode' is a very, very slow function because it creates a new temporary buffer and runs `org-mode' for @@ -969,12 +1047,12 @@ useful with absolute paths)." (car (f-split (magit-todos-item-filename item)))) (cl-defun magit-todos--async-start-process (name &key command finish-func) - "Start the executable PROGRAM asynchronously. See `async-start'. + "Start the executable COMMAND asynchronously. See `async-start'. PROGRAM is passed PROGRAM-ARGS, calling FINISH-FUNC with the process object when done. If FINISH-FUNC is nil, the future object will return the process object when the program is finished. Set DEFAULT-DIRECTORY to change PROGRAM's current -working directory. +working directory. Process is named NAME. This is a copy of `async-start-process' that does not override `process-connection-type'. It also uses keyword arguments." @@ -994,7 +1072,7 @@ This is a copy of `async-start-process' that does not override proc))) (defun magit-todos--async-when-done (proc &optional _change) - "Process sentinel used to retrieve the value from the child process. + "Process sentinel used to retrieve the value from the child PROC. This is a copy of `async-when-done' that does not raise an error if the process's buffer has already been deleted." @@ -1017,7 +1095,7 @@ if the process's buffer has already been deleted." (let ((async-current-process proc)) ;; TRAMP processes seem to have the exit status 9 instead of ;; 0. I can't find documentation or code about it. - (if (memq (process-exit-status proc) '(0 9)) + (if (memq (process-exit-status proc) (process-get proc :allow-exit-codes)) (if async-callback-for-process (if async-callback (prog1 @@ -1030,11 +1108,8 @@ if the process's buffer has already been deleted." (backward-sexp) (async-handle-result async-callback (read (current-buffer)) (current-buffer))) - (set (make-local-variable 'async-callback-value) - (list 'error - (format "Async process '%s' failed with exit code %d" - (process-name proc) (process-exit-status proc)))) - (set (make-local-variable 'async-callback-value-set) t)))))) + (error "magit-todos--async-when-done: Process %S failed with exit code %d. Output:%S" + (process-name proc) (process-exit-status proc) (buffer-string))))))) ;;;;; Formatters @@ -1048,6 +1123,7 @@ if the process's buffer has already been deleted." (defun magit-todos--format-org (item) "Return ITEM formatted as from an Org file." + (require 'org) (magit-todos--fontify-like-in-org-mode (concat (magit-todos-item-org-level item) " " (magit-todos-item-keyword item) " " @@ -1063,7 +1139,7 @@ if the process's buffer has already been deleted." (defun magit-todos--sort-by-keyword (a b) "Return non-nil if A's keyword is before B's in `magit-todos-keywords-list'." (cl-flet ((keyword-index (keyword) - (or (-elem-index keyword magit-todos-keywords-list) 0))) + (or (-elem-index keyword magit-todos-keywords-list) 0))) (< (keyword-index (magit-todos-item-keyword a)) (keyword-index (magit-todos-item-keyword b))))) @@ -1088,6 +1164,8 @@ if the process's buffer has already been deleted." ;;;; Scanners (cl-defmacro magit-todos-defscanner (name &key test command results-regexp + (allow-exit-codes '(0)) + (directory-form '(f-relative directory default-directory)) (callback (function 'magit-todos--scan-callback))) "Define a `magit-todos' scanner named NAME. @@ -1102,7 +1180,8 @@ COMMAND is a sexp which should evaluate to the scanner command, i.e. a list of strings to be eventually passed to `start-process'. Nil elements are removed, numbers are converted to strings, and nested lists are flattened into a single list. -It is evaluated each time the scanner is run. +It is evaluated each time the scanner is run. If COMMAND +evaluates to nil, it is not run. Within the COMMAND list these variables are available: @@ -1136,6 +1215,20 @@ appropriate. Custom regexps may also match column numbers or byte offsets in the appropriate numbered groups; see `make-magit-todos-item'. +ALLOW-EXIT-CODES is a list of integers corresponding to exit +codes which should not be interpreted as errors (e.g. rg uses 1 +to indicate no match and no error, so its list should include 0 +and 1). Note that TRAMP seems to use code 9 instead of 0, so 9 +is added to this list automatically. + +DIRECTORY-FORM may be a form within which the symbol `directory' +is bound to the directory path being searched; it should evaluate +to the directory path that should be passed to the +command. (Since some commands' output differs by the way the +search directory is passed, like \"./\" or \".\" vs. a full path, +this may be used to, e.g. ensure that the command does not +include a leading \"./\" in filenames.) + CALLBACK is called to process the process's output buffer. Normally the default should be used, which inserts items into the Magit status buffer which is passed as an argument to the scanner @@ -1163,6 +1256,8 @@ It also adds the scanner to the customization variable (scan-fn-name (concat "magit-todos--scan-with-" name-without-spaces)) (scan-fn-symbol (intern scan-fn-name)) (extra-args-var (intern (format "magit-todos-%s-extra-args" name-without-spaces)))) + (cl-pushnew 9 allow-exit-codes) + (setf allow-exit-codes (sort allow-exit-codes #'<)) `(progn (defcustom ,extra-args-var nil ,(format "Extra arguments passed to %s." name) @@ -1172,17 +1267,20 @@ It also adds the scanner to the customization variable ;; FIXME: That is confusing. (cl-defun ,scan-fn-symbol (&key magit-status-buffer directory depth heading sync callback) - ,(format "Scan for to-dos with %s, then call `%s'. -MAGIT-STATUS-BUFFER is what it says. DIRECTORY is the directory in which to run the scan. DEPTH should be an integer, typically the value of `magit-todos-depth'. HEADING is passed to `%s'. + ,(format "Scan for to-dos with %s. +Then calls CALLBACK. MAGIT-STATUS-BUFFER is what it says. DIRECTORY +is the directory in which to run the scan. DEPTH should be an +integer, typically the value of `magit-todos-depth'. HEADING is +passed to CALLBACK. When SYNC is nil, the scanner process is returned, and CALLBACK is a function which is called by the process sentinel with one argument, a list of match items. When SYNC is non-nil, match items are returned." - name callback callback) + name-without-spaces) (let* ((process-connection-type 'pipe) - (directory (f-relative directory default-directory)) + (directory ,directory-form) (extra-args (when ,extra-args-var (--map (s-split (rx (1+ space)) it 'omit-nulls) ,extra-args-var))) @@ -1222,35 +1320,37 @@ When SYNC is non-nil, match items are returned." (optional (group-n 6 (regexp ,magit-todos-keyword-suffix))) (optional (1+ blank)) (optional (group-n 5 (1+ not-newline))))))))) - (command (-flatten - (-non-nil - (list (when magit-todos-nice - (list "nice" "-n5")) - ,command))))) + (command (-flatten (-non-nil ,command)))) ;; Convert any numbers in command to strings (e.g. depth). (cl-loop for elt in-ref command when (numberp elt) do (setf elt (number-to-string elt))) ;; Run command. - (if sync - ;; Synchronous: return matching items. - (with-temp-buffer - (unless (= 0 (apply #'call-process (car command) nil (current-buffer) nil - (cdr command))) - (user-error (concat (car command) " failed"))) - (magit-todos--buffer-items results-regexp)) - ;; Async: return process. - (magit-todos--async-start-process ,scan-fn-name - :command command - ;; NOTE: This callback chain. - :finish-func (apply-partially ,callback - :callback callback - :magit-status-buffer magit-status-buffer - :results-regexp results-regexp - :search-regexp-elisp search-regexp-elisp - :heading heading - :exclude-globs magit-todos-exclude-globs - :process))))) ; Process is appended to the list. + (when command + (when magit-todos-nice + (setf command (append (list "nice" "-n5") command))) + (if sync + ;; Synchronous: return matching items. + (with-temp-buffer + (unless (member (apply #'call-process (car command) nil (current-buffer) nil + (cdr command)) + ',allow-exit-codes) + (user-error (concat (car command) " failed"))) + (magit-todos--buffer-items results-regexp)) + ;; Async: return process. + (let ((process (magit-todos--async-start-process ,scan-fn-name + :command command + ;; NOTE: This callback chain. + :finish-func (apply-partially ,callback + :callback callback + :magit-status-buffer magit-status-buffer + :results-regexp results-regexp + :search-regexp-elisp search-regexp-elisp + :heading heading + :exclude-globs magit-todos-exclude-globs + :process)))) ; Process is appended to the list. + (setf (process-get process :allow-exit-codes) ',allow-exit-codes) + process))))) (magit-todos--add-to-custom-type 'magit-todos-scanner (list 'const :tag ,name #',scan-fn-symbol)) (add-to-list 'magit-todos-scanners @@ -1270,6 +1370,11 @@ When SYNC is non-nil, match items are returned." (magit-todos-defscanner "rg" :test (executable-find "rg") + :directory-form (if (equal directory default-directory) + ;; Prevent leading "./" in filenames. + nil + (f-relative directory default-directory)) + :allow-exit-codes (0 1) :command (list "rg" "--no-heading" "--line-number" (when depth (list "--maxdepth" (1+ depth))) @@ -1285,6 +1390,7 @@ When SYNC is non-nil, match items are returned." (magit-todos-defscanner "git grep" :test (string-match "--perl-regexp" (shell-command-to-string "git grep --magit-todos-testing-git-grep")) + :allow-exit-codes (0 1) :command (list "git" "--no-pager" "grep" "--full-name" "--no-color" "-n" (when depth @@ -1308,17 +1414,19 @@ When SYNC is non-nil, match items are returned." :command (progn ;; Silence byte-compiler warnings about these vars we don't use in this scanner. (ignore search-regexp-elisp search-regexp-pcre extra-args directory depth) - (list "git" "--no-pager" "diff" "--no-color" "-U0" - (-> "git merge-base HEAD " - (concat magit-todos-branch-list-merge-base-ref) - shell-command-to-string - string-trim))) + (let ((merge-base-ref (-> "git merge-base HEAD " + (concat (or magit-todos-branch-list-merge-base-ref (magit-main-branch))) + shell-command-to-string + string-trim))) + (unless (string-empty-p merge-base-ref) + (list "git" "--no-pager" "diff" "--no-color" "-U0" merge-base-ref)))) :callback 'magit-todos--git-diff-callback) (magit-todos-defscanner "find|grep" ;; NOTE: The filenames output by find|grep have a leading "./". I don't expect this scanner to be ;; used much, if at all, so I'm not going to go to the trouble to fix this now. :test (string-match "--perl-regexp" (shell-command-to-string "grep --help")) + :allow-exit-codes (0 1) :command (let* ((grep-find-template (progn (unless grep-find-template (grep-compute-defaults)) @@ -1353,14 +1461,18 @@ When SYNC is non-nil, match items are returned." ")" "-prune")) (when magit-todos-exclude-globs (list "-o" "(" - (--map (list "-iname" it) - magit-todos-exclude-globs) + (-interpose (list "-o") + (--map (list "-iname" + ;; Arguments to "-iname" must not end in "/". + (replace-regexp-in-string (rx "/" eos) "" it)) + magit-todos-exclude-globs)) ")" "-prune")) (unless magit-todos-submodule-list - (list "-o" "(" - (--map (list "-iname" it) - (magit-list-module-paths)) - ")" "-prune"))) + (when (magit-list-module-paths) + (list "-o" "(" + (--map (list "-ipath" it) + (magit-list-module-paths)) + ")" "-prune")))) (list "-o" "-type" "f") ;; NOTE: This uses "grep -P", i.e. "Interpret the pattern as a ;; Perl-compatible regular expression (PCRE). This is highly @@ -1390,6 +1502,7 @@ When SYNC is non-nil, match items are returned." ;; Helm or Ivy to be installed; it is only called after one of them is loaded. (declare-function helm-make-source "ext:helm-source") +(declare-function helm "ext:helm-core") (with-eval-after-load 'helm (defvar helm-magit-todos-source -- 2.47.3