From f1ed191655d563445b6fb85c991c3155bb9cefa4 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Mon, 7 Jan 2019 14:47:24 +0100 Subject: [PATCH] update magit. Signed-off-by: Andreas Gerler --- elpa/magit-20181110.1820/magit-collab.el | 174 --- elpa/magit-20181110.1820/magit.info | 187 --- .../AUTHORS.md | 6 + .../LICENSE | 0 .../dir | 0 .../git-rebase.el | 4 +- .../magit-apply.el | 2 +- .../magit-autoloads.el | 95 +- .../magit-autorevert.el | 2 +- .../magit-bisect.el | 2 +- .../magit-blame.el | 6 +- .../magit-bookmark.el | 2 +- .../magit-branch.el | 86 +- .../magit-clone.el | 3 +- .../magit-commit.el | 8 +- .../magit-core.el | 2 +- .../magit-diff.el | 105 +- .../magit-ediff.el | 2 +- .../magit-extras.el | 5 +- .../magit-fetch.el | 2 +- .../magit-files.el | 2 +- .../magit-git.el | 96 +- .../magit-gitignore.el | 2 +- .../magit-imenu.el | 2 +- .../magit-log.el | 55 +- .../magit-margin.el | 2 +- .../magit-merge.el | 10 +- .../magit-mode.el | 20 +- .../magit-notes.el | 2 +- .../magit-obsolete.el | 2 +- .../magit-patch.el | 2 +- .../magit-pkg.el | 3 +- .../magit-process.el | 9 +- .../magit-pull.el | 2 +- .../magit-push.el | 2 +- .../magit-refs.el | 40 +- .../magit-remote.el | 2 +- .../magit-repos.el | 28 +- .../magit-reset.el | 2 +- .../magit-section.el | 199 ++- .../magit-sequence.el | 7 +- .../magit-stash.el | 2 +- .../magit-status.el | 41 +- .../magit-submodule.el | 12 +- .../magit-subtree.el | 2 +- .../magit-tag.el | 2 +- .../magit-utils.el | 115 +- .../magit-wip.el | 2 +- .../magit-worktree.el | 38 +- .../magit.el | 3 +- elpa/magit-20190104.1519/magit.info | 187 +++ .../magit.info-1 | 250 ++- .../magit.info-2 | 88 +- elpa/magit-popup-20180329.1302/dir | 18 - .../magit-popup-autoloads.el | 16 - .../magit-popup-pkg.el | 10 - elpa/magit-popup-20180329.1302/magit-popup.el | 1363 ---------------- .../magit-popup.info | 740 --------- elpa/magit-popup-20180509.1041/dir | 18 - .../magit-popup-autoloads.el | 26 - .../magit-popup-pkg.el | 10 - elpa/magit-popup-20180509.1041/magit-popup.el | 1366 ----------------- .../magit-popup.info | 740 --------- 63 files changed, 1047 insertions(+), 5184 deletions(-) delete mode 100644 elpa/magit-20181110.1820/magit-collab.el delete mode 100644 elpa/magit-20181110.1820/magit.info rename elpa/{magit-20181110.1820 => magit-20190104.1519}/AUTHORS.md (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/LICENSE (100%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/dir (100%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/git-rebase.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-apply.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-autoloads.el (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-autorevert.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-bisect.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-blame.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-bookmark.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-branch.el (91%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-clone.el (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-commit.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-core.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-diff.el (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-ediff.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-extras.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-fetch.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-files.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-git.el (96%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-gitignore.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-imenu.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-log.el (96%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-margin.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-merge.el (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-mode.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-notes.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-obsolete.el (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-patch.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-pkg.el (70%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-process.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-pull.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-push.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-refs.el (96%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-remote.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-repos.el (93%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-reset.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-section.el (86%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-sequence.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-stash.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-status.el (94%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-submodule.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-subtree.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-tag.el (98%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-utils.el (93%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-wip.el (99%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit-worktree.el (76%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit.el (99%) create mode 100644 elpa/magit-20190104.1519/magit.info rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit.info-1 (97%) rename elpa/{magit-20181110.1820 => magit-20190104.1519}/magit.info-2 (99%) delete mode 100644 elpa/magit-popup-20180329.1302/dir delete mode 100644 elpa/magit-popup-20180329.1302/magit-popup-autoloads.el delete mode 100644 elpa/magit-popup-20180329.1302/magit-popup-pkg.el delete mode 100644 elpa/magit-popup-20180329.1302/magit-popup.el delete mode 100644 elpa/magit-popup-20180329.1302/magit-popup.info delete mode 100644 elpa/magit-popup-20180509.1041/dir delete mode 100644 elpa/magit-popup-20180509.1041/magit-popup-autoloads.el delete mode 100644 elpa/magit-popup-20180509.1041/magit-popup-pkg.el delete mode 100644 elpa/magit-popup-20180509.1041/magit-popup.el delete mode 100644 elpa/magit-popup-20180509.1041/magit-popup.info diff --git a/elpa/magit-20181110.1820/magit-collab.el b/elpa/magit-20181110.1820/magit-collab.el deleted file mode 100644 index a637c7ae..00000000 --- a/elpa/magit-20181110.1820/magit-collab.el +++ /dev/null @@ -1,174 +0,0 @@ -;;; magit-collab.el --- collaboration tools -*- lexical-binding: t -*- - -;; Copyright (C) 2010-2018 The Magit Project Contributors -;; -;; You should have received a copy of the AUTHORS.md file which -;; lists all contributors. If not, see http://magit.vc/authors. - -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli - -;; Magit 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, or (at your option) -;; any later version. -;; -;; Magit 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 Magit. If not, see http://www.gnu.org/licenses. - -;;; Commentary: - -;; This library implements various collaboration tools. These tools -;; are only early incarnation -- implementing collaboration tools is -;; a top priority for future development. - -;; Currently these tools (including `magit-branch-pull-request', which -;; is defined elsewhere) only support Github, but support for other -;; Git forges as well as mailing list based collaboration is in -;; planning. - -;;; Code: - -(require 'magit) -(require 'ghub) - -;;; Variables - -(defvar magit-github-token-scopes '(repo) - "The Github API scopes needed by Magit. - -`repo' is the only required scope. Without this scope none of -Magit's features that use the API work. Instead of this scope -you could use `public_repo' if you are only interested in public -repositories. - -`repo' Grants read/write access to code, commit statuses, - invitations, collaborators, adding team memberships, and - deployment statuses for public and private repositories - and organizations. - -`public_repo' Grants read/write access to code, commit statuses, - collaborators, and deployment statuses for public repositories - and organizations. Also required for starring public - repositories.") - -;;; Commands - -;;;###autoload -(defun magit-browse-pull-request (pr) - "Visit pull-request PR using `browse-url'. - -Currently this only supports Github, but that restriction will -be lifted eventually to support other Git forges." - (interactive (list (magit-read-pull-request "Visit pull request"))) - (browse-url (format "https://github.com/%s/pull/%s" - (--> pr - (cdr (assq 'base it)) - (cdr (assq 'repo it)) - (cdr (assq 'full_name it))) - (cdr (assq 'number pr))))) - -;;; Utilities - -(defun magit-read-pull-request (prompt) - "Read a pull request from the user, prompting with PROMPT. -Return the Git forge's API response. Currently this function -only supports Github, but that will change eventually." - (let* ((origin (magit-upstream-repository)) - (id (magit--forge-id origin)) - (fmtfun (lambda (pull-request) - (format "%s %s" - (cdr (assq 'number pull-request)) - (cdr (assq 'title pull-request))))) - (prs (ghub-get (format "/repos/%s/pulls" id) nil :auth 'magit)) - (choice (magit-completing-read - prompt (mapcar fmtfun prs) nil nil nil nil - (let ((default (thing-at-point 'github-pull-request))) - (and default (funcall fmtfun default))))) - (number (and (string-match "\\([0-9]+\\)" choice) - (string-to-number (match-string 1 choice))))) - (and number - ;; Don't reuse the pr from the list, it lacks some information - ;; that is only returned when requesting a single pr. #3371 - (ghub-get (format "/repos/%s/pulls/%s" id number) - nil :auth 'magit)))) - -(defun magit-upstream-repository () - "Return the remote name of the upstream repository. - -If the Git variable `magit.upstream' is set, then return its -value. Otherwise return \"origin\". If the remote does not -exist, then raise an error." - (let ((remote (or (magit-get "magit.upstream") "origin"))) - (unless (magit-remote-p remote) - (error "No remote named `%s' exists (consider setting `magit.upstream')" - remote)) - (unless (magit--github-remote-p remote) - (error "Currently only Github is supported")) - remote)) - -(defun magit--forge-id (remote) - (let ((url (magit-get "remote" remote "url"))) - (and (string-match "\\([^:/]+/[^/]+?\\)\\(?:\\.git\\)?\\'" url) - (match-string 1 url)))) - -(defconst magit--github-url-regexp "\ -\\`\\(?:git://\\|git@\\|ssh://git@\\|https://\\)\ -\\(.*?\\)[/:]\ -\\(\\([^:/]+\\)/\\([^/]+?\\)\\)\ -\\(?:\\.git\\)?\\'") - -(defun magit--github-url-p (url) - (save-match-data - (and url - (string-match magit--github-url-regexp url) - (let ((host (match-string 1 url))) - ;; Match values like "github.com-as-someone", which are - ;; translated to just "github.com" according to settings - ;; in "~/.ssh/config". Theoretically this could result - ;; in false-positives, but that's rather unlikely. #3392 - (and (or (string-match-p (regexp-quote "github.com") host) - (string-match-p - (regexp-quote (car (split-string (ghub--host) "/"))) - host)) - host))))) - -(defun magit--github-remote-p (remote) - (or (--when-let (magit-git-string "remote" "get-url" "--push" remote) - (magit--github-url-p it)) - (--when-let (magit-git-string "remote" "get-url" "--all" remote) - (magit--github-url-p it)))) - -(defun magit--github-url-equal (r1 r2) - (or (equal r1 r2) - (save-match-data - (let ((n1 (and (string-match magit--github-url-regexp r1) - (match-string 2 r1))) - (n2 (and (string-match magit--github-url-regexp r2) - (match-string 2 r2)))) - (and n1 n2 (equal n1 n2)))))) - -(defun magit--pullreq-from-upstream-p (pr) - (let-alist pr - (equal .head.repo.full_name - .base.repo.full_name))) - -(defun magit--pullreq-branch (pr &optional assert-new) - (let-alist pr - (let ((branch .head.ref)) - (when (and (not (magit--pullreq-from-upstream-p pr)) - (or (not .maintainer_can_modify) - (magit-branch-p branch))) - (setq branch (format "pr-%s" .number))) - (when (and assert-new (magit-branch-p branch)) - (user-error "Branch `%s' already exists" branch)) - branch))) - -;;; _ -(provide 'magit-collab) -;;; magit-collab.el ends here diff --git a/elpa/magit-20181110.1820/magit.info b/elpa/magit-20181110.1820/magit.info deleted file mode 100644 index 64e27c03..00000000 --- a/elpa/magit-20181110.1820/magit.info +++ /dev/null @@ -1,187 +0,0 @@ -This is magit.info, produced by makeinfo version 6.5 from magit.texi. - - Copyright (C) 2015-2018 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 -* Magit: (magit). Using Git from Emacs with Magit. -END-INFO-DIR-ENTRY - - -Indirect: -magit.info-1: 754 -magit.info-2: 307175 - -Tag Table: -(Indirect) -Node: Top754 -Node: Introduction6307 -Node: Installation11030 -Node: Installing from Melpa11360 -Node: Installing from the Git Repository12433 -Node: Post-Installation Tasks14979 -Node: Getting Started16264 -Node: Interface Concepts21611 -Node: Modes and Buffers21942 -Node: Switching Buffers23691 -Node: Naming Buffers28234 -Node: Quitting Windows31541 -Node: Automatic Refreshing of Magit Buffers33173 -Node: Automatic Saving of File-Visiting Buffers35941 -Node: Automatic Reverting of File-Visiting Buffers37126 -Node: Risk of Reverting Automatically42122 -Node: Sections44505 -Node: Section Movement45446 -Node: Section Visibility49543 -Node: Section Hooks54402 -Node: Section Types and Values56809 -Node: Section Options58112 -Node: Popup Buffers and Prefix Commands58584 -Node: Completion Confirmation and the Selection60965 -Node: Action Confirmation61402 -Node: Completion and Confirmation68748 -Node: The Selection71934 -Node: The hunk-internal region74833 -Node: Support for Completion Frameworks75922 -Node: Additional Completion Options80738 -Node: Running Git81337 -Node: Viewing Git Output81610 -Node: Git Process Status82743 -Node: Running Git Manually83708 -Node: Git Executable86110 -Node: Global Git Arguments88392 -Node: Inspecting89198 -Node: Status Buffer90345 -Node: Status Sections93109 -Node: Status Header Sections97912 -Node: Status Module Sections100542 -Node: Status Options103047 -Node: Repository List104801 -Node: Logging106959 -Node: Refreshing Logs109412 -Node: Log Buffer110797 -Node: Log Margin114592 -Node: Select from Log117232 -Node: Reflog119336 -Node: Cherries120868 -Node: Diffing122595 -Node: Refreshing Diffs125548 -Node: Diff Buffer129039 -Node: Diff Options133623 -Node: Revision Buffer137899 -Node: Ediffing140833 -Node: References Buffer144429 -Node: References Sections154193 -Node: Bisecting155054 -Node: Visiting Blobs156792 -Node: Blaming157302 -Node: Manipulating163113 -Node: Repository Setup163429 -Node: Staging and Unstaging164469 -Node: Staging from File-Visiting Buffers168550 -Node: Applying169718 -Node: Committing171611 -Node: Initiating a Commit172194 -Node: Editing Commit Messages175522 -Node: Branching185918 -Node: The Two Remotes186148 -Node: The Branch Popup188765 -Node: The Branch Config Popup205825 -Node: Auxiliary Branch Commands211766 -Node: Merging212871 -Node: Resolving Conflicts216802 -Node: Rebasing221803 -Node: Editing Rebase Sequences225967 -Node: Information About In-Progress Rebase228997 -Ref: Information About In-Progress Rebase-Footnote-1237746 -Node: Cherry Picking238342 -Node: Reverting242594 -Node: Resetting243968 -Node: Stashing245622 -Node: Transferring250145 -Node: Remotes250383 -Node: The Remote Popup250539 -Node: The Remote Config Popup254007 -Node: Fetching255663 -Node: Pulling257025 -Node: Pushing257868 -Node: Creating and Sending Patches262609 -Node: Applying Patches263446 -Node: Miscellaneous265032 -Node: Tagging265348 -Node: Notes266696 -Node: Submodules269007 -Node: Listing Submodules269221 -Node: Submodule Popup271145 -Node: Subtree273598 -Node: Worktree274838 -Node: Common Commands276048 -Node: Wip Modes277795 -Node: Wip Graph282728 -Node: Legacy Wip Modes285042 -Node: Minor Mode for Buffers Visiting Files287937 -Node: Minor Mode for Buffers Visiting Blobs293353 -Node: Customizing294166 -Node: Per-Repository Configuration295834 -Node: Essential Settings297483 -Node: Safety297807 -Node: Performance299572 -Node: Microsoft Windows Performance307175 -Node: MacOS Performance308366 -Ref: MacOS Performance-Footnote-1309602 -Ref: MacOS Performance-Footnote-2309684 -Ref: MacOS Performance-Footnote-3309744 -Node: Plumbing309910 -Node: Calling Git310733 -Node: Getting a Value from Git312258 -Node: Calling Git for Effect315344 -Node: Section Plumbing321864 -Node: Creating Sections322092 -Node: Section Selection325992 -Node: Matching Sections327791 -Node: Refreshing Buffers333764 -Node: Conventions336906 -Node: Theming Faces337098 -Node: FAQ345213 -Node: FAQ - How to ...?345655 -Node: How to show git's output?346015 -Node: How to install the gitman info manual?346769 -Node: How to show diffs for gpg-encrypted files?347739 -Node: How does branching and pushing work?348335 -Node: Can Magit be used as ediff-version-control-package?348698 -Node: FAQ - Issues and Errors350687 -Node: Magit is slow351619 -Node: I changed several thousand files at once and now Magit is unusable351833 -Node: I am having problems committing352562 -Node: I am using MS Windows and cannot push with Magit353043 -Node: I am using OS X and SOMETHING works in shell but not in Magit353660 -Node: Diffs contain control sequences354466 -Node: Expanding a file to show the diff causes it to disappear355579 -Node: Point is wrong in the COMMIT_EDITMSG buffer356130 -Node: The mode-line information isn't always up-to-date357176 -Node: A branch and tag sharing the same name breaks SOMETHING358258 -Node: My Git hooks work on the command-line but not inside Magit359146 -Node: git-commit-mode isn't used when committing from the command-line359983 -Node: Point ends up inside invisible text when jumping to a file-visiting buffer362250 -Node: Debugging Tools363048 -Node: Keystroke Index364935 -Node: Command Index396948 -Node: Function Index431821 -Node: Variable Index447202 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-20181110.1820/AUTHORS.md b/elpa/magit-20190104.1519/AUTHORS.md similarity index 97% rename from elpa/magit-20181110.1820/AUTHORS.md rename to elpa/magit-20190104.1519/AUTHORS.md index 1ff892fb..3bb6cc95 100644 --- a/elpa/magit-20181110.1820/AUTHORS.md +++ b/elpa/magit-20190104.1519/AUTHORS.md @@ -50,6 +50,7 @@ Contributors - Alban Gruin - Aleksey Uimanov - Alexander Gramiak +- Alex Branham - Alex Dunn - Alexey Voinov - Alex Kost @@ -60,6 +61,7 @@ Contributors - Andreas Liljeqvist - Andreas Rottmann - Andrei Chițu +- Andrew Eggenberger - Andrew Kirkpatrick - Andrew Schwartzmeyer - Andrey Smirnov @@ -114,6 +116,7 @@ Contributors - Dean Kariniemi <8913263+d3k4r@users.noreply.github.com> - Dennis Paskorz - Divye Kapoor +- Dominique Quatravaux - Dominique Quatravaux - Duianto Vebotci - Eli Barzilay @@ -121,6 +124,7 @@ Contributors - Eric Prud'hommeaux - Eric Schulte - Erik Anderson +- Evan Torrie - Evgkeni Sampelnikof - Eyal Lotem - Fabian Wiget @@ -154,6 +158,7 @@ Contributors - Joakim Jalap - Johann Klähn - John Mastro +- John Morris - John Wiegley - Jonas Bernoulli - Jonathan Leech-Pepin @@ -170,6 +175,7 @@ Contributors - Kan-Ru Chen - Kenny Ballou - Keshav Kini +- Kevin Brubeck Unhammer - Kévin Le Gouguec - Kimberly Wolk - Kyle Meyer diff --git a/elpa/magit-20181110.1820/LICENSE b/elpa/magit-20190104.1519/LICENSE similarity index 100% rename from elpa/magit-20181110.1820/LICENSE rename to elpa/magit-20190104.1519/LICENSE diff --git a/elpa/magit-20181110.1820/dir b/elpa/magit-20190104.1519/dir similarity index 100% rename from elpa/magit-20181110.1820/dir rename to elpa/magit-20190104.1519/dir diff --git a/elpa/magit-20181110.1820/git-rebase.el b/elpa/magit-20190104.1519/git-rebase.el similarity index 99% rename from elpa/magit-20181110.1820/git-rebase.el rename to elpa/magit-20190104.1519/git-rebase.el index 07577c5b..daffbf9e 100644 --- a/elpa/magit-20181110.1820/git-rebase.el +++ b/elpa/magit-20190104.1519/git-rebase.el @@ -1,6 +1,6 @@ ;;; git-rebase.el --- Edit Git rebase files -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -383,7 +383,7 @@ remove the command on the current line, if any." (defun git-rebase-noop (&optional arg) "Add noop action at point. -If the current line already contains a a noop action, leave it +If the current line already contains a noop action, leave it unchanged. If there is a commented noop action present, remove the comment. Otherwise add a new noop action. With a prefix argument insert a new noop action regardless what is already diff --git a/elpa/magit-20181110.1820/magit-apply.el b/elpa/magit-20190104.1519/magit-apply.el similarity index 99% rename from elpa/magit-20181110.1820/magit-apply.el rename to elpa/magit-20190104.1519/magit-apply.el index b99057ee..8b7142f7 100644 --- a/elpa/magit-20181110.1820/magit-apply.el +++ b/elpa/magit-20190104.1519/magit-apply.el @@ -1,6 +1,6 @@ ;;; magit-apply.el --- apply Git diffs -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-autoloads.el b/elpa/magit-20190104.1519/magit-autoloads.el similarity index 97% rename from elpa/magit-20181110.1820/magit-autoloads.el rename to elpa/magit-20190104.1519/magit-autoloads.el index 66d8a45e..88fbd6a5 100644 --- a/elpa/magit-20181110.1820/magit-autoloads.el +++ b/elpa/magit-20190104.1519/magit-autoloads.el @@ -419,12 +419,6 @@ Create and checkout an orphan BRANCH with contents from revision START-POINT. \(fn BRANCH START-POINT &optional ARGS)" t nil) -(autoload 'magit-branch-pull-request "magit-branch" "\ -Create and configure a new branch from a pull-request. -Please see the manual for more information. - -\(fn PR)" t nil) - (autoload 'magit-branch-spinoff "magit-branch" "\ Create new branch from the unpushed commits. @@ -648,21 +642,6 @@ Then show the status buffer for the new repository. (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-clone" '("magit-clone-"))) -;;;*** - -;;;### (autoloads nil "magit-collab" "magit-collab.el" (0 0 0 0)) -;;; Generated autoloads from magit-collab.el - -(autoload 'magit-browse-pull-request "magit-collab" "\ -Visit pull-request PR using `browse-url'. - -Currently this only supports Github, but that restriction will -be lifted eventually to support other Git forges. - -\(fn PR)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-collab" '("magit-"))) - ;;;*** ;;;### (autoloads nil "magit-commit" "magit-commit.el" (0 0 0 0)) @@ -1081,6 +1060,26 @@ points at it) otherwise. \(fn &optional TYPE)" t nil) +(autoload 'magit-diff-edit-hunk-commit "magit-extras" "\ +From a hunk, edit the respective commit and visit the file. + +First visit the file being modified by the hunk at the correct +location using `magit-diff-visit-file'. This actually visits a +blob. When point is on a diff header, not within an individual +hunk, then this visits the blob the first hunk is about. + +Then invoke `magit-edit-line-commit', which uses an interactive +rebase to make the commit editable, or if that is not possible +because the commit is not reachable from `HEAD' by checking out +that commit directly. This also causes the actual worktree file +to be visited. + +Neither the blob nor the file buffer are killed when finishing +the rebase. If that is undesirable, then it might be better to +use `magit-rebase-edit-command' instead of this command. + +\(fn)" t nil) + (autoload 'magit-reshelve-since "magit-extras" "\ Change the author and committer dates of the commits since REV. @@ -1430,6 +1429,11 @@ beginning of the line. ;;;### (autoloads nil "magit-log" "magit-log.el" (0 0 0 0)) ;;; Generated autoloads from magit-log.el +(autoload 'magit-log-popup "magit-log" "\ +Popup console for log commands. + +\(fn ARG)" t nil) + (autoload 'magit-log-buffer-file-popup "magit-log" "\ Popup console for log commands. @@ -1488,6 +1492,15 @@ Show log for the definition at point. \(fn FILE FN REV)" t nil) +(autoload 'magit-log-merged "magit-log" "\ +Show log for the merge of COMMIT into BRANCH. +More precisely, find merge commit M that brought COMMIT into +BRANCH, and show the log of the range \"M^..M\". This command +requires git-when-merged, which is available from +https://github.com/mhagger/git-when-merged. + +\(fn COMMIT BRANCH &optional ARGS FILES)" t nil) + (autoload 'magit-reflog-current "magit-log" "\ Display the reflog of the current branch. @@ -1566,7 +1579,7 @@ Before merging, force push the source branch to its push-remote, provided the respective remote branch already exists, ensuring that the respective pull-request (if any) won't get stuck on some obsolete version of the commits that are being merged. Finally -if `magit-branch-pull-request' was used to create the merged +if `forge-branch-pullreq' was used to create the merged branch, branch, then also remove the respective remote branch. \(fn BRANCH &optional ARGS)" t nil) @@ -1578,8 +1591,8 @@ Before merging, force push the source branch to its push-remote, provided the respective remote branch already exists, ensuring that the respective pull-request (if any) won't get stuck on some obsolete version of the commits that are being merged. Finally -if `magit-branch-pull-request' was used to create the merged -branch, then also remove the respective remote branch. +if `forge-branch-pullreq' was used to create the merged branch, +then also remove the respective remote branch. \(fn BRANCH &optional ARGS)" t nil) @@ -2306,10 +2319,36 @@ Non-interactively DIRECTORY is (re-)initialized unconditionally. (autoload 'magit-status "magit-status" "\ Show the status of the current Git repository in a buffer. -With a prefix argument prompt for a repository to be shown. -With two prefix arguments prompt for an arbitrary directory. -If that directory isn't the root of an existing repository, -then offer to initialize it as a new repository. + +If the current directory isn't located within a Git repository, +then prompt for an existing repository or an arbitrary directory, +depending on option `magit-repository-directories', and show the +status of the selected repository instead. + +* If that option specifies any existing repositories, then offer + those for completion and show the status buffer for the + selected one. + +* Otherwise read an arbitrary directory using regular file-name + completion. If the selected directory is the top-level of an + existing working tree, then show the status buffer for that. + +* Otherwise offer to initialize the selected directory as a new + repository. After creating the repository show its status + buffer. + +These fallback behaviors can also be forced using one or more +prefix arguments: + +* With two prefix arguments (or more precisely a numeric prefix + value of 16 or greater) read an arbitrary directory and act on + it as described above. The same could be accomplished using + the command `magit-init'. + +* With a single prefix argument read an existing repository, or + if none can be found based on `magit-repository-directories', + then fall back to the same behavior as with two prefix + arguments. \(fn &optional DIRECTORY CACHE)" t nil) diff --git a/elpa/magit-20181110.1820/magit-autorevert.el b/elpa/magit-20190104.1519/magit-autorevert.el similarity index 99% rename from elpa/magit-20181110.1820/magit-autorevert.el rename to elpa/magit-20190104.1519/magit-autorevert.el index 9001b138..62c7c227 100644 --- a/elpa/magit-20181110.1820/magit-autorevert.el +++ b/elpa/magit-20190104.1519/magit-autorevert.el @@ -1,6 +1,6 @@ ;;; magit-autorevert.el --- revert buffers when files in repository change -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-bisect.el b/elpa/magit-20190104.1519/magit-bisect.el similarity index 99% rename from elpa/magit-20181110.1820/magit-bisect.el rename to elpa/magit-20190104.1519/magit-bisect.el index 735785b7..a4345c7b 100644 --- a/elpa/magit-20181110.1820/magit-bisect.el +++ b/elpa/magit-20190104.1519/magit-bisect.el @@ -1,6 +1,6 @@ ;;; magit-bisect.el --- bisect support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2018 The Magit Project Contributors +;; Copyright (C) 2011-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-blame.el b/elpa/magit-20190104.1519/magit-blame.el similarity index 99% rename from elpa/magit-20181110.1820/magit-blame.el rename to elpa/magit-20190104.1519/magit-blame.el index 99351b75..ed99cf35 100644 --- a/elpa/magit-20181110.1820/magit-blame.el +++ b/elpa/magit-20190104.1519/magit-blame.el @@ -1,6 +1,6 @@ ;;; magit-blame.el --- blame support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2012-2018 The Magit Project Contributors +;; Copyright (C) 2012-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -65,10 +65,10 @@ KEYs are recognized: Face used to highlight the first line of each chunk. If this is nil, then those lines are not highlighted. `heading-format' - String specifing the information to be shown above each + String specifying the information to be shown above each chunk of lines. It must end with a newline character. `margin-format' - String specifing the information to be shown in the left + String specifying the information to be shown in the left buffer margin. It must NOT end with a newline character. This can also be a list of formats used for the lines at the same positions within the chunk. If the chunk has diff --git a/elpa/magit-20181110.1820/magit-bookmark.el b/elpa/magit-20190104.1519/magit-bookmark.el similarity index 99% rename from elpa/magit-20181110.1820/magit-bookmark.el rename to elpa/magit-20190104.1519/magit-bookmark.el index 047132da..2d76f861 100644 --- a/elpa/magit-20181110.1820/magit-bookmark.el +++ b/elpa/magit-20190104.1519/magit-bookmark.el @@ -1,6 +1,6 @@ ;;; magit-bookmark.el --- bookmark support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-branch.el b/elpa/magit-20190104.1519/magit-branch.el similarity index 91% rename from elpa/magit-20181110.1820/magit-branch.el rename to elpa/magit-20190104.1519/magit-branch.el index 7adea0d0..d9e5010b 100644 --- a/elpa/magit-20181110.1820/magit-branch.el +++ b/elpa/magit-20190104.1519/magit-branch.el @@ -1,6 +1,6 @@ ;;; magit-branch.el --- branch support -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -35,7 +35,6 @@ (require 'subr-x)) (require 'magit) -(require 'magit-collab) (require 'magit-reset) ;;; Options @@ -113,7 +112,7 @@ upstream and the push-remote reference the same related branch would be wasteful. Instead a branch like \"maint\" or \"master\" should be used as the upstream. -This option allows specifing the branch that should be used as +This option allows specifying the branch that should be used as the upstream when branching certain remote branches. The value is an alist of the form ((UPSTREAM . RULE)...). The first matching element is used, the following elements are ignored. @@ -211,7 +210,7 @@ and change branch related variables." :variables (lambda () (and magit-branch-popup-show-variables magit-branch-config-variables)) - :actions `((?b "Checkout" magit-checkout) nil + :actions '((?b "Checkout" magit-checkout) nil (?C "Configure..." magit-branch-config-popup) (?l "Checkout local branch" magit-branch-checkout) (?s "Create new spin-off" magit-branch-spinoff) @@ -221,10 +220,7 @@ and change branch related variables." (?x "Reset" magit-branch-reset) (?w "Checkout new worktree" magit-worktree-checkout) (?W "Create new worktree" magit-worktree-branch) - (?k "Delete" magit-branch-delete) - ,@(and (not (require (quote forge) nil t)) - '((?y "Checkout pull-request" magit-checkout-pull-request) - (?Y "Create from pull-request" magit-branch-pull-request)))) + (?k "Delete" magit-branch-delete)) :default-action 'magit-checkout :max-action-columns 3 :setup-function 'magit-branch-popup-setup) @@ -286,7 +282,7 @@ does." (interactive (let ((arg (magit-read-other-branch-or-commit "Checkout"))) (list arg - (and (not (magit-rev-verify-commit arg)) + (and (not (magit-commit-p arg)) (magit-read-starting-point "Create and checkout branch" arg))))) (when (string-match "\\`heads/\\(.+\\)" arg) (setq arg (match-string 1 arg))) @@ -374,78 +370,6 @@ when using `magit-branch-and-checkout'." (interactive (magit-branch-read-args "Create and checkout orphan branch")) (magit-run-git "checkout" "--orphan" args branch start-point)) -;;;###autoload -(defun magit-branch-pull-request (pr) - "Create and configure a new branch from a pull-request. -Please see the manual for more information." - (interactive (list (magit-read-pull-request "Branch pull request"))) - (let-alist pr - (let* ((upstream (or (--first (magit--github-url-equal - (magit-get "remote" it "url") - .base.repo.ssh_url) - (magit-list-remotes)) - (user-error - "Upstream repository %s not available as a remote" - .base.repo.ssh_url))) - (upstream-url (magit-get "remote" upstream "url")) - (remote .head.repo.owner.login) - (branch (magit--pullreq-branch pr t)) - (pr-branch .head.ref)) - (if (magit--pullreq-from-upstream-p pr) - (let ((tracking (concat upstream "/" pr-branch))) - (unless (magit-branch-p tracking) - (magit-call-git "fetch" upstream)) - (let ((inhibit-magit-refresh t)) - (magit-branch-create branch tracking)) - (magit-set upstream "branch" branch "pushRemote") - (magit-set upstream "branch" branch "pullRequestRemote")) - (if (magit-remote-p remote) - (let ((url (magit-get "remote" remote "url")) - (fetch (magit-get-all "remote" remote "fetch"))) - (unless (magit--github-url-equal url .head.repo.ssh_url) - (user-error - "Remote `%s' already exists but does not point to %s" - remote url)) - (unless (member (format "+refs/heads/*:refs/remotes/%s/*" remote) - fetch) - (magit-call-git "remote" "set-branches" - "--add" remote pr-branch) - (magit-call-git "fetch" remote))) - (magit-call-git - "remote" "add" "-f" "--no-tags" - "-t" pr-branch remote - (cond ((or (string-prefix-p "git@" upstream-url) - (string-prefix-p "ssh://git@" upstream-url)) - .head.repo.ssh_url) - ((string-prefix-p "https://" upstream-url) - .head.repo.clone_url) - ((string-prefix-p "git://" upstream-url) - .head.repo.git_url) - (t (error "%s has an unexpected format" upstream-url))))) - (magit-call-git "branch" branch (concat remote "/" pr-branch)) - (if (or .locked (not (equal branch pr-branch))) - (magit-set upstream "branch" branch "pushRemote") - (magit-set remote "branch" branch "pushRemote")) - (magit-set remote "branch" branch "pullRequestRemote")) - (magit-set "true" "branch" branch "rebase") - (magit-call-git "branch" branch - (concat "--set-upstream-to=" - (if magit-branch-prefer-remote-upstream - (concat upstream "/" .base.ref) - .base.ref))) - (magit-set (number-to-string .number) "branch" branch "pullRequest") - (magit-set .title "branch" branch "description") - (magit-refresh) - branch))) - -(defun magit-checkout-pull-request (pr) - "Create, configure and checkout a new branch from a pull-request. -Please see the manual for more information." - (interactive (list (magit-read-pull-request "Checkout pull request"))) - (magit-checkout - (let ((inhibit-magit-refresh t)) - (magit-branch-pull-request pr)))) - (defun magit-branch-read-args (prompt) (let ((args (magit-branch-arguments))) (if magit-branch-read-upstream-first diff --git a/elpa/magit-20181110.1820/magit-clone.el b/elpa/magit-20190104.1519/magit-clone.el similarity index 97% rename from elpa/magit-20181110.1820/magit-clone.el rename to elpa/magit-20190104.1519/magit-clone.el index 7afc1eac..b099c2e4 100644 --- a/elpa/magit-20181110.1820/magit-clone.el +++ b/elpa/magit-20190104.1519/magit-clone.el @@ -1,6 +1,6 @@ ;;; magit-clone.el --- clone a repository -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -75,6 +75,7 @@ Then show the status buffer for the new repository." nil nil (and (string-match "\\([^/:]+?\\)\\(/?\\.git\\)?$" url) (match-string 1 url)))))) + (run-hooks 'magit-credential-hook) (setq directory (file-name-as-directory (expand-file-name directory))) (magit-run-git-async "clone" repository (magit-convert-filename-for-git directory)) diff --git a/elpa/magit-20181110.1820/magit-commit.el b/elpa/magit-20190104.1519/magit-commit.el similarity index 98% rename from elpa/magit-20181110.1820/magit-commit.el rename to elpa/magit-20190104.1519/magit-commit.el index bbd49c88..f47015e1 100644 --- a/elpa/magit-20181110.1820/magit-commit.el +++ b/elpa/magit-20190104.1519/magit-commit.el @@ -1,6 +1,6 @@ ;;; magit-commit.el --- create Git commits -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -228,6 +228,7 @@ and ignore the option. (let ((process-environment process-environment)) (unless override-date (push (magit-rev-format "GIT_COMMITTER_DATE=%cD") process-environment)) + (cl-pushnew "--allow-empty" args :test #'equal) (magit-run-git-with-editor "commit" "--amend" "--only" args))) ;;;###autoload @@ -314,10 +315,11 @@ depending on the value of option `magit-commit-squash-confirm'." rebase) (magit-commit-amend-assert commit) (magit-rebase-interactive-1 commit - (list "--autosquash" "--autostash") + (list "--autosquash" "--autostash" "--keep-empty") "" "true" nil t))) (format "Type %%p on a commit to %s into it," - (substring option 2))) + (substring option 2)) + nil nil nil commit) (when magit-commit-show-diff (let ((magit-display-buffer-noselect t)) (apply #'magit-diff-staged nil (magit-diff-arguments))))))) diff --git a/elpa/magit-20181110.1820/magit-core.el b/elpa/magit-20190104.1519/magit-core.el similarity index 98% rename from elpa/magit-20181110.1820/magit-core.el rename to elpa/magit-20190104.1519/magit-core.el index 2bad54c1..93085171 100644 --- a/elpa/magit-20181110.1820/magit-core.el +++ b/elpa/magit-20190104.1519/magit-core.el @@ -1,6 +1,6 @@ ;;; magit-core.el --- core functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-diff.el b/elpa/magit-20190104.1519/magit-diff.el similarity index 97% rename from elpa/magit-20181110.1820/magit-diff.el rename to elpa/magit-20190104.1519/magit-diff.el index e033d1db..6de0e278 100644 --- a/elpa/magit-20181110.1820/magit-diff.el +++ b/elpa/magit-20190104.1519/magit-diff.el @@ -1,6 +1,6 @@ ;;; magit-diff.el --- inspect Git diffs -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -158,15 +158,23 @@ keep their distinct foreground colors." (defcustom magit-diff-refine-hunk nil "Whether to show word-granularity differences within diff hunks. -nil never show fine differences. -t show fine differences for the current diff hunk only. -`all' show fine differences for all displayed diff hunks." +nil Never show fine differences. +t Show fine differences for the current diff hunk only. +`all' Show fine differences for all displayed diff hunks." :group 'magit-diff :safe (lambda (val) (memq val '(nil t all))) :type '(choice (const :tag "Never" nil) (const :tag "Current" t) (const :tag "All" all))) +(defcustom magit-diff-refine-ignore-whitespace smerge-refine-ignore-whitespace + "Whether to ignore whitespace changes in word-granularity differences." + :package-version '(magit . "2.91.0") + :set-after '(smerge-refine-ignore-whitespace) + :group 'magit-diff + :safe 'booleanp + :type 'boolean) + (put 'magit-diff-refine-hunk 'permanent-local t) (defcustom magit-diff-adjust-tab-width nil @@ -177,7 +185,7 @@ opening large and/or many files, so the widths are cached in the variable `magit-diff--tab-width-cache'. Set that to nil to invalidate the cache. -nil Never ajust tab width. Use `tab-width's value from +nil Never adjust tab width. Use `tab-width's value from the Magit buffer itself instead. t If the corresponding file-visiting buffer exits, then @@ -192,22 +200,46 @@ NUMBER Like `always', but don't visit files larger than NUMBER bytes." :package-version '(magit . "2.12.0") :group 'magit-diff - :type '(choice (const :tag "Never" nil) - (const :tag "If file-visiting buffer exists" t) - (const :tag "... or file isn't larger than bytes" all) - (const :tag "Always" always))) + :type '(choice (const :tag "Never" nil) + (const :tag "If file-visiting buffer exists" t) + (integer :tag "If file isn't larger than N bytes") + (const :tag "Always" always))) (defcustom magit-diff-paint-whitespace t "Specify where to highlight whitespace errors. -See `magit-diff-highlight-trailing', -`magit-diff-highlight-indentation'. The symbol t means in all -diffs, `status' means only in the status buffer, and nil means -nowhere." + +nil Never highlight whitespace errors. +t Highlight whitespace errors everywhere. +`uncommitted' Only highlight whitespace errors in diffs + showing uncommitted changes. + +For backward compatibility `status' is treated as a synonym +for `uncommitted'. + +The option `magit-diff-paint-whitespace-lines' controls for +what lines (added/remove/context) errors are highlighted. + +The options `magit-diff-highlight-trailing' and +`magit-diff-highlight-indentation' control what kind of +whitespace errors are highlighted." :group 'magit-diff - :safe (lambda (val) (memq val '(t nil status))) - :type '(choice (const :tag "Always" t) - (const :tag "Never" nil) - (const :tag "In status buffer" status))) + :safe (lambda (val) (memq val '(t nil uncommitted status))) + :type '(choice (const :tag "In all diffs" t) + (const :tag "Only in uncommitted changes" uncommitted) + (const :tag "Never" nil))) + +(defcustom magit-diff-paint-whitespace-lines t + "Specify in what kind of lines to highlight whitespace errors. + +t Highlight only in added lines. +`both' Highlight in added and removed lines. +`all' Highlight in added, removed and context lines." + :package-version '(magit . "2.91.0") + :group 'magit-diff + :safe (lambda (val) (memq val '(t both all))) + :type '(choice (const :tag "in added lines" t) + (const :tag "in added and removed lines" both) + (const :tag "in added, removed and context lines" all))) (defcustom magit-diff-highlight-trailing t "Whether to highlight whitespace at the end of a line in diffs. @@ -1058,7 +1090,7 @@ for a revision." (when module (setq default-directory (expand-file-name (file-name-as-directory module)))) - (unless (magit-rev-verify-commit rev) + (unless (magit-commit-p rev) (user-error "%s is not a commit" rev)) (magit-mode-setup #'magit-revision-mode rev nil args files))) @@ -1354,7 +1386,7 @@ whether `magit-diff-visit-file' uses this function." With a prefix argument display it in the current window. Option `magit-display-file-buffer-function' controls whether `magit-diff-visit-file' uses this function." - (if (or current-prefix-arg (get-buffer-window buffer)) + (if current-prefix-arg (switch-to-buffer buffer) (pop-to-buffer buffer))) @@ -2090,12 +2122,12 @@ or a ref which is not a branch, then it inserts nothing." (`quicker ; false negatives (number-less hashes) (and (>= (length text) 7) (string-match-p "[0-9]" text) - (magit-rev-verify-commit text))) + (magit-commit-p text))) (`quick ; false negatives (short hashes) (and (>= (length text) 7) - (magit-rev-verify-commit text))) + (magit-commit-p text))) (`slow - (magit-rev-verify-commit text))) + (magit-commit-p text))) (put-text-property beg (point) 'face 'magit-hash) (let ((end (point))) (goto-char beg) @@ -2546,6 +2578,7 @@ are highlighted." (goto-char (oref section start)) (let ((end (oref section end)) (merging (looking-at "@@@")) + (diff-type (magit-diff-type)) (stage nil) (tab-width (magit-diff-tab-width (magit-section-parent-value section)))) @@ -2570,14 +2603,16 @@ are highlighted." 'magit-diff-conflict-heading) ((looking-at (if merging "^\\(\\+\\| \\+\\)" "^\\+")) (magit-diff-paint-tab merging tab-width) - (magit-diff-paint-whitespace merging) + (magit-diff-paint-whitespace merging 'added diff-type) (or stage (if highlight 'magit-diff-added-highlight 'magit-diff-added))) ((looking-at (if merging "^\\(-\\| -\\)" "^-")) (magit-diff-paint-tab merging tab-width) + (magit-diff-paint-whitespace merging 'removed diff-type) (if highlight 'magit-diff-removed-highlight 'magit-diff-removed)) (t (magit-diff-paint-tab merging tab-width) + (magit-diff-paint-whitespace merging 'context diff-type) (if highlight 'magit-diff-context-highlight 'magit-diff-context)))) (forward-line)))))) (magit-diff-update-hunk-refinement section)) @@ -2619,11 +2654,15 @@ are highlighted." 'display (list (list 'space :width width))) (forward-char)))) -(defun magit-diff-paint-whitespace (merging) +(defun magit-diff-paint-whitespace (merging line-type diff-type) (when (and magit-diff-paint-whitespace - (or (derived-mode-p 'magit-status-mode) - (not (eq magit-diff-paint-whitespace 'status)))) - (let ((prefix (if merging "^[-\\+\s]\\{2\\}" "^[-\\+]")) + (or (not (memq magit-diff-paint-whitespace '(uncommitted status))) + (memq diff-type '(staged unstaged))) + (cl-case line-type + (added t) + (removed (memq magit-diff-paint-whitespace-lines '(all both))) + (context (memq magit-diff-paint-whitespace-lines '(all))))) + (let ((prefix (if merging "^[-\\+\s]\\{2\\}" "^[-\\+\s]")) (indent (if (local-variable-p 'magit-diff-highlight-indentation) magit-diff-highlight-indentation @@ -2637,6 +2676,7 @@ are highlighted." (looking-at (concat prefix ".*?\\([ \t]+\\)$"))) (let ((ov (make-overlay (match-beginning 1) (match-end 1) nil t))) (overlay-put ov 'face 'magit-diff-whitespace-warning) + (overlay-put ov 'priority 2) (overlay-put ov 'evaporate t))) (when (or (and (eq indent 'tabs) (looking-at (concat prefix "\\( *\t[ \t]*\\)"))) @@ -2645,6 +2685,7 @@ are highlighted." prefix indent)))) (let ((ov (make-overlay (match-beginning 1) (match-end 1) nil t))) (overlay-put ov 'face 'magit-diff-whitespace-warning) + (overlay-put ov 'priority 2) (overlay-put ov 'evaporate t)))))) (defun magit-diff-update-hunk-refinement (&optional section) @@ -2659,8 +2700,10 @@ are highlighted." (goto-char (oref section start)) ;; `diff-refine-hunk' does not handle combined diffs. (unless (looking-at "@@@") - ;; Avoid fsyncing many small temp files - (let ((write-region-inhibit-fsync t)) + (let ((smerge-refine-ignore-whitespace + magit-diff-refine-ignore-whitespace) + ;; Avoid fsyncing many small temp files + (write-region-inhibit-fsync t)) (diff-refine-hunk))))) ((or `(nil t ,_) `(t t nil)) (oset section refined nil) @@ -2786,8 +2829,8 @@ last (visual) lines of the region." (defun magit-diff-inside-hunk-body-p () "Return non-nil if point is inside the body of a hunk." (and (magit-section-match 'hunk) - (> (point) - (oref (magit-current-section) content)))) + (when-let ((content (oref (magit-current-section) content))) + (> (point) content)))) ;;; Diff Extract diff --git a/elpa/magit-20181110.1820/magit-ediff.el b/elpa/magit-20190104.1519/magit-ediff.el similarity index 99% rename from elpa/magit-20181110.1820/magit-ediff.el rename to elpa/magit-20190104.1519/magit-ediff.el index 41b3d83f..2ee4cf6e 100644 --- a/elpa/magit-20181110.1820/magit-ediff.el +++ b/elpa/magit-20190104.1519/magit-ediff.el @@ -1,6 +1,6 @@ ;;; magit-ediff.el --- Ediff extension for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-extras.el b/elpa/magit-20190104.1519/magit-extras.el similarity index 99% rename from elpa/magit-20181110.1820/magit-extras.el rename to elpa/magit-20190104.1519/magit-extras.el index cd0649ab..f217d873 100644 --- a/elpa/magit-20181110.1820/magit-extras.el +++ b/elpa/magit-20190104.1519/magit-extras.el @@ -1,6 +1,6 @@ ;;; magit-extras.el --- additional functionality for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -321,6 +321,7 @@ points at it) otherwise." (put 'magit-edit-line-commit 'disabled t) +;;;###autoload (defun magit-diff-edit-hunk-commit () "From a hunk, edit the respective commit and visit the file. @@ -627,7 +628,7 @@ above." (match-string 1 r) r))) ((eq major-mode 'magit-status-mode) "HEAD")))) - (when (magit-rev-verify-commit rev) + (when (magit-commit-p rev) (setq rev (magit-rev-parse rev)) (push (list rev default-directory) magit-revision-stack) (kill-new (message "%s" rev)))))) diff --git a/elpa/magit-20181110.1820/magit-fetch.el b/elpa/magit-20190104.1519/magit-fetch.el similarity index 98% rename from elpa/magit-20181110.1820/magit-fetch.el rename to elpa/magit-20190104.1519/magit-fetch.el index dc04233c..81b1a82b 100644 --- a/elpa/magit-20181110.1820/magit-fetch.el +++ b/elpa/magit-20190104.1519/magit-fetch.el @@ -1,6 +1,6 @@ ;;; magit-fetch.el --- download objects and refs -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-files.el b/elpa/magit-20190104.1519/magit-files.el similarity index 99% rename from elpa/magit-20181110.1820/magit-files.el rename to elpa/magit-20190104.1519/magit-files.el index 094539f2..c18626bc 100644 --- a/elpa/magit-20181110.1820/magit-files.el +++ b/elpa/magit-20190104.1519/magit-files.el @@ -1,6 +1,6 @@ ;;; magit-files.el --- finding files -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-git.el b/elpa/magit-20190104.1519/magit-git.el similarity index 96% rename from elpa/magit-20181110.1820/magit-git.el rename to elpa/magit-20190104.1519/magit-git.el index 6ebf2981..5675918c 100644 --- a/elpa/magit-20181110.1820/magit-git.el +++ b/elpa/magit-20190104.1519/magit-git.el @@ -1,6 +1,6 @@ ;;; magit-git.el --- Git functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -42,7 +42,10 @@ (declare-function magit-process-file "magit-process" (&rest args)) (declare-function magit-process-insert-section "magit-process" (pwe program args &optional errcode errlog)) +(declare-function magit-mode-get-buffer "magit-mode" + (mode &optional create frame value)) (declare-function magit-refresh "magit-mode" ()) +(defvar magit-this-error) (defvar magit-process-error-message-regexps) (defvar magit-refresh-args) ; from `magit-mode' for `magit-current-file' (defvar magit-branch-prefer-remote-upstream) @@ -277,6 +280,56 @@ to do the following. "Execute Git with ARGS, returning t if its exit code is 1." (= (magit-git-exit-code args) 1)) +(defun magit-git-string-p (&rest args) + "Execute Git with ARGS, returning the first line of its output. +If the exit code isn't zero or if there is no output, then return +nil. Neither of these results is considered an error; if that is +what you want, then use `magit-git-string-ng' instead. + +This is an experimental replacement for `magit-git-string', and +still subject to major changes." + (magit--with-refresh-cache (cons default-directory args) + (with-temp-buffer + (and (zerop (apply #'magit-process-file magit-git-executable nil t nil + (magit-process-git-arguments args))) + (not (bobp)) + (progn + (goto-char (point-min)) + (buffer-substring-no-properties (point) (line-end-position))))))) + +(defun magit-git-string-ng (&rest args) + "Execute Git with ARGS, returning the first line of its output. +If the exit code isn't zero or if there is no output, then that +is considered an error, but instead of actually signaling an +error, return nil. Additionally the output is put in the process +buffer (creating it if necessary) and the error message is shown +in the status buffer (provided it exists). + +This is an experimental replacement for `magit-git-string', and +still subject to major changes. Also see `magit-git-string-p'." + (magit--with-refresh-cache + (list default-directory 'magit-git-string-ng args) + (with-temp-buffer + (let* ((args (magit-process-git-arguments args)) + (status (apply #'magit-process-file magit-git-executable + nil t nil args))) + (if (zerop status) + (and (not (bobp)) + (progn + (goto-char (point-min)) + (buffer-substring-no-properties + (point) (line-end-position)))) + (let ((buf (current-buffer))) + (with-current-buffer (magit-process-buffer t) + (magit-process-insert-section default-directory + magit-git-executable args + status buf))) + (when-let ((status-buf (magit-mode-get-buffer 'magit-status-mode))) + (let ((msg (magit--locate-error-message))) + (with-current-buffer status-buf + (setq magit-this-error msg)))) + nil))))) + (defun magit-git-str (&rest args) "Execute Git with ARGS, returning the first line of its output. If there is no output, return nil. If the output begins with a @@ -339,13 +392,9 @@ add a section in the respective process buffer." (setq msg (with-temp-buffer (insert-file-contents log) (goto-char (point-max)) - (cond - ((functionp magit-git-debug) - (funcall magit-git-debug (buffer-string))) - ((run-hook-wrapped - 'magit-process-error-message-regexps - (lambda (re) (re-search-backward re nil t))) - (match-string-no-properties 1))))) + (if (functionp magit-git-debug) + (funcall magit-git-debug (buffer-string)) + (magit--locate-error-message)))) (let ((magit-git-debug nil)) (with-current-buffer (magit-process-buffer t) (magit-process-insert-section default-directory @@ -357,6 +406,12 @@ add a section in the respective process buffer." (apply #'magit-process-file magit-git-executable nil (list t nil) nil args))) +(defun magit--locate-error-message () + (goto-char (point-max)) + (and (run-hook-wrapped 'magit-process-error-message-regexps + (lambda (re) (re-search-backward re nil t))) + (match-string-no-properties 1))) + (defun magit-git-string (&rest args) "Execute Git with ARGS, returning the first line of its output. If there is no output, return nil. If the output begins with a @@ -950,18 +1005,22 @@ string \"true\", otherwise return nil." (equal (magit-git-str "rev-parse" args) "true")) (defun magit-rev-verify (rev) - (magit-rev-parse-safe "--verify" rev)) + (magit-git-string-p "rev-parse" "--verify" rev)) -(defun magit-rev-verify-commit (rev) +(defun magit-commit-p (rev) "Return full hash for REV if it names an existing commit." (magit-rev-verify (concat rev "^{commit}"))) +(defalias 'magit-rev-verify-commit 'magit-commit-p) + (defun magit-rev-equal (a b) + "Return t if there are no differences between the commits A and B." (magit-git-success "diff" "--quiet" a b)) (defun magit-rev-eq (a b) - (let ((a (magit-rev-verify a)) - (b (magit-rev-verify b))) + "Return t if A and B refer to the same commit." + (let ((a (magit-commit-p a)) + (b (magit-commit-p b))) (and a b (equal a b)))) (defun magit-rev-ancestor-p (a b) @@ -1314,10 +1373,13 @@ as into its upstream." (pcase-let ((`(,url ,branch) (split-string branch " "))) (cons url branch))) ((string-match "/" branch) - (let ((remote (substring branch 0 (match-beginning 0)))) - (if (save-match-data (member remote (magit-list-remotes))) - (cons remote (substring branch (match-end 0))) - (error "Invalid branch name %s" branch)))))) + (or (-some (lambda (remote) + (and (string-match (format "\\`\\(%s\\)/\\(.+\\)\\'" remote) + branch) + (cons (match-string 1 branch) + (match-string 2 branch)))) + (magit-list-remotes)) + (error "Invalid branch name %s" branch))))) (defun magit-get-current-tag (&optional rev with-distance) "Return the closest tag reachable from REV. @@ -1852,7 +1914,7 @@ and this option only controls what face is used.") (defun magit-thingatpt--git-revision () (--when-let (bounds-of-thing-at-point 'git-revision) (let ((text (buffer-substring-no-properties (car it) (cdr it)))) - (and (magit-rev-verify-commit text) text)))) + (and (magit-commit-p text) text)))) ;;; Completion diff --git a/elpa/magit-20181110.1820/magit-gitignore.el b/elpa/magit-20190104.1519/magit-gitignore.el similarity index 98% rename from elpa/magit-20181110.1820/magit-gitignore.el rename to elpa/magit-20190104.1519/magit-gitignore.el index 1d4e84a9..d1d96bde 100644 --- a/elpa/magit-20181110.1820/magit-gitignore.el +++ b/elpa/magit-20190104.1519/magit-gitignore.el @@ -1,6 +1,6 @@ ;;; magit-gitignore.el --- intentionally untracked files -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-imenu.el b/elpa/magit-20190104.1519/magit-imenu.el similarity index 99% rename from elpa/magit-20181110.1820/magit-imenu.el rename to elpa/magit-20190104.1519/magit-imenu.el index 52b7ed6b..2b2c298d 100644 --- a/elpa/magit-20181110.1820/magit-imenu.el +++ b/elpa/magit-20190104.1519/magit-imenu.el @@ -1,6 +1,6 @@ ;;; magit-imenu.el --- Integrate Imenu in magit major modes -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-log.el b/elpa/magit-20190104.1519/magit-log.el similarity index 96% rename from elpa/magit-20181110.1820/magit-log.el rename to elpa/magit-20190104.1519/magit-log.el index cbaca5b9..1844ed62 100644 --- a/elpa/magit-20181110.1820/magit-log.el +++ b/elpa/magit-20190104.1519/magit-log.el @@ -1,6 +1,6 @@ ;;; magit-log.el --- inspect Git history -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -144,12 +144,17 @@ This is useful if you use really long branch names." (function-item magit-log-header-line-sentence) function)) -(defcustom magit-log-trace-definition-function 'which-function +(defcustom magit-log-trace-definition-function 'magit-which-function "Function used to determine the function at point. -This is used by the command `magit-log-trace-definition'." - :package-version '(magit . "2.90.0") +This is used by the command `magit-log-trace-definition'. +You should prefer `magit-which-function' over `which-function' +because the latter may make use of Imenu's outdated cache." + :package-version '(magit . "2.91.0") :group 'magit-log - :type '(choice (function-item which-function) function)) + :type '(choice (function-item magit-which-function) + (function-item which-function) + (function-item add-log-current-defun) + function)) (defface magit-log-graph '((((class color) (background light)) :foreground "grey30") @@ -487,6 +492,7 @@ header." (t (magit-log-get-buffer-args)))) +;;;###autoload (defun magit-log-popup (arg) "Popup console for log commands." (interactive "P") @@ -733,7 +739,19 @@ active, restrict the log to the lines that the region touches." (magit-mode-setup-internal #'magit-log-mode (list (list rev) - (cons (format "-L:%s:%s" (regexp-quote fn) file) + (cons (format "-L:%s%s:%s" + (regexp-quote fn) + (if (derived-mode-p 'lisp-mode 'emacs-lisp-mode) + ;; Git doesn't treat "-" the same way as + ;; "_", leading to false-positives such as + ;; "foo-suffix" being considered a match + ;; for "foo". Wing it. + "\\( \\|$\\)" + ;; We could use "\\b" here, but since Git + ;; already does something equivalent, that + ;; isn't necessary. + "") + file) (cl-delete "-L" (car (magit-log-arguments)) :test 'string-prefix-p)) nil) @@ -753,6 +771,27 @@ active, restrict the log to the lines that the region touches." (goto-char pos) (call-interactively #'magit-log-trace-definition))))) +;;;###autoload +(defun magit-log-merged (commit branch &optional args files) + "Show log for the merge of COMMIT into BRANCH. +More precisely, find merge commit M that brought COMMIT into +BRANCH, and show the log of the range \"M^..M\". This command +requires git-when-merged, which is available from +https://github.com/mhagger/git-when-merged." + (interactive + (append (let ((commit (magit-read-branch-or-commit "Commit"))) + (list commit + (magit-read-other-branch "Merged into" commit))) + (magit-log-arguments))) + (unless (executable-find "git-when-merged") + (user-error "This command requires git-when-merged (%s)" + "https://github.com/mhagger/git-when-merged")) + (magit-git-log + (list (or (magit-git-string "when-merged" "--show-branch" commit branch) + (user-error "Could not find when %s was merged into %s" + commit branch))) + args files)) + (defun magit-git-reflog (ref args) (require 'magit) (magit-mode-setup #'magit-reflog-mode ref args)) @@ -839,7 +878,7 @@ is displayed in the current frame." (let* ((section (magit-current-section)) (parent-rev (format "%s^%s" (oref section value) (or n 1)))) (if-let ((parent-hash (magit-rev-parse "--short" parent-rev))) - (if-let ((parent (--first (equal (oref section value) + (if-let ((parent (--first (equal (oref it value) parent-hash) (magit-section-siblings section 'next)))) (magit-section-goto parent) @@ -1425,6 +1464,8 @@ Type \\[magit-log-select-quit] to abort without selecting a commit." (defun magit-log-select (pick &optional msg quit branch args initial) (declare (indent defun)) + (unless initial + (setq initial (magit-commit-at-point))) (magit-mode-setup #'magit-log-select-mode (or branch (magit-get-current-branch) "HEAD") (append args magit-log-select-arguments)) diff --git a/elpa/magit-20181110.1820/magit-margin.el b/elpa/magit-20190104.1519/magit-margin.el similarity index 99% rename from elpa/magit-20181110.1820/magit-margin.el rename to elpa/magit-20190104.1519/magit-margin.el index 5aaa4f53..ad8b3595 100644 --- a/elpa/magit-20181110.1820/magit-margin.el +++ b/elpa/magit-20190104.1519/magit-margin.el @@ -1,6 +1,6 @@ ;;; magit-margin.el --- margins in Magit buffers -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-merge.el b/elpa/magit-20190104.1519/magit-merge.el similarity index 97% rename from elpa/magit-20181110.1820/magit-merge.el rename to elpa/magit-20190104.1519/magit-merge.el index eada3953..4c1fe233 100644 --- a/elpa/magit-20181110.1820/magit-merge.el +++ b/elpa/magit-20190104.1519/magit-merge.el @@ -1,6 +1,6 @@ ;;; magit-merge.el --- merge functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -106,7 +106,7 @@ Before merging, force push the source branch to its push-remote, provided the respective remote branch already exists, ensuring that the respective pull-request (if any) won't get stuck on some obsolete version of the commits that are being merged. Finally -if `magit-branch-pull-request' was used to create the merged +if `forge-branch-pullreq' was used to create the merged branch, branch, then also remove the respective remote branch." (interactive (list (magit-read-other-local-branch @@ -128,8 +128,8 @@ Before merging, force push the source branch to its push-remote, provided the respective remote branch already exists, ensuring that the respective pull-request (if any) won't get stuck on some obsolete version of the commits that are being merged. Finally -if `magit-branch-pull-request' was used to create the merged -branch, then also remove the respective remote branch." +if `forge-branch-pullreq' was used to create the merged branch, +then also remove the respective remote branch." (interactive (list (magit-read-other-local-branch "Absorb branch") (magit-merge-arguments))) (magit--merge-absort branch args)) @@ -137,7 +137,7 @@ branch, then also remove the respective remote branch." (defun magit--merge-absort (branch args) (when (equal branch "master") (unless (yes-or-no-p - "Do you really want to to merge `master' into another branch? ") + "Do you really want to merge `master' into another branch? ") (user-error "Abort"))) (if-let ((target (magit-get-push-branch branch t))) (progn diff --git a/elpa/magit-20181110.1820/magit-mode.el b/elpa/magit-20190104.1519/magit-mode.el similarity index 98% rename from elpa/magit-20181110.1820/magit-mode.el rename to elpa/magit-20190104.1519/magit-mode.el index 736e59ae..3b6e06bb 100644 --- a/elpa/magit-20181110.1820/magit-mode.el +++ b/elpa/magit-20190104.1519/magit-mode.el @@ -1,6 +1,6 @@ ;;; magit-mode.el --- create and refresh Magit buffers -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -451,9 +451,9 @@ starts complicating other things, then it will be removed." (define-key map "Z" 'magit-stash-popup) (define-key map ":" 'magit-git-command) (define-key map "!" 'magit-run-popup) - (define-key map (kbd "C-c C-b") 'magit-browse-thing) (define-key map (kbd "C-c C-c") 'magit-dispatch-popup) - (define-key map (kbd "C-c C-e") 'magit-dispatch-popup) + (define-key map (kbd "C-c C-e") 'magit-edit-thing) + (define-key map (kbd "C-c C-w") 'magit-browse-thing) (define-key map (kbd "C-x a") 'magit-add-change-log-entry) (define-key map (kbd "C-x 4 a") 'magit-add-change-log-entry-other-window) (define-key map (kbd "C-w") 'magit-copy-section-value) @@ -646,18 +646,22 @@ locked to its value, which is derived from MODE and ARGS." (defvar magit-display-buffer-noselect nil "If non-nil, then `magit-display-buffer' doesn't call `select-window'.") -(defun magit-display-buffer (buffer) +(defun magit-display-buffer (buffer &optional display-function) "Display BUFFER in some window and maybe select it. -Display the buffer using `magit-display-buffer-function' and -then, unless `magit-display-buffer-noselect' is non-nil, select +If optional DISPLAY-FUNCTION is non-nil, then use that to display +the buffer. Otherwise use `magit-display-buffer-function', which +is the normal case. + +Then, unless `magit-display-buffer-noselect' is non-nil, select the window which was used to display the buffer. Also run the hooks `magit-pre-display-buffer-hook' and `magit-post-display-buffer-hook'." (with-current-buffer buffer (run-hooks 'magit-pre-display-buffer-hook)) - (let ((window (funcall magit-display-buffer-function buffer))) + (let ((window (funcall (or display-function magit-display-buffer-function) + buffer))) (unless magit-display-buffer-noselect (let* ((old-frame (selected-frame)) (new-frame (window-frame window))) @@ -902,7 +906,7 @@ latter is displayed in its place." major-mode value))) (user-error "Buffer has no value it could be locked to")))) -(defvar magit-buffer-lock-functions nil +(defvar magit-buffer-lock-functions '((forge-topic-mode . car)) "Provide buffer-locking support for third-party modes. An alist of symbols to functions. diff --git a/elpa/magit-20181110.1820/magit-notes.el b/elpa/magit-20190104.1519/magit-notes.el similarity index 99% rename from elpa/magit-20181110.1820/magit-notes.el rename to elpa/magit-20190104.1519/magit-notes.el index e4806a23..9987bdd4 100644 --- a/elpa/magit-20181110.1820/magit-notes.el +++ b/elpa/magit-20190104.1519/magit-notes.el @@ -1,6 +1,6 @@ ;;; magit-notes.el --- notes support -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-obsolete.el b/elpa/magit-20190104.1519/magit-obsolete.el similarity index 97% rename from elpa/magit-20181110.1820/magit-obsolete.el rename to elpa/magit-20190104.1519/magit-obsolete.el index 67a3d1ce..0cabad4d 100644 --- a/elpa/magit-20181110.1820/magit-obsolete.el +++ b/elpa/magit-20190104.1519/magit-obsolete.el @@ -1,6 +1,6 @@ ;;; magit-obsolete.el --- obsolete definitions -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-patch.el b/elpa/magit-20190104.1519/magit-patch.el similarity index 99% rename from elpa/magit-20181110.1820/magit-patch.el rename to elpa/magit-20190104.1519/magit-patch.el index e42b44a6..96bd0922 100644 --- a/elpa/magit-20181110.1820/magit-patch.el +++ b/elpa/magit-20190104.1519/magit-patch.el @@ -1,6 +1,6 @@ ;;; magit-patch.el --- creating and applying patches -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-pkg.el b/elpa/magit-20190104.1519/magit-pkg.el similarity index 70% rename from elpa/magit-20181110.1820/magit-pkg.el rename to elpa/magit-20190104.1519/magit-pkg.el index 905fb4d6..f8e58b43 100644 --- a/elpa/magit-20181110.1820/magit-pkg.el +++ b/elpa/magit-20190104.1519/magit-pkg.el @@ -1,8 +1,7 @@ -(define-package "magit" "20181110.1820" "A Git porcelain inside Emacs." +(define-package "magit" "20190104.1519" "A Git porcelain inside Emacs." '((emacs "25.1") (async "20180527") (dash "20180910") - (ghub "20181107") (git-commit "20181104") (magit-popup "20181003") (with-editor "20181103"))) diff --git a/elpa/magit-20181110.1820/magit-process.el b/elpa/magit-20190104.1519/magit-process.el similarity index 99% rename from elpa/magit-20181110.1820/magit-process.el rename to elpa/magit-20190104.1519/magit-process.el index 6378ffc1..a3013ede 100644 --- a/elpa/magit-20181110.1820/magit-process.el +++ b/elpa/magit-20190104.1519/magit-process.el @@ -1,6 +1,6 @@ ;;; magit-process.el --- process functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -620,8 +620,11 @@ Magit status buffer." 'face 'magit-section-heading)))) (magit-insert-heading) (when errlog - (insert-file-contents errlog) - (goto-char (1- (point-max)))) + (if (bufferp errlog) + (insert (with-current-buffer errlog + (buffer-substring-no-properties (point-min) (point-max)))) + (insert-file-contents errlog) + (goto-char (1- (point-max))))) (insert "\n")))) (defun magit-process-truncate-log () diff --git a/elpa/magit-20181110.1820/magit-pull.el b/elpa/magit-20190104.1519/magit-pull.el similarity index 99% rename from elpa/magit-20181110.1820/magit-pull.el rename to elpa/magit-20190104.1519/magit-pull.el index 67abe436..41c49bf0 100644 --- a/elpa/magit-20181110.1820/magit-pull.el +++ b/elpa/magit-20190104.1519/magit-pull.el @@ -1,6 +1,6 @@ ;;; magit-pull.el --- update local objects and refs -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-push.el b/elpa/magit-20190104.1519/magit-push.el similarity index 99% rename from elpa/magit-20181110.1820/magit-push.el rename to elpa/magit-20190104.1519/magit-push.el index f6e04282..f34be472 100644 --- a/elpa/magit-20181110.1820/magit-push.el +++ b/elpa/magit-20190104.1519/magit-push.el @@ -1,6 +1,6 @@ ;;; magit-push.el --- update remote objects and refs -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-refs.el b/elpa/magit-20190104.1519/magit-refs.el similarity index 96% rename from elpa/magit-20181110.1820/magit-refs.el rename to elpa/magit-20190104.1519/magit-refs.el index a0bddd3f..4b814ff4 100644 --- a/elpa/magit-20181110.1820/magit-refs.el +++ b/elpa/magit-20190104.1519/magit-refs.el @@ -1,6 +1,6 @@ ;;; magit-refs.el --- listing references -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -516,7 +516,7 @@ line is inserted at all." (let ((tag (match-string 1 tag)) (msg (match-string 2 tag))) (when (magit-refs--insert-refname-p tag) - (magit-insert-section section (tag tag t) + (magit-insert-section (tag tag t) (magit-insert-heading (magit-refs--format-focus-column tag 'tag) (propertize tag 'face 'magit-tag) @@ -526,7 +526,7 @@ line is inserted at all." (and msg (magit-log-propertize-keywords nil msg))) (when (and magit-refs-margin-for-tags (magit-buffer-margin-p)) (magit-refs--format-margin tag)) - (magit-refs--insert-cherry-commits tag section))))) + (magit-refs--insert-cherry-commits tag))))) (insert ?\n) (magit-make-margin-overlay nil t))))) @@ -551,7 +551,7 @@ line is inserted at all." (progn (cl-assert (equal branch (concat remote "/HEAD"))) (setq head head-branch)) (when (magit-refs--insert-refname-p branch) - (magit-insert-section section (branch branch t) + (magit-insert-section (branch branch t) (let ((headp (equal branch head)) (abbrev (if magit-refs-show-remote-prefix branch @@ -566,7 +566,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 section))))))) + (magit-refs--insert-cherry-commits branch))))))) (insert ?\n) (magit-make-margin-overlay nil t)))) @@ -576,14 +576,14 @@ line is inserted at all." (magit-insert-heading "Branches:") (dolist (line (magit-refs--format-local-branches)) (pcase-let ((`(,branch . ,strings) line)) - (magit-insert-section section + (magit-insert-section ((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)) - (magit-refs--insert-cherry-commits branch section)))) + (magit-refs--insert-cherry-commits branch)))) (insert ?\n) (magit-make-margin-overlay nil t))) @@ -723,21 +723,17 @@ line is inserted at all." (cdr it) t)) -(defun magit-refs--insert-cherry-commits (ref section) - (if (oref section hidden) - (oset section washer - (apply-partially #'magit-refs--insert-cherry-commits-1 ref section)) - (magit-refs--insert-cherry-commits-1 ref section))) - -(defun magit-refs--insert-cherry-commits-1 (ref _section) - (let ((start (point)) - (magit-insert-section--current nil)) - (magit-git-wash (apply-partially 'magit-log-wash-log 'cherry) - "cherry" "-v" (magit-abbrev-arg) - (or (car magit-refresh-args) "HEAD") - ref magit-refresh-args) - (unless (= (point) start) - (magit-make-margin-overlay nil t)))) +(defun magit-refs--insert-cherry-commits (ref) + (magit-insert-section-body + (let ((start (point)) + (magit-insert-section--current nil)) + (magit-git-wash (apply-partially 'magit-log-wash-log 'cherry) + "cherry" "-v" (magit-abbrev-arg) + (or (car magit-refresh-args) "HEAD") + ref magit-refresh-args) + (if (= (point) start) + (message "No cherries for %s" ref) + (magit-make-margin-overlay nil t))))) (defun magit-refs--format-margin (commit) (save-excursion diff --git a/elpa/magit-20181110.1820/magit-remote.el b/elpa/magit-20190104.1519/magit-remote.el similarity index 99% rename from elpa/magit-20181110.1820/magit-remote.el rename to elpa/magit-20190104.1519/magit-remote.el index 5f80452a..fa2d9219 100644 --- a/elpa/magit-20181110.1820/magit-remote.el +++ b/elpa/magit-20190104.1519/magit-remote.el @@ -1,6 +1,6 @@ ;;; magit-remote.el --- transfer Git commits -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-repos.el b/elpa/magit-20190104.1519/magit-repos.el similarity index 93% rename from elpa/magit-20181110.1820/magit-repos.el rename to elpa/magit-20190104.1519/magit-repos.el index 8db44d86..b45e69d3 100644 --- a/elpa/magit-20181110.1820/magit-repos.el +++ b/elpa/magit-20190104.1519/magit-repos.el @@ -1,6 +1,6 @@ ;;; magit-repos.el --- listing repositories -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -40,16 +40,18 @@ ;;; Options -(defcustom magit-repository-directories - '(("~/.emacs.d/" . 0) ; this should always be a repository - ("~/.emacs.d/lib/" . 1)) ; useful for `borg' users +(defcustom magit-repository-directories nil "List of directories that are or contain Git repositories. Each element has the form (DIRECTORY . DEPTH). DIRECTORY has to be a directory or a directory file-name, a string. DEPTH, an integer, specifies the maximum depth to look for Git -repositories. If it is 0, then only add DIRECTORY itself." - :package-version '(magit . "2.90.0") +repositories. If it is 0, then only add DIRECTORY itself. + +This option controls which repositories are being listed by +`magit-list-repositories'. It also affects `magit-status' +\(which see) in potentially surprising ways." + :package-version '(magit . "2.91.0") :group 'magit-essentials :type '(repeat (cons directory (integer :tag "Depth")))) @@ -179,10 +181,10 @@ Usually this is just its basename." (defun magit-repolist-column-version (_id) "Insert a description of the repository's `HEAD' revision." - (let ((v (or (magit-git-string "describe" "--tags" "--dirty") - ;; If there are no tags, use the date in MELPA format. - (magit-git-string "show" "--no-patch" "--format=%cd-g%h" - "--date=format:%Y%m%d.%H%M")))) + (when-let ((v (or (magit-git-string "describe" "--tags" "--dirty") + ;; If there are no tags, use the date in MELPA format. + (magit-git-string "show" "--no-patch" "--format=%cd-g%h" + "--date=format:%Y%m%d.%H%M")))) (save-match-data (when (string-match "-dirty\\'" v) (put-text-property (1+ (match-beginning 0)) (length v) 'face 'error v)) @@ -255,8 +257,10 @@ the basenames are prefixed with the name of the respective parent directories. The returned value is the actual path to the selected repository. -With prefix argument simply read a directory name using -`read-directory-name'." +If READ-DIRECTORY-NAME is non-nil or no repositories can be +found based on the value of `magit-repository-directories', +then read an arbitrary directory using `read-directory-name' +instead." (if-let ((repos (and (not read-directory-name) magit-repository-directories (magit-list-repos-uniquify diff --git a/elpa/magit-20181110.1820/magit-reset.el b/elpa/magit-20190104.1519/magit-reset.el similarity index 98% rename from elpa/magit-20181110.1820/magit-reset.el rename to elpa/magit-20190104.1519/magit-reset.el index c4876499..063c86c6 100644 --- a/elpa/magit-20181110.1820/magit-reset.el +++ b/elpa/magit-20190104.1519/magit-reset.el @@ -1,6 +1,6 @@ ;;; magit-reset.el --- reset fuctionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-section.el b/elpa/magit-20190104.1519/magit-section.el similarity index 86% rename from elpa/magit-20181110.1820/magit-section.el rename to elpa/magit-20190104.1519/magit-section.el index b7c4c8d4..045ce410 100644 --- a/elpa/magit-20181110.1820/magit-section.el +++ b/elpa/magit-20190104.1519/magit-section.el @@ -1,6 +1,6 @@ ;;; magit-section.el --- section functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -160,6 +160,50 @@ entries of this alist." (const show) function))) +(defcustom magit-section-visibility-indicator + (if (window-system) + '(magit-fringe-bitmap> . magit-fringe-bitmapv) + '("…" . t)) + "Whether and how to indicate that a section can be expanded/collapsed. + +If nil, then don't show any indicators. +Otherwise the value has to have one of these two forms: + +(EXPANDABLE-BITMAP . COLLAPSIBLE-BITMAP) + + Both values have to by variables whose values are fringe + bitmaps. In this case every section that can be expanded or + collapsed gets an indicator in the left fringe. + +(STRING . BOOLEAN) + + In this case STRING (usually an ellipsis) is shown at the end + of the heading of every collapsed section. Expanded sections + get no indicator. The cdr controls whether the appearance of + these ellipsis take section highlighting into account. Doing + so might potentially have an impact on performance, while not + doing so is kinda ugly." + :package-version '(magit . "2.91.0") + :group 'magit-section + :type '(choice (const :tag "No indicators" nil) + (cons :tag "Use +- fringe indicators" + (const magit-fringe-bitmap+) + (const magit-fringe-bitmap-)) + (cons :tag "Use >v fringe indicators" + (const magit-fringe-bitmap>) + (const magit-fringe-bitmapv)) + (cons :tag "Use bold >v fringe indicators)" + (const magit-fringe-bitmap-bold>) + (const magit-fringe-bitmap-boldv)) + (cons :tag "Use custom fringe indicators" + (variable :tag "Expandable bitmap variable") + (variable :tag "Collapsable bitmap variable")) + (cons :tag "Use ellipses at end of headings" + (string :tag "Ellipsis" "…") + (choice :tag "Use face kludge" + (const :tag "Yes (potentially slow)" t) + (const :tag "No (kinda ugly)" nil))))) + (defface magit-section-highlight '((((class color) (background light)) :background "grey95") (((class color) (background dark)) :background "grey20")) @@ -195,7 +239,8 @@ entries of this alist." )) (defclass magit-section () - ((type :initform nil :initarg :type) + ((keymap :initform nil :allocation :class) + (type :initform nil :initarg :type) (value :initform nil :initarg :value) (start :initform nil :initarg :start) (content :initform nil) @@ -236,7 +281,9 @@ never modify it.") The return value has the form ((TYPE . VALUE)...)." (with-slots (type value parent) section (cons (cons type - (cond ((not (memq type '(unpulled unpushed))) value) + (cond ((eieio-object-p value) + (magit-section-ident-value value)) + ((not (memq type '(unpulled unpushed))) value) ((string-match-p "@{upstream}" value) value) ;; Unfortunately Git chokes on "@{push}" when ;; the value of `push.default' does not allow a @@ -250,6 +297,18 @@ The return value has the form ((TYPE . VALUE)...)." (and parent (magit-section-ident parent))))) +(cl-defgeneric magit-section-ident-value (VALUE) + "Return a constant representation of VALUE. +VALUE is the value of a `magit-section' object. If that is an +object itself, then that is not suitable to be used to identify +the section because two objects may represent the same thing but +not be equal. If possible a method should be addef for such +objects, which returns a value that is equal. Otherwise the +catch-all method is used, which just returns the argument +itself.") + +(cl-defmethod magit-section-ident-value (arg) arg) + (defun magit-get-section (ident &optional root) "Return the section identified by IDENT. IDENT has to be a list as returned by `magit-section-ident'." @@ -258,11 +317,15 @@ IDENT has to be a list as returned by `magit-section-ident'." (when (eq (car (pop ident)) (oref section type)) (while (and ident - (setq section - (--first - (and (eq (caar ident) (oref it type)) - (equal (cdar ident) (oref it value))) - (oref section children)))) + (pcase-let* ((`(,type . ,value) (car ident)) + (value (magit-section-ident-value value))) + (setq section + (cl-find-if (lambda (section) + (and (eq (oref section type) type) + (equal (magit-section-ident-value + (oref section value)) + value))) + (oref section children))))) (pop ident)) section))) @@ -423,6 +486,7 @@ With a prefix argument also expand it." heading) (magit-section-update-highlight)) (when-let ((beg (oref section content))) (remove-overlays beg (oref section end) 'invisible t)) + (magit-section-maybe-update-visibility-indicator section) (magit-section-maybe-cache-visibility section) (dolist (child (oref section children)) (if (oref child hidden) @@ -441,6 +505,7 @@ With a prefix argument also expand it." heading) (let ((o (make-overlay beg end))) (overlay-put o 'evaporate t) (overlay-put o 'invisible t)))) + (magit-section-maybe-update-visibility-indicator section) (magit-section-maybe-cache-visibility section))) (defun magit-section-toggle (section) @@ -631,11 +696,11 @@ Sections at higher levels are hidden." ;;;; Auxiliary -(defun magit-describe-section-briefly (section &optional message ident) +(defun magit-describe-section-briefly (section &optional ident) "Show information about the section at point. With a prefix argument show the section identity instead of the section lineage. This command is intended for debugging purposes." - (interactive (list (magit-current-section) t)) + (interactive (list (magit-current-section) current-prefix-arg)) (let ((str (format "#<%s %S %S %s-%s>" (eieio-object-class section) (let ((val (oref section value))) @@ -653,7 +718,9 @@ section lineage. This command is intended for debugging purposes." (marker-position m)) (when-let ((m (oref section end))) (marker-position m))))) - (if message (message "%s" str) str))) + (if (called-interactively-p 'any) + (message "%s" str) + str))) (cl-defmethod cl-print-object ((section magit-section) stream) "Print `magit-describe-section' result of SECTION." @@ -935,11 +1002,13 @@ anything this time around. (magit-insert-child-count ,s) (set-marker-insertion-type (oref ,s start) t) (let* ((end (oset ,s end (point-marker))) + (class-map (oref-default ,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 (or (and (boundp magit-map) (symbol-value magit-map)) + (map (or (and class-map (symbol-value class-map)) + (and (boundp magit-map) (symbol-value magit-map)) (and (boundp forge-map) (symbol-value forge-map))))) (save-excursion (goto-char (oref ,s start)) @@ -1007,6 +1076,23 @@ insert a newline character if necessary." (magit-maybe-make-margin-overlay) (oset magit-insert-section--current content (point-marker))) +(defmacro magit-insert-section-body (&rest body) + "Use BODY to insert the section body, once the section is expanded. +If the section is expanded when it is created, then this is +like `progn'. Otherwise BODY isn't evaluated until the section +is explicitly expanded." + (declare (indent 0)) + (let ((f (cl-gensym)) + (s (cl-gensym))) + `(let ((,f (lambda () ,@body)) + (,s magit-insert-section--current)) + (if (oref ,s hidden) + (oset ,s washer + (lambda () + (funcall ,f) + (magit-section-maybe-remove-visibility-indicator ,s))) + (funcall ,f))))) + (defun magit-insert-headers (hook) (let* ((header-sections nil) (magit-insert-section-hook @@ -1090,7 +1176,8 @@ evaluated its BODY. Admittedly that's a bit of a hack." (and (not (oref section hidden)) section)))) (when (version< emacs-version "25.1") - (setq deactivate-mark nil))))) + (setq deactivate-mark nil))) + (magit-section-maybe-paint-visibility-ellipses))) (defun magit-section-highlight (section selection) "Highlight SECTION and if non-nil all sections in SELECTION. @@ -1242,6 +1329,92 @@ invisible." (magit-repository-local-get (cons mode 'magit-section-visibility-cache)))) +(defun magit-section-maybe-update-visibility-indicator (section) + (when magit-section-visibility-indicator + (let ((beg (oref section start)) + (cnt (oref section content)) + (end (oref section end))) + (when (and cnt (or (not (= cnt end)) (oref section washer))) + (let ((eoh (save-excursion + (goto-char beg) + (line-end-position)))) + (cond + ((symbolp (car-safe magit-section-visibility-indicator)) + ;; It would make more sense to put the overlay only on the + ;; location we actually don't put it on, but then inserting + ;; before that location (while taking care not to mess with + ;; the overlay) would cause the fringe bitmap to disappear + ;; (but not other effects of the overlay). + (let ((ov (magit--overlay-at (1+ beg) 'magit-vis-indicator 'fringe))) + (unless ov + (setq ov (make-overlay (1+ beg) eoh)) + (overlay-put ov 'evaporate t) + (overlay-put ov 'magit-vis-indicator 'fringe)) + (overlay-put + ov 'before-string + (propertize "fringe" 'display + (list 'left-fringe + (if (oref section hidden) + (car magit-section-visibility-indicator) + (cdr magit-section-visibility-indicator)) + "#93a1a1"))))) + ((stringp (car-safe magit-section-visibility-indicator)) + (let ((ov (magit--overlay-at (1- eoh) 'magit-vis-indicator 'eoh))) + (cond ((oref section hidden) + (unless ov + (setq ov (make-overlay (1- eoh) eoh)) + (overlay-put ov 'evaporate t) + (overlay-put ov 'magit-vis-indicator 'eoh)) + (overlay-put ov 'after-string + (car magit-section-visibility-indicator))) + (ov + (delete-overlay ov))))))))))) + +(defvar-local magit--ellipses-sections nil) + +(defun magit-section-maybe-paint-visibility-ellipses () + ;; This is needed because we hide the body instead of "the body + ;; except the final newline and additionally the newline before + ;; the body"; otherwise we could use `buffer-invisibility-spec'. + (when (stringp (car-safe magit-section-visibility-indicator)) + (let* ((sections (append magit--ellipses-sections + (setq magit--ellipses-sections + (or (magit-region-sections) + (list (magit-current-section)))))) + (beg (--map (oref it start) sections)) + (end (--map (oref it end) sections))) + (when (region-active-p) + ;; This ensures that the region face is removed from ellipses + ;; when the region becomes inactive, but fails to ensure that + ;; all ellipses within the active region use the region face, + ;; because the respective overlay has not yet been updated at + ;; this time. The magit-selection face is always applied. + (push (region-beginning) beg) + (push (region-end) end)) + (setq beg (apply #'min beg)) + (setq end (apply #'max end)) + (dolist (ov (overlays-in beg end)) + (when (eq (overlay-get ov 'magit-vis-indicator) 'eoh) + (overlay-put + ov 'after-string + (propertize + (car magit-section-visibility-indicator) 'face + (let ((pos (overlay-start ov))) + (delq nil (nconc (--map (overlay-get it 'face) + (overlays-at pos)) + (list (get-char-property pos 'face)))))))))))) + +(defun magit-section-maybe-remove-visibility-indicator (section) + (when (and magit-section-visibility-indicator + (= (oref section content) + (oref section end))) + (dolist (o (overlays-in (oref section start) + (save-excursion + (goto-char (oref section start)) + (1+ (line-end-position))))) + (when (overlay-get o 'magit-vis-indicator) + (delete-overlay o))))) + ;;; Utilities (cl-defun magit-section-selected-p (section &optional (selection nil sselection)) diff --git a/elpa/magit-20181110.1820/magit-sequence.el b/elpa/magit-20190104.1519/magit-sequence.el similarity index 99% rename from elpa/magit-20181110.1820/magit-sequence.el rename to elpa/magit-20190104.1519/magit-sequence.el index 0eb1ec6b..82938457 100644 --- a/elpa/magit-20181110.1820/magit-sequence.el +++ b/elpa/magit-20190104.1519/magit-sequence.el @@ -1,6 +1,6 @@ ;;; magit-sequence.el --- history manipulation in Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2018 The Magit Project Contributors +;; Copyright (C) 2011-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -625,7 +625,8 @@ START has to be selected from a list of recent commits." (defun magit-rebase-autosquash (args) "Combine squash and fixup commits with their intended targets." (interactive (list (magit-rebase-arguments))) - (magit-rebase-interactive-1 :merge-base (cons "--autosquash" args) + (magit-rebase-interactive-1 :merge-base + (nconc (list "--autosquash" "--keep-empty") args) "Type %p on a commit to squash into it and then rebase as necessary," "true" nil t)) @@ -754,7 +755,7 @@ If no such sequence is in progress, do nothing." patch commit) (while patches (setq patch (pop patches)) - (setq commit (magit-rev-verify-commit + (setq commit (magit-commit-p (cadr (split-string (magit-file-line patch))))) (cond ((and commit patches) (magit-sequence-insert-commit diff --git a/elpa/magit-20181110.1820/magit-stash.el b/elpa/magit-20190104.1519/magit-stash.el similarity index 99% rename from elpa/magit-20181110.1820/magit-stash.el rename to elpa/magit-20190104.1519/magit-stash.el index 9012c9aa..3ad2cd26 100644 --- a/elpa/magit-20181110.1820/magit-stash.el +++ b/elpa/magit-20190104.1519/magit-stash.el @@ -1,6 +1,6 @@ ;;; magit-stash.el --- stash support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-status.el b/elpa/magit-20190104.1519/magit-status.el similarity index 94% rename from elpa/magit-20181110.1820/magit-status.el rename to elpa/magit-20190104.1519/magit-status.el index 73a31672..b6ff3895 100644 --- a/elpa/magit-20181110.1820/magit-status.el +++ b/elpa/magit-20190104.1519/magit-status.el @@ -1,6 +1,6 @@ ;;; magit-status.el --- the grand overview -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -96,7 +96,7 @@ all." "The section point is placed on when a status buffer is created. When such a buffer is merely being refreshed or being shown again -after it was merely burried, then this option has no effect. +after it was merely buried, then this option has no effect. If this is nil, then point remains on the very first section as usual. Otherwise it has to be a list of integers and section @@ -190,10 +190,36 @@ Non-interactively DIRECTORY is (re-)initialized unconditionally." ;;;###autoload (defun magit-status (&optional directory cache) "Show the status of the current Git repository in a buffer. -With a prefix argument prompt for a repository to be shown. -With two prefix arguments prompt for an arbitrary directory. -If that directory isn't the root of an existing repository, -then offer to initialize it as a new repository." + +If the current directory isn't located within a Git repository, +then prompt for an existing repository or an arbitrary directory, +depending on option `magit-repository-directories', and show the +status of the selected repository instead. + +* If that option specifies any existing repositories, then offer + those for completion and show the status buffer for the + selected one. + +* Otherwise read an arbitrary directory using regular file-name + completion. If the selected directory is the top-level of an + existing working tree, then show the status buffer for that. + +* Otherwise offer to initialize the selected directory as a new + repository. After creating the repository show its status + buffer. + +These fallback behaviors can also be forced using one or more +prefix arguments: + +* With two prefix arguments (or more precisely a numeric prefix + value of 16 or greater) read an arbitrary directory and act on + it as described above. The same could be accomplished using + the command `magit-init'. + +* With a single prefix argument read an existing repository, or + if none can be found based on `magit-repository-directories', + then fall back to the same behavior as with two prefix + arguments." (interactive (let ((magit--refresh-cache (list (cons 0 0)))) (list (and (or current-prefix-arg (not (magit-toplevel))) @@ -212,8 +238,7 @@ then offer to initialize it as a new repository." (format "%s is a repository. Create another in %s? " toplevel directory) (format "Create repository in %s? " directory))) - ;; Creating a new repository will invalidate cached - ;; values. + ;; Creating a new repository invalidates cached values. (setq magit--refresh-cache nil) (magit-init directory)))) (magit-status-internal default-directory)))) diff --git a/elpa/magit-20181110.1820/magit-submodule.el b/elpa/magit-20190104.1519/magit-submodule.el similarity index 98% rename from elpa/magit-20181110.1820/magit-submodule.el rename to elpa/magit-20190104.1519/magit-submodule.el index d05b7e8d..b0e6c130 100644 --- a/elpa/magit-20181110.1820/magit-submodule.el +++ b/elpa/magit-20190104.1519/magit-submodule.el @@ -1,6 +1,6 @@ ;;; magit-submodule.el --- submodule support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2018 The Magit Project Contributors +;; Copyright (C) 2011-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -384,13 +384,12 @@ are inserted, and option `magit-module-sections-nested' controls whether they are wrapped in an additional section." (when-let ((modules (magit-list-module-paths))) (if magit-module-sections-nested - (magit-insert-section section (modules nil t) + (magit-insert-section (modules nil t) (magit-insert-heading (format "%s (%s)" (propertize "Modules" 'face 'magit-section-heading) (length modules))) - (if (oref section hidden) - (oset section washer 'magit--insert-modules) + (magit-insert-section-body (magit--insert-modules))) (magit--insert-modules)))) @@ -403,13 +402,12 @@ whether they are wrapped in an additional section." For each section insert the path and the output of `git describe --tags', or, failing that, the abbreviated HEAD commit hash." (when-let ((modules (magit-list-module-paths))) - (magit-insert-section section (modules nil t) + (magit-insert-section (modules nil t) (magit-insert-heading (format "%s (%s)" (propertize "Modules overview" 'face 'magit-section-heading) (length modules))) - (if (oref section hidden) - (oset section washer 'magit--insert-modules-overview) + (magit-insert-section-body (magit--insert-modules-overview))))) (defvar magit-modules-overview-align-numbers t) diff --git a/elpa/magit-20181110.1820/magit-subtree.el b/elpa/magit-20190104.1519/magit-subtree.el similarity index 98% rename from elpa/magit-20181110.1820/magit-subtree.el rename to elpa/magit-20190104.1519/magit-subtree.el index 4e5d32b0..d7aa3a20 100644 --- a/elpa/magit-20181110.1820/magit-subtree.el +++ b/elpa/magit-20190104.1519/magit-subtree.el @@ -1,6 +1,6 @@ ;;; magit-subtree.el --- subtree support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2018 The Magit Project Contributors +;; Copyright (C) 2011-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-tag.el b/elpa/magit-20190104.1519/magit-tag.el similarity index 98% rename from elpa/magit-20181110.1820/magit-tag.el rename to elpa/magit-20190104.1519/magit-tag.el index ca5f6aba..afaf3caf 100644 --- a/elpa/magit-20181110.1820/magit-tag.el +++ b/elpa/magit-20190104.1519/magit-tag.el @@ -1,6 +1,6 @@ ;;; magit-tag.el --- tag functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-utils.el b/elpa/magit-20190104.1519/magit-utils.el similarity index 93% rename from elpa/magit-20181110.1820/magit-utils.el rename to elpa/magit-20190104.1519/magit-utils.el index fc819514..1ca051fb 100644 --- a/elpa/magit-20181110.1820/magit-utils.el +++ b/elpa/magit-20190104.1519/magit-utils.el @@ -1,6 +1,6 @@ ;;; magit-utils.el --- various utilities -*- lexical-binding: t; coding: utf-8 -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -56,6 +56,9 @@ (eval-when-compile (require 'vc-git)) (declare-function vc-git--run-command-string "vc-git" (file &rest args)) +(eval-when-compile (require 'which-func)) +(declare-function which-function "which-func" ()) + (defvar magit-wip-before-change-mode) (require 'magit-popup) @@ -91,12 +94,14 @@ alphabetical order, depending on your version of Ivy." (magit-stash-format-patch nil t) (magit-stash-drop nil ask) (magit-stash-pop nil ask) + (forge-browse-dwim nil t) (forge-browse-commit nil t) (forge-browse-branch nil t) (forge-browse-remote nil t) (forge-browse-issue nil t) (forge-browse-pullreq nil t) (forge-edit-topic-title nil t) + (forge-edit-topic-state nil t) (forge-edit-topic-labels nil t) (forge-edit-topic-assignees nil t) (forge-visit-issue nil t) @@ -738,12 +743,9 @@ See info node `(magit)Debugging Tools' for more information." (error "Cannot find mandatory dependency %s" lib))))) '(;; Like `LOAD_PATH' in `default.mk'. "dash" - "ghub" - "graphql" "lv" "magit-popup" "transient" - "treepy" "with-editor" ;; Obviously `magit' itself is needed too. "magit" @@ -887,6 +889,41 @@ that it will align with the text area." (interactive) (kill-buffer (current-buffer))) +(defun magit--buffer-string (&optional min max trim) + "Like `buffer-substring-no-properties' but the arguments are optional. + +This combines the benefits of `buffer-string', `buffer-substring' +and `buffer-substring-no-properties' into one function that is +not as painful to use as the latter. I.e. you can write + (magit--buffer-string) +instead of + (buffer-substring-no-properties (point-min) + (point-max)) + +Optional MIN defaults to the value of `point-min'. +Optional MAX defaults to the value of `point-max'. + +If optional TRIM is non-nil, then all leading and trailing +whitespace is remove. If it is the newline character, then +one trailing newline is added." + ;; Lets write that one last time and be done with it: + (let ((str (buffer-substring-no-properties (or min (point-min)) + (or max (point-max))))) + (if trim + (concat (string-trim str) + (and (eq trim ?\n) "\n")) + str))) + +(cl-defun magit--overlay-at (pos prop &optional (val nil sval) testfn) + (cl-find-if (lambda (o) + (let ((p (overlay-properties o))) + (and (plist-member p prop) + (or (not sval) + (funcall (or testfn #'eql) + (plist-get p prop) + val))))) + (overlays-at pos t))) + ;;; Kludges for Emacs Bugs (defun magit-file-accessible-directory-p (filename) @@ -959,6 +996,15 @@ and https://github.com/magit/magit/issues/2295." ;; `completion-pcm--all-completions' that shipped with Emacs 25.1. (nreverse poss)))))) +(defun magit-which-function () + "Return current function name based on point. + +This is a simple wrapper around `which-function', that resets +Imenu's potentially outdated and therefore unreliable cache by +setting `imenu--index-alist' to nil before calling that function." + (setq imenu--index-alist nil) + (which-function)) + ;;; Kludges for Incompatible Modes (defvar whitespace-mode) @@ -1078,6 +1124,67 @@ the %s(1) manpage. (advice-add 'org-man-export :around 'org-man-export--magit-gitman) +;;; Bitmaps + +(when (window-system) + (define-fringe-bitmap 'magit-fringe-bitmap+ + [#b00000000 + #b00011000 + #b00011000 + #b01111110 + #b01111110 + #b00011000 + #b00011000 + #b00000000]) + (define-fringe-bitmap 'magit-fringe-bitmap- + [#b00000000 + #b00000000 + #b00000000 + #b01111110 + #b01111110 + #b00000000 + #b00000000 + #b00000000]) + + (define-fringe-bitmap 'magit-fringe-bitmap> + [#b01100000 + #b00110000 + #b00011000 + #b00001100 + #b00011000 + #b00110000 + #b01100000 + #b00000000]) + (define-fringe-bitmap 'magit-fringe-bitmapv + [#b00000000 + #b10000010 + #b11000110 + #b01101100 + #b00111000 + #b00010000 + #b00000000 + #b00000000]) + + (define-fringe-bitmap 'magit-fringe-bitmap-bold> + [#b11100000 + #b01110000 + #b00111000 + #b00011100 + #b00011100 + #b00111000 + #b01110000 + #b11100000]) + (define-fringe-bitmap 'magit-fringe-bitmap-boldv + [#b10000001 + #b11000011 + #b11100111 + #b01111110 + #b00111100 + #b00011000 + #b00000000 + #b00000000]) + ) + ;;; Miscellaneous (defun magit-message (format-string &rest args) diff --git a/elpa/magit-20181110.1820/magit-wip.el b/elpa/magit-20190104.1519/magit-wip.el similarity index 99% rename from elpa/magit-20181110.1820/magit-wip.el rename to elpa/magit-20190104.1519/magit-wip.el index 10c085be..b291cd0d 100644 --- a/elpa/magit-20181110.1820/magit-wip.el +++ b/elpa/magit-20190104.1519/magit-wip.el @@ -1,6 +1,6 @@ ;;; magit-wip.el --- commit snapshots to work-in-progress refs -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. diff --git a/elpa/magit-20181110.1820/magit-worktree.el b/elpa/magit-20190104.1519/magit-worktree.el similarity index 76% rename from elpa/magit-20181110.1820/magit-worktree.el rename to elpa/magit-20190104.1519/magit-worktree.el index 08941e5a..d6d46a84 100644 --- a/elpa/magit-20181110.1820/magit-worktree.el +++ b/elpa/magit-20190104.1519/magit-worktree.el @@ -1,6 +1,6 @@ ;;; magit-worktree.el --- worktree support -*- lexical-binding: t -*- -;; Copyright (C) 2010-2018 The Magit Project Contributors +;; Copyright (C) 2010-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -35,11 +35,8 @@ (magit-define-popup magit-worktree-popup "Popup console for worktree commands." :man-page "git-worktree" - :actions `((?b "Create new worktree" magit-worktree-checkout) + :actions '((?b "Create new worktree" magit-worktree-checkout) (?c "Create new branch and worktree" magit-worktree-branch) - ,@(and (not (require (quote forge) nil t)) - '((?p "Create new worktree from pull-request" - magit-worktree-checkout-pull-request))) (?k "Delete worktree" magit-worktree-delete) (?g "Show status for worktree" magit-worktree-status)) :max-action-columns 1) @@ -48,41 +45,12 @@ (defun magit-worktree-checkout (path branch) "Checkout BRANCH in a new worktree at PATH." (interactive - (let ((branch (magit-read-local-branch-or-commit "Checkout"))) + (let ((branch (magit-read-branch-or-commit "Checkout"))) (list (read-directory-name (format "Checkout %s in new worktree: " branch)) branch))) (magit-run-git "worktree" "add" (expand-file-name path) branch) (magit-diff-visit-directory path)) -(defun magit-worktree-checkout-pull-request (path pr) - "Create, configure and checkout a new worktree from a pull-request. -This is like `magit-checkout-pull-request', except that it -also creates a new worktree. Please see the manual for more -information." - (interactive - (let ((pr (magit-read-pull-request "Checkout pull request"))) - (let-alist pr - (let ((path (let ((branch (magit--pullreq-branch pr t))) - (read-directory-name - (format "Checkout #%s as `%s' in new worktree: " - .number branch) - (file-name-directory - (directory-file-name default-directory)) - nil nil - (if (string-match-p "\\`pr-[0-9]+\\'" branch) - (number-to-string .number) - (format "%s-%s" .number .head.ref)))))) - (when (equal path "") - (user-error "The empty string isn't a valid path")) - (list path pr))))) - (when (and (file-exists-p path) - (not (and (file-directory-p path) - (= (length (directory-files "/tmp/testing/")) 2)))) - (user-error "%s already exists and isn't empty" path)) - (magit-worktree-checkout path - (let ((inhibit-magit-refresh t)) - (magit-branch-pull-request pr)))) - ;;;###autoload (defun magit-worktree-branch (path branch start-point &optional force) "Create a new BRANCH and check it out in a new worktree at PATH." diff --git a/elpa/magit-20181110.1820/magit.el b/elpa/magit-20190104.1519/magit.el similarity index 99% rename from elpa/magit-20181110.1820/magit.el rename to elpa/magit-20190104.1519/magit.el index 5bd9146f..050d8cf5 100644 --- a/elpa/magit-20181110.1820/magit.el +++ b/elpa/magit-20190104.1519/magit.el @@ -1,6 +1,6 @@ ;;; magit.el --- A Git porcelain inside Emacs -*- lexical-binding: t; coding: utf-8 -*- -;; Copyright (C) 2008-2018 The Magit Project Contributors +;; Copyright (C) 2008-2019 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. @@ -591,7 +591,6 @@ For X11 something like ~/.xinitrc should work.\n" (require 'magit-status) (require 'magit-refs) (require 'magit-files) - (require 'magit-collab) (require 'magit-reset) (require 'magit-branch) (require 'magit-merge) diff --git a/elpa/magit-20190104.1519/magit.info b/elpa/magit-20190104.1519/magit.info new file mode 100644 index 00000000..d3e995ff --- /dev/null +++ b/elpa/magit-20190104.1519/magit.info @@ -0,0 +1,187 @@ +This is magit.info, produced by makeinfo version 6.5 from magit.texi. + + Copyright (C) 2015-2019 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 +* Magit: (magit). Using Git from Emacs with Magit. +END-INFO-DIR-ENTRY + + +Indirect: +magit.info-1: 754 +magit.info-2: 304415 + +Tag Table: +(Indirect) +Node: Top754 +Node: Introduction6308 +Node: Installation11031 +Node: Installing from Melpa11361 +Node: Installing from the Git Repository12434 +Node: Post-Installation Tasks14789 +Node: Getting Started16074 +Node: Interface Concepts21421 +Node: Modes and Buffers21752 +Node: Switching Buffers23501 +Node: Naming Buffers28271 +Node: Quitting Windows31578 +Node: Automatic Refreshing of Magit Buffers33210 +Node: Automatic Saving of File-Visiting Buffers35978 +Node: Automatic Reverting of File-Visiting Buffers37163 +Node: Risk of Reverting Automatically42159 +Node: Sections44542 +Node: Section Movement45483 +Node: Section Visibility49580 +Node: Section Hooks55401 +Node: Section Types and Values57808 +Node: Section Options59111 +Node: Popup Buffers and Prefix Commands59583 +Node: Completion Confirmation and the Selection61964 +Node: Action Confirmation62401 +Node: Completion and Confirmation69747 +Node: The Selection72933 +Node: The hunk-internal region75832 +Node: Support for Completion Frameworks76921 +Node: Additional Completion Options81737 +Node: Running Git82336 +Node: Viewing Git Output82609 +Node: Git Process Status83742 +Node: Running Git Manually84707 +Node: Git Executable87109 +Node: Global Git Arguments89391 +Node: Inspecting90197 +Node: Status Buffer91344 +Node: Status Sections95334 +Node: Status Header Sections100137 +Node: Status Module Sections102767 +Node: Status Options105272 +Node: Repository List107026 +Node: Logging109184 +Node: Refreshing Logs111637 +Node: Log Buffer113022 +Node: Log Margin116817 +Node: Select from Log119457 +Node: Reflog121561 +Node: Cherries123093 +Node: Diffing124820 +Node: Refreshing Diffs127773 +Node: Diff Buffer131264 +Node: Diff Options135848 +Node: Revision Buffer140870 +Node: Ediffing143804 +Node: References Buffer147400 +Node: References Sections157164 +Node: Bisecting158025 +Node: Visiting Blobs159763 +Node: Blaming160273 +Node: Manipulating166084 +Node: Repository Setup166400 +Node: Staging and Unstaging167440 +Node: Staging from File-Visiting Buffers171521 +Node: Applying172689 +Node: Committing174582 +Node: Initiating a Commit175165 +Node: Editing Commit Messages178493 +Node: Branching188889 +Node: The Two Remotes189119 +Node: The Branch Popup191736 +Node: The Branch Config Popup203312 +Node: Auxiliary Branch Commands209253 +Node: Merging210358 +Node: Resolving Conflicts214289 +Node: Rebasing219290 +Node: Editing Rebase Sequences223454 +Node: Information About In-Progress Rebase226484 +Ref: Information About In-Progress Rebase-Footnote-1235233 +Node: Cherry Picking235829 +Node: Reverting240081 +Node: Resetting241455 +Node: Stashing243109 +Node: Transferring247632 +Node: Remotes247870 +Node: The Remote Popup248026 +Node: The Remote Config Popup251494 +Node: Fetching253150 +Node: Pulling254512 +Node: Pushing255355 +Node: Creating and Sending Patches260096 +Node: Applying Patches260933 +Node: Miscellaneous262519 +Node: Tagging262835 +Node: Notes264183 +Node: Submodules266494 +Node: Listing Submodules266708 +Node: Submodule Popup268632 +Node: Subtree271085 +Node: Worktree272325 +Node: Common Commands273288 +Node: Wip Modes275035 +Node: Wip Graph279968 +Node: Legacy Wip Modes282282 +Node: Minor Mode for Buffers Visiting Files285177 +Node: Minor Mode for Buffers Visiting Blobs290593 +Node: Customizing291406 +Node: Per-Repository Configuration293074 +Node: Essential Settings294723 +Node: Safety295047 +Node: Performance296812 +Node: Microsoft Windows Performance304415 +Node: MacOS Performance305606 +Ref: MacOS Performance-Footnote-1306842 +Ref: MacOS Performance-Footnote-2306924 +Ref: MacOS Performance-Footnote-3306984 +Node: Plumbing307150 +Node: Calling Git307973 +Node: Getting a Value from Git309498 +Node: Calling Git for Effect312584 +Node: Section Plumbing319104 +Node: Creating Sections319332 +Node: Section Selection323232 +Node: Matching Sections325031 +Node: Refreshing Buffers331004 +Node: Conventions334146 +Node: Theming Faces334338 +Node: FAQ342453 +Node: FAQ - How to ...?342895 +Node: How to show git's output?343255 +Node: How to install the gitman info manual?344009 +Node: How to show diffs for gpg-encrypted files?344979 +Node: How does branching and pushing work?345575 +Node: Can Magit be used as ediff-version-control-package?345938 +Node: FAQ - Issues and Errors347927 +Node: Magit is slow348859 +Node: I changed several thousand files at once and now Magit is unusable349073 +Node: I am having problems committing349802 +Node: I am using MS Windows and cannot push with Magit350283 +Node: I am using OS X and SOMETHING works in shell but not in Magit350900 +Node: Diffs contain control sequences351706 +Node: Expanding a file to show the diff causes it to disappear352819 +Node: Point is wrong in the COMMIT_EDITMSG buffer353370 +Node: The mode-line information isn't always up-to-date354416 +Node: A branch and tag sharing the same name breaks SOMETHING355498 +Node: My Git hooks work on the command-line but not inside Magit356386 +Node: git-commit-mode isn't used when committing from the command-line357223 +Node: Point ends up inside invisible text when jumping to a file-visiting buffer359490 +Node: Debugging Tools360288 +Node: Keystroke Index362175 +Node: Command Index393969 +Node: Function Index428623 +Node: Variable Index444004 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/magit-20181110.1820/magit.info-1 b/elpa/magit-20190104.1519/magit.info-1 similarity index 97% rename from elpa/magit-20181110.1820/magit.info-1 rename to elpa/magit-20190104.1519/magit.info-1 index bda4ef17..63279e0e 100644 --- a/elpa/magit-20181110.1820/magit.info-1 +++ b/elpa/magit-20190104.1519/magit.info-1 @@ -1,6 +1,6 @@ This is magit.info, produced by makeinfo version 6.5 from magit.texi. - Copyright (C) 2015-2018 Jonas Bernoulli + Copyright (C) 2015-2019 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 @@ -31,9 +31,9 @@ to perform almost all of their daily version control tasks directly from within Emacs. While many fine Git clients exist, only Magit and Git itself deserve to be called porcelains. -This manual is for Magit version 2.90.0 (v2.90.0-4-g13b32ae1c+1). +This manual is for Magit version 2.90.1 (v2.90.1-86-gcc435005b+1). - Copyright (C) 2015-2018 Jonas Bernoulli + Copyright (C) 2015-2019 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 @@ -453,11 +453,10 @@ File: magit.info, Node: Installing from the Git Repository, Next: Post-Install 2.2 Installing from the Git Repository ====================================== -Magit depends on the ‘dash’, ‘ghub’, ‘graphql’, ‘magit-popup’, ‘treepy’ -and ‘with-editor’ libraries which are available from Melpa and -Melpa-Stable. Install them using ‘M-x package-install RET -RET’. Of course you may also install them manually from their -repository. +Magit depends on the ‘dash’, ‘magit-popup’, and ‘with-editor’ libraries +which are available from Melpa and Melpa-Stable. Install them using +‘M-x package-install RET RET’. Of course you may also install +them manually from their repository. Then clone the Magit repository: @@ -468,18 +467,14 @@ repository. $ make - If you haven’t installed ‘dash’, ‘ghub’, ‘graphql’, ‘magit-popup’, -‘treepy’ and ‘with-editor’ from Melpa or at -‘/path/to/magit/../’, then you have to tell ‘make’ where to -find them. To do so create the file ‘/path/to/magit/config.mk’ with the -following content before running ‘make’: + If you haven’t installed ‘dash’, ‘magit-popup’ and ‘with-editor’ from +Melpa or at ‘/path/to/magit/../’, then you have to tell ‘make’ +where to find them. To do so create the file ‘/path/to/magit/config.mk’ +with the following content before running ‘make’: LOAD_PATH = -L /path/to/magit/lisp LOAD_PATH += -L /path/to/dash - LOAD_PATH += -L /path/to/ghub - LOAD_PATH += -L /path/to/graphql LOAD_PATH += -L /path/to/magit-popup - LOAD_PATH += -L /path/to/treepy LOAD_PATH += -L /path/to/with-editor Finally add this to your init file: @@ -720,7 +715,7 @@ File: magit.info, Node: Switching Buffers, Next: Naming Buffers, Up: Modes an 4.1.1 Switching Buffers ----------------------- - -- Function: magit-display-buffer buffer + -- Function: magit-display-buffer buffer &optional display-function This function is a wrapper around ‘display-buffer’ and is used to display any Magit buffer. It displays BUFFER in some window and, @@ -728,6 +723,10 @@ File: magit.info, Node: Switching Buffers, Next: Naming Buffers, Up: Modes an ‘magit-display-buffer-noselect’ is ‘nil’. It also runs the hooks mentioned below. + If optional DISPLAY-FUNCTION is non-nil, then that is used to + display the buffer. Usually that is ‘nil’ and the function + specified by ‘magit-display-buffer-function’ is used. + -- Variable: magit-display-buffer-noselect When this is non-nil, then ‘magit-display-buffer’ only displays the @@ -1454,6 +1453,29 @@ certain sections can also be overwritten using the hook non-nil, then the buffer is being refreshed and these functions should immediately return ‘nil’. + -- User Option: magit-section-visibility-indicator + + This option controls whether and how to indicate that a section can + be expanded/collapsed. + + If nil, then no visibility indicators are shown. Otherwise the + value has to have one of these two forms: + + • ‘(EXPANDABLE-BITMAP . COLLAPSIBLE-BITMAP)’ + + Both values have to by variables whose values are fringe + bitmaps. In this case every section that can be expanded or + collapsed gets an indicator in the left fringe. + + • ‘(STRING . BOOLEAN)’ + + In this case STRING (usually an ellipsis) is shown at the end + of the heading of every collapsed section. Expanded sections + get no indicator. The cdr controls whether the appearance of + these ellipsis take section highlighting into account. Doing + so might potentially have an impact on performance, while not + doing so is kinda ugly. +  File: magit.info, Node: Section Hooks, Next: Section Types and Values, Prev: Section Visibility, Up: Sections @@ -2301,11 +2323,39 @@ that it should be bound globally. We recommend using ‘C-x g’: ‘C-x g’ (‘magit-status’) - Show the status of the current Git repository in a buffer. With a - prefix argument prompt for a repository to be shown. With two - prefix arguments prompt for an arbitrary directory. If that - directory isn’t the root of an existing repository, then offer to - initialize it as a new repository. + When invoked from within an existing Git repository, then this + command shows the status of that repository in a buffer. + + If the current directory isn’t located within a Git repository, + then this command prompts for an existing repository or an + arbitrary directory, depending on the option + ‘magit-repository-directories’, and the status for the selected + repository is shown instead. + + • If that option specifies any existing repositories, then the + user is asked to select one of them. + + • Otherwise the user is asked to select an arbitrary directory + using regular file-name completion. If the selected directory + is the top-level directory of an existing working tree, then + the status buffer for that is shown. + + • Otherwise the user is offered to initialize the selected + directory as a new repository. After creating the repository + its status buffer is shown. + + These fallback behaviors can also be forced using one or more + prefix arguments: + + • With two prefix arguments (or more precisely a numeric prefix + value of 16 or greater) an arbitrary directory is read, which + is then acted on as described above. The same could be + accomplished using the command ‘magit-init’. + + • With a single prefix argument an existing repository is read + from the user, or if no repository can be found based on the + value of ‘magit-repository-directories’, then the behavior is + the same as with two prefix arguments. -- User Option: magit-repository-directories @@ -2317,12 +2367,9 @@ that it should be bound globally. We recommend using ‘C-x g’: integer, specifies the maximum depth to look for Git repositories. If it is 0, then only add DIRECTORY itself. - -- User Option: magit-repository-directories-depth - - The maximum depth to look for Git repositories. This option is - obsolete and only used for elements of the option - ‘magit-repository-directories’ (which see) that don’t specify the - depth directly. + This option controls which repositories are being listed by + ‘magit-list-repositories’. It also affects ‘magit-status’ (which + see) in potentially surprising ways (see above). -- Command: ido-enter-magit-status @@ -3505,11 +3552,16 @@ File: magit.info, Node: Diff Options, Next: Revision Buffer, Prev: Diff Buffe Whether to show word-granularity differences within diff hunks. - • ‘nil’ never show fine differences. + • ‘nil’ Never show fine differences. + + • ‘t’ Show fine differences for the current diff hunk only. - • ‘t’ show fine differences for the current diff hunk only. + • ‘all’ Show fine differences for all displayed diff hunks. - • ‘all’ show fine differences for all displayed diff hunks. + -- User Option: magit-diff-refine-ignore-whitespace + + Whether to ignore whitespace changes in word-granularity + differences. -- User Option: magit-diff-adjust-tab-width @@ -3542,6 +3594,24 @@ File: magit.info, Node: Diff Options, Next: Revision Buffer, Prev: Diff Buffe diffs, ‘status’ means only in the status buffer, and nil means nowhere. + • ‘nil’ Never highlight whitespace errors. + + • ‘t’ Highlight whitespace errors everywhere. + + • ‘uncommitted’ Only highlight whitespace errors in diffs + showing uncommitted changes. For backward compatibility + ‘status’ is treated as a synonym. + + -- User Option: magit-diff-paint-whitespace-lines + + Specify in what kind of lines to highlight whitespace errors. + + • ‘t’ Highlight only in added lines. + + • ‘both’ Highlight in added and removed lines. + + • ‘all’ Highlight in added, removed and context lines. + -- User Option: magit-diff-highlight-trailing Whether to highlight whitespace at the end of a line in diffs. @@ -5052,117 +5122,6 @@ features are available from separate popups. branch. If FROM is not reachable from ‘HEAD’ or is reachable from the source branch’s upstream, then an error is raised. -‘b Y’ (‘magit-branch-pull-request’) - - This command creates and configures a new branch from a Github - pull-request, creating and configuring a new remote if necessary. - - The name of the local branch is the same as the name of the remote - branch that you are being asked to merge, unless the contributor - could not be bother to properly name the branch before opening the - pull-request. The most likely such case is when you are being - asked to merge something like "fork/master" into "origin/master". - In such cases the local branch will be named "pr-N", where ‘N’ is - the pull-request number. - - These variables are always set by this command: - - • ‘branch..pullRequest’ is set to the pull-request number. - - • ‘branch..pullRequestRemote’ is set to the remote on - which the pull-request branch is located. - - • ‘branch..pushRemote’ is set to the same remote as - ‘branch..pullRequestRemote’ if that is possible, - otherwise it is set to the upstream remote. - - • ‘branch..description’ is set to the pull-request title. - - • ‘branch..rebase’ is set to ‘true’ because there should - be no merge commits among the commits in a pull-request. - - This command also configures the upstream and the push-remote of - the local branch that it creates. - - The branch against which the pull-request was opened, is always - used as the upstream. This makes it easy to see what commits you - are being asked to merge in the section titled something like - "Unmerged into origin/master". - - Like for other commands that create a branch it depends on the - option ‘magit-branch-prefer-remote-upstream’ whether the remote - branch itself or the respective local branch is used as the - upstream, so this section may also be titled e.g. "Unmerged into - master". - - When necessary and possible, then the remote pull-request branch is - configured to be used as the push-target. This makes it easy to - see what further changes the contributor has made since you last - reviewed their changes in the section titled something like - "Unpulled from origin/new-feature" or "Unpulled from - fork/new-feature". - - • If the pull-request branch is located in the upstream - repository, then you probably have set ‘remote.pushDefault’ to - that repository. However some users like to set that variable - to their personal fork, even if they have push access to the - upstream, so ‘branch..pushRemote’ is set anyway. - - • If the pull-request branch is located inside a fork, then you - are usually able to push to that branch, because Github by - default allows the recipient of a pull-request to push to the - remote pull-request branch even if it is located in a fork. - The contributor has to explicitly disable this. - - • If you are not allowed to push to the pull-request branch - on the fork, then a branch by the same name located in - the upstream repository is configured as the push-target. - - • A — sadly rather common — special case is when the - contributor didn’t bother to use a dedicated branch for - the pull-request. - - The most likely such case is when you are being asked to - merge something like "fork/master" into "origin/master". - The special push permission mentioned above is never - granted for the branch that is the repository’s default - branch, and that would almost certainly be the case in - this scenario. - - To enable you to easily push somewhere anyway, the local - branch is named "pr-N" (where ‘N’ is the pull-request - number) and the upstream repository is used as the - push-remote. - - • Finally, if you are allowed to push to the pull-request - branch and the contributor had the foresight to use a - dedicated branch, then the fork is configured as the - push-remote. - - The push-remote is configured using - ‘branch..pushRemote’, even if the used value is - identical to that of ‘remote.pushDefault’, just in case you - change the value of the latter later on. Additionally the - variable ‘branch..pullRequestRemote’ is set to the - remote on which the pull-request branch is located. - - When you later delete the local pull-request branch, then you are - offered to also delete the corresponding remote, provided it is not - the upstream remote and that the tracking branch that corresponds - to the deleted branch is the only remaining tracked branch. If you - don’t confirm, then only the tracking branch itself is deleted in - addition to the local branch. - - Do not delete the tracking branch instead of the local branch. The - cleanup mentioned in the previous paragraph is not performed if you - do that. - -‘b y’ (‘magit-checkout-pull-request’) - - This command creates and configures a new branch from a pull - request, the same way ‘magit-branch-pull-request’ does. - Additionally it checks out the new branch. - ‘b x’ (‘magit-branch-reset’) This command resets a branch, defaulting to the branch at point, to @@ -7187,13 +7146,6 @@ Also see *note (gitman)git-worktree::. Create a new BRANCH and check it out in a new worktree at PATH. -‘% p’ (‘magit-worktree-checkout-pull-request’) - - Create, configure and checkout a new worktree from a pull-request. - - This is like ‘magit-checkout-pull-request’ (which see) except that - it also creates a new worktree. - ‘% k’ (‘magit-worktree-delete’) Delete a worktree, defaulting to the worktree at point. The diff --git a/elpa/magit-20181110.1820/magit.info-2 b/elpa/magit-20190104.1519/magit.info-2 similarity index 99% rename from elpa/magit-20181110.1820/magit.info-2 rename to elpa/magit-20190104.1519/magit.info-2 index 18585bb4..82f0173c 100644 --- a/elpa/magit-20181110.1820/magit.info-2 +++ b/elpa/magit-20190104.1519/magit.info-2 @@ -1,6 +1,6 @@ This is magit.info, produced by makeinfo version 6.5 from magit.texi. - Copyright (C) 2015-2018 Jonas Bernoulli + Copyright (C) 2015-2019 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 @@ -1348,9 +1348,8 @@ Appendix C Keystroke Index * %: Worktree. (line 8) * % b: Worktree. (line 13) * % c: Worktree. (line 17) -* % g: Worktree. (line 33) -* % k: Worktree. (line 28) -* % p: Worktree. (line 21) +* % g: Worktree. (line 26) +* % k: Worktree. (line 21) * +: Log Buffer. (line 59) * + <1>: Refreshing Diffs. (line 68) * -: Log Buffer. (line 63) @@ -1383,16 +1382,14 @@ Appendix C Keystroke Index * b c: The Branch Popup. (line 55) * B g: Bisecting. (line 36) * B k: Bisecting. (line 41) -* b k: The Branch Popup. (line 240) +* b k: The Branch Popup. (line 129) * b l: The Branch Popup. (line 62) * b n: The Branch Popup. (line 45) * B r: Bisecting. (line 47) -* b r: The Branch Popup. (line 246) +* b r: The Branch Popup. (line 135) * B s: Bisecting. (line 24) * b s: The Branch Popup. (line 85) -* b x: The Branch Popup. (line 224) -* b Y: The Branch Popup. (line 113) -* b y: The Branch Popup. (line 218) +* b x: The Branch Popup. (line 113) * c: Blaming. (line 120) * c <1>: Initiating a Commit. (line 8) * c <2>: Editing Rebase Sequences. @@ -1829,7 +1826,7 @@ Appendix D Command Index (line 59) * git-rebase-undo: Editing Rebase Sequences. (line 89) -* ido-enter-magit-status: Status Buffer. (line 47) +* ido-enter-magit-status: Status Buffer. (line 72) * magit-am-abort: Applying Patches. (line 34) * magit-am-apply-maildir: Applying Patches. (line 19) * magit-am-apply-patches: Applying Patches. (line 13) @@ -1876,20 +1873,18 @@ Appendix D Command Index * magit-branch-config-popup <1>: The Branch Config Popup. (line 6) * magit-branch-create: The Branch Popup. (line 45) -* magit-branch-delete: The Branch Popup. (line 240) -* magit-branch-or-checkout: The Branch Popup. (line 350) -* magit-branch-orphan: The Branch Popup. (line 345) +* magit-branch-delete: The Branch Popup. (line 129) +* magit-branch-or-checkout: The Branch Popup. (line 239) +* magit-branch-orphan: The Branch Popup. (line 234) * magit-branch-popup: The Branch Popup. (line 12) -* magit-branch-pull-request: The Branch Popup. (line 113) -* magit-branch-rename: The Branch Popup. (line 246) -* magit-branch-reset: The Branch Popup. (line 224) +* magit-branch-rename: The Branch Popup. (line 135) +* magit-branch-reset: The Branch Popup. (line 113) * magit-branch-shelve: Auxiliary Branch Commands. (line 8) * magit-branch-spinoff: The Branch Popup. (line 85) * magit-branch-unshelve: Auxiliary Branch Commands. (line 19) * magit-checkout: The Branch Popup. (line 37) -* magit-checkout-pull-request: The Branch Popup. (line 218) * magit-cherry: Cherries. (line 17) * magit-cherry-apply: Cherry Picking. (line 23) * magit-cherry-copy: Cherry Picking. (line 16) @@ -2238,10 +2233,9 @@ Appendix D Command Index * magit-wip-log-current: Wip Modes. (line 57) * magit-worktree-branch: Worktree. (line 17) * magit-worktree-checkout: Worktree. (line 13) -* magit-worktree-checkout-pull-request: Worktree. (line 21) -* magit-worktree-delete: Worktree. (line 28) +* magit-worktree-delete: Worktree. (line 21) * magit-worktree-popup: Worktree. (line 8) -* magit-worktree-status: Worktree. (line 33) +* magit-worktree-status: Worktree. (line 26) * scroll-down: Diff Buffer. (line 109) * scroll-up: Diff Buffer. (line 105) * with-editor-cancel: Editing Commit Messages. @@ -2277,7 +2271,7 @@ Appendix E Function Index (line 196) * git-commit-turn-on-flyspell: Editing Commit Messages. (line 201) -* ido-enter-magit-status: Status Buffer. (line 47) +* ido-enter-magit-status: Status Buffer. (line 72) * magit-add-section-hook: Section Hooks. (line 20) * magit-after-save-refresh-status: Automatic Refreshing of Magit Buffers. (line 56) @@ -2287,8 +2281,8 @@ Appendix E Function Index * magit-blame-reverse: Blaming. (line 46) * magit-branch-config-popup: The Branch Config Popup. (line 6) -* magit-branch-or-checkout: The Branch Popup. (line 350) -* magit-branch-orphan: The Branch Popup. (line 345) +* magit-branch-or-checkout: The Branch Popup. (line 239) +* magit-branch-orphan: The Branch Popup. (line 234) * magit-branch-shelve: Auxiliary Branch Commands. (line 8) * magit-branch-unshelve: Auxiliary Branch Commands. @@ -2308,14 +2302,14 @@ Appendix E Function Index * magit-diff-type: Matching Sections. (line 95) * magit-diff-visit-file-other-window: Diff Buffer. (line 65) * magit-display-buffer: Switching Buffers. (line 6) -* magit-display-buffer-fullcolumn-most-v1: Switching Buffers. (line 72) +* magit-display-buffer-fullcolumn-most-v1: Switching Buffers. (line 76) * magit-display-buffer-fullframe-status-topleft-v1: Switching Buffers. - (line 62) + (line 66) * magit-display-buffer-fullframe-status-v1: Switching Buffers. - (line 56) + (line 60) * magit-display-buffer-same-window-except-diff-v1: Switching Buffers. - (line 50) -* magit-display-buffer-traditional: Switching Buffers. (line 42) + (line 54) +* magit-display-buffer-traditional: Switching Buffers. (line 46) * magit-file-checkout: Minor Mode for Buffers Visiting Files. (line 131) * magit-file-delete: Minor Mode for Buffers Visiting Files. @@ -2418,7 +2412,7 @@ Appendix E Function Index * magit-log-maybe-show-more-commits: Section Movement. (line 57) * magit-log-maybe-update-blob-buffer: Section Movement. (line 71) * magit-log-maybe-update-revision-buffer: Section Movement. (line 64) -* magit-maybe-set-dedicated: Switching Buffers. (line 97) +* magit-maybe-set-dedicated: Switching Buffers. (line 101) * magit-mode-display-buffer: Refreshing Buffers. (line 33) * magit-mode-quit-window: Quitting Windows. (line 31) * magit-mode-setup: Refreshing Buffers. (line 17) @@ -2452,7 +2446,7 @@ Appendix E Function Index (line 40) * magit-run-git-with-logfile: Calling Git for Effect. (line 56) -* magit-save-window-configuration: Switching Buffers. (line 86) +* magit-save-window-configuration: Switching Buffers. (line 90) * magit-section-case: Matching Sections. (line 71) * magit-section-hide: Section Visibility. (line 49) * magit-section-hide-children: Section Visibility. (line 64) @@ -2545,10 +2539,10 @@ Appendix F Variable Index * magit-blame-styles: Blaming. (line 128) * magit-blame-time-format: Blaming. (line 140) * magit-branch-adjust-remote-upstream-alist: The Branch Popup. - (line 303) + (line 192) * magit-branch-popup-show-variables: The Branch Popup. (line 21) -* magit-branch-prefer-remote-upstream: The Branch Popup. (line 258) -* magit-branch-read-upstream-first: The Branch Popup. (line 252) +* magit-branch-prefer-remote-upstream: The Branch Popup. (line 147) +* magit-branch-read-upstream-first: The Branch Popup. (line 141) * magit-buffer-name-format: Naming Buffers. (line 27) * magit-bury-buffer-function: Quitting Windows. (line 11) * magit-cherry-margin: Cherries. (line 22) @@ -2559,19 +2553,21 @@ Appendix F Variable Index * magit-commit-squash-confirm: Initiating a Commit. (line 87) * magit-completing-read-function: Support for Completion Frameworks. (line 27) -* magit-diff-adjust-tab-width: Diff Options. (line 16) +* magit-diff-adjust-tab-width: Diff Options. (line 21) * magit-diff-buffer-file-locked: Minor Mode for Buffers Visiting Files. (line 52) -* magit-diff-hide-trailing-cr-characters: Diff Options. (line 67) -* magit-diff-highlight-hunk-region-functions: Diff Options. (line 71) -* magit-diff-highlight-indentation: Diff Options. (line 52) -* magit-diff-highlight-trailing: Diff Options. (line 47) -* magit-diff-paint-whitespace: Diff Options. (line 38) +* magit-diff-hide-trailing-cr-characters: Diff Options. (line 90) +* magit-diff-highlight-hunk-region-functions: Diff Options. (line 94) +* magit-diff-highlight-indentation: Diff Options. (line 75) +* magit-diff-highlight-trailing: Diff Options. (line 70) +* magit-diff-paint-whitespace: Diff Options. (line 43) +* magit-diff-paint-whitespace-lines: Diff Options. (line 60) * magit-diff-refine-hunk: Diff Options. (line 6) -* magit-diff-unmarked-lines-keep-foreground: Diff Options. (line 97) +* magit-diff-refine-ignore-whitespace: Diff Options. (line 16) +* magit-diff-unmarked-lines-keep-foreground: Diff Options. (line 120) * magit-diff-visit-previous-blob: Diff Buffer. (line 37) -* magit-display-buffer-function: Switching Buffers. (line 23) -* magit-display-buffer-noselect: Switching Buffers. (line 14) +* magit-display-buffer-function: Switching Buffers. (line 27) +* magit-display-buffer-noselect: Switching Buffers. (line 18) * magit-dwim-selection: Completion and Confirmation. (line 42) * magit-ediff-dwim-show-on-hunks: Ediffing. (line 73) @@ -2605,8 +2601,8 @@ Appendix F Variable Index * magit-no-confirm: Action Confirmation. (line 18) * magit-pop-revision-stack-format: Editing Commit Messages. (line 92) -* magit-post-display-buffer-hook: Switching Buffers. (line 92) -* magit-pre-display-buffer-hook: Switching Buffers. (line 81) +* magit-post-display-buffer-hook: Switching Buffers. (line 96) +* magit-pre-display-buffer-hook: Switching Buffers. (line 85) * magit-prefer-remote-upstream: The Branch Config Popup. (line 139) * magit-process-raise-error: Calling Git for Effect. @@ -2631,8 +2627,7 @@ Appendix F Variable Index * magit-remote-add-set-remote.pushDefault: The Remote Popup. (line 77) * magit-remote-popup-show-variables: The Remote Popup. (line 18) * magit-repolist-columns: Repository List. (line 14) -* magit-repository-directories: Status Buffer. (line 30) -* magit-repository-directories-depth: Status Buffer. (line 40) +* magit-repository-directories: Status Buffer. (line 58) * magit-revision-insert-related-refs: Revision Buffer. (line 6) * magit-revision-show-gravatars: Revision Buffer. (line 19) * magit-revision-use-hash-sections: Revision Buffer. (line 36) @@ -2644,6 +2639,7 @@ Appendix F Variable Index * magit-section-movement-hook: Section Movement. (line 38) * magit-section-set-visibility-hook: Section Visibility. (line 106) * magit-section-show-child-count: Section Options. (line 9) +* magit-section-visibility-indicator: Section Visibility. (line 124) * magit-shell-command-verbose-prompt: Running Git Manually. (line 46) * magit-stashes-margin: Stashing. (line 103) diff --git a/elpa/magit-popup-20180329.1302/dir b/elpa/magit-popup-20180329.1302/dir deleted file mode 100644 index c276dafb..00000000 --- a/elpa/magit-popup-20180329.1302/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, "?" 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 -* Magit-Popup: (magit-popup). Infix arguments with feedback. diff --git a/elpa/magit-popup-20180329.1302/magit-popup-autoloads.el b/elpa/magit-popup-20180329.1302/magit-popup-autoloads.el deleted file mode 100644 index de27c3ee..00000000 --- a/elpa/magit-popup-20180329.1302/magit-popup-autoloads.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; magit-popup-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) - -;;;### (autoloads nil nil ("magit-popup-pkg.el" "magit-popup.el") -;;;;;; (23238 5900 659502 226000)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; magit-popup-autoloads.el ends here diff --git a/elpa/magit-popup-20180329.1302/magit-popup-pkg.el b/elpa/magit-popup-20180329.1302/magit-popup-pkg.el deleted file mode 100644 index a388a3ac..00000000 --- a/elpa/magit-popup-20180329.1302/magit-popup-pkg.el +++ /dev/null @@ -1,10 +0,0 @@ -(define-package "magit-popup" "20180329.1302" "Define prefix-infix-suffix command combos" - '((emacs "24.4") - (async "1.9.2") - (dash "2.13.0")) - :keywords - '("bindings") - :url "https://github.com/magit/magit-popup") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-popup-20180329.1302/magit-popup.el b/elpa/magit-popup-20180329.1302/magit-popup.el deleted file mode 100644 index b5d12f78..00000000 --- a/elpa/magit-popup-20180329.1302/magit-popup.el +++ /dev/null @@ -1,1363 +0,0 @@ -;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- - -;; Copyright (C) 2010-2018 The Magit Project Contributors -;; -;; You should have received a copy of the AUTHORS.md file which -;; lists all contributors. If not, see http://magit.vc/authors. - -;; This library was inspired by and replaces library `magit-key-mode', -;; which was written by Phil Jackson and is -;; distributed under the GNU General Public License version 3 or later. - -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli - -;; Package-Requires: ((emacs "24.4") (async "1.9.2") (dash "2.13.0")) -;; Keywords: bindings -;; Homepage: https://github.com/magit/magit-popup - -;; Magit-Popup 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, or (at your option) -;; any later version. -;; -;; Magit-Popup 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 Magit-Popup. If not, see http://www.gnu.org/licenses. - -;;; Commentary: - -;; This package implements a generic interface for toggling switches -;; and setting options and then invoking an Emacs command which does -;; something with these arguments. The prototypical use is for the -;; command to call an external process, passing on the arguments as -;; command line arguments. But this is only one of many possible -;; uses (though the one this library is optimized for). - -;; With the Emacs concept of "prefix arguments" in mind this could be -;; described as "infix arguments with feedback in a buffer". - -;; Commands that set the prefix argument for the subsequent command do -;; not limit what that next command could be. But entering a command -;; console popup does limit the selection to the commands defined for -;; that popup, and so we use the term "infix" instead of "prefix". - -;;; Code: - -(require 'button) -(require 'cl-lib) -(require 'dash) -(require 'format-spec) -(eval-when-compile (require 'subr-x)) - -(and (require 'async-bytecomp nil t) - (cl-intersection '(all magit) - (bound-and-true-p async-bytecomp-allowed-packages)) - (fboundp 'async-bytecomp-package-mode) - (async-bytecomp-package-mode 1)) - -(declare-function info 'info) -(declare-function Man-find-section 'man) -(declare-function Man-next-section 'man) - -;; For branch actions. -(declare-function magit-branch-set-face 'magit-git) - -;;; Settings -;;;; Custom Groups - -(defgroup magit-popup nil - "Infix arguments with a popup as feedback." - :link '(info-link "(magit-popup)") - :group 'bindings) - -(defgroup magit-popup-faces nil - "Faces used by Magit-Popup." - :group 'magit-popup) - -;;;; Custom Options - -(defcustom magit-popup-display-buffer-action '((display-buffer-below-selected)) - "The action used to display a popup buffer. - -Popup buffers are displayed using `display-buffer' with the value -of this option as ACTION argument. You can also set this to nil -and instead add an entry to `display-buffer-alist'." - :package-version '(magit-popup . "2.4.0") - :group 'magit-popup - :type 'sexp) - -(defcustom magit-popup-manpage-package - (if (memq system-type '(windows-nt ms-dos)) 'woman 'man) - "The package used to display manpages. -One of `man' or `woman'." - :group 'magit-popup - :type '(choice (const man) (const woman))) - -(defcustom magit-popup-show-help-echo t - "Show usage information in the echo area." - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-show-common-commands nil - "Whether to initially show section with commands common to all popups. -This section can also be toggled temporarily using \ -\\\\[magit-popup-toggle-show-common-commands]." - :package-version '(magit-popup . "2.9.0") - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-use-prefix-argument 'default - "Control how prefix arguments affect infix argument popups. - -This option controls the effect that the use of a prefix argument -before entering a popup has. - -`default' With a prefix argument directly invoke the popup's - default action (an Emacs command), instead of bringing - up the popup. - -`popup' With a prefix argument bring up the popup, otherwise - directly invoke the popup's default action. - -`nil' Ignore prefix arguments." - :group 'magit-popup - :type '(choice - (const :tag "Call default action instead of showing popup" default) - (const :tag "Show popup instead of calling default action" popup) - (const :tag "Ignore prefix argument" nil))) - -;;;; Custom Faces - -(defface magit-popup-heading - '((t :inherit font-lock-keyword-face)) - "Face for key mode header lines." - :group 'magit-popup-faces) - -(defface magit-popup-key - '((t :inherit font-lock-builtin-face)) - "Face for key mode buttons." - :group 'magit-popup-faces) - -(defface magit-popup-argument - '((t :inherit font-lock-warning-face)) - "Face used to display enabled arguments in popups." - :group 'magit-popup-faces) - -(defface magit-popup-disabled-argument - '((t :inherit shadow)) - "Face used to display disabled arguments in popups." - :group 'magit-popup-faces) - -(defface magit-popup-option-value - '((t :inherit font-lock-string-face)) - "Face used to display option values in popups." - :group 'magit-popup-faces) - -;;;; Keymap - -(defvar magit-popup-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [remap self-insert-command] 'magit-invoke-popup-action) - (define-key map (kbd "- ") 'magit-invoke-popup-switch) - (define-key map (kbd "= ") 'magit-invoke-popup-option) - (define-key map (kbd "C-g") 'magit-popup-quit) - (define-key map (kbd "?") 'magit-popup-help) - (define-key map (kbd "C-h k") 'magit-popup-help) - (define-key map (kbd "C-h i") 'magit-popup-info) - (define-key map (kbd "C-t") 'magit-popup-toggle-show-common-commands) - (define-key map (kbd "C-c C-c") 'magit-popup-set-default-arguments) - (define-key map (kbd "C-x C-s") 'magit-popup-save-default-arguments) - (cond ((featurep 'jkl) - (define-key map (kbd "C-p") 'universal-argument) - (define-key map [return] 'push-button) - (define-key map (kbd "C-i") 'backward-button) - (define-key map (kbd "C-k") 'forward-button)) - (t - (define-key map (kbd "C-m") 'push-button) - (define-key map (kbd "DEL") 'backward-button) - (define-key map (kbd "C-p") 'backward-button) - (define-key map (kbd "C-i") 'forward-button) - (define-key map (kbd "C-n") 'forward-button))) - map) - "Keymap for `magit-popup-mode'. - -\\\ -This keymap contains bindings common to all popups. A section -listing these commands can be shown or hidden using \ -\\[magit-popup-toggle-show-common-commands]. - -The prefix used to toggle any switch can be changed by binding -another key to `magit-invoke-popup-switch'. Likewise binding -another key to `magit-invoke-popup-option' changes the prefixed -used to set any option. The two prefixes have to be different. -If you change these bindings, you should also change the `prefix' -property of the button types `magit-popup-switch-button' and -`magit-popup-option-button'. - -If you change any other binding, then you might have to also edit -`magit-popup-common-commands' for things to align correctly in -the section listing these commands. - -Never bind an alphabetic character in this keymap or you might -make it impossible to invoke certain actions.") - -(defvar magit-popup-common-commands - '(("Set defaults" magit-popup-set-default-arguments) - ("View popup manual" magit-popup-info) - ("Toggle this section" magit-popup-toggle-show-common-commands) - ("Save defaults" magit-popup-save-default-arguments) - (" Popup help prefix" magit-popup-help) - ("Abort" magit-popup-quit))) - -;;;; Buttons - -(define-button-type 'magit-popup-button - 'face nil - 'action (lambda (button) - (funcall (button-get button 'function) - (button-get button 'event)))) - -(define-button-type 'magit-popup-switch-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-switch - 'property :switches - 'heading "Switches\n" - 'formatter 'magit-popup-format-argument-button - 'format " %k %d (%a)" - 'prefix ?- - 'maxcols 1) - -(define-button-type 'magit-popup-option-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-option - 'property :options - 'heading "Options\n" - 'formatter 'magit-popup-format-argument-button - 'format " %k %d (%a%v)" - 'prefix ?= - 'maxcols 1) - -(define-button-type 'magit-popup-variable-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-action - 'property :variables - 'heading "Variables\n" - 'formatter 'magit-popup-format-variable-button - 'format " %k %d" - 'prefix nil - 'maxcols 1) - -(define-button-type 'magit-popup-action-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-action - 'property :actions - 'heading "Actions\n" - 'formatter 'magit-popup-format-action-button - 'format " %k %d" - 'prefix nil - 'maxcols :max-action-columns) - -(define-button-type 'magit-popup-command-button - 'supertype 'magit-popup-action-button - 'formatter 'magit-popup-format-command-button - 'action (lambda (button) - (let ((command (button-get button 'function))) - (unless (eq command 'push-button) - (call-interactively command))))) - -(define-button-type 'magit-popup-internal-command-button - 'supertype 'magit-popup-command-button - 'heading "Common Commands\n" - 'maxcols 3) - -;;; Events - -(defvar-local magit-this-popup nil - "The popup which is currently active. -This is intended for internal use only. -Don't confuse this with `magit-current-popup'.") - -(defvar-local magit-this-popup-events nil - "The events known to the active popup. -This is intended for internal use only. -Don't confuse this with `magit-current-popup-args'.") - -(defvar-local magit-previous-popup nil) - -(defvar-local magit-pre-popup-buffer nil - "The buffer that was current before invoking the active popup.") - -(defun magit-popup-get (prop) - "While a popup is active, get the value of PROP." - (if (memq prop '(:switches :options :variables :actions)) - (plist-get magit-this-popup-events prop) - (plist-get (symbol-value magit-this-popup) prop))) - -(defun magit-popup-put (prop val) - "While a popup is active, set the value of PROP to VAL." - (if (memq prop '(:switches :options :variables :actions)) - (setq magit-this-popup-events - (plist-put magit-this-popup-events prop val)) - (error "Property %s isn't supported" prop))) - -(defvar magit-current-popup nil - "The popup from which this editing command was invoked. - -Use this inside the `interactive' form of a popup aware command -to determine whether it was invoked from a popup and if so from -which popup. If the current command was invoked without the use -of a popup, then this is nil.") - -(defvar magit-current-popup-action nil - "The popup action now being executed.") - -(defvar magit-current-popup-args nil - "The value of the popup arguments for this editing command. - -If the current command was invoked from a popup, then this is -a list of strings of all the set switches and options. This -includes arguments which are set by default not only those -explicitly set during this invocation. - -When the value is nil, then that can be because no argument is -set, or because the current command wasn't invoked from a popup; -consult `magit-current-popup' to tell the difference. - -Generally it is better to use `NAME-arguments', which is created -by `magit-define-popup', instead of this variable or the function -by the same name, because `NAME-argument' uses the default value -for the arguments when the editing command is invoked directly -instead of from a popup. When the command is bound in several -popups that might not be feasible though.") - -(defun magit-current-popup-args (&rest filter) - "Return the value of the popup arguments for this editing command. - -The value is the same as that of the variable by the same name -\(which see), except that FILTER is applied. FILTER is a list -of regexps; only arguments that match one of them are returned. -The first element of FILTER may also be `:not' in which case -only arguments that don't match any of the regexps are returned, -or `:only' which doesn't change the behaviour." - (let ((-compare-fn (lambda (a b) (magit-popup-arg-match b a)))) - (-filter (if (eq (car filter) :not) - (lambda (arg) (not (-contains-p (cdr filter) arg))) - (when (eq (car filter) :only) - (pop filter)) - (lambda (arg) (-contains-p filter arg))) - magit-current-popup-args))) - -(defvar magit-current-pre-popup-buffer nil - "The buffer that was current before invoking the active popup. -This is bound when invoking an action or variable.") - -(defmacro magit-with-pre-popup-buffer (&rest body) - "Execute the forms in BODY in the buffer that current before the popup. -If `magit-current-pre-popup-buffer' is non-nil use that, else if -`magit-pre-popup-buffer' is non-nil use that, otherwise (when no -popup is involved) execute the forms in the current buffer." - (declare (indent 0)) - `(--if-let (or magit-current-pre-popup-buffer magit-pre-popup-buffer) - (with-current-buffer it ,@body) - ,@body)) - -(defun magit-popup-arg-match (pattern string) - (if (or (string-match-p "=$" pattern) - (string-match-p "^-[A-Z]$" pattern)) - (string-match (format "^%s\\(.*\\)$" pattern) string) - (string-equal string pattern))) - -(cl-defstruct magit-popup-event key dsc arg fun use val) - -(defun magit-popup-event-keydsc (ev) - (let ((key (magit-popup-event-key ev))) - (key-description (if (vectorp key) key (vector key))))) - -(defun magit-popup-lookup (event type) - (--first (equal (magit-popup-event-key it) event) - (-filter 'magit-popup-event-p (magit-popup-get type)))) - -(defun magit-popup-get-args () - (--mapcat (when (and (magit-popup-event-p it) - (magit-popup-event-use it)) - (list (format "%s%s" - (magit-popup-event-arg it) - (or (magit-popup-event-val it) "")))) - (append (magit-popup-get :switches) - (magit-popup-get :options)))) - -(defmacro magit-popup-convert-events (def form) - (declare (indent 1) (debug (form form))) - `(--map (if (or (null it) (stringp it) (functionp it)) it ,form) ,def)) - -(defun magit-popup-convert-switches (val def) - (magit-popup-convert-events def - (let ((a (nth 2 it))) - (make-magit-popup-event - :key (car it) :dsc (cadr it) :arg a - :use (and (member a val) t) - ;; For arguments implemented in lisp, this function's - ;; doc-string is used by `magit-popup-help'. That is - ;; the only thing it is used for. - :fun (and (string-prefix-p "\+\+" a) (nth 3 it)))))) - -(defun magit-popup-convert-options (val def) - (magit-popup-convert-events def - (let* ((a (nth 2 it)) - (r (format "^%s\\(.*\\)" a)) - (v (--first (string-match r it) val))) - (make-magit-popup-event - :key (car it) :dsc (cadr it) :arg a - :use (and v t) :val (and v (match-string 1 v)) - :fun (or (nth 3 it) 'read-from-minibuffer))))) - -(defun magit-popup-convert-variables (_val def) - (magit-popup-convert-events def - (make-magit-popup-event - :key (car it) :dsc (cadr it) :fun (nth 2 it) :arg (nth 3 it)))) - -(defun magit-popup-convert-actions (_val def) - (magit-popup-convert-events def - (make-magit-popup-event - :key (car it) :dsc (cadr it) :fun (nth 2 it)))) - -;;; Define - -(defmacro magit-define-popup (name doc &rest args) - "Define a popup command named NAME. - -NAME should begin with the package prefix and by convention end -with `-popup'. That name is used for the actual command as well -as for a variable used internally. DOC is used as the doc-string -of that command. - -Also define an option and a function named `SHORTNAME-arguments', -where SHORTNAME is NAME with the trailing `-popup' removed. The -name of this option and this function can be overwritten using -the optional argument OPTION, but that is rarely advisable. As a -special case if OPTION is specified but nil, do not define this -option and this function at all. - -The option `SHORTNAME-arguments' holds the default value for the -popup arguments. It can be customized from within the popup or -using the Custom interface. - -The function `SHORTNAME-arguments' is a wrapper around the -variable `magit-current-popup-args', both of which are intended -to be used inside the `interactive' form of commands commonly -invoked from the popup `NAME'. When such a command is invoked -from that popup, then the function `SHORTNAME-arguments' returns -the value of the variable `magit-current-popup-args'; however -when the command is invoked directly, then it returns the default -value of the variable `SHORTNAME-arguments'. - -Optional argument GROUP specifies the Custom group into which the -option is placed. If omitted, then the option is placed into some -group the same way it is done when directly using `defcustom' and -omitting the group, except when NAME begins with \"magit-\", in -which case the group `magit-git-arguments' is used. - -Optional argument MODE is deprecated, instead use the keyword -arguments `:setup-function' and/or `:refresh-function'. If MODE -is non-nil, then it specifies the mode used by the popup buffer, -instead of the default, which is `magit-popup-mode'. - -The remaining arguments should have the form - - [KEYWORD VALUE]... - -The following keywords are meaningful (and by convention are -usually specified in that order): - -`:actions' - The actions which can be invoked from the popup. VALUE is a - list whose members have the form (KEY DESC COMMAND), see - `magit-define-popup-action' for details. - - Actions are regular Emacs commands, which usually have an - `interactive' form setup to consume the values of the popup - `:switches' and `:options' when invoked from the corresponding - popup, else when invoked as the default action or directly - without using the popup, the default value of the variable - `SHORTNAME-arguments'. This is usually done by calling the - function `SHORTNAME-arguments'. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - - Members of VALUE may also be nil. This should only be used - together with `:max-action-columns' and allows having gaps in - the action grid, which can help arranging actions sensibly. - -`:default-action' - The default action of the popup which is used directly instead - of displaying the popup buffer, when the popup is invoked with - a prefix argument. Also see `magit-popup-use-prefix-argument' - and `:use-prefix', which can be used to inverse the meaning of - the prefix argument. - -`:use-prefix' - Controls when to display the popup buffer and when to invoke - the default action (if any) directly. This overrides the - global default set using `magit-popup-use-prefix-argument'. - The value, if specified, should be one of `default' or `popup', - or a function that is called with no arguments and returns one - of these symbols. - -`:max-action-columns' - The maximum number of actions to display on a single line, a - number or a function that returns a number and takes the name - of the section currently being inserted as argument. If there - isn't enough room to display as many columns as specified here, - then fewer are used. - -`:switches' - The popup arguments which can be toggled on and off. VALUE - is a list whose members have the form (KEY DESC SWITCH), see - `magit-define-popup-switch' for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - -`:options' - The popup arguments which take a value, as in \"--opt=OPTVAL\". - VALUE is a list whose members have the form (KEY DESC OPTION - READER), see `magit-define-popup-option' for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - -`:default-arguments' - The default arguments, a list of switches (which are then - enabled by default) and options with there default values, as - in \"--OPT=OPTVAL\". - -`:variables' - - Git variables which can be set from the popup. VALUE is a list - whose members have the form (KEY DESC COMMAND FORMATTER), see - `magit-define-popup-variable' for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - - Members of VALUE may also be actions as described above for - `:actions'. - - VALUE may also be a function that returns a list as describe - above. - -`:sequence-predicate' - When this function returns non-nil, then the popup uses - `:sequence-actions' instead of `:actions', and does not show - the `:switches' and `:options'. - -`:sequence-actions' - The actions which can be invoked from the popup, when - `:sequence-predicate' returns non-nil. - -`:setup-function' - When this function is specified, then it is used instead of - `magit-popup-default-setup'. - -`:refresh-function' - When this function is specified, then it is used instead of - calling `magit-popup-insert-section' three times with symbols - `magit-popup-switch-button', `magit-popup-option-button', and - finally `magit-popup-action-button' as argument. - -`:man-page' - The name of the manpage to be displayed when the user requests - help for a switch or argument. - -\(fn NAME DOC [GROUP [MODE [OPTION]]] :KEYWORD VALUE...)" - (declare (indent defun) (doc-string 2)) - (let* ((str (symbol-name name)) - (grp (if (keywordp (car args)) - (and (string-prefix-p "magit-" str) ''magit-git-arguments) - (pop args))) - (mode (and (not (keywordp (car args))) (pop args))) - (opt (if (keywordp (car args)) - (intern (concat (if (string-suffix-p "-popup" str) - (substring str 0 -6) - str) - "-arguments")) - (eval (pop args))))) - `(progn - (defun ,name (&optional arg) ,doc - (interactive "P") - (magit-invoke-popup ',name ,mode arg)) - (defvar ,name - (list :variable ',opt ,@args)) - (magit-define-popup-keys-deferred ',name) - ,@(when opt - `((defcustom ,opt (plist-get ,name :default-arguments) - "" - ,@(and grp (list :group grp)) - :type '(repeat (string :tag "Argument"))) - (defun ,opt () - (if (eq magit-current-popup ',name) - magit-current-popup-args - ,opt)) - (put ',opt 'definition-name ',name)))))) - -(defun magit-define-popup-switch (popup key desc switch - &optional enable at prepend) - "In POPUP, define KEY as SWITCH. - -POPUP is a popup command defined using `magit-define-popup'. -SWITCH is a string representing an argument that takes no value. -KEY is a character representing the second event in the sequence -of keystrokes used to toggle the argument. (The first event, the -prefix, is shared among all switches, defaults to -, and can be -changed in `magit-popup-mode-keymap'). - -DESC is a string describing the purpose of the argument, it is -displayed in the popup. - -If optional ENABLE is non-nil, then the switch is on by default. - -SWITCH is inserted after all other switches already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another switch already defined for POPUP, the argument -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :switches key - (list desc switch enable) at prepend)) - -(defun magit-define-popup-option (popup key desc option - &optional reader value at prepend) - "In POPUP, define KEY as OPTION. - -POPUP is a popup command defined using `magit-define-popup'. -OPTION is a string representing an argument that takes a value. -KEY is a character representing the second event in the sequence -of keystrokes used to set the argument's value. (The first -event, the prefix, is shared among all options, defaults to =, -and can be changed in `magit-popup-mode-keymap'). - -DESC is a string describing the purpose of the argument, it is -displayed in the popup. - -If optional VALUE is non-nil then the option is on by default, -and VALUE is its default value. - -READER is used to read a value from the user when the option is -invoked and does not currently have a value. It should take one -argument and use it as the prompt. If this is nil, then -`read-from-minibuffer' is used. - -OPTION is inserted after all other options already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another option already defined for POPUP, the argument -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :options key - (list desc option reader value) at prepend)) - -(defun magit-define-popup-variable (popup key desc command formatter - &optional at prepend) - "In POPUP, define KEY as COMMAND. - -POPUP is a popup command defined using `magit-define-popup'. -COMMAND is a command which calls `magit-popup-set-variable'. -FORMATTER is a function which calls `magit-popup-format-variable'. -These two functions have to be called with the same arguments. - -KEY is a character representing the event used interactively call -the COMMAND. - -DESC is the variable or a representation thereof. It's not -actually used for anything. - -COMMAND is inserted after all other commands already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another command already defined for POPUP, the command -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :variables key - (list desc command formatter) at prepend)) - -(defun magit-define-popup-action (popup key desc command - &optional at prepend) - "In POPUP, define KEY as COMMAND. - -POPUP is a popup command defined using `magit-define-popup'. -COMMAND can be any command but should usually consume the popup -arguments in its `interactive' form. -KEY is a character representing the event used invoke the action, -i.e. to interactively call the COMMAND. - -DESC is a string describing the purpose of the action, it is -displayed in the popup. - -COMMAND is inserted after all other commands already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another command already defined for POPUP, the command -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :actions key - (list desc command) at prepend)) - -(defun magit-define-popup-sequence-action - (popup key desc command &optional at prepend) - "Like `magit-define-popup-action' but for `:sequence-action'." - (declare (indent defun)) - (magit-define-popup-key popup :sequence-actions key - (list desc command) at prepend)) - -(defconst magit-popup-type-plural-alist - '((:switch . :switches) - (:option . :options) - (:variable . :variables) - (:action . :actions) - (:sequence-action . :sequence-actions))) - -(defun magit-popup-pluralize-type (type) - (or (cdr (assq type magit-popup-type-plural-alist)) - type)) - -(defun magit-define-popup-key - (popup type key def &optional at prepend) - "In POPUP, define KEY as an action, switch, or option. -It's better to use one of the specialized functions - `magit-define-popup-action', - `magit-define-popup-sequence-action', - `magit-define-popup-switch', - `magit-define-popup-option', or - `magit-define-popup-variable'." - (declare (indent defun)) - (setq type (magit-popup-pluralize-type type)) - (if (memq type '(:switches :options :variables :actions :sequence-actions)) - (if (boundp popup) - (let* ((plist (symbol-value popup)) - (value (plist-get plist type)) - (elt (assoc key value))) - (if elt - (setcdr elt def) - (setq elt (cons key def))) - (if at - (when (setq at (cl-member at value :key 'car-safe :test 'equal)) - (setq value (cl-delete key value :key 'car-safe :test 'equal)) - (if prepend - (progn (push (car at) (cdr at)) - (setcar at elt)) - (push elt (cdr at)))) - (setq value (cl-delete key value :key 'car-safe :test 'equal))) - (unless (assoc key value) - (setq value (if prepend - (cons elt value) - (append value (list elt))))) - (set popup (plist-put plist type value))) - (push (list type key def at prepend) - (get popup 'magit-popup-deferred))) - (error "Unknown popup event type: %s" type))) - -(defun magit-define-popup-keys-deferred (popup) - (dolist (args (get popup 'magit-popup-deferred)) - (condition-case err - (apply #'magit-define-popup-key popup args) - ((debug error) - (display-warning 'magit (error-message-string err) :error)))) - (put popup 'magit-popup-deferred nil)) - -(defun magit-change-popup-key (popup type from to) - "In POPUP, bind TO to what FROM was bound to. -TYPE is one of `:action', `:sequence-action', `:switch', or -`:option'. Bind TO and unbind FROM, both are characters." - (--if-let (assoc from (plist-get (symbol-value popup) - (magit-popup-pluralize-type type))) - (setcar it to) - (message "magit-change-popup-key: FROM key %c is unbound" from))) - -(defun magit-remove-popup-key (popup type key) - "In POPUP, remove KEY's binding of TYPE. -POPUP is a popup command defined using `magit-define-popup'. -TYPE is one of `:action', `:sequence-action', `:switch', or -`:option'. KEY is the character which is to be unbound." - (setq type (magit-popup-pluralize-type type)) - (let* ((plist (symbol-value popup)) - (alist (plist-get plist type)) - (value (assoc key alist))) - (set popup (plist-put plist type (delete value alist))))) - -;;; Invoke - -(defvar-local magit-popup-previous-winconf nil) - -(defun magit-invoke-popup (popup mode arg) - (let* ((def (symbol-value popup)) - (val (symbol-value (plist-get def :variable))) - (default (plist-get def :default-action)) - (local (plist-get def :use-prefix)) - (local (if (functionp local) - (funcall local) - local)) - (use-prefix (or local magit-popup-use-prefix-argument))) - (cond - ((or (and (eq use-prefix 'default) arg) - (and (eq use-prefix 'popup) (not arg))) - (if default - (let ((magit-current-popup (list popup 'default)) - (magit-current-popup-args - (let ((magit-this-popup popup) - (magit-this-popup-events nil)) - (magit-popup-default-setup val def) - (magit-popup-get-args)))) - (when (and arg (listp arg)) - (setq current-prefix-arg (and (not (= (car arg) 4)) - (list (/ (car arg) 4))))) - (call-interactively default)) - (message "%s has no default action; showing popup instead." popup) - (magit-popup-mode-setup popup mode))) - ((memq use-prefix '(default popup nil)) - (magit-popup-mode-setup popup mode) - (when magit-popup-show-help-echo - (message - (format - "[%s] show common commands, [%s] describe events, [%s] show manual" - (propertize "C-t" 'face 'magit-popup-key) - (propertize "?" 'face 'magit-popup-key) - (propertize "C-h i" 'face 'magit-popup-key))))) - (local - (error "Invalid :use-prefix popup property value: %s" use-prefix)) - (t - (error "Invalid magit-popup-use-prefix-argument value: %s" use-prefix))))) - -(defun magit-invoke-popup-switch (event) - (interactive (list last-command-event)) - (--if-let (magit-popup-lookup event :switches) - (progn - (setf (magit-popup-event-use it) - (not (magit-popup-event-use it))) - (magit-refresh-popup-buffer)) - (user-error "%c isn't bound to any switch" event))) - -(defun magit-invoke-popup-option (event) - (interactive (list last-command-event)) - (--if-let (magit-popup-lookup event :options) - (progn - (if (magit-popup-event-use it) - (setf (magit-popup-event-use it) nil) - (let* ((arg (magit-popup-event-arg it)) - (val (funcall - (magit-popup-event-fun it) - (concat arg (unless (string-match-p "=$" arg) ": ")) - (magit-popup-event-val it)))) - (setf (magit-popup-event-use it) t) - (setf (magit-popup-event-val it) val))) - (magit-refresh-popup-buffer)) - (user-error "%c isn't bound to any option" event))) - -(defun magit-invoke-popup-action (event) - (interactive (list last-command-event)) - (let ((action (magit-popup-lookup event :actions)) - (variable (magit-popup-lookup event :variables))) - (when (and variable (not (magit-popup-event-arg variable))) - (setq action variable) - (setq variable nil)) - (cond ((or action variable) - (let* ((magit-current-popup magit-this-popup) - (magit-current-popup-args (magit-popup-get-args)) - (magit-current-pre-popup-buffer magit-pre-popup-buffer) - (command (magit-popup-event-fun (or action variable))) - (magit-current-popup-action command)) - (when action - (magit-popup-quit)) - (setq this-command command) - (call-interactively command) - (unless action - (magit-refresh-popup-buffer)))) - ((eq event ?q) - (magit-popup-quit) - (when magit-previous-popup - (magit-popup-mode-setup magit-previous-popup nil))) - (t - (user-error "%c isn't bound to any action" event))))) - -(defun magit-popup-quit () - "Quit the current popup command without invoking an action." - (interactive) - (let ((winconf magit-popup-previous-winconf)) - (if (derived-mode-p 'magit-popup-mode) - (kill-buffer) - (magit-popup-help-mode -1) - (kill-local-variable 'magit-popup-previous-winconf)) - (when winconf - (set-window-configuration winconf)))) - -(defun magit-popup-read-number (prompt &optional default) - "Like `read-number' but DEFAULT may be a numeric string." - (read-number prompt (if (stringp default) - (string-to-number default) - default))) - -;;; Save - -(defun magit-popup-set-default-arguments (arg) - "Set default value for the arguments for the current popup. -Then close the popup without invoking an action; unless a prefix -argument is used in which case the popup remains open. - -For a popup named `NAME-popup' that usually means setting the -value of the custom option `NAME-arguments'." - (interactive "P") - (-if-let (var (magit-popup-get :variable)) - (progn (customize-set-variable var (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - (user-error "Nothing to set"))) - -(defun magit-popup-save-default-arguments (arg) - "Save default value for the arguments for the current popup. -Then close the popup without invoking an action; unless a prefix -argument is used in which case the popup remains open. - -For a popup named `NAME-popup' that usually means saving the -value of the custom option `NAME-arguments'." - (interactive "P") - (-if-let (var (magit-popup-get :variable)) - (progn (customize-save-variable var (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - (user-error "Nothing to save"))) - -;;; Help - -(defun magit-popup-toggle-show-common-commands () - "Show or hide an additional section with common commands. -The commands listed in this section are common to all popups -and are defined in `magit-popup-mode-map' (which see)." - (interactive) - (setq magit-popup-show-common-commands - (not magit-popup-show-common-commands)) - (magit-refresh-popup-buffer) - (fit-window-to-buffer)) - -(defun magit-popup-help () - "Show help for the argument or action at point." - (interactive) - (let* ((man (magit-popup-get :man-page)) - (key (read-key-sequence - (concat "Describe key" (and man " (? for manpage)") ": "))) - (int (aref key (1- (length key)))) - (def (or (lookup-key (current-local-map) key t) - (lookup-key (current-global-map) key)))) - (pcase def - (`magit-invoke-popup-switch - (--if-let (magit-popup-lookup int :switches) - (if (and (string-prefix-p "++" (magit-popup-event-arg it)) - (magit-popup-event-fun it)) - (magit-popup-describe-function (magit-popup-event-fun it)) - (magit-popup-manpage man it)) - (user-error "%c isn't bound to any switch" int))) - (`magit-invoke-popup-option - (--if-let (magit-popup-lookup int :options) - (if (and (string-prefix-p "++" (magit-popup-event-arg it)) - (magit-popup-event-fun it)) - (magit-popup-describe-function (magit-popup-event-fun it)) - (magit-popup-manpage man it)) - (user-error "%c isn't bound to any option" int))) - (`magit-popup-help - (magit-popup-manpage man nil)) - ((or `self-insert-command - `magit-invoke-popup-action) - (setq def (or (magit-popup-lookup int :actions) - (magit-popup-lookup int :variables))) - (if def - (magit-popup-describe-function (magit-popup-event-fun def)) - (ding) - (message nil))) - (`nil (ding) - (message nil)) - (_ (magit-popup-describe-function def))))) - -(defun magit-popup-manpage (topic arg) - (unless topic - (user-error "No man page associated with %s" - (magit-popup-get :man-page))) - (when arg - (setq arg (magit-popup-event-arg arg)) - (when (string-prefix-p "--" arg) - ;; handle '--' option and the '--[no-]' shorthand - (setq arg (cond ((string= "-- " arg) - "\\(?:\\[--\\] \\)?<[^[:space:]]+>\\.\\.\\.") - ((string-prefix-p "--no-" arg) - (concat "--" - "\\[?no-\\]?" - (substring arg 5))) - (t - (concat "--" - "\\(?:\\[no-\\]\\)?" - (substring arg 2))))))) - (let ((winconf (current-window-configuration)) buffer) - (pcase magit-popup-manpage-package - (`woman (delete-other-windows) - (split-window-below) - (with-no-warnings ; display-buffer-function is obsolete - (let ((display-buffer-alist nil) - (display-buffer-function nil) - (display-buffer-overriding-action nil)) - (woman topic))) - (setq buffer (current-buffer))) - (`man (cl-letf (((symbol-function #'fboundp) (lambda (_) nil))) - (setq buffer (man topic))) - (delete-other-windows) - (split-window-below) - (set-window-buffer (selected-window) buffer))) - (with-current-buffer buffer - (setq magit-popup-previous-winconf winconf) - (magit-popup-help-mode) - (fit-window-to-buffer (next-window)) - (if (and arg - (Man-find-section "OPTIONS") - (let ((case-fold-search nil) - ;; This matches preceding/proceeding options. - ;; Options such as '-a', '-S[]', and - ;; '--grep=' are matched by this regex - ;; without the shy group. The '. ' in the shy - ;; group is for options such as '-m - ;; parent-number', and the '-[^[:space:]]+ ' is - ;; for options such as '--mainline parent-number' - (others "-\\(?:. \\|-[^[:space:]]+ \\)?[^[:space:]]+")) - (re-search-forward - ;; should start with whitespace, and may have any - ;; number of options before/after - (format "^[\t\s]+\\(?:%s, \\)*?\\(?1:%s\\)%s\\(?:, %s\\)*$" - others - ;; options don't necessarily end in an '=' - ;; (e.g., '--gpg-sign[=]') - (string-remove-suffix "=" arg) - ;; Simple options don't end in an '='. - ;; Splitting this into 2 cases should make - ;; getting false positives less likely. - (if (string-suffix-p "=" arg) - ;; [^[:space:]]*[^.[:space:]] matches - ;; the option value, which is usually - ;; after the option name and either '=' - ;; or '[='. The value can't end in a - ;; period, as that means it's being used - ;; at the end of a sentence. The space - ;; is for options such as '--mainline - ;; parent-number'. - "\\(?: \\|\\[?=\\)[^[:space:]]*[^.[:space:]]" - ;; Either this doesn't match anything - ;; (e.g., '-a'), or the option is followed - ;; by a value delimited by a '[', '<', or - ;; ':'. A space might appear before this - ;; value, as in '-f '. The space - ;; alternative is for options such as '-m - ;; parent-number'. - "\\(?:\\(?: \\| ?[\\[<:]\\)[^[:space:]]*[^.[:space:]]\\)?") - others) - nil - t))) - (goto-char (match-beginning 1)) - (goto-char (point-min)))))) - -(defun magit-popup-describe-function (function) - (let ((winconf (current-window-configuration))) - (delete-other-windows) - (split-window-below) - (other-window 1) - (with-no-warnings ; display-buffer-function is obsolete - (let ((display-buffer-alist '(("" display-buffer-use-some-window))) - (display-buffer-function nil) - (display-buffer-overriding-action nil) - (help-window-select nil)) - (describe-function function))) - (fit-window-to-buffer) - (other-window 1) - (setq magit-popup-previous-winconf winconf) - (magit-popup-help-mode))) - -(defun magit-popup-info () - "Show the popup manual." - (interactive) - (let ((winconf (current-window-configuration))) - (delete-other-windows) - (split-window-below) - (info "(magit-popup.info)Usage") - (magit-popup-help-mode) - (setq magit-popup-previous-winconf winconf)) - (magit-popup-help-mode) - (fit-window-to-buffer (next-window))) - -(define-minor-mode magit-popup-help-mode - "Auxiliary minor mode used to restore previous window configuration. -When some sort of help buffer is created from within a popup, -then this minor mode is turned on in that buffer, so that when -the user quits it, the previous window configuration is also -restored." - :keymap '(([remap Man-quit] . magit-popup-quit) - ([remap Info-exit] . magit-popup-quit) - ([remap quit-window] . magit-popup-quit))) - -;;; Modes - -(define-derived-mode magit-popup-mode fundamental-mode "MagitPopup" - "Major mode for infix argument popups." - :mode 'magit-popup - (setq truncate-lines t) - (setq buffer-read-only t) - (setq-local scroll-margin 0) - (setq-local magit-popup-show-common-commands magit-popup-show-common-commands) - (hack-dir-local-variables-non-file-buffer)) - -(put 'magit-popup-mode 'mode-class 'special) - -(defun magit-popup-default-setup (val def) - (if (--when-let (magit-popup-get :sequence-predicate) - (funcall it)) - (magit-popup-put :actions (magit-popup-convert-actions - val (magit-popup-get :sequence-actions))) - (let ((vars (plist-get def :variables))) - (when (functionp vars) - (setq vars (funcall vars))) - (when vars - (magit-popup-put :variables (magit-popup-convert-variables val vars)))) - (magit-popup-put :switches (magit-popup-convert-switches - val (plist-get def :switches))) - (magit-popup-put :options (magit-popup-convert-options - val (plist-get def :options))) - (magit-popup-put :actions (magit-popup-convert-actions - val (plist-get def :actions))))) - -(defun magit-popup-mode-setup (popup mode) - (setq magit-previous-popup magit-current-popup) - (let ((val (symbol-value (plist-get (symbol-value popup) :variable))) - (def (symbol-value popup)) - (buf (current-buffer))) - (magit-popup-mode-display-buffer (get-buffer-create - (format "*%s*" popup)) - (or mode 'magit-popup-mode)) - (setq magit-this-popup popup) - (setq magit-pre-popup-buffer buf) - (if (bound-and-true-p magit-popup-setup-hook) ; obsolete - (run-hook-with-args 'magit-popup-setup-hook val def) - (funcall (or (magit-popup-get :setup-function) - 'magit-popup-default-setup) - val def))) - (magit-refresh-popup-buffer) - (fit-window-to-buffer nil nil (line-number-at-pos (point-max)))) - -(defun magit-popup-mode-display-buffer (buffer mode) - (let ((winconf (current-window-configuration))) - (select-window (display-buffer buffer magit-popup-display-buffer-action)) - (funcall mode) - (setq magit-popup-previous-winconf winconf))) - -(defvar magit-refresh-popup-buffer-hook nil - "Hook run by `magit-refresh-popup-buffer'. - -The hook is run right after inserting the representation of the -popup events but before optionally inserting the representation -of events shared by all popups and before point is adjusted.") - -(defun magit-refresh-popup-buffer () - (let* ((inhibit-read-only t) - (button (button-at (point))) - (prefix (and button (button-get button 'prefix))) - (event (and button (button-get button 'event)))) - (erase-buffer) - (save-excursion - (--if-let (magit-popup-get :refresh-function) - (funcall it) - (magit-popup-insert-section 'magit-popup-variable-button) - (magit-popup-insert-section 'magit-popup-switch-button) - (magit-popup-insert-section 'magit-popup-option-button) - (magit-popup-insert-section 'magit-popup-action-button)) - (run-hooks 'magit-refresh-popup-buffer-hook) - (when magit-popup-show-common-commands - (magit-popup-insert-command-section - 'magit-popup-internal-command-button - magit-popup-common-commands))) - (set-buffer-modified-p nil) - (when event - (while (and (ignore-errors (forward-button 1)) - (let ((b (button-at (point)))) - (or (not (equal (button-get b 'prefix) prefix)) - (not (equal (button-get b 'event) event))))))))) - -;;; Draw - -(defvar magit-popup-min-padding 3 - "Minimal amount of whitespace between columns in popup buffers.") - -(defun magit-popup-insert-section (type &optional spec heading) - (if (not spec) - (progn (setq spec (magit-popup-get (button-type-get type 'property))) - (when spec - (if (or (stringp (car spec)) - (functionp (car spec))) - (--each (--partition-by-header - (or (stringp it) (functionp it)) - spec) - (magit-popup-insert-section type (cdr it) (car it))) - (magit-popup-insert-section type spec)))) - (let* ((formatter (button-type-get type 'formatter)) - (items (mapcar (lambda (ev) - (and ev (or (funcall formatter type ev) '("")))) - (or spec (magit-popup-get - (button-type-get type 'property))))) - (maxcols (button-type-get type 'maxcols)) - (pred (magit-popup-get :sequence-predicate))) - (when items - (if (functionp heading) - (when (setq heading (funcall heading)) - (insert heading ?\n)) - (unless heading - (setq heading (button-type-get type 'heading))) - (insert (propertize heading 'face 'magit-popup-heading)) - (unless (string-match "\n$" heading) - (insert "\n"))) - (if (and pred (funcall pred)) - (setq maxcols nil) - (cl-typecase maxcols - (keyword (setq maxcols (magit-popup-get maxcols))) - (symbol (setq maxcols (symbol-value maxcols))))) - (when (functionp maxcols) - (setq maxcols (funcall maxcols heading))) - (when heading - (let ((colwidth - (+ (apply 'max (mapcar (lambda (e) (length (car e))) items)) - magit-popup-min-padding))) - (dolist (item items) - (unless (bolp) - (let ((padding (- colwidth (% (current-column) colwidth)))) - (if (and (< (+ (current-column) padding colwidth) - (window-width)) - (< (ceiling (/ (current-column) (* colwidth 1.0))) - (or maxcols 1000))) - (insert (make-string padding ?\s)) - (insert "\n")))) - (unless (equal item '("")) - (if item - (apply 'insert-button item) - (insert ?\s))))) - (insert (if (= (char-before) ?\n) "\n" "\n\n"))))))) - -(defun magit-popup-format-argument-button (type ev) - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (concat - (--when-let (button-type-get type 'prefix) - (char-to-string it)) - (magit-popup-event-keydsc ev)) - 'face 'magit-popup-key)) - (?d . ,(magit-popup-event-dsc ev)) - (?a . ,(propertize (magit-popup-event-arg ev) - 'face (if (magit-popup-event-use ev) - 'magit-popup-argument - 'magit-popup-disabled-argument))) - (?v . ,(let ((val (magit-popup-event-val ev))) - (if (and (magit-popup-event-use ev) - (not (equal val ""))) - (propertize (format "\"%s\"" val) - 'face 'magit-popup-option-value) - ""))))) - 'type type 'event (magit-popup-event-key ev))) - -(defun magit-popup-format-variable-button (type ev) - (if (not (magit-popup-event-arg ev)) - (magit-popup-format-action-button 'magit-popup-action-button ev) - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (magit-popup-event-keydsc ev) - 'face 'magit-popup-key)) - (?d . ,(funcall (magit-popup-event-arg ev))))) - 'type type 'event (magit-popup-event-key ev)))) - -(defun magit-popup-format-action-button (type ev) - (let* ((dsc (magit-popup-event-dsc ev)) - (fun (and (functionp dsc) dsc))) - (when fun - (setq dsc - (-when-let (branch (funcall fun)) - (if (text-property-not-all 0 (length branch) 'face nil branch) - branch - (magit-branch-set-face branch))))) - (when dsc - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (magit-popup-event-keydsc ev) - 'face 'magit-popup-key)) - (?d . ,dsc) - (?D . ,(if (and (not fun) - (eq (magit-popup-event-fun ev) - (magit-popup-get :default-action))) - (propertize dsc 'face 'bold) - dsc)))) - 'type type 'event (magit-popup-event-key ev))))) - -(defun magit-popup-insert-command-section (type spec) - (magit-popup-insert-section - type (mapcar (lambda (elt) - (list (car (where-is-internal (cadr elt) - (current-local-map))) - (car elt))) - spec))) - -(defun magit-popup-format-command-button (type elt) - (nconc (magit-popup-format-action-button - type (make-magit-popup-event :key (car elt) - :dsc (cadr elt))) - (list 'function (lookup-key (current-local-map) (car elt))))) - -;;; Utilities - -(defun magit-popup-import-file-args (args files) - (if files - (cons (concat "-- " (mapconcat #'identity files ",")) args) - args)) - -(defun magit-popup-export-file-args (args) - (let ((files (--first (string-prefix-p "-- " it) args))) - (when files - (setq args (remove files args)) - (setq files (split-string (substring files 3) ","))) - (list args files))) - -(defconst magit-popup-font-lock-keywords - (eval-when-compile - `((,(concat "(\\(magit-define-popup\\)\\_>" - "[ \t'\(]*" - "\\(\\(?:\\sw\\|\\s_\\)+\\)?") - (1 'font-lock-keyword-face) - (2 'font-lock-function-name-face nil t))))) - -(font-lock-add-keywords 'emacs-lisp-mode magit-popup-font-lock-keywords) - -;;; _ -(provide 'magit-popup) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: -;;; magit-popup.el ends here diff --git a/elpa/magit-popup-20180329.1302/magit-popup.info b/elpa/magit-popup-20180329.1302/magit-popup.info deleted file mode 100644 index e5cae82b..00000000 --- a/elpa/magit-popup-20180329.1302/magit-popup.info +++ /dev/null @@ -1,740 +0,0 @@ -This is magit-popup.info, produced by makeinfo version 6.1 from -magit-popup.texi. - - Copyright (C) 2015-2018 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 -* Magit-Popup: (magit-popup). Infix arguments with feedback. -END-INFO-DIR-ENTRY - - -File: magit-popup.info, Node: Top, Next: Introduction, Up: (dir) - -Magit-Popup User Manual -*********************** - -Taking inspiration from regular prefix commands and prefix arguments, -this library implements a similar abstraction; a new kind of prefix -command that is associated with a specific set of infix arguments and -suffix commands. - -This manual is for Magit-Popup version 2.12.2 (v2.12.2-6-gbd04ebd+1). - - Copyright (C) 2015-2018 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:: -* Usage:: -* Defining Prefix and Suffix Commands:: - -— The Detailed Node Listing — - -Usage - -* Customizing Existing Popups:: -* Other Options:: - -Defining Prefix and Suffix Commands - -* Defining Prefix Commands:: -* Defining Suffix Commands:: - - - -File: magit-popup.info, Node: Introduction, Next: Usage, Prev: Top, Up: Top - -1 Introduction -************** - -Taking inspiration from regular prefix commands and prefix arguments, -this library implements a similar abstraction; a new kind of prefix -command that is associated with a specific set of infix arguments and -suffix commands. - - Invoking such a prefix command displays a popup buffer which lists -the associated infix arguments and suffix commands. In that buffer each -argument is prefixed with the key sequence that can be used to toggle it -or change its value. Likewise each suffix command is prefixed with the -key used to invoke it. Such a popup buffer might look like this: - - ,----------------------------------------- - |Switches - | -l Show graph (--graph) - | -d Show refnames (--decorate) - | - |Options - | =m Search messages (--grep="popup") - | =p Search patches (-G) - | - |Action - | l Show log for current branch - | o Show log for another branch - '----------------------------------------- - - The user could then for example type ‘-l’ to toggle the ‘--graph’ -*switch* (when it is on then it is shown in green, otherwise in gray), -or ‘=m’ to change the value of the *option* ‘--grep’. - - Once all arguments are as desired one invokes a suffix command, which -causes the popup buffer to disappear. The suffix command should then -retrieve the infix arguments in its ‘interactive’ form like this is done -for prefix arguments. - - While such "prefix-infix-suffix" combos were inspired by regular -prefix commands and prefix arguments, they are also quite different. -This should illustrate the most basic differences: - - • A regular prefix command - - /- command1 - prefix --- command2 - \- command3 - - • Prefix arguments - - /- command1 - C-u ... --- command2 - \- well any command - - • A Prefix-Infix-Suffix combo - - /- argument1 -\ /- suffix1 - prefix----- argument2 --+-- suffix2 - ^ \- argument3 -/ - | | - '--------' - (refresh buffer) - - This library was written as a replacement for ‘magit-key-mode’, which -was used in Magit releases before 2.1.0. It is used to implement all -"popups" in the current Magit release but a future release will switch -to yet another implementation. - - This library does not depend on any other Magit libraries and it is -distributed as a separate package, which makes it possible to use it in -packages that are not related to Magit. But keep in mind that it will -be deprecated eventually. - - -File: magit-popup.info, Node: Usage, Next: Defining Prefix and Suffix Commands, Prev: Introduction, Up: Top - -2 Usage -******* - -Every popup buffers created with a prefix command contains a section -named "Actions" listing the available suffix commands. Most buffers -also contain a "Switches" and/or an "Options" section which list the two -types of infix arguments separately. - - Switches are arguments that can be toggled on or off. When a switch -is active then it is shown in color, when it is off then it is shown in -gray (of course the details depend on the color theme in use). - - Options are arguments that have a value. When an option has a value -then that is shown after the option itself. Because for some options -the empty string is a valid value, options are additionally colorized -like switches to indicate whether they are active or not. - - The events bound to suffix commands are always single alphabetic -characters. The bindings for arguments are always two events long. For -switches the first key is always ‘-’, for options it is always ‘=’. The -second key is always an alphabetic character. - - By default popup buffers also feature a section listing commands -common to all popups. To avoid conflicts with suffix commands, the -bindings of these common commands are not alphabetic characters. This -section is shown by default so that documentation-resistant users get a -chance to notice them. - - -- User Option: magit-popup-show-common-commands - - This option controls whether the section that lists the commands - that are common to all popups is initially shown. - - By default this is not the case, but note that you can temporarily - show this section using ‘C-t’, which therefore is the only common - command you actually have to memorize. - -‘C-t’ (‘magit-popup-toggle-show-common-commands’) - - Show or hide the section listing the commands shared by all popups. - -‘C-g’ (‘magit-popup-quit’) - - Quit popup buffer without invoking a suffix command. - - Without further action, setting arguments only affects the next -suffix command. Invoking the same prefix command again resets the -arguments to their default value, but the defaults can be changed -directly from the popup buffer itself. For a prefix command named -‘NAME-popup’ the default values are stored as the value of the custom -option named ‘NAME-arguments’. While this option can be customized -using the Custom interface, it is better to do so directly from the -popup buffer. - -‘C-c C-c’ (‘magit-popup-set-default-arguments’) - - This sets the default value for the arguments for the current - popup. - - Then the popup buffer is closed without invoking a suffix command; - unless a prefix argument is used in which case the popup remains - open. - -‘C-x C-s’ (‘magit-popup-save-default-arguments’) - - This sets the default value for the arguments for the current popup - and saves it for future Emacs sessions. - - Then the popup buffer is closed without invoking an action; unless - a prefix argument is used in which case the popup remains open. - - It is also possible to add additional arguments and commands to an -existing popup, but that cannot be done directly from the popup (or the -Custom interface). See *note Customizing Existing Popups::. - - Documentation about a popup’s arguments and commands can be shown -directly from the popup. - -‘C-h i’ (‘magit-popup-info’) - - Show this manual. - -‘?’ (‘magit-popup-help’) - - This command reads a key sequence and then shows the documentation - of the argument or command that sequence is bound to. In other - words type the same keys that you would use to invoke the argument - or command, but prefix the sequence with ‘?’. - - For suffix commands this shows the doc-string. For arguments this - command can only show something for popups that have an associated - man-page. If the man-page is set, then this command displays it in - a separate buffer and puts point on the entry about the argument in - question. - - The buffer which is used to display the documentation is selected. - Simply press ‘q’ to leave that buffer and restore the old window - configuration. - - While it isn’t very useful, it is possible to move around in a popup -buffer using ‘C-p’ and ‘C-n’, and to invoke the argument or command at -point using ‘RET’. But it is much more efficient to use the dedicated -key bindings instead, so these commands are not listed in popup buffers -along with the other common commands. - -* Menu: - -* Customizing Existing Popups:: -* Other Options:: - - -File: magit-popup.info, Node: Customizing Existing Popups, Next: Other Options, Up: Usage - -2.1 Customizing Existing Popups -=============================== - -It is possible to define additional infix arguments and suffix commands -to an existing popup using the following functions. - - You can find some examples which use the below commands at -. - - -- Function: magit-define-popup-switch popup key desc switch &optional - enable at prepend - - In POPUP, define KEY as SWITCH. - - POPUP is a popup command defined using ‘magit-define-popup’. - SWITCH is a string representing an argument that takes no value. - KEY is a character representing the second event in the sequence of - keystrokes used to toggle the argument. (The first event, the - prefix, is shared among all switches, defaults to ‘-’, and can be - changed in ‘magit-popup-mode-keymap’). - - DESC is a string describing the purpose of the argument, it is - displayed in the popup. - - If optional ENABLE is non-nil then the switch is on by default. - - SWITCH is inserted after all other switches already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another switch already defined for POPUP, the argument is then - placed before or after AT, depending on PREPEND. - - -- Function: magit-define-popup-option popup key desc option &optional - reader value at prepend - - In POPUP, define KEY as OPTION. - - POPUP is a popup command defined using ‘magit-define-popup’. - OPTION is a string representing an argument that takes a value. - KEY is a character representing the second event in the sequence of - keystrokes used to set the argument’s value. (The first event, the - prefix, is shared among all options, defaults to ‘=’, and can be - changed in ‘magit-popup-mode-keymap’). - - DESC is a string describing the purpose of the argument, it is - displayed in the popup. - - If optional VALUE is non-nil then the option is on by default, and - VALUE is its default value. - - READER is used to read a value from the user when the option is - invoked and does not currently have a value. It should take one - argument and use it as the prompt. If this is nil, then - ‘read-from-minibuffer’ is used. - - OPTION is inserted after all other options already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another option already defined for POPUP, the argument is then - placed before or after AT, depending on PREPEND. - - -- Function: magit-define-popup-action popup key desc command &optional - at prepend - - In POPUP, define KEY as COMMAND. - - POPUP is a popup command defined using ‘magit-define-popup’. - COMMAND can be any command but should usually consume the popup - arguments in its ‘interactive’ form. KEY is a character - representing the event used invoke the action, i.e. to - interactively call the COMMAND. - - DESC is a string describing the purpose of the action, it is - displayed in the popup. - - COMMAND is inserted after all other commands already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another command already defined for POPUP, the command is then - placed before or after AT, depending on PREPEND. - - -- Function: magit-define-popup-sequence-action popup key desc command - &optional at prepend - - Like ‘magit-define-popup-action’, but modifies the value of the - ‘:sequence-actions’ property instead of ‘:actions’. - - -- Function: magit-define-popup-variable popup key desc command - formatter &optional at prepend - - In POPUP, define KEY as COMMAND. - - POPUP is a popup command defined using ‘magit-define-popup’. - COMMAND is a command which calls ‘magit-popup-set-variable’. - FORMATTER is a function which calls ‘magit-popup-format-variable’. - These two functions have to be called with the same arguments. - - KEY is a character representing the event used interactively call - the COMMAND. - - DESC is the variable or a representation thereof. It’s not - actually used for anything. - - COMMAND is inserted after all other commands already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another command already defined for POPUP, the command is then - placed before or after AT, depending on PREPEND." - - -- Function: magit-change-popup-key popup type from to - - In POPUP, bind TO to what FROM was bound to. TYPE is one of - ‘:action’, ‘:sequence-action’, ‘:switch’, or ‘:option’. Bind TO - and unbind FROM, both are characters. - - -- Function: magit-remove-popup-key popup type key - - In POPUP, remove KEY’s binding of TYPE. POPUP is a popup command - defined using ‘magit-define-popup’. TYPE is one of ‘:action’, - ‘:sequence-action’, ‘:switch’, or ‘:option’. KEY is the character - which is to be unbound. - - It is also possible to change other aspects of a popup by setting a -property using ‘plist-put’. See *note Defining Prefix Commands:: for -valid properties. The most likely change Magit users might want to make -is: - - (plist-put magit-show-refs-popup :use-prefix nil) - - -File: magit-popup.info, Node: Other Options, Prev: Customizing Existing Popups, Up: Usage - -2.2 Other Options -================= - - -- User Option: magit-popup-use-prefix-argument - - This option controls the effect that the use of a prefix argument - before entering a popup has. - - • ‘default’ - - With a prefix argument directly invoke the popup’s default - action (an Emacs command), instead of bringing up the popup. - - • ‘popup’ - - With a prefix argument bring up the popup, otherwise directly - invoke the popup’s default action. - - • ‘nil’ - - Ignore prefix arguments. - - This option can be overridden for individual popups. - ‘magit-show-refs-popup’ for example defaults to invoking the - default action directly. It only shows the popup buffer when a - prefix argument is used. See *note Customizing Existing Popups::. - - -- User Option: magit-popup-manpage-package - - The Emacs package used to display man-pages, one of ‘man’ or - ‘woman’. - - -- User Option: magit-popup-display-buffer-action - - The option controls how the window used to display a popup buffer - is created. Popup buffers are displayed using ‘display-buffer’ - with the value of this option as ACTION argument. You can also set - this to nil and instead add an entry to ‘display-buffer-alist’. - - To emphasize the default action by making it bold use this: - - (button-type-put 'magit-popup-action-button 'format " %k %D") - - -File: magit-popup.info, Node: Defining Prefix and Suffix Commands, Prev: Usage, Up: Top - -3 Defining Prefix and Suffix Commands -************************************* - -If you write an extension for Magit then you should use this library now -and later when ‘transient’ is released port to that. - - If you are considering using this library to define popups for -packages not related to Magit, then keep in mind that it will be -superseded eventually. Once ‘transient’ has been released I will only -fix bugs in ‘magit-popup’ but not implement any new features. - - Also consider using ‘hydra’ instead. To some extend ‘magit-popup’ -and ‘hydra’ are similar but have a different focus. The main purpose of -‘magit-popup’ is to pass infix arguments to suffix commands. If all you -need is a command dispatcher then you are better of using ‘hydra’. Of -course ‘hydra’ may also be a better fit not only because of the features -it lacks, but also because of the features it provides, which are in -turn missing from ‘magit-popup’. - - Here is an example of how one defines a prefix command along with its -infix arguments, and then also one of its suffix commands. - - ;;;###autoload (autoload 'magit-tag-popup "magit" nil t) - (magit-define-popup magit-tag-popup - "Show popup buffer featuring tagging commands." - 'magit-commands - :man-page "git-tag" - :switches '((?a "Annotate" "--annotate") - (?s "Sign" "--sign") - (?f "Force" "--force")) - :actions '((?t "Create" magit-tag) - (?k "Delete" magit-tag-delete) - (?p "Prune" magit-tag-prune)) - :default-action 'magit-tag) - - ;;;###autoload - (defun magit-tag (name rev &optional args) - "Create a new tag with the given NAME at REV." - (interactive (list (magit-read-tag "Tag name") - (magit-read-branch-or-commit "Place tag on") - (magit-tag-arguments))) - (magit-run-git-with-editor "tag" args name rev)) - -* Menu: - -* Defining Prefix Commands:: -* Defining Suffix Commands:: - - -File: magit-popup.info, Node: Defining Prefix Commands, Next: Defining Suffix Commands, Up: Defining Prefix and Suffix Commands - -3.1 Defining Prefix Commands -============================ - -Prefix commands and their infix arguments are defined using the macro -‘magit-define-popup’. The key bindings and descriptions of suffix -commands are also defined using that macro, but the actual interactive -commands have to be defined separately using plain ‘defun’. - - -- Macro: magit-define-popup name doc [group [mode [option]]] :keyword - value... - - This macro defines a popup named NAME. The NAME should begin with - the package prefix and by convention end with ‘-popup’, it is used - as the name of the command which shows the popup and for an - internal variable (whose value is used to store information about - the popup and should not be accessed directly). DOC is the - doc-string of the popup command. - - This macro also defines an option and a function both named - ‘SHORTNAME-arguments’, where SHORTNAME is NAME with the trailing - ‘-popup’ removed. The name of this option and this function can be - overwritten using the optional argument OPTION, but that is rarely - advisable. As a special case if OPTION is specified but ‘nil’, - then this option and this function are not defined at all, which is - useful for popups that are used as simple dispatchers that offer no - arguments. - - The option ‘SHORTNAME-arguments’ holds the value for the popup - arguments. It can be customized from within the popup or using the - Custom interface. It can also have a buffer local value in any - non-popup buffer. The local value for the buffer from which the - popup command was invoked, can be set from within the popup buffer. - - The function ‘SHORTNAME-arguments’ returns the currently effective - value of the variable by the same name. See below for more - information. - - Optional argument GROUP specifies the Custom group into which the - option is placed. If omitted then the option is placed into some - group the same way it is done when directly using ‘defcustom’ and - omitting the group, except when NAME begins with "magit-", in which - case the group ‘magit-git-arguments’ is used. - - The optional argument MODE specifies the mode used by the popup - buffer. If it is omitted or ‘nil’ then ‘magit-popup-mode’ is used. - - The remaining arguments should have the form ‘[KEYWORD VALUE]...’. - - The following keywords are meaningful (and by convention are - usually specified in that order): - - • ‘:actions’ - - The actions which can be invoked from the popup. VALUE is a - list whose members have the form (KEY DESC COMMAND), see - ‘magit-define-popup-action’ for details. - - Actions are regular Emacs commands, which usually have an - ‘interactive’ form setup to consume the values of the popup - ‘:switches’ and ‘:options’ when invoked from the corresponding - popup, else when invoked as the default action or directly - without using the popup, the default value of the variable - ‘SHORTNAME-arguments’. This is usually done by calling the - function ‘SHORTNAME-arguments’. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - Members of VALUE may also be nil. This should only be used - together with ‘:max-action-columns’ and allows having gaps in - the action grit, which can help arranging actions sensibly. - - • ‘:default-action’ - - The default action of the popup which is used directly instead - of displaying the popup buffer, when the popup is invoked with - a prefix argument. Also see ‘magit-popup-use-prefix-argument’ - and ‘:use-prefix’, which can be used to inverse the meaning of - the prefix argument. - - • ‘:use-prefix’ - - Controls when to display the popup buffer and when to invoke - the default action (if any) directly. This overrides the - global default set using ‘magit-popup-use-prefix-argument’. - The value, if specified, should be one of ‘default’ or - ‘prefix’, or a function that is called with no arguments and - returns one of these symbols. - - • ‘:max-action-columns’ - - The maximum number of actions to display on a single line, a - number or a function that return a number and takes the name - of the section currently being inserted as argument. If there - isn’t enough room to display as many columns as specified - here, then fewer are used. - - • ‘:switches’ - - The popup arguments which can be toggled on and off. VALUE is - a list whose members have the form ‘(KEY DESC SWITCH)’, see - ‘magit-define-popup-switch’ for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - • ‘:options’ - - The popup arguments which take a value, as in "–opt~OPTVAL". - VALUE is a list whose members have the form ‘(KEY DESC OPTION - READER)’, see ‘magit-define-popup-option’ for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - • ‘:default-arguments’ - - The default arguments, a list of switches (which are then - enabled by default) and options with there default values, as - in ‘"--OPT=OPTVAL"’. - - • ‘:variables’ - - Git variables which can be set from the popup. VALUE is a - list whose members have the form ‘(KEY DESC COMMAND - FORMATTER)’, see ‘magit-define-popup-variable’ for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - Members of VALUE may also be actions as described above for - ‘:actions’. - - VALUE may also be a function that returns a list as describe - above. - - • ‘:sequence-predicate’ - - When this function returns non-nil, then the popup uses - ‘:sequence-actions’ instead of ‘:actions’, and does not show - the ‘:switches’ and ‘:options’. - - • ‘:sequence-actions’ - - The actions which can be invoked from the popup, when - ‘:sequence-predicate’ returns non-nil. - - • ‘:setup-function’ - - When this function is specified, then it is used instead of - ‘magit-popup-default-setup’. - - • ‘:refresh-function’ - - When this function is specified, then it is used instead of - calling ‘magit-popup-insert-section’ three times with symbols - ‘magit-popup-switch-button’, ‘magit-popup-option-button’, and - finally ‘magit-popup-action-button’ as argument. - - • ‘:man-page’ - - The name of the manpage to be displayed when the user requests - help for an argument. - - -File: magit-popup.info, Node: Defining Suffix Commands, Prev: Defining Prefix Commands, Up: Defining Prefix and Suffix Commands - -3.2 Defining Suffix Commands -============================ - -Commands intended to be invoked from a particular popup should determine -the currently effective arguments by calling the function -‘SHORTNAME-arguments’ inside their ‘interactive’ form. This function is -created by the ‘magit-define-popup’ macro. For a popup named -‘prefix-foo-popup’ the name of this function is ‘prefix-foo-arguments’. - - When the command was invoked as an action in the respective popup, -then this function returns the arguments that were set in the popup. -Otherwise when the command was invoked as the default of the popup (by -calling the popup command with a prefix argument), or without using the -popup command at all, then this function returns the buffer-local or -global value of the variable ‘SHORTNAME-arguments’. - - Internally arguments are handled as a list of strings. This might -not be appropriate for the intended use inside commands, or it might be -necessary to manipulate that list somehow, i.e. to split "–ARG=VAL" -into "–ARG""VAL". This should be done by advising or redefining the -function ‘SHORTNAME-arguments’. - - Internally ‘SHORNAME-arguments’ used following variables and -function. Except when redefining the former, you should not use these -directly. - - -- Variable: magit-current-popup - - The popup from which this editing command was invoked. - - -- Variable: magit-current-popup-args - - The value of the popup arguments for this editing command. - - If the current command was invoked from a popup, then this is a - list of strings of all the set switches and options. This includes - arguments which are set by default not only those explicitly set - during this invocation. - - When the value is nil, then that can be because no argument is set, - or because the current command wasn’t invoked from a popup at all. - - -- Function: magit-current-popup-args &rest args - - This function returns the value of the popup arguments for this - editing command. The value is the same as that of the variable by - the same name, except that FILTER is applied. FILTER is a list of - regexps; only arguments that match one of them are returned. The - first element of FILTER may also be ‘:not’ in which case only - arguments that don’t match any of the regexps are returned, or - ‘:only’ which doesn’t change the behavior. - - - -Tag Table: -Node: Top768 -Node: Introduction2013 -Node: Usage4712 -Node: Customizing Existing Popups9409 -Node: Other Options15155 -Node: Defining Prefix and Suffix Commands16698 -Node: Defining Prefix Commands18850 -Node: Defining Suffix Commands27548 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-popup-20180509.1041/dir b/elpa/magit-popup-20180509.1041/dir deleted file mode 100644 index c276dafb..00000000 --- a/elpa/magit-popup-20180509.1041/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, "?" 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 -* Magit-Popup: (magit-popup). Infix arguments with feedback. diff --git a/elpa/magit-popup-20180509.1041/magit-popup-autoloads.el b/elpa/magit-popup-20180509.1041/magit-popup-autoloads.el deleted file mode 100644 index e6e027b2..00000000 --- a/elpa/magit-popup-20180509.1041/magit-popup-autoloads.el +++ /dev/null @@ -1,26 +0,0 @@ -;;; magit-popup-autoloads.el --- automatically extracted autoloads -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "magit-popup" "magit-popup.el" (0 0 0 0)) -;;; Generated autoloads from magit-popup.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-popup" '("magit-"))) - -;;;*** - -;;;### (autoloads nil nil ("magit-popup-pkg.el") (0 0 0 0)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; magit-popup-autoloads.el ends here diff --git a/elpa/magit-popup-20180509.1041/magit-popup-pkg.el b/elpa/magit-popup-20180509.1041/magit-popup-pkg.el deleted file mode 100644 index 76fc98c0..00000000 --- a/elpa/magit-popup-20180509.1041/magit-popup-pkg.el +++ /dev/null @@ -1,10 +0,0 @@ -(define-package "magit-popup" "20180509.1041" "Define prefix-infix-suffix command combos" - '((emacs "24.4") - (async "1.9.2") - (dash "2.13.0")) - :keywords - '("bindings") - :url "https://github.com/magit/magit-popup") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-popup-20180509.1041/magit-popup.el b/elpa/magit-popup-20180509.1041/magit-popup.el deleted file mode 100644 index 5378842d..00000000 --- a/elpa/magit-popup-20180509.1041/magit-popup.el +++ /dev/null @@ -1,1366 +0,0 @@ -;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- - -;; Copyright (C) 2010-2018 The Magit Project Contributors -;; -;; You should have received a copy of the AUTHORS.md file which -;; lists all contributors. If not, see http://magit.vc/authors. - -;; This library was inspired by and replaces library `magit-key-mode', -;; which was written by Phil Jackson and is -;; distributed under the GNU General Public License version 3 or later. - -;; Author: Jonas Bernoulli -;; Maintainer: Jonas Bernoulli - -;; Package-Requires: ((emacs "24.4") (async "1.9.2") (dash "2.13.0")) -;; Keywords: bindings -;; Homepage: https://github.com/magit/magit-popup - -;; Magit-Popup 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, or (at your option) -;; any later version. -;; -;; Magit-Popup 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 Magit-Popup. If not, see http://www.gnu.org/licenses. - -;;; Commentary: - -;; This package implements a generic interface for toggling switches -;; and setting options and then invoking an Emacs command which does -;; something with these arguments. The prototypical use is for the -;; command to call an external process, passing on the arguments as -;; command line arguments. But this is only one of many possible -;; uses (though the one this library is optimized for). - -;; With the Emacs concept of "prefix arguments" in mind this could be -;; described as "infix arguments with feedback in a buffer". - -;; Commands that set the prefix argument for the subsequent command do -;; not limit what that next command could be. But entering a command -;; console popup does limit the selection to the commands defined for -;; that popup, and so we use the term "infix" instead of "prefix". - -;;; Code: - -(require 'button) -(require 'cl-lib) -(require 'dash) -(require 'format-spec) -(eval-when-compile (require 'subr-x)) - -(and (require 'async-bytecomp nil t) - (cl-intersection '(all magit) - (bound-and-true-p async-bytecomp-allowed-packages)) - (fboundp 'async-bytecomp-package-mode) - (async-bytecomp-package-mode 1)) - -(declare-function info 'info) -(declare-function Man-find-section 'man) -(declare-function Man-next-section 'man) - -;; For branch actions. -(declare-function magit-branch-set-face 'magit-git) - -;;; Settings -;;;; Custom Groups - -(defgroup magit-popup nil - "Infix arguments with a popup as feedback." - :link '(info-link "(magit-popup)") - :group 'bindings) - -(defgroup magit-popup-faces nil - "Faces used by Magit-Popup." - :group 'magit-popup) - -;;;; Custom Options - -(defcustom magit-popup-display-buffer-action '((display-buffer-below-selected)) - "The action used to display a popup buffer. - -Popup buffers are displayed using `display-buffer' with the value -of this option as ACTION argument. You can also set this to nil -and instead add an entry to `display-buffer-alist'." - :package-version '(magit-popup . "2.4.0") - :group 'magit-popup - :type 'sexp) - -(defcustom magit-popup-manpage-package - (if (memq system-type '(windows-nt ms-dos)) 'woman 'man) - "The package used to display manpages. -One of `man' or `woman'." - :group 'magit-popup - :type '(choice (const man) (const woman))) - -(defcustom magit-popup-show-help-echo t - "Show usage information in the echo area." - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-show-common-commands nil - "Whether to initially show section with commands common to all popups. -This section can also be toggled temporarily using \ -\\\\[magit-popup-toggle-show-common-commands]." - :package-version '(magit-popup . "2.9.0") - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-use-prefix-argument 'default - "Control how prefix arguments affect infix argument popups. - -This option controls the effect that the use of a prefix argument -before entering a popup has. - -`default' With a prefix argument directly invoke the popup's - default action (an Emacs command), instead of bringing - up the popup. - -`popup' With a prefix argument bring up the popup, otherwise - directly invoke the popup's default action. - -`nil' Ignore prefix arguments." - :group 'magit-popup - :type '(choice - (const :tag "Call default action instead of showing popup" default) - (const :tag "Show popup instead of calling default action" popup) - (const :tag "Ignore prefix argument" nil))) - -;;;; Custom Faces - -(defface magit-popup-heading - '((t :inherit font-lock-keyword-face)) - "Face for key mode header lines." - :group 'magit-popup-faces) - -(defface magit-popup-key - '((t :inherit font-lock-builtin-face)) - "Face for key mode buttons." - :group 'magit-popup-faces) - -(defface magit-popup-argument - '((t :inherit font-lock-warning-face)) - "Face used to display enabled arguments in popups." - :group 'magit-popup-faces) - -(defface magit-popup-disabled-argument - '((t :inherit shadow)) - "Face used to display disabled arguments in popups." - :group 'magit-popup-faces) - -(defface magit-popup-option-value - '((t :inherit font-lock-string-face)) - "Face used to display option values in popups." - :group 'magit-popup-faces) - -;;;; Keymap - -(defvar magit-popup-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [remap self-insert-command] 'magit-invoke-popup-action) - (define-key map (kbd "- ") 'magit-invoke-popup-switch) - (define-key map (kbd "= ") 'magit-invoke-popup-option) - (define-key map (kbd "C-g") 'magit-popup-quit) - (define-key map (kbd "?") 'magit-popup-help) - (define-key map (kbd "C-h k") 'magit-popup-help) - (define-key map (kbd "C-h i") 'magit-popup-info) - (define-key map (kbd "C-t") 'magit-popup-toggle-show-common-commands) - (define-key map (kbd "C-c C-c") 'magit-popup-set-default-arguments) - (define-key map (kbd "C-x C-s") 'magit-popup-save-default-arguments) - (cond ((featurep 'jkl) - (define-key map (kbd "C-p") 'universal-argument) - (define-key map [return] 'push-button) - (define-key map (kbd "C-i") 'backward-button) - (define-key map (kbd "C-k") 'forward-button)) - (t - (define-key map (kbd "C-m") 'push-button) - (define-key map (kbd "DEL") 'backward-button) - (define-key map (kbd "C-p") 'backward-button) - (define-key map (kbd "C-i") 'forward-button) - (define-key map (kbd "C-n") 'forward-button))) - map) - "Keymap for `magit-popup-mode'. - -\\\ -This keymap contains bindings common to all popups. A section -listing these commands can be shown or hidden using \ -\\[magit-popup-toggle-show-common-commands]. - -The prefix used to toggle any switch can be changed by binding -another key to `magit-invoke-popup-switch'. Likewise binding -another key to `magit-invoke-popup-option' changes the prefixed -used to set any option. The two prefixes have to be different. -If you change these bindings, you should also change the `prefix' -property of the button types `magit-popup-switch-button' and -`magit-popup-option-button'. - -If you change any other binding, then you might have to also edit -`magit-popup-common-commands' for things to align correctly in -the section listing these commands. - -Never bind an alphabetic character in this keymap or you might -make it impossible to invoke certain actions.") - -(defvar magit-popup-common-commands - '(("Set defaults" magit-popup-set-default-arguments) - ("View popup manual" magit-popup-info) - ("Toggle this section" magit-popup-toggle-show-common-commands) - ("Save defaults" magit-popup-save-default-arguments) - (" Popup help prefix" magit-popup-help) - ("Abort" magit-popup-quit))) - -;;;; Buttons - -(define-button-type 'magit-popup-button - 'face nil - 'action (lambda (button) - (funcall (button-get button 'function) - (button-get button 'event)))) - -(define-button-type 'magit-popup-switch-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-switch - 'property :switches - 'heading "Switches\n" - 'formatter 'magit-popup-format-argument-button - 'format " %k %d (%a)" - 'prefix ?- - 'maxcols 1) - -(define-button-type 'magit-popup-option-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-option - 'property :options - 'heading "Options\n" - 'formatter 'magit-popup-format-argument-button - 'format " %k %d (%a%v)" - 'prefix ?= - 'maxcols 1) - -(define-button-type 'magit-popup-variable-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-action - 'property :variables - 'heading "Variables\n" - 'formatter 'magit-popup-format-variable-button - 'format " %k %d" - 'prefix nil - 'maxcols 1) - -(define-button-type 'magit-popup-action-button - 'supertype 'magit-popup-button - 'function 'magit-invoke-popup-action - 'property :actions - 'heading "Actions\n" - 'formatter 'magit-popup-format-action-button - 'format " %k %d" - 'prefix nil - 'maxcols :max-action-columns) - -(define-button-type 'magit-popup-command-button - 'supertype 'magit-popup-action-button - 'formatter 'magit-popup-format-command-button - 'action (lambda (button) - (let ((command (button-get button 'function))) - (unless (eq command 'push-button) - (call-interactively command))))) - -(define-button-type 'magit-popup-internal-command-button - 'supertype 'magit-popup-command-button - 'heading "Common Commands\n" - 'maxcols 3) - -;;; Events - -(defvar-local magit-this-popup nil - "The popup which is currently active. -This is intended for internal use only. -Don't confuse this with `magit-current-popup'.") - -(defvar-local magit-this-popup-events nil - "The events known to the active popup. -This is intended for internal use only. -Don't confuse this with `magit-current-popup-args'.") - -(defvar-local magit-previous-popup nil) - -(defvar-local magit-pre-popup-buffer nil - "The buffer that was current before invoking the active popup.") - -(defun magit-popup-get (prop) - "While a popup is active, get the value of PROP." - (if (memq prop '(:switches :options :variables :actions)) - (plist-get magit-this-popup-events prop) - (plist-get (symbol-value magit-this-popup) prop))) - -(defun magit-popup-put (prop val) - "While a popup is active, set the value of PROP to VAL." - (if (memq prop '(:switches :options :variables :actions)) - (setq magit-this-popup-events - (plist-put magit-this-popup-events prop val)) - (error "Property %s isn't supported" prop))) - -(defvar magit-current-popup nil - "The popup from which this editing command was invoked. - -Use this inside the `interactive' form of a popup aware command -to determine whether it was invoked from a popup and if so from -which popup. If the current command was invoked without the use -of a popup, then this is nil.") - -(defvar magit-current-popup-action nil - "The popup action now being executed.") - -(defvar magit-current-popup-args nil - "The value of the popup arguments for this editing command. - -If the current command was invoked from a popup, then this is -a list of strings of all the set switches and options. This -includes arguments which are set by default not only those -explicitly set during this invocation. - -When the value is nil, then that can be because no argument is -set, or because the current command wasn't invoked from a popup; -consult `magit-current-popup' to tell the difference. - -Generally it is better to use `NAME-arguments', which is created -by `magit-define-popup', instead of this variable or the function -by the same name, because `NAME-argument' uses the default value -for the arguments when the editing command is invoked directly -instead of from a popup. When the command is bound in several -popups that might not be feasible though.") - -(defun magit-current-popup-args (&rest filter) - "Return the value of the popup arguments for this editing command. - -The value is the same as that of the variable by the same name -\(which see), except that FILTER is applied. FILTER is a list -of regexps; only arguments that match one of them are returned. -The first element of FILTER may also be `:not' in which case -only arguments that don't match any of the regexps are returned, -or `:only' which doesn't change the behaviour." - (let ((-compare-fn (lambda (a b) (magit-popup-arg-match b a)))) - (-filter (if (eq (car filter) :not) - (lambda (arg) (not (-contains-p (cdr filter) arg))) - (when (eq (car filter) :only) - (pop filter)) - (lambda (arg) (-contains-p filter arg))) - magit-current-popup-args))) - -(defvar magit-current-pre-popup-buffer nil - "The buffer that was current before invoking the active popup. -This is bound when invoking an action or variable.") - -(defmacro magit-with-pre-popup-buffer (&rest body) - "Execute the forms in BODY in the buffer that current before the popup. -If `magit-current-pre-popup-buffer' is non-nil use that, else if -`magit-pre-popup-buffer' is non-nil use that, otherwise (when no -popup is involved) execute the forms in the current buffer." - (declare (indent 0)) - `(--if-let (or magit-current-pre-popup-buffer magit-pre-popup-buffer) - (with-current-buffer it ,@body) - ,@body)) - -(defun magit-popup-arg-match (pattern string) - (if (or (string-match-p "=$" pattern) - (string-match-p "^-[A-Z]$" pattern)) - (string-match (format "^%s\\(.*\\)$" pattern) string) - (string-equal string pattern))) - -(cl-defstruct magit-popup-event key dsc arg fun use val) - -(defun magit-popup-event-keydsc (ev) - (let ((key (magit-popup-event-key ev))) - (key-description (if (vectorp key) key (vector key))))) - -(defun magit-popup-lookup (event type) - (--first (equal (magit-popup-event-key it) event) - (-filter 'magit-popup-event-p (magit-popup-get type)))) - -(defun magit-popup-get-args () - (--mapcat (when (and (magit-popup-event-p it) - (magit-popup-event-use it)) - (list (format "%s%s" - (magit-popup-event-arg it) - (or (magit-popup-event-val it) "")))) - (append (magit-popup-get :switches) - (magit-popup-get :options)))) - -(defmacro magit-popup-convert-events (def form) - (declare (indent 1) (debug (form form))) - `(--map (if (or (null it) (stringp it) (functionp it)) it ,form) ,def)) - -(defun magit-popup-convert-switches (val def) - (magit-popup-convert-events def - (let ((a (nth 2 it))) - (make-magit-popup-event - :key (car it) :dsc (cadr it) :arg a - :use (and (member a val) t) - ;; For arguments implemented in lisp, this function's - ;; doc-string is used by `magit-popup-help'. That is - ;; the only thing it is used for. - :fun (and (string-prefix-p "\+\+" a) (nth 3 it)))))) - -(defun magit-popup-convert-options (val def) - (magit-popup-convert-events def - (let* ((a (nth 2 it)) - (r (format "^%s\\(.*\\)" a)) - (v (--first (string-match r it) val))) - (make-magit-popup-event - :key (car it) :dsc (cadr it) :arg a - :use (and v t) :val (and v (match-string 1 v)) - :fun (or (nth 3 it) 'read-from-minibuffer))))) - -(defun magit-popup-convert-variables (_val def) - (magit-popup-convert-events def - (make-magit-popup-event - :key (car it) :dsc (cadr it) :fun (nth 2 it) :arg (nth 3 it)))) - -(defun magit-popup-convert-actions (_val def) - (magit-popup-convert-events def - (make-magit-popup-event - :key (car it) :dsc (cadr it) :fun (nth 2 it)))) - -;;; Define - -(defmacro magit-define-popup (name doc &rest args) - "Define a popup command named NAME. - -NAME should begin with the package prefix and by convention end -with `-popup'. That name is used for the actual command as well -as for a variable used internally. DOC is used as the doc-string -of that command. - -Also define an option and a function named `SHORTNAME-arguments', -where SHORTNAME is NAME with the trailing `-popup' removed. The -name of this option and this function can be overwritten using -the optional argument OPTION, but that is rarely advisable. As a -special case if OPTION is specified but nil, do not define this -option and this function at all. - -The option `SHORTNAME-arguments' holds the default value for the -popup arguments. It can be customized from within the popup or -using the Custom interface. - -The function `SHORTNAME-arguments' is a wrapper around the -variable `magit-current-popup-args', both of which are intended -to be used inside the `interactive' form of commands commonly -invoked from the popup `NAME'. When such a command is invoked -from that popup, then the function `SHORTNAME-arguments' returns -the value of the variable `magit-current-popup-args'; however -when the command is invoked directly, then it returns the default -value of the variable `SHORTNAME-arguments'. - -Optional argument GROUP specifies the Custom group into which the -option is placed. If omitted, then the option is placed into some -group the same way it is done when directly using `defcustom' and -omitting the group, except when NAME begins with \"magit-\", in -which case the group `magit-git-arguments' is used. - -Optional argument MODE is deprecated, instead use the keyword -arguments `:setup-function' and/or `:refresh-function'. If MODE -is non-nil, then it specifies the mode used by the popup buffer, -instead of the default, which is `magit-popup-mode'. - -The remaining arguments should have the form - - [KEYWORD VALUE]... - -The following keywords are meaningful (and by convention are -usually specified in that order): - -`:actions' - The actions which can be invoked from the popup. VALUE is a - list whose members have the form (KEY DESC COMMAND), see - `magit-define-popup-action' for details. - - Actions are regular Emacs commands, which usually have an - `interactive' form setup to consume the values of the popup - `:switches' and `:options' when invoked from the corresponding - popup, else when invoked as the default action or directly - without using the popup, the default value of the variable - `SHORTNAME-arguments'. This is usually done by calling the - function `SHORTNAME-arguments'. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - - Members of VALUE may also be nil. This should only be used - together with `:max-action-columns' and allows having gaps in - the action grid, which can help arranging actions sensibly. - -`:default-action' - The default action of the popup which is used directly instead - of displaying the popup buffer, when the popup is invoked with - a prefix argument. Also see `magit-popup-use-prefix-argument' - and `:use-prefix', which can be used to inverse the meaning of - the prefix argument. - -`:use-prefix' - Controls when to display the popup buffer and when to invoke - the default action (if any) directly. This overrides the - global default set using `magit-popup-use-prefix-argument'. - The value, if specified, should be one of `default' or `popup', - or a function that is called with no arguments and returns one - of these symbols. - -`:max-action-columns' - The maximum number of actions to display on a single line, a - number or a function that returns a number and takes the name - of the section currently being inserted as argument. If there - isn't enough room to display as many columns as specified here, - then fewer are used. - -`:switches' - The popup arguments which can be toggled on and off. VALUE - is a list whose members have the form (KEY DESC SWITCH), see - `magit-define-popup-switch' for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - -`:options' - The popup arguments which take a value, as in \"--opt=OPTVAL\". - VALUE is a list whose members have the form (KEY DESC OPTION - READER), see `magit-define-popup-option' for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - -`:default-arguments' - The default arguments, a list of switches (which are then - enabled by default) and options with there default values, as - in \"--OPT=OPTVAL\". - -`:variables' - - Git variables which can be set from the popup. VALUE is a list - whose members have the form (KEY DESC COMMAND FORMATTER), see - `magit-define-popup-variable' for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, which - is used as the heading, or nil, in which case the section is - not inserted. - - Members of VALUE may also be actions as described above for - `:actions'. - - VALUE may also be a function that returns a list as describe - above. - -`:sequence-predicate' - When this function returns non-nil, then the popup uses - `:sequence-actions' instead of `:actions', and does not show - the `:switches' and `:options'. - -`:sequence-actions' - The actions which can be invoked from the popup, when - `:sequence-predicate' returns non-nil. - -`:setup-function' - When this function is specified, then it is used instead of - `magit-popup-default-setup'. - -`:refresh-function' - When this function is specified, then it is used instead of - calling `magit-popup-insert-section' three times with symbols - `magit-popup-switch-button', `magit-popup-option-button', and - finally `magit-popup-action-button' as argument. - -`:man-page' - The name of the manpage to be displayed when the user requests - help for a switch or argument. - -\(fn NAME DOC [GROUP [MODE [OPTION]]] :KEYWORD VALUE...)" - (declare (indent defun) (doc-string 2)) - (let* ((str (symbol-name name)) - (grp (if (keywordp (car args)) - (and (string-prefix-p "magit-" str) ''magit-git-arguments) - (pop args))) - (mode (and (not (keywordp (car args))) (pop args))) - (opt (if (keywordp (car args)) - (intern (concat (if (string-suffix-p "-popup" str) - (substring str 0 -6) - str) - "-arguments")) - (eval (pop args))))) - `(progn - (defun ,name (&optional arg) ,doc - (interactive "P") - (magit-invoke-popup ',name ,mode arg)) - (defvar ,name - (list :variable ',opt ,@args)) - (magit-define-popup-keys-deferred ',name) - ,@(when opt - `((defcustom ,opt (plist-get ,name :default-arguments) - "" - ,@(and grp (list :group grp)) - :type '(repeat (string :tag "Argument"))) - (defun ,opt () - (if (eq magit-current-popup ',name) - magit-current-popup-args - ,opt)) - (put ',opt 'definition-name ',name)))))) - -(defun magit-define-popup-switch (popup key desc switch - &optional enable at prepend) - "In POPUP, define KEY as SWITCH. - -POPUP is a popup command defined using `magit-define-popup'. -SWITCH is a string representing an argument that takes no value. -KEY is a character representing the second event in the sequence -of keystrokes used to toggle the argument. (The first event, the -prefix, is shared among all switches, defaults to -, and can be -changed in `magit-popup-mode-keymap'). - -DESC is a string describing the purpose of the argument, it is -displayed in the popup. - -If optional ENABLE is non-nil, then the switch is on by default. - -SWITCH is inserted after all other switches already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another switch already defined for POPUP, the argument -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :switches key - (list desc switch enable) at prepend)) - -(defun magit-define-popup-option (popup key desc option - &optional reader value at prepend) - "In POPUP, define KEY as OPTION. - -POPUP is a popup command defined using `magit-define-popup'. -OPTION is a string representing an argument that takes a value. -KEY is a character representing the second event in the sequence -of keystrokes used to set the argument's value. (The first -event, the prefix, is shared among all options, defaults to =, -and can be changed in `magit-popup-mode-keymap'). - -DESC is a string describing the purpose of the argument, it is -displayed in the popup. - -If optional VALUE is non-nil then the option is on by default, -and VALUE is its default value. - -READER is used to read a value from the user when the option is -invoked and does not currently have a value. It should take one -argument and use it as the prompt. If this is nil, then -`read-from-minibuffer' is used. - -OPTION is inserted after all other options already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another option already defined for POPUP, the argument -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :options key - (list desc option reader value) at prepend)) - -(defun magit-define-popup-variable (popup key desc command formatter - &optional at prepend) - "In POPUP, define KEY as COMMAND. - -POPUP is a popup command defined using `magit-define-popup'. -COMMAND is a command which calls `magit-popup-set-variable'. -FORMATTER is a function which calls `magit-popup-format-variable'. -These two functions have to be called with the same arguments. - -KEY is a character representing the event used interactively call -the COMMAND. - -DESC is the variable or a representation thereof. It's not -actually used for anything. - -COMMAND is inserted after all other commands already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another command already defined for POPUP, the command -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :variables key - (list desc command formatter) at prepend)) - -(defun magit-define-popup-action (popup key desc command - &optional at prepend) - "In POPUP, define KEY as COMMAND. - -POPUP is a popup command defined using `magit-define-popup'. -COMMAND can be any command but should usually consume the popup -arguments in its `interactive' form. -KEY is a character representing the event used invoke the action, -i.e. to interactively call the COMMAND. - -DESC is a string describing the purpose of the action, it is -displayed in the popup. - -COMMAND is inserted after all other commands already defined for -POPUP, unless optional PREPEND is non-nil, in which case it is -placed first. If optional AT is non-nil, then it should be the -KEY of another command already defined for POPUP, the command -is then placed before or after AT, depending on PREPEND." - (declare (indent defun)) - (magit-define-popup-key popup :actions key - (list desc command) at prepend)) - -(defun magit-define-popup-sequence-action - (popup key desc command &optional at prepend) - "Like `magit-define-popup-action' but for `:sequence-action'." - (declare (indent defun)) - (magit-define-popup-key popup :sequence-actions key - (list desc command) at prepend)) - -(defconst magit-popup-type-plural-alist - '((:switch . :switches) - (:option . :options) - (:variable . :variables) - (:action . :actions) - (:sequence-action . :sequence-actions))) - -(defun magit-popup-pluralize-type (type) - (or (cdr (assq type magit-popup-type-plural-alist)) - type)) - -(defun magit-define-popup-key - (popup type key def &optional at prepend) - "In POPUP, define KEY as an action, switch, or option. -It's better to use one of the specialized functions - `magit-define-popup-action', - `magit-define-popup-sequence-action', - `magit-define-popup-switch', - `magit-define-popup-option', or - `magit-define-popup-variable'." - (declare (indent defun)) - (setq type (magit-popup-pluralize-type type)) - (if (memq type '(:switches :options :variables :actions :sequence-actions)) - (if (boundp popup) - (let* ((plist (symbol-value popup)) - (value (plist-get plist type)) - (elt (assoc key value))) - (if elt - (setcdr elt def) - (setq elt (cons key def))) - (if at - (when (setq at (cl-member at value :key 'car-safe :test 'equal)) - (setq value (cl-delete key value :key 'car-safe :test 'equal)) - (if prepend - (progn (push (car at) (cdr at)) - (setcar at elt)) - (push elt (cdr at)))) - (setq value (cl-delete key value :key 'car-safe :test 'equal))) - (unless (assoc key value) - (setq value (if prepend - (cons elt value) - (append value (list elt))))) - (set popup (plist-put plist type value))) - (push (list type key def at prepend) - (get popup 'magit-popup-deferred))) - (error "Unknown popup event type: %s" type))) - -(defun magit-define-popup-keys-deferred (popup) - (dolist (args (get popup 'magit-popup-deferred)) - (condition-case err - (apply #'magit-define-popup-key popup args) - ((debug error) - (display-warning 'magit (error-message-string err) :error)))) - (put popup 'magit-popup-deferred nil)) - -(defun magit-change-popup-key (popup type from to) - "In POPUP, bind TO to what FROM was bound to. -TYPE is one of `:action', `:sequence-action', `:switch', or -`:option'. Bind TO and unbind FROM, both are characters." - (--if-let (assoc from (plist-get (symbol-value popup) - (magit-popup-pluralize-type type))) - (setcar it to) - (message "magit-change-popup-key: FROM key %c is unbound" from))) - -(defun magit-remove-popup-key (popup type key) - "In POPUP, remove KEY's binding of TYPE. -POPUP is a popup command defined using `magit-define-popup'. -TYPE is one of `:action', `:sequence-action', `:switch', or -`:option'. KEY is the character which is to be unbound." - (setq type (magit-popup-pluralize-type type)) - (let* ((plist (symbol-value popup)) - (alist (plist-get plist type)) - (value (assoc key alist))) - (set popup (plist-put plist type (delete value alist))))) - -;;; Invoke - -(defvar-local magit-popup-previous-winconf nil) - -(defun magit-invoke-popup (popup mode arg) - (let* ((def (symbol-value popup)) - (val (symbol-value (plist-get def :variable))) - (default (plist-get def :default-action)) - (local (plist-get def :use-prefix)) - (local (if (functionp local) - (funcall local) - local)) - (use-prefix (or local magit-popup-use-prefix-argument))) - (cond - ((or (and (eq use-prefix 'default) arg) - (and (eq use-prefix 'popup) (not arg))) - (if default - (let ((magit-current-popup (list popup 'default)) - (magit-current-popup-args - (let ((magit-this-popup popup) - (magit-this-popup-events nil)) - (magit-popup-default-setup val def) - (magit-popup-get-args)))) - (when (and arg (listp arg)) - (setq current-prefix-arg (and (not (= (car arg) 4)) - (list (/ (car arg) 4))))) - (call-interactively default)) - (message "%s has no default action; showing popup instead." popup) - (magit-popup-mode-setup popup mode))) - ((memq use-prefix '(default popup nil)) - (magit-popup-mode-setup popup mode) - (when magit-popup-show-help-echo - (message - (format - "[%s] show common commands, [%s] describe events, [%s] show manual" - (propertize "C-t" 'face 'magit-popup-key) - (propertize "?" 'face 'magit-popup-key) - (propertize "C-h i" 'face 'magit-popup-key))))) - (local - (error "Invalid :use-prefix popup property value: %s" use-prefix)) - (t - (error "Invalid magit-popup-use-prefix-argument value: %s" use-prefix))))) - -(defun magit-invoke-popup-switch (event) - (interactive (list last-command-event)) - (--if-let (magit-popup-lookup event :switches) - (progn - (setf (magit-popup-event-use it) - (not (magit-popup-event-use it))) - (magit-refresh-popup-buffer)) - (user-error "%c isn't bound to any switch" event))) - -(defun magit-invoke-popup-option (event) - (interactive (list last-command-event)) - (--if-let (magit-popup-lookup event :options) - (progn - (if (magit-popup-event-use it) - (setf (magit-popup-event-use it) nil) - (let* ((arg (magit-popup-event-arg it)) - (val (funcall - (magit-popup-event-fun it) - (concat arg (unless (string-match-p "=$" arg) ": ")) - (magit-popup-event-val it)))) - (setf (magit-popup-event-use it) t) - (setf (magit-popup-event-val it) val))) - (magit-refresh-popup-buffer)) - (user-error "%c isn't bound to any option" event))) - -(defun magit-invoke-popup-action (event) - (interactive (list last-command-event)) - (let ((action (magit-popup-lookup event :actions)) - (variable (magit-popup-lookup event :variables))) - (when (and variable (not (magit-popup-event-arg variable))) - (setq action variable) - (setq variable nil)) - (cond ((or action variable) - (let* ((magit-current-popup magit-this-popup) - (magit-current-popup-args (magit-popup-get-args)) - (magit-current-pre-popup-buffer magit-pre-popup-buffer) - (command (magit-popup-event-fun (or action variable))) - (magit-current-popup-action command)) - (when action - (magit-popup-quit)) - (setq this-command command) - (call-interactively command) - (unless action - (magit-refresh-popup-buffer)))) - ((eq event ?q) - (magit-popup-quit) - (when magit-previous-popup - (magit-popup-mode-setup magit-previous-popup nil))) - (t - (user-error "%c isn't bound to any action" event))))) - -(defun magit-popup-quit () - "Quit the current popup command without invoking an action." - (interactive) - (let ((winconf magit-popup-previous-winconf)) - (if (derived-mode-p 'magit-popup-mode) - (kill-buffer) - (magit-popup-help-mode -1) - (kill-local-variable 'magit-popup-previous-winconf)) - (when winconf - (set-window-configuration winconf)))) - -(defun magit-popup-read-number (prompt &optional default) - "Like `read-number' but DEFAULT may be a numeric string." - (read-number prompt (if (stringp default) - (string-to-number default) - default))) - -;;; Save - -(defun magit-popup-set-default-arguments (arg) - "Set default value for the arguments for the current popup. -Then close the popup without invoking an action; unless a prefix -argument is used in which case the popup remains open. - -For a popup named `NAME-popup' that usually means setting the -value of the custom option `NAME-arguments'." - (interactive "P") - (-if-let (var (magit-popup-get :variable)) - (progn (customize-set-variable var (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - (user-error "Nothing to set"))) - -(defun magit-popup-save-default-arguments (arg) - "Save default value for the arguments for the current popup. -Then close the popup without invoking an action; unless a prefix -argument is used in which case the popup remains open. - -For a popup named `NAME-popup' that usually means saving the -value of the custom option `NAME-arguments'." - (interactive "P") - (-if-let (var (magit-popup-get :variable)) - (progn (customize-save-variable var (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - (user-error "Nothing to save"))) - -;;; Help - -(defun magit-popup-toggle-show-common-commands () - "Show or hide an additional section with common commands. -The commands listed in this section are common to all popups -and are defined in `magit-popup-mode-map' (which see)." - (interactive) - (setq magit-popup-show-common-commands - (not magit-popup-show-common-commands)) - (magit-refresh-popup-buffer) - (fit-window-to-buffer)) - -(defun magit-popup-help () - "Show help for the argument or action at point." - (interactive) - (let* ((man (magit-popup-get :man-page)) - (key (read-key-sequence - (concat "Describe key" (and man " (? for manpage)") ": "))) - (int (aref key (1- (length key)))) - (def (or (lookup-key (current-local-map) key t) - (lookup-key (current-global-map) key)))) - (pcase def - (`magit-invoke-popup-switch - (--if-let (magit-popup-lookup int :switches) - (if (and (string-prefix-p "++" (magit-popup-event-arg it)) - (magit-popup-event-fun it)) - (magit-popup-describe-function (magit-popup-event-fun it)) - (magit-popup-manpage man it)) - (user-error "%c isn't bound to any switch" int))) - (`magit-invoke-popup-option - (--if-let (magit-popup-lookup int :options) - (if (and (string-prefix-p "++" (magit-popup-event-arg it)) - (magit-popup-event-fun it)) - (magit-popup-describe-function (magit-popup-event-fun it)) - (magit-popup-manpage man it)) - (user-error "%c isn't bound to any option" int))) - (`magit-popup-help - (magit-popup-manpage man nil)) - ((or `self-insert-command - `magit-invoke-popup-action) - (setq def (or (magit-popup-lookup int :actions) - (magit-popup-lookup int :variables))) - (if def - (magit-popup-describe-function (magit-popup-event-fun def)) - (ding) - (message nil))) - (`nil (ding) - (message nil)) - (_ (magit-popup-describe-function def))))) - -(defun magit-popup-manpage (topic arg) - (unless topic - (user-error "No man page associated with %s" - (magit-popup-get :man-page))) - (when arg - (setq arg (magit-popup-event-arg arg)) - (when (string-prefix-p "--" arg) - ;; handle '--' option and the '--[no-]' shorthand - (setq arg (cond ((string= "-- " arg) - "\\(?:\\[--\\] \\)?<[^[:space:]]+>\\.\\.\\.") - ((string-prefix-p "--no-" arg) - (concat "--" - "\\[?no-\\]?" - (substring arg 5))) - (t - (concat "--" - "\\(?:\\[no-\\]\\)?" - (substring arg 2))))))) - (let ((winconf (current-window-configuration)) buffer) - (pcase magit-popup-manpage-package - (`woman (delete-other-windows) - (split-window-below) - (with-no-warnings ; display-buffer-function is obsolete - (let ((display-buffer-alist nil) - (display-buffer-function nil) - (display-buffer-overriding-action nil)) - (woman topic))) - (setq buffer (current-buffer))) - (`man (cl-letf (((symbol-function #'fboundp) (lambda (_) nil))) - (setq buffer (man topic))) - (delete-other-windows) - (split-window-below) - (set-window-buffer (selected-window) buffer))) - (with-current-buffer buffer - (setq magit-popup-previous-winconf winconf) - (magit-popup-help-mode) - (fit-window-to-buffer (next-window)) - (if (and arg - (Man-find-section "OPTIONS") - (let ((case-fold-search nil) - ;; This matches preceding/proceeding options. - ;; Options such as '-a', '-S[]', and - ;; '--grep=' are matched by this regex - ;; without the shy group. The '. ' in the shy - ;; group is for options such as '-m - ;; parent-number', and the '-[^[:space:]]+ ' is - ;; for options such as '--mainline parent-number' - (others "-\\(?:. \\|-[^[:space:]]+ \\)?[^[:space:]]+")) - (re-search-forward - ;; should start with whitespace, and may have any - ;; number of options before/after - (format "^[\t\s]+\\(?:%s, \\)*?\\(?1:%s\\)%s\\(?:, %s\\)*$" - others - ;; options don't necessarily end in an '=' - ;; (e.g., '--gpg-sign[=]') - (string-remove-suffix "=" arg) - ;; Simple options don't end in an '='. - ;; Splitting this into 2 cases should make - ;; getting false positives less likely. - (if (string-suffix-p "=" arg) - ;; [^[:space:]]*[^.[:space:]] matches - ;; the option value, which is usually - ;; after the option name and either '=' - ;; or '[='. The value can't end in a - ;; period, as that means it's being used - ;; at the end of a sentence. The space - ;; is for options such as '--mainline - ;; parent-number'. - "\\(?: \\|\\[?=\\)[^[:space:]]*[^.[:space:]]" - ;; Either this doesn't match anything - ;; (e.g., '-a'), or the option is followed - ;; by a value delimited by a '[', '<', or - ;; ':'. A space might appear before this - ;; value, as in '-f '. The space - ;; alternative is for options such as '-m - ;; parent-number'. - "\\(?:\\(?: \\| ?[\\[<:]\\)[^[:space:]]*[^.[:space:]]\\)?") - others) - nil - t))) - (goto-char (match-beginning 1)) - (goto-char (point-min)))))) - -(defun magit-popup-describe-function (function) - (let ((winconf (current-window-configuration))) - (delete-other-windows) - (split-window-below) - (other-window 1) - (with-no-warnings ; display-buffer-function is obsolete - (let ((display-buffer-alist '(("" display-buffer-use-some-window))) - (display-buffer-function nil) - (display-buffer-overriding-action nil) - (help-window-select nil)) - (describe-function function))) - (fit-window-to-buffer) - (other-window 1) - (setq magit-popup-previous-winconf winconf) - (magit-popup-help-mode))) - -(defun magit-popup-info () - "Show the popup manual." - (interactive) - (let ((winconf (current-window-configuration))) - (delete-other-windows) - (split-window-below) - (info "(magit-popup.info)Usage") - (magit-popup-help-mode) - (setq magit-popup-previous-winconf winconf)) - (magit-popup-help-mode) - (fit-window-to-buffer (next-window))) - -(define-minor-mode magit-popup-help-mode - "Auxiliary minor mode used to restore previous window configuration. -When some sort of help buffer is created from within a popup, -then this minor mode is turned on in that buffer, so that when -the user quits it, the previous window configuration is also -restored." - :keymap '(([remap Man-quit] . magit-popup-quit) - ([remap Info-exit] . magit-popup-quit) - ([remap quit-window] . magit-popup-quit))) - -;;; Modes - -(define-derived-mode magit-popup-mode fundamental-mode "MagitPopup" - "Major mode for infix argument popups." - :mode 'magit-popup - (setq truncate-lines t) - (setq buffer-read-only t) - (setq-local scroll-margin 0) - (setq-local magit-popup-show-common-commands magit-popup-show-common-commands) - (hack-dir-local-variables-non-file-buffer)) - -(put 'magit-popup-mode 'mode-class 'special) - -(defun magit-popup-default-setup (val def) - (if (--when-let (magit-popup-get :sequence-predicate) - (funcall it)) - (magit-popup-put :actions (magit-popup-convert-actions - val (magit-popup-get :sequence-actions))) - (let ((vars (plist-get def :variables))) - (when (functionp vars) - (setq vars (funcall vars))) - (when vars - (magit-popup-put :variables (magit-popup-convert-variables val vars)))) - (magit-popup-put :switches (magit-popup-convert-switches - val (plist-get def :switches))) - (magit-popup-put :options (magit-popup-convert-options - val (plist-get def :options))) - (magit-popup-put :actions (magit-popup-convert-actions - val (plist-get def :actions))))) - -(defun magit-popup-mode-setup (popup mode) - (setq magit-previous-popup magit-current-popup) - (let ((val (symbol-value (plist-get (symbol-value popup) :variable))) - (def (symbol-value popup)) - (buf (current-buffer))) - (magit-popup-mode-display-buffer (get-buffer-create - (format "*%s*" popup)) - (or mode 'magit-popup-mode)) - (setq magit-this-popup popup) - (setq magit-pre-popup-buffer buf) - (if (bound-and-true-p magit-popup-setup-hook) ; obsolete - (run-hook-with-args 'magit-popup-setup-hook val def) - (funcall (or (magit-popup-get :setup-function) - 'magit-popup-default-setup) - val def))) - (magit-refresh-popup-buffer) - (fit-window-to-buffer nil nil (line-number-at-pos (point-max)))) - -(defun magit-popup-mode-display-buffer (buffer mode) - (let ((winconf (current-window-configuration))) - (select-window (display-buffer buffer magit-popup-display-buffer-action)) - (funcall mode) - (setq magit-popup-previous-winconf winconf))) - -(defvar magit-refresh-popup-buffer-hook nil - "Hook run by `magit-refresh-popup-buffer'. - -The hook is run right after inserting the representation of the -popup events but before optionally inserting the representation -of events shared by all popups and before point is adjusted.") - -(defun magit-refresh-popup-buffer () - (let* ((inhibit-read-only t) - (button (button-at (point))) - (prefix (and button (button-get button 'prefix))) - (event (and button (button-get button 'event)))) - (erase-buffer) - (save-excursion - (--if-let (magit-popup-get :refresh-function) - (funcall it) - (magit-popup-insert-section 'magit-popup-variable-button) - (magit-popup-insert-section 'magit-popup-switch-button) - (magit-popup-insert-section 'magit-popup-option-button) - (magit-popup-insert-section 'magit-popup-action-button)) - (run-hooks 'magit-refresh-popup-buffer-hook) - (when magit-popup-show-common-commands - (magit-popup-insert-command-section - 'magit-popup-internal-command-button - magit-popup-common-commands))) - (set-buffer-modified-p nil) - (when event - (while (and (ignore-errors (forward-button 1)) - (let ((b (button-at (point)))) - (or (not (equal (button-get b 'prefix) prefix)) - (not (equal (button-get b 'event) event))))))))) - -;;; Draw - -(defvar magit-popup-min-padding 3 - "Minimal amount of whitespace between columns in popup buffers.") - -(defun magit-popup-insert-section (type &optional spec heading) - (if (not spec) - (progn (setq spec (magit-popup-get (button-type-get type 'property))) - (when spec - (if (or (stringp (car spec)) - (functionp (car spec))) - (--each (--partition-by-header - (or (stringp it) (functionp it)) - spec) - (magit-popup-insert-section type (cdr it) (car it))) - (magit-popup-insert-section type spec)))) - (let* ((formatter (button-type-get type 'formatter)) - (items (mapcar (lambda (ev) - (and ev (or (funcall formatter type ev) '("")))) - (or spec (magit-popup-get - (button-type-get type 'property))))) - (maxcols (button-type-get type 'maxcols)) - (pred (magit-popup-get :sequence-predicate))) - (when items - (if (functionp heading) - (when (setq heading (funcall heading)) - (insert heading ?\n)) - (unless heading - (setq heading (button-type-get type 'heading))) - (insert (propertize heading 'face 'magit-popup-heading)) - (unless (string-match "\n$" heading) - (insert "\n"))) - (if (and pred (funcall pred)) - (setq maxcols nil) - (cl-typecase maxcols - (keyword (setq maxcols (magit-popup-get maxcols))) - (symbol (setq maxcols (symbol-value maxcols))))) - (when (functionp maxcols) - (setq maxcols (funcall maxcols heading))) - (when heading - (let ((colwidth - (+ (apply 'max (mapcar (lambda (e) (length (car e))) items)) - magit-popup-min-padding))) - (dolist (item items) - (unless (bolp) - (let ((padding (- colwidth (% (current-column) colwidth)))) - (if (and (< (+ (current-column) padding colwidth) - (window-width)) - (< (ceiling (/ (current-column) (* colwidth 1.0))) - (or maxcols 1000))) - (insert (make-string padding ?\s)) - (insert "\n")))) - (unless (equal item '("")) - (if item - (apply 'insert-button item) - (insert ?\s))))) - (insert (if (= (char-before) ?\n) "\n" "\n\n"))))))) - -(defun magit-popup-format-argument-button (type ev) - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (concat - (--when-let (button-type-get type 'prefix) - (char-to-string it)) - (magit-popup-event-keydsc ev)) - 'face 'magit-popup-key)) - (?d . ,(magit-popup-event-dsc ev)) - (?a . ,(propertize (magit-popup-event-arg ev) - 'face (if (magit-popup-event-use ev) - 'magit-popup-argument - 'magit-popup-disabled-argument))) - (?v . ,(let ((val (magit-popup-event-val ev))) - (if (and (magit-popup-event-use ev) - (not (equal val ""))) - (propertize (format "\"%s\"" val) - 'face 'magit-popup-option-value) - ""))))) - 'type type 'event (magit-popup-event-key ev))) - -(defun magit-popup-format-variable-button (type ev) - (if (not (magit-popup-event-arg ev)) - (magit-popup-format-action-button 'magit-popup-action-button ev) - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (magit-popup-event-keydsc ev) - 'face 'magit-popup-key)) - (?d . ,(funcall (magit-popup-event-arg ev))))) - 'type type 'event (magit-popup-event-key ev)))) - -(defun magit-popup-format-action-button (type ev) - (let* ((cmd (magit-popup-event-fun ev)) - (dsc (magit-popup-event-dsc ev)) - (fun (and (functionp dsc) dsc))) - (unless (and disabled-command-function - (symbolp cmd) - (get cmd 'disabled)) - (when fun - (setq dsc - (-when-let (branch (funcall fun)) - (if (text-property-not-all 0 (length branch) 'face nil branch) - branch - (magit-branch-set-face branch))))) - (when dsc - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (magit-popup-event-keydsc ev) - 'face 'magit-popup-key)) - (?d . ,dsc) - (?D . ,(if (and (not fun) - (eq cmd (magit-popup-get :default-action))) - (propertize dsc 'face 'bold) - dsc)))) - 'type type 'event (magit-popup-event-key ev)))))) - -(defun magit-popup-insert-command-section (type spec) - (magit-popup-insert-section - type (mapcar (lambda (elt) - (list (car (where-is-internal (cadr elt) - (current-local-map))) - (car elt))) - spec))) - -(defun magit-popup-format-command-button (type elt) - (nconc (magit-popup-format-action-button - type (make-magit-popup-event :key (car elt) - :dsc (cadr elt))) - (list 'function (lookup-key (current-local-map) (car elt))))) - -;;; Utilities - -(defun magit-popup-import-file-args (args files) - (if files - (cons (concat "-- " (mapconcat #'identity files ",")) args) - args)) - -(defun magit-popup-export-file-args (args) - (let ((files (--first (string-prefix-p "-- " it) args))) - (when files - (setq args (remove files args)) - (setq files (split-string (substring files 3) ","))) - (list args files))) - -(defconst magit-popup-font-lock-keywords - (eval-when-compile - `((,(concat "(\\(magit-define-popup\\)\\_>" - "[ \t'\(]*" - "\\(\\(?:\\sw\\|\\s_\\)+\\)?") - (1 'font-lock-keyword-face) - (2 'font-lock-function-name-face nil t))))) - -(font-lock-add-keywords 'emacs-lisp-mode magit-popup-font-lock-keywords) - -;;; _ -(provide 'magit-popup) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: -;;; magit-popup.el ends here diff --git a/elpa/magit-popup-20180509.1041/magit-popup.info b/elpa/magit-popup-20180509.1041/magit-popup.info deleted file mode 100644 index e5cae82b..00000000 --- a/elpa/magit-popup-20180509.1041/magit-popup.info +++ /dev/null @@ -1,740 +0,0 @@ -This is magit-popup.info, produced by makeinfo version 6.1 from -magit-popup.texi. - - Copyright (C) 2015-2018 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 -* Magit-Popup: (magit-popup). Infix arguments with feedback. -END-INFO-DIR-ENTRY - - -File: magit-popup.info, Node: Top, Next: Introduction, Up: (dir) - -Magit-Popup User Manual -*********************** - -Taking inspiration from regular prefix commands and prefix arguments, -this library implements a similar abstraction; a new kind of prefix -command that is associated with a specific set of infix arguments and -suffix commands. - -This manual is for Magit-Popup version 2.12.2 (v2.12.2-6-gbd04ebd+1). - - Copyright (C) 2015-2018 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:: -* Usage:: -* Defining Prefix and Suffix Commands:: - -— The Detailed Node Listing — - -Usage - -* Customizing Existing Popups:: -* Other Options:: - -Defining Prefix and Suffix Commands - -* Defining Prefix Commands:: -* Defining Suffix Commands:: - - - -File: magit-popup.info, Node: Introduction, Next: Usage, Prev: Top, Up: Top - -1 Introduction -************** - -Taking inspiration from regular prefix commands and prefix arguments, -this library implements a similar abstraction; a new kind of prefix -command that is associated with a specific set of infix arguments and -suffix commands. - - Invoking such a prefix command displays a popup buffer which lists -the associated infix arguments and suffix commands. In that buffer each -argument is prefixed with the key sequence that can be used to toggle it -or change its value. Likewise each suffix command is prefixed with the -key used to invoke it. Such a popup buffer might look like this: - - ,----------------------------------------- - |Switches - | -l Show graph (--graph) - | -d Show refnames (--decorate) - | - |Options - | =m Search messages (--grep="popup") - | =p Search patches (-G) - | - |Action - | l Show log for current branch - | o Show log for another branch - '----------------------------------------- - - The user could then for example type ‘-l’ to toggle the ‘--graph’ -*switch* (when it is on then it is shown in green, otherwise in gray), -or ‘=m’ to change the value of the *option* ‘--grep’. - - Once all arguments are as desired one invokes a suffix command, which -causes the popup buffer to disappear. The suffix command should then -retrieve the infix arguments in its ‘interactive’ form like this is done -for prefix arguments. - - While such "prefix-infix-suffix" combos were inspired by regular -prefix commands and prefix arguments, they are also quite different. -This should illustrate the most basic differences: - - • A regular prefix command - - /- command1 - prefix --- command2 - \- command3 - - • Prefix arguments - - /- command1 - C-u ... --- command2 - \- well any command - - • A Prefix-Infix-Suffix combo - - /- argument1 -\ /- suffix1 - prefix----- argument2 --+-- suffix2 - ^ \- argument3 -/ - | | - '--------' - (refresh buffer) - - This library was written as a replacement for ‘magit-key-mode’, which -was used in Magit releases before 2.1.0. It is used to implement all -"popups" in the current Magit release but a future release will switch -to yet another implementation. - - This library does not depend on any other Magit libraries and it is -distributed as a separate package, which makes it possible to use it in -packages that are not related to Magit. But keep in mind that it will -be deprecated eventually. - - -File: magit-popup.info, Node: Usage, Next: Defining Prefix and Suffix Commands, Prev: Introduction, Up: Top - -2 Usage -******* - -Every popup buffers created with a prefix command contains a section -named "Actions" listing the available suffix commands. Most buffers -also contain a "Switches" and/or an "Options" section which list the two -types of infix arguments separately. - - Switches are arguments that can be toggled on or off. When a switch -is active then it is shown in color, when it is off then it is shown in -gray (of course the details depend on the color theme in use). - - Options are arguments that have a value. When an option has a value -then that is shown after the option itself. Because for some options -the empty string is a valid value, options are additionally colorized -like switches to indicate whether they are active or not. - - The events bound to suffix commands are always single alphabetic -characters. The bindings for arguments are always two events long. For -switches the first key is always ‘-’, for options it is always ‘=’. The -second key is always an alphabetic character. - - By default popup buffers also feature a section listing commands -common to all popups. To avoid conflicts with suffix commands, the -bindings of these common commands are not alphabetic characters. This -section is shown by default so that documentation-resistant users get a -chance to notice them. - - -- User Option: magit-popup-show-common-commands - - This option controls whether the section that lists the commands - that are common to all popups is initially shown. - - By default this is not the case, but note that you can temporarily - show this section using ‘C-t’, which therefore is the only common - command you actually have to memorize. - -‘C-t’ (‘magit-popup-toggle-show-common-commands’) - - Show or hide the section listing the commands shared by all popups. - -‘C-g’ (‘magit-popup-quit’) - - Quit popup buffer without invoking a suffix command. - - Without further action, setting arguments only affects the next -suffix command. Invoking the same prefix command again resets the -arguments to their default value, but the defaults can be changed -directly from the popup buffer itself. For a prefix command named -‘NAME-popup’ the default values are stored as the value of the custom -option named ‘NAME-arguments’. While this option can be customized -using the Custom interface, it is better to do so directly from the -popup buffer. - -‘C-c C-c’ (‘magit-popup-set-default-arguments’) - - This sets the default value for the arguments for the current - popup. - - Then the popup buffer is closed without invoking a suffix command; - unless a prefix argument is used in which case the popup remains - open. - -‘C-x C-s’ (‘magit-popup-save-default-arguments’) - - This sets the default value for the arguments for the current popup - and saves it for future Emacs sessions. - - Then the popup buffer is closed without invoking an action; unless - a prefix argument is used in which case the popup remains open. - - It is also possible to add additional arguments and commands to an -existing popup, but that cannot be done directly from the popup (or the -Custom interface). See *note Customizing Existing Popups::. - - Documentation about a popup’s arguments and commands can be shown -directly from the popup. - -‘C-h i’ (‘magit-popup-info’) - - Show this manual. - -‘?’ (‘magit-popup-help’) - - This command reads a key sequence and then shows the documentation - of the argument or command that sequence is bound to. In other - words type the same keys that you would use to invoke the argument - or command, but prefix the sequence with ‘?’. - - For suffix commands this shows the doc-string. For arguments this - command can only show something for popups that have an associated - man-page. If the man-page is set, then this command displays it in - a separate buffer and puts point on the entry about the argument in - question. - - The buffer which is used to display the documentation is selected. - Simply press ‘q’ to leave that buffer and restore the old window - configuration. - - While it isn’t very useful, it is possible to move around in a popup -buffer using ‘C-p’ and ‘C-n’, and to invoke the argument or command at -point using ‘RET’. But it is much more efficient to use the dedicated -key bindings instead, so these commands are not listed in popup buffers -along with the other common commands. - -* Menu: - -* Customizing Existing Popups:: -* Other Options:: - - -File: magit-popup.info, Node: Customizing Existing Popups, Next: Other Options, Up: Usage - -2.1 Customizing Existing Popups -=============================== - -It is possible to define additional infix arguments and suffix commands -to an existing popup using the following functions. - - You can find some examples which use the below commands at -. - - -- Function: magit-define-popup-switch popup key desc switch &optional - enable at prepend - - In POPUP, define KEY as SWITCH. - - POPUP is a popup command defined using ‘magit-define-popup’. - SWITCH is a string representing an argument that takes no value. - KEY is a character representing the second event in the sequence of - keystrokes used to toggle the argument. (The first event, the - prefix, is shared among all switches, defaults to ‘-’, and can be - changed in ‘magit-popup-mode-keymap’). - - DESC is a string describing the purpose of the argument, it is - displayed in the popup. - - If optional ENABLE is non-nil then the switch is on by default. - - SWITCH is inserted after all other switches already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another switch already defined for POPUP, the argument is then - placed before or after AT, depending on PREPEND. - - -- Function: magit-define-popup-option popup key desc option &optional - reader value at prepend - - In POPUP, define KEY as OPTION. - - POPUP is a popup command defined using ‘magit-define-popup’. - OPTION is a string representing an argument that takes a value. - KEY is a character representing the second event in the sequence of - keystrokes used to set the argument’s value. (The first event, the - prefix, is shared among all options, defaults to ‘=’, and can be - changed in ‘magit-popup-mode-keymap’). - - DESC is a string describing the purpose of the argument, it is - displayed in the popup. - - If optional VALUE is non-nil then the option is on by default, and - VALUE is its default value. - - READER is used to read a value from the user when the option is - invoked and does not currently have a value. It should take one - argument and use it as the prompt. If this is nil, then - ‘read-from-minibuffer’ is used. - - OPTION is inserted after all other options already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another option already defined for POPUP, the argument is then - placed before or after AT, depending on PREPEND. - - -- Function: magit-define-popup-action popup key desc command &optional - at prepend - - In POPUP, define KEY as COMMAND. - - POPUP is a popup command defined using ‘magit-define-popup’. - COMMAND can be any command but should usually consume the popup - arguments in its ‘interactive’ form. KEY is a character - representing the event used invoke the action, i.e. to - interactively call the COMMAND. - - DESC is a string describing the purpose of the action, it is - displayed in the popup. - - COMMAND is inserted after all other commands already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another command already defined for POPUP, the command is then - placed before or after AT, depending on PREPEND. - - -- Function: magit-define-popup-sequence-action popup key desc command - &optional at prepend - - Like ‘magit-define-popup-action’, but modifies the value of the - ‘:sequence-actions’ property instead of ‘:actions’. - - -- Function: magit-define-popup-variable popup key desc command - formatter &optional at prepend - - In POPUP, define KEY as COMMAND. - - POPUP is a popup command defined using ‘magit-define-popup’. - COMMAND is a command which calls ‘magit-popup-set-variable’. - FORMATTER is a function which calls ‘magit-popup-format-variable’. - These two functions have to be called with the same arguments. - - KEY is a character representing the event used interactively call - the COMMAND. - - DESC is the variable or a representation thereof. It’s not - actually used for anything. - - COMMAND is inserted after all other commands already defined for - POPUP, unless optional PREPEND is non-nil, in which case it is - placed first. If optional AT is non-nil then it should be the KEY - of another command already defined for POPUP, the command is then - placed before or after AT, depending on PREPEND." - - -- Function: magit-change-popup-key popup type from to - - In POPUP, bind TO to what FROM was bound to. TYPE is one of - ‘:action’, ‘:sequence-action’, ‘:switch’, or ‘:option’. Bind TO - and unbind FROM, both are characters. - - -- Function: magit-remove-popup-key popup type key - - In POPUP, remove KEY’s binding of TYPE. POPUP is a popup command - defined using ‘magit-define-popup’. TYPE is one of ‘:action’, - ‘:sequence-action’, ‘:switch’, or ‘:option’. KEY is the character - which is to be unbound. - - It is also possible to change other aspects of a popup by setting a -property using ‘plist-put’. See *note Defining Prefix Commands:: for -valid properties. The most likely change Magit users might want to make -is: - - (plist-put magit-show-refs-popup :use-prefix nil) - - -File: magit-popup.info, Node: Other Options, Prev: Customizing Existing Popups, Up: Usage - -2.2 Other Options -================= - - -- User Option: magit-popup-use-prefix-argument - - This option controls the effect that the use of a prefix argument - before entering a popup has. - - • ‘default’ - - With a prefix argument directly invoke the popup’s default - action (an Emacs command), instead of bringing up the popup. - - • ‘popup’ - - With a prefix argument bring up the popup, otherwise directly - invoke the popup’s default action. - - • ‘nil’ - - Ignore prefix arguments. - - This option can be overridden for individual popups. - ‘magit-show-refs-popup’ for example defaults to invoking the - default action directly. It only shows the popup buffer when a - prefix argument is used. See *note Customizing Existing Popups::. - - -- User Option: magit-popup-manpage-package - - The Emacs package used to display man-pages, one of ‘man’ or - ‘woman’. - - -- User Option: magit-popup-display-buffer-action - - The option controls how the window used to display a popup buffer - is created. Popup buffers are displayed using ‘display-buffer’ - with the value of this option as ACTION argument. You can also set - this to nil and instead add an entry to ‘display-buffer-alist’. - - To emphasize the default action by making it bold use this: - - (button-type-put 'magit-popup-action-button 'format " %k %D") - - -File: magit-popup.info, Node: Defining Prefix and Suffix Commands, Prev: Usage, Up: Top - -3 Defining Prefix and Suffix Commands -************************************* - -If you write an extension for Magit then you should use this library now -and later when ‘transient’ is released port to that. - - If you are considering using this library to define popups for -packages not related to Magit, then keep in mind that it will be -superseded eventually. Once ‘transient’ has been released I will only -fix bugs in ‘magit-popup’ but not implement any new features. - - Also consider using ‘hydra’ instead. To some extend ‘magit-popup’ -and ‘hydra’ are similar but have a different focus. The main purpose of -‘magit-popup’ is to pass infix arguments to suffix commands. If all you -need is a command dispatcher then you are better of using ‘hydra’. Of -course ‘hydra’ may also be a better fit not only because of the features -it lacks, but also because of the features it provides, which are in -turn missing from ‘magit-popup’. - - Here is an example of how one defines a prefix command along with its -infix arguments, and then also one of its suffix commands. - - ;;;###autoload (autoload 'magit-tag-popup "magit" nil t) - (magit-define-popup magit-tag-popup - "Show popup buffer featuring tagging commands." - 'magit-commands - :man-page "git-tag" - :switches '((?a "Annotate" "--annotate") - (?s "Sign" "--sign") - (?f "Force" "--force")) - :actions '((?t "Create" magit-tag) - (?k "Delete" magit-tag-delete) - (?p "Prune" magit-tag-prune)) - :default-action 'magit-tag) - - ;;;###autoload - (defun magit-tag (name rev &optional args) - "Create a new tag with the given NAME at REV." - (interactive (list (magit-read-tag "Tag name") - (magit-read-branch-or-commit "Place tag on") - (magit-tag-arguments))) - (magit-run-git-with-editor "tag" args name rev)) - -* Menu: - -* Defining Prefix Commands:: -* Defining Suffix Commands:: - - -File: magit-popup.info, Node: Defining Prefix Commands, Next: Defining Suffix Commands, Up: Defining Prefix and Suffix Commands - -3.1 Defining Prefix Commands -============================ - -Prefix commands and their infix arguments are defined using the macro -‘magit-define-popup’. The key bindings and descriptions of suffix -commands are also defined using that macro, but the actual interactive -commands have to be defined separately using plain ‘defun’. - - -- Macro: magit-define-popup name doc [group [mode [option]]] :keyword - value... - - This macro defines a popup named NAME. The NAME should begin with - the package prefix and by convention end with ‘-popup’, it is used - as the name of the command which shows the popup and for an - internal variable (whose value is used to store information about - the popup and should not be accessed directly). DOC is the - doc-string of the popup command. - - This macro also defines an option and a function both named - ‘SHORTNAME-arguments’, where SHORTNAME is NAME with the trailing - ‘-popup’ removed. The name of this option and this function can be - overwritten using the optional argument OPTION, but that is rarely - advisable. As a special case if OPTION is specified but ‘nil’, - then this option and this function are not defined at all, which is - useful for popups that are used as simple dispatchers that offer no - arguments. - - The option ‘SHORTNAME-arguments’ holds the value for the popup - arguments. It can be customized from within the popup or using the - Custom interface. It can also have a buffer local value in any - non-popup buffer. The local value for the buffer from which the - popup command was invoked, can be set from within the popup buffer. - - The function ‘SHORTNAME-arguments’ returns the currently effective - value of the variable by the same name. See below for more - information. - - Optional argument GROUP specifies the Custom group into which the - option is placed. If omitted then the option is placed into some - group the same way it is done when directly using ‘defcustom’ and - omitting the group, except when NAME begins with "magit-", in which - case the group ‘magit-git-arguments’ is used. - - The optional argument MODE specifies the mode used by the popup - buffer. If it is omitted or ‘nil’ then ‘magit-popup-mode’ is used. - - The remaining arguments should have the form ‘[KEYWORD VALUE]...’. - - The following keywords are meaningful (and by convention are - usually specified in that order): - - • ‘:actions’ - - The actions which can be invoked from the popup. VALUE is a - list whose members have the form (KEY DESC COMMAND), see - ‘magit-define-popup-action’ for details. - - Actions are regular Emacs commands, which usually have an - ‘interactive’ form setup to consume the values of the popup - ‘:switches’ and ‘:options’ when invoked from the corresponding - popup, else when invoked as the default action or directly - without using the popup, the default value of the variable - ‘SHORTNAME-arguments’. This is usually done by calling the - function ‘SHORTNAME-arguments’. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - Members of VALUE may also be nil. This should only be used - together with ‘:max-action-columns’ and allows having gaps in - the action grit, which can help arranging actions sensibly. - - • ‘:default-action’ - - The default action of the popup which is used directly instead - of displaying the popup buffer, when the popup is invoked with - a prefix argument. Also see ‘magit-popup-use-prefix-argument’ - and ‘:use-prefix’, which can be used to inverse the meaning of - the prefix argument. - - • ‘:use-prefix’ - - Controls when to display the popup buffer and when to invoke - the default action (if any) directly. This overrides the - global default set using ‘magit-popup-use-prefix-argument’. - The value, if specified, should be one of ‘default’ or - ‘prefix’, or a function that is called with no arguments and - returns one of these symbols. - - • ‘:max-action-columns’ - - The maximum number of actions to display on a single line, a - number or a function that return a number and takes the name - of the section currently being inserted as argument. If there - isn’t enough room to display as many columns as specified - here, then fewer are used. - - • ‘:switches’ - - The popup arguments which can be toggled on and off. VALUE is - a list whose members have the form ‘(KEY DESC SWITCH)’, see - ‘magit-define-popup-switch’ for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - • ‘:options’ - - The popup arguments which take a value, as in "–opt~OPTVAL". - VALUE is a list whose members have the form ‘(KEY DESC OPTION - READER)’, see ‘magit-define-popup-option’ for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - • ‘:default-arguments’ - - The default arguments, a list of switches (which are then - enabled by default) and options with there default values, as - in ‘"--OPT=OPTVAL"’. - - • ‘:variables’ - - Git variables which can be set from the popup. VALUE is a - list whose members have the form ‘(KEY DESC COMMAND - FORMATTER)’, see ‘magit-define-popup-variable’ for details. - - Members of VALUE may also be strings and functions, assuming - the first member is a string or function. In that case the - members are split into sections and these special elements are - used as headings. If such an element is a function then it is - called with no arguments and must return either a string, - which is used as the heading, or nil, in which case the - section is not inserted. - - Members of VALUE may also be actions as described above for - ‘:actions’. - - VALUE may also be a function that returns a list as describe - above. - - • ‘:sequence-predicate’ - - When this function returns non-nil, then the popup uses - ‘:sequence-actions’ instead of ‘:actions’, and does not show - the ‘:switches’ and ‘:options’. - - • ‘:sequence-actions’ - - The actions which can be invoked from the popup, when - ‘:sequence-predicate’ returns non-nil. - - • ‘:setup-function’ - - When this function is specified, then it is used instead of - ‘magit-popup-default-setup’. - - • ‘:refresh-function’ - - When this function is specified, then it is used instead of - calling ‘magit-popup-insert-section’ three times with symbols - ‘magit-popup-switch-button’, ‘magit-popup-option-button’, and - finally ‘magit-popup-action-button’ as argument. - - • ‘:man-page’ - - The name of the manpage to be displayed when the user requests - help for an argument. - - -File: magit-popup.info, Node: Defining Suffix Commands, Prev: Defining Prefix Commands, Up: Defining Prefix and Suffix Commands - -3.2 Defining Suffix Commands -============================ - -Commands intended to be invoked from a particular popup should determine -the currently effective arguments by calling the function -‘SHORTNAME-arguments’ inside their ‘interactive’ form. This function is -created by the ‘magit-define-popup’ macro. For a popup named -‘prefix-foo-popup’ the name of this function is ‘prefix-foo-arguments’. - - When the command was invoked as an action in the respective popup, -then this function returns the arguments that were set in the popup. -Otherwise when the command was invoked as the default of the popup (by -calling the popup command with a prefix argument), or without using the -popup command at all, then this function returns the buffer-local or -global value of the variable ‘SHORTNAME-arguments’. - - Internally arguments are handled as a list of strings. This might -not be appropriate for the intended use inside commands, or it might be -necessary to manipulate that list somehow, i.e. to split "–ARG=VAL" -into "–ARG""VAL". This should be done by advising or redefining the -function ‘SHORTNAME-arguments’. - - Internally ‘SHORNAME-arguments’ used following variables and -function. Except when redefining the former, you should not use these -directly. - - -- Variable: magit-current-popup - - The popup from which this editing command was invoked. - - -- Variable: magit-current-popup-args - - The value of the popup arguments for this editing command. - - If the current command was invoked from a popup, then this is a - list of strings of all the set switches and options. This includes - arguments which are set by default not only those explicitly set - during this invocation. - - When the value is nil, then that can be because no argument is set, - or because the current command wasn’t invoked from a popup at all. - - -- Function: magit-current-popup-args &rest args - - This function returns the value of the popup arguments for this - editing command. The value is the same as that of the variable by - the same name, except that FILTER is applied. FILTER is a list of - regexps; only arguments that match one of them are returned. The - first element of FILTER may also be ‘:not’ in which case only - arguments that don’t match any of the regexps are returned, or - ‘:only’ which doesn’t change the behavior. - - - -Tag Table: -Node: Top768 -Node: Introduction2013 -Node: Usage4712 -Node: Customizing Existing Popups9409 -Node: Other Options15155 -Node: Defining Prefix and Suffix Commands16698 -Node: Defining Prefix Commands18850 -Node: Defining Suffix Commands27548 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: -- 2.47.3