From 0a6b7fbe6bbef76dbcdedb89afefb3bf28d808cb Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 11 Oct 2017 13:29:13 +0200 Subject: [PATCH] update magit to version 20171009.1252 Update magit-popup as well and remove old versions of both packages. Signed-off-by: Andreas Gerler --- elpa/magit-20161115.1658/magit-pkg.el | 12 - elpa/magit-20161115.1658/magit.el | 3566 ----------------- elpa/magit-20161115.1658/magit.info | 176 - elpa/magit-20161115.1658/magit.info-2 | Bin 56853 -> 0 bytes .../AUTHORS.md | 24 +- .../COPYING | 0 .../dir | 0 .../git-rebase.el | 211 +- .../magit-apply.el | 36 +- .../magit-autoloads.el | 1252 ++++-- .../magit-autorevert.el | 34 +- .../magit-bisect.el | 17 +- .../magit-blame.el | 67 +- elpa/magit-20171009.1252/magit-bookmark.el | 364 ++ elpa/magit-20171009.1252/magit-branch.el | 809 ++++ .../magit-commit.el | 101 +- .../magit-core.el | 73 +- .../magit-diff.el | 354 +- .../magit-ediff.el | 43 +- .../magit-extras.el | 143 +- elpa/magit-20171009.1252/magit-files.el | 443 ++ .../magit-git.el | 468 ++- elpa/magit-20171009.1252/magit-imenu.el | 243 ++ .../magit-log.el | 603 +-- elpa/magit-20171009.1252/magit-margin.el | 229 ++ .../magit-mode.el | 302 +- elpa/magit-20171009.1252/magit-notes.el | 179 + elpa/magit-20171009.1252/magit-obsolete.el | 133 + elpa/magit-20171009.1252/magit-pkg.el | 12 + .../magit-process.el | 118 +- elpa/magit-20171009.1252/magit-refs.el | 622 +++ .../magit-remote.el | 53 +- elpa/magit-20171009.1252/magit-repos.el | 308 ++ .../magit-section.el | 145 +- .../magit-sequence.el | 108 +- .../magit-stash.el | 90 +- elpa/magit-20171009.1252/magit-status.el | 532 +++ .../magit-submodule.el | 195 +- .../magit-subtree.el | 57 +- .../magit-utils.el | 322 +- .../magit-wip.el | 14 +- elpa/magit-20171009.1252/magit-worktree.el | 132 + elpa/magit-20171009.1252/magit.el | 1084 +++++ elpa/magit-20171009.1252/magit.info | 171 + .../magit.info-1 | 2700 ++++++------- elpa/magit-20171009.1252/magit.info-2 | Bin 0 -> 87111 bytes .../magit-popup-autoloads.el | 16 - .../magit-popup-pkg.el | 8 - elpa/magit-popup-20150701.1246/magit-popup.el | 1055 ----- .../magit-popup.info | 639 --- elpa/magit-popup-20160130.649/dir | 18 - .../magit-popup-autoloads.el | 16 - elpa/magit-popup-20160130.649/magit-popup.el | 1264 ------ .../magit-popup-20160130.649/magit-popup.info | 710 ---- elpa/magit-popup-20160529.2045/dir | 18 - .../magit-popup-autoloads.el | 16 - .../magit-popup-pkg.el | 9 - elpa/magit-popup-20160529.2045/magit-popup.el | 1274 ------ .../magit-popup.info | 712 ---- elpa/magit-popup-20161009.1506/dir | 18 - .../magit-popup-pkg.el | 9 - .../dir | 0 .../magit-popup-autoloads.el | 2 +- .../magit-popup-pkg.el | 6 +- .../magit-popup.el | 186 +- .../magit-popup.info | 217 +- 66 files changed, 9938 insertions(+), 12800 deletions(-) delete mode 100644 elpa/magit-20161115.1658/magit-pkg.el delete mode 100644 elpa/magit-20161115.1658/magit.el delete mode 100644 elpa/magit-20161115.1658/magit.info delete mode 100644 elpa/magit-20161115.1658/magit.info-2 rename elpa/{magit-20161115.1658 => magit-20171009.1252}/AUTHORS.md (91%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/COPYING (100%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/dir (100%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/git-rebase.el (69%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-apply.el (95%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-autoloads.el (74%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-autorevert.el (93%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-bisect.el (96%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-blame.el (92%) create mode 100644 elpa/magit-20171009.1252/magit-bookmark.el create mode 100644 elpa/magit-20171009.1252/magit-branch.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-commit.el (91%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-core.el (50%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-diff.el (90%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-ediff.el (95%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-extras.el (56%) create mode 100644 elpa/magit-20171009.1252/magit-files.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-git.el (79%) create mode 100644 elpa/magit-20171009.1252/magit-imenu.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-log.el (77%) create mode 100644 elpa/magit-20171009.1252/magit-margin.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-mode.el (81%) create mode 100644 elpa/magit-20171009.1252/magit-notes.el create mode 100644 elpa/magit-20171009.1252/magit-obsolete.el create mode 100644 elpa/magit-20171009.1252/magit-pkg.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-process.el (92%) create mode 100644 elpa/magit-20171009.1252/magit-refs.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-remote.el (96%) create mode 100644 elpa/magit-20171009.1252/magit-repos.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-section.el (90%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-sequence.el (89%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-stash.el (86%) create mode 100644 elpa/magit-20171009.1252/magit-status.el rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-submodule.el (66%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-subtree.el (82%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-utils.el (64%) rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit-wip.el (97%) create mode 100644 elpa/magit-20171009.1252/magit-worktree.el create mode 100644 elpa/magit-20171009.1252/magit.el create mode 100644 elpa/magit-20171009.1252/magit.info rename elpa/{magit-20161115.1658 => magit-20171009.1252}/magit.info-1 (77%) create mode 100644 elpa/magit-20171009.1252/magit.info-2 delete mode 100644 elpa/magit-popup-20150701.1246/magit-popup-autoloads.el delete mode 100644 elpa/magit-popup-20150701.1246/magit-popup-pkg.el delete mode 100644 elpa/magit-popup-20150701.1246/magit-popup.el delete mode 100644 elpa/magit-popup-20150701.1246/magit-popup.info delete mode 100644 elpa/magit-popup-20160130.649/dir delete mode 100644 elpa/magit-popup-20160130.649/magit-popup-autoloads.el delete mode 100644 elpa/magit-popup-20160130.649/magit-popup.el delete mode 100644 elpa/magit-popup-20160130.649/magit-popup.info delete mode 100644 elpa/magit-popup-20160529.2045/dir delete mode 100644 elpa/magit-popup-20160529.2045/magit-popup-autoloads.el delete mode 100644 elpa/magit-popup-20160529.2045/magit-popup-pkg.el delete mode 100644 elpa/magit-popup-20160529.2045/magit-popup.el delete mode 100644 elpa/magit-popup-20160529.2045/magit-popup.info delete mode 100644 elpa/magit-popup-20161009.1506/dir delete mode 100644 elpa/magit-popup-20161009.1506/magit-popup-pkg.el rename elpa/{magit-popup-20150701.1246 => magit-popup-20170913.343}/dir (100%) rename elpa/{magit-popup-20161009.1506 => magit-popup-20170913.343}/magit-popup-autoloads.el (93%) rename elpa/{magit-popup-20160130.649 => magit-popup-20170913.343}/magit-popup-pkg.el (57%) rename elpa/{magit-popup-20161009.1506 => magit-popup-20170913.343}/magit-popup.el (90%) rename elpa/{magit-popup-20161009.1506 => magit-popup-20170913.343}/magit-popup.info (83%) diff --git a/elpa/magit-20161115.1658/magit-pkg.el b/elpa/magit-20161115.1658/magit-pkg.el deleted file mode 100644 index b2e0ae20..00000000 --- a/elpa/magit-20161115.1658/magit-pkg.el +++ /dev/null @@ -1,12 +0,0 @@ -(define-package "magit" "20161115.1658" "A Git porcelain inside Emacs" - '((emacs "24.4") - (async "20160711.223") - (dash "20160820.501") - (with-editor "20160929.734") - (git-commit "20160929.801") - (magit-popup "20160821.1338")) - :url "https://github.com/magit/magit" :keywords - '("git" "tools" "vc")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-20161115.1658/magit.el b/elpa/magit-20161115.1658/magit.el deleted file mode 100644 index 1b09ba93..00000000 --- a/elpa/magit-20161115.1658/magit.el +++ /dev/null @@ -1,3566 +0,0 @@ -;;; magit.el --- A Git porcelain inside Emacs -*- lexical-binding: t -*- - -;; Copyright (C) 2008-2016 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: Marius Vollmer -;; Maintainer: Jonas Bernoulli -;; Kyle Meyer -;; Noam Postavsky -;; Former-Maintainers: -;; Nicolas Dudebout -;; Peter J. Weisberg -;; Phil Jackson -;; Rémi Vanicat -;; Yann Hodique - -;; Package-Requires: ((emacs "24.4") (async "20160711.223") (dash "20160820.501") (with-editor "20160929.734") (git-commit "20160929.801") (magit-popup "20160821.1338")) -;; Keywords: git tools vc -;; Homepage: https://github.com/magit/magit - -;; Magit requires at least GNU Emacs 24.4 and Git 1.9.4. - -;; 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: - -;; Magit is an interface to the version control system Git, -;; implemented as an Emacs package. Magit aspires to be a complete -;; Git porcelain. While we cannot (yet) claim, that Magit wraps and -;; improves upon each and every Git command, it is complete enough to -;; allow even experienced Git users 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. - -;;; Code: - -(require 'cl-lib) -(require 'dash) - -(require 'with-editor) -(require 'git-commit) -(require 'magit-core) -(require 'magit-diff) -(require 'magit-apply) -(require 'magit-log) - -(require 'format-spec) -(require 'package nil t) ; used in `magit-version' - -(eval-when-compile (require 'dired-x)) -(declare-function dired-jump 'dired-x) -(eval-when-compile (require 'eshell)) -(declare-function eshell-parse-arguments 'eshell) -(eval-when-compile (require 'message)) - -(defconst magit--minimal-git "1.9.4") -(defconst magit--minimal-emacs "24.4") - -;;; Options -;;;; Status Mode - -(defgroup magit-status nil - "Inspect and manipulate Git repositories." - :group 'magit-modes) - -(defcustom magit-status-mode-hook nil - "Hook run after entering Magit-Status mode." - :group 'magit-status - :type 'hook) - -(defcustom magit-status-headers-hook - '(magit-insert-error-header - magit-insert-diff-filter-header - magit-insert-head-branch-header - magit-insert-upstream-branch-header - magit-insert-push-branch-header - magit-insert-tags-header) - "Hook run to insert headers into the status buffer. - -This hook is run by `magit-insert-status-headers', which in turn -has to be a member of `magit-status-sections-hook' to be used at -all." - :package-version '(magit . "2.1.0") - :group 'magit-status - :type 'hook - :options '(magit-insert-error-header - magit-insert-diff-filter-header - magit-insert-repo-header - magit-insert-remote-header - magit-insert-head-branch-header - magit-insert-upstream-branch-header - magit-insert-push-branch-header - magit-insert-tags-header)) - -(defcustom magit-status-sections-hook - '(magit-insert-status-headers - magit-insert-merge-log - magit-insert-rebase-sequence - magit-insert-am-sequence - magit-insert-sequencer-sequence - magit-insert-bisect-output - magit-insert-bisect-rest - magit-insert-bisect-log - magit-insert-untracked-files - magit-insert-unstaged-changes - magit-insert-staged-changes - magit-insert-stashes - magit-insert-unpulled-from-upstream - magit-insert-unpulled-from-pushremote - magit-insert-unpushed-to-upstream - magit-insert-unpushed-to-pushremote) - "Hook run to insert sections into a status buffer." - :package-version '(magit . "2.4.0") - :group 'magit-status - :type 'hook) - -(defvar magit-status-refresh-hook nil - "Hook run after a status buffer has been refreshed.") - -(defcustom magit-status-expand-stashes t - "Whether the list of stashes is expanded initially." - :package-version '(magit . "2.3.0") - :group 'magit-status - :type 'boolean) - -(defcustom magit-status-show-hashes-in-headers nil - "Whether headers in the status buffer show hashes. -The functions which respect this option are -`magit-insert-head-branch-header', -`magit-insert-upstream-branch-header', and -`magit-insert-push-branch-header'." - :package-version '(magit . "2.4.0") - :group 'magit-status - :type 'boolean) - -;;;; Refs Mode - -(defgroup magit-refs nil - "Inspect and manipulate Git branches and tags." - :group 'magit-modes) - -(defcustom magit-refs-mode-hook nil - "Hook run after entering Magit-Refs mode." - :package-version '(magit . "2.1.0") - :group 'magit-refs - :type 'hook) - -(defcustom magit-refs-sections-hook - '(magit-insert-error-header - magit-insert-branch-description - magit-insert-local-branches - magit-insert-remote-branches - magit-insert-tags) - "Hook run to insert sections into a references buffer." - :package-version '(magit . "2.1.0") - :group 'magit-refs - :type 'hook) - -(defcustom magit-refs-show-commit-count nil - "Whether to show commit counts in Magit-Refs mode buffers. - -all Show counts for branches and tags. -branch Show counts for branches only. -nil Never show counts. - -To change the value in an existing buffer use the command -`magit-refs-show-commit-count'" - :package-version '(magit . "2.1.0") - :group 'magit-refs - :safe (lambda (val) (memq val '(all branch nil))) - :type '(choice (const all :tag "For branches and tags") - (const branch :tag "For branches only") - (const nil :tag "Never"))) -(put 'magit-refs-show-commit-count 'safe-local-variable 'symbolp) -(put 'magit-refs-show-commit-count 'permanent-local t) - -(defcustom magit-refs-show-margin 'branch - "Whether to initially show the margin in refs buffers. - -When non-nil the committer name and date are initially displayed -in the margin of refs buffers. The margin can be shown or hidden -in the current buffer using the command `magit-toggle-margin'." - :package-version '(magit . "2.1.0") - :group 'magit-refs - :safe (lambda (val) (memq val '(all branch nil))) - :type '(choice (const all :tag "For branches and tags") - (const branch :tag "For branches only") - (const nil :tag "Never"))) - -(defcustom magit-visit-ref-create nil - "Whether `magit-visit-ref' may create new branches. - -When this is non-nil, then \"visiting\" a remote branch in a -refs buffer works by creating a new local branch which tracks -the remote branch and then checking out the new local branch." - :package-version '(magit . "2.1.0") - :group 'magit-refs - :group 'magit-commands - :type 'boolean) - -;;;; Miscellaneous - -(defcustom magit-branch-read-upstream-first t - "Whether to read upstream before name of new branch when creating a branch. - -`nil' Read the branch name first. -`t' Read the upstream first. -`fallback' Read the upstream first, but if it turns out that the chosen - value is not a valid upstream (because it cannot be resolved - as an existing revision), then treat it as the name of the - new branch and continue by reading the upstream next." - :package-version '(magit . "2.2.0") - :group 'magit-commands - :type '(choice (const :tag "read branch name first" nil) - (const :tag "read upstream first" t) - (const :tag "read upstream first, with fallback" fallback))) - -(defcustom magit-branch-prefer-remote-upstream nil - "Whether to favor remote upstreams when creating new branches. - -When a new branch is created, Magit offers the branch, commit, or -stash as the default starting point of the new branch. If there -is no such thing at point, then it falls back to offer the -current branch as starting-point. The user may then accept that -default or pick something else. - -If the chosen starting-point is a branch, then it may also be set -as the upstream of the new branch, depending on the value of the -Git variable `branch.autoSetupMerge'. By default this is done -for remote branches, but not for local branches. - -You might prefer to always use some remote branch as upstream. -If the chosen starting-point is (1) a local branch, (2) whose -name matches a member of the value of this option, (3) the -upstream of that local branch is a remote branch with the same -name, and (4) that remote branch can be fast-forwarded to the -local branch, then the chosen branch is used as starting-point, -but its own upstream is used as the upstream of the new branch. - -Members of this option's value are treated as branch names that -have to match exactly unless they contain a character that makes -them invalid as a branch name. Recommended characters to use -to trigger interpretation as a regexp are \"*\" and \"^\". Some -other characters which you might expect to be invalid, actually -are not, e.g. \".+$\" are all perfectly valid. More precisely, -if `git check-ref-format --branch STRING' exits with a non-zero -status, then treat STRING as a regexp. - -Assuming the chosen branch matches these conditions you would end -up with with e.g.: - - feature --upstream--> origin/master - -instead of - - feature --upstream--> master --upstream--> origin/master - -Which you prefer is a matter of personal preference. If you do -prefer the former, then you should add branches such as \"master\", -\"next\", and \"maint\" to the value of this options." - :package-version '(magit . "2.4.0") - :group 'magit-commands - :type '(repeat string)) - -(defcustom magit-branch-adjust-remote-upstream-alist nil - "Alist of upstreams to be used when branching from remote branches. - -When creating a local branch from an ephemeral branch located -on a remote, e.g. a feature or hotfix branch, then that remote -branch should usually not be used as the upstream branch, since -the push-remote already allows accessing it and having both the -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 -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. - -UPSTREAM is the branch to be used as the upstream for branches -specified by RULE. It can be a local or a remote branch. - -RULE can either be a regular expression, matching branches whose -upstream should be the one specified by UPSTREAM. Or it can be -a list of the only branches that should *not* use UPSTREAM; all -other branches will. Matching is done after stripping the remote -part of the name of the branch that is being branched from. - -If you use a finite set of non-ephemeral branches across all your -repositories, then you might use something like: - - ((\"origin/master\" \"master\" \"next\" \"maint\")) - -Or if the names of all your ephemeral branches contain a slash, -at least in some repositories, then a good value could be: - - ((\"origin/master\" . \"/\")) - -Of course you can also fine-tune: - - ((\"origin/maint\" . \"\\`hotfix/\") - (\"origin/master\" . \"\\`feature/\"))" - :package-version '(magit . "2.9.0") - :group 'magit-commands - :type '(repeat (cons (string :tag "Use upstream") - (choice :tag "for branches" - (regexp :tag "matching") - (repeat :tag "except" - (string :tag "branch")))))) - -(defcustom magit-branch-popup-show-variables t - "Whether the `magit-branch-popup' shows Git variables. -This defaults to t to avoid changing key bindings. When set to -nil, no variables are displayed directly in this popup, instead -the sub-popup `magit-branch-config-popup' has to be used to view -and change branch related variables." - :package-version '(magit . "2.7.0") - :group 'magit-commands - :type 'boolean) - -(defcustom magit-repository-directories nil - "List of directories that are or contain Git repositories. -Each element has the form (DIRECTORY . DEPTH) or, for backward -compatibility, just DIRECTORY. 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. For elements that are strings, the -value of option `magit-repository-directories-depth' specifies -the depth." - :package-version '(magit . "2.8.0") - :group 'magit - :type '(repeat (choice (cons directory (integer :tag "Depth")) directory))) - -(defcustom magit-repository-directories-depth 3 - "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." - :group 'magit - :type 'integer) - -(defcustom magit-repolist-columns - '(("Name" 25 magit-repolist-column-ident nil) - ("Version" 25 magit-repolist-column-version nil) - ("LU" 3 magit-repolist-column-unpushed-to-upstream (:right-align t)) - ("Path" 99 magit-repolist-column-path)) - "List of columns displayed by `magit-list-repositories'. - -Each element has the form (HEADER WIDTH FORMAT PROPS). - -HEADER is the string displayed in the header. WIDTH is the width -of the column. FORMAT is a function that is called with one -argument, the repository identification (usually its basename), -and with `default-directory' bound to the toplevel of its working -tree. It has to return a string to be inserted or nil. PROPS is -an alist that supports the keys `:right-align' and `:pad-right'." - :package-version '(magit . "2.8.0") - :group 'magit-commands - :type `(repeat (list :tag "Column" - (string :tag "Header Label") - (integer :tag "Column Width") - (function :tag "Inserter Function") - (repeat :tag "Properties" - (list (choice :tag "Property" - (const :right-align) - (const :pad-right) - (symbol)) - (sexp :tag "Value")))))) - -;;;; Faces - -(defface magit-header-line - '((t :inherit magit-section-heading)) - "Face for the `header-line'." - :group 'magit-faces) - -(defface magit-dimmed - '((((class color) (background light)) :foreground "grey50") - (((class color) (background dark)) :foreground "grey50")) - "Face for text that shouldn't stand out." - :group 'magit-faces) - -(defface magit-hash - '((((class color) (background light)) :foreground "grey60") - (((class color) (background dark)) :foreground "grey40")) - "Face for the sha1 part of the log output." - :group 'magit-faces) - -(defface magit-tag - '((((class color) (background light)) :foreground "Goldenrod4") - (((class color) (background dark)) :foreground "LightGoldenrod2")) - "Face for tag labels shown in log buffer." - :group 'magit-faces) - -(defface magit-branch-remote - '((((class color) (background light)) :foreground "DarkOliveGreen4") - (((class color) (background dark)) :foreground "DarkSeaGreen2")) - "Face for remote branch head labels shown in log buffer." - :group 'magit-faces) - -(defface magit-branch-local - '((((class color) (background light)) :foreground "SkyBlue4") - (((class color) (background dark)) :foreground "LightSkyBlue1")) - "Face for local branches." - :group 'magit-faces) - -(defface magit-branch-current - '((((class color) (background light)) :inherit magit-branch-local :box t) - (((class color) (background dark)) :inherit magit-branch-local :box t)) - "Face for current branch." - :group 'magit-faces) - -(defface magit-head - '((((class color) (background light)) :inherit magit-branch-local) - (((class color) (background dark)) :inherit magit-branch-local)) - "Face for the symbolic ref \"HEAD\"." - :group 'magit-faces) - -(defface magit-refname - '((((class color) (background light)) :foreground "grey30") - (((class color) (background dark)) :foreground "grey80")) - "Face for refnames without a dedicated face." - :group 'magit-faces) - -(defface magit-refname-stash - '((t :inherit magit-refname)) - "Face for wip refnames." - :group 'magit-faces) - -(defface magit-refname-wip - '((t :inherit magit-refname)) - "Face for wip refnames." - :group 'magit-faces) - -(defface magit-signature-good - '((t :foreground "green")) - "Face for good signatures." - :group 'magit-faces) - -(defface magit-signature-bad - '((t :foreground "red" :weight bold)) - "Face for bad signatures." - :group 'magit-faces) - -(defface magit-signature-untrusted - '((t :foreground "cyan")) - "Face for good untrusted signatures." - :group 'magit-faces) - -(defface magit-signature-expired - '((t :foreground "orange")) - "Face for signatures that have expired." - :group 'magit-faces) - -(defface magit-signature-expired-key - '((t :inherit magit-signature-expired)) - "Face for signatures made by an expired key." - :group 'magit-faces) - -(defface magit-signature-revoked - '((t :foreground "violet red")) - "Face for signatures made by a revoked key." - :group 'magit-faces) - -(defface magit-signature-error - '((t :foreground "firebrick3")) - "Face for signatures that cannot be checked (e.g. missing key)." - :group 'magit-faces) - -(defface magit-cherry-unmatched - '((t :foreground "cyan")) - "Face for unmatched cherry commits." - :group 'magit-faces) - -(defface magit-cherry-equivalent - '((t :foreground "magenta")) - "Face for equivalent cherry commits." - :group 'magit-faces) - -(defface magit-filename - '((t :weight normal)) - "Face for filenames." - :group 'magit-faces) - -;;; Inspect -;;;; Status Mode -;;;;; Status Core - -(defvar magit-status-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map magit-mode-map) - (define-key map "jz" 'magit-jump-to-stashes) - (define-key map "jt" 'magit-jump-to-tracked) - (define-key map "jn" 'magit-jump-to-untracked) - (define-key map "ju" 'magit-jump-to-unstaged) - (define-key map "js" 'magit-jump-to-staged) - (define-key map "jfu" 'magit-jump-to-unpulled-from-upstream) - (define-key map "jfp" 'magit-jump-to-unpulled-from-pushremote) - (define-key map "jpu" 'magit-jump-to-unpushed-to-upstream) - (define-key map "jpp" 'magit-jump-to-unpushed-to-pushremote) - map) - "Keymap for `magit-status-mode'.") - -(eval-after-load 'dired-x - '(define-key magit-status-mode-map [remap dired-jump] 'magit-dired-jump)) - -(define-derived-mode magit-status-mode magit-mode "Magit" - "Mode for looking at Git status. - -This mode is documented in info node `(magit)Status buffer'. - -\\\ -Type \\[magit-refresh] to refresh the current buffer. -Type \\[magit-section-toggle] to expand or hide the section at point. -Type \\[magit-visit-thing] to visit the change or commit at point. - -Type \\[magit-dispatch-popup] to see available prefix popups. - -Staging and applying changes is documented in info node -`(magit)Staging and unstaging' and info node `(magit)Applying'. - -\\Type \ -\\[magit-apply] to apply the change at point, \ -\\[magit-stage] to stage, -\\[magit-unstage] to unstage, \ -\\[magit-discard] to discard, or \ -\\[magit-reverse] to reverse it. - -\\\ -Type \\[magit-commit-popup] to create a commit. - -\\{magit-status-mode-map}" - :group 'magit-status - (hack-dir-local-variables-non-file-buffer) - ;; Avoid listing all files as deleted when visiting a bare repo. - (when (magit-bare-repo-p) - (make-local-variable 'magit-status-sections-hook) - (remove-hook 'magit-status-sections-hook #'magit-insert-staged-changes - 'local))) - -;;;###autoload -(defun magit-status (&optional directory) - "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." - (interactive - (list (and (or current-prefix-arg (not (magit-toplevel))) - (magit-read-repository - (>= (prefix-numeric-value current-prefix-arg) 16))))) - (if directory - (let ((toplevel (magit-toplevel directory))) - (setq directory (file-name-as-directory (expand-file-name directory))) - (if (and toplevel (string-equal directory toplevel)) - (magit-status-internal directory) - (when (y-or-n-p - (if toplevel - (format "%s is a repository. Create another in %s? " - toplevel directory) - (format "Create repository in %s? " directory))) - (magit-init directory)))) - (magit-status-internal default-directory))) - -(put 'magit-status 'interactive-only 'magit-status-internal) - -;;;###autoload -(defun magit-status-internal (directory) - (magit-tramp-asserts directory) - (let ((default-directory directory)) - (magit-mode-setup #'magit-status-mode))) - -;;;;; Standard Status Sections - -(defvar magit-status-sections-hook-1 nil) - -(defun magit-status-refresh-buffer () - (magit-git-exit-code "update-index" "--refresh") - (magit-insert-section (status) - (if (-all-p #'functionp magit-status-sections-hook) - (run-hooks 'magit-status-sections-hook) - (message "`magit-status-sections-hook' contains entries that are \ -no longer valid.\nUsing standard value instead. Please re-configure") - (sit-for 5) - (let ((magit-status-sections-hook-1 - (eval (car (get 'magit-status-sections-hook 'standard-value))))) - (run-hooks 'magit-status-sections-hook-1)))) - (run-hooks 'magit-status-refresh-hook)) - -(defun magit-insert-status-headers () - "Insert header sections appropriate for `magit-status-mode' buffers. -The sections are inserted by running the functions on the hook -`magit-status-headers-hook'." - (if (magit-rev-verify "HEAD") - (magit-insert-headers magit-status-headers-hook) - (insert "In the beginning there was darkness\n\n"))) - -(defun magit-insert-error-header () - "Insert the message about the Git error that just occured. - -This function is only aware of the last error that occur when Git -was run for side-effects. If, for example, an error occurs while -generating a diff, then that error won't be inserted. Refreshing -the status buffer causes this section to disappear again." - (when magit-this-error - (magit-insert-section (error 'git) - (insert (propertize (format "%-10s" "GitError! ") - 'face 'magit-section-heading)) - (insert (propertize magit-this-error 'face 'font-lock-warning-face)) - (-when-let (key (car (where-is-internal 'magit-process-buffer))) - (insert (format " [Type `%s' for details]" (key-description key)))) - (insert ?\n)) - (setq magit-this-error nil))) - -(cl-defun magit-insert-head-branch-header - (&optional (branch (magit-get-current-branch))) - "Insert a header line about BRANCH. -When BRANCH is nil, use the current branch or, if none, the -detached `HEAD'." - (let ((output (magit-rev-format "%h %s" (or branch "HEAD")))) - (string-match "^\\([^ ]+\\) \\(.*\\)" output) - (magit-bind-match-strings (commit summary) output - (if branch - (magit-insert-section (branch branch) - (insert (format "%-10s" "Head: ")) - (when magit-status-show-hashes-in-headers - (insert (propertize commit 'face 'magit-hash) ?\s)) - (insert (propertize branch 'face 'magit-branch-local)) - (insert ?\s summary ?\n)) - (magit-insert-section (commit commit) - (insert (format "%-10s" "Head: ")) - (insert (propertize commit 'face 'magit-hash)) - (insert ?\s summary ?\n)))))) - -(cl-defun magit-insert-upstream-branch-header - (&optional (branch (magit-get-current-branch)) - (pull (magit-get-upstream-branch branch)) - keyword) - "Insert a header line about branch usually pulled into current branch." - (when pull - (magit-insert-section (branch pull) - (let ((rebase (magit-git-string "config" - (format "branch.%s.rebase" branch)))) - (if (equal rebase "false") - (setq rebase nil) - (setq rebase (magit-get-boolean "pull.rebase"))) - (insert (format "%-10s" (or keyword (if rebase "Rebase: " "Merge: "))))) - (--when-let (and magit-status-show-hashes-in-headers - (magit-rev-format "%h" pull)) - (insert (propertize it 'face 'magit-hash) ?\s)) - (insert (propertize pull 'face - (if (string= (magit-get "branch" branch "remote") ".") - 'magit-branch-local - 'magit-branch-remote))) - (insert ?\s) - (if (magit-rev-verify pull) - (insert (or (magit-rev-format "%s" pull) "")) - (insert (propertize "is missing" 'face 'font-lock-warning-face))) - (insert ?\n)))) - -(cl-defun magit-insert-push-branch-header - (&optional (branch (magit-get-current-branch)) - (push (magit-get-push-branch branch))) - "Insert a header line about the branch the current branch is pushed to." - (when push - (magit-insert-section (branch push) - (insert (format "%-10s" "Push: ")) - (--when-let (and magit-status-show-hashes-in-headers - (magit-rev-format "%h" push)) - (insert (propertize it 'face 'magit-hash) ?\s)) - (insert (propertize push 'face 'magit-branch-remote) ?\s) - (if (magit-rev-verify push) - (insert (or (magit-rev-format "%s" push) "")) - (insert (propertize "is missing" 'face 'font-lock-warning-face))) - (insert ?\n)))) - -(defun magit-insert-tags-header () - "Insert a header line about the current and/or next tag." - (let* ((this-tag (magit-get-current-tag nil t)) - (next-tag (magit-get-next-tag nil t)) - (this-cnt (cadr this-tag)) - (next-cnt (cadr next-tag)) - (this-tag (car this-tag)) - (next-tag (car next-tag)) - (both-tags (and this-tag next-tag t))) - (when (or this-tag next-tag) - (magit-insert-section (tag (or this-tag next-tag)) - (insert (format "%-10s" (if both-tags "Tags: " "Tag: "))) - (when this-tag - (insert (magit-format-status-tag-sentence this-tag this-cnt nil))) - (when both-tags - (insert ", ")) - (when next-tag - (insert (magit-format-status-tag-sentence next-tag next-cnt t))) - (insert ?\n))))) - -(defun magit-format-status-tag-sentence (tag count next) - (concat (propertize tag 'face 'magit-tag) - (and (> count 0) - (format " (%s)" - (propertize (format "%s" count) 'face - (if next 'magit-tag 'magit-branch-local)))))) - -(defun magit-insert-diff-filter-header () - "Insert a header line showing the effective diff filters." - (when magit-diff-section-file-args - (magit-insert-section (filter 'diff) - (insert (propertize (format "%-10s" "Filter! ") - 'face 'magit-section-heading)) - (insert (mapconcat #'identity magit-diff-section-file-args " ")) - (insert ?\n)))) - -(magit-define-section-jumper magit-jump-to-untracked "Untracked files" untracked) - -(defvar magit-untracked-section-map - (let ((map (make-sparse-keymap))) - (define-key map [remap magit-delete-thing] 'magit-discard) - (define-key map "s" 'magit-stage) - map) - "Keymap for the `untracked' section.") - -(defun magit-insert-untracked-files () - "Maybe insert a list or tree of untracked files. -Do so depending on the value of `status.showUntrackedFiles'. -Note that even if the value is `all', Magit still initially only -shows directories. But the directory sections can then be expanded -using \"TAB\"." - (let ((show (or (magit-get "status.showUntrackedFiles") "normal"))) - (unless (equal show "no") - (if (equal show "all") - (-when-let (files (magit-untracked-files)) - (magit-insert-section (untracked) - (magit-insert-heading "Untracked files:") - (magit-insert-un/tracked-files-1 files nil) - (insert ?\n))) - (-when-let - (files (--mapcat (and (eq (aref it 0) ??) - (list (substring it 3))) - (magit-git-items "status" "-z" "--porcelain"))) - (magit-insert-section (untracked) - (magit-insert-heading "Untracked files:") - (dolist (file files) - (magit-insert-section (file file) - (insert (propertize file 'face 'magit-filename) ?\n))) - (insert ?\n))))))) - -(defun magit-insert-un/tracked-files-1 (files directory) - (while (and files (string-prefix-p (or directory "") (car files))) - (let ((dir (file-name-directory (car files)))) - (if (equal dir directory) - (let ((file (pop files))) - (magit-insert-section (file file) - (insert (propertize file 'face 'magit-filename) ?\n))) - (magit-insert-section (file dir t) - (insert (propertize dir 'file 'magit-filename) ?\n) - (magit-insert-heading) - (setq files (magit-insert-un/tracked-files-1 files dir)))))) - files) - -;;;;; Auxiliary Status Sections - -(magit-define-section-jumper magit-jump-to-tracked "Tracked files" tracked) - -(defun magit-insert-tracked-files () - "Insert a tree of tracked files." - (-when-let (files (magit-list-files)) - (magit-insert-section (tracked nil t) - (magit-insert-heading "Tracked files:") - (magit-insert-un/tracked-files-1 files nil) - (insert ?\n)))) - -(defun magit-insert-user-header () - "Insert a header line about the current user." - (let ((name (magit-get "user.name")) - (email (magit-get "user.email"))) - (when (and name email) - (magit-insert-section (user name) - (insert (format "%-10s" "User: ")) - (insert (propertize name 'face 'magit-log-author)) - (insert " <" email ">\n"))))) - -(defun magit-insert-repo-header () - "Insert a header line showing the path to the repository top-level." - (let ((topdir (magit-toplevel))) - (magit-insert-section (repo topdir) - (insert (format "%-10s%s\n" "Repo: " (abbreviate-file-name topdir)))))) - -(defun magit-insert-remote-header () - "Insert a header line about the remote of the current branch. - -If no remote is configured for the current branch, then fall back -showing the \"origin\" remote, or if that does not exist the first -remote in alphabetic order." - (-when-let* ((name (or (magit-get-remote) - (let ((remotes (magit-list-remotes))) - (or (car (member "origin" remotes)) - (car remotes))))) - ;; Under certain configurations it's possible for url - ;; to be nil, when name is not, see #2858. - (url (magit-get "remote" name "url"))) - (magit-insert-section (remote name) - (insert (format "%-10s" "Remote: ")) - (insert (propertize name 'face 'magit-branch-remote) ?\s) - (insert url ?\n)))) - -;;;;; Status Miscellaneous - -(defun ido-enter-magit-status () - "Drop into `magit-status' from file switching. - -To make this command available use something like: - - (add-hook \\='ido-setup-hook - (lambda () - (define-key ido-completion-map - (kbd \"C-x g\") \\='ido-enter-magit-status))) - -Starting with Emacs 25.1 the Ido keymaps are defined just once -instead of every time Ido is invoked, so now you can modify it -like pretty much every other keymap: - - (define-key ido-common-completion-map - (kbd \"C-x g\") 'ido-enter-magit-status)" - (interactive) - (with-no-warnings ; FIXME these are internal variables - (setq ido-exit 'fallback fallback 'magit-status)) - (exit-minibuffer)) - -(defun magit-status-maybe-update-revision-buffer (&optional _) - "When moving in the status buffer, update the revision buffer. -If there is no revision buffer in the same frame, then do nothing." - (when (derived-mode-p 'magit-status-mode) - (magit-log-maybe-update-revision-buffer-1))) - -(defun magit-status-maybe-update-blob-buffer (&optional _) - "When moving in the status buffer, update the blob buffer. -If there is no blob buffer in the same frame, then do nothing." - (when (derived-mode-p 'magit-status-mode) - (magit-log-maybe-update-blob-buffer-1))) - -;;;; Refs Mode - -(defvar magit-refs-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map magit-mode-map) - (define-key map "\C-y" 'magit-refs-set-show-commit-count) - map) - "Keymap for `magit-refs-mode'.") - -(define-derived-mode magit-refs-mode magit-mode "Magit Refs" - "Mode which lists and compares references. - -This mode is documented in info node `(magit)References buffer'. - -\\\ -Type \\[magit-refresh] to refresh the current buffer. -Type \\[magit-section-toggle] to expand or hide the section at point. -Type \\[magit-visit-thing] or \\[magit-diff-show-or-scroll-up] \ -to visit the commit or branch at point. - -Type \\[magit-branch-popup] to see available branch commands. -Type \\[magit-merge-popup] to merge the branch or commit at point. -Type \\[magit-cherry-pick-popup] to apply the commit at point. -Type \\[magit-reset] to reset HEAD to the commit at point. - -\\{magit-refs-mode-map}" - :group 'magit-refs - (hack-dir-local-variables-non-file-buffer)) - -;;;###autoload (autoload 'magit-show-refs-popup "magit" nil t) -(magit-define-popup magit-show-refs-popup - "Popup console for `magit-show-refs'." - 'magit-refs - :man-page "git-branch" - :switches '((?m "Merged to HEAD" "--merged") - (?M "Merged to master" "--merged=master") - (?n "Not merged to HEAD" "--no-merged") - (?N "Not merged to master" "--no-merged=master")) - :options '((?c "Contains" "--contains=" magit-read-branch-or-commit) - (?m "Merged" "--merged=" magit-read-branch-or-commit) - (?n "Not merged" "--no-merged=" magit-read-branch-or-commit) - (?s "Sort" "--sort=" magit-read-ref-sort)) - :actions '((?y "Show refs, comparing them with HEAD" - magit-show-refs-head) - (?c "Show refs, comparing them with current branch" - magit-show-refs-current) - (?o "Show refs, comparing them with other branch" - magit-show-refs)) - :default-action 'magit-show-refs-head - :use-prefix 'popup) - -(defun magit-read-ref-sort (prompt initial-input) - (magit-completing-read prompt - '("-committerdate" "-authordate" - "committerdate" "authordate") - nil nil initial-input)) - -;;;###autoload -(defun magit-show-refs-head (&optional args) - "List and compare references in a dedicated buffer. -Refs are compared with `HEAD'." - (interactive (list (magit-show-refs-arguments))) - (magit-show-refs nil args)) - -;;;###autoload -(defun magit-show-refs-current (&optional args) - "List and compare references in a dedicated buffer. -Refs are compared with the current branch or `HEAD' if -it is detached." - (interactive (list (magit-show-refs-arguments))) - (magit-show-refs (magit-get-current-branch) args)) - -;;;###autoload -(defun magit-show-refs (&optional ref args) - "List and compare references in a dedicated buffer. -Refs are compared with a branch read form the user." - (interactive (list (magit-read-other-branch "Compare with") - (magit-show-refs-arguments))) - (magit-mode-setup #'magit-refs-mode ref args)) - -(defun magit-refs-refresh-buffer (&rest _ignore) - (setq magit-set-buffer-margin-refresh (not magit-show-margin)) - (unless (magit-rev-verify (or (car magit-refresh-args) "HEAD")) - (setq magit-refs-show-commit-count nil)) - (magit-insert-section (branchbuf) - (run-hooks 'magit-refs-sections-hook))) - -(defun magit-insert-branch-description () - "Insert header containing the description of the current branch. -Insert a header line with the name and description of the -current branch. The description is taken from the Git variable -`branch..description'; if that is undefined then no header -line is inserted at all." - (let ((branch (magit-get-current-branch))) - (--when-let (magit-git-lines - "config" (format "branch.%s.description" branch)) - (magit-insert-section (branchdesc branch t) - (magit-insert-heading branch ": " (car it)) - (insert (mapconcat 'identity (cdr it) "\n")) - (insert "\n\n"))))) - -(defconst magit-refs-branch-line-re - (concat "^" - "\\(?:[ \\*]\\) " - "\\(?1:([^)]+)\\|[^ ]+?\\)" ; branch - "\\(?: +\\)" - "\\(?2:[0-9a-fA-F]+\\) " ; sha1 - "\\(?:\\[" - "\\(?4:[^:]+\\)" ; upstream - "\\(?:: \\(?:" - "\\(?7:gone\\)\\|" ; gone - "\\(?:ahead \\(?5:[0-9]+\\)\\)?" ; ahead - "\\(?:, \\)?" - "\\(?:behind \\(?6:[0-9]+\\)\\)?" ; behind - "\\)\\)?" - "\\] \\)?" - "\\(?3:.*\\)")) ; message - -(defconst magit-refs-symref-line-re "^ \\([^ ]+\\) +-> \\(.+\\)") - -(defvar magit-refs-local-branch-format "%4c %-25n %U%m\n" - "Format used for local branches in refs buffers.") -(defvar magit-refs-remote-branch-format "%4c %-25n %m\n" - "Format used for remote branches in refs buffers.") -(defvar magit-refs-symref-format "%4c %-25n -> %m\n" - "Format used for symrefs in refs buffers.") -(defvar magit-refs-tags-format "%4c %-25n %m\n" - "Format used for tags in refs buffers.") -(defvar magit-refs-indent-cherry-lines 3 - "Indentation of cherries in refs buffers.") - -(defvar magit-branch-section-map - (let ((map (make-sparse-keymap))) - (define-key map [remap magit-visit-thing] 'magit-visit-ref) - (define-key map [remap magit-delete-thing] 'magit-branch-delete) - (define-key map "R" 'magit-branch-rename) - map) - "Keymap for `branch' sections.") - -(defvar magit-remote-section-map - (let ((map (make-sparse-keymap))) - (define-key map [remap magit-delete-thing] 'magit-remote-remove) - (define-key map "R" 'magit-remote-rename) - map) - "Keymap for `remote' sections.") - -(defun magit-refs-set-show-commit-count () - "Change for which refs the commit count is shown." - (interactive) - (setq-local magit-refs-show-commit-count - (magit-read-char-case "Show commit counts for " nil - (?a "[a]ll refs" 'all) - (?b "[b]ranches only" t) - (?n "[n]othing" nil))) - (magit-refresh)) - -(defun magit-visit-ref () - "Visit the reference or revision at point. - -In most places use `magit-show-commit' to visit the reference or -revision at point. - -In `magit-refs-mode', when there is a reference at point, instead -checkout that reference. When option `magit-visit-ref-create' is -non-nil and point is on remote branch, then create a local branch -with the same name and check it out. - -With a prefix argument only focus on the reference at point, i.e. -the commit counts and cherries are updated to be relative to that -reference, but it is not checked out." - (interactive) - (if (derived-mode-p 'magit-refs-mode) - (magit-section-case - (([branch * branchbuf] - [tag * branchbuf]) - (let ((ref (magit-section-value (magit-current-section)))) - (if current-prefix-arg - (magit-show-refs ref) - (if (magit-section-match [branch remote]) - (let ((start ref) - (arg "-b")) - (string-match "^[^/]+/\\(.+\\)" ref) - (setq ref (match-string 1 ref)) - (when (magit-branch-p ref) - (if (yes-or-no-p - (format "Branch %s already exists. Recreate it?" ref)) - (setq arg "-B") - (user-error "Abort"))) - (magit-run-git "checkout" arg ref start)) - (magit-run-git "checkout" ref)) - (setcar magit-refresh-args ref) - (magit-refresh)))) - ([commit * branchbuf] - (call-interactively #'magit-show-commit))) - (call-interactively #'magit-show-commit))) - -(defun magit-insert-local-branches () - "Insert sections showing all local branches." - (magit-insert-section (local nil) - (magit-insert-heading "Branches:") - (let ((current (magit-get-current-branch)) - (branches (magit-list-local-branch-names))) - (dolist (line (magit-git-lines "branch" "-vv" - (cadr magit-refresh-args))) - (cond - ((string-match magit-refs-branch-line-re line) - (magit-bind-match-strings - (branch hash message upstream ahead behind gone) line - (when (string-match-p "(HEAD detached" branch) - (setq branch nil)) - (magit-insert-branch - branch magit-refs-local-branch-format current branches - 'magit-branch-local hash message upstream ahead behind gone))) - ((string-match magit-refs-symref-line-re line) - (magit-bind-match-strings (symref ref) line - (magit-insert-symref symref ref 'magit-branch-local)))))) - (insert ?\n))) - -(defun magit-insert-remote-branches () - "Insert sections showing all remote-tracking branches." - (dolist (remote (magit-list-remotes)) - (magit-insert-section (remote remote) - (magit-insert-heading - (let ((pull (magit-get "remote" remote "url")) - (push (magit-get "remote" remote "pushurl"))) - (format "%s (%s):" (capitalize remote) - (concat pull (and pull push ", ") push)))) - (let ((current (magit-get-current-branch)) - (branches (magit-list-local-branch-names))) - (dolist (line (magit-git-lines "branch" "-vvr" - (cadr magit-refresh-args))) - (cond - ((string-match magit-refs-branch-line-re line) - (magit-bind-match-strings (branch hash message) line - (when (string-match-p (format "^%s/" remote) branch) - (magit-insert-branch - branch magit-refs-remote-branch-format current branches - 'magit-branch-remote hash message)))) - ((string-match magit-refs-symref-line-re line) - (magit-bind-match-strings (symref ref) line - (magit-insert-symref symref ref 'magit-branch-remote)))))) - (insert ?\n)))) - -(defun magit-insert-branch (branch format &rest args) - "For internal use, don't add to a hook." - (unless magit-refs-show-commit-count - (setq format (replace-regexp-in-string "%[0-9]\\([cC]\\)" "%1\\1" format t))) - (if (equal branch "HEAD") - (magit-insert-section it (commit (magit-rev-parse "HEAD") t) - (apply #'magit-insert-branch-1 it nil format args)) - (magit-insert-section it (branch branch t) - (apply #'magit-insert-branch-1 it branch format args)))) - -(defun magit-insert-branch-1 - (section branch format current branches face - &optional hash message upstream ahead behind gone) - "For internal use, don't add to a hook." - (let* ((head (or (car magit-refresh-args) current "HEAD")) - (count (and branch - (magit-refs-format-commit-count branch head format))) - (mark (cond ((or (equal branch head) - (and (not branch) (equal head "HEAD"))) - (if (equal branch current) - (propertize "@" 'face 'magit-head) - (propertize "#" 'face 'magit-tag))) - ((equal branch current) - (propertize "." 'face 'magit-head))))) - (when upstream - (setq upstream (propertize upstream 'face - (if (member upstream branches) - 'magit-branch-local - 'magit-branch-remote)))) - (magit-insert-heading - (format-spec - format - `((?a . ,(or ahead "")) - (?b . ,(or behind "")) - (?c . ,(or mark count "")) - (?C . ,(or mark " ")) - (?h . ,(or (propertize hash 'face 'magit-hash) "")) - (?m . ,(or message "")) - (?n . ,(propertize (or branch "(detached)") 'face face)) - (?u . ,(or upstream "")) - (?U . ,(if upstream - (format (propertize "[%s%s] " 'face 'magit-dimmed) - upstream - (cond - (gone - (concat ": " (propertize gone 'face 'error))) - ((or ahead behind) - (concat ": " - (and ahead (format "ahead %s" ahead)) - (and ahead behind ", ") - (and behind (format "behind %s" behind)))) - (t ""))) - ""))))) - (when magit-show-margin - (magit-refs-format-margin branch)) - (magit-refs-insert-cherry-commits head branch section))) - -(defun magit-insert-symref (symref ref face) - "For internal use, don't add to a hook." - (magit-insert-section (commit symref) - (insert - (format-spec (if magit-refs-show-commit-count - magit-refs-symref-format - (replace-regexp-in-string "%[0-9]\\([cC]\\)" "%1\\1" - magit-refs-symref-format t)) - `((?c . "") - (?n . ,(propertize symref 'face face)) - (?m . ,(propertize ref 'face face))))))) - -(defvar magit-tag-section-map - (let ((map (make-sparse-keymap))) - (define-key map [remap magit-visit-thing] 'magit-visit-ref) - (define-key map [remap magit-delete-thing] 'magit-tag-delete) - map) - "Keymap for `tag' sections.") - -(defun magit-insert-tags () - "Insert sections showing all tags." - (-when-let (tags (magit-git-lines "tag" "-l" "-n")) - (magit-insert-section (tags) - (magit-insert-heading "Tags:") - (let ((head (or (car magit-refresh-args) - (magit-get-current-branch) - "HEAD")) - (format (if magit-refs-show-commit-count - magit-refs-tags-format - (replace-regexp-in-string - "%[0-9]\\([cC]\\)" "%1\\1" magit-refs-tags-format t)))) - (dolist (tag (nreverse tags)) - (string-match "^\\([^ \t]+\\)[ \t]+\\([^ \t\n].*\\)?" tag) - (let* ((message (match-string 2 tag)) - (tag (match-string 1 tag)) - (count (magit-refs-format-commit-count tag head format t)) - (mark (and (equal tag head) - (propertize "#" 'face 'magit-tag)))) - (magit-insert-section section (tag tag t) - (magit-insert-heading - (format-spec format - `((?n . ,(propertize tag 'face 'magit-tag)) - (?c . ,(or mark count "")) - (?m . ,(or message ""))))) - (when (and magit-show-margin - (eq magit-refs-show-margin 'all)) - (magit-refs-format-margin (concat tag "^{commit}"))) - (magit-refs-insert-cherry-commits head tag section))))) - (insert ?\n)))) - -(defun magit-refs-insert-cherry-commits (head ref section) - (if (magit-section-hidden section) - (setf (magit-section-washer section) - (apply-partially #'magit-refs-insert-cherry-commits-1 - head ref section)) - (magit-refs-insert-cherry-commits-1 head ref section))) - -(defun magit-refs-insert-cherry-commits-1 (head ref section) - (let ((start (point))) - (magit-git-wash (apply-partially 'magit-log-wash-log 'cherry) - "cherry" "-v" "--abbrev" head ref magit-refresh-args) - (unless (= (point) start) - (insert (propertize "\n" 'magit-section section))))) - -(defun magit-refs-format-commit-count (ref head format &optional tag-p) - (and (string-match-p "%-?[0-9]+c" format) - (if tag-p - (eq magit-refs-show-commit-count 'all) - magit-refs-show-commit-count) - (let ((count (cadr (magit-rev-diff-count head ref)))) - (and (> count 0) - (propertize (number-to-string count) 'face 'magit-dimmed))))) - -(defun magit-refs-format-margin (commit) - (save-excursion - (goto-char (line-beginning-position 0)) - (let ((line (magit-rev-format "%ct%cN" commit))) - (magit-format-log-margin (substring line 10) - (substring line 0 10))))) - -;;;; Files - -;;;###autoload -(defun magit-find-file (rev file) - "View FILE from REV. -Switch to a buffer visiting blob REV:FILE, -creating one if none already exists." - (interactive (magit-find-file-read-args "Find file")) - (switch-to-buffer (magit-find-file-noselect rev file))) - -;;;###autoload -(defun magit-find-file-other-window (rev file) - "View FILE from REV, in another window. -Like `magit-find-file', but create a new window or reuse an -existing one." - (interactive (magit-find-file-read-args "Find file in other window")) - (switch-to-buffer-other-window (magit-find-file-noselect rev file))) - -(defun magit-find-file-read-args (prompt) - (let ((rev (magit-read-branch-or-commit "Find file from revision"))) - (list rev (magit-read-file-from-rev rev prompt)))) - -(defvar magit-read-file-hist nil) - -(defun magit-read-file-from-rev (rev prompt &optional default) - (let ((files (magit-revision-files rev))) - (magit-completing-read - prompt files nil t nil 'magit-read-file-hist - (car (member (or default (magit-current-file)) files))))) - -(defun magit-read-changed-file (rev-or-range prompt &optional default) - (magit-read-file-choice - prompt - (magit-changed-files rev-or-range) - default - (concat "No file changed in " rev-or-range))) - -(defun magit-get-revision-buffer (rev file &optional create) - (funcall (if create 'get-buffer-create 'get-buffer) - (format "%s.~%s~" file (if (equal rev "") "index" - (subst-char-in-string ?/ ?_ rev))))) - -(defun magit-get-revision-buffer-create (rev file) - (magit-get-revision-buffer rev file t)) - -(defun magit-revert-rev-file-buffer (_ignore-auto noconfirm) - (when (or noconfirm - (and (not (buffer-modified-p)) - (catch 'found - (dolist (regexp revert-without-query) - (when (string-match regexp magit-buffer-file-name) - (throw 'found t))))) - (yes-or-no-p (format "Revert buffer from git %s? " - (if (equal magit-buffer-refname "") "{index}" - (concat "revision " magit-buffer-refname))))) - (let* ((inhibit-read-only t) - (default-directory (magit-toplevel)) - (file (file-relative-name magit-buffer-file-name)) - (coding-system-for-read (or coding-system-for-read 'undecided))) - (erase-buffer) - (magit-git-insert "cat-file" "-p" (concat magit-buffer-refname ":" file)) - (setq buffer-file-coding-system last-coding-system-used)) - (let ((buffer-file-name magit-buffer-file-name) - (after-change-major-mode-hook - (remq 'global-diff-hl-mode-enable-in-buffers - after-change-major-mode-hook))) - (normal-mode t)) - (setq buffer-read-only t) - (set-buffer-modified-p nil) - (goto-char (point-min)))) - -(defun magit-find-file-noselect-1 (rev file hookvar &optional revert) - "Read FILE from REV into a buffer and return the buffer. -FILE must be relative to the top directory of the repository. -An empty REV stands for index." - (let ((topdir (magit-toplevel))) - (when (file-name-absolute-p file) - (setq file (file-relative-name file topdir))) - (with-current-buffer (magit-get-revision-buffer-create rev file) - (when (or (not magit-buffer-file-name) - (if (eq revert 'ask-revert) - (y-or-n-p (format "%s already exists; revert it? " - (buffer-name)))) - revert) - (setq magit-buffer-revision - (if (string= rev "") "{index}" (magit-rev-format "%H" rev)) - magit-buffer-refname rev - magit-buffer-file-name (expand-file-name file topdir)) - (setq default-directory (file-name-directory magit-buffer-file-name)) - (setq-local revert-buffer-function #'magit-revert-rev-file-buffer) - (revert-buffer t t) - (run-hooks hookvar)) - (current-buffer)))) - -(defvar magit-find-file-hook nil) -(add-hook 'magit-find-file-hook #'magit-blob-mode) - -(defun magit-find-file-noselect (rev file) - "Read FILE from REV into a buffer and return the buffer. -FILE must be relative to the top directory of the repository." - (magit-find-file-noselect-1 rev file 'magit-find-file-hook)) - -(defvar magit-find-index-hook nil) - -(defun magit-find-file-index-noselect (file &optional revert) - "Read FILE from the index into a buffer and return the buffer. -FILE must to be relative to the top directory of the repository." - (magit-find-file-noselect-1 "" file 'magit-find-index-hook - (or revert 'ask-revert))) - -(defun magit-update-index () - "Update the index with the contents of the current buffer. -The current buffer has to be visiting a file in the index, which -is done using `magit-find-index-noselect'." - (interactive) - (let ((file (magit-file-relative-name))) - (unless (equal magit-buffer-refname "") - (user-error "%s isn't visiting the index" file)) - (if (y-or-n-p (format "Update index with contents of %s" (buffer-name))) - (let ((index (make-temp-file "index")) - (buffer (current-buffer))) - (when magit-wip-before-change-mode - (magit-wip-commit-before-change (list file) " before un-/stage")) - (let ((coding-system-for-write buffer-file-coding-system)) - (with-temp-file index - (insert-buffer-substring buffer))) - (magit-with-toplevel - (magit-call-git "update-index" "--cacheinfo" - (substring (magit-git-string "ls-files" "-s" file) - 0 6) - (magit-git-string "hash-object" "-t" "blob" "-w" - (concat "--path=" file) - "--" index) - file)) - (set-buffer-modified-p nil) - (when magit-wip-after-apply-mode - (magit-wip-commit-after-apply (list file) " after un-/stage"))) - (message "Abort"))) - (--when-let (magit-mode-get-buffer 'magit-status-mode) - (with-current-buffer it (magit-refresh))) - t) - -;;;###autoload -(defun magit-dired-jump (&optional other-window) - "Visit file at point using Dired. -With a prefix argument, visit in another window. If there -is no file at point then instead visit `default-directory'." - (interactive "P") - (dired-jump other-window (-if-let (file (magit-file-at-point)) - (progn (setq file (expand-file-name file)) - (if (file-directory-p file) - (concat file "/.") - file)) - (concat default-directory "/.")))) - -;;;###autoload -(defun magit-checkout-file (rev file) - "Checkout FILE from REV." - (interactive - (let ((rev (magit-read-branch-or-commit - "Checkout from revision" magit-buffer-revision))) - (list rev (magit-read-file-from-rev rev "Checkout file")))) - (magit-with-toplevel - (magit-run-git "checkout" rev "--" file))) - -;;; Manipulate -;;;; Init - -;;;###autoload -(defun magit-init (directory) - "Initialize a Git repository, then show its status. - -If the directory is below an existing repository, then the user -has to confirm that a new one should be created inside. If the -directory is the root of the existing repository, then the user -has to confirm that it should be reinitialized. - -Non-interactively DIRECTORY is (re-)initialized unconditionally." - (interactive - (let ((directory (file-name-as-directory - (expand-file-name - (read-directory-name "Create repository in: "))))) - (-when-let (toplevel (magit-toplevel directory)) - (setq toplevel (expand-file-name toplevel)) - (unless (y-or-n-p (if (string-equal toplevel directory) - (format "Reinitialize existing repository %s? " - directory) - (format "%s is a repository. Create another in %s? " - toplevel directory))) - (user-error "Abort"))) - (list directory))) - ;; `git init' does not understand the meaning of "~"! - (magit-call-git "init" (magit-convert-filename-for-git - (expand-file-name directory))) - (magit-status-internal directory)) - -;;;; Branch -;;;;; Branch Popup - -;;;###autoload (autoload 'magit-branch-popup "magit" nil t) -(magit-define-popup magit-branch-popup - "Popup console for branch commands." - 'magit-commands - :man-page "git-branch" - :actions '((?b "Checkout" magit-checkout) - (?n "Create new branch" magit-branch) - (?C "Configure..." magit-branch-config-popup) - (?c "Checkout new branch" magit-branch-and-checkout) - (?s "Create new spin-off" magit-branch-spinoff) - (?m "Rename" magit-branch-rename) - (?w "Checkout new worktree" magit-worktree-checkout) - (?W "Create new worktree" magit-worktree-branch) - (?x "Reset" magit-branch-reset) nil nil - (?k "Delete" magit-branch-delete)) - :default-action 'magit-checkout - :max-action-columns 3 - :setup-function 'magit-branch-popup-setup) - -(defvar magit-branch-config-variables) - -(defun magit-branch-popup-setup (val def) - (magit-popup-default-setup val def) - (when magit-branch-popup-show-variables - (magit-popup-put :variables (magit-popup-convert-variables - val magit-branch-config-variables)) - (use-local-map (copy-keymap magit-popup-mode-map)) - (dolist (ev (-filter #'magit-popup-event-p (magit-popup-get :variables))) - (local-set-key (vector (magit-popup-event-key ev)) - 'magit-invoke-popup-action)))) - -;;;###autoload -(defun magit-checkout (revision) - "Checkout REVISION, updating the index and the working tree. -If REVISION is a local branch then that becomes the current -branch. If it is something else then `HEAD' becomes detached. -Checkout fails if the working tree or the staging area contain -changes. -\n(git checkout REVISION)." - (interactive (list (magit-read-other-branch-or-commit "Checkout"))) - (magit-run-git "checkout" revision)) - -;;;###autoload -(defun magit-branch (branch start-point &optional args) - "Create BRANCH at branch or revision START-POINT. -\n(git branch [ARGS] BRANCH START-POINT)." - (interactive (magit-branch-read-args "Create branch")) - (magit-call-git "branch" args branch start-point) - (magit-branch-maybe-adjust-upstream branch start-point) - (magit-refresh)) - -;;;###autoload -(defun magit-branch-and-checkout (branch start-point &optional args) - "Create and checkout BRANCH at branch or revision START-POINT. -\n(git checkout [ARGS] -b BRANCH START-POINT)." - (interactive (magit-branch-read-args "Create and checkout branch")) - (if (string-match-p "^stash@{[0-9]+}$" start-point) - (magit-run-git "stash" "branch" branch start-point) - (magit-call-git "checkout" args "-b" branch start-point) - (magit-branch-maybe-adjust-upstream branch start-point) - (magit-refresh))) - -(defun magit-branch-maybe-adjust-upstream (branch start-point) - (--when-let - (or (and (magit-get-upstream-branch branch) - (magit-get-indirect-upstream-branch start-point)) - (and (magit-remote-branch-p start-point) - (let ((name (cdr (magit-split-branch-name start-point)))) - (car (--first (if (listp (cdr it)) - (not (member name (cdr it))) - (string-match-p (cdr it) name)) - magit-branch-adjust-remote-upstream-alist))))) - (magit-call-git "branch" (concat "--set-upstream-to=" it) branch))) - -;;;###autoload -(defun magit-branch-orphan (branch start-point &optional args) - "Create and checkout an orphan BRANCH with contents from revision START-POINT. -\n(git checkout --orphan [ARGS] BRANCH START-POINT)." - (interactive (magit-branch-read-args "Create and checkout orphan branch")) - (magit-run-git "checkout" "--orphan" args branch start-point)) - -(defun magit-branch-read-args (prompt) - (let ((args (magit-branch-arguments))) - (if magit-branch-read-upstream-first - (let* ((default (and (or (memq this-command magit-no-confirm-default) - (memq magit-current-popup-action - magit-no-confirm-default)) - (magit--default-starting-point))) - (choice (or default - (magit-read-starting-point prompt)))) - (if (magit-rev-verify choice) - (list (magit-read-string-ns - (if default - (format "%s (starting at %s)" prompt choice) - "Branch name") - (let ((def (mapconcat #'identity - (cdr (split-string choice "/")) - "/"))) - (and (member choice (magit-list-remote-branch-names)) - (not (member def (magit-list-local-branch-names))) - def))) - choice args) - (if (eq magit-branch-read-upstream-first 'fallback) - (list choice - (magit-read-starting-point (concat prompt " " choice)) - args) - (user-error "Not a valid starting-point: %s" choice)))) - (let ((branch (magit-read-string-ns (concat prompt " named")))) - (list branch - (magit-read-starting-point (concat prompt " " branch)) - args))))) - -;;;###autoload -(defun magit-branch-spinoff (branch &optional from &rest args) - "Create new branch from the unpushed commits. - -Create and checkout a new branch starting at and tracking the -current branch. That branch in turn is reset to the last commit -it shares with its upstream. If the current branch has no -upstream or no unpushed commits, then the new branch is created -anyway and the previously current branch is not touched. - -This is useful to create a feature branch after work has already -began on the old branch (likely but not necessarily \"master\"). - -If the current branch is a member of the value of option -`magit-branch-prefer-remote-upstream' (which see), then the -current branch will be used as the starting point as usual, but -the upstream of the starting-point may be used as the upstream -of the new branch, instead of the starting-point itself. - -If optional FROM is non-nil, then the source branch is reset to -that commit, instead of to the last commit it shares with its -upstream. Interactively, FROM is non-nil, when the region -selects some commits, and among those commits, FROM it is the -commit that is the fewest commits ahead of the source branch. - -The commit at the other end of the selection actually does not -matter, all commits between FROM and `HEAD' are moved to the new -branch. If FROM is not reachable from `HEAD' or is reachable -from the source branch's upstream, then an error is raised." - (interactive (list (magit-read-string "Spin off branch") - (car (last (magit-region-values 'commit))) - (magit-branch-arguments))) - (when (magit-branch-p branch) - (user-error "Cannot spin off %s. It already exists" branch)) - (-if-let (current (magit-get-current-branch)) - (let ((tracked (magit-get-upstream-branch current)) - base) - (when from - (unless (magit-rev-ancestor-p from current) - (user-error "Cannot spin off %s. %s is not reachable from %s" - branch from current)) - (when (and tracked - (magit-rev-ancestor-p from tracked)) - (user-error "Cannot spin off %s. %s is ancestor of upstream %s" - branch from tracked))) - (magit-call-git "checkout" args "-b" branch current) - (--when-let (magit-get-indirect-upstream-branch current) - (magit-call-git "branch" "--set-upstream-to" it branch)) - (when (and tracked - (setq base - (if from - (concat from "^") - (magit-git-string "merge-base" current tracked))) - (not (magit-rev-eq base current))) - (magit-call-git "update-ref" "-m" - (format "reset: moving to %s" base) - (concat "refs/heads/" current) base)) - (magit-refresh)) - (magit-run-git "checkout" "-b" branch))) - -;;;###autoload -(defun magit-branch-reset (branch to &optional args set-upstream) - "Reset a branch to the tip of another branch or any other commit. - -When the branch being reset is the current branch, then do a -hard reset. If there are any uncommitted changes, then the user -has to confirming the reset because those changes would be lost. - -This is useful when you have started work on a feature branch but -realize it's all crap and want to start over. - -When resetting to another branch and a prefix argument is used, -then also set the target branch as the upstream of the branch -that is being reset." - (interactive - (let* ((atpoint (magit-branch-at-point)) - (branch (magit-read-local-branch "Reset branch" atpoint))) - (list branch - (magit-completing-read (format "Reset %s to" branch) - (delete branch (magit-list-branch-names)) - nil nil nil 'magit-revision-history - (or (and (not (equal branch atpoint)) atpoint) - (magit-get-upstream-branch branch))) - (magit-branch-arguments) - current-prefix-arg))) - (unless (member "--force" args) - (setq args (cons "--force" args))) - (if (equal branch (magit-get-current-branch)) - (if (and (magit-anything-modified-p) - (not (yes-or-no-p "Uncommitted changes will be lost. Proceed?"))) - (user-error "Abort") - (magit-reset-hard to) - (when (and set-upstream (magit-branch-p to)) - (magit-set-branch*merge/remote branch to))) - (magit-branch branch to args))) - -;;;###autoload -(defun magit-branch-delete (branches &optional force) - "Delete one or multiple branches. -If the region marks multiple branches, then offer to delete -those, otherwise prompt for a single branch to be deleted, -defaulting to the branch at point." - ;; One would expect this to be a command as simple as, for example, - ;; `magit-branch-rename'; but it turns out everyone wants to squeeze - ;; a bit of extra functionality into this one. And once it's there, - ;; you cannot remove it anymore. (I tried, it causes protests.) - (interactive - (let ((branches (magit-region-values 'branch)) - (force current-prefix-arg)) - (if (if (> (length branches) 1) - (magit-confirm t nil "Delete %i branches" branches) - (setq branches - (list (magit-read-branch (if current-prefix-arg - "Force delete branch" - "Delete branch") - (magit-get-previous-branch))))) - (unless force - (--when-let (-intersection - (-union (magit-list-unmerged-branches) - (magit-list-unmerged-to-upstream-branches)) - branches) - (if (magit-confirm 'delete-unmerged-branch - "Delete unmerged branch %s" - "Delete %i unmerged branches" it) - (setq force t) - (or (setq branches (-difference branches it)) - (user-error "Abort"))))) - (user-error "Abort")) - (list branches force))) - (let* ((refs (-map #'magit-ref-fullname branches)) - (ambiguous (--filter (not it) refs))) - (when ambiguous - (user-error - "%s ambiguous. Please cleanup using git directly." - (let ((len (length ambiguous))) - (cond - ((= len 1) - (format "%s is" (--first (not (magit-ref-fullname it)) branches))) - ((= len (length refs)) - (format "These %s names are" len)) - (t - (format "%s of these names are" len)))))) - (cond - ((string-match "^refs/remotes/\\([^/]+\\)" (car refs)) - (let* ((remote (match-string 1 (car refs))) - (offset (1+ (length remote)))) - ;; Assume the branches actually still exists on the remote. - (magit-run-git-async - "push" remote (--map (concat ":" (substring it offset)) branches)) - ;; If that is not the case, then this deletes the tracking branches. - (set-process-sentinel - magit-this-process - (apply-partially 'magit-delete-remote-branch-sentinel refs)))) - ((> (length branches) 1) - (magit-run-git "branch" (if force "-D" "-d") - (delete (magit-get-current-branch) branches))) - (t ; And now for something completely different. - (let* ((branch (car branches)) - (prompt (format "Branch %s is checked out. " branch))) - (when (equal branch (magit-get-current-branch)) - (pcase (if (or (equal branch "master") - (not (magit-rev-verify "master"))) - (magit-read-char-case prompt nil - (?d "[d]etach HEAD & delete" 'detach) - (?a "[a]bort" 'abort)) - (magit-read-char-case prompt nil - (?d "[d]etach HEAD & delete" 'detach) - (?c "[c]heckout master & delete" 'master) - (?a "[a]bort" 'abort))) - (`detach (magit-call-git "checkout" "--detach")) - (`master (magit-call-git "checkout" "master")) - (`abort (user-error "Abort"))) - (setq force t)) - (magit-run-git "branch" (if force "-D" "-d") branch)))))) - -(put 'magit-branch-delete 'interactive-only t) - -(defun magit-delete-remote-branch-sentinel (refs process event) - (when (memq (process-status process) '(exit signal)) - (if (= (process-exit-status process) 0) - (magit-process-sentinel process event) - (-if-let (rest (-filter #'magit-ref-exists-p refs)) - (progn - (process-put process 'inhibit-refresh t) - (magit-process-sentinel process event) - (setq magit-this-error nil) - (message "Some remote branches no longer exist. %s" - "Deleting just the local tracking refs instead...") - (--each rest (magit-call-git "update-ref" "-d" it)) - (magit-refresh) - (message "Deleting local remote-tracking refs...done")) - (magit-process-sentinel process event))))) - -;;;###autoload -(defun magit-branch-rename (old new &optional force) - "Rename branch OLD to NEW. -With prefix, forces the rename even if NEW already exists. -\n(git branch -m|-M OLD NEW)." - (interactive - (let ((branch (or (and (memq 'magit-branch-rename magit-no-confirm-default) - (or (magit-local-branch-at-point) - (magit-get-current-branch))) - (magit-read-local-branch "Rename branch")))) - (list branch - (magit-read-string-ns (format "Rename branch '%s' to" branch) - nil 'magit-revision-history) - current-prefix-arg))) - (unless (string= old new) - (magit-run-git "branch" (if force "-M" "-m") old new))) - -;;;;; Branch Config Popup - -(defvar magit-branch-config-branch nil) - -;;;###autoload -(defun magit-branch-config-popup (branch) - "Popup console for setting branch variables." - (interactive - (list (if (or current-prefix-arg - (and (eq magit-current-popup 'magit-branch-popup) - magit-branch-popup-show-variables)) - (magit-read-local-branch "Configure branch") - (magit-get-current-branch)))) - (let ((magit-branch-config-branch branch)) - (magit-invoke-popup 'magit-branch-config-popup nil nil))) - -(defvar magit-branch-config-variables - '((lambda () - (concat - (propertize "Configure " 'face 'magit-popup-heading) - (propertize (magit-branch-config-branch) 'face 'magit-branch-local))) - (?d "branch.%s.description" - magit-edit-branch*description - magit-format-branch*description) - (?u "branch.%s.merge" - magit-set-branch*merge/remote - magit-format-branch*merge/remote) - (?r "branch.%s.rebase" - magit-cycle-branch*rebase - magit-format-branch*rebase) - (?p "branch.%s.pushRemote" - magit-cycle-branch*pushRemote - magit-format-branch*pushRemote) - "Configure repository defaults" - (?\M-r "pull.rebase" - magit-cycle-pull.rebase - magit-format-pull.rebase) - (?\M-p "remote.pushDefault" - magit-cycle-remote.pushDefault - magit-format-remote.pushDefault) - "Configure branch creation" - (?U "branch.autoSetupMerge" - magit-cycle-branch*autoSetupMerge - magit-format-branch*autoSetupMerge) - (?R "branch.autoSetupRebase" - magit-cycle-branch*autoSetupRebase - magit-format-branch*autoSetupRebase))) - -(defvar magit-branch-config-popup - `(:man-page "git-branch" - :variables ,magit-branch-config-variables - :default-action magit-checkout - :setup-function magit-branch-config-popup-setup)) - -(defun magit-branch-config-popup-setup (val def) - (magit-popup-default-setup val def) - (setq-local magit-branch-config-branch magit-branch-config-branch) - (use-local-map (copy-keymap magit-popup-mode-map)) - (dolist (ev (-filter #'magit-popup-event-p (magit-popup-get :variables))) - (local-set-key (vector (magit-popup-event-key ev)) - 'magit-invoke-popup-action))) - -(defun magit-branch-config-branch (&optional prompt) - (if prompt - (or (and (not current-prefix-arg) - (or magit-branch-config-branch - (magit-get-current-branch))) - (magit-read-local-branch prompt)) - (or magit-branch-config-branch - (magit-get-current-branch) - ""))) - -;;;###autoload -(defun magit-edit-branch*description (branch) - "Edit the description of the current branch. -With a prefix argument edit the description of another branch. - -The description for the branch named NAME is stored in the Git -variable `branch..description'." - (interactive (list (magit-branch-config-branch "Edit branch description"))) - (magit-run-git-with-editor "branch" "--edit-description" branch)) - -(defun magit-edit-branch*description-check-buffers () - (and buffer-file-name - (string-match-p "/BRANCH_DESCRIPTION\\'" buffer-file-name) - (add-hook 'with-editor-post-finish-hook - (lambda () - (when (derived-mode-p 'magit-popup-mode) - (magit-refresh-popup-buffer))) - nil t))) - -(add-hook 'find-file-hook 'magit-edit-branch*description-check-buffers) - -(defun magit-format-branch*description () - (let* ((branch (magit-branch-config-branch)) - (width (+ (length branch) 19)) - (var (format "branch.%s.description" branch))) - (concat var " " (make-string (- width (length var)) ?\s) - (-if-let (value (magit-get var)) - (propertize value 'face 'magit-popup-option-value) - (propertize "unset" 'face 'magit-popup-disabled-argument))))) - -;;;###autoload -(defun magit-set-branch*merge/remote (branch upstream) - "Set or unset the upstream of the current branch. -With a prefix argument do so for another branch. - -When the branch in question already has an upstream then simply -unsets it. Invoke this command again to set another upstream. - -Together the Git variables `branch..remote' and -`branch..merge' define the upstream branch of the local -branch named NAME. The value of `branch..remote' is the -name of the upstream remote. The value of `branch..merge' -is the full reference of the upstream branch, on the remote. - -Non-interactively, when UPSTREAM is non-nil, then always set it -as the new upstream, regardless of whether another upstream was -already set. When nil, then always unset." - (interactive - (let ((branch (magit-branch-config-branch "Change upstream of branch"))) - (list branch (and (not (magit-get-upstream-branch branch)) - (magit-read-upstream-branch))))) - (if upstream - (-let (((remote . merge) (magit-split-branch-name upstream))) - (setf (magit-get (format "branch.%s.remote" branch)) remote) - (setf (magit-get (format "branch.%s.merge" branch)) - (concat "refs/heads/" merge))) - (magit-call-git "branch" "--unset-upstream" branch)) - (when (called-interactively-p 'any) - (magit-refresh))) - -(defun magit-format-branch*merge/remote () - (let* ((branch (magit-branch-config-branch)) - (width (+ (length branch) 20)) - (varM (format "branch.%s.merge" branch)) - (varR (format "branch.%s.remote" branch)) - (face (if (equal (magit-get varR) ".") - 'magit-branch-local - 'magit-branch-remote))) - (concat varM (make-string (- width (length varM)) ?\s) - (-if-let (value (magit-get varM)) - (propertize value 'face face) - (propertize "unset" 'face 'magit-popup-disabled-argument)) - "\n " varR (make-string (- width (length varR)) ?\s) - (-if-let (value (magit-get varR)) - (propertize value 'face face) - (propertize "unset" 'face 'magit-popup-disabled-argument))))) - -;;;###autoload -(defun magit-cycle-branch*rebase (branch) - "Cycle the value of `branch..rebase' for the current branch. -With a prefix argument cycle the value for another branch. - -The Git variables `branch..rebase' controls whether pulling -into the branch named NAME is done by rebasing that branch onto -the fetched branch or by merging that branch. - -When `true' then pulling is done by rebasing. -When `false' then pulling is done by merging. - -When that variable is undefined then the value of `pull.rebase' -is used instead. It defaults to `false'." - (interactive (list (magit-branch-config-branch - "Cycle branch..rebase for"))) - (magit-popup-set-variable (format "branch.%s.rebase" branch) - '("true" "false") - "false" "pull.rebase")) - -(defun magit-format-branch*rebase () - (let ((branch (magit-branch-config-branch))) - (magit-popup-format-variable (format "branch.%s.rebase" branch) - '("true" "false") - "false" "pull.rebase" - (+ (length branch) 20)))) - -;;;###autoload -(defun magit-cycle-branch*pushRemote (branch) - "Cycle the value of `branch..pushRemote' for the current branch. -With a prefix argument cycle the value for another branch. - -The Git variable `branch..pushRemote' specifies the remote -that the branch named NAME is usually pushed to. The value has -to be the name of an existing remote. - -If that variable is undefined, then the value of the Git variable -`remote.pushDefault' is used instead, provided that it is defined, -which by default it is not." - (interactive (list (magit-branch-config-branch - "Cycle branch..pushRemote for"))) - (magit-popup-set-variable (format "branch.%s.pushRemote" branch) - (magit-list-remotes) - "remote.pushDefault")) - -(defun magit-format-branch*pushRemote () - (let ((branch (magit-branch-config-branch))) - (magit-popup-format-variable (format "branch.%s.pushRemote" branch) - (magit-list-remotes) - nil "remote.pushDefault" - (+ (length branch) 20)))) - -;;;###autoload -(defun magit-cycle-pull.rebase () - "Cycle the repository-local value of `pull.rebase'. - -The Git variable `pull.rebase' specifies whether pulling is done -by rebasing or by merging. It can be overwritten using the Git -variable `branch..rebase'. - -When `true' then pulling is done by rebasing. -When `false' (the default) then pulling is done by merging." - (interactive) - (magit-popup-set-variable "pull.rebase" '("true" "false") "false")) - -(defun magit-format-pull.rebase () - (magit-popup-format-variable "pull.rebase" '("true" "false") "false" nil 19)) - -;;;###autoload -(defun magit-cycle-remote.pushDefault () - "Cycle the repository-local value of `remote.pushDefault'. - -The Git variable `remote.pushDefault' specifies the remote that -local branches are usually pushed to. It can be overwritten -using the Git variable `branch..pushRemote'." - (interactive) - (magit-popup-set-variable "remote.pushDefault" (magit-list-remotes))) - -(defun magit-format-remote.pushDefault () - (magit-popup-format-variable "remote.pushDefault" - (magit-list-remotes) nil nil 19)) - -;;;###autoload -(defun magit-cycle-branch*autoSetupMerge () - "Cycle the repository-local value of `branch.autoSetupMerge'. - -The Git variable `branch.autoSetupMerge' under what circumstances -creating a branch (named NAME) should result in the variables -`branch..merge' and `branch..remote' being set -according to the starting point used to create the branch. If -the starting point isn't a branch, then these variables are never -set. - -When `always' then the variables are set regardless of whether -the starting point is a local or a remote branch. - -When `true' (the default) then the variable are set when the -starting point is a remote branch, but not when it is a local -branch. - -When `false' then the variables are never set." - (interactive) - (magit-popup-set-variable "branch.autoSetupMerge" - '("always" "true" "false") "true")) - -(defun magit-format-branch*autoSetupMerge () - (magit-popup-format-variable "branch.autoSetupMerge" - '("always" "true" "false") "true" nil 23)) - -;;;###autoload -(defun magit-cycle-branch*autoSetupRebase () - "Cycle the repository-local value of `branch.autoSetupRebase'. - -The Git variable `branch.autoSetupRebase' specifies whether -creating a branch (named NAME) should result in the variable -`branch..rebase' being set to `true'. - -When `always' then the variable is set regardless of whether the -starting point is a local or a remote branch. - -When `local' then the variable are set when the starting point -is a local branch, but not when it is a remote branch. - -When `remote' then the variable are set when the starting point -is a remote branch, but not when it is a local branch. - -When `never' (the default) then the variable is never set." - (interactive) - (magit-popup-set-variable "branch.autoSetupRebase" - '("always" "local" "remote" "never") "never")) - -(defun magit-format-branch*autoSetupRebase () - (magit-popup-format-variable "branch.autoSetupRebase" - '("always" "local" "remote" "never") - "never" nil 23)) - -;;;; Merge - -;;;###autoload (autoload 'magit-merge-popup "magit" nil t) -(magit-define-popup magit-merge-popup - "Popup console for merge commands." - 'magit-commands - :man-page "git-merge" - :switches '((?f "Fast-forward only" "--ff-only") - (?n "No fast-forward" "--no-ff") - (?s "Squash" "--squash")) - :options '((?s "Strategy" "--strategy=")) - :actions '((?m "Merge" magit-merge) - (?e "Merge and edit message" magit-merge-editmsg) - (?p "Preview merge" magit-merge-preview) - (?n "Merge but don't commit" magit-merge-nocommit)) - :sequence-actions '((?m "Commit merge" magit-commit) - (?a "Abort merge" magit-merge-abort)) - :sequence-predicate 'magit-merge-state - :default-action 'magit-merge - :max-action-columns 2) - -;;;###autoload -(defun magit-merge (rev &optional args nocommit) - "Merge commit REV into the current branch; using default message. - -Unless there are conflicts or a prefix argument is used create a -merge commit using a generic commit message and without letting -the user inspect the result. With a prefix argument pretend the -merge failed to give the user the opportunity to inspect the -merge. - -\(git merge --no-edit|--no-commit [ARGS] REV)" - (interactive (list (magit-read-other-branch-or-commit "Merge") - (magit-merge-arguments) - current-prefix-arg)) - (magit-merge-assert) - (magit-run-git-async "merge" (if nocommit "--no-commit" "--no-edit") args rev)) - -;;;###autoload -(defun magit-merge-editmsg (rev &optional args) - "Merge commit REV into the current branch; and edit message. -Perform the merge and prepare a commit message but let the user -edit it. -\n(git merge --edit --no-ff [ARGS] rev)" - (interactive (list (magit-read-other-branch-or-commit "Merge") - (magit-merge-arguments))) - (magit-merge-assert) - (cl-pushnew "--no-ff" args :test #'equal) - (apply #'magit-run-git-with-editor "merge" "--edit" - (append args (list rev)))) - -;;;###autoload -(defun magit-merge-nocommit (rev &optional args) - "Merge commit REV into the current branch; pretending it failed. -Pretend the merge failed to give the user the opportunity to -inspect the merge and change the commit message. -\n(git merge --no-commit --no-ff [ARGS] rev)" - (interactive (list (magit-read-other-branch-or-commit "Merge") - (magit-merge-arguments))) - (magit-merge-assert) - (cl-pushnew "--no-ff" args :test #'equal) - (magit-run-git-async "merge" "--no-commit" args rev)) - -;;;###autoload -(defun magit-merge-preview (rev) - "Preview result of merging REV into the current branch." - (interactive (list (magit-read-other-branch-or-commit "Preview merge"))) - (magit-mode-setup #'magit-merge-preview-mode rev)) - -(define-derived-mode magit-merge-preview-mode magit-diff-mode "Magit Merge" - "Mode for previewing a merge." - :group 'magit-diff - (hack-dir-local-variables-non-file-buffer)) - -(defun magit-merge-preview-refresh-buffer (rev) - (let* ((branch (magit-get-current-branch)) - (head (or branch (magit-rev-verify "HEAD")))) - (setq header-line-format - (propertize (format "Preview merge of %s into %s" - rev (or branch "HEAD")) - 'face 'magit-header-line)) - (magit-insert-section (diffbuf) - (magit-git-wash #'magit-diff-wash-diffs - "merge-tree" (magit-git-string "merge-base" head rev) head rev)))) - -;;;###autoload -(defun magit-merge-abort () - "Abort the current merge operation. -\n(git merge --abort)" - (interactive) - (if (file-exists-p (magit-git-dir "MERGE_HEAD")) - (when (magit-confirm 'abort-merge) - (magit-run-git-async "merge" "--abort")) - (user-error "No merge in progress"))) - -(defun magit-checkout-stage (file arg) - "During a conflict checkout and stage side, or restore conflict." - (interactive - (let ((file (magit-completing-read "Checkout file" - (magit-tracked-files) nil nil nil - 'magit-read-file-hist - (magit-current-file)))) - (cond ((member file (magit-unmerged-files)) - (list file (magit-checkout-read-stage file))) - ((yes-or-no-p (format "Restore conflicts in %s? " file)) - (list file "--merge")) - (t - (user-error "Quit"))))) - (pcase (cons arg (cddr (car (magit-file-status file)))) - ((or `("--ours" ?D ,_) - `("--theirs" ,_ ?D)) - (magit-run-git "rm" "--" file)) - (_ (if (equal arg "--merge") - ;; This fails if the file was deleted on one - ;; side. And we cannot do anything about it. - (magit-run-git "checkout" "--merge" "--" file) - (magit-call-git "checkout" arg "--" file) - (magit-run-git "add" "-u" "--" file))))) - -(defun magit-merge-state () - (file-exists-p (magit-git-dir "MERGE_HEAD"))) - -(defun magit-merge-assert () - (or (not (magit-anything-modified-p)) - (magit-confirm 'merge-dirty - "Merging with dirty worktree is risky. Continue") - (user-error "Abort"))) - -(defun magit-checkout-read-stage (file) - (magit-read-char-case (format "For %s checkout: " file) t - (?o "[o]ur stage" "--ours") - (?t "[t]heir stage" "--theirs") - (?c "[c]onflict" "--merge"))) - -(defun magit-insert-merge-log () - "Insert section for the on-going merge. -Display the heads that are being merged. -If no merge is in progress, do nothing." - (-when-let (heads (mapcar 'magit-get-shortname - (magit-file-lines (magit-git-dir "MERGE_HEAD")))) - (magit-insert-section (commit (car heads)) - (magit-insert-heading - (format "Merging %s:" (mapconcat 'identity heads ", "))) - (magit-insert-log - (concat (magit-git-string "merge-base" "--octopus" "HEAD" (car heads)) - ".." (car heads)) - (let ((args magit-log-section-arguments)) - (unless (member "--decorate=full" magit-log-section-arguments) - (push "--decorate=full" args)) - args))))) - -;;;; Reset - -;;;###autoload (autoload 'magit-reset-popup "magit" nil t) -(magit-define-popup magit-reset-popup - "Popup console for reset commands." - 'magit-commands - :man-page "git-reset" - :actions '((?m "reset mixed (HEAD and index)" magit-reset-head) - (?s "reset soft (HEAD only)" magit-reset-soft) - (?h "reset hard (HEAD, index, and files)" magit-reset-hard) - (?i "reset index (index only)" magit-reset-index)) - :max-action-columns 1) - -;;;###autoload -(defun magit-reset-index (commit) - "Reset the index to COMMIT. -Keep the head and working tree as-is, so if COMMIT refers to the -head this effectively unstages all changes. -\n(git reset COMMIT .)" - (interactive (list (magit-read-branch-or-commit "Reset index to"))) - (magit-reset-internal nil commit ".")) - -;;;###autoload -(defun magit-reset (commit &optional hard) - "Reset the head and index to COMMIT, but not the working tree. -With a prefix argument also reset the working tree. -\n(git reset --mixed|--hard COMMIT)" - (interactive (list (magit-read-branch-or-commit - (if current-prefix-arg - "Hard reset to" - "Reset head to")) - current-prefix-arg)) - (magit-reset-internal (if hard "--hard" "--mixed") commit)) - -;;;###autoload -(defun magit-reset-head (commit) - "Reset the head and index to COMMIT, but not the working tree. -\n(git reset --mixed COMMIT)" - (interactive (list (magit-read-branch-or-commit "Reset head to"))) - (magit-reset-internal "--mixed" commit)) - -;;;###autoload -(defun magit-reset-soft (commit) - "Reset the head to COMMIT, but not the index and working tree. -\n(git reset --soft REVISION)" - (interactive (list (magit-read-branch-or-commit "Soft reset to"))) - (magit-reset-internal "--soft" commit)) - -;;;###autoload -(defun magit-reset-hard (commit) - "Reset the head, index, and working tree to COMMIT. -\n(git reset --hard REVISION)" - (interactive (list (magit-read-branch-or-commit "Hard reset to"))) - (magit-reset-internal "--hard" commit)) - -(defun magit-reset-internal (arg commit &optional path) - (when (and (not (member arg '("--hard" nil))) - (equal (magit-rev-parse commit) - (magit-rev-parse "HEAD~"))) - (with-temp-buffer - (magit-git-insert "show" "-s" "--format=%B" "HEAD") - (when git-commit-major-mode - (funcall git-commit-major-mode)) - (git-commit-setup-font-lock) - (git-commit-save-message))) - (let ((cmd (if (and (equal commit "HEAD") (not arg)) "unstage" "reset"))) - (magit-wip-commit-before-change nil (concat " before " cmd)) - (magit-run-git "reset" arg commit "--" path) - (when (equal cmd "unstage") - (magit-wip-commit-after-apply nil " after unstage")))) - -;;;; Files - -(defun magit-file-rename (file newname) - "Rename the FILE to NEWNAME. -If FILE isn't tracked in Git fallback to using `rename-file'." - (interactive - (let* ((file (magit-read-file "Rename file")) - (newname (read-file-name (format "Rename %s to file: " file)))) - (list (expand-file-name file (magit-toplevel)) - (expand-file-name newname)))) - (if (magit-file-tracked-p file) - (let ((oldbuf (get-file-buffer file))) - (when (and oldbuf (buffer-modified-p oldbuf)) - (user-error "Save %s before moving it" file)) - (when (file-exists-p newname) - (user-error "%s already exists" newname)) - (magit-run-git "mv" file newname) - (when oldbuf - (with-current-buffer oldbuf - (let ((buffer-read-only buffer-read-only)) - (set-visited-file-name newname)) - (if (fboundp 'vc-refresh-state) - (vc-refresh-state) - (with-no-warnings - (vc-find-file-hook)))))) - (rename-file file newname current-prefix-arg) - (magit-refresh))) - -(defun magit-file-untrack (file) - "Untrack FILE. -Stop tracking FILE in Git but do not remove it from the working -tree." - (interactive (list (magit-read-tracked-file "Untrack file"))) - (magit-run-git "rm" "--cached" "--" file)) - -(defun magit-file-delete (file &optional force) - "Delete FILE. -With a prefix argument FORCE do so even when FILE has uncommitted -changes. - -If FILE isn't tracked in Git fallback to using `delete-file'." - (interactive (list (magit-read-file "Delete file"))) - (if (magit-file-tracked-p file) - (magit-run-git "rm" (and force "--force") "--" file) - (delete-file (expand-file-name file (magit-toplevel)) t) - (magit-refresh))) - -(defun magit-read-tracked-file (prompt) - (magit-read-file prompt t)) - -(defun magit-read-file (prompt &optional tracked-only) - (let ((choices (nconc (magit-list-files) - (unless tracked-only (magit-untracked-files))))) - (magit-completing-read prompt choices nil t nil nil - (car (member (or (magit-section-when (file submodule)) - (magit-file-relative-name - nil tracked-only)) - choices))))) - -(defun magit-read-files (prompt initial-contents) - (mapconcat 'identity - (completing-read-multiple (or prompt "File,s: ") - (magit-list-files) - nil nil initial-contents) ",")) - -(defun magit-read-file-choice (prompt files &optional error default) - "Read file from FILES. - -If FILES has only one member, return that instead of prompting. -If FILES has no members, give a user error. ERROR can be given -to provide a more informative error. - -If DEFAULT is non-nil, use this as the default value instead of -`magit-current-file'." - (pcase (length files) - (0 (user-error (or error "No file choices"))) - (1 (car files)) - (_ (magit-completing-read - prompt files nil t nil 'magit-read-file-hist - (car (member (or default (magit-current-file)) files)))))) - -;;; Miscellaneous -;;;; Worktree - -;;;###autoload -(defun magit-worktree-checkout (path branch) - "Checkout BRANCH in a new worktree at PATH." - (interactive - (let ((branch (magit-read-local-branch "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)) - -;;;###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." - (interactive - `(,(read-directory-name "Create worktree: ") - ,@(butlast (magit-branch-read-args "Create and checkout branch")) - ,current-prefix-arg)) - (magit-run-git "worktree" "add" (if force "-B" "-b") - branch (expand-file-name path) start-point) - (magit-diff-visit-directory path)) - -(defun magit-worktree-delete (worktree) - "Delete a worktree, defaulting to the worktree at point. -The primary worktree cannot be deleted." - (interactive - (list (magit-completing-read "Delete worktree" - (cdr (magit-list-worktrees)) - nil t nil nil - (magit-section-when (worktree))))) - (if (file-directory-p (expand-file-name ".git" worktree)) - (user-error "Deleting %s would delete the shared .git directory" worktree) - (let ((primary (file-name-as-directory (caar (magit-list-worktrees))))) - (when (if magit-delete-by-moving-to-trash - (magit-confirm-files 'trash (list "worktree")) - (magit-confirm-files 'delete (list "worktree"))) - (let ((delete-by-moving-to-trash magit-delete-by-moving-to-trash)) - (delete-directory worktree t magit-delete-by-moving-to-trash)) - (if (file-exists-p default-directory) - (magit-run-git "worktree" "prune") - (let ((default-directory primary)) - (magit-run-git "worktree" "prune"))))))) - -(defun magit-worktree-status (worktree) - "Show the status for the worktree at point. -If there is no worktree at point, then read one in the -minibuffer. If the worktree at point is the one whose -status is already being displayed in the current buffer, -then show it in Dired instead." - (interactive - (list (or (magit-section-when (worktree)) - (magit-completing-read - "Show status for worktree" - (cl-delete (directory-file-name (magit-toplevel)) - (magit-list-worktrees) - :test #'equal :key #'car))))) - (magit-diff-visit-directory worktree)) - -(defvar magit-worktree-section-map - (let ((map (make-sparse-keymap))) - (define-key map [remap magit-visit-thing] 'magit-worktree-status) - (define-key map [remap magit-delete-thing] 'magit-worktree-delete) - map) - "Keymap for `worktree' sections.") - -(defun magit-insert-worktrees () - "Insert sections for all worktrees. -If there is only one worktree, then insert nothing." - (let ((worktrees (magit-list-worktrees))) - (when (> (length worktrees) 1) - (magit-insert-section (worktrees) - (magit-insert-heading "Worktrees:") - (let* ((cols - (mapcar (-lambda ((path barep commit branch)) - (cons (cond - (branch (propertize branch - 'face 'magit-branch-local)) - (commit (propertize (magit-rev-abbrev commit) - 'face 'magit-hash)) - (barep "(bare)")) - path)) - worktrees)) - (align (1+ (-max (--map (string-width (car it)) cols))))) - (pcase-dolist (`(,head . ,path) cols) - (magit-insert-section (worktree path) - (insert head) - (indent-to align) - (insert (let ((r (file-relative-name path)) - (a (abbreviate-file-name path))) - (if (< (string-width r) (string-width a)) r a))) - (insert ?\n)))) - (insert ?\n))))) - -;;;; Tag - -;;;###autoload (autoload 'magit-tag-popup "magit" nil t) -(magit-define-popup magit-tag-popup - "Popup console for tag 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. -With a prefix argument annotate the tag. -\n(git tag [--annotate] NAME REV)" - (interactive (list (magit-read-tag "Tag name") - (or (and (memq 'magit-tag magit-no-confirm-default) - (or (magit-branch-or-commit-at-point) - (magit-get-current-branch))) - (magit-read-branch-or-commit "Place tag on")) - (let ((args (magit-tag-arguments))) - (when current-prefix-arg - (cl-pushnew "--annotate" args)) - args))) - (magit-run-git-with-editor "tag" args name rev)) - -;;;###autoload -(defun magit-tag-delete (tags) - "Delete one or more tags. -If the region marks multiple tags (and nothing else), then offer -to delete those, otherwise prompt for a single tag to be deleted, -defaulting to the tag at point. -\n(git tag -d TAGS)" - (interactive (list (--if-let (magit-region-values 'tag) - (magit-confirm t nil "Delete %i tags" it) - (magit-read-tag "Delete tag" t)))) - (magit-run-git "tag" "-d" tags)) - -(defun magit-tag-prune (tags remote-tags remote) - "Offer to delete tags missing locally from REMOTE, and vice versa." - (interactive - (let* ((remote (magit-read-remote "Prune tags using remote")) - (tags (magit-list-tags)) - (rtags (prog2 (message "Determining remote tags...") - (magit-remote-list-tags remote) - (message "Determining remote tags...done"))) - (ltags (-difference tags rtags)) - (rtags (-difference rtags tags))) - (unless (or ltags rtags) - (message "Same tags exist locally and remotely")) - (unless (magit-confirm t "Delete %s locally" - "Delete %i tags locally" ltags) - (setq ltags nil)) - (unless (magit-confirm t "Delete %s from remote" - "Delete %i tags from remote" rtags) - (setq rtags nil)) - (list ltags rtags remote))) - (when tags - (magit-call-git "tag" "-d" tags)) - (when remote-tags - (magit-run-git-async "push" remote (--map (concat ":" it) remote-tags)))) - -;;;; Notes - -;;;###autoload (autoload 'magit-notes-popup "magit" nil t) -(magit-define-popup magit-notes-popup - "Popup console for notes commands." - 'magit-commands - :man-page "git-tag" - :switches '("Switch for prune" - (?n "Dry run" "--dry-run")) - :options '("Option for edit and remove" - (?r "Manipulate ref" "--ref=" magit-notes-popup-read-ref) - "Option for merge" - (?s "Merge strategy" "--strategy=")) - :actions '((?T "Edit" magit-notes-edit) - (?r "Remove" magit-notes-remove) - (?m "Merge" magit-notes-merge) - (?p "Prune" magit-notes-prune) - (?s "Set ref" magit-notes-set-ref) - (?S "Set display refs" magit-notes-set-display-refs)) - :sequence-actions '((?c "Commit merge" magit-notes-merge-commit) - (?a "Abort merge" magit-notes-merge-abort)) - :sequence-predicate 'magit-notes-merging-p - :default-action 'magit-notes-edit) - -(defun magit-notes-edit (commit &optional ref) - "Edit the note attached to COMMIT. -REF is the notes ref used to store the notes. - -Interactively or when optional REF is nil use the value of Git -variable `core.notesRef' or \"refs/notes/commits\" if that is -undefined." - (interactive (magit-notes-read-args "Edit notes")) - (magit-run-git-with-editor "notes" (and ref (concat "--ref=" ref)) - "edit" commit)) - -(defun magit-notes-remove (commit &optional ref) - "Remove the note attached to COMMIT. -REF is the notes ref from which the note is removed. - -Interactively or when optional REF is nil use the value of Git -variable `core.notesRef' or \"refs/notes/commits\" if that is -undefined." - (interactive (magit-notes-read-args "Remove notes")) - (magit-run-git-with-editor "notes" (and ref (concat "--ref=" ref)) - "remove" commit)) - -(defun magit-notes-merge (ref) - "Merge the notes ref REF into the current notes ref. - -The current notes ref is the value of Git variable -`core.notesRef' or \"refs/notes/commits\" if that is undefined. - -When there are conflict, then they have to resolved in the -temporary worktree \".git/NOTES_MERGE_WORKTREE\". When -done use `magit-notes-merge-commit' to finish. To abort -use `magit-notes-merge-abort'." - (interactive (list (magit-read-string-ns "Merge reference"))) - (magit-run-git-with-editor "notes" "merge" ref)) - -(defun magit-notes-merge-commit () - "Commit the current notes ref merge. -Also see `magit-notes-merge'." - (interactive) - (magit-run-git-with-editor "notes" "merge" "--commit")) - -(defun magit-notes-merge-abort () - "Abort the current notes ref merge. -Also see `magit-notes-merge'." - (interactive) - (magit-run-git-with-editor "notes" "merge" "--abort")) - -(defun magit-notes-prune (&optional dry-run) - "Remove notes about unreachable commits." - (interactive (list (and (member "--dry-run" (magit-notes-arguments)) t))) - (when dry-run - (magit-process-buffer)) - (magit-run-git-with-editor "notes" "prune" (and dry-run "--dry-run"))) - -(defun magit-notes-set-ref (ref &optional global) - "Set the current notes ref to REF. -The ref is made current by setting the value of the Git variable -`core.notesRef'. With a prefix argument GLOBAL change the global -value, else the value in the current repository. When this is -undefined, then \"refs/notes/commit\" is used. - -Other `magit-notes-*' commands, as well as the sub-commands -of Git's `note' command, default to operate on that ref." - (interactive - (list (magit-completing-read "Set notes ref" - (nconc (list "refs/" "refs/notes/") - (magit-list-notes-refnames)) - nil nil - (--when-let (magit-get "core.notesRef") - (if (string-match "^refs/notes/\\(.+\\)" it) - (match-string 1 it) - it))) - current-prefix-arg)) - (if ref - (magit-run-git "config" (and global "--global") "core.notesRef" - (if (string-prefix-p "refs/" ref) - ref - (concat "refs/notes/" ref))) - (magit-run-git "config" (and global "--global") - "--unset" "core.notesRef"))) - -(defun magit-notes-set-display-refs (refs &optional global) - "Set notes refs to be display in addition to \"core.notesRef\". -REFS is a colon separated list of notes refs. The values are -stored in the Git variable `notes.displayRef'. With a prefix -argument GLOBAL change the global values, else the values in -the current repository." - (interactive - (list (magit-completing-read "Set additional notes ref(s)" - (nconc (list "refs/" "refs/notes/") - (magit-list-notes-refnames)) - nil nil - (mapconcat #'identity - (magit-get-all "notes.displayRef") - ":")) - current-prefix-arg)) - (when (and refs (atom refs)) - (setq refs (split-string refs ":"))) - (when global - (setq global "--global")) - (magit-git-success "config" "--unset-all" global "notes.displayRef") - (dolist (ref refs) - (magit-call-git "config" "--add" global "notes.displayRef" ref)) - (magit-refresh)) - -(defun magit-notes-read-args (prompt) - (list (magit-read-branch-or-commit prompt) - (--when-let (--first (string-match "^--ref=\\(.+\\)" it) - (magit-notes-arguments)) - (match-string 1 it)))) - -(defun magit-notes-popup-read-ref (prompt &optional initial-input) - (magit-completing-read prompt (nconc (list "refs/" "refs/notes/") - (magit-list-notes-refnames)) - nil nil initial-input)) - -(defun magit-notes-merging-p () - (let ((dir (magit-git-dir "NOTES_MERGE_WORKTREE"))) - (and (file-directory-p dir) - (directory-files dir nil "^[^.]")))) - -;;;; Config Files - -(defun magit-find-git-config-file (filename &optional wildcards) - "Edit a located in the current repository's git directory. - -When \".git\", located at the root of the working tree, is a -regular file, then that makes it cumbersome to open a file -located in the actual git directory. - -This command is like `find-file', except that it temporarily -binds `default-directory' to the actual git directory, while -reading the FILENAME." - (interactive - (let ((default-directory (magit-git-dir))) - (find-file-read-args "Find file: " - (confirm-nonexistent-file-or-buffer)))) - (find-file filename wildcards)) - -(defun magit-find-git-config-file-other-window (filename &optional wildcards) - "Edit a located in the current repository's git directory, in another window. - -When \".git\", located at the root of the working tree, is a -regular file, then that makes it cumbersome to open a file -located in the actual git directory. - -This command is like `find-file-other-window', except that it -temporarily binds `default-directory' to the actual git -directory, while reading the FILENAME." - (interactive - (let ((default-directory (magit-git-dir))) - (find-file-read-args "Find file in other window: " - (confirm-nonexistent-file-or-buffer)))) - (find-file-other-window filename wildcards)) - -(defun magit-find-git-config-file-other-frame (filename &optional wildcards) - "Edit a located in the current repository's git directory, in another frame. - -When \".git\", located at the root of the working tree, is a -regular file, then that makes it cumbersome to open a file -located in the actual git directory. - -This command is like `find-file-other-frame', except that it -temporarily binds `default-directory' to the actual git -directory, while reading the FILENAME." - (interactive - (let ((default-directory (magit-git-dir))) - (find-file-read-args "Find file in other frame: " - (confirm-nonexistent-file-or-buffer)))) - (find-file-other-frame filename wildcards)) - -;;;; File Mode - -(defvar magit-file-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-xg" 'magit-status) - (define-key map "\C-x\M-g" 'magit-dispatch-popup) - (define-key map "\C-c\M-g" 'magit-file-popup) - map) - "Keymap for `magit-file-mode'.") - -;;;###autoload (autoload 'magit-file-popup "magit" nil t) -(magit-define-popup magit-file-popup - "Popup console for Magit commands in file-visiting buffers." - :actions '((?s "Stage" magit-stage-file) - (?d "Diff" magit-diff-buffer-file) - (?l "Log" magit-log-buffer-file) - (?b "Blame" magit-blame-popup) - (?u "Unstage" magit-unstage-file) - (?D "Diff..." magit-diff-buffer-file-popup) - (?L "Log..." magit-log-buffer-file-popup) - (?p "Find blob" magit-blob-previous) - (?c "Commit" magit-commit-popup)) - :max-action-columns 4) - -(defvar magit-file-mode-lighter "") - -(define-minor-mode magit-file-mode - "Enable some Magit features in file-visiting buffers. - -Currently this only adds the following key bindings. -\n\\{magit-file-mode-map}" - :package-version '(magit . "2.2.0") - :lighter magit-file-mode-lighter - :keymap magit-file-mode-map) - -(defun magit-file-mode-turn-on () - (and buffer-file-name - (ignore-errors (magit-inside-worktree-p)) - (magit-file-mode))) - -;;;###autoload -(define-globalized-minor-mode global-magit-file-mode - magit-file-mode magit-file-mode-turn-on - :package-version '(magit . "2.2.0") - :group 'magit-modes) - -;;;; Blob Mode - -(defvar magit-blob-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "n" 'magit-blob-next) - (define-key map "p" 'magit-blob-previous) - (define-key map "q" 'magit-kill-this-buffer) - map) - "Keymap for `magit-blob-mode'.") - -(define-minor-mode magit-blob-mode - "Enable some Magit features in blob-visiting buffers. - -Currently this only adds the following key bindings. -\n\\{magit-blob-mode-map}" - :package-version '(magit . "2.3.0")) - -(defun magit-blob-next () - "Visit the next blob which modified the current file." - (interactive) - (if magit-buffer-file-name - (magit-blob-visit (or (magit-blob-successor magit-buffer-revision - magit-buffer-file-name) - magit-buffer-file-name) - (line-number-at-pos)) - (if (buffer-file-name (buffer-base-buffer)) - (user-error "You have reached the end of time") - (user-error "Buffer isn't visiting a file or blob")))) - -(defun magit-blob-previous () - "Visit the previous blob which modified the current file." - (interactive) - (-if-let (file (or magit-buffer-file-name - (buffer-file-name (buffer-base-buffer)))) - (--if-let (magit-blob-ancestor magit-buffer-revision file) - (magit-blob-visit it (line-number-at-pos)) - (user-error "You have reached the beginning of time")) - (user-error "Buffer isn't visiting a file or blob"))) - -(defun magit-blob-visit (blob-or-file line) - (if (stringp blob-or-file) - (find-file blob-or-file) - (-let [(rev file) blob-or-file] - (magit-find-file rev file) - (let ((str (magit-rev-format "%ct%s" rev))) - (message "%s (%s ago)" (substring str 10) - (magit-format-duration - (abs (truncate (- (float-time) - (string-to-number - (substring str 0 10))))) - magit-duration-spec))))) - (goto-char (point-min)) - (forward-line (1- line))) - -(defun magit-blob-ancestor (rev file) - (let ((lines (magit-with-toplevel - (magit-git-lines "log" "-2" "--format=%H" "--name-only" - "--follow" (or rev "HEAD") "--" file)))) - (if rev (cddr lines) (butlast lines 2)))) - -(defun magit-blob-successor (rev file) - (let ((lines (magit-with-toplevel - (magit-git-lines "log" "--format=%H" "--name-only" "--follow" - "HEAD" "--" file)))) - (catch 'found - (while lines - (if (equal (nth 2 lines) rev) - (throw 'found (list (nth 0 lines) (nth 1 lines))) - (setq lines (nthcdr 2 lines))))))) - -(defun magit-kill-this-buffer () - "Kill the current buffer." - (interactive) - (kill-buffer (current-buffer))) - -;;;; Dispatch Popup - -;;;###autoload (autoload 'magit-dispatch-popup "magit" nil t) -(magit-define-popup magit-dispatch-popup - "Popup console for dispatching other popups." - 'magit-commands nil nil - :actions '("Popup and dwim commands" - (?A "Cherry-picking" magit-cherry-pick-popup) - (?b "Branching" magit-branch-popup) - (?B "Bisecting" magit-bisect-popup) - (?c "Committing" magit-commit-popup) - (?d "Diffing" magit-diff-popup) - (?D "Change diffs" magit-diff-refresh-popup) - (?e "Ediff dwimming" magit-ediff-dwim) - (?E "Ediffing" magit-ediff-popup) - (?f "Fetching" magit-fetch-popup) - (?F "Pulling" magit-pull-popup) - (?l "Logging" magit-log-popup) - (?L "Change logs" magit-log-refresh-popup) - (?m "Merging" magit-merge-popup) - (?M "Remoting" magit-remote-popup) - (?o "Submodules" magit-submodule-popup) - (?O "Subtrees" magit-subtree-popup) - (?P "Pushing" magit-push-popup) - (?r "Rebasing" magit-rebase-popup) - (?t "Tagging" magit-tag-popup) - (?T "Notes" magit-notes-popup) - (?V "Reverting" magit-revert-popup) - (?w "Apply patches" magit-am-popup) - (?W "Format patches" magit-patch-popup) - (?X "Resetting" magit-reset-popup) - (?y "Show Refs" magit-show-refs-popup) - (?z "Stashing" magit-stash-popup) - (?! "Running" magit-run-popup) - "Applying changes" - (?a "Apply" magit-apply) - (?s "Stage" magit-stage) - (?u "Unstage" magit-unstage) - nil - (?v "Reverse" magit-reverse) - (?S "Stage all" magit-stage-modified) - (?U "Unstage all" magit-unstage-all) - nil - (?k "Discard" magit-discard) - "\ - g refresh current buffer - TAB toggle section at point - RET visit thing at point - - C-h m show all key bindings" nil) - :max-action-columns 4) - -;;;; Git Popup - -(defvar magit-git-command-history nil) - -;;;###autoload (autoload 'magit-run-popup "magit" nil t) -(magit-define-popup magit-run-popup - "Popup console for running raw Git commands." - 'magit-commands nil nil - :actions '((?! "Git Subcommand (in topdir)" magit-git-command-topdir) - (?k "Gitk" magit-run-gitk) - (?p "Git Subcommand (in pwd)" magit-git-command) - (?a "Gitk --all" magit-run-gitk-all) - (?s "Shell command (in topdir)" magit-shell-command-topdir) - (?b "Gitk --branches" magit-run-gitk-branches) - (?S "Shell command (in pwd)" magit-shell-command) - (?g "Git Gui" magit-run-git-gui)) - :default-action 'magit-git-command - :max-action-columns 2) - -;;;###autoload -(defun magit-git-command (args directory) - "Execute a Git subcommand asynchronously, displaying the output. -With a prefix argument run Git in the root of the current -repository, otherwise in `default-directory'." - (interactive (magit-read-shell-command "Git subcommand (pwd: %s)")) - (require 'eshell) - (with-temp-buffer - (insert args) - (setq args (mapcar 'eval (eshell-parse-arguments (point-min) - (point-max)))) - (setq default-directory directory) - (let ((magit-git-global-arguments - ;; A human will want globbing by default. - (remove "--literal-pathspecs" - magit-git-global-arguments))) - (magit-run-git-async args))) - (magit-process-buffer)) - -;;;###autoload -(defun magit-git-command-topdir (args directory) - "Execute a Git subcommand asynchronously, displaying the output. -Run Git in the top-level directory of the current repository. -\n(fn)" ; arguments are for internal use - (interactive (magit-read-shell-command "Git subcommand (pwd: %s)" t)) - (magit-git-command args directory)) - -;;;###autoload -(defun magit-shell-command (args directory) - "Execute a shell command asynchronously, displaying the output. -With a prefix argument run the command in the root of the current -repository, otherwise in `default-directory'." - (interactive (magit-read-shell-command "Shell command (pwd: %s)")) - (require 'eshell) - (with-temp-buffer - (insert args) - (setq args (mapcar 'eval (eshell-parse-arguments (point-min) - (point-max)))) - (setq default-directory directory) - (apply #'magit-start-process (car args) nil (cdr args))) - (magit-process-buffer)) - -;;;###autoload -(defun magit-shell-command-topdir (args directory) - "Execute a shell command asynchronously, displaying the output. -Run the command in the top-level directory of the current repository. -\n(fn)" ; arguments are for internal use - (interactive (magit-read-shell-command "Shell command (pwd: %s)" t)) - (magit-shell-command args directory)) - -(defun magit-read-shell-command (prompt &optional root) - (let ((dir (if (or root current-prefix-arg) - (or (magit-toplevel) - (user-error "Not inside a Git repository")) - default-directory))) - (list (magit-read-string (format prompt (abbreviate-file-name dir)) - nil 'magit-git-command-history) - dir))) - -;;;; Repository List - -;;;###autoload -(defun magit-list-repositories () - "Display a list of repositories. - -Use the options `magit-repository-directories' -and `magit-repository-directories-depth' to -control which repositories are displayed." - (interactive) - (if magit-repository-directories - (with-current-buffer (get-buffer-create "*Magit Repositories*") - (magit-repolist-mode) - (setq tabulated-list-entries - (mapcar (-lambda ((id . path)) - (let ((default-directory path)) - (list path - (vconcat (--map (or (funcall (nth 2 it) id) "") - magit-repolist-columns))))) - (magit-list-repos-uniquify - (--map (cons (file-name-nondirectory (directory-file-name it)) - it) - (magit-list-repos))))) - (tabulated-list-print) - (switch-to-buffer (current-buffer))) - (message "You need to customize `magit-repository-directories' %s" - "before you can list repositories"))) - -(defvar magit-repolist-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map tabulated-list-mode-map) - (define-key map "g" 'magit-list-repositories) - (define-key map "\r" 'magit-repolist-status) - map) - "Local keymap for Magit-Repolist mode buffers.") - -(defun magit-repolist-status (&optional _button) - "Show the status for the repository at point." - (interactive) - (--if-let (tabulated-list-get-id) - (magit-status-internal (expand-file-name it)) - (user-error "There is no repository at point"))) - -(define-derived-mode magit-repolist-mode tabulated-list-mode "Repos" - "Major mode for browsing a list of Git repositories." - (setq x-stretch-cursor nil) - (setq tabulated-list-padding 0) - (setq tabulated-list-sort-key (cons "Name" nil)) - (setq tabulated-list-format - (vconcat (mapcar (-lambda ((title width _fn props)) - (nconc (list title width t) - (-flatten props))) - magit-repolist-columns))) - (tabulated-list-init-header)) - -(defun magit-repolist-column-ident (id) - "Insert the identification of the repository. -Usually this is just its basename." - id) - -(defun magit-repolist-column-path (_id) - "Insert the absolute path of the repository." - (abbreviate-file-name default-directory)) - -(defun magit-repolist-column-version (_id) - "Insert a description of the repository's `HEAD' revision." - (let ((v (or (magit-git-string "describe" "--tags") - ;; 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")))) - (if (and v (string-match-p "\\`[0-9]" v)) - (concat " " v) - v))) - -(defun magit-repolist-column-branch (_id) - "Insert the current branch." - (magit-get-current-branch)) - -(defun magit-repolist-column-upstream (_id) - "Insert the upstream branch of the current branch." - (magit-get-current-branch)) - -(defun magit-repolist-column-unpulled-from-upstream (_id) - "Insert number of upstream commits not in the current branch." - (--when-let (magit-get-upstream-branch) - (let ((n (cadr (magit-rev-diff-count "HEAD" it)))) - (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow))))) - -(defun magit-repolist-column-unpulled-from-pushremote (_id) - "Insert number of commits in the push branch but not the current branch." - (--when-let (magit-get-push-branch) - (when (magit-rev-verify it) - (let ((n (cadr (magit-rev-diff-count "HEAD" it)))) - (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow)))))) - -(defun magit-repolist-column-unpushed-to-upstream (_id) - "Insert number of commits in the current branch but not its upstream." - (--when-let (magit-get-upstream-branch) - (let ((n (car (magit-rev-diff-count "HEAD" it)))) - (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow))))) - -(defun magit-repolist-column-unpushed-to-pushremote (_id) - "Insert number of commits in the current branch but not its push branch." - (--when-let (magit-get-push-branch) - (when (magit-rev-verify it) - (let ((n (car (magit-rev-diff-count "HEAD" it)))) - (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow)))))) - -(defun magit-read-repository (&optional read-directory-name) - "Read a Git repository in the minibuffer, with completion. - -The completion choices are the basenames of top-levels of -repositories found in the directories specified by option -`magit-repository-directories'. In case of name conflicts -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 (and (not read-directory-name) magit-repository-directories) - (let* ((repos (magit-list-repos-uniquify - (--map (cons (file-name-nondirectory - (directory-file-name it)) - it) - (magit-list-repos)))) - (reply (magit-completing-read "Git repository" repos))) - (file-name-as-directory - (or (cdr (assoc reply repos)) - (if (file-directory-p reply) - (expand-file-name reply) - (user-error "Not a repository or a directory: %s" reply))))) - (file-name-as-directory - (read-directory-name "Git repository: " - (or (magit-toplevel) default-directory))))) - -(defun magit-list-repos () - (--mapcat (if (consp it) - (magit-list-repos-1 (car it) (cdr it)) - (magit-list-repos-1 it magit-repository-directories-depth)) - magit-repository-directories)) - -(defun magit-list-repos-1 (directory depth) - (cond ((file-readable-p (expand-file-name ".git" directory)) - (list directory)) - ((and (> depth 0) (magit-file-accessible-directory-p directory)) - (--mapcat (and (file-directory-p it) - (magit-list-repos-1 it (1- depth))) - (directory-files directory t - directory-files-no-dot-files-regexp t))))) - -(defun magit-list-repos-uniquify (alist) - (let (result (dict (make-hash-table :test 'equal))) - (dolist (a (delete-dups alist)) - (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) - (maphash - (lambda (key value) - (if (= (length value) 1) - (push (cons key (car value)) result) - (setq result - (append result - (magit-list-repos-uniquify - (--map (cons (concat - key "\\" - (file-name-nondirectory - (directory-file-name - (substring it 0 (- (1+ (length key))))))) - it) - value)))))) - dict) - result)) - -;;;; Revision Stack - -(defvar magit-revision-stack nil) - -(defcustom magit-pop-revision-stack-format - '("[%N: %h] " "%N: %H\n %s\n" "\\[\\([0-9]+\\)[]:]") - "Control how `magit-pop-revision-stack' inserts a revision. - -The command `magit-pop-revision-stack' inserts a representation -of the revision last pushed to the `magit-revision-stack' into -the current buffer. It inserts text at point and/or near the end -of the buffer, and removes the consumed revision from the stack. - -The entries on the stack have the format (HASH TOPLEVEL) and this -option has the format (POINT-FORMAT EOB-FORMAT INDEX-REGEXP), all -of which may be nil or a string (though either one of EOB-FORMAT -or POINT-FORMAT should be a string, and if INDEX-REGEXP is -non-nil, then the two formats should be too). - -First INDEX-REGEXP is used to find the previously inserted entry, -by searching backward from point. The first submatch must match -the index number. That number is incremented by one, and becomes -the index number of the entry to be inserted. If you don't want -to number the inserted revisions, then use nil for INDEX-REGEXP. - -If INDEX-REGEXP is non-nil then both POINT-FORMAT and EOB-FORMAT -should contain \"%N\", which is replaced with the number that was -determined in the previous step. - -Both formats, if non-nil and after removing %N, are then expanded -using `git show --format=FORMAT ...' inside TOPLEVEL. - -The expansion of POINT-FORMAT is inserted at point, and the -expansion of EOB-FORMAT is inserted at the end of the buffer (if -the buffer ends with a comment, then it is inserted right before -that)." - :package-version '(magit . "2.3.0") - :group 'magit-commands - :type '(list (choice (string :tag "Insert at point format") - (cons (string :tag "Insert at point format") - (repeat (string :tag "Argument to git show"))) - (const :tag "Don't insert at point" nil)) - (choice (string :tag "Insert at eob format") - (cons (string :tag "Insert at eob format") - (repeat (string :tag "Argument to git show"))) - (const :tag "Don't insert at eob" nil)) - (choice (regexp :tag "Find index regexp") - (const :tag "Don't number entries" nil)))) - -(defun magit-pop-revision-stack (rev toplevel) - "Insert a representation of a revision into the current buffer. - -Pop a revision from the `magit-revision-stack' and insert it into -the current buffer according to `magit-pop-revision-stack-format'. -Revisions can be put on the stack using `magit-copy-section-value' -and `magit-copy-buffer-revision'. - -If the stack is empty or with a prefix argument instead read a -revision in the minibuffer. By using the minibuffer history this -allows selecting an item which was popped earlier or to insert an -arbitrary reference or revision without first pushing it onto the -stack. - -When reading the revision from the minibuffer, then it might not -be possible to guess the correct repository. When this command -is called inside a repository (e.g. while composing a commit -message), then that repository is used. Otherwise (e.g. while -composing an email) then the repository recorded for the top -element of the stack is used (even though we insert another -revision). If not called inside a repository and with an empty -stack, or with two prefix arguments, then read the repository in -the minibuffer too." - (interactive - (if (or current-prefix-arg (not magit-revision-stack)) - (let ((default-directory - (or (and (not (= (prefix-numeric-value current-prefix-arg) 16)) - (or (magit-toplevel) - (cadr (car magit-revision-stack)))) - (magit-read-repository)))) - (list (magit-read-branch-or-commit "Insert revision") - default-directory)) - (push (caar magit-revision-stack) magit-revision-history) - (pop magit-revision-stack))) - (if rev - (-let [(pnt-format eob-format idx-format) magit-pop-revision-stack-format] - (let ((default-directory toplevel) - (idx (and idx-format - (save-excursion - (if (re-search-backward idx-format nil t) - (number-to-string - (1+ (string-to-number (match-string 1)))) - "1")))) - pnt-args eob-args) - (when (listp pnt-format) - (setq pnt-args (cdr pnt-format) - pnt-format (car pnt-format))) - (when (listp eob-format) - (setq eob-args (cdr eob-format) - eob-format (car eob-format))) - (when pnt-format - (when idx-format - (setq pnt-format - (replace-regexp-in-string "%N" idx pnt-format t t))) - (magit-rev-insert-format pnt-format rev pnt-args) - (backward-delete-char 1)) - (when eob-format - (when idx-format - (setq eob-format - (replace-regexp-in-string "%N" idx eob-format t t))) - (save-excursion - (goto-char (point-max)) - (skip-syntax-backward ">s-") - (beginning-of-line) - (if (and comment-start (looking-at comment-start)) - (while (looking-at comment-start) - (forward-line -1)) - (forward-line) - (unless (= (current-column) 0) - (insert ?\n))) - (insert ?\n) - (magit-rev-insert-format eob-format rev eob-args) - (backward-delete-char 1))))) - (user-error "Revision stack is empty"))) - -(define-key git-commit-mode-map - (kbd "C-c C-w") 'magit-pop-revision-stack) - -(defun magit-copy-section-value () - "Save the value of the current section for later use. - -Save the section value to the `kill-ring', and, provided that -the current section is a commit, branch, or tag section, push -the (referenced) revision to the `magit-revision-stack' for use -with `magit-pop-revision-stack'. - -When the current section is a branch or a tag, and a prefix -argument is used, then save the revision at its tip to the -`kill-ring' instead of the reference name. - -When the region is active, then save that to the `kill-ring', -like `kill-ring-save' would, instead of behaving as described -above." - (interactive) - (if (use-region-p) - (copy-region-as-kill nil nil 'region) - (-when-let* ((section (magit-current-section)) - (value (magit-section-value section))) - (magit-section-case - ((branch commit module-commit tag) - (let ((default-directory default-directory) ref) - (magit-section-case - ((branch tag) - (setq ref value)) - (module-commit - (setq default-directory - (file-name-as-directory - (expand-file-name (magit-section-parent-value section) - (magit-toplevel)))))) - (setq value (magit-rev-parse value)) - (push (list value default-directory) magit-revision-stack) - (kill-new (message "%s" (or (and current-prefix-arg ref) - value))))) - (t (kill-new (message "%s" value))))))) - -(defun magit-copy-buffer-revision () - "Save the revision of the current buffer for later use. - -Save the revision shown in the current buffer to the `kill-ring' -and push it to the `magit-revision-stack'. - -This command is mainly intended for use in `magit-revision-mode' -buffers, the only buffers where it is always unambiguous exactly -which revision should be saved. - -Most other Magit buffers usually show more than one revision, in -some way or another, so this command has to select one of them, -and that choice might not always be the one you think would have -been the best pick. - -In such buffers it is often more useful to save the value of -the current section instead, using `magit-copy-section-value'. - -When the region is active, then save that to the `kill-ring', -like `kill-ring-save' would, instead of behaving as described -above." - (interactive) - (if (use-region-p) - (copy-region-as-kill nil nil 'region) - (-when-let (rev (cond ((memq major-mode '(magit-cherry-mode - magit-log-select-mode - magit-reflog-mode - magit-refs-mode - magit-revision-mode - magit-stash-mode - magit-stashes-mode)) - (car magit-refresh-args)) - ((memq major-mode '(magit-diff-mode - magit-log-mode)) - (let ((r (caar magit-refresh-args))) - (if (string-match "\\.\\.\\.?\\(.+\\)" r) - (match-string 1 r) - r))) - ((eq major-mode 'magit-status-mode) "HEAD"))) - (when (magit-rev-verify-commit rev) - (setq rev (magit-rev-parse rev)) - (push (list rev default-directory) magit-revision-stack) - (kill-new (message "%s" rev)))))) - -;;; magit.el ends soon - -(defconst magit-font-lock-keywords - (eval-when-compile - `((,(concat "(\\(magit-define-section-jumper\\)\\_>" - "[ \t'\(]*" - "\\(\\(?:\\sw\\|\\s_\\)+\\)?") - (1 'font-lock-keyword-face) - (2 'font-lock-function-name-face nil t)) - (,(concat "(" (regexp-opt '("magit-insert-section" - "magit-section-case" - "magit-section-when" - "magit-bind-match-strings" - "magit-with-temp-index" - "magit-with-blob" - "magit-with-toplevel") t) - "\\_>") - . 1)))) - -(font-lock-add-keywords 'emacs-lisp-mode magit-font-lock-keywords) - -(defvar magit-version 'undefined - "The version of Magit that you're using. -Use the function by the same name instead of this variable.") - -;;;###autoload -(defun magit-version () - "Return the version of Magit currently in use. -When called interactive also show the used versions of Magit, -Git, and Emacs in the echo area." - (interactive) - (let ((magit-git-global-arguments nil) - (toplib (or load-file-name buffer-file-name)) - debug) - (unless (and toplib - (equal (file-name-nondirectory toplib) "magit.el")) - (setq toplib (locate-library "magit.el"))) - (push toplib debug) - (when toplib - (let* ((topdir (file-name-directory toplib)) - (gitdir (expand-file-name - ".git" (file-name-directory - (directory-file-name topdir)))) - (static (locate-library "magit-version.el" nil (list topdir)))) - (or (progn - (push 'repo debug) - (when (and (file-exists-p gitdir) - ;; It is a repo, but is it the Magit repo? - (file-exists-p - (expand-file-name "../lisp/magit.el" gitdir))) - (push t debug) - ;; Inside the repo the version file should only exist - ;; while running make. - (when (and static (not noninteractive)) - (ignore-errors (delete-file static))) - (setq magit-version - (let ((default-directory topdir)) - (magit-git-string "describe" "--tags" "--dirty"))))) - (progn - (push 'static debug) - (when (and static (file-exists-p static)) - (push t debug) - (load-file static) - magit-version)) - (when (featurep 'package) - (push 'elpa debug) - (ignore-errors - (--when-let (assq 'magit package-alist) - (push t debug) - (setq magit-version - (and (fboundp 'package-desc-version) - (package-version-join - (package-desc-version (cadr it)))))))) - (progn - (push 'debug debug) - (let ((dirname (file-name-nondirectory - (directory-file-name topdir)))) - (when (string-match "\\`magit-\\([0-9]\\{8\\}\\.[0-9]*\\)" - dirname) - (setq magit-version (match-string 1 dirname)))))))) - (if (stringp magit-version) - (when (called-interactively-p 'any) - (message "Magit %s, Git %s, Emacs %s, %s" - (or magit-version "(unknown)") - (or (magit-git-version t) "(unknown)") - emacs-version - system-type)) - (setq debug (reverse debug)) - (setq magit-version 'error) - (when magit-version - (push magit-version debug)) - (unless (equal (getenv "TRAVIS") "true") - ;; The repository is a sparse clone. - (message "Cannot determine Magit's version %S" debug))) - magit-version)) - -(defun magit-startup-asserts () - (let ((version (magit-git-version))) - (when (and version - (version< version magit--minimal-git) - (not (equal (getenv "TRAVIS") "true"))) - (display-warning 'magit (format "\ -Magit requires Git >= %s, you are using %s. - -If this comes as a surprise to you, because you do actually have -a newer version installed, then that probably means that the -older version happens to appear earlier on the `$PATH'. If you -always start Emacs from a shell, then that can be fixed in the -shell's init file. If you start Emacs by clicking on an icon, -or using some sort of application launcher, then you probably -have to adjust the environment as seen by graphical interface. -For X11 something like ~/.xinitrc should work. - -If you use Tramp to work inside remote Git repositories, then you -have to make sure a suitable Git is used on the remote machines -too.\n" magit--minimal-git version) :error))) - (when (version< emacs-version magit--minimal-emacs) - (display-warning 'magit (format "\ -Magit requires Emacs >= %s, you are using %s. - -If this comes as a surprise to you, because you do actually have -a newer version installed, then that probably means that the -older version happens to appear earlier on the `$PATH'. If you -always start Emacs from a shell, then that can be fixed in the -shell's init file. If you start Emacs by clicking on an icon, -or using some sort of application launcher, then you probably -have to adjust the environment as seen by graphical interface. -For X11 something like ~/.xinitrc should work.\n" - magit--minimal-emacs emacs-version) - :error)) - (--each '((magit-log-edit . git-commit) - (git-commit-mode . git-commit) - (git-rebase-mode . git-rebase)) - (when (or (featurep (car it)) (locate-library (symbol-name (car it)))) - (display-warning 'magit (format "%s has to be removed - -Magit is no longer compatible with the library `%s', -which was used in earlier releases. Please remove it, so that -Magit can use the successor `%s' without the obsolete -library getting in the way. Then restart Emacs.\n" - (car it) (car it) (cdr it)) :error)))) - -(defvar magit--remotes-using-recent-git nil) - -(defun magit-tramp-asserts (directory) - (-when-let (remote (file-remote-p directory)) - (unless (member remote magit--remotes-using-recent-git) - (-if-let (version (let ((default-directory directory)) - (magit-git-version))) - (if (version<= magit--minimal-git version) - (push version magit--remotes-using-recent-git) - (display-warning 'magit (format "\ -Magit requires Git >= %s, but on %s the version is %s. - -If multiple Git versions are installed on the host then the -problem might be that TRAMP uses the wrong executable. - -First check the value of `magit-git-executable'. Its value is -used when running git locally as well as when running it on a -remote host. The default value is \"git\", except on Windows -where an absolute path is used for performance reasons. - -If the value already is just \"git\" but TRAMP never-the-less -doesn't use the correct executable, then consult the info node -`(tramp)Remote programs'.\n" magit--minimal-git remote version) :error)) - (display-warning 'magit (format "\ -Magit cannot find Git on %s. - -First check the value of `magit-git-executable'. Its value is -used when running git locally as well as when running it on a -remote host. The default value is \"git\", except on Windows -where an absolute path is used for performance reasons. - -If the value already is just \"git\" but TRAMP never-the-less -doesn't find the executable, then consult the info node -`(tramp)Remote programs'.\n" remote) :error))))) - -(make-obsolete-variable 'magit-status-refresh-hook "\ -use `magit-pre-refresh-hook', `magit-post-refresh-hook', - `magit-refresh-buffer-hook', or `magit-status-mode-hook' instead. - - If you want to run a function every time the status buffer is - refreshed, in order to do something with that buffer, then use: - - (add-hook 'magit-refresh-buffer-hook - (lambda () - (when (derived-mode-p 'magit-status-mode) - ...))) - - If your hook function should run regardless of whether the - status buffer exists or not, then use `magit-pre-refresh-hook' - or `magit-post-refresh-hook'. - - If your hook function only has to be run once, when the buffer - is first created, then `magit-status-mode-hook' instead. -" "Magit 2.4.0") - -(define-obsolete-function-alias 'global-magit-file-buffer-mode - 'global-magit-file-mode "Magit 2.3.0") -(define-obsolete-function-alias 'magit-insert-head-header - 'magit-insert-head-branch-header "Magit 2.4.0") -(define-obsolete-function-alias 'magit-insert-upstream-header - 'magit-insert-upstream-branch-header "Magit 2.4.0") -(define-obsolete-function-alias 'magit-insert-pull-branch-header - 'magit-insert-upstream-branch-header "Magit 2.4.0") - -(provide 'magit) - -(cl-eval-when (load eval) - (require 'magit-sequence) - (require 'magit-commit) - (require 'magit-remote) - (require 'magit-bisect) - (require 'magit-stash) - (require 'magit-blame) - (unless (load "magit-autoloads" t t) - (require 'magit-submodule) - (require 'magit-subtree) - (require 'magit-ediff) - (require 'magit-extras) - (require 'git-rebase))) - -(if after-init-time - (progn (magit-startup-asserts) - (magit-version)) - (add-hook 'after-init-hook #'magit-startup-asserts t) - (add-hook 'after-init-hook #'magit-version t)) - -;; Local Variables: -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: -;;; magit.el ends here diff --git a/elpa/magit-20161115.1658/magit.info b/elpa/magit-20161115.1658/magit.info deleted file mode 100644 index ed791409..00000000 --- a/elpa/magit-20161115.1658/magit.info +++ /dev/null @@ -1,176 +0,0 @@ -This is magit.info, produced by makeinfo version 5.2 from magit.texi. - -Magit is an interface to the version control system Git, implemented as -an Emacs package. Magit aspires to be a complete Git porcelain. While -we cannot (yet) claim that Magit wraps and improves upon each and every -Git command, it is complete enough to allow even experienced Git users -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. - - Copyright (C) 2015-2016 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: 1222 -magit.info-2: 321649 - -Tag Table: -(Indirect) -Node: Top1222 -Node: Introduction6446 -Node: Installation11169 -Node: Updating from an older release11544 -Node: Installing from an Elpa archive13139 -Node: Installing from the Git repository14478 -Node: Post-installation tasks17325 -Node: Getting started18714 -Node: Interface concepts24443 -Node: Modes and Buffers24717 -Node: Switching Buffers26462 -Node: Naming Buffers31003 -Node: Quitting Windows33838 -Node: Automatic Refreshing of Magit Buffers35470 -Node: Automatic Saving of File-Visiting Buffers38238 -Node: Automatic Reverting of File-Visiting Buffers39423 -Node: Risk of Reverting Automatically44419 -Node: Sections46802 -Node: Section movement47743 -Node: Section visibility51670 -Node: Section hooks55261 -Node: Section types and values57542 -Node: Section options58812 -Node: Popup buffers and prefix commands59284 -Node: Completion and confirmation60598 -Node: Running Git63504 -Node: Viewing Git output63740 -Node: Running Git manually64740 -Node: Git executable66866 -Node: Global Git arguments68873 -Node: Inspecting69680 -Node: Status buffer70827 -Node: Status sections73692 -Node: Status header sections79571 -Node: Status options82128 -Node: Repository list82852 -Node: Logging85010 -Node: Refreshing logs87748 -Node: Log Buffer89133 -Node: Select from log92429 -Node: Reflog93369 -Node: Diffing93847 -Node: Refreshing diffs96867 -Node: Diff buffer99848 -Node: Diff options102442 -Node: Revision buffer105808 -Node: Ediffing106763 -Node: References buffer110353 -Node: References sections115063 -Node: Bisecting115938 -Node: Visiting blobs117677 -Node: Blaming118186 -Node: Manipulating121616 -Node: Repository setup121932 -Node: Staging and unstaging122972 -Node: Staging from file-visiting buffers127061 -Node: Applying128229 -Node: Committing130122 -Node: Initiating a commit130705 -Node: Editing commit messages134017 -Node: Branching144413 -Node: The two remotes144613 -Node: The branch popup147157 -Node: The branch config popup156393 -Node: Merging162299 -Node: Resolving conflicts164467 -Node: Rebasing169472 -Node: Editing rebase sequences173113 -Node: Information about in-progress rebase176143 -Ref: Information about in-progress rebase-Footnote-1182979 -Node: Cherry picking183565 -Node: Reverting185171 -Node: Resetting186534 -Node: Stashing188046 -Node: Transferring191220 -Node: Remotes191458 -Node: Fetching192744 -Node: Pulling194110 -Node: Pushing194956 -Node: Creating and sending patches199700 -Node: Applying patches200395 -Node: Miscellaneous201393 -Node: Tagging201696 -Node: Notes202481 -Node: Submodules205006 -Node: Listing submodules205221 -Node: Submodule popup207040 -Node: Subtree208323 -Node: Common commands209571 -Node: Wip modes211316 -Node: Minor mode for buffers visiting files218052 -Node: Minor mode for buffers visiting blobs221526 -Node: Customizing222331 -Node: Per-repository configuration224003 -Node: Essential settings225637 -Node: Safety225961 -Node: Performance227794 -Node: Plumbing235756 -Node: Calling Git236580 -Node: Getting a value from Git238103 -Node: Calling Git for effect241207 -Node: Section plumbing247711 -Node: Creating sections247939 -Node: Section selection251838 -Node: Matching sections253518 -Node: Refreshing buffers258950 -Node: Conventions262085 -Node: Confirmation and completion262262 -Node: Theming Faces263160 -Node: FAQ271311 -Node: Magit is slow272924 -Node: I changed several thousand files at once and now Magit is unusable273125 -Node: I am having problems committing273841 -Node: Diffs are collapsed after un-/staging274287 -Node: I don't understand how branching and pushing work275765 -Node: I don't like the key binding in v24276140 -Node: I cannot install the pre-requisites for Magit v2276479 -Node: I am using an Emacs release older than v244276944 -Node: I am using a Git release older than v194278557 -Node: I am using MS Windows and cannot push with Magit279544 -Node: I am using OS X and SOMETHING works in shell but not in Magit280148 -Node: How to install the gitman info manual?280939 -Node: How can I show Git's output?283480 -Node: Diffs contain control sequences284267 -Node: Expanding a file to show the diff causes it to disappear285272 -Node: Point is wrong in the ‘COMMIT_EDITMSG’ buffer285807 -Node: The mode-line information isn't always up-to-date286837 -Node: Can Magit be used as ‘ediff-version-control-package’?287905 -Node: How to show diffs for gpg-encrypted files?289949 -Node: Emacs 245 hangs when loading Magit290546 -Node: Symbol's value as function is void ‘--some’291121 -Node: Where is the branch manager291455 -Node: Keystroke Index291746 -Node: Command Index321649 -Node: Function Index351658 -Node: Variable Index365552 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-20161115.1658/magit.info-2 b/elpa/magit-20161115.1658/magit.info-2 deleted file mode 100644 index ed10b788692d4463e0e4df8941060aabeb315039..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 56853 zcmeHQYjYb%cHNI#{1cgvw#%ak)LYrwimZoMi6kqeY?mvQ4?|!;j0Ire8H_0A*XP`R z3{KB+FPmjCFSC7}?N??0qw{*Z zZ|Zf{Ubp*llYL+9zs;)6Ze4Cl{Kz6J+7tZv%S|zFvt2R&SX`EOvdlsk?XGIdRv<6R ztjOlI{NTP6lx$Zw^KxBOTYUWIRkbcpuF7m)Y`673`|7&ff1SC3DDgR!z+vV%6z%RfUi#k9lvUW4}z;1VgH-UZQWh2gi*0x*H;;S0zdzGS2k6- z74gXrcP-?0g3sW~%evX%vzxlz%a3IBQp8g=*`lb{*CR3Qi}quiEiml)9^V$BpIlY@ zRpn&l2aB25;@j2M3S+*;uiv*|Qne6py~WQu8Dg~HbW-ixa=pwJCAfVuvjmaO!3dmt zQMQ=XO#VEtch^mIxq>L4f1RD)oju6$pNHAM)!U-YzAGDuVZE-hzx*m+_}2^jg*)r& zuMXgsx|7MsnsNa~O?A;>+As`^t)6!>_ag9ruA6LAFRJCW$hq4t%El}ntfftBnOJ#c z-@p4Y`@YgiW#CUtb7&4%Kppm zoAT4s?B7eMrl$T__Fw;T_cZ%Z?@msh?RMpMQGL#yhma@VB>tS7{OQmCS;=qx)1UuK zhFfmCrziMF(e3LTzpiZdIaWM4M*lp+$2M4`^X$xgR>XoGAOp>Rs@iHVU-+(DE}>xV z*olhb{GKmJv{vy{4lRrNQ+#)mf$9sFBg_VQ(hF11eiA=iH5VNNQ54WcMEo zsO+$&zYLYpT4_q0V=yU(65(|_(F6_G3WQRXS1}@oEi?_4duBJ&4r+@}#10Eo?k%SrcMDb zm8mp;zgQfX5+}_~Vws4`gAtd{Wm5T1ESE?9%5`#CR-ZeVC(%C>b9vY=UB{(@`Q0RD zX<{yqhja81=5)$>nV8GNUi~|{Y;d(ST=GSIwGAh0VlMX|4fgbb%XryL&1JY=c2(M( zo0!X^{#d&f`}qoY8Tp0-x@T6+0Z2XyTGblPq7k45G&4gR0J&fI z$AHZK?t#S9S8cn*^-*JV8UpR=-B?$75oH=sW;AinsQp-_j!M93K&M8HIv|nsNH9I0 z1CXD2^DRGXG_;GVg;x(&RzmG$-x*MeUbuxp%+Fnn+)c!exvEAI^Tc8c{w88al^9PYViWU( zIcetd1A-10=0gZW;oJ{Q9y*2XXL1CMuxHBoN5n$H3DAIo6UO|qd{IgyF@&&-O9OgB zwv%I2H@j64J*^a=)4QyOEu*y7Q-HGBNZ7dniY5Cz0r6oMUw(G&+_VJa?v?(n@qd=?lLG#2S}??7AMx zNdsb|X}+%2$QA-_yBYzuy1B-Me;+EMfRTwz4QbHyzuqE7h8P~MaVBK}Hqae^T+Zk^ zV4b=-_Qy7E#;ZVNGzj`3W7-n;#_KZeAk#)@<4@L% zb21;x+HV#ODA2fa)v?|ciJ`+pufqfPIb?~rzWhQM2-a=lx7;b+<;%^XQBW$wU6o9^8Hl5BsyLzWRpW#-o%%_yb$8gdyernllu5_ROr8u>V- z&1W|9aN@x^KVL8KfrHw2U-jCb4mJVu^A$bYZgXj~?KdPgI#OSr;F|ug_ zG&J0$ao3HE3t$=$YXQSZa*zI3Ky+RjAUHf%v0=&RG#ObZH4QC&66iputWIRZG zF^60NC%PsbKK)~2?smOwGSvfjk9>kDASav2BRJ!=vqySZ+|pKe{Qcp{)*>@;zRGc* zyexA$;AzWh+rs8s(AsgXGVE7m-Q}SNRs*u>ECkeveViEF3q|4EOa}ro?$5-1RDcFC zuKp4^G$Zl@P>wk3$360Kdnsu^qoG|%YBw~#xRT{g)uY^?%-At$mf{eImh`mwd)WiJ zs#_{UiHK%)e?&Mb8!Oae?Hmc4EDjH0|MuZ6QilC>g)6Z&!N2HnAyDtdMbtaU#gv7k z5jU}exqTe>5g&-9krQTpS2Tx(Lj#0r9m~m^qU49NK#R0Nqyc5L^DU5a*lR$ni!2a~ zxqAKS4-f4gS!fnW$sN!bJ&Xgz)rbbfi<=k$D3V2>0X-ZE+YBwP+B6`WVP};ZF%mU| zjg<$gNOpd59X%v_$N`C#jc+*(=sp>r%Mxct9KtT|SMq_O2JkDJ&Q}AJqktm?rUBg> zGRmztJBp)KUQZtBp(t^u(XOF-QYx%p)=xXx%mtVS%5vS~G-8BMl-i>6EI3AJL|Svp@4EL zDbMP#H?NOWq`{$W;*sy`-8lVcLLR(gF6%yFI4%$E%8>wKqs*=_`LAXRKc;Im7`Zx@ zIH62q#7Rg8pg19&5h>{kv48{@J3KAwz`N?#ZnMK|=W<-(Y~9NxSpMCEzrg=VS?7Er znmk!4#B&b19>9zHCIxiNNHObb6!7ig193r^svJ3INL2D!Yu82;kO6AD3zS)P@H>qL zh$_FcwM?hqN8W5W^2FT<+CJqk`=;1&{&c!ch9CBK!Fj~~8#q}3Z0A3;&avSpd7}uM4T4SC zr0%qKkG#bPhWF9_xFij3fQD1gEGAu2l zZEYnT*={P(h>^1YH6V6JSw<$~FJ5S>0kL9}Vsw~->0{(SkQi#rrJv13E{HtxrbXY4 zvNghv$VcY?oqQnhM&gU!?4tOL1u_GSBWXZvEfG+BHEBTXKW3ol63~Fymass|^lLzz zJmP?wE|t@y0dWqR1rk?H+!?9P8oMn@HYyoIM>}t`y z+E{zH;6LCEf@z0LBrt;H6WrlOwQz7DnvG_c*pV9=WNa3p`3;&j@a)J2r9VHReBHY; zkZHT?BqP~ud*K}IG+B-F8P);QZlfK-eBJwA{UHisY>NW2sB{{y$L z1{4bWz({~bBG-V}DmIKvYn*u{4U~{=5H52K=nVA{nt!87K{ik24PxWg|!$5a0JKkTl4VkO7)TnZIc6G@!?1 zr`y8O=8@C8&Ai&O(`*qp{ z1qVcbIXB4ipNKW$fTZ*+#>WH_(m-U5I3N?iiXy3uf_0=gXk--J@T<@8M8~hU1;RYe zp>(XIVb0LU2*q=hc1zzTG4>%^-JchW#1vu+%i%D%NczP<2e<>$c3v8Y?^+H>{u(JJ znL?Ejd!u@wR87>GHnd>p33KB|>YA9@tO0SHtC9X~2)l@h8eQkNa7CJtdjv}|u1buY zji~Vfxg@cT>n1;(Gr5Vb(g{*$T4_~q#u=cbM#1E#8S(wt3@taU0i%-6&S8;ZV5U~U zCcVfoj}yiY)wYbt5Q#hMv=OmS)Q+e{lg;>mbkPJRk~HE>+or?5g;* zPndncR|dyp+_S)pMkF&`HU^iJcpk}rs$AUbYCpi4AOC_*zp17d5^10}O>JWy2FbQBDLMzThqV%x$u2E=|K z545Thy>>lNOxV1y7zmvQ&~6FAUlz9p#P@d(Bw4Ne^Il)|LyIwDjl)2HoKa+Dn>^cC zzYc9^TsjaiTH|P2=d)ml8c=N33?l~=C{_)Ki%%kqPJch6$QB_+r@x;O>BR`6d%vF% z8UHb$-_Izr*Jx<>e?KF-Ek_vL|NV?2!nSekfQ#KF=Wh4Mwg@{*JR=_n^GAC3zC3_Y-ILSMs%UTlLCk)Njxr*^gE$Z70ea$h$a0_$%8EqDKLyiz}=pZ zEY!j6yfypPL<+27;)$3CE=(1O9AYNkZ_{3n<>loz6>ZNdrUk+4 z?Jah}3wE0!W}be*8z!-n9v{GpoWvW(so9W_9#qG?CHDq*^D#h5=OlHLaaykhQp&M3 zMjQ*ZK)7obkjczLXt+;+DS(#QMkqB@=s9Aa;N_pk&Ze0}6C@50o$gR3J8I9T4(fqdPZT&#vNO+^C?YtuU}!dQ2s{MLZRoMR@c#cC1a!T;P|)6R}@FEY>+Vrt&4kBG#|= zaO&uZRQq!3PeoIS!suT}eUE&S@iVJG;?f$voBCq#=xXxe)NlUZzMSgYamb^k(wH8l zJ=dlHdW)x_rO~W)P5brkoZiQMt@PB!hlvUbbMW}|zWVPnY!e}BWm+nCjbThwzSs+t zv&TkTGZne!VVb0K9}bhe?RN5Js8I@&N@e!MxWS0ZzH7EQ3c;i>K>Wt6uqUQ6oFGqS zxxPkwqkzfOYsE^5_xxv!ENXc`sKlGx^Zl`y&?+=cw1Uk^nXtda8kT-< zMI_T_i@UT5v$@>H;y8e-^hhK59om}q3^K!zxC3Gb9(oE(=T!IWa%qxO2Eh)M5%~fZ zh+CtnFwV@#uw=U5rhBN*IO1l220dZr=leejP-f37>nvZmDr)QJh_E_`MQPi*kKG)B zi~^v1iB$i2z3w(!^fN)~|0iT>MWFnwk&ioMWPp~9yz^zf=#rMOE|)39<0P_kvDZy} z;v+i_57x#59_HyY+w?9kKhMh@T3^fRnv@PXYzK7q4c_4rCE2HTMrOO;TpU5TEVpF? zAGGh}FI6jj7w=`aHHnx{vv=mvx+9k=v2*wm}V!nj@Vrtg(d463>Ws@kYB@HZ>PY+_GHO=~|G9 zxv;}YxM&YtPc0WtXEj{*gyYD_$8hQZk++`(=@z(z7E+<_hj z)wo#J0lD{pBc6W^h;t1?Alu9);G_ZZrV4@J4j5hzH6S*u9FVaJ;rS6KgQSWcZY~bU ze(@lx=hx;BIjJ& z0}TV)TEBI^W^%Mnwy53MVm5I^pU|?Mzg!* z`6M87a{e(H#fRpPU^z|gsUdfV2%mnpKh}X*LN@@BqoW^Mn^0vMBW|0~1HmsGU6LwL zMA+_qp0UyHfTpoB_<>PBq;_ z26bdwoZ|`Egpz%T5RGkG>`Az#WB!6oD8YY;_S$cY*TOO4_^1Jr_VD93k1U+lN}H)HLI|jsle%Y^PDF$5+` zp750CSP@7IX9q18>_V20mkW9C{YZ2DST_sVt04J>= zIh{c`S`}HMTx?WaHm(*yA3#KA2VEeAbXs=C6#ole0icKgP(U5tXmWu6*6jG4{kS{>R8rYK1itJCsb4(2> z{wYP4O#2+Y;Lu&CkSsQR~woDkioRFOHpQywJux1A`!azom3NkNY#ZIaNtJPbJF|SeVZYgwiwZI6HCd)#fFFmanO{tN z!CPdvbS2_oHS_b?DfN~F_yy$0xm>Ok!R&_1rr3?##@|)OK^1+RDgatbCFNy}c>3Jb zfegD8D9x{fgr^GwB&Ql~uet538YnIWDC3BM1u`RZXuQX<%{3sayKL361=?2_Uxdz0 zK$Ko&Z7j4e{I$c~-R0~0;3}MlrqL=Hd#3%`ajGL{90GAX47|;u`Q&=xI0=n7V30mJ zgyRGr2%RKwmmUmACQSjF@iuWl(j1|GCKtwE)0d;DK-7)bIY&%cZ*;N-mAx{s!_X*! zhF*{Ft-W9wYT;uJ%FNfbspj_+en;*cFUn=nt*wKV0@}ueF%8UIK%4W$ok?7@A0>|; ze#GGo_cdCXLOqMqr@;MI4Cp(4);KrO0hOQk<#v(dr643-O14nnno|X$5W53%&v*Vo zpvM$BbwKtlS=jq%%F%3C+8QHnFaRKKv@xE!=aV$@~%z2vTgGXO;=tvb+^UR z8nJT1W({C~Y&*oA1RrXIHYE44XJ$a`!gc)=NlQ``A1BP^>B0p>Xty%nwIDjQjC(9$rSIlPu70lKD6^W$d(RK-|~e0vR$; z+HfJ5a0m5ySApnkGa4jn#@RYYCw-k^_%BgM~0dR$Nib!)Z&6ITxMW+xU75VS@f(7?SE)l zV;b9O$d22qGUKO3cG7}saG(W8h?esf03m%%1Jk7=x0B)0W85@La`Y1*< zg$VdeskI1mpDmEniNTsN6UEM=zI+1#{?`W0J(JF8iZweJ?IC75hkBpV{6X9XoILFlQmVdDNSEWg3qXw*+|P`)s>9LU=v{yu9UdCP%r zp8|xZ)M_lmMTOE){EI7NdlTd!A7&Ixe+&p__RdA6oCy*I3We=XS67?ZlxwL^!>Q{Y zDm-(?Z}75^8yee>hhtjS61>iz3gr2b7SMp$x@ziL@1m#WJ9F8uYlqtl%F2Q!@1T~> zi%)U^nK-M8x1BdceP-ck3!mGJcDy(+e)OA zAn(vZBLr5hV-(oOekG6t(H#RWgiTER{&j29e&Em|!iNqkMeyIwrx0yaM3G z?SPz!&<$bOtl0ti4}=PU_HEyKz-Ic{BnVoP*&C=2S&ID!se+U1m-ed)uWdGUvT@p^ z78iG|>b4d9Da&hr>67~hk4W_sa8nNdR*5}_Mn$qlIZpPb3|A1ly5V{clfhS-Eua_s z0IA{y82CKgH@8(Yp-<0Zns7X!Z0;Mds1Zh z$jJ~0OA%gP*V9V@nsM)`10$nmt!*T<4rmc5t1V`nDL()jjZA$lg$uO==%N&-scWAy zlv0F`Kka9%n&Uu+acPWZT<$MGW;YCd%zg!EjBJXgw7t5cB#}9!NpE_Y?FMMA*3f+N O1EIgCr6TdAlm7u}kT!<^ diff --git a/elpa/magit-20161115.1658/AUTHORS.md b/elpa/magit-20171009.1252/AUTHORS.md similarity index 91% rename from elpa/magit-20161115.1658/AUTHORS.md rename to elpa/magit-20171009.1252/AUTHORS.md index 389541ef..37be5ec2 100644 --- a/elpa/magit-20161115.1658/AUTHORS.md +++ b/elpa/magit-20171009.1252/AUTHORS.md @@ -40,16 +40,20 @@ Contributors - Aaron Culich - Abdo Roig-Maranges +- Adam Benanti <0entropy@protonmail.com> - Adam Porter - Adam Spiers - Adeodato Simó - Ævar Arnfjörð Bjarmason - Alan Falloon +- Aleksey Uimanov - Alexander Gramiak - Alex Dunn - Alexey Voinov - Alex Kost - Alex Ott +- Allen +- Allen Li - Andreas Fuchs - Andreas Liljeqvist - Andreas Rottmann @@ -63,6 +67,7 @@ Contributors - Bart Bakker - Basil L. Contovounesios - Bastian Beischer +- Ben North - Ben Walton - Bradley Wright - Brandon W Maister @@ -95,10 +100,14 @@ Contributors - Dennis Paskorz - Divye Kapoor - Dominique Quatravaux +- Duianto Vebotci - Eli Barzilay - Eric Davis - Eric Schulte +- Erik Anderson - Evgkeni Sampelnikof +- Eyal Lotem +- Fabian Wiget - Felix Geller - Feng Li - Florian Ragwitz @@ -115,12 +124,15 @@ Contributors - Hans-Peter Deifel - Ian Eure - Ingo Lohmar +- Ioan-Adrian Ratiu - Ivan Brennan - Jan Tatarik - Jasper St. Pierre - Jeff Bellegarde - Jeff Dairiki +- Jeremy Meng - Jesse Alama +- Joakim Jalap - Johann Klähn - John Mastro - John Wiegley @@ -129,10 +141,13 @@ Contributors - Jordan Greenberg - Josiah Schwab - Julien Danjou +- Justin Burkett - Justin Caratzas +- Justin Guenther +- Justin Thomas - Kan-Ru Chen -- Kan-Ru Chen - Keshav Kini +- Kévin Le Gouguec - Kimberly Wolk - Kyle Meyer - Laurent Laffont @@ -151,6 +166,8 @@ Contributors - Marc Herbert - Marcin Bachry - Marco Craveiro +- Marco Wahl +- Marc Sherry - Marian Schubert - Mario Rodas - Marius Vollmer @@ -190,12 +207,14 @@ Contributors - Peter Vasil - Philippe Vaucher - Philipp Haselwarter +- Philipp Stephani - Philip Weaver - Phil Jackson - Phil Sainty - Pieter Praet - Prathamesh Sonpatki - rabio +- Radon Rosborough - Rafael Laboissiere - Raimon Grau - Ramkumar Ramachandra @@ -217,6 +236,7 @@ Contributors - Sanjoy Das - Sean Allred - Sean Bryant +- Sean Whitton - Sebastian Wiesner - Sébastien Gross - Seong-Kook Shin @@ -252,8 +272,10 @@ Contributors - Wei Huang - Wilfred Hughes - Win Treese +- Wouter Bolsterlee - Xavier Noria - Yann Hodique - York Zhao - Yuichi Higashi +- Yuri Khan - Zach Latta diff --git a/elpa/magit-20161115.1658/COPYING b/elpa/magit-20171009.1252/COPYING similarity index 100% rename from elpa/magit-20161115.1658/COPYING rename to elpa/magit-20171009.1252/COPYING diff --git a/elpa/magit-20161115.1658/dir b/elpa/magit-20171009.1252/dir similarity index 100% rename from elpa/magit-20161115.1658/dir rename to elpa/magit-20171009.1252/dir diff --git a/elpa/magit-20161115.1658/git-rebase.el b/elpa/magit-20171009.1252/git-rebase.el similarity index 69% rename from elpa/magit-20161115.1658/git-rebase.el rename to elpa/magit-20171009.1252/git-rebase.el index 98b6b675..1de18252 100644 --- a/elpa/magit-20161115.1658/git-rebase.el +++ b/elpa/magit-20171009.1252/git-rebase.el @@ -1,6 +1,6 @@ ;;; git-rebase.el --- Edit Git rebase files -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -55,8 +55,11 @@ ;; f Like "s" but don't also edit the commit message. ;; x Add a script to be run with the commit at point ;; being checked out. +;; z Add noop action at point. ;; -;; RET Show the commit at point in another buffer. +;; SPC Show the commit at point in another buffer. +;; RET Show the commit at point in another buffer and +;; select its window. ;; C-/ Undo last change. ;; You should probably also read the `git-rebase' manpage. @@ -81,6 +84,7 @@ (defgroup git-rebase nil "Edit Git rebase sequences." + :link '(info-link "(magit)Editing Rebase Sequences") :group 'tools) (defcustom git-rebase-auto-advance t @@ -125,7 +129,7 @@ (defface git-rebase-comment-heading '((t :inherit font-lock-keyword-face)) - "Face used for headings in rebase message comments." + "Face for headings in rebase message comments." :group 'git-commit-faces) ;;; Keymaps @@ -133,34 +137,50 @@ (defvar git-rebase-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map special-mode-map) - (define-key map (kbd "q") 'undefined) - (define-key map [remap undo] 'git-rebase-undo) - (define-key map (kbd "RET") 'git-rebase-show-commit) - (define-key map (kbd "SPC") 'git-rebase-show-or-scroll-up) - (define-key map (kbd "x") 'git-rebase-exec) - (define-key map (kbd "c") 'git-rebase-pick) - (define-key map (kbd "r") 'git-rebase-reword) - (define-key map (kbd "w") 'git-rebase-reword) - (define-key map (kbd "e") 'git-rebase-edit) - (define-key map (kbd "m") 'git-rebase-edit) - (define-key map (kbd "s") 'git-rebase-squash) - (define-key map (kbd "f") 'git-rebase-fixup) - (define-key map (kbd "y") 'git-rebase-insert) - (define-key map (kbd "k") 'git-rebase-kill-line) - (define-key map (kbd "C-k") 'git-rebase-kill-line) - (define-key map (kbd "p") 'git-rebase-backward-line) - (define-key map (kbd "n") 'forward-line) - (define-key map (kbd "M-p") 'git-rebase-move-line-up) - (define-key map (kbd "M-n") 'git-rebase-move-line-down) - (define-key map (kbd "M-") 'git-rebase-move-line-up) - (define-key map (kbd "M-") 'git-rebase-move-line-down) - (define-key map (kbd "C-x C-t") 'git-rebase-move-line-up) + (cond ((featurep 'jkl) + (define-key map [return] 'git-rebase-show-commit) + (define-key map (kbd "i") 'git-rebase-backward-line) + (define-key map (kbd "k") 'forward-line) + (define-key map (kbd "M-i") 'git-rebase-move-line-up) + (define-key map (kbd "M-k") 'git-rebase-move-line-down) + (define-key map (kbd "p") 'git-rebase-pick) + (define-key map (kbd ",") 'git-rebase-kill-line)) + (t + (define-key map (kbd "C-m") 'git-rebase-show-commit) + (define-key map (kbd "p") 'git-rebase-backward-line) + (define-key map (kbd "n") 'forward-line) + (define-key map (kbd "M-p") 'git-rebase-move-line-up) + (define-key map (kbd "M-n") 'git-rebase-move-line-down) + (define-key map (kbd "c") 'git-rebase-pick) + (define-key map (kbd "k") 'git-rebase-kill-line) + (define-key map (kbd "C-k") 'git-rebase-kill-line))) + (define-key map (kbd "e") 'git-rebase-edit) + (define-key map (kbd "m") 'git-rebase-edit) + (define-key map (kbd "f") 'git-rebase-fixup) + (define-key map (kbd "q") 'undefined) + (define-key map (kbd "r") 'git-rebase-reword) + (define-key map (kbd "w") 'git-rebase-reword) + (define-key map (kbd "s") 'git-rebase-squash) + (define-key map (kbd "x") 'git-rebase-exec) + (define-key map (kbd "y") 'git-rebase-insert) + (define-key map (kbd "z") 'git-rebase-noop) + (define-key map (kbd "SPC") 'git-rebase-show-or-scroll-up) + (define-key map (kbd "DEL") 'git-rebase-show-or-scroll-down) + (define-key map (kbd "C-x C-t") 'git-rebase-move-line-up) + (define-key map [M-up] 'git-rebase-move-line-up) + (define-key map [M-down] 'git-rebase-move-line-down) + (define-key map [remap undo] 'git-rebase-undo) map) "Keymap for Git-Rebase mode.") -(put 'git-rebase-reword :advertised-binding "r") -(put 'git-rebase-move-line-up :advertised-binding (kbd "M-p")) -(put 'git-rebase-kill-line :advertised-binding "k") +(cond ((featurep 'jkl) + (put 'git-rebase-reword :advertised-binding "r") + (put 'git-rebase-move-line-up :advertised-binding (kbd "M-i")) + (put 'git-rebase-kill-line :advertised-binding ",")) + (t + (put 'git-rebase-reword :advertised-binding "r") + (put 'git-rebase-move-line-up :advertised-binding (kbd "M-p")) + (put 'git-rebase-kill-line :advertised-binding "k"))) (easy-menu-define git-rebase-mode-menu git-rebase-mode-map "Git-Rebase mode menu" @@ -179,15 +199,19 @@ ["Finish" with-editor-finish t])) (defvar git-rebase-command-descriptions - '((with-editor-finish . "tell Git to make it happen") - (with-editor-cancel . "tell Git that you changed your mind, i.e. abort") - (git-rebase-backward-line . "move point to previous line") - (forward-line . "move point to next line") - (git-rebase-move-line-up . "move the commit at point up") - (git-rebase-move-line-down . "move the commit at point down") - (git-rebase-show-commit . "show the commit at point in another buffer") - (undo . "undo last change") - (git-rebase-kill-line . "drop the commit at point"))) + '((with-editor-finish . "tell Git to make it happen") + (with-editor-cancel . "tell Git that you changed your mind, i.e. abort") + (git-rebase-backward-line . "move point to previous line") + (forward-line . "move point to next line") + (git-rebase-move-line-up . "move the commit at point up") + (git-rebase-move-line-down . "move the commit at point down") + (git-rebase-show-or-scroll-up . "show the commit at point in another buffer") + (git-rebase-show-commit + . "show the commit at point in another buffer and select its window") + (undo . "undo last change") + (git-rebase-kill-line . "drop the commit at point") + (git-rebase-insert . "insert a line for an arbitrary commit") + (git-rebase-noop . "add noop action at point"))) ;;; Commands @@ -222,7 +246,7 @@ (defun git-rebase-set-action (action) (goto-char (line-beginning-position)) (if (and (looking-at git-rebase-line) - (not (string-match-p "\\(e\\|exec\\)$" (match-string 1)))) + (not (string-match-p "\\(e\\|exec\\|noop\\)$" (match-string 1)))) (let ((inhibit-read-only t)) (replace-match action t t nil 1) (when git-rebase-auto-advance @@ -310,7 +334,8 @@ current line." (when (and (looking-at git-rebase-line) (not (eq (char-after) (string-to-char comment-start)))) (let ((inhibit-read-only t)) - (insert comment-start)) + (insert comment-start) + (insert " ")) (when git-rebase-auto-advance (forward-line)))) @@ -353,6 +378,31 @@ remove the command on the current line, if any." (forward-line) (goto-char (line-beginning-position))))))) +(defun git-rebase-noop (&optional arg) + "Add noop action at point. + +If the current line already contains a 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 +present on the current line. + +A noop action can be used to make git perform a rebase even if +no commits are selected. Without the noop action present, git +would see an empty file and therefore do nothing." + (interactive "P") + (goto-char (line-beginning-position)) + ;; The extra space at the end is only there to make the action + ;; consistent with the others (action argument). This keeps + ;; the regexp `git-rebase-line' from getting complicated. + (let ((noop-string "noop \n")) + (when (or arg (not (looking-at noop-string))) + (let ((inhibit-read-only t)) + (if (and (not arg) + (looking-at (concat comment-start noop-string))) + (delete-char 1) + (insert noop-string)))))) + (defun git-rebase-undo (&optional arg) "Undo some previous changes. Like `undo' but works in read-only buffers." @@ -366,9 +416,10 @@ Like `undo' but works in read-only buffers." (goto-char (line-beginning-position)) (--if-let (and (looking-at git-rebase-line) (match-string 2)) - (if scroll - (magit-diff-show-or-scroll-up) - (apply #'magit-show-commit it (magit-diff-arguments))) + (pcase scroll + (`up (magit-diff-show-or-scroll-up)) + (`down (magit-diff-show-or-scroll-down)) + (_ (apply #'magit-show-commit it (magit-diff-arguments)))) (ding))))) (defun git-rebase-show-commit () @@ -377,15 +428,30 @@ Like `undo' but works in read-only buffers." (git-rebase--show-commit)) (defun git-rebase-show-or-scroll-up () - "Update the commit buffer for commit on current line." + "Update the commit buffer for commit on current line. + +Either show the commit at point in the appropriate buffer, or if +that buffer is already being displayed in the current frame and +contains information about that commit, then instead scroll the +buffer up." (interactive) - (git-rebase--show-commit t)) + (git-rebase--show-commit 'up)) + +(defun git-rebase-show-or-scroll-down () + "Update the commit buffer for commit on current line. + +Either show the commit at point in the appropriate buffer, or if +that buffer is already being displayed in the current frame and +contains information about that commit, then instead scroll the +buffer down." + (interactive) + (git-rebase--show-commit 'down)) (defun git-rebase-backward-line (&optional n) "Move N lines backward (forward if N is negative). Like `forward-line' but go into the opposite direction." (interactive "p") - (forward-line (- n))) + (forward-line (- (or n 1)))) ;;; Mode @@ -401,14 +467,16 @@ running 'man git-rebase' at the command line) for details." (setq comment-start (or (magit-get "core.commentChar") "#")) (setq git-rebase-comment-re (concat "^" (regexp-quote comment-start))) (setq git-rebase-line - (concat "^\\(" (regexp-quote comment-start) "?" - "\\(?:[fprse]\\|pick\\|reword\\|edit\\|squash\\|fixup\\|exec\\)\\) " + (concat "^\\(" (regexp-quote comment-start) "? *" + "\\(?:[fprse]\\|pick\\|reword\\|edit\\|squash\\|fixup\\|exec\\|noop\\)\\) " "\\(?:\\([^ \n]+\\) \\(.*\\)\\)?")) (setq font-lock-defaults (list (git-rebase-mode-font-lock-keywords) t t)) (unless git-rebase-show-instructions (let ((inhibit-read-only t)) (flush-lines git-rebase-comment-re))) - (with-editor-mode 1) + (unless with-editor-mode + ;; Maybe already enabled when using `shell-command' or an Emacs shell. + (with-editor-mode 1)) (when git-rebase-confirm-cancel (add-hook 'with-editor-cancel-query-functions 'git-rebase-cancel-confirm nil t)) @@ -416,6 +484,10 @@ running 'man git-rebase' at the command line) for details." (setq-local redisplay-unhighlight-region-function 'git-rebase-unhighlight-region) (add-hook 'with-editor-pre-cancel-hook 'git-rebase-autostash-save nil t) (add-hook 'with-editor-post-cancel-hook 'git-rebase-autostash-apply nil t) + (setq imenu-prev-index-position-function + #'magit-imenu--rebase-prev-index-position-function) + (setq imenu-extract-index-name-function + #'magit-imenu--rebase-extract-index-name-function) (when (boundp 'save-place) (setq save-place nil))) @@ -435,25 +507,25 @@ running 'man git-rebase' at the command line) for details." (defun git-rebase-match-comment-line (limit) (re-search-forward (concat git-rebase-comment-re ".*") limit t)) -(defun git-rebase-match-killed-action (limit) - (re-search-forward (concat git-rebase-comment-re "[^ \n].*") limit t)) - (defun git-rebase-mode-font-lock-keywords () "Font lock keywords for Git-Rebase mode." - `(("^\\([efprs]\\|pick\\|reword\\|edit\\|squash\\|fixup\\) \\([^ \n]+\\) \\(.*\\)" - (1 'font-lock-keyword-face) - (2 'git-rebase-hash) - (3 'git-rebase-description)) - ("^\\(exec\\) \\(.*\\)" - (1 'font-lock-keyword-face) - (2 'git-rebase-description)) - (git-rebase-match-comment-line 0 'font-lock-comment-face) - (git-rebase-match-killed-action 0 'git-rebase-killed-action t) - (,(format "^%s Rebase \\([^ ]*\\) onto \\([^ ]*\\)" comment-start) - (1 'git-rebase-comment-hash t) - (2 'git-rebase-comment-hash t)) - (,(format "^%s \\(Commands:\\)" comment-start) - (1 'git-rebase-comment-heading t)))) + (let ((action-re "\ +\\([efprs]\\|pick\\|reword\\|edit\\|squash\\|fixup\\) \\([^ \n]+\\) \\(.*\\)")) + `((,(concat "^" action-re) + (1 'font-lock-keyword-face) + (2 'git-rebase-hash) + (3 'git-rebase-description)) + ("^\\(exec\\) \\(.*\\)" + (1 'font-lock-keyword-face) + (2 'git-rebase-description)) + (git-rebase-match-comment-line 0 'font-lock-comment-face) + (,(concat git-rebase-comment-re " *" action-re) + 0 'git-rebase-killed-action t) + (,(format "^%s Rebase \\([^ ]*\\) onto \\([^ ]*\\)" comment-start) + (1 'git-rebase-comment-hash t) + (2 'git-rebase-comment-hash t)) + (,(format "^%s \\(Commands:\\)" comment-start) + (1 'git-rebase-comment-heading t))))) (defun git-rebase-mode-show-keybindings () "Modify the \"Commands:\" section of the comment Git generates @@ -465,15 +537,17 @@ By default, this is the same except for the \"pick\" command." (goto-char (point-min)) (when (and git-rebase-show-instructions (re-search-forward - (concat git-rebase-comment-re " Commands:\n") + (concat git-rebase-comment-re " p, pick") nil t)) + (goto-char (line-beginning-position)) (--each git-rebase-command-descriptions (insert (format "%s %-8s %s\n" comment-start (substitute-command-keys (format "\\[%s]" (car it))) (cdr it)))) (while (re-search-forward (concat git-rebase-comment-re - "\\( ?\\)\\([^,],\\) \\([^ ]+\\) = ") + "\\( ?\\)\\([^\n,],\\) " + "\\([^\n ]+\\) ") nil t) (let ((cmd (intern (concat "git-rebase-" (match-string 3))))) (if (not (fboundp cmd)) @@ -509,7 +583,4 @@ By default, this is the same except for the \"pick\" command." (add-to-list 'with-editor-file-name-history-exclude git-rebase-filename-regexp) (provide 'git-rebase) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; git-rebase.el ends here diff --git a/elpa/magit-20161115.1658/magit-apply.el b/elpa/magit-20171009.1252/magit-apply.el similarity index 95% rename from elpa/magit-20161115.1658/magit-apply.el rename to elpa/magit-20171009.1252/magit-apply.el index a99000a0..7d5255b9 100644 --- a/elpa/magit-20161115.1658/magit-apply.el +++ b/elpa/magit-20171009.1252/magit-apply.el @@ -1,6 +1,6 @@ ;;; magit-apply.el --- apply Git diffs -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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,16 +42,21 @@ (defvar auto-revert-verbose) ;; For `magit-stage-untracked' (declare-function magit-submodule-add 'magit-submodule) -(declare-function magit-submodule-read-name 'magit-submodule) +(declare-function magit-submodule-read-name-for-path 'magit-submodule) (require 'dired) ;;; Options (defcustom magit-delete-by-moving-to-trash t - "Whether Magit uses the system's trash can." + "Whether Magit uses the system's trash can. + +You should absolutely not disable this and also remove `discard' +from `magit-no-confirm'. You shouldn't do that even if you have +all of the Magit-Wip modes enabled, because those modes do not +track any files that are not tracked in the proper branch." :package-version '(magit . "2.1.0") - :group 'magit + :group 'magit-essentials :type 'boolean) (defcustom magit-unstage-committed t @@ -63,7 +68,7 @@ between the index and the working tree, not with committed changes. If this option is non-nil (the default), then typing \"u\" -(`magit-unstage') on a committed change, causes it to be +\(`magit-unstage') on a committed change, causes it to be reversed in the index but not the working tree. For more information see command `magit-reverse-in-index'." :package-version '(magit . "2.4.1") @@ -219,7 +224,7 @@ requiring confirmation." (interactive (let* ((atpoint (magit-section-when (file))) (current (magit-file-relative-name)) - (choices (nconc (magit-modified-files) + (choices (nconc (magit-unstaged-files) (magit-untracked-files))) (default (car (member (or atpoint current) choices)))) (list (if (or current-prefix-arg (not default)) @@ -259,7 +264,8 @@ ignored) files. (`list (magit-untracked-files)))) plain repos) (dolist (file files) - (if (magit-git-repo-p file t) + (if (and (not (file-symlink-p file)) + (magit-git-repo-p file t)) (push file repos) (push file plain))) (magit-wip-commit-before-change files " before stage") @@ -276,9 +282,10 @@ ignored) files. (magit-submodule-add (let ((default-directory (file-name-as-directory (expand-file-name repo)))) - (magit-get "remote" (or (magit-get-remote) "origin") "url")) + (or (magit-get "remote" (or (magit-get-remote) "origin") "url") + (concat (file-name-as-directory ".") repo))) repo - (magit-submodule-read-name repo)))) + (magit-submodule-read-name-for-path repo)))) (magit-wip-commit-after-apply files " after stage"))) ;;;; Unstage @@ -478,7 +485,10 @@ without requiring confirmation." (dolist (file files) (let ((orig (cadr (assoc file status)))) (if (file-exists-p file) - (magit-call-git "mv" file orig) + (progn + (--when-let (file-name-directory orig) + (make-directory it t)) + (magit-call-git "mv" file orig)) (magit-call-git "rm" "--cached" "--" file) (magit-call-git "reset" "--" orig)))))) @@ -502,7 +512,7 @@ without requiring confirmation." (sections (magit-discard-apply-n sections 'magit-apply-diffs))) (when binaries - (let ((modified (magit-modified-files t))) + (let ((modified (magit-unstaged-files t))) (setq binaries (--separate (member it modified) binaries))) (when (cadr binaries) (magit-call-git "reset" "--" (cadr binaries))) @@ -584,9 +594,5 @@ a separate commit. A typical workflow would be: (interactive) (magit-reverse (cons "--cached" args))) -;;; magit-apply.el ends soon (provide 'magit-apply) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-apply.el ends here diff --git a/elpa/magit-20161115.1658/magit-autoloads.el b/elpa/magit-20171009.1252/magit-autoloads.el similarity index 74% rename from elpa/magit-20161115.1658/magit-autoloads.el rename to elpa/magit-20171009.1252/magit-autoloads.el index ccd52be1..a763a273 100644 --- a/elpa/magit-20161115.1658/magit-autoloads.el +++ b/elpa/magit-20171009.1252/magit-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "git-rebase" "git-rebase.el" (22576 8242 0 +;;;### (autoloads nil "git-rebase" "git-rebase.el" (23004 52629 0 ;;;;;; 0)) ;;; Generated autoloads from git-rebase.el @@ -23,301 +23,8 @@ running 'man git-rebase' at the command line) for details. ;;;*** -;;;### (autoloads nil "magit" "magit.el" (22576 8242 0 0)) +;;;### (autoloads nil "magit" "magit.el" (23004 52629 0 0)) ;;; Generated autoloads from magit.el - -(autoload 'magit-status "magit" "\ -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. - -\(fn &optional DIRECTORY)" t nil) - -(autoload 'magit-status-internal "magit" "\ - - -\(fn DIRECTORY)" nil nil) - (autoload 'magit-show-refs-popup "magit" nil t) - -(autoload 'magit-show-refs-head "magit" "\ -List and compare references in a dedicated buffer. -Refs are compared with `HEAD'. - -\(fn &optional ARGS)" t nil) - -(autoload 'magit-show-refs-current "magit" "\ -List and compare references in a dedicated buffer. -Refs are compared with the current branch or `HEAD' if -it is detached. - -\(fn &optional ARGS)" t nil) - -(autoload 'magit-show-refs "magit" "\ -List and compare references in a dedicated buffer. -Refs are compared with a branch read form the user. - -\(fn &optional REF ARGS)" t nil) - -(autoload 'magit-find-file "magit" "\ -View FILE from REV. -Switch to a buffer visiting blob REV:FILE, -creating one if none already exists. - -\(fn REV FILE)" t nil) - -(autoload 'magit-find-file-other-window "magit" "\ -View FILE from REV, in another window. -Like `magit-find-file', but create a new window or reuse an -existing one. - -\(fn REV FILE)" t nil) - -(autoload 'magit-dired-jump "magit" "\ -Visit file at point using Dired. -With a prefix argument, visit in another window. If there -is no file at point then instead visit `default-directory'. - -\(fn &optional OTHER-WINDOW)" t nil) - -(autoload 'magit-checkout-file "magit" "\ -Checkout FILE from REV. - -\(fn REV FILE)" t nil) - -(autoload 'magit-init "magit" "\ -Initialize a Git repository, then show its status. - -If the directory is below an existing repository, then the user -has to confirm that a new one should be created inside. If the -directory is the root of the existing repository, then the user -has to confirm that it should be reinitialized. - -Non-interactively DIRECTORY is (re-)initialized unconditionally. - -\(fn DIRECTORY)" t nil) - (autoload 'magit-branch-popup "magit" nil t) - -(autoload 'magit-checkout "magit" "\ -Checkout REVISION, updating the index and the working tree. -If REVISION is a local branch then that becomes the current -branch. If it is something else then `HEAD' becomes detached. -Checkout fails if the working tree or the staging area contain -changes. - -\(git checkout REVISION). - -\(fn REVISION)" t nil) - -(autoload 'magit-branch "magit" "\ -Create BRANCH at branch or revision START-POINT. - -\(git branch [ARGS] BRANCH START-POINT). - -\(fn BRANCH START-POINT &optional ARGS)" t nil) - -(autoload 'magit-branch-and-checkout "magit" "\ -Create and checkout BRANCH at branch or revision START-POINT. - -\(git checkout [ARGS] -b BRANCH START-POINT). - -\(fn BRANCH START-POINT &optional ARGS)" t nil) - -(autoload 'magit-branch-orphan "magit" "\ -Create and checkout an orphan BRANCH with contents from revision START-POINT. - -\(git checkout --orphan [ARGS] BRANCH START-POINT). - -\(fn BRANCH START-POINT &optional ARGS)" t nil) - -(autoload 'magit-branch-spinoff "magit" "\ -Create new branch from the unpushed commits. - -Create and checkout a new branch starting at and tracking the -current branch. That branch in turn is reset to the last commit -it shares with its upstream. If the current branch has no -upstream or no unpushed commits, then the new branch is created -anyway and the previously current branch is not touched. - -This is useful to create a feature branch after work has already -began on the old branch (likely but not necessarily \"master\"). - -If the current branch is a member of the value of option -`magit-branch-prefer-remote-upstream' (which see), then the -current branch will be used as the starting point as usual, but -the upstream of the starting-point may be used as the upstream -of the new branch, instead of the starting-point itself. - -If optional FROM is non-nil, then the source branch is reset to -that commit, instead of to the last commit it shares with its -upstream. Interactively, FROM is non-nil, when the region -selects some commits, and among those commits, FROM it is the -commit that is the fewest commits ahead of the source branch. - -The commit at the other end of the selection actually does not -matter, all commits between FROM and `HEAD' are moved to the new -branch. If FROM is not reachable from `HEAD' or is reachable -from the source branch's upstream, then an error is raised. - -\(fn BRANCH &optional FROM &rest ARGS)" t nil) - -(autoload 'magit-branch-reset "magit" "\ -Reset a branch to the tip of another branch or any other commit. - -When the branch being reset is the current branch, then do a -hard reset. If there are any uncommitted changes, then the user -has to confirming the reset because those changes would be lost. - -This is useful when you have started work on a feature branch but -realize it's all crap and want to start over. - -When resetting to another branch and a prefix argument is used, -then also set the target branch as the upstream of the branch -that is being reset. - -\(fn BRANCH TO &optional ARGS SET-UPSTREAM)" t nil) - -(autoload 'magit-branch-delete "magit" "\ -Delete one or multiple branches. -If the region marks multiple branches, then offer to delete -those, otherwise prompt for a single branch to be deleted, -defaulting to the branch at point. - -\(fn BRANCHES &optional FORCE)" t nil) - -(autoload 'magit-branch-rename "magit" "\ -Rename branch OLD to NEW. -With prefix, forces the rename even if NEW already exists. - -\(git branch -m|-M OLD NEW). - -\(fn OLD NEW &optional FORCE)" t nil) - -(autoload 'magit-branch-config-popup "magit" "\ -Popup console for setting branch variables. - -\(fn BRANCH)" t nil) - -(autoload 'magit-edit-branch*description "magit" "\ -Edit the description of the current branch. -With a prefix argument edit the description of another branch. - -The description for the branch named NAME is stored in the Git -variable `branch..description'. - -\(fn BRANCH)" t nil) - -(autoload 'magit-set-branch*merge/remote "magit" "\ -Set or unset the upstream of the current branch. -With a prefix argument do so for another branch. - -When the branch in question already has an upstream then simply -unsets it. Invoke this command again to set another upstream. - -Together the Git variables `branch..remote' and -`branch..merge' define the upstream branch of the local -branch named NAME. The value of `branch..remote' is the -name of the upstream remote. The value of `branch..merge' -is the full reference of the upstream branch, on the remote. - -Non-interactively, when UPSTREAM is non-nil, then always set it -as the new upstream, regardless of whether another upstream was -already set. When nil, then always unset. - -\(fn BRANCH UPSTREAM)" t nil) - -(autoload 'magit-cycle-branch*rebase "magit" "\ -Cycle the value of `branch..rebase' for the current branch. -With a prefix argument cycle the value for another branch. - -The Git variables `branch..rebase' controls whether pulling -into the branch named NAME is done by rebasing that branch onto -the fetched branch or by merging that branch. - -When `true' then pulling is done by rebasing. -When `false' then pulling is done by merging. - -When that variable is undefined then the value of `pull.rebase' -is used instead. It defaults to `false'. - -\(fn BRANCH)" t nil) - -(autoload 'magit-cycle-branch*pushRemote "magit" "\ -Cycle the value of `branch..pushRemote' for the current branch. -With a prefix argument cycle the value for another branch. - -The Git variable `branch..pushRemote' specifies the remote -that the branch named NAME is usually pushed to. The value has -to be the name of an existing remote. - -If that variable is undefined, then the value of the Git variable -`remote.pushDefault' is used instead, provided that it is defined, -which by default it is not. - -\(fn BRANCH)" t nil) - -(autoload 'magit-cycle-pull\.rebase "magit" "\ -Cycle the repository-local value of `pull.rebase'. - -The Git variable `pull.rebase' specifies whether pulling is done -by rebasing or by merging. It can be overwritten using the Git -variable `branch..rebase'. - -When `true' then pulling is done by rebasing. -When `false' (the default) then pulling is done by merging. - -\(fn)" t nil) - -(autoload 'magit-cycle-remote\.pushDefault "magit" "\ -Cycle the repository-local value of `remote.pushDefault'. - -The Git variable `remote.pushDefault' specifies the remote that -local branches are usually pushed to. It can be overwritten -using the Git variable `branch..pushRemote'. - -\(fn)" t nil) - -(autoload 'magit-cycle-branch*autoSetupMerge "magit" "\ -Cycle the repository-local value of `branch.autoSetupMerge'. - -The Git variable `branch.autoSetupMerge' under what circumstances -creating a branch (named NAME) should result in the variables -`branch..merge' and `branch..remote' being set -according to the starting point used to create the branch. If -the starting point isn't a branch, then these variables are never -set. - -When `always' then the variables are set regardless of whether -the starting point is a local or a remote branch. - -When `true' (the default) then the variable are set when the -starting point is a remote branch, but not when it is a local -branch. - -When `false' then the variables are never set. - -\(fn)" t nil) - -(autoload 'magit-cycle-branch*autoSetupRebase "magit" "\ -Cycle the repository-local value of `branch.autoSetupRebase'. - -The Git variable `branch.autoSetupRebase' specifies whether -creating a branch (named NAME) should result in the variable -`branch..rebase' being set to `true'. - -When `always' then the variable is set regardless of whether the -starting point is a local or a remote branch. - -When `local' then the variable are set when the starting point -is a local branch, but not when it is a remote branch. - -When `remote' then the variable are set when the starting point -is a remote branch, but not when it is a local branch. - -When `never' (the default) then the variable is never set. - -\(fn)" t nil) (autoload 'magit-merge-popup "magit" nil t) (autoload 'magit-merge "magit" "\ @@ -338,7 +45,7 @@ Merge commit REV into the current branch; and edit message. Perform the merge and prepare a commit message but let the user edit it. -\(git merge --edit --no-ff [ARGS] rev) +\(git merge --edit --no-ff [ARGS] REV) \(fn REV &optional ARGS)" t nil) @@ -347,7 +54,7 @@ Merge commit REV into the current branch; pretending it failed. Pretend the merge failed to give the user the opportunity to inspect the merge and change the commit message. -\(git merge --no-commit --no-ff [ARGS] rev) +\(git merge --no-commit --no-ff [ARGS] REV) \(fn REV &optional ARGS)" t nil) @@ -401,17 +108,7 @@ Reset the head, index, and working tree to COMMIT. \(git reset --hard REVISION) \(fn COMMIT)" t nil) - -(autoload 'magit-worktree-checkout "magit" "\ -Checkout BRANCH in a new worktree at PATH. - -\(fn PATH BRANCH)" t nil) - -(autoload 'magit-worktree-branch "magit" "\ -Create a new BRANCH and check it out in a new worktree at PATH. - -\(fn PATH BRANCH START-POINT &optional FORCE)" t nil) - (autoload 'magit-tag-popup "magit" nil t) + (autoload 'magit-tag-popup "magit" nil t) (autoload 'magit-tag "magit" "\ Create a new tag with the given NAME at REV. @@ -430,78 +127,60 @@ defaulting to the tag at point. \(git tag -d TAGS) \(fn TAGS)" t nil) - (autoload 'magit-notes-popup "magit" nil t) - (autoload 'magit-file-popup "magit" nil t) - -(defvar global-magit-file-mode nil "\ -Non-nil if Global Magit-File mode is enabled. -See the `global-magit-file-mode' command -for a description of this minor mode. -Setting this variable directly does not take effect; -either customize it (see the info node `Easy Customization') -or call the function `global-magit-file-mode'.") - -(custom-autoload 'global-magit-file-mode "magit" nil) - -(autoload 'global-magit-file-mode "magit" "\ -Toggle Magit-File mode in all buffers. -With prefix ARG, enable Global Magit-File mode if ARG is positive; -otherwise, disable it. If called from Lisp, enable the mode if -ARG is omitted or nil. - -Magit-File mode is enabled in all buffers where -`magit-file-mode-turn-on' would do it. -See `magit-file-mode' for more information on Magit-File mode. - -\(fn &optional ARG)" t nil) (autoload 'magit-dispatch-popup "magit" nil t) (autoload 'magit-run-popup "magit" nil t) (autoload 'magit-git-command "magit" "\ -Execute a Git subcommand asynchronously, displaying the output. -With a prefix argument run Git in the root of the current -repository, otherwise in `default-directory'. +Execute COMMAND asynchonously; display output. + +Interactively, prompt for COMMAND in the minibuffer. \"git \" is +used as initial input, but can be deleted to run another command. -\(fn ARGS DIRECTORY)" t nil) +With a prefix argument COMMAND is run in the top-level directory +of the current working tree, otherwise in `default-directory'. + +\(fn COMMAND)" t nil) (autoload 'magit-git-command-topdir "magit" "\ -Execute a Git subcommand asynchronously, displaying the output. -Run Git in the top-level directory of the current repository. +Execute COMMAND asynchonously; display output. -\(fn)" t nil) +Interactively, prompt for COMMAND in the minibuffer. \"git \" is +used as initial input, but can be deleted to run another command. -(autoload 'magit-shell-command "magit" "\ -Execute a shell command asynchronously, displaying the output. -With a prefix argument run the command in the root of the current -repository, otherwise in `default-directory'. +COMMAND is run in the top-level directory of the current +working tree. -\(fn ARGS DIRECTORY)" t nil) +\(fn COMMAND)" t nil) -(autoload 'magit-shell-command-topdir "magit" "\ -Execute a shell command asynchronously, displaying the output. -Run the command in the top-level directory of the current repository. +(autoload 'magit-shell-command "magit" "\ +Execute COMMAND asynchonously; display output. -\(fn)" t nil) +Interactively, prompt for COMMAND in the minibuffer. With a +prefix argument COMMAND is run in the top-level directory of +the current working tree, otherwise in `default-directory'. -(autoload 'magit-list-repositories "magit" "\ -Display a list of repositories. +\(fn COMMAND)" t nil) -Use the options `magit-repository-directories' -and `magit-repository-directories-depth' to -control which repositories are displayed. +(autoload 'magit-shell-command-topdir "magit" "\ +Execute COMMAND asynchonously; display output. -\(fn)" t nil) +Interactively, prompt for COMMAND in the minibuffer. COMMAND +is run in the top-level directory of the current working tree. + +\(fn COMMAND)" t nil) (autoload 'magit-version "magit" "\ Return the version of Magit currently in use. -When called interactive also show the used versions of Magit, -Git, and Emacs in the echo area. +If optional argument PRINT-DEST is non-nil, output +stream (interactively, the echo area, or the current buffer with +a prefix argument), also print the used versions of Magit, Git, +and Emacs to it. -\(fn)" t nil) +\(fn &optional PRINT-DEST)" t nil) ;;;*** -;;;### (autoloads nil "magit-apply" "magit-apply.el" (22576 8242 +;;;### (autoloads nil "magit-apply" "magit-apply.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-apply.el @@ -538,13 +217,13 @@ Remove all changes from the staging area. ;;;*** -;;;### (autoloads nil "magit-autorevert" "magit-autorevert.el" (22576 -;;;;;; 8242 0 0)) +;;;### (autoloads nil "magit-autorevert" "magit-autorevert.el" (23004 +;;;;;; 52629 0 0)) ;;; Generated autoloads from magit-autorevert.el (defvar magit-revert-buffers t) -(defvar magit-auto-revert-mode (and magit-revert-buffers (not global-auto-revert-mode) (not noninteractive)) "\ +(defvar magit-auto-revert-mode (and (with-no-warnings magit-revert-buffers) (not global-auto-revert-mode) (not noninteractive)) "\ Non-nil if Magit-Auto-Revert mode is enabled. See the `magit-auto-revert-mode' command for a description of this minor mode. @@ -568,7 +247,7 @@ See `auto-revert-mode' for more information on Auto-Revert mode. ;;;*** -;;;### (autoloads nil "magit-bisect" "magit-bisect.el" (22576 8242 +;;;### (autoloads nil "magit-bisect" "magit-bisect.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-bisect.el (autoload 'magit-bisect-popup "magit-bisect" nil t) @@ -607,51 +286,400 @@ While bisecting, skip the current commit. Use this if for some reason the current commit is not a good one to test. This command lets Git choose a different one. -\(fn)" t nil) +\(fn)" t nil) + +(autoload 'magit-bisect-run "magit-bisect" "\ +Bisect automatically by running commands after each step. + +Unlike `git bisect run' this can be used before bisecting has +begun. In that case it behaves like `git bisect start; git +bisect run'. + +\(fn CMDLINE &optional BAD GOOD)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-blame" "magit-blame.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-blame.el + (autoload 'magit-blame-popup "magit-blame" nil t) + +(autoload 'magit-blame "magit-blame" "\ +Display edit history of FILE up to REVISION. + +Interactively blame the file being visited in the current buffer. +If the buffer visits a revision of that file, then blame up to +that revision, otherwise blame the file's full history, including +uncommitted changes. + +If Magit-Blame mode is already turned on then blame recursively, by +visiting REVISION:FILE (using `magit-find-file'), where revision +is the revision before the revision that added the lines at +point. + +ARGS is a list of additional arguments to pass to `git blame'; +only arguments available from `magit-blame-popup' should be used. + +\(fn REVISION FILE &optional ARGS)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-bookmark" "magit-bookmark.el" (23004 +;;;;;; 52629 0 0)) +;;; Generated autoloads from magit-bookmark.el + +(autoload 'magit-bookmark--status-jump "magit-bookmark" "\ +Handle a Magit status BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--status-make-record "magit-bookmark" "\ +Create a Magit status bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--refs-jump "magit-bookmark" "\ +Handle a Magit refs BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--refs-make-record "magit-bookmark" "\ +Create a Magit refs bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--log-jump "magit-bookmark" "\ +Handle a Magit log BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--log-make-record "magit-bookmark" "\ +Create a Magit log bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--reflog-jump "magit-bookmark" "\ +Handle a Magit reflog BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--reflog-make-record "magit-bookmark" "\ +Create a Magit reflog bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--stashes-jump "magit-bookmark" "\ +Handle a Magit stash list BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--stashes-make-record "magit-bookmark" "\ +Create a Magit stash list bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--cherry-jump "magit-bookmark" "\ +Handle a Magit cherry BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--cherry-make-record "magit-bookmark" "\ +Create a Magit cherry bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--diff-jump "magit-bookmark" "\ +Handle a Magit diff BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--diff-make-record "magit-bookmark" "\ +Create a Magit diff bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--revision-jump "magit-bookmark" "\ +Handle a Magit revision BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--revision-make-record "magit-bookmark" "\ +Create a Magit revision bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--stash-jump "magit-bookmark" "\ +Handle a Magit stash BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--stash-make-record "magit-bookmark" "\ +Create a Magit stash bookmark. + +\(fn)" nil nil) + +(autoload 'magit-bookmark--submodules-jump "magit-bookmark" "\ +Handle a Magit submodule list BOOKMARK. + +\(fn BOOKMARK)" nil nil) + +(autoload 'magit-bookmark--submodules-make-record "magit-bookmark" "\ +Create a Magit submodule list bookmark. + +\(fn)" nil nil) + +;;;*** + +;;;### (autoloads nil "magit-branch" "magit-branch.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-branch.el + (autoload 'magit-branch-popup "magit" nil t) + +(autoload 'magit-checkout "magit-branch" "\ +Checkout REVISION, updating the index and the working tree. +If REVISION is a local branch, then that becomes the current +branch. If it is something else, then `HEAD' becomes detached. +Checkout fails if the working tree or the staging area contain +changes. + +\(git checkout REVISION). + +\(fn REVISION)" t nil) + +(autoload 'magit-branch "magit-branch" "\ +Create BRANCH at branch or revision START-POINT. + +\(git branch [ARGS] BRANCH START-POINT). + +\(fn BRANCH START-POINT &optional ARGS)" t nil) + +(autoload 'magit-branch-and-checkout "magit-branch" "\ +Create and checkout BRANCH at branch or revision START-POINT. + +\(git checkout [ARGS] -b BRANCH START-POINT). + +\(fn BRANCH START-POINT &optional ARGS)" t nil) + +(autoload 'magit-branch-or-checkout "magit-branch" "\ +Hybrid between `magit-checkout' and `magit-branch-and-checkout'. + +Ask the user for an existing branch or revision. If the user +input actually can be resolved as a branch or revision, then +check that out, just like `magit-checkout' would. + +Otherwise create and checkout a new branch using the input as +its name. Before doing so read the starting-point for the new +branch. This is similar to what `magit-branch-and-checkout' +does. + +\(fn ARG &optional START-POINT)" t nil) + +(autoload 'magit-branch-orphan "magit-branch" "\ +Create and checkout an orphan BRANCH with contents from revision START-POINT. + +\(git checkout --orphan [ARGS] BRANCH START-POINT). + +\(fn BRANCH START-POINT &optional ARGS)" t nil) + +(autoload 'magit-branch-spinoff "magit-branch" "\ +Create new branch from the unpushed commits. + +Create and checkout a new branch starting at and tracking the +current branch. That branch in turn is reset to the last commit +it shares with its upstream. If the current branch has no +upstream or no unpushed commits, then the new branch is created +anyway and the previously current branch is not touched. + +This is useful to create a feature branch after work has already +began on the old branch (likely but not necessarily \"master\"). + +If the current branch is a member of the value of option +`magit-branch-prefer-remote-upstream' (which see), then the +current branch will be used as the starting point as usual, but +the upstream of the starting-point may be used as the upstream +of the new branch, instead of the starting-point itself. + +If optional FROM is non-nil, then the source branch is reset +to `FROM~', instead of to the last commit it shares with its +upstream. Interactively, FROM is only ever non-nil, if the +region selects some commits, and among those commits, FROM is +the commit that is the fewest commits ahead of the source +branch. (It not yet possible to spin off a single commit, +unless it is the only unpushed commit. See #2920.) + +The commit at the other end of the selection actually does not +matter, all commits between FROM and `HEAD' are moved to the new +branch. If FROM is not reachable from `HEAD' or is reachable +from the source branch's upstream, then an error is raised. + +\(fn BRANCH &optional FROM &rest ARGS)" t nil) + +(autoload 'magit-branch-reset "magit-branch" "\ +Reset a branch to the tip of another branch or any other commit. + +When the branch being reset is the current branch, then do a +hard reset. If there are any uncommitted changes, then the user +has to confirm the reset because those changes would be lost. + +This is useful when you have started work on a feature branch but +realize it's all crap and want to start over. + +When resetting to another branch and a prefix argument is used, +then also set the target branch as the upstream of the branch +that is being reset. + +\(fn BRANCH TO &optional ARGS SET-UPSTREAM)" t nil) + +(autoload 'magit-branch-delete "magit-branch" "\ +Delete one or multiple branches. +If the region marks multiple branches, then offer to delete +those, otherwise prompt for a single branch to be deleted, +defaulting to the branch at point. + +\(fn BRANCHES &optional FORCE)" t nil) + +(autoload 'magit-branch-rename "magit-branch" "\ +Rename branch OLD to NEW. +With prefix, forces the rename even if NEW already exists. + +\(git branch -m|-M OLD NEW). + +\(fn OLD NEW &optional FORCE)" t nil) + +(autoload 'magit-branch-config-popup "magit-branch" "\ +Popup console for setting branch variables. + +\(fn BRANCH)" t nil) + +(autoload 'magit-edit-branch*description "magit-branch" "\ +Edit the description of the current branch. +With a prefix argument edit the description of another branch. + +The description for the branch named NAME is stored in the Git +variable `branch..description'. + +\(fn BRANCH)" t nil) + +(autoload 'magit-set-branch*merge/remote "magit-branch" "\ +Set or unset the upstream of the current branch. +With a prefix argument do so for another branch. + +When the branch in question already has an upstream then simply +unsets it. Invoke this command again to set another upstream. + +Together the Git variables `branch..remote' and +`branch..merge' define the upstream branch of the local +branch named NAME. The value of `branch..remote' is the +name of the upstream remote. The value of `branch..merge' +is the full reference of the upstream branch, on the remote. + +Non-interactively, when UPSTREAM is non-nil, then always set it +as the new upstream, regardless of whether another upstream was +already set. When nil, then always unset. + +\(fn BRANCH UPSTREAM)" t nil) + +(autoload 'magit-cycle-branch*rebase "magit-branch" "\ +Cycle the value of `branch..rebase' for the current branch. +With a prefix argument cycle the value for another branch. + +The Git variables `branch..rebase' controls whether pulling +into the branch named NAME is done by rebasing that branch onto +the fetched branch or by merging that branch. + +When `true' then pulling is done by rebasing. +When `false' then pulling is done by merging. + +When that variable is undefined then the value of `pull.rebase' +is used instead. It defaults to `false'. + +\(fn BRANCH)" t nil) + +(autoload 'magit-cycle-branch*pushRemote "magit-branch" "\ +Cycle the value of `branch..pushRemote' for the current branch. +With a prefix argument cycle the value for another branch. + +The Git variable `branch..pushRemote' specifies the remote +that the branch named NAME is usually pushed to. The value has +to be the name of an existing remote. + +If that variable is undefined, then the value of the Git variable +`remote.pushDefault' is used instead, provided that it is defined, +which by default it is not. + +\(fn BRANCH)" t nil) + +(autoload 'magit-cycle-pull\.rebase "magit-branch" "\ +Cycle the repository-local value of `pull.rebase'. + +The Git variable `pull.rebase' specifies whether pulling is done +by rebasing or by merging. It can be overwritten using the Git +variable `branch..rebase'. + +When `true' then pulling is done by rebasing. +When `false' (the default) then pulling is done by merging. + +\(fn)" t nil) + +(autoload 'magit-cycle-remote\.pushDefault "magit-branch" "\ +Cycle the repository-local value of `remote.pushDefault'. + +The Git variable `remote.pushDefault' specifies the remote that +local branches are usually pushed to. It can be overwritten +using the Git variable `branch..pushRemote'. + +\(fn)" t nil) + +(autoload 'magit-cycle-branch*autoSetupMerge "magit-branch" "\ +Cycle the repository-local value of `branch.autoSetupMerge'. + +The Git variable `branch.autoSetupMerge' under what circumstances +creating a branch (named NAME) should result in the variables +`branch..merge' and `branch..remote' being set +according to the starting point used to create the branch. If +the starting point isn't a branch, then these variables are never +set. + +When `always' then the variables are set regardless of whether +the starting point is a local or a remote branch. + +When `true' (the default) then the variable are set when the +starting point is a remote branch, but not when it is a local +branch. -(autoload 'magit-bisect-run "magit-bisect" "\ -Bisect automatically by running commands after each step. +When `false' then the variables are never set. -Unlike `git bisect run' this can be used before bisecting has -begun. In that case it behaves like `git bisect start; git -bisect run'. +\(fn)" t nil) -\(fn CMDLINE &optional BAD GOOD)" t nil) +(autoload 'magit-cycle-branch*autoSetupRebase "magit-branch" "\ +Cycle the repository-local value of `branch.autoSetupRebase'. -;;;*** - -;;;### (autoloads nil "magit-blame" "magit-blame.el" (22576 8242 -;;;;;; 0 0)) -;;; Generated autoloads from magit-blame.el - (autoload 'magit-blame-popup "magit-blame" nil t) +The Git variable `branch.autoSetupRebase' specifies whether +creating a branch (named NAME) should result in the variable +`branch..rebase' being set to `true'. -(autoload 'magit-blame "magit-blame" "\ -Display edit history of FILE up to REVISION. +When `always' then the variable is set regardless of whether the +starting point is a local or a remote branch. -Interactively blame the file being visited in the current buffer. -If the buffer visits a revision of that file, then blame up to -that revision, otherwise blame the file's full history, including -uncommitted changes. +When `local' then the variable are set when the starting point +is a local branch, but not when it is a remote branch. -If Magit-Blame mode is already turned on then blame recursively, by -visiting REVISION:FILE (using `magit-find-file'), where revision -is the revision before the revision that added the lines at -point. +When `remote' then the variable are set when the starting point +is a remote branch, but not when it is a local branch. -ARGS is a list of additional arguments to pass to `git blame'; -only arguments available from `magit-blame-popup' should be used. +When `never' (the default) then the variable is never set. -\(fn REVISION FILE &optional ARGS)" t nil) +\(fn)" t nil) ;;;*** -;;;### (autoloads nil "magit-commit" "magit-commit.el" (22576 8242 +;;;### (autoloads nil "magit-commit" "magit-commit.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-commit.el (autoload 'magit-commit "magit-commit" "\ -Create a new commit on HEAD. -With a prefix argument amend to the commit at HEAD instead. +Create a new commit on `HEAD'. +With a prefix argument, amend to the commit at `HEAD' instead. \(git commit [--amend] ARGS) @@ -728,7 +756,7 @@ Create a squash commit targeting COMMIT and instantly rebase. ;;;*** -;;;### (autoloads nil "magit-diff" "magit-diff.el" (22576 8242 0 +;;;### (autoloads nil "magit-diff" "magit-diff.el" (23004 52629 0 ;;;;;; 0)) ;;; Generated autoloads from magit-diff.el @@ -805,7 +833,7 @@ Show changes between any two files on disk. \(fn A B)" t nil) (autoload 'magit-show-commit "magit-diff" "\ -Show the revision at point. +Visit the revision at point in another buffer. If there is no revision at point or with a prefix argument prompt for a revision. @@ -813,7 +841,7 @@ for a revision. ;;;*** -;;;### (autoloads nil "magit-ediff" "magit-ediff.el" (22576 8242 +;;;### (autoloads nil "magit-ediff" "magit-ediff.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-ediff.el (autoload 'magit-ediff-popup "magit-ediff" nil t) @@ -838,7 +866,7 @@ FILE has to be relative to the top directory of the repository. Compare REVA:FILEA with REVB:FILEB using Ediff. FILEA and FILEB have to be relative to the top directory of the -repository. If REVA or REVB is nil then this stands for the +repository. If REVA or REVB is nil, then this stands for the working tree state. If the region is active, use the revisions on the first and last @@ -882,7 +910,7 @@ FILE must be relative to the top directory of the repository. \(fn FILE)" t nil) (autoload 'magit-ediff-show-working-tree "magit-ediff" "\ -Show changes between HEAD and working tree using Ediff. +Show changes between `HEAD' and working tree using Ediff. FILE must be relative to the top directory of the repository. \(fn FILE)" t nil) @@ -902,7 +930,7 @@ stash that were staged. ;;;*** -;;;### (autoloads nil "magit-extras" "magit-extras.el" (22576 8242 +;;;### (autoloads nil "magit-extras" "magit-extras.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-extras.el @@ -913,7 +941,7 @@ Run `git gui' for the current git repository. (autoload 'magit-run-git-gui-blame "magit-extras" "\ Run `git gui blame' on the given FILENAME and COMMIT. -Interactively run it for the current file and the HEAD, with a +Interactively run it for the current file and the `HEAD', with a prefix or when the current file cannot be determined let the user choose. When the current buffer is visiting FILENAME instruct blame to center around the line point is on. @@ -935,6 +963,68 @@ Run `gitk --all' in the current repository. \(fn)" t nil) +(autoload 'ido-enter-magit-status "magit-extras" "\ +Drop into `magit-status' from file switching. + +To make this command available use something like: + + (add-hook \\='ido-setup-hook + (lambda () + (define-key ido-completion-map + (kbd \"C-x g\") \\='ido-enter-magit-status))) + +Starting with Emacs 25.1 the Ido keymaps are defined just once +instead of every time Ido is invoked, so now you can modify it +like pretty much every other keymap: + + (define-key ido-common-completion-map + (kbd \"C-x g\") 'ido-enter-magit-status) + +\(fn)" t nil) + +(autoload 'magit-dired-jump "magit-extras" "\ +Visit file at point using Dired. +With a prefix argument, visit in another window. If there +is no file at point, then instead visit `default-directory'. + +\(fn &optional OTHER-WINDOW)" t nil) + +(autoload 'magit-do-async-shell-command "magit-extras" "\ +Open FILE with `dired-do-async-shell-command'. +Interactively, open the file at point. + +\(fn FILE)" t nil) + +(autoload 'magit-previous-line "magit-extras" "\ +Like `previous-line' but with Magit-specific shift-selection. + +Magit's selection mechanism is based on the region but selects an +area that is larger than the region. This causes `previous-line' +when invoked while holding the shift key to move up one line and +thereby select two lines. When invoked inside a hunk body this +command does not move point on the first invocation and thereby +it only selects a single line. Which inconsistency you prefer +is a matter of preference. + +\(fn &optional ARG TRY-VSCROLL)" t nil) + +(function-put 'magit-previous-line 'interactive-only '"use `forward-line' with negative argument instead.") + +(autoload 'magit-next-line "magit-extras" "\ +Like `next-line' but with Magit-specific shift-selection. + +Magit's selection mechanism is based on the region but selects +an area that is larger than the region. This causes `next-line' +when invoked while holding the shift key to move down one line +and thereby select two lines. When invoked inside a hunk body +this command does not move point on the first invocation and +thereby it only selects a single line. Which inconsistency you +prefer is a matter of preference. + +\(fn &optional ARG TRY-VSCROLL)" t nil) + +(function-put 'magit-next-line 'interactive-only 'forward-line) + (autoload 'magit-clean "magit-extras" "\ Remove untracked files from the working tree. With a prefix argument also remove ignored files, @@ -971,9 +1061,181 @@ on a position in a file-visiting buffer. \(fn &optional WHOAMI FILE-NAME)" t nil) +(autoload 'magit-abort-dwim "magit-extras" "\ +Abort current operation. +Depending on the context, this will abort a merge, a rebase, a +patch application, a cherry-pick, a revert, or a bisect. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-files" "magit-files.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-files.el + +(autoload 'magit-find-file "magit-files" "\ +View FILE from REV. +Switch to a buffer visiting blob REV:FILE, +creating one if none already exists. + +\(fn REV FILE)" t nil) + +(autoload 'magit-find-file-other-window "magit-files" "\ +View FILE from REV, in another window. +Like `magit-find-file', but create a new window or reuse an +existing one. + +\(fn REV FILE)" t nil) + (autoload 'magit-file-popup "magit" nil t) + +(defvar global-magit-file-mode nil "\ +Non-nil if Global Magit-File mode is enabled. +See the `global-magit-file-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-magit-file-mode'.") + +(custom-autoload 'global-magit-file-mode "magit-files" nil) + +(autoload 'global-magit-file-mode "magit-files" "\ +Toggle Magit-File mode in all buffers. +With prefix ARG, enable Global Magit-File mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Magit-File mode is enabled in all buffers where +`magit-file-mode-turn-on' would do it. +See `magit-file-mode' for more information on Magit-File mode. + +\(fn &optional ARG)" t nil) + +(autoload 'magit-file-checkout "magit-files" "\ +Checkout FILE from REV. + +\(fn REV FILE)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-imenu" "magit-imenu.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-imenu.el + +(autoload 'magit-imenu--log-prev-index-position-function "magit-imenu" "\ +Move point to previous line in current buffer. +This function is used as a value for +`imenu-prev-index-position-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--log-extract-index-name-function "magit-imenu" "\ +Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line. + +\(fn)" nil nil) + +(autoload 'magit-imenu--diff-prev-index-position-function "magit-imenu" "\ +Move point to previous file line in current buffer. +This function is used as a value for +`imenu-prev-index-position-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--diff-extract-index-name-function "magit-imenu" "\ +Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line. + +\(fn)" nil nil) + +(autoload 'magit-imenu--status-create-index-function "magit-imenu" "\ +Return an alist of all imenu entries in current buffer. +This function is used as a value for +`imenu-create-index-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--refs-create-index-function "magit-imenu" "\ +Return an alist of all imenu entries in current buffer. +This function is used as a value for +`imenu-create-index-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--cherry-create-index-function "magit-imenu" "\ +Return an alist of all imenu entries in current buffer. +This function is used as a value for +`imenu-create-index-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--submodule-prev-index-position-function "magit-imenu" "\ +Move point to previous line in magit-submodule-list buffer. +This function is used as a value for +`imenu-prev-index-position-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--submodule-extract-index-name-function "magit-imenu" "\ +Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line. + +\(fn)" nil nil) + +(autoload 'magit-imenu--repolist-prev-index-position-function "magit-imenu" "\ +Move point to previous line in magit-repolist buffer. +This function is used as a value for +`imenu-prev-index-position-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--repolist-extract-index-name-function "magit-imenu" "\ +Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line. + +\(fn)" nil nil) + +(autoload 'magit-imenu--process-prev-index-position-function "magit-imenu" "\ +Move point to previous process in magit-process buffer. +This function is used as a value for +`imenu-prev-index-position-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--process-extract-index-name-function "magit-imenu" "\ +Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line. + +\(fn)" nil nil) + +(autoload 'magit-imenu--rebase-prev-index-position-function "magit-imenu" "\ +Move point to previous commit in git-rebase buffer. +This function is used as a value for +`imenu-prev-index-position-function'. + +\(fn)" nil nil) + +(autoload 'magit-imenu--rebase-extract-index-name-function "magit-imenu" "\ +Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line. + +\(fn)" nil nil) + ;;;*** -;;;### (autoloads nil "magit-log" "magit-log.el" (22576 8242 0 0)) +;;;### (autoloads nil "magit-log" "magit-log.el" (23004 52629 0 0)) ;;; Generated autoloads from magit-log.el (autoload 'magit-log-buffer-file-popup "magit-log" "\ @@ -1024,7 +1286,8 @@ Show log for all references and `HEAD'. (autoload 'magit-log-buffer-file "magit-log" "\ Show log for the blob or file visited in the current buffer. With a prefix argument or when `--follow' is part of -`magit-log-arguments', then follow renames. +`magit-log-arguments', then follow renames. When the region is +active, restrict the log to the lines that the region touches. \(fn &optional FOLLOW BEG END)" t nil) @@ -1055,7 +1318,44 @@ Show commits in a branch that are not merged in the upstream branch. ;;;*** -;;;### (autoloads nil "magit-remote" "magit-remote.el" (22576 8242 +;;;### (autoloads nil "magit-notes" "magit-notes.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-notes.el + (autoload 'magit-notes-popup "magit" nil t) + +;;;*** + +;;;### (autoloads nil "magit-refs" "magit-refs.el" (23004 52629 0 +;;;;;; 0)) +;;; Generated autoloads from magit-refs.el + +(autoload 'magit-show-refs-popup "magit-refs" "\ +Popup console for `magit-show-refs'. + +\(fn &optional ARG)" t nil) + +(autoload 'magit-show-refs-head "magit-refs" "\ +List and compare references in a dedicated buffer. +Refs are compared with `HEAD'. + +\(fn &optional ARGS)" t nil) + +(autoload 'magit-show-refs-current "magit-refs" "\ +List and compare references in a dedicated buffer. +Refs are compared with the current branch or `HEAD' if +it is detached. + +\(fn &optional ARGS)" t nil) + +(autoload 'magit-show-refs "magit-refs" "\ +List and compare references in a dedicated buffer. +Refs are compared with a branch read from the user. + +\(fn &optional REF ARGS)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-remote" "magit-remote.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-remote.el @@ -1069,7 +1369,7 @@ Then show the status buffer for the new repository. (autoload 'magit-remote-add "magit-remote" "\ Add a remote named REMOTE and fetch it. -\(fn REMOTE URL)" t nil) +\(fn REMOTE URL &optional ARGS)" t nil) (autoload 'magit-remote-rename "magit-remote" "\ Rename the remote named OLD to NEW. @@ -1237,11 +1537,11 @@ To add this command to the push popup add this to your init file: (with-eval-after-load \\='magit-remote (magit-define-popup-action \\='magit-push-popup ?P - 'magit-push-implicitly--desc - 'magit-push-implicitly ?p t)) + \\='magit-push-implicitly--desc + \\='magit-push-implicitly ?p t)) The function `magit-push-implicitly--desc' attempts to predict -what this command will do, the value it returns is displayed in +what this command will do. The value it returns is displayed in the popup buffer. \(fn ARGS)" t nil) @@ -1261,8 +1561,8 @@ To add this command to the push popup add this to your init file: (with-eval-after-load \\='magit-remote (magit-define-popup-action \\='magit-push-popup ?r - 'magit-push-to-remote--desc - 'magit-push-to-remote ?p t)) + \\='magit-push-to-remote--desc + \\='magit-push-to-remote ?p t)) \(fn REMOTE ARGS)" t nil) (autoload 'magit-patch-popup "magit-remote" nil t) @@ -1272,7 +1572,7 @@ Create patches for the commits in RANGE. When a single commit is given for RANGE, create a patch for the changes introduced by that commit (unlike 'git format-patch' which creates patches for all commits that are reachable from -HEAD but not from the specified commit). +`HEAD' but not from the specified commit). \(fn RANGE ARGS)" t nil) @@ -1288,8 +1588,23 @@ is asked to pull. START has to be reachable from that commit. ;;;*** -;;;### (autoloads nil "magit-sequence" "magit-sequence.el" (22576 -;;;;;; 8242 0 0)) +;;;### (autoloads nil "magit-repos" "magit-repos.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-repos.el + +(autoload 'magit-list-repositories "magit-repos" "\ +Display a list of repositories. + +Use the options `magit-repository-directories' +and `magit-repository-directories-depth' to +control which repositories are displayed. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-sequence" "magit-sequence.el" (23004 +;;;;;; 52629 0 0)) ;;; Generated autoloads from magit-sequence.el (autoload 'magit-sequencer-continue "magit-sequence" "\ @@ -1383,13 +1698,13 @@ Rebase the current branch onto its upstream branch. (autoload 'magit-rebase "magit-sequence" "\ Rebase the current branch onto a branch read in the minibuffer. -All commits that are reachable from head but not from the +All commits that are reachable from `HEAD' but not from the selected branch TARGET are being rebased. \(fn TARGET ARGS)" t nil) (autoload 'magit-rebase-subset "magit-sequence" "\ -Rebase a subset of the current branches history onto a new base. +Rebase a subset of the current branch's history onto a new base. Rebase commits from START to `HEAD' onto NEWBASE. START has to be selected from a list of recent commits. @@ -1439,7 +1754,7 @@ Abort the current rebase operation, restoring the original branch. ;;;*** -;;;### (autoloads nil "magit-stash" "magit-stash.el" (22576 8242 +;;;### (autoloads nil "magit-stash" "magit-stash.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-stash.el (autoload 'magit-stash-popup "magit-stash" nil t) @@ -1539,8 +1854,40 @@ Show all diffs of a stash in a buffer. ;;;*** -;;;### (autoloads nil "magit-submodule" "magit-submodule.el" (22576 -;;;;;; 8242 0 0)) +;;;### (autoloads nil "magit-status" "magit-status.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-status.el + +(autoload 'magit-init "magit-status" "\ +Initialize a Git repository, then show its status. + +If the directory is below an existing repository, then the user +has to confirm that a new one should be created inside. If the +directory is the root of the existing repository, then the user +has to confirm that it should be reinitialized. + +Non-interactively DIRECTORY is (re-)initialized unconditionally. + +\(fn DIRECTORY)" t nil) + +(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. + +\(fn &optional DIRECTORY CACHE)" t nil) + +(autoload 'magit-status-internal "magit-status" "\ + + +\(fn DIRECTORY)" nil nil) + +;;;*** + +;;;### (autoloads nil "magit-submodule" "magit-submodule.el" (23004 +;;;;;; 52629 0 0)) ;;; Generated autoloads from magit-submodule.el (autoload 'magit-submodule-popup "magit-submodule" nil t) @@ -1556,7 +1903,7 @@ PATH also becomes the name. \(fn URL &optional PATH NAME)" t nil) -(autoload 'magit-submodule-read-name "magit-submodule" "\ +(autoload 'magit-submodule-read-name-for-path "magit-submodule" "\ \(fn PATH)" nil nil) @@ -1593,9 +1940,18 @@ Unregister the submodule at PATH. \(fn PATH)" t nil) -(autoload 'magit-insert-submodules "magit-submodule" "\ +(autoload 'magit-insert-modules "magit-submodule" "\ +Insert submodule sections. +Hook `magit-module-sections-hook' controls which module sections +are inserted, and option `magit-insert-modules-nested' controls +whether they are wrapped in an additional section. + +\(fn)" nil nil) + +(autoload 'magit-insert-modules-overview "magit-submodule" "\ Insert sections for all modules. -For each section insert the path and the output of `git describe --tags'. +For each section insert the path and the output of `git describe --tags', +or, failing that, the abbreviated HEAD commit hash. \(fn)" nil nil) @@ -1630,15 +1986,15 @@ Display a list of the current repository's submodules. ;;;*** -;;;### (autoloads nil "magit-subtree" "magit-subtree.el" (22576 8242 +;;;### (autoloads nil "magit-subtree" "magit-subtree.el" (23004 52629 ;;;;;; 0 0)) ;;; Generated autoloads from magit-subtree.el (autoload 'magit-subtree-popup "magit-subtree" nil t) (autoload 'magit-subtree-add "magit-subtree" "\ -Add COMMIT from REPOSITORY as a new subtree at PREFIX. +Add REF from REPOSITORY as a new subtree at PREFIX. -\(fn PREFIX REPOSITORY COMMIT ARGS)" t nil) +\(fn PREFIX REPOSITORY REF ARGS)" t nil) (autoload 'magit-subtree-add-commit "magit-subtree" "\ Add COMMIT as a new subtree at PREFIX. @@ -1651,9 +2007,9 @@ Merge COMMIT into the PREFIX subtree. \(fn PREFIX COMMIT ARGS)" t nil) (autoload 'magit-subtree-pull "magit-subtree" "\ -Pull COMMIT from REPOSITORY into the PREFIX subtree. +Pull REF from REPOSITORY into the PREFIX subtree. -\(fn PREFIX REPOSITORY COMMIT ARGS)" t nil) +\(fn PREFIX REPOSITORY REF ARGS)" t nil) (autoload 'magit-subtree-push "magit-subtree" "\ Extract the history of the subtree PREFIX and push it to REF on REPOSITORY. @@ -1667,7 +2023,33 @@ Extract the history of the subtree PREFIX. ;;;*** -;;;### (autoloads nil "magit-wip" "magit-wip.el" (22576 8242 0 0)) +;;;### (autoloads nil "magit-utils" "magit-utils.el" (23004 52629 +;;;;;; 0 0)) +;;; Generated autoloads from magit-utils.el + +(autoload 'magit-emacs-Q-command "magit-utils" "\ +Show a shell command that runs an uncustomized Emacs with only Magit loaded. +See info node `(magit)Debugging Tools' for more information. + +\(fn)" t nil) + +(autoload 'Info-follow-nearest-node--magit-gitman "magit-utils" "\ + + +\(fn FN &optional FORK)" nil nil) + +(advice-add 'Info-follow-nearest-node :around 'Info-follow-nearest-node--magit-gitman) + +(autoload 'org-man-export--magit-gitman "magit-utils" "\ + + +\(fn FN LINK DESCRIPTION FORMAT)" nil nil) + +(advice-add 'org-man-export :around 'org-man-export--magit-gitman) + +;;;*** + +;;;### (autoloads nil "magit-wip" "magit-wip.el" (23004 52629 0 0)) ;;; Generated autoloads from magit-wip.el (defvar magit-wip-after-save-mode nil "\ @@ -1735,9 +2117,25 @@ command which is about to be called are committed. ;;;*** -;;;### (autoloads nil nil ("magit-core.el" "magit-git.el" "magit-mode.el" -;;;;;; "magit-pkg.el" "magit-process.el" "magit-section.el" "magit-utils.el") -;;;;;; (22576 8242 0 0)) +;;;### (autoloads nil "magit-worktree" "magit-worktree.el" (23004 +;;;;;; 52629 0 0)) +;;; Generated autoloads from magit-worktree.el + +(autoload 'magit-worktree-checkout "magit-worktree" "\ +Checkout BRANCH in a new worktree at PATH. + +\(fn PATH BRANCH)" t nil) + +(autoload 'magit-worktree-branch "magit-worktree" "\ +Create a new BRANCH and check it out in a new worktree at PATH. + +\(fn PATH BRANCH START-POINT &optional FORCE)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("magit-core.el" "magit-git.el" "magit-margin.el" +;;;;;; "magit-mode.el" "magit-obsolete.el" "magit-pkg.el" "magit-process.el" +;;;;;; "magit-section.el") (23004 52629 0 0)) ;;;*** diff --git a/elpa/magit-20161115.1658/magit-autorevert.el b/elpa/magit-20171009.1252/magit-autorevert.el similarity index 93% rename from elpa/magit-20161115.1658/magit-autorevert.el rename to elpa/magit-20171009.1252/magit-autorevert.el index 5a3027c3..e6c6f731 100644 --- a/elpa/magit-20161115.1658/magit-autorevert.el +++ b/elpa/magit-20171009.1252/magit-autorevert.el @@ -1,6 +1,6 @@ ;;; magit-autorevert.el --- revert buffers when files in repository change -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -30,10 +30,15 @@ (require 'autorevert) +;;; Options + (defgroup magit-auto-revert nil "Revert buffers when files in repository change." + :link '(custom-group-link auto-revert) + :link '(info-link "(magit)Automatic Reverting of File-Visiting Buffers") :group 'auto-revert - :group 'magit-extensions) + :group 'magit-essentials + :group 'magit-modes) (defcustom auto-revert-buffer-list-filter nil "Filter that determines which buffers `auto-revert-buffers' reverts. @@ -56,6 +61,7 @@ is enabled." :package-version '(magit . "2.4.2") :group 'auto-revert :group 'magit-auto-revert + :group 'magit-related :type '(radio (const :tag "no filter" nil) (function-item magit-auto-revert-buffer-p) (function-item magit-auto-revert-repository-buffer-p) @@ -93,6 +99,8 @@ seconds of user inactivity. That is not desirable." :group 'magit-auto-revert :type 'boolean) +;;; Mode + (defun magit-turn-on-auto-revert-mode-if-desired (&optional file) (if file (--when-let (find-buffer-visiting file) @@ -102,27 +110,27 @@ seconds of user inactivity. That is not desirable." (file-readable-p buffer-file-name) (magit-toplevel) (or (not magit-auto-revert-tracked-only) - (magit-file-tracked-p buffer-file-name))) - (auto-revert-mode)))) + (magit-file-tracked-p buffer-file-name)) + (not auto-revert-mode)) ; see #3014 + (auto-revert-mode 1)))) ;;;###autoload -(defvar magit-revert-buffers t) -(make-obsolete-variable 'magit-revert-buffers 'magit-auto-revert-mode - "Magit 2.4.0") +(defvar magit-revert-buffers t) ; obsolete ;;;###autoload (define-globalized-minor-mode magit-auto-revert-mode auto-revert-mode magit-turn-on-auto-revert-mode-if-desired :package-version '(magit . "2.4.0") - :group 'magit + :link '(info-link "(magit)Automatic Reverting of File-Visiting Buffers") :group 'magit-auto-revert + :group 'magit-essentials ;; When `global-auto-revert-mode' is enabled, then this mode is ;; redundant. When `magit-revert-buffers' is nil, then the user has ;; opted out of the automatic reverts while the old implementation ;; was still in use. In all other cases enable the mode because if ;; buffers are not automatically reverted that would make many very ;; common tasks much more cumbersome. - :init-value (and magit-revert-buffers + :init-value (and (with-no-warnings magit-revert-buffers) (not global-auto-revert-mode) (not noninteractive))) ;; - Unfortunately `:init-value t' only sets the value of the mode @@ -145,7 +153,7 @@ the `after-init-hook'. For more information see the comments and code surrounding the definition of this function." ;; `magit-revert-buffers' may have been set to nil before the alias ;; had been established, so consult the value of both variables. - (if (and magit-auto-revert-mode magit-revert-buffers) + (if (and magit-auto-revert-mode (with-no-warnings magit-revert-buffers)) (let ((start (current-time))) (magit-message "Turning on magit-auto-revert-mode...") (magit-auto-revert-mode 1) @@ -250,11 +258,5 @@ located. If there is no current repository, then return FALLBACK (advice-add 'auto-revert-buffers :before 'auto-revert-buffers--buffer-list-filter) -(custom-add-to-group 'magit 'auto-revert-check-vc-info 'custom-variable) - -;;; magit-autorevert.el ends soon (provide 'magit-autorevert) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-autorevert.el ends here diff --git a/elpa/magit-20161115.1658/magit-bisect.el b/elpa/magit-20171009.1252/magit-bisect.el similarity index 96% rename from elpa/magit-20161115.1658/magit-bisect.el rename to elpa/magit-20171009.1252/magit-bisect.el index 9b58feee..fff770d1 100644 --- a/elpa/magit-20161115.1658/magit-bisect.el +++ b/elpa/magit-20171009.1252/magit-bisect.el @@ -1,6 +1,6 @@ ;;; magit-bisect.el --- bisect support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2016 The Magit Project Contributors +;; Copyright (C) 2011-2017 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. @@ -29,6 +29,8 @@ (require 'magit) +;;; Options + (defcustom magit-bisect-show-graph t "Whether to use `--graph' in the log showing commits yet to be bisected." :package-version '(magit . "2.8.0") @@ -50,10 +52,11 @@ "Face for bad bisect revisions." :group 'magit-faces) +;;; Commands + ;;;###autoload (autoload 'magit-bisect-popup "magit-bisect" nil t) (magit-define-popup magit-bisect-popup "Popup console for bisect commands." - 'magit-commands :man-page "git-bisect" :actions '((?B "Start" magit-bisect-start) (?s "Start script" magit-bisect-run)) @@ -126,7 +129,7 @@ bisect run'." (cons (read-shell-command "Bisect shell command: ") args))) (when (and bad good) (magit-bisect-start bad good)) - (magit-git-bisect "run" (list cmdline))) + (magit-git-bisect "run" (list shell-file-name shell-command-switch cmdline))) (defun magit-git-bisect (subcommand &optional args no-assert) (unless (or no-assert (magit-bisect-in-progress-p)) @@ -135,6 +138,8 @@ bisect run'." (magit-run-git-with-logfile (magit-git-dir "BISECT_CMD_OUTPUT") "bisect" subcommand args))) +;;; Sections + (defun magit-bisect-in-progress-p () (file-exists-p (magit-git-dir "BISECT_LOG"))) @@ -167,7 +172,7 @@ bisect run'." (magit-insert-heading "Bisect Rest:") (magit-git-wash (apply-partially 'magit-log-wash-log 'bisect-vis) "bisect" "visualize" "git" "log" - "--format=%h%d %s" "--decorate=full" + "--format=%h%d%x00%s" "--decorate=full" (and magit-bisect-show-graph "--graph"))))) (defun magit-insert-bisect-log () @@ -201,9 +206,5 @@ bisect run'." (magit-insert-section (bisect-log) (insert hash " is the first bad commit\n")))))) -;;; magit-bisect.el ends soon (provide 'magit-bisect) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-bisect.el ends here diff --git a/elpa/magit-20161115.1658/magit-blame.el b/elpa/magit-20171009.1252/magit-blame.el similarity index 92% rename from elpa/magit-20161115.1658/magit-blame.el rename to elpa/magit-20171009.1252/magit-blame.el index 1202b686..d2e32c7c 100644 --- a/elpa/magit-20161115.1658/magit-blame.el +++ b/elpa/magit-20171009.1252/magit-blame.el @@ -1,6 +1,6 @@ ;;; magit-blame.el --- blame support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2012-2016 The Magit Project Contributors +;; Copyright (C) 2012-2017 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. @@ -34,7 +34,8 @@ (defgroup magit-blame nil "Blame support for Magit." - :group 'magit-extensions) + :link '(info-link "(magit)Blaming") + :group 'magit-modes) (defcustom magit-blame-heading-format "%-20a %C %s" "Format string used for blame headings. @@ -72,20 +73,17 @@ and then turned on again when turning off the latter." :group 'magit-blame :type '(repeat (symbol :tag "Mode"))) -(make-variable-buffer-local 'magit-blame-disabled-modes) - (defcustom magit-blame-mode-lighter " Blame" "The mode-line lighter of the Magit-Blame mode." :group 'magit-blame :type '(choice (const :tag "No lighter" "") string)) -(unless (find-lisp-object-file-name 'magit-blame-goto-chunk-hook 'defvar) - (add-hook 'magit-blame-goto-chunk-hook 'magit-blame-maybe-update-revision-buffer)) (defcustom magit-blame-goto-chunk-hook '(magit-blame-maybe-update-revision-buffer) "Hook run by `magit-blame-next-chunk' and `magit-blame-previous-chunk'." :package-version '(magit . "2.1.0") :group 'magit-blame :type 'hook + :get 'magit-hook-custom-get :options '(magit-blame-maybe-update-revision-buffer)) (defface magit-blame-heading @@ -100,39 +98,46 @@ and then turned on again when turning off the latter." (defface magit-blame-summary '((t :inherit magit-blame-heading)) - "Face used for commit summary in blame headings." + "Face for commit summary in blame headings." :group 'magit-faces) (defface magit-blame-hash '((t :inherit magit-blame-heading)) - "Face used for commit hash in blame headings." + "Face for commit hash in blame headings." :group 'magit-faces) (defface magit-blame-name '((t :inherit magit-blame-heading)) - "Face used for author and committer names in blame headings." + "Face for author and committer names in blame headings." :group 'magit-faces) (defface magit-blame-date '((t :inherit magit-blame-heading)) - "Face used for dates in blame headings." + "Face for dates in blame headings." :group 'magit-faces) -;;; Code +;;; Mode (defvar magit-blame-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\r" 'magit-show-commit) - (define-key map "\s" 'magit-diff-show-or-scroll-up) - (define-key map "\d" 'magit-diff-show-or-scroll-down) - (define-key map "b" 'magit-blame-popup) - (define-key map "n" 'magit-blame-next-chunk) - (define-key map "N" 'magit-blame-next-chunk-same-commit) - (define-key map "p" 'magit-blame-previous-chunk) - (define-key map "P" 'magit-blame-previous-chunk-same-commit) - (define-key map "q" 'magit-blame-quit) - (define-key map "t" 'magit-blame-toggle-headings) - (define-key map "\M-w" 'magit-blame-copy-hash) + (cond ((featurep 'jkl) + (define-key map [return] 'magit-show-commit) + (define-key map (kbd "i") 'magit-blame-previous-chunk) + (define-key map (kbd "I") 'magit-blame-previous-chunk-same-commit) + (define-key map (kbd "k") 'magit-blame-next-chunk) + (define-key map (kbd "K") 'magit-blame-next-chunk-same-commit)) + (t + (define-key map (kbd "C-m") 'magit-show-commit) + (define-key map (kbd "p") 'magit-blame-previous-chunk) + (define-key map (kbd "P") 'magit-blame-previous-chunk-same-commit) + (define-key map (kbd "n") 'magit-blame-next-chunk) + (define-key map (kbd "N") 'magit-blame-next-chunk-same-commit))) + (define-key map (kbd "b") 'magit-blame-popup) + (define-key map (kbd "t") 'magit-blame-toggle-headings) + (define-key map (kbd "q") 'magit-blame-quit) + (define-key map (kbd "M-w") 'magit-blame-copy-hash) + (define-key map (kbd "SPC") 'magit-diff-show-or-scroll-up) + (define-key map (kbd "DEL") 'magit-diff-show-or-scroll-down) map) "Keymap for `magit-blame-mode'.") @@ -148,6 +153,7 @@ and then turned on again when turning off the latter." (defvar-local magit-blame-buffer-read-only nil) (defvar-local magit-blame-cache nil) +(defvar-local magit-blame-disabled-modes nil) (defvar-local magit-blame-process nil) (defvar-local magit-blame-recursive-p nil) (defvar-local magit-blame-separator nil) @@ -190,10 +196,11 @@ and then turned on again when turning off the latter." (advice-add 'auto-revert-handler :before-until 'auto-revert-handler--unless-magit-blame-mode) +;;; Popup + ;;;###autoload (autoload 'magit-blame-popup "magit-blame" nil t) (magit-define-popup magit-blame-popup "Popup console for blame commands." - 'magit-commands :man-page "git-blame" :switches '((?w "Ignore whitespace" "-w") (?r "Do not treat root commits as boundaries" "--root")) @@ -203,6 +210,8 @@ and then turned on again when turning off the latter." :default-arguments '("-w") :default-action 'magit-blame) +;;; Process + ;;;###autoload (defun magit-blame (revision file &optional args line) "Display edit history of FILE up to REVISION. @@ -227,7 +236,7 @@ only arguments available from `magit-blame-popup' should be used. (list it (magit-blame-chunk-get :previous-file) args (magit-blame-chunk-get :previous-start)) (user-error "Block has no further history")) - (--if-let (magit-file-relative-name nil 'tracked) + (--if-let (magit-file-relative-name nil (not magit-buffer-file-name)) (list (or magit-buffer-refname magit-buffer-revision) it args) (if buffer-file-name (user-error "Buffer isn't visiting a tracked file") @@ -355,6 +364,8 @@ This is intended for debugging purposes.") (kill-process process) (user-error "Buffer being blamed has been killed"))) +;;; Display + (defun magit-blame-make-overlay (chunk) (let ((ov (save-excursion (save-restriction @@ -418,6 +429,8 @@ This is intended for debugging purposes.") (format-time-string format (seconds-to-time (+ time (* (/ tz 100) 60 60) (* (% tz 100) 60))))) +;;; Commands + (defun magit-blame-quit () "Turn off Magit-Blame mode. If the buffer was created during a recursive blame, @@ -496,6 +509,8 @@ like `kill-ring-save' would." (copy-region-as-kill nil nil 'region) (kill-new (message "%s" (magit-blame-chunk-get :hash))))) +;;; Utilities + (defun magit-blame-chunk-get (key &optional pos) (--when-let (magit-blame-overlay-at pos) (plist-get (overlay-get it 'magit-blame) key))) @@ -519,9 +534,5 @@ like `kill-ring-save' would." (let ((magit-display-buffer-noselect t)) (apply #'magit-show-commit rev (magit-diff-arguments)))))))))) -;;; magit-blame.el ends soon (provide 'magit-blame) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-blame.el ends here diff --git a/elpa/magit-20171009.1252/magit-bookmark.el b/elpa/magit-20171009.1252/magit-bookmark.el new file mode 100644 index 00000000..6f0306bd --- /dev/null +++ b/elpa/magit-20171009.1252/magit-bookmark.el @@ -0,0 +1,364 @@ +;;; magit-bookmark.el --- bookmark support for Magit -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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: Yuri Khan +;; 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: + +;; Support for bookmarks for most Magit buffers. + +;;; Code: + +(require 'magit) +(require 'bookmark) + +;;; Supporting primitives + +(defun magit-bookmark--jump (bookmark fn &rest args) + "Handle a Magit BOOKMARK. + +This function will: + +1. Bind `default-directory' to the repository root directory + stored in the `filename' bookmark property. +2. Invoke the function FN with ARGS as arguments. This needs to + restore the buffer. +3. Restore the expanded/collapsed status of top level sections + and the point position." + (declare (indent 2)) + (let* ((default-directory (bookmark-get-filename bookmark))) + (if default-directory + (apply fn args) + (signal 'bookmark-error-no-filename (list 'stringp default-directory))) + (when (derived-mode-p 'magit-mode) + (-when-let (hidden-sections (bookmark-prop-get bookmark + 'magit-hidden-sections)) + (--each (magit-section-children magit-root-section) + (if (member (cons (magit-section-type it) (magit-section-value it)) + hidden-sections) + (magit-section-hide it) + (magit-section-show it))))) + (--when-let (bookmark-get-position bookmark) + (goto-char it)) + (--when-let (bookmark-get-front-context-string bookmark) + (when (search-forward it (point-max) t) + (goto-char (match-beginning 0)))) + (--when-let (bookmark-get-rear-context-string bookmark) + (when (search-backward it (point-min) t) + (goto-char (match-end 0)))) + nil)) + +(defun magit-bookmark--make-record (mode handler &optional make-props) + "Create a Magit bookmark. + +MODE specifies the expected major mode of current buffer. + +HANDLER should be a function that will be used to restore this +buffer. + +MAKE-PROPS should be either nil or a function that will be called +with `magit-refresh-args' as the argument list, and may return an +alist whose every element has the form (PROP . VALUE) and +specifies additional properties to store in the bookmark." + (declare (indent 1)) + (unless (eq major-mode mode) + (user-error "Not in a %s buffer" mode)) + (let ((bookmark (bookmark-make-record-default 'no-file))) + (bookmark-prop-set bookmark 'handler handler) + (bookmark-set-filename bookmark (magit-toplevel)) + (when (derived-mode-p 'magit-mode) + (bookmark-prop-set + bookmark 'magit-hidden-sections + (--map (cons (magit-section-type it) (magit-section-value it)) + (-filter #'magit-section-hidden + (magit-section-children magit-root-section))))) + (when make-props + (pcase-dolist (`(,prop . ,value) (apply make-props magit-refresh-args)) + (bookmark-prop-set bookmark prop value))) + bookmark)) + +;;; Status + +;;;###autoload +(defun magit-bookmark--status-jump (bookmark) + "Handle a Magit status BOOKMARK." + (magit-bookmark--jump bookmark + (lambda () (magit-status-internal default-directory)))) + +;;;###autoload +(defun magit-bookmark--status-make-record () + "Create a Magit status bookmark." + (magit-bookmark--make-record 'magit-status-mode + #'magit-bookmark--status-jump)) + +;;; Refs + +;;;###autoload +(defun magit-bookmark--refs-jump (bookmark) + "Handle a Magit refs BOOKMARK." + (magit-bookmark--jump bookmark #'magit-show-refs + (bookmark-prop-get bookmark 'magit-refs) + (bookmark-prop-get bookmark 'magit-args))) + +;;;###autoload +(defun magit-bookmark--refs-make-record () + "Create a Magit refs bookmark." + (magit-bookmark--make-record 'magit-refs-mode + #'magit-bookmark--refs-jump + (lambda (refs args) + `((magit-refs . ,refs) + (magit-args . ,args))))) + +;;; Log + +;;;###autoload +(defun magit-bookmark--log-jump (bookmark) + "Handle a Magit log BOOKMARK." + (magit-bookmark--jump bookmark #'magit-log + (bookmark-prop-get bookmark 'magit-revs) + (bookmark-prop-get bookmark 'magit-args) + (bookmark-prop-get bookmark 'magit-files))) + +(defun magit-bookmark--log-make-name (buffer-name revs _args files) + "Generate the default name for a log bookmark." + (concat + buffer-name " " (mapconcat #'identity revs " ") + (and files + (concat " touching " (mapconcat #'identity files " "))))) + +;;;###autoload +(defun magit-bookmark--log-make-record () + "Create a Magit log bookmark." + (magit-bookmark--make-record 'magit-log-mode + #'magit-bookmark--log-jump + (lambda (revs args files) + `((defaults . (,(magit-bookmark--log-make-name + (buffer-name) revs args files))) + (magit-revs . ,revs) + (magit-args . ,args) + (magit-files . ,files))))) + +;;; Reflog + +;;;###autoload +(defun magit-bookmark--reflog-jump (bookmark) + "Handle a Magit reflog BOOKMARK." + (magit-bookmark--jump bookmark + (lambda () + (let ((magit-reflog-arguments (bookmark-prop-get bookmark 'magit-args))) + (magit-reflog (bookmark-prop-get bookmark 'magit-ref)))))) + +(defun magit-bookmark--reflog-make-name (buffer-name ref) + "Generate the default name for a reflog bookmark." + (concat buffer-name " " ref)) + +;;;###autoload +(defun magit-bookmark--reflog-make-record () + "Create a Magit reflog bookmark." + (magit-bookmark--make-record 'magit-reflog-mode + #'magit-bookmark--reflog-jump + (lambda (ref args) + `((defaults . (,(magit-bookmark--reflog-make-name (buffer-name) ref))) + (magit-ref . ,ref) + (magit-args . ,args))))) + +;;; Stashes + +;;;###autoload +(defun magit-bookmark--stashes-jump (bookmark) + "Handle a Magit stash list BOOKMARK." + (magit-bookmark--jump bookmark #'magit-stash-list)) + +;;;###autoload +(defun magit-bookmark--stashes-make-record () + "Create a Magit stash list bookmark." + (magit-bookmark--make-record 'magit-stashes-mode + #'magit-bookmark--stashes-jump)) + +;;; Cherry + +;;;###autoload +(defun magit-bookmark--cherry-jump (bookmark) + "Handle a Magit cherry BOOKMARK." + (magit-bookmark--jump bookmark #'magit-cherry + (bookmark-prop-get bookmark 'magit-head) + (bookmark-prop-get bookmark 'magit-upstream))) + +(defun magit-bookmark--cherry-make-name (buffer-name head upstream) + "Generate the default name for a cherry bookmark." + (concat buffer-name " " head " upstream " upstream)) + +;;;###autoload +(defun magit-bookmark--cherry-make-record () + "Create a Magit cherry bookmark." + (magit-bookmark--make-record 'magit-cherry-mode + #'magit-bookmark--cherry-jump + (lambda (upstream head) + `((defaults . (,(magit-bookmark--cherry-make-name + (buffer-name) head upstream))) + (magit-head . ,head) + (magit-upstream . ,upstream))))) + +;;; Diff + +;;;###autoload +(defun magit-bookmark--diff-jump (bookmark) + "Handle a Magit diff BOOKMARK." + (magit-bookmark--jump bookmark #'magit-diff-setup + (bookmark-prop-get bookmark 'magit-rev-or-range) + (bookmark-prop-get bookmark 'magit-const) + (bookmark-prop-get bookmark 'magit-args) + (bookmark-prop-get bookmark 'magit-files))) + +(defun magit-bookmark--resolve (rev-or-range) + "Return REV-OR-RANGE with ref names resolved to commit hashes." + (pcase (magit-git-lines "rev-parse" rev-or-range) + (`(,rev) + (magit-rev-abbrev rev)) + ((and `(,rev1 ,rev2) + (guard (/= ?^ (aref rev1 0))) + (guard (= ?^ (aref rev2 0)))) + (concat (magit-rev-abbrev (substring rev2 1)) + ".." + (magit-rev-abbrev rev1))) + ((and `(,rev1 ,rev2 ,rev3) + (guard (/= ?^ (aref rev1 0))) + (guard (/= ?^ (aref rev2 0))) + (guard (= ?^ (aref rev3 0)))) + (ignore rev3) + (concat (magit-rev-abbrev rev1) + "..." + (magit-rev-abbrev rev2))) + (_ + rev-or-range))) + +(defun magit-bookmark--diff-make-name + (buffer-name rev-or-range const _args files) + "Generate a default name for a diff bookmark." + (if (member "--no-index" const) + (apply #'format "*magit-diff %s %s" files) + (concat buffer-name " " + (cond (rev-or-range) + ((member "--cached" const) "staged") + (t "unstaged")) + (when files + (concat " in " (mapconcat #'identity files ", ")))))) + +;;;###autoload +(defun magit-bookmark--diff-make-record () + "Create a Magit diff bookmark." + (magit-bookmark--make-record 'magit-diff-mode + #'magit-bookmark--diff-jump + (lambda (rev-or-range const args files) + (let ((resolved (magit-bookmark--resolve rev-or-range))) + `((defaults . (,(magit-bookmark--diff-make-name + (buffer-name) resolved const args files))) + (magit-rev-or-range . ,resolved) + (magit-const . ,const) + (magit-args . ,args) + (magit-files . ,files)))))) + +;;; Revision + +;;;###autoload +(defun magit-bookmark--revision-jump (bookmark) + "Handle a Magit revision BOOKMARK." + (magit-bookmark--jump bookmark #'magit-show-commit + (bookmark-prop-get bookmark 'magit-rev) + (bookmark-prop-get bookmark 'args) + (bookmark-prop-get bookmark 'files))) + +(defun magit-bookmark--revision-make-name (buffer-name rev _args files) + "Generate a default name for a revision bookmark." + (let ((subject (magit-rev-format "%s" rev))) + (concat buffer-name " " + (magit-rev-abbrev rev) + (cond (files (concat " " (mapconcat #'identity files " "))) + (subject (concat " " subject)))))) + +;;;###autoload +(defun magit-bookmark--revision-make-record () + "Create a Magit revision bookmark." + ;; magit-refresh-args stores the revision in relative form. + ;; For bookmarks, the exact hash is more appropriate. + (magit-bookmark--make-record 'magit-revision-mode + #'magit-bookmark--revision-jump + (lambda (_rev _ args files) + `((defaults . (,(magit-bookmark--revision-make-name + (buffer-name) magit-buffer-revision-hash + args files))) + (magit-rev . ,magit-buffer-revision-hash) + (magit-args . ,args) + (magit-files . ,files))))) + +;;; Stash + +;;;###autoload +(defun magit-bookmark--stash-jump (bookmark) + "Handle a Magit stash BOOKMARK." + (magit-bookmark--jump bookmark #'magit-stash-show + (bookmark-prop-get bookmark 'magit-stash) + (bookmark-prop-get bookmark 'magit-args) + (bookmark-prop-get bookmark 'magit-files))) + +(defun magit-bookmark--stash-make-name (buffer-name stash _args files) + "Generate the default name for a stash bookmark." + (concat buffer-name " " stash " " + (if files + (mapconcat #'identity files " ") + (magit-rev-format "%s" stash)))) + +;;;###autoload +(defun magit-bookmark--stash-make-record () + "Create a Magit stash bookmark." + (magit-bookmark--make-record 'magit-stash-mode + #'magit-bookmark--stash-jump + (lambda (stash _ args files) + `((defaults . (,(magit-bookmark--stash-make-name + (buffer-name) + (magit-rev-abbrev magit-buffer-revision-hash) + args files))) + (magit-stash . ,magit-buffer-revision-hash) + (magit-args . ,args) + (magit-files . ,files) + (magit-hidden-sections + . ,(--map `(,(magit-section-type it) + . ,(replace-regexp-in-string (regexp-quote stash) + magit-buffer-revision-hash + (magit-section-value it))) + (-filter #'magit-section-hidden + (magit-section-children magit-root-section)))))))) + +;;; Submodules + +;;;###autoload +(defun magit-bookmark--submodules-jump (bookmark) + "Handle a Magit submodule list BOOKMARK." + (magit-bookmark--jump bookmark #'magit-list-submodules)) + +;;;###autoload +(defun magit-bookmark--submodules-make-record () + "Create a Magit submodule list bookmark." + (magit-bookmark--make-record 'magit-submodule-list-mode + #'magit-bookmark--submodules-jump)) + +(provide 'magit-bookmark) +;;; magit-bookmark.el ends here diff --git a/elpa/magit-20171009.1252/magit-branch.el b/elpa/magit-20171009.1252/magit-branch.el new file mode 100644 index 00000000..02888560 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-branch.el @@ -0,0 +1,809 @@ +;;; magit-branch.el --- branch support -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for branches. It defines popups +;; and commands for creating, checking out, manipulating, and +;; configuring branches. Commands defined here are mainly concerned +;; with branches as pointers, commands that deal with what a branch +;; points at, are defined elsewhere. + +;;; Code: + +(require 'magit) + +;;; Options + +(defcustom magit-branch-read-upstream-first t + "Whether to read upstream before name of new branch when creating a branch. + +`nil' Read the branch name first. +`t' Read the upstream first. +`fallback' Read the upstream first, but if it turns out that the chosen + value is not a valid upstream (because it cannot be resolved + as an existing revision), then treat it as the name of the + new branch and continue by reading the upstream next." + :package-version '(magit . "2.2.0") + :group 'magit-commands + :type '(choice (const :tag "read branch name first" nil) + (const :tag "read upstream first" t) + (const :tag "read upstream first, with fallback" fallback))) + +(defcustom magit-branch-prefer-remote-upstream nil + "Whether to favor remote upstreams when creating new branches. + +When a new branch is created, then the branch, commit, or stash +at point is suggested as the default starting point of the new +branch, or if there is no such revision at point the current +branch. In either case the user may choose another starting +point. + +If the chosen starting point is a branch, then it may also be set +as the upstream of the new branch, depending on the value of the +Git variable `branch.autoSetupMerge'. By default this is done +for remote branches, but not for local branches. + +You might prefer to always use some remote branch as upstream. +If the chosen starting point is (1) a local branch, (2) whose +name matches a member of the value of this option, (3) the +upstream of that local branch is a remote branch with the same +name, and (4) that remote branch can be fast-forwarded to the +local branch, then the chosen branch is used as starting point, +but its own upstream is used as the upstream of the new branch. + +Members of this option's value are treated as branch names that +have to match exactly unless they contain a character that makes +them invalid as a branch name. Recommended characters to use +to trigger interpretation as a regexp are \"*\" and \"^\". Some +other characters which you might expect to be invalid, actually +are not, e.g. \".+$\" are all perfectly valid. More precisely, +if `git check-ref-format --branch STRING' exits with a non-zero +status, then treat STRING as a regexp. + +Assuming the chosen branch matches these conditions you would end +up with with e.g.: + + feature --upstream--> origin/master + +instead of + + feature --upstream--> master --upstream--> origin/master + +Which you prefer is a matter of personal preference. If you do +prefer the former, then you should add branches such as \"master\", +\"next\", and \"maint\" to the value of this options." + :package-version '(magit . "2.4.0") + :group 'magit-commands + :type '(repeat string)) + +(defcustom magit-branch-adjust-remote-upstream-alist nil + "Alist of upstreams to be used when branching from remote branches. + +When creating a local branch from an ephemeral branch located +on a remote, e.g. a feature or hotfix branch, then that remote +branch should usually not be used as the upstream branch, since +the push-remote already allows accessing it and having both the +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 +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. + +UPSTREAM is the branch to be used as the upstream for branches +specified by RULE. It can be a local or a remote branch. + +RULE can either be a regular expression, matching branches whose +upstream should be the one specified by UPSTREAM. Or it can be +a list of the only branches that should *not* use UPSTREAM; all +other branches will. Matching is done after stripping the remote +part of the name of the branch that is being branched from. + +If you use a finite set of non-ephemeral branches across all your +repositories, then you might use something like: + + ((\"origin/master\" \"master\" \"next\" \"maint\")) + +Or if the names of all your ephemeral branches contain a slash, +at least in some repositories, then a good value could be: + + ((\"origin/master\" . \"/\")) + +Of course you can also fine-tune: + + ((\"origin/maint\" . \"\\`hotfix/\") + (\"origin/master\" . \"\\`feature/\"))" + :package-version '(magit . "2.9.0") + :group 'magit-commands + :type '(repeat (cons (string :tag "Use upstream") + (choice :tag "for branches" + (regexp :tag "matching") + (repeat :tag "except" + (string :tag "branch")))))) + +(defcustom magit-branch-popup-show-variables t + "Whether the `magit-branch-popup' shows Git variables. +This defaults to t to avoid changing key bindings. When set to +nil, no variables are displayed directly in this popup, instead +the sub-popup `magit-branch-config-popup' has to be used to view +and change branch related variables." + :package-version '(magit . "2.7.0") + :group 'magit-commands + :type 'boolean) + +;;; Branch Popup + +;;;###autoload (autoload 'magit-branch-popup "magit" nil t) +(magit-define-popup magit-branch-popup + "Popup console for branch commands." + :man-page "git-branch" + :actions '((?b "Checkout" magit-checkout) + (?n "Create new branch" magit-branch) + (?C "Configure..." magit-branch-config-popup) + (?c "Checkout new branch" magit-branch-and-checkout) + (?s "Create new spin-off" magit-branch-spinoff) + (?m "Rename" magit-branch-rename) + (?w "Checkout new worktree" magit-worktree-checkout) + (?W "Create new worktree" magit-worktree-branch) + (?x "Reset" magit-branch-reset) nil nil + (?k "Delete" magit-branch-delete)) + :default-action 'magit-checkout + :max-action-columns 3 + :setup-function 'magit-branch-popup-setup) + +(defvar magit-branch-config-variables) + +(defun magit-branch-popup-setup (val def) + (magit-popup-default-setup val def) + (when magit-branch-popup-show-variables + (magit-popup-put :variables (magit-popup-convert-variables + val magit-branch-config-variables)) + (use-local-map (copy-keymap magit-popup-mode-map)) + (dolist (ev (-filter #'magit-popup-event-p (magit-popup-get :variables))) + (local-set-key (vector (magit-popup-event-key ev)) + 'magit-invoke-popup-action)))) + +;;; Branch Commands + +;;;###autoload +(defun magit-checkout (revision) + "Checkout REVISION, updating the index and the working tree. +If REVISION is a local branch, then that becomes the current +branch. If it is something else, then `HEAD' becomes detached. +Checkout fails if the working tree or the staging area contain +changes. +\n(git checkout REVISION)." + (interactive (list (magit-read-other-branch-or-commit "Checkout"))) + (when (string-match "\\`heads/\\(.+\\)" revision) + (setq revision (match-string 1 revision))) + (magit-run-git "checkout" revision)) + +;;;###autoload +(defun magit-branch (branch start-point &optional args) + "Create BRANCH at branch or revision START-POINT. +\n(git branch [ARGS] BRANCH START-POINT)." + (interactive (magit-branch-read-args "Create branch")) + (magit-call-git "branch" args branch start-point) + (magit-branch-maybe-adjust-upstream branch start-point) + (magit-refresh)) + +;;;###autoload +(defun magit-branch-and-checkout (branch start-point &optional args) + "Create and checkout BRANCH at branch or revision START-POINT. +\n(git checkout [ARGS] -b BRANCH START-POINT)." + (interactive (magit-branch-read-args "Create and checkout branch")) + (if (string-match-p "^stash@{[0-9]+}$" start-point) + (magit-run-git "stash" "branch" branch start-point) + (magit-call-git "checkout" args "-b" branch start-point) + (magit-branch-maybe-adjust-upstream branch start-point) + (magit-refresh))) + +;;;###autoload +(defun magit-branch-or-checkout (arg &optional start-point) + "Hybrid between `magit-checkout' and `magit-branch-and-checkout'. + +Ask the user for an existing branch or revision. If the user +input actually can be resolved as a branch or revision, then +check that out, just like `magit-checkout' would. + +Otherwise create and checkout a new branch using the input as +its name. Before doing so read the starting-point for the new +branch. This is similar to what `magit-branch-and-checkout' +does." + (interactive + (let ((arg (magit-read-other-branch-or-commit "Checkout"))) + (list arg + (and (not (magit-rev-verify-commit arg)) + (magit-read-starting-point + (format "Create and checkout branch `%s' starting at" arg)))))) + (when (string-match "\\`heads/\\(.+\\)" arg) + (setq arg (match-string 1 arg))) + (if start-point + (magit-branch-and-checkout arg start-point (magit-branch-arguments)) + (magit-run-git "checkout" arg))) + +(defun magit-branch-maybe-adjust-upstream (branch start-point) + (--when-let + (or (and (magit-get-upstream-branch branch) + (magit-get-indirect-upstream-branch start-point)) + (and (magit-remote-branch-p start-point) + (let ((name (cdr (magit-split-branch-name start-point)))) + (car (--first (if (listp (cdr it)) + (not (member name (cdr it))) + (string-match-p (cdr it) name)) + magit-branch-adjust-remote-upstream-alist))))) + (magit-call-git "branch" (concat "--set-upstream-to=" it) branch))) + +;;;###autoload +(defun magit-branch-orphan (branch start-point &optional args) + "Create and checkout an orphan BRANCH with contents from revision START-POINT. +\n(git checkout --orphan [ARGS] BRANCH START-POINT)." + (interactive (magit-branch-read-args "Create and checkout orphan branch")) + (magit-run-git "checkout" "--orphan" args branch start-point)) + +(defun magit-branch-read-args (prompt) + (let ((args (magit-branch-arguments))) + (if magit-branch-read-upstream-first + (let* ((default (and (or (memq this-command magit-no-confirm-default) + (memq magit-current-popup-action + magit-no-confirm-default)) + (magit--default-starting-point))) + (choice (or default + (magit-read-starting-point prompt)))) + (if (magit-rev-verify choice) + (list (magit-read-string-ns + (if default + (format "%s (starting at %s)" prompt choice) + "Branch name") + (let ((def (mapconcat #'identity + (cdr (split-string choice "/")) + "/"))) + (and (member choice (magit-list-remote-branch-names)) + (not (member def (magit-list-local-branch-names))) + def))) + choice args) + (if (eq magit-branch-read-upstream-first 'fallback) + (list choice + (magit-read-starting-point (concat prompt " " choice)) + args) + (user-error "Not a valid starting-point: %s" choice)))) + (let ((branch (magit-read-string-ns (concat prompt " named")))) + (list branch + (magit-read-starting-point (concat prompt " " branch)) + args))))) + +;;;###autoload +(defun magit-branch-spinoff (branch &optional from &rest args) + "Create new branch from the unpushed commits. + +Create and checkout a new branch starting at and tracking the +current branch. That branch in turn is reset to the last commit +it shares with its upstream. If the current branch has no +upstream or no unpushed commits, then the new branch is created +anyway and the previously current branch is not touched. + +This is useful to create a feature branch after work has already +began on the old branch (likely but not necessarily \"master\"). + +If the current branch is a member of the value of option +`magit-branch-prefer-remote-upstream' (which see), then the +current branch will be used as the starting point as usual, but +the upstream of the starting-point may be used as the upstream +of the new branch, instead of the starting-point itself. + +If optional FROM is non-nil, then the source branch is reset +to `FROM~', instead of to the last commit it shares with its +upstream. Interactively, FROM is only ever non-nil, if the +region selects some commits, and among those commits, FROM is +the commit that is the fewest commits ahead of the source +branch. (It not yet possible to spin off a single commit, +unless it is the only unpushed commit. See #2920.) + +The commit at the other end of the selection actually does not +matter, all commits between FROM and `HEAD' are moved to the new +branch. If FROM is not reachable from `HEAD' or is reachable +from the source branch's upstream, then an error is raised." + (interactive (list (magit-read-string "Spin off branch") + (car (last (magit-region-values 'commit))) + (magit-branch-arguments))) + (when (magit-branch-p branch) + (user-error "Cannot spin off %s. It already exists" branch)) + (-if-let (current (magit-get-current-branch)) + (let ((tracked (magit-get-upstream-branch current)) + base) + (when from + (unless (magit-rev-ancestor-p from current) + (user-error "Cannot spin off %s. %s is not reachable from %s" + branch from current)) + (when (and tracked + (magit-rev-ancestor-p from tracked)) + (user-error "Cannot spin off %s. %s is ancestor of upstream %s" + branch from tracked))) + (magit-call-git "checkout" args "-b" branch current) + (--when-let (magit-get-indirect-upstream-branch current) + (magit-call-git "branch" "--set-upstream-to" it branch)) + (when (and tracked + (setq base + (if from + (concat from "^") + (magit-git-string "merge-base" current tracked))) + (not (magit-rev-eq base current))) + (magit-call-git "update-ref" "-m" + (format "reset: moving to %s" base) + (concat "refs/heads/" current) base)) + (magit-refresh)) + (magit-run-git "checkout" "-b" branch))) + +;;;###autoload +(defun magit-branch-reset (branch to &optional args set-upstream) + "Reset a branch to the tip of another branch or any other commit. + +When the branch being reset is the current branch, then do a +hard reset. If there are any uncommitted changes, then the user +has to confirm the reset because those changes would be lost. + +This is useful when you have started work on a feature branch but +realize it's all crap and want to start over. + +When resetting to another branch and a prefix argument is used, +then also set the target branch as the upstream of the branch +that is being reset." + (interactive + (let* ((atpoint (magit-branch-at-point)) + (branch (magit-read-local-branch "Reset branch" atpoint))) + (list branch + (magit-completing-read (format "Reset %s to" branch) + (delete branch (magit-list-branch-names)) + nil nil nil 'magit-revision-history + (or (and (not (equal branch atpoint)) atpoint) + (magit-get-upstream-branch branch))) + (magit-branch-arguments) + current-prefix-arg))) + (unless (member "--force" args) + (setq args (cons "--force" args))) + (if (equal branch (magit-get-current-branch)) + (if (and (magit-anything-modified-p) + (not (yes-or-no-p "Uncommitted changes will be lost. Proceed?"))) + (user-error "Abort") + (magit-reset-hard to) + (when (and set-upstream (magit-branch-p to)) + (magit-set-branch*merge/remote branch to))) + (magit-branch branch to args))) + +;;;###autoload +(defun magit-branch-delete (branches &optional force) + "Delete one or multiple branches. +If the region marks multiple branches, then offer to delete +those, otherwise prompt for a single branch to be deleted, +defaulting to the branch at point." + ;; One would expect this to be a command as simple as, for example, + ;; `magit-branch-rename'; but it turns out everyone wants to squeeze + ;; a bit of extra functionality into this one. And once it's there, + ;; you cannot remove it anymore. (I tried, it causes protests.) + (interactive + (let ((branches (magit-region-values 'branch)) + (force current-prefix-arg)) + (if (if (> (length branches) 1) + (magit-confirm t nil "Delete %i branches" branches) + (setq branches + (list (magit-read-branch (if force + "Force delete branch" + "Delete branch") + (magit-get-previous-branch))))) + (unless force + (--when-let (-remove #'magit-branch-merged-p branches) + (if (magit-confirm 'delete-unmerged-branch + "Delete unmerged branch %s" + "Delete %i unmerged branches" it) + (setq force branches) + (or (setq branches (-difference branches it)) + (user-error "Abort"))))) + (user-error "Abort")) + (list branches force))) + (let* ((refs (-map #'magit-ref-fullname branches)) + (ambiguous (--filter (not it) refs))) + (when ambiguous + (user-error + "%s ambiguous. Please cleanup using git directly." + (let ((len (length ambiguous))) + (cond + ((= len 1) + (format "%s is" (-first #'magit-ref-ambiguous-p branches))) + ((= len (length refs)) + (format "These %s names are" len)) + (t + (format "%s of these names are" len)))))) + (cond + ((string-match "^refs/remotes/\\([^/]+\\)" (car refs)) + (let* ((remote (match-string 1 (car refs))) + (offset (1+ (length remote)))) + ;; Assume the branches actually still exists on the remote. + (magit-run-git-async + "push" remote (--map (concat ":" (substring it offset)) branches)) + ;; If that is not the case, then this deletes the tracking branches. + (set-process-sentinel + magit-this-process + (apply-partially 'magit-delete-remote-branch-sentinel refs)))) + ((> (length branches) 1) + (magit-run-git "branch" (if force "-D" "-d") + (delete (magit-get-current-branch) branches))) + (t ; And now for something completely different. + (let* ((branch (car branches)) + (prompt (format "Branch %s is checked out. " branch))) + (when (equal branch (magit-get-current-branch)) + (pcase (if (or (equal branch "master") + (not (magit-rev-verify "master"))) + (magit-read-char-case prompt nil + (?d "[d]etach HEAD & delete" 'detach) + (?a "[a]bort" 'abort)) + (magit-read-char-case prompt nil + (?d "[d]etach HEAD & delete" 'detach) + (?c "[c]heckout master & delete" 'master) + (?a "[a]bort" 'abort))) + (`detach (unless (or (equal force '(4)) + (member branch force) + (magit-branch-merged-p branch t) + (magit-confirm 'delete-unmerged-branch + "Delete unmerged branch %s" "" + (list branch))) + (user-error "Abort")) + (magit-call-git "checkout" "--detach")) + (`master (unless (or (equal force '(4)) + (member branch force) + (magit-branch-merged-p branch "master") + (magit-confirm 'delete-unmerged-branch + "Delete unmerged branch %s" "" + (list branch))) + (user-error "Abort")) + (magit-call-git "checkout" "master")) + (`abort (user-error "Abort"))) + (setq force t)) + (magit-run-git "branch" (if force "-D" "-d") branch)))))) + +(put 'magit-branch-delete 'interactive-only t) + +(defun magit-delete-remote-branch-sentinel (refs process event) + (when (memq (process-status process) '(exit signal)) + (if (= (process-exit-status process) 0) + (magit-process-sentinel process event) + (-if-let (rest (-filter #'magit-ref-exists-p refs)) + (progn + (process-put process 'inhibit-refresh t) + (magit-process-sentinel process event) + (setq magit-this-error nil) + (message "Some remote branches no longer exist. %s" + "Deleting just the local tracking refs instead...") + (--each rest (magit-call-git "update-ref" "-d" it)) + (magit-refresh) + (message "Deleting local remote-tracking refs...done")) + (magit-process-sentinel process event))))) + +;;;###autoload +(defun magit-branch-rename (old new &optional force) + "Rename branch OLD to NEW. +With prefix, forces the rename even if NEW already exists. +\n(git branch -m|-M OLD NEW)." + (interactive + (let ((branch (or (and (memq 'magit-branch-rename magit-no-confirm-default) + (or (magit-local-branch-at-point) + (magit-get-current-branch))) + (magit-read-local-branch "Rename branch")))) + (list branch + (magit-read-string-ns (format "Rename branch '%s' to" branch) + nil 'magit-revision-history) + current-prefix-arg))) + (unless (string= old new) + (magit-run-git "branch" (if force "-M" "-m") old new))) + +;;; Config Popup + +(defvar magit-branch-config-branch nil) + +;;;###autoload +(defun magit-branch-config-popup (branch) + "Popup console for setting branch variables." + (interactive + (list (if (or current-prefix-arg + (and (eq magit-current-popup 'magit-branch-popup) + magit-branch-popup-show-variables)) + (magit-read-local-branch "Configure branch") + (magit-get-current-branch)))) + (let ((magit-branch-config-branch branch)) + (magit-invoke-popup 'magit-branch-config-popup nil nil))) + +(defvar magit-branch-config-variables + '((lambda () + (concat + (propertize "Configure " 'face 'magit-popup-heading) + (propertize (magit-branch-config-branch) 'face 'magit-branch-local))) + (?d "branch.%s.description" + magit-edit-branch*description + magit-format-branch*description) + (?u "branch.%s.merge" + magit-set-branch*merge/remote + magit-format-branch*merge/remote) + (?r "branch.%s.rebase" + magit-cycle-branch*rebase + magit-format-branch*rebase) + (?p "branch.%s.pushRemote" + magit-cycle-branch*pushRemote + magit-format-branch*pushRemote) + "Configure repository defaults" + (?\M-r "pull.rebase" + magit-cycle-pull.rebase + magit-format-pull.rebase) + (?\M-p "remote.pushDefault" + magit-cycle-remote.pushDefault + magit-format-remote.pushDefault) + "Configure branch creation" + (?U "branch.autoSetupMerge" + magit-cycle-branch*autoSetupMerge + magit-format-branch*autoSetupMerge) + (?R "branch.autoSetupRebase" + magit-cycle-branch*autoSetupRebase + magit-format-branch*autoSetupRebase))) + +(defvar magit-branch-config-popup + `(:man-page "git-branch" + :variables ,magit-branch-config-variables + :default-action magit-checkout + :setup-function magit-branch-config-popup-setup)) + +(defun magit-branch-config-popup-setup (val def) + (magit-popup-default-setup val def) + (setq-local magit-branch-config-branch magit-branch-config-branch) + (use-local-map (copy-keymap magit-popup-mode-map)) + (dolist (ev (-filter #'magit-popup-event-p (magit-popup-get :variables))) + (local-set-key (vector (magit-popup-event-key ev)) + 'magit-invoke-popup-action))) + +(defun magit-branch-config-branch (&optional prompt) + (if prompt + (or (and (not current-prefix-arg) + (or magit-branch-config-branch + (magit-get-current-branch))) + (magit-read-local-branch prompt)) + (or magit-branch-config-branch + (magit-get-current-branch) + ""))) + +;;; Config Commands and Inserters + +;;;###autoload +(defun magit-edit-branch*description (branch) + "Edit the description of the current branch. +With a prefix argument edit the description of another branch. + +The description for the branch named NAME is stored in the Git +variable `branch..description'." + (interactive (list (magit-branch-config-branch "Edit branch description"))) + (magit-run-git-with-editor "branch" "--edit-description" branch)) + +(defun magit-edit-branch*description-check-buffers () + (and buffer-file-name + (string-match-p "/\\(BRANCH\\|EDIT\\)_DESCRIPTION\\'" buffer-file-name) + (add-hook 'with-editor-post-finish-hook + (lambda () + (when (derived-mode-p 'magit-popup-mode) + (magit-refresh-popup-buffer))) + nil t))) + +(add-hook 'find-file-hook 'magit-edit-branch*description-check-buffers) + +(defun magit-format-branch*description () + (let* ((branch (magit-branch-config-branch)) + (width (+ (length branch) 19)) + (var (format "branch.%s.description" branch))) + (concat var " " (make-string (- width (length var)) ?\s) + (-if-let (value (magit-get var)) + (propertize value 'face 'magit-popup-option-value) + (propertize "unset" 'face 'magit-popup-disabled-argument))))) + +;;;###autoload +(defun magit-set-branch*merge/remote (branch upstream) + "Set or unset the upstream of the current branch. +With a prefix argument do so for another branch. + +When the branch in question already has an upstream then simply +unsets it. Invoke this command again to set another upstream. + +Together the Git variables `branch..remote' and +`branch..merge' define the upstream branch of the local +branch named NAME. The value of `branch..remote' is the +name of the upstream remote. The value of `branch..merge' +is the full reference of the upstream branch, on the remote. + +Non-interactively, when UPSTREAM is non-nil, then always set it +as the new upstream, regardless of whether another upstream was +already set. When nil, then always unset." + (interactive + (let ((branch (magit-branch-config-branch "Change upstream of branch"))) + (list branch (and (not (magit-get-upstream-branch branch)) + (magit-read-upstream-branch branch))))) + (if upstream + (-let (((remote . merge) (magit-split-branch-name upstream))) + (setf (magit-get (format "branch.%s.remote" branch)) remote) + (setf (magit-get (format "branch.%s.merge" branch)) + (concat "refs/heads/" merge))) + (magit-call-git "branch" "--unset-upstream" branch)) + (when (called-interactively-p 'any) + (magit-refresh))) + +(defun magit-format-branch*merge/remote () + (let* ((branch (magit-branch-config-branch)) + (width (+ (length branch) 20)) + (varM (format "branch.%s.merge" branch)) + (varR (format "branch.%s.remote" branch)) + (face (if (equal (magit-get varR) ".") + 'magit-branch-local + 'magit-branch-remote))) + (concat varM (make-string (- width (length varM)) ?\s) + (-if-let (value (magit-get varM)) + (propertize value 'face face) + (propertize "unset" 'face 'magit-popup-disabled-argument)) + "\n " varR (make-string (- width (length varR)) ?\s) + (-if-let (value (magit-get varR)) + (propertize value 'face face) + (propertize "unset" 'face 'magit-popup-disabled-argument))))) + +;;;###autoload +(defun magit-cycle-branch*rebase (branch) + "Cycle the value of `branch..rebase' for the current branch. +With a prefix argument cycle the value for another branch. + +The Git variables `branch..rebase' controls whether pulling +into the branch named NAME is done by rebasing that branch onto +the fetched branch or by merging that branch. + +When `true' then pulling is done by rebasing. +When `false' then pulling is done by merging. + +When that variable is undefined then the value of `pull.rebase' +is used instead. It defaults to `false'." + (interactive (list (magit-branch-config-branch + "Cycle branch..rebase for"))) + (magit-popup-set-variable (format "branch.%s.rebase" branch) + '("true" "false") + "false" "pull.rebase")) + +(defun magit-format-branch*rebase () + (let ((branch (magit-branch-config-branch))) + (magit-popup-format-variable (format "branch.%s.rebase" branch) + '("true" "false") + "false" "pull.rebase" + (+ (length branch) 20)))) + +;;;###autoload +(defun magit-cycle-branch*pushRemote (branch) + "Cycle the value of `branch..pushRemote' for the current branch. +With a prefix argument cycle the value for another branch. + +The Git variable `branch..pushRemote' specifies the remote +that the branch named NAME is usually pushed to. The value has +to be the name of an existing remote. + +If that variable is undefined, then the value of the Git variable +`remote.pushDefault' is used instead, provided that it is defined, +which by default it is not." + (interactive (list (magit-branch-config-branch + "Cycle branch..pushRemote for"))) + (magit-popup-set-variable (format "branch.%s.pushRemote" branch) + (magit-list-remotes) + "remote.pushDefault")) + +(defun magit-format-branch*pushRemote () + (let ((branch (magit-branch-config-branch))) + (magit-popup-format-variable (format "branch.%s.pushRemote" branch) + (magit-list-remotes) + nil "remote.pushDefault" + (+ (length branch) 20)))) + +;;;###autoload +(defun magit-cycle-pull.rebase () + "Cycle the repository-local value of `pull.rebase'. + +The Git variable `pull.rebase' specifies whether pulling is done +by rebasing or by merging. It can be overwritten using the Git +variable `branch..rebase'. + +When `true' then pulling is done by rebasing. +When `false' (the default) then pulling is done by merging." + (interactive) + (magit-popup-set-variable "pull.rebase" '("true" "false") "false")) + +(defun magit-format-pull.rebase () + (magit-popup-format-variable "pull.rebase" '("true" "false") "false" nil 19)) + +;;;###autoload +(defun magit-cycle-remote.pushDefault () + "Cycle the repository-local value of `remote.pushDefault'. + +The Git variable `remote.pushDefault' specifies the remote that +local branches are usually pushed to. It can be overwritten +using the Git variable `branch..pushRemote'." + (interactive) + (magit-popup-set-variable "remote.pushDefault" (magit-list-remotes))) + +(defun magit-format-remote.pushDefault () + (magit-popup-format-variable "remote.pushDefault" + (magit-list-remotes) nil nil 19)) + +;;;###autoload +(defun magit-cycle-branch*autoSetupMerge () + "Cycle the repository-local value of `branch.autoSetupMerge'. + +The Git variable `branch.autoSetupMerge' under what circumstances +creating a branch (named NAME) should result in the variables +`branch..merge' and `branch..remote' being set +according to the starting point used to create the branch. If +the starting point isn't a branch, then these variables are never +set. + +When `always' then the variables are set regardless of whether +the starting point is a local or a remote branch. + +When `true' (the default) then the variable are set when the +starting point is a remote branch, but not when it is a local +branch. + +When `false' then the variables are never set." + (interactive) + (magit-popup-set-variable "branch.autoSetupMerge" + '("always" "true" "false") "true")) + +(defun magit-format-branch*autoSetupMerge () + (magit-popup-format-variable "branch.autoSetupMerge" + '("always" "true" "false") "true" nil 23)) + +;;;###autoload +(defun magit-cycle-branch*autoSetupRebase () + "Cycle the repository-local value of `branch.autoSetupRebase'. + +The Git variable `branch.autoSetupRebase' specifies whether +creating a branch (named NAME) should result in the variable +`branch..rebase' being set to `true'. + +When `always' then the variable is set regardless of whether the +starting point is a local or a remote branch. + +When `local' then the variable are set when the starting point +is a local branch, but not when it is a remote branch. + +When `remote' then the variable are set when the starting point +is a remote branch, but not when it is a local branch. + +When `never' (the default) then the variable is never set." + (interactive) + (magit-popup-set-variable "branch.autoSetupRebase" + '("always" "local" "remote" "never") "never")) + +(defun magit-format-branch*autoSetupRebase () + (magit-popup-format-variable "branch.autoSetupRebase" + '("always" "local" "remote" "never") + "never" nil 23)) + +(provide 'magit-branch) +;;; magit-branch.el ends here diff --git a/elpa/magit-20161115.1658/magit-commit.el b/elpa/magit-20171009.1252/magit-commit.el similarity index 91% rename from elpa/magit-20161115.1658/magit-commit.el rename to elpa/magit-20171009.1252/magit-commit.el index 65288320..ba330936 100644 --- a/elpa/magit-20161115.1658/magit-commit.el +++ b/elpa/magit-20171009.1252/magit-commit.el @@ -1,6 +1,6 @@ ;;; magit-commit.el --- create Git commits -*- lexical-binding: t -*- -;; Copyright (C) 2008-2016 The Magit Project Contributors +;; Copyright (C) 2008-2017 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. @@ -45,7 +45,7 @@ (defcustom magit-commit-arguments nil "The arguments used when committing." - :group 'magit-commands + :group 'magit-git-arguments :type '(repeat (string :tag "Argument"))) (defcustom magit-commit-ask-to-stage 'verbose @@ -85,7 +85,7 @@ an error while using those is harder to recover from." :group 'magit-commands :type 'boolean) -;;; Code +;;; Popup (defun magit-commit-popup (&optional arg) "Popup console for commit commands." @@ -100,12 +100,13 @@ an error while using those is harder to recover from." :switches ((?a "Stage all modified and deleted files" "--all") (?e "Allow empty commit" "--allow-empty") (?v "Show diff of changes to be committed" "--verbose") - (?n "Bypass git hooks" "--no-verify") + (?h "Disable hooks" "--no-verify") (?s "Add Signed-off-by line" "--signoff") (?R "Claim authorship and reset author date" "--reset-author")) :options ((?A "Override the author" "--author=") (?S "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key) - (?C "Reuse commit message" "--reuse-message=")) + (?C "Reuse commit message" "--reuse-message=" + magit-read-reuse-message)) :actions ((?c "Commit" magit-commit) (?e "Extend" magit-commit-extend) (?f "Fixup" magit-commit-fixup) @@ -125,22 +126,42 @@ an error while using those is harder to recover from." magit-current-popup-args magit-commit-arguments)) -(defun magit-commit-message-buffer () - (let* ((find-file-visit-truename t) ; git uses truename of COMMIT_EDITMSG - (topdir (magit-toplevel))) - (--first (equal topdir (with-current-buffer it - (and git-commit-mode (magit-toplevel)))) - (append (buffer-list (selected-frame)) - (buffer-list))))) +(defvar magit-gpg-secret-key-hist nil) + +(defun magit-read-gpg-secret-key (prompt &optional _initial-input) + (require 'epa) + (let ((keys (--map (concat (epg-sub-key-id (car (epg-key-sub-key-list it))) + " " + (-when-let (id-obj (car (epg-key-user-id-list it))) + (let ((id-str (epg-user-id-string id-obj))) + (if (stringp id-str) + id-str + (epg-decode-dn id-obj))))) + (epg-list-keys (epg-make-context epa-protocol) nil t)))) + (car (split-string (magit-completing-read + prompt keys nil nil nil 'magit-gpg-secret-key-hist + (car (or magit-gpg-secret-key-hist keys))) + " ")))) + +(defun magit-read-reuse-message (prompt &optional default) + (magit-completing-read prompt (magit-list-refnames) + nil nil nil 'magit-revision-history + (or default + (and (magit-rev-verify "ORIG_HEAD") + "ORIG_HEAD")))) + +;;; Commands ;;;###autoload (defun magit-commit (&optional args) - "Create a new commit on HEAD. -With a prefix argument amend to the commit at HEAD instead. + "Create a new commit on `HEAD'. +With a prefix argument, amend to the commit at `HEAD' instead. \n(git commit [--amend] ARGS)" (interactive (if current-prefix-arg (list (cons "--amend" (magit-commit-arguments))) (list (magit-commit-arguments)))) + (when (member "--all" args) + (setq this-command 'magit-commit-all)) (when (setq args (magit-commit-assert args)) (magit-run-git-with-editor "commit" args))) @@ -251,9 +272,10 @@ depending on the value of option `magit-commit-squash-confirm'." (if rebase (magit-with-editor (magit-call-git - "commit" (-remove-first - (apply-partially #'string-match-p "\\`--gpg-sign=") - args))) + "commit" "--no-gpg-sign" + (-remove-first + (apply-partially #'string-match-p "\\`--gpg-sign=") + args))) (magit-run-git-with-editor "commit" args))) (magit-log-select `(lambda (commit) @@ -301,14 +323,20 @@ depending on the value of option `magit-commit-squash-confirm'." (t (user-error "Nothing staged")))) +;;; Pending Diff + (defun magit-commit-diff () (-when-let (fn (and git-commit-mode magit-commit-show-diff - (pcase last-command - (`magit-commit + (cl-case last-command + (magit-commit (apply-partially 'magit-diff-staged nil)) - (`magit-commit-amend 'magit-diff-while-amending) - (`magit-commit-reword 'magit-diff-while-amending)))) + (magit-commit-all + (apply-partially 'magit-diff-working-tree nil)) + ((magit-commit-amend + magit-commit-reword + magit-rebase-reword-commit) + 'magit-diff-while-amending)))) (-when-let (diff-buffer (magit-mode-get-buffer 'magit-diff-mode)) ;; This window just started displaying the commit message ;; buffer. Without this that buffer would immediately be @@ -329,22 +357,15 @@ depending on the value of option `magit-commit-squash-confirm'." (add-to-list 'with-editor-server-window-alist (cons git-commit-filename-regexp 'switch-to-buffer)) -(defvar magit-gpg-secret-key-hist nil) +;;; Message Utilities -(defun magit-read-gpg-secret-key (prompt &optional _initial-input) - (require 'epa) - (let ((keys (--map (concat (epg-sub-key-id (car (epg-key-sub-key-list it))) - " " - (-when-let (id-obj (car (epg-key-user-id-list it))) - (let ((id-str (epg-user-id-string id-obj))) - (if (stringp id-str) - id-str - (epg-decode-dn id-obj))))) - (epg-list-keys (epg-make-context epa-protocol) nil t)))) - (car (split-string (magit-completing-read - prompt keys nil nil nil 'magit-gpg-secret-key-hist - (car (or magit-gpg-secret-key-hist keys))) - " ")))) +(defun magit-commit-message-buffer () + (let* ((find-file-visit-truename t) ; git uses truename of COMMIT_EDITMSG + (topdir (magit-toplevel))) + (--first (equal topdir (with-current-buffer it + (and git-commit-mode (magit-toplevel)))) + (append (buffer-list (selected-frame)) + (buffer-list))))) (defvar magit-commit-add-log-insert-function 'magit-commit-add-log-insert "Used by `magit-commit-add-log' to insert a single entry.") @@ -359,8 +380,8 @@ actually insert the entry." (log (magit-commit-message-buffer)) buf pos) (save-window-excursion (call-interactively #'magit-diff-visit-file) - (setq buf (current-buffer) - pos (point))) + (setq buf (current-buffer)) + (setq pos (point))) (unless log (unless (magit-commit-assert nil) (user-error "Abort")) @@ -408,9 +429,5 @@ actually insert the entry." (insert (format "(%s): \n" defun)) (backward-char)))))) -;;; magit-commit.el ends soon (provide 'magit-commit) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-commit.el ends here diff --git a/elpa/magit-20161115.1658/magit-core.el b/elpa/magit-20171009.1252/magit-core.el similarity index 50% rename from elpa/magit-20161115.1658/magit-core.el rename to elpa/magit-20171009.1252/magit-core.el index ea14dc17..1d03837b 100644 --- a/elpa/magit-20161115.1658/magit-core.el +++ b/elpa/magit-20171009.1252/magit-core.el @@ -1,6 +1,6 @@ ;;; magit-core.el --- core functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -30,35 +30,79 @@ ;;; Code: +(require 'magit-popup) (require 'magit-utils) (require 'magit-section) (require 'magit-git) (require 'magit-mode) -(require 'magit-popup) +(require 'magit-margin) (require 'magit-process) (require 'magit-autorevert) (defgroup magit nil "Controlling Git from Emacs." + :link '(url-link "https://magit.vc") + :link '(info-link "(magit)FAQ") + :link '(info-link "(magit)") :group 'tools) +(defgroup magit-essentials nil + "Options that every Magit user should briefly think about. + +Each of these options falls into one or more of these categories: + +* Options that affect Magit's behavior in fundamental ways. +* Options that affect safety. +* Options that affect performance. +* Options that are of a personal nature." + :link '(info-link "(magit)Essential Settings") + :group 'magit) + +(defgroup magit-miscellaneous nil + "Miscellanous Magit options." + :group 'magit) + (defgroup magit-commands nil "Options controlling behavior of certain commands." :group 'magit) +(defgroup magit-git-arguments nil + "Options controlling what arguments are passed to Git. + +Most of these options can be set using the respective popup, +and it is recommended that you do that because then you can +be certain that Magit supports the arguments that you select. + +An option `magit-NAME-argument' specifies the arguments that +are enabled by default by the popup `magit-NAME-popup'." + :link '(info-link "(magit-popup)Customizing Existing Popups") + :link '(info-link "(magit-popup)Usage") + :group 'magit-commands) + (defgroup magit-modes nil "Modes used or provided by Magit." :group 'magit) -(defgroup magit-extensions nil - "Extensions to Magit." +(defgroup magit-buffers nil + "Options concerning Magit buffers." + :link '(info-link "(magit)Modes and Buffers") :group 'magit) +(defgroup magit-refresh nil + "Options controlling how Magit buffers are refreshed." + :link '(info-link "(magit)Automatic Refreshing of Magit Buffers") + :group 'magit + :group 'magit-buffers) + (defgroup magit-faces nil "Faces used by Magit." :group 'magit :group 'faces) +(defgroup magit-extensions nil + "Extensions to Magit." + :group 'magit) + (custom-add-to-group 'magit-modes 'magit-popup 'custom-group) (custom-add-to-group 'magit-faces 'magit-popup-faces 'custom-group) (custom-add-to-group 'magit-modes 'git-commit 'custom-group) @@ -67,11 +111,22 @@ (custom-add-to-group 'magit-faces 'git-rebase-faces 'custom-group) (custom-add-to-group 'magit-process 'with-editor 'custom-group) -(custom-add-to-group 'magit 'vc-follow-symlinks 'custom-variable) +(defgroup magit-related nil + "Options that are relevant to Magit but that are defined elsewhere." + :link '(custom-group-link vc) + :link '(custom-group-link smerge) + :link '(custom-group-link ediff) + :link '(custom-group-link auto-revert) + :group 'magit + :group 'magit-extensions + :group 'magit-essentials) + +(custom-add-to-group 'magit-related 'auto-revert-check-vc-info 'custom-variable) +(custom-add-to-group 'magit-auto-revert 'auto-revert-check-vc-info 'custom-variable) + +(custom-add-to-group 'magit-related 'ediff-window-setup-function 'custom-variable) +(custom-add-to-group 'magit-related 'smerge-refine-ignore-whitespace 'custom-variable) +(custom-add-to-group 'magit-related 'vc-follow-symlinks 'custom-variable) -;;; magit-core.el ends soon (provide 'magit-core) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-core.el ends here diff --git a/elpa/magit-20161115.1658/magit-diff.el b/elpa/magit-20171009.1252/magit-diff.el similarity index 90% rename from elpa/magit-20161115.1658/magit-diff.el rename to elpa/magit-20171009.1252/magit-diff.el index 12090309..8f49be4d 100644 --- a/elpa/magit-20161115.1658/magit-diff.el +++ b/elpa/magit-20171009.1252/magit-diff.el @@ -1,6 +1,6 @@ ;;; magit-diff.el --- inspect Git diffs -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -50,30 +50,36 @@ (require 'diff-mode) (require 'smerge-mode) +(defvar bookmark-make-record-function) + ;;; Options ;;;; Diff Mode (defgroup magit-diff nil "Inspect and manipulate Git diffs." + :link '(info-link "(magit)Diffing") :group 'magit-modes) -(custom-add-to-group 'magit-diff 'smerge-refine-ignore-whitespace - 'custom-variable) - (defcustom magit-diff-mode-hook nil "Hook run after entering Magit-Diff mode." :group 'magit-diff :type 'hook) +(defcustom magit-diff-arguments '("--stat" "--no-ext-diff") + "The diff arguments used in buffers whose mode derives from `magit-diff-mode'." + :group 'magit-git-arguments + :group 'magit-diff + :type '(repeat (string :tag "Argument"))) + (defcustom magit-diff-sections-hook '(magit-insert-diff magit-insert-xref-buttons) "Hook run to insert sections into a `magit-diff-mode' buffer." :package-version '(magit . "2.3.0") - :group 'magit-revision + :group 'magit-diff :type 'hook) -(defcustom magit-diff-expansion-threshold 1.0 +(defcustom magit-diff-expansion-threshold 60 "After how many seconds not to expand anymore diffs. Except in status buffers, diffs are usually start out fully @@ -86,8 +92,8 @@ to be collapsed. So you should not pick a very low value here. The hook function `magit-diff-expansion-threshold' has to be a member of `magit-section-set-visibility-hook' for this option -to have any effect" - :package-version '(magit . "2.1.0") +to have any effect." + :package-version '(magit . "2.9.0") :group 'magit-diff :type 'float) @@ -165,9 +171,10 @@ t show fine differences for the current diff hunk only. (defcustom magit-diff-paint-whitespace t "Specify where to highlight whitespace errors. -See `magit-highlight-trailing-whitespace', -`magit-highlight-indentation'. The symbol t means in all diffs, -`status' means only in the status buffer, and nil means nowhere." +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." :group 'magit-diff :safe (lambda (val) (memq val '(t nil status))) :type '(choice (const :tag "Always" t) @@ -221,10 +228,16 @@ visits the file in the working tree." :group 'magit-diff :type 'boolean) +(defcustom magit-diff-highlight-keywords t + "Whether to highlight bracketed keywords in commit messages." + :package-version '(magit . "2.11.1") + :group 'magit-diff + :type 'boolean) + ;;;; File Diff (defcustom magit-diff-buffer-file-locked t - "Whether `magit-diff-buffer-file' uses a decicated buffer." + "Whether `magit-diff-buffer-file' uses a dedicated buffer." :package-version '(magit . "2.7.0") :group 'magit-commands :group 'magit-diff @@ -234,12 +247,14 @@ visits the file in the working tree." (defgroup magit-revision nil "Inspect and manipulate Git commits." + :link '(info-link "(magit)Revision Buffer") :group 'magit-modes) -(defcustom magit-revision-mode-hook nil +(defcustom magit-revision-mode-hook '(bug-reference-mode) "Hook run after entering Magit-Revision mode." :group 'magit-revision - :type 'hook) + :type 'hook + :options '(bug-reference-mode)) (defcustom magit-revision-sections-hook '(magit-insert-revision-tag @@ -285,8 +300,8 @@ inserted inside the text that was previously inserted according to `magit-revision-header-format'. Both cells are regular expressions. The car specifies where to -insert the author gravatar image. The top halve of the image is -inserted right after the matched text, the bottom halve on the +insert the author gravatar image. The top half of the image is +inserted right after the matched text, the bottom half on the next line at the same offset. The cdr specifies where to insert the committer image, accordingly. Either the car or the cdr may be nil." @@ -313,6 +328,15 @@ and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=7847." :group 'magit-revision :type 'boolean) +;;;; Diff Sections + +(defcustom magit-diff-section-arguments '("--no-ext-diff") + "The diff arguments used in buffers that show other things besides diffs." + :group 'magit-git-arguments + :group 'magit-diff + :group 'magit-status + :type '(repeat (string :tag "Argument"))) + ;;; Faces (defface magit-diff-file-heading @@ -550,7 +574,8 @@ and `:slant'." (?x "Disallow external diff drivers" "--no-ext-diff")) :actions ((?g "Refresh" magit-diff-refresh) (?t "Toggle hunk refinement" magit-diff-toggle-refine-hunk) - (?s "Set defaults" magit-diff-set-default-arguments) nil + (?s "Set defaults" magit-diff-set-default-arguments) + (?F "Toggle file filter" magit-diff-toggle-file-filter) (?w "Save defaults" magit-diff-save-default-arguments)) :max-action-columns 2)) @@ -566,7 +591,8 @@ and `:slant'." (?s "Set defaults" magit-diff-set-default-arguments) (?r "Switch range type" magit-diff-switch-range-type) (?w "Save defaults" magit-diff-save-default-arguments) - (?f "Flip revisions" magit-diff-flip-revs)) + (?f "Flip revisions" magit-diff-flip-revs) nil + (?F "Toggle file filter" magit-diff-toggle-file-filter)) :max-action-columns 2)) (defvar magit-revision-mode-refresh-popup @@ -578,7 +604,8 @@ and `:slant'." (?s "Show stats" "--stat")) :actions ((?g "Refresh" magit-diff-refresh) (?t "Toggle hunk refinement" magit-diff-toggle-refine-hunk) - (?s "Set defaults" magit-diff-set-default-arguments) nil + (?s "Set defaults" magit-diff-set-default-arguments) + (?F "Toggle file filter" magit-diff-toggle-file-filter) (?w "Save defaults" magit-diff-save-default-arguments)) :max-action-columns 2)) @@ -587,37 +614,31 @@ and `:slant'." (magit-define-popup-keys-deferred 'magit-diff-mode-refresh-popup) (magit-define-popup-keys-deferred 'magit-revision-mode-refresh-popup) -(defcustom magit-diff-arguments '("--stat" "--no-ext-diff") - "The diff arguments used in buffers whose mode derives from `magit-diff-mode'." - :group 'magit-diff - :group 'magit-commands - :type '(repeat (string :tag "Argument"))) - -(defcustom magit-diff-section-arguments '("--no-ext-diff") - "The diff arguments used in buffers that show other things besides diffs." - :group 'magit-diff - :group 'magit-status - :type '(repeat (string :tag "Argument"))) - (defvar magit-diff-section-file-args nil) (put 'magit-diff-section-file-args 'permanent-local t) (put 'magit-diff-section-arguments 'permanent-local t) +(defun magit-diff-get-buffer-args () + (cond ((and magit-use-sticky-arguments + (derived-mode-p 'magit-diff-mode)) + (list (nth 2 magit-refresh-args) + (nth 3 magit-refresh-args))) + ((and (eq magit-use-sticky-arguments t) + (--when-let (magit-mode-get-buffer 'magit-diff-mode) + (with-current-buffer it + (list (nth 2 magit-refresh-args) + (nth 3 magit-refresh-args)))))) + (t + (list (default-value 'magit-diff-arguments) nil)))) + (defun magit-diff-arguments (&optional refresh) (cond ((memq magit-current-popup '(magit-diff-popup magit-diff-refresh-popup)) (magit-popup-export-file-args magit-current-popup-args)) - ((derived-mode-p 'magit-diff-mode) - (list (nth 2 magit-refresh-args) - (nth 3 magit-refresh-args))) - (refresh + ((and refresh (not (derived-mode-p 'magit-diff-mode))) (list magit-diff-section-arguments magit-diff-section-file-args)) (t - (-if-let (buffer (magit-mode-get-buffer 'magit-diff-mode)) - (with-current-buffer buffer - (list (nth 2 magit-refresh-args) - (nth 3 magit-refresh-args))) - (list (default-value 'magit-diff-arguments) nil))))) + (magit-diff-get-buffer-args)))) ;;;###autoload (defun magit-diff-popup (arg) @@ -629,11 +650,7 @@ and `:slant'." ;; we should get the current values. However it is much ;; more likely that we will end up updating the diff buffer, ;; and we therefore use the value from that buffer. - (-if-let (buffer (magit-mode-get-buffer 'magit-diff-mode)) - (with-current-buffer buffer - (magit-popup-import-file-args (nth 2 magit-refresh-args) - (nth 3 magit-refresh-args))) - (default-value 'magit-diff-arguments)))) + (apply #'magit-popup-import-file-args (magit-diff-get-buffer-args)))) (magit-invoke-popup 'magit-diff-popup nil arg))) ;;;###autoload @@ -746,7 +763,9 @@ If no DWIM context is found, nil is returned." (if (magit-anything-modified-p) current (cons 'commit current))) - (format "%s...%s" current atpoint)))) + (format "%s...%s" + (or current "HEAD") + atpoint)))) (commit (cons 'commit (magit-section-value it))) (stash (cons 'stash (magit-section-value it))))))) @@ -888,9 +907,18 @@ be committed." nil (list (expand-file-name a) (expand-file-name b)))) +(defvar-local magit-buffer-revision-hash nil) + +(defun magit-show-commit--arguments () + (-let [(args diff-files) (magit-diff-arguments)] + (list args (if (derived-mode-p 'magit-log-mode) + (and (not (member "--follow" (nth 1 magit-refresh-args))) + (nth 2 magit-refresh-args)) + diff-files)))) + ;;;###autoload (defun magit-show-commit (rev &optional args files module) - "Show the revision at point. + "Visit the revision at point in another buffer. If there is no revision at point or with a prefix argument prompt for a revision." (interactive @@ -898,12 +926,10 @@ for a revision." (atpoint (or (and (bound-and-true-p magit-blame-mode) (magit-blame-chunk-get :hash)) mcommit - magit-buffer-refname - (magit-branch-or-commit-at-point) - (magit-tag-at-point)))) + (magit-branch-or-commit-at-point)))) (nconc (cons (or (and (not current-prefix-arg) atpoint) (magit-read-branch-or-commit "Show commit" atpoint)) - (magit-diff-arguments)) + (magit-show-commit--arguments)) (and mcommit (list (magit-section-parent-value (magit-current-section))))))) (require 'magit) @@ -992,6 +1018,34 @@ Change \"revA..revB\" to \"revB..revA\"." (magit-refresh)) (user-error "No range to swap")))) +(defvar-local magit-diff--last-file-args nil) +(defun magit-diff--toggle-file-args (files) + (cond (files + (setq magit-diff--last-file-args files) + nil) + (magit-diff--last-file-args) + (t + (user-error "No diff file filter to toggle")))) + +(defun magit-diff-toggle-file-filter () + "Toggle the file restriction of the current buffer's diffs. +If the current buffer's mode is derived from `magit-log-mode', +toggle the file restriction in the repository's revision buffer +instead." + (interactive) + (--if-let (and (derived-mode-p 'magit-log-mode) + (magit-mode-get-buffer 'magit-revision-mode)) + (with-current-buffer it + (setf (nth 3 magit-refresh-args) + (magit-diff--toggle-file-args (nth 3 magit-refresh-args))) + (magit-refresh)) + (if (derived-mode-p 'magit-diff-mode) + (setf (nth 3 magit-refresh-args) + (magit-diff--toggle-file-args (nth 3 magit-refresh-args))) + (setq-local magit-diff-section-file-args + (magit-diff--toggle-file-args magit-diff-section-file-args))) + (magit-refresh))) + (defun magit-diff-less-context (&optional count) "Decrease the context for diff hunks by COUNT lines." (interactive "p") @@ -1088,7 +1142,9 @@ the buffer in another window." (or (get-file-buffer file) (find-file-noselect file))))) (magit-display-file-buffer buf) - (with-current-buffer buf + (with-selected-window + (or (get-buffer-window buf 'visible) + (error "File buffer is not visible")) (when line (setq line (cond ((eq rev 'staged) @@ -1125,10 +1181,23 @@ treated as such.") (funcall magit-display-file-buffer-function buffer)) (defun magit-display-file-buffer-traditional (buffer) + "Display BUFFER in the current window. +With a prefix argument display it in another 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)) (pop-to-buffer buffer) (switch-to-buffer buffer))) +(defun magit-display-file-buffer-other-window (buffer) + "Display BUFFER in another window. +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)) + (switch-to-buffer buffer) + (pop-to-buffer buffer))) + (defun magit-diff-visit-file-worktree (file &optional other-window) "From a diff, visit the corresponding file at the appropriate position. @@ -1155,7 +1224,7 @@ or `HEAD'." rev (setq rev (if (consp rev) (cdr rev) - (car (magit-split-range rev)))) + (cdr (magit-split-range rev)))) (if (magit-rev-head-p rev) 'unstaged rev)))) @@ -1165,7 +1234,7 @@ or `HEAD'." (cond ((consp rev) (concat (cdr rev) "^")) ((stringp rev) - (cdr (magit-split-range rev))) + (car (magit-split-range rev))) (t rev)))) @@ -1296,34 +1365,40 @@ commit or stash at point, then prompt for a commit." (let (rev cmd buf win) (cond (magit-blame-mode - (setq rev (magit-blame-chunk-get :hash) - cmd 'magit-show-commit - buf (magit-mode-get-buffer 'magit-revision-mode))) + (setq rev (magit-blame-chunk-get :hash)) + (setq cmd 'magit-show-commit) + (setq buf (magit-mode-get-buffer 'magit-revision-mode))) ((derived-mode-p 'git-rebase-mode) (save-excursion (goto-char (line-beginning-position)) (--if-let (and git-rebase-line (looking-at git-rebase-line) (match-string 2)) - (setq rev it - cmd 'magit-show-commit - buf (magit-mode-get-buffer 'magit-revision-mode)) + (progn (setq rev it) + (setq cmd 'magit-show-commit) + (setq buf (magit-mode-get-buffer 'magit-revision-mode))) (user-error "No commit on this line")))) (t (magit-section-case - ((commit branch) - (setq rev (magit-section-value it) - cmd 'magit-show-commit - buf (magit-mode-get-buffer 'magit-revision-mode))) + (branch + (setq rev (magit-ref-maybe-qualify (magit-section-value it))) + (setq cmd 'magit-show-commit) + (setq buf (magit-mode-get-buffer 'magit-revision-mode))) + (commit + (setq rev (magit-section-value it)) + (setq cmd 'magit-show-commit) + (setq buf (magit-mode-get-buffer 'magit-revision-mode))) (stash - (setq rev (magit-section-value it) - cmd 'magit-stash-show - buf (magit-mode-get-buffer 'magit-stash-mode)))))) + (setq rev (magit-section-value it)) + (setq cmd 'magit-stash-show) + (setq buf (magit-mode-get-buffer 'magit-stash-mode)))))) (if rev (if (and buf (setq win (get-buffer-window buf)) (with-current-buffer buf - (equal rev (car magit-refresh-args)))) + (and (equal rev (car magit-refresh-args)) + (equal (magit-rev-parse rev) + magit-buffer-revision-hash)))) (with-selected-window win (condition-case nil (funcall fn) @@ -1333,7 +1408,7 @@ commit or stash at point, then prompt for a commit." (`scroll-down (point-max))))))) (let ((magit-display-buffer-noselect t)) (if (eq cmd 'magit-show-commit) - (apply #'magit-show-commit rev (magit-diff-arguments)) + (apply #'magit-show-commit rev (magit-show-commit--arguments)) (funcall cmd rev)))) (call-interactively #'magit-show-commit)))) @@ -1354,7 +1429,7 @@ commit or stash at point, then prompt for a commit." (define-derived-mode magit-diff-mode magit-mode "Magit Diff" "Mode for looking at a Git diff. -This mode is documented in info node `(magit)Diff buffer'. +This mode is documented in info node `(magit)Diff Buffer'. \\\ Type \\[magit-refresh] to refresh the current buffer. @@ -1362,7 +1437,7 @@ Type \\[magit-section-toggle] to expand or hide the section at point. Type \\[magit-visit-thing] to visit the hunk or file at point. Staging and applying changes is documented in info node -`(magit)Staging and unstaging' and info node `(magit)Applying'. +`(magit)Staging and Unstaging' and info node `(magit)Applying'. \\Type \ \\[magit-apply] to apply the change at point, \ @@ -1373,7 +1448,13 @@ Staging and applying changes is documented in info node \\{magit-diff-mode-map}" :group 'magit-diff - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq imenu-prev-index-position-function + 'magit-imenu--diff-prev-index-position-function) + (setq imenu-extract-index-name-function + 'magit-imenu--diff-extract-index-name-function) + (setq-local bookmark-make-record-function + 'magit-bookmark--diff-make-record)) (defun magit-diff-refresh-buffer (rev-or-range const _args files) "Refresh the current `magit-diff-mode' buffer. @@ -1386,7 +1467,8 @@ is set in `magit-mode-setup'." (if (member "--no-index" const) (apply #'format " Differences between %s and %s" files) (concat (if rev-or-range - (if (string-match-p "\\.\\." rev-or-range) + (if (string-match-p "\\(\\.\\.\\|\\^-\\)" + rev-or-range) (format " Changes in %s" rev-or-range) (format " Changes from %s to working tree" rev-or-range)) (if (member "--cached" const) @@ -1414,31 +1496,33 @@ is set in `magit-mode-setup'." (defvar magit-file-section-map (let ((map (make-sparse-keymap))) + (unless (featurep 'jkl) + (define-key map (kbd "C-j") 'magit-diff-visit-file-worktree)) (define-key map [C-return] 'magit-diff-visit-file-worktree) - (define-key map "\C-j" 'magit-diff-visit-file-worktree) (define-key map [remap magit-visit-thing] 'magit-diff-visit-file) (define-key map [remap magit-delete-thing] 'magit-discard) (define-key map [remap magit-revert-no-commit] 'magit-reverse) - (define-key map "a" 'magit-apply) - (define-key map "C" 'magit-commit-add-log) - (define-key map "K" 'magit-file-untrack) - (define-key map "R" 'magit-file-rename) - (define-key map "s" 'magit-stage) - (define-key map "u" 'magit-unstage) + (define-key map "a" 'magit-apply) + (define-key map "C" 'magit-commit-add-log) + (define-key map "s" 'magit-stage) + (define-key map "u" 'magit-unstage) + (define-key map "&" 'magit-do-async-shell-command) map) "Keymap for `file' sections.") (defvar magit-hunk-section-map (let ((map (make-sparse-keymap))) + (unless (featurep 'jkl) + (define-key map (kbd "C-j") 'magit-diff-visit-file-worktree)) (define-key map [C-return] 'magit-diff-visit-file-worktree) - (define-key map "\C-j" 'magit-diff-visit-file-worktree) (define-key map [remap magit-visit-thing] 'magit-diff-visit-file) (define-key map [remap magit-delete-thing] 'magit-discard) (define-key map [remap magit-revert-no-commit] 'magit-reverse) - (define-key map "a" 'magit-apply) - (define-key map "C" 'magit-commit-add-log) - (define-key map "s" 'magit-stage) - (define-key map "u" 'magit-unstage) + (define-key map "a" 'magit-apply) + (define-key map "C" 'magit-commit-add-log) + (define-key map "s" 'magit-stage) + (define-key map "u" 'magit-unstage) + (define-key map "&" 'magit-do-async-shell-command) map) "Keymap for `hunk' sections.") @@ -1706,7 +1790,7 @@ section or a child thereof." (define-derived-mode magit-revision-mode magit-diff-mode "Magit Rev" "Mode for looking at a Git commit. -This mode is documented in info node `(magit)Revision buffer'. +This mode is documented in info node `(magit)Revision Buffer'. \\\ Type \\[magit-refresh] to refresh the current buffer. @@ -1714,7 +1798,7 @@ Type \\[magit-section-toggle] to expand or hide the section at point. Type \\[magit-visit-thing] to visit the hunk or file at point. Staging and applying changes is documented in info node -`(magit)Staging and unstaging' and info node `(magit)Applying'. +`(magit)Staging and Unstaging' and info node `(magit)Applying'. \\Type \ \\[magit-apply] to apply the change at point, \ @@ -1725,7 +1809,9 @@ Staging and applying changes is documented in info node \\{magit-revision-mode-map}" :group 'magit-revision - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq-local bookmark-make-record-function + 'magit-bookmark--revision-make-record)) (defun magit-revision-refresh-buffer (rev __const _args files) (setq header-line-format @@ -1733,10 +1819,11 @@ Staging and applying changes is documented in info node " " rev (pcase (length files) (0) - (1 (concat " in file " (car files))) - (_ (concat " in files " + (1 (concat " limited to file " (car files))) + (_ (concat " limited to files " (mapconcat #'identity files ", "))))) 'face 'magit-header-line)) + (setq magit-buffer-revision-hash (magit-rev-parse rev)) (magit-insert-section (commitbuf) (run-hook-with-args 'magit-revision-sections-hook rev))) @@ -1786,12 +1873,19 @@ or a ref which is not a branch, then it inserts nothing." (progn (backward-delete-char 2) (insert "(no message)\n")) (goto-char beg) - (while (search-forward "\r\n" nil t) ; Remove trailing CRs. - (delete-region (match-beginning 0) (1+ (match-beginning 0)))) - (goto-char beg) - (forward-line) - (put-text-property beg (point) 'face 'magit-section-secondary-heading) - (magit-insert-heading) + (save-excursion + (while (search-forward "\r\n" nil t) ; Remove trailing CRs. + (delete-region (match-beginning 0) (1+ (match-beginning 0))))) + (save-excursion + (forward-line) + (put-text-property beg (point) 'face 'magit-section-secondary-heading) + (magit-insert-heading)) + (when magit-diff-highlight-keywords + (save-excursion + (while (re-search-forward "\\[[^[]*\\]" nil t) + (put-text-property (match-beginning 0) + (match-end 0) + 'face 'magit-keyword)))) (goto-char (point-max)))))) (defun magit-insert-revision-notes (rev) @@ -1813,7 +1907,7 @@ or a ref which is not a branch, then it inserts nothing." (magit-insert-section (headers) ;; Before v2.2.0, "%D" was not supported. (--when-let (magit-rev-format "%d" rev "--decorate=full") - (insert (magit-format-ref-labels (substring it 2 -1)) ?\s)) + (insert (magit-format-ref-labels it) ?\s)) (insert (propertize (magit-rev-parse (concat rev "^{commit}")) 'face 'magit-hash)) (magit-insert-heading) @@ -1891,22 +1985,21 @@ or a ref which is not a branch, then it inserts nothing." (align-to (+ offset (ceiling (/ size (aref font-obj 7) 1.0)))) (gravatar-size (- size 2)) (slice1 '(slice .0 .0 1.0 0.5)) - (slice2 '(slice .0 .5 1.0 1.0))) - (gravatar-retrieve - email - (lambda (image offset align-to slice1 slice2) - (unless (eq image 'error) - (insert (propertize " " 'display `((,@image :ascent center :relief 1) - ,slice1))) - (insert (propertize " " 'display `((space :align-to ,align-to)))) - (forward-line) - (forward-char offset) - (insert (propertize " " 'display `((,@image :ascent center :relief 1) - ,slice2))) - (insert (propertize " " 'display `((space :align-to ,align-to)))))) - (list offset align-to - (if magit-revision-use-gravatar-kludge slice2 slice1) - (if magit-revision-use-gravatar-kludge slice1 slice2))))))) + (slice2 '(slice .0 .5 1.0 1.0)) + (image (gravatar-retrieve-synchronously email))) + (unless (eq image 'error) + (when magit-revision-use-gravatar-kludge + (cl-rotatef slice1 slice2)) + (insert (propertize " " 'display `((,@image :ascent center :relief 1) + ,slice1))) + (insert (propertize " " 'display `((space :align-to ,align-to)))) + (insert " ") + (forward-line) + (forward-char offset) + (insert (propertize " " 'display `((,@image :ascent center :relief 1) + ,slice2))) + (insert (propertize " " 'display `((space :align-to ,align-to)))) + (insert " ")))))) ;;; Diff Sections @@ -1943,11 +2036,13 @@ or a ref which is not a branch, then it inserts nothing." (defun magit-insert-staged-changes () "Insert section showing staged changes." - (magit-insert-section (staged) - (magit-insert-heading "Staged changes:") - (magit-git-wash #'magit-diff-wash-diffs - "diff" "--cached" magit-diff-section-arguments "--no-prefix" - "--" magit-diff-section-file-args))) + ;; Avoid listing all files as deleted when visiting a bare repo. + (unless (magit-bare-repo-p) + (magit-insert-section (staged) + (magit-insert-heading "Staged changes:") + (magit-git-wash #'magit-diff-wash-diffs + "diff" "--cached" magit-diff-section-arguments "--no-prefix" + "--" magit-diff-section-file-args)))) ;;; Diff Type @@ -2027,7 +2122,7 @@ starts and ends inside the body of a that section, then the type is `region'. If the region is empty after a mouse click, then `hunk' is returned instead of `region'. -If optional STRICT is non-nil then return nil if the diff type of +If optional STRICT is non-nil, then return nil if the diff type of the section at point is `untracked' or the section at point is not actually a `diff' but a `diffstat' section." (let ((siblings (and (not ssection) (magit-region-sections)))) @@ -2074,9 +2169,9 @@ actually a `diff' but a `diffstat' section." t)) (defun magit-diff-highlight (section selection) - "Highlight the diff-related SECTION and return t. + "Highlight the diff-related SECTION. If SECTION is not a diff-related section, then do nothing and -return nil. If SELECTION is non-nil then it is a list of sections +return nil. If SELECTION is non-nil, then it is a list of sections selected by the region, including SECTION. All of these sections are highlighted." (if (and (magit-section-match 'commit section) @@ -2262,6 +2357,7 @@ are highlighted." (line-end-position))) (defun magit-diff-update-hunk-region (section) + "Highlight the hunk-internal region if any." (when (eq (magit-diff-scope section t) 'region) (magit-diff--make-hunk-overlay (magit-section-start section) @@ -2362,6 +2458,13 @@ https://github.com/magit/magit/pull/2293 for more details)." ;; edge of the window. 'cursor t)) +;;; Hunk Utilities + +(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) (magit-section-content (magit-current-section))))) + ;;; Diff Extract (defun magit-diff-file-header (section) @@ -2399,14 +2502,5 @@ https://github.com/magit/magit/pull/2293 for more details)." (setq patch (buffer-string))) patch)) -;;; magit-diff.el ends soon - -(make-obsolete-variable 'magit-diff-show-lines-boundary - 'magit-diff-highlight-hunk-region-functions - "Magit 2.9.0") - (provide 'magit-diff) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-diff.el ends here diff --git a/elpa/magit-20161115.1658/magit-ediff.el b/elpa/magit-20171009.1252/magit-ediff.el similarity index 95% rename from elpa/magit-20161115.1658/magit-ediff.el rename to elpa/magit-20171009.1252/magit-ediff.el index 600f82df..369d0e26 100644 --- a/elpa/magit-20161115.1658/magit-ediff.el +++ b/elpa/magit-20171009.1252/magit-ediff.el @@ -1,6 +1,6 @@ ;;; magit-ediff.el --- Ediff extension for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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,13 +35,13 @@ (defvar smerge-ediff-buf) (defvar smerge-ediff-windows) +;;; Options + (defgroup magit-ediff nil "Ediff support for Magit." + :link '(info-link "(magit)Ediffing") :group 'magit-extensions) -(unless (find-lisp-object-file-name 'magit-ediff-quit-hook 'defvar) - (add-hook 'magit-ediff-quit-hook 'magit-ediff-restore-previous-winconf) - (add-hook 'magit-ediff-quit-hook 'magit-ediff-cleanup-auxiliary-buffers)) (defcustom magit-ediff-quit-hook '(magit-ediff-cleanup-auxiliary-buffers magit-ediff-restore-previous-winconf) @@ -53,6 +53,7 @@ invoked using Magit." :package-version '(magit . "2.2.0") :group 'magit-ediff :type 'hook + :get 'magit-hook-custom-get :options '(magit-ediff-cleanup-auxiliary-buffers magit-ediff-restore-previous-winconf)) @@ -73,10 +74,10 @@ If non-nil, use a third Ediff buffer to distinguish which changes in the stash were staged. In cases where the stash contains no staged changes, fall back to a two-buffer Ediff. -More specificaly, a stash is a merge commit, stash@{N}, with +More specifically, a stash is a merge commit, stash@{N}, with potentially three parents. -* stash@{N}^1 represents the HEAD commit at the time the stash +* stash@{N}^1 represents the `HEAD' commit at the time the stash was created. * stash@{N}^2 records any changes that were staged when the stash @@ -98,12 +99,13 @@ tree at the time of stashing." :group 'magit-ediff :type 'boolean) +;;; Commands + (defvar magit-ediff-previous-winconf nil) ;;;###autoload (autoload 'magit-ediff-popup "magit-ediff" nil t) (magit-define-popup magit-ediff-popup "Popup console for ediff commands." - 'magit-diff nil nil :actions '((?E "Dwim" magit-ediff-dwim) (?u "Show unstaged" magit-ediff-show-unstaged) (?s "Stage" magit-ediff-stage) @@ -204,7 +206,7 @@ FILE has to be relative to the top directory of the repository." "Compare REVA:FILEA with REVB:FILEB using Ediff. FILEA and FILEB have to be relative to the top directory of the -repository. If REVA or REVB is nil then this stands for the +repository. If REVA or REVB is nil, then this stands for the working tree state. If the region is active, use the revisions on the first and last @@ -298,22 +300,23 @@ mind at all, then it asks the user for a command to run." (`unstaged (setq command #'magit-ediff-show-unstaged)) (`staged (setq command #'magit-ediff-show-staged)) (`(commit . ,value) - (setq command #'magit-ediff-show-commit - revB value)) + (setq command #'magit-ediff-show-commit) + (setq revB value)) (`(stash . ,value) - (setq command #'magit-ediff-show-stash - revB value)) + (setq command #'magit-ediff-show-stash) + (setq revB value)) ((pred stringp) (-let [(a b) (magit-ediff-compare--read-revisions range)] - (setq command #'magit-ediff-compare - revA a - revB b))) + (setq command #'magit-ediff-compare) + (setq revA a) + (setq revB b))) (_ (when (derived-mode-p 'magit-diff-mode) (pcase (magit-diff-type) (`committed (-let [(a b) (magit-ediff-compare--read-revisions (car magit-refresh-args))] - (setq revA a revB b))) + (setq revA a) + (setq revB b))) ((guard (not magit-ediff-dwim-show-on-hunks)) (setq command #'magit-ediff-stage)) (`unstaged (setq command #'magit-ediff-show-unstaged)) @@ -378,7 +381,7 @@ and discard changes using Ediff, use `magit-ediff-stage'. FILE must be relative to the top directory of the repository." (interactive (list (magit-read-file-choice "Show unstaged changes for file" - (magit-modified-files) + (magit-unstaged-files) "No unstaged files"))) (magit-with-toplevel (let ((conf (current-window-configuration)) @@ -399,7 +402,7 @@ FILE must be relative to the top directory of the repository." ;;;###autoload (defun magit-ediff-show-working-tree (file) - "Show changes between HEAD and working tree using Ediff. + "Show changes between `HEAD' and working tree using Ediff. FILE must be relative to the top directory of the repository." (interactive (list (magit-read-file-choice "Show changes in file" @@ -500,9 +503,5 @@ stash that were staged." (defun magit-ediff-restore-previous-winconf () (set-window-configuration magit-ediff-previous-winconf)) -;;; magit-ediff.el ends soon (provide 'magit-ediff) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-ediff.el ends here diff --git a/elpa/magit-20161115.1658/magit-extras.el b/elpa/magit-20171009.1252/magit-extras.el similarity index 56% rename from elpa/magit-20161115.1658/magit-extras.el rename to elpa/magit-20171009.1252/magit-extras.el index e66611d9..aca28470 100644 --- a/elpa/magit-20161115.1658/magit-extras.el +++ b/elpa/magit-20171009.1252/magit-extras.el @@ -1,6 +1,6 @@ ;;; magit-extras.el --- additional functionality for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2008-2016 The Magit Project Contributors +;; Copyright (C) 2008-2017 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. @@ -26,6 +26,9 @@ (require 'magit) +(declare-function dired-do-shell-command 'dired-aux) +(declare-function dired-read-shell-command 'dired-aux) + (defgroup magit-extras nil "Additional functionality for Magit." :group 'magit-extensions) @@ -48,12 +51,12 @@ "Run `git gui' for the current git repository." (interactive) (magit-with-toplevel - (call-process magit-git-executable nil 0 nil "gui"))) + (magit-process-file magit-git-executable nil 0 nil "gui"))) ;;;###autoload (defun magit-run-git-gui-blame (commit filename &optional linenum) "Run `git gui blame' on the given FILENAME and COMMIT. -Interactively run it for the current file and the HEAD, with a +Interactively run it for the current file and the `HEAD', with a prefix or when the current file cannot be determined let the user choose. When the current buffer is visiting FILENAME instruct blame to center around the line point is on." @@ -62,15 +65,15 @@ blame to center around the line point is on." (when (or current-prefix-arg (not (setq revision "HEAD" filename (magit-file-relative-name nil 'tracked)))) - (setq revision (magit-read-branch-or-commit "Blame from revision") - filename (magit-read-file-from-rev revision "Blame file"))) + (setq revision (magit-read-branch-or-commit "Blame from revision")) + (setq filename (magit-read-file-from-rev revision "Blame file"))) (list revision filename (and (equal filename (ignore-errors (magit-file-relative-name buffer-file-name))) (line-number-at-pos))))) (magit-with-toplevel - (apply #'call-process magit-git-executable nil 0 nil "gui" "blame" + (apply #'magit-process-file magit-git-executable nil 0 nil "gui" "blame" `(,@(and linenum (list (format "--line=%d" linenum))) ,commit ,filename)))) @@ -79,19 +82,119 @@ blame to center around the line point is on." (defun magit-run-gitk () "Run `gitk' in the current repository." (interactive) - (call-process magit-gitk-executable nil 0)) + (magit-process-file magit-gitk-executable nil 0)) ;;;###autoload (defun magit-run-gitk-branches () "Run `gitk --branches' in the current repository." (interactive) - (call-process magit-gitk-executable nil 0 nil "--branches")) + (magit-process-file magit-gitk-executable nil 0 nil "--branches")) ;;;###autoload (defun magit-run-gitk-all () "Run `gitk --all' in the current repository." (interactive) - (call-process magit-gitk-executable nil 0 nil "--all")) + (magit-process-file magit-gitk-executable nil 0 nil "--all")) + +;;; Emacs Tools + +;;;###autoload +(defun ido-enter-magit-status () + "Drop into `magit-status' from file switching. + +To make this command available use something like: + + (add-hook \\='ido-setup-hook + (lambda () + (define-key ido-completion-map + (kbd \"C-x g\") \\='ido-enter-magit-status))) + +Starting with Emacs 25.1 the Ido keymaps are defined just once +instead of every time Ido is invoked, so now you can modify it +like pretty much every other keymap: + + (define-key ido-common-completion-map + (kbd \"C-x g\") 'ido-enter-magit-status)" + (interactive) + (with-no-warnings ; FIXME these are internal variables + (setq ido-exit 'fallback fallback 'magit-status)) + (exit-minibuffer)) + +;;;###autoload +(defun magit-dired-jump (&optional other-window) + "Visit file at point using Dired. +With a prefix argument, visit in another window. If there +is no file at point, then instead visit `default-directory'." + (interactive "P") + (dired-jump other-window (-if-let (file (magit-file-at-point)) + (progn (setq file (expand-file-name file)) + (if (file-directory-p file) + (concat file "/.") + file)) + (concat default-directory "/.")))) + +;;;###autoload +(defun magit-do-async-shell-command (file) + "Open FILE with `dired-do-async-shell-command'. +Interactively, open the file at point." + (interactive (list (or (magit-file-at-point) + (completing-read "Act on file: " + (magit-list-files))))) + (require 'dired-aux) + (dired-do-async-shell-command + (dired-read-shell-command "& on %s: " current-prefix-arg (list file)) + nil (list file))) + +;;; Shift Selection + +(defun magit--turn-on-shift-select-mode-p () + (and shift-select-mode + this-command-keys-shift-translated + (not mark-active) + (not (eq (car-safe transient-mark-mode) 'only)))) + +;;;###autoload +(defun magit-previous-line (&optional arg try-vscroll) + "Like `previous-line' but with Magit-specific shift-selection. + +Magit's selection mechanism is based on the region but selects an +area that is larger than the region. This causes `previous-line' +when invoked while holding the shift key to move up one line and +thereby select two lines. When invoked inside a hunk body this +command does not move point on the first invocation and thereby +it only selects a single line. Which inconsistency you prefer +is a matter of preference." + (declare (interactive-only + "use `forward-line' with negative argument instead.")) + (interactive "p\np") + (unless arg (setq arg 1)) + (let ((hunkp (magit-diff-inside-hunk-body-p))) + (if (and hunkp (= arg 1) (magit--turn-on-shift-select-mode-p)) + (push-mark nil nil t) + (with-no-warnings + (handle-shift-selection) + (previous-line (if hunkp (max (1- arg) 1) arg) try-vscroll))))) + +;;;###autoload +(defun magit-next-line (&optional arg try-vscroll) + "Like `next-line' but with Magit-specific shift-selection. + +Magit's selection mechanism is based on the region but selects +an area that is larger than the region. This causes `next-line' +when invoked while holding the shift key to move down one line +and thereby select two lines. When invoked inside a hunk body +this command does not move point on the first invocation and +thereby it only selects a single line. Which inconsistency you +prefer is a matter of preference." + (declare (interactive-only forward-line)) + (interactive "p\np") + (unless arg (setq arg 1)) + (let ((hunkp (magit-diff-inside-hunk-body-p))) + (if (and hunkp (= arg 1) (magit--turn-on-shift-select-mode-p)) + (push-mark nil nil t) + (with-no-warnings + (handle-shift-selection) + (next-line (if hunkp (max (1- arg) 1) arg) try-vscroll))))) ;;; Clean @@ -177,8 +280,8 @@ a position in a file-visiting buffer." (let (buf pos) (save-window-excursion (call-interactively #'magit-diff-visit-file) - (setq buf (current-buffer) - pos (point))) + (setq buf (current-buffer)) + (setq pos (point))) (save-excursion (with-current-buffer buf (goto-char pos) @@ -195,9 +298,19 @@ on a position in a file-visiting buffer." (prompt-for-change-log-name)))) (magit-add-change-log-entry whoami file-name t)) -;;; magit-extras.el ends soon +;;; Miscellaneous + +;;;###autoload +(defun magit-abort-dwim () + "Abort current operation. +Depending on the context, this will abort a merge, a rebase, a +patch application, a cherry-pick, a revert, or a bisect." + (interactive) + (cond ((magit-merge-state) (magit-merge-abort)) + ((magit-rebase-in-progress-p) (magit-rebase-abort)) + ((magit-am-in-progress-p) (magit-am-abort)) + ((magit-sequencer-in-progress-p) (magit-sequencer-abort)) + ((magit-bisect-in-progress-p) (magit-bisect-reset)))) + (provide 'magit-extras) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-extras.el ends here diff --git a/elpa/magit-20171009.1252/magit-files.el b/elpa/magit-20171009.1252/magit-files.el new file mode 100644 index 00000000..e1047ab7 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-files.el @@ -0,0 +1,443 @@ +;;; magit-files.el --- finding files -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for finding blobs, staged files, +;; and Git configuration files. It also implements modes useful in +;; buffers visiting files and blobs, and the commands used by those +;; modes. + +;;; Code: + +(require 'magit) + +;;; Find Blob + +(defvar magit-find-file-hook nil) +(add-hook 'magit-find-file-hook #'magit-blob-mode) + +;;;###autoload +(defun magit-find-file (rev file) + "View FILE from REV. +Switch to a buffer visiting blob REV:FILE, +creating one if none already exists." + (interactive (magit-find-file-read-args "Find file")) + (switch-to-buffer (magit-find-file-noselect rev file))) + +;;;###autoload +(defun magit-find-file-other-window (rev file) + "View FILE from REV, in another window. +Like `magit-find-file', but create a new window or reuse an +existing one." + (interactive (magit-find-file-read-args "Find file in other window")) + (switch-to-buffer-other-window (magit-find-file-noselect rev file))) + +(defun magit-find-file-read-args (prompt) + (let ((rev (magit-read-branch-or-commit "Find file from revision"))) + (list rev (magit-read-file-from-rev rev prompt)))) + +(defun magit-find-file-noselect (rev file) + "Read FILE from REV into a buffer and return the buffer. +FILE must be relative to the top directory of the repository." + (magit-find-file-noselect-1 rev file 'magit-find-file-hook)) + +(defun magit-find-file-noselect-1 (rev file hookvar &optional revert) + "Read FILE from REV into a buffer and return the buffer. +FILE must be relative to the top directory of the repository. +An empty REV stands for index." + (let ((topdir (magit-toplevel))) + (when (file-name-absolute-p file) + (setq file (file-relative-name file topdir))) + (with-current-buffer (magit-get-revision-buffer-create rev file) + (when (or (not magit-buffer-file-name) + (if (eq revert 'ask-revert) + (y-or-n-p (format "%s already exists; revert it? " + (buffer-name)))) + revert) + (setq magit-buffer-revision + (if (string= rev "") "{index}" (magit-rev-format "%H" rev))) + (setq magit-buffer-refname rev) + (setq magit-buffer-file-name (expand-file-name file topdir)) + (setq default-directory + (let ((dir (file-name-directory magit-buffer-file-name))) + (if (file-exists-p dir) dir topdir))) + (setq-local revert-buffer-function #'magit-revert-rev-file-buffer) + (revert-buffer t t) + (run-hooks hookvar)) + (current-buffer)))) + +(defun magit-get-revision-buffer-create (rev file) + (magit-get-revision-buffer rev file t)) + +(defun magit-get-revision-buffer (rev file &optional create) + (funcall (if create 'get-buffer-create 'get-buffer) + (format "%s.~%s~" file (if (equal rev "") "index" + (subst-char-in-string ?/ ?_ rev))))) + +(defun magit-revert-rev-file-buffer (_ignore-auto noconfirm) + (when (or noconfirm + (and (not (buffer-modified-p)) + (catch 'found + (dolist (regexp revert-without-query) + (when (string-match regexp magit-buffer-file-name) + (throw 'found t))))) + (yes-or-no-p (format "Revert buffer from git %s? " + (if (equal magit-buffer-refname "") "{index}" + (concat "revision " magit-buffer-refname))))) + (let* ((inhibit-read-only t) + (default-directory (magit-toplevel)) + (file (file-relative-name magit-buffer-file-name)) + (coding-system-for-read (or coding-system-for-read 'undecided))) + (erase-buffer) + (magit-git-insert "cat-file" "-p" (concat magit-buffer-refname ":" file)) + (setq buffer-file-coding-system last-coding-system-used)) + (let ((buffer-file-name magit-buffer-file-name) + (after-change-major-mode-hook + (remq 'global-diff-hl-mode-enable-in-buffers + after-change-major-mode-hook))) + (normal-mode t)) + (setq buffer-read-only t) + (set-buffer-modified-p nil) + (goto-char (point-min)))) + +;;; Find Index + +(defvar magit-find-index-hook nil) + +(defun magit-find-file-index-noselect (file &optional revert) + "Read FILE from the index into a buffer and return the buffer. +FILE must to be relative to the top directory of the repository." + (magit-find-file-noselect-1 "" file 'magit-find-index-hook + (or revert 'ask-revert))) + +(defun magit-update-index () + "Update the index with the contents of the current buffer. +The current buffer has to be visiting a file in the index, which +is done using `magit-find-index-noselect'." + (interactive) + (let ((file (magit-file-relative-name))) + (unless (equal magit-buffer-refname "") + (user-error "%s isn't visiting the index" file)) + (if (y-or-n-p (format "Update index with contents of %s" (buffer-name))) + (let ((index (make-temp-file "index")) + (buffer (current-buffer))) + (when magit-wip-before-change-mode + (magit-wip-commit-before-change (list file) " before un-/stage")) + (let ((coding-system-for-write buffer-file-coding-system)) + (with-temp-file index + (insert-buffer-substring buffer))) + (magit-with-toplevel + (magit-call-git "update-index" "--cacheinfo" + (substring (magit-git-string "ls-files" "-s" file) + 0 6) + (magit-git-string "hash-object" "-t" "blob" "-w" + (concat "--path=" file) + "--" index) + file)) + (set-buffer-modified-p nil) + (when magit-wip-after-apply-mode + (magit-wip-commit-after-apply (list file) " after un-/stage"))) + (message "Abort"))) + (--when-let (magit-mode-get-buffer 'magit-status-mode) + (with-current-buffer it (magit-refresh))) + t) + +;;; Find Config File + +(defun magit-find-git-config-file (filename &optional wildcards) + "Edit a file located in the current repository's git directory. + +When \".git\", located at the root of the working tree, is a +regular file, then that makes it cumbersome to open a file +located in the actual git directory. + +This command is like `find-file', except that it temporarily +binds `default-directory' to the actual git directory, while +reading the FILENAME." + (interactive + (let ((default-directory (magit-git-dir))) + (find-file-read-args "Find file: " + (confirm-nonexistent-file-or-buffer)))) + (find-file filename wildcards)) + +(defun magit-find-git-config-file-other-window (filename &optional wildcards) + "Edit a file located in the current repository's git directory, in another window. + +When \".git\", located at the root of the working tree, is a +regular file, then that makes it cumbersome to open a file +located in the actual git directory. + +This command is like `find-file-other-window', except that it +temporarily binds `default-directory' to the actual git +directory, while reading the FILENAME." + (interactive + (let ((default-directory (magit-git-dir))) + (find-file-read-args "Find file in other window: " + (confirm-nonexistent-file-or-buffer)))) + (find-file-other-window filename wildcards)) + +(defun magit-find-git-config-file-other-frame (filename &optional wildcards) + "Edit a file located in the current repository's git directory, in another frame. + +When \".git\", located at the root of the working tree, is a +regular file, then that makes it cumbersome to open a file +located in the actual git directory. + +This command is like `find-file-other-frame', except that it +temporarily binds `default-directory' to the actual git +directory, while reading the FILENAME." + (interactive + (let ((default-directory (magit-git-dir))) + (find-file-read-args "Find file in other frame: " + (confirm-nonexistent-file-or-buffer)))) + (find-file-other-frame filename wildcards)) + +;;; File Mode + +(defvar magit-file-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-xg" 'magit-status) + (define-key map "\C-x\M-g" 'magit-dispatch-popup) + (define-key map "\C-c\M-g" 'magit-file-popup) + map) + "Keymap for `magit-file-mode'.") + +;;;###autoload (autoload 'magit-file-popup "magit" nil t) +(magit-define-popup magit-file-popup + "Popup console for Magit commands in file-visiting buffers." + :actions '((?s "Stage" magit-stage-file) + (?d "Diff" magit-diff-buffer-file) + (?l "Log" magit-log-buffer-file) + (?b "Blame" magit-blame-popup) + (?u "Unstage" magit-unstage-file) + (?D "Diff..." magit-diff-buffer-file-popup) + (?L "Log..." magit-log-buffer-file-popup) + (?p "Find blob" magit-blob-previous) + (?c "Commit" magit-commit-popup)) + :max-action-columns 4) + +(defvar magit-file-mode-lighter "") + +(define-minor-mode magit-file-mode + "Enable some Magit features in a file-visiting buffer. + +Currently this only adds the following key bindings. +\n\\{magit-file-mode-map}" + :package-version '(magit . "2.2.0") + :lighter magit-file-mode-lighter + :keymap magit-file-mode-map) + +(defun magit-file-mode-turn-on () + (and buffer-file-name + (ignore-errors (magit-inside-worktree-p)) + (magit-file-mode))) + +;;;###autoload +(define-globalized-minor-mode global-magit-file-mode + magit-file-mode magit-file-mode-turn-on + :package-version '(magit . "2.2.0") + :link '(info-link "(magit)Minor Mode for Buffers Visiting Files") + :group 'magit-essentials + :group 'magit-modes) + +;;; Blob Mode + +(defvar magit-blob-mode-map + (let ((map (make-sparse-keymap))) + (cond ((featurep 'jkl) + (define-key map "i" 'magit-blob-previous) + (define-key map "k" 'magit-blob-next)) + (t + (define-key map "p" 'magit-blob-previous) + (define-key map "n" 'magit-blob-next))) + (define-key map "q" 'magit-kill-this-buffer) + map) + "Keymap for `magit-blob-mode'.") + +(define-minor-mode magit-blob-mode + "Enable some Magit features in blob-visiting buffers. + +Currently this only adds the following key bindings. +\n\\{magit-blob-mode-map}" + :package-version '(magit . "2.3.0")) + +(defun magit-blob-next () + "Visit the next blob which modified the current file." + (interactive) + (if magit-buffer-file-name + (magit-blob-visit (or (magit-blob-successor magit-buffer-revision + magit-buffer-file-name) + magit-buffer-file-name) + (line-number-at-pos)) + (if (buffer-file-name (buffer-base-buffer)) + (user-error "You have reached the end of time") + (user-error "Buffer isn't visiting a file or blob")))) + +(defun magit-blob-previous () + "Visit the previous blob which modified the current file." + (interactive) + (-if-let (file (or magit-buffer-file-name + (buffer-file-name (buffer-base-buffer)))) + (--if-let (magit-blob-ancestor magit-buffer-revision file) + (magit-blob-visit it (line-number-at-pos)) + (user-error "You have reached the beginning of time")) + (user-error "Buffer isn't visiting a file or blob"))) + +(defun magit-blob-visit (blob-or-file line) + (if (stringp blob-or-file) + (find-file blob-or-file) + (-let [(rev file) blob-or-file] + (magit-find-file rev file) + (apply #'message "%s (%s %s ago)" + (magit-rev-format "%s" rev) + (magit--age (magit-rev-format "%ct" rev))))) + (goto-char (point-min)) + (forward-line (1- line))) + +(defun magit-blob-ancestor (rev file) + (let ((lines (magit-with-toplevel + (magit-git-lines "log" "-2" "--format=%H" "--name-only" + "--follow" (or rev "HEAD") "--" file)))) + (if rev (cddr lines) (butlast lines 2)))) + +(defun magit-blob-successor (rev file) + (let ((lines (magit-with-toplevel + (magit-git-lines "log" "--format=%H" "--name-only" "--follow" + "HEAD" "--" file)))) + (catch 'found + (while lines + (if (equal (nth 2 lines) rev) + (throw 'found (list (nth 0 lines) (nth 1 lines))) + (setq lines (nthcdr 2 lines))))))) + +;;; File Commands + +(defun magit-file-rename (file newname) + "Rename the FILE to NEWNAME. +If FILE isn't tracked in Git, fallback to using `rename-file'." + (interactive + (let* ((file (magit-read-file "Rename file")) + (newname (read-file-name (format "Rename %s to file: " file)))) + (list (expand-file-name file (magit-toplevel)) + (expand-file-name newname)))) + (if (magit-file-tracked-p file) + (let ((oldbuf (get-file-buffer file))) + (when (and oldbuf (buffer-modified-p oldbuf)) + (user-error "Save %s before moving it" file)) + (when (file-exists-p newname) + (user-error "%s already exists" newname)) + (magit-run-git "mv" file newname) + (when oldbuf + (with-current-buffer oldbuf + (let ((buffer-read-only buffer-read-only)) + (set-visited-file-name newname)) + (if (fboundp 'vc-refresh-state) + (vc-refresh-state) + (with-no-warnings + (vc-find-file-hook)))))) + (rename-file file newname current-prefix-arg) + (magit-refresh))) + +(defun magit-file-untrack (file) + "Untrack FILE. +Stop tracking FILE in Git but do not remove it from the working +tree." + (interactive (list (magit-read-tracked-file "Untrack file"))) + (magit-run-git "rm" "--cached" "--" file)) + +(defun magit-file-delete (file &optional force) + "Delete FILE. +With a prefix argument FORCE do so even when FILE has uncommitted +changes. + +If FILE isn't tracked in Git, fallback to using `delete-file'." + (interactive (list (magit-read-file "Delete file"))) + (if (magit-file-tracked-p file) + (magit-run-git "rm" (and force "--force") "--" file) + (delete-file (expand-file-name file (magit-toplevel)) t) + (magit-refresh))) + +;;;###autoload +(defun magit-file-checkout (rev file) + "Checkout FILE from REV." + (interactive + (let ((rev (magit-read-branch-or-commit + "Checkout from revision" magit-buffer-revision))) + (list rev (magit-read-file-from-rev rev "Checkout file")))) + (magit-with-toplevel + (magit-run-git "checkout" rev "--" file))) + +;;; Read File + +(defvar magit-read-file-hist nil) + +(defun magit-read-file-from-rev (rev prompt &optional default) + (let ((files (magit-revision-files rev))) + (magit-completing-read + prompt files nil t nil 'magit-read-file-hist + (car (member (or default (magit-current-file)) files))))) + +(defun magit-read-file (prompt &optional tracked-only) + (let ((choices (nconc (magit-list-files) + (unless tracked-only (magit-untracked-files))))) + (magit-completing-read prompt choices nil t nil nil + (car (member (or (magit-section-when (file submodule)) + (magit-file-relative-name + nil tracked-only)) + choices))))) + +(defun magit-read-tracked-file (prompt) + (magit-read-file prompt t)) + +(defun magit-read-file-choice (prompt files &optional error default) + "Read file from FILES. + +If FILES has only one member, return that instead of prompting. +If FILES has no members, give a user error. ERROR can be given +to provide a more informative error. + +If DEFAULT is non-nil, use this as the default value instead of +`magit-current-file'." + (pcase (length files) + (0 (user-error (or error "No file choices"))) + (1 (car files)) + (_ (magit-completing-read + prompt files nil t nil 'magit-read-file-hist + (car (member (or default (magit-current-file)) files)))))) + +(defun magit-read-changed-file (rev-or-range prompt &optional default) + (magit-read-file-choice + prompt + (magit-changed-files rev-or-range) + default + (concat "No file changed in " rev-or-range))) + +(defun magit-read-files (prompt initial-contents) + (mapconcat 'identity + (completing-read-multiple (or prompt "File,s: ") + (magit-list-files) + nil nil initial-contents) ",")) + +(provide 'magit-files) +;;; magit-files.el ends here diff --git a/elpa/magit-20161115.1658/magit-git.el b/elpa/magit-20171009.1252/magit-git.el similarity index 79% rename from elpa/magit-20161115.1658/magit-git.el rename to elpa/magit-20171009.1252/magit-git.el index af9134c7..024caea0 100644 --- a/elpa/magit-20161115.1658/magit-git.el +++ b/elpa/magit-20171009.1252/magit-git.el @@ -1,6 +1,6 @@ ;;; magit-git.el --- Git functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -33,6 +33,7 @@ (require 'magit-utils) (require 'magit-section) +(declare-function magit-maybe-make-margin-overlay 'magit-log) (declare-function magit-process-buffer 'magit-process) (declare-function magit-process-file 'magit-process) (declare-function magit-process-insert-section 'magit-process) @@ -42,8 +43,6 @@ (defvar magit-tramp-process-environment nil) -(require 'crm) - ;;; Options ;; For now this is shared between `magit-process' and `magit-git'. @@ -55,6 +54,18 @@ (list (format "INSIDE_EMACS=%s,magit" emacs-version)) "Prepended to `process-environment' while running git.") +(defcustom magit-git-output-coding-system + (and (eq system-type 'windows-nt) 'utf-8) + "Coding system for receiving output from Git. + +If non-nil, the Git config value `i18n.logOutputEncoding' should +be set via `magit-git-global-arguments' to value consistent with +this." + :package-version '(magit . "2.9.0") + :group 'magit-process + :type '(choice (coding-system :tag "Coding system to decode Git output") + (const :tag "Use system default" nil))) + (defcustom magit-git-executable ;; Git might be installed in a different location on a remote, so ;; it is better not to use the full path to the executable, except @@ -97,9 +108,10 @@ (defcustom magit-git-global-arguments `("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" + "-c" "log.showSignature=false" ,@(and (eq system-type 'windows-nt) (list "-c" "i18n.logOutputEncoding=UTF-8"))) - "Global git arguments. + "Global Git arguments. The arguments set here are used every time the git executable is run as a subprocess. They are placed right after the executable @@ -113,11 +125,11 @@ know what you are doing. And think very hard before adding something; it will be used every time Magit runs Git for any purpose." :package-version '(magit . "2.9.0") - :group 'magit + :group 'magit-git-arguments :group 'magit-process :type '(repeat string)) -(defcustom magit-git-debug nil +(defvar magit-git-debug nil "Whether to enable additional reporting of git errors. Magit basically calls git for one of these two reasons: for @@ -133,10 +145,7 @@ option is non-nil and git returns with a non-zero exit status, then at least its standard error is inserted into this buffer. This is only intended for debugging purposes. Do not enable this -permanently, that would negatively affect performance" - :group 'magit - :group 'magit-process - :type 'boolean) +permanently, that would negatively affect performance.") (defcustom magit-ref-namespaces '(("^@$" magit-head nil) @@ -159,11 +168,11 @@ has the form (REGEXP FACE FORMATTER). REGEXP is a regular expression used to match full refs. The first entry whose REGEXP matches the reference is used. The first regexp submatch becomes the \"label\" that represents the ref and is propertized with -font FONT. If FORMATTER is non-nil it should be a function that +font FONT. If FORMATTER is non-nil, it should be a function that takes two arguments, the full ref and the face. It is supposed to return a propertized label that represents the ref." :package-version '(magit . "2.1.0") - :group 'magit-modes + :group 'magit-miscellanous :type '(repeat (list regexp face @@ -184,6 +193,31 @@ change the upstream and many which create new branches." :group 'magit-commands :type 'boolean) +(defcustom magit-list-refs-sortby nil + "How to sort the ref collection in the prompt. + +This affects commands that read a ref. More specifically, it +controls the order of refs returned by `magit-list-refs', which +is called by functions like `magit-list-branch-names' to generate +the collection of refs. By default, refs are sorted according to +their full refname (i.e., 'refs/...'). + +Any value accepted by the `--sort' flag of `git for-each-ref' can +be used. For example, \"-creatordate\" places refs with more +recent committer or tagger dates earlier in the list. A list of +strings can also be given in order to pass multiple sort keys to +`git for-each-ref'. + +Note that, depending on the completion framework you use, this +may not be sufficient to change the order in which the refs are +displayed. It only controls the order of the collection passed +to `magit-completing-read' or, for commands that support reading +multiple strings, `read-from-minibuffer'. The completion +framework ultimately determines how the collection is displayed." + :package-version '(magit . "2.11.0") + :group 'magit-miscellanous + :type '(choice string (repeat string))) + ;;; Git (defvar magit--refresh-cache nil) @@ -213,7 +247,7 @@ change the upstream and many which create new branches." ;; `shell-quote-argument'), but Git for Windows expects shell ;; quoting in the dos style. (shell-file-name (if (and (eq system-type 'windows-nt) - ;; If we have Cygwin mount points + ;; If we have Cygwin mount points, ;; the git flavor is cygwin, so dos ;; shell quoting is probably wrong. (not magit-cygwin-mount-points)) @@ -248,8 +282,8 @@ to do the following. (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 -newline return an empty string. Like `magit-git-string' but +If there is no output, return nil. If the output begins with a +newline, return an empty string. Like `magit-git-string' but ignore `magit-git-debug'." (setq args (-flatten args)) (magit--with-refresh-cache (cons default-directory args) @@ -291,9 +325,12 @@ add a section in the respective process buffer." (setq msg (with-temp-buffer (insert-file-contents log) (goto-char (point-max)) - (and (re-search-backward - magit-process-error-message-re nil t) - (match-string 1)))) + (cond + ((functionp magit-git-debug) + (funcall magit-git-debug (buffer-string))) + ((re-search-backward + magit-process-error-message-re nil t) + (match-string 1))))) (let ((magit-git-debug nil)) (with-current-buffer (magit-process-buffer t) (magit-process-insert-section default-directory @@ -307,8 +344,8 @@ add a section in the respective process buffer." (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 -newline return an empty string." +If there is no output, return nil. If the output begins with a +newline, return an empty string." (setq args (-flatten args)) (magit--with-refresh-cache (cons default-directory args) (with-temp-buffer @@ -340,9 +377,9 @@ message and add a section in the respective process buffer." (defun magit-git-wash (washer &rest args) "Execute Git with ARGS, inserting washed output at point. Actually first insert the raw output at point. If there is no -output call `magit-cancel-section'. Otherwise temporarily narrow +output, call `magit-cancel-section'. Otherwise temporarily narrow the buffer to the inserted text, move to its beginning, and then -call function WASHER with no argument." +call function WASHER with ARGS as its sole argument." (declare (indent 1)) (let ((beg (point))) (setq args (-flatten args)) @@ -357,7 +394,8 @@ call function WASHER with no argument." (funcall washer args)) (when (or (= (point) beg) (= (point) (1+ beg))) - (magit-cancel-section))))) + (magit-cancel-section)) + (magit-maybe-make-margin-overlay)))) (defun magit-git-version (&optional raw) (--when-let (let (magit-git-global-arguments) @@ -396,6 +434,21 @@ absolute path is returned." (setq it (file-name-as-directory (magit-expand-git-file-name it))) (if path (expand-file-name (convert-standard-filename path) it) it))))) +(defvar magit--separated-gitdirs nil) + +(defun magit--record-separated-gitdir () + (let ((topdir (magit-toplevel)) + (gitdir (magit-git-dir))) + ;; We want to delete the entry for `topdir' here, rather than within + ;; (unless ...), in case a `--separate-git-dir' repository was switched to + ;; the standard structure (i.e., "topdir/.git/"). + (setq magit--separated-gitdirs (cl-delete topdir + magit--separated-gitdirs + :key #'car :test #'equal)) + (unless (equal (file-name-as-directory (expand-file-name ".git" topdir)) + gitdir) + (push (cons topdir gitdir) magit--separated-gitdirs)))) + (defun magit-toplevel (&optional directory) "Return the absolute path to the toplevel of the current repository. @@ -460,14 +513,20 @@ returning the truename." (let* ((link (expand-file-name "gitdir" gitdir)) (wtree (and (file-exists-p link) (magit-file-line link)))) - (if (and wtree - ;; Ignore .git/gitdir files that result from a - ;; Git bug. See #2364. - (not (equal wtree ".git"))) - ;; Return the linked working tree. - (file-name-directory wtree) + (cond + ((and wtree + ;; Ignore .git/gitdir files that result from a + ;; Git bug. See #2364. + (not (equal wtree ".git"))) + ;; Return the linked working tree. + (file-name-directory wtree)) + ;; The working directory may not be the parent directory of + ;; .git if it was set up with `git init --separate-git-dir'. + ;; See #2955. + ((car (rassoc gitdir magit--separated-gitdirs))) + (t ;; Step outside the control directory to enter the working tree. - (file-name-directory (directory-file-name gitdir)))))))))) + (file-name-directory (directory-file-name gitdir))))))))))) (defmacro magit-with-toplevel (&rest body) (declare (indent defun) (debug (body))) @@ -496,7 +555,7 @@ returning the truename." (defun magit-git-repo-p (directory &optional non-bare) "Return t if DIRECTORY is a Git repository. When optional NON-BARE is non-nil also return nil if DIRECTORY is -a bare repositories." +a bare repository." (or (file-regular-p (expand-file-name ".git" directory)) (file-directory-p (expand-file-name ".git" directory)) (and (not non-bare) @@ -514,9 +573,9 @@ a bare repositories." (defun magit-file-relative-name (&optional file tracked) "Return the path of FILE relative to the repository root. -If optional FILE is nil or omitted return the relative path of +If optional FILE is nil or omitted, return the relative path of the file being visited in the current buffer, if any, else nil. -If the file is not inside a Git repository then return nil. +If the file is not inside a Git repository, then return nil. If TRACKED is non-nil, return the path only if it matches a tracked file." @@ -543,20 +602,16 @@ tracked file." (defun magit-untracked-files (&optional all files) (magit-list-files "--other" (unless all "--exclude-standard") "--" files)) -(defun magit-modified-files (&optional nomodules) +(defun magit-unstaged-files (&optional nomodules files) (magit-git-items "diff-files" "-z" "--name-only" - (and nomodules "--ignore-submodules"))) + (and nomodules "--ignore-submodules") + "--" files)) (defun magit-staged-files (&optional nomodules files) (magit-git-items "diff-index" "-z" "--name-only" "--cached" (and nomodules "--ignore-submodules") (magit-headish) "--" files)) -(defun magit-unstaged-files (&optional nomodules files) - (magit-git-items "diff-index" "-z" "--name-only" - (and nomodules "--ignore-submodules") - (magit-headish) "--" files)) - (defun magit-staged-binary-files () (--mapcat (and (string-match "^-\t-\t\\(.+\\)" it) (list (match-string 1 it))) @@ -651,7 +706,10 @@ Sorted from longest to shortest CYGWIN name." (defun magit-decode-git-path (path) (if (eq (aref path 0) ?\") - (string-as-multibyte (read path)) + (decode-coding-string (read path) + (or magit-git-output-coding-system + (car default-process-coding-system)) + t) path)) (defun magit-file-at-point () @@ -704,12 +762,12 @@ are considered." (defun magit-rev-parse (&rest args) "Execute `git rev-parse ARGS', returning first line of output. -If there is no output return nil." +If there is no output, return nil." (apply #'magit-git-string "rev-parse" args)) (defun magit-rev-parse-safe (&rest args) "Execute `git rev-parse ARGS', returning first line of output. -If there is no output return nil. Like `magit-rev-parse' but +If there is no output, return nil. Like `magit-rev-parse' but ignore `magit-git-debug'." (apply #'magit-git-str "rev-parse" args)) @@ -745,24 +803,41 @@ string \"true\", otherwise return nil." (magit-rev-parse "HEAD"))))) (defun magit-rev-name (rev &optional pattern) - (magit-git-string "name-rev" "--name-only" "--no-undefined" - (and pattern (concat "--refs=" pattern)) - rev)) + "Return a symbolic name for REV. +PATTERN is passed to the `--refs' flag of `git-name-rev' and can +be used to limit the result to a matching ref. When structured +as \"refs//*\", PATTERN is taken as a namespace. In this +case, the name returned by `git-name-rev' is discarded if it +corresponds to a ref outside of the namespace." + (--when-let (magit-git-string "name-rev" "--name-only" "--no-undefined" + (and pattern (concat "--refs=" pattern)) + rev) + ;; We can't use name-rev's --exclude to filter out "*/PATTERN" + ;; because --exclude wasn't added until Git v2.13.0. + (if (and pattern + (string-match-p "\\`refs/[^/]+/\\*\\'" pattern)) + (let ((namespace (substring pattern 0 -1))) + (unless (and (string-match-p namespace it) + (not (magit-rev-verify (concat namespace it)))) + it)) + it))) (defun magit-rev-branch (rev) (--when-let (magit-rev-name rev "refs/heads/*") (unless (string-match-p "~" it) it))) (defun magit-get-shortname (rev) - (let ((fn (apply-partially 'magit-git-string "name-rev" - "--name-only" "--no-undefined" rev))) - (setq rev (or (funcall fn "--refs=refs/tags/*") - (funcall fn "--refs=refs/heads/*") - (funcall fn "--refs=refs/remotes/*" "--always"))) - (if (and (string-match "^\\(?:tags\\|remotes\\)/\\(.+\\)" rev) - (magit-ref-fullname (match-string 1 rev))) - (match-string 1 rev) - rev))) + (let* ((fn (apply-partially 'magit-rev-name rev)) + (name (or (funcall fn "refs/tags/*") + (funcall fn "refs/heads/*") + (funcall fn "refs/remotes/*")))) + (cond ((not name) + (magit-rev-parse "--short" rev)) + ((string-match "^\\(?:tags\\|remotes\\)/\\(.+\\)" name) + (if (magit-ref-ambiguous-p (match-string 1 name)) + name + (match-string 1 name))) + (t (magit-ref-maybe-qualify name))))) (defun magit-name-branch (rev &optional lax) (or (magit-name-local-branch rev) @@ -771,28 +846,62 @@ string \"true\", otherwise return nil." (magit-name-remote-branch rev t))))) (defun magit-name-local-branch (rev &optional lax) - (--when-let (magit-git-string "name-rev" "--name-only" "--no-undefined" - "--refs=refs/heads/*" rev) + (--when-let (magit-rev-name rev "refs/heads/*") (and (or lax (not (string-match-p "[~^]" it))) it))) (defun magit-name-remote-branch (rev &optional lax) - (--when-let (magit-git-string "name-rev" "--name-only" "--no-undefined" - "--refs=refs/remotes/*" rev) + (--when-let (magit-rev-name rev "refs/remotes/*") (and (or lax (not (string-match-p "[~^]" it))) (substring it 8)))) (defun magit-name-tag (rev &optional lax) - (--when-let (magit-git-string "name-rev" "--name-only" "--no-undefined" - "--refs=refs/tags/*" rev) + (--when-let (magit-rev-name rev "refs/tags/*") (and (or lax (not (string-match-p "[~^]" it))) (substring it 5)))) (defun magit-ref-fullname (name) - (magit-rev-parse "--symbolic-full-name" name)) + "Return fully qualified refname for NAME. +If NAME is ambiguous, return nil. NAME may include suffixes such +as \"^1\" and \"~3\". " + (save-match-data + (if (string-match "\\`\\([^^~]+\\)\\(.*\\)" name) + (--when-let (magit-rev-parse "--symbolic-full-name" + (match-string 1 name)) + (concat it (match-string 2 name))) + (error "`name' has an unrecognized format")))) + +(defun magit-ref-ambiguous-p (name) + (not (magit-ref-fullname name))) + +(cl-defun magit-ref-maybe-qualify (name &optional (prefix "heads/")) + "If NAME is ambiguous, prepend PREFIX to it." + (concat (and (magit-ref-ambiguous-p name) + prefix) + name)) (defun magit-ref-exists-p (ref) (magit-git-success "show-ref" "--verify" ref)) +(defun magit-ref-equal (a b) + "Return t if the refs A and B are `equal'. +A symbolic-ref pointing to some ref, is `equal' to that ref, +as are two symbolic-refs pointing to the same ref." + (equal (magit-ref-fullname a) + (magit-ref-fullname b))) + +(defun magit-ref-eq (a b) + "Return t if the refs A and B are `eq'. +A symbolic-ref is `eq' to itself, but not to the ref it points +to, or to some other symbolic-ref that points to the same ref." + (let ((symbolic-a (magit-symbolic-ref-p a)) + (symbolic-b (magit-symbolic-ref-p b))) + (or (and symbolic-a + symbolic-b + (equal a b)) + (and (not symbolic-a) + (not symbolic-b) + (magit-ref-equal a b))))) + (defun magit-headish () "Return \"HEAD\" or if that doesn't exist the hash of the empty tree." (if (magit-no-commit-p) @@ -806,7 +915,7 @@ string \"true\", otherwise return nil." (defun magit-local-branch-at-point () (magit-section-case - (branch (let ((branch (magit-section-value it))) + (branch (let ((branch (magit-ref-maybe-qualify (magit-section-value it)))) (when (member branch (magit-list-local-branch-names)) branch))) (commit (magit-name-local-branch (magit-section-value it))))) @@ -824,12 +933,14 @@ string \"true\", otherwise return nil." (car magit-refresh-args)))) (defun magit-branch-or-commit-at-point () - (or (magit-section-case - (branch (magit-section-value it)) + (or magit-buffer-refname + (magit-section-case + (branch (magit-ref-maybe-qualify (magit-section-value it))) (commit (let ((rev (magit-section-value it))) (or (magit-get-shortname rev) rev))) - (tag (magit-section-value it))) - (and (derived-mode-p 'magit-revision-mode) + (tag (magit-ref-maybe-qualify (magit-section-value it) "tags/"))) + (and (derived-mode-p 'magit-revision-mode + 'magit-merge-preview-mode) (car magit-refresh-args)))) (defun magit-tag-at-point () @@ -862,26 +973,33 @@ which is different from the current branch and still exists." (cl-incf i)) prev)) -(cl-defun magit-get-upstream-ref - (&optional (branch (magit-get-current-branch))) - (when branch - (let ((remote (magit-get "branch" branch "remote")) - (merge (magit-get "branch" branch "merge"))) - (when (and remote merge) - (cond ((string-equal remote ".") merge) - ((string-prefix-p "refs/heads/" merge) - (concat "refs/remotes/" remote "/" (substring merge 11)))))))) - -(cl-defun magit-get-upstream-branch - (&optional (branch (magit-get-current-branch))) - (when branch - (let ((remote (magit-get "branch" branch "remote")) - (merge (magit-get "branch" branch "merge"))) - (when (and remote merge (string-prefix-p "refs/heads/" merge)) - (setq merge (substring merge 11)) - (if (string-equal remote ".") - (propertize merge 'face 'magit-branch-local) - (propertize (concat remote "/" merge) 'face 'magit-branch-remote)))))) +(defun magit-get-upstream-ref (&optional branch) + (and (or branch (setq branch (magit-get-current-branch))) + (let ((remote (magit-get "branch" branch "remote")) + (merge (magit-get "branch" branch "merge"))) + (when (and remote merge) + (cond ((string-equal remote ".") merge) + ((string-prefix-p "refs/heads/" merge) + (concat "refs/remotes/" remote "/" (substring merge 11)))))))) + +(defun magit-get-upstream-branch (&optional branch verify) + (and (or branch (setq branch (magit-get-current-branch))) + (-when-let* ((remote (magit-get "branch" branch "remote")) + (merge (magit-get "branch" branch "merge"))) + (and (string-prefix-p "refs/heads/" merge) + (let* ((upstream (substring merge 11)) + (upstream + (cond ((string-equal remote ".") + (propertize upstream 'face 'magit-branch-local)) + ((string-match-p "[@:]" remote) + (propertize (concat remote " " upstream) + 'face 'magit-branch-remote)) + (t + (propertize (concat remote "/" upstream) + 'face 'magit-branch-remote))))) + (and (or (not verify) + (magit-rev-verify upstream)) + upstream)))))) (defun magit-get-indirect-upstream-branch (branch &optional force) (let ((remote (magit-get "branch" branch "remote"))) @@ -902,20 +1020,22 @@ which is different from the current branch and still exists." (magit-rev-ancestor-p upstream branch) upstream))))) -(cl-defun magit-get-upstream-remote - (&optional (branch (magit-get-current-branch))) - (when branch - (magit-get "branch" branch "remote"))) +(defun magit-get-upstream-remote (&optional branch) + (and (or branch (setq branch (magit-get-current-branch))) + (magit-get "branch" branch "remote"))) -(cl-defun magit-get-push-remote - (&optional (branch (magit-get-current-branch))) - (or (and branch (magit-get "branch" branch "pushRemote")) +(defun magit-get-push-remote (&optional branch) + (or (and (or branch (setq branch (magit-get-current-branch))) + (magit-get "branch" branch "pushRemote")) (magit-get "remote.pushDefault"))) -(cl-defun magit-get-push-branch - (&optional (branch (magit-get-current-branch))) - (-when-let (remote (and branch (magit-get-push-remote branch))) - (concat remote "/" branch))) +(defun magit-get-push-branch (&optional branch verify) + (and (or branch (setq branch (magit-get-current-branch))) + (-when-let* ((remote (magit-get-push-remote branch)) + (push-branch (concat remote "/" branch))) + (and (or (not verify) + (magit-rev-verify push-branch)) + push-branch)))) (defun magit-get-@{push}-branch (&optional branch) (let ((ref (magit-rev-parse "--symbolic-full-name" @@ -929,9 +1049,33 @@ which is different from the current branch and still exists." (unless (equal remote ".") remote)))) +(defun magit-branch-merged-p (branch &optional target) + "Return non-nil if BRANCH is merged into its upstream and TARGET. + +TARGET defaults to the current branch. If `HEAD' is detached and +TARGET is nil, then always return nil. As a special case, if +TARGET is t, then return non-nil if BRANCH is merged into any one +of the other local branches. + +If, and only if, BRANCH has an upstream, then only return non-nil +if BRANCH is merged into both TARGET (as described above) as well +as into its upstream." + (and (--if-let (and (magit-branch-p branch) + (magit-get-upstream-branch branch)) + (magit-git-success "merge-base" "--is-ancestor" branch it) + t) + (if (eq target t) + (delete (magit-name-local-branch branch) + (magit-list-containing-branches branch)) + (--when-let (or target (magit-get-current-branch)) + (magit-git-success "merge-base" "--is-ancestor" branch it))))) + (defun magit-split-branch-name (branch) (cond ((member branch (magit-list-local-branch-names)) (cons "." branch)) + ((string-match " " branch) + (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))) @@ -941,10 +1085,10 @@ which is different from the current branch and still exists." (defun magit-get-current-tag (&optional rev with-distance) "Return the closest tag reachable from REV. -If optional REV is nil then default to \"HEAD\". +If optional REV is nil, then default to `HEAD'. If optional WITH-DISTANCE is non-nil then return (TAG COMMITS), if it is `dirty' return (TAG COMMIT DIRTY). COMMITS is the number -of commits in \"HEAD\" but not in TAG and DIRTY is t if there are +of commits in `HEAD' but not in TAG and DIRTY is t if there are uncommitted changes, nil otherwise." (--when-let (magit-git-str "describe" "--long" "--tags" (and (eq with-distance 'dirty) "--dirty") rev) @@ -960,10 +1104,10 @@ uncommitted changes, nil otherwise." (defun magit-get-next-tag (&optional rev with-distance) "Return the closest tag from which REV is reachable. -If optional REV is nil then default to \"HEAD\". +If optional REV is nil, then default to `HEAD'. If no such tag can be found or if the distance is 0 (in which -case it is the current tag, not the next) return nil instead. -If optional WITH-DISTANCE is non-nil then return (TAG COMMITS) +case it is the current tag, not the next), return nil instead. +If optional WITH-DISTANCE is non-nil, then return (TAG COMMITS) where COMMITS is the number of commits in TAG but not in REV." (--when-let (magit-git-str "describe" "--contains" (or rev "HEAD")) (save-match-data @@ -977,12 +1121,27 @@ where COMMITS is the number of commits in TAG but not in REV." (defvar magit-list-refs-namespaces '("refs/heads" "refs/remotes" "refs/tags" "refs/pull")) -(defun magit-list-refs (&rest args) - (magit-git-lines "for-each-ref" "--format=%(refname)" - (or args magit-list-refs-namespaces))) +(defun magit-list-refs (&optional namespaces format sortby) + "Return list of references. + +When NAMESPACES is non-nil, list refs from these namespaces +rather than those from `magit-list-refs-namespaces'. + +FORMAT is passed to the `--format' flag of `git for-each-ref' and +defaults to \"%(refname)\". + +SORTBY is a key or list of keys to pass to the `--sort' flag of +`git for-each-ref'. When nil, use `magit-list-refs-sortby'" + (magit-git-lines "for-each-ref" + (concat "--format=" (or format "%(refname)")) + (--map (concat "--sort=" it) + (pcase (or sortby magit-list-refs-sortby) + ((and val (pred stringp)) (list val)) + ((and val (pred listp)) val))) + (or namespaces magit-list-refs-namespaces))) (defun magit-list-branches () - (magit-list-refs "refs/heads" "refs/remotes")) + (magit-list-refs (list "refs/heads" "refs/remotes"))) (defun magit-list-local-branches () (magit-list-refs "refs/heads")) @@ -1010,12 +1169,11 @@ where COMMITS is the number of commits in TAG but not in REV." (member it (magit-list-unmerged-branches upstream))) (magit-list-local-branch-names))) -(defun magit-list-refnames (&rest args) - (magit-git-lines "for-each-ref" "--format=%(refname:short)" - (or args magit-list-refs-namespaces))) +(defun magit-list-refnames (&optional namespaces) + (magit-list-refs namespaces "%(refname:short)")) (defun magit-list-branch-names () - (magit-list-refnames "refs/heads" "refs/remotes")) + (magit-list-refnames (list "refs/heads" "refs/remotes"))) (defun magit-list-local-branch-names () (magit-list-refnames "refs/heads")) @@ -1042,6 +1200,9 @@ where COMMITS is the number of commits in TAG but not in REV." (defun magit-list-tags () (magit-git-lines "tag")) +(defun magit-list-stashes (&optional format) + (magit-git-lines "stash" "list" (concat "--format=" (or format "%gd")))) + (defun magit-list-notes-refnames () (--map (substring it 6) (magit-list-refnames "refs/notes"))) @@ -1065,6 +1226,18 @@ where COMMITS is the number of commits in TAG but not in REV." (list (match-string 1 it))) (magit-git-items "ls-files" "-z" "--stage"))) +(defun magit-get-submodule-name (path) + "Return the name of the submodule at PATH. +PATH has to be relative to the super-repository." + (cadr (split-string + (car (or (magit-git-items + "config" "-z" + "-f" (expand-file-name ".gitmodules" (magit-toplevel)) + "--get-regexp" "^submodule\\..*\\.path$" + (concat "^" (regexp-quote (directory-file-name path)) "$")) + (error "No such submodule `%s'" path))) + "\n"))) + (defun magit-list-worktrees () (let (worktrees worktree) (dolist (line (let ((magit-git-global-arguments @@ -1090,6 +1263,9 @@ where COMMITS is the number of commits in TAG but not in REV." ((string-equal line "detached")))) (nreverse worktrees))) +(defun magit-symbolic-ref-p (name) + (magit-git-success "symbolic-ref" "--quiet" name)) + (defun magit-ref-p (rev) (or (car (member rev (magit-list-refs))) (car (member rev (magit-list-refnames))))) @@ -1127,7 +1303,15 @@ Return a list of two integers: (A>B B>A)." "\t"))) (defun magit-abbrev-length () - (string-to-number (or (magit-get "core.abbrev") "7"))) + (--if-let (magit-get "core.abbrev") + (string-to-number it) + ;; Guess the length git will be using based on an example + ;; abbreviation. Actually HEAD's abbreviation might be an + ;; outlier, so use the shorter of the abbreviations for two + ;; commits. When a commit does not exist, then fall back + ;; to the default of 7. See #3034. + (min (--if-let (magit-rev-parse "--short" "HEAD") (length it) 7) + (--if-let (magit-rev-parse "--short" "HEAD~") (length it) 7)))) (defun magit-abbrev-arg (&optional arg) (format "--%s=%d" (or arg "abbrev") (magit-abbrev-length))) @@ -1187,8 +1371,15 @@ Return a list of two integers: (A>B B>A)." 'face (if (equal ref head) 'magit-branch-current face))))) (defun magit-format-ref-labels (string) + ;; To support Git <2.2.0, we remove the surrounding parentheses here + ;; rather than specifying that STRING should be generated with Git's + ;; "%D" placeholder. + (setq string (->> string + (replace-regexp-in-string "\\`\\s-*(" "") + (replace-regexp-in-string ")\\s-*\\'" ""))) (save-match-data - (let ((regexp "\\(, \\|tag: \\| -> \\|[()]\\)") head names) + (let ((regexp "\\(, \\|tag: \\| -> \\)") + head names) (if (and (derived-mode-p 'magit-log-mode) (member "--simplify-by-decoration" (cadr magit-refresh-args))) (let ((branches (magit-list-local-branch-names)) @@ -1226,7 +1417,8 @@ Return a list of two integers: (A>B B>A)." (defmacro magit-with-temp-index (tree arg &rest body) (declare (indent 2) (debug (form form body))) (let ((file (cl-gensym "file"))) - `(let ((,file (magit-convert-filename-for-git + `(let ((magit--refresh-cache nil) + (,file (magit-convert-filename-for-git (make-temp-name (magit-git-dir "index.magit."))))) (unwind-protect (progn (--when-let ,tree @@ -1248,11 +1440,13 @@ Return a list of two integers: (A>B B>A)." (defun magit-commit-tree (message &optional tree &rest parents) (magit-git-string "commit-tree" "--no-gpg-sign" "-m" message (--mapcat (list "-p" it) (delq nil parents)) - (or tree (magit-git-string "write-tree")))) + (or tree + (magit-git-string "write-tree") + (error "Cannot write tree")))) (defun magit-commit-worktree (message &optional arg &rest other-parents) (magit-with-temp-index "HEAD" arg - (and (magit-update-files (magit-modified-files)) + (and (magit-update-files (magit-unstaged-files)) (apply #'magit-commit-tree message nil "HEAD" other-parents)))) (defun magit-update-files (files) @@ -1287,7 +1481,7 @@ Return a list of two integers: (A>B B>A)." (when (string-match magit-range-re range) (let ((beg (or (match-string 1 range) "HEAD")) (end (or (match-string 3 range) "HEAD"))) - (cons (if (string-equal (match-string 2) "...") + (cons (if (string-equal (match-string 2 range) "...") (magit-git-string "merge-base" beg end) beg) end)))) @@ -1296,11 +1490,12 @@ Return a list of two integers: (A>B B>A)." (defvar magit-revision-history nil) -(defun magit-read-branch (prompt &optional default) +(defun magit-read-branch (prompt &optional secondary-default) (magit-completing-read prompt (magit-list-branch-names) nil t nil 'magit-revision-history (or (magit-branch-at-point) - default (magit-get-current-branch)))) + secondary-default + (magit-get-current-branch)))) (defun magit-read-branch-or-commit (prompt &optional secondary-default) (or (magit-completing-read prompt (cons "HEAD" (magit-list-refnames)) @@ -1321,21 +1516,10 @@ Return a list of two integers: (A>B B>A)." (magit-get-current-branch)))) (defun magit-read-range (prompt &optional default) - (let* ((choose-completion-string-functions - '(crm--choose-completion-string)) - (minibuffer-completion-table #'crm--collection-fn) - (minibuffer-completion-confirm t) - (crm-completion-table (magit-list-refnames)) - (crm-separator "\\.\\.\\.?") - (input (read-from-minibuffer - (concat prompt (and default (format " (%s)" default)) ": ") - nil crm-local-completion-map - nil 'magit-revision-history - default))) - (when (string-equal input "") - (or (setq input default) - (user-error "Nothing selected"))) - input)) + (magit-completing-read-multiple prompt + (magit-list-refnames) + "\\.\\.\\.?" + default 'magit-revision-history)) (defun magit-read-remote-branch (prompt &optional remote default local-branch require-match) @@ -1451,7 +1635,7 @@ Return a list of two integers: (A>B B>A)." (defun magit-read-stash (prompt &optional use-at-point) (let ((atpoint (magit-stash-at-point))) (or (and use-at-point atpoint) - (let ((stashes (magit-git-lines "stash" "list" "--format=%gd"))) + (let ((stashes (magit-list-stashes))) (magit-completing-read prompt stashes nil t nil nil (or atpoint (car stashes))))))) @@ -1524,19 +1708,5 @@ Return a list of two integers: (A>B B>A)." (gv-define-setter magit-get (val &rest keys) `(magit-set ,val ,@keys)) -;;; magit-git.el ends soon - -(define-obsolete-variable-alias 'magit-git-standard-options - 'magit-git-global-arguments "Magit 2.1.0") -(define-obsolete-function-alias 'magit-get-tracked-ref - 'magit-get-upstream-ref "Magit 2.4.0") -(define-obsolete-function-alias 'magit-get-tracked-branch - 'magit-get-upstream-branch "Magit 2.4.0") -(define-obsolete-function-alias 'magit-get-tracked-remote - 'magit-get-upstream-remote "Magit 2.4.0") - (provide 'magit-git) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-git.el ends here diff --git a/elpa/magit-20171009.1252/magit-imenu.el b/elpa/magit-20171009.1252/magit-imenu.el new file mode 100644 index 00000000..0d7b0341 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-imenu.el @@ -0,0 +1,243 @@ +;;; magit-imenu.el --- Integrate Imenu in magit major modes -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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: Damien Cassou +;; 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: + +;; Emacs' major modes can facilitate navigation in their buffers by +;; supporting Imenu. In such major modes, launching Imenu (M-x imenu) +;; makes Emacs display a list of items (e.g., function definitions in +;; a programming major mode). Selecting an item from this list moves +;; point to this item. + +;; magit-imenu.el adds Imenu support to every major mode in Magit + +;;; Code: + +(require 'subr-x) + +(require 'magit) +(require 'git-rebase) + +(defun magit-imenu--index-function (entry-types menu-types) + "Return an alist of imenu entries in current buffer. + +ENTRY-TYPES is a list of section types to be selected through +`imenu'. + +MENU-TYPES is a list of section types containing elements of +ENTRY-TYPES. Elements of MENU-TYPES are are used to categories +elements of ENTRY-TYPES. + +This function is used as a helper for functions set as +`imenu-create-index-function'." + (let ((entries (make-hash-table :test 'equal))) + (goto-char (point-max)) + (while (magit-section--backward-find + (lambda () + (let* ((section (magit-current-section)) + (type (magit-section-type section)) + (parent (magit-section-parent section)) + (parent-type (magit-section-type parent))) + (and (-contains-p entry-types type) + (-contains-p menu-types parent-type))))) + (let* ((section (magit-current-section)) + (name (buffer-substring-no-properties + (line-beginning-position) + (line-end-position))) + (parent (magit-section-parent section)) + (parent-title (buffer-substring-no-properties + (magit-section-start parent) + (1- (magit-section-content parent))))) + (puthash parent-title + (cons (cons name (point)) + (gethash parent-title entries (list))) + entries))) + (-map (lambda (menu-title) + (cons menu-title (gethash menu-title entries))) + (hash-table-keys entries)))) + +;;; Log mode + +;;;###autoload +(defun magit-imenu--log-prev-index-position-function () + "Move point to previous line in current buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (magit-section--backward-find + (lambda () + (-contains-p '(commit stash) + (magit-section-type (magit-current-section)))))) + +;;;###autoload +(defun magit-imenu--log-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (save-match-data + (looking-at "\\([^ ]+\\)[ *|]+\\(.+\\)$") + (format "%s: %s" + (match-string-no-properties 1) + (match-string-no-properties 2)))) + +;;; Diff mode + +;;;###autoload +(defun magit-imenu--diff-prev-index-position-function () + "Move point to previous file line in current buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (magit-section--backward-find + (lambda () + (and (equal (magit-section-type (magit-current-section)) 'file) + (not (equal (magit-section-type + (magit-section-parent (magit-current-section))) + 'diffstat)))))) + +;;;###autoload +(defun magit-imenu--diff-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))) + +;;; Status mode + +;;;###autoload +(defun magit-imenu--status-create-index-function () + "Return an alist of all imenu entries in current buffer. +This function is used as a value for +`imenu-create-index-function'." + (magit-imenu--index-function + '(file commit stash) + '(unpushed unstaged unpulled untracked staged stashes))) + +;;;; Refs mode + +;;;###autoload +(defun magit-imenu--refs-create-index-function () + "Return an alist of all imenu entries in current buffer. +This function is used as a value for +`imenu-create-index-function'." + (magit-imenu--index-function + '(branch commit tag) + '(local remote tags))) + +;;;; Cherry mode + +;;;###autoload +(defun magit-imenu--cherry-create-index-function () + "Return an alist of all imenu entries in current buffer. +This function is used as a value for +`imenu-create-index-function'." + (magit-imenu--index-function + '(commit) + '(cherries))) + +;;;; Submodule list mode + +;;;###autoload +(defun magit-imenu--submodule-prev-index-position-function () + "Move point to previous line in magit-submodule-list buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (unless (bobp) + (forward-line -1))) + +;;;###autoload +(defun magit-imenu--submodule-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (elt (tabulated-list-get-entry) 0)) + +;;;; Repolist mode + +;;;###autoload +(defun magit-imenu--repolist-prev-index-position-function () + "Move point to previous line in magit-repolist buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (unless (bobp) + (forward-line -1))) + +;;;###autoload +(defun magit-imenu--repolist-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (let ((entry (tabulated-list-get-entry))) + (format "%s (%s)" + (elt entry 0) + (elt entry (1- (length entry)))))) + +;;;; Process mode + +;;;###autoload +(defun magit-imenu--process-prev-index-position-function () + "Move point to previous process in magit-process buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (magit-section--backward-find + (lambda () + (eq + (magit-section-type (magit-current-section)) + 'process)))) + +;;;###autoload +(defun magit-imenu--process-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))) + +;;;; Rebase mode + +;;;###autoload +(defun magit-imenu--rebase-prev-index-position-function () + "Move point to previous commit in git-rebase buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (catch 'found + (while (not (bobp)) + (git-rebase-backward-line) + (when (git-rebase-line-p) + (throw 'found t))))) + +;;;###autoload +(defun magit-imenu--rebase-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))) + +(provide 'magit-imenu) +;;; magit-imenu.el ends here diff --git a/elpa/magit-20161115.1658/magit-log.el b/elpa/magit-20171009.1252/magit-log.el similarity index 77% rename from elpa/magit-20161115.1658/magit-log.el rename to elpa/magit-20171009.1252/magit-log.el index a3e2a7b6..8c07a490 100644 --- a/elpa/magit-20161115.1658/magit-log.el +++ b/elpa/magit-20171009.1252/magit-log.el @@ -1,6 +1,6 @@ ;;; magit-log.el --- inspect Git history -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -38,17 +38,22 @@ (declare-function magit-read-file-from-rev 'magit) (declare-function magit-show-commit 'magit) (defvar magit-refs-indent-cherry-lines) +(defvar magit-refs-margin) (defvar magit-refs-show-commit-count) +(defvar magit-buffer-margin) +(defvar magit-status-margin) (defvar magit-status-sections-hook) (require 'ansi-color) (require 'crm) +(defvar bookmark-make-record-function) ;;; Options ;;;; Log Mode (defgroup magit-log nil "Inspect and manipulate Git history." + :link '(info-link "(magit)Logging") :group 'magit-modes) (defcustom magit-log-mode-hook nil @@ -59,8 +64,8 @@ (defcustom magit-log-arguments '("-n256" "--graph" "--decorate") "The log arguments used in `magit-log-mode' buffers." :package-version '(magit . "2.3.0") + :group 'magit-git-arguments :group 'magit-log - :group 'magit-commands :type '(repeat (string :tag "Argument"))) (defcustom magit-log-remove-graph-args '("--follow" "--grep" "-G" "-S" "-L") @@ -86,64 +91,28 @@ Only considered when moving past the last entry with :group 'magit-log :type 'boolean) -(defcustom magit-log-show-margin t - "Whether to initially show the margin in log buffers. - -When non-nil the author name and date are initially displayed in -the margin of log buffers. The margin can be shown or hidden in -the current buffer using the command `magit-toggle-margin'. In -status buffers this option is ignored but it is possible to show -the margin using the mentioned command." - :package-version '(magit . "2.1.0") +(defcustom magit-log-margin '(t age magit-log-margin-width t 18) + "Format of the margin in `magit-log-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") :group 'magit-log - :type 'boolean) - -(defcustom magit-duration-spec - `((?Y "year" "years" ,(round (* 60 60 24 365.2425))) - (?M "month" "months" ,(round (* 60 60 24 30.436875))) - (?w "week" "weeks" ,(* 60 60 24 7)) - (?d "day" "days" ,(* 60 60 24)) - (?h "hour" "hours" ,(* 60 60)) - (?m "minute" "minutes" 60) - (?s "second" "seconds" 1)) - "Units used to display durations in a human format. -The value is a list of time units, beginning with the longest. -Each element has the form (CHAR UNIT UNITS SECONDS). UNIT is the -time unit, UNITS is the plural of that unit. CHAR is a character -abbreviation. And SECONDS is the number of seconds in one UNIT. -Also see option `magit-log-margin-spec'." - :package-version '(magit . "2.1.0") - :group 'magit-log - :type '(repeat (list (character :tag "Unit character") - (string :tag "Unit singular string") - (string :tag "Unit plural string") - (integer :tag "Seconds in unit")))) - -(defcustom magit-log-margin-spec '(28 7 magit-duration-spec) - "How to format the log margin. - -The log margin is used to display each commit's author followed -by the commit's age. This option controls the total width of the -margin and how time units are formatted, the value has the form: - - (WIDTH UNIT-WIDTH DURATION-SPEC) - -WIDTH specifies the total width of the log margin. UNIT-WIDTH is -either the integer 1, in which case time units are displayed as a -single characters, leaving more room for author names; or it has -to be the width of the longest time unit string in DURATION-SPEC. -DURATION-SPEC has to be a variable, its value controls which time -units, in what language, are being used." - :package-version '(magit . "2.1.0") - :group 'magit-log - :set-after '(magit-duration-spec) - :type '(list (integer :tag "Margin width") - (choice :tag "Time unit style" - (const :format "%t\n" - :tag "abbreviate to single character" 1) - (integer :format "%t\n" - :tag "show full name" 7)) - (variable :tag "Duration spec variable"))) + :group 'magit-margin + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set (apply-partially #'magit-margin-set-variable 'magit-log-mode)) (defcustom magit-log-show-refname-after-summary nil "Whether to show refnames after commit summaries. @@ -152,6 +121,12 @@ This is useful if you use really long branch names." :group 'magit-log :type 'boolean) +(defcustom magit-log-highlight-keywords t + "Whether to highlight bracketed keywords in commit summaries." + :package-version '(magit . "2.11.1") + :group 'magit-log + :type 'boolean) + (defface magit-log-graph '((((class color) (background light)) :foreground "grey30") (((class color) (background dark)) :foreground "grey80")) @@ -199,6 +174,34 @@ be nil, in which case no usage information is shown." (const :tag "in both places" both) (const :tag "nowhere"))) +(defcustom magit-log-select-margin + (list (nth 0 magit-log-margin) + (nth 1 magit-log-margin) + 'magit-log-margin-width t + (nth 4 magit-log-margin)) + "Format of the margin in `magit-log-select-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") + :group 'magit-log + :group 'magit-margin + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set-after '(magit-log-margin) + :set (apply-partially #'magit-margin-set-variable 'magit-log-select-mode)) + ;;;; Cherry Mode (defcustom magit-cherry-sections-hook @@ -209,24 +212,69 @@ be nil, in which case no usage information is shown." :group 'magit-log :type 'hook) +(defcustom magit-cherry-margin + (list (nth 0 magit-log-margin) + (nth 1 magit-log-margin) + 'magit-log-margin-width t + (nth 4 magit-log-margin)) + "Format of the margin in `magit-cherry-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") + :group 'magit-log + :group 'magit-margin + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set-after '(magit-log-margin) + :set (apply-partially #'magit-margin-set-variable 'magit-cherry-mode)) + ;;;; Reflog Mode (defcustom magit-reflog-arguments '("-n256") "The log arguments used in `magit-reflog-mode' buffers." :package-version '(magit . "2.3.0") - :group 'magit-log - :group 'magit-commands + :group 'magit-git-arguments :type '(repeat (string :tag "Argument"))) -(defcustom magit-reflog-show-margin t - "Whether to initially show the margin in reflog buffers. - -When non-nil the author name and date are initially displayed in -the margin of reflog buffers. The margin can be shown or hidden -in the current buffer using the command `magit-toggle-margin'." - :package-version '(magit . "2.1.0") +(defcustom magit-reflog-margin + (list (nth 0 magit-log-margin) + (nth 1 magit-log-margin) + 'magit-log-margin-width nil + (nth 4 magit-log-margin)) + "Format of the margin in `magit-reflog-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") :group 'magit-log - :type 'boolean) + :group 'magit-margin + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set-after '(magit-log-margin) + :set (apply-partially #'magit-margin-set-variable 'magit-reflog-mode)) (defface magit-reflog-commit '((t :foreground "green")) "Face for commit commands in reflogs." @@ -278,11 +326,13 @@ the upstream isn't ahead of the current branch) show." (defcustom magit-log-section-arguments '("-n256" "--decorate") "The log arguments used in buffers that show other things besides logs." :package-version '(magit . "2.4.0") + :group 'magit-git-arguments :group 'magit-log :group 'magit-status :type '(repeat (string :tag "Argument"))) ;;; Commands +;;;; Popups (defvar magit-log-popup '(:variable magit-log-arguments @@ -336,7 +386,7 @@ the upstream isn't ahead of the current branch) show." (?S "Search occurrences" "-S") (?L "Trace line evolution" "-L" magit-read-file-trace)) :actions ((?g "Refresh" magit-log-refresh) - (?t "Toggle margin" magit-toggle-margin) + (?L "Toggle margin" magit-toggle-margin) (?s "Set defaults" magit-log-set-default-arguments) nil (?w "Save defaults" magit-log-save-default-arguments)) :max-action-columns 2)) @@ -354,11 +404,15 @@ the upstream isn't ahead of the current branch) show." (?d "Show refnames" "--decorate")) :options ((?n "Limit number of commits" "-n") (?o "Order commits by" "++order=" magit-log-select-order)) - :actions ((?g "Refresh" magit-log-refresh) - (?t "Toggle margin" magit-toggle-margin) - (?s "Set defaults" magit-log-set-default-arguments) nil - (?w "Save defaults" magit-log-save-default-arguments)) - :max-action-columns 2)) + :actions ("Refresh" + (?g "buffer" magit-log-refresh) + (?s "buffer and set defaults" magit-log-set-default-arguments) + (?w "buffer and save defaults" magit-log-save-default-arguments) + "Margin" + (?L "toggle visibility" magit-toggle-margin) + (?l "cycle style" magit-cycle-margin-style) + (?d "toggle details" magit-toggle-margin-details)) + :max-action-columns 1)) (magit-define-popup-keys-deferred 'magit-log-popup) (magit-define-popup-keys-deferred 'magit-log-mode-refresh-popup) @@ -378,21 +432,27 @@ the upstream isn't ahead of the current branch) show." (?a "[a]uthor date" "author-date") (?c "[c]ommitter date" "date"))) +(defun magit-log-get-buffer-args () + (cond ((and magit-use-sticky-arguments + (derived-mode-p 'magit-log-mode)) + (list (nth 1 magit-refresh-args) + (nth 2 magit-refresh-args))) + ((and (eq magit-use-sticky-arguments t) + (--when-let (magit-mode-get-buffer 'magit-log-mode) + (with-current-buffer it + (list (nth 1 magit-refresh-args) + (nth 2 magit-refresh-args)))))) + (t + (list (default-value 'magit-log-arguments) nil)))) + (defun magit-log-arguments (&optional refresh) (cond ((memq magit-current-popup '(magit-log-popup magit-log-refresh-popup)) (magit-popup-export-file-args magit-current-popup-args)) - ((derived-mode-p 'magit-log-mode) - (list (nth 1 magit-refresh-args) - (nth 2 magit-refresh-args))) - (refresh + ((and refresh (not (derived-mode-p 'magit-log-mode))) (list magit-log-section-arguments nil)) (t - (-if-let (buffer (magit-mode-get-buffer 'magit-log-mode)) - (with-current-buffer buffer - (list (nth 1 magit-refresh-args) - (nth 2 magit-refresh-args))) - (list (default-value 'magit-log-arguments) nil))))) + (magit-log-get-buffer-args)))) (defun magit-log-popup (arg) "Popup console for log commands." @@ -402,11 +462,7 @@ the upstream isn't ahead of the current branch) show." (`magit-log-mode magit-log-mode-refresh-popup) (_ magit-log-refresh-popup))) (magit-log-arguments - (-if-let (buffer (magit-mode-get-buffer 'magit-log-mode)) - (with-current-buffer buffer - (magit-popup-import-file-args (nth 1 magit-refresh-args) - (nth 2 magit-refresh-args))) - (default-value 'magit-log-arguments)))) + (apply #'magit-popup-import-file-args (magit-log-get-buffer-args)))) (magit-invoke-popup 'magit-log-popup nil arg))) ;;;###autoload @@ -452,6 +508,8 @@ buffer." magit-log-section-arguments)))) (magit-invoke-popup 'magit-log-refresh-popup nil arg))) +;;;; Refresh Commands + (defun magit-log-refresh (args files) "Set the local log arguments for the current buffer." (interactive (magit-log-arguments t)) @@ -500,6 +558,8 @@ buffer." ((derived-mode-p 'magit-cherry-mode) (user-error "Cannot change log arguments in cherry buffers")))) +;;;; Log Commands + (defvar magit-log-read-revs-map (let ((map (make-sparse-keymap))) (set-keymap-parent map crm-local-completion-map) @@ -508,27 +568,18 @@ buffer." (defun magit-log-read-revs (&optional use-current) (or (and use-current (--when-let (magit-get-current-branch) (list it))) - (let* ((choose-completion-string-functions - '(crm--choose-completion-string)) - (minibuffer-completion-table #'crm--collection-fn) - (minibuffer-completion-confirm t) - (crm-completion-table - `(,@(and (file-exists-p (magit-git-dir "FETCH_HEAD")) - (list "FETCH_HEAD")) - ,@(magit-list-branch-names))) - (crm-separator "\\(\\.\\.\\.?\\|[, ]\\)") - (default (or (magit-branch-or-commit-at-point) - (unless use-current - (magit-get-previous-branch)))) - (input (read-from-minibuffer - (format "Log rev,s%s: " - (if default (format " (%s)" default) "")) - nil magit-log-read-revs-map - nil 'magit-revision-history default))) - (when (string-equal input "") - (or (setq input default) - (user-error "Nothing selected"))) - (split-string input "[, ]" t)))) + (let ((collection `(,@(and (file-exists-p (magit-git-dir "FETCH_HEAD")) + (list "FETCH_HEAD")) + ,@(magit-list-refnames)))) + (split-string + (magit-completing-read-multiple "Log rev,s" collection + "\\(\\.\\.\\.?\\|[, ]\\)" + (or (magit-branch-or-commit-at-point) + (unless use-current + (magit-get-previous-branch))) + 'magit-revision-history + magit-log-read-revs-map) + "[, ]" t)))) ;;;###autoload (defun magit-log-current (revs &optional args files) @@ -589,12 +640,21 @@ completion candidates." (defun magit-log-buffer-file (&optional follow beg end) "Show log for the blob or file visited in the current buffer. With a prefix argument or when `--follow' is part of -`magit-log-arguments', then follow renames." - (interactive (if (region-active-p) - (list current-prefix-arg - (1- (line-number-at-pos (region-beginning))) - (1- (line-number-at-pos (region-end)))) - (list current-prefix-arg))) +`magit-log-arguments', then follow renames. When the region is +active, restrict the log to the lines that the region touches." + (interactive + (cons current-prefix-arg + (and (region-active-p) + (save-restriction + (widen) + (list (line-number-at-pos (region-beginning)) + (line-number-at-pos + (let ((end (region-end))) + (if (char-after end) + end + ;; Ensure that we don't get the line number + ;; of a trailing newline. + (1- end))))))))) (require 'magit) (-if-let (file (magit-file-relative-name)) (magit-mode-setup-internal @@ -635,6 +695,8 @@ With a prefix argument or when `--follow' is part of (interactive) (magit-reflog "HEAD")) +;;;; Limit Commands + (defun magit-log-toggle-commit-limit () "Toggle the number of commits the current log buffer is limited to. If the number of commits is currently limited, then remove that @@ -669,6 +731,8 @@ limit. Otherwise set it to 256." (car (magit-log-arguments t))) (string-to-number (match-string 1 it)))) +;;;; Other Commands + (defun magit-log-bury-buffer (&optional arg) "Bury the current buffer or the revision buffer in the same frame. Like `magit-mode-bury-buffer' (which see) but with a negative @@ -731,11 +795,17 @@ to visit the commit at point. Type \\[magit-branch-popup] to see available branch commands. Type \\[magit-merge-popup] to merge the branch or commit at point. Type \\[magit-cherry-pick-popup] to apply the commit at point. -Type \\[magit-reset] to reset HEAD to the commit at point. +Type \\[magit-reset] to reset `HEAD' to the commit at point. \\{magit-log-mode-map}" :group 'magit-log - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq imenu-prev-index-position-function + 'magit-imenu--log-prev-index-position-function) + (setq imenu-extract-index-name-function + 'magit-imenu--log-extract-index-name-function) + (setq-local bookmark-make-record-function + 'magit-bookmark--log-make-record)) (defvar magit-log-disable-graph-hack-args '("-G" "--grep" "--author") @@ -746,7 +816,10 @@ Type \\[magit-reset] to reset HEAD to the commit at point. (propertize (concat " Commits in " (mapconcat 'identity revs " ") (and files (concat " touching " - (mapconcat 'identity files " ")))) + (mapconcat 'identity files " "))) + (--some (and (string-prefix-p "-L" it) + (concat " " it)) + args)) 'face 'magit-header-line)) (unless (= (length files) 1) (setq args (remove "--follow" args))) @@ -782,7 +855,7 @@ Do not add this to a hook variable." (remove "--literal-pathspecs" magit-git-global-arguments))) (magit-git-wash (apply-partially #'magit-log-wash-log 'log) "log" - (format "--format=%%h%s %s[%%aN][%%at]%%s%s" + (format "--format=%%h%s%%x00%s%%x00%%aN%%x00%%at%%x00%%s%s" (if (member "--decorate" args) "%d" "") (if (member "--show-signature" args) (progn (setq args (remove "--show-signature" args)) "%G?") @@ -817,11 +890,11 @@ Do not add this to a hook variable." (defconst magit-log-heading-re (concat "^" "\\(?4:[-_/|\\*o. ]*\\)" ; graph - "\\(?1:[0-9a-fA-F]+\\) " ; sha1 - "\\(?:\\(?3:([^()]+)\\) \\)?" ; refs - "\\(?7:[BGUXYREN]\\)?" ; gpg - "\\[\\(?5:[^]]*\\)\\]" ; author - "\\[\\(?6:[^]]*\\)\\]" ; date + "\\(?1:[0-9a-fA-F]+\\)" ; sha1 + "\\(?3:[^\0\n]+)\\)?\0" ; refs + "\\(?7:[BGUXYREN]\\)?\0" ; gpg + "\\(?5:[^\0\n]*\\)\0" ; author + "\\(?6:[^\0\n]+\\)\0" ; date "\\(?2:.*\\)$")) ; msg (defconst magit-log-cherry-re @@ -839,22 +912,23 @@ Do not add this to a hook variable." (defconst magit-log-bisect-vis-re (concat "^" "\\(?4:[-_/|\\*o. ]*\\)" ; graph - "\\(?1:[0-9a-fA-F]+\\) " ; sha1 - "\\(?:\\(?3:([^()]+)\\) \\)?" ; refs + "\\(?1:[0-9a-fA-F]+\\)" ; sha1 + "\\(?3:[^\0\n]+)\\)?\0" ; refs "\\(?2:.*\\)$")) ; msg (defconst magit-log-bisect-log-re (concat "^# " "\\(?3:bad:\\|skip:\\|good:\\) " ; "refs" - "\\[\\(?1:[^]]+\\)\\] " ; sha1 + "\\[\\(?1:[^]\n]+\\)\\] " ; sha1 "\\(?2:.*\\)$")) ; msg (defconst magit-log-reflog-re (concat "^" - "\\(?1:[^ ]+\\) " ; sha1 - "\\(?:\\(?:[^@]+@{\\(?6:[^}]+\\)} " ; date - "\\(?10:merge \\|autosave \\|restart \\|[^:]+: \\)?" ; refsub - "\\(?2:.*\\)?\\)\\| \\)$")) ; msg + "\\(?1:[^\0\n]+\\)\0" ; sha1 + "\\(?5:[^\0\n]*\\)\0" ; author + "\\(?:\\(?:[^@\n]+@{\\(?6:[^}\n]+\\)}\0" ; date + "\\(?10:merge \\|autosave \\|restart \\|[^:\n]+: \\)?" ; refsub + "\\(?2:.*\\)?\\)\\|\0\\)$")) ; msg (defconst magit-reflog-subject-re (concat "\\(?1:[^ ]+\\) ?" ; command @@ -863,9 +937,9 @@ Do not add this to a hook variable." (defconst magit-log-stash-re (concat "^" - "\\(?1:[^ ]+\\)" ; "sha1" - "\\(?5: \\)" ; "author" - "\\(?6:[^ ]+\\) " ; date + "\\(?1:[^\0\n]+\\)\0" ; "sha1" + "\\(?5:[^\0\n]*\\)\0" ; author + "\\(?6:[^\0\n]+\\)\0" ; date "\\(?2:.*\\)$")) ; msg (defvar magit-log-count nil) @@ -896,10 +970,9 @@ Do not add this to a hook variable." (magit-log-double-commit-limit)) 'follow-link t 'mouse-face 'magit-section-highlight))) - (unless (equal (car args) "cherry") - (insert ?\n))))) + (insert ?\n)))) -(defun magit-log-wash-rev (style abbrev) +(cl-defun magit-log-wash-rev (style abbrev) (when (derived-mode-p 'magit-log-mode) (cl-incf magit-log-count)) (looking-at (pcase style @@ -917,12 +990,14 @@ Do not add this to a hook variable." magit-log-bisect-vis-re magit-log-heading-re))) (magit-delete-line) + ;; If the reflog entries have been pruned, the output of `git + ;; reflog show' includes a partial line that refers to the hash + ;; of the youngest expired reflog entry. + (when (and (eq style 'reflog) (not date)) + (cl-return-from magit-log-wash-rev t)) (magit-insert-section section (commit hash) (pcase style - (`stash (setf (magit-section-type section) 'stash) - ;; Replace blank space with nil for - ;; `magit-format-log-margin'. - (setq author nil)) + (`stash (setf (magit-section-type section) 'stash)) (`module (setf (magit-section-type section) 'module-commit)) (`bisect-log (setq hash (magit-rev-parse "--short" hash)))) (when cherry @@ -946,20 +1021,30 @@ Do not add this to a hook variable." (insert (propertize hash 'face 'magit-hash) ?\s)) (when (and refs (not magit-log-show-refname-after-summary)) (insert (magit-format-ref-labels refs) ?\s)) - (when refsub + (when (eq style 'reflog) (insert (format "%-2s " (1- magit-log-count))) - (insert (magit-reflog-format-subject - (substring refsub 0 (if (string-match-p ":" refsub) -2 -1))))) + (when refsub + (insert (magit-reflog-format-subject + (substring refsub 0 (if (string-match-p ":" refsub) -2 -1)))))) (when msg - (insert (propertize msg 'face - (pcase (and gpg (aref gpg 0)) - (?G 'magit-signature-good) - (?B 'magit-signature-bad) - (?U 'magit-signature-untrusted) - (?X 'magit-signature-expired) - (?Y 'magit-signature-expired-key) - (?R 'magit-signature-revoked) - (?E 'magit-signature-error))))) + (when gpg + (setq msg (propertize msg 'face + (pcase (aref gpg 0) + (?G 'magit-signature-good) + (?B 'magit-signature-bad) + (?U 'magit-signature-untrusted) + (?X 'magit-signature-expired) + (?Y 'magit-signature-expired-key) + (?R 'magit-signature-revoked) + (?E 'magit-signature-error))))) + (let ((start 0)) + (while (string-match "\\[[^[]*\\]" msg start) + (setq start (match-end 0)) + (when magit-log-highlight-keywords + (put-text-property (match-beginning 0) + (match-end 0) + 'face 'magit-keyword msg)))) + (insert msg)) (when (and refs magit-log-show-refname-after-summary) (insert ?\s) (insert (magit-format-ref-labels refs))) @@ -973,7 +1058,13 @@ Do not add this to a hook variable." (* (string-to-number (match-string 3 date)) 60)))) (save-excursion (backward-char) - (magit-format-log-margin author date))) + (magit-log-format-margin author date))) + (when (and (eq style 'cherry) + (magit-buffer-margin-p)) + (save-excursion + (backward-char) + (apply #'magit-log-format-margin + (split-string (magit-rev-format "%aN%x00%ct" hash) "\0")))) (when (and graph (not (eobp)) (not (looking-at non-graph-re))) @@ -1004,7 +1095,7 @@ Do not add this to a hook variable." (while (and (not (eobp)) (not (looking-at non-graph-re))) (when align (save-excursion (insert align))) - (magit-format-log-margin) + (magit-make-margin-overlay) (forward-line)) ;; When `--format' is used and its value isn't one of the ;; predefined formats, then `git-log' does not insert a @@ -1017,49 +1108,16 @@ Do not add this to a hook variable." (insert graph ?\n)))))))) t) -(defun magit-format-log-margin (&optional author date) - (-let [(width unit-width duration-spec) magit-log-margin-spec] - (when (and date (not author)) - (setq width (+ (if (= unit-width 1) 1 (1+ unit-width)) - (if (derived-mode-p 'magit-log-mode) 1 0)))) - (if date - (magit-make-margin-overlay - (and author - (concat (propertize (truncate-string-to-width - (or author "") - (- width 1 3 ; gap, digits - (if (= unit-width 1) 1 (1+ unit-width)) - (if (derived-mode-p 'magit-log-mode) 1 0)) - nil ?\s (make-string 1 magit-ellipsis)) - 'face 'magit-log-author) - " ")) - (propertize (magit-format-duration - (abs (- (float-time) - (string-to-number date))) - (symbol-value duration-spec) - unit-width) - 'face 'magit-log-date) - (and (derived-mode-p 'magit-log-mode) - (propertize " " 'face 'fringe))) - (magit-make-margin-overlay - (propertize (make-string (1- width) ?\s) 'face 'default) - (propertize " " 'face 'fringe))))) - -(defun magit-format-duration (duration spec &optional width) - (-let [(char unit units weight) (car spec)] - (let ((cnt (round (/ duration weight 1.0)))) - (if (or (not (cdr spec)) - (>= (/ duration weight) 1)) - (if (eq width 1) - (format "%3i%c" cnt char) - (format (if width (format "%%3i %%-%is" width) "%i %s") - cnt (if (= cnt 1) unit units))) - (magit-format-duration duration (cdr spec) width))))) - (defun magit-log-maybe-show-more-commits (section) - "Automatically insert more commit sections in a log. -Only do so if `point' is on the \"show more\" section, -and `magit-log-auto-more' is non-nil." + "When point is at the end of a log buffer, insert more commits. + +Log buffers end with a button \"Type + to show more history\". +When the use of a section movement command puts point on that +button, then automatically show more commits, without the user +having to press \"+\". + +This function is called by `magit-section-movement-hook' and +exists mostly for backward compatibility reasons." (when (and (eq (magit-section-type section) 'longer) magit-log-auto-more) (magit-log-double-commit-limit) @@ -1081,13 +1139,14 @@ If there is no revision buffer in the same frame, then do nothing." (setq magit--update-revision-buffer (list commit buffer)) (run-with-idle-timer magit-update-other-window-delay nil - (lambda () - (-let [(rev buf) magit--update-revision-buffer] - (setq magit--update-revision-buffer nil) - (when (buffer-live-p buf) - (let ((magit-display-buffer-noselect t)) - (apply #'magit-show-commit rev (magit-diff-arguments))))) - (setq magit--update-revision-buffer nil)))))) + (let ((args (magit-show-commit--arguments))) + (lambda () + (-let [(rev buf) magit--update-revision-buffer] + (setq magit--update-revision-buffer nil) + (when (buffer-live-p buf) + (let ((magit-display-buffer-noselect t)) + (apply #'magit-show-commit rev args)))) + (setq magit--update-revision-buffer nil))))))) (defvar magit--update-blob-buffer nil) @@ -1128,6 +1187,46 @@ If there is no blob buffer in the same frame, then do nothing." (magit-section-children magit-root-section)))) (goto-char (magit-section-start same)))) +;;; Log Margin + +(defun magit-log-format-margin (author date) + (-when-let (option (magit-margin-option)) + (-let [(_ style width details details-width) + (or magit-buffer-margin + (symbol-value option))] + (magit-make-margin-overlay + (concat (and details + (concat (propertize (truncate-string-to-width + (or author "") + details-width + nil ?\s (make-string 1 magit-ellipsis)) + 'face 'magit-log-author) + " ")) + (propertize + (if (stringp style) + (format-time-string + style + (seconds-to-time (string-to-number date))) + (-let* ((abbr (eq style 'age-abbreviated)) + ((cnt unit) (magit--age date abbr))) + (format (format (if abbr "%%2i%%-%ic" "%%2i %%-%is") + (- width (if details (1+ details-width) 0))) + cnt unit))) + 'face 'magit-log-date)))))) + +(defun magit-log-margin-width (style details details-width) + (+ (if details (1+ details-width) 0) + (if (stringp style) + (length (format-time-string style)) + (+ 2 ; two digits + 1 ; trailing space + (if (eq style 'age-abbreviated) + 1 ; single character + (+ 1 ; gap after digits + (apply #'max (--map (max (length (nth 1 it)) + (length (nth 2 it))) + magit--age-spec)))))))) + ;;; Select Mode (defvar magit-log-select-mode-map @@ -1149,7 +1248,7 @@ If there is no blob buffer in the same frame, then do nothing." (define-derived-mode magit-log-select-mode magit-log-mode "Magit Select" "Mode for selecting a commit from history. -This mode is documented in info node `(magit)Select from log'. +This mode is documented in info node `(magit)Select from Log'. \\\ Type \\[magit-refresh] to refresh the current buffer. @@ -1215,7 +1314,7 @@ commit as argument." (let ((map (make-sparse-keymap))) (set-keymap-parent map magit-mode-map) (define-key map "q" 'magit-log-bury-buffer) - (define-key map "L" 'magit-toggle-margin) + (define-key map "L" 'magit-margin-popup) map) "Keymap for `magit-cherry-mode'.") @@ -1231,7 +1330,11 @@ Type \\[magit-cherry-pick-popup] to apply the commit at point. \\{magit-cherry-mode-map}" :group 'magit-log - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq imenu-create-index-function + 'magit-imenu--cherry-create-index-function) + (setq-local bookmark-make-record-function + 'magit-bookmark--cherry-make-record)) ;;;###autoload (defun magit-cherry (head upstream) @@ -1267,7 +1370,7 @@ Type \\[magit-cherry-pick-popup] to apply the commit at point. (defvar magit-reflog-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map magit-log-mode-map) - (define-key map "L" 'magit-toggle-margin) + (define-key map "L" 'magit-margin-popup) map) "Keymap for `magit-reflog-mode'.") @@ -1282,18 +1385,21 @@ Type \\[magit-visit-thing] or \\[magit-diff-show-or-scroll-up] \ to visit the commit at point. Type \\[magit-cherry-pick-popup] to apply the commit at point. -Type \\[magit-reset] to reset HEAD to the commit at point. +Type \\[magit-reset] to reset `HEAD' to the commit at point. \\{magit-reflog-mode-map}" :group 'magit-log - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq-local bookmark-make-record-function + 'magit-bookmark--reflog-make-record)) (defun magit-reflog-refresh-buffer (ref args) (setq header-line-format (propertize (concat " Reflog for " ref) 'face 'magit-header-line)) (magit-insert-section (reflogbuf) (magit-git-wash (apply-partially 'magit-log-wash-log 'reflog) - "reflog" "show" "--format=%h %gd %gs" "--date=raw" args ref))) + "reflog" "show" "--format=%h%x00%aN%x00%gd%x00%gs" "--date=raw" + args ref "--"))) (defvar magit-reflog-labels '(("commit" . magit-reflog-commit) @@ -1410,7 +1516,7 @@ Show the last `magit-log-section-commit-count' commits." (range (and (magit-rev-verify start) (concat start "..HEAD")))) (magit-insert-section (recent range collapse) - (magit-insert-heading "Recent commits:") + (magit-insert-heading "Recent commits") (magit-insert-log range (cons (format "-%d" magit-log-section-commit-count) magit-log-section-arguments))))) @@ -1432,7 +1538,7 @@ then show the last `magit-log-section-commit-count' commits." (defun magit-insert-unpulled-cherries () "Insert section showing unpulled commits. -Like `magit-insert-unpulled-to-upstream' but prefix each commit +Like `magit-insert-unpulled-from-upstream' but prefix each commit which has not been applied yet (i.e. a commit with a patch-id not shared with any local commit) with \"+\", and all others with \"-\"." @@ -1455,74 +1561,5 @@ all others with \"-\"." (magit-git-wash (apply-partially 'magit-log-wash-log 'cherry) "cherry" "-v" (magit-abbrev-arg) "@{upstream}")))) -;;; Buffer Margins - -(defvar-local magit-set-buffer-margin-refresh nil) - -(defvar-local magit-show-margin nil) -(put 'magit-show-margin 'permanent-local t) - -(defun magit-toggle-margin () - "Show or hide the Magit margin." - (interactive) - (unless (derived-mode-p 'magit-log-mode 'magit-status-mode 'magit-refs-mode) - (user-error "Buffer doesn't contain any logs")) - (magit-set-buffer-margin (not (cdr (window-margins))))) - -(defun magit-maybe-show-margin () - "Maybe show the margin, depending on the major-mode and an option. -Supported modes are `magit-log-mode' and `magit-reflog-mode', -and the respective options are `magit-log-show-margin' and -`magit-reflog-show-margin'." - (if (local-variable-p 'magit-show-margin) - (magit-set-buffer-margin magit-show-margin) - (pcase major-mode - (`magit-log-mode (magit-set-buffer-margin magit-log-show-margin)) - (`magit-reflog-mode (magit-set-buffer-margin magit-reflog-show-margin))))) - -(defun magit-set-buffer-margin (enable) - (let ((width (cond ((not enable) nil) - ((derived-mode-p 'magit-reflog-mode) - (+ (cadr magit-log-margin-spec) 5)) - (t (car magit-log-margin-spec))))) - (setq magit-show-margin width) - (when (and enable magit-set-buffer-margin-refresh) - (magit-refresh)) - (-when-let (window (get-buffer-window)) - (with-selected-window window - (set-window-margins nil (car (window-margins)) width) - (if enable - (add-hook 'window-configuration-change-hook - 'magit-set-buffer-margin-1 nil t) - (remove-hook 'window-configuration-change-hook - 'magit-set-buffer-margin-1 t)))))) - -(defun magit-set-buffer-margin-1 () - (-when-let (window (get-buffer-window)) - (with-selected-window window - (set-window-margins nil (car (window-margins)) magit-show-margin)))) - -(defun magit-make-margin-overlay (&rest strings) - ;; Don't put the overlay on the complete line to work around #1880. - (let ((o (make-overlay (1+ (line-beginning-position)) - (line-end-position) - nil t))) - (overlay-put o 'evaporate t) - (overlay-put o 'before-string - (propertize "o" 'display - (list '(margin right-margin) - (apply #'concat strings)))))) - -;;; magit-log.el ends soon - -(define-obsolete-variable-alias 'magit-log-section-args - 'magit-log-section-arguments "Magit 2.2.0") -(define-obsolete-function-alias 'magit-insert-unpulled-or-recent-commits - 'magit-insert-unpulled-from-upstream-or-recent "Magit 2.4.0") - (provide 'magit-log) -;; Local Variables: -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: ;;; magit-log.el ends here diff --git a/elpa/magit-20171009.1252/magit-margin.el b/elpa/magit-20171009.1252/magit-margin.el new file mode 100644 index 00000000..5f2bef67 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-margin.el @@ -0,0 +1,229 @@ +;;; magit-margin.el --- margins in Magit buffers -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for showing additional information +;; in the margins of Magit buffers. Currently this is only used for +;; commits, for which the committer date or age, and optionally the +;; author name are shown. + +;;; Code: + +(require 'dash) + +(require 'magit-section) +(require 'magit-mode) + +(defgroup magit-margin nil + "Information Magit displays in the margin. + +You can change the STYLE and AUTHOR-WIDTH of all `magit-*-margin' +options to the same values by customizing `magit-log-margin' +*before* `magit' is loaded. If you do that, then the respective +values for the other options will default to what you have set +for that variable. Likewise if you set `magit-log-margin's INIT +to nil, then that is used in the default of all other options. But +setting it to t, i.e. re-enforcing the default for that option, +does not carry to other options." + :link '(info-link "(magit)Log Margin") + :group 'magit-log) + +(defvar-local magit-buffer-margin nil) +(put 'magit-buffer-margin 'permanent-local t) + +(defvar-local magit-set-buffer-margin-refresh nil) + +(defvar magit--age-spec) + +;;; Commands + +(magit-define-popup magit-margin-popup + "Popup console for changing appearance of the margin." + :actions '("Margin" + (?L "toggle visibility" magit-toggle-margin) + (?l "cycle style" magit-cycle-margin-style) + (?d "toggle details" magit-toggle-margin-details)) + :max-action-columns 1) + +(defun magit-toggle-margin () + "Show or hide the Magit margin." + (interactive) + (unless (magit-margin-option) + (user-error "Magit margin isn't supported in this buffer")) + (setcar magit-buffer-margin (not (magit-buffer-margin-p))) + (magit-set-buffer-margin)) + +(defun magit-cycle-margin-style () + "Cycle style used for the Magit margin." + (interactive) + (unless (magit-margin-option) + (user-error "Magit margin isn't supported in this buffer")) + ;; This is only suitable for commit margins (there are not others). + (setf (cadr magit-buffer-margin) + (pcase (cadr magit-buffer-margin) + (`age 'age-abbreviated) + (`age-abbreviated + (let ((default (cadr (symbol-value (magit-margin-option))))) + (if (stringp default) default "%Y-%m-%d %H:%M "))) + (_ 'age))) + (magit-set-buffer-margin nil t)) + +(defun magit-toggle-margin-details () + "Show or hide details in the Magit margin." + (interactive) + (unless (magit-margin-option) + (user-error "Magit margin isn't supported in this buffer")) + (setf (nth 3 magit-buffer-margin) + (not (nth 3 magit-buffer-margin))) + (magit-set-buffer-margin nil t)) + +;;; Core + +(defun magit-buffer-margin-p () + (car magit-buffer-margin)) + +(defun magit-margin-option () + (pcase major-mode + (`magit-cherry-mode 'magit-cherry-margin) + (`magit-log-mode 'magit-log-margin) + (`magit-log-select-mode 'magit-log-select-margin) + (`magit-reflog-mode 'magit-reflog-margin) + (`magit-refs-mode 'magit-refs-margin) + (`magit-stashes-mode 'magit-stashes-margin) + (`magit-status-mode 'magit-status-margin))) + +(defun magit-set-buffer-margin (&optional reset refresh) + (-when-let (option (magit-margin-option)) + (let* ((default (symbol-value option)) + (default-width (nth 2 default))) + (when (or reset (not magit-buffer-margin)) + (setq magit-buffer-margin (copy-sequence default))) + (-let [(enable style _width details details-width) + magit-buffer-margin] + (when (functionp default-width) + (setf (nth 2 magit-buffer-margin) + (funcall default-width style details details-width))) + (dolist (window (get-buffer-window-list nil nil 0)) + (with-selected-window window + (magit-set-window-margin window) + (if enable + (add-hook 'window-configuration-change-hook + 'magit-set-window-margin nil t) + (remove-hook 'window-configuration-change-hook + 'magit-set-window-margin t)))) + (when (and enable (or refresh magit-set-buffer-margin-refresh)) + (magit-refresh-buffer)))))) + +(defun magit-set-window-margin (&optional window) + (when (or window (setq window (get-buffer-window))) + (with-selected-window window + (set-window-margins nil (car (window-margins)) + (and (magit-buffer-margin-p) + (nth 2 magit-buffer-margin)))))) + +(defun magit-make-margin-overlay (&optional string previous-line) + (if previous-line + (save-excursion + (forward-line -1) + (magit-make-margin-overlay string)) + ;; Don't put the overlay on the complete line to work around #1880. + (let ((o (make-overlay (1+ (line-beginning-position)) + (line-end-position) + nil t))) + (overlay-put o 'evaporate t) + (overlay-put o 'before-string + (propertize "o" 'display + (list (list 'margin 'right-margin) + (or string " "))))))) + +(defun magit-maybe-make-margin-overlay () + (when (or (magit-section-match + '(unpulled unpushed recent stashes local cherries) + magit-insert-section--current) + (and (eq major-mode 'magit-refs-mode) + (magit-section-match + '(remote commit tags) + magit-insert-section--current))) + (magit-make-margin-overlay nil t))) + +;;; Custom Support + +(defun magit-margin-set-variable (mode symbol value) + (set-default symbol value) + (message "Updating margins in %s buffers..." mode) + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (when (eq major-mode mode) + (magit-set-buffer-margin t) + (magit-refresh)))) + (message "Updating margins in %s buffers...done" mode)) + +(defconst magit-log-margin--custom-type + '(list (boolean :tag "Show margin initially") + (choice :tag "Show committer" + (string :tag "date using time-format" "%Y-%m-%d %H:%M ") + (const :tag "date's age" age) + (const :tag "date's age (abbreviated)" age-abbreviated)) + (const :tag "Calculate width using magit-log-margin-width" + magit-log-margin-width) + (boolean :tag "Show author name by default") + (integer :tag "Show author name using width"))) + +;;; Time Utilities + +(defvar magit--age-spec + `((?Y "year" "years" ,(round (* 60 60 24 365.2425))) + (?M "month" "months" ,(round (* 60 60 24 30.436875))) + (?w "week" "weeks" ,(* 60 60 24 7)) + (?d "day" "days" ,(* 60 60 24)) + (?h "hour" "hours" ,(* 60 60)) + (?m "minute" "minutes" 60) + (?s "second" "seconds" 1)) + "Time units used when formatting relative commit ages. + +The value is a list of time units, beginning with the longest. +Each element has the form (CHAR UNIT UNITS SECONDS). UNIT is the +time unit, UNITS is the plural of that unit. CHAR is a character +abbreviation. And SECONDS is the number of seconds in one UNIT. + +This is defined as a variable to make it possible to use time +units for a language other than English. It is not defined +as an option, because most other parts of Magit are always in +English.") + +(defun magit--age (date &optional abbreviate) + (cl-labels ((fn (age spec) + (-let [(char unit units weight) (car spec)] + (let ((cnt (round (/ age weight 1.0)))) + (if (or (not (cdr spec)) + (>= (/ age weight) 1)) + (list cnt (cond (abbreviate char) + ((= cnt 1) unit) + (t units))) + (fn age (cdr spec))))))) + (fn (abs (- (float-time) (string-to-number date))) + magit--age-spec))) + +(provide 'magit-margin) +;;; magit-margin.el ends here diff --git a/elpa/magit-20161115.1658/magit-mode.el b/elpa/magit-20171009.1252/magit-mode.el similarity index 81% rename from elpa/magit-20161115.1658/magit-mode.el rename to elpa/magit-20171009.1252/magit-mode.el index f7d79cec..4d000db6 100644 --- a/elpa/magit-20161115.1658/magit-mode.el +++ b/elpa/magit-20171009.1252/magit-mode.el @@ -1,6 +1,6 @@ ;;; magit-mode.el --- create and refresh Magit buffers -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -34,7 +34,10 @@ (require 'magit-section) (require 'magit-git) +(require 'magit-popup) +;; For `magit-display-buffer-fullcolumn-most-v1' from `git-commit' +(defvar git-commit-mode) ;; For `magit-xref-insert-buttons' from `magit' (defvar magit-diff-show-xref-buttons) (defvar magit-revision-show-xref-buttons) @@ -58,13 +61,19 @@ (defcustom magit-mode-setup-hook '(magit-maybe-save-repository-buffers - magit-maybe-show-margin) - "Hook run by `magit-mode-setup'." + magit-set-buffer-margin) + "Hook run by `magit-mode-setup'. + +This is run right after displaying the buffer and right before +generating or updating its content. `magit-mode-hook' and other, +more specific, `magit-mode-*-hook's on the other hand are run +right before displaying the buffer. Usually one of these hooks +should be used instead of this one." :package-version '(magit . "2.3.0") :group 'magit-modes :type 'hook :options '(magit-maybe-save-repository-buffers - magit-maybe-show-margin)) + magit-set-buffer-margin)) (defcustom magit-pre-refresh-hook '(magit-maybe-save-repository-buffers) "Hook run before refreshing in `magit-refresh'. @@ -76,7 +85,7 @@ To run a function with a particular buffer current, use `magit-refresh-buffer-hook' and use `derived-mode-p' inside your function." :package-version '(magit . "2.4.0") - :group 'magit-modes + :group 'magit-refresh :type 'hook :options '(magit-maybe-save-repository-buffers)) @@ -90,7 +99,7 @@ To run a function with a particular buffer current, use `magit-refresh-buffer-hook' and use `derived-mode-p' inside your function." :package-version '(magit . "2.4.0") - :group 'magit-modes + :group 'magit-refresh :type 'hook) (defcustom magit-display-buffer-function 'magit-display-buffer-traditional @@ -100,7 +109,7 @@ All Magit buffers (buffers whose major-modes derive from `magit-mode') are displayed using `magit-display-buffer', which in turn uses the function specified here." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-buffers :type '(radio (function-item magit-display-buffer-traditional) (function-item magit-display-buffer-same-window-except-diff-v1) (function-item magit-display-buffer-fullframe-status-v1) @@ -109,33 +118,31 @@ which in turn uses the function specified here." (function-item display-buffer) (function :tag "Function"))) -(unless (find-lisp-object-file-name 'magit-pre-display-buffer-hook 'defvar) - (add-hook 'magit-pre-display-buffer-hook 'magit-save-window-configuration)) (defcustom magit-pre-display-buffer-hook '(magit-save-window-configuration) "Hook run by `magit-display-buffer' before displaying the buffer." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-buffers :type 'hook + :get 'magit-hook-custom-get :options '(magit-save-window-configuration)) -(unless (find-lisp-object-file-name 'magit-post-display-buffer-hook 'defvar) - (add-hook 'magit-post-display-buffer-hook 'magit-maybe-set-dedicated)) (defcustom magit-post-display-buffer-hook '(magit-maybe-set-dedicated) "Hook run by `magit-display-buffer' after displaying the buffer." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-buffers :type 'hook + :get 'magit-hook-custom-get :options '(magit-maybe-set-dedicated)) (defcustom magit-generate-buffer-name-function 'magit-generate-buffer-name-default-function "The function used to generate the name for a Magit buffer." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-buffers :type '(radio (function-item magit-generate-buffer-name-default-function) (function :tag "Function"))) -(defcustom magit-buffer-name-format "*%M%v: %t" +(defcustom magit-buffer-name-format "*%M%v: %T" "The format string used to name Magit buffers. The following %-sequences are supported: @@ -145,65 +152,105 @@ The following %-sequences are supported: `%M' Like \"%m\" but abbreviate `magit-status-mode' as `magit'. -`%v' The value the buffer is locked to, in parentheses, or an empty - string if the buffer is not locked to a value. +`%v' The value the buffer is locked to, in parentheses, or an + empty string if the buffer is not locked to a value. -`%V' Like \"%v\", but the string is prefixed with a space, unless it - is an empty string. +`%V' Like \"%v\", but the string is prefixed with a space, unless + it is an empty string. `%t' The top-level directory of the working tree of the repository, or if `magit-uniquify-buffer-names' is non-nil an abbreviation of that. -The value should always contain either \"%m\" or \"%M\" as well as -\"%t\". If `magit-uniquify-buffer-names' is non-nil, then the -value must end with \"%t\". +`%T' Like \"%t\", but append an asterisk if and only if + `magit-uniquify-buffer-names' is nil. + +The value should always contain \"%m\" or \"%M\", \"%v\" or \"%V\", +and \"%t\" or \"%T\". If `magit-uniquify-buffer-names' is non-nil, +then the value must end with \"%t\" or \"%T\" (see issue #2841). This is used by `magit-generate-buffer-name-default-function'. If another `magit-generate-buffer-name-function' is used, then it may not respect this option, or on the contrary it may support additional %-sequences." - :package-version '(magit . "2.3.0") - :group 'magit-modes + :package-version '(magit . "2.11.1") + :group 'magit-buffers :type 'string) (defcustom magit-uniquify-buffer-names t "Whether to uniquify the names of Magit buffers." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-buffers :type 'boolean) (defcustom magit-bury-buffer-function 'magit-restore-window-configuration "The function used to bury or kill the current Magit buffer." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-buffers :type '(radio (function-item quit-window) (function-item magit-mode-quit-window) (function-item magit-restore-window-configuration) (function :tag "Function"))) +(defcustom magit-use-sticky-arguments t + "How to reuse arguments from existing diff and log buffers. + +nil Always use the default value of the variable + `magit-log-arguments' for log commands. Likewise, + always use the default value of the variable + `magit-diff-arguments' for diff command calls. + +current If the mode of the current buffer is derived from + `magit-log-mode' or `magit-diff-mode', reuse the + arguments from that buffer instead of those given by + the variable `magit-log-arguments' or + `magit-diff-arguments', respectively. + +t Like `current', but if the mode of the current buffer + is not derived from `magit-log-mode' or + `magit-diff-mode', use the arguments from the current + repository's active (i.e. non-locked) `magit-log-mode' + or `magit-diff-mode' buffer, respectively, if it + exists. + + Note that commands that generate a + `magit-revision-mode' or `magit-stash-mode' buffer will + also collect their diff arguments from the active + `magit-diff-mode' buffer. + +In general, there is a separation between the \"sticky\" +arguments for log and diff buffers, but there is one special +case: if the current buffer is a log buffer, +`magit-show-commit' (considered a diff command) uses the file +filter from the log buffer." + :package-version '(magit . "2.11.0") + :group 'magit-buffers + :type '(choice (const :tag "disabled" nil) + (const :tag "sticky for current" current) + (const :tag "sticky" t))) + (defcustom magit-region-highlight-hook '(magit-section-update-region magit-diff-update-hunk-region) "Functions used to highlight the region. + Each function is run with the current section as only argument -until one of them returns non-nil. When multiple sections are -selected, then this hook does not run and the region is not -displayed. Otherwise fall back to regular region highlighting." +until one of them returns non-nil. If all functions return nil, +then fall back to regular region highlighting." :package-version '(magit . "2.1.0") - :group 'magit-modes + :group 'magit-refresh :type 'hook :options '(magit-section-update-region magit-diff-update-hunk-region)) (defcustom magit-refresh-verbose nil "Whether to revert Magit buffers verbosely." :package-version '(magit . "2.1.0") - :group 'magit-modes + :group 'magit-refresh :type 'boolean) (defcustom magit-refresh-buffer-hook nil "Normal hook for `magit-refresh-buffer' to run after refreshing." :package-version '(magit . "2.1.0") - :group 'magit-modes + :group 'magit-refresh :type 'hook) (defcustom magit-refresh-status-buffer t @@ -216,19 +263,23 @@ current Magit buffer, which is always refreshed automatically. Only set this to nil after exhausting all other options to improve performance." :package-version '(magit . "2.4.0") + :group 'magit-refresh :group 'magit-status :type 'boolean) (defcustom magit-save-repository-buffers t "Whether to save file-visiting buffers when appropriate. -If this is non-nil then all modified file-visiting buffers -belonging to the current repository may be saved before running -commands, before creating new Magit buffers, and before -explicitly refreshing such buffers. If this is `dontask' then -this is done without user intervention, if it is t then the user -has to confirm each save. `dontask' is the recommended setting." - :group 'magit +If non-nil, then all modified file-visiting buffers belonging +to the current repository may be saved before running Magit +commands and before creating or refreshing Magit buffers. +If `dontask', then this is done without user intervention, for +any other non-nil value the user has to confirm each save. + +The default is t to avoid surprises, but `dontask' is the +recommended value." + :group 'magit-essentials + :group 'magit-buffers :type '(choice (const :tag "Never" nil) (const :tag "Ask" t) (const :tag "Save without asking" dontask))) @@ -277,7 +328,7 @@ because it doesn't cost much to offer this option we do so. However that might change. If the existence of this option starts complicating other things, then it will be removed." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-miscellaneous :type 'boolean) ;;; Magit Mode @@ -285,32 +336,57 @@ starts complicating other things, then it will be removed." (defvar magit-mode-map (let ((map (make-keymap))) (suppress-keymap map t) - (define-key map "\t" 'magit-section-toggle) - (define-key map [C-tab] 'magit-section-cycle) - (define-key map [M-tab] 'magit-section-cycle-diffs) - (define-key map [S-tab] 'magit-section-cycle-global) - ;; Next two are for backward compatibility. - (define-key map [s-tab] 'magit-section-cycle-global) - (define-key map [backtab] 'magit-section-cycle-global) - (define-key map "^" 'magit-section-up) - (define-key map "n" 'magit-section-forward) - (define-key map "p" 'magit-section-backward) - (define-key map "\M-n" 'magit-section-forward-sibling) - (define-key map "\M-p" 'magit-section-backward-sibling) - (define-key map "+" 'magit-diff-more-context) - (define-key map "-" 'magit-diff-less-context) - (define-key map "0" 'magit-diff-default-context) - (define-key map "1" 'magit-section-show-level-1) - (define-key map "2" 'magit-section-show-level-2) - (define-key map "3" 'magit-section-show-level-3) - (define-key map "4" 'magit-section-show-level-4) - (define-key map "\M-1" 'magit-section-show-level-1-all) - (define-key map "\M-2" 'magit-section-show-level-2-all) - (define-key map "\M-3" 'magit-section-show-level-3-all) - (define-key map "\M-4" 'magit-section-show-level-4-all) - (define-key map "g" 'magit-refresh) - (define-key map "G" 'magit-refresh-all) - (define-key map "q" 'magit-mode-bury-buffer) + (cond ((featurep 'jkl) + (define-key map [return] 'magit-visit-thing) + (define-key map [C-return] 'magit-dired-jump) + (define-key map [tab] 'magit-section-toggle) + (define-key map [C-tab] 'magit-section-cycle) + (define-key map [M-tab] 'magit-section-cycle-diffs) + (define-key map [S-tab] 'magit-section-cycle-global) + (define-key map (kbd "M-o") 'magit-section-up) + (define-key map (kbd "i") 'magit-section-backward) + (define-key map (kbd "k") 'magit-section-forward) + (define-key map (kbd "M-i") 'magit-section-backward-sibling) + (define-key map (kbd "M-k") 'magit-section-forward-sibling) + (define-key map (kbd "p") 'magit-push-popup) + (define-key map (kbd ",") 'magit-delete-thing) + (define-key map (kbd ";") 'magit-file-untrack) + (define-key map (kbd "C-c C-i") 'magit-gitignore) + (define-key map (kbd "C-c i") 'magit-gitignore-locally)) + (t + (define-key map [C-return] 'magit-visit-thing) + (define-key map (kbd "C-m") 'magit-visit-thing) + (define-key map (kbd "C-M-i") 'magit-dired-jump) + (define-key map (kbd "C-i") 'magit-section-toggle) + (define-key map [C-tab] 'magit-section-cycle) + (define-key map [M-tab] 'magit-section-cycle-diffs) + (define-key map [S-tab] 'magit-section-cycle-global) + ;; Next two are for backward compatibility. + (define-key map [s-tab] 'magit-section-cycle-global) + (define-key map [backtab] 'magit-section-cycle-global) + (define-key map (kbd "^") 'magit-section-up) + (define-key map (kbd "p") 'magit-section-backward) + (define-key map (kbd "n") 'magit-section-forward) + (define-key map (kbd "M-p") 'magit-section-backward-sibling) + (define-key map (kbd "M-n") 'magit-section-forward-sibling) + (define-key map (kbd "P") 'magit-push-popup) + (define-key map (kbd "k") 'magit-delete-thing) + (define-key map (kbd "K") 'magit-file-untrack) + (define-key map (kbd "i") 'magit-gitignore) + (define-key map (kbd "I") 'magit-gitignore-locally))) + (define-key map (kbd "SPC") 'magit-diff-show-or-scroll-up) + (define-key map (kbd "DEL") 'magit-diff-show-or-scroll-down) + (define-key map "+" 'magit-diff-more-context) + (define-key map "-" 'magit-diff-less-context) + (define-key map "0" 'magit-diff-default-context) + (define-key map "1" 'magit-section-show-level-1) + (define-key map "2" 'magit-section-show-level-2) + (define-key map "3" 'magit-section-show-level-3) + (define-key map "4" 'magit-section-show-level-4) + (define-key map (kbd "M-1") 'magit-section-show-level-1-all) + (define-key map (kbd "M-2") 'magit-section-show-level-2-all) + (define-key map (kbd "M-3") 'magit-section-show-level-3-all) + (define-key map (kbd "M-4") 'magit-section-show-level-4-all) (define-key map "$" 'magit-process-buffer) (define-key map "a" 'magit-cherry-apply) (define-key map "A" 'magit-cherry-pick-popup) @@ -319,34 +395,25 @@ starts complicating other things, then it will be removed." (define-key map "c" 'magit-commit-popup) (define-key map "d" 'magit-diff-popup) (define-key map "D" 'magit-diff-refresh-popup) - (define-key map "h" 'magit-dispatch-popup) - (define-key map "?" 'magit-dispatch-popup) - (define-key map "\C-c\C-c" 'magit-dispatch-popup) - (define-key map "\C-c\C-e" 'magit-dispatch-popup) (define-key map "e" 'magit-ediff-dwim) (define-key map "E" 'magit-ediff-popup) (define-key map "f" 'magit-fetch-popup) (define-key map "F" 'magit-pull-popup) - (define-key map "i" 'magit-gitignore) - (define-key map "I" 'magit-gitignore-locally) - (define-key map "k" 'magit-delete-thing) - (define-key map "K" 'magit-file-untrack) + (define-key map "g" 'magit-refresh) + (define-key map "G" 'magit-refresh-all) + (define-key map "h" 'magit-dispatch-popup) + (define-key map "?" 'magit-dispatch-popup) (define-key map "l" 'magit-log-popup) (define-key map "L" 'magit-log-refresh-popup) (define-key map "m" 'magit-merge-popup) (define-key map "M" 'magit-remote-popup) (define-key map "o" 'magit-submodule-popup) (define-key map "O" 'magit-subtree-popup) - (define-key map "P" 'magit-push-popup) + (define-key map "q" 'magit-mode-bury-buffer) (define-key map "r" 'magit-rebase-popup) (define-key map "R" 'magit-file-rename) (define-key map "t" 'magit-tag-popup) (define-key map "T" 'magit-notes-popup) - (define-key map "\r" 'magit-visit-thing) - (define-key map [C-return] 'magit-visit-thing) - (define-key map "\M-\r" 'magit-dired-jump) - (define-key map "\s" 'magit-diff-show-or-scroll-up) - (define-key map "\d" 'magit-diff-show-or-scroll-down) (define-key map "s" 'magit-stage-file) (define-key map "S" 'magit-stage-modified) (define-key map "u" 'magit-unstage-file) @@ -363,10 +430,12 @@ 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 "\C-xa" 'magit-add-change-log-entry) - (define-key map "\C-x4a" 'magit-add-change-log-entry-other-window) - (define-key map "\C-w" 'magit-copy-section-value) - (define-key map "\M-w" 'magit-copy-buffer-revision) + (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-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) + (define-key map (kbd "M-w") 'magit-copy-buffer-revision) (define-key map [remap evil-previous-line] 'evil-previous-visual-line) (define-key map [remap evil-next-line] 'evil-next-visual-line) map) @@ -384,7 +453,10 @@ which deletes the thing at point." Where applicable, section-specific keymaps bind another command which visits the thing at point." (interactive) - (user-error "There is no thing at point that could be visited")) + (if (eq magit-current-popup 'magit-dispatch-popup) + (progn (setq magit-current-popup nil) + (call-interactively (key-binding (this-command-keys)))) + (user-error "There is no thing at point that could be visited"))) (easy-menu-define magit-mode-menu magit-mode-map "Magit menu" @@ -453,7 +525,7 @@ Magit is documented in info node `(magit)'." (setq buffer-read-only t) (setq-local line-move-visual t) ; see #1771 (setq show-trailing-whitespace nil) - (setq list-buffers-directory default-directory) + (setq list-buffers-directory (abbreviate-file-name default-directory)) (hack-dir-local-variables-non-file-buffer) (make-local-variable 'text-property-default-nonsticky) (push (cons 'keymap t) text-property-default-nonsticky) @@ -530,7 +602,9 @@ and `magit-post-display-buffer-hook'." (run-hooks 'magit-pre-display-buffer-hook)) (let ((window (funcall magit-display-buffer-function buffer))) (unless magit-display-buffer-noselect - (select-window window))) + (select-frame-set-input-focus + (window-frame + (select-window window))))) (with-current-buffer buffer (run-hooks 'magit-post-display-buffer-hook))) @@ -636,7 +710,8 @@ the mode of the current buffer derives from `magit-log-mode' or `magit-cherry-mode'." (display-buffer buffer - (cond ((and (derived-mode-p 'magit-log-mode 'magit-cherry-mode) + (cond ((and (or git-commit-mode + (derived-mode-p 'magit-log-mode 'magit-cherry-mode)) (with-current-buffer buffer (derived-mode-p 'magit-diff-mode))) nil) @@ -702,7 +777,7 @@ thinking a buffer belongs to a repo that it doesn't.") (when magit-uniquify-buffer-names (add-to-list 'uniquify-list-buffers-directory-modes mode) (with-current-buffer buffer - (setq list-buffers-directory default-directory)) + (setq list-buffers-directory (abbreviate-file-name default-directory))) (let ((uniquify-buffer-name-style (if (memq uniquify-buffer-name-style '(nil forward)) 'post-forward-angle-brackets @@ -713,18 +788,24 @@ thinking a buffer belongs to a repo that it doesn't.") buffer)) (defun magit-generate-buffer-name-default-function (mode &optional value) + "Generate buffer name for a MODE buffer in the current repository. +The returned name is based on `magit-buffer-name-format' and +takes `magit-uniquify-buffer-names' and VALUE, if non-nil, into +account." (let ((m (substring (symbol-name mode) 0 -5)) - (v (and value (format "%s" (if (listp value) value (list value)))))) + (v (and value (format "%s" (if (listp value) value (list value))))) + (n (if magit-uniquify-buffer-names + (file-name-nondirectory + (directory-file-name default-directory)) + (abbreviate-file-name default-directory)))) (format-spec magit-buffer-name-format `((?m . ,m) (?M . ,(if (eq mode 'magit-status-mode) "magit" m)) (?v . ,(or v "")) (?V . ,(if v (concat " " v) "")) - (?t . ,(if magit-uniquify-buffer-names - (file-name-nondirectory - (directory-file-name default-directory)) - (abbreviate-file-name default-directory))))))) + (?t . ,n) + (?T . ,(if magit-uniquify-buffer-names n (concat n "*"))))))) (defun magit-toggle-buffer-lock () "Lock the current buffer to its value or unlock it. @@ -837,7 +918,8 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (interactive) (unless inhibit-magit-refresh (let ((start (current-time)) - (magit--refresh-cache (list (cons 0 0)))) + (magit--refresh-cache (or magit--refresh-cache + (list (cons 0 0))))) (when magit-refresh-verbose (message "Refreshing magit...")) (magit-run-hook-with-benchmark 'magit-pre-refresh-hook) @@ -894,10 +976,10 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (or (get-buffer-window-list buffer nil t) (list (selected-window)))))) (deactivate-mark) - (setq magit-section-highlight-overlays nil - magit-section-highlighted-section nil - magit-section-highlighted-sections nil - magit-section-unhighlight-sections nil) + (setq magit-section-highlight-overlays nil) + (setq magit-section-highlighted-section nil) + (setq magit-section-highlighted-sections nil) + (setq magit-section-unhighlight-sections nil) (let ((inhibit-read-only t)) (erase-buffer) (save-excursion @@ -997,14 +1079,16 @@ buffer which visits a file in the current repository. Optional argument (the prefix) non-nil means save all with no questions." (interactive "P") (-when-let (topdir (magit-rev-parse-safe "--show-toplevel")) - (save-some-buffers - arg (-partial (lambda (topdir) - (and buffer-file-name - ;; Avoid needlessly connecting to unrelated remotes. - (string-prefix-p topdir (file-truename buffer-file-name)) - (equal (magit-rev-parse-safe "--show-toplevel") - topdir))) - topdir)))) + (let ((remote (file-remote-p topdir))) + (save-some-buffers + arg (lambda () + (and buffer-file-name + ;; Avoid needlessly connecting to unrelated remotes. + (equal (file-remote-p buffer-file-name) + remote) + (string-prefix-p topdir (file-truename buffer-file-name)) + (equal (magit-rev-parse-safe "--show-toplevel") + topdir))))))) ;;; Restore Window Configuration @@ -1113,9 +1197,5 @@ Currently `magit-log-mode', `magit-reflog-mode', (float-time (time-subtract (current-time) start)))) (run-hooks hook)))) -;;; magit-mode.el ends soon (provide 'magit-mode) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-mode.el ends here diff --git a/elpa/magit-20171009.1252/magit-notes.el b/elpa/magit-20171009.1252/magit-notes.el new file mode 100644 index 00000000..95b96fd1 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-notes.el @@ -0,0 +1,179 @@ +;;; magit-notes.el --- notes support -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for `git-notes'. + +;;; Code: + +(require 'magit) + +;;; Popup + +;;;###autoload (autoload 'magit-notes-popup "magit" nil t) +(magit-define-popup magit-notes-popup + "Popup console for notes commands." + :man-page "git-tag" + :switches '("Switch for prune" + (?n "Dry run" "--dry-run")) + :options '("Option for edit and remove" + (?r "Manipulate ref" "--ref=" magit-notes-popup-read-ref) + "Option for merge" + (?s "Merge strategy" "--strategy=")) + :actions '((?T "Edit" magit-notes-edit) + (?r "Remove" magit-notes-remove) + (?m "Merge" magit-notes-merge) + (?p "Prune" magit-notes-prune) + (?s "Set ref" magit-notes-set-ref) + (?S "Set display refs" magit-notes-set-display-refs)) + :sequence-actions '((?c "Commit merge" magit-notes-merge-commit) + (?a "Abort merge" magit-notes-merge-abort)) + :sequence-predicate 'magit-notes-merging-p + :default-action 'magit-notes-edit) + +(defun magit-notes-merging-p () + (let ((dir (magit-git-dir "NOTES_MERGE_WORKTREE"))) + (and (file-directory-p dir) + (directory-files dir nil "^[^.]")))) + +(defun magit-notes-popup-read-ref (prompt &optional initial-input) + (magit-completing-read prompt (nconc (list "refs/" "refs/notes/") + (magit-list-notes-refnames)) + nil nil initial-input)) + +;;; Commands + +(defun magit-notes-edit (commit &optional ref) + "Edit the note attached to COMMIT. +REF is the notes ref used to store the notes. + +Interactively or when optional REF is nil use the value of Git +variable `core.notesRef' or \"refs/notes/commits\" if that is +undefined." + (interactive (magit-notes-read-args "Edit notes")) + (magit-run-git-with-editor "notes" (and ref (concat "--ref=" ref)) + "edit" commit)) + +(defun magit-notes-remove (commit &optional ref) + "Remove the note attached to COMMIT. +REF is the notes ref from which the note is removed. + +Interactively or when optional REF is nil use the value of Git +variable `core.notesRef' or \"refs/notes/commits\" if that is +undefined." + (interactive (magit-notes-read-args "Remove notes")) + (magit-run-git-with-editor "notes" (and ref (concat "--ref=" ref)) + "remove" commit)) + +(defun magit-notes-merge (ref) + "Merge the notes ref REF into the current notes ref. + +The current notes ref is the value of Git variable +`core.notesRef' or \"refs/notes/commits\" if that is undefined. + +When there are conflicts, then they have to be resolved in the +temporary worktree \".git/NOTES_MERGE_WORKTREE\". When +done use `magit-notes-merge-commit' to finish. To abort +use `magit-notes-merge-abort'." + (interactive (list (magit-read-string-ns "Merge reference"))) + (magit-run-git-with-editor "notes" "merge" ref)) + +(defun magit-notes-merge-commit () + "Commit the current notes ref merge. +Also see `magit-notes-merge'." + (interactive) + (magit-run-git-with-editor "notes" "merge" "--commit")) + +(defun magit-notes-merge-abort () + "Abort the current notes ref merge. +Also see `magit-notes-merge'." + (interactive) + (magit-run-git-with-editor "notes" "merge" "--abort")) + +(defun magit-notes-prune (&optional dry-run) + "Remove notes about unreachable commits." + (interactive (list (and (member "--dry-run" (magit-notes-arguments)) t))) + (when dry-run + (magit-process-buffer)) + (magit-run-git-with-editor "notes" "prune" (and dry-run "--dry-run"))) + +(defun magit-notes-set-ref (ref &optional global) + "Set the current notes ref to REF. +The ref is made current by setting the value of the Git variable +`core.notesRef'. With a prefix argument GLOBAL change the global +value, else the value in the current repository. When this is +undefined, then \"refs/notes/commit\" is used. + +Other `magit-notes-*' commands, as well as the sub-commands +of Git's `note' command, default to operate on that ref." + (interactive + (list (magit-completing-read "Set notes ref" + (nconc (list "refs/" "refs/notes/") + (magit-list-notes-refnames)) + nil nil + (--when-let (magit-get "core.notesRef") + (if (string-match "^refs/notes/\\(.+\\)" it) + (match-string 1 it) + it))) + current-prefix-arg)) + (if ref + (magit-run-git "config" (and global "--global") "core.notesRef" + (if (string-prefix-p "refs/" ref) + ref + (concat "refs/notes/" ref))) + (magit-run-git "config" (and global "--global") + "--unset" "core.notesRef"))) + +(defun magit-notes-set-display-refs (refs &optional global) + "Set notes refs to be display in addition to \"core.notesRef\". +REFS is a colon separated list of notes refs. The values are +stored in the Git variable `notes.displayRef'. With a prefix +argument GLOBAL change the global values, else the values in +the current repository." + (interactive + (list (magit-completing-read "Set additional notes ref(s)" + (nconc (list "refs/" "refs/notes/") + (magit-list-notes-refnames)) + nil nil + (mapconcat #'identity + (magit-get-all "notes.displayRef") + ":")) + current-prefix-arg)) + (when (and refs (atom refs)) + (setq refs (split-string refs ":"))) + (when global + (setq global "--global")) + (magit-git-success "config" "--unset-all" global "notes.displayRef") + (dolist (ref refs) + (magit-call-git "config" "--add" global "notes.displayRef" ref)) + (magit-refresh)) + +(defun magit-notes-read-args (prompt) + (list (magit-read-branch-or-commit prompt) + (--when-let (--first (string-match "^--ref=\\(.+\\)" it) + (magit-notes-arguments)) + (match-string 1 it)))) + +(provide 'magit-notes) +;;; magit-notes.el ends here diff --git a/elpa/magit-20171009.1252/magit-obsolete.el b/elpa/magit-20171009.1252/magit-obsolete.el new file mode 100644 index 00000000..6ddea4ba --- /dev/null +++ b/elpa/magit-20171009.1252/magit-obsolete.el @@ -0,0 +1,133 @@ +;;; magit-obsolete.el --- obsolete definitions -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 defines aliases for obsolete variables and functions. + +;;; Code: + +(require 'magit) + +;;; Obsolete since v2.1.0 + +(define-obsolete-variable-alias 'magit-git-standard-options + 'magit-git-global-arguments "Magit 2.1.0") + +;;; Obsolete since v2.2.0 + +(define-obsolete-variable-alias 'magit-log-section-args + 'magit-log-section-arguments "Magit 2.2.0") + +;;; Obsolete since v2.3.0 + +(define-obsolete-function-alias 'global-magit-file-buffer-mode + 'global-magit-file-mode "Magit 2.3.0") + +;;; Obsolete since v2.4.0 + +(define-obsolete-function-alias 'magit-get-tracked-ref + 'magit-get-upstream-ref "Magit 2.4.0") + +(define-obsolete-function-alias 'magit-get-tracked-branch + 'magit-get-upstream-branch "Magit 2.4.0") + +(define-obsolete-function-alias 'magit-get-tracked-remote + 'magit-get-upstream-remote "Magit 2.4.0") + +(define-obsolete-function-alias 'magit-insert-head-header + 'magit-insert-head-branch-header "Magit 2.4.0") + +(define-obsolete-function-alias 'magit-insert-pull-branch-header + 'magit-insert-upstream-branch-header "Magit 2.4.0") + +(define-obsolete-function-alias 'magit-insert-unpulled-or-recent-commits + 'magit-insert-unpulled-from-upstream-or-recent "Magit 2.4.0") + +(define-obsolete-function-alias 'magit-insert-upstream-header + 'magit-insert-upstream-branch-header "Magit 2.4.0") + +(make-obsolete-variable 'magit-revert-buffers + 'magit-auto-revert-mode + "Magit 2.4.0") + +(make-obsolete-variable 'magit-status-refresh-hook "\ +use `magit-pre-refresh-hook', `magit-post-refresh-hook', + `magit-refresh-buffer-hook', or `magit-status-mode-hook' instead. + + If you want to run a function every time the status buffer is + refreshed, in order to do something with that buffer, then use: + + (add-hook 'magit-refresh-buffer-hook + (lambda () + (when (derived-mode-p 'magit-status-mode) + ...))) + + If your hook function should run regardless of whether the + status buffer exists or not, then use `magit-pre-refresh-hook' + or `magit-post-refresh-hook'. + + If your hook function only has to be run once, when the buffer + is first created, then `magit-status-mode-hook' instead. +" "Magit 2.4.0") + +;;; Obsolete since v2.6.0 + +(define-obsolete-function-alias 'magit-insert-unpulled-module-commits + 'magit-insert-modules-unpulled-from-upstream "Magit 2.6.0") + +(define-obsolete-function-alias 'magit-insert-unpushed-module-commits + 'magit-insert-modules-unpushed-to-upstream "Magit 2.6.0") + +;;; Obsolete since v2.8.0 + +(make-obsolete-variable 'magit-repository-directories-depth + 'magit-repository-directories "Magit 2.8.0") + +;;; Obsolete since v2.9.0 + +(define-obsolete-variable-alias 'magit-duration-spec + 'magit--age-spec "Magit 2.9.0") + +(make-obsolete-variable 'magit-diff-show-lines-boundary + 'magit-diff-highlight-hunk-region-functions + "Magit 2.9.0") + +(define-obsolete-variable-alias 'magit-log-output-coding-system + 'magit-git-output-coding-system "Magit 2.9.0") + +;;; Obsolete since v2.9.1 + +(define-obsolete-function-alias 'magit-checkout-file + 'magit-file-checkout "Magit 2.9.1") + +;;; Obsolete since v2.11.0 + +(define-obsolete-function-alias 'magit-modified-files + 'magit-unstaged-files "Magit 2.11.0") + +(define-obsolete-function-alias 'magit-insert-submodules + 'magit-insert-modules-overview "Magit 2.11.0") + +(provide 'magit-obsolete) +;;; magit-obsolete.el ends here diff --git a/elpa/magit-20171009.1252/magit-pkg.el b/elpa/magit-20171009.1252/magit-pkg.el new file mode 100644 index 00000000..5fdaaabc --- /dev/null +++ b/elpa/magit-20171009.1252/magit-pkg.el @@ -0,0 +1,12 @@ +(define-package "magit" "20171009.1252" "A Git porcelain inside Emacs" + '((emacs "24.4") + (async "20170823") + (dash "20170810") + (with-editor "20170817") + (git-commit "20170823") + (magit-popup "20170824")) + :url "https://github.com/magit/magit" :keywords + '("git" "tools" "vc")) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/magit-20161115.1658/magit-process.el b/elpa/magit-20171009.1252/magit-process.el similarity index 92% rename from elpa/magit-20161115.1658/magit-process.el rename to elpa/magit-20171009.1252/magit-process.el index 370b2a61..bff559de 100644 --- a/elpa/magit-20161115.1658/magit-process.el +++ b/elpa/magit-20171009.1252/magit-process.el @@ -1,6 +1,6 @@ ;;; magit-process.el --- process functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -31,6 +31,7 @@ ;;; Code: +(require 'ansi-color) (require 'cl-lib) (require 'dash) @@ -43,19 +44,10 @@ (eval-when-compile (require 'dired)) (declare-function dired-uncache 'dired) -;;; Options - -(defcustom magit-git-output-coding-system - (and (eq system-type 'windows-nt) 'utf-8) - "Coding system for receiving output from Git. +(eval-when-compile (require 'auth-source)) +(declare-function auth-source-search 'auth-source) -If non-nil, the Git config value `i18n.logOutputEncoding' should -be set via `magit-git-global-arguments' to value consistent with -this." - :package-version '(magit . "2.9.0") - :group 'magit-process - :type '(choice (coding-system :tag "Coding system to decode Git output") - (const :tag "Use system default" nil))) +;;; Options (defcustom magit-process-connection-type (not (eq system-type 'cygwin)) "Connection type used for the Git process. @@ -67,18 +59,18 @@ If t, use ptys: this enables Magit to prompt for passphrases when needed." (const :tag "pty" t))) (defcustom magit-need-cygwin-noglob - (when (eq system-type 'windows-nt) - (with-temp-buffer - (let ((process-environment - (append magit-git-environment process-environment))) - (condition-case e - (process-file magit-git-executable - nil (current-buffer) nil - "-c" "alias.echo=!echo" "echo" "x{0}") - (file-error - (lwarn 'magit-process :warning - "Could not run Git: %S" e)))) - (equal "x0\n" (buffer-string)))) + (and (eq system-type 'windows-nt) + (with-temp-buffer + (let ((process-environment + (append magit-git-environment process-environment))) + (condition-case e + (process-file magit-git-executable + nil (current-buffer) nil + "-c" "alias.echo=!echo" "echo" "x{0}") + (file-error + (lwarn 'magit-process :warning + "Could not run Git: %S" e)))) + (equal "x0\n" (buffer-string)))) "Whether to use a workaround for Cygwin's globbing behavior. If non-nil, add environment variables to `process-environment' to @@ -109,8 +101,9 @@ When this is nil, no sections are ever removed." (defcustom magit-credential-cache-daemon-socket (--some (-let [(prog . args) (split-string it)] - (if (string-match-p - "\\`\\(?:\\(?:/.*/\\)?git-credential-\\)?cache\\'" prog) + (if (and prog + (string-match-p + "\\`\\(?:\\(?:/.*/\\)?git-credential-\\)?cache\\'" prog)) (or (cl-loop for (opt val) on args if (string= opt "--socket") return val) @@ -217,7 +210,11 @@ non-nil, then the password is read from the user instead." (define-derived-mode magit-process-mode magit-mode "Magit Process" "Mode for looking at Git process output." :group 'magit-process - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq imenu-prev-index-position-function + 'magit-imenu--process-prev-index-position-function) + (setq imenu-extract-index-name-function + 'magit-imenu--process-extract-index-name-function)) (defun magit-process-buffer (&optional nodisplay) "Display the current repository's process buffer. @@ -295,8 +292,12 @@ as well as the current repository's status buffer are refreshed. Process output goes into a new section in the buffer returned by `magit-process-buffer'." - (magit-call-git args) - (magit-refresh)) + (let ((magit--refresh-cache (list (cons 0 0)))) + (magit-call-git args) + (when (member (car args) '("init" "clone")) + ;; Creating a new repository invalidates the cache. + (setq magit--refresh-cache nil)) + (magit-refresh))) (defvar magit-pre-call-git-hook nil) @@ -337,12 +338,12 @@ conversion." (defun magit-cygwin-env-vars () (append magit-git-environment - (when magit-need-cygwin-noglob - (mapcar (lambda (var) - (concat var "=" (--if-let (getenv var) - (concat it " noglob") - "noglob"))) - '("CYGWIN" "MSYS"))))) + (and magit-need-cygwin-noglob + (mapcar (lambda (var) + (concat var "=" (--if-let (getenv var) + (concat it " noglob") + "noglob"))) + '("CYGWIN" "MSYS"))))) (defvar magit-this-process nil) @@ -417,6 +418,7 @@ current when this function was called (if it is a Magit buffer and still alive), as well as the respective Magit status buffer. See `magit-start-process' and `with-editor' for more information." + (magit--record-separated-gitdir) (magit-with-editor (magit-run-git-async args))) (defun magit-run-git-sequencer (&rest args) @@ -535,17 +537,22 @@ Magit status buffer." (unless (equal (expand-file-name pwd) (expand-file-name default-directory)) (insert (file-relative-name pwd default-directory) ?\s)) - (insert (propertize program 'face 'magit-section-heading)) - (insert " ") - (when (and args (equal program magit-git-executable)) + (cond + ((and args (equal program magit-git-executable)) (setq args (-split-at (length magit-git-global-arguments) args)) + (insert (propertize program 'face 'magit-section-heading) " ") (insert (propertize (char-to-string magit-ellipsis) 'face 'magit-section-heading 'help-echo (mapconcat #'identity (car args) " "))) (insert " ") - (setq args (cadr args))) - (insert (propertize (mapconcat #'identity args " ") - 'face 'magit-section-heading)) + (insert (propertize (mapconcat #'shell-quote-argument (cadr args) " ") + 'face 'magit-section-heading))) + ((and args (equal program shell-file-name)) + (insert (propertize (cadr args) 'face 'magit-section-heading))) + (t + (insert (propertize program 'face 'magit-section-heading) " ") + (insert (propertize (mapconcat #'shell-quote-argument args " ") + 'face 'magit-section-heading)))) (magit-insert-heading) (when errlog (insert-file-contents errlog) @@ -595,7 +602,7 @@ Magit status buffer." "Special sentinel used by `magit-run-git-sequencer'." (when (memq (process-status process) '(exit signal)) (magit-process-sentinel process event) - (-when-let (process-buf (process-get process 'process-buf)) + (-when-let (process-buf (process-buffer process)) (when (buffer-live-p process-buf) (-when-let (status-buf (with-current-buffer process-buf (magit-mode-get-buffer 'magit-status-mode))) @@ -698,7 +705,7 @@ instead." (defun magit-process-match-prompt (prompts string) "Match STRING against PROMPTS and set match data. Return the matched string suffixed with \": \", if needed." - (when (--any? (string-match it string) prompts) + (when (--any-p (string-match it string) prompts) (let ((prompt (match-string 0 string))) (cond ((string-suffix-p ": " prompt) prompt) ((string-suffix-p ":" prompt) (concat prompt " ")) @@ -790,14 +797,16 @@ as argument." (defvar-local magit-this-error nil) +(defvar magit-process-finish-apply-ansi-colors nil) + (defun magit-process-finish (arg &optional process-buf command-buf default-dir section) (unless (integerp arg) - (setq process-buf (process-buffer arg) - command-buf (process-get arg 'command-buf) - default-dir (process-get arg 'default-dir) - section (process-get arg 'section) - arg (process-exit-status arg))) + (setq process-buf (process-buffer arg)) + (setq command-buf (process-get arg 'command-buf)) + (setq default-dir (process-get arg 'default-dir)) + (setq section (process-get arg 'section)) + (setq arg (process-exit-status arg))) (when (featurep 'dired) (dired-uncache default-dir)) (when (buffer-live-p process-buf) @@ -815,6 +824,9 @@ as argument." 'magit-process-ok 'magit-process-ng))) (set-marker-insertion-type marker t)) + (when magit-process-finish-apply-ansi-colors + (ansi-color-apply-on-region (magit-section-content section) + (magit-section-end section))) (if (= (magit-section-end section) (+ (line-end-position) 2)) (save-excursion @@ -872,13 +884,5 @@ as argument." (pop-to-buffer buf)))))) process)))))) -;;; magit-process.el ends soon - -(define-obsolete-variable-alias 'magit-log-output-coding-system - 'magit-git-output-coding-system "Magit 2.9.0") - (provide 'magit-process) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-process.el ends here diff --git a/elpa/magit-20171009.1252/magit-refs.el b/elpa/magit-20171009.1252/magit-refs.el new file mode 100644 index 00000000..8b85225d --- /dev/null +++ b/elpa/magit-20171009.1252/magit-refs.el @@ -0,0 +1,622 @@ +;;; magit-refs.el --- listing references -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for listing references in a buffer. + +;;; Code: + +(require 'magit) + +(defvar bookmark-make-record-function) + +;;; Options + +(defgroup magit-refs nil + "Inspect and manipulate Git branches and tags." + :link '(info-link "(magit)References Buffer") + :group 'magit-modes) + +(defcustom magit-refs-mode-hook nil + "Hook run after entering Magit-Refs mode." + :package-version '(magit . "2.1.0") + :group 'magit-refs + :type 'hook) + +(defcustom magit-refs-sections-hook + '(magit-insert-error-header + magit-insert-branch-description + magit-insert-local-branches + magit-insert-remote-branches + magit-insert-tags) + "Hook run to insert sections into a references buffer." + :package-version '(magit . "2.1.0") + :group 'magit-refs + :type 'hook) + +(defcustom magit-refs-show-commit-count nil + "Whether to show commit counts in Magit-Refs mode buffers. + +all Show counts for branches and tags. +branch Show counts for branches only. +nil Never show counts. + +To change the value in an existing buffer use the command +`magit-refs-show-commit-count'" + :package-version '(magit . "2.1.0") + :group 'magit-refs + :safe (lambda (val) (memq val '(all branch nil))) + :type '(choice (const all :tag "For branches and tags") + (const branch :tag "For branches only") + (const nil :tag "Never"))) +(put 'magit-refs-show-commit-count 'safe-local-variable 'symbolp) +(put 'magit-refs-show-commit-count 'permanent-local t) + +(defcustom magit-refs-margin + (list nil + (nth 1 magit-log-margin) + 'magit-log-margin-width nil + (nth 4 magit-log-margin)) + "Format of the margin in `magit-refs-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") + :group 'magit-refs + :group 'magit-margin + :safe (lambda (val) (memq val '(all branch nil))) + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set-after '(magit-log-margin) + :set (apply-partially #'magit-margin-set-variable 'magit-refs-mode)) + +(defcustom magit-refs-margin-for-tags nil + "Whether to show information about tags in the margin. + +This is disabled by default because it is slow if there are many +tags." + :package-version '(magit . "2.9.0") + :group 'magit-refs + :group 'magit-margin + :type 'boolean) + +(defcustom magit-visit-ref-behavior nil + "Control how `magit-visit-ref' behaves in `magit-refs-mode' buffers. + +By default `magit-visit-ref' behaves like `magit-show-commit', +in all buffers, including `magit-refs-mode' buffers. When the +type of the section at point is `commit' then \"RET\" is bound to +`magit-show-commit', and when the type is either `branch' or +`tag' then it is bound to `magit-visit-ref'. + +\"RET\" is one of Magit's most essential keys and at least by +default it should behave consistently across all of Magit, +especially because users quickly learn that it does something +very harmless; it shows more information about the thing at point +in another buffer. + +However \"RET\" used to behave differently in `magit-refs-mode' +buffers, doing surprising things, some of which cannot really be +described as \"visit this thing\". If you have grown accustomed +to such inconsistent, but to you useful, behavior, then you can +restore that by adding one or more of the below symbols to the +value of this option. But keep in mind that by doing so you +don't only introduce inconsistencies, you also lose some +functionality and might have to resort to `M-x magit-show-commit' +to get it back. + +`magit-visit-ref' looks for these symbols in the order in which +they are described here. If the presence of a symbol applies to +the current situation, then the symbols that follow do not affect +the outcome. + +`focus-on-ref' + + With a prefix argument update the buffer to show commit counts + and lists of cherry commits relative to the reference at point + instead of relative to the current buffer or `HEAD'. + + Instead of adding this symbol, consider pressing \"C-u y o RET\". + +`create-branch' + + If point is on a remote branch, then create a new local branch + with the same name, use the remote branch as its upstream, and + then check out the local branch. + + Instead of adding this symbol, consider pressing \"b c RET RET\", + like you would do in other buffers. + +`checkout-any' + + Check out the reference at point. If that reference is a tag + or a remote branch, then this results in a detached `HEAD'. + + Instead of adding this symbol, consider pressing \"b b RET\", + like you would do in other buffers. + +`checkout-branch' + + Check out the local branch at point. + + Instead of adding this symbol, consider pressing \"b b RET\", + like you would do in other buffers." + :package-version '(magit . "2.9.0") + :group 'magit-refs + :group 'magit-commands + :options '(focus-on-ref create-branch checkout-any checkout-branch) + :type '(list :convert-widget custom-hook-convert-widget)) + +;;; Mode + +(defvar magit-refs-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map "\C-y" 'magit-refs-set-show-commit-count) + (define-key map "L" 'magit-margin-popup) + map) + "Keymap for `magit-refs-mode'.") + +(define-derived-mode magit-refs-mode magit-mode "Magit Refs" + "Mode which lists and compares references. + +This mode is documented in info node `(magit)References Buffer'. + +\\\ +Type \\[magit-refresh] to refresh the current buffer. +Type \\[magit-section-toggle] to expand or hide the section at point. +Type \\[magit-visit-thing] or \\[magit-diff-show-or-scroll-up] \ +to visit the commit or branch at point. + +Type \\[magit-branch-popup] to see available branch commands. +Type \\[magit-merge-popup] to merge the branch or commit at point. +Type \\[magit-cherry-pick-popup] to apply the commit at point. +Type \\[magit-reset] to reset `HEAD' to the commit at point. + +\\{magit-refs-mode-map}" + :group 'magit-refs + (hack-dir-local-variables-non-file-buffer) + (setq imenu-create-index-function + #'magit-imenu--refs-create-index-function) + (setq-local bookmark-make-record-function + #'magit-bookmark--refs-make-record)) + +(defun magit-refs-refresh-buffer (ref &optional args) + (setq magit-set-buffer-margin-refresh (not (magit-buffer-margin-p))) + (unless ref + (setq ref "HEAD")) + (unless (magit-rev-verify ref) + (setq magit-refs-show-commit-count nil)) + (setq header-line-format + (propertize (format " %s %s" ref (mapconcat #'identity args " ")) + 'face 'magit-header-line)) + (magit-insert-section (branchbuf) + (run-hooks 'magit-refs-sections-hook))) + +;;; Commands + +(defcustom magit-show-refs-arguments nil + "The arguments used in `magit-refs-mode' buffers." + :group 'magit-git-arguments + :group 'magit-refs + :type '(repeat (string :tag "Argument"))) + +(defvar magit-show-refs-popup + (list + :variable 'magit-show-refs-arguments + :man-page "git-branch" + :switches '((?m "Merged to HEAD" "--merged") + (?M "Merged to master" "--merged=master") + (?n "Not merged to HEAD" "--no-merged") + (?N "Not merged to master" "--no-merged=master")) + :options '((?c "Contains" "--contains=" magit-read-branch-or-commit) + (?m "Merged" "--merged=" magit-read-branch-or-commit) + (?n "Not merged" "--no-merged=" magit-read-branch-or-commit) + (?s "Sort" "--sort=" magit-read-ref-sort)) + :actions '((?y "Show refs, comparing them with HEAD" + magit-show-refs-head) + (?c "Show refs, comparing them with current branch" + magit-show-refs-current) + (?o "Show refs, comparing them with other branch" + magit-show-refs)) + :default-action 'magit-show-refs-head + :max-action-columns 1 + :use-prefix (lambda () + (if (derived-mode-p 'magit-refs-mode) + (if current-prefix-arg 'popup 'default) + 'popup)))) + +(magit-define-popup-keys-deferred 'magit-show-refs-popup) + +(defun magit-read-ref-sort (prompt initial-input) + (magit-completing-read prompt + '("-committerdate" "-authordate" + "committerdate" "authordate") + nil nil initial-input)) + +(defun magit-show-refs-get-buffer-args () + (cond ((and magit-use-sticky-arguments + (derived-mode-p 'magit-refs-mode)) + (cadr magit-refresh-args)) + ((and (eq magit-use-sticky-arguments t) + (--when-let (magit-mode-get-buffer 'magit-refs-mode) + (with-current-buffer it + (cadr magit-refresh-args))))) + (t + (default-value 'magit-show-refs-arguments)))) + +(defun magit-show-refs-arguments () + (if (eq magit-current-popup 'magit-show-refs-popup) + magit-current-popup-args + (magit-show-refs-get-buffer-args))) + +;;;###autoload +(defun magit-show-refs-popup (&optional arg) + "Popup console for `magit-show-refs'." + (interactive "P") + (let ((magit-show-refs-arguments (magit-show-refs-get-buffer-args))) + (magit-invoke-popup 'magit-show-refs-popup nil arg))) + +;;;###autoload +(defun magit-show-refs-head (&optional args) + "List and compare references in a dedicated buffer. +Refs are compared with `HEAD'." + (interactive (list (magit-show-refs-arguments))) + (magit-show-refs nil args)) + +;;;###autoload +(defun magit-show-refs-current (&optional args) + "List and compare references in a dedicated buffer. +Refs are compared with the current branch or `HEAD' if +it is detached." + (interactive (list (magit-show-refs-arguments))) + (magit-show-refs (magit-get-current-branch) args)) + +;;;###autoload +(defun magit-show-refs (&optional ref args) + "List and compare references in a dedicated buffer. +Refs are compared with a branch read from the user." + (interactive (list (magit-read-other-branch "Compare with") + (magit-show-refs-arguments))) + (magit-mode-setup #'magit-refs-mode ref args)) + +(defun magit-refs-set-show-commit-count () + "Change for which refs the commit count is shown." + (interactive) + (setq-local magit-refs-show-commit-count + (magit-read-char-case "Show commit counts for " nil + (?a "[a]ll refs" 'all) + (?b "[b]ranches only" t) + (?n "[n]othing" nil))) + (magit-refresh)) + +(defun magit-visit-ref () + "Visit the reference or revision at point in another buffer. +If there is no revision at point or with a prefix argument prompt +for a revision. + +This command behaves just like `magit-show-commit', except if +point is on a reference in a `magit-refs-mode' buffer (a buffer +listing branches and tags), in which case the behavior may be +different, but only if you have customized the option +`magit-visit-ref-behavior' (which see)." + (interactive) + (if (and (derived-mode-p 'magit-refs-mode) + (magit-section-match '(branch tag))) + (let ((ref (magit-section-value (magit-current-section)))) + (cond ((and (memq 'focus-on-ref magit-visit-ref-behavior) + current-prefix-arg) + (magit-show-refs ref)) + ((and (memq 'create-branch magit-visit-ref-behavior) + (magit-section-match [branch remote])) + (let ((branch (cdr (magit-split-branch-name ref)))) + (if (magit-branch-p branch) + (if (yes-or-no-p + (format "Branch %s already exists. Reset it to %s?" + branch ref)) + (magit-call-git "checkout" "-B" branch ref) + (user-error "Abort")) + (magit-call-git "checkout" "-b" branch ref)) + (setcar magit-refresh-args branch) + (magit-refresh))) + ((or (memq 'checkout-any magit-visit-ref-behavior) + (and (memq 'checkout-branch magit-visit-ref-behavior) + (magit-section-match [branch local]))) + (magit-call-git "checkout" ref) + (setcar magit-refresh-args ref) + (magit-refresh)) + (t + (call-interactively #'magit-show-commit)))) + (call-interactively #'magit-show-commit))) + +;;; Sections +;;;; Section Keymaps + +(defvar magit-branch-section-map + (let ((map (make-sparse-keymap))) + (define-key map [remap magit-visit-thing] 'magit-visit-ref) + (define-key map [remap magit-delete-thing] 'magit-branch-delete) + (define-key map "R" 'magit-branch-rename) + map) + "Keymap for `branch' sections.") + +(defvar magit-remote-section-map + (let ((map (make-sparse-keymap))) + (define-key map [remap magit-delete-thing] 'magit-remote-remove) + (define-key map "R" 'magit-remote-rename) + map) + "Keymap for `remote' sections.") + +(defvar magit-tag-section-map + (let ((map (make-sparse-keymap))) + (define-key map [remap magit-visit-thing] 'magit-visit-ref) + (define-key map [remap magit-delete-thing] 'magit-tag-delete) + map) + "Keymap for `tag' sections.") + +;;;; Section Variables + +(defconst magit-refs-branch-line-re + (concat "^" + "\\(?:[ \\*]\\) " + "\\(?1:([^)]+)\\|[^ ]+?\\)" ; branch + "\\(?: +\\)" + "\\(?2:[0-9a-fA-F]+\\) " ; sha1 + "\\(?:\\[" + "\\(?4:[^:]+\\)" ; upstream + "\\(?:: \\(?:" + "\\(?7:gone\\)\\|" ; gone + "\\(?:ahead \\(?5:[0-9]+\\)\\)?" ; ahead + "\\(?:, \\)?" + "\\(?:behind \\(?6:[0-9]+\\)\\)?" ; behind + "\\)\\)?" + "\\] \\)?" + "\\(?3:.*\\)")) ; message + +(defconst magit-refs-symref-line-re "^ \\([^ ]+\\) +-> \\(.+\\)") + +(defvar magit-refs-local-branch-format "%4c %-25n %U%m\n" + "Format used for local branches in refs buffers.") +(defvar magit-refs-remote-branch-format "%4c %-25n %m\n" + "Format used for remote branches in refs buffers.") +(defvar magit-refs-symref-format "%4c %-25n -> %m\n" + "Format used for symrefs in refs buffers.") +(defvar magit-refs-tags-format "%4c %-25n %m\n" + "Format used for tags in refs buffers.") +(defvar magit-refs-indent-cherry-lines 3 + "Indentation of cherries in refs buffers.") + +;;;; Branch Sections + +(defun magit-insert-branch-description () + "Insert header containing the description of the current branch. +Insert a header line with the name and description of the +current branch. The description is taken from the Git variable +`branch..description'; if that is undefined then no header +line is inserted at all." + (let ((branch (magit-get-current-branch))) + (-when-let* ((desc (magit-get "branch" branch "description")) + (desc-lines (split-string desc "\n"))) + (magit-insert-section (branchdesc branch t) + (magit-insert-heading branch ": " (car desc-lines)) + (insert (mapconcat 'identity (cdr desc-lines) "\n")) + (insert "\n\n"))))) + +(defun magit-insert-local-branches () + "Insert sections showing all local branches." + (magit-insert-section (local nil) + (magit-insert-heading "Branches:") + (let ((current (magit-get-current-branch)) + (branches (magit-list-local-branch-names))) + (dolist (line (magit-git-lines "branch" "-vv" + (cadr magit-refresh-args))) + (cond + ((string-match magit-refs-branch-line-re line) + (magit-bind-match-strings + (branch hash message upstream ahead behind gone) line + (when (string-match-p "(HEAD detached" branch) + (setq branch nil)) + (magit-insert-branch + branch magit-refs-local-branch-format current branches + 'magit-branch-local hash message upstream ahead behind gone))) + ((string-match magit-refs-symref-line-re line) + (magit-bind-match-strings (symref ref) line + (magit-insert-symref symref ref 'magit-branch-local)))))) + (insert ?\n) + (magit-make-margin-overlay nil t))) + +(defun magit-insert-remote-branches () + "Insert sections showing all remote-tracking branches." + (dolist (remote (magit-list-remotes)) + (magit-insert-section (remote remote) + (magit-insert-heading + (let ((pull (magit-get "remote" remote "url")) + (push (magit-get "remote" remote "pushurl"))) + (format "%s (%s):" (capitalize remote) + (concat pull (and pull push ", ") push)))) + (let ((current (magit-get-current-branch)) + (branches (magit-list-local-branch-names))) + (dolist (line (magit-git-lines "branch" "-vvr" + (cadr magit-refresh-args))) + (cond + ((string-match magit-refs-branch-line-re line) + (magit-bind-match-strings (branch hash message) line + (when (string-match-p (format "^%s/" remote) branch) + (magit-insert-branch + branch magit-refs-remote-branch-format current branches + 'magit-branch-remote hash message)))) + ((string-match magit-refs-symref-line-re line) + (magit-bind-match-strings (symref ref) line + (magit-insert-symref symref ref 'magit-branch-remote)))))) + (insert ?\n) + (magit-make-margin-overlay nil t)))) + +(defun magit-insert-branch (branch format &rest args) + "For internal use, don't add to a hook." + (unless magit-refs-show-commit-count + (setq format (replace-regexp-in-string "%[0-9]\\([cC]\\)" "%1\\1" format t))) + (if (equal branch "HEAD") + (magit-insert-section it (commit (magit-rev-parse "HEAD") t) + (apply #'magit-insert-branch-1 it nil format args)) + (magit-insert-section it (branch branch t) + (apply #'magit-insert-branch-1 it branch format args)))) + +(defun magit-insert-branch-1 + (section branch format current branches face + &optional hash message upstream ahead behind gone) + "For internal use, don't add to a hook." + (let* ((head (or (car magit-refresh-args) current "HEAD")) + (count (and branch + (magit-refs-format-commit-count branch head format))) + (mark (cond ((or (equal branch head) + (and (not branch) (equal head "HEAD"))) + (if (equal branch current) + (propertize "@" 'face 'magit-head) + (propertize "#" 'face 'magit-tag))) + ((equal branch current) + (propertize "." 'face 'magit-head))))) + (when upstream + (setq upstream (propertize upstream 'face + (if (member upstream branches) + 'magit-branch-local + 'magit-branch-remote)))) + (magit-insert-heading + (format-spec + format + `((?a . ,(or ahead "")) + (?b . ,(or behind "")) + (?c . ,(or mark count "")) + (?C . ,(or mark " ")) + (?h . ,(or (propertize hash 'face 'magit-hash) "")) + (?m . ,(or message "")) + (?n . ,(propertize (or branch "(detached)") 'face face)) + (?u . ,(or upstream "")) + (?U . ,(if upstream + (format (propertize "[%s%s] " 'face 'magit-dimmed) + upstream + (cond + (gone + (concat ": " (propertize gone 'face 'error))) + ((or ahead behind) + (concat ": " + (and ahead (format "ahead %s" ahead)) + (and ahead behind ", ") + (and behind (format "behind %s" behind)))) + (t ""))) + ""))))) + (when (magit-buffer-margin-p) + (magit-refs-format-margin branch)) + (magit-refs-insert-cherry-commits head branch section))) + +(defun magit-insert-symref (symref ref face) + "For internal use, don't add to a hook." + (magit-insert-section (commit symref) + (insert + (format-spec (if magit-refs-show-commit-count + magit-refs-symref-format + (replace-regexp-in-string "%[0-9]\\([cC]\\)" "%1\\1" + magit-refs-symref-format t)) + `((?c . "") + (?n . ,(propertize symref 'face face)) + (?m . ,(propertize ref 'face face))))))) + +(defun magit-refs-format-commit-count (ref head format &optional tag-p) + (and (string-match-p "%-?[0-9]+c" format) + (if tag-p + (eq magit-refs-show-commit-count 'all) + magit-refs-show-commit-count) + (let ((count (cadr (magit-rev-diff-count head ref)))) + (and (> count 0) + (propertize (number-to-string count) 'face 'magit-dimmed))))) + +;;;; Tag Sections + +(defun magit-insert-tags () + "Insert sections showing all tags." + (-when-let (tags (magit-git-lines "tag" "-l" "-n")) + (magit-insert-section (tags) + (magit-insert-heading "Tags:") + (let ((head (or (car magit-refresh-args) + (magit-get-current-branch) + "HEAD")) + (format (if magit-refs-show-commit-count + magit-refs-tags-format + (replace-regexp-in-string + "%[0-9]\\([cC]\\)" "%1\\1" magit-refs-tags-format t)))) + (dolist (tag (nreverse tags)) + (string-match "^\\([^ \t]+\\)[ \t]+\\([^ \t\n].*\\)?" tag) + (let* ((message (match-string 2 tag)) + (tag (match-string 1 tag)) + (count (magit-refs-format-commit-count tag head format t)) + (mark (and (equal tag head) + (propertize "#" 'face 'magit-tag)))) + (magit-insert-section section (tag tag t) + (magit-insert-heading + (format-spec format + `((?n . ,(propertize tag 'face 'magit-tag)) + (?c . ,(or mark count "")) + (?m . ,(or message ""))))) + (when (and (magit-buffer-margin-p) + magit-refs-margin-for-tags) + (magit-refs-format-margin (concat tag "^{commit}"))) + (magit-refs-insert-cherry-commits head tag section))))) + (insert ?\n) + (magit-make-margin-overlay nil t)))) + +;;;; Cherry Sections + +(defun magit-refs-insert-cherry-commits (head ref section) + (if (magit-section-hidden section) + (setf (magit-section-washer section) + (apply-partially #'magit-refs-insert-cherry-commits-1 + head ref section)) + (magit-refs-insert-cherry-commits-1 head ref section))) + +(defun magit-refs-insert-cherry-commits-1 (head ref _section) + (let ((start (point))) + (magit-git-wash (apply-partially 'magit-log-wash-log 'cherry) + "cherry" "-v" (magit-abbrev-arg) head ref magit-refresh-args) + (unless (= (point) start) + (magit-make-margin-overlay nil t)))) + +(defun magit-refs-format-margin (commit) + (save-excursion + (goto-char (line-beginning-position 0)) + (let ((line (magit-rev-format "%ct%cN" commit))) + (magit-log-format-margin (substring line 10) + (substring line 0 10))))) + +(provide 'magit-refs) +;;; magit-refs.el ends here diff --git a/elpa/magit-20161115.1658/magit-remote.el b/elpa/magit-20171009.1252/magit-remote.el similarity index 96% rename from elpa/magit-20161115.1658/magit-remote.el rename to elpa/magit-20171009.1252/magit-remote.el index d7053f0c..89817313 100644 --- a/elpa/magit-20161115.1658/magit-remote.el +++ b/elpa/magit-20171009.1252/magit-remote.el @@ -1,6 +1,6 @@ ;;; magit-remote.el --- transfer Git commits -*- lexical-binding: t -*- -;; Copyright (C) 2008-2016 The Magit Project Contributors +;; Copyright (C) 2008-2017 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. @@ -58,7 +58,7 @@ Then show the status buffer for the new repository." (let ((url (magit-read-string-ns "Clone repository"))) (list url (read-directory-name "Clone to: " nil nil nil - (and (string-match "\\([^./]+\\)\\(\\.git\\)?$" url) + (and (string-match "\\([^/:]+?\\)\\(/?\\.git\\)?$" url) (match-string 1 url)))))) (setq directory (file-name-as-directory (expand-file-name directory))) (magit-run-git-async "clone" repository @@ -90,9 +90,9 @@ Then show the status buffer for the new repository." If `ask', then always ask. If `ask-if-unset', then ask, but only if the variable isn't set already. If nil, then don't ever set. -If the value is a string, then set without asking, provided the -name of the name of the added remote is equal to that string and -the variable isn't already set." +If the value is a string, then set without asking, provided that +the name of the added remote is equal to that string and the +variable isn't already set." :package-version '(magit . "2.4.0") :group 'magit-commands :type '(choice (const :tag "ask if unset" ask-if-unset) @@ -103,8 +103,10 @@ the variable isn't already set." ;;;###autoload (autoload 'magit-remote-popup "magit-remote" nil t) (magit-define-popup magit-remote-popup "Popup console for remote commands." - 'magit-commands nil nil :man-page "git-remote" + :default-arguments '("-f") + :switches '("Switches for add" + (?f "Fetch after add" "-f")) :actions '((?a "Add" magit-remote-add) (?r "Rename" magit-remote-rename) (?k "Remove" magit-remote-remove) @@ -117,19 +119,20 @@ the variable isn't already set." url))) ;;;###autoload -(defun magit-remote-add (remote url) +(defun magit-remote-add (remote url &optional args) "Add a remote named REMOTE and fetch it." (interactive (list (magit-read-string-ns "Remote name") - (magit-read-url "Remote url"))) + (magit-read-url "Remote url") + (magit-remote-arguments))) (if (pcase (list magit-remote-add-set-remote.pushDefault - (magit-get "remote.defaultPush")) + (magit-get "remote.pushDefault")) (`(,(pred stringp) ,_) t) ((or `(ask ,_) `(ask-if-unset nil)) (y-or-n-p (format "Set `remote.pushDefault' to \"%s\"? " remote)))) - (progn (magit-call-git "remote" "add" "-f" remote url) + (progn (magit-call-git "remote" "add" args remote url) (setf (magit-get "remote.pushDefault") remote) (magit-refresh)) - (magit-run-git-async "remote" "add" "-f" remote url))) + (magit-run-git-async "remote" "add" args remote url))) ;;;###autoload (defun magit-remote-rename (old new) @@ -182,7 +185,6 @@ Delete the symbolic-ref \"refs/remotes//HEAD\"." ;;;###autoload (autoload 'magit-fetch-popup "magit-remote" nil t) (magit-define-popup magit-fetch-popup "Popup console for fetch commands." - 'magit-commands :man-page "git-fetch" :switches '((?p "Prune deleted branches" "--prune")) :actions '("Configure" @@ -278,7 +280,6 @@ removed on the respective remote." ;;;###autoload (autoload 'magit-pull-popup "magit-remote" nil t) (magit-define-popup magit-pull-popup "Popup console for pull commands." - 'magit-commands :man-page "git-pull" :variables '("Configure" (?r "branch.%s.rebase" @@ -324,7 +325,6 @@ missing. To add them use something like: (magit-define-popup-action \\='magit-pull-and-fetch-popup ?P \\='magit-get-push-branch \\='magit-fetch-from-push-remote ?F))" - 'magit-commands :man-page "git-pull" :variables '("Configure" (?r "branch.%s.rebase" @@ -423,7 +423,6 @@ removed after restarting Emacs." ;;;###autoload (autoload 'magit-push-popup "magit-remote" nil t) (magit-define-popup magit-push-popup "Popup console for push commands." - 'magit-commands :man-page "git-push" :switches `((?f "Force with lease" "--force-with-lease") (?F "Force" "--force") @@ -580,9 +579,10 @@ only available for the part before the colon, or when no colon is used." (interactive (list (magit-read-remote "Push to remote") - (completing-read-multiple - "Push refspec,s: " - (cons "HEAD" (magit-list-local-branch-names))) + (split-string (magit-completing-read-multiple + "Push refspec,s" + (cons "HEAD" (magit-list-local-branch-names))) + crm-default-separator t) (magit-push-arguments))) (run-hooks 'magit-credential-hook) (magit-run-git-async "push" "-v" args remote refspecs)) @@ -633,11 +633,11 @@ To add this command to the push popup add this to your init file: (with-eval-after-load \\='magit-remote (magit-define-popup-action \\='magit-push-popup ?P - 'magit-push-implicitly--desc - 'magit-push-implicitly ?p t)) + \\='magit-push-implicitly--desc + \\='magit-push-implicitly ?p t)) The function `magit-push-implicitly--desc' attempts to predict -what this command will do, the value it returns is displayed in +what this command will do. The value it returns is displayed in the popup buffer." (interactive (list (magit-push-arguments))) (run-hooks 'magit-credential-hook) @@ -686,8 +686,8 @@ To add this command to the push popup add this to your init file: (with-eval-after-load \\='magit-remote (magit-define-popup-action \\='magit-push-popup ?r - 'magit-push-to-remote--desc - 'magit-push-to-remote ?p t))" + \\='magit-push-to-remote--desc + \\='magit-push-to-remote ?p t))" (interactive (list (magit-read-remote "Push to remote") (magit-push-arguments))) (run-hooks 'magit-credential-hook) @@ -701,7 +701,6 @@ To add this command to the push popup add this to your init file: ;;;###autoload (autoload 'magit-patch-popup "magit-remote" nil t) (magit-define-popup magit-patch-popup "Popup console for patch commands." - 'magit-commands :man-page "git-format-patch" :switches '("Switches for formatting patches" (?l "Add cover letter" "--cover-letter")) @@ -728,7 +727,7 @@ To add this command to the push popup add this to your init file: When a single commit is given for RANGE, create a patch for the changes introduced by that commit (unlike 'git format-patch' which creates patches for all commits that are reachable from -HEAD but not from the specified commit)." +`HEAD' but not from the specified commit)." (interactive (list (-if-let (revs (magit-region-values 'commit)) (concat (car (last revs)) "^.." (car revs)) @@ -768,9 +767,5 @@ is asked to pull. START has to be reachable from that commit." (magit-git-insert "request-pull" start url end) (set-buffer-modified-p nil)) -;;; magit-remote.el ends soon (provide 'magit-remote) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-remote.el ends here diff --git a/elpa/magit-20171009.1252/magit-repos.el b/elpa/magit-20171009.1252/magit-repos.el new file mode 100644 index 00000000..2b31ae5a --- /dev/null +++ b/elpa/magit-20171009.1252/magit-repos.el @@ -0,0 +1,308 @@ +;;; magit-repos.el --- listing repositories -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for listing repositories. This +;; includes getting a Lisp list of known repositories as well as a +;; mode for listing repositories in a buffer. + +;;; Code: + +(require 'magit-core) + +(declare-function magit-status-internal 'magit-status) + +(defvar x-stretch-cursor) + +;;; Options + +(defcustom magit-repository-directories nil + "List of directories that are or contain Git repositories. + +Each element has the form (DIRECTORY . DEPTH) or, for backward +compatibility, just DIRECTORY. 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. + +For backward compatibility reasons an element may be a string, +instead of a cons-cell, in which case the value of the obsolete +option `magit-repository-directories-depth' specifies the depth." + :package-version '(magit . "2.8.0") + :group 'magit-essentials + :type '(repeat (choice (cons directory (integer :tag "Depth")) directory))) + +(defvar magit-repository-directories-depth 3 + "The maximum depth to look for Git repositories. +This variable is obsolete and only used for elements of the +option `magit-repository-directories' (which see) that don't +specify the depth directly.") + +(defgroup magit-repolist nil + "List repositories in a buffer." + :link '(info-link "(magit)Repository List") + :group 'magit-modes) + +(defcustom magit-repolist-mode-hook '(hl-line-mode) + "Hook run after entering Magit-Repolist mode." + :package-version '(magit . "2.9.0") + :group 'magit-repolist + :type 'hook + :get 'magit-hook-custom-get + :options '(hl-line-mode)) + +(defcustom magit-repolist-columns + '(("Name" 25 magit-repolist-column-ident nil) + ("Version" 25 magit-repolist-column-version nil) + ("BU" 3 magit-repolist-column-unpushed-to-upstream ((:right-align t))) + ("Path" 99 magit-repolist-column-path nil)) + "List of columns displayed by `magit-list-repositories'. + +Each element has the form (HEADER WIDTH FORMAT PROPS). + +HEADER is the string displayed in the header. WIDTH is the width +of the column. FORMAT is a function that is called with one +argument, the repository identification (usually its basename), +and with `default-directory' bound to the toplevel of its working +tree. It has to return a string to be inserted or nil. PROPS is +an alist that supports the keys `:right-align' and `:pad-right'." + :package-version '(magit . "2.8.0") + :group 'magit-repolist + :type `(repeat (list :tag "Column" + (string :tag "Header Label") + (integer :tag "Column Width") + (function :tag "Inserter Function") + (repeat :tag "Properties" + (list (choice :tag "Property" + (const :right-align) + (const :pad-right) + (symbol)) + (sexp :tag "Value")))))) + + +;;; List Repositories +;;;; Command +;;;###autoload +(defun magit-list-repositories () + "Display a list of repositories. + +Use the options `magit-repository-directories' +and `magit-repository-directories-depth' to +control which repositories are displayed." + (interactive) + (if magit-repository-directories + (with-current-buffer (get-buffer-create "*Magit Repositories*") + (magit-repolist-mode) + (setq tabulated-list-entries + (mapcar (-lambda ((id . path)) + (let ((default-directory path)) + (list path + (vconcat (--map (or (funcall (nth 2 it) id) "") + magit-repolist-columns))))) + (magit-list-repos-uniquify + (--map (cons (file-name-nondirectory (directory-file-name it)) + it) + (magit-list-repos))))) + (tabulated-list-print) + (switch-to-buffer (current-buffer))) + (message "You need to customize `magit-repository-directories' %s" + "before you can list repositories"))) + +;;;; Mode + +(defvar magit-repolist-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map tabulated-list-mode-map) + (define-key map "g" 'magit-list-repositories) + (define-key map (if (featurep 'jkl) [return] (kbd "C-m")) + 'magit-repolist-status) + map) + "Local keymap for Magit-Repolist mode buffers.") + +(defun magit-repolist-status (&optional _button) + "Show the status for the repository at point." + (interactive) + (--if-let (tabulated-list-get-id) + (magit-status-internal (expand-file-name it)) + (user-error "There is no repository at point"))) + +(define-derived-mode magit-repolist-mode tabulated-list-mode "Repos" + "Major mode for browsing a list of Git repositories." + (setq x-stretch-cursor nil) + (setq tabulated-list-padding 0) + (setq tabulated-list-sort-key (cons "Name" nil)) + (setq tabulated-list-format + (vconcat (mapcar (-lambda ((title width _fn props)) + (nconc (list title width t) + (-flatten props))) + magit-repolist-columns))) + (tabulated-list-init-header) + (setq imenu-prev-index-position-function + 'magit-imenu--repolist-prev-index-position-function) + (setq imenu-extract-index-name-function + 'magit-imenu--repolist-extract-index-name-function)) + +;;;; Columns + +(defun magit-repolist-column-ident (id) + "Insert the identification of the repository. +Usually this is just its basename." + id) + +(defun magit-repolist-column-path (_id) + "Insert the absolute path of the repository." + (abbreviate-file-name default-directory)) + +(defun magit-repolist-column-version (_id) + "Insert a description of the repository's `HEAD' revision." + (let ((v (or (magit-git-string "describe" "--tags") + ;; 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")))) + (if (and v (string-match-p "\\`[0-9]" v)) + (concat " " v) + v))) + +(defun magit-repolist-column-branch (_id) + "Insert the current branch." + (magit-get-current-branch)) + +(defun magit-repolist-column-upstream (_id) + "Insert the upstream branch of the current branch." + (magit-get-upstream-branch)) + +(defun magit-repolist-column-dirty (_id) + "Insert a letter if there are uncommitted changes. + +Show N if there is at least one untracked file. +Show U if there is at least one unstaged file. +Show S if there is at least one staged file. +Only one letter is shown, the first that applies." + (cond ((magit-untracked-files) "N") + ((magit-unstaged-files) "U") + ((magit-staged-files) "S"))) + +(defun magit-repolist-column-unpulled-from-upstream (_id) + "Insert number of upstream commits not in the current branch." + (--when-let (magit-get-upstream-branch nil t) + (let ((n (cadr (magit-rev-diff-count "HEAD" it)))) + (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow))))) + +(defun magit-repolist-column-unpulled-from-pushremote (_id) + "Insert number of commits in the push branch but not the current branch." + (--when-let (magit-get-push-branch nil t) + (let ((n (cadr (magit-rev-diff-count "HEAD" it)))) + (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow))))) + +(defun magit-repolist-column-unpushed-to-upstream (_id) + "Insert number of commits in the current branch but not its upstream." + (--when-let (magit-get-upstream-branch nil t) + (let ((n (car (magit-rev-diff-count "HEAD" it)))) + (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow))))) + +(defun magit-repolist-column-unpushed-to-pushremote (_id) + "Insert number of commits in the current branch but not its push branch." + (--when-let (magit-get-push-branch nil t) + (let ((n (car (magit-rev-diff-count "HEAD" it)))) + (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow))))) + +(defun magit-repolist-column-branches (_id) + "Insert number of branches." + (let ((n (length (magit-list-local-branches)))) + (propertize (number-to-string n) 'face (if (> n 1) 'bold 'shadow)))) + +(defun magit-repolist-column-stashes (_id) + "Insert number of stashes." + (let ((n (length (magit-list-stashes)))) + (propertize (number-to-string n) 'face (if (> n 0) 'bold 'shadow)))) + +;;; Read Repository + +(defun magit-read-repository (&optional read-directory-name) + "Read a Git repository in the minibuffer, with completion. + +The completion choices are the basenames of top-levels of +repositories found in the directories specified by option +`magit-repository-directories'. In case of name conflicts +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 (and (not read-directory-name) magit-repository-directories) + (let* ((repos (magit-list-repos-uniquify + (--map (cons (file-name-nondirectory + (directory-file-name it)) + it) + (magit-list-repos)))) + (reply (magit-completing-read "Git repository" repos))) + (file-name-as-directory + (or (cdr (assoc reply repos)) + (if (file-directory-p reply) + (expand-file-name reply) + (user-error "Not a repository or a directory: %s" reply))))) + (file-name-as-directory + (read-directory-name "Git repository: " + (or (magit-toplevel) default-directory))))) + +(defun magit-list-repos () + (--mapcat (if (consp it) + (magit-list-repos-1 (car it) (cdr it)) + (magit-list-repos-1 it magit-repository-directories-depth)) + magit-repository-directories)) + +(defun magit-list-repos-1 (directory depth) + (cond ((file-readable-p (expand-file-name ".git" directory)) + (list directory)) + ((and (> depth 0) (magit-file-accessible-directory-p directory)) + (--mapcat (and (file-directory-p it) + (magit-list-repos-1 it (1- depth))) + (directory-files directory t + directory-files-no-dot-files-regexp t))))) + +(defun magit-list-repos-uniquify (alist) + (let (result (dict (make-hash-table :test 'equal))) + (dolist (a (delete-dups alist)) + (puthash (car a) (cons (cdr a) (gethash (car a) dict)) dict)) + (maphash + (lambda (key value) + (if (= (length value) 1) + (push (cons key (car value)) result) + (setq result + (append result + (magit-list-repos-uniquify + (--map (cons (concat + key "\\" + (file-name-nondirectory + (directory-file-name + (substring it 0 (- (1+ (length key))))))) + it) + value)))))) + dict) + result)) + +(provide 'magit-repos) +;;; magit-repos.el ends here diff --git a/elpa/magit-20161115.1658/magit-section.el b/elpa/magit-20171009.1252/magit-section.el similarity index 90% rename from elpa/magit-20161115.1658/magit-section.el rename to elpa/magit-20171009.1252/magit-section.el index 74adf91a..288fe513 100644 --- a/elpa/magit-20161115.1658/magit-section.el +++ b/elpa/magit-20171009.1252/magit-section.el @@ -1,6 +1,6 @@ ;;; magit-section.el --- section functionality -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -24,7 +24,7 @@ ;;; Commentary: ;; This library implements "sections" as used in all Magit buffers. -;; If you have used Magit before then you probably know what that +;; If you have used Magit before, then you probably know what that ;; means, otherwise think "read-only Org-Mode for Git", kinda. ;;; Code: @@ -34,16 +34,19 @@ (require 'magit-utils) +(declare-function magit-maybe-make-margin-overlay 'magit-log) (defvar magit-keep-region-overlay) ;;; Options (defgroup magit-section nil "Expandable sections." + :link '(info-link "(magit)Sections") :group 'magit) (defcustom magit-section-show-child-count t - "Whether to append the number of children to section headings." + "Whether to append the number of children to section headings. +This only applies to sections for which doing so makes sense." :package-version '(magit . "2.1.0") :group 'magit-section :type 'boolean) @@ -95,7 +98,7 @@ diff-related sections being the only exception." magit-section-set-visibility-from-cache) "Hook used to set the initial visibility of a section. Stop at the first function that returns non-nil. The value -should be `show' or `hide'. If no function returns non-nil +should be `show' or `hide'. If no function returns non-nil, determine the visibility as usual, i.e. use the hardcoded section specific default (see `magit-insert-section')." :package-version '(magit . "2.4.0") @@ -269,7 +272,7 @@ If there is no previous sibling section, then move to the parent." (set-window-start (selected-window) (magit-section-start section)))) (defun magit-hunk-set-window-start (section) - "Ensure the beginning of the `hunk' SECTION is visible. + "When SECTION is a `hunk', ensure that its beginning is visible. It the SECTION has a different type, then do nothing." (when (eq (magit-section-type section) 'hunk) (magit-section-set-window-start section))) @@ -349,7 +352,7 @@ With a prefix argument also expand it." heading) (interactive (list (magit-current-section))) (goto-char (magit-section-start section)) (let* ((children (magit-section-children section)) - (show (-any? 'magit-section-hidden children))) + (show (-any-p 'magit-section-hidden children))) (dolist (c children) (setf (magit-section-hidden c) show))) (magit-section-show section)) @@ -399,10 +402,10 @@ hidden." (progn (magit-section-show section) (magit-section-hide-children section)) (let ((children (magit-section-children section))) - (cond ((and (-any? 'magit-section-hidden children) - (-any? 'magit-section-children children)) + (cond ((and (-any-p 'magit-section-hidden children) + (-any-p 'magit-section-children children)) (magit-section-show-headings section)) - ((-any? 'magit-section-hidden-body children) + ((-any-p 'magit-section-hidden-body children) (magit-section-show-children section)) (t (magit-section-hide section)))))) @@ -411,10 +414,10 @@ hidden." "Cycle visibility of all sections in the current buffer." (interactive) (let ((children (magit-section-children magit-root-section))) - (cond ((and (-any? 'magit-section-hidden children) - (-any? 'magit-section-children children)) + (cond ((and (-any-p 'magit-section-hidden children) + (-any-p 'magit-section-children children)) (magit-section-show-headings magit-root-section)) - ((-any? 'magit-section-hidden-body children) + ((-any-p 'magit-section-hidden-body children) (magit-section-show-children magit-root-section)) (t (mapc 'magit-section-hide children))))) @@ -434,22 +437,22 @@ hidden." ((derived-mode-p 'magit-diff-mode) (--filter (eq (magit-section-type it) 'file) (magit-section-children magit-root-section))))) - (if (-any? 'magit-section-hidden sections) + (if (-any-p 'magit-section-hidden sections) (dolist (s sections) (magit-section-show s) (magit-section-hide-children s)) (let ((children (-mapcat 'magit-section-children sections))) - (cond ((and (-any? 'magit-section-hidden children) - (-any? 'magit-section-children children)) + (cond ((and (-any-p 'magit-section-hidden children) + (-any-p 'magit-section-children children)) (mapc 'magit-section-show-headings sections)) - ((-any? 'magit-section-hidden-body children) + ((-any-p 'magit-section-hidden-body children) (mapc 'magit-section-show-children sections)) (t (mapc 'magit-section-hide sections))))))) (defun magit-section-hidden-body (section &optional pred) (--if-let (magit-section-children section) - (funcall (or pred '-any?) 'magit-section-hidden-body it) + (funcall (or pred '-any-p) 'magit-section-hidden-body it) (and (magit-section-content section) (magit-section-hidden section)))) @@ -463,7 +466,7 @@ SECTION's body (and heading) obviously cannot be visible." (defun magit-section-show-level (level) "Show surrounding sections up to LEVEL. -If LEVEL is negative show up to the absolute value. +If LEVEL is negative, show up to the absolute value. Sections at higher levels are hidden." (if (< level 0) (let ((s (magit-current-section))) @@ -555,11 +558,16 @@ Each TYPE is a symbol. Note that it is not necessary to specify all TYPEs up to the root section as printed by `magit-describe-type', unless of course you want to be that precise." - ;; When recursing SECTION actually is a type list. Matching - ;; macros also pass such a list instead of a section struct. + ;; For backward compatibility reasons SECTION can also be a + ;; type-list as understood by `magit-section-match-1'. This + ;; includes uses of the macros `magit-section-when' and + ;; `magit-section-case' that did not get recompiled after + ;; this function was changed. (and section (magit-section-match-1 condition - (mapcar #'car (magit-section-ident section))))) + (if (magit-section-p section) + (mapcar #'car (magit-section-ident section)) + section)))) (defun magit-section-match-1 (condition type-list) (if (listp condition) @@ -580,18 +588,23 @@ precise." (magit-section-match-2 (cdr l1) (cdr l2)))))) (defmacro magit-section-when (condition &rest body) - "If the section at point matches CONDITION evaluate BODY. + "If the section at point matches CONDITION, evaluate BODY. If the section matches, then evaluate BODY forms sequentially with `it' bound to the section and return the value of the last form. If there are no BODY forms, then return the value of the section. If the section does not match or if there is no section -at point then return nil. +at point, then return nil. See `magit-section-match' for the forms CONDITION can take." (declare (indent 1) (debug (sexp body))) `(--when-let (magit-current-section) + ;; Quoting CONDITION here often leads to double-quotes, which + ;; isn't an issue because `magit-section-match-1' implicitly + ;; deals with that. We shouldn't force users of this function + ;; to not quote CONDITION because that would needlessly break + ;; backward compatibility. (when (magit-section-match ',condition it) ,@(or body '((magit-section-value it)))))) @@ -603,7 +616,7 @@ section is compared against each CONDITION; the BODY forms of the first match are evaluated sequentially and the value of the last form is returned. Inside BODY the symbol `it' is bound to the section at point. If no clause succeeds or if there is no -section at point return nil. +section at point, return nil. See `magit-section-match' for the forms CONDITION can take. Additionally a CONDITION of t is allowed in the final clause, and @@ -757,7 +770,7 @@ The `content' property of the section struct is the end of the heading (which lasts from `start' to `content') and the beginning of the the body (which lasts from `content' to `end'). If the value of `content' is nil, then the section has no heading and -its body cannot be collapsed. If a section does have a heading +its body cannot be collapsed. If a section does have a heading, then its height must be exactly one line, including a trailing newline character. This isn't enforced, you are responsible for getting it right. The only exception is that this function does @@ -770,9 +783,11 @@ insert a newline character if necessary." (propertize heading 'face 'magit-section-heading))))) (unless (bolp) (insert ?\n)) + (magit-maybe-make-margin-overlay) (setf (magit-section-content magit-insert-section--current) (point-marker))) -(defvar magit-insert-headers-hook nil "For internal use only.") +(defvar magit-insert-headers--hook nil "For internal use only.") +(defvar magit-insert-headers--beginning nil "For internal use only.") (defun magit-insert-headers (hooks) (let ((magit-insert-section-hook @@ -780,18 +795,19 @@ insert a newline character if necessary." (if (listp magit-insert-section-hook) magit-insert-section-hook (list magit-insert-section-hook)))) - (magit-insert-headers-hook hooks) + (magit-insert-headers--hook hooks) wrapper) - (while (and (setq wrapper (pop magit-insert-headers-hook)) - (= (point) (point-min))) + (setq magit-insert-headers--beginning (point)) + (while (and (setq wrapper (pop magit-insert-headers--hook)) + (= (point) magit-insert-headers--beginning)) (funcall wrapper)))) (defun magit-insert-remaining-headers () - (if (= (point) (point-min)) + (if (= (point) magit-insert-headers--beginning) (magit-cancel-section) (magit-insert-heading) (remove-hook 'magit-insert-section-hook 'magit-insert-remaining-headers) - (mapc #'funcall magit-insert-headers-hook) + (mapc #'funcall magit-insert-headers--hook) (insert "\n"))) (defun magit-insert-child-count (section) @@ -823,7 +839,11 @@ evaluated its BODY. Admittedly that's a bit of a hack." (defvar-local magit-section-unhighlight-sections nil) (defun magit-section-update-region (_) - ;; Don't show complete region. Highlighting emphasizes headings. + "When the region is a valid section-selection, highlight them all." + ;; At least that's what it does conceptually. In actuality it just + ;; returns a list of those sections, and it doesn't even matter if + ;; this is a member of `magit-region-highlight-hook'. It probably + ;; should be removed, but I want to make sure before removing it. (magit-region-sections)) (defun magit-section-update-highlight () @@ -833,9 +853,10 @@ evaluated its BODY. Admittedly that's a bit of a hack." (deactivate-mark nil) (selection (magit-region-sections))) (mapc #'delete-overlay magit-section-highlight-overlays) + (setq magit-section-highlight-overlays nil) (setq magit-section-unhighlight-sections - magit-section-highlighted-sections - magit-section-highlighted-sections nil) + magit-section-highlighted-sections) + (setq magit-section-highlighted-sections nil) (unless (eq section magit-root-section) (run-hook-with-args-until-success 'magit-section-highlight-hook section selection)) @@ -849,7 +870,7 @@ evaluated its BODY. Admittedly that's a bit of a hack." (setq deactivate-mark nil)))) (defun magit-section-highlight (section selection) - "Highlight SECTION and if non-nil all SELECTION. + "Highlight SECTION and if non-nil all sections in SELECTION. This function works for any section but produces undesirable effects for diff related sections, which by default are highlighted using `magit-diff-highlight'. Return t." @@ -865,8 +886,8 @@ highlighted using `magit-diff-highlight'. Return t." t) (defun magit-section-highlight-selection (_ selection) - "Highlight the section selection region. -If SELECTION is non-nil then it is a list of sections selected by + "Highlight the section-selection region. +If SELECTION is non-nil, then it is a list of sections selected by the region. The headings of these sections are then highlighted. This is a fallback for people who don't want to highlight the @@ -1013,9 +1034,9 @@ either `hide' or nil." (defun magit-section-siblings (section &optional direction) "Return a list of the sibling sections of SECTION. -If optional DIRECTION is `prev' then return siblings that come -before SECTION, if it is `next' then return siblings that come -after SECTION. For all other values return all siblings +If optional DIRECTION is `prev', then return siblings that come +before SECTION. If it is `next', then return siblings that come +after SECTION. For all other values, return all siblings excluding SECTION itself." (-when-let (parent (magit-section-parent section)) (let ((siblings (magit-section-children parent))) @@ -1053,7 +1074,7 @@ apply to diffs where things get a bit more complicated, but even here if the region looks like it usually does, then that's not a valid selection as far as this function is concerned. -If optional TYPES is non-nil then the selection not only has to +If optional TYPES is non-nil, then the selection not only has to be valid; the types of all selected sections additionally have to match one of TYPES, or nil is returned." (when (use-region-p) @@ -1094,6 +1115,27 @@ If optional SECTION is nil, use the current section." (magit-section-position-in-heading-p section (region-end)))) t)) +(defun magit-section--backward-protected () + "Move to the beginning of the current or the previous visible section. +Same as `magit-section-backward' but for non-interactive use. +Suppress `magit-section-movement-hook', and return a boolean to +indicate whether a section was found, instead of raising an error +if not." + (condition-case nil + (let ((magit-section-movement-hook nil)) + (magit-section-backward) + t) + (user-error nil))) + +(defun magit-section--backward-find (predicate) + "Move to the first previous section satisfying PREDICATE. +PREDICATE does not take any parameter and should not move +point." + (let (found) + (while (and (setq found (magit-section--backward-protected)) + (not (funcall predicate)))) + found)) + (defun magit-wash-sequence (function) "Repeatedly call FUNCTION until it returns nil or eob is reached. FUNCTION has to move point forward or return nil." @@ -1104,7 +1146,7 @@ FUNCTION has to move point forward or return nil." Add FUNCTION at the beginning of the hook list unless optional APPEND is non-nil, in which case FUNCTION is added at the end. -If FUNCTION already is a member then move it to the new location. +If FUNCTION already is a member, then move it to the new location. If optional AT is non-nil and a member of the hook list, then add FUNCTION next to that instead. Add before or after AT, or @@ -1156,9 +1198,20 @@ again use `remove-hook'." (set hook value) (set-default hook value)))) -;;; magit-section.el ends soon +(defun magit-run-section-hook (hook) + "Run HOOK, warning about invalid entries." + (--if-let (-remove #'functionp (symbol-value hook)) + (progn + (message "`%s' contains entries that are no longer valid. +%s\nUsing standard value instead. Please re-configure hook variable." + hook + (mapconcat (lambda (sym) (format " `%s'" sym)) it "\n")) + (sit-for 5) + (defvar magit--hook-standard-value nil) + (let ((magit--hook-standard-value + (eval (car (get hook 'standard-value))))) + (run-hooks 'magit---hook-standard-value))) + (run-hooks hook))) + (provide 'magit-section) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-section.el ends here diff --git a/elpa/magit-20161115.1658/magit-sequence.el b/elpa/magit-20171009.1252/magit-sequence.el similarity index 89% rename from elpa/magit-20161115.1658/magit-sequence.el rename to elpa/magit-20171009.1252/magit-sequence.el index 19b13924..91372687 100644 --- a/elpa/magit-20161115.1658/magit-sequence.el +++ b/elpa/magit-20171009.1252/magit-sequence.el @@ -1,6 +1,6 @@ ;;; magit-sequence.el --- history manipulation in Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2016 The Magit Project Contributors +;; Copyright (C) 2011-2017 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. @@ -114,14 +114,13 @@ This discards all changes made since the sequence started." ;;;###autoload (autoload 'magit-cherry-pick-popup "magit-sequence" nil t) (magit-define-popup magit-cherry-pick-popup "Popup console for cherry-pick commands." - 'magit-commands :man-page "git-cherry-pick" :switches '((?s "Add Signed-off-by lines" "--signoff") (?e "Edit commit messages" "--edit") (?x "Reference cherry in commit message" "-x") - (?F "Attempt fast-forward" "--ff") - (?m "Reply merge relative to parent" "--mainline=")) - :options '((?s "Strategy" "--strategy=")) + (?F "Attempt fast-forward" "--ff")) + :options '((?s "Strategy" "--strategy=") + (?m "Replay merge relative to parent" "--mainline=")) :actions '((?A "Cherry Pick" magit-cherry-pick) (?a "Cherry Apply" magit-cherry-apply)) :sequence-actions '((?A "Continue" magit-sequencer-continue) @@ -142,10 +141,11 @@ Prompt for a commit, defaulting to the commit at point. If the region selects multiple commits, then pick all of them, without prompting." (interactive (magit-cherry-pick-read-args "Cherry-pick")) - (magit-assert-one-parent (car (if (listp commit) - commit - (split-string commit "\\.\\."))) - "cherry-pick") + (unless (--any (string-prefix-p "--mainline" it) args) + (magit-assert-one-parent (car (if (listp commit) + commit + (split-string commit "\\.\\."))) + "cherry-pick")) (magit-run-git-sequencer "cherry-pick" args commit)) ;;;###autoload @@ -155,7 +155,8 @@ Prompt for a commit, defaulting to the commit at point. If the region selects multiple commits, then apply all of them, without prompting." (interactive (magit-cherry-pick-read-args "Apply changes from commit")) - (magit-assert-one-parent commit "cherry-pick") + (unless (--any (string-prefix-p "--mainline" it) args) + (magit-assert-one-parent commit "cherry-pick")) (magit-run-git-sequencer "cherry-pick" "--no-commit" (remove "--ff" args) commit)) @@ -168,11 +169,11 @@ without prompting." ;;;###autoload (autoload 'magit-revert-popup "magit-sequence" nil t) (magit-define-popup magit-revert-popup "Popup console for revert commands." - 'magit-commands :man-page "git-revert" :switches '((?s "Add Signed-off-by lines" "--signoff")) :options '((?s "Strategy" "--strategy=") - (?S "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key)) + (?S "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key) + (?m "Replay merge relative to parent" "--mainline=")) :actions '((?V "Revert commit(s)" magit-revert) (?v "Revert changes" magit-revert-no-commit)) :sequence-actions '((?V "Continue" magit-sequencer-continue) @@ -192,7 +193,8 @@ Prompt for a commit, defaulting to the commit at point. If the region selects multiple commits, then revert all of them, without prompting." (interactive (magit-revert-read-args "Revert commit")) - (magit-assert-one-parent commit "revert") + (unless (--any (string-prefix-p "--mainline" it) args) + (magit-assert-one-parent commit "revert")) (magit-run-git-sequencer "revert" args commit)) ;;;###autoload @@ -202,7 +204,8 @@ Prompt for a commit, defaulting to the commit at point. If the region selects multiple commits, then revert all of them, without prompting." (interactive (magit-revert-read-args "Revert changes")) - (magit-assert-one-parent commit "revert") + (unless (--any (string-prefix-p "--mainline" it) args) + (magit-assert-one-parent commit "revert")) (magit-run-git-sequencer "revert" "--no-commit" args commit)) (defun magit-revert-in-progress-p () @@ -214,7 +217,6 @@ without prompting." ;;;###autoload (autoload 'magit-am-popup "magit-sequence" nil t) (magit-define-popup magit-am-popup "Popup console for mailbox commands." - 'magit-commands :man-page "git-am" :switches '((?3 "Fall back on 3way merge" "--3way") (?s "Add Signed-off-by lines" "--signoff") @@ -290,14 +292,14 @@ This discards all changes made since the sequence started." ;;;###autoload (autoload 'magit-rebase-popup "magit-sequence" nil t) (magit-define-popup magit-rebase-popup "Key menu for rebasing." - 'magit-commands :man-page "git-rebase" - :switches '((?k "Keep empty commits" "--keep-empty") - (?p "Preserve merges" "--preserve-merges") - (?c "Lie about author date" "--committer-date-is-author-date") - (?a "Autosquash" "--autosquash") - (?A "Autostash" "--autostash") - (?i "Interactive" "--interactive")) + :switches '((?k "Keep empty commits" "--keep-empty") + (?p "Preserve merges" "--preserve-merges") + (?c "Lie about committer date" "--committer-date-is-author-date") + (?a "Autosquash" "--autosquash") + (?A "Autostash" "--autostash") + (?i "Interactive" "--interactive") + (?h "Disable hooks" "--no-verify")) :actions '((lambda () (concat (propertize "Rebase " 'face 'magit-popup-heading) (propertize (or (magit-get-current-branch) "HEAD") @@ -352,7 +354,7 @@ If that variable is unset, then rebase onto `remote.pushDefault'." ;;;###autoload (defun magit-rebase (target args) "Rebase the current branch onto a branch read in the minibuffer. -All commits that are reachable from head but not from the +All commits that are reachable from `HEAD' but not from the selected branch TARGET are being rebased." (interactive (list (magit-read-other-branch-or-commit "Rebase onto") (magit-rebase-arguments))) @@ -362,7 +364,7 @@ selected branch TARGET are being rebased." ;;;###autoload (defun magit-rebase-subset (newbase start args) - "Rebase a subset of the current branches history onto a new base. + "Rebase a subset of the current branch's history onto a new base. Rebase commits from START to `HEAD' onto NEWBASE. START has to be selected from a list of recent commits." (interactive (list (magit-read-other-branch-or-commit @@ -525,8 +527,8 @@ If no such sequence is in progress, do nothing." (let ((patches (nreverse (magit-rebase-patches))) patch commit) (while patches - (setq patch (pop patches) - commit (magit-rev-verify-commit + (setq patch (pop patches)) + (setq commit (magit-rev-verify-commit (cadr (split-string (magit-file-line patch))))) (cond ((and commit patches) (magit-sequence-insert-commit @@ -562,17 +564,11 @@ If no such sequence is in progress, do nothing." (magit-insert-section (rebase-sequence) (magit-insert-heading (format "Rebasing %s onto %s" name onto)) (if interactive - (magit-rebase-insert-merge-sequence) - (magit-rebase-insert-apply-sequence)) - (magit-sequence-insert-sequence - (magit-file-line - (magit-git-dir - (concat dir (if interactive "stopped-sha" "original-commit")))) - onto (--map (cadr (split-string it)) - (magit-file-lines (magit-git-dir "rebase-merge/done")))) + (magit-rebase-insert-merge-sequence onto) + (magit-rebase-insert-apply-sequence onto)) (insert ?\n))))) -(defun magit-rebase-insert-merge-sequence () +(defun magit-rebase-insert-merge-sequence (onto) (dolist (line (nreverse (magit-file-lines (magit-git-dir "rebase-merge/git-rebase-todo")))) @@ -581,12 +577,27 @@ If no such sequence is in progress, do nothing." (or (magit-get "core.commentChar") "#"))) line) (magit-bind-match-strings (action hash) line - (magit-sequence-insert-commit action hash 'magit-sequence-pick))))) - -(defun magit-rebase-insert-apply-sequence () - (dolist (patch (nreverse (cdr (magit-rebase-patches)))) - (magit-sequence-insert-commit - "pick" (cadr (split-string (magit-file-line patch))) 'magit-sequence-pick))) + (unless (equal action "exec") + (magit-sequence-insert-commit action hash 'magit-sequence-pick))))) + (magit-sequence-insert-sequence + (magit-file-line (magit-git-dir "rebase-merge/stopped-sha")) + onto + (--when-let (magit-file-lines (magit-git-dir "rebase-merge/done")) + (cadr (split-string (car (last it))))))) + +(defun magit-rebase-insert-apply-sequence (onto) + (let ((rewritten + (--map (car (split-string it)) + (magit-file-lines (magit-git-dir "rebase-apply/rewritten")))) + (stop (magit-file-line (magit-git-dir "rebase-apply/original-commit")))) + (dolist (patch (nreverse (cdr (magit-rebase-patches)))) + (let ((hash (cadr (split-string (magit-file-line patch))))) + (unless (or (member hash rewritten) + (equal hash stop)) + (magit-sequence-insert-commit "pick" hash 'magit-sequence-pick))))) + (magit-sequence-insert-sequence + (magit-file-line (magit-git-dir "rebase-apply/original-commit")) + onto)) (defun magit-rebase-patches () (directory-files (magit-git-dir "rebase-apply") t "^[0-9]\\{4\\}$")) @@ -610,8 +621,9 @@ If no such sequence is in progress, do nothing." ((magit-anything-modified-p t) ;; ...and the dust hasn't settled yet... (magit-sequence-insert-commit - (let ((staged (magit-commit-tree "oO" nil "HEAD")) - (unstaged (magit-commit-worktree "oO" "--reset"))) + (let* ((magit--refresh-cache nil) + (staged (magit-commit-tree "oO" nil "HEAD")) + (unstaged (magit-commit-worktree "oO" "--reset"))) (cond ;; ...but we could end up at the same tree just by committing. ((or (magit-rev-equal staged stop) @@ -636,10 +648,10 @@ If no such sequence is in progress, do nothing." ;; ...but its reincarnation lives on. ;; Or it didn't die in the first place. (list (if (and (equal rev head) - (equal (magit-patch-id (concat stop "^")) - (magit-patch-id (car (last orig 2))))) + (equal (magit-patch-id rev) + (magit-patch-id orig))) "stop" ; We haven't done anything yet. - "same") ; There are new commits. + "like") ; There are new commits. rev (if (equal rev head) 'magit-sequence-head 'magit-sequence-stop))) @@ -657,9 +669,5 @@ If no such sequence is in progress, do nothing." (insert (propertize type 'face face) ?\s (magit-format-rev-summary hash) ?\n))) -;;; magit-sequence.el ends soon (provide 'magit-sequence) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-sequence.el ends here diff --git a/elpa/magit-20161115.1658/magit-stash.el b/elpa/magit-20171009.1252/magit-stash.el similarity index 86% rename from elpa/magit-20161115.1658/magit-stash.el rename to elpa/magit-20171009.1252/magit-stash.el index 5bbd216a..fee6f068 100644 --- a/elpa/magit-20161115.1658/magit-stash.el +++ b/elpa/magit-20171009.1252/magit-stash.el @@ -1,6 +1,6 @@ ;;; magit-stash.el --- stash support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2008-2016 The Magit Project Contributors +;; Copyright (C) 2008-2017 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. @@ -29,12 +29,60 @@ (require 'magit) +(defvar bookmark-make-record-function) + +;;; Options + +(defgroup magit-stash nil + "List stashes and show stash diffs." + :group 'magit-modes) + +;;;; Diff options + +(defcustom magit-stash-sections-hook + '(magit-insert-stash-worktree + magit-insert-stash-index + magit-insert-stash-untracked) + "Hook run to insert sections into stash diff buffers." + :package-version '(magit . "2.1.0") + :group 'magit-stash + :type 'hook) + +;;;; Log options + +(defcustom magit-stashes-margin + (list (nth 0 magit-log-margin) + (nth 1 magit-log-margin) + 'magit-log-margin-width nil + (nth 4 magit-log-margin)) + "Format of the margin in `magit-stashes-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") + :group 'magit-stash + :group 'magit-margin + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set-after '(magit-log-margin) + :set (apply-partially #'magit-margin-set-variable 'magit-stashes-mode)) + ;;; Commands ;;;###autoload (autoload 'magit-stash-popup "magit-stash" nil t) (magit-define-popup magit-stash-popup "Popup console for stash commands." - 'magit-commands :man-page "git-stash" :switches '((?u "Also save untracked files" "--include-untracked") (?a "Also save untracked and ignored files" "--all")) @@ -168,7 +216,8 @@ and forgo removing the stash." "Remove a stash from the stash list. When the region is active offer to drop all contained stashes." (interactive (list (--if-let (magit-region-values 'stash) - (magit-confirm t nil "Drop %i stashes" it) + (or (magit-confirm t nil "Drop %i stashes" it) + (user-error "Abort")) (magit-read-stash "Drop stash")))) (dolist (stash (if (listp stash) (nreverse (prog1 stash (setq stash (car stash)))) @@ -215,7 +264,7 @@ When the region is active offer to drop all contained stashes." (defun magit-stash-save (message index worktree untracked &optional refresh keep noerror ref) (if (or (and index (magit-staged-files t)) - (and worktree (magit-modified-files t)) + (and worktree (magit-unstaged-files t)) (and untracked (magit-untracked-files (eq untracked 'all)))) (magit-with-toplevel (magit-stash-store message (or ref "refs/stash") @@ -252,7 +301,8 @@ When the region is active offer to drop all contained stashes." (summary (magit-stash-summary)) (head "HEAD")) (when (and worktree (not index)) - (setq head (magit-commit-tree "pre-stash index" nil "HEAD"))) + (setq head (or (magit-commit-tree "pre-stash index" nil "HEAD") + (error "Cannot save the current index state")))) (or (setq index (magit-commit-tree (concat "index on " summary) nil head)) (error "Cannot save the current index state")) (and untracked @@ -296,14 +346,14 @@ When the region is active offer to drop all contained stashes." (cl-defun magit-insert-stashes (&optional (ref "refs/stash") (heading "Stashes:")) "Insert `stashes' section showing reflog for \"refs/stash\". -If optional REF is non-nil show reflog for that instead. -If optional HEADING is non-nil use that as section heading +If optional REF is non-nil, show reflog for that instead. +If optional HEADING is non-nil, use that as section heading instead of \"Stashes:\"." (when (magit-rev-verify ref) (magit-insert-section (stashes ref (not magit-status-expand-stashes)) (magit-insert-heading heading) (magit-git-wash (apply-partially 'magit-log-wash-log 'stash) - "reflog" "--format=%gd %at %gs" ref)))) + "reflog" "--format=%gd%x00%aN%x00%at%x00%gs" ref)))) ;;; List Stashes @@ -316,7 +366,9 @@ instead of \"Stashes:\"." (define-derived-mode magit-stashes-mode magit-reflog-mode "Magit Stashes" "Mode for looking at lists of stashes." :group 'magit-log - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq-local bookmark-make-record-function + #'magit-bookmark--stashes-make-record)) (cl-defun magit-stashes-refresh-buffer (ref) (magit-insert-section (stashesbuf) @@ -324,19 +376,10 @@ instead of \"Stashes:\"." "Stashes:" (format "Stashes [%s]:" ref))) (magit-git-wash (apply-partially 'magit-log-wash-log 'stash) - "reflog" "--format=%gd %at %gs" ref))) + "reflog" "--format=%gd%x00%aN%x00%at%x00%gs" ref))) ;;; Show Stash -(defcustom magit-stash-sections-hook - '(magit-insert-stash-worktree - magit-insert-stash-index - magit-insert-stash-untracked) - "Hook run to insert sections into stash buffers." - :package-version '(magit . "2.1.0") - :group 'magit-log - :type 'hook) - ;;;###autoload (defun magit-stash-show (stash &optional args files) "Show all diffs of a stash in a buffer." @@ -350,13 +393,16 @@ instead of \"Stashes:\"." (define-derived-mode magit-stash-mode magit-diff-mode "Magit Stash" "Mode for looking at individual stashes." :group 'magit-diff - (hack-dir-local-variables-non-file-buffer)) + (hack-dir-local-variables-non-file-buffer) + (setq-local bookmark-make-record-function + #'magit-bookmark--stash-make-record)) (defun magit-stash-refresh-buffer (stash _const _args _files) (setq header-line-format (concat "\s" (propertize (capitalize stash) 'face 'magit-section-heading) "\s" (magit-rev-format "%s" stash))) + (setq magit-buffer-revision-hash (magit-rev-parse stash)) (magit-insert-section (stash) (run-hooks 'magit-stash-sections-hook))) @@ -393,9 +439,5 @@ instead of \"Stashes:\"." (magit-git-items "ls-tree" "-z" "--name-only" "-r" "--full-tree" rev))))) -;;; magit-stash.el ends soon (provide 'magit-stash) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-stash.el ends here diff --git a/elpa/magit-20171009.1252/magit-status.el b/elpa/magit-20171009.1252/magit-status.el new file mode 100644 index 00000000..3c183e34 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-status.el @@ -0,0 +1,532 @@ +;;; magit-status.el --- the grand overview -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 the status buffer. + +;;; Code: + +(require 'magit) + +(require 'subr-x) + +(defvar bookmark-make-record-function) + +;;; Options + +(defgroup magit-status nil + "Inspect and manipulate Git repositories." + :link '(info-link "(magit)Status Buffer") + :group 'magit-modes) + +(defcustom magit-status-mode-hook nil + "Hook run after entering Magit-Status mode." + :group 'magit-status + :type 'hook) + +(defcustom magit-status-headers-hook + '(magit-insert-error-header + magit-insert-diff-filter-header + magit-insert-head-branch-header + magit-insert-upstream-branch-header + magit-insert-push-branch-header + magit-insert-tags-header) + "Hook run to insert headers into the status buffer. + +This hook is run by `magit-insert-status-headers', which in turn +has to be a member of `magit-status-sections-hook' to be used at +all." + :package-version '(magit . "2.1.0") + :group 'magit-status + :type 'hook + :options '(magit-insert-error-header + magit-insert-diff-filter-header + magit-insert-repo-header + magit-insert-remote-header + magit-insert-head-branch-header + magit-insert-upstream-branch-header + magit-insert-push-branch-header + magit-insert-tags-header)) + +(defcustom magit-status-sections-hook + '(magit-insert-status-headers + magit-insert-merge-log + magit-insert-rebase-sequence + magit-insert-am-sequence + magit-insert-sequencer-sequence + magit-insert-bisect-output + magit-insert-bisect-rest + magit-insert-bisect-log + magit-insert-untracked-files + magit-insert-unstaged-changes + magit-insert-staged-changes + magit-insert-stashes + magit-insert-unpulled-from-upstream + magit-insert-unpulled-from-pushremote + magit-insert-unpushed-to-upstream + magit-insert-unpushed-to-pushremote) + "Hook run to insert sections into a status buffer." + :package-version '(magit . "2.4.0") + :group 'magit-status + :type 'hook) + +(defcustom magit-status-expand-stashes t + "Whether the list of stashes is expanded initially." + :package-version '(magit . "2.3.0") + :group 'magit-status + :type 'boolean) + +(defcustom magit-status-show-hashes-in-headers nil + "Whether headers in the status buffer show hashes. +The functions which respect this option are +`magit-insert-head-branch-header', +`magit-insert-upstream-branch-header', and +`magit-insert-push-branch-header'." + :package-version '(magit . "2.4.0") + :group 'magit-status + :type 'boolean) + +(defcustom magit-status-margin + (list nil + (nth 1 magit-log-margin) + 'magit-log-margin-width nil + (nth 4 magit-log-margin)) + "Format of the margin in `magit-status-mode' buffers. + +The value has the form (INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH). + +If INIT is non-nil, then the margin is shown initially. +STYLE controls how to format the committer date. It can be one + of `age' (to show the age of the commit), `age-abbreviated' (to + abbreviate the time unit to a character), or a string (suitable + for `format-time-string') to show the actual date. +WIDTH controls the width of the margin. This exists for forward + compatibility and currently the value should not be changed. +AUTHOR controls whether the name of the author is also shown by + default. +AUTHOR-WIDTH has to be an integer. When the name of the author + is shown, then this specifies how much space is used to do so." + :package-version '(magit . "2.9.0") + :group 'magit-status + :group 'magit-margin + :type magit-log-margin--custom-type + :initialize 'magit-custom-initialize-reset + :set-after '(magit-log-margin) + :set (apply-partially #'magit-margin-set-variable 'magit-status-mode)) + +;;; Commands + +;;;###autoload +(defun magit-init (directory) + "Initialize a Git repository, then show its status. + +If the directory is below an existing repository, then the user +has to confirm that a new one should be created inside. If the +directory is the root of the existing repository, then the user +has to confirm that it should be reinitialized. + +Non-interactively DIRECTORY is (re-)initialized unconditionally." + (interactive + (let ((directory (file-name-as-directory + (expand-file-name + (read-directory-name "Create repository in: "))))) + (-when-let (toplevel (magit-toplevel directory)) + (setq toplevel (expand-file-name toplevel)) + (unless (y-or-n-p (if (file-equal-p toplevel directory) + (format "Reinitialize existing repository %s? " + directory) + (format "%s is a repository. Create another in %s? " + toplevel directory))) + (user-error "Abort"))) + (list directory))) + ;; `git init' does not understand the meaning of "~"! + (magit-call-git "init" (magit-convert-filename-for-git + (expand-file-name directory))) + (magit-status-internal directory)) + +;;;###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." + (interactive + (let ((magit--refresh-cache (list (cons 0 0)))) + (list (and (or current-prefix-arg (not (magit-toplevel))) + (magit-read-repository + (>= (prefix-numeric-value current-prefix-arg) 16))) + magit--refresh-cache))) + (let ((magit--refresh-cache (or cache (list (cons 0 0))))) + (if directory + (let ((toplevel (magit-toplevel directory))) + (setq directory (file-name-as-directory + (expand-file-name directory))) + (if (and toplevel (file-equal-p directory toplevel)) + (magit-status-internal directory) + (when (y-or-n-p + (if toplevel + (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. + (setq magit--refresh-cache nil) + (magit-init directory)))) + (magit-status-internal default-directory)))) + +(put 'magit-status 'interactive-only 'magit-status-internal) + +;;;###autoload +(defun magit-status-internal (directory) + (magit--tramp-asserts directory) + (let ((default-directory directory)) + (magit-mode-setup #'magit-status-mode))) + +(defvar magit--remotes-using-recent-git nil) + +(defun magit--tramp-asserts (directory) + (-when-let (remote (file-remote-p directory)) + (unless (member remote magit--remotes-using-recent-git) + (-if-let (version (let ((default-directory directory)) + (magit-git-version))) + (if (version<= magit--minimal-git version) + (push version magit--remotes-using-recent-git) + (display-warning 'magit (format "\ +Magit requires Git >= %s, but on %s the version is %s. + +If multiple Git versions are installed on the host, then the +problem might be that TRAMP uses the wrong executable. + +First check the value of `magit-git-executable'. Its value is +used when running git locally as well as when running it on a +remote host. The default value is \"git\", except on Windows +where an absolute path is used for performance reasons. + +If the value already is just \"git\" but TRAMP never-the-less +doesn't use the correct executable, then consult the info node +`(tramp)Remote programs'.\n" magit--minimal-git remote version) :error)) + (display-warning 'magit (format "\ +Magit cannot find Git on %s. + +First check the value of `magit-git-executable'. Its value is +used when running git locally as well as when running it on a +remote host. The default value is \"git\", except on Windows +where an absolute path is used for performance reasons. + +If the value already is just \"git\" but TRAMP never-the-less +doesn't find the executable, then consult the info node +`(tramp)Remote programs'.\n" remote) :error))))) + +;;; Mode + +(defvar magit-status-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-mode-map) + (define-key map "jz" 'magit-jump-to-stashes) + (define-key map "jt" 'magit-jump-to-tracked) + (define-key map "jn" 'magit-jump-to-untracked) + (define-key map "ju" 'magit-jump-to-unstaged) + (define-key map "js" 'magit-jump-to-staged) + (define-key map "jfu" 'magit-jump-to-unpulled-from-upstream) + (define-key map "jfp" 'magit-jump-to-unpulled-from-pushremote) + (define-key map "jpu" 'magit-jump-to-unpushed-to-upstream) + (define-key map "jpp" 'magit-jump-to-unpushed-to-pushremote) + (define-key map [remap dired-jump] 'magit-dired-jump) + map) + "Keymap for `magit-status-mode'.") + +(define-derived-mode magit-status-mode magit-mode "Magit" + "Mode for looking at Git status. + +This mode is documented in info node `(magit)Status Buffer'. + +\\\ +Type \\[magit-refresh] to refresh the current buffer. +Type \\[magit-section-toggle] to expand or hide the section at point. +Type \\[magit-visit-thing] to visit the change or commit at point. + +Type \\[magit-dispatch-popup] to see available prefix popups. + +Staging and applying changes is documented in info node +`(magit)Staging and Unstaging' and info node `(magit)Applying'. + +\\Type \ +\\[magit-apply] to apply the change at point, \ +\\[magit-stage] to stage, +\\[magit-unstage] to unstage, \ +\\[magit-discard] to discard, or \ +\\[magit-reverse] to reverse it. + +\\\ +Type \\[magit-commit-popup] to create a commit. + +\\{magit-status-mode-map}" + :group 'magit-status + (hack-dir-local-variables-non-file-buffer) + (setq imenu-create-index-function + 'magit-imenu--status-create-index-function) + (setq-local bookmark-make-record-function + #'magit-bookmark--status-make-record)) + +(defun magit-status-refresh-buffer () + (magit-git-exit-code "update-index" "--refresh") + (magit-insert-section (status) + (magit-run-section-hook 'magit-status-sections-hook)) + (run-hooks 'magit-status-refresh-hook)) + +(defun magit-status-maybe-update-revision-buffer (&optional _) + "When moving in the status buffer, update the revision buffer. +If there is no revision buffer in the same frame, then do nothing." + (when (derived-mode-p 'magit-status-mode) + (magit-log-maybe-update-revision-buffer-1))) + +(defun magit-status-maybe-update-blob-buffer (&optional _) + "When moving in the status buffer, update the blob buffer. +If there is no blob buffer in the same frame, then do nothing." + (when (derived-mode-p 'magit-status-mode) + (magit-log-maybe-update-blob-buffer-1))) + +;;; Sections +;;;; Special Headers + +(defun magit-insert-status-headers () + "Insert header sections appropriate for `magit-status-mode' buffers. +The sections are inserted by running the functions on the hook +`magit-status-headers-hook'." + (if (magit-rev-verify "HEAD") + (magit-insert-headers magit-status-headers-hook) + (insert "In the beginning there was darkness\n\n"))) + +(defun magit-insert-error-header () + "Insert the message about the Git error that just occured. + +This function is only aware of the last error that occur when Git +was run for side-effects. If, for example, an error occurs while +generating a diff, then that error won't be inserted. Refreshing +the status buffer causes this section to disappear again." + (when magit-this-error + (magit-insert-section (error 'git) + (insert (propertize (format "%-10s" "GitError! ") + 'face 'magit-section-heading)) + (insert (propertize magit-this-error 'face 'font-lock-warning-face)) + (-when-let (key (car (where-is-internal 'magit-process-buffer))) + (insert (format " [Type `%s' for details]" (key-description key)))) + (insert ?\n)) + (setq magit-this-error nil))) + +(defun magit-insert-diff-filter-header () + "Insert a header line showing the effective diff filters." + (when magit-diff-section-file-args + (magit-insert-section (filter 'diff) + (insert (propertize (format "%-10s" "Filter! ") + 'face 'magit-section-heading)) + (insert (mapconcat #'identity magit-diff-section-file-args " ")) + (insert ?\n)))) + +;;;; Reference Headers + +(cl-defun magit-insert-head-branch-header + (&optional (branch (magit-get-current-branch))) + "Insert a header line about BRANCH. +When BRANCH is nil, use the current branch or, if none, the +detached `HEAD'." + (let ((output (magit-rev-format "%h %s" (or branch "HEAD")))) + (string-match "^\\([^ ]+\\) \\(.*\\)" output) + (magit-bind-match-strings (commit summary) output + (if branch + (magit-insert-section (branch branch) + (insert (format "%-10s" "Head: ")) + (when magit-status-show-hashes-in-headers + (insert (propertize commit 'face 'magit-hash) ?\s)) + (insert (propertize branch 'face 'magit-branch-local)) + (insert ?\s summary ?\n)) + (magit-insert-section (commit commit) + (insert (format "%-10s" "Head: ")) + (insert (propertize commit 'face 'magit-hash)) + (insert ?\s summary ?\n)))))) + +(cl-defun magit-insert-upstream-branch-header + (&optional (branch (magit-get-current-branch)) + (pull (magit-get-upstream-branch branch)) + keyword) + "Insert a header line about branch usually pulled into current branch." + (when pull + (magit-insert-section (branch pull) + (let ((rebase (magit-get "branch" branch "rebase"))) + (pcase rebase + ("true") + ("false" (setq rebase nil)) + (_ (setq rebase (magit-get-boolean "pull.rebase")))) + (insert (format "%-10s" (or keyword (if rebase "Rebase: " "Merge: "))))) + (--when-let (and magit-status-show-hashes-in-headers + (not (string-match-p " " pull)) + (magit-rev-format "%h" pull)) + (insert (propertize it 'face 'magit-hash) " ")) + (if (string-match-p " " pull) + (pcase-let ((`(,url ,branch) (split-string pull " "))) + (insert branch " from " url " ")) + (insert pull " ") + (if (magit-rev-verify pull) + (insert (or (magit-rev-format "%s" pull) "")) + (insert (propertize "is missing" 'face 'font-lock-warning-face)))) + (insert ?\n)))) + +(cl-defun magit-insert-push-branch-header + (&optional (branch (magit-get-current-branch)) + (push (magit-get-push-branch branch))) + "Insert a header line about the branch the current branch is pushed to." + (when push + (magit-insert-section (branch push) + (insert (format "%-10s" "Push: ")) + (--when-let (and magit-status-show-hashes-in-headers + (magit-rev-format "%h" push)) + (insert (propertize it 'face 'magit-hash) ?\s)) + (insert (propertize push 'face 'magit-branch-remote) ?\s) + (if (magit-rev-verify push) + (insert (or (magit-rev-format "%s" push) "")) + (insert (propertize "is missing" 'face 'font-lock-warning-face))) + (insert ?\n)))) + +(defun magit-insert-tags-header () + "Insert a header line about the current and/or next tag." + (let* ((this-tag (magit-get-current-tag nil t)) + (next-tag (magit-get-next-tag nil t)) + (this-cnt (cadr this-tag)) + (next-cnt (cadr next-tag)) + (this-tag (car this-tag)) + (next-tag (car next-tag)) + (both-tags (and this-tag next-tag t))) + (when (or this-tag next-tag) + (magit-insert-section (tag (or this-tag next-tag)) + (insert (format "%-10s" (if both-tags "Tags: " "Tag: "))) + (cl-flet ((insert-count + (tag count face) + (insert (concat (propertize tag 'face 'magit-tag) + (and (> count 0) + (format " (%s)" + (propertize (format "%s" count) + 'face face))))))) + (when this-tag (insert-count this-tag this-cnt 'magit-branch-local)) + (when both-tags (insert ", ")) + (when next-tag (insert-count next-tag next-cnt 'magit-tag))) + (insert ?\n))))) + +;;;; Auxiliary Headers + +(defun magit-insert-user-header () + "Insert a header line about the current user." + (let ((name (magit-get "user.name")) + (email (magit-get "user.email"))) + (when (and name email) + (magit-insert-section (user name) + (insert (format "%-10s" "User: ")) + (insert (propertize name 'face 'magit-log-author)) + (insert " <" email ">\n"))))) + +(defun magit-insert-repo-header () + "Insert a header line showing the path to the repository top-level." + (let ((topdir (magit-toplevel))) + (magit-insert-section (repo topdir) + (insert (format "%-10s%s\n" "Repo: " (abbreviate-file-name topdir)))))) + +(defun magit-insert-remote-header () + "Insert a header line about the remote of the current branch. + +If no remote is configured for the current branch, then fall back +showing the \"origin\" remote, or if that does not exist the first +remote in alphabetic order." + (-when-let* ((name (or (magit-get-remote) + (let ((remotes (magit-list-remotes))) + (or (car (member "origin" remotes)) + (car remotes))))) + ;; Under certain configurations it's possible for url + ;; to be nil, when name is not, see #2858. + (url (magit-get "remote" name "url"))) + (magit-insert-section (remote name) + (insert (format "%-10s" "Remote: ")) + (insert (propertize name 'face 'magit-branch-remote) ?\s) + (insert url ?\n)))) + +;;;; File Sections + +(defvar magit-untracked-section-map + (let ((map (make-sparse-keymap))) + (define-key map [remap magit-delete-thing] 'magit-discard) + (define-key map "s" 'magit-stage) + map) + "Keymap for the `untracked' section.") + +(magit-define-section-jumper magit-jump-to-untracked "Untracked files" untracked) + +(defun magit-insert-untracked-files () + "Maybe insert a list or tree of untracked files. +Do so depending on the value of `status.showUntrackedFiles'. +Note that even if the value is `all', Magit still initially only +shows directories. But the directory sections can then be expanded +using \"TAB\"." + (let ((show (or (magit-get "status.showUntrackedFiles") "normal"))) + (unless (equal show "no") + (if (equal show "all") + (-when-let (files (magit-untracked-files)) + (magit-insert-section (untracked) + (magit-insert-heading "Untracked files:") + (magit-insert-un/tracked-files-1 files nil) + (insert ?\n))) + (-when-let + (files (--mapcat (and (eq (aref it 0) ??) + (list (substring it 3))) + (magit-git-items "status" "-z" "--porcelain"))) + (magit-insert-section (untracked) + (magit-insert-heading "Untracked files:") + (dolist (file files) + (magit-insert-section (file file) + (insert (propertize file 'face 'magit-filename) ?\n))) + (insert ?\n))))))) + +(magit-define-section-jumper magit-jump-to-tracked "Tracked files" tracked) + +(defun magit-insert-tracked-files () + "Insert a tree of tracked files." + (-when-let (files (magit-list-files)) + (magit-insert-section (tracked nil t) + (magit-insert-heading "Tracked files:") + (magit-insert-un/tracked-files-1 files nil) + (insert ?\n)))) + +(defun magit-insert-un/tracked-files-1 (files directory) + (while (and files (string-prefix-p (or directory "") (car files))) + (let ((dir (file-name-directory (car files)))) + (if (equal dir directory) + (let ((file (pop files))) + (magit-insert-section (file file) + (insert (propertize file 'face 'magit-filename) ?\n))) + (magit-insert-section (file dir t) + (insert (propertize dir 'file 'magit-filename) ?\n) + (magit-insert-heading) + (setq files (magit-insert-un/tracked-files-1 files dir)))))) + files) + +(provide 'magit-status) +;;; magit-status.el ends here diff --git a/elpa/magit-20161115.1658/magit-submodule.el b/elpa/magit-20171009.1252/magit-submodule.el similarity index 66% rename from elpa/magit-20161115.1658/magit-submodule.el rename to elpa/magit-20171009.1252/magit-submodule.el index 3238cd1a..2dbe9cb7 100644 --- a/elpa/magit-20161115.1658/magit-submodule.el +++ b/elpa/magit-20171009.1252/magit-submodule.el @@ -1,6 +1,6 @@ ;;; magit-submodule.el --- submodule support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2016 The Magit Project Contributors +;; Copyright (C) 2011-2017 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. @@ -25,16 +25,54 @@ (require 'magit) +(defvar x-stretch-cursor) +(defvar bookmark-make-record-function) + ;;; Options +(defcustom magit-module-sections-hook + '(magit-insert-modules-overview + magit-insert-modules-unpulled-from-upstream + magit-insert-modules-unpulled-from-pushremote + magit-insert-modules-unpushed-to-upstream + magit-insert-modules-unpushed-to-pushremote) + "Hook run by `magit-insert-modules'. + +That function isn't part of `magit-status-sections-hook's default +value, so you have to add it yourself for this hook to have any +effect." + :package-version '(magit . "2.11.0") + :group 'magit-status + :type 'hook) + +(defcustom magit-module-sections-nested t + "Whether `magit-insert-modules' wraps inserted sections. + +If this is non-nil, then only a single top-level section +is inserted. If it is nil, then all sections listed in +`magit-module-sections-hook' become top-level sections." + :package-version '(magit . "2.11.0") + :group 'magit-status + :type 'boolean) + +(defcustom magit-submodule-list-mode-hook '(hl-line-mode) + "Hook run after entering Magit-Submodule-List mode." + :package-version '(magit . "2.9.0") + :group 'magit-repolist + :type 'hook + :get 'magit-hook-custom-get + :options '(hl-line-mode)) + (defcustom magit-submodule-list-columns '(("Path" 25 magit-modulelist-column-path nil) ("Version" 25 magit-repolist-column-version nil) ("Branch" 20 magit-repolist-column-branch nil) - ("LU" 3 magit-repolist-column-unpushed-to-upstream (:right-align t)) - ("LP" 3 magit-repolist-column-unpushed-to-pushremote (:right-align t))) + ("BU" 3 magit-repolist-column-unpushed-to-upstream ((:right-align t))) + ("BP" 3 magit-repolist-column-unpushed-to-pushremote ((:right-align t))) + ("B" 3 magit-repolist-column-branches ((:right-align t))) + ("S" 3 magit-repolist-column-stashes ((:right-align t)))) "List of columns displayed by `magit-list-submodules'. Each element has the form (HEADER WIDTH FORMAT PROPS). @@ -46,7 +84,7 @@ and with `default-directory' bound to the toplevel of its working tree. It has to return a string to be inserted or nil. PROPS is an alist that supports the keys `:right-align' and `:pad-right'." :package-version '(magit . "2.8.0") - :group 'magit-commands + :group 'magit-repolist-mode :type `(repeat (list :tag "Column" (string :tag "Header Label") (integer :tag "Column Width") @@ -63,7 +101,6 @@ an alist that supports the keys `:right-align' and `:pad-right'." ;;;###autoload (autoload 'magit-submodule-popup "magit-submodule" nil t) (magit-define-popup magit-submodule-popup "Popup console for submodule commands." - 'magit-commands nil nil :man-page "git-submodule" :actions '((?a "Add" magit-submodule-add) (?b "Setup" magit-submodule-setup) @@ -71,7 +108,8 @@ an alist that supports the keys `:right-align' and `:pad-right'." (?u "Update" magit-submodule-update) (?s "Sync" magit-submodule-sync) (?f "Fetch" magit-submodule-fetch) - (?d "Deinit" magit-submodule-deinit))) + (?d "Deinit" magit-submodule-deinit) + (?l "List" magit-list-submodules))) ;;;###autoload (defun magit-submodule-add (url &optional path name) @@ -95,11 +133,11 @@ PATH also becomes the name." (match-string 1 url)))))))) (list url (directory-file-name path) - (magit-submodule-read-name path))))) + (magit-submodule-read-name-for-path path))))) (magit-run-git "submodule" "add" (and name (list "--name" name)) url path)) ;;;###autoload -(defun magit-submodule-read-name (path) +(defun magit-submodule-read-name-for-path (path) (setq path (directory-file-name (file-relative-name path))) (push (file-name-nondirectory path) minibuffer-history) (magit-read-string-ns @@ -163,32 +201,71 @@ With a prefix argument fetch all remotes." ;;; Sections ;;;###autoload -(defun magit-insert-submodules () +(defun magit-insert-modules () + "Insert submodule sections. +Hook `magit-module-sections-hook' controls which module sections +are inserted, and option `magit-insert-modules-nested' controls +whether they are wrapped in an additional section." + (-when-let (modules (magit-get-submodules)) + (if magit-module-sections-nested + (magit-insert-section section (submodules nil t) + (magit-insert-heading + (format "%s (%s)" + (propertize "Modules" 'face 'magit-section-heading) + (length modules))) + (if (magit-section-hidden section) + (setf (magit-section-washer section) 'magit--insert-modules) + (magit--insert-modules))) + (magit--insert-modules)))) + +(defun magit--insert-modules (&optional _section) + (magit-run-section-hook 'magit-module-sections-hook)) + +;;;###autoload +(defun magit-insert-modules-overview () "Insert sections for all modules. -For each section insert the path and the output of `git describe --tags'." +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-get-submodules)) - (magit-insert-section (submodules nil t) - (magit-insert-heading "Modules:") - (magit-with-toplevel - (let ((col-format (format "%%-%is " (min 25 (/ (window-width) 3))))) - (dolist (module modules) - (let ((default-directory - (expand-file-name (file-name-as-directory module)))) - (magit-insert-section (submodule module t) - (insert (propertize (format col-format module) - 'face 'magit-diff-file-heading)) - (if (not (file-exists-p ".git")) - (insert "(uninitialized)") - (insert (format col-format - (--if-let (magit-get-current-branch) - (propertize it 'face 'magit-branch-local) - (propertize "(detached)" 'face 'warning)))) - (--when-let (magit-git-string "describe" "--tags") - (when (string-match-p "\\`[0-9]" it) - (insert ?\s)) - (insert (propertize it 'face 'magit-tag)))) - (insert ?\n)))))) - (insert ?\n)))) + (magit-insert-section section (submodules nil t) + (magit-insert-heading + (format "%s (%s)" + (propertize "Modules overview" 'face 'magit-section-heading) + (length modules))) + (if (magit-section-hidden section) + (setf (magit-section-washer section) 'magit--insert-modules-overview) + (magit--insert-modules-overview))))) + +(defvar magit-modules-overview-align-numbers t) + +(defun magit--insert-modules-overview (&optional _section) + (magit-with-toplevel + (let* ((modules (magit-get-submodules)) + (path-format (format "%%-%is " + (min (apply 'max (mapcar 'length modules)) + (/ (window-width) 2)))) + (branch-format (format "%%-%is " (min 25 (/ (window-width) 3))))) + (dolist (module modules) + (let ((default-directory + (expand-file-name (file-name-as-directory module)))) + (magit-insert-section (submodule module t) + (insert (propertize (format path-format module) + 'face 'magit-diff-file-heading)) + (if (not (file-exists-p ".git")) + (insert "(uninitialized)") + (insert (format branch-format + (--if-let (magit-get-current-branch) + (propertize it 'face 'magit-branch-local) + (propertize "(detached)" 'face 'warning)))) + (--if-let (magit-git-string "describe" "--tags") + (progn (when (and magit-modules-overview-align-numbers + (string-match-p "\\`[0-9]" it)) + (insert ?\s)) + (insert (propertize it 'face 'magit-tag))) + (--when-let (magit-rev-format "%h") + (insert (propertize it 'face 'magit-hash))))) + (insert ?\n)))))) + (insert ?\n)) (defvar magit-submodules-section-map (let ((map (make-sparse-keymap))) @@ -198,8 +275,9 @@ For each section insert the path and the output of `git describe --tags'." (defvar magit-submodule-section-map (let ((map (make-sparse-keymap))) + (unless (featurep 'jkl) + (define-key map "\C-j" 'magit-submodule-visit)) (define-key map [C-return] 'magit-submodule-visit) - (define-key map "\C-j" 'magit-submodule-visit) (define-key map [remap magit-visit-thing] 'magit-submodule-visit) (define-key map [remap magit-delete-thing] 'magit-submodule-deinit) (define-key map "K" 'magit-file-untrack) @@ -237,17 +315,15 @@ With a prefix argument, visit in another window." These sections can be expanded to show the respective commits." (magit--insert-modules-logs "Modules unpulled from @{upstream}" 'modules-unpulled-from-upstream - 'magit-get-upstream-ref - "HEAD..%s")) + "HEAD..@{upstream}")) ;;;###autoload (defun magit-insert-modules-unpulled-from-pushremote () "Insert sections for modules that haven't been pulled from the push-remote. These sections can be expanded to show the respective commits." - (magit--insert-modules-logs "Modules unpulled from " + (magit--insert-modules-logs "Modules unpulled from ${push}" 'modules-unpulled-from-pushremote - 'magit-get-push-branch - "HEAD..%s")) + "HEAD..@{push}")) ;;;###autoload (defun magit-insert-modules-unpushed-to-upstream () @@ -255,19 +331,17 @@ These sections can be expanded to show the respective commits." These sections can be expanded to show the respective commits." (magit--insert-modules-logs "Modules unmerged into @{upstream}" 'modules-unpushed-to-upstream - 'magit-get-upstream-ref - "%s..HEAD")) + "@{upstream}..HEAD")) ;;;###autoload (defun magit-insert-modules-unpushed-to-pushremote () "Insert sections for modules that haven't been pushed to the push-remote. These sections can be expanded to show the respective commits." - (magit--insert-modules-logs "Modules unpushed to " + (magit--insert-modules-logs "Modules unpushed to @{push}" 'modules-unpushed-to-pushremote - 'magit-get-push-branch - "%s..HEAD")) + "${push}..HEAD")) -(defun magit--insert-modules-logs (heading type fn format) +(defun magit--insert-modules-logs (heading type range) "For internal use, don't add to a hook." (-when-let (modules (magit-get-submodules)) (magit-insert-section section ((eval type) nil t) @@ -280,13 +354,12 @@ These sections can be expanded to show the respective commits." (dolist (module modules) (let ((default-directory (expand-file-name (file-name-as-directory module)))) - (--when-let (and (magit-file-accessible-directory-p default-directory) - (funcall fn)) + (when (magit-file-accessible-directory-p default-directory) (magit-insert-section sec (file module t) (magit-insert-heading (concat (propertize module 'face 'magit-diff-file-heading) ":")) (magit-git-wash (apply-partially 'magit-log-wash-log 'module) - "log" "--oneline" (format format it)) + "-c" "push.default=current" "log" "--oneline" range) (when (> (point) (magit-section-content sec)) (delete-char -1))))))) (if (> (point) (magit-section-content section)) @@ -313,14 +386,14 @@ These sections can be expanded to show the respective commits." (defvar magit-submodule-list-mode-map (let ((map (make-sparse-keymap))) - (set-keymap-parent map tabulated-list-mode-map) - (define-key map "g" 'magit-list-submodules) - (define-key map "\r" 'magit-repolist-status) + (set-keymap-parent map magit-repolist-mode-map) + (define-key map "g" 'magit-list-submodules) map) "Local keymap for Magit-Submodule-List mode buffers.") (define-derived-mode magit-submodule-list-mode tabulated-list-mode "Modules" "Major mode for browsing a list of Git submodules." + :group 'magit-repolist-mode (setq x-stretch-cursor nil) (setq tabulated-list-padding 0) (setq tabulated-list-sort-key (cons "Path" nil)) @@ -329,21 +402,17 @@ These sections can be expanded to show the respective commits." (nconc (list title width t) (-flatten props))) magit-submodule-list-columns))) - (tabulated-list-init-header)) + (tabulated-list-init-header) + (setq imenu-prev-index-position-function + #'magit-imenu--submodule-prev-index-position-function) + (setq imenu-extract-index-name-function + #'magit-imenu--submodule-extract-index-name-function) + (setq-local bookmark-make-record-function + #'magit-bookmark--submodules-make-record)) (defun magit-modulelist-column-path (path) "Insert the relative path of the submodule." path) -;;; magit-submodule.el ends soon - -(define-obsolete-function-alias 'magit-insert-unpulled-module-commits - 'magit-insert-modules-unpulled-from-upstream "Magit 2.6.0") -(define-obsolete-function-alias 'magit-insert-unpushed-module-commits - 'magit-insert-modules-unpushed-to-upstream "Magit 2.6.0") - (provide 'magit-submodule) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-submodule.el ends here diff --git a/elpa/magit-20161115.1658/magit-subtree.el b/elpa/magit-20171009.1252/magit-subtree.el similarity index 82% rename from elpa/magit-20161115.1658/magit-subtree.el rename to elpa/magit-20171009.1252/magit-subtree.el index 843147f3..882177e7 100644 --- a/elpa/magit-20161115.1658/magit-subtree.el +++ b/elpa/magit-20171009.1252/magit-subtree.el @@ -1,6 +1,6 @@ ;;; magit-subtree.el --- subtree support for Magit -*- lexical-binding: t -*- -;; Copyright (C) 2011-2016 The Magit Project Contributors +;; Copyright (C) 2011-2017 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. @@ -25,10 +25,11 @@ (require 'magit) +;;; Popup + ;;;###autoload (autoload 'magit-subtree-popup "magit-subtree" nil t) (magit-define-popup magit-subtree-popup "Popup console for subtree commands." - 'magit-commands :man-page "git-subtree" :switches '("Switches for add, merge, push, and pull" (?s "Squash" "--squash") @@ -51,12 +52,6 @@ (?s "Split" magit-subtree-split)) :max-action-columns 3) -(defun magit-subtree-prefix (prompt) - (--if-let (--first (string-prefix-p "--prefix=" it) - (magit-subtree-arguments)) - (substring it 9) - (magit-subtree-read-prefix prompt))) - (defun magit-subtree-read-prefix (prompt &optional default) (let* ((insert-default-directory nil) (topdir (magit-toplevel)) @@ -68,6 +63,14 @@ (user-error "%s isn't inside the repository at %s" prefix topdir)) prefix))) +;;; Commands + +(defun magit-subtree-prefix (prompt) + (--if-let (--first (string-prefix-p "--prefix=" it) + (magit-subtree-arguments)) + (substring it 9) + (magit-subtree-read-prefix prompt))) + (defun magit-subtree-args () (-filter (lambda (arg) (if (eq this-command 'magit-subtree-split) @@ -85,13 +88,15 @@ (magit-run-git-async "subtree" subcmd (concat "--prefix=" prefix) args)) ;;;###autoload -(defun magit-subtree-add (prefix repository commit args) - "Add COMMIT from REPOSITORY as a new subtree at PREFIX." - (interactive (list (magit-subtree-prefix "Add subtree") - (magit-read-string-ns "Repository") - (magit-read-string-ns "Commit") - (magit-subtree-args))) - (magit-git-subtree "add" prefix args repository commit)) +(defun magit-subtree-add (prefix repository ref args) + "Add REF from REPOSITORY as a new subtree at PREFIX." + (interactive + (cons (magit-subtree-prefix "Add subtree") + (let ((remote (magit-read-remote-or-url "From repository"))) + (list remote + (magit-read-refspec "Ref" remote) + (magit-subtree-args))))) + (magit-git-subtree "add" prefix args repository ref)) ;;;###autoload (defun magit-subtree-add-commit (prefix commit args) @@ -110,19 +115,21 @@ (magit-git-subtree "merge" prefix args commit)) ;;;###autoload -(defun magit-subtree-pull (prefix repository commit args) - "Pull COMMIT from REPOSITORY into the PREFIX subtree." - (interactive (list (magit-subtree-prefix "Pull into subtree") - (magit-read-string-ns "From repository") - (magit-read-string-ns "Commit") - (magit-subtree-args))) - (magit-git-subtree "pull" prefix args repository commit)) +(defun magit-subtree-pull (prefix repository ref args) + "Pull REF from REPOSITORY into the PREFIX subtree." + (interactive + (cons (magit-subtree-prefix "Pull into subtree") + (let ((remote (magit-read-remote-or-url "From repository"))) + (list remote + (magit-read-refspec "Ref" remote) + (magit-subtree-args))))) + (magit-git-subtree "pull" prefix args repository ref)) ;;;###autoload (defun magit-subtree-push (prefix repository ref args) "Extract the history of the subtree PREFIX and push it to REF on REPOSITORY." (interactive (list (magit-subtree-prefix "Push subtree") - (magit-read-string-ns "To repository") + (magit-read-remote-or-url "To repository") (magit-read-string-ns "To reference") (magit-subtree-args))) (magit-git-subtree "push" prefix args repository ref)) @@ -135,9 +142,5 @@ (magit-subtree-args))) (magit-git-subtree "split" prefix args commit)) -;;; magit-subtree.el ends soon (provide 'magit-subtree) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-subtree.el ends here diff --git a/elpa/magit-20161115.1658/magit-utils.el b/elpa/magit-20171009.1252/magit-utils.el similarity index 64% rename from elpa/magit-20161115.1658/magit-utils.el rename to elpa/magit-20171009.1252/magit-utils.el index e1a0e207..862ec351 100644 --- a/elpa/magit-20161115.1658/magit-utils.el +++ b/elpa/magit-20171009.1252/magit-utils.el @@ -1,6 +1,6 @@ -;;; magit-utils.el --- various utilities -*- lexical-binding: t -*- +;;; magit-utils.el --- various utilities -*- lexical-binding: t; coding: utf-8 -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -41,8 +41,14 @@ (require 'cl-lib) (require 'dash) +(require 'crm) + (eval-when-compile (require 'ido)) (declare-function ido-completing-read+ 'ido-completing-read+) +(declare-function Info-get-token 'info) + +(eval-when-compile (require 'vc-git)) +(declare-function vc-git--run-command-string 'vc-git) (defvar magit-wip-before-change-mode) @@ -51,16 +57,22 @@ (defcustom magit-completing-read-function 'magit-builtin-completing-read "Function to be called when requesting input from the user. -For Helm users, the simplest way to get Helm completion is to -turn on `helm-mode' and leave this option set to the default -value. However, if you prefer to not use `helm-mode' but still -want Magit to use Helm for completion, you can set this option to -`helm--completing-read-default'." - :group 'magit +If you have enabled `ivy-mode' or `helm-mode', then you don't +have to customize this option; `magit-builtin-completing-read' +will work just fine. However, if you use Ido completion, then +you do have to use `magit-ido-completion-read', because Ido is +less well behaved than the former, more modern alternatives. + +If you would like to use Ivy or Helm completion with Magit but +not enable the respective modes globally, then customize this +option to use `ivy-completing-read' +or `helm--completing-read-default'." + :group 'magit-essentials :type '(radio (function-item magit-builtin-completing-read) (function-item magit-ido-completing-read) + (function-item ivy-completing-read) (function-item helm--completing-read-default) - (function :tag "Other"))) + (function :tag "Other function"))) (defcustom magit-no-confirm-default nil "A list of commands which should just use the default choice. @@ -81,7 +93,7 @@ these commands do: `magit-branch-rename' `magit-tag'" :package-version '(magit . "2.9.0") - :group 'magit-commands + :group 'magit-miscellaneous :type '(list :convert-widget custom-hook-convert-widget) :options '(magit-branch magit-branch-and-checkout @@ -192,10 +204,10 @@ Global settings: When `magit-wip-before-change-mode' is enabled then these actions can fairly easily be undone: `discard', `reverse', `stage-all-changes', and `unstage-all-changes'. If and only if - this mode is enabled then `safe-with-wip' has the same effect + this mode is enabled, then `safe-with-wip' has the same effect as adding all of these symbols individually." :package-version '(magit . "2.1.0") - :group 'magit + :group 'magit-essentials :group 'magit-commands :type `(choice (const :tag "Always require confirmation" nil) (const :tag "Never require confirmation" t) @@ -212,10 +224,10 @@ identifying actions, then `yes-or-no-p' is used for those, `y-or-no-p' for all others. The list of actions is the same as for `magit-no-confirm' (which see)." :package-version '(magit . "2.9.0") - :group 'magit-commands + :group 'magit-miscellaneous :type `(choice (const :tag "Always ask \"yes or no\" questions" t) (const :tag "Always ask \"y or n\" questions" nil) - (set :tag "Ask yes or no questions only for" + (set :tag "Ask \"yes or no\" questions only for" ,@magit--confirm-actions))) (defcustom magit-no-message nil @@ -238,13 +250,16 @@ some of these messages useless. Messages which can currently be suppressed using this option are: * \"Turning on magit-auto-revert-mode...\"" :package-version '(magit . "2.8.0") - :group 'magit + :group 'magit-miscellaneous :type '(repeat string)) (defcustom magit-ellipsis ?… - "Character used to abbreviate text." + "Character used to abbreviate text. + +Currently this is used to abbreviate author names in the margin +and in process buffers to elide `magit-git-global-arguments'." :package-version '(magit . "2.1.0") - :group 'magit-modes + :group 'magit-miscellaneous :type 'character) (defcustom magit-update-other-window-delay 0.2 @@ -261,9 +276,26 @@ this option controls for how long. For optimal experience you might have to adjust this delay and/or the keyboard repeat rate and delay of your graphical environment or operating system." :package-version '(magit . "2.3.0") - :group 'magit-modes + :group 'magit-miscellaneous :type 'number) +(defcustom magit-view-git-manual-method 'info + "How links to Git documentation are followed from Magit's Info manuals. + +`info' Follow the link to the node in the `gitman' Info manual + as usual. Unfortunately that manual is not installed by + default on some platforms, and when it is then the nodes + look worse than the actual manpages. + +`man' View the respective man-page using the `man' package. + +`woman' View the respective man-page using the `woman' package." + :package-version '(magit . "2.9.0") + :group 'magit-miscellaneous + :type '(choice (const :tag "view info manual" info) + (const :tag "view manpage using `man'" man) + (const :tag "view manpage using `woman'" woman))) + ;;; User Input (defun magit-completing-read @@ -294,7 +326,11 @@ that this wrapper makes the following changes: The use of another completing function and/or wrapper obviously results in additional differences." (let ((reply (funcall magit-completing-read-function - (concat prompt ": ") collection predicate + (concat prompt ": ") + (if (and def (not (member def collection))) + (cons def collection) + collection) + predicate require-match initial-input hist def))) (if (string= reply "") (if require-match @@ -302,12 +338,59 @@ results in additional differences." nil) reply))) +(defun magit--completion-table (collection) + (lambda (string pred action) + (if (eq action 'metadata) + '(metadata (display-sort-function . identity)) + (complete-with-action action collection string pred)))) + (defun magit-builtin-completing-read (prompt choices &optional predicate require-match initial-input hist def) "Magit wrapper for standard `completing-read' function." - (completing-read (magit-prompt-with-default prompt def) - choices predicate require-match - initial-input hist def)) + (cl-letf (((symbol-function 'completion-pcm--all-completions) + #'magit-completion-pcm--all-completions)) + (completing-read (if (or (bound-and-true-p helm-mode) + (bound-and-true-p ivy-mode)) + prompt + (magit-prompt-with-default prompt def)) + (magit--completion-table choices) + predicate require-match + initial-input hist def))) + +(defvar helm-completion-in-region-default-sort-fn) + +(defun magit-completing-read-multiple + (prompt choices &optional sep default hist keymap) + "Read multiple items from CHOICES, separated by SEP. + +Set up the `crm' variables needed to read multiple values with +`read-from-minibuffer'. + +SEP is a regexp matching characters that can separate choices. +When SEP is nil, it defaults to `crm-default-separator'. +DEFAULT, HIST, and KEYMAP are passed to `read-from-minibuffer'. +When KEYMAP is nil, it defaults to `crm-local-completion-map'. + +Unlike `completing-read-multiple', the return value is not split +into a list." + (let* ((crm-separator (or sep crm-default-separator)) + (crm-completion-table (magit--completion-table choices)) + (choose-completion-string-functions + '(crm--choose-completion-string)) + (minibuffer-completion-table #'crm--collection-fn) + (minibuffer-completion-confirm t) + (helm-completion-in-region-default-sort-fn nil) + (input + (cl-letf (((symbol-function 'completion-pcm--all-completions) + #'magit-completion-pcm--all-completions)) + (read-from-minibuffer + (concat prompt (and default (format " (%s)" default)) ": ") + nil (or keymap crm-local-completion-map) + nil hist default)))) + (when (string-equal input "") + (or (setq input default) + (user-error "Nothing selected"))) + input)) (defun magit-ido-completing-read (prompt choices &optional predicate require-match initial-input hist def) @@ -404,8 +487,8 @@ ACTION is a member of option `magit-slow-confirm'." (cl-defun magit-confirm (action &optional prompt prompt-n (items nil sitems)) (declare (indent defun)) - (setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items)) - prompt (format (concat (or prompt (magit-confirm-make-prompt action)) + (setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items))) + (setq prompt (format (concat (or prompt (magit-confirm-make-prompt action)) "? ") (car items))) (cond ((and (not (eq action t)) @@ -450,13 +533,38 @@ ACTION is a member of option `magit-slow-confirm'." (replace-regexp-in-string "-" " " (concat (upcase (substring prompt 0 1)) (substring prompt 1))))) +;;; Debug Utilities + +;;;###autoload +(defun magit-emacs-Q-command () + "Show a shell command that runs an uncustomized Emacs with only Magit loaded. +See info node `(magit)Debugging Tools' for more information." + (interactive) + (let ((cmd (mapconcat + #'shell-quote-argument + `(,(concat invocation-directory invocation-name) + "-Q" "--eval" "(setq debug-on-error t)" + ,@(cl-mapcan + (lambda (dir) (list "-L" dir)) + (delete-dups + (mapcar (lambda (lib) + (file-name-directory (locate-library lib))) + '("magit" "magit-popup" "with-editor" + "git-commit" "dash")))) + ;; Avoid Emacs bug#16406 by using full path. + "-l" ,(file-name-sans-extension (locate-library "magit"))) + " "))) + (message "Uncustomized Magit command saved to kill-ring, %s" + "please run it in a terminal.") + (kill-new cmd))) + ;;; Text Utilities (defmacro magit-bind-match-strings (varlist string &rest body) "Bind variables to submatches according to VARLIST then evaluate BODY. Bind the symbols in VARLIST to submatches of the current match data, starting with 1 and incrementing by 1 for each symbol. If -the last match was against a string then that has to be provided +the last match was against a string, then that has to be provided as STRING." (declare (indent 2) (debug (listp form body))) (let ((s (cl-gensym "string")) @@ -472,7 +580,7 @@ as STRING." (defun magit-delete-match (&optional num) "Delete text matched by last search. -If optional NUM is specified only delete that subexpression." +If optional NUM is specified, only delete that subexpression." (delete-region (match-beginning (or num 0)) (match-end (or num 0)))) @@ -492,7 +600,14 @@ Unless optional argument KEEP-EMPTY-LINES is t, trim all empty lines." (insert-file-contents file) (split-string (buffer-string) "\n" (not keep-empty-lines))))) -;;; Kludges +;;; Missing from Emacs + +(defun magit-kill-this-buffer () + "Kill the current buffer." + (interactive) + (kill-buffer (current-buffer))) + +;;; Kludges for Emacs Bugs (defun magit-file-accessible-directory-p (filename) "Like `file-accessible-directory-p' but work around an Apple bug. @@ -501,13 +616,45 @@ and https://github.com/magit/magit/issues/2295." (and (file-directory-p filename) (file-accessible-directory-p filename))) -(defun magit-message (format-string &rest args) - "Display a message at the bottom of the screen, or not. -Like `message', except that if the users configured option -`magit-no-message' to prevent the message corresponding to -FORMAT-STRING to be displayed, then don't." - (unless (--first (string-prefix-p it format-string) magit-no-message) - (apply #'message format-string args))) +(when (version<= "25.1" emacs-version) + (with-eval-after-load 'vc-git + (defun vc-git-conflicted-files (directory) + "Return the list of files with conflicts in DIRECTORY." + (let* ((status + (vc-git--run-command-string directory "diff-files" + "--name-status")) + (lines (when status (split-string status "\n" 'omit-nulls))) + files) + (dolist (line lines files) + (when (string-match "\\([ MADRCU?!]\\)[ \t]+\\(.+\\)" line) + (let ((state (match-string 1 line)) + (file (match-string 2 line))) + (when (equal state "U") + (push (expand-file-name file directory) files))))))))) + +;; `completion-pcm--all-completions' reverses the completion list. To +;; preserve the order of our pre-sorted completions, we'll temporarily +;; override it with the function below. bug#24676 +(defun magit-completion-pcm--all-completions (prefix pattern table pred) + (if (completion-pcm--pattern-trivial-p pattern) + (all-completions (concat prefix (car pattern)) table pred) + (let* ((regex (completion-pcm--pattern->regex pattern)) + (case-fold-search completion-ignore-case) + (completion-regexp-list (cons regex completion-regexp-list)) + (compl (all-completions + (concat prefix + (if (stringp (car pattern)) (car pattern) "")) + table pred))) + (if (not (functionp table)) + compl + (let ((poss ())) + (dolist (c compl) + (when (string-match-p regex c) (push c poss))) + ;; This `nreverse' call is the only code change made to the + ;; `completion-pcm--all-completions' that shipped with Emacs 25.1. + (nreverse poss)))))) + +;;; Kludges for Incompatible Modes (defvar whitespace-mode) @@ -525,10 +672,107 @@ for an alternative." (advice-add 'whitespace-turn-on :before 'whitespace-dont-turn-on-in-magit-mode) -;;; magit-utils.el ends soon +;;; Kludges for Custom + +(defun magit-custom-initialize-reset (symbol exp) + "Initialize SYMBOL based on EXP. +Set the symbol, using `set-default' (unlike +`custom-initialize-reset' which uses the `:set' function if any.) +The value is either the symbol's current value + (as obtained using the `:get' function), if any, +or the value in the symbol's `saved-value' property if any, +or (last of all) the value of EXP." + (set-default-toplevel-value + symbol + (condition-case nil + (let ((def (default-toplevel-value symbol)) + (getter (get symbol 'custom-get))) + (if getter (funcall getter symbol) def)) + (error + (eval (let ((sv (get symbol 'saved-value))) + (if sv (car sv) exp))))))) + +(defun magit-hook-custom-get (symbol) + (if (symbol-file symbol 'defvar) + (default-toplevel-value symbol) + ;; + ;; Called by `custom-initialize-reset' on behalf of `symbol's + ;; `defcustom', which is being evaluated for the first time to + ;; set the initial value, but there's already a default value, + ;; which most likely was established by one or more `add-hook' + ;; calls. + ;; + ;; We combine the `standard-value' and the current value, while + ;; preserving the order established by `:options', and return + ;; the result of that to be used as the "initial" default value. + ;; + (let ((standard (eval (car (get symbol 'standard-value)))) + (current (default-toplevel-value symbol)) + (value nil)) + (dolist (fn (get symbol 'custom-options)) + (when (or (memq fn standard) + (memq fn current)) + (push fn value))) + (dolist (fn current) + (unless (memq fn value) + (push fn value))) + (nreverse value)))) + +;;; Kludges for Info Manuals + +;;;###autoload +(defun Info-follow-nearest-node--magit-gitman (fn &optional fork) + (if magit-view-git-manual-method + (let ((node (Info-get-token + (point) "\\*note[ \n\t]+" + "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?"))) + (if (and node (string-match "^(gitman)\\(.+\\)" node)) + (pcase magit-view-git-manual-method + (`man (require 'man) + (man (match-string 1 node))) + (`woman (require 'woman) + (woman (match-string 1 node))) + (_ + (user-error "Invalid value for `magit-view-git-documentation'"))) + (funcall fn fork))) + (funcall fn fork))) + +;;;###autoload +(advice-add 'Info-follow-nearest-node :around + 'Info-follow-nearest-node--magit-gitman) + +;;;###autoload +(defun org-man-export--magit-gitman (fn link description format) + (if (and (eq format 'texinfo) + (string-match-p "\\`git" link)) + (replace-regexp-in-string "%s" link " +@ifinfo +@ref{%s,,,gitman,}. +@end ifinfo +@ifhtml +@html +the %s(1) manpage. +@end html +@end ifhtml +@iftex +the %s(1) manpage. +@end iftex +") + (funcall fn link description format))) + +;;;###autoload +(advice-add 'org-man-export :around + 'org-man-export--magit-gitman) + +;;; Miscellaneous + +(defun magit-message (format-string &rest args) + "Display a message at the bottom of the screen, or not. +Like `message', except that if the users configured option +`magit-no-message' to prevent the message corresponding to +FORMAT-STRING to be displayed, then don't." + (unless (--first (string-prefix-p it format-string) magit-no-message) + (apply #'message format-string args))) + (provide 'magit-utils) -;; Local Variables: -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: ;;; magit-utils.el ends here diff --git a/elpa/magit-20161115.1658/magit-wip.el b/elpa/magit-20171009.1252/magit-wip.el similarity index 97% rename from elpa/magit-20161115.1658/magit-wip.el rename to elpa/magit-20171009.1252/magit-wip.el index 3702e27a..ff7b69cb 100644 --- a/elpa/magit-20161115.1658/magit-wip.el +++ b/elpa/magit-20171009.1252/magit-wip.el @@ -1,6 +1,6 @@ ;;; magit-wip.el --- commit snapshots to work-in-progress refs -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -24,7 +24,7 @@ ;;; Commentary: ;; This library defines tree global modes which automatically commit -;; snapshots to branch specific work-in-progress refs before and after +;; snapshots to branch-specific work-in-progress refs before and after ;; making changes, and two commands which can be used to do so on ;; demand. @@ -37,7 +37,9 @@ (defgroup magit-wip nil "Automatically commit to work-in-progress refs." - :group 'magit-extensions) + :link '(info-link "(magit)Wip Modes") + :group 'magit-modes + :group 'magit-essentials) (defcustom magit-wip-after-save-local-mode-lighter " sWip" "Lighter for Magit-Wip-After-Save-Local mode." @@ -125,7 +127,7 @@ in the worktree and the other contains snapshots of the entries in the index." :package-version '(magit . "2.1.0") :group 'magit-wip - :lighter magit-wip-after-change-mode-lighter + :lighter magit-wip-after-apply-mode-lighter :global t) (defun magit-wip-commit-after-apply (&optional files msg) @@ -280,9 +282,5 @@ many \"branches\" of each wip ref are shown." (cl-decf count)) (cons wipref (nreverse tips))))) -;;; magit-wip.el ends soon (provide 'magit-wip) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: ;;; magit-wip.el ends here diff --git a/elpa/magit-20171009.1252/magit-worktree.el b/elpa/magit-20171009.1252/magit-worktree.el new file mode 100644 index 00000000..d7e62613 --- /dev/null +++ b/elpa/magit-20171009.1252/magit-worktree.el @@ -0,0 +1,132 @@ +;;; magit-worktree.el --- worktree support -*- lexical-binding: t -*- + +;; Copyright (C) 2010-2017 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 support for `git-worktree'. + +;;; Code: + +(eval-when-compile + '(require 'pcase)) ; `pcase-dolist' isn't autoloaded by v24.4 + +(require 'magit) + +;;; Commands + +;;;###autoload +(defun magit-worktree-checkout (path branch) + "Checkout BRANCH in a new worktree at PATH." + (interactive + (let ((branch (magit-read-local-branch "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)) + +;;;###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." + (interactive + `(,(read-directory-name "Create worktree: ") + ,@(butlast (magit-branch-read-args "Create and checkout branch")) + ,current-prefix-arg)) + (magit-run-git "worktree" "add" (if force "-B" "-b") + branch (expand-file-name path) start-point) + (magit-diff-visit-directory path)) + +(defun magit-worktree-delete (worktree) + "Delete a worktree, defaulting to the worktree at point. +The primary worktree cannot be deleted." + (interactive + (list (magit-completing-read "Delete worktree" + (cdr (magit-list-worktrees)) + nil t nil nil + (magit-section-when (worktree))))) + (if (file-directory-p (expand-file-name ".git" worktree)) + (user-error "Deleting %s would delete the shared .git directory" worktree) + (let ((primary (file-name-as-directory (caar (magit-list-worktrees))))) + (when (if magit-delete-by-moving-to-trash + (magit-confirm-files 'trash (list "worktree")) + (magit-confirm-files 'delete (list "worktree"))) + (let ((delete-by-moving-to-trash magit-delete-by-moving-to-trash)) + (delete-directory worktree t magit-delete-by-moving-to-trash)) + (if (file-exists-p default-directory) + (magit-run-git "worktree" "prune") + (let ((default-directory primary)) + (magit-run-git "worktree" "prune"))))))) + +(defun magit-worktree-status (worktree) + "Show the status for the worktree at point. +If there is no worktree at point, then read one in the +minibuffer. If the worktree at point is the one whose +status is already being displayed in the current buffer, +then show it in Dired instead." + (interactive + (list (or (magit-section-when (worktree)) + (magit-completing-read + "Show status for worktree" + (cl-delete (directory-file-name (magit-toplevel)) + (magit-list-worktrees) + :test #'equal :key #'car))))) + (magit-diff-visit-directory worktree)) + +;;; Sections + +(defvar magit-worktree-section-map + (let ((map (make-sparse-keymap))) + (define-key map [remap magit-visit-thing] 'magit-worktree-status) + (define-key map [remap magit-delete-thing] 'magit-worktree-delete) + map) + "Keymap for `worktree' sections.") + +(defun magit-insert-worktrees () + "Insert sections for all worktrees. +If there is only one worktree, then insert nothing." + (let ((worktrees (magit-list-worktrees))) + (when (> (length worktrees) 1) + (magit-insert-section (worktrees) + (magit-insert-heading "Worktrees:") + (let* ((cols + (mapcar (-lambda ((path barep commit branch)) + (cons (cond + (branch (propertize branch + 'face 'magit-branch-local)) + (commit (propertize (magit-rev-abbrev commit) + 'face 'magit-hash)) + (barep "(bare)")) + path)) + worktrees)) + (align (1+ (-max (--map (string-width (car it)) cols))))) + (pcase-dolist (`(,head . ,path) cols) + (magit-insert-section (worktree path) + (insert head) + (indent-to align) + (insert (let ((r (file-relative-name path)) + (a (abbreviate-file-name path))) + (if (< (string-width r) (string-width a)) r a))) + (insert ?\n)))) + (insert ?\n))))) + +(provide 'magit-worktree) +;;; magit-worktree.el ends here diff --git a/elpa/magit-20171009.1252/magit.el b/elpa/magit-20171009.1252/magit.el new file mode 100644 index 00000000..ee2322b9 --- /dev/null +++ b/elpa/magit-20171009.1252/magit.el @@ -0,0 +1,1084 @@ +;;; magit.el --- A Git porcelain inside Emacs -*- lexical-binding: t; coding: utf-8 -*- + +;; Copyright (C) 2008-2017 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: Marius Vollmer +;; Maintainer: Jonas Bernoulli +;; Kyle Meyer +;; Noam Postavsky +;; Former-Maintainers: +;; Nicolas Dudebout +;; Peter J. Weisberg +;; Phil Jackson +;; Rémi Vanicat +;; Yann Hodique + +;; Package-Requires: ((emacs "24.4") (async "20170823") (dash "20170810") (with-editor "20170817") (git-commit "20170823") (magit-popup "20170824")) +;; Keywords: git tools vc +;; Homepage: https://github.com/magit/magit + +;; Magit requires at least GNU Emacs 24.4 and Git 1.9.4. + +;; 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: + +;; Magit is an interface to the version control system Git, +;; implemented as an Emacs package. Magit aspires to be a complete +;; Git porcelain. While we cannot (yet) claim, that Magit wraps and +;; improves upon each and every Git command, it is complete enough to +;; allow even experienced Git users 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. + +;;; Code: + +(require 'cl-lib) +(require 'dash) + +(require 'with-editor) +(require 'git-commit) +(require 'magit-core) +(require 'magit-diff) +(require 'magit-apply) +(require 'magit-log) +(require 'magit-repos) + +(require 'format-spec) +(require 'package nil t) ; used in `magit-version' + +(eval-when-compile (require 'dired-x)) +(declare-function dired-jump 'dired-x) +(eval-when-compile (require 'eshell)) +(declare-function eshell-parse-arguments 'eshell) +(eval-when-compile (require 'message)) + +(defconst magit--minimal-git "1.9.4") +(defconst magit--minimal-emacs "24.4") + +;;; Faces + +(defface magit-header-line + '((t :inherit magit-section-heading)) + "Face for the `header-line'." + :group 'magit-faces) + +(defface magit-dimmed + '((((class color) (background light)) :foreground "grey50") + (((class color) (background dark)) :foreground "grey50")) + "Face for text that shouldn't stand out." + :group 'magit-faces) + +(defface magit-hash + '((((class color) (background light)) :foreground "grey60") + (((class color) (background dark)) :foreground "grey40")) + "Face for the sha1 part of the log output." + :group 'magit-faces) + +(defface magit-tag + '((((class color) (background light)) :foreground "Goldenrod4") + (((class color) (background dark)) :foreground "LightGoldenrod2")) + "Face for tag labels shown in log buffer." + :group 'magit-faces) + +(defface magit-branch-remote + '((((class color) (background light)) :foreground "DarkOliveGreen4") + (((class color) (background dark)) :foreground "DarkSeaGreen2")) + "Face for remote branch head labels shown in log buffer." + :group 'magit-faces) + +(defface magit-branch-local + '((((class color) (background light)) :foreground "SkyBlue4") + (((class color) (background dark)) :foreground "LightSkyBlue1")) + "Face for local branches." + :group 'magit-faces) + +(defface magit-branch-current + '((((class color) (background light)) :inherit magit-branch-local :box t) + (((class color) (background dark)) :inherit magit-branch-local :box t)) + "Face for current branch." + :group 'magit-faces) + +(defface magit-head + '((((class color) (background light)) :inherit magit-branch-local) + (((class color) (background dark)) :inherit magit-branch-local)) + "Face for the symbolic ref `HEAD'." + :group 'magit-faces) + +(defface magit-refname + '((((class color) (background light)) :foreground "grey30") + (((class color) (background dark)) :foreground "grey80")) + "Face for refnames without a dedicated face." + :group 'magit-faces) + +(defface magit-refname-stash + '((t :inherit magit-refname)) + "Face for wip refnames." + :group 'magit-faces) + +(defface magit-refname-wip + '((t :inherit magit-refname)) + "Face for wip refnames." + :group 'magit-faces) + +(defface magit-keyword + '((t :inherit font-lock-string-face)) + "Face for parts of commit messages inside brackets." + :group 'magit-faces) + +(defface magit-signature-good + '((t :foreground "green")) + "Face for good signatures." + :group 'magit-faces) + +(defface magit-signature-bad + '((t :foreground "red" :weight bold)) + "Face for bad signatures." + :group 'magit-faces) + +(defface magit-signature-untrusted + '((t :foreground "cyan")) + "Face for good untrusted signatures." + :group 'magit-faces) + +(defface magit-signature-expired + '((t :foreground "orange")) + "Face for signatures that have expired." + :group 'magit-faces) + +(defface magit-signature-expired-key + '((t :inherit magit-signature-expired)) + "Face for signatures made by an expired key." + :group 'magit-faces) + +(defface magit-signature-revoked + '((t :foreground "violet red")) + "Face for signatures made by a revoked key." + :group 'magit-faces) + +(defface magit-signature-error + '((t :foreground "firebrick3")) + "Face for signatures that cannot be checked (e.g. missing key)." + :group 'magit-faces) + +(defface magit-cherry-unmatched + '((t :foreground "cyan")) + "Face for unmatched cherry commits." + :group 'magit-faces) + +(defface magit-cherry-equivalent + '((t :foreground "magenta")) + "Face for equivalent cherry commits." + :group 'magit-faces) + +(defface magit-filename + '((t :weight normal)) + "Face for filenames." + :group 'magit-faces) + +;;; Commands +;;;; Merge + +;;;###autoload (autoload 'magit-merge-popup "magit" nil t) +(magit-define-popup magit-merge-popup + "Popup console for merge commands." + :man-page "git-merge" + :switches '((?f "Fast-forward only" "--ff-only") + (?n "No fast-forward" "--no-ff") + (?s "Squash" "--squash")) + :options '((?s "Strategy" "--strategy=")) + :actions '((?m "Merge" magit-merge) + (?e "Merge and edit message" magit-merge-editmsg) + (?p "Preview merge" magit-merge-preview) + (?n "Merge but don't commit" magit-merge-nocommit)) + :sequence-actions '((?m "Commit merge" magit-commit) + (?a "Abort merge" magit-merge-abort)) + :sequence-predicate 'magit-merge-state + :default-action 'magit-merge + :max-action-columns 2) + +;;;###autoload +(defun magit-merge (rev &optional args nocommit) + "Merge commit REV into the current branch; using default message. + +Unless there are conflicts or a prefix argument is used create a +merge commit using a generic commit message and without letting +the user inspect the result. With a prefix argument pretend the +merge failed to give the user the opportunity to inspect the +merge. + +\(git merge --no-edit|--no-commit [ARGS] REV)" + (interactive (list (magit-read-other-branch-or-commit "Merge") + (magit-merge-arguments) + current-prefix-arg)) + (magit-merge-assert) + (magit-run-git-async "merge" (if nocommit "--no-commit" "--no-edit") args rev)) + +;;;###autoload +(defun magit-merge-editmsg (rev &optional args) + "Merge commit REV into the current branch; and edit message. +Perform the merge and prepare a commit message but let the user +edit it. +\n(git merge --edit --no-ff [ARGS] REV)" + (interactive (list (magit-read-other-branch-or-commit "Merge") + (magit-merge-arguments))) + (magit-merge-assert) + (cl-pushnew "--no-ff" args :test #'equal) + (apply #'magit-run-git-with-editor "merge" "--edit" + (append args (list rev)))) + +;;;###autoload +(defun magit-merge-nocommit (rev &optional args) + "Merge commit REV into the current branch; pretending it failed. +Pretend the merge failed to give the user the opportunity to +inspect the merge and change the commit message. +\n(git merge --no-commit --no-ff [ARGS] REV)" + (interactive (list (magit-read-other-branch-or-commit "Merge") + (magit-merge-arguments))) + (magit-merge-assert) + (cl-pushnew "--no-ff" args :test #'equal) + (magit-run-git-async "merge" "--no-commit" args rev)) + +;;;###autoload +(defun magit-merge-preview (rev) + "Preview result of merging REV into the current branch." + (interactive (list (magit-read-other-branch-or-commit "Preview merge"))) + (magit-mode-setup #'magit-merge-preview-mode rev)) + +(define-derived-mode magit-merge-preview-mode magit-diff-mode "Magit Merge" + "Mode for previewing a merge." + :group 'magit-diff + (hack-dir-local-variables-non-file-buffer)) + +(defun magit-merge-preview-refresh-buffer (rev) + (let* ((branch (magit-get-current-branch)) + (head (or branch (magit-rev-verify "HEAD")))) + (setq header-line-format + (propertize (format "Preview merge of %s into %s" + rev (or branch "HEAD")) + 'face 'magit-header-line)) + (magit-insert-section (diffbuf) + (magit-git-wash #'magit-diff-wash-diffs + "merge-tree" (magit-git-string "merge-base" head rev) head rev)))) + +;;;###autoload +(defun magit-merge-abort () + "Abort the current merge operation. +\n(git merge --abort)" + (interactive) + (if (file-exists-p (magit-git-dir "MERGE_HEAD")) + (when (magit-confirm 'abort-merge) + (magit-run-git-async "merge" "--abort")) + (user-error "No merge in progress"))) + +(defun magit-checkout-stage (file arg) + "During a conflict checkout and stage side, or restore conflict." + (interactive + (let ((file (magit-completing-read "Checkout file" + (magit-tracked-files) nil nil nil + 'magit-read-file-hist + (magit-current-file)))) + (cond ((member file (magit-unmerged-files)) + (list file (magit-checkout-read-stage file))) + ((yes-or-no-p (format "Restore conflicts in %s? " file)) + (list file "--merge")) + (t + (user-error "Quit"))))) + (pcase (cons arg (cddr (car (magit-file-status file)))) + ((or `("--ours" ?D ,_) + `("--theirs" ,_ ?D)) + (magit-run-git "rm" "--" file)) + (_ (if (equal arg "--merge") + ;; This fails if the file was deleted on one + ;; side. And we cannot do anything about it. + (magit-run-git "checkout" "--merge" "--" file) + (magit-call-git "checkout" arg "--" file) + (magit-run-git "add" "-u" "--" file))))) + +(defun magit-merge-state () + (file-exists-p (magit-git-dir "MERGE_HEAD"))) + +(defun magit-merge-assert () + (or (not (magit-anything-modified-p t)) + (magit-confirm 'merge-dirty + "Merging with dirty worktree is risky. Continue") + (user-error "Abort"))) + +(defun magit-checkout-read-stage (file) + (magit-read-char-case (format "For %s checkout: " file) t + (?o "[o]ur stage" "--ours") + (?t "[t]heir stage" "--theirs") + (?c "[c]onflict" "--merge"))) + +(defun magit-insert-merge-log () + "Insert section for the on-going merge. +Display the heads that are being merged. +If no merge is in progress, do nothing." + (-when-let (heads (mapcar 'magit-get-shortname + (magit-file-lines (magit-git-dir "MERGE_HEAD")))) + (magit-insert-section (commit (car heads)) + (magit-insert-heading + (format "Merging %s:" (mapconcat 'identity heads ", "))) + (magit-insert-log + (concat (magit-git-string "merge-base" "--octopus" "HEAD" (car heads)) + ".." (car heads)) + (let ((args magit-log-section-arguments)) + (unless (member "--decorate=full" magit-log-section-arguments) + (push "--decorate=full" args)) + args))))) + +;;;; Reset + +;;;###autoload (autoload 'magit-reset-popup "magit" nil t) +(magit-define-popup magit-reset-popup + "Popup console for reset commands." + :man-page "git-reset" + :actions '((?m "reset mixed (HEAD and index)" magit-reset-head) + (?s "reset soft (HEAD only)" magit-reset-soft) + (?h "reset hard (HEAD, index, and files)" magit-reset-hard) + (?i "reset index (index only)" magit-reset-index) nil + (?f "reset a file" magit-file-checkout)) + :max-action-columns 1) + +;;;###autoload +(defun magit-reset-index (commit) + "Reset the index to COMMIT. +Keep the head and working tree as-is, so if COMMIT refers to the +head this effectively unstages all changes. +\n(git reset COMMIT .)" + (interactive (list (magit-read-branch-or-commit "Reset index to"))) + (magit-reset-internal nil commit ".")) + +;;;###autoload +(defun magit-reset (commit &optional hard) + "Reset the head and index to COMMIT, but not the working tree. +With a prefix argument also reset the working tree. +\n(git reset --mixed|--hard COMMIT)" + (interactive (list (magit-read-branch-or-commit + (if current-prefix-arg + "Hard reset to" + "Reset head to")) + current-prefix-arg)) + (magit-reset-internal (if hard "--hard" "--mixed") commit)) + +;;;###autoload +(defun magit-reset-head (commit) + "Reset the head and index to COMMIT, but not the working tree. +\n(git reset --mixed COMMIT)" + (interactive (list (magit-read-branch-or-commit "Reset head to"))) + (magit-reset-internal "--mixed" commit)) + +;;;###autoload +(defun magit-reset-soft (commit) + "Reset the head to COMMIT, but not the index and working tree. +\n(git reset --soft REVISION)" + (interactive (list (magit-read-branch-or-commit "Soft reset to"))) + (magit-reset-internal "--soft" commit)) + +;;;###autoload +(defun magit-reset-hard (commit) + "Reset the head, index, and working tree to COMMIT. +\n(git reset --hard REVISION)" + (interactive (list (magit-read-branch-or-commit "Hard reset to"))) + (magit-reset-internal "--hard" commit)) + +(defun magit-reset-internal (arg commit &optional path) + (when (and (not (member arg '("--hard" nil))) + (equal (magit-rev-parse commit) + (magit-rev-parse "HEAD~"))) + (with-temp-buffer + (magit-git-insert "show" "-s" "--format=%B" "HEAD") + (when git-commit-major-mode + (funcall git-commit-major-mode)) + (git-commit-setup-font-lock) + (git-commit-save-message))) + (let ((cmd (if (and (equal commit "HEAD") (not arg)) "unstage" "reset"))) + (magit-wip-commit-before-change nil (concat " before " cmd)) + (magit-run-git "reset" arg commit "--" path) + (when (equal cmd "unstage") + (magit-wip-commit-after-apply nil " after unstage")))) + +;;;; Tag + +;;;###autoload (autoload 'magit-tag-popup "magit" nil t) +(magit-define-popup magit-tag-popup + "Popup console for tag 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. +With a prefix argument annotate the tag. +\n(git tag [--annotate] NAME REV)" + (interactive (list (magit-read-tag "Tag name") + (or (and (memq 'magit-tag magit-no-confirm-default) + (or (magit-branch-or-commit-at-point) + (magit-get-current-branch))) + (magit-read-branch-or-commit "Place tag on")) + (let ((args (magit-tag-arguments))) + (when current-prefix-arg + (cl-pushnew "--annotate" args)) + args))) + (magit-run-git-with-editor "tag" args name rev)) + +;;;###autoload +(defun magit-tag-delete (tags) + "Delete one or more tags. +If the region marks multiple tags (and nothing else), then offer +to delete those, otherwise prompt for a single tag to be deleted, +defaulting to the tag at point. +\n(git tag -d TAGS)" + (interactive (list (--if-let (magit-region-values 'tag) + (magit-confirm t nil "Delete %i tags" it) + (magit-read-tag "Delete tag" t)))) + (magit-run-git "tag" "-d" tags)) + +(defun magit-tag-prune (tags remote-tags remote) + "Offer to delete tags missing locally from REMOTE, and vice versa." + (interactive + (let* ((remote (magit-read-remote "Prune tags using remote")) + (tags (magit-list-tags)) + (rtags (prog2 (message "Determining remote tags...") + (magit-remote-list-tags remote) + (message "Determining remote tags...done"))) + (ltags (-difference tags rtags)) + (rtags (-difference rtags tags))) + (unless (or ltags rtags) + (message "Same tags exist locally and remotely")) + (unless (magit-confirm t "Delete %s locally" + "Delete %i tags locally" ltags) + (setq ltags nil)) + (unless (magit-confirm t "Delete %s from remote" + "Delete %i tags from remote" rtags) + (setq rtags nil)) + (list ltags rtags remote))) + (when tags + (magit-call-git "tag" "-d" tags)) + (when remote-tags + (magit-run-git-async "push" remote (--map (concat ":" it) remote-tags)))) + +;;;; Dispatch Popup + +;;;###autoload (autoload 'magit-dispatch-popup "magit" nil t) +(magit-define-popup magit-dispatch-popup + "Popup console for dispatching other popups." + :actions '("Popup and dwim commands" + (?A "Cherry-picking" magit-cherry-pick-popup) + (?b "Branching" magit-branch-popup) + (?B "Bisecting" magit-bisect-popup) + (?c "Committing" magit-commit-popup) + (?d "Diffing" magit-diff-popup) + (?D "Change diffs" magit-diff-refresh-popup) + (?e "Ediff dwimming" magit-ediff-dwim) + (?E "Ediffing" magit-ediff-popup) + (?f "Fetching" magit-fetch-popup) + (?F "Pulling" magit-pull-popup) + (?l "Logging" magit-log-popup) + (?L "Change logs" magit-log-refresh-popup) + (?m "Merging" magit-merge-popup) + (?M "Remoting" magit-remote-popup) + (?o "Submodules" magit-submodule-popup) + (?O "Subtrees" magit-subtree-popup) + (?P "Pushing" magit-push-popup) + (?r "Rebasing" magit-rebase-popup) + (?t "Tagging" magit-tag-popup) + (?T "Notes" magit-notes-popup) + (?V "Reverting" magit-revert-popup) + (?w "Apply patches" magit-am-popup) + (?W "Format patches" magit-patch-popup) + (?X "Resetting" magit-reset-popup) + (?y "Show Refs" magit-show-refs-popup) + (?z "Stashing" magit-stash-popup) + (?! "Running" magit-run-popup) + "Applying changes" + (?a "Apply" magit-apply) + (?s "Stage" magit-stage) + (?u "Unstage" magit-unstage) + (?v "Reverse" magit-reverse) + (?S "Stage all" magit-stage-modified) + (?U "Unstage all" magit-unstage-all) + (?k "Discard" magit-discard) + "Essential commands" + (?g " refresh current buffer" magit-refresh) + ;; These bindings only work because of :setup-function. + (?\t " toggle section at point" magit-section-toggle) + (?\r " visit thing at point" magit-visit-thing) + ;; This binding has no effect and only appears to do + ;; so because it is identical to the global binding. + ("C-h m" "show all key bindings" describe-mode)) + :setup-function 'magit-dispatch-popup-setup + :max-action-columns (lambda (heading) + (pcase heading + ("Popup and dwim commands" 4) + ("Applying changes" 3) + ("Essential commands" 1)))) + +(defvar magit-dispatch-popup-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map magit-popup-mode-map) + (cond ((featurep 'jkl) + (define-key map [tab] 'magit-invoke-popup-action) + (define-key map [return] 'magit-invoke-popup-action)) + (t + (define-key map (kbd "C-i") 'magit-invoke-popup-action) + (define-key map (kbd "C-m") 'magit-invoke-popup-action))) + map) + "Keymap used by `magit-dispatch-popup'.") + +(defun magit-dispatch-popup-setup (val def) + (magit-popup-default-setup val def) + (use-local-map magit-dispatch-popup-map) + ;; This is necessary for users (i.e. me) who have broken the + ;; connection between C-i (aka TAB) and tab, and C-m (aka RET) + ;; and return. + (magit-popup-put + :actions (nconc (magit-popup-get :actions) + (list (make-magit-popup-event :key 'tab + :fun 'magit-section-toggle) + (make-magit-popup-event :key 'return + :fun 'magit-visit-thing))))) + +;;;; Git Popup + +(defcustom magit-shell-command-verbose-prompt t + "Whether to show the working directory when reading a command. +This affects `magit-git-command', `magit-git-command-topdir', +`magit-shell-command', and `magit-shell-command-topdir'." + :package-version '(magit . "2.11.0") + :group 'magit-commands + :type 'boolean) + +(defvar magit-git-command-history nil) + +;;;###autoload (autoload 'magit-run-popup "magit" nil t) +(magit-define-popup magit-run-popup + "Popup console for running raw Git commands." + :actions '((?! "Git Subcommand (in topdir)" magit-git-command-topdir) + (?k "Gitk" magit-run-gitk) + (?p "Git Subcommand (in pwd)" magit-git-command) + (?a "Gitk --all" magit-run-gitk-all) + (?s "Shell command (in topdir)" magit-shell-command-topdir) + (?b "Gitk --branches" magit-run-gitk-branches) + (?S "Shell command (in pwd)" magit-shell-command) + (?g "Git Gui" magit-run-git-gui)) + :default-action 'magit-git-command + :max-action-columns 2) + +;;;###autoload +(defun magit-git-command (command) + "Execute COMMAND asynchonously; display output. + +Interactively, prompt for COMMAND in the minibuffer. \"git \" is +used as initial input, but can be deleted to run another command. + +With a prefix argument COMMAND is run in the top-level directory +of the current working tree, otherwise in `default-directory'." + (interactive (list (magit-read-shell-command nil "git "))) + (magit--shell-command command)) + +;;;###autoload +(defun magit-git-command-topdir (command) + "Execute COMMAND asynchonously; display output. + +Interactively, prompt for COMMAND in the minibuffer. \"git \" is +used as initial input, but can be deleted to run another command. + +COMMAND is run in the top-level directory of the current +working tree." + (interactive (list (magit-read-shell-command t "git "))) + (magit--shell-command command (magit-toplevel))) + +;;;###autoload +(defun magit-shell-command (command) + "Execute COMMAND asynchonously; display output. + +Interactively, prompt for COMMAND in the minibuffer. With a +prefix argument COMMAND is run in the top-level directory of +the current working tree, otherwise in `default-directory'." + (interactive (list (magit-read-shell-command))) + (magit--shell-command command)) + +;;;###autoload +(defun magit-shell-command-topdir (command) + "Execute COMMAND asynchonously; display output. + +Interactively, prompt for COMMAND in the minibuffer. COMMAND +is run in the top-level directory of the current working tree." + (interactive (list (magit-read-shell-command t))) + (magit--shell-command command (magit-toplevel))) + +(defun magit--shell-command (command &optional directory) + (let ((default-directory (or directory default-directory)) + (process-environment process-environment)) + (push "GIT_PAGER=cat" process-environment) + (magit-start-process shell-file-name nil + shell-command-switch command)) + (magit-process-buffer)) + +(defun magit-read-shell-command (&optional toplevel initial-input) + (let ((dir (abbreviate-file-name + (if (or toplevel current-prefix-arg) + (or (magit-toplevel) + (user-error "Not inside a Git repository")) + default-directory)))) + (read-shell-command (if magit-shell-command-verbose-prompt + (format "Async shell command in %s: " dir) + "Async shell command: ") + initial-input 'magit-git-command-history))) + +;;; Revision Stack + +(defvar magit-revision-stack nil) + +(defcustom magit-pop-revision-stack-format + '("[%N: %h] " "%N: %H\n %s\n" "\\[\\([0-9]+\\)[]:]") + "Control how `magit-pop-revision-stack' inserts a revision. + +The command `magit-pop-revision-stack' inserts a representation +of the revision last pushed to the `magit-revision-stack' into +the current buffer. It inserts text at point and/or near the end +of the buffer, and removes the consumed revision from the stack. + +The entries on the stack have the format (HASH TOPLEVEL) and this +option has the format (POINT-FORMAT EOB-FORMAT INDEX-REGEXP), all +of which may be nil or a string (though either one of EOB-FORMAT +or POINT-FORMAT should be a string, and if INDEX-REGEXP is +non-nil, then the two formats should be too). + +First INDEX-REGEXP is used to find the previously inserted entry, +by searching backward from point. The first submatch must match +the index number. That number is incremented by one, and becomes +the index number of the entry to be inserted. If you don't want +to number the inserted revisions, then use nil for INDEX-REGEXP. + +If INDEX-REGEXP is non-nil, then both POINT-FORMAT and EOB-FORMAT +should contain \"%N\", which is replaced with the number that was +determined in the previous step. + +Both formats, if non-nil and after removing %N, are then expanded +using `git show --format=FORMAT ...' inside TOPLEVEL. + +The expansion of POINT-FORMAT is inserted at point, and the +expansion of EOB-FORMAT is inserted at the end of the buffer (if +the buffer ends with a comment, then it is inserted right before +that)." + :package-version '(magit . "2.3.0") + :group 'magit-commands + :type '(list (choice (string :tag "Insert at point format") + (cons (string :tag "Insert at point format") + (repeat (string :tag "Argument to git show"))) + (const :tag "Don't insert at point" nil)) + (choice (string :tag "Insert at eob format") + (cons (string :tag "Insert at eob format") + (repeat (string :tag "Argument to git show"))) + (const :tag "Don't insert at eob" nil)) + (choice (regexp :tag "Find index regexp") + (const :tag "Don't number entries" nil)))) + +(defun magit-pop-revision-stack (rev toplevel) + "Insert a representation of a revision into the current buffer. + +Pop a revision from the `magit-revision-stack' and insert it into +the current buffer according to `magit-pop-revision-stack-format'. +Revisions can be put on the stack using `magit-copy-section-value' +and `magit-copy-buffer-revision'. + +If the stack is empty or with a prefix argument, instead read a +revision in the minibuffer. By using the minibuffer history this +allows selecting an item which was popped earlier or to insert an +arbitrary reference or revision without first pushing it onto the +stack. + +When reading the revision from the minibuffer, then it might not +be possible to guess the correct repository. When this command +is called inside a repository (e.g. while composing a commit +message), then that repository is used. Otherwise (e.g. while +composing an email) then the repository recorded for the top +element of the stack is used (even though we insert another +revision). If not called inside a repository and with an empty +stack, or with two prefix arguments, then read the repository in +the minibuffer too." + (interactive + (if (or current-prefix-arg (not magit-revision-stack)) + (let ((default-directory + (or (and (not (= (prefix-numeric-value current-prefix-arg) 16)) + (or (magit-toplevel) + (cadr (car magit-revision-stack)))) + (magit-read-repository)))) + (list (magit-read-branch-or-commit "Insert revision") + default-directory)) + (push (caar magit-revision-stack) magit-revision-history) + (pop magit-revision-stack))) + (if rev + (-let [(pnt-format eob-format idx-format) magit-pop-revision-stack-format] + (let ((default-directory toplevel) + (idx (and idx-format + (save-excursion + (if (re-search-backward idx-format nil t) + (number-to-string + (1+ (string-to-number (match-string 1)))) + "1")))) + pnt-args eob-args) + (when (listp pnt-format) + (setq pnt-args (cdr pnt-format)) + (setq pnt-format (car pnt-format))) + (when (listp eob-format) + (setq eob-args (cdr eob-format)) + (setq eob-format (car eob-format))) + (when pnt-format + (when idx-format + (setq pnt-format + (replace-regexp-in-string "%N" idx pnt-format t t))) + (magit-rev-insert-format pnt-format rev pnt-args) + (backward-delete-char 1)) + (when eob-format + (when idx-format + (setq eob-format + (replace-regexp-in-string "%N" idx eob-format t t))) + (save-excursion + (goto-char (point-max)) + (skip-syntax-backward ">s-") + (beginning-of-line) + (if (and comment-start (looking-at comment-start)) + (while (looking-at comment-start) + (forward-line -1)) + (forward-line) + (unless (= (current-column) 0) + (insert ?\n))) + (insert ?\n) + (magit-rev-insert-format eob-format rev eob-args) + (backward-delete-char 1))))) + (user-error "Revision stack is empty"))) + +(define-key git-commit-mode-map + (kbd "C-c C-w") 'magit-pop-revision-stack) + +(defun magit-copy-section-value () + "Save the value of the current section for later use. + +Save the section value to the `kill-ring', and, provided that +the current section is a commit, branch, or tag section, push +the (referenced) revision to the `magit-revision-stack' for use +with `magit-pop-revision-stack'. + +When the current section is a branch or a tag, and a prefix +argument is used, then save the revision at its tip to the +`kill-ring' instead of the reference name. + +When the region is active, then save that to the `kill-ring', +like `kill-ring-save' would, instead of behaving as described +above." + (interactive) + (if (use-region-p) + (copy-region-as-kill nil nil 'region) + (-when-let* ((section (magit-current-section)) + (value (magit-section-value section))) + (magit-section-case + ((branch commit module-commit tag) + (let ((default-directory default-directory) ref) + (magit-section-case + ((branch tag) + (setq ref value)) + (module-commit + (setq default-directory + (file-name-as-directory + (expand-file-name (magit-section-parent-value section) + (magit-toplevel)))))) + (setq value (magit-rev-parse value)) + (push (list value default-directory) magit-revision-stack) + (kill-new (message "%s" (or (and current-prefix-arg ref) + value))))) + (t (kill-new (message "%s" value))))))) + +(defun magit-copy-buffer-revision () + "Save the revision of the current buffer for later use. + +Save the revision shown in the current buffer to the `kill-ring' +and push it to the `magit-revision-stack'. + +This command is mainly intended for use in `magit-revision-mode' +buffers, the only buffers where it is always unambiguous exactly +which revision should be saved. + +Most other Magit buffers usually show more than one revision, in +some way or another, so this command has to select one of them, +and that choice might not always be the one you think would have +been the best pick. + +In such buffers it is often more useful to save the value of +the current section instead, using `magit-copy-section-value'. + +When the region is active, then save that to the `kill-ring', +like `kill-ring-save' would, instead of behaving as described +above." + (interactive) + (if (use-region-p) + (copy-region-as-kill nil nil 'region) + (-when-let (rev (cond ((memq major-mode '(magit-cherry-mode + magit-log-select-mode + magit-reflog-mode + magit-refs-mode + magit-revision-mode + magit-stash-mode + magit-stashes-mode)) + (car magit-refresh-args)) + ((memq major-mode '(magit-diff-mode + magit-log-mode)) + (let ((r (caar magit-refresh-args))) + (if (string-match "\\.\\.\\.?\\(.+\\)" r) + (match-string 1 r) + r))) + ((eq major-mode 'magit-status-mode) "HEAD"))) + (when (magit-rev-verify-commit rev) + (setq rev (magit-rev-parse rev)) + (push (list rev default-directory) magit-revision-stack) + (kill-new (message "%s" rev)))))) + +;;; (Keywords) + +(defconst magit-font-lock-keywords + (eval-when-compile + `((,(concat "(\\(magit-define-section-jumper\\)\\_>" + "[ \t'\(]*" + "\\(\\(?:\\sw\\|\\s_\\)+\\)?") + (1 'font-lock-keyword-face) + (2 'font-lock-function-name-face nil t)) + (,(concat "(" (regexp-opt '("magit-insert-section" + "magit-section-case" + "magit-section-when" + "magit-bind-match-strings" + "magit-with-temp-index" + "magit-with-blob" + "magit-with-toplevel") t) + "\\_>") + . 1)))) + +(font-lock-add-keywords 'emacs-lisp-mode magit-font-lock-keywords) + +;;; (Versions) + +(defvar magit-version 'undefined + "The version of Magit that you're using. +Use the function by the same name instead of this variable.") + +;;;###autoload +(defun magit-version (&optional print-dest) + "Return the version of Magit currently in use. +If optional argument PRINT-DEST is non-nil, output +stream (interactively, the echo area, or the current buffer with +a prefix argument), also print the used versions of Magit, Git, +and Emacs to it." + (interactive (list (if current-prefix-arg (current-buffer) t))) + (let ((magit-git-global-arguments nil) + (toplib (or load-file-name buffer-file-name)) + debug) + (unless (and toplib + (equal (file-name-nondirectory toplib) "magit.el")) + (setq toplib (locate-library "magit.el"))) + (setq toplib (and toplib (file-chase-links toplib))) + (push toplib debug) + (when toplib + (let* ((topdir (file-name-directory toplib)) + (gitdir (expand-file-name + ".git" (file-name-directory + (directory-file-name topdir)))) + (static (locate-library "magit-version.el" nil (list topdir))) + (static (and static (file-chase-links static)))) + (or (progn + (push 'repo debug) + (when (and (file-exists-p gitdir) + ;; It is a repo, but is it the Magit repo? + (file-exists-p + (expand-file-name "../lisp/magit.el" gitdir))) + (push t debug) + ;; Inside the repo the version file should only exist + ;; while running make. + (when (and static (not noninteractive)) + (ignore-errors (delete-file static))) + (setq magit-version + (let ((default-directory topdir)) + (magit-git-string "describe" "--tags" "--dirty"))))) + (progn + (push 'static debug) + (when (and static (file-exists-p static)) + (push t debug) + (load-file static) + magit-version)) + (when (featurep 'package) + (push 'elpa debug) + (ignore-errors + (--when-let (assq 'magit package-alist) + (push t debug) + (setq magit-version + (and (fboundp 'package-desc-version) + (package-version-join + (package-desc-version (cadr it)))))))) + (progn + (push 'debug debug) + (let ((dirname (file-name-nondirectory + (directory-file-name topdir)))) + (when (string-match "\\`magit-\\([0-9]\\{8\\}\\.[0-9]*\\)" + dirname) + (setq magit-version (match-string 1 dirname)))))))) + (if (stringp magit-version) + (when print-dest + (princ (format "Magit %s, Git %s, Emacs %s, %s" + (or magit-version "(unknown)") + (or (let ((magit-git-debug + (lambda (err) + (display-warning '(magit git) + err :error)))) + (magit-git-version t)) + "(unknown)") + emacs-version + system-type) + print-dest)) + (setq debug (reverse debug)) + (setq magit-version 'error) + (when magit-version + (push magit-version debug)) + (unless (equal (getenv "TRAVIS") "true") + ;; The repository is a sparse clone. + (message "Cannot determine Magit's version %S" debug))) + magit-version)) + +(defun magit-debug-git-executable () + "Display a buffer with information about `magit-git-executable'. +See info node `(magit)Debugging Tools' for more information." + (interactive) + (with-current-buffer (get-buffer-create "*magit-git-debug*") + (pop-to-buffer (current-buffer)) + (erase-buffer) + (insert (format "magit-git-executable: %S" magit-git-executable) + (unless (file-name-absolute-p magit-git-executable) + (format " [%S]" (executable-find magit-git-executable))) + (format " (%s)\n" + (let* ((errmsg nil) + (magit-git-debug (lambda (err) (setq errmsg err)))) + (or (magit-git-version t) errmsg)))) + (insert (format "exec-path: %S\n" exec-path)) + (--when-let (cl-set-difference + (-filter #'file-exists-p (remq nil (parse-colon-path + (getenv "PATH")))) + (-filter #'file-exists-p (remq nil exec-path)) + :test #'file-equal-p) + (insert (format " entries in PATH, but not in exec-path: %S\n" it))) + (dolist (execdir exec-path) + (insert (format " %s (%s)\n" execdir (car (file-attributes execdir)))) + (when (file-directory-p execdir) + (dolist (exec (directory-files + execdir t (concat + "\\`git" (regexp-opt exec-suffixes) "\\'"))) + (insert (format " %s (%s)\n" exec + (let* ((magit-git-executable exec) + (errmsg nil) + (magit-git-debug (lambda (err) (setq errmsg err)))) + (or (magit-git-version t) errmsg))))))))) + +;;; (Asserts) + +(defun magit-startup-asserts () + (let ((version (magit-git-version))) + (when (and version + (version< version magit--minimal-git) + (not (equal (getenv "TRAVIS") "true"))) + (display-warning 'magit (format "\ +Magit requires Git >= %s, you are using %s. + +If this comes as a surprise to you, because you do actually have +a newer version installed, then that probably means that the +older version happens to appear earlier on the `$PATH'. If you +always start Emacs from a shell, then that can be fixed in the +shell's init file. If you start Emacs by clicking on an icon, +or using some sort of application launcher, then you probably +have to adjust the environment as seen by graphical interface. +For X11 something like ~/.xinitrc should work. + +If you use Tramp to work inside remote Git repositories, then you +have to make sure a suitable Git is used on the remote machines +too.\n" magit--minimal-git version) :error))) + (when (version< emacs-version magit--minimal-emacs) + (display-warning 'magit (format "\ +Magit requires Emacs >= %s, you are using %s. + +If this comes as a surprise to you, because you do actually have +a newer version installed, then that probably means that the +older version happens to appear earlier on the `$PATH'. If you +always start Emacs from a shell, then that can be fixed in the +shell's init file. If you start Emacs by clicking on an icon, +or using some sort of application launcher, then you probably +have to adjust the environment as seen by graphical interface. +For X11 something like ~/.xinitrc should work.\n" + magit--minimal-emacs emacs-version) + :error)) + (--each '((magit-log-edit . git-commit) + (git-commit-mode . git-commit) + (git-rebase-mode . git-rebase)) + (when (or (featurep (car it)) (locate-library (symbol-name (car it)))) + (display-warning 'magit (format "%s has to be removed + +Magit is no longer compatible with the library `%s', +which was used in earlier releases. Please remove it, so that +Magit can use the successor `%s' without the obsolete +library getting in the way. Then restart Emacs.\n" + (car it) (car it) (cdr it)) :error)))) + +;;; (Features) + +(provide 'magit) + +(cl-eval-when (load eval) + (require 'magit-status) + (require 'magit-refs) + (require 'magit-files) + (require 'magit-branch) + (require 'magit-worktree) + (require 'magit-notes) + (require 'magit-sequence) + (require 'magit-commit) + (require 'magit-remote) + (require 'magit-bisect) + (require 'magit-stash) + (require 'magit-blame) + (require 'magit-obsolete) + (unless (load "magit-autoloads" t t) + (require 'magit-submodule) + (require 'magit-subtree) + (require 'magit-ediff) + (require 'magit-extras) + (require 'git-rebase) + (require 'magit-imenu) + (require 'magit-bookmark))) + +(eval-after-load 'bookmark + '(require 'magit-bookmark)) + +(if after-init-time + (progn (magit-startup-asserts) + (magit-version)) + (add-hook 'after-init-hook #'magit-startup-asserts t) + (add-hook 'after-init-hook #'magit-version t)) + +;;; magit.el ends here diff --git a/elpa/magit-20171009.1252/magit.info b/elpa/magit-20171009.1252/magit.info new file mode 100644 index 00000000..b08ff86c --- /dev/null +++ b/elpa/magit-20171009.1252/magit.info @@ -0,0 +1,171 @@ +This is magit.info, produced by makeinfo version 5.2 from magit.texi. + + Copyright (C) 2015-2017 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: 752 +magit.info-2: 301745 + +Tag Table: +(Indirect) +Node: Top752 +Node: Introduction5726 +Node: Installation10449 +Node: Installing from an Elpa Archive10789 +Node: Installing from the Git Repository11892 +Node: Post-Installation Tasks14535 +Node: Getting Started15820 +Node: Interface Concepts21167 +Node: Modes and Buffers21441 +Node: Switching Buffers23186 +Node: Naming Buffers27727 +Node: Quitting Windows30735 +Node: Automatic Refreshing of Magit Buffers32367 +Node: Automatic Saving of File-Visiting Buffers35135 +Node: Automatic Reverting of File-Visiting Buffers36320 +Node: Risk of Reverting Automatically41316 +Node: Sections43699 +Node: Section Movement44640 +Node: Section Visibility48567 +Node: Section Hooks52042 +Node: Section Types and Values54323 +Node: Section Options55593 +Node: Popup Buffers and Prefix Commands56065 +Node: Completion and Confirmation58432 +Node: Running Git61716 +Node: Viewing Git Output61952 +Node: Running Git Manually62952 +Node: Git Executable65354 +Node: Global Git Arguments67636 +Node: Inspecting68442 +Node: Status Buffer69589 +Node: Status Sections72502 +Node: Status Header Sections77017 +Node: Status Module Sections79647 +Node: Status Options82147 +Node: Repository List83901 +Node: Logging86059 +Node: Refreshing Logs88506 +Node: Log Buffer89891 +Node: Log Margin92726 +Node: Select from Log95366 +Node: Reflog97470 +Node: Cherries98987 +Node: Diffing100714 +Node: Refreshing Diffs103661 +Node: Diff Buffer107152 +Node: Diff Options109737 +Node: Revision Buffer113107 +Node: Ediffing114824 +Node: References Buffer118420 +Node: References Sections125719 +Node: Bisecting126580 +Node: Visiting Blobs128318 +Node: Blaming128827 +Node: Manipulating132256 +Node: Repository Setup132572 +Node: Staging and Unstaging133612 +Node: Staging from File-Visiting Buffers137693 +Node: Applying138861 +Node: Committing140754 +Node: Initiating a Commit141337 +Node: Editing Commit Messages144648 +Node: Branching155044 +Node: The Two Remotes155244 +Node: The Branch Popup157861 +Node: The Branch Config Popup168109 +Node: Merging174005 +Node: Resolving Conflicts176172 +Node: Rebasing181174 +Node: Editing Rebase Sequences185231 +Node: Information About In-Progress Rebase188261 +Ref: Information About In-Progress Rebase-Footnote-1195068 +Node: Cherry Picking195654 +Node: Reverting197259 +Node: Resetting198622 +Node: Stashing200039 +Node: Transferring204233 +Node: Remotes204471 +Node: Fetching205749 +Node: Pulling207105 +Node: Pushing207941 +Node: Creating and Sending Patches212675 +Node: Applying Patches213370 +Node: Miscellaneous214367 +Node: Tagging214670 +Node: Notes215454 +Node: Submodules217978 +Node: Listing Submodules218192 +Node: Submodule Popup220069 +Node: Subtree221352 +Node: Common Commands222599 +Node: Wip Modes224344 +Node: Minor Mode for Buffers Visiting Files231140 +Node: Minor Mode for Buffers Visiting Blobs234489 +Node: Customizing235302 +Node: Per-Repository Configuration236974 +Node: Essential Settings238621 +Node: Safety238945 +Node: Performance240710 +Node: Microsoft Windows Performance247570 +Node: MacOS Performance248763 +Ref: MacOS Performance-Footnote-1249999 +Ref: MacOS Performance-Footnote-2250081 +Ref: MacOS Performance-Footnote-3250141 +Node: Plumbing250307 +Node: Calling Git251131 +Node: Getting a Value from Git252654 +Node: Calling Git for Effect255758 +Node: Section Plumbing262276 +Node: Creating Sections262504 +Node: Section Selection266403 +Node: Matching Sections268083 +Node: Refreshing Buffers273515 +Node: Conventions276650 +Node: Confirmation and Completion276827 +Node: Theming Faces277725 +Node: FAQ285876 +Node: FAQ - How to …?286318 +Node: How to show git's output?286682 +Node: How to install the gitman info manual?287436 +Node: How to show diffs for gpg-encrypted files?288406 +Node: How does branching and pushing work?289002 +Node: Can Magit be used as ‘ediff-version-control-package’?289371 +Node: FAQ - Issues and Errors291367 +Node: Magit is slow292111 +Node: I changed several thousand files at once and now Magit is unusable292325 +Node: I am having problems committing293054 +Node: I am using MS Windows and cannot push with Magit293535 +Node: I am using OS X and SOMETHING works in shell but not in Magit294152 +Node: Diffs contain control sequences294958 +Node: Expanding a file to show the diff causes it to disappear296032 +Node: Point is wrong in the ‘COMMIT_EDITMSG’ buffer296589 +Node: The mode-line information isn't always up-to-date297641 +Node: Emacs 245 hangs when loading Magit298708 +Node: Debugging Tools299258 +Node: Keystroke Index301745 +Node: Command Index331095 +Node: Function Index361834 +Node: Variable Index375510 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/magit-20161115.1658/magit.info-1 b/elpa/magit-20171009.1252/magit.info-1 similarity index 77% rename from elpa/magit-20161115.1658/magit.info-1 rename to elpa/magit-20171009.1252/magit.info-1 index 156bee3d..07cfe092 100644 --- a/elpa/magit-20161115.1658/magit.info-1 +++ b/elpa/magit-20171009.1252/magit.info-1 @@ -1,14 +1,6 @@ This is magit.info, produced by makeinfo version 5.2 from magit.texi. -Magit is an interface to the version control system Git, implemented as -an Emacs package. Magit aspires to be a complete Git porcelain. While -we cannot (yet) claim that Magit wraps and improves upon each and every -Git command, it is complete enough to allow even experienced Git users -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. - - Copyright (C) 2015-2016 Jonas Bernoulli + Copyright (C) 2015-2017 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 @@ -38,7 +30,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. - Copyright (C) 2015-2016 Jonas Bernoulli + This manual is for Magit version 2.11.0 (2.11.0-55-g7edecce4+1). + + Copyright (C) 2015-2017 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 @@ -54,8 +48,8 @@ itself deserve to be called porcelains. * Introduction:: * Installation:: -* Getting started:: -* Interface concepts:: +* Getting Started:: +* Interface Concepts:: * Inspecting:: * Manipulating:: * Transferring:: @@ -63,6 +57,7 @@ itself deserve to be called porcelains. * Customizing:: * Plumbing:: * FAQ:: +* Debugging Tools:: * Keystroke Index:: * Command Index:: * Function Index:: @@ -73,20 +68,19 @@ itself deserve to be called porcelains. Installation -* Updating from an older release:: -* Installing from an Elpa archive:: -* Installing from the Git repository:: -* Post-installation tasks:: +* Installing from an Elpa Archive:: +* Installing from the Git Repository:: +* Post-Installation Tasks:: -Interface concepts +Interface Concepts * Modes and Buffers:: * Sections:: -* Popup buffers and prefix commands:: -* Completion and confirmation:: +* Popup Buffers and Prefix Commands:: +* Completion and Confirmation:: * Running Git:: Modes and Buffers @@ -101,106 +95,109 @@ Modes and Buffers Sections -* Section movement:: -* Section visibility:: -* Section hooks:: -* Section types and values:: -* Section options:: +* Section Movement:: +* Section Visibility:: +* Section Hooks:: +* Section Types and Values:: +* Section Options:: Running Git -* Viewing Git output:: -* Running Git manually:: -* Git executable:: -* Global Git arguments:: +* Viewing Git Output:: +* Running Git Manually:: +* Git Executable:: +* Global Git Arguments:: Inspecting -* Status buffer:: -* Repository list:: +* Status Buffer:: +* Repository List:: * Logging:: * Diffing:: * Ediffing:: -* References buffer:: +* References Buffer:: * Bisecting:: -* Visiting blobs:: +* Visiting Blobs:: * Blaming:: -Status buffer +Status Buffer -* Status sections:: -* Status header sections:: -* Status options:: +* Status Sections:: +* Status Header Sections:: +* Status Module Sections:: +* Status Options:: Logging -* Refreshing logs:: +* Refreshing Logs:: * Log Buffer:: -* Select from log:: +* Log Margin:: +* Select from Log:: * Reflog:: +* Cherries:: Diffing -* Refreshing diffs:: -* Diff buffer:: -* Diff options:: -* Revision buffer:: +* Refreshing Diffs:: +* Diff Buffer:: +* Diff Options:: +* Revision Buffer:: -References buffer +References Buffer -* References sections:: +* References Sections:: Manipulating -* Repository setup:: -* Staging and unstaging:: +* Repository Setup:: +* Staging and Unstaging:: * Applying:: * Committing:: * Branching:: * Merging:: -* Resolving conflicts:: +* Resolving Conflicts:: * Rebasing:: -* Cherry picking:: +* Cherry Picking:: * Resetting:: * Stashing:: -Staging and unstaging +Staging and Unstaging -* Staging from file-visiting buffers:: +* Staging from File-Visiting Buffers:: Committing -* Initiating a commit:: -* Editing commit messages:: +* Initiating a Commit:: +* Editing Commit Messages:: Branching -* The two remotes:: -* The branch popup:: -* The branch config popup:: +* The Two Remotes:: +* The Branch Popup:: +* The Branch Config Popup:: Rebasing -* Editing rebase sequences:: -* Information about in-progress rebase:: +* Editing Rebase Sequences:: +* Information About In-Progress Rebase:: -Cherry picking +Cherry Picking * Reverting:: @@ -210,8 +207,8 @@ Transferring * Fetching:: * Pulling:: * Pushing:: -* Creating and sending patches:: -* Applying patches:: +* Creating and Sending Patches:: +* Applying Patches:: @@ -221,25 +218,25 @@ Miscellaneous * Notes:: * Submodules:: * Subtree:: -* Common commands:: -* Wip modes:: -* Minor mode for buffers visiting files:: -* Minor mode for buffers visiting blobs:: +* Common Commands:: +* Wip Modes:: +* Minor Mode for Buffers Visiting Files:: +* Minor Mode for Buffers Visiting Blobs:: Submodules -* Listing submodules:: -* Submodule popup:: +* Listing Submodules:: +* Submodule Popup:: Customizing -* Per-repository configuration:: -* Essential settings:: +* Per-Repository Configuration:: +* Essential Settings:: -Essential settings +Essential Settings * Safety:: * Performance:: @@ -247,53 +244,55 @@ Essential settings Plumbing * Calling Git:: -* Section plumbing:: -* Refreshing buffers:: +* Section Plumbing:: +* Refreshing Buffers:: * Conventions:: Calling Git -* Getting a value from Git:: -* Calling Git for effect:: +* Getting a Value from Git:: +* Calling Git for Effect:: -Section plumbing +Section Plumbing -* Creating sections:: -* Section selection:: -* Matching sections:: +* Creating Sections:: +* Section Selection:: +* Matching Sections:: Conventions -* Confirmation and completion:: +* Confirmation and Completion:: * Theming Faces:: FAQ +* FAQ - How to …?:: +* FAQ - Issues and Errors:: + +FAQ - How to …? + +* How to show git's output?:: +* How to install the gitman info manual?:: +* How to show diffs for gpg-encrypted files?:: +* How does branching and pushing work?:: +* Can Magit be used as ‘ediff-version-control-package’?:: + + +FAQ - Issues and Errors + * Magit is slow:: * I changed several thousand files at once and now Magit is unusable:: * I am having problems committing:: -* Diffs are collapsed after un-/staging:: -* I don't understand how branching and pushing work:: -* I don’t like the key binding in v2.4: I don't like the key binding in v24. -* I cannot install the pre-requisites for Magit v2:: -* I am using an Emacs release older than v24.4: I am using an Emacs release older than v244. -* I am using a Git release older than v1.9.4: I am using a Git release older than v194. * I am using MS Windows and cannot push with Magit:: * I am using OS X and SOMETHING works in shell, but not in Magit: I am using OS X and SOMETHING works in shell but not in Magit. -* How to install the gitman info manual?:: -* How can I show Git's output?:: * Diffs contain control sequences:: * Expanding a file to show the diff causes it to disappear:: * Point is wrong in the ‘COMMIT_EDITMSG’ buffer:: * The mode-line information isn't always up-to-date:: -* Can Magit be used as ‘ediff-version-control-package’?:: -* How to show diffs for gpg-encrypted files?:: * Emacs 24.5 hangs when loading Magit: Emacs 245 hangs when loading Magit. -* Symbol's value as function is void ‘--some’:: -* Where is the branch manager::  File: magit.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top @@ -380,7 +379,7 @@ Git porcelain commands: ‘add’, ‘am’, ‘bisect’, ‘blame’, ‘branc commands are implemented on top of Git plumbing commands.  -File: magit.info, Node: Installation, Next: Getting started, Prev: Introduction, Up: Top +File: magit.info, Node: Installation, Next: Getting Started, Prev: Introduction, Up: Top 2 Installation ************** @@ -390,54 +389,17 @@ development repository. * Menu: -* Updating from an older release:: -* Installing from an Elpa archive:: -* Installing from the Git repository:: -* Post-installation tasks:: - - -File: magit.info, Node: Updating from an older release, Next: Installing from an Elpa archive, Up: Installation - -2.1 Updating from an older release -================================== - -When updating from ‘1.2.*’ or ‘1.4.*’, you should first uninstall Magit -and some of its dependencies and restart Emacs before installing the -latest release. - - • The old Magit installation has to be removed because some macros - have changed and using the old definitions when building the new - release would lead to very strange results, including compile - errors. This is due to a limitation in Emacs’ package manager or - rather Emacs itself: it’s not possible to reliably unload a feature - or even all features belonging to a package. - - • Furthermore the old dependencies ‘git-commit-mode’ and - ‘git-rebase-mode’ have to be removed because they are no longer - used by the ‘2.1.0’ release and later, and get in the way of their - successors ‘git-commit’ and ‘git-rebase’. - - So please uninstall the packages ‘magit’, ‘git-commit-mode’, and -‘git-rebase-mode’. Then quit Emacs and start a new instance. Only then -follow the instructions in either one of the next two sections. - - Also note that starting with the ‘2.1.0’ release, Magit requires at -least Emacs ‘24.4’ and Git ‘1.9.4’. You should make sure you have at -least these releases installed before updating Magit. And if you -connect to remote hosts using Tramp, then you should also make sure to -install a recent enough Git version on these hosts. +* Installing from an Elpa Archive:: +* Installing from the Git Repository:: +* Post-Installation Tasks::  -File: magit.info, Node: Installing from an Elpa archive, Next: Installing from the Git repository, Prev: Updating from an older release, Up: Installation +File: magit.info, Node: Installing from an Elpa Archive, Next: Installing from the Git Repository, Up: Installation -2.2 Installing from an Elpa archive +2.1 Installing from an Elpa Archive =================================== -If you are updating from a release older than ‘2.1.0’, then you have to -first uninstall the old version. See *note Updating from an older -release: Updating from an older release. - - Magit is available from Melpa and Melpa-Stable. If you haven’t used +Magit is available from Melpa and Melpa-Stable. If you haven’t used Emacs’ package manager before, then it is high time you familiarize yourself with it by reading the documentation in the Emacs manual, see *note (emacs)Packages::. Then add one of the archives to @@ -447,13 +409,13 @@ yourself with it by reading the documentation in the Emacs manual, see (require 'package) (add-to-list 'package-archives - '("melpa" . "http://melpa.org/packages/") t) + '("melpa" . "http://melpa.org/packages/") t) • To use Melpa-Stable: (require 'package) (add-to-list 'package-archives - '("melpa-stable" . "http://stable.melpa.org/packages/") t) + '("melpa-stable" . "http://stable.melpa.org/packages/") t) Once you have added your preferred archive, you need to update the local package list using: @@ -465,19 +427,15 @@ using: M-x package-install RET magit RET - Now see *note Post-installation tasks: Post-installation tasks. + Now see *note Post-Installation Tasks::.  -File: magit.info, Node: Installing from the Git repository, Next: Post-installation tasks, Prev: Installing from an Elpa archive, Up: Installation +File: magit.info, Node: Installing from the Git Repository, Next: Post-Installation Tasks, Prev: Installing from an Elpa Archive, Up: Installation -2.3 Installing from the Git repository +2.2 Installing from the Git Repository ====================================== -If you are updating from a release older than ‘2.1.0’, then you have to -first uninstall the old version. See *note Updating from an older -release: Updating from an older release. - - Magit depends on the ‘dash’ and ‘with-editor’ library which are +Magit depends on the ‘dash’ and ‘with-editor’ library 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 development repository, but I won’t cover that here. @@ -514,7 +472,7 @@ following content before running ‘make’: (with-eval-after-load 'info (info-initialize) (add-to-list 'Info-directory-list - "~/.emacs.d/site-lisp/magit/Documentation/")) + "~/.emacs.d/site-lisp/magit/Documentation/")) Note that you have to add the ‘lisp’ subdirectory to the ‘load-path’, not the top-level of the repository, and that elements of ‘load-path’ @@ -539,12 +497,12 @@ directory using ‘sudo make install’ and setting ‘load-path’ accordingly. To view all available targets use ‘make help’. - Now see *note Post-installation tasks: Post-installation tasks. + Now see *note Post-Installation Tasks::.  -File: magit.info, Node: Post-installation tasks, Prev: Installing from the Git repository, Up: Installation +File: magit.info, Node: Post-Installation Tasks, Prev: Installing from the Git Repository, Up: Installation -2.4 Post-installation tasks +2.3 Post-Installation Tasks =========================== After installing Magit you should verify that you are indeed using the @@ -556,68 +514,62 @@ outdated value for ‘load-path’. should display something like - Magit 2.8.0, Git 2.9.0, Emacs 24.5.1 + Magit 2.8.0, Git 2.10.2, Emacs 25.1.1, gnu/linux Then you might also want to read about options that many users likely -want to customize. See *note Essential settings: Essential settings. +want to customize. See *note Essential Settings::. To be able to follow cross references to Git manpages found in this manual, you might also have to manually install the ‘gitman’ info manual, or advice ‘Info-follow-nearest-node’ to instead open the actual -manpage. See *note How to install the gitman info manual?: How to -install the gitman info manual?. +manpage. See *note How to install the gitman info manual?::. - If you are completely new to Magit then see *note Getting started: -Getting started. + If you are completely new to Magit then see *note Getting Started::. - If you have used an older Magit release before, then you should have -a look at the release notes . + If you run into problems, then please see the *note FAQ::. Also see +the *note Debugging Tools::. And last but not least please consider making a donation, to ensure -that I can keep working on Magit. See +that I can keep working on Magit. See . for various donation options.  -File: magit.info, Node: Getting started, Next: Interface concepts, Prev: Installation, Up: Top +File: magit.info, Node: Getting Started, Next: Interface Concepts, Prev: Installation, Up: Top -3 Getting started +3 Getting Started ***************** -This section describes the most essential features that many Magitians -use on a daily basis. It only scratches the surface but should be -enough to get you started. +This short tutorial describes the most essential features that many +Magitians use on a daily basis. It only scratches the surface but +should be enough to get you started. - (You might want to create a repository just for this walk-through, -e.g. by cloning an existing repository. If you don’t use a separate -repository then make sure you create a snapshot as described below). + IMPORTANT: It is safest if you clone some repository just for this +tutorial. Alternatively you can use an existing local repository, but +if you do that, then you should commit all uncommitted changes before +proceeding. To display information about the current Git repository, type ‘M-x -magit-status’. You will be doing that so often that it is best to bind -this command globally: +magit-status RET’. You will be using this command a lot, and should +therefore give it a global key binding. This is what we recommend: (global-set-key (kbd "C-x g") 'magit-status) - Most Magit commands are commonly invoked from this buffer. It should -be considered the primary interface to interact with Git using Magit. -There are many other Magit buffers, but they are usually created from -this buffer. + Most Magit commands are commonly invoked from the status buffer. It +can be considered the primary interface for interacting with Git using +Magit. Many other Magit buffers may exist at a given time, but they are +often created from this buffer. - Depending on what state your repository is in, this buffer will -contain sections titled "Staged changes", "Unstaged changes", "Unpulled -commits", "Unpushed commits", and/or some others. + Depending on what state your repository is in, this buffer may +contain sections titled "Staged changes", "Unstaged changes", "Unmerged +into origin/master", "Unpushed to origin/master", and many others. - If some staged and/or unstaged changes exist, you should back them up -now. Type ‘z’ to show the stashing popup buffer featuring various stash -variants and arguments that can be passed to these commands. Do not -worry about those for now, just type ‘Z’ (uppercase) to create a stash -while also keeping the index and work tree intact. The status buffer -should now also contain a section titled "Stashes". - - Otherwise, if there are no uncommitted changes, you should create -some now by editing and saving some of the tracked files. Then go back -to the status buffer, while at the same time refreshing it, by typing -‘C-x g’. (When the status buffer, or any Magit buffer for that matter, -is the current buffer, then you can also use just ‘g’ to refresh it). + Since we are starting from a safe state, which you can easily return +to (by doing a ‘git reset --hard PRE-MAGIT-STATE’), there currently are +not staged or unstaged changes. Edit some files and save the changes. +Then go back to the status buffer, while at the same time refreshing it, +by typing ‘C-x g’. (When the status buffer, or any Magit buffer for +that matter, is the current buffer, then you can also use just ‘g’ to +refresh it). Move between sections using ‘p’ and ‘n’. Note that the bodies of some sections are hidden. Type ‘TAB’ to expand or collapse the section @@ -634,10 +586,10 @@ change at point. Many other commands behave the same way. You can also un-/stage just part of a hunk. Inside the body of a hunk section (move there using ‘C-n’), set the mark using ‘C-SPC’ and -move down until some added and removed lines fall inside the region but -not all of them. Again type ‘s’ to stage. +move down until some added and/or removed lines fall inside the region +but not all of them. Again type ‘s’ to stage. - It’s also possible to un-/stage multiple files at once. Move to a + It is also possible to un-/stage multiple files at once. Move to a file section, type ‘C-SPC’, move to the next file using ‘n’, and then ‘s’ to stage both files. Note that both the mark and point have to be on the headings of sibling sections for this to work. If the region @@ -651,27 +603,21 @@ for now. We want to create a "normal" commit, which is done by typing ‘c’ again. Now two new buffers appear. One is for writing the commit message, -the other shows a diff with the changes that are about to committed. +the other shows a diff with the changes that you are about to committed. Write a message and then type ‘C-c C-c’ to actually create the commit. You probably don’t want to push the commit you just created because you just committed some random changes, but if that is not the case you -could push it by typing ‘P’ to bring up the push popup and then ‘u’ to -push to the configured upstream. (If the upstream is not configured, -then you would be prompted for the push target instead.) - - Instead we are going to undo the changes made so far. Bring up the -log for the current branch by typing ‘l l’, move to the last commit -created before starting with this walk through using ‘n’, and do a hard -reset using ‘C-u x’. *WARNING*: this discards all uncommitted changes. -If you did not follow the advice about using a separate repository for -these experiments and did not create a snapshot of uncommitted changes -before starting to try out Magit, then don’t do this. +could push it by typing ‘P’ to bring up the push popup and then ‘p’ to +push to a branch with the same name as the local branch onto the remote +configured as the push-remote. (If the push-remote is not configured +yet, then you would first be prompted for the remote to push to.) So far we have mentioned the commit, push, and log popups. These are probably among the popups you will be using the most, but many others -exist. To show a popup with all other popups (as well as the various -apply commands), type ‘h’. Try a few. +exist. To show a popup that lists all other popups (as well as the +various apply commands and some other fundamental commands), type ‘h’. +Try a few. The key bindings in that popup correspond to the bindings in Magit buffers, including but not limited to the status buffer. So you could @@ -679,30 +625,34 @@ type ‘h d’ to bring up the diff popup, but once you remember that "d" stands for "diff", you would usually do so by just typing ‘d’. But the "popup of popups" is useful even once you have memorized all the bindings, as it can provide easy access to Magit commands from non-Magit -buffers. So you should bind this globally too: +buffers. You should create a global key binding for this command too: (global-set-key (kbd "C-x M-g") 'magit-dispatch-popup) - You might also want to enable ‘global-magit-file-mode’ (see *note -Minor mode for buffers visiting files: Minor mode for buffers visiting -files.). + In the same vein, you might also want to enable +‘global-magit-file-mode’ to get some more Magit key bindings in regular +file-visiting buffers (see *note Minor Mode for Buffers Visiting +Files::). + + It is not necessary that you do so now, but if you stick with Magit, +then it is highly recommended that you read the next section too.  -File: magit.info, Node: Interface concepts, Next: Inspecting, Prev: Getting started, Up: Top +File: magit.info, Node: Interface Concepts, Next: Inspecting, Prev: Getting Started, Up: Top -4 Interface concepts +4 Interface Concepts ******************** * Menu: * Modes and Buffers:: * Sections:: -* Popup buffers and prefix commands:: -* Completion and confirmation:: +* Popup Buffers and Prefix Commands:: +* Completion and Confirmation:: * Running Git::  -File: magit.info, Node: Modes and Buffers, Next: Sections, Up: Interface concepts +File: magit.info, Node: Modes and Buffers, Next: Sections, Up: Interface Concepts 4.1 Modes and Buffers ===================== @@ -908,9 +858,14 @@ File: magit.info, Node: Naming Buffers, Next: Quitting Windows, Prev: Switchi The top-level directory of the working tree of the repository, or if ‘magit-uniquify-buffer-names’ is non-nil an abbreviation of that. - The value should always contain either ‘%m’ or ‘%M’, ‘%v’ or ‘%V’, - and ‘%t’. If ‘magit-uniquify-buffer-names’ is non-nil, then the - value must end with ‘%t’. + + • ‘%T’ + + Like ‘%t’, but append an asterisk if and only if + ‘magit-uniquify-buffer-names’ is nil. + The value should always contain ‘%m’ or ‘%M’, ‘%v’ or ‘%V’, and + ‘%t’ or ‘%T’. If ‘magit-uniquify-buffer-names’ is non-nil, then + the value must end with ‘%t’ or ‘%T’ (see issue #2841). -- User Option: magit-uniquify-buffer-names @@ -1219,7 +1174,7 @@ buffer) and you would not be asked whether you want to save the buffer (because it isn’t modified).  -File: magit.info, Node: Sections, Next: Popup buffers and prefix commands, Prev: Modes and Buffers, Up: Interface concepts +File: magit.info, Node: Sections, Next: Popup Buffers and Prefix Commands, Prev: Modes and Buffers, Up: Interface Concepts 4.2 Sections ============ @@ -1239,16 +1194,16 @@ type keymaps. * Menu: -* Section movement:: -* Section visibility:: -* Section hooks:: -* Section types and values:: -* Section options:: +* Section Movement:: +* Section Visibility:: +* Section Hooks:: +* Section Types and Values:: +* Section Options::  -File: magit.info, Node: Section movement, Next: Section visibility, Up: Sections +File: magit.info, Node: Section Movement, Next: Section Visibility, Up: Sections -4.2.1 Section movement +4.2.1 Section Movement ---------------------- To move within a section use the usual keys (‘C-p’, ‘C-n’, ‘C-b’, ‘C-f’ @@ -1348,9 +1303,9 @@ hook’s default value. of your graphical environment or operating system.  -File: magit.info, Node: Section visibility, Next: Section hooks, Prev: Section movement, Up: Sections +File: magit.info, Node: Section Visibility, Next: Section Hooks, Prev: Section Movement, Up: Sections -4.2.2 Section visibility +4.2.2 Section Visibility ------------------------ Magit provides many commands for changing the visibility of sections, @@ -1373,21 +1328,19 @@ but all you need to get started are the next two. Cycle the visibility of all sections in the current buffer. - -- Command: magit-section-show-level-1 - -- Command: magit-section-show-level-2 - -- Command: magit-section-show-level-3 - -- Command: magit-section-show-level-4 +‘1’ (‘magit-section-show-level-1’) +‘2’ (‘magit-section-show-level-2’) +‘3’ (‘magit-section-show-level-3’) +‘4’ (‘magit-section-show-level-4’) - To show sections surrounding the current section, up to level N, - press the respective number key (‘1’, ‘2’, ‘3’, or ‘4’). + Show sections surrounding the current section up to level N. - -- Command: magit-section-show-level-1-all - -- Command: magit-section-show-level-2-all - -- Command: magit-section-show-level-3-all - -- Command: magit-section-show-level-4-all +‘M-1’ (‘magit-section-show-level-1-all’) +‘M-2’ (‘magit-section-show-level-2-all’) +‘M-3’ (‘magit-section-show-level-3-all’) +‘M-4’ (‘magit-section-show-level-4-all’) - To show all sections up to level N, press the respective number key - and meta (‘M-1’, ‘M-2’, ‘M-3’, or ‘M-4’). + Show all sections up to level N. Some functions, which are used to implement the above commands, are also exposed as commands themselves. By default no keys are bound to @@ -1446,9 +1399,9 @@ certain sections can also be overwritten using the hook should immediately return ‘nil’.  -File: magit.info, Node: Section hooks, Next: Section types and values, Prev: Section visibility, Up: Sections +File: magit.info, Node: Section Hooks, Next: Section Types and Values, Prev: Section Visibility, Up: Sections -4.2.3 Section hooks +4.2.3 Section Hooks ------------------- Which sections are inserted into certain buffers is controlled with @@ -1494,9 +1447,9 @@ this manual along with the appropriate "section inserter functions". To remove a function from a section hook, use ‘remove-hook’.  -File: magit.info, Node: Section types and values, Next: Section options, Prev: Section hooks, Up: Sections +File: magit.info, Node: Section Types and Values, Next: Section Options, Prev: Section Hooks, Up: Sections -4.2.4 Section types and values +4.2.4 Section Types and Values ------------------------------ Each section has a type, for example ‘hunk’, ‘file’, and ‘commit’. @@ -1523,9 +1476,9 @@ map does not exist for a certain type, then you can define it yourself, and it will automatically be used.  -File: magit.info, Node: Section options, Prev: Section types and values, Up: Sections +File: magit.info, Node: Section Options, Prev: Section Types and Values, Up: Sections -4.2.5 Section options +4.2.5 Section Options --------------------- This section describes options that have an effect on more than just a @@ -1537,9 +1490,9 @@ certain type of sections. As you can see there are not many of those. only affects sections that could benefit from this information.  -File: magit.info, Node: Popup buffers and prefix commands, Next: Completion and confirmation, Prev: Sections, Up: Interface concepts +File: magit.info, Node: Popup Buffers and Prefix Commands, Next: Completion and Confirmation, Prev: Sections, Up: Interface Concepts -4.3 Popup buffers and prefix commands +4.3 Popup Buffers and Prefix Commands ===================================== Many Magit commands are implemented using *popup buffers*. First the @@ -1567,10 +1520,33 @@ you should setup a global binding: (global-set-key (kbd "C-x M-g") 'magit-dispatch-popup) + Most popups set their initial arguments according to the +corresponding ‘magit-*-arguments’ variable. Two popups, the log and +diff popups (see *note Logging:: and *note Diffing::), may behave a bit +differently, depending on the value of ‘magit-use-sticky-arguments’. + + -- User Option: magit-use-sticky-arguments + + This option controls how diff and log commands reuse arguments from + existing buffers. + + When ‘t’ (the default value), the log or diff popup reuses the + arguments from the current repository’s log or diff buffer, + respectively. When no log or diff buffer exists for the current + repository, these popups use the default value of + ‘magit-log-arguments’ or ‘magit-diff-arguments’. + + When ‘current’, log and diff popups will only reuse the arguments + if the current buffer is derived from ‘magit-log-mode’ or + ‘magit-diff-mode’, respectively. + + When ‘nil’, the default value of ‘magit-log-arguments’ or + ‘magit-diff-arguments’ is always used. +  -File: magit.info, Node: Completion and confirmation, Next: Running Git, Prev: Popup buffers and prefix commands, Up: Interface concepts +File: magit.info, Node: Completion and Confirmation, Next: Running Git, Prev: Popup Buffers and Prefix Commands, Up: Interface Concepts -4.4 Completion and confirmation +4.4 Completion and Confirmation =============================== Many commands read a value from the user. By default this is done using @@ -1603,6 +1579,14 @@ supported. More frameworks will be supported in the future. comes with a supposed drop-in replacement ‘ido-completing-read’, but that has too many deficits to serve our needs. + -- User Option: magit-list-refs-sortby + + For many commands that read a ref or refs from the user, the value + of this option can be used to control the order of the refs. Valid + values include any key accepted by the ‘--sort’ flag of ‘git + for-each-ref’. By default, refs are sorted alphabetically by their + full name (e.g., "refs/heads/master"). + By default many commands that could potentially lead to data loss have to be confirmed. This includes many very common commands, so this can become annoying quickly. Many of these actions can be undone, @@ -1633,22 +1617,22 @@ at once always, require confirmation, even when they do respect this option when acting on a single section.  -File: magit.info, Node: Running Git, Prev: Completion and confirmation, Up: Interface concepts +File: magit.info, Node: Running Git, Prev: Completion and Confirmation, Up: Interface Concepts 4.5 Running Git =============== * Menu: -* Viewing Git output:: -* Running Git manually:: -* Git executable:: -* Global Git arguments:: +* Viewing Git Output:: +* Running Git Manually:: +* Git Executable:: +* Global Git Arguments::  -File: magit.info, Node: Viewing Git output, Next: Running Git manually, Up: Running Git +File: magit.info, Node: Viewing Git Output, Next: Running Git Manually, Up: Running Git -4.5.1 Viewing Git output +4.5.1 Viewing Git Output ------------------------ Magit runs Git either for side-effects (e.g. when pushing) or to get @@ -1675,9 +1659,9 @@ sections are available. There is one additional command. just negatively affects performance.  -File: magit.info, Node: Running Git manually, Next: Git executable, Prev: Viewing Git output, Up: Running Git +File: magit.info, Node: Running Git Manually, Next: Git Executable, Prev: Viewing Git Output, Up: Running Git -4.5.2 Running Git manually +4.5.2 Running Git Manually -------------------------- While Magit provides many Emacs commands to interact with Git, it does @@ -1690,35 +1674,41 @@ to a shell. Shows the popup buffer featuring the below suffix commands. - These suffix commands run a Git subcommand. The user input has to -begin with the subcommand, "git" is assumed. - ‘! !’ (‘magit-git-command-topdir’) - This command reads a Git subcommand from the user and executes it - in the top-level directory of the current repository. + This command reads a command from the user and executes it in the + top-level directory of the current working tree. + + The string "git " is used as initial input when prompting the user + for the command. It can be removed to run another command. ‘! p’ (‘magit-git-command’) - This command reads a Git subcommand from the user and executes it - in ‘default-directory’. With a prefix argument the command is - executed in the top-level directory of the current repository + This command reads a command from the user and executes it in + ‘default-directory’. With a prefix argument the command is + executed in the top-level directory of the current working tree instead. - These suffix commands run arbitrary shell commands. + The string "git " is used as initial input when prompting the user + for the command. It can be removed to run another command. ‘! s’ (‘magit-shell-command-topdir’) - This command reads a shell command from the user and executes it in - the top-level directory of the current repository. + This command reads a command from the user and executes it in the + top-level directory of the current working tree. ‘! S’ (‘magit-shell-command’) - This command reads a shell command from the user and executes it in + This command reads a command from the user and executes it in ‘default-directory’. With a prefix argument the command is - executed in the top-level directory of the current repository + executed in the top-level directory of the current working tree instead. + -- User Option: magit-shell-command-verbose-prompt + + Whether the prompt, used by the the above commands when reading a + shell command, shows the directory in which it will be run. + These suffix commands start external gui tools. ‘! k’ (‘magit-run-gitk’) @@ -1738,9 +1728,9 @@ begin with the subcommand, "git" is assumed. This command runs ‘git gui’ in the current repository.  -File: magit.info, Node: Git executable, Next: Global Git arguments, Prev: Running Git manually, Up: Running Git +File: magit.info, Node: Git Executable, Next: Global Git Arguments, Prev: Running Git Manually, Up: Running Git -4.5.3 Git executable +4.5.3 Git Executable -------------------- Except on MS Windows, Magit defaults to running Git without specifying @@ -1756,8 +1746,9 @@ one you think you are using. ‘M-x magit-version’ (‘magit-version’) - Shows the currently used versions of Magit, Git, and Emacs in the - echo area. Non-interactively this just returns the Magit version. + This command shows the currently used versions of Magit, Git, and + Emacs in the echo area. Non-interactively this just returns the + Magit version. When the ‘system-type’ is ‘windows-nt’, then ‘magit-git-executable’ is set to an absolute path when Magit is first loaded. This is @@ -1770,8 +1761,10 @@ performance horribly. around that by setting ‘magit-git-executable’ to an absolute path. But note that doing so is a kludge. It is better to make sure the order in the environment variable ‘$PATH’ is correct, and that Emacs is started -with that environment in effect. If you have to connect from Windows to -a non-Windows machine, then you must change the value to "git". +with that environment in effect. The command +‘magit-debug-git-executable’ can be useful to find out where Emacs is +searching for git. If you have to connect from Windows to a non-Windows +machine, then you must change the value to "git". -- User Option: magit-git-executable @@ -1779,10 +1772,14 @@ a non-Windows machine, then you must change the value to "git". executable or the string "git" to let Emacs find the executable itself, using the standard mechanism for doing such things. +‘M-x magit-debug-git-executable’ (‘magit-debug-git-executable’) + + Display a buffer with information about ‘magit-git-executable’. +  -File: magit.info, Node: Global Git arguments, Prev: Git executable, Up: Running Git +File: magit.info, Node: Global Git Arguments, Prev: Git Executable, Up: Running Git -4.5.4 Global Git arguments +4.5.4 Global Git Arguments -------------------------- -- User Option: magit-git-global-arguments @@ -1790,7 +1787,7 @@ File: magit.info, Node: Global Git arguments, Prev: Git executable, Up: Runni The arguments set here are used every time the git executable is run as a subprocess. They are placed right after the executable itself and before the git command - as in ‘git HERE... COMMAND - REST’. For valid arguments see *note (gitman)git:: . + REST’. For valid arguments see *note (gitman)git::. Be careful what you add here, especially if you are using Tramp to connect to servers with ancient Git versions. Never remove @@ -1799,7 +1796,7 @@ File: magit.info, Node: Global Git arguments, Prev: Git executable, Up: Runni it will be used every time Magit runs Git for any purpose.  -File: magit.info, Node: Inspecting, Next: Manipulating, Prev: Interface concepts, Up: Top +File: magit.info, Node: Inspecting, Next: Manipulating, Prev: Interface Concepts, Up: Top 5 Inspecting ************ @@ -1822,20 +1819,20 @@ described later. * Menu: -* Status buffer:: -* Repository list:: +* Status Buffer:: +* Repository List:: * Logging:: * Diffing:: * Ediffing:: -* References buffer:: +* References Buffer:: * Bisecting:: -* Visiting blobs:: +* Visiting Blobs:: * Blaming::  -File: magit.info, Node: Status buffer, Next: Repository list, Up: Inspecting +File: magit.info, Node: Status Buffer, Next: Repository List, Up: Inspecting -5.1 Status buffer +5.1 Status Buffer ================= While other Magit buffers contain e.g. one particular diff or one @@ -1888,9 +1885,9 @@ that it should be bound globally. We recommend using ‘C-x g’: To make this command available, use something like: (add-hook 'ido-setup-hook - (lambda () - (define-key ido-completion-map - (kbd \"C-x g\") 'ido-enter-magit-status))) + (lambda () + (define-key ido-completion-map + (kbd \"C-x g\") 'ido-enter-magit-status))) Starting with Emacs 25.1 the Ido keymaps are defined just once instead of every time Ido is invoked, so now you can modify it like @@ -1901,19 +1898,20 @@ that it should be bound globally. We recommend using ‘C-x g’: * Menu: -* Status sections:: -* Status header sections:: -* Status options:: +* Status Sections:: +* Status Header Sections:: +* Status Module Sections:: +* Status Options::  -File: magit.info, Node: Status sections, Next: Status header sections, Up: Status buffer +File: magit.info, Node: Status Sections, Next: Status Header Sections, Up: Status Buffer -5.1.1 Status sections +5.1.1 Status Sections --------------------- The contents of status buffers is controlled using the hook -‘magit-status-sections-hook’. See *note Section hooks: Section hooks. -to learn about such hooks and how to customize them. +‘magit-status-sections-hook’. See *note Section Hooks:: to learn about +such hooks and how to customize them. -- User Option: magit-status-sections-hook @@ -2023,40 +2021,6 @@ default the following functions are also members of that hook: ‘magit-insert-unpulled-or-recent-commits’ (provided there are no unpulled commits) show. - -- Function: magit-insert-modules-unpulled-from-upstream - - Insert sections for modules that haven’t been pulled from the - upstream yet. These sections can be expanded to show the - respective commits. - - -- Function: magit-insert-modules-unpulled-from-pushremote - - Insert sections for modules that haven’t been pulled from the - push-remote yet. These sections can be expanded to show the - respective commits. - - -- Function: magit-insert-modules-unpushed-to-upstream - - Insert sections for modules that haven’t been pushed to the - upstream yet. These sections can be expanded to show the - respective commits. - - -- Function: magit-insert-modules-unpushed-to-pushremote - - Insert sections for modules that haven’t been pushed to the - push-remote yet. These sections can be expanded to show the - respective commits. - - -- Function: magit-insert-submodules - - Insert sections for all submodules. For each section insert the - path, the branch, and the output of ‘git describe --tags’. - - Press ‘RET’ on such a submodule section to show its own status - buffer. Press ‘RET’ on the "Modules" section to display a list of - submodules in a separate buffer. This shows additional information - not displayed in the super-repository’s status buffer. - -- Function: magit-insert-unpulled-cherries Insert section showing unpulled commits. Like @@ -2072,19 +2036,20 @@ default the following functions are also members of that hook: not shared with any upstream commit) with "+" and all others with "-". - See *note References buffer: References buffer. for some more section -inserters, which could be used here. + See *note References Buffer:: for some more section inserters, which +could be used here.  -File: magit.info, Node: Status header sections, Next: Status options, Prev: Status sections, Up: Status buffer +File: magit.info, Node: Status Header Sections, Next: Status Module Sections, Prev: Status Sections, Up: Status Buffer -5.1.2 Status header sections +5.1.2 Status Header Sections ---------------------------- The contents of status buffers is controlled using the hook -‘magit-status-sections-hook’, as described in the previous section. By -default ‘magit-insert-status-headers’ is the first member of that hook -variable. +‘magit-status-sections-hook’ (see *note Status Sections::). + + By default ‘magit-insert-status-headers’ is the first member of that +hook variable. -- Function: magit-insert-status-headers @@ -2132,7 +2097,8 @@ variable. -- Function: magit-insert-tags-header - Insert a header line about the current and/or next tag. + Insert a header line about the current and/or next tag, along with + the number of commits between the tag and ‘HEAD’. The following functions can also be added to the above hook: @@ -2153,15 +2119,109 @@ variable. Insert a header line about the current user.  -File: magit.info, Node: Status options, Prev: Status header sections, Up: Status buffer +File: magit.info, Node: Status Module Sections, Next: Status Options, Prev: Status Header Sections, Up: Status Buffer + +5.1.3 Status Module Sections +---------------------------- + +The contents of status buffers is controlled using the hook +‘magit-status-sections-hook’ (see *note Status Sections::). + + By default ‘magit-insert-modules’ is _not_ a member of that hook +variable. + + -- Function: magit-insert-modules + + Insert submodule sections. + + Hook ‘magit-module-sections-hook’ controls which module sections + are inserted, and option ‘magit-insert-modules-nested’ controls + whether they are wrapped in an additional section. + + • Option: magit-module-sections-hook + + Hook run by ‘magit-insert-modules’. + + • Option: magit-module-sections-nested -5.1.3 Status options + This option controls whether ‘magit-insert-modules’ wraps inserted + sections in an additional section. + + If this is non-nil, then only a single top-level section is + inserted. If it is nil, then all sections listed in + ‘magit-module-sections-hook’ become top-level sections. + + -- Function: magit-insert-modules-overview + + Insert sections for all submodules. For each section insert the + path, the branch, and the output of ‘git describe --tags’, or, + failing that, the abbreviated HEAD commit hash. + + Press ‘RET’ on such a submodule section to show its own status + buffer. Press ‘RET’ on the "Modules" section to display a list of + submodules in a separate buffer. This shows additional information + not displayed in the super-repository’s status buffer. + + -- Function: magit-insert-modules-unpulled-from-upstream + + Insert sections for modules that haven’t been pulled from the + upstream yet. These sections can be expanded to show the + respective commits. + + -- Function: magit-insert-modules-unpulled-from-pushremote + + Insert sections for modules that haven’t been pulled from the + push-remote yet. These sections can be expanded to show the + respective commits. + + -- Function: magit-insert-modules-unpushed-to-upstream + + Insert sections for modules that haven’t been pushed to the + upstream yet. These sections can be expanded to show the + respective commits. + + -- Function: magit-insert-modules-unpushed-to-pushremote + + Insert sections for modules that haven’t been pushed to the + push-remote yet. These sections can be expanded to show the + respective commits. + + +File: magit.info, Node: Status Options, Prev: Status Module Sections, Up: Status Buffer + +5.1.4 Status Options -------------------- -- User Option: magit-status-refresh-hook Hook run after a status buffer has been refreshed. + -- User Option: magit-status-margin + + This option specifies whether the margin is initially shown in + Magit-Status mode buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. + + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. + + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so. + -- User Option: magit-log-section-args Additional Git arguments used when creating log sections. Only @@ -2175,9 +2235,9 @@ File: magit.info, Node: Status options, Prev: Status header sections, Up: Sta buffers.  -File: magit.info, Node: Repository list, Next: Logging, Prev: Status buffer, Up: Inspecting +File: magit.info, Node: Repository List, Next: Logging, Prev: Status Buffer, Up: Inspecting -5.2 Repository list +5.2 Repository List =================== -- Command: magit-list-repositories @@ -2239,7 +2299,7 @@ File: magit.info, Node: Repository list, Next: Logging, Prev: Status buffer, but not its push branch.  -File: magit.info, Node: Logging, Next: Diffing, Prev: Repository list, Up: Inspecting +File: magit.info, Node: Logging, Next: Diffing, Prev: Repository List, Up: Inspecting 5.3 Logging =========== @@ -2250,19 +2310,21 @@ on ‘l’, features several suffix commands, which show a specific log in a separate log buffer. Like other popups, the log popup also features several arguments that -can be changed before invoking one of the suffix commands. However in -case of the log popup these arguments correspond to those currently in -use in the current repository’s log buffer. When the log popup is -invoked while no log buffer exists for the current repository yet, then -the default value of ‘magit-log-arguments’ is used instead. +can be changed before invoking one of the suffix commands. However, in +the case of the log popup, these arguments may be taken from those +currently in use in the current repository’s log buffer, depending on +the value of ‘magit-use-sticky-arguments’ (see *note Popup Buffers and +Prefix Commands::). For information about the various arguments, see *note -(gitman)git-log:: . The switch ‘++order=VALUE’ is converted to one of +(gitman)git-log::. + + The switch ‘++order=VALUE’ is converted to one of ‘--author-date-order’, ‘--date-order’, or ‘--topo-order’ before being passed to ‘git log’. The log popup also features several reflog commands. See *note -Reflog: Reflog. +Reflog::. ‘l’ (‘magit-log-popup’) @@ -2298,32 +2360,24 @@ Reflog: Reflog. Show log for all references and ‘HEAD’. - The following related commands are not available from the popup. - -‘Y’ (‘magit-cherry’) - - Show commits in a branch that are not merged in the upstream - branch. - -‘M-x magit-log-buffer-file’ (‘magit-log-buffer-file’) - - Show log for the file visited in the current buffer. - Two additional commands that show the log for the file or blob that -is being visited in the current buffer exists, see *note Minor mode for -buffers visiting files: Minor mode for buffers visiting files. +is being visited in the current buffer exists, see *note Minor Mode for +Buffers Visiting Files::. The command ‘magit-cherry’ also shows a log, +see *note Cherries::. * Menu: -* Refreshing logs:: +* Refreshing Logs:: * Log Buffer:: -* Select from log:: +* Log Margin:: +* Select from Log:: * Reflog:: +* Cherries::  -File: magit.info, Node: Refreshing logs, Next: Log Buffer, Up: Logging +File: magit.info, Node: Refreshing Logs, Next: Log Buffer, Up: Logging -5.3.1 Refreshing logs +5.3.1 Refreshing Logs --------------------- The prefix command ‘magit-log-refresh-popup’, on ‘L’, can be used to @@ -2361,7 +2415,7 @@ the status buffer. Show or hide the margin.  -File: magit.info, Node: Log Buffer, Next: Select from log, Prev: Refreshing logs, Up: Logging +File: magit.info, Node: Log Buffer, Next: Log Margin, Prev: Refreshing Logs, Up: Logging 5.3.2 Log Buffer ---------------- @@ -2370,7 +2424,7 @@ File: magit.info, Node: Log Buffer, Next: Select from log, Prev: Refreshing l This prefix command shows the following suffix commands along with the appropriate infix arguments in a popup buffer. See *note - Refreshing logs: Refreshing logs. + Refreshing Logs::. ‘q’ (‘magit-log-bury-buffer’) @@ -2423,7 +2477,7 @@ File: magit.info, Node: Log Buffer, Next: Select from log, Prev: Refreshing l Double the number of commits the current log buffer is limited to. -‘=’ (‘magit-log-half-commit-limit’) +‘-’ (‘magit-log-half-commit-limit’) Half the number of commits the current log buffer is limited to. @@ -2433,27 +2487,85 @@ File: magit.info, Node: Log Buffer, Next: Select from log, Prev: Refreshing l entry. Only considered when moving past the last entry with ‘magit-goto-*-section’ commands. - -- User Option: magit-log-show-margin + -- User Option: magit-log-show-refname-after-summary + + Whether to show the refnames after the commit summaries. This is + useful if you use really long branch names. + + For a description of ‘magit-log-margin’ see *note Log Margin::. - Whether to initially show the margin in log buffers. + +File: magit.info, Node: Log Margin, Next: Select from Log, Prev: Log Buffer, Up: Logging - When non-nil the author name and date are initially displayed in - the margin of log buffers. The margin can be shown or hidden in - the current buffer using the command ‘magit-toggle-margin’. +5.3.3 Log Margin +---------------- - When a log buffer contains a verbose log, then the margin is never - displayed. In status buffers this option is ignored, but it is - possible to show the margin using the mentioned command. +In buffers which show one or more logs, it is possible to show +additional information about each commit in the margin. The options +used to configure the margin are named ‘magit-INFIX-margin’, where INFIX +is the same as in the respective major-mode ‘magit-INFIX-mode’. In +regular log buffers that would be ‘magit-log-margin’. - -- User Option: magit-log-show-refname-after-summary + -- User Option: magit-log-margin - Whether to show the refnames after the commit summaries. This is - useful if you use really long branch names. + This option specifies whether the margin is initially shown in + Magit-Log mode buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. + + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. + + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so. + + You can change the STYLE and AUTHOR-WIDTH of all ‘magit-INFIX-margin’ +options to the same values by customizing ‘magit-log-margin’ *before* +‘magit’ is loaded. If you do that, then the respective values for the +other options will default to what you have set for that variable. +Likewise if you set INIT in ‘magit-log-margin’ to ‘nil’, then that is +used in the default of all other options. But setting it to ‘t’, i.e. +re-enforcing the default for that option, does not carry to other +options. + +‘L’ (‘magit-margin-popup’) + + This prefix command features the following commands for changing + the appearance of the margin. + + In some buffers that support the margin, "L" is bound to +‘magit-log-refresh-popup’, but that popup features the same commands, +and then some other unrelated commands. + +‘L L’ (‘magit-toggle-margin’) + + This command shows or hides the margin. + +‘L l’ (‘magit-cycle-margin-style’) + + This command cycles the style used for the margin. + +‘L d’ (‘magit-toggle-margin-details’) + + This command shows or hides details in the margin.  -File: magit.info, Node: Select from log, Next: Reflog, Prev: Log Buffer, Up: Logging +File: magit.info, Node: Select from Log, Next: Reflog, Prev: Log Margin, Up: Logging -5.3.3 Select from log +5.3.4 Select from Log --------------------- When the user has to select a recent commit that is reachable from @@ -2461,8 +2573,14 @@ When the user has to select a recent commit that is reachable from humans cannot remember hashes or "HEAD~5", at least not without double checking). Instead a log buffer is used to select the commit, which has the advantage that commits are presented in order and with the commit -message. The following additional key bindings are available when a log -is used for selection: +message. + + Such selection logs are used when selecting the beginning of a rebase +and when selecting the commit to be squashed into. + + In addition to the key bindings available in all log buffers, the +following additional key bindings are available in selection log +buffers: ‘C-c C-c’ (‘magit-log-select-pick’) @@ -2474,18 +2592,42 @@ is used for selection: Abort selecting a commit, don’t act on any commit. - This feature is used by rebase and squash commands. + -- User Option: magit-log-select-margin + + This option specifies whether the margin is initially shown in + Magit-Log-Select mode buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. + + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. + + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so.  -File: magit.info, Node: Reflog, Prev: Select from log, Up: Logging +File: magit.info, Node: Reflog, Next: Cherries, Prev: Select from Log, Up: Logging -5.3.4 Reflog +5.3.5 Reflog ------------ -Also see *note (gitman)git-reflog:: . +Also see *note (gitman)git-reflog::. These reflog commands are available from the log popup. See *note -Logging: Logging. +Logging::. ‘l r’ (‘magit-reflog-current’) @@ -2499,6 +2641,80 @@ Logging: Logging. Display the ‘HEAD’ reflog. + -- User Option: magit-reflog-margin + + This option specifies whether the margin is initially shown in + Magit-Reflog mode buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. + + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. + + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so. + + +File: magit.info, Node: Cherries, Prev: Reflog, Up: Logging + +5.3.6 Cherries +-------------- + +Cherries are commits that haven’t been applied upstream (yet), and are +usually visualized using a log. Each commit is prefixed with ‘-’ if it +has an equivalent in the upstream and ‘+’ if it does not, i.e. if it is +a cherry. + + The command ‘magit-cherry’ shows cherries for a single branch, but +the references buffer (see *note References Buffer::) can show cherries +for multiple "upstreams" at once. + + Also see *note (gitman)git-reflog::. + +‘Y’ (‘magit-cherry’) + + Show commits that are in a certain branch but that have not been + merged in the upstream branch. + + -- User Option: magit-cherry-margin + + This option specifies whether the margin is initially shown in + Magit-Cherry mode buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. + + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. + + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so. +  File: magit.info, Node: Diffing, Next: Ediffing, Prev: Logging, Up: Inspecting @@ -2511,13 +2727,13 @@ on ‘d’, features several suffix commands, which show a specific diff in a separate diff buffer. Like other popups, the diff popup also features several arguments -that can be changed before invoking one of the suffix commands. However -in case of the diff popup these arguments correspond to those currently -in use in the current repository’s diff buffer. When the diff popup is -invoked while no diff buffer exists for the current repository yet, then -the default value of ‘magit-diff-arguments’ is used instead. +that can be changed before invoking one of the suffix commands. +However, in the case of the diff popup, these arguments may be taken +from those currently in use in the current repository’s log buffer, +depending on the value of ‘magit-use-sticky-arguments’ (see *note Popup +Buffers and Prefix Commands::). - Also see *note (gitman)git-diff:: . + Also see *note (gitman)git-diff::. ‘d’ (‘magit-diff-popup’) @@ -2534,15 +2750,15 @@ the default value of ‘magit-diff-arguments’ is used instead. RANGE should be a range (A..B or A…B) but can also be a single commit. If one side of the range is omitted, then it defaults to - HEAD. If just a commit is given, then changes in the working tree - relative to that commit are shown. + ‘HEAD’. If just a commit is given, then changes in the working + tree relative to that commit are shown. If the region is active, use the revisions on the first and last line of the region. With a prefix argument, instead of diffing the revisions, choose a revision to view changes along, starting at the common ancestor of both revisions (i.e., use a "…" range). -‘d w’ (‘magit-diff-worktree’) +‘d w’ (‘magit-diff-working-tree’) Show changes between the current working tree and the ‘HEAD’ commit. With a prefix argument show changes between the working @@ -2576,20 +2792,20 @@ another buffer: Show all diffs of a stash in a buffer. Two additional commands that show the diff for the file or blob that -is being visited in the current buffer exists, see *note Minor mode for -buffers visiting files: Minor mode for buffers visiting files. +is being visited in the current buffer exists, see *note Minor Mode for +Buffers Visiting Files::. * Menu: -* Refreshing diffs:: -* Diff buffer:: -* Diff options:: -* Revision buffer:: +* Refreshing Diffs:: +* Diff Buffer:: +* Diff Options:: +* Revision Buffer::  -File: magit.info, Node: Refreshing diffs, Next: Diff buffer, Up: Diffing +File: magit.info, Node: Refreshing Diffs, Next: Diff Buffer, Up: Diffing -5.4.1 Refreshing diffs +5.4.1 Refreshing Diffs ---------------------- The prefix command ‘magit-diff-refresh-popup’, on ‘D’, can be used to @@ -2636,6 +2852,16 @@ the status buffer. This command swaps revisions in the diff range from "revA..revB" to "revB..revA", or vice versa. +‘D F’ (‘magit-diff-toggle-file-filter’) + + This command toggles the file restriction of the diffs in the + current buffer, allowing you to quickly switch between viewing all + the changes in the commit and the restricted subset. As a special + case, when this command is called from a log buffer, it toggles the + file restriction in the repository’s revision buffer, which is + useful when you display a revision from a log buffer that is + restricted to a file or files. + In addition to the above popup, which allows changing any of the supported arguments, there also exist some commands which change a particular argument. @@ -2675,9 +2901,9 @@ without having to using one of the diff popups. This command moves forward in current buffer’s history.  -File: magit.info, Node: Diff buffer, Next: Diff options, Prev: Refreshing diffs, Up: Diffing +File: magit.info, Node: Diff Buffer, Next: Diff Options, Prev: Refreshing Diffs, Up: Diffing -5.4.2 Diff buffer +5.4.2 Diff Buffer ----------------- ‘RET’ (‘magit-diff-visit-file’) @@ -2723,9 +2949,9 @@ File: magit.info, Node: Diff buffer, Next: Diff options, Prev: Refreshing dif hunk headers get less useful the "older" the changes are, and as a result, jumping to the appropriate position gets less reliable. - Also see ‘magit-diff-visit-file-worktree’, which visits the - respective blob, unless the diff shows changes in the worktree, the - index, or ‘HEAD’. + Also see ‘magit-diff-visit-file’, which visits the respective blob, + unless the diff shows changes in the worktree, the index, or + ‘HEAD’. ‘j’ (‘magit-jump-to-diffstat-or-diff’) @@ -2742,9 +2968,9 @@ File: magit.info, Node: Diff buffer, Next: Diff options, Prev: Refreshing dif Scroll text downward.  -File: magit.info, Node: Diff options, Next: Revision buffer, Prev: Diff buffer, Up: Diffing +File: magit.info, Node: Diff Options, Next: Revision Buffer, Prev: Diff Buffer, Up: Diffing -5.4.3 Diff options +5.4.3 Diff Options ------------------ -- User Option: magit-diff-refine-hunk @@ -2761,9 +2987,10 @@ File: magit.info, Node: Diff options, Next: Revision buffer, Prev: Diff buffe Specify where to highlight whitespace errors. - See ‘magit-highlight-trailing-whitespace’, - ‘magit-highlight-indentation’. The symbol ‘t’ means in all diffs, - ‘status’ means only in the status buffer, and nil means nowhere. + 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. -- User Option: magit-diff-highlight-trailing @@ -2824,9 +3051,9 @@ File: magit.info, Node: Diff options, Next: Revision buffer, Prev: Diff buffe ‘magit-diff-highlight-hunk-region-functions’.  -File: magit.info, Node: Revision buffer, Prev: Diff options, Up: Diffing +File: magit.info, Node: Revision Buffer, Prev: Diff Options, Up: Diffing -5.4.4 Revision buffer +5.4.4 Revision Buffer --------------------- -- User Option: magit-revision-insert-related-refs @@ -2843,14 +3070,28 @@ File: magit.info, Node: Revision buffer, Prev: Diff options, Up: Diffing ‘magit-revision-header-format’. Both cells are regular expressions. The car specifies where to - insert the author gravatar image. The top halve of the image is - inserted right after the matched text, the bottom halve on the next + insert the author gravatar image. The top half of the image is + inserted right after the matched text, the bottom half on the next line at the same offset. The cdr specifies where to insert the committer image, accordingly. Either the car or the cdr may be nil. + The diffs shown in the revision buffer may be automatically +restricted to a subset of the changed files. If the revision buffer is +displayed from a log buffer, the revision buffer will share the same +file restriction as that log buffer (also see the command +‘magit-diff-toggle-file-filter’). Note, however, that the log’s file +restriction will be ignored when ‘magit-log-arguments’ includes +‘--follow’. In this case, the ‘-u’ argument of the log popup can be +used to show the file-restricted diffs inline. + + If the revision buffer is not displayed from a log buffer, the file +restriction is determined by the file restriction in the repository’s +diff buffer, if it exists, and the value of the option +‘magit-use-sticky-arguments’. +  -File: magit.info, Node: Ediffing, Next: References buffer, Prev: Diffing, Up: Inspecting +File: magit.info, Node: Ediffing, Next: References Buffer, Prev: Diffing, Up: Inspecting 5.5 Ediffing ============ @@ -2912,7 +3153,7 @@ information on how to use Ediff itself, see *note (ediff)Top::. ‘E w’ (‘magit-ediff-show-working-tree’) - Show changes in a file between HEAD and working tree using Ediff. + Show changes in a file between ‘HEAD’ and working tree using Ediff. ‘E c’ (‘magit-ediff-show-commit’) @@ -2948,9 +3189,9 @@ information on how to use Ediff itself, see *note (ediff)Top::. sessions that were created using a Magit command.  -File: magit.info, Node: References buffer, Next: Bisecting, Prev: Ediffing, Up: Inspecting +File: magit.info, Node: References Buffer, Next: Bisecting, Prev: Ediffing, Up: Inspecting -5.6 References buffer +5.6 References Buffer ===================== ‘y’ (‘magit-show-refs-popup’) @@ -2987,13 +3228,37 @@ File: magit.info, Node: References buffer, Next: Bisecting, Prev: Ediffing, • ‘nil’ Never show counts. The default is ‘nil’ because anything else can be very expensive. - -- User Option: magit-refs-show-margin + -- User Option: magit-refs-margin + + This option specifies whether the margin is initially shown in + Magit-Refs mode buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. - Whether to initially show the margin in refs buffers. + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. - When non-nil the committer name and date are initially displayed in - the margin of refs buffers. The margin can be shown or hidden in - the current buffer using the command ‘magit-toggle-margin’. + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so. + + -- User Option: magit-refs-margin-for-tags + + This option specifies whether to show information about tags in the + margin. This is disabled by default because it is slow if there + are many tags. The following variables control how individual refs are displayed. If you change one of these variables (especially the "%c" part), then @@ -3040,56 +3305,97 @@ you should also change the others to keep things aligned. The following Indentation of cherries in refs buffers. This should be N-1 where N is taken from "%Nc" in the above format strings. - Everywhere in Magit ‘RET’ visits the thing represented by the section -at point. In almost all cases visiting is done by showing some -information in another buffer and *not* doing anything else. In refs -buffers ‘RET’ behaves differently, and because many users have grown -accustomed to that inconsistency we are keeping it that way. - ‘RET’ (‘magit-visit-ref’) - Everywhere except in refs buffers this command behaves exactly like - ‘magit-show-commit’; it shows the commit at point in another + This command visits the reference or revision at point in another + buffer. If there is no revision at point or with a prefix argument + then it prompts for a revision. + + This command behaves just like ‘magit-show-commit’ as described + above, except if point is on a reference in a ‘magit-refs-mode’ + buffer, in which case the behavior may be different, but only if + you have customized the option ‘magit-visit-ref-behavior’. + + -- User Option: magit-visit-ref-behavior + + This option controls how ‘magit-visit-ref’ behaves in + ‘magit-refs-mode’ buffers. + + By default ‘magit-visit-ref’ behaves like ‘magit-show-commit’, in + all buffers, including ‘magit-refs-mode’ buffers. When the type of + the section at point is ‘commit’ then "RET" is bound to + ‘magit-show-commit’, and when the type is either ‘branch’ or ‘tag’ + then it is bound to ‘magit-visit-ref’. + + "RET" is one of Magit’s most essential keys and at least by default + it should behave consistently across all of Magit, especially + because users quickly learn that it does something very harmless; + it shows more information about the thing at point in another buffer. - In refs buffers, when there is a local branch at point, then this - command instead checks out that branch. When there is a remote - branch or a tag at point then the respective commit is checked out - causing ‘HEAD’ to be detached. + However "RET" used to behave differently in ‘magit-refs-mode’ + buffers, doing surprising things, some of which cannot really be + described as "visit this thing". If you’ve grown accustomed this + behavior, you can restore it by adding one or more of the below + symbols to the value of this option. But keep in mind that by + doing so you don’t only introduce inconsistencies, you also lose + some functionality and might have to resort to ‘M-x + magit-show-commit’ to get it back. + + ‘magit-visit-ref’ looks for these symbols in the order in which + they are described here. If the presence of a symbol applies to + the current situation, then the symbols that follow do not affect + the outcome. + + • ‘focus-on-ref’ + + With a prefix argument update the buffer to show commit counts + and lists of cherry commits relative to the reference at point + instead of relative to the current buffer or ‘HEAD’. + + Instead of adding this symbol, consider pressing "C-u y o + RET". + + • ‘create-branch’ + + If point is on a remote branch, then create a new local branch + with the same name, use the remote branch as its upstream, and + then check out the local branch. - When a prefix argument it used, then this command only *focuses* on - the reference at point, i.e. the commit counts and cherries are - updated to be relative to that reference, but nothing is checked - out. + Instead of adding this symbol, consider pressing "b c RET + RET", like you would do in other buffers. - -- User Option: magit-visit-ref-create + • ‘checkout-any’ - When this is non-nil and ‘magit-visit-ref’ is called inside a refs - buffer, then it "visits" the remote branch at point by creating a - new local branch which tracks that remote branch and then checking - out the newly created branch. + Check out the reference at point. If that reference is a tag + or a remote branch, then this results in a detached ‘HEAD’. - This is not enabled by default because one has to use an extremely - loose definition of the verb "to visit" to be able to argue that - creating and then checking out a new local branch is a form of - visiting a remote branch. + Instead of adding this symbol, consider pressing "b b RET", + like you would do in other buffers. + + • ‘checkout-branch’ + + Check out the local branch at point. + + Instead of adding this symbol, consider pressing "b b RET", + like you would do in other buffers. * Menu: -* References sections:: +* References Sections::  -File: magit.info, Node: References sections, Up: References buffer +File: magit.info, Node: References Sections, Up: References Buffer -5.6.1 References sections +5.6.1 References Sections ------------------------- The contents of references buffers is controlled using the hook -‘magit-refs-sections-hook’. See *note Section hooks: Section hooks. to -learn about such hooks and how to customize them. All of the below -functions are members of the default value. Note that it makes much -less sense to customize this hook than it does for the respective hook -used for the status buffer. +‘magit-refs-sections-hook’. See *note Section Hooks:: to learn about +such hooks and how to customize them. All of the below functions are +members of the default value. Note that it makes much less sense to +customize this hook than it does for the respective hook used for the +status buffer. -- User Option: magit-refs-sections-hook @@ -3108,12 +3414,12 @@ used for the status buffer. Insert sections showing all tags.  -File: magit.info, Node: Bisecting, Next: Visiting blobs, Prev: References buffer, Up: Inspecting +File: magit.info, Node: Bisecting, Next: Visiting Blobs, Prev: References Buffer, Up: Inspecting 5.7 Bisecting ============= -Also see *note (gitman)git-bisect:: . +Also see *note (gitman)git-bisect::. ‘B’ (‘magit-bisect-popup’) @@ -3168,9 +3474,9 @@ bisect session. commits that still have to be bisected.  -File: magit.info, Node: Visiting blobs, Next: Blaming, Prev: Bisecting, Up: Inspecting +File: magit.info, Node: Visiting Blobs, Next: Blaming, Prev: Bisecting, Up: Inspecting -5.8 Visiting blobs +5.8 Visiting Blobs ================== ‘M-x magit-find-file’ (‘magit-find-file’) @@ -3184,12 +3490,12 @@ File: magit.info, Node: Visiting blobs, Next: Blaming, Prev: Bisecting, Up: create a new window or reuse an existing one.  -File: magit.info, Node: Blaming, Prev: Visiting blobs, Up: Inspecting +File: magit.info, Node: Blaming, Prev: Visiting Blobs, Up: Inspecting 5.9 Blaming =========== -Also see *note (gitman)git-blame:: . +Also see *note (gitman)git-blame::. ‘M-x magit-blame’ (‘magit-blame’) @@ -3296,22 +3602,22 @@ File: magit.info, Node: Manipulating, Next: Transferring, Prev: Inspecting, * Menu: -* Repository setup:: -* Staging and unstaging:: +* Repository Setup:: +* Staging and Unstaging:: * Applying:: * Committing:: * Branching:: * Merging:: -* Resolving conflicts:: +* Resolving Conflicts:: * Rebasing:: -* Cherry picking:: +* Cherry Picking:: * Resetting:: * Stashing::  -File: magit.info, Node: Repository setup, Next: Staging and unstaging, Up: Manipulating +File: magit.info, Node: Repository Setup, Next: Staging and Unstaging, Up: Manipulating -6.1 Repository setup +6.1 Repository Setup ==================== ‘M-x magit-init’ (‘magit-init’) @@ -3339,9 +3645,9 @@ File: magit.info, Node: Repository setup, Next: Staging and unstaging, Up: Ma ‘ask’, then ask the user every time she clones a repository.  -File: magit.info, Node: Staging and unstaging, Next: Applying, Prev: Repository setup, Up: Manipulating +File: magit.info, Node: Staging and Unstaging, Next: Applying, Prev: Repository Setup, Up: Manipulating -6.2 Staging and unstaging +6.2 Staging and Unstaging ========================= Like Git, Magit can of course stage and unstage complete files. Unlike @@ -3364,8 +3670,7 @@ the heading of a sibling section of the same type. once, a hunk, multiple hunks at once, and on parts of a hunk. These apply variants are described in the next section. - You can also use Ediff to stage and unstage. See *note Ediffing: -Ediffing. + You can also use Ediff to stage and unstage. See *note Ediffing::. ‘s’ (‘magit-stage’) @@ -3434,12 +3739,12 @@ Ediffing. * Menu: -* Staging from file-visiting buffers:: +* Staging from File-Visiting Buffers::  -File: magit.info, Node: Staging from file-visiting buffers, Up: Staging and unstaging +File: magit.info, Node: Staging from File-Visiting Buffers, Up: Staging and Unstaging -6.2.1 Staging from file-visiting buffers +6.2.1 Staging from File-Visiting Buffers ---------------------------------------- Fine-grained un-/staging has to be done from the status or a diff @@ -3463,7 +3768,7 @@ visited in the current buffer right from inside that buffer. buffer or when there is a file section at point.  -File: magit.info, Node: Applying, Next: Committing, Prev: Staging and unstaging, Up: Manipulating +File: magit.info, Node: Applying, Next: Committing, Prev: Staging and Unstaging, Up: Manipulating 6.3 Applying ============ @@ -3531,16 +3836,16 @@ using the file’s content as message. * Menu: -* Initiating a commit:: -* Editing commit messages:: +* Initiating a Commit:: +* Editing Commit Messages::  -File: magit.info, Node: Initiating a commit, Next: Editing commit messages, Up: Committing +File: magit.info, Node: Initiating a Commit, Next: Editing Commit Messages, Up: Committing -6.4.1 Initiating a commit +6.4.1 Initiating a Commit ------------------------- -Also see *note (gitman)git-commit:: . +Also see *note (gitman)git-commit::. ‘c’ (‘magit-commit-popup’) @@ -3631,9 +3936,9 @@ Also see *note (gitman)git-commit:: . error while using those is harder to recover from.  -File: magit.info, Node: Editing commit messages, Prev: Initiating a commit, Up: Committing +File: magit.info, Node: Editing Commit Messages, Prev: Initiating a Commit, Up: Committing -6.4.2 Editing commit messages +6.4.2 Editing Commit Messages ----------------------------- After initiating a commit as described in the previous section, two new @@ -3665,7 +3970,7 @@ is stored at the beginning and the end of an edit session (regardless of whether the session is finished successfully or was canceled). It is sometimes useful to bring back messages from that ring. -‘C-s M-s’ (‘git-commit-save-message’) +‘C-c M-s’ (‘git-commit-save-message’) Save the current buffer content to the commit message ring. @@ -3895,14 +4200,14 @@ File: magit.info, Node: Branching, Next: Merging, Prev: Committing, Up: Mani * Menu: -* The two remotes:: -* The branch popup:: -* The branch config popup:: +* The Two Remotes:: +* The Branch Popup:: +* The Branch Config Popup::  -File: magit.info, Node: The two remotes, Next: The branch popup, Up: Branching +File: magit.info, Node: The Two Remotes, Next: The Branch Popup, Up: Branching -6.5.1 The two remotes +6.5.1 The Two Remotes --------------------- The upstream branch of some local branch is the branch into which the @@ -3912,44 +4217,45 @@ upstream branch and the branch it is being pushed to, are usually the same remote branch. But for a feature branch the upstream branch and the branch it is being pushed to should differ. - Feature branches too should _eventually_ end up in a remote branch -such as ‘origin/master’ or ‘origin/maint’. Such a branch should -therefore be used as the upstream. But feature branches shouldn’t be -pushed directly to such branches. Instead a feature branch ‘my-feature’ -is usually pushed to ‘my-fork/my-feature’ or ‘origin/my-feature’. After -the new feature has been reviewed, the maintainer merges the feature -into ‘master’. And finally ‘master’ (not ‘my-feature’ itself) is pushed -to ‘origin/master’. + The commits on feature branches too should _eventually_ end up in a +remote branch such as ‘origin/master’ or ‘origin/maint’. Such a branch +should therefore be used as the upstream. But feature branches +shouldn’t be pushed directly to such branches. Instead a feature branch +‘my-feature’ is usually pushed to ‘my-fork/my-feature’ or if you are a +contributor ‘origin/my-feature’. After the new feature has been +reviewed, the maintainer merges the feature into ‘master’. And finally +‘master’ (not ‘my-feature’ itself) is pushed to ‘origin/master’. But new features seldom are perfect on the first try, and so feature -branches usually have to be improved and re-pushed many times. Pushing -should therefore be easy to do, and for that reason some users have -concluded that the remote branch to which a feature branch is being -pushed should be set as the upstream. Luckily Git has long ago gained -support for a push-remote which can be configured separately from the -upstream branch, using the variables ‘branch..pushRemote’ and -‘remote.pushDefault’, so we no longer have to choose which of the two -remotes should be used as "the remote". +branches usually have to be reviewed, improved, and re-pushed several +times. Pushing should therefore be easy to do, and for that reason many +Git users have concluded that it is best to use the remote branch to +which the local feature branch is being pushed as its upstream. + + But luckily Git has long ago gained support for a push-remote which +can be configured separately from the upstream branch, using the +variables ‘branch..pushRemote’ and ‘remote.pushDefault’. So we no +longer have to choose which of the two remotes should be used as "the +remote". Each of the fetching, pulling, and pushing popups features three -commands which act on the current branch and some other branch. Of +commands that act on the current branch and some other branch. Of these, ‘p’ is bound to a command which acts on the push-remote, ‘u’ is bound to a command which acts on the upstream, and ‘e’ is bound to a command which acts on any other branch. The status buffer shows -unpushed and unpulled for both the push-remote and the upstream. +unpushed and unpulled commits for both the push-remote and the upstream. It’s fairly simple to configure these two remotes. The values of all the variables that are related to fetching, pulling, and pushing (as well as some other branch-related variables) can be inspected and changed using the popup ‘magit-branch-config-popup’, which is a sub-popup of many popups that deal with branches. It is also possible -to set the push-remote and/or upstream while pushing (see *note Pushing: -Pushing.). +to set the push-remote or upstream while pushing (see *note Pushing::).  -File: magit.info, Node: The branch popup, Next: The branch config popup, Prev: The two remotes, Up: Branching +File: magit.info, Node: The Branch Popup, Next: The Branch Config Popup, Prev: The Two Remotes, Up: Branching -6.5.2 The branch popup +6.5.2 The Branch Popup ---------------------- The popup ‘magit-branch-popup’ is used to create and checkout branches, @@ -4018,10 +4324,12 @@ features are available from separate popups. new branch, instead of the starting-point itself. If optional FROM is non-nil, then the source branch is reset to - that commit, instead of to the last commit it shares with its - upstream. Interactively, FROM is non-nil, when the region selects - some commits, and among those commits, FROM it is the commit that - is the fewest commits ahead of the source branch. + ‘FROM~’, instead of to the last commit it shares with its upstream. + Interactively, FROM is only ever non-nil, if the region selects + some commits, and among those commits, FROM is the commit that is + the fewest commits ahead of the source branch. (It not yet + possible to spin off a single commit, unless it is the only + unpushed commit. See #2920.) The commit at the other end of the selection actually does not matter, all commits between FROM and ‘HEAD’ are moved to the new @@ -4035,8 +4343,7 @@ features are available from separate popups. When the branch being reset is the current branch, then a hard reset is performed. If there are any uncommitted changes, then the - user has to confirming the reset because those changes would be - lost. + user has to confirm the reset because those changes would be lost. This is useful when you have started work on a feature branch but realize it’s all crap and want to start over. @@ -4068,23 +4375,22 @@ features are available from separate popups. This option specifies whether remote upstreams are favored over local upstreams when creating new branches. - When a new branch is created, Magit offers the branch, commit, or - stash as the default starting point of the new branch. If there is - no such thing at point, then it falls back to offer the current - branch as starting-point. The user may then accept that default or - pick something else. + When a new branch is created, then the branch, commit, or stash at + point is suggested as the starting point of the new branch, or if + there is no such revision at point the current branch. In either + case the user may choose another starting point. - If the chosen starting-point is a branch, then it may also be set + If the chosen starting point is a branch, then it may also be set as the upstream of the new branch, depending on the value of the Git variable ‘branch.autoSetupMerge’. By default this is done for remote branches, but not for local branches. You might prefer to always use some remote branch as upstream. If - the chosen starting-point is (1) a local branch, (2) whose name + the chosen starting point is (1) a local branch, (2) whose name matches a member of the value of this option, (3) the upstream of that local branch is a remote branch with the same name, and (4) that remote branch can be fast-forwarded to the local branch, then - the chosen branch is used as starting-point, but its own upstream + the chosen branch is used as starting point, but its own upstream is used as the upstream of the new branch. Members of this option’s value are treated as branch names that @@ -4156,10 +4462,32 @@ features are available from separate popups. This command creates and checks out a new orphan branch with contents from a given revision. + -- Command: magit-branch-or-checkout + + This command is a hybrid between ‘magit-checkout’ and + ‘magit-branch-and-checkout’ and is intended as a replacement for + the former in ‘magit-branch-popup’. + + It first asks the user for an existing branch or revision. If the + user input actually can be resolved as a branch or revision, then + it checks that out, just like ‘magit-checkout’ would. + + Otherwise it creates and checks out a new branch using the input as + its name. Before doing so it reads the starting-point for the new + branch. This is similar to what ‘magit-branch-and-checkout’ does. + + To use this command instead of ‘magit-checkout’ add this to your + init file: + + (magit-remove-popup-key 'magit-branch-popup :action ?b) + (magit-define-popup-action 'magit-branch-popup + ?b "Checkout" 'magit-branch-or-checkout + 'magit-branch t) +  -File: magit.info, Node: The branch config popup, Prev: The branch popup, Up: Branching +File: magit.info, Node: The Branch Config Popup, Prev: The Branch Popup, Up: Branching -6.5.3 The branch config popup +6.5.3 The Branch Config Popup ----------------------------- -- Command: magit-branch-popup @@ -4291,9 +4619,8 @@ e.g.: For more information about these variables you should also see - *note (gitman)git-config:: . Also see *note (gitman)git-branch:: , - - *note (gitman)git-checkout:: , and *note Pushing: Pushing. + *note (gitman)git-config::. Also see *note (gitman)git-branch::. , +*note (gitman)git-checkout::. and *note Pushing::. -- User Option: magit-prefer-remote-upstream @@ -4307,12 +4634,12 @@ e.g.: change the upstream and many which create new branches.  -File: magit.info, Node: Merging, Next: Resolving conflicts, Prev: Branching, Up: Manipulating +File: magit.info, Node: Merging, Next: Resolving Conflicts, Prev: Branching, Up: Manipulating 6.6 Merging =========== -Also see *note (gitman)git-merge:: . For information on how to resolve +Also see *note (gitman)git-merge::. For information on how to resolve merge conflicts see the next section. ‘m’ (‘magit-merge-popup’) @@ -4368,9 +4695,9 @@ commands instead. Abort the current merge operation.  -File: magit.info, Node: Resolving conflicts, Next: Rebasing, Prev: Merging, Up: Manipulating +File: magit.info, Node: Resolving Conflicts, Next: Rebasing, Prev: Merging, Up: Manipulating -6.7 Resolving conflicts +6.7 Resolving Conflicts ======================= When merging branches (or otherwise combining or changing history) @@ -4454,7 +4781,7 @@ of commands and binding ‘C-c ^ C-h’ and press ‘RET’ while point is on a command name to read its documentation. Normally you would edit one version and then tell Smerge to keep only -that version. Use ‘C-c ^ m’ (‘smerge-keep-mine)’ to keep the "HEAD" +that version. Use ‘C-c ^ m’ (‘smerge-keep-mine’) to keep the ‘HEAD’ version or ‘C-c ^ o’ (‘smerge-keep-other’) to keep the version that follows "|||||||". Then use ‘C-c ^ n’ to move to the next conflicting area in the same file. Once you are done resolving conflicts, return to @@ -4468,21 +4795,21 @@ using Ediff press ‘e’ while point is on such a file in the status buffer. Ediff can be used for other purposes as well. For more information -on how to enter Ediff from Magit, see *note Ediffing: Ediffing. -Explaining how to use Ediff is beyond the scope of this manual, instead -see *note (ediff)Top::. +on how to enter Ediff from Magit, see *note Ediffing::. Explaining how +to use Ediff is beyond the scope of this manual, instead see *note +(ediff)Top::. If you are unsure whether you should Smerge or Ediff, then use the former. It is much easier to understand and use, and except for truely complex conflicts, the latter is usually overkill.  -File: magit.info, Node: Rebasing, Next: Cherry picking, Prev: Resolving conflicts, Up: Manipulating +File: magit.info, Node: Rebasing, Next: Cherry Picking, Prev: Resolving Conflicts, Up: Manipulating 6.8 Rebasing ============ -Also see *note (gitman)git-rebase:: . For information on how to resolve +Also see *note (gitman)git-rebase::. For information on how to resolve conflicts that occur during rebases see the preceding section. ‘r’ (‘magit-rebase-popup’) @@ -4498,8 +4825,7 @@ then stop somewhere along the way, either because you told it to do so, or because applying a commit failed due to a conflict. When that happens, then the status buffer shows information about the rebase sequence which is in progress in a section similar to a log section. -See *note Information about in-progress rebase: Information about -in-progress rebase. +See *note Information About In-Progress Rebase::. ‘r p’ (‘magit-rebase-onto-pushremote’) @@ -4516,15 +4842,23 @@ in-progress rebase. All commits that are reachable from head but not from the selected branch TARGET are being rebased." -‘r o’ (‘magit-rebase-subset’) +‘r s’ (‘magit-rebase-subset’) Start a non-interactive rebase sequence with commits from START to ‘HEAD’ onto NEWBASE. START has to be selected from a list of recent commits. - Note that the popup also features the infix argument ‘--interactive’. -This can be used to turn one of the above non-interactive rebase -variants into an interactive rebase. + By default Magit uses the ‘--autostash’ argument, which causes +uncommitted changes to be stored in a stash before the rebase begins. +These changes are restored after the rebase completes and if possible +the stash is removed. If the stash does not apply cleanly, then the +stash is not removed. In case something goes wrong when resolving the +conflicts, this allows you to start over. + + Even though one of the actions is dedicated to interactive rebases, +the popup also features the infix argument ‘--interactive’. This can be +used to turn one of the other, non-interactive rebase variants into an +interactive rebase. For example if you want to clean up a feature branch and at the same time rebase it onto ‘master’, then you could use ‘r-iu’. But we @@ -4578,13 +4912,13 @@ commands instead. * Menu: -* Editing rebase sequences:: -* Information about in-progress rebase:: +* Editing Rebase Sequences:: +* Information About In-Progress Rebase::  -File: magit.info, Node: Editing rebase sequences, Next: Information about in-progress rebase, Up: Rebasing +File: magit.info, Node: Editing Rebase Sequences, Next: Information About In-Progress Rebase, Up: Rebasing -6.8.1 Editing rebase sequences +6.8.1 Editing Rebase Sequences ------------------------------ ‘C-c C-c’ (‘with-editor-finish’) @@ -4602,14 +4936,14 @@ File: magit.info, Node: Editing rebase sequences, Next: Information about in-p Show the commit on the current line in another buffer and select that buffer. -‘SPC’ (‘magit-diff-show-or-scroll-up’) +‘SPC’ (‘git-rebase-show-or-scroll-up’) Show the commit on the current line in another buffer without selecting that buffer. If the revision buffer is already visible in another window of the current frame, then instead scroll that window up. -‘DEL’ (‘magit-diff-show-or-scroll-down’) +‘DEL’ (‘git-rebase-show-or-scroll-down’) Show the commit on the current line in another buffer without selecting that buffer. If the revision buffer is already visible @@ -4688,9 +5022,9 @@ File: magit.info, Node: Editing rebase sequences, Next: Information about in-p Whether confirmation is required to cancel.  -File: magit.info, Node: Information about in-progress rebase, Prev: Editing rebase sequences, Up: Rebasing +File: magit.info, Node: Information About In-Progress Rebase, Prev: Editing Rebase Sequences, Up: Rebasing -6.8.2 Information about in-progress rebase +6.8.2 Information About In-Progress Rebase ------------------------------------------ While a rebase sequence is in progress, the status buffer features a @@ -4734,8 +5068,7 @@ shown in different colors to indicate the status of the commits. • Commits prefixed with ‘pick’, ‘reword’, ‘edit’, ‘squash’, and ‘fixup’ have not been applied yet. These words have the same meaning here as they do in the buffer used to edit the rebase - sequence. See *note Editing rebase sequences: Editing rebase - sequences. + sequence. See *note Editing Rebase Sequences::. • The commit prefixed with ‘onto’ is the commit on top of which all the other commits are being re-applied. Like the commits that have @@ -4833,12 +5166,12 @@ commits can be used to answer the question "Do these two commits make the same change?".  -File: magit.info, Node: Cherry picking, Next: Resetting, Prev: Rebasing, Up: Manipulating +File: magit.info, Node: Cherry Picking, Next: Resetting, Prev: Rebasing, Up: Manipulating -6.9 Cherry picking +6.9 Cherry Picking ================== -Also see *note (gitman)git-cherry-pick:: . +Also see *note (gitman)git-cherry-pick::. ‘A’ (‘magit-cherry-pick-popup’) @@ -4885,7 +5218,7 @@ features these commands instead. * Reverting::  -File: magit.info, Node: Reverting, Up: Cherry picking +File: magit.info, Node: Reverting, Up: Cherry Picking 6.9.1 Reverting --------------- @@ -4928,12 +5261,12 @@ features these commands instead. all changes made since the sequence started.  -File: magit.info, Node: Resetting, Next: Stashing, Prev: Cherry picking, Up: Manipulating +File: magit.info, Node: Resetting, Next: Stashing, Prev: Cherry Picking, Up: Manipulating 6.10 Resetting ============== -Also see *note (gitman)git-reset:: . +Also see *note (gitman)git-reset::. ‘x’ (‘magit-reset’) @@ -4941,35 +5274,33 @@ Also see *note (gitman)git-reset:: . defaulting to the commit at point. The working tree is kept as-is. With a prefix argument also reset the working tree. -‘M-x magit-reset-index’ (‘magit-reset-index’) - - Reset the index to some commit read from the user and defaulting to - the commit at point. Keep the ‘HEAD’ and working tree as-is, so if - the commit refers to the ‘HEAD’, then this effectively unstages all - changes. - -‘M-x magit-reset-head’ (‘magit-reset-head’) +‘X m’ (‘magit-reset-head’) Reset the ‘HEAD’ and index to some commit read from the user and defaulting to the commit at point. The working tree is kept as-is. -‘M-x magit-reset-soft’ (‘magit-reset-soft’) +‘X s’ (‘magit-reset-soft’) Reset the ‘HEAD’ to some commit read from the user and defaulting to the commit at point. The index and the working tree are kept as-is. -‘M-x magit-reset-hard’ (‘magit-reset-hard’) +‘X h’ (‘magit-reset-hard’) Reset the ‘HEAD’, index, and working tree to some commit read from the user and defaulting to the commit at point. -‘M-x magit-checkout-file’ (‘magit-checkout-file’) +‘X i’ (‘magit-reset-index’) - Update file in the working tree and index to the contents from a - revision. + Reset the index to some commit read from the user and defaulting to + the commit at point. Keep the ‘HEAD’ and working tree as-is, so if + the commit refers to the ‘HEAD’, then this effectively unstages all + changes. - Both the revision and file are read from the user. +‘X f’ (‘magit-file-checkout’) + + Update file in the working tree and index to the contents from a + revision. Both the revision and file are read from the user.  File: magit.info, Node: Stashing, Prev: Resetting, Up: Manipulating @@ -4977,7 +5308,7 @@ File: magit.info, Node: Stashing, Prev: Resetting, Up: Manipulating 6.11 Stashing ============= -Also see *note (gitman)git-stash:: . +Also see *note (gitman)git-stash::. ‘z’ (‘magit-stash-popup’) @@ -5047,10 +5378,6 @@ Also see *note (gitman)git-stash:: . Remove a stash from the stash list. When the region is active, offer to drop all contained stashes. -‘z l’ (‘magit-stash-list’) - - List all stashes in a buffer. - ‘z v’ (‘magit-stash-show’) Show all diffs of a stash in a buffer. @@ -5067,6 +5394,36 @@ Also see *note (gitman)git-stash:: . Remove all stashes saved in REF’s reflog by deleting REF. +‘z l’ (‘magit-stash-list’) + + List all stashes in a buffer. + + -- User Option: magit-stashes-margin + + This option specifies whether the margin is initially shown in + stashes buffers and how it is formatted. + + The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’. + + • If INIT is non-nil, then the margin is shown initially. + + • STYLE controls how to format the committer date. It can be + one of ‘age’ (to show the age of the commit), + ‘age-abbreviated’ (to abbreviate the time unit to a + character), or a string (suitable for ‘format-time-string’) to + show the actual date. + + • WIDTH controls the width of the margin. This exists for + forward compatibility and currently the value should not be + changed. + + • AUTHOR controls whether the name of the author is also shown + by default. + + • AUTHOR-WIDTH has to be an integer. When the name of the + author is shown, then this specifies how much space is used to + do so. +  File: magit.info, Node: Transferring, Next: Miscellaneous, Prev: Manipulating, Up: Top @@ -5079,8 +5436,8 @@ File: magit.info, Node: Transferring, Next: Miscellaneous, Prev: Manipulating * Fetching:: * Pulling:: * Pushing:: -* Creating and sending patches:: -* Applying patches:: +* Creating and Sending Patches:: +* Applying Patches::  File: magit.info, Node: Remotes, Next: Fetching, Up: Transferring @@ -5088,7 +5445,7 @@ File: magit.info, Node: Remotes, Next: Fetching, Up: Transferring 7.1 Remotes =========== -Also see *note (gitman)git-remote:: . +Also see *note (gitman)git-remote::. ‘M’ (‘magit-remote-popup’) @@ -5121,9 +5478,9 @@ Also see *note (gitman)git-remote:: . If ‘ask’, then always ask. If ‘ask-if-unset’, then ask, but only if the variable isn’t set already. If ‘nil’, then don’t ever set. - If the value is a string, then set without asking, provided the - name of the name of the added remote is equal to that string and - the variable isn’t already set. + If the value is a string, then set without asking, provided that + the name of the added remote is equal to that string and the + variable isn’t already set.  File: magit.info, Node: Fetching, Next: Pulling, Prev: Remotes, Up: Transferring @@ -5132,9 +5489,9 @@ File: magit.info, Node: Fetching, Next: Pulling, Prev: Remotes, Up: Transfer ============ For information about the differences between the _upstream_ and the -_push-remote_, see *note Branching: Branching. +_push-remote_, see *note Branching::. - Also see *note (gitman)git-fetch:: . + Also see *note (gitman)git-fetch::. ‘f’ (‘magit-fetch-popup’) @@ -5183,9 +5540,9 @@ File: magit.info, Node: Pulling, Next: Pushing, Prev: Fetching, Up: Transfer =========== For information about the differences between the _upstream_ and the -_push-remote_, see *note Branching: Branching. +_push-remote_, see *note Branching::. - Also see *note (gitman)git-pull:: . + Also see *note (gitman)git-pull::. ‘F’ (‘magit-pull-popup’) @@ -5209,15 +5566,15 @@ could also use ‘magit-pull-and-fetch-popup’. See its doc-string for more information.  -File: magit.info, Node: Pushing, Next: Creating and sending patches, Prev: Pulling, Up: Transferring +File: magit.info, Node: Pushing, Next: Creating and Sending Patches, Prev: Pulling, Up: Transferring 7.4 Pushing =========== For information about the differences between the _upstream_ and the -_push-remote_, see *note Branching: Branching. +_push-remote_, see *note Branching::. - Also see *note (gitman)git-push:: . + Also see *note (gitman)git-push::. ‘P’ (‘magit-push-popup’) @@ -5327,9 +5684,9 @@ them to the popup. added or removed after restarting Emacs.  -File: magit.info, Node: Creating and sending patches, Next: Applying patches, Prev: Pushing, Up: Transferring +File: magit.info, Node: Creating and Sending Patches, Next: Applying Patches, Prev: Pushing, Up: Transferring -7.5 Creating and sending patches +7.5 Creating and Sending Patches ================================ ‘W’ (‘magit-patch-popup’) @@ -5348,12 +5705,12 @@ File: magit.info, Node: Creating and sending patches, Next: Applying patches, Request that upstream pulls from your public repository.  -File: magit.info, Node: Applying patches, Prev: Creating and sending patches, Up: Transferring +File: magit.info, Node: Applying Patches, Prev: Creating and Sending Patches, Up: Transferring -7.6 Applying patches +7.6 Applying Patches ==================== -Also see *note (gitman)git-am:: . +Also see *note (gitman)git-am::. ‘w’ (‘magit-am-popup’) @@ -5395,10 +5752,10 @@ File: magit.info, Node: Miscellaneous, Next: Customizing, Prev: Transferring, * Notes:: * Submodules:: * Subtree:: -* Common commands:: -* Wip modes:: -* Minor mode for buffers visiting files:: -* Minor mode for buffers visiting blobs:: +* Common Commands:: +* Wip Modes:: +* Minor Mode for Buffers Visiting Files:: +* Minor Mode for Buffers Visiting Blobs::  File: magit.info, Node: Tagging, Next: Notes, Up: Miscellaneous @@ -5406,7 +5763,7 @@ File: magit.info, Node: Tagging, Next: Notes, Up: Miscellaneous 8.1 Tagging =========== -Also see *note (gitman)git-tag:: . +Also see *note (gitman)git-tag::. ‘t’ (‘magit-tag-popup’) @@ -5434,7 +5791,7 @@ File: magit.info, Node: Notes, Next: Submodules, Prev: Tagging, Up: Miscella 8.2 Notes ========= -Also see *note (gitman)git-notes:: . +Also see *note (gitman)git-notes::. ‘T’ (‘magit-notes-popup’) @@ -5508,20 +5865,20 @@ File: magit.info, Node: Submodules, Next: Subtree, Prev: Notes, Up: Miscella 8.3 Submodules ============== -Also see *note (gitman)git-submodule:: . +Also see *note (gitman)git-submodule::. * Menu: -* Listing submodules:: -* Submodule popup:: +* Listing Submodules:: +* Submodule Popup::  -File: magit.info, Node: Listing submodules, Next: Submodule popup, Up: Submodules +File: magit.info, Node: Listing Submodules, Next: Submodule Popup, Up: Submodules -8.3.1 Listing submodules +8.3.1 Listing Submodules ------------------------ -The command ‘magit-list-submodule’ displays a list of the current +The command ‘magit-list-submodules’ displays a list of the current repository’s submodules in a separate buffer. It’s also possible to display information about submodules directly in the status buffer of the super-repository by adding ‘magit-insert-submodules’ to the hook @@ -5552,7 +5909,8 @@ the super-repository by adding ‘magit-insert-submodules’ to the hook -- Function: magit-insert-submodules Insert sections for all submodules. For each section insert the - path, the branch, and the output of ‘git describe --tags’. + path, the branch, and the output of ‘git describe --tags’, or, + failing that, the abbreviated HEAD commit hash. Press ‘RET’ on such a submodule section to show its own status buffer. Press ‘RET’ on the "Modules" section to display a list of @@ -5560,9 +5918,9 @@ the super-repository by adding ‘magit-insert-submodules’ to the hook not displayed in the super-repository’s status buffer.  -File: magit.info, Node: Submodule popup, Prev: Listing submodules, Up: Submodules +File: magit.info, Node: Submodule Popup, Prev: Listing Submodules, Up: Submodules -8.3.2 Submodule popup +8.3.2 Submodule Popup --------------------- ‘o’ (‘magit-submodule-popup’) @@ -5603,12 +5961,12 @@ File: magit.info, Node: Submodule popup, Prev: Listing submodules, Up: Submod Unregister the submodule at PATH.  -File: magit.info, Node: Subtree, Next: Common commands, Prev: Submodules, Up: Miscellaneous +File: magit.info, Node: Subtree, Next: Common Commands, Prev: Submodules, Up: Miscellaneous 8.4 Subtree =========== -Also see *note (gitman)git-subtree:: . +Also see *note (gitman)git-subtree::. ‘O’ (‘magit-tree-popup’) @@ -5648,9 +6006,9 @@ used. Otherwise the prefix is read in the minibuffer. Extract the history of the subtree PREFIX.  -File: magit.info, Node: Common commands, Next: Wip modes, Prev: Subtree, Up: Miscellaneous +File: magit.info, Node: Common Commands, Next: Wip Modes, Prev: Subtree, Up: Miscellaneous -8.5 Common commands +8.5 Common Commands =================== These are some of the commands that can be used in all buffers whose @@ -5688,9 +6046,9 @@ of these commands behave like ‘kill-ring-save’ instead of as described above.  -File: magit.info, Node: Wip modes, Next: Minor mode for buffers visiting files, Prev: Common commands, Up: Miscellaneous +File: magit.info, Node: Wip Modes, Next: Minor Mode for Buffers Visiting Files, Prev: Common Commands, Up: Miscellaneous -8.6 Wip modes +8.6 Wip Modes ============= Git keeps *committed* changes around long enough for users to recover @@ -5727,22 +6085,22 @@ additional commit with the message "restart autosaving" is created on it Starting with - BI0---BI1 refs/wip/index/refs/heads/master - / -A---B refs/heads/master - \ - BW0---BW1 refs/wip/wtree/refs/heads/master + BI0---BI1 refs/wip/index/refs/heads/master + / + A---B refs/heads/master + \ + BW0---BW1 refs/wip/wtree/refs/heads/master and committing the staged changes and editing and saving a file would result in - BI0---BI1 refs/wip/index/refs/heads/master - / -A---B---C refs/heads/master - \ \ - \ CW0---CW1 refs/wip/wtree/refs/heads/master - \ - BW0---BW1 refs/wip/wtree/refs/heads/master@{2} + BI0---BI1 refs/wip/index/refs/heads/master + / + A---B---C refs/heads/master + \ \ + \ CW0---CW1 refs/wip/wtree/refs/heads/master + \ + BW0---BW1 refs/wip/wtree/refs/heads/master@{2} The fork-point of the index wip ref is not changed until some change is being staged. Likewise just checking out a branch or creating a @@ -5845,9 +6203,9 @@ files are being committed. ‘’.  -File: magit.info, Node: Minor mode for buffers visiting files, Next: Minor mode for buffers visiting blobs, Prev: Wip modes, Up: Miscellaneous +File: magit.info, Node: Minor Mode for Buffers Visiting Files, Next: Minor Mode for Buffers Visiting Blobs, Prev: Wip Modes, Up: Miscellaneous -8.7 Minor mode for buffers visiting files +8.7 Minor Mode for Buffers Visiting Files ========================================= The ‘magit-file-mode’ enables certain Magit features in file-visiting @@ -5859,9 +6217,9 @@ few key bindings, but this might be extended in the future. Whether to establish certain Magit key bindings in all file-visiting buffers belonging to a Git repository. This - establishes the bindings suggested in *note Getting started: - Getting started. (but only for file-visiting buffers), and - additionally binds ‘C-c M-g’ to ‘magit-file-popup’. + establishes the bindings suggested in *note Getting Started:: (but + only for file-visiting buffers), and additionally binds ‘C-c M-g’ + to ‘magit-file-popup’. ‘C-c M-g’ (‘magit-file-popup’) @@ -5881,7 +6239,7 @@ few key bindings, but this might be extended in the future. This prefix command shows suffix commands along with the appropriate infix arguments in a popup buffer. See *note - Initiating a commit: Initiating a commit. + Initiating a Commit::. ‘C-c M-g D’ (‘magit-diff-buffer-file-popup’) @@ -5894,13 +6252,12 @@ few key bindings, but this might be extended in the future. ‘C-c M-g d’ (‘magit-diff-buffer-file’) This command shows the diff for the file of blob that the current - buffer visits. Renames are followed when a prefix argument is used - or when ‘--follow’ is part of ‘magit-diff-arguments’. + buffer visits. -- User Option: magit-diff-buffer-file-locked This option controls whether ‘magit-diff-buffer-file’ uses a - decicated buffer. See *note Modes and Buffers: Modes and Buffers. + decicated buffer. See *note Modes and Buffers::. ‘C-c M-g L’ (‘magit-log-buffer-file-popup’) @@ -5913,34 +6270,35 @@ few key bindings, but this might be extended in the future. This command shows the log for the file of blob that the current buffer visits. Renames are followed when a prefix argument is used - or when ‘--follow’ is part of ‘magit-log-arguments’. + or when ‘--follow’ is part of ‘magit-log-arguments’. When the + region is active, the log is restricted to the selected line range. -- User Option: magit-log-buffer-file-locked This option controls whether ‘magit-log-buffer-file’ uses a - decicated buffer. See *note Modes and Buffers: Modes and Buffers. + decicated buffer. See *note Modes and Buffers::. ‘C-c M-g b’ (‘magit-blame-popup’) This prefix command shows the ‘magit-blame’ suffix command along with the appropriate infix arguments in a popup buffer. See *note - Initiating a commit: Initiating a commit. + Initiating a Commit::. ‘C-c M-g p’ (‘magit-blob-previous’) Visit the previous blob which modified the current file.  -File: magit.info, Node: Minor mode for buffers visiting blobs, Prev: Minor mode for buffers visiting files, Up: Miscellaneous +File: magit.info, Node: Minor Mode for Buffers Visiting Blobs, Prev: Minor Mode for Buffers Visiting Files, Up: Miscellaneous -8.8 Minor mode for buffers visiting blobs +8.8 Minor Mode for Buffers Visiting Blobs ========================================= The ‘magit-blob-mode’ enables certain Magit features in blob-visiting buffers. Such buffers can be created using ‘magit-find-file’ and some of the commands mentioned below, which also take care of turning on this minor mode. Currently this mode only establishes a few key bindings, -but this might be e +but this might be extended. ‘p’ (‘magit-blob-previous’) @@ -5991,13 +6349,13 @@ the following. * Menu: -* Per-repository configuration:: -* Essential settings:: +* Per-Repository Configuration:: +* Essential Settings::  -File: magit.info, Node: Per-repository configuration, Next: Essential settings, Up: Customizing +File: magit.info, Node: Per-Repository Configuration, Next: Essential Settings, Up: Customizing -9.1 Per-repository configuration +9.1 Per-Repository Configuration ================================ Magit can be configured on a per-repository level using both Git @@ -6005,7 +6363,7 @@ variables as well as Emacs options. To set a Git variable for one repository only, simply set it in ‘/path/to/repo/.git/config’ instead of ‘$HOME/.gitconfig’ or -‘/etc/gitconfig’. See *note (gitman)git-config:: . +‘/etc/gitconfig’. See *note (gitman)git-config::. Similarly, Emacs options can be set for one repository only by editing ‘/path/to/repo/.dir-locals.el’. See *note (emacs)Directory @@ -6026,12 +6384,12 @@ example: • ‘/path/to/huge/repo/.git/config’ [include] - path = /path/to/huge-gitconfig + path = /path/to/huge-gitconfig • ‘/path/to/huge-gitconfig’ [status] - showUntrackedFiles = no + showUntrackedFiles = no • ‘$HOME/.emacs.d/init.el’ @@ -6042,9 +6400,9 @@ example: "/path/to/huge/repo/" 'huge-git-repository)  -File: magit.info, Node: Essential settings, Prev: Per-repository configuration, Up: Customizing +File: magit.info, Node: Essential Settings, Prev: Per-Repository Configuration, Up: Customizing -9.2 Essential settings +9.2 Essential Settings ====================== The next two sections list and discuss several variables that many users @@ -6056,7 +6414,7 @@ might want to customize, for safety and/or performance reasons. * Performance::  -File: magit.info, Node: Safety, Next: Performance, Up: Essential settings +File: magit.info, Node: Safety, Next: Performance, Up: Essential Settings 9.2.1 Safety ------------ @@ -6071,14 +6429,14 @@ for *uncommitted* changes in the working tree and not even the index uncommitted changes, it also makes it easy to shoot yourself in the foot in the process. For that reason Magit provides three global modes that save *tracked* files to work-in-progress references after or before -certain actions. See *note Wip modes: Wip modes. +certain actions. See *note Wip Modes::. These modes are not enabled by default because of performance concerns. Instead a lot of potentially destructive commands require confirmation every time they are used. In many cases this can be disabled by adding a symbol to ‘magit-no-confirm’ (see *note Completion -and confirmation: Completion and confirmation.). If you enable the -various wip modes then you should add ‘safe-with-wip’ to this list. +and Confirmation::). If you enable the various wip modes then you +should add ‘safe-with-wip’ to this list. Similarly it isn’t necessary to require confirmation before moving a file to the system trash - if you trashed a file by mistake then you can @@ -6090,10 +6448,10 @@ want to change that. By default buffers visiting files are automatically reverted when the visited file changes on disk. This isn’t as risky as it might seem, but to make an informed decision you should see *note Risk of Reverting -Automatically: Risk of Reverting Automatically. +Automatically::.  -File: magit.info, Node: Performance, Prev: Safety, Up: Essential settings +File: magit.info, Node: Performance, Prev: Safety, Up: Essential Settings 9.2.2 Performance ----------------- @@ -6137,7 +6495,7 @@ should help. 'magit-auto-revert-repository-buffers-p) For alternative approaches see *note Automatic Reverting of -File-Visiting Buffers: Automatic Reverting of File-Visiting Buffers. +File-Visiting Buffers::. If you have enabled any features that are disabled by default, then you should check whether they impact performance significantly. It’s @@ -6147,32 +6505,12 @@ they reduce performance at least in large repositories. If performance is only slow inside certain unusually large repositories, then you might want to disable certain features on a per-repository or per-repository-class basis only. See *note -Per-repository configuration: Per-repository configuration. - -Microsoft Windows Performance -............................. - -In order to update the status buffer, ‘git’ has to be run a few dozen -times. That is only problematic on Microsoft Windows, because that -operating system is exceptionally slow at starting processes. Sadly -this is an issue that can only be fixed by Microsoft itself, and they -don’t appear to be particularly interested in doing so. - - Beside the subprocess issue, there also exist other Window-specific -performance issues, some of which can be worked around. The maintainers -of "Git for Windows" try to reduce their effect, and in order to benefit -from the latest performance tweaks, should always use the latest -release. Magit too tries to work around some Windows-specific issues. - - According to some sources setting the following Git variables can -also help. +Per-Repository Configuration::. - git config --global core.preloadindex true # default since v2.1 - git config --global core.fscache true # default since v2.8 - git config --global gc.auto 256 +* Menu: - You should also check whether an anti-virus program is slowing things -down. +* Microsoft Windows Performance:: +* MacOS Performance:: Log Performance ............... @@ -6256,7 +6594,7 @@ but doing it this way has the advantage that you usually get to see the diff, which is useful because it increases the odds that you spot potential issues. -The built-in VC Package +The Built-In VC Package ....................... Emacs comes with a version control interface called "VC", see *note @@ -6271,6 +6609,70 @@ using another version control system: (setq vc-handled-backends (delq 'Git vc-handled-backends)) + +File: magit.info, Node: Microsoft Windows Performance, Next: MacOS Performance, Up: Performance + +Microsoft Windows Performance +............................. + +In order to update the status buffer, ‘git’ has to be run a few dozen +times. That is problematic on Microsoft Windows, because that operating +system is exceptionally slow at starting processes. Sadly this is an +issue that can only be fixed by Microsoft itself, and they don’t appear +to be particularly interested in doing so. + + Beside the subprocess issue, there also exist other Window-specific +performance issues, some of which can be worked around. The maintainers +of "Git for Windows" try to reduce their effect, and in order to benefit +from the latest performance tweaks, should always use the latest +release. Magit too tries to work around some Windows-specific issues. + + According to some sources setting the following Git variables can +also help. + + git config --global core.preloadindex true # default since v2.1 + git config --global core.fscache true # default since v2.8 + git config --global gc.auto 256 + + You should also check whether an anti-virus program is slowing things +down. + + +File: magit.info, Node: MacOS Performance, Prev: Microsoft Windows Performance, Up: Performance + +MacOS Performance +................. + +On macOS Emacs currently creates child processes using ‘fork’. It +appears that this also copies GUI resources. The result is that forking +takes about 30 times as long on Darwin than on Linux. And because Magit +starts many ‘git’ processes even when doing simple things, that makes +quite a difference. + + On the ‘master’ branch Emacs now uses ‘vfork’ when possible, like +this was already done on Linux, and now child creation only takes about +twice as long on Darwin. See (1) for more information. + + Nobody knows when the changes on the ‘master’ branch will be released +as ‘26.1’, but it is still a long way off. You might want to get your +hands on this change before then. The easiest way to get a patched +Emacs is to install the ‘emacs-plus’ formula (2) using ‘homebrew’. The +change has been backported, so you get it not only when using ‘--HEAD’, +but also when using ‘--devel’ or when installing the latest release (by +not using a version argument). + + Alternatively you can apply the backport (3) manually. + + ---------- Footnotes ---------- + + (1) + + + (2) + + (3) + +  File: magit.info, Node: Plumbing, Next: FAQ, Prev: Customizing, Up: Top @@ -6293,12 +6695,12 @@ command provided by your own Magit extension, then checkout * Menu: * Calling Git:: -* Section plumbing:: -* Refreshing buffers:: +* Section Plumbing:: +* Refreshing Buffers:: * Conventions::  -File: magit.info, Node: Calling Git, Next: Section plumbing, Up: Plumbing +File: magit.info, Node: Calling Git, Next: Section Plumbing, Up: Plumbing 10.1 Calling Git ================ @@ -6329,13 +6731,13 @@ refresh when the executable has finished. * Menu: -* Getting a value from Git:: -* Calling Git for effect:: +* Getting a Value from Git:: +* Calling Git for Effect::  -File: magit.info, Node: Getting a value from Git, Next: Calling Git for effect, Up: Calling Git +File: magit.info, Node: Getting a Value from Git, Next: Calling Git for Effect, Up: Calling Git -10.1.1 Getting a value from Git +10.1.1 Getting a Value from Git ------------------------------- These functions run Git in order to get a value, either its exit status @@ -6414,9 +6816,9 @@ occur we need to be able to debug them. need to use this function.  -File: magit.info, Node: Calling Git for effect, Prev: Getting a value from Git, Up: Calling Git +File: magit.info, Node: Calling Git for Effect, Prev: Getting a Value from Git, Up: Calling Git -10.1.2 Calling Git for effect +10.1.2 Calling Git for Effect ----------------------------- These functions are used to run git to produce some effect. Most Magit @@ -6489,7 +6891,7 @@ refresh because that also automatically moves to the next change. first insert the raw output at point. If there is no output call ‘magit-cancel-section’. Otherwise temporarily narrow the buffer to the inserted text, move to its beginning, and then call function - WASHER with no argument. + WASHER with ARGS as its sole argument. And now for the asynchronous variants. @@ -6570,21 +6972,21 @@ refresh because that also automatically moves to the next change. if git exits with a non-zero exit status. For debugging purposes.  -File: magit.info, Node: Section plumbing, Next: Refreshing buffers, Prev: Calling Git, Up: Plumbing +File: magit.info, Node: Section Plumbing, Next: Refreshing Buffers, Prev: Calling Git, Up: Plumbing -10.2 Section plumbing +10.2 Section Plumbing ===================== * Menu: -* Creating sections:: -* Section selection:: -* Matching sections:: +* Creating Sections:: +* Section Selection:: +* Matching Sections::  -File: magit.info, Node: Creating sections, Next: Section selection, Up: Section plumbing +File: magit.info, Node: Creating Sections, Next: Section Selection, Up: Section Plumbing -10.2.1 Creating sections +10.2.1 Creating Sections ------------------------ -- Macro: magit-insert-section &rest args @@ -6664,9 +7066,9 @@ File: magit.info, Node: Creating sections, Next: Section selection, Up: Secti displayed title of the section.  -File: magit.info, Node: Section selection, Next: Matching sections, Prev: Creating sections, Up: Section plumbing +File: magit.info, Node: Section Selection, Next: Matching Sections, Prev: Creating Sections, Up: Section Plumbing -10.2.2 Section selection +10.2.2 Section Selection ------------------------ -- Function: magit-current-section @@ -6704,9 +7106,9 @@ File: magit.info, Node: Section selection, Next: Matching sections, Prev: Cre TYPES, or nil is returned.  -File: magit.info, Node: Matching sections, Prev: Section selection, Up: Section plumbing +File: magit.info, Node: Matching Sections, Prev: Section Selection, Up: Section Plumbing -10.2.3 Matching sections +10.2.3 Matching Sections ------------------------ ‘M-x magit-describe-section’ (‘magit-describe-section’) @@ -6835,9 +7237,9 @@ File: magit.info, Node: Matching sections, Prev: Section selection, Up: Secti actually a ‘diff’ but a ‘diffstat’ section.  -File: magit.info, Node: Refreshing buffers, Next: Conventions, Prev: Section plumbing, Up: Plumbing +File: magit.info, Node: Refreshing Buffers, Next: Conventions, Prev: Section Plumbing, Up: Plumbing -10.3 Refreshing buffers +10.3 Refreshing Buffers ======================= All commands that create a new Magit buffer or change what is being @@ -6905,20 +7307,20 @@ where ‘*’ may be something like ‘diff’) with the value of then calling this ‘magit-refresh-function’.  -File: magit.info, Node: Conventions, Prev: Refreshing buffers, Up: Plumbing +File: magit.info, Node: Conventions, Prev: Refreshing Buffers, Up: Plumbing 10.4 Conventions ================ * Menu: -* Confirmation and completion:: +* Confirmation and Completion:: * Theming Faces::  -File: magit.info, Node: Confirmation and completion, Next: Theming Faces, Up: Conventions +File: magit.info, Node: Confirmation and Completion, Next: Theming Faces, Up: Conventions -10.4.1 Confirmation and completion +10.4.1 Confirmation and Completion ---------------------------------- Dangerous operations that may lead to data loss have to be confirmed by @@ -6934,7 +7336,7 @@ item, just like if the command had been invoked with no suitable section at point at all.  -File: magit.info, Node: Theming Faces, Prev: Confirmation and completion, Up: Conventions +File: magit.info, Node: Theming Faces, Prev: Confirmation and Completion, Up: Conventions 10.4.2 Theming Faces -------------------- @@ -7076,189 +7478,188 @@ that if you do not get this right, this will in some cases look to users like bugs in Magit - so please do it right or not at all.  -File: magit.info, Node: FAQ, Next: Keystroke Index, Prev: Plumbing, Up: Top +File: magit.info, Node: FAQ, Next: Debugging Tools, Prev: Plumbing, Up: Top Appendix A FAQ ************** -Below you find a list of frequently asked questions. For a list of +The next two nodes lists frequently asked questions. For a list of frequently *and recently* asked questions, i.e. questions that haven’t made it into the manual yet, see . + Please also use the *note Debugging Tools::. + * Menu: -* Magit is slow:: -* I changed several thousand files at once and now Magit is unusable:: -* I am having problems committing:: -* Diffs are collapsed after un-/staging:: -* I don't understand how branching and pushing work:: -* I don’t like the key binding in v2.4: I don't like the key binding in v24. -* I cannot install the pre-requisites for Magit v2:: -* I am using an Emacs release older than v24.4: I am using an Emacs release older than v244. -* I am using a Git release older than v1.9.4: I am using a Git release older than v194. -* I am using MS Windows and cannot push with Magit:: -* I am using OS X and SOMETHING works in shell, but not in Magit: I am using OS X and SOMETHING works in shell but not in Magit. -* How to install the gitman info manual?:: -* How can I show Git's output?:: -* Diffs contain control sequences:: -* Expanding a file to show the diff causes it to disappear:: -* Point is wrong in the ‘COMMIT_EDITMSG’ buffer:: -* The mode-line information isn't always up-to-date:: -* Can Magit be used as ‘ediff-version-control-package’?:: -* How to show diffs for gpg-encrypted files?:: -* Emacs 24.5 hangs when loading Magit: Emacs 245 hangs when loading Magit. -* Symbol's value as function is void ‘--some’:: -* Where is the branch manager:: +* FAQ - How to …?:: +* FAQ - Issues and Errors::  -File: magit.info, Node: Magit is slow, Next: I changed several thousand files at once and now Magit is unusable, Up: FAQ +File: magit.info, Node: FAQ - How to …?, Next: FAQ - Issues and Errors, Up: FAQ -A.1 Magit is slow -================= +A.1 FAQ - How to …? +=================== -See *note Performance: Performance. +* Menu: + +* How to show git's output?:: +* How to install the gitman info manual?:: +* How to show diffs for gpg-encrypted files?:: +* How does branching and pushing work?:: +* Can Magit be used as ‘ediff-version-control-package’?::  -File: magit.info, Node: I changed several thousand files at once and now Magit is unusable, Next: I am having problems committing, Prev: Magit is slow, Up: FAQ +File: magit.info, Node: How to show git's output?, Next: How to install the gitman info manual?, Up: FAQ - How to …? -A.2 I changed several thousand files at once and now Magit is unusable -====================================================================== +A.1.1 How to show git’s output? +------------------------------- -Magit is *currently* not expected to work under such conditions. It -sure would be nice if it did, and v2.5 will hopefully be a big step into -that direction. But it might take until v3.1 to accomplish fully -satisfactory performance, because that requires some heavy refactoring. +To show the output of recently run git commands, press ‘$’ (or, if that +isn’t available, ‘M-x magit-process-buffer’). This will show a buffer +containing a section per git invocation; as always press ‘TAB’ to expand +or collapse them. - But for now we recommend you use the command line to complete this -one commit. Also see *note Performance: Performance. + By default git’s output is only inserted into the process buffer if +it is run for side-effects. When the output is consumed in some way +then also inserting it into the process buffer would be to expensive. +For debugging purposes it’s possible to do so anyway by setting +‘magit-git-debug’ to ‘t’.  -File: magit.info, Node: I am having problems committing, Next: Diffs are collapsed after un-/staging, Prev: I changed several thousand files at once and now Magit is unusable, Up: FAQ +File: magit.info, Node: How to install the gitman info manual?, Next: How to show diffs for gpg-encrypted files?, Prev: How to show git's output?, Up: FAQ - How to …? -A.3 I am having problems committing -=================================== +A.1.2 How to install the gitman info manual? +-------------------------------------------- -That likely means that Magit is having problems finding an appropriate -emacsclient executable. See *note (with-editor)Configuring -With-Editor:: and *note (with-editor)Debugging::. +Git’s manpages can be exported as an info manual called ‘gitman’. +Magit’s own info manual links to nodes in that manual instead of the +actual manpages because Info doesn’t support linking to manpages. - -File: magit.info, Node: Diffs are collapsed after un-/staging, Next: I don't understand how branching and pushing work, Prev: I am having problems committing, Up: FAQ + Unfortunately some distributions do not install the ‘gitman’ manual +by default and you will have to install a separate documentation package +to get it. -A.4 Diffs are collapsed after un-/staging -========================================= + Magit patches Info adding the ability to visit links to the ‘gitman’ +Info manual by instead viewing the respective manpage. If you prefer +that approach, then set the value of ‘magit-view-git-manual-method’ to +one of the supported packages ‘man’ or ‘woman’, e.g.: -This typically happens on Windows and/or large repositories where -preparing diffs takes longer than ‘magit-diff-expansion-threshold’. The -default is one second, try increasing it to a larger value. + (setq magit-view-git-manual-method 'man) + + +File: magit.info, Node: How to show diffs for gpg-encrypted files?, Next: How does branching and pushing work?, Prev: How to install the gitman info manual?, Up: FAQ - How to …? - Currently when one part of a Magit buffer has to be updated the whole -buffer is recreated from scratch. That obviously isn’t good for -performance and will be fixed eventually. Meanwhile we need a kludge -that prevents the update from taking very long under certain -circumstances, e.g. when showing the difference for hundrets of changes -files. +A.1.3 How to show diffs for gpg-encrypted files? +------------------------------------------------ - For that reason the variable ‘magit-diff-expansion-threshold’ was -added, defaulting to one second. If it takes longer than that to -recreate a Magit buffer, then no further diff sections are expanded -because that’s one of the steps that take the longest. If a diff is not -expanded, then some work can be delayed until it actually is. +Git supports showing diffs for encrypted files, but has to be told to do +so. Since Magit just uses Git to get the diffs, configuring Git also +affects the diffs displayed inside Magit. - You can then still expand sections manually, but when you refresh the -complete buffer explicitly using ‘g’ or by performing an action which -triggers a refresh, then previously expanded diffs could be collapsed. -You can set ‘magit-diff-expansion-threshold’ to a higher value to -prevent that from happening. + git config --global diff.gpg.textconv "gpg --no-tty --decrypt" + echo "*.gpg filter=gpg diff=gpg" > .gitattributes  -File: magit.info, Node: I don't understand how branching and pushing work, Next: I don't like the key binding in v24, Prev: Diffs are collapsed after un-/staging, Up: FAQ +File: magit.info, Node: How does branching and pushing work?, Next: Can Magit be used as ‘ediff-version-control-package’?, Prev: How to show diffs for gpg-encrypted files?, Up: FAQ - How to …? -A.5 I don’t understand how branching and pushing work -===================================================== +A.1.4 How does branching and pushing work? +------------------------------------------ -Please see *note Branching: Branching. and +Please see *note Branching:: and  -File: magit.info, Node: I don't like the key binding in v24, Next: I cannot install the pre-requisites for Magit v2, Prev: I don't understand how branching and pushing work, Up: FAQ - -A.6 I don’t like the key binding in v2.4 -======================================== +File: magit.info, Node: Can Magit be used as ‘ediff-version-control-package’?, Prev: How does branching and pushing work?, Up: FAQ - How to …? -Please see . +A.1.5 Can Magit be used as ‘ediff-version-control-package’? +----------------------------------------------------------- - -File: magit.info, Node: I cannot install the pre-requisites for Magit v2, Next: I am using an Emacs release older than v244, Prev: I don't like the key binding in v24, Up: FAQ +No, it cannot. For that to work the functions ‘ediff-magit-internal’ +and ‘ediff-magit-merge-internal’ would have to be implemented, and they +are not. These two functions are only used by the three commands +‘ediff-revision’, ‘ediff-merge-revisions-with-ancestor’, and +‘ediff-merge-revisions’. -A.7 I cannot install the pre-requisites for Magit v2 -==================================================== + These commands only delegate the task of populating buffers with +certain revisions to the "internal" functions. The equally important +task of determining which revisions are to be compared/merged is not +delegated. Instead this is done without any support whatsoever, from +the version control package/system - meaning that the user has to enter +the revisions explicitly. Instead of implementing +‘ediff-magit-internal’ we provide ‘magit-ediff-compare’, which handles +both tasks like it is 2005. -An Elpa archive featuring obsolete Magit v1.4.2 and its dependencies is -available from . But note that v1.4.2 is -obsolete and no longer maintained. + The other commands ‘ediff-merge-revisions’ and +‘ediff-merge-revisions-with-ancestor’ are normally not what you want +when using a modern version control system like Git. Instead of letting +the user resolve only those conflicts which Git could not resolve on its +own, they throw away all work done by Git and then expect the user to +manually merge all conflicts, including those that had already been +resolved. That made sense back in the days when version control systems +couldn’t merge (or so I have been told), but not anymore. Once in a +blue moon you might actually want to see all conflicts, in which case +you *can* use these commands, which then use ‘ediff-vc-merge-internal’. +So we don’t actually have to implement ‘ediff-magit-merge-internal’. +Instead we provide the more useful command ‘magit-ediff-resolve’ which +only shows yet-to-be resolved conflicts.  -File: magit.info, Node: I am using an Emacs release older than v244, Next: I am using a Git release older than v194, Prev: I cannot install the pre-requisites for Magit v2, Up: FAQ - -A.8 I am using an Emacs release older than v24.4 -================================================ +File: magit.info, Node: FAQ - Issues and Errors, Prev: FAQ - How to …?, Up: FAQ -At least Emacs v24.4 is required. There is no way around it, if you -want to use Magit v2. +A.2 FAQ - Issues and Errors +=========================== - If you own the machine you work on, then consider updating to the -latest release provided by your distribution. If it doesn’t feature a -recent enough release, then you will have to use a backport package or -build Emacs from source. +* Menu: - Installing Emacs from source is quite simple. See the instructions -at and - to get an -idea of that this involves. But when you perform the installation then -use the instructions for the release you are actually installing. +* Magit is slow:: +* I changed several thousand files at once and now Magit is unusable:: +* I am having problems committing:: +* I am using MS Windows and cannot push with Magit:: +* I am using OS X and SOMETHING works in shell, but not in Magit: I am using OS X and SOMETHING works in shell but not in Magit. +* Diffs contain control sequences:: +* Expanding a file to show the diff causes it to disappear:: +* Point is wrong in the ‘COMMIT_EDITMSG’ buffer:: +* The mode-line information isn't always up-to-date:: +* Emacs 24.5 hangs when loading Magit: Emacs 245 hangs when loading Magit. - Unfortunately these instructions do not cover the hardest part (which -is the hardest part exactly because it is not covered there): installing -the build time dependencies. + +File: magit.info, Node: Magit is slow, Next: I changed several thousand files at once and now Magit is unusable, Up: FAQ - Issues and Errors - For that you’ll need to perform a web search and find an appropriate -tutorial for your distribution. If you think you should not have had to -do that yourself, then consider informing me about the resources that -helped you figure what to do for your specific setup, so that I can post -a link here. That way those coming after you have it easier. +A.2.1 Magit is slow +------------------- - An Elpa archive featuring obsolete Magit v1.4.2 and its dependencies -is available from . +See *note Performance::.  -File: magit.info, Node: I am using a Git release older than v194, Next: I am using MS Windows and cannot push with Magit, Prev: I am using an Emacs release older than v244, Up: FAQ +File: magit.info, Node: I changed several thousand files at once and now Magit is unusable, Next: I am having problems committing, Prev: Magit is slow, Up: FAQ - Issues and Errors -A.9 I am using a Git release older than v1.9.4 -============================================== +A.2.2 I changed several thousand files at once and now Magit is unusable +------------------------------------------------------------------------ + +Magit is *currently* not expected to work under such conditions. It +sure would be nice if it did, and v2.5 will hopefully be a big step into +that direction. But it might take until v3.1 to accomplish fully +satisfactory performance, because that requires some heavy refactoring. -At least Git v1.9.4 is required. There is no way around it, if you want -to use Magit v2. + But for now we recommend you use the command line to complete this +one commit. Also see *note Performance::. - If you own the machine, then consider updating to the latest release -provided by your distribution. If it doesn’t feature a recent enough -release, then you will have to use a backport package or build Git from -source. + +File: magit.info, Node: I am having problems committing, Next: I am using MS Windows and cannot push with Magit, Prev: I changed several thousand files at once and now Magit is unusable, Up: FAQ - Issues and Errors - Installing Git from source is quite simple. See the instructions at - to get an idea of that -this involves. But when you perform the installation then use the -instructions for the release you are actually installing. +A.2.3 I am having problems committing +------------------------------------- - An Elpa archive featuring obsolete Magit v1.4.2 and its dependencies -is available from . +That likely means that Magit is having problems finding an appropriate +emacsclient executable. See *note (with-editor)Configuring +With-Editor:: and *note (with-editor)Debugging::.  -File: magit.info, Node: I am using MS Windows and cannot push with Magit, Next: I am using OS X and SOMETHING works in shell but not in Magit, Prev: I am using a Git release older than v194, Up: FAQ +File: magit.info, Node: I am using MS Windows and cannot push with Magit, Next: I am using OS X and SOMETHING works in shell but not in Magit, Prev: I am having problems committing, Up: FAQ - Issues and Errors -A.10 I am using MS Windows and cannot push with Magit -===================================================== +A.2.4 I am using MS Windows and cannot push with Magit +------------------------------------------------------ It’s almost certain that Magit is only incidental to this issue. It is much more likely that this is a configuration issue, even if you can @@ -7268,10 +7669,10 @@ push on the command line. .  -File: magit.info, Node: I am using OS X and SOMETHING works in shell but not in Magit, Next: How to install the gitman info manual?, Prev: I am using MS Windows and cannot push with Magit, Up: FAQ +File: magit.info, Node: I am using OS X and SOMETHING works in shell but not in Magit, Next: Diffs contain control sequences, Prev: I am using MS Windows and cannot push with Magit, Up: FAQ - Issues and Errors -A.11 I am using OS X and SOMETHING works in shell, but not in Magit -=================================================================== +A.2.5 I am using OS X and SOMETHING works in shell, but not in Magit +-------------------------------------------------------------------- This usually occurs because Emacs doesn’t have the same environment variables as your shell. Try installing and configuring @@ -7283,82 +7684,10 @@ you are using on the shell. tag signing", then you’ll also need to synchronize ‘$GPG_AGENT_INFO’.  -File: magit.info, Node: How to install the gitman info manual?, Next: How can I show Git's output?, Prev: I am using OS X and SOMETHING works in shell but not in Magit, Up: FAQ +File: magit.info, Node: Diffs contain control sequences, Next: Expanding a file to show the diff causes it to disappear, Prev: I am using OS X and SOMETHING works in shell but not in Magit, Up: FAQ - Issues and Errors -A.12 How to install the gitman info manual? -=========================================== - -Git’s manpages can be exported as an info manual called ‘gitman’. -Magit’s own info manual links to nodes in that manual instead of the -actual manpages because texinfo sadly doesn’t support linking to -manpages. - - Unfortunately many distributions do not install the ‘gitman’ manual -by default. Some distributions may provide a separate package -containing the info manual. Please let me know the name of that package -for your distribution, so that I can mention here. - - If the distribution you are using does not offer a package that -contains the ‘gitman’ manual, then you have to install it manually. -Clone Git’s own Git repository, checkout the tag corresponding to the -Git release you have installed, and follow the instructions in -‘INSTALL’. The relevant make targets are ‘info’ and ‘install-info’. - - Alternatively you may add this advice to your ‘init.el’ file. - - (defadvice Info-follow-nearest-node (around gitman activate) - "When encountering a cross reference to the `gitman' info - manual, then instead of following that cross reference show - the actual manpage using the function `man'." - (let ((node (Info-get-token - (point) "\\*note[ \n\t]+" - "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?"))) - (if (and node (string-match "^(gitman)\\(.+\\)" node)) - (progn (require 'man) - (man (match-string 1 node))) - ad-do-it))) - - Or if you are using MS Windows and ‘man’ is not available, use this -variation with used the Emacs Lisp implementation provided by the -‘woman’ package. - - (defadvice Info-follow-nearest-node (around gitman activate) - "When encountering a cross reference to the `gitman' info - manual, then instead of following that cross reference show - the actual manpage using the function `woman'." - (let ((node (Info-get-token - (point) "\\*note[ \n\t]+" - "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?"))) - (if (and node (string-match "^(gitman)\\(.+\\)" node)) - (progn (require 'woman) - (woman (match-string 1 node))) - ad-do-it))) - - Did I mention that texinfo cross reference are just awful? (This is -just one of many issues.) - - -File: magit.info, Node: How can I show Git's output?, Next: Diffs contain control sequences, Prev: How to install the gitman info manual?, Up: FAQ - -A.13 How can I show Git’s output? -================================= - -To show the output of recently run git commands, press ‘$’ (or, if that -isn’t available, ‘M-x magit-process-buffer’). This will show a buffer -containing a section per git invocation; as always press ‘TAB’ to expand -or collapse them. - - By default git’s output is only inserted into the process buffer if -it is run for side-effects. When the output is consumed in some way -then also inserting it into the process buffer would be to expensive. -For debugging purposes it’s possible to do so anyway by setting -‘magit-git-debug’ to ‘t’. - - -File: magit.info, Node: Diffs contain control sequences, Next: Expanding a file to show the diff causes it to disappear, Prev: How can I show Git's output?, Up: FAQ - -A.14 Diffs contain control sequences -==================================== +A.2.6 Diffs contain control sequences +------------------------------------- This happens when you configure Git to always color diffs and/or all of its output. The valid values for relevant Git variables ‘color.ui’ and @@ -7373,24 +7702,24 @@ then you can override these settings just for Magit by using: (setq magit-git-global-arguments (nconc magit-git-global-arguments - '("-c" "color.ui=false" - "-c" "color.diff=false"))) + '("-c" "color.ui=false" + "-c" "color.diff=false")))  -File: magit.info, Node: Expanding a file to show the diff causes it to disappear, Next: Point is wrong in the ‘COMMIT_EDITMSG’ buffer, Prev: Diffs contain control sequences, Up: FAQ +File: magit.info, Node: Expanding a file to show the diff causes it to disappear, Next: Point is wrong in the ‘COMMIT_EDITMSG’ buffer, Prev: Diffs contain control sequences, Up: FAQ - Issues and Errors -A.15 Expanding a file to show the diff causes it to disappear -============================================================= +A.2.7 Expanding a file to show the diff causes it to disappear +-------------------------------------------------------------- This is probably caused by a change of a ‘diff.*’ Git variable. You probably set that variable for a reason, and should therefore only undo that setting in Magit by customizing ‘magit-git-global-arguments’.  -File: magit.info, Node: Point is wrong in the ‘COMMIT_EDITMSG’ buffer, Next: The mode-line information isn't always up-to-date, Prev: Expanding a file to show the diff causes it to disappear, Up: FAQ +File: magit.info, Node: Point is wrong in the ‘COMMIT_EDITMSG’ buffer, Next: The mode-line information isn't always up-to-date, Prev: Expanding a file to show the diff causes it to disappear, Up: FAQ - Issues and Errors -A.16 Point is wrong in the ‘COMMIT_EDITMSG’ buffer -================================================== +A.2.8 Point is wrong in the ‘COMMIT_EDITMSG’ buffer +--------------------------------------------------- Neither Magit nor ‘git-commit‘ fiddle with point in the buffer used to write commit messages, so something else must be doing it. @@ -7411,10 +7740,10 @@ help: (pointback-mode -1))))  -File: magit.info, Node: The mode-line information isn't always up-to-date, Next: Can Magit be used as ‘ediff-version-control-package’?, Prev: Point is wrong in the ‘COMMIT_EDITMSG’ buffer, Up: FAQ +File: magit.info, Node: The mode-line information isn't always up-to-date, Next: Emacs 245 hangs when loading Magit, Prev: Point is wrong in the ‘COMMIT_EDITMSG’ buffer, Up: FAQ - Issues and Errors -A.17 The mode-line information isn’t always up-to-date -====================================================== +A.2.9 The mode-line information isn’t always up-to-date +------------------------------------------------------- Magit is not responsible for the version control information that is being displayed in the mode-line and looks something like ‘Git-master’. @@ -7437,58 +7766,10 @@ consider disabling VC when using Git: (setq vc-handled-backends nil)  -File: magit.info, Node: Can Magit be used as ‘ediff-version-control-package’?, Next: How to show diffs for gpg-encrypted files?, Prev: The mode-line information isn't always up-to-date, Up: FAQ - -A.18 Can Magit be used as ‘ediff-version-control-package’? -========================================================== - -No, it cannot. For that to work the functions ‘ediff-magit-internal’ -and ‘ediff-magit-merge-internal’ would have to be implemented, and they -are not. These two functions are only used by the three commands -‘ediff-revision’, ‘ediff-merge-revisions-with-ancestor’, and -‘ediff-merge-revisions’. +File: magit.info, Node: Emacs 245 hangs when loading Magit, Prev: The mode-line information isn't always up-to-date, Up: FAQ - Issues and Errors - These commands only delegate the task of populating buffers with -certain revisions to the "internal" functions. The equally important -task of determining which revisions are to be compared/merged is not -delegated. Instead this is done without any support whatsoever, from -the version control package/system - meaning that the user has to enter -the revisions explicitly. Instead of implementing -‘ediff-magit-internal’ we provide ‘magit-ediff-compare’, which handles -both tasks like it is 2005. - - The other commands ‘ediff-merge-revisions’ and -‘ediff-merge-revisions-with-ancestor’ are normally not what you want -when using a modern version control system like Git. Instead of letting -the user resolve only those conflicts which Git could not resolve on its -own, they throw away all work done by Git and then expect the user to -manually merge all conflicts, including those that had already been -resolved. That made sense back in the days when version control systems -couldn’t merge (or so I have been told), but not anymore. Once in a -blue moon you might actually want to see all conflicts, in which case -you *can* use these commands, which then use ‘ediff-vc-merge-internal’. -So we don’t actually have to implement ‘ediff-magit-merge-internal’. -Instead we provide the more useful command ‘magit-ediff-resolve’ which -only shows yet-to-be resolved conflicts. - - -File: magit.info, Node: How to show diffs for gpg-encrypted files?, Next: Emacs 245 hangs when loading Magit, Prev: Can Magit be used as ‘ediff-version-control-package’?, Up: FAQ - -A.19 How to show diffs for gpg-encrypted files? -=============================================== - -Git supports showing diffs for encrypted files, but has to be told to do -so. Since Magit just uses Git to get the diffs, configuring Git also -affects the diffs displayed inside Magit. - - git config --global diff.gpg.textconv "gpg --no-tty --decrypt" - echo "*.gpg filter=gpg diff=gpg" > .gitattributes - - -File: magit.info, Node: Emacs 245 hangs when loading Magit, Next: Symbol's value as function is void ‘--some’, Prev: How to show diffs for gpg-encrypted files?, Up: FAQ - -A.20 Emacs 24.5 hangs when loading Magit -======================================== +A.2.10 Emacs 24.5 hangs when loading Magit +------------------------------------------ This is actually triggered by loading Tramp. See for details. You @@ -7497,423 +7778,48 @@ can work around the problem by setting Google’s ‘8.8.8.8’) may also be sufficient to work around the issue.  -File: magit.info, Node: Symbol's value as function is void ‘--some’, Next: Where is the branch manager, Prev: Emacs 245 hangs when loading Magit, Up: FAQ +File: magit.info, Node: Debugging Tools, Next: Keystroke Index, Prev: FAQ, Up: Top -A.21 Symbol’s value as function is void ‘--some’ -================================================ +B Debugging Tools +***************** -Update ‘dash’, restart Emacs, and then it will be defined. +Magit and its dependencies provide a few debugging tools, and we +appreciate it very much if you use those tools before reporting an +issue. Please include all relevant output when reporting an issue. - -File: magit.info, Node: Where is the branch manager, Prev: Symbol's value as function is void ‘--some’, Up: FAQ +‘M-x magit-version’ (‘magit-version’) -A.22 Where is the branch manager -================================ + This command shows the currently used versions of Magit, Git, and + Emacs in the echo area. Non-interactively this just returns the + Magit version. -‘y’ is bound to the command that shows the "refs buffer", the successor -of the "branch manager". +‘M-x magit-emacs-Q-command’ (‘magit-emacs-Q-command’) - -File: magit.info, Node: Keystroke Index, Next: Command Index, Prev: FAQ, Up: Top + This command shows a debugging shell command in the echo area and + adds it to the kill ring. Paste that command into a shell an run + it. -Appendix B Keystroke Index -************************** + This shell command starts ‘emacs’ with only ‘magit’ and its + dependencies loaded. Neither your configuration nor other + installed packages are loaded. This makes it easier to determine + whether some issue lays with Magit or something else. -[index] -* Menu: +‘M-x magit-debug-git-executable’ (‘magit-debug-git-executable’) + + This command displays a buffer containing information about the + available and used ‘git’ executable(s), and can be useful when + investigating ‘exec-path’ issues. + + Also see *note Git Executable::. + +‘M-x with-editor-debug’ (‘with-editor-debug’) + + This command displays a buffer containing information about the + available and used ‘git’ executable(s), and can be useful when + investigating why Magit (or rather ‘with-editor’) cannot find an + appropriate ‘emacsclient’ executable. + + Also see *note (with-editor)Debugging::. -* !: Running Git manually. - (line 12) -* ! !: Running Git manually. - (line 19) -* ! a: Running Git manually. - (line 51) -* ! b: Running Git manually. - (line 55) -* ! g: Running Git manually. - (line 59) -* ! k: Running Git manually. - (line 47) -* ! p: Running Git manually. - (line 24) -* ! s: Running Git manually. - (line 33) -* ! S: Running Git manually. - (line 38) -* $: Viewing Git output. (line 11) -* +: Log Buffer. (line 59) -* + <1>: Refreshing diffs. (line 58) -* -: Refreshing diffs. (line 54) -* 0: Refreshing diffs. (line 62) -* 1: Section visibility. (line 26) -* 2: Section visibility. (line 26) -* 3: Section visibility. (line 26) -* 4: Section visibility. (line 26) -* =: Log Buffer. (line 53) -* = <1>: Log Buffer. (line 63) -* ^: Section movement. (line 31) -* a: Applying. (line 33) -* A: Cherry picking. (line 8) -* A A: Cherry picking. (line 16) -* A a: Cherry picking. (line 22) -* A A <1>: Cherry picking. (line 35) -* A a <1>: Cherry picking. (line 43) -* A s: Cherry picking. (line 39) -* B: Bisecting. (line 8) -* b: The branch popup. (line 12) -* B B: Bisecting. (line 16) -* B b: Bisecting. (line 31) -* b b: The branch popup. (line 29) -* b c: The branch popup. (line 47) -* B g: Bisecting. (line 36) -* B k: Bisecting. (line 41) -* b k: The branch popup. (line 99) -* b n: The branch popup. (line 37) -* B r: Bisecting. (line 47) -* b r: The branch popup. (line 105) -* B s: Bisecting. (line 24) -* b s: The branch popup. (line 54) -* b x: The branch popup. (line 82) -* c: Initiating a commit. (line 8) -* c <1>: Editing rebase sequences. - (line 72) -* c a: Initiating a commit. (line 18) -* c A: Initiating a commit. (line 66) -* c c: Initiating a commit. (line 13) -* c e: Initiating a commit. (line 22) -* c f: Initiating a commit. (line 42) -* c F: Initiating a commit. (line 50) -* c s: Initiating a commit. (line 54) -* c S: Initiating a commit. (line 62) -* c w: Initiating a commit. (line 32) -* C-: Diff buffer. (line 36) -* C-: Section visibility. (line 13) -* C-c C-a: Editing commit messages. - (line 128) -* C-c C-b: Log Buffer. (line 19) -* C-c C-b <1>: Refreshing diffs. (line 80) -* C-c C-c: Popup buffers and prefix commands. - (line 20) -* C-c C-c <1>: Select from log. (line 14) -* C-c C-c <2>: Editing commit messages. - (line 19) -* C-c C-c <3>: Editing rebase sequences. - (line 6) -* C-c C-d: Refreshing diffs. (line 70) -* C-c C-d <1>: Editing commit messages. - (line 57) -* C-c C-f: Log Buffer. (line 23) -* C-c C-f <1>: Refreshing diffs. (line 84) -* C-c C-i: Editing commit messages. - (line 153) -* C-c C-k: Select from log. (line 20) -* C-c C-k <1>: Editing commit messages. - (line 24) -* C-c C-k <2>: Editing rebase sequences. - (line 11) -* C-c C-n: Log Buffer. (line 27) -* C-c C-o: Editing commit messages. - (line 144) -* C-c C-p: Editing commit messages. - (line 148) -* C-c C-r: Editing commit messages. - (line 132) -* C-c C-s: Editing commit messages. - (line 136) -* C-c C-t: Editing commit messages. - (line 140) -* C-c C-w: Editing commit messages. - (line 63) -* C-c M-g: Minor mode for buffers visiting files. - (line 19) -* C-c M-g b: Minor mode for buffers visiting files. - (line 76) -* C-c M-g c: Minor mode for buffers visiting files. - (line 33) -* C-c M-g D: Minor mode for buffers visiting files. - (line 39) -* C-c M-g d: Minor mode for buffers visiting files. - (line 47) -* C-c M-g L: Minor mode for buffers visiting files. - (line 58) -* C-c M-g l: Minor mode for buffers visiting files. - (line 65) -* C-c M-g p: Minor mode for buffers visiting files. - (line 82) -* C-c M-g s: Minor mode for buffers visiting files. - (line 24) -* C-c M-g u: Minor mode for buffers visiting files. - (line 28) -* C-s M-s: Editing commit messages. - (line 35) -* C-w: Common commands. (line 21) -* C-x g: Status buffer. (line 22) -* C-x u: Editing rebase sequences. - (line 89) -* d: Diffing. (line 20) -* D: Refreshing diffs. (line 11) -* d c: Diffing. (line 67) -* d d: Diffing. (line 25) -* D f: Refreshing diffs. (line 45) -* D g: Refreshing diffs. (line 16) -* d p: Diffing. (line 59) -* d r: Diffing. (line 29) -* D r: Refreshing diffs. (line 40) -* d s: Diffing. (line 49) -* D s: Refreshing diffs. (line 21) -* d t: Diffing. (line 72) -* D t: Refreshing diffs. (line 36) -* d u: Diffing. (line 55) -* d w: Diffing. (line 43) -* D w: Refreshing diffs. (line 28) -* DEL: Log Buffer. (line 43) -* DEL <1>: Diff buffer. (line 63) -* DEL <2>: Blaming. (line 44) -* DEL <3>: Editing rebase sequences. - (line 28) -* e: Ediffing. (line 9) -* E: Ediffing. (line 21) -* e <1>: Editing rebase sequences. - (line 55) -* E c: Ediffing. (line 65) -* E i: Ediffing. (line 57) -* E m: Ediffing. (line 35) -* E r: Ediffing. (line 26) -* E s: Ediffing. (line 48) -* E u: Ediffing. (line 53) -* E w: Ediffing. (line 61) -* E z: Ediffing. (line 69) -* f: Editing rebase sequences. - (line 63) -* f <1>: Fetching. (line 11) -* F: Pulling. (line 11) -* f a: Fetching. (line 38) -* f e: Fetching. (line 24) -* F e: Pulling. (line 24) -* f m: Fetching. (line 42) -* f o: Fetching. (line 28) -* f p: Fetching. (line 16) -* F p: Pulling. (line 16) -* f r: Fetching. (line 33) -* f u: Fetching. (line 20) -* F u: Pulling. (line 20) -* g: Automatic Refreshing of Magit Buffers. - (line 22) -* G: Automatic Refreshing of Magit Buffers. - (line 31) -* j: Diff buffer. (line 53) -* k: Viewing Git output. (line 19) -* k <1>: Applying. (line 40) -* k <2>: Editing rebase sequences. - (line 68) -* k <3>: Stashing. (line 92) -* l: Logging. (line 26) -* L: Refreshing logs. (line 11) -* L <1>: Log Buffer. (line 6) -* l a: Logging. (line 56) -* l b: Logging. (line 52) -* L g: Refreshing logs. (line 16) -* l h: Logging. (line 44) -* l H: Reflog. (line 19) -* l l: Logging. (line 31) -* l L: Logging. (line 48) -* l o: Logging. (line 37) -* l O: Reflog. (line 15) -* l r: Reflog. (line 11) -* L s: Refreshing logs. (line 21) -* L t: Refreshing logs. (line 36) -* L w: Refreshing logs. (line 28) -* m: Merging. (line 9) -* M: Remotes. (line 8) -* m a: Merging. (line 57) -* M a: Remotes. (line 13) -* m e: Merging. (line 30) -* M k: Remotes. (line 28) -* m m: Merging. (line 17) -* m m <1>: Merging. (line 52) -* m n: Merging. (line 37) -* m p: Merging. (line 44) -* M r: Remotes. (line 18) -* M u: Remotes. (line 23) -* M-1: Section visibility. (line 34) -* M-2: Section visibility. (line 34) -* M-3: Section visibility. (line 34) -* M-4: Section visibility. (line 34) -* M-: Section visibility. (line 17) -* M-n: Section movement. (line 26) -* M-n <1>: Editing commit messages. - (line 45) -* M-n <2>: Editing rebase sequences. - (line 47) -* M-p: Section movement. (line 20) -* M-p <1>: Editing commit messages. - (line 39) -* M-p <2>: Editing rebase sequences. - (line 43) -* M-w: Blaming. (line 75) -* M-w <1>: Common commands. (line 10) -* M-x magit-blame: Blaming. (line 8) -* M-x magit-blame-popup: Blaming. (line 24) -* M-x magit-checkout-file: Resetting. (line 37) -* M-x magit-clone: Repository setup. (line 16) -* M-x magit-describe-section: Section types and values. - (line 13) -* M-x magit-describe-section <1>: Matching sections. (line 6) -* M-x magit-find-file: Visiting blobs. (line 6) -* M-x magit-find-file-other-window: Visiting blobs. (line 11) -* M-x magit-init: Repository setup. (line 6) -* M-x magit-log-buffer-file: Logging. (line 67) -* M-x magit-reset-hard: Resetting. (line 32) -* M-x magit-reset-head: Resetting. (line 21) -* M-x magit-reset-index: Staging and unstaging. - (line 88) -* M-x magit-reset-index <1>: Resetting. (line 14) -* M-x magit-reset-soft: Resetting. (line 26) -* M-x magit-reverse-in-index: Staging and unstaging. - (line 63) -* M-x magit-stage-file: Staging from file-visiting buffers. - (line 10) -* M-x magit-toggle-buffer-lock: Modes and Buffers. (line 17) -* M-x magit-unstage-file: Staging from file-visiting buffers. - (line 18) -* M-x magit-version: Git executable. (line 17) -* M-x magit-wip-commit: Wip modes. (line 129) -* n: Section movement. (line 16) -* n <1>: Blaming. (line 54) -* N: Blaming. (line 58) -* n <2>: Editing rebase sequences. - (line 39) -* n <3>: Minor mode for buffers visiting blobs. - (line 16) -* o: Submodule popup. (line 6) -* O: Subtree. (line 8) -* o a: Submodule popup. (line 11) -* O a: Subtree. (line 20) -* o b: Submodule popup. (line 17) -* O c: Subtree. (line 24) -* o f: Submodule popup. (line 35) -* O f: Subtree. (line 32) -* o i: Submodule popup. (line 22) -* o i <1>: Submodule popup. (line 39) -* O m: Subtree. (line 28) -* O p: Subtree. (line 36) -* o s: Submodule popup. (line 31) -* O s: Subtree. (line 41) -* o u: Submodule popup. (line 26) -* p: Section movement. (line 10) -* p <1>: Blaming. (line 62) -* P: Blaming. (line 66) -* p <2>: Editing rebase sequences. - (line 35) -* P <1>: Pushing. (line 11) -* p <3>: Minor mode for buffers visiting blobs. - (line 12) -* P e: Pushing. (line 35) -* P m: Pushing. (line 53) -* P o: Pushing. (line 39) -* P p: Pushing. (line 16) -* P r: Pushing. (line 44) -* P t: Pushing. (line 59) -* P T: Pushing. (line 65) -* P u: Pushing. (line 26) -* q: Quitting Windows. (line 6) -* q <1>: Log Buffer. (line 12) -* q <2>: Blaming. (line 70) -* q <3>: Minor mode for buffers visiting blobs. - (line 20) -* r: Rebasing. (line 9) -* r <1>: Editing rebase sequences. - (line 51) -* r a: Rebasing. (line 96) -* r e: Rebasing. (line 34) -* r e <1>: Rebasing. (line 92) -* r f: Rebasing. (line 66) -* r i: Rebasing. (line 62) -* r m: Rebasing. (line 70) -* r o: Rebasing. (line 40) -* r p: Rebasing. (line 25) -* r r: Rebasing. (line 81) -* r s: Rebasing. (line 88) -* r u: Rebasing. (line 30) -* r w: Rebasing. (line 74) -* RET: Diff buffer. (line 6) -* RET <1>: References buffer. (line 99) -* RET <2>: Blaming. (line 29) -* RET <3>: Editing rebase sequences. - (line 16) -* s: Staging and unstaging. - (line 29) -* S: Staging and unstaging. - (line 37) -* s <1>: Editing rebase sequences. - (line 59) -* S-: Section visibility. (line 22) -* SPC: Log Buffer. (line 33) -* SPC <1>: Diff buffer. (line 59) -* SPC <2>: Blaming. (line 34) -* SPC <3>: Editing rebase sequences. - (line 21) -* t: Blaming. (line 82) -* t <1>: Tagging. (line 8) -* T: Notes. (line 8) -* T a: Notes. (line 70) -* T c: Notes. (line 65) -* t k: Tagging. (line 18) -* T m: Notes. (line 56) -* t p: Tagging. (line 24) -* T p: Notes. (line 29) -* T r: Notes. (line 21) -* T s: Notes. (line 33) -* T S: Notes. (line 44) -* t t: Tagging. (line 13) -* T T: Notes. (line 13) -* TAB: Section visibility. (line 9) -* u: Staging and unstaging. - (line 44) -* U: Staging and unstaging. - (line 53) -* v: Applying. (line 44) -* V: Reverting. (line 6) -* V A: Reverting. (line 30) -* V a: Reverting. (line 38) -* V s: Reverting. (line 34) -* V V: Reverting. (line 14) -* V v: Reverting. (line 20) -* W: Creating and sending patches. - (line 6) -* w: Applying patches. (line 8) -* w a: Applying patches. (line 31) -* w m: Applying patches. (line 19) -* W p: Creating and sending patches. - (line 11) -* W r: Creating and sending patches. - (line 17) -* w s: Applying patches. (line 27) -* w w: Applying patches. (line 13) -* w w <1>: Applying patches. (line 23) -* x: Editing rebase sequences. - (line 76) -* x <1>: Resetting. (line 8) -* Y: Logging. (line 62) -* y: References buffer. (line 6) -* y <1>: Editing rebase sequences. - (line 85) -* y c: References buffer. (line 19) -* y o: References buffer. (line 24) -* y y: References buffer. (line 14) -* z: Stashing. (line 8) -* z a: Stashing. (line 58) -* z b: Stashing. (line 84) -* z f: Stashing. (line 88) -* z i: Stashing. (line 20) -* z I: Stashing. (line 46) -* z k: Stashing. (line 71) -* z l: Stashing. (line 76) -* z p: Stashing. (line 64) -* z v: Stashing. (line 80) -* z w: Stashing. (line 25) -* z W: Stashing. (line 51) -* z x: Stashing. (line 32) -* z z: Stashing. (line 13) -* z Z: Stashing. (line 39) + Please also see the *note FAQ::. diff --git a/elpa/magit-20171009.1252/magit.info-2 b/elpa/magit-20171009.1252/magit.info-2 new file mode 100644 index 0000000000000000000000000000000000000000..0f870e099c9057b35123bd35e5695a721f3cc91b GIT binary patch literal 87111 zcmdUYZF3wqw%+}COMl`bRr#>H*R5!%cV}}e5=GfcM2Sn%_ByGgs%NH$?A6TlxMx}v z_3Lw9fS!YH;4~aflU|lflqvGzg9G5;;Jo4Ty4)K0Z!L6h)na#(*98N;tpGpY!N9*WMG4~FD<-x=Wb zr+jB_tEM*927lC`T464m%sj3`1aj(1^-%nE*Pv_ZI&gB7)Ds< z>)kDkfiX@`&X0eDAA0rr-TQZ!zv5WlzPtQza&ckaempm?%-O5+%Xh~=y?=FX&VD*S z`*?Bk&|HALP;ek;Mu`Y}K{HktW?t;_a=Cr@;N6F}AG0^_&a;b?uCL4wAQf7Vgg_(a?|=B<!j0YbTG>eBI>B$Ml|gJex3&tNZ5hlzDu*XC6-|?XrG&|7uP7%?9|MxVY_tlko-7FSG?G6lB6c*?yG5UA&*U5hj zgPj+Py4YSLsW;_fu_ZVQ^y~!=EgJ^G1*tK5Mr$`a03(|8M`?_-p*<(9KS=|+C}wEy z!0c_yX}K(SxBFQ;BDH;V03g!4j}HJuv-acwK(vnjTN;oy{j9qFZyJyj_G$IGK%-bL z$j7url1@ltz))G|pBU;(OC}p>4K#%F*14iEp^n`_Nl1>bj5iQ8qX|wja+~T(N=ii&PBn!uwOSl8P zhWo_q+MHFJW+N9Q8;`F|5+{ujPycI^#7P6J%V#XaqDhNkHn*tgw?dt;UG$ z#cA5^R~VV6boNipmlPRkKraX=X2>==_)& z@L~*qXh3{4&dlOlfu7JAJ2P*;73e7`kXhR1(1ymFV`h?WLmJRCJG7f`9ol08I?n!D z7rUlj>sJxHdi3ryc4a@Nbp$}We5#|s>TuR$$W-Tbbezr1aW-gXx$TPnF>u127Taxp zb*SAsIigL*R0fZH&9t7-DQ$s<6p?lzdPyshfd*A0*+F)`w&=As;5J;KPmsNdhf-=s zlGM=XE{Y`>eC#d-k+Iot*H8!ONL@#xPQ8&c21m!^Bq}2v8pdud+!6Dk4X>@97h(bGCr`w&Ie5bvmx?oQ zP<0O8kw&H>_98^|^pA0=JQ3%>panT96~jJf+(D<=pzGnZTtgK16e6Vt!@2BP-;%?Z zE^QcAJ(N+iHvoXxke}u*i9K)E5fU3P0`HO-du#1fnm76qzf)qZ^^Fo6u%Pae82j9u z#NPjLB(}HCP-4qJ4zXwLDTl-c&bhms$`|$?O?qs|QE->U_I4Latoh?i<^FPgde29* z;TXzsHh31|p^cYkh%&Z!XgbK<1=bptUsBxY7rT7dKu($$A9g@?Iei(LG5qcBgdWLS zenIMUKy8u~;16^Wb)q?KIFGOQ0|$cx(ynT3zt4vbKZep6JtO;lK6EAw107Km?oFD{ zQXAS63zX!u)PUG$`6gu{8t`_<(+fD}H6K#8!!qK8hk07iLz^{@dA&&k(uT%%@O(&J z4-f4LZIL%=KpLYXQXq3PctJo;nv6Km@FopNW5j;ld5Rv=89k+y4QZeH5tJZo^7y<- z1JZ`ZC(xUd0mF+KX>I@xodeL2i^a`aN9ng3l5ax`Ui+T6bF~BVNjuA6rlQh$M*Hi;4EiqZlt+Qs z_&+hL6hUi@*sMB9)6*IdXK$UPsaFk%JyR!X%1i@d5A8{s4$^=)fA++D{Z?T=qs=ks zO2^3`eND3(Tcqu;x5aLTiH)HIFgEm(Y#{^H6;RmG!EreN475m#yK9UdlW%j87UkA} z_+Iul4M-ar11-|FtHy}KW?5fl^&KjpK(Dy>_?6IQQ-! zX~fXRj#+Db2n+`3SoCU6IqB}f038Eq3A22m0ia>)ar{GoG$n8uHb5aEWS3KRd*~2& zK|ljeNR|!dw_`z+hvNC#->B5l_Z?fd1BgMC=od@LG!r=OfX@6)a|!jS=^^j9|DXW##BXHO4^ojvcNCR1WsMNwboA3OmDRYK8dsXcq0^II1{EKrQFrzdLsWIZ~@o5^6#)uOgS7|o@ zjnQM;BByDI@){#PAfc>2Mcf*r3Hj9lDCG*M0X?NS$SN&$UjyRQ{Z-mkLIYyY+G*e0jRS^{?OAbsZ37Gyya8mG)pRzQ-SF0Kg}MetRoeORPAY&R3@ha(Q$No zfb3*i*{9iH+8C-H$0$@J$386pO4%adL81hgQPP|Z$DD}DupR2Cj1+8SL-sTq2<@YE z2jt62G27g~eA)7VF{Rk~W6Reni=-%w7GZd9x8_ZXe6^VQ#7@)~?uU_0A*>M%7HEvP z&gV4qfU*r11NQZh2E-nRw4wqqPmtu@dJ0Rq8nzNVK=~OcEoN3n)bAf$avcF|BE_3k4)a{w#Nr&Bp z`-z84hIzK2UM+T##3!s>A*K9!SxueI8DZ1{Wz`PKlr!iqFt6Me)PUI2uxC_4otr-% z!AM(*>}l8oK{tV7mr<{mJ|1{u&>*Lhk)PIE{=Wmc1z&VlAT+Xpu1*C|39uQH2$xXp zC4$2&VzcdtP?sM}GtKt1M)^AjOFQjo!yWi);I~cbmt@OoCf$vg3CkPPro!TCwo8yr z@cr-_n#afh?{0W>3){1@9liQX5SO*45xc{4t-*rbG&GIaJ$`P=4JnS`KKrHIQ2Mdk z?zH(>;1kYD!J%QttE>Q%t*SFp`TgN(j5utXWMJwh5UaB!15?i?;IhRJ{bA7fJAY^= zD|;7#(XgF4x__FjGT@TppFSPPJm)juFg3zFZAno$nEz%9edwBHA-Wzo6~H<_$=^jl zJLo-U?G8Jq?l_}eTcx=?G)8=!eM|<5GUBLLmFA{a8PRd{F)jT9fZ~kk&ReBr0BVeQ z`+rOZiZbHbmntnGL}SE}JOJ`6vd*@5|EmGnn` zzTA(=K+##_t`}9BTS#NX4u-(h$IX=dta&Q&FONTxZ{YjBw9_r0ewf#|T}` z&Qi7prl|CzoK9P_ZiGSo;m#xS!Jei0skITZW;;vU{u&Sm-p|rvLK+Y&q_Z?Vq5<)l zeU|1G)_~Z(e3ll<(SSJH`pjIWY&Q*v^9s+>6p{wS3hB2LKF0j5DR*?c{)Mi}Y;Zes zgzo#lrENKgarN>y+AT*b8-P;GQO&M>PPaAy`lIb#wvz^naQP@8mu@!@=VVUN(>hJ& zBl|F)(pg)lS&_=1CXdJiRi|k-1;}vZ1b|ZHqXE6NVou8A)PSDbp(SMlYe1Y=3f-<# z_N@l=oGk4+P1kBb?4GUDbgc%&iA8mq&87kIF#g_W5mvgIyI0#&9RTQ zclWdV{srx|^OK}wL`#Y8e$*b?;Jy3>`@Gcv>aLCXf7qKzw1{rCnGxVRJg%W!i;RV`PC|C3X9Cj;~NBLe4!L zXqn)2$(Uy$*O&g3a%hZuD04aL%@`tO4<{13)R(q6WkrEtC3ZkACyvW@BGchJ@+&kW&=X)3n3> zo)*>AfH;x+?`c&$8W6W^`FmP;R0HCZjqhfZovI0| z7unZxn+62+ATg(nVNHFTwvI;jwY(rF+ilv-M;jFDXn4OaMLrr3-!pDalAtvpUO`E{ z1jtbAMb^pXN&U(>7)4Ty_3znUb|Qv>3I=xf?BtpTyx|7wz~SPh7y zP+!v?y3l|)Pv>h|3lI&6Es(F~e|_tM#CV4GN~P_6*SuNz|n}06u zX@ba%l~l^Bb+rg*4vZ`na>7X}@GNn$4KJ2)sc>qTpaS*a(Lm6+RJa)nQmN@NscZ`B zHg*a)DiqW|{JT?}dMCIPP@WLpK%@HRR?W_@%0Pcf(4iDb#)V~=^A;CIIpM61?s|}?6!g(q-WfiEE1K%Ny9|9HO2@+sKvJpgy%)1na^(b@yybIm}jT+YjWTCoPi-qH@xhU0-f zW-1Wry%uOzts&;nM6T5u5C>XXph%|xDsl$r1jIl@o71-p0E)J&e6?nb{*8! z8W6V&5sWhOvdpfVb>C*ufVdVp43uq|Av&yRIjBGsk(5C3^{C3on|_iJ0fl2-LxseL ze8P$^H{J-*b5b?itS@&>RP4iy1Nm|fA=$7J7w$=*-=NMXxO4S&$=Qn%$Tmv2E^tD5p$Asy7uz8?G;C+*OY)VNVSJOQ_Mb9O=r1kK;8+%Ky!Hhb{Di&6d?P8y&PHw zcZe_{qW~RoEpG>CbDal|Jq_p)c^^HXxcXFp%%nGK+_EXOn&i-qtM#IUgfeXJbfDHW zoTT8535rl6-Kdl?O&&>Ghvz+Rq9{OyW7Qs`?FL#=1iic(kUTXb%ceDTq?B2__)k`Y zb0#x00-(CqOw{AS)Dj7lCgw73sf1LEfoJRoqu?(+2xnnHD*!Wt0wP!0lZdtMF=NSa+%MsXdh0eK6O zr=Ng=I(F#DKBO%nuc>x~amS%HLXOLMGVjZp7UjTB@f0Oqb!_J?G`_ZF<)4$sAWQuz zK*tDxY=^zxLa4Zs#(khU- zCQS!w^`_>5;qm=Ts5_WW8N@6ky9z2o>#-G$3i4l8h`+UBEF^WWG061LE?0!N~R( z4NB>aa>{WwhyX%63r+5xZDZAl=m>$^uf3Vd+dB8Jro#m_)s{Zz}(zk6t$N+ua8`4t)?ZXD19 zf-84G*=j&?ar4lK5dZ};3N#?@b<|@NR&5#(XCd~0P!07rod(3ugL*(Hp755_fcWK8 z3#9c&#|5t4*`#f>z^6OITzH?TFCbD?GBYBeEMG<+dDDRSNlppGPWvD+4M-YU%m~|k zXB%kRSkucw5>W%{$tWYBX0ru#n|Ce}8j#dS%t+b&8W5N7N*RIv+-|~oml}{XvdH=X zPiY`3!qb1Q6okqk3jrx38w|X?g#-FfXMoI8Y5Vrendh6AlVM3}c{8DK9QhUS#2dKqFq?!MZX0?IY&d?Bp(|(8dSp0iC&^L;iFVASoZr)v& zTkFbd0i3vpyjX{fV@svKEVo!bV4s+QD(x;aA*%QAy_^eXjZi5n0@}J}@jV!LrWAe} z_i5Ww8XaO5NXBTFm3RMf0@{Cu0MO%J|gpiwGBZl#%rJ zBTy6s2dDyxEk{87Vn_HMJG7h*d7ep!Ux!%#zIB(xq}k5IY8P(lu5$eq-OlpNW=#!o zd*9pJu1{?arE!Cd=2ZhPG})U!R2;apG6Dmjo(I8g80pePpzD0Oh`{JW8DI>+>; zzHsc|w4rg0`5uUBC_r`M<+dj(ZD=xPgG1BIHg&^DYa4;UAVq(Ccy!{h19JBH6{nrV zU0VQ!nW;d+uIT}F&peOLD9vAeFhMp(_B=0Ej z&J<+CK;i5=6{sU@%@3^)ts`vfh-5F@@7il39o$An<7*OUEfyb@VXYNBNgKIk^JdeY z2<5IRyw?b*yLMV-1b@+h?CYoG^(P=Lk6#6%Zb^a>Jx{dS29I(Lh)f3(o`8q2N}zV@)5)3!5SkOhrkvBU<$_1qrVNdr)L?hv6UwYJ0Kri2E&aEB@hiT zjHCf^L(Cpfcr|H2GVPX!#v%_c0S!p{{uoG^eho;bwpgILiS<~}fMjAD1EJ3+>>gET zO*&c`h;(GR-7NE4JmsYEtuc}dat{Omp#`7;NwY@xv%`YC1OI_M9%0%s98S44Sm)HM zU<9Wo-Aj%~iHk`4YExG;2&#vqi#rv4GzC1|$gYf!&2H1+b;}tc;yANF8Qv;`XeyA% z`q(rP0Oo`5$t^&m{>WN$f;@4JK=M$rHwON+4 za<{xSka*xPa}9`Jk`O@Pf1F|3Oi1b)kaV~ZBYpbgv(}w{QmWv~_Qz!BUt=USEHQ%E zN@!FBr2)y~%mD@2Ad&_oFOCd^ZH@2|d1F6`xzm7T<~X;Xhz<<>ZPVxj5c2S_eJtX| zqzaIIY=zg61A?wi;WSMJ$jAk0fiQh3Tmz~B@%tYhqaxZCLj&ShTY5nD#@`XV2E=cq zct9oA0q4+It7nR6Kr)h9bN3MtQ9u{rg4BTIDI$S-x@ZtcoNE>+zW+5w(%`p1oHHB} zw+6&dn|Q*Gmu+f5FGZ4{WdxqqNJ**&B#$Go^OkT?kNdK~lL6nrw|o>neFUr#3l#Sp zsX*SW5hHrRy0fPFm#aXYj1*4~LdiC5ZIUMRX*Ko-z70w zdCj^%%jYrY-#MKT)-T4h(HerX_`?EeI}Z<=Fp#`!Ss?t>Q%v;xHAd2{)dIx|tu!Eh zGQw?PWDcIKUDnhgyITX2ajv@f4Ia4%FI&v|zJn{0bRof#j8wPViPpmG{+yw3uHz|N z8W8u*bfPApxG!1*;vTgUDDnzDj_v|1GQ4t)@zfE&MBgJ4cGhVll1{N2Co9`li%9qZ z4qNyJywOU{?bNoXZShHS#RsV-*NJE=+^!KQE7$Pfyy*88A5+G%go%j6#DbH3uDtW$ zuNv&#nXRkPi9ZA+FQLpR94J5>m67yffXj)BX|9^cdwU~hAIQ6h<C{jhBrf zuXm0|^dudVhwv=7JYr$p5qZeeJ>(HTbH|+*869;sXs#1s&x~_LR;O^PV`%~@DW{!8 zgu4rrZObWoqS{NZ1|+wj1ER{d9vzU31HuHUX}K(Sx5DWrLO&i5XN350Dv($+KF}59 zb>+S_p#jNiR0kBzzHvZ7VT(9h2dF3ORz@Kp=?8K^*JY$bvSSnywk&3lK+uK&nn6Jn zS&CZ&k_ib82orYY&pUn94lT$?+$ki`?`9;kNj#uXHxX@UQU`iKOE}t=*~A;71{9h# zN@})1o?_L2r28ho=qR00V2cPwN9l}&Z4zMgIGvFwKnnq-Gm5Pv7WR{LM#6pzFnW^C zD6soEK<;tjU2*{_0Z^GtDWqKuDV-&bk&CqVwyg%lO*q+Dc0gWbR=Z<`&JO7#d9B^z zO=~?X!huKt(z-0jN)#U`V8LsqrOY31fnpv-jgbrj^nkjgR7T!OYh@JkO{t8$1u1~K zY;g8eMsm|$7Z6RtkZ&aEcSNH~ddRktM=0rcOdg&*;_XFIu4+BiGpSbheM&>~qj$uT z@oUn{;LK{RF`^;<08d@?sUGR^ZGmEbNDWA4Gw*>Sen=IlD{LHE%%0YO!{MmyQbx4icvI_6AJFPbHb{i3c+@o?)2Fs0|xW@2?$*NbF zH$A8hM50Stx|<0|>Fb34y(o}pmE-r>9P$D?$ta z^(x)>Yg+@7-hBXqw$hPdAshfj`%Zff5La#z3tY9eCbo?qadqA%kx80fQ&pdq-7LY-5Mj$FlvDyP!YP~X+Sb= zwcP{Vu0s!eXh7aIu?1>2^E}W!Qv>omDa{o79mJL+tZe=U8JcM~t*0UPK;amK3M9>0 z3lvT4Re_`f!~#WwmKu9uUmm4&EN{PA9FV zL!SM#^|fi!7Nndt+Ycfn9iDzTAV-T@OShLL;<*)>f&Ft#BCWsNPY}a^e7BdRH*Z)he*&*!HM<-N5bbdk*sT^QI5+}SJ9&sZ@n^htV;*g6 zQ7dkhi9GagpuJtN8pMt7mvUoB8OcMIhc=NuECho5wiq8{6d)thA1zSKgQWv;LT2c( z9ycEGS*teZLIVpFvZ@3QIShNng?9QmLm2vqT~k>RwgHD$=Y=1lbYSBaPw)ZMrxIL_ zjtb>J9{zzl&Iy-XsKse``DnX>t$Yat*SIob3%Nm!Q=GyM)IOE_kT2d4v?qakkN@(U zz(418i7KppDj529!CTNMFLYwPvo8hz1Q+|uYV+U$BsD<~XlU$pVtmBtlfZxZr+pLH zwJgC7D%eDa8~TFwTz`hl3pgLx${BTy9dXgCpaR898_2FIzZQNg4OA)PQsJ)og37(U ztvcbAtS2eioezkpBq(*rrH3vrO1``2yc=qvZ=G6<(J* zPq^J>9=W_raT?q|>)Rp6BR~1kKqFPik_Gd115N^P-hx3a+ik$9MgIV~7I=6O9rW6R zsy9^Y@F*-Vz48X?8PhUsY8r} z;{}3#3wRY24&T7A@bEpgWtT1`P7G}#-v}U}PH$oS`SwErGBPKAZcEnLsT5#!0j4Qc zg0>|&@H;{>@_@1h)K$!?WwTmms|xBYK0{hu0LsmpsL$~k5zwN>C*QUdk-!{~WwD4M zK4>NI|MeHkM`pAS@d=OYFg&DM@9>~k@Ssv19+%CEFSB9;t-^72jY>y26FPKub&fUs z)w<224a|1CaAdgVs#rtqBNX*mzb2LlwO!8_&6@JwzBeE873x9f*gTAUrBmYyOFB5q zF0c(?HECN)R&;CXoEGJ%np9Q_pcPkqq2`U@T;LzLO2y>nXMC`P+X}%^bD;A@YAock z0IzNn?z0S!k&MhmWXUm?WxViaWG>PLhFr8a;K!DW?1N8ScE!r`yh}YgvRq{LIdTEZ zC(!B75*nL}2;dk>*}n#HkAL;urq-}S=_R72HwJ>cP13_9o(D5 zZG|;v29KV*9PG|+fLIi!uSk2mwLWC_q6M-~LkD6J8jwuv^nu_7QRp1xangX~rt*Qn zui(S9nK{9sNyEwlkyQvTB=lBbUhe+pVj2BNU)+o8Fs4;tNbry(L^6C1ygx@}5}0n} zU=s~Hd`4vwm>pyi*5%qQHvk0b0QoZ5*;YjL_G`vobff`n*9$j$3+x1!61E4y$#X#c z%?UZK4RmbxHi0+Y5FvzbIP}7krI2n&%p`+)$NDq$_u5mk(>)FoS(epd(yTFur+{|x z-Ny$;Wh7q)QW@<#zl_SqJ7LyaEcmvoCPN89@yEQ|Tx(Q5^4=eikK=Pk(vi1+%ZA!T zSqHDLNUdCc97UPS!UN01^}w;!UHdJistMVGqXn8lB+TX$c-q1aDWq>EkAzpP1)|;{ zfhurK1IkX0K9Db8(p;koSylbfzZp<%kXc20#Bpb5+tFan#?&R2-hII|Tv@U||Q)?dqV&Yn8qT%cy^j`@)dq1{Ai!DhNC?IV6^i=<5V}Zue zKY?3t1E$Su+3;ay;VqVT5n$ziFrv-yv3R4cO ze@sc@HrkE^A2{u?<1*7-D5%}-GKfq-`0|1Ee0hoAD6Km3q+6J2Vg+8 z+U^x0AQ=q7{Yo3xhK`|yjsI?m_7alcq0I-vXRAF)sX#)FbQ!gWe($XAA|A$#CPN}R zm;G@+5)*L*hM2fR6_=-5n&U8$XQ;+xY>CKcrMf(N+5cTp&<3-rRF?Rm!xtZGw+?$q z6kU{84Ft$xtI`VA6qhVt16_{(6jq|4T{&(Z;d9{-#Lj3C6Y(}6joNg_U23l5$bXGW^KVDn6-XZOFwKg=_-ro&vg~@OJCSWKHNc!&_ zP&D9qVeOEhg)J^rEl{lV-vRyecC51%m;Jte+R#D`!fvkpu7Ga#)qE-GP=;$XoKwpA zFy^kGJQBtpGf|RYM`a>22!IK?61~frcgu6L6k5r$=Y0rh_?CAV+f`o2|45a7;>gXK zEqIZ$6+8(9pMBjks(o}cfpw?VT1ASg{DP_PjOkZZy@g~xS&;RORaI<2LM|3$@p2kL zD<)atfW{^!XhH}7wG1kDPw=>}C*|KUCkoUyE9r5F4Es`IY^BXMXA)lCU zUfqNII6q$U176T&dsi-QdlI|{eth4R{9xjyRoHmCdw%wT8;&tPM4A^^G?Ha*3%l^&gO%>hnQ^Qd4!dIrIAc%amkL0C7=xKudSE~tE3S2xhwep@t< z1j<3#ZIu$gv8wm96xLnLj^2G8R2V78YE$7fSx_gt#$WD2*e4Jsw zS{3sWVu?#(ncf3G8CI11LgKrRD~Aj+N`5Y@pjrz7-h=#}3J;6Tv!~r~Rp*L zzPI4ZNgmJ=%LK0~h=b0k$f2ug|T;5 zZJNztO8@L}X$M4CAa16|xeuSMgThLv#{mZE63eB3*A58YeuvKH-2tJL6d*70$^v2K z|6U-AvTkcFR3K5TY@H)ivl^VNPT49BY(F%S_#ob)Z>>FV-nFowbf#0H6`BGybf@zW z_;>Sj3y`hm?F<`;l&W~Ptf=PQt(=E=d3jST@@B~aA`#J~OE3XCAQ4}(wspS!gt^?{ zknB3z-a%7T(DUd$%BgD*6rj54m&s`ssQ9vj_Cb`)UqkF6+jk39fkY~p1+p)SVpYKJ z0D93M8b5Cf7YB&d)+;G=jgc(F2S&0TMSlq#kKUF-CUj8EkX_ptgo7q+m@~N_*=f0k zW)!Djhf`OI*WAaQUMHb>L>J(p>^j+lkceRj3~K$Lm>5;|44R|CbBFMHE;QWxp4+N@ zB*#O$#OocAtT&ksXL z45dmP0IH=6xs;-(fEUg}x6}F5b5D>R9ghSwSSwV~h!y+v+0^!xT z*KZccmyt{{>u)zTzAK9u{9H9~q;8@2>`X+^wLr0~Uj^g!?!qs;d< z1l$t(&BmRKgic~0N`33vL_BR8kZgX>Ktu+VHuxeaZh{NkJ};>PiO$}nL4ww@T}OAR zP2^b_Y(3$&Kdve5^p*=8FM3KVLIaAifNTP8?om3BpF^ z1!)5K4SQ|vMkvc#5Qy%D*b=V}l%!m6xwkl~0p0GeuFM^fwE|~w{Ot9$1+w9FYe6v3 zq|XRdeZk9-IY#1=Mngk|4+kw>BWzzecIm;gKpDkWflLdgmvVass9o9k zY5dhK%S)jLHw?+9lf(G|tuOrx5}Y1nDgrHVy_-`G!5_+Kln;w+umM%)p!SYN?Tq$- zATLwHQLP4@?4t(J<>{JT) zmN5Q|@TwQwTIzel0WBj46nxGhNmQs44M;k&>Z;Pa`e~`f zvclH(`E4c63QkPkUcX)BpYf_Uaw44EEzY7{*}}oz&a-UEPlWqiN3ohjT3u7+B6CwT83$N?T@20@{rZ% zmP!01f+1lKt>C3fZZZo5yPT}0zS`G-PMO)mBY8}f3*sM$N=`C*EO&{-yazv`HN*?y^!5ltVdzHGh07rY+ zNY>cc;^k@wR+%ezgO|JV)-U6fO)$q@#Lh5-b-OEPpKj4o5BQfTu<5L5YU>RzR4m{D z3cPzlm+wPeI;E!p)hC(>i)>n4!--JI;|urtxneHLmSvbZ&pv^Cvspr9ubcd&y^-@$ zsL~J+><Wxf&{zsOuA<(qIXadH9 z;Q5BGlmdL*xiyg|X&7ifE{)Md#+ML?wrDr_;?%sxh?AhPL)b$lP17Qc>MAhYOp@;g RzP0NHB0i5x1p}`S{vW%Kx-$R( literal 0 HcmV?d00001 diff --git a/elpa/magit-popup-20150701.1246/magit-popup-autoloads.el b/elpa/magit-popup-20150701.1246/magit-popup-autoloads.el deleted file mode 100644 index 439beb25..00000000 --- a/elpa/magit-popup-20150701.1246/magit-popup-autoloads.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; magit-popup-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil nil ("magit-popup-pkg.el" "magit-popup.el") -;;;;;; (21910 48885 479571 0)) - -;;;*** - -;; 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-20150701.1246/magit-popup-pkg.el b/elpa/magit-popup-20150701.1246/magit-popup-pkg.el deleted file mode 100644 index 7c2af7ff..00000000 --- a/elpa/magit-popup-20150701.1246/magit-popup-pkg.el +++ /dev/null @@ -1,8 +0,0 @@ -(define-package "magit-popup" "20150701.1246" "Define prefix-infix-suffix command combos" - '((emacs "24.4") - (dash "2.10.0")) - :url "https://github.com/magit/magit" :keywords - '("bindings")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-popup-20150701.1246/magit-popup.el b/elpa/magit-popup-20150701.1246/magit-popup.el deleted file mode 100644 index 7b523ed1..00000000 --- a/elpa/magit-popup-20150701.1246/magit-popup.el +++ /dev/null @@ -1,1055 +0,0 @@ -;;; magit-popup.el --- Define prefix-infix-suffix command combos - -;; Copyright (C) 2010-2015 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") (dash "2.10.0")) -;; Keywords: bindings -;; Homepage: https://github.com/magit/magit - -;; 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 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) - -(declare-function info 'info) -(declare-function Man-find-section 'man) -(declare-function Man-next-section 'man) - -;;; Settings -;;;; Custom Groups - -(defgroup magit-popup nil - "Infix arguments with a popup as feedback." - :group 'bindings) - -(defgroup magit-popup-faces nil - "Faces used by Magit-Popup." - :group 'magit-popup) - -;;;; Custom Options - -(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 t - "Initially show section with commands common to all popups. -This section can also be toggled temporarily using \ -\\\\[magit-popup-toggle-show-common-commands]." - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-use-prefix-argument 'disabled - "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. The *intended* default is `default', -but the *actual* default is `disabled'. This is necessary because -the old popup implementation did simply forward such a pre-popup -prefix argument to the action invoked from the popup, and changing -that without users being aware of it could lead to tears. - -`disabled' Bring up a Custom option buffer so that the user reads - this and then makes an informed choice. - -`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 "Use default action, else show popup" default) - (const :tag "Show popup, else use default action" popup) - (const :tag "Ignore prefix argument" nil) - (const :tag "Abort and show usage information" disabled))) - -;;;; 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 [?- t] 'magit-invoke-popup-switch) - (define-key map [?= t] 'magit-invoke-popup-option) - (define-key map [?\C-c ?\C-c] 'magit-popup-set-default-arguments) - (define-key map [?\C-x ?\C-s] 'magit-popup-save-default-arguments) - (define-key map [?\C-g] 'magit-popup-quit) - (define-key map [??] 'magit-popup-help) - (define-key map [?\C-h ?i] 'magit-popup-info) - (define-key map [?\C-t] 'magit-popup-toggle-show-common-commands) - (define-key map [?\d] 'backward-button) - (define-key map [?\C-p] 'backward-button) - (define-key map [?\t] 'forward-button) - (define-key map [?\C-n] 'forward-button) - (define-key map [?\r] 'push-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-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'.") - -(defun magit-popup-get (prop) - "While a popup is active, get the value of PROP." - (if (memq prop '(:switches :options :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 :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-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? (cdr filter) arg))) - (when (eq (car filter) :only) - (pop filter)) - (lambda (arg) (-contains? filter arg))) - magit-current-popup-args))) - -(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 (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)) - `(--map (if (or (null it) (stringp 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))))) - -(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-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 in which the -option is placed. If ommitted then the option is placed in some -group the same way it is done when directly using `defcustom'. - -Optional argument MODE specifies the mode used by the popup -buffer. If it is ommitted 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 may, assuming the first - member is also a string. Instead of just one action section - with the heading \"Actions\", multiple sections are then - inserted into the popup buffer, using these strings as - headings. - - 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'. - -`:max-action-columns' - The maximum number of actions to display on a single line. - This helps arranging actions more sensibly. If there is not - enough room to display that many actions on one line, then - this is ignored. - -`: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 defails. - -`: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. - -`: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\". - -`:man-page' - The name of the manpage to be displayed when the user requests - help for a switch or argument. - -When MODE is `magit-popup-sequence-mode', then the following -keywords are also meaningful: - -`:sequence-predicate' - When this function returns non-nil, then the popup uses - `:sequence-actions' instead of `:actions'. - -`:sequence-actions' - The actions which can be invoked from the popup, when - `:sequence-predicate' returns non-nil. - -\(fn NAME DOC [GROUP [MODE [OPTION]]] :KEYWORD VALUE...)" - ;; TODO document keywords - (declare (indent defun) (doc-string 2)) - (let* ((grp (unless (keywordp (car args)) (pop args))) - (mode (unless (keywordp (car args)) (pop args))) - (opt (symbol-name name)) - (opt (if (keywordp (car args)) - (intern (concat (if (string-suffix-p "-popup" opt) - (substring opt 0 -6) - opt) - "-arguments")) - (eval (pop args))))) - `(progn - (defun ,name (&optional arg) ,doc - (interactive "P") - (magit-invoke-popup ',name ,mode arg)) - (defvar ,name - (list :variable ',opt ,@args)) - ,@(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. - -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-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-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-switch', or - `magit-define-popup-option'." - (declare (indent defun)) - (if (memq type '(:switches :options :actions)) - (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 :test 'equal)) - (setq value (cl-delete key value :key 'car :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 :test 'equal))) - (unless (assoc key value) - (setq value (if prepend - (cons elt value) - (append value (list elt))))) - (set popup (plist-put plist type value))) - (error "Unknown popup event type: %s" type))) - -(defun magit-change-popup-key (popup type from to) - "In POPUP, bind TO to what FROM was bound to. -TYPE is one of `:action', `:switch', or `:option'. -Bind TO and unbind FROM, both are characters." - (--if-let (assoc from (plist-get (symbol-value popup) 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', `:switch', or `:option'. -KEY is the character which is to be unbound." - (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)) - (use-prefix (or local magit-popup-use-prefix-argument))) - (cond - ((and arg (eq magit-popup-use-prefix-argument 'disabled)) - (customize-option-other-window 'magit-popup-use-prefix-argument) - (error (concat "The meaning of prefix arguments has changed. " - "Please explicitly enable their use again."))) - ((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 '(disabled default popup nil)) - (magit-popup-mode-setup popup mode) - (when magit-popup-show-help-echo - (message (concat "Type C-h i to view popup manual, " - "? to describe an argument or action.")))) - (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)) - (--if-let (magit-popup-lookup event :actions) - (let ((magit-current-popup magit-this-popup) - (magit-current-popup-args (magit-popup-get-args)) - (command (magit-popup-event-fun it))) - (magit-popup-quit) - (call-interactively command) - (setq this-command command)) - (if (eq event ?q) - (magit-popup-quit) - (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 ((buf (current-buffer)) - (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") - (customize-set-variable (magit-popup-get :variable) - (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - -(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") - (customize-save-variable (magit-popup-get :variable) - (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - -;;; 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 - (magit-popup-manpage man (magit-popup-lookup int :switches))) - (`magit-invoke-popup-option - (magit-popup-manpage man (magit-popup-lookup int :options))) - (`magit-popup-help - (magit-popup-manpage man nil)) - (`self-insert-command - (setq def (magit-popup-lookup int :actions)) - (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))) - (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)) - (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") - (re-search-forward (format "^[\t\s]+\\(-., \\)*?%s[=\n]" arg) - (save-excursion - (Man-next-section 1) - (point)) - t)) - (goto-char (1+ (match-beginning 0))) - (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 nil) - (display-buffer-function 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." - (setq buffer-read-only t) - (setq-local scroll-margin 0) - (setq-local magit-popup-show-common-commands magit-popup-show-common-commands) - (add-hook 'magit-popup-setup-hook 'magit-popup-default-setup nil t) - (hack-dir-local-variables-non-file-buffer)) - -(put 'magit-popup-mode 'mode-class 'special) - -(defvar magit-popup-setup-hook nil "For internal use.") - -(defun magit-popup-default-setup (val def) - (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)))) - -(define-derived-mode magit-popup-sequence-mode magit-popup-mode "MagitPopup" - "Major mode for infix argument popups, which are affected by state. -Used for popups that display different actions depending on some -external state. Within Magit this is used for sequence commands -such as rebase. The function `:sequence-predicate', which takes -no arguments, is used to determine whether to use the actions -defined with regular `:actions' or those in `:sequence-actions'. -When a sequence is in progress the arguments are not available -in the popup." - (remove-hook 'magit-popup-setup-hook 'magit-popup-default-setup t) - (add-hook 'magit-popup-setup-hook - (lambda (val def) - (if (funcall (magit-popup-get :sequence-predicate)) - (magit-popup-put - :actions (magit-popup-convert-actions - val (magit-popup-get :sequence-actions))) - (magit-popup-default-setup val def))) - t t) - (hack-dir-local-variables-non-file-buffer)) - -(defun magit-popup-mode-setup (popup mode) - (let ((val (symbol-value (plist-get (symbol-value popup) :variable))) - (def (symbol-value popup))) - (magit-popup-mode-display-buffer (get-buffer-create - (format "*%s*" popup)) - (or mode 'magit-popup-mode)) - (setq magit-this-popup popup) - (run-hook-with-args 'magit-popup-setup-hook val def)) - (magit-refresh-popup-buffer) - (fit-window-to-buffer)) - -(defun magit-popup-mode-display-buffer (buffer mode) - (let ((winconf (current-window-configuration))) - (split-window-vertically) - (other-window 1) - (switch-to-buffer buffer) - (funcall mode) - (setq magit-popup-previous-winconf winconf))) - -(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 - (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) - (if event - (while (and (forward-button 1) - (let ((b (button-at (point)))) - (or (not (equal (button-get b 'prefix) prefix)) - (not (equal (button-get b 'event) event)))))) - (re-search-forward "^Actions" nil t) - (forward-button 1)))) - -;;; 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 (stringp (car spec)) - (--each (-partition-by-header 'stringp spec) - (magit-popup-insert-section type (cdr it) (car it))) - (magit-popup-insert-section type spec)))) - (unless heading - (setq heading (button-type-get type 'heading))) - (let* ((formatter (button-type-get type 'formatter)) - (items (mapcar (lambda (ev) - (and ev (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))) - (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 items - (insert (propertize heading 'face 'magit-popup-heading)) - (unless (string-match "\n$" heading) - (insert "\n")) - (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")))) - (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-action-button (type ev) - (list (format-spec - (button-type-get type 'format) - `((?k . ,(propertize (magit-popup-event-keydsc ev) - 'face 'magit-popup-key)) - (?d . ,(magit-popup-event-dsc ev)))) - '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))))) - -;;; magit-popup.el ends soon - -(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-20150701.1246/magit-popup.info b/elpa/magit-popup-20150701.1246/magit-popup.info deleted file mode 100644 index 0256d377..00000000 --- a/elpa/magit-popup-20150701.1246/magit-popup.info +++ /dev/null @@ -1,639 +0,0 @@ -This is magit-popup.info, produced by makeinfo version 5.2 from -magit-popup.texi. - -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. - - Copyright (C) 2015 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. - - Copyright (C) 2015 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 prefixes 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 disappears. 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 commands - - /- 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 -change to notice them. - - -- User Option: magit-popup-show-common-commands - - This option controls whether the section which lists the commands - that are common to all popups is initially show. We recommend you - set this to ‘nil’ - after you have memorized that it can be shown - on demand using ‘C-t’. - -‘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: 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. - - -- 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. - - 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-change-popup-key popup type from to - - In POPUP, bind TO to what FROM was bound to. TYPE is one of - ‘: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’, - ‘:switch’, or ‘:option’. KEY is the character which is to be - unbound. - - -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. The *intended* default is ‘default’, - but the *actual* default is ‘disabled’. This is necessary because - the old popup implementation did simply forward such a pre-popup - prefix argument to the suffix command invoked from the popup, and - changing that without users being aware of it could lead to tears. - - • ‘disabled’ - - Bring up a Custom option buffer so that the user reads this - and then makes an informed choice. - - • ‘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. - - -- User Option: magit-popup-manpage-package - - The Emacs package used to display man-pages, one of ‘man’ or - ‘woman’. - - -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. - - The optional argument GROUP specifies the Custom group in which the - option is placed. If omitted then the option is placed in some - group the same way it is done when directly using ‘defcustom’ and - omitting the group. - - 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. - - How the actions are split into rows and columns currently - depends on the available space and ‘:max-action-columns’. - - WARNING: This will likely be change to use a more explicit - format (((KEY DESC COMMAND)…)…) before the release. - - 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, assuming the first - member is also a string. Instead of just one action section - with the heading \"Actions\", multiple sections are then - inserted into the popup buffer, using these strings as - headings. - - 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’. - - • ‘: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. - - • ‘: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. - - • ‘: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\". - - • ‘:man-page’ - - The name of the manpage to be displayed when the user requests - help for an argument. - When MODE is ‘magit-popup-sequence-mode’, then the following - keywords are also meaningful: - - • ‘:sequence-predicate’ - - When this function returns non-nil, then the popup uses - ‘:sequence-actions’ instead of ‘:actions’. - - • ‘:sequence-actions’ - - The actions which can be invoked from the popup, when - ‘:sequence-predicate’ returns non-nil. - - -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: Top989 -Node: Introduction2158 -Node: Usage4735 -Node: Customizing existing popups9392 -Node: Other options13208 -Node: Defining prefix and suffix commands14481 -Node: Defining prefix commands16633 -Node: Defining suffix commands22640 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-popup-20160130.649/dir b/elpa/magit-popup-20160130.649/dir deleted file mode 100644 index c276dafb..00000000 --- a/elpa/magit-popup-20160130.649/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-20160130.649/magit-popup-autoloads.el b/elpa/magit-popup-20160130.649/magit-popup-autoloads.el deleted file mode 100644 index 1c2eb166..00000000 --- a/elpa/magit-popup-20160130.649/magit-popup-autoloads.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; magit-popup-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil nil ("magit-popup-pkg.el" "magit-popup.el") -;;;;;; (22206 285 159684 0)) - -;;;*** - -;; 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-20160130.649/magit-popup.el b/elpa/magit-popup-20160130.649/magit-popup.el deleted file mode 100644 index 6119f7ce..00000000 --- a/elpa/magit-popup-20160130.649/magit-popup.el +++ /dev/null @@ -1,1264 +0,0 @@ -;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- - -;; Copyright (C) 2010-2016 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 "20150909.2257") (dash "20151021.113")) -;; Keywords: bindings -;; Homepage: https://github.com/magit/magit - -;; 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 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) - -(and (require 'async-bytecomp nil t) - (memq '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 the `:variable' event type. -(declare-function magit-call-git 'magit-process) -(declare-function magit-git-string 'magit-git) -(declare-function magit-refresh 'magit-mode) -(declare-function magit-set 'magit-git) - -;; For branch actions. -(declare-function magit-branch-set-face 'magit-git) -(declare-function magit-local-branch-p 'magit-git) - -;;; Settings -;;;; Custom Groups - -(defgroup magit-popup nil - "Infix arguments with a popup as feedback." - :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 t - "Initially show section with commands common to all popups. -This section can also be toggled temporarily using \ -\\\\[magit-popup-toggle-show-common-commands]." - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-use-prefix-argument 'disabled - "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. The *intended* default is `default', -but the *actual* default is `disabled'. This is necessary because -the old popup implementation did simply forward such a pre-popup -prefix argument to the action invoked from the popup, and changing -that without users being aware of it could lead to tears. - -`disabled' Bring up a Custom option buffer so that the user reads - this and then makes an informed choice. - -`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) - (const :tag "Abort and show usage information" disabled))) - -;;;; 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 [?- t] 'magit-invoke-popup-switch) - (define-key map [?= t] 'magit-invoke-popup-option) - (define-key map [?\C-c ?\C-c] 'magit-popup-set-default-arguments) - (define-key map [?\C-x ?\C-s] 'magit-popup-save-default-arguments) - (define-key map [?\C-g] 'magit-popup-quit) - (define-key map [??] 'magit-popup-help) - (define-key map [?\C-h ?i] 'magit-popup-info) - (define-key map [?\C-t] 'magit-popup-toggle-show-common-commands) - (define-key map [?\d] 'backward-button) - (define-key map [?\C-p] 'backward-button) - (define-key map [?\t] 'forward-button) - (define-key map [?\C-n] 'forward-button) - (define-key map [?\r] 'push-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'.") - -(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-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? (cdr filter) arg))) - (when (eq (car filter) :only) - (pop filter)) - (lambda (arg) (-contains? filter arg))) - magit-current-popup-args))) - -(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))))) - -(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 in which the -option is placed. If omitted then the option is placed in some -group the same way it is done when directly using `defcustom'. - -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, assuming the first member - is also a string. Instead of just one action section with the - heading \"Actions\", multiple sections are then inserted into - the popup buffer, using these strings as headings. - - 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 `popup'. - -`:max-action-columns' - The maximum number of actions to display on a single line. - This helps arranging actions more sensibly. If there is not - enough room to display that many actions on one line, then - this is ignored. - -`: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. - -`: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. - -`: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\". - -`: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* ((grp (unless (keywordp (car args)) (pop args))) - (mode (unless (keywordp (car args)) (pop args))) - (opt (symbol-name name)) - (opt (if (keywordp (car args)) - (intern (concat (if (string-suffix-p "-popup" opt) - (substring opt 0 -6) - opt) - "-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. - -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)) - (use-prefix (or local magit-popup-use-prefix-argument))) - (cond - ((and arg (eq magit-popup-use-prefix-argument 'disabled)) - (customize-option-other-window 'magit-popup-use-prefix-argument) - (error (concat "The meaning of prefix arguments has changed. " - "Please explicitly enable their use again."))) - ((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 '(disabled default popup nil)) - (magit-popup-mode-setup popup mode) - (when magit-popup-show-help-echo - (message (concat "Type C-h i to view popup manual, " - "? to describe an argument or action.")))) - (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))) - (if (or action variable) - (let ((magit-current-popup magit-this-popup) - (magit-current-popup-args (magit-popup-get-args)) - (command (magit-popup-event-fun (or action variable)))) - (when action - (magit-popup-quit)) - (call-interactively command) - (setq this-command command) - (unless action - (magit-refresh-popup-buffer))) - (if (eq event ?q) - (magit-popup-quit) - (user-error "%c isn't bound to any action" event))))) - -(defun magit-popup-set-variable - (variable choices &optional default other) - (--if-let (--if-let (magit-git-string "config" "--local" variable) - (cadr (member it choices)) - (car choices)) - (magit-set it variable) - (magit-call-git "config" "--unset" variable)) - (magit-refresh) - (message "%s %s" variable - (magit-popup-format-variable-1 variable choices default other))) - -(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") - (customize-set-variable (magit-popup-get :variable) - (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - -(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") - (customize-save-variable (magit-popup-get :variable) - (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - -;;; 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 - (magit-popup-manpage man (magit-popup-lookup int :switches))) - (`magit-invoke-popup-option - (magit-popup-manpage man (magit-popup-lookup int :options))) - (`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))) - (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)) - (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") - (re-search-forward (format "^[\t\s]+\\(-., \\)*?%s[=\n]" arg) - (save-excursion - (Man-next-section 1) - (point)) - t)) - (goto-char (1+ (match-beginning 0))) - (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 nil) - (display-buffer-function 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))) - (magit-popup-put :variables (magit-popup-convert-variables - val (plist-get def :variables))) - (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) - (let ((val (symbol-value (plist-get (symbol-value popup) :variable))) - (def (symbol-value popup))) - (magit-popup-mode-display-buffer (get-buffer-create - (format "*%s*" popup)) - (or mode 'magit-popup-mode)) - (setq magit-this-popup popup) - (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-switch-button) - (magit-popup-insert-section 'magit-popup-option-button) - (magit-popup-insert-section 'magit-popup-variable-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))) - (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 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"))) - (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) - (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-variable - (variable choices &optional default other width) - (concat variable - (if width (make-string (- width (length variable)) ?\s) " ") - (magit-popup-format-variable-1 variable choices default other))) - -(defun magit-popup-format-variable-1 - (variable choices &optional default other) - (let ((local (magit-git-string "config" "--local" variable)) - (global (magit-git-string "config" "--global" variable))) - (when other - (--if-let (magit-git-string "config" other) - (setq other (concat other ":" it)) - (setq other nil))) - (concat - (propertize "[" 'face 'magit-popup-disabled-argument) - (mapconcat - (lambda (choice) - (propertize choice 'face (if (equal choice local) - 'magit-popup-option-value - 'magit-popup-disabled-argument))) - choices - (propertize "|" 'face 'magit-popup-disabled-argument)) - (when (or global other default) - (concat - (propertize "|" 'face 'magit-popup-disabled-argument) - (cond (global - (propertize (concat "global:" global) - 'face (cond (local - 'magit-popup-disabled-argument) - ((member global choices) - 'magit-popup-option-value) - (t - 'font-lock-warning-face)))) - (other - (propertize other - 'face (if local - 'magit-popup-disabled-argument - 'magit-popup-option-value))) - (default - (propertize (concat "default:" default) - 'face (if local - 'magit-popup-disabled-argument - 'magit-popup-option-value)))))) - (propertize "]" 'face 'magit-popup-disabled-argument)))) - -(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 (next-single-property-change 0 'face (concat "0" 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) - files (split-string (substring files 3) ","))) - (list args files))) - -;;; magit-popup.el ends soon - -(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-20160130.649/magit-popup.info b/elpa/magit-popup-20160130.649/magit-popup.info deleted file mode 100644 index a4b68226..00000000 --- a/elpa/magit-popup-20160130.649/magit-popup.info +++ /dev/null @@ -1,710 +0,0 @@ -This is magit-popup.info, produced by makeinfo version 5.2 from -magit-popup.texi. - -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. - - Copyright (C) 2015-2016 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. - - Copyright (C) 2015-2016 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 prefixes 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 disappears. 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 commands - - /- 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 -change to notice them. - - -- User Option: magit-popup-show-common-commands - - This option controls whether the section which lists the commands - that are common to all popups is initially show. We recommend you - set this to ‘nil’ - after you have memorized that it can be shown - on demand using ‘C-t’. - -‘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: 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. - - 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: -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. The *intended* default is ‘default’, - but the *actual* default is ‘disabled’. This is necessary because - the old popup implementation did simply forward such a pre-popup - prefix argument to the suffix command invoked from the popup, and - changing that without users being aware of it could lead to tears. - - • ‘disabled’ - - Bring up a Custom option buffer so that the user reads this - and then makes an informed choice. - - • ‘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: - 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. - - The optional argument GROUP specifies the Custom group in which the - option is placed. If omitted then the option is placed in some - group the same way it is done when directly using ‘defcustom’ and - omitting the group. - - 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. - - How the actions are split into rows and columns currently - depends on the available space and ‘:max-action-columns’. - - WARNING: This will likely be change to use a more explicit - format (((KEY DESC COMMAND)…)…) before the release. - - 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, assuming the first - member is also a string. Instead of just one action section - with the heading \"Actions\", multiple sections are then - inserted into the popup buffer, using these strings as - headings. - - 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’. - - • ‘: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. - - • ‘: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. - - • ‘: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. - - • ‘: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\". - - • ‘: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: Top994 -Node: Introduction2168 -Node: Usage4745 -Node: Customizing existing popups9402 -Node: Other options14930 -Node: Defining prefix and suffix commands16979 -Node: Defining prefix commands19075 -Node: Defining suffix commands25755 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-popup-20160529.2045/dir b/elpa/magit-popup-20160529.2045/dir deleted file mode 100644 index c276dafb..00000000 --- a/elpa/magit-popup-20160529.2045/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-20160529.2045/magit-popup-autoloads.el b/elpa/magit-popup-20160529.2045/magit-popup-autoloads.el deleted file mode 100644 index c6fb0ce2..00000000 --- a/elpa/magit-popup-20160529.2045/magit-popup-autoloads.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; magit-popup-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil nil ("magit-popup-pkg.el" "magit-popup.el") -;;;;;; (22348 36356 167146 0)) - -;;;*** - -;; 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-20160529.2045/magit-popup-pkg.el b/elpa/magit-popup-20160529.2045/magit-popup-pkg.el deleted file mode 100644 index e7cdb9fe..00000000 --- a/elpa/magit-popup-20160529.2045/magit-popup-pkg.el +++ /dev/null @@ -1,9 +0,0 @@ -(define-package "magit-popup" "20160529.2045" "Define prefix-infix-suffix command combos" - '((emacs "24.4") - (async "20150909.2257") - (dash "20151021.113")) - :url "https://github.com/magit/magit" :keywords - '("bindings")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-popup-20160529.2045/magit-popup.el b/elpa/magit-popup-20160529.2045/magit-popup.el deleted file mode 100644 index 23459351..00000000 --- a/elpa/magit-popup-20160529.2045/magit-popup.el +++ /dev/null @@ -1,1274 +0,0 @@ -;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- - -;; Copyright (C) 2010-2016 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 "20150909.2257") (dash "20151021.113")) -;; Keywords: bindings -;; Homepage: https://github.com/magit/magit - -;; 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 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) - -(and (require 'async-bytecomp nil t) - (memq '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 the `:variable' event type. -(declare-function magit-call-git 'magit-process) -(declare-function magit-git-string 'magit-git) -(declare-function magit-refresh 'magit-mode) -(declare-function magit-set 'magit-git) - -;; For branch actions. -(declare-function magit-branch-set-face 'magit-git) -(declare-function magit-local-branch-p 'magit-git) - -;;; Settings -;;;; Custom Groups - -(defgroup magit-popup nil - "Infix arguments with a popup as feedback." - :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 t - "Initially show section with commands common to all popups. -This section can also be toggled temporarily using \ -\\\\[magit-popup-toggle-show-common-commands]." - :group 'magit-popup - :type 'boolean) - -(defcustom magit-popup-use-prefix-argument 'disabled - "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. The *intended* default is `default', -but the *actual* default is `disabled'. This is necessary because -the old popup implementation did simply forward such a pre-popup -prefix argument to the action invoked from the popup, and changing -that without users being aware of it could lead to tears. - -`disabled' Bring up a Custom option buffer so that the user reads - this and then makes an informed choice. - -`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) - (const :tag "Abort and show usage information" disabled))) - -;;;; 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 [?- t] 'magit-invoke-popup-switch) - (define-key map [?= t] 'magit-invoke-popup-option) - (define-key map [?\C-c ?\C-c] 'magit-popup-set-default-arguments) - (define-key map [?\C-x ?\C-s] 'magit-popup-save-default-arguments) - (define-key map [?\C-g] 'magit-popup-quit) - (define-key map [??] 'magit-popup-help) - (define-key map [?\C-h ?i] 'magit-popup-info) - (define-key map [?\C-t] 'magit-popup-toggle-show-common-commands) - (define-key map [?\d] 'backward-button) - (define-key map [?\C-p] 'backward-button) - (define-key map [?\t] 'forward-button) - (define-key map [?\C-n] 'forward-button) - (define-key map [?\r] 'push-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) - -(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-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? (cdr filter) arg))) - (when (eq (car filter) :only) - (pop filter)) - (lambda (arg) (-contains? filter arg))) - magit-current-popup-args))) - -(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))))) - -(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 in which the -option is placed. If omitted then the option is placed in some -group the same way it is done when directly using `defcustom'. - -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, assuming the first member - is also a string. Instead of just one action section with the - heading \"Actions\", multiple sections are then inserted into - the popup buffer, using these strings as headings. - - 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'. - -`:max-action-columns' - The maximum number of actions to display on a single line. - This helps arranging actions more sensibly. If there is not - enough room to display that many actions on one line, then - this is ignored. - -`: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. - -`: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. - -`: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\". - -`: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* ((grp (unless (keywordp (car args)) (pop args))) - (mode (unless (keywordp (car args)) (pop args))) - (opt (symbol-name name)) - (opt (if (keywordp (car args)) - (intern (concat (if (string-suffix-p "-popup" opt) - (substring opt 0 -6) - opt) - "-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. - -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)) - (use-prefix (or local magit-popup-use-prefix-argument))) - (cond - ((and arg (eq magit-popup-use-prefix-argument 'disabled)) - (customize-option-other-window 'magit-popup-use-prefix-argument) - (error (concat "The meaning of prefix arguments has changed. " - "Please explicitly enable their use again."))) - ((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 '(disabled default popup nil)) - (magit-popup-mode-setup popup mode) - (when magit-popup-show-help-echo - (message (concat "Type C-h i to view popup manual, " - "? to describe an argument or action.")))) - (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)) - (if (or action variable) - (let ((magit-current-popup magit-this-popup) - (magit-current-popup-args (magit-popup-get-args)) - (command (magit-popup-event-fun (or action variable)))) - (when action - (magit-popup-quit)) - (call-interactively command) - (setq this-command command) - (unless action - (magit-refresh-popup-buffer))) - (if (eq event ?q) - (progn (magit-popup-quit) - (when magit-previous-popup - (magit-popup-mode-setup magit-previous-popup nil))) - (user-error "%c isn't bound to any action" event))))) - -(defun magit-popup-set-variable - (variable choices &optional default other) - (--if-let (--if-let (magit-git-string "config" "--local" variable) - (cadr (member it choices)) - (car choices)) - (magit-set it variable) - (magit-call-git "config" "--unset" variable)) - (magit-refresh) - (message "%s %s" variable - (magit-popup-format-variable-1 variable choices default other))) - -(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") - (customize-set-variable (magit-popup-get :variable) - (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - -(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") - (customize-save-variable (magit-popup-get :variable) - (magit-popup-get-args)) - (unless arg (magit-popup-quit))) - -;;; 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 - (magit-popup-manpage man (magit-popup-lookup int :switches))) - (`magit-invoke-popup-option - (magit-popup-manpage man (magit-popup-lookup int :options))) - (`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))) - (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)) - (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") - (re-search-forward (format "^[\t\s]+\\(-., \\)*?%s[=\n]" arg) - (save-excursion - (Man-next-section 1) - (point)) - t)) - (goto-char (1+ (match-beginning 0))) - (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)) - (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))) - (magit-popup-put :variables (magit-popup-convert-variables - val (plist-get def :variables))) - (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))) - (magit-popup-mode-display-buffer (get-buffer-create - (format "*%s*" popup)) - (or mode 'magit-popup-mode)) - (setq magit-this-popup popup) - (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-switch-button) - (magit-popup-insert-section 'magit-popup-option-button) - (magit-popup-insert-section 'magit-popup-variable-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))) - (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 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"))) - (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-variable - (variable choices &optional default other width) - (concat variable - (if width (make-string (- width (length variable)) ?\s) " ") - (magit-popup-format-variable-1 variable choices default other))) - -(defun magit-popup-format-variable-1 - (variable choices &optional default other) - (let ((local (magit-git-string "config" "--local" variable)) - (global (magit-git-string "config" "--global" variable))) - (when other - (--if-let (magit-git-string "config" other) - (setq other (concat other ":" it)) - (setq other nil))) - (concat - (propertize "[" 'face 'magit-popup-disabled-argument) - (mapconcat - (lambda (choice) - (propertize choice 'face (if (equal choice local) - 'magit-popup-option-value - 'magit-popup-disabled-argument))) - choices - (propertize "|" 'face 'magit-popup-disabled-argument)) - (when (or global other default) - (concat - (propertize "|" 'face 'magit-popup-disabled-argument) - (cond (global - (propertize (concat "global:" global) - 'face (cond (local - 'magit-popup-disabled-argument) - ((member global choices) - 'magit-popup-option-value) - (t - 'font-lock-warning-face)))) - (other - (propertize other - 'face (if local - 'magit-popup-disabled-argument - 'magit-popup-option-value))) - (default - (propertize (concat "default:" default) - 'face (if local - 'magit-popup-disabled-argument - 'magit-popup-option-value)))))) - (propertize "]" 'face 'magit-popup-disabled-argument)))) - -(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 (next-single-property-change 0 'face (concat "0" 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) - files (split-string (substring files 3) ","))) - (list args files))) - -;;; magit-popup.el ends soon - -(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-20160529.2045/magit-popup.info b/elpa/magit-popup-20160529.2045/magit-popup.info deleted file mode 100644 index b80a74a6..00000000 --- a/elpa/magit-popup-20160529.2045/magit-popup.info +++ /dev/null @@ -1,712 +0,0 @@ -This is magit-popup.info, produced by makeinfo version 5.2 from -magit-popup.texi. - -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. - - Copyright (C) 2015-2016 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. - - Copyright (C) 2015-2016 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 prefixes 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 disappears. 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 commands - - /- 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 -change to notice them. - - -- User Option: magit-popup-show-common-commands - - This option controls whether the section which lists the commands - that are common to all popups is initially show. We recommend you - set this to ‘nil’ - after you have memorized that it can be shown - on demand using ‘C-t’. - -‘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: 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. - - 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: -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. The *intended* default is ‘default’, - but the *actual* default is ‘disabled’. This is necessary because - the old popup implementation did simply forward such a pre-popup - prefix argument to the suffix command invoked from the popup, and - changing that without users being aware of it could lead to tears. - - • ‘disabled’ - - Bring up a Custom option buffer so that the user reads this - and then makes an informed choice. - - • ‘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: - 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. - - The optional argument GROUP specifies the Custom group in which the - option is placed. If omitted then the option is placed in some - group the same way it is done when directly using ‘defcustom’ and - omitting the group. - - 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. - - How the actions are split into rows and columns currently - depends on the available space and ‘:max-action-columns’. - - WARNING: This will likely be change to use a more explicit - format (((KEY DESC COMMAND)…)…) before the release. - - 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, assuming the first - member is also a string. Instead of just one action section - with the heading \"Actions\", multiple sections are then - inserted into the popup buffer, using these strings as - headings. - - 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’. - - • ‘: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. - - • ‘: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. - - • ‘: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. - - • ‘: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\". - - • ‘: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: Top994 -Node: Introduction2170 -Node: Usage4747 -Node: Customizing existing popups9404 -Node: Other options14932 -Node: Defining prefix and suffix commands16981 -Node: Defining prefix commands19077 -Node: Defining suffix commands25757 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-popup-20161009.1506/dir b/elpa/magit-popup-20161009.1506/dir deleted file mode 100644 index c276dafb..00000000 --- a/elpa/magit-popup-20161009.1506/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-20161009.1506/magit-popup-pkg.el b/elpa/magit-popup-20161009.1506/magit-popup-pkg.el deleted file mode 100644 index 98931ef0..00000000 --- a/elpa/magit-popup-20161009.1506/magit-popup-pkg.el +++ /dev/null @@ -1,9 +0,0 @@ -(define-package "magit-popup" "20161009.1506" "Define prefix-infix-suffix command combos" - '((emacs "24.4") - (async "20160711.223") - (dash "20160820.501")) - :url "https://github.com/magit/magit" :keywords - '("bindings")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-popup-20150701.1246/dir b/elpa/magit-popup-20170913.343/dir similarity index 100% rename from elpa/magit-popup-20150701.1246/dir rename to elpa/magit-popup-20170913.343/dir diff --git a/elpa/magit-popup-20161009.1506/magit-popup-autoloads.el b/elpa/magit-popup-20170913.343/magit-popup-autoloads.el similarity index 93% rename from elpa/magit-popup-20161009.1506/magit-popup-autoloads.el rename to elpa/magit-popup-20170913.343/magit-popup-autoloads.el index 214947a1..4bd55557 100644 --- a/elpa/magit-popup-20161009.1506/magit-popup-autoloads.el +++ b/elpa/magit-popup-20170913.343/magit-popup-autoloads.el @@ -4,7 +4,7 @@ (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") -;;;;;; (22576 8240 0 0)) +;;;;;; (22975 34389 0 0)) ;;;*** diff --git a/elpa/magit-popup-20160130.649/magit-popup-pkg.el b/elpa/magit-popup-20170913.343/magit-popup-pkg.el similarity index 57% rename from elpa/magit-popup-20160130.649/magit-popup-pkg.el rename to elpa/magit-popup-20170913.343/magit-popup-pkg.el index a62d46bb..a802f86e 100644 --- a/elpa/magit-popup-20160130.649/magit-popup-pkg.el +++ b/elpa/magit-popup-20170913.343/magit-popup-pkg.el @@ -1,7 +1,7 @@ -(define-package "magit-popup" "20160130.649" "Define prefix-infix-suffix command combos" +(define-package "magit-popup" "20170913.343" "Define prefix-infix-suffix command combos" '((emacs "24.4") - (async "20150909.2257") - (dash "20151021.113")) + (async "20170823") + (dash "20170810")) :url "https://github.com/magit/magit" :keywords '("bindings")) ;; Local Variables: diff --git a/elpa/magit-popup-20161009.1506/magit-popup.el b/elpa/magit-popup-20170913.343/magit-popup.el similarity index 90% rename from elpa/magit-popup-20161009.1506/magit-popup.el rename to elpa/magit-popup-20170913.343/magit-popup.el index e43f01ff..c7e2b2e0 100644 --- a/elpa/magit-popup-20161009.1506/magit-popup.el +++ b/elpa/magit-popup-20170913.343/magit-popup.el @@ -1,6 +1,6 @@ ;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- -;; Copyright (C) 2010-2016 The Magit Project Contributors +;; Copyright (C) 2010-2017 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. @@ -12,7 +12,7 @@ ;; Author: Jonas Bernoulli ;; Maintainer: Jonas Bernoulli -;; Package-Requires: ((emacs "24.4") (async "20160711.223") (dash "20160820.501")) +;; Package-Requires: ((emacs "24.4") (async "20170823") (dash "20170810")) ;; Keywords: bindings ;; Homepage: https://github.com/magit/magit @@ -54,7 +54,8 @@ (require 'format-spec) (and (require 'async-bytecomp nil t) - (memq 'magit (bound-and-true-p async-bytecomp-allowed-packages)) + (cl-intersection '(all magit) + (bound-and-true-p async-bytecomp-allowed-packages)) (fboundp 'async-bytecomp-package-mode) (async-bytecomp-package-mode 1)) @@ -76,6 +77,7 @@ (defgroup magit-popup nil "Infix arguments with a popup as feedback." + :link '(info-link "(magit-popup)") :group 'bindings) (defgroup magit-popup-faces nil @@ -106,25 +108,19 @@ One of `man' or `woman'." :group 'magit-popup :type 'boolean) -(defcustom magit-popup-show-common-commands t - "Initially show section with commands common to all popups. +(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 'disabled +(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. The *intended* default is `default', -but the *actual* default is `disabled'. This is necessary because -the old popup implementation did simply forward such a pre-popup -prefix argument to the action invoked from the popup, and changing -that without users being aware of it could lead to tears. - -`disabled' Bring up a Custom option buffer so that the user reads - this and then makes an informed choice. +before entering a popup has. `default' With a prefix argument directly invoke the popup's default action (an Emacs command), instead of bringing @@ -138,8 +134,7 @@ that without users being aware of it could lead to tears. :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) - (const :tag "Abort and show usage information" disabled))) + (const :tag "Ignore prefix argument" nil))) ;;;; Custom Faces @@ -173,20 +168,26 @@ that without users being aware of it could lead to tears. (defvar magit-popup-mode-map (let ((map (make-sparse-keymap))) (define-key map [remap self-insert-command] 'magit-invoke-popup-action) - (define-key map [?- t] 'magit-invoke-popup-switch) - (define-key map [?= t] 'magit-invoke-popup-option) - (define-key map [?\C-c ?\C-c] 'magit-popup-set-default-arguments) - (define-key map [?\C-x ?\C-s] 'magit-popup-save-default-arguments) - (define-key map [?\C-g] 'magit-popup-quit) - (define-key map [??] 'magit-popup-help) - (define-key map [?\C-h ?k] 'magit-popup-help) - (define-key map [?\C-h ?i] 'magit-popup-info) - (define-key map [?\C-t] 'magit-popup-toggle-show-common-commands) - (define-key map [?\d] 'backward-button) - (define-key map [?\C-p] 'backward-button) - (define-key map [?\t] 'forward-button) - (define-key map [?\C-n] 'forward-button) - (define-key map [?\r] 'push-button) + (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'. @@ -199,7 +200,7 @@ 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' +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'. @@ -312,7 +313,7 @@ Don't confuse this with `magit-current-popup-args'.") 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.") +of a popup, then this is nil.") (defvar magit-current-popup-action nil "The popup action now being executed.") @@ -347,10 +348,10 @@ 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? (cdr filter) arg))) + (lambda (arg) (not (-contains-p (cdr filter) arg))) (when (eq (car filter) :only) (pop filter)) - (lambda (arg) (-contains? filter arg))) + (lambda (arg) (-contains-p filter arg))) magit-current-popup-args))) (defun magit-popup-arg-match (pattern string) @@ -439,9 +440,11 @@ 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 in which the -option is placed. If omitted then the option is placed in some -group the same way it is done when directly using `defcustom'. +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 @@ -488,13 +491,16 @@ usually specified in that order): 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'. + 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. - This helps arranging actions more sensibly. If there is not - enough room to display that many actions on one line, then - this is ignored. + 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 @@ -511,6 +517,12 @@ usually specified in that order): 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. + `:sequence-predicate' When this function returns non-nil, then the popup uses `:sequence-actions' instead of `:actions', and does not show @@ -536,13 +548,15 @@ usually specified in that order): \(fn NAME DOC [GROUP [MODE [OPTION]]] :KEYWORD VALUE...)" (declare (indent defun) (doc-string 2)) - (let* ((grp (unless (keywordp (car args)) (pop args))) - (mode (unless (keywordp (car args)) (pop args))) - (opt (symbol-name name)) + (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" opt) - (substring opt 0 -6) - opt) + (intern (concat (if (string-suffix-p "-popup" str) + (substring str 0 -6) + str) "-arguments")) (eval (pop args))))) `(progn @@ -577,11 +591,11 @@ 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. +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 +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)) @@ -605,9 +619,14 @@ 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 +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)) @@ -631,7 +650,7 @@ 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 +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)) @@ -653,7 +672,7 @@ 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 +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)) @@ -751,12 +770,11 @@ TYPE is one of `:action', `:sequence-action', `:switch', or (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 - ((and arg (eq magit-popup-use-prefix-argument 'disabled)) - (customize-option-other-window 'magit-popup-use-prefix-argument) - (error (concat "The meaning of prefix arguments has changed. " - "Please explicitly enable their use again."))) ((or (and (eq use-prefix 'default) arg) (and (eq use-prefix 'popup) (not arg))) (if default @@ -772,11 +790,15 @@ TYPE is one of `:action', `:sequence-action', `:switch', or (call-interactively default)) (message "%s has no default action; showing popup instead." popup) (magit-popup-mode-setup popup mode))) - ((memq use-prefix '(disabled default popup nil)) + ((memq use-prefix '(default popup nil)) (magit-popup-mode-setup popup mode) (when magit-popup-show-help-echo - (message (concat "Type C-h i to view popup manual, " - "? to describe an argument or action.")))) + (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 @@ -814,22 +836,23 @@ TYPE is one of `:action', `:sequence-action', `:switch', or (when (and variable (not (magit-popup-event-arg variable))) (setq action variable) (setq variable nil)) - (if (or action variable) - (let* ((magit-current-popup magit-this-popup) - (magit-current-popup-args (magit-popup-get-args)) - (command (magit-popup-event-fun (or action variable))) - (magit-current-popup-action command)) - (when action - (magit-popup-quit)) - (call-interactively command) - (setq this-command command) - (unless action - (magit-refresh-popup-buffer))) - (if (eq event ?q) - (progn (magit-popup-quit) - (when magit-previous-popup - (magit-popup-mode-setup magit-previous-popup nil))) - (user-error "%c isn't bound to any action" event))))) + (cond ((or action variable) + (let* ((magit-current-popup magit-this-popup) + (magit-current-popup-args (magit-popup-get-args)) + (command (magit-popup-event-fun (or action variable))) + (magit-current-popup-action command)) + (when action + (magit-popup-quit)) + (call-interactively command) + (setq this-command 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-set-variable (variable choices &optional default other) @@ -1105,6 +1128,8 @@ of events shared by all popups and before point is adjusted.") (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 items (if (functionp heading) (when (setq heading (funcall heading)) @@ -1258,12 +1283,10 @@ variable whose value may be used as a default." (defun magit-popup-export-file-args (args) (let ((files (--first (string-prefix-p "-- " it) args))) (when files - (setq args (remove files args) - files (split-string (substring files 3) ","))) + (setq args (remove files args)) + (setq files (split-string (substring files 3) ","))) (list args files))) -;;; magit-popup.el ends soon - (defconst magit-popup-font-lock-keywords (eval-when-compile `((,(concat "(\\(magit-define-popup\\)\\_>" @@ -1275,7 +1298,4 @@ variable whose value may be used as a default." (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-20161009.1506/magit-popup.info b/elpa/magit-popup-20170913.343/magit-popup.info similarity index 83% rename from elpa/magit-popup-20161009.1506/magit-popup.info rename to elpa/magit-popup-20170913.343/magit-popup.info index e06fc7c1..f1537b58 100644 --- a/elpa/magit-popup-20161009.1506/magit-popup.info +++ b/elpa/magit-popup-20170913.343/magit-popup.info @@ -1,12 +1,7 @@ This is magit-popup.info, produced by makeinfo version 5.2 from magit-popup.texi. -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. - - Copyright (C) 2015-2016 Jonas Bernoulli + Copyright (C) 2015-2017 Jonas Bernoulli You can redistribute this document and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +28,7 @@ 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. - Copyright (C) 2015-2016 Jonas Bernoulli + Copyright (C) 2015-2017 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 @@ -49,22 +44,22 @@ suffix commands. * Introduction:: * Usage:: -* Defining prefix and suffix commands:: +* Defining Prefix and Suffix Commands:: — The Detailed Node Listing — Usage -* Customizing existing popups:: -* Other options:: +* Customizing Existing Popups:: +* Other Options:: -Defining prefix and suffix commands +Defining Prefix and Suffix Commands -* Defining prefix commands:: -* Defining suffix commands:: +* Defining Prefix Commands:: +* Defining Suffix Commands::  File: magit-popup.info, Node: Introduction, Next: Usage, Prev: Top, Up: Top @@ -79,30 +74,30 @@ 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 prefixes with the key sequence that can be used to toggle it +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 -'----------------------------------------- + ,----------------------------------------- + |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 disappears. The suffix command should then +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. @@ -110,28 +105,28 @@ for prefix arguments. prefix commands and prefix arguments, they are also quite different. This should illustrate the most basic differences: - • A regular prefix commands + • A regular prefix command - /- command1 - prefix --- command2 - \- command3 + /- command1 + prefix --- command2 + \- command3 • Prefix arguments - /- command1 - C-u ... --- command2 - \- well *any* command + /- command1 + C-u ... --- command2 + \- well any command • A Prefix-Infix-Suffix combo - /- argument1 -\ /- suffix1 - prefix----- argument2 --+-- suffix2 - ^ \- argument3 -/ - | | - '--------' - (refresh buffer) + /- argument1 -\ /- suffix1 + prefix----- argument2 --+-- suffix2 + ^ \- argument3 -/ + | | + '--------' + (refresh buffer) - This library was written as a replacement for ‘magit-key-mode’ which + 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. @@ -142,7 +137,7 @@ 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 +File: magit-popup.info, Node: Usage, Next: Defining Prefix and Suffix Commands, Prev: Introduction, Up: Top 2 Usage ******* @@ -174,10 +169,12 @@ chance to notice them. -- User Option: magit-popup-show-common-commands - This option controls whether the section which lists the commands - that are common to all popups is initially show. We recommend you - set this to ‘nil’ - after you have memorized that it can be shown - on demand using ‘C-t’. + 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’) @@ -215,8 +212,7 @@ popup buffer. 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: Customizing -existing popups. +Custom interface). See *note Customizing Existing Popups::. Documentation about a popup’s arguments and commands can be shown directly from the popup. @@ -250,13 +246,13 @@ along with the other common commands. * Menu: -* Customizing existing popups:: -* Other options:: +* Customizing Existing Popups:: +* Other Options::  -File: magit-popup.info, Node: Customizing existing popups, Next: Other options, Up: Usage +File: magit-popup.info, Node: Customizing Existing Popups, Next: Other Options, Up: Usage -2.1 Customizing existing popups +2.1 Customizing Existing Popups =============================== It is possible to define additional infix arguments and suffix commands @@ -306,6 +302,11 @@ to an existing popup using the following functions. 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 @@ -374,31 +375,22 @@ to an existing popup using the following functions. 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: -Defining prefix commands. for valid properties. The most likely change -Magit users might want to make is: +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 +File: magit-popup.info, Node: Other Options, Prev: Customizing Existing Popups, Up: Usage -2.2 Other options +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. The *intended* default is ‘default’, - but the *actual* default is ‘disabled’. This is necessary because - the old popup implementation did simply forward such a pre-popup - prefix argument to the suffix command invoked from the popup, and - changing that without users being aware of it could lead to tears. - - • ‘disabled’ - - Bring up a Custom option buffer so that the user reads this - and then makes an informed choice. + before entering a popup has. • ‘default’ @@ -416,8 +408,7 @@ File: magit-popup.info, Node: Other options, Prev: Customizing existing popups 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: - Customizing existing popups. + prefix argument is used. See *note Customizing Existing Popups::. -- User Option: magit-popup-manpage-package @@ -436,9 +427,9 @@ File: magit-popup.info, Node: Other options, Prev: Customizing existing popups (button-type-put 'magit-popup-action-button 'format " %k %D")  -File: magit-popup.info, Node: Defining prefix and suffix commands, Prev: Usage, Up: Top +File: magit-popup.info, Node: Defining Prefix and Suffix Commands, Prev: Usage, Up: Top -3 Defining prefix and suffix commands +3 Defining Prefix and Suffix Commands ************************************* If you write an extension for Magit then you should use this library now @@ -466,30 +457,30 @@ infix arguments, and then also one of its suffix commands. 'magit-commands :man-page "git-tag" :switches '((?a "Annotate" "--annotate") - (?s "Sign" "--sign") - (?f "Force" "--force")) + (?s "Sign" "--sign") + (?f "Force" "--force")) :actions '((?t "Create" magit-tag) - (?k "Delete" magit-tag-delete) - (?p "Prune" magit-tag-prune)) + (?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-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:: +* Defining Prefix Commands:: +* Defining Suffix Commands::  -File: magit-popup.info, Node: Defining prefix commands, Next: Defining suffix commands, Up: Defining prefix and 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 +3.1 Defining Prefix Commands ============================ Prefix commands and their infix arguments are defined using the macro @@ -526,10 +517,11 @@ commands have to be defined separately using plain ‘defun’. value of the variable by the same name. See below for more information. - The optional argument GROUP specifies the Custom group in which the - option is placed. If omitted then the option is placed in some + 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. + 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. @@ -545,12 +537,6 @@ commands have to be defined separately using plain ‘defun’. list whose members have the form (KEY DESC COMMAND), see ‘magit-define-popup-action’ for details. - How the actions are split into rows and columns currently - depends on the available space and ‘:max-action-columns’. - - WARNING: This will likely be change to use a more explicit - format (((KEY DESC COMMAND)…)…) before the release. - 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 @@ -583,7 +569,16 @@ commands have to be defined separately using plain ‘defun’. 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’. + ‘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’ @@ -594,20 +589,20 @@ commands have to be defined separately using plain ‘defun’. • ‘: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. - - • ‘: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. + VALUE is a list whose members have the form ‘(KEY DESC OPTION + READER)’, see ‘magit-define-popup-option’ for details. • ‘: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\". + 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. • ‘:sequence-predicate’ @@ -638,9 +633,9 @@ commands have to be defined separately using plain ‘defun’. help for an argument.  -File: magit-popup.info, Node: Defining suffix commands, Prev: Defining prefix commands, Up: Defining prefix and suffix commands +File: magit-popup.info, Node: Defining Suffix Commands, Prev: Defining Prefix Commands, Up: Defining Prefix and Suffix Commands -3.2 Defining suffix commands +3.2 Defining Suffix Commands ============================ Commands intended to be invoked from a particular popup should determine @@ -695,14 +690,14 @@ directly.  Tag Table: -Node: Top994 -Node: Introduction2170 -Node: Usage4747 -Node: Customizing existing popups9404 -Node: Other options14932 -Node: Defining prefix and suffix commands16981 -Node: Defining prefix commands19077 -Node: Defining suffix commands25757 +Node: Top768 +Node: Introduction1944 +Node: Usage4643 +Node: Customizing Existing Popups9340 +Node: Other Options15086 +Node: Defining Prefix and Suffix Commands16628 +Node: Defining Prefix Commands18780 +Node: Defining Suffix Commands25755  End Tag Table -- 2.47.3