From 90d350d5a41467698a90f861e28775411ebc13af Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Mon, 18 Jan 2016 20:05:20 +0100 Subject: [PATCH] update magit. --- .../git-commit-pkg.el | 1 - .../git-commit-autoloads.el | 2 +- .../git-commit-pkg.el | 1 + .../git-commit.el | 49 +- elpa/magit-20160102.906/magit.info | 158 --- .../AUTHORS.md | 1 + .../COPYING | 0 .../dir | 0 .../git-rebase.el | 0 .../magit-apply.el | 68 +- .../magit-autoloads.el | 67 +- elpa/magit-20160117.2129/magit-autorevert.el | 150 ++ .../magit-bisect.el | 0 .../magit-blame.el | 0 .../magit-commit.el | 0 .../magit-core.el | 1 + .../magit-diff.el | 6 +- .../magit-ediff.el | 0 .../magit-extras.el | 0 .../magit-git.el | 25 +- .../magit-log.el | 27 +- .../magit-mode.el | 301 +--- .../magit-pkg.el | 8 +- .../magit-popup.el | 16 +- .../magit-process.el | 67 +- .../magit-remote.el | 44 +- .../magit-section.el | 0 .../magit-sequence.el | 0 .../magit-stash.el | 0 .../magit-utils.el | 0 .../magit-wip.el | 0 .../magit.el | 94 +- elpa/magit-20160117.2129/magit.info | 163 +++ .../magit.info-1 | 728 +++++----- .../magit.info-2 | Bin 21491 -> 22604 bytes .../dir | 0 .../magit-popup-autoloads.el | 2 +- .../magit-popup-pkg.el | 2 +- elpa/magit-popup-20160117.1513/magit-popup.el | 1264 +++++++++++++++++ .../magit-popup.info | 27 +- .../dir | 0 .../with-editor-autoloads.el | 2 +- .../with-editor-pkg.el | 2 +- .../with-editor.el | 4 +- .../with-editor.info | 16 +- 45 files changed, 2348 insertions(+), 948 deletions(-) delete mode 100644 elpa/git-commit-20150701.1326/git-commit-pkg.el rename elpa/{git-commit-20150701.1326 => git-commit-20160117.2258}/git-commit-autoloads.el (94%) create mode 100644 elpa/git-commit-20160117.2258/git-commit-pkg.el rename elpa/{git-commit-20150701.1326 => git-commit-20160117.2258}/git-commit.el (92%) delete mode 100644 elpa/magit-20160102.906/magit.info rename elpa/{magit-20160102.906 => magit-20160117.2129}/AUTHORS.md (99%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/COPYING (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/dir (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/git-rebase.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-apply.el (90%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-autoloads.el (95%) create mode 100644 elpa/magit-20160117.2129/magit-autorevert.el rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-bisect.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-blame.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-commit.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-core.el (98%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-diff.el (99%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-ediff.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-extras.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-git.el (97%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-log.el (98%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-mode.el (78%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-pkg.el (53%) rename elpa/{magit-popup-20151223.1341 => magit-20160117.2129}/magit-popup.el (98%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-process.el (93%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-remote.el (94%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-section.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-sequence.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-stash.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-utils.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit-wip.el (100%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit.el (97%) create mode 100644 elpa/magit-20160117.2129/magit.info rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit.info-1 (94%) rename elpa/{magit-20160102.906 => magit-20160117.2129}/magit.info-2 (92%) rename elpa/{magit-popup-20151223.1341 => magit-popup-20160117.1513}/dir (100%) rename elpa/{magit-popup-20151223.1341 => magit-popup-20160117.1513}/magit-popup-autoloads.el (92%) rename elpa/{magit-popup-20151223.1341 => magit-popup-20160117.1513}/magit-popup-pkg.el (77%) create mode 100644 elpa/magit-popup-20160117.1513/magit-popup.el rename elpa/{magit-popup-20151223.1341 => magit-popup-20160117.1513}/magit-popup.info (97%) rename elpa/{with-editor-20151223.1341 => with-editor-20160117.1513}/dir (100%) rename elpa/{with-editor-20151223.1341 => with-editor-20160117.1513}/with-editor-autoloads.el (92%) rename elpa/{with-editor-20151223.1341 => with-editor-20160117.1513}/with-editor-pkg.el (76%) rename elpa/{with-editor-20151223.1341 => with-editor-20160117.1513}/with-editor.el (99%) rename elpa/{with-editor-20151223.1341 => with-editor-20160117.1513}/with-editor.info (97%) diff --git a/elpa/git-commit-20150701.1326/git-commit-pkg.el b/elpa/git-commit-20150701.1326/git-commit-pkg.el deleted file mode 100644 index ebebfad4..00000000 --- a/elpa/git-commit-20150701.1326/git-commit-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "git-commit" "20150701.1326" "Edit Git commit messages" '((emacs "24.4") (dash "2.10.0") (with-editor "2.1.0")) :url "https://github.com/magit/magit" :keywords '("git" "tools" "vc")) diff --git a/elpa/git-commit-20150701.1326/git-commit-autoloads.el b/elpa/git-commit-20160117.2258/git-commit-autoloads.el similarity index 94% rename from elpa/git-commit-20150701.1326/git-commit-autoloads.el rename to elpa/git-commit-20160117.2258/git-commit-autoloads.el index 722b20ae..cdf6a91f 100644 --- a/elpa/git-commit-20150701.1326/git-commit-autoloads.el +++ b/elpa/git-commit-20160117.2258/git-commit-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "git-commit" "git-commit.el" (21910 48889 0 +;;;### (autoloads nil "git-commit" "git-commit.el" (22173 11883 0 ;;;;;; 0)) ;;; Generated autoloads from git-commit.el diff --git a/elpa/git-commit-20160117.2258/git-commit-pkg.el b/elpa/git-commit-20160117.2258/git-commit-pkg.el new file mode 100644 index 00000000..6c9ad763 --- /dev/null +++ b/elpa/git-commit-20160117.2258/git-commit-pkg.el @@ -0,0 +1 @@ +(define-package "git-commit" "20160117.2258" "Edit Git commit messages" '((emacs "24.4") (dash "20151021.113") (with-editor "20160117.1513")) :url "https://github.com/magit/magit" :keywords '("git" "tools" "vc")) diff --git a/elpa/git-commit-20150701.1326/git-commit.el b/elpa/git-commit-20160117.2258/git-commit.el similarity index 92% rename from elpa/git-commit-20150701.1326/git-commit.el rename to elpa/git-commit-20160117.2258/git-commit.el index 8f629f21..44bf9825 100644 --- a/elpa/git-commit-20150701.1326/git-commit.el +++ b/elpa/git-commit-20160117.2258/git-commit.el @@ -1,6 +1,6 @@ ;;; git-commit.el --- Edit Git commit messages -*- lexical-binding: t; -*- -;; Copyright (C) 2010-2015 The Magit Project Contributors +;; 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. @@ -11,9 +11,9 @@ ;; Marius Vollmer ;; Maintainer: Jonas Bernoulli -;; Package-Requires: ((emacs "24.4") (dash "2.10.0") (with-editor "2.1.0")) +;; Package-Requires: ((emacs "24.4") (dash "20151021.113") (with-editor "20160117.1513")) ;; Keywords: git tools vc -;; Package-Version: 20150701.1326 +;; Package-Version: 20160117.2258 ;; Homepage: https://github.com/magit/magit ;; This file is not part of GNU Emacs. @@ -102,7 +102,7 @@ ;; files. ;; Finally this package highlights style errors, like lines that are -;; to long, or when the second line is not empty. It may even nag you +;; too long, or when the second line is not empty. It may even nag you ;; when you attempt to finish the commit without having fixed these ;; issues. Some people like that nagging, I don't, so you'll have to ;; enable it. Which brings me to the last point. Like any @@ -125,6 +125,8 @@ (defvar flyspell-generic-check-word-predicate) +(declare-function magit-expand-git-file-name 'magit-git) + ;;; Options ;;;; Variables @@ -160,6 +162,12 @@ The major mode configured here is turned on by the minor mode :type '(choice (function-item text-mode) (const :tag "No major mode"))) +(unless (find-lisp-object-file-name 'git-commit-setup-hook 'defvar) + (add-hook 'git-commit-setup-hook 'with-editor-usage-message) + (add-hook 'git-commit-setup-hook 'git-commit-propertize-diff) + (add-hook 'git-commit-setup-hook 'git-commit-turn-on-auto-fill) + (add-hook 'git-commit-setup-hook 'git-commit-setup-changelog-support) + (add-hook 'git-commit-setup-hook 'git-commit-save-message)) (defcustom git-commit-setup-hook '(git-commit-save-message git-commit-setup-changelog-support @@ -169,7 +177,7 @@ The major mode configured here is turned on by the minor mode "Hook run at the end of `git-commit-setup'." :group 'git-commit :type 'hook - :options '(magit-revert-buffers + :options '( git-commit-save-message git-commit-setup-changelog-support git-commit-turn-on-auto-fill @@ -351,6 +359,21 @@ usually honor this wish and return non-nil." (git-commit-setup))) (defun git-commit-setup () + ;; cygwin git will pass a cygwin path (/cygdrive/c/foo/.git/...), + ;; try to handle this in window-nt Emacs. + (--when-let + (and (eq system-type 'windows-nt) + (not (file-accessible-directory-p default-directory)) + (if (require 'magit-git nil t) + ;; Emacs prepends a "c:". + (magit-expand-git-file-name (substring buffer-file-name 2)) + ;; Fallback if we can't load `magit-git'. + (and (string-match "\\`[a-z]:/\\(cygdrive/\\)?\\([a-z]\\)/\\(.*\\)" + buffer-file-name) + (concat (match-string 2 buffer-file-name) ":/" + (match-string 3 buffer-file-name))))) + (when (file-accessible-directory-p (file-name-directory it)) + (find-alternate-file it))) (when git-commit-major-mode (funcall git-commit-major-mode)) (setq with-editor-show-usage nil) @@ -424,12 +447,7 @@ finally check current non-comment text." (flyspell-buffer)) (defun git-commit-flyspell-verify () - (not (memq (get-text-property (point) 'face) - '(font-lock-comment-face font-lock-comment-delimiter-face - git-commit-comment-branch git-commit-comment-detached - git-commit-comment-heading git-commit-comment-file - git-commit-comment-action git-commit-pseudo-header - git-commit-known-pseudo-header)))) + (not (= (char-after (line-beginning-position)) ?#))) (defun git-commit-finish-query-functions (force) (run-hook-with-args-until-failure @@ -438,7 +456,7 @@ finally check current non-comment text." (defun git-commit-check-style-conventions (force) "Check for violations of certain basic style conventions. For each violation ask the user if she wants to proceed anyway. -This makes sure the summary line isn't to long and that the +This makes sure the summary line isn't too long and that the second line is empty." (or force (save-excursion @@ -570,7 +588,7 @@ With a numeric prefix ARG, go forward ARG comments." (insert ?\n))) (t (while (re-search-backward (concat "^" comment-start) nil t)) - (unless (looking-back "\n\n") + (unless (looking-back "\n\n" nil) (insert ?\n)) (insert header ?\n))) (unless (or (eobp) (= (char-after) ?\n)) @@ -639,7 +657,10 @@ With a numeric prefix ARG, go forward ARG comments." (delete-region (point) (point-max))))) (diff-mode) (let (font-lock-verbose font-lock-support-mode) - (font-lock-fontify-buffer)) + (if (fboundp 'font-lock-flush) + (font-lock-flush) + (with-no-warnings + (font-lock-fontify-buffer)))) (let (next (pos (point-min))) (while (setq next (next-single-property-change pos 'face)) (put-text-property pos next 'font-lock-face diff --git a/elpa/magit-20160102.906/magit.info b/elpa/magit-20160102.906/magit.info deleted file mode 100644 index 447b8769..00000000 --- a/elpa/magit-20160102.906/magit.info +++ /dev/null @@ -1,158 +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: 306730 - -Tag Table: -(Indirect) -Node: Top1222 -Node: Introduction5680 -Node: Installation10373 -Node: Updating from an older release10748 -Node: Installing from an Elpa archive12343 -Node: Installing from the Git repository13901 -Node: Post-installation tasks16138 -Node: Getting started17664 -Node: Interface concepts23399 -Node: Modes and Buffers23725 -Node: Switching Buffers25340 -Node: Naming Buffers28404 -Node: Quitting Windows31239 -Node: Automatic save32825 -Node: Automatic refresh and revert33890 -Node: Sections39152 -Node: Section movement40104 -Node: Section visibility44031 -Node: Section hooks47622 -Node: Section types and values49660 -Node: Section options50930 -Node: Popup buffers and prefix commands51402 -Node: Completion and confirmation52716 -Node: Running Git55622 -Node: Viewing Git output55858 -Node: Running Git manually56858 -Node: Git executable58984 -Node: Global Git arguments60991 -Node: Inspecting61798 -Node: Status buffer62925 -Node: Status sections65448 -Node: Status header sections70195 -Node: Status options72754 -Node: Logging73478 -Node: Refreshing logs75845 -Node: Log Buffer77230 -Node: Select from log80319 -Node: Reflog81259 -Node: Diffing81737 -Node: Refreshing diffs84549 -Node: Diff buffer87530 -Node: Diff options89432 -Node: Revision buffer91064 -Node: Ediffing92019 -Node: References buffer95068 -Node: References sections99778 -Node: Bisecting100653 -Node: Visiting blobs102149 -Node: Blaming102658 -Node: Manipulating105978 -Node: Repository setup106270 -Node: Staging and unstaging107310 -Node: Staging from file-visiting buffers109659 -Node: Applying110827 -Node: Committing112470 -Node: Initiating a commit113053 -Node: Editing commit messages116365 -Node: Branching126761 -Node: Merging139048 -Node: Rebasing141132 -Node: Editing rebase sequences144080 -Node: Rebase sequence log147114 -Node: Cherry picking153858 -Node: Reverting155464 -Node: Resetting156827 -Node: Stashing158337 -Node: Transferring161482 -Node: Remotes161720 -Node: Fetching163006 -Node: Pulling163983 -Node: Pushing164709 -Node: Creating and sending patches169038 -Node: Applying patches169733 -Node: Miscellaneous170731 -Node: Tagging171022 -Node: Notes171807 -Node: Submodules174332 -Node: Common commands175652 -Node: Wip modes177400 -Node: Minor mode for buffers visiting files184136 -Node: Minor mode for buffers visiting blobs186279 -Node: Customizing187084 -Node: Per-repository configuration188756 -Node: Essential settings190390 -Node: Safety190714 -Node: Performance193948 -Node: Plumbing200594 -Node: Calling Git201222 -Node: Getting a value from Git202745 -Node: Calling Git for effect205849 -Node: Section plumbing212353 -Node: Creating sections212581 -Node: Section selection216384 -Node: Matching sections218064 -Node: Refreshing buffers223266 -Node: Conventions226401 -Node: Confirmation and completion226578 -Node: Theming Faces227476 -Node: FAQ235627 -Node: Magit is slow236797 -Node: I changed several thousand files at once and now Magit is unusable236998 -Node: I am having problems committing237714 -Node: I don't like how branching and pushing works238167 -Node: I cannot install the pre-requisites for Magit v2238647 -Node: I am using an Emacs release older than v244239121 -Node: I am using a Git release older than v194240734 -Node: I am using MS Windows and cannot push with Magit241721 -Node: How to install the gitman info manual?242300 -Node: How can I show Git's output?244826 -Node: Expanding a file to show the diff causes it to disappear245638 -Node: Point is wrong in the COMMIT_EDITMSG buffer246164 -Node: Can Magit be used as ediff-version-control-package?247182 -Node: How to show diffs for gpg-encrypted files?249206 -Node: Emacs 245 hangs when loading Magit249797 -Node: Keystroke Index250316 -Node: Command Index277507 -Node: Function Index306730 -Node: Variable Index318344 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-20160102.906/AUTHORS.md b/elpa/magit-20160117.2129/AUTHORS.md similarity index 99% rename from elpa/magit-20160102.906/AUTHORS.md rename to elpa/magit-20160117.2129/AUTHORS.md index 8f3761e0..1ca91429 100644 --- a/elpa/magit-20160102.906/AUTHORS.md +++ b/elpa/magit-20160117.2129/AUTHORS.md @@ -238,3 +238,4 @@ Contributors - Yann Hodique - York Zhao - Yuichi Higashi +- Zach Latta diff --git a/elpa/magit-20160102.906/COPYING b/elpa/magit-20160117.2129/COPYING similarity index 100% rename from elpa/magit-20160102.906/COPYING rename to elpa/magit-20160117.2129/COPYING diff --git a/elpa/magit-20160102.906/dir b/elpa/magit-20160117.2129/dir similarity index 100% rename from elpa/magit-20160102.906/dir rename to elpa/magit-20160117.2129/dir diff --git a/elpa/magit-20160102.906/git-rebase.el b/elpa/magit-20160117.2129/git-rebase.el similarity index 100% rename from elpa/magit-20160102.906/git-rebase.el rename to elpa/magit-20160117.2129/git-rebase.el diff --git a/elpa/magit-20160102.906/magit-apply.el b/elpa/magit-20160117.2129/magit-apply.el similarity index 90% rename from elpa/magit-20160102.906/magit-apply.el rename to elpa/magit-20160117.2129/magit-apply.el index 0b6142ae..554a1950 100644 --- a/elpa/magit-20160102.906/magit-apply.el +++ b/elpa/magit-20160117.2129/magit-apply.el @@ -35,6 +35,7 @@ (require 'magit-wip) ;; For `magit-apply' +(declare-function magit-anti-stage 'magit-rockstar) (declare-function magit-am-popup 'magit-sequence) ;; For `magit-discard-files' (declare-function magit-checkout-stage 'magit) @@ -163,18 +164,17 @@ With a prefix argument and if necessary, attempt a 3-way merge." "Add the change at point to the staging area." (interactive) (--when-let (magit-apply--get-selection) - (let ((inhibit-magit-revert t)) - (pcase (list (magit-diff-type) (magit-diff-scope)) - (`(untracked ,_) (magit-stage-untracked)) - (`(unstaged region) (magit-apply-region it "--cached")) - (`(unstaged hunk) (magit-apply-hunk it "--cached")) - (`(unstaged hunks) (magit-apply-hunks it "--cached")) - (`(unstaged file) (magit-stage-1 "-u" (list (magit-section-value it)))) - (`(unstaged files) (magit-stage-1 "-u" (magit-region-values))) - (`(unstaged list) (magit-stage-1 "-u")) - (`(staged ,_) (user-error "Already staged")) - (`(committed ,_) (user-error "Cannot stage committed changes")) - (`(undefined ,_) (user-error "Cannot stage this change")))))) + (pcase (list (magit-diff-type) (magit-diff-scope)) + (`(untracked ,_) (magit-stage-untracked)) + (`(unstaged region) (magit-apply-region it "--cached")) + (`(unstaged hunk) (magit-apply-hunk it "--cached")) + (`(unstaged hunks) (magit-apply-hunks it "--cached")) + (`(unstaged file) (magit-stage-1 "-u" (list (magit-section-value it)))) + (`(unstaged files) (magit-stage-1 "-u" (magit-region-values))) + (`(unstaged list) (magit-stage-1 "-u")) + (`(staged ,_) (user-error "Already staged")) + (`(committed ,_) (user-error "Cannot stage committed changes")) + (`(undefined ,_) (user-error "Cannot stage this change"))))) ;;;###autoload (defun magit-stage-file (file) @@ -212,7 +212,9 @@ ignored) files. (defun magit-stage-1 (arg &optional files) (magit-wip-commit-before-change files " before stage") - (magit-run-git-no-revert "add" arg (if files (cons "--" files) ".")) + (magit-run-git "add" arg (if files (cons "--" files) ".")) + (when magit-auto-revert-mode + (mapc #'magit-turn-on-auto-revert-mode-if-desired files)) (magit-wip-commit-after-apply files " after stage")) (defun magit-stage-untracked () @@ -228,14 +230,15 @@ ignored) files. (push file plain))) (magit-wip-commit-before-change files " before stage") (when plain - (magit-run-git-no-revert "add" "--" plain)) + (magit-run-git "add" "--" plain) + (when magit-auto-revert-mode + (mapc #'magit-turn-on-auto-revert-mode-if-desired plain))) (dolist (repo repos) - (let ((inhibit-magit-revert t)) - (save-excursion - (goto-char (magit-section-start - (magit-get-section - `((file . ,repo) (untracked) (status))))) - (call-interactively 'magit-submodule-add)))) + (save-excursion + (goto-char (magit-section-start + (magit-get-section + `((file . ,repo) (untracked) (status))))) + (call-interactively 'magit-submodule-add))) (magit-wip-commit-after-apply files " after stage"))) ;;;; Unstage @@ -244,18 +247,19 @@ ignored) files. "Remove the change at point from the staging area." (interactive) (--when-let (magit-apply--get-selection) - (let ((inhibit-magit-revert t)) - (pcase (list (magit-diff-type) (magit-diff-scope)) - (`(untracked ,_) (user-error "Cannot unstage untracked changes")) - (`(unstaged ,_) (user-error "Already unstaged")) - (`(staged region) (magit-apply-region it "--reverse" "--cached")) - (`(staged hunk) (magit-apply-hunk it "--reverse" "--cached")) - (`(staged hunks) (magit-apply-hunks it "--reverse" "--cached")) - (`(staged file) (magit-unstage-1 (list (magit-section-value it)))) - (`(staged files) (magit-unstage-1 (magit-region-values))) - (`(staged list) (magit-unstage-all)) - (`(committed ,_) (user-error "Cannot unstage committed changes")) - (`(undefined ,_) (user-error "Cannot unstage this change")))))) + (pcase (list (magit-diff-type) (magit-diff-scope)) + (`(untracked ,_) (user-error "Cannot unstage untracked changes")) + (`(unstaged ,_) (user-error "Already unstaged")) + (`(staged region) (magit-apply-region it "--reverse" "--cached")) + (`(staged hunk) (magit-apply-hunk it "--reverse" "--cached")) + (`(staged hunks) (magit-apply-hunks it "--reverse" "--cached")) + (`(staged file) (magit-unstage-1 (list (magit-section-value it)))) + (`(staged files) (magit-unstage-1 (magit-region-values))) + (`(staged list) (magit-unstage-all)) + (`(committed ,_) (if (bound-and-true-p magit-unstage-use-anti-stage) + (magit-anti-stage) + (user-error "Cannot unstage committed changes"))) + (`(undefined ,_) (user-error "Cannot unstage this change"))))) ;;;###autoload (defun magit-unstage-file (file) diff --git a/elpa/magit-20160102.906/magit-autoloads.el b/elpa/magit-20160117.2129/magit-autoloads.el similarity index 95% rename from elpa/magit-20160102.906/magit-autoloads.el rename to elpa/magit-20160117.2129/magit-autoloads.el index e1a61dd1..5ce48506 100644 --- a/elpa/magit-20160102.906/magit-autoloads.el +++ b/elpa/magit-20160117.2129/magit-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "git-rebase" "git-rebase.el" (22154 38258 0 +;;;### (autoloads nil "git-rebase" "git-rebase.el" (22173 11926 0 ;;;;;; 0)) ;;; Generated autoloads from git-rebase.el @@ -23,7 +23,7 @@ running 'man git-rebase' at the command line) for details. ;;;*** -;;;### (autoloads nil "magit" "magit.el" (22154 38258 0 0)) +;;;### (autoloads nil "magit" "magit.el" (22173 11926 0 0)) ;;; Generated autoloads from magit.el (autoload 'magit-status "magit" "\ @@ -197,6 +197,10 @@ 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" "\ @@ -492,7 +496,7 @@ Git, and Emacs in the echo area. ;;;*** -;;;### (autoloads nil "magit-apply" "magit-apply.el" (22154 38258 +;;;### (autoloads nil "magit-apply" "magit-apply.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-apply.el @@ -529,7 +533,36 @@ Remove all changes from the staging area. ;;;*** -;;;### (autoloads nil "magit-bisect" "magit-bisect.el" (22154 38258 +;;;### (autoloads nil "magit-autorevert" "magit-autorevert.el" (22173 +;;;;;; 11926 0 0)) +;;; Generated autoloads from magit-autorevert.el + +(defvar magit-revert-buffers t) + +(defvar magit-auto-revert-mode (and (not global-auto-revert-mode) magit-revert-buffers) "\ +Non-nil if Magit-Auto-Revert mode is enabled. +See the command `magit-auto-revert-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `magit-auto-revert-mode'.") + +(custom-autoload 'magit-auto-revert-mode "magit-autorevert" nil) + +(autoload 'magit-auto-revert-mode "magit-autorevert" "\ +Toggle Auto-Revert mode in all buffers. +With prefix ARG, enable Magit-Auto-Revert mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Auto-Revert mode is enabled in all buffers where +`magit-turn-on-auto-revert-mode-if-desired' would do it. +See `auto-revert-mode' for more information on Auto-Revert mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "magit-bisect" "magit-bisect.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-bisect.el (autoload 'magit-bisect-popup "magit-bisect" nil t) @@ -581,7 +614,7 @@ bisect run'. ;;;*** -;;;### (autoloads nil "magit-blame" "magit-blame.el" (22154 38258 +;;;### (autoloads nil "magit-blame" "magit-blame.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-blame.el (autoload 'magit-blame-popup "magit-blame" nil t) @@ -606,7 +639,7 @@ only arguments available from `magit-blame-popup' should be used. ;;;*** -;;;### (autoloads nil "magit-commit" "magit-commit.el" (22154 38258 +;;;### (autoloads nil "magit-commit" "magit-commit.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-commit.el @@ -689,7 +722,7 @@ Create a squash commit targeting COMMIT and instantly rebase. ;;;*** -;;;### (autoloads nil "magit-diff" "magit-diff.el" (22154 38258 0 +;;;### (autoloads nil "magit-diff" "magit-diff.el" (22173 11926 0 ;;;;;; 0)) ;;; Generated autoloads from magit-diff.el @@ -755,7 +788,7 @@ for a revision. ;;;*** -;;;### (autoloads nil "magit-ediff" "magit-ediff.el" (22154 38258 +;;;### (autoloads nil "magit-ediff" "magit-ediff.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-ediff.el (autoload 'magit-ediff-popup "magit-ediff" nil t) @@ -836,7 +869,7 @@ Show changes introduced by COMMIT using Ediff. ;;;*** -;;;### (autoloads nil "magit-extras" "magit-extras.el" (22154 38258 +;;;### (autoloads nil "magit-extras" "magit-extras.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-extras.el @@ -907,7 +940,7 @@ on a position in a file-visiting buffer. ;;;*** -;;;### (autoloads nil "magit-log" "magit-log.el" (22154 38258 0 0)) +;;;### (autoloads nil "magit-log" "magit-log.el" (22173 11926 0 0)) ;;; Generated autoloads from magit-log.el (autoload 'magit-log-current "magit-log" "\ @@ -975,7 +1008,7 @@ Show commits in a branch that are not merged in the upstream branch. ;;;*** -;;;### (autoloads nil "magit-remote" "magit-remote.el" (22154 38258 +;;;### (autoloads nil "magit-remote" "magit-remote.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-remote.el @@ -1174,8 +1207,8 @@ is asked to pull. START has to be reachable from that commit. ;;;*** -;;;### (autoloads nil "magit-sequence" "magit-sequence.el" (22154 -;;;;;; 38258 0 0)) +;;;### (autoloads nil "magit-sequence" "magit-sequence.el" (22173 +;;;;;; 11926 0 0)) ;;; Generated autoloads from magit-sequence.el (autoload 'magit-sequencer-continue "magit-sequence" "\ @@ -1323,7 +1356,7 @@ Abort the current rebase operation, restoring the original branch. ;;;*** -;;;### (autoloads nil "magit-stash" "magit-stash.el" (22154 38258 +;;;### (autoloads nil "magit-stash" "magit-stash.el" (22173 11926 ;;;;;; 0 0)) ;;; Generated autoloads from magit-stash.el (autoload 'magit-stash-popup "magit-stash" nil t) @@ -1423,7 +1456,7 @@ Show all diffs of a stash in a buffer. ;;;*** -;;;### (autoloads nil "magit-wip" "magit-wip.el" (22154 38258 0 0)) +;;;### (autoloads nil "magit-wip" "magit-wip.el" (22173 11926 0 0)) ;;; Generated autoloads from magit-wip.el (defvar magit-wip-after-save-mode nil "\ @@ -1489,8 +1522,8 @@ 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") -;;;;;; (22154 38258 437343 0)) +;;;;;; "magit-pkg.el" "magit-popup.el" "magit-process.el" "magit-section.el" +;;;;;; "magit-utils.el") (22173 11926 589100 0)) ;;;*** diff --git a/elpa/magit-20160117.2129/magit-autorevert.el b/elpa/magit-20160117.2129/magit-autorevert.el new file mode 100644 index 00000000..fa7555db --- /dev/null +++ b/elpa/magit-20160117.2129/magit-autorevert.el @@ -0,0 +1,150 @@ +;;; magit-autorevert.el --- revert buffers when files in Git repositories change -*- 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. + +;; 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. + +;;; Code: + +(require 'cl-lib) +(require 'dash) + +(require 'magit-git) + +(require 'autorevert) + +(defcustom magit-auto-revert-tracked-only t + "Whether `magit-auto-revert-mode' only reverts tracked files." + :package-version '(magit . "2.4.0") + :group 'magit + :type 'boolean + :set (lambda (var val) + (set var val) + (when (and (bound-and-true-p magit-auto-revert-mode) + (featurep 'magit-autorevert)) + (magit-auto-revert-mode -1) + (magit-auto-revert-mode)))) + +(defcustom magit-auto-revert-immediately (not file-notify--library) + "Whether Magit reverts buffers immediately. + +If this is non-nil and either `global-auto-revert-mode' or +`magit-auto-revert-mode' is enabled, then Magit immediately +reverts buffers by explicitly calling `auto-revert-buffers' +after running git for side-effects. + +If `auto-revert-use-notify' is non-nil (and file notifications +are actually supported), then `magit-auto-revert-immediately' +should be nil, because the reverts happen immediately anyway. + +If `magit-auto-revert-immediately' and `auto-revert-use-notify' +are both nil, then reverts happen after `auto-revert-interval' +seconds of user inactivity. That is not desirable." + :package-version '(magit . "2.4.0") + :group 'magit + :type 'boolean) + +(defun magit-turn-on-auto-revert-mode-if-desired (&optional file) + (if file + (--when-let (find-buffer-visiting file) + (with-current-buffer it + (magit-turn-on-auto-revert-mode-if-desired))) + (when (and buffer-file-name + (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)))) + +;;;###autoload +(defvar magit-revert-buffers t) +(make-obsolete-variable 'magit-revert-buffers 'magit-auto-revert-mode + "Magit 2.4.0") + +;;;###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 + ;; 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 (not global-auto-revert-mode) magit-revert-buffers)) + +;; `:init-value t' only sets the value of the mode variable +;; but does not cause the mode function to be called. +(cl-eval-when (load eval) + (when magit-auto-revert-mode + (magit-auto-revert-mode))) + +;; If the user has set the obsolete `magit-revert-buffers' to nil +;; after loading magit, then we should still respect that setting. +(defun magit-auto-revert-mode--maybe-turn-off-after-init () + (unless magit-revert-buffers + (magit-auto-revert-mode -1))) +(unless after-init-time + (add-hook 'after-init-hook + #'magit-auto-revert-mode--maybe-turn-off-after-init t)) + +(put 'magit-auto-revert-mode 'function-documentation + "Toggle Magit Auto Revert mode. +With a prefix argument ARG, enable Magit Auto Revert mode if ARG +is positive, and disable it otherwise. If called from Lisp, +enable the mode if ARG is omitted or nil. + +Magit Auto Revert mode is a global minor mode that reverts +buffers associated with a file that is located inside a Git +repository when the file changes on disk. Use `auto-revert-mode' +to revert a particular buffer. Or use `global-auto-revert-mode' +to revert all file-visiting buffers, not just those that visit +a file located inside a Git repository. + +This global mode works by turning on the buffer-local mode +`auto-revert-mode' at the time a buffer is first created. The +local mode is turned on if the visited file is being tracked in +a Git repository at the time when the buffer is created. + +If `magit-auto-revert-tracked-only' is non-nil (the default), +then only tracked files are reverted. But if you stage a +previously untracked file using `magit-stage', then this mode +notices that. + +Unlike `global-auto-revert-mode', this mode never reverts any +buffers that are not visiting files. + +This function calls the hook `magit-auto-revert-mode-hook'.") + +(defun magit-auto-revert-buffers () + (when (and magit-auto-revert-immediately + (or global-auto-revert-mode + (and magit-auto-revert-mode auto-revert-buffer-list))) + (auto-revert-buffers))) + +(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-20160102.906/magit-bisect.el b/elpa/magit-20160117.2129/magit-bisect.el similarity index 100% rename from elpa/magit-20160102.906/magit-bisect.el rename to elpa/magit-20160117.2129/magit-bisect.el diff --git a/elpa/magit-20160102.906/magit-blame.el b/elpa/magit-20160117.2129/magit-blame.el similarity index 100% rename from elpa/magit-20160102.906/magit-blame.el rename to elpa/magit-20160117.2129/magit-blame.el diff --git a/elpa/magit-20160102.906/magit-commit.el b/elpa/magit-20160117.2129/magit-commit.el similarity index 100% rename from elpa/magit-20160102.906/magit-commit.el rename to elpa/magit-20160117.2129/magit-commit.el diff --git a/elpa/magit-20160102.906/magit-core.el b/elpa/magit-20160117.2129/magit-core.el similarity index 98% rename from elpa/magit-20160102.906/magit-core.el rename to elpa/magit-20160117.2129/magit-core.el index a9efd588..ea14dc17 100644 --- a/elpa/magit-20160102.906/magit-core.el +++ b/elpa/magit-20160117.2129/magit-core.el @@ -36,6 +36,7 @@ (require 'magit-mode) (require 'magit-popup) (require 'magit-process) +(require 'magit-autorevert) (defgroup magit nil "Controlling Git from Emacs." diff --git a/elpa/magit-20160102.906/magit-diff.el b/elpa/magit-20160117.2129/magit-diff.el similarity index 99% rename from elpa/magit-20160102.906/magit-diff.el rename to elpa/magit-20160117.2129/magit-diff.el index 51cc3f7a..197a18f1 100644 --- a/elpa/magit-20160102.906/magit-diff.el +++ b/elpa/magit-20160117.2129/magit-diff.el @@ -671,6 +671,7 @@ a \"revA...revB\" range. Otherwise, always construct (magit-get-current-branch))))) (defun magit-diff-setup (rev-or-range const args files) + (require 'magit) (magit-mode-setup #'magit-diff-mode rev-or-range const args files)) ;;;###autoload @@ -952,7 +953,10 @@ which, as the name suggests always visits the actual file." ((or `file `files) (car (magit-section-children current))) (`list (car (magit-section-children (car (magit-section-children current))))))) - (when hunk + (when (and hunk + ;; Currently the `hunk' type is also abused for file + ;; mode changes. Luckily such sections have no value. + (magit-section-value hunk)) (setq line (magit-diff-hunk-line hunk) col (magit-diff-hunk-column hunk))) (setq buffer (if rev diff --git a/elpa/magit-20160102.906/magit-ediff.el b/elpa/magit-20160117.2129/magit-ediff.el similarity index 100% rename from elpa/magit-20160102.906/magit-ediff.el rename to elpa/magit-20160117.2129/magit-ediff.el diff --git a/elpa/magit-20160102.906/magit-extras.el b/elpa/magit-20160117.2129/magit-extras.el similarity index 100% rename from elpa/magit-20160102.906/magit-extras.el rename to elpa/magit-20160117.2129/magit-extras.el diff --git a/elpa/magit-20160102.906/magit-git.el b/elpa/magit-20160117.2129/magit-git.el similarity index 97% rename from elpa/magit-20160102.906/magit-git.el rename to elpa/magit-20160117.2129/magit-git.el index b9e33c3b..79093571 100644 --- a/elpa/magit-20160102.906/magit-git.el +++ b/elpa/magit-20160117.2129/magit-git.el @@ -642,6 +642,10 @@ string \"true\", otherwise return nil." (defun magit-rev-equal (a b) (magit-git-success "diff" "--quiet" a b)) +(defun magit-rev-eq (a b) + (equal (magit-rev-verify a) + (magit-rev-verify b))) + (defun magit-rev-ancestor-p (a b) "Return non-nil if commit A is an ancestor of commit B." (magit-git-success "merge-base" "--is-ancestor" a b)) @@ -1218,7 +1222,8 @@ Return a list of two integers: (A>B B>A)." secondary-default (magit-get-current-branch)))) -(defun magit-read-other-branch (prompt &optional exclude secondary-default) +(defun magit-read-other-branch + (prompt &optional exclude secondary-default no-require-match) (let* ((current (magit-get-current-branch)) (atpoint (magit-branch-at-point)) (exclude (or exclude current)) @@ -1227,7 +1232,8 @@ Return a list of two integers: (A>B B>A)." secondary-default (magit-get-previous-branch)))) (magit-completing-read prompt (delete exclude (magit-list-branch-names)) - nil t nil 'magit-revision-history default))) + nil (not no-require-match) + nil 'magit-revision-history default))) (defun magit-read-other-branch-or-commit (prompt &optional exclude secondary-default) @@ -1242,6 +1248,21 @@ Return a list of two integers: (A>B B>A)." nil nil nil 'magit-revision-history default) (user-error "Nothing selected")))) +(cl-defun magit-read-upstream-branch + (&optional (branch (magit-get-current-branch)) prompt) + (magit-completing-read (or prompt (format "Change upstream of %s to" branch)) + (nconc (--map (concat it "/" branch) + (magit-list-remotes)) + (delete branch (magit-list-branch-names))) + nil nil nil 'magit-revision-history + (or (let ((atpoint (magit-branch-at-point))) + (and (not (equal atpoint branch)) atpoint)) + (magit-branch-p "origin/master") + (and (not (equal branch "master")) + (magit-branch-p "master")) + (let ((previous (magit-get-previous-branch))) + (and (not (equal previous branch)) previous))))) + (defun magit-read-tag (prompt &optional require-match) (magit-completing-read prompt (magit-list-tags) nil require-match nil 'magit-revision-history diff --git a/elpa/magit-20160102.906/magit-log.el b/elpa/magit-20160117.2129/magit-log.el similarity index 98% rename from elpa/magit-20160102.906/magit-log.el rename to elpa/magit-20160117.2129/magit-log.el index 653dffa6..db9071c3 100644 --- a/elpa/magit-20160102.906/magit-log.el +++ b/elpa/magit-20160117.2129/magit-log.el @@ -261,15 +261,15 @@ in the current buffer using the command `magit-toggle-margin'." (defcustom magit-log-section-commit-count 10 "How many recent commits to show in certain log sections. How many recent commits `magit-insert-recent-commits' and -`magit-insert-unpulled-or-recent-commits' (provided there -are no unpulled commits) show." +`magit-insert-unpulled-from-upstream-or-recent' (provided +the upstream isn't ahead of the current branch) show." :package-version '(magit . "2.1.0") :group 'magit-status :type 'number) -(defcustom magit-log-section-arguments '("--decorate") +(defcustom magit-log-section-arguments '("-n256" "--decorate") "The log arguments used in buffers that show other things besides logs." - :package-version '(magit . "2.2.0") + :package-version '(magit . "2.4.0") :group 'magit-log :group 'magit-status :type '(repeat (string :tag "Argument"))) @@ -345,6 +345,7 @@ are no unpulled commits) show." :switches ((?g "Show graph" "--graph") (?c "Show graph in color" "--color") (?d "Show refnames" "--decorate")) + :options ((?n "Limit number of commits" "-n")) :actions ((?g "Refresh" magit-log-refresh) (?t "Toggle margin" magit-toggle-margin) (?s "Set defaults" magit-log-set-default-arguments) nil @@ -514,6 +515,7 @@ representation of the commit at point, are available as completion candidates." (interactive (cons (magit-log-read-revs) (magit-log-arguments))) + (require 'magit) (magit-mode-setup #'magit-log-mode revs args files) (magit-log-goto-same-commit)) @@ -1323,8 +1325,6 @@ Type \\[magit-reset] to reset HEAD to the commit at point. (magit-insert-log (concat it "..") magit-log-section-arguments) (magit-section-cache-visibility))))) -;;;; Auxiliary Log Sections - (defun magit-insert-recent-commits (&optional collapse) "Insert section showing recent commits. Show the last `magit-log-section-commit-count' commits." @@ -1337,17 +1337,20 @@ Show the last `magit-log-section-commit-count' commits." (cons (format "-%d" magit-log-section-commit-count) magit-log-section-arguments))))) -(defun magit-insert-unpulled-or-recent-commits () +(defun magit-insert-unpulled-from-upstream-or-recent () "Insert section showing unpulled or recent commits. If an upstream is configured for the current branch and it is -ahead of the current branch, then show the missing commits, -otherwise show the last `magit-log-section-commit-count' -commits." +ahead of the current branch, then show the commits that have +not yet been pulled into the current branch. If no upstream is +configured or if the upstream is not ahead of the current branch, +then show the last `magit-log-section-commit-count' commits." (if (equal (magit-rev-parse "HEAD") (magit-rev-parse "@{upstream}")) (magit-insert-recent-commits t) (magit-insert-unpulled-from-upstream))) +;;;; Auxiliary Log Sections + (defun magit-insert-unpulled-cherries () "Insert section showing unpulled commits. Like `magit-insert-unpulled-to-upstream' but prefix each commit @@ -1482,6 +1485,10 @@ and the respective options are `magit-log-show-margin' and (apply #'concat strings)))))) ;;; magit-log.el ends soon + +(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 diff --git a/elpa/magit-20160102.906/magit-mode.el b/elpa/magit-20160117.2129/magit-mode.el similarity index 78% rename from elpa/magit-20160102.906/magit-mode.el rename to elpa/magit-20160117.2129/magit-mode.el index a277ac5b..d5c32c6c 100644 --- a/elpa/magit-20160102.906/magit-mode.el +++ b/elpa/magit-20160117.2129/magit-mode.el @@ -38,9 +38,8 @@ ;; For `magit-xref-insert-buttons' from `magit' (defvar magit-diff-show-xref-buttons) (defvar magit-revision-show-xref-buttons) -;; For `magit-revert-buffers' -(declare-function magit-blame-mode 'magit-blame) -(defvar magit-blame-mode) +;; For `magit-refresh' and `magit-refresh-all' +(declare-function magit-auto-revert-buffers 'magit-autorevert) (require 'format-spec) (require 'help-mode) @@ -67,6 +66,33 @@ :options '(magit-maybe-save-repository-buffers magit-maybe-show-margin)) +(defcustom magit-pre-refresh-hook '(magit-maybe-save-repository-buffers) + "Hook run before refreshing in `magit-refresh'. + +This hook, or `magit-post-refresh-hook', should be used +for functions that are not tied to a particular buffer. + +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 + :type 'hook + :options '(magit-maybe-save-repository-buffers)) + +(defcustom magit-post-refresh-hook nil + "Hook run after refreshing in `magit-refresh'. + +This hook, or `magit-pre-refresh-hook', should be used +for functions that are not tied to a particular buffer. + +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 + :type 'hook) + (defcustom magit-display-buffer-function 'magit-display-buffer-traditional "The function used display a Magit buffer. @@ -176,98 +202,19 @@ displayed. Otherwise fall back to regular region highlighting." :group 'magit-modes :type 'hook) -(defvar magit-revert-buffers-timer nil) - -(defun magit-revert-buffers-set-timer () - (when (timerp magit-revert-buffers-timer) - (cancel-timer magit-revert-buffers-timer)) - (setq magit-revert-buffers-timer - (and (boundp 'magit-revert-buffers) - (numberp magit-revert-buffers) - (run-with-timer 0 (abs magit-revert-buffers) - 'magit-revert-buffers-async)))) - -(defcustom magit-revert-buffers 'usage - "How file-visiting buffers in the current repository are reverted. - -After running certain commands, after refreshing the current -Magit buffer, unmodified buffers visiting files belonging to -the current repository may optionally be reverted. - -`nil' Don't revert any buffers. - -`ask' List the buffers which might potentially have to be - reverted and ask the user whether she wants to revert - them. If so, then do it synchronously. - -`t' Revert the buffers synchronously, mentioning each one - as it is being reverted and then also show a summary. - -`usage' Like `t' but include usage information in the summary. - This is the default so that users come here and pick - what is right for them. +(defcustom magit-refresh-status-buffer t + "Whether the status buffer is refreshed after running git. -`silent' Revert the buffers synchronously and be quiet about it. - This (or a negative number) is the recommended setting, - because for the other values the revert messages might - prevent you from seeing other, more important, messages - in the echo area. +When this is non-nil, then the status buffer is automatically +refreshed after running git for side-effects, in addition to the +current Magit buffer, which is always refreshed automatically. -NUMBER An integer or float. Revert the buffers asynchronously. - If NUMBER is positive, then mention each buffer as it is - being reverted. If it is negative, then be quiet about - it. If user input arrives, then stop reverting. After - (the absolute value of) NUMBER seconds resume reverting. - -Also see option `magit-revert-buffers-only-for-tracked-files'." - :package-version '(magit . "2.1.0") - :group 'magit - :type '(choice - (const :tag "Don't revert" nil) - (const :tag "Ask whether to revert" ask) - (const :tag "Revert synchronously" t) - (const :tag "Revert synchronously but in silence" silent) - (const :tag "Revert synchronously with usage information" usage) - (integer :tag "Revert asynchronously (interval in seconds)")) - :set (lambda (var val) - (set-default var val) - (magit-revert-buffers-set-timer))) - -(defcustom magit-revert-buffers-only-for-tracked-files nil - "Whether to revert only buffers that visit tracked files. - -If non-nil, then only tracked files may be reverted. If nil, -then all files in the current repository may potentially be -reverted. Reverting untracked files should be safe and limiting -to only tracked files has the potential of causing very noticable -delays, so the default is to revert all buffers. - -Also see option `magit-revert-buffers'." +Only set this to nil after exhausting all other options to +improve performance." :package-version '(magit . "2.4.0") - :group 'magit + :group 'magit-status :type 'boolean) -(defcustom magit-after-revert-hook '(magit-refresh-vc-mode-line) - "Normal hook for `magit-revert-buffer' to run after reverting. - -This hook is only run for buffers that were actually reverted. -For other buffers `magit-not-reverted-hook' is run instead." - :package-version '(magit . "2.1.0") - :group 'magit-modes - :type 'hook - :options '(magit-refresh-vc-mode-line)) - -(defcustom magit-not-reverted-hook '(magit-refresh-vc-mode-line) - "Normal hook for `magit-revert-buffer' to run instead of reverting. - -This hook is only run for buffers which might have been reverted -but were not actually reverted, because that was not necessary. -For other buffers `magit-after-revert-hook' is run instead." - :package-version '(magit . "2.1.0") - :group 'magit-modes - :type 'hook - :options '(magit-refresh-vc-mode-line)) - (defcustom magit-save-repository-buffers t "Whether to save file-visiting buffers when appropriate. @@ -730,31 +677,27 @@ window." (when (window-live-p window) (delete-window window))))) -;;; Refresh Machinery +;;; Refresh Magit Buffers (defvar inhibit-magit-refresh nil) -(defvar magit-pre-refresh-hook nil) - (defun magit-refresh () "Refresh some buffers belonging to the current repository. Refresh the current buffer if its major mode derives from -`magit-mode', and refresh the corresponding status buffer. - -If option `magit-revert-buffers' call for it, then also revert -all unmodified buffers that visit files being tracked in the -current repository." +`magit-mode', and refresh the corresponding status buffer." (interactive) (unless inhibit-magit-refresh - (run-hooks 'magit-pre-refresh-hook) - (unless (when (derived-mode-p 'magit-mode) - (magit-refresh-buffer) - (derived-mode-p 'magit-status-mode)) - (--when-let (magit-mode-get-buffer 'magit-status-mode) - (with-current-buffer it - (magit-refresh-buffer)))) - (magit-revert-buffers))) + (magit-run-hook-with-benchmark 'magit-pre-refresh-hook) + (when (derived-mode-p 'magit-mode) + (magit-refresh-buffer)) + (--when-let (and magit-refresh-status-buffer + (not (derived-mode-p 'magit-status-mode)) + (magit-mode-get-buffer 'magit-status-mode)) + (with-current-buffer it + (magit-refresh-buffer))) + (magit-auto-revert-buffers) + (magit-run-hook-with-benchmark 'magit-post-refresh-hook))) (defun magit-refresh-all () "Refresh all buffers belonging to the current repository. @@ -766,7 +709,7 @@ tracked in the current repository." (interactive) (dolist (buffer (magit-mode-get-buffers)) (with-current-buffer buffer (magit-refresh-buffer))) - (magit-revert-buffers t)) + (magit-auto-revert-buffers)) (defvar-local magit-refresh-start-time nil) @@ -829,133 +772,7 @@ tracked in the current repository." beg (line-end-position)))) (t t))))))))) -(defvar inhibit-magit-revert nil) -(defvar magit-revert-buffers-backlog nil) - -(defun magit-revert-buffers (&optional force) - "Revert unmodified file-visiting buffers of the current repository. - -If either `magit-revert-buffers' is non-nil and `inhibit-magit-revert' -is nil, or if optional FORCE is non-nil; then revert all unmodified -buffers that visit files being tracked in the current repository. - -When called interactively then the revert is forced." - (interactive (list t)) - (-when-let* ((- (or force - (and magit-revert-buffers - (not inhibit-magit-revert)))) - (topdir (magit-toplevel)) - (buffers (magit-revert-list-modified-buffers topdir)) - (- (or force - (not (eq magit-revert-buffers 'ask)) - (magit-confirm 'revert-buffer - "Revert %s from visited file" - "Revert %i buffers from visited files" - (mapcar #'buffer-name buffers))))) - (if (numberp magit-revert-buffers) - (magit-revert-buffers-async buffers) - (magit-revert-buffers-sync buffers force)))) - -(add-hook 'git-commit-setup-hook #'magit-revert-buffers) - -(defun magit-revert-buffers-sync (buffers force) - (if (eq magit-revert-buffers 'silent) - (mapc #'magit-revert-buffer buffers) - (let ((cnt (length buffers))) - (message "Reverting (up to) %s file-visiting buffer(s)..." cnt) - (setq cnt (length (-non-nil (mapcar #'magit-revert-buffer buffers)))) - (if (> cnt 0) - (let ((s (if (> cnt 1) "s" ""))) - (pcase magit-revert-buffers - (`t - (message "Reverting %s file-visiting buffer%s...done" cnt s)) - (`usage - (message "Reverting %s file-visiting buffer%s...done%s%s%s" cnt s - (substitute-command-keys - "\n This can be undone using `\\[undo]' in the ") - "affected buffers\n Customize behavior using `M-x " - "customize-option RET magit-revert-buffers RET'")) - ((or `nil `ask) - (message "Reverting %s file-visiting buffer%s...done%s" - cnt s (if force " (forced)" ""))))) - (message "(No buffers need to be reverted)"))))) - -(defun magit-revert-buffers-async (&optional buffers) - (setq buffers (nconc buffers (--filter (not (memq it buffers)) - magit-revert-buffers-backlog))) - (while (and buffers (not (input-pending-p))) - (let ((buf (pop buffers))) - (when (buffer-live-p buf) - (with-current-buffer buf - (magit-revert-buffer buf))))) - (setq magit-revert-buffers-backlog buffers)) - -(defun magit-revert-buffer (&optional buffer) - "Revert the current buffer. -If optional BUFFER is non-nil, then revert that instead. -The buffer is expected to visit a file. Return t if the -buffer had to be reverted, nil otherwise." - (with-current-buffer (or buffer (current-buffer)) - (if (and (file-readable-p buffer-file-name) - (not (verify-visited-file-modtime (current-buffer)))) - (if magit-blame-mode - (progn (message "Reverting %s inhibited due to magit-blame-mode" - buffer-file-name) - (run-hooks 'magit-not-reverted-hook) - nil) - (if (or (eq magit-revert-buffers 'silent) - (and (numberp magit-revert-buffers) - (< magit-revert-buffers 0))) - (revert-buffer 'ignore-auto t t) - (message "Reverting buffer `%s'..." (buffer-name)) - (revert-buffer 'ignore-auto t t) - (message "Reverting buffer `%s'...done" (buffer-name))) - (run-hooks 'magit-after-revert-hook) - t) - (run-hooks 'magit-not-reverted-hook) - nil))) - -(defun magit-revert-list-modified-buffers (topdir) - (if magit-revert-buffers-only-for-tracked-files - (let ((tracked (magit-revision-files "HEAD"))) - (if (> (length tracked) - (length (buffer-list))) - (--filter (magit-revert-buffer-p it topdir tracked) - (buffer-list)) - (--keep (find-buffer-visiting (expand-file-name it topdir)) tracked))) - (--filter (magit-revert-buffer-p it topdir) - (buffer-list)))) - -(defun magit-revert-buffer-p (buffer topdir &optional tracked) - (let ((file (buffer-file-name buffer))) - (and file - (equal (file-remote-p file) - (file-remote-p topdir)) - (file-in-directory-p file topdir) - (or (not tracked) - (member (file-relative-name file topdir) tracked))))) - -(defun magit-refresh-vc-mode-line () - "Update `vc-mode' which is displayed in the mode-line. -Like `vc-mode-line' but simpler, more efficient, and less buggy." - (setq vc-mode - (if vc-display-status - (magit-with-toplevel - (let* ((rev (or (magit-get-current-branch) - (magit-rev-parse "--short" "HEAD"))) - (msg (cl-letf (((symbol-function #'vc-working-revision) - (lambda (&rest _) rev))) - (vc-default-mode-line-string - 'Git buffer-file-name)))) - (propertize - (concat " " msg) - 'mouse-face 'mode-line-highlight - 'help-echo (concat (get-text-property 0 'help-echo msg) - "\nCurrent revision: " rev - "\nmouse-1: Version Control menu") - 'local-map vc-mode-line-map))) - " Git")) - (force-mode-line-update)) +;;; Save File-Visiting Buffers (defvar disable-magit-save-buffers nil) @@ -992,7 +809,9 @@ should obviously not add this function to that hook." (defun magit-maybe-save-repository-buffers () "Maybe save file-visiting buffers belonging to the current repository. -Do so if `magit-save-repository-buffers' is non-nil." +Do so if `magit-save-repository-buffers' is non-nil. You should +not remove this from any hooks, instead set that variable to nil +if you so desire." (when (and magit-save-repository-buffers (not disable-magit-save-buffers)) (setq disable-magit-save-buffers t) @@ -1118,6 +937,18 @@ Currently `magit-log-mode', `magit-reflog-mode', (setq magit-refresh-args (cdr args)) (magit-refresh-buffer)) +;;; Utilities + +(defun magit-run-hook-with-benchmark (hook) + (when hook + (if magit-refresh-verbose + (let ((start (current-time))) + (message "Running %s..." hook) + (run-hooks hook) + (message "Running %s...done (%.3fs)" hook + (float-time (time-subtract (current-time) start)))) + (run-hooks hook)))) + ;;; magit-mode.el ends soon (provide 'magit-mode) ;; Local Variables: diff --git a/elpa/magit-20160102.906/magit-pkg.el b/elpa/magit-20160117.2129/magit-pkg.el similarity index 53% rename from elpa/magit-20160102.906/magit-pkg.el rename to elpa/magit-20160117.2129/magit-pkg.el index 3d69675b..091e9cf6 100644 --- a/elpa/magit-20160102.906/magit-pkg.el +++ b/elpa/magit-20160117.2129/magit-pkg.el @@ -1,10 +1,10 @@ -(define-package "magit" "20160102.906" "A Git porcelain inside Emacs" +(define-package "magit" "20160117.2129" "A Git porcelain inside Emacs" '((emacs "24.4") (async "20150909.2257") (dash "20151021.113") - (with-editor "20151111") - (git-commit "20151111") - (magit-popup "20151221")) + (with-editor "20160117.1513") + (git-commit "20160117.1513") + (magit-popup "20160117.1513")) :url "https://github.com/magit/magit" :keywords '("git" "tools" "vc")) ;; Local Variables: diff --git a/elpa/magit-popup-20151223.1341/magit-popup.el b/elpa/magit-20160117.2129/magit-popup.el similarity index 98% rename from elpa/magit-popup-20151223.1341/magit-popup.el rename to elpa/magit-20160117.2129/magit-popup.el index 2a11aa74..78c53539 100644 --- a/elpa/magit-popup-20151223.1341/magit-popup.el +++ b/elpa/magit-20160117.2129/magit-popup.el @@ -1,6 +1,6 @@ ;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- -;; Copyright (C) 2010-2015 The Magit Project Contributors +;; 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. @@ -85,6 +85,16 @@ ;;;; 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. @@ -1018,9 +1028,7 @@ restored." (defun magit-popup-mode-display-buffer (buffer mode) (let ((winconf (current-window-configuration))) - (split-window-vertically) - (other-window 1) - (switch-to-buffer buffer) + (select-window (display-buffer buffer magit-popup-display-buffer-action)) (funcall mode) (setq magit-popup-previous-winconf winconf))) diff --git a/elpa/magit-20160102.906/magit-process.el b/elpa/magit-20160117.2129/magit-process.el similarity index 93% rename from elpa/magit-20160102.906/magit-process.el rename to elpa/magit-20160117.2129/magit-process.el index 2582e603..2130df20 100644 --- a/elpa/magit-20160102.906/magit-process.el +++ b/elpa/magit-20160117.2129/magit-process.el @@ -56,9 +56,11 @@ If t, use ptys: this enables Magit to prompt for passphrases when needed." (defcustom magit-need-cygwin-noglob (equal "x0\n" (with-temp-buffer - (process-file magit-git-executable - nil (current-buffer) nil - "-c" "alias.echo=!echo" "echo" "x{0}") + (let ((process-environment + (append magit-git-environment process-environment))) + (process-file magit-git-executable + nil (current-buffer) nil + "-c" "alias.echo=!echo" "echo" "x{0}")) (buffer-string))) "Whether to use a workaround for Cygwin's globbing behavior. @@ -99,8 +101,10 @@ When this is nil, no sections are ever removed." ;; Note: `magit-process-file' is not yet defined when ;; evaluating this form, so we use `process-lines'. (ignore-errors - (process-lines magit-git-executable - "config" "--get-all" "credential.helper"))) + (let ((process-environment + (append magit-git-environment process-environment))) + (process-lines magit-git-executable + "config" "--get-all" "credential.helper")))) "If non-nil, start a credential cache daemon using this socket. When using Git's cache credential helper in the normal way, Emacs @@ -262,30 +266,12 @@ before use. After Git returns, the current buffer (if it is a Magit buffer) as well as the current repository's status buffer are refreshed. -Unmodified buffers visiting files that are tracked in the current -repository are reverted if `magit-revert-buffers' is non-nil. Process output goes into a new section in the buffer returned by `magit-process-buffer'." (magit-call-git args) (magit-refresh)) -(defun magit-run-git-no-revert (&rest args) - "Call Git synchronously in a separate process, and refresh. - -Option `magit-git-executable' specifies the Git executable and -option `magit-git-global-arguments' specifies constant arguments. -The arguments ARGS specify arguments to Git, they are flattened -before use. - -After Git returns, the current buffer (if it is a Magit buffer) -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'." - (let ((inhibit-magit-revert t)) - (magit-run-git args))) - (defvar magit-pre-call-git-hook nil) (defun magit-call-git (&rest args) @@ -345,8 +331,6 @@ flattened before use. After Git returns, the current buffer (if it is a Magit buffer) as well as the current repository's status buffer are refreshed. -Unmodified buffers visiting files that are tracked in the current -repository are reverted if `magit-revert-buffers' is non-nil. When INPUT is nil then do not refresh any buffers. This function actually starts a asynchronous process, but it then @@ -379,8 +363,6 @@ Display the command line arguments in the echo area. After Git returns some buffers are refreshed: the buffer that was current when this function was called (if it is a Magit buffer and still alive), as well as the respective Magit status buffer. -Unmodified buffers visiting files that are tracked in the current -repository are reverted if `magit-revert-buffers' is non-nil. See `magit-start-process' for more information." (message "Running %s %s" magit-git-executable @@ -389,20 +371,6 @@ See `magit-start-process' for more information." m)) (magit-start-git nil args)) -(defun magit-run-git-async-no-revert (&rest args) - "Start Git, prepare for refresh, and return the process object. -ARGS is flattened and then used as arguments to Git. - -Display the command line arguments in the echo area. - -After Git returns some buffers are refreshed: the buffer that was -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' for more information." - (let ((inhibit-magit-revert t)) - (magit-run-git-async args))) - (defun magit-run-git-with-editor (&rest args) "Export GIT_EDITOR and start Git. Also prepare for refresh and return the process object. @@ -416,8 +384,7 @@ and still alive), as well as the respective Magit status buffer. See `magit-start-process' and `with-editor' for more information." (with-editor "GIT_EDITOR" - (let ((magit-process-popup-time -1) - (inhibit-magit-revert nil)) + (let ((magit-process-popup-time -1)) (magit-run-git-async args)))) (defun magit-run-git-sequencer (&rest args) @@ -433,9 +400,6 @@ and still alive), as well as the respective Magit status buffer. If the sequence stops at a commit, make the section representing that commit the current section by moving `point' there. -Unmodified buffers visiting files that are tracked in the current -repository are reverted if `magit-revert-buffers' is non-nil. - See `magit-start-process' and `with-editor' for more information." (with-editor "GIT_EDITOR" (let ((magit-process-popup-time -1)) @@ -460,8 +424,6 @@ flattened before use. After Git returns some buffers are refreshed: the buffer that was current when this function was called (if it is a Magit buffer and still alive), as well as the respective Magit status buffer. -Unmodified buffers visiting files that are tracked in the current -repository are reverted if `magit-revert-buffers' is non-nil. See `magit-start-process' for more information." (run-hooks 'magit-pre-start-git-hook) @@ -485,9 +447,7 @@ the sentinel and filter. After the process returns, `magit-process-sentinel' refreshes the buffer that was current when `magit-start-process' was called (if it is a Magit buffer and still alive), as well as the respective -Magit status buffer. Unmodified buffers visiting files that are -tracked in the current repository are reverted if -`magit-revert-buffers' is non-nil." +Magit status buffer." (-let* (((process-buf . section) (magit-process-setup program args)) (process @@ -508,8 +468,6 @@ tracked in the current repository are reverted if (process-put process 'default-dir default-directory) (when inhibit-magit-refresh (process-put process 'inhibit-refresh t)) - (when inhibit-magit-revert - (process-put process 'inhibit-revert t)) (setf (magit-section-process section) process) (with-current-buffer process-buf (set-marker (process-mark process) (point))) @@ -592,8 +550,7 @@ tracked in the current repository are reverted if (when (eq process magit-this-process) (setq magit-this-process nil)) (unless (process-get process 'inhibit-refresh) - (let ((inhibit-magit-revert (process-get process 'inhibit-revert)) - (command-buf (process-get process 'command-buf))) + (let ((command-buf (process-get process 'command-buf))) (if (buffer-live-p command-buf) (with-current-buffer command-buf (magit-refresh)) diff --git a/elpa/magit-20160102.906/magit-remote.el b/elpa/magit-20160117.2129/magit-remote.el similarity index 94% rename from elpa/magit-20160102.906/magit-remote.el rename to elpa/magit-20160117.2129/magit-remote.el index 3cb6b022..ea4ecacf 100644 --- a/elpa/magit-20160102.906/magit-remote.el +++ b/elpa/magit-20160117.2129/magit-remote.el @@ -63,7 +63,8 @@ Then show the status buffer for the new repository." (when (or (eq magit-clone-set-remote.pushDefault t) (and magit-clone-set-remote.pushDefault (y-or-n-p "Set `remote.pushDefault' to \"origin\"? "))) - (magit-call-git "config" "remote.pushDefault" "origin")) + (let ((default-directory directory)) + (magit-call-git "config" "remote.pushDefault" "origin"))) (message "Cloning %s...done" repository) (magit-status-internal directory))) @@ -159,7 +160,7 @@ the variable isn't already set." (defun magit-git-fetch (remote args) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "fetch" remote args)) + (magit-run-git-async "fetch" remote args)) ;;;###autoload (defun magit-fetch-from-pushremote (args) @@ -193,7 +194,7 @@ the variable isn't already set." "Fetch from all remotes." (interactive (list (magit-fetch-arguments))) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "remote" "update" args)) + (magit-run-git-async "remote" "update" args)) ;;;###autoload (defun magit-fetch-all-prune () @@ -202,14 +203,14 @@ Prune remote tracking branches for branches that have been removed on the respective remote." (interactive) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "remote" "update" "--prune")) + (magit-run-git-async "remote" "update" "--prune")) ;;;###autoload (defun magit-fetch-all-no-prune () "Fetch from all remotes." (interactive) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "remote" "update")) + (magit-run-git-async "remote" "update")) ;;; Pull @@ -381,9 +382,8 @@ removed after restarting Emacs." (run-hooks 'magit-credential-hook) (-let [(remote . target) (magit-split-branch-name target)] - (magit-run-git-async-no-revert "push" "-v" args remote - (format "%s:refs/heads/%s" - branch target)))) + (magit-run-git-async "push" "-v" args remote + (format "%s:refs/heads/%s" branch target)))) ;;;###autoload (defun magit-push-current-to-pushremote (args &optional push-remote) @@ -436,20 +436,11 @@ upstream can be changed before pushed to it." (interactive (list (magit-push-arguments) (and (magit--push-current-set-upstream-p current-prefix-arg) - (let ((branch (magit-get-current-branch))) - (magit-read-other-branch - (format "Set upstream of %s and push there" branch) - nil (or (magit-branch-p "origin/master") - (and (not (equal branch "master")) - (magit-branch-p "master")))))))) + (magit-read-upstream-branch)))) (--if-let (magit-get-current-branch) (progn (when upstream - (-let (((remote . merge) (magit-split-branch-name upstream)) - (branch (magit-get-current-branch))) - (magit-call-git "config" (format "branch.%s.remote" branch) remote) - (magit-call-git "config" (format "branch.%s.merge" branch) - (concat "refs/heads/" merge)))) + (magit-set-branch*merge/remote it upstream)) (-if-let (target (magit-get-upstream-branch it)) (magit-git-push it target args) (user-error "No upstream is configured for %s" it))) @@ -500,7 +491,7 @@ If just one exists, use that without requiring confirmation." (interactive (list (magit-read-remote "Push matching branches to" nil t) (magit-push-arguments))) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "push" "-v" args remote ":")) + (magit-run-git-async "push" "-v" args remote ":")) ;;;###autoload (defun magit-push-tags (remote &optional args) @@ -511,7 +502,7 @@ branch as default." (interactive (list (magit-read-remote "Push tags to remote" nil t) (magit-push-arguments))) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "push" remote "--tags" args)) + (magit-run-git-async "push" remote "--tags" args)) ;;;###autoload (defun magit-push-tag (tag remote &optional args) @@ -521,7 +512,7 @@ branch as default." (list tag (magit-read-remote (format "Push %s to remote" tag) nil t) (magit-push-arguments)))) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "push" remote tag args)) + (magit-run-git-async "push" remote tag args)) ;;;###autoload (defun magit-push-implicitly (args) @@ -546,7 +537,7 @@ 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) - (magit-run-git-async-no-revert "push" "-v" args)) + (magit-run-git-async "push" "-v" args)) (defun magit-push-implicitly--desc () (let ((default (magit-get "push.default"))) @@ -596,7 +587,7 @@ To add this command to the push popup add this to your init file: (interactive (list (magit-read-remote "Push to remote") (magit-push-arguments))) (run-hooks 'magit-credential-hook) - (magit-run-git-async-no-revert "push" "-v" args remote)) + (magit-run-git-async "push" "-v" args remote)) (defun magit-push-to-remote--desc () (format "using %s\n" (propertize "git push " 'face 'bold))) @@ -640,7 +631,7 @@ HEAD but not from the specified commit)." range (format "%s~..%s" range range)))) (magit-patch-arguments))) - (magit-run-git-no-revert "format-patch" range args)) + (magit-run-git "format-patch" range args)) ;;;###autoload (defun magit-request-pull (url start end) @@ -659,8 +650,7 @@ is asked to pull. START has to be reachable from that commit." (compose-mail) (setq default-directory dir)) (message-goto-body) - (let ((inhibit-magit-revert t)) - (magit-git-insert "request-pull" start url end)) + (magit-git-insert "request-pull" start url end) (set-buffer-modified-p nil)) ;;; magit-remote.el ends soon diff --git a/elpa/magit-20160102.906/magit-section.el b/elpa/magit-20160117.2129/magit-section.el similarity index 100% rename from elpa/magit-20160102.906/magit-section.el rename to elpa/magit-20160117.2129/magit-section.el diff --git a/elpa/magit-20160102.906/magit-sequence.el b/elpa/magit-20160117.2129/magit-sequence.el similarity index 100% rename from elpa/magit-20160102.906/magit-sequence.el rename to elpa/magit-20160117.2129/magit-sequence.el diff --git a/elpa/magit-20160102.906/magit-stash.el b/elpa/magit-20160117.2129/magit-stash.el similarity index 100% rename from elpa/magit-20160102.906/magit-stash.el rename to elpa/magit-20160117.2129/magit-stash.el diff --git a/elpa/magit-20160102.906/magit-utils.el b/elpa/magit-20160117.2129/magit-utils.el similarity index 100% rename from elpa/magit-20160102.906/magit-utils.el rename to elpa/magit-20160117.2129/magit-utils.el diff --git a/elpa/magit-20160102.906/magit-wip.el b/elpa/magit-20160117.2129/magit-wip.el similarity index 100% rename from elpa/magit-20160102.906/magit-wip.el rename to elpa/magit-20160117.2129/magit-wip.el diff --git a/elpa/magit-20160102.906/magit.el b/elpa/magit-20160117.2129/magit.el similarity index 97% rename from elpa/magit-20160102.906/magit.el rename to elpa/magit-20160117.2129/magit.el index 06ace1a7..5eba15eb 100644 --- a/elpa/magit-20160102.906/magit.el +++ b/elpa/magit-20160117.2129/magit.el @@ -16,7 +16,7 @@ ;; Rémi Vanicat ;; Yann Hodique -;; Package-Requires: ((emacs "24.4") (async "20150909.2257") (dash "20151021.113") (with-editor "20151111") (git-commit "20151111") (magit-popup "20151221")) +;; Package-Requires: ((emacs "24.4") (async "20150909.2257") (dash "20151021.113") (with-editor "20160117.1513") (git-commit "20160117.1513") (magit-popup "20160117.1513")) ;; Keywords: git tools vc ;; Homepage: https://github.com/magit/magit @@ -129,11 +129,28 @@ at all." :group 'magit-status :type 'hook) -(defcustom magit-status-refresh-hook nil - "Hook run after a status buffer has been refreshed." - :package-version '(magit . "2.1.0") - :group 'magit-status - :type 'hook) +(defvar magit-status-refresh-hook nil + "Hook run after a status buffer has been refreshed.") + +(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") (defcustom magit-status-expand-stashes t "Whether the list of stashes is expanded initially." @@ -141,6 +158,16 @@ at all." :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 @@ -496,6 +523,8 @@ detached `HEAD'." (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) @@ -515,6 +544,9 @@ detached `HEAD'." (if (magit-get-boolean "branch" branch "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 @@ -532,6 +564,9 @@ detached `HEAD'." (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) "")) @@ -1369,7 +1404,7 @@ of the new branch, instead of the starting-point itself." (magit-call-git "branch" "--set-upstream-to" it branch)) (when (and (setq tracked (magit-get-upstream-branch current)) (setq base (magit-git-string "merge-base" current tracked)) - (not (magit-rev-equal base current))) + (not (magit-rev-eq base current))) (magit-call-git "update-ref" "-m" (format "reset: moving to %s" base) (concat "refs/heads/" current) base)) @@ -1496,7 +1531,7 @@ With prefix, forces the rename even if NEW already exists. (magit-read-string-ns (format "Rename branch '%s' to" branch)) current-prefix-arg))) (unless (string= old new) - (magit-run-git-no-revert "branch" (if force "-M" "-m") old new))) + (magit-run-git "branch" (if force "-M" "-m") old new))) ;;;;; Branch Variables @@ -1545,21 +1580,26 @@ 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." +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 (or (and (not current-prefix-arg) (magit-get-current-branch)) (magit-read-local-branch "Change upstream of branch")))) (list branch (and (not (magit-get-upstream-branch branch)) - (magit-read-other-branch - (format "Change upstream of %s to" branch) - nil (or (magit-branch-p "origin/master") - (and (not (equal branch "master")) - (magit-branch-p "master")))))))) + (magit-read-upstream-branch))))) (if upstream - (magit-run-git-no-revert - "branch" (concat "--set-upstream-to=" upstream) branch) - (magit-run-git-no-revert "branch" "--unset-upstream" branch))) + (-let (((remote . merge) (magit-split-branch-name upstream)) + (branch (magit-get-current-branch))) + (magit-call-git "config" (format "branch.%s.remote" branch) remote) + (magit-call-git "config" (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 (or (magit-get-current-branch) "")) @@ -2048,7 +2088,7 @@ defaulting to the tag at point. (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-no-revert "tag" "-d" tags)) + (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." @@ -2072,8 +2112,7 @@ defaulting to the tag at point. (when tags (magit-call-git "tag" "-d" tags)) (when remote-tags - (magit-run-git-async-no-revert - "push" remote (--map (concat ":" it) remote-tags)))) + (magit-run-git-async "push" remote (--map (concat ":" it) remote-tags)))) ;;;; Notes @@ -2173,12 +2212,12 @@ of Git's `note' command, default to operate on that ref." it))) current-prefix-arg)) (if ref - (magit-run-git-no-revert "config" (and global "--global") "core.notesRef" - (if (string-prefix-p "refs/" ref) - ref - (concat "refs/notes/" ref))) - (magit-run-git-no-revert "config" (and global "--global") - "--unset" "core.notesRef"))) + (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\". @@ -2202,8 +2241,7 @@ the current repository." (magit-git-success "config" "--unset-all" global "notes.displayRef") (dolist (ref refs) (magit-call-git "config" "--add" global "notes.displayRef" ref)) - (let ((inhibit-magit-revert t)) - (magit-refresh))) + (magit-refresh)) (defun magit-notes-read-args (prompt) (list (magit-read-branch-or-commit prompt) diff --git a/elpa/magit-20160117.2129/magit.info b/elpa/magit-20160117.2129/magit.info new file mode 100644 index 00000000..8d5f70cd --- /dev/null +++ b/elpa/magit-20160117.2129/magit.info @@ -0,0 +1,163 @@ +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: 309520 + +Tag Table: +(Indirect) +Node: Top1222 +Node: Introduction5928 +Node: Installation10621 +Node: Updating from an older release10996 +Node: Installing from an Elpa archive12591 +Node: Installing from the Git repository14149 +Node: Post-installation tasks16388 +Node: Getting started17777 +Node: Interface concepts23512 +Node: Modes and Buffers23786 +Node: Switching Buffers25532 +Node: Naming Buffers28596 +Node: Quitting Windows31431 +Node: Automatic Refreshing of Magit Buffers33063 +Node: Automatic Saving of File-Visiting Buffers35831 +Node: Automatic Reverting of File-Visiting Buffers37016 +Node: Risk of Reverting Automatically40866 +Node: Sections43249 +Node: Section movement44190 +Node: Section visibility48117 +Node: Section hooks51708 +Node: Section types and values53989 +Node: Section options55259 +Node: Popup buffers and prefix commands55731 +Node: Completion and confirmation57045 +Node: Running Git59951 +Node: Viewing Git output60187 +Node: Running Git manually61187 +Node: Git executable63313 +Node: Global Git arguments65320 +Node: Inspecting66127 +Node: Status buffer67254 +Node: Status sections69777 +Node: Status header sections74524 +Node: Status options77083 +Node: Logging77807 +Node: Refreshing logs80174 +Node: Log Buffer81559 +Node: Select from log84648 +Node: Reflog85588 +Node: Diffing86066 +Node: Refreshing diffs88878 +Node: Diff buffer91859 +Node: Diff options93761 +Node: Revision buffer95393 +Node: Ediffing96348 +Node: References buffer99397 +Node: References sections104107 +Node: Bisecting104982 +Node: Visiting blobs106478 +Node: Blaming106987 +Node: Manipulating110307 +Node: Repository setup110599 +Node: Staging and unstaging111639 +Node: Staging from file-visiting buffers113988 +Node: Applying115156 +Node: Committing116799 +Node: Initiating a commit117382 +Node: Editing commit messages120694 +Node: Branching131090 +Node: Merging143379 +Node: Rebasing145463 +Node: Editing rebase sequences148411 +Node: Rebase sequence log151445 +Node: Cherry picking158189 +Node: Reverting159795 +Node: Resetting161158 +Node: Stashing162668 +Node: Transferring165813 +Node: Remotes166051 +Node: Fetching167337 +Node: Pulling168314 +Node: Pushing169040 +Node: Creating and sending patches173369 +Node: Applying patches174064 +Node: Miscellaneous175062 +Node: Tagging175353 +Node: Notes176138 +Node: Submodules178663 +Node: Common commands179983 +Node: Wip modes181731 +Node: Minor mode for buffers visiting files188467 +Node: Minor mode for buffers visiting blobs190610 +Node: Customizing191415 +Node: Per-repository configuration193087 +Node: Essential settings194721 +Node: Safety195045 +Node: Performance196878 +Node: Plumbing202144 +Node: Calling Git202772 +Node: Getting a value from Git204295 +Node: Calling Git for effect207399 +Node: Section plumbing213903 +Node: Creating sections214131 +Node: Section selection217934 +Node: Matching sections219614 +Node: Refreshing buffers224816 +Node: Conventions227951 +Node: Confirmation and completion228128 +Node: Theming Faces229026 +Node: FAQ237177 +Node: Magit is slow238510 +Node: I changed several thousand files at once and now Magit is unusable238711 +Node: I am having problems committing239427 +Node: I don't understand how branching and pushing work239885 +Node: I don't like the key binding in v24240254 +Node: I cannot install the pre-requisites for Magit v2240593 +Node: I am using an Emacs release older than v244241058 +Node: I am using a Git release older than v194242671 +Node: I am using MS Windows and cannot push with Magit243658 +Node: How to install the gitman info manual?244237 +Node: How can I show Git's output?246765 +Node: Expanding a file to show the diff causes it to disappear247577 +Node: Point is wrong in the COMMIT_EDITMSG buffer248103 +Node: Can Magit be used as ediff-version-control-package?249121 +Node: How to show diffs for gpg-encrypted files?251145 +Node: Emacs 245 hangs when loading Magit251736 +Node: Symbol's value as function is void --some252305 +Node: Where is the branch manager252625 +Node: Keystroke Index252910 +Node: Command Index280119 +Node: Function Index309520 +Node: Variable Index321303 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/magit-20160102.906/magit.info-1 b/elpa/magit-20160117.2129/magit.info-1 similarity index 94% rename from elpa/magit-20160102.906/magit.info-1 rename to elpa/magit-20160117.2129/magit.info-1 index cddf7923..07bd6cf1 100644 --- a/elpa/magit-20160102.906/magit.info-1 +++ b/elpa/magit-20160117.2129/magit.info-1 @@ -80,8 +80,6 @@ Installation Interface concepts * Modes and Buffers:: -* Automatic save:: -* Automatic refresh and revert:: * Sections:: * Popup buffers and prefix commands:: * Completion and confirmation:: @@ -92,6 +90,9 @@ Modes and Buffers * Switching Buffers:: * Naming Buffers:: * Quitting Windows:: +* Automatic Refreshing of Magit Buffers:: +* Automatic Saving of File-Visiting Buffers:: +* Automatic Reverting of File-Visiting Buffers:: Sections @@ -231,7 +232,8 @@ FAQ * Magit is slow:: * I changed several thousand files at once and now Magit is unusable:: * I am having problems committing:: -* I don't like how branching and pushing works:: +* 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. @@ -243,6 +245,8 @@ FAQ * 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::  @@ -441,7 +445,7 @@ manually from its development repository, but I won’t cover that here. Then clone the Magit repository: - $ git clone git://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit + $ git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit $ cd ~/.emacs.d/site-lisp/magit Then compile the libraries and generate the info manuals: @@ -501,7 +505,7 @@ outdated value for ‘load-path’. should display something like - Magit 2.2.0, Git 2.4.2, Emacs 24.5.1 + Magit 2.4.0, Git 2.7.0, Emacs 24.5.1 Then you might also want to read about options that many users likely want to customize. See *note Essential settings: Essential settings. @@ -516,10 +520,7 @@ install the gitman info manual?. Getting started. If you have used an older Magit release before, then you should have -a look at the release notes - -and - +a look at the release notes . And last but not least please consider making a donation, to ensure that I can keep working on Magit. See @@ -644,15 +645,13 @@ File: magit.info, Node: Interface concepts, Next: Inspecting, Prev: Getting s * Menu: * Modes and Buffers:: -* Automatic save:: -* Automatic refresh and revert:: * Sections:: * Popup buffers and prefix commands:: * Completion and confirmation:: * Running Git::  -File: magit.info, Node: Modes and Buffers, Next: Automatic save, Up: Interface concepts +File: magit.info, Node: Modes and Buffers, Next: Sections, Up: Interface concepts 4.1 Modes and Buffers ===================== @@ -692,6 +691,9 @@ buffers whose major-modes derive from ‘magit-mode’. * Switching Buffers:: * Naming Buffers:: * Quitting Windows:: +* Automatic Refreshing of Magit Buffers:: +* Automatic Saving of File-Visiting Buffers:: +* Automatic Reverting of File-Visiting Buffers::  File: magit.info, Node: Switching Buffers, Next: Naming Buffers, Up: Modes and Buffers @@ -842,7 +844,7 @@ File: magit.info, Node: Naming Buffers, Next: Quitting Windows, Prev: Switchi control how buffer names are uniquified.  -File: magit.info, Node: Quitting Windows, Prev: Naming Buffers, Up: Modes and Buffers +File: magit.info, Node: Quitting Windows, Next: Automatic Refreshing of Magit Buffers, Prev: Naming Buffers, Up: Modes and Buffers 4.1.3 Quitting Windows ---------------------- @@ -883,10 +885,77 @@ File: magit.info, Node: Quitting Windows, Prev: Naming Buffers, Up: Modes and that was ever displayed in the window, then that is deleted.  -File: magit.info, Node: Automatic save, Next: Automatic refresh and revert, Prev: Modes and Buffers, Up: Interface concepts +File: magit.info, Node: Automatic Refreshing of Magit Buffers, Next: Automatic Saving of File-Visiting Buffers, Prev: Quitting Windows, Up: Modes and Buffers -4.2 Automatic save -================== +4.1.4 Automatic Refreshing of Magit Buffers +------------------------------------------- + +After running a command which may change the state of the current +repository, the current Magit buffer and the corresponding status buffer +are refreshed. The status buffer may optionally be automatically +refreshed whenever a buffer is saved to a file inside the respective +repository. + + Automatically refreshing Magit buffers ensures that the displayed +information is up-to-date most of the time but can lead to a noticeable +delay in big repositories. Other Magit buffers are not refreshed to +keep the delay to a minimum and also because doing so can sometimes be +undesirable. + + Buffers can also be refreshed explicitly, which is useful in buffers +that weren’t current during the last refresh and after changes were made +to the repository outside of Magit. + +‘g’ (‘magit-refresh’) + + This command refreshes the current buffer if its major mode derives + from ‘magit-mode’ as well as the corresponding status buffer. + + If the option ‘magit-revert-buffers’ calls for it, then it also + reverts all unmodified buffers that visit files being tracked in + the current repository. + +‘G’ (‘magit-refresh-all’) + + This command refreshes all Magit buffers belonging to the current + repository and also reverts all unmodified buffers that visit files + being tracked in the current repository. + + The file-visiting buffers are always reverted, even if + ‘magit-revert-buffers’ is nil. + + -- User Option: magit-refresh-buffer-hook + + This hook is run in each Magit buffer that was refreshed during the + current refresh - normally the current buffer and the status + buffer. + + -- User Option: magit-refresh-status-buffer + + When this option is non-nil, then the status buffer is + automatically refreshed after running git for side-effects, in + addition to the current Magit buffer, which is always refreshed + automatically. + + Only set this to nil after exhausting all other options to improve + performance. + + -- Function: magit-after-save-refresh-status + + This function is intended to be added to ‘after-save-hook’. After + doing that the corresponding status buffer is refreshed whenever a + buffer is saved to a file inside a repository. + + Note that refreshing a Magit buffer is done by re-creating its + contents from scratch, which can be slow in large repositories. If + you are not satisfied with Magit’s performance, then you should + obviously not add this function to that hook. + + +File: magit.info, Node: Automatic Saving of File-Visiting Buffers, Next: Automatic Reverting of File-Visiting Buffers, Prev: Automatic Refreshing of Magit Buffers, Up: Modes and Buffers + +4.1.5 Automatic Saving of File-Visiting Buffers +----------------------------------------------- File-visiting buffers are by default saved at certain points in time. This doesn’t guarantee that Magit buffers are always up-to-date, but, @@ -908,140 +977,146 @@ explicitly. confirm each save.  -File: magit.info, Node: Automatic refresh and revert, Next: Sections, Prev: Automatic save, Up: Interface concepts +File: magit.info, Node: Automatic Reverting of File-Visiting Buffers, Prev: Automatic Saving of File-Visiting Buffers, Up: Modes and Buffers -4.3 Automatic refresh and revert -================================ +4.1.6 Automatic Reverting of File-Visiting Buffers +-------------------------------------------------- -After running a command which may change the state of the current -repository, the current Magit buffer and the corresponding status buffer -are refreshed. Status buffer may optionally be automatically refreshed -whenever a buffer is saved to a file inside the respective repository. +By default Magit automatically reverts buffers that are visiting files +that are being tracked in a Git repository, after they have changed on +disk. When using Magit one often changes files on disk by running git, +i.e. "outside Emacs", making this a rather important feature. - Automatically refreshing Magit buffers ensures that the displayed -information is up-to-date most of the time but can lead to a noticeable -delay in big repositories. Other Magit buffers are not refreshed to -keep the delay to a minimum and also because doing so can sometimes be -undesirable. + For example, if you discard a change in the status buffer, then that +is done by running ‘git apply --reverse ...’, and Emacs considers the +file to have "change on disk". If Magit did not automaticallyrevert the +buffer, then you would have to type ‘M-x revert-buffer RET RET’ in the +visiting buffer before you could continue making changes. - -- User Option: magit-revert-buffers + -- User Option: magit-auto-revert-mode - This option controls if and how file-visiting buffers in the - current repository are reverted. + When this mode is enabled, then buffers that visit tracked files, + are automatically reverted after the visited files changed on disk. - Unmodified buffers visiting files belonging to the current - repository may be reverted after refreshing the current Magit - buffer and after running certain other commands. + -- User Option: global-auto-revert-mode - • ‘nil’ + When this mode is enabled, then any file-visiting buffer is + automatically reverted after the visited file changed on disk. - Don’t revert any buffers. + If you like buffers that visit tracked files to be automatically + reverted, then you might also like any buffer to be reverted, not + just those visiting tracked files. If that is the case, then + enable this mode _instead of_ ‘magit-auto-revert-mode’. - • ‘ask’ + -- User Option: magit-auto-revert-immediately - List the buffers which might potentially have to be reverted - and ask the user whether she wants to revert them. If so, - then do it synchronously. + This option controls whether Magit reverts buffers immediately. - • ‘t’ + If this is non-nil and either ‘global-auto-revert-mode’ or + ‘magit-auto-revert-mode’ is enabled, then Magit immediately reverts + buffers by explicitly calling ‘auto-revert-buffers’ after running + git for side-effects. - Revert the buffers synchronously, mentioning each one as it is - being reverted and then also show a summary in the echo area. + If ‘auto-revert-use-notify’ is non-nil (and file notifications are + actually supported), then ‘magit-auto-revert-immediately’ should be + set to nil, because the reverts happen immediately anyway. - • ‘usage’ + If ‘magit-auto-revert-immediately’ and ‘auto-revert-use-notify’ are + both nil, then reverts happen after ‘auto-revert-interval’ seconds + of user inactivity. That is not desirable. - Like ‘t’ but include usage information in the summary. This - is the default so that users come here and pick what is right - for them. + -- User Option: auto-revert-use-notify - • ‘silent’ + This option controls whether file notification functions should be + used. Note that this variable unfortunately defaults to ‘t’ even + on systems on which file notifications cannot be used. - Revert the buffers synchronously and be quiet about it. + -- User Option: magit-auto-revert-tracked-only - This (or a negative number) is the recommended setting, - because for the other values the revert messages might prevent - you from seeing other, more important, messages in the echo - area. + This option controls whether ‘magit-auto-revert-mode’ only reverts + tracked files or all files that are located inside Git + repositories, including untracked files and files located inside + Git’s control directory. - • NUMBER + -- Command: auto-revert-mode - An integer or float. Revert the buffers asynchronously. If - NUMBER is positive, then mention each buffer as it is being - reverted. If it is negative, then be quiet about it. If user - input arrives, then stop reverting. After (the absolute value - of) NUMBER seconds resume reverting. + The global mode ‘magit-auto-revert-mode’ works by turning on this + local mode in the appropriate buffers. You can also turn it on or + off manually, which might be necessary if Magit does not notice + that a previously untracked file now is being tracked or + vice-versa. - -- User Option: magit-revert-buffers-only-for-tracked-files + -- User Option: auto-revert-stop-on-user-input - This option controls whether only buffers that visit tracked files + This option controls whether the arrival of user input suspends the + automatic reverts for ‘auto-revert-interval’ seconds. - If non-nil, then only tracked files may be reverted. If nil, then - all files in the current repository may potentially be reverted. - Reverting untracked files should be safe and limiting to only - tracked files has the potential of causing very noticable delays, - so the default is to revert all buffers. + -- User Option: auto-revert-interval - Buffers can also be refreshed explicitly, which is useful in buffers -that weren’t current during the last refresh and after changes were made -to the repository outside of Magit. + This option controls for how many seconds Emacs waits before + resuming suspended reverts. -‘g’ (‘magit-refresh’) - - This command refreshes the current buffer if its major mode derives - from ‘magit-mode’ as well as the corresponding status buffer. - - If the option ‘magit-revert-buffers’ calls for it, then it also - reverts all unmodified buffers that visit files being tracked in - the current repository. - -‘G’ (‘magit-refresh-all’) - - This command refreshes all Magit buffers belonging to the current - repository and also reverts all unmodified buffers that visit files - being tracked in the current repository. - - The file-visiting buffers are always reverted, even if - ‘magit-revert-buffers’ is nil. + -- User Option: auto-revert-verbose - -- Function: magit-after-save-refresh-status - - This function is intended to be added to ‘after-save-hook’. After - doing that the corresponding status buffer is refreshed whenever a - buffer is saved to a file inside a repository. - - Note that refreshing a Magit buffer is done by re-creating its - contents from scratch, which can be slow in large repositories. If - you are not satisfied with Magit’s performance, then you should - obviously not add this function to that hook. - - -- User Option: magit-refresh-buffer-hook - - This hook is run in each Magit buffer that was refreshed during the - current refresh - normally the current buffer and the status - buffer. + This option controls whether Emacs reports when a buffer has been + reverted. - -- User Option: magit-after-revert-hook + The options with the ‘auto-revert-’ prefix are located in the Custom +group named ‘auto-revert’. The other, magit-specific, options are +located in the ‘magit’ group. - This hook is run in each file-visiting buffer belonging to the - current repository that was actually reverted during a refresh. - - Note that adding something here is very expensive. If you - experience performance issues, you might want to check this hook, - as well as ‘magit-not-reverted-hook’ and, if possible, remove some - of the functions added by third-party packages. +* Menu: - -- User Option: magit-not-reverted-hook +* Risk of Reverting Automatically:: - This hook is run in each file-visiting buffer belonging to the - current repository that was reverted during a refresh. The file - was not reverted because it did not change, and so Magit does not - have to do anything. This hook is intended for third-party - extensions that need to run some functions even on such files. + +File: magit.info, Node: Risk of Reverting Automatically, Up: Automatic Reverting of File-Visiting Buffers + +Risk of Reverting Automatically +............................... + +For the vast majority users automatically reverting file-visiting +buffers after they have changed on disk is harmless. + + If a buffer is modified (i.e. it contains changes that haven’t been +saved yet), then Emacs would refuse to automatically revert it. If you +save a previously modified buffer, then that results in what is seen by +Git as an uncommitted change. Git would then refuse to carry out any +commands that would cause these changes to be lost. In other words, if +there is anything that could be lost, then either Git or Emacs would +refuse to discard the changes. + + However if you do use file-visiting buffers as a sort of ad hoc +"staging area", then the automatic reverts could potentially cause data +loss. So far I have only heard from one user who uses such a workflow. + + An example: You visit some file in a buffer, edit it, and save the +changes. Then, outside of Emacs (or at least not using Magit or by +saving the buffer) you change the file on disk again. At this point the +buffer is the only place where the intermediate version still exists. +You have saved the changes to disk, but that has since been overwritten. +Meanwhile Emacs considers the buffer to be unmodified (because you have +not made any changes to it since you last saved it to the visited file) +and therefore would not object to it being automatically reverted. At +this point an Auto-Revert mode would kick in. It would check whether +the buffer is modified and since that is not the case it would revert +it. The intermediate version would be lost. (Actually you could still +get it back using the ‘undo’ command.) + + If your workflow depends on Emacs preserving the intermediate version +in the buffer, then you have to disable all Auto-Revert modes. But +please consider that such a workflow would be dangerous even without +using an Auto-Revert mode, and should therefore be avoided. If Emacs +crashed or if you quit Emacs by mistake, then you would also lose the +buffer content. There would be no autosave file still containing the +intermediate version (because that was deleted when you saved the +buffer) and you would not be asked whether you want to safe the buffer +(because it isn’t modified).  -File: magit.info, Node: Sections, Next: Popup buffers and prefix commands, Prev: Automatic refresh and revert, Up: Interface concepts +File: magit.info, Node: Sections, Next: Popup buffers and prefix commands, Prev: Modes and Buffers, Up: Interface concepts -4.4 Sections +4.2 Sections ============ Magit buffers are organized into nested sections, which can be collapsed @@ -1068,7 +1143,7 @@ type keymaps.  File: magit.info, Node: Section movement, Next: Section visibility, Up: Sections -4.4.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’ @@ -1170,7 +1245,7 @@ hook’s default value.  File: magit.info, Node: Section visibility, Next: Section hooks, Prev: Section movement, Up: Sections -4.4.2 Section visibility +4.2.2 Section visibility ------------------------ Magit provides many commands for changing the visibility of sections, @@ -1268,7 +1343,7 @@ certain sections can also be overwritten using the hook  File: magit.info, Node: Section hooks, Next: Section types and values, Prev: Section visibility, Up: Sections -4.4.3 Section hooks +4.2.3 Section hooks ------------------- Which sections are inserted into certain buffers is controlled with @@ -1293,9 +1368,12 @@ this manual along with the appropriate "section inserter functions". 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 depending on - APPEND. If only FUNCTION is a member of the list, then leave it - wherever it already is. + FUNCTION next to that instead. Add before or after AT, or replace + AT with FUNCTION depending on APPEND. If APPEND is the symbol + ‘replace’, then replace AT with FUNCTION. For any other non-nil + value place FUNCTION right after AT. If nil, then place FUNCTION + right before AT. If FUNCTION already is a member of the list but AT + is not, then leave FUNCTION where ever it already is. If optional LOCAL is non-nil, then modify the hook’s buffer-local value rather than its global value. This makes the hook local by @@ -1313,7 +1391,7 @@ this manual along with the appropriate "section inserter functions".  File: magit.info, Node: Section types and values, Next: Section options, Prev: Section hooks, Up: Sections -4.4.4 Section types and values +4.2.4 Section types and values ------------------------------ Each section has a type, for example ‘hunk’, ‘file’, and ‘commit’. @@ -1342,7 +1420,7 @@ and it will automatically be used.  File: magit.info, Node: Section options, Prev: Section types and values, Up: Sections -4.4.5 Section options +4.2.5 Section options --------------------- This section describes options that have an effect on more than just a @@ -1356,7 +1434,7 @@ certain type of sections. As you can see there are not many of those.  File: magit.info, Node: Popup buffers and prefix commands, Next: Completion and confirmation, Prev: Sections, Up: Interface concepts -4.5 Popup buffers and prefix commands +4.3 Popup buffers and prefix commands ===================================== Many Magit commands are implemented using *popup buffers*. First the @@ -1387,7 +1465,7 @@ you should setup a global binding:  File: magit.info, Node: Completion and confirmation, Next: Running Git, Prev: Popup buffers and prefix commands, Up: Interface concepts -4.6 Completion and confirmation +4.4 Completion and confirmation =============================== Many commands read a value from the user. By default this is done using @@ -1452,7 +1530,7 @@ option when acting on a single section.  File: magit.info, Node: Running Git, Prev: Completion and confirmation, Up: Interface concepts -4.7 Running Git +4.5 Running Git =============== * Menu: @@ -1465,7 +1543,7 @@ File: magit.info, Node: Running Git, Prev: Completion and confirmation, Up: I  File: magit.info, Node: Viewing Git output, Next: Running Git manually, Up: Running Git -4.7.1 Viewing Git output +4.5.1 Viewing Git output ------------------------ Magit runs Git either for side-effects (e.g. when pushing) or to get @@ -1494,7 +1572,7 @@ sections are available. There is one additional command.  File: magit.info, Node: Running Git manually, Next: Git executable, Prev: Viewing Git output, Up: Running Git -4.7.2 Running Git manually +4.5.2 Running Git manually -------------------------- While Magit provides many Emacs commands to interact with Git, it does @@ -1557,7 +1635,7 @@ begin with the subcommand, "git" is assumed.  File: magit.info, Node: Git executable, Next: Global Git arguments, Prev: Running Git manually, Up: Running Git -4.7.3 Git executable +4.5.3 Git executable -------------------- Except on MS Windows, Magit defaults to running Git without specifying @@ -1599,7 +1677,7 @@ a non-Windows machine, then you must change the value to "git".  File: magit.info, Node: Global Git arguments, Prev: Git executable, Up: Running Git -4.7.4 Global Git arguments +4.5.4 Global Git arguments -------------------------- -- User Option: magit-git-global-arguments @@ -3602,8 +3680,8 @@ set at this time. • 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 - staring point is a remote branch, but not when it is a local + • When ‘true’ (the default) then the variables 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. @@ -4024,7 +4102,7 @@ either because the user has to deal with a conflict or explicitly requested that rebase stops at that commit, then point is placed on the commit that separates the two groups, i.e. on ‘HEAD’. The commits above it have not been applied yet, while it and the commits below it -have already been applied. In between these two groups or applied and +have already been applied. In between these two groups of applied and yet-to-be applied commits, there sometimes is a commit which has been dropped. @@ -4137,7 +4215,7 @@ you will acquire a good enough understanding through practice. For other sequence operations such as cherry-picking, a similar section is displayed, but they lack some of the features described -below, due to limitations in the git commands used to implement them. +above, due to limitations in the git commands used to implement them. Most importantly these sequences only support "picking" a commit but not other actions such as "rewording", and they do not keep track of the commits which have already been applied. @@ -5215,13 +5293,13 @@ This section discusses various variables that you might want to change (or *not* change) for safety reasons. Git keeps *committed* changes around long enough for users to recover -changes they have accidentally deleted. It does not do the same for -*uncommitted* changes in the working tree and not even the index (the -staging area). Because Magit makes it so easy to modify 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. +changes they have accidentally been deleted. It does not do the same +for *uncommitted* changes in the working tree and not even the index +(the staging area). Because Magit makes it so easy to modify +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. These modes are not enabled by default because of performance concerns. Instead a lot of potentially destructive commands require @@ -5237,32 +5315,10 @@ controls whether the system trash is used, which is the case by default. Nevertheless, ‘trash’ isn’t a member of ‘magit-no-confirm’ - you might want to change that. - Buffers visiting files tracked in the current repository are being -refreshed before certain actions. See *note Automatic refresh and -revert: Automatic refresh and revert. This isn’t as risky as it might -seem. If a buffer is modified (i.e. it contains changes that haven’t -been saved yet), then Emacs/Magit would refuse to revert it. If the -buffer has been saved resulting in what is seen by Git as an uncommitted -change, then Git in turn would refuse to carry out the action that would -cause these changes to be lost. Since Git doesn’t do anything, the file -doesn’t change on disk, and Emacs/Magit has nothing to revert. - - However if you do modify some files, visit the respective files in -Emacs, somehow discard the changes (not using Magit and probably even -outside Emacs), and then expect the respective file-visiting buffers to -retain the uncommitted changes, then the automatic reverting would -actually be harmful. In other words if you use file-visiting buffers as -a sort of "staging area", then you should set ‘magit-revert-buffers’ to -‘nil’. - - So far I have only heard from one user who uses such a workflow. But -because there might be some other users doing such things, and I don’t -want to be responsible for data loss, these reverts by default happen -quite verbosely, allowing these few users to undo the reverts using the -‘undo’ command and then disabling the automatic reverts for the future. -Most users should however keep automatic reverts turned on and instead -configure it to be less verbose by setting ‘magit-revert-buffers’ to ‘t’ -or even ‘silent’. This option is mentioned again in the next section. + 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.  File: magit.info, Node: Performance, Prev: Safety, Up: Essential settings @@ -5270,148 +5326,121 @@ File: magit.info, Node: Performance, Prev: Safety, Up: Essential settings 9.2.2 Performance ----------------- -Magit is slower than raw Git because it does more. For example ‘git -commit’ creates a commit and that’s it. ‘magit-commit’ also updates the -current Magit buffer to make sure you are not looking at outdated -information without noticing it. To refresh the status buffer, Magit -has to run Git a dozen times or more, making it slower than ‘git -status’, but also much more informative. Magit also optionally reverts -file-visiting buffers, creates backups, runs hooks where third-party -extensions can do their slow thing, etc. - - I do care about performance and try to optimize for it as much as -possible, but many features simply come with an inherent performance -penalty. When a feature is just too slow given certain usage and -repository characteristics, then it often can be disabled, globally or -on a per-repository basis. - - But first a short list of performance issues that cannot easily be -worked around: - - • Creating a new process on MS Windows is much slower than on - POSIX-compatible systems. This is a problem because Magit creates - a lot of child processes to retrieve information from Git. In the - short run, only switching to a POSIX system can fix this. Of - course this could also be fixed in Windows itself, but I am just - one unpaid person while Microsoft is a billion dollar company, so I - will leave it to them to fix this grave flaw in their OS. - - • When showing logs, Magit limits the number of commits initially - shown in the hope that this avoids unnecessary work. When using - ‘--graph’ this unfortunately does not have the desired effect for - large histories. Junio said on the git mailing list - (): "‘--graph’ - wants to compute the whole history and the max-count only affects - the output phase after ‘--graph’ does its computation". - - In other words, it’s not that Git is slow at outputting the - differences, or that Magit is slow at parsing the output - the - problem is that Git first goes outside and has a smoke. - - We actually work around this issue by limiting the commit not only - using ‘-’ but also using a range. But unfortunately that’s not - always possible. - - • Whenever "something changes", Magit "refreshes" the status buffer - and the current Magit buffer by recreating them from scratch. This - is an old design decision that we couldn’t depart from easily. And - it has its benefits too - most importantly it’s much simpler and - less error prone to do it this way than to only refreshing "what - actually has changed" (that would basically be a huge collection of - special cases). So for now at least, we don’t avoid recreating the - buffer content and instead focus on making doing so faster. - - Now for the things that you can do to improve performance: - - Most optional features which can have a negative effect on -performance are disabled by default. So start by checking the options -you have explicitly enabled. Even the potentially slow features are -expected to only lead to barely noticeable delays, but your mileage may -vary. Also note that it is now possible to set options on a -per-repository or per-repository-class basis. See *note Per-repository -configuration: Per-repository configuration. - - You should check the values of at least the following variables: - - • ‘magit-after-revert-hook’ - - • ‘magit-diff-auto-show’ - - • ‘magit-diff-highlight-hunk-body’ - - • ‘magit-diff-highlight-indentation’ - - • ‘magit-diff-highlight-trailing’ - - • ‘magit-diff-paint-whitespace’ +After Magit has run ‘git’ for side-effects, it also refreshes the +current Magit buffer and the respective status buffer. This is +necessary because otherwise outdated information might be displayed +without the user noticing. Magit buffers are updated by recreating +their content from scratch, which makes updating simpler and less +error-prone, but also more costly. Keeping it simple and just +re-creating everything from scratch is an old design decision and +departing from that will require major refactoring. + + I plan to do that in time for the next major release. I also intend +to create logs and diffs asynchronously, which should also help a lot +but also requires major refactoring. + + Meanwhile you can tell Magit to only automatically refresh the +current Magit buffer, but not the status buffer. If you do that, then +the status buffer is only refreshed automatically if it itself is the +current buffer. + + (setq magit-refresh-status-buffer nil) + + You should also check whether any third-party packages have added +anything to ‘magit-refresh-buffer-hook’ and ‘magit-status-refresh-hook’, +and if so whether those additions impacts performance significantly. + + If you have enabled any features that are disabled by default, then +you should check whether they impact performance significantly. It’s +likely that they were not enabled by default because it is known that +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 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. + + But all these efforts might not be enough, forcing users to make some +changes themselves. For example, according to +, setting the following Git +variables might also help: + + git config --global core.preloadindex true + git config --global core.fscache true + git config --global gc.auto 256 + + You should also check whether an anti-virus program is slowing things +down. + +Log Performance +............... + +When showing logs, Magit limits the number of commits initially shown in +the hope that this avoids unnecessary work. When using ‘--graph’ is +used, then this unfortunately does not have the desired effect for large +histories. Junio, Git’s maintainer, said on the git mailing list +(): "‘--graph’ wants to +compute the whole history and the max-count only affects the output +phase after ‘--graph’ does its computation". + + In other words, it’s not that Git is slow at outputting the +differences, or that Magit is slow at parsing the output - the problem +is that Git first goes outside and has a smoke. + + We actually work around this issue by limiting the number of commits +not only by using ‘-’ but by also using a range. But unfortunately +that’s not always possible. + + In repositories with more than a few thousand commits ‘--graph’ +should never be a member of ‘magit-log-section-arguments’. That +variable is used in the status buffer which is refreshed every time you +run any Magit command. + + Using ‘--color --graph’ is even slower. Magit uses code that is part +of Emacs to turn control characters into faces. That code is pretty +slow and this is quite noticeable when showing a log with many branches +and merges. For that reason ‘--color’ is not enabled by default +anymore. Consider leaving it at that. + +Diff Performance +................ + + • ‘magit-diff-highlight-hunk-body’, + ‘magit-diff-highlight-indentation’, + ‘magit-diff-highlight-trailing’, and ‘magit-diff-paint-whitespace’ • ‘magit-diff-refine-hunk’ - • ‘magit-log-arguments’, ‘magit-log-select-arguments’, and - ‘magit-log-section-arguments’ - - In repositories with more than a few thousand commits ‘--graph’ - should never be a member of ‘magit-log-section-arguments’. That - variable is in the status buffer which is refreshed every time you - run any Magit command. - - Using ‘--color --graph’ is even slower. Magit uses code that is - part of Emacs to turn control characters into faces. That code is - pretty slow and this is quite noticeable when showing a log with - many branches and merges. For that reason ‘--color’ is not enabled - by default anymore. Consider leaving it at that. - - • ‘magit-revert-buffers’ - - After running certain commands, after refreshing the current Magit - buffer, unmodified buffers visiting files belonging to the current - repository are reverted. By default that happens synchronously, - which can be an issue if you visit many buffers. Set this variable - to a number to revert asynchronously. It’s best to use a negative - number because that causes the reverts to happen silently (which is - desirable because the revert messages would otherwise shadow other, - more important messages). - - • ‘magit-not-reverted-hook’ - - • ‘magit-refresh-buffer-hook’ - - If third-party packages add functions to these hooks, then you - might want to consider removing them again. - - • ‘magit-refs-sections-hook’ - - When refreshing the "references buffer" is slow, then that’s - usually because several hundred refs are being displayed. The best - way to address that is to display fewer refs, obviously. - - If you are not, or only mildly, interested in seeing the list of - tags, then start by not displaying them: - - (remove-hook 'magit-refs-sections-hook 'magit-insert-tags) - - Then you should also make sure that the listed remote branches - actually all exist. You can do so by pruning branches which no - longer exist using ‘f-pa’. - - • ‘magit-status-refresh-hook’ +Refs Buffer Performance +....................... - • ‘magit-wip-after-apply-mode’ +When refreshing the "references buffer" is slow, then that’s usually +because several hundred refs are being displayed. The best way to +address that is to display fewer refs, obviously. - • ‘magit-wip-after-save-mode’ + If you are not, or only mildly, interested in seeing the list of +tags, then start by not displaying them: - • ‘magit-wip-before-change-mode’ + (remove-hook 'magit-refs-sections-hook 'magit-insert-tags) - Also note that everything involving "cherry commits" is slow. - - If, after actually trying the above suggestions, performance is still -bad, and the above does not contain a statement explaining why that is -so in that particular case and that there is nothing that we can -currently do about it, then comment on the appropriate existing issue -(see ), or if -necessary open a new issue. Note that "something is slow, I am using -v2.2" is not helpful, you have to be a bit more specific. Benchmarks -are a start. + Then you should also make sure that the listed remote branches +actually all exist. You can do so by pruning branches which no longer +exist using ‘f-pa’.  File: magit.info, Node: Plumbing, Next: FAQ, Prev: Customizing, Up: Top @@ -6223,7 +6252,8 @@ made it into the manual yet, see * Magit is slow:: * I changed several thousand files at once and now Magit is unusable:: * I am having problems committing:: -* I don't like how branching and pushing works:: +* 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. @@ -6235,6 +6265,8 @@ made it into the manual yet, see * 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: Magit is slow, Next: I changed several thousand files at once and now Magit is unusable, Up: FAQ @@ -6259,7 +6291,7 @@ satisfactory performance, because that requires some heavy refactoring. one commit. Also see *note Performance: Performance.  -File: magit.info, Node: I am having problems committing, Next: I don't like how branching and pushing works, Prev: I changed several thousand files at once and now Magit is unusable, Up: FAQ +File: magit.info, Node: I am having problems committing, Next: I don't understand how branching and pushing work, Prev: I changed several thousand files at once and now Magit is unusable, Up: FAQ A.3 I am having problems committing =================================== @@ -6269,19 +6301,26 @@ emacsclient executable. See *note (with-editor)Configuring With-Editor:: and *note (with-editor)Debugging::.  -File: magit.info, Node: I don't like how branching and pushing works, Next: I cannot install the pre-requisites for Magit v2, Prev: I am having problems committing, Up: FAQ +File: magit.info, Node: I don't understand how branching and pushing work, Next: I don't like the key binding in v24, Prev: I am having problems committing, Up: FAQ -A.4 I don’t like how branching and pushing works -================================================ +A.4 I don’t understand how branching and pushing work +===================================================== + +Please see *note Branching: 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.5 I don’t like the key binding in v2.4 +======================================== -In v2.1 the default behavior of the branch and push commands changed, -which has taken a few users by surprise and left more unsatisfied. The -next release, v2.4, will try to address these concerns. +Please see .  -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 how branching and pushing works, Up: FAQ +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 -A.5 I cannot install the pre-requisites for Magit v2 +A.6 I cannot install the pre-requisites for Magit v2 ==================================================== An Elpa archive featuring obsolete Magit v1.4.2 and its dependencies is @@ -6291,7 +6330,7 @@ obsolete and no longer maintained.  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.6 I am using an Emacs release older than v24.4 +A.7 I am using an Emacs release older than v24.4 ================================================ At least Emacs v24.4 is required. There is no way around it, if you @@ -6324,7 +6363,7 @@ is available from .  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 -A.7 I am using a Git release older than v1.9.4 +A.8 I am using a Git release older than v1.9.4 ============================================== At least Git v1.9.4 is required. There is no way around it, if you want @@ -6346,7 +6385,7 @@ is available from .  File: magit.info, Node: I am using MS Windows and cannot push with Magit, Next: How to install the gitman info manual?, Prev: I am using a Git release older than v194, Up: FAQ -A.8 I am using MS Windows and cannot push with Magit +A.9 I am using MS Windows and cannot push with Magit ==================================================== It’s almost certain that Magit is only incidental to this issue. It is @@ -6359,8 +6398,8 @@ push on the command line.  File: magit.info, Node: How to install the gitman info manual?, Next: How can I show Git's output?, Prev: I am using MS Windows and cannot push with Magit, Up: FAQ -A.9 How to install the gitman info manual? -========================================== +A.10 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 @@ -6414,7 +6453,7 @@ just one of many issues.)  File: magit.info, Node: How can I show Git's output?, Next: Expanding a file to show the diff causes it to disappear, Prev: How to install the gitman info manual?, Up: FAQ -A.10 How can I show Git’s output? +A.11 How can I show Git’s output? ================================= To show the output of recently run git commands, press ‘$’ (or, if that @@ -6431,7 +6470,7 @@ For debugging purposes it’s possible to do so anyway by setting  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: How can I show Git's output?, Up: FAQ -A.11 Expanding a file to show the diff causes it to disappear +A.12 Expanding a file to show the diff causes it to disappear ============================================================= This is probably caused by a change of a ‘diff.*’ Git variable. You @@ -6441,7 +6480,7 @@ that setting in Magit by customizing ‘magit-git-global-arguments’.  File: magit.info, Node: Point is wrong in the COMMIT_EDITMSG buffer, Next: Can Magit be used as ediff-version-control-package?, Prev: Expanding a file to show the diff causes it to disappear, Up: FAQ -A.12 Point is wrong in the COMMIT_EDITMSG buffer +A.13 Point is wrong in the COMMIT_EDITMSG buffer ================================================ Neither Magit nor ‘git-commit‘ fiddle with point in the buffer used to @@ -6465,7 +6504,7 @@ help:  File: magit.info, Node: Can Magit be used as ediff-version-control-package?, Next: How to show diffs for gpg-encrypted files?, Prev: Point is wrong in the COMMIT_EDITMSG buffer, Up: FAQ -A.13 Can Magit be used as ediff-version-control-package? +A.14 Can Magit be used as ediff-version-control-package? ======================================================== No, it cannot. For that to work the functions ‘ediff-magit-internal’ @@ -6500,7 +6539,7 @@ 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.14 How to show diffs for gpg-encrypted files? +A.15 How to show diffs for gpg-encrypted files? =============================================== Git supports showing diffs for encrypted files, but has to be told to do @@ -6511,9 +6550,9 @@ affects the diffs displayed inside Magit. echo "*.gpg filter=gpg diff=gpg" > .gitattributes  -File: magit.info, Node: Emacs 245 hangs when loading Magit, Prev: How to show diffs for gpg-encrypted files?, Up: FAQ +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.15 Emacs 24.5 hangs when loading Magit +A.16 Emacs 24.5 hangs when loading Magit ======================================== This is actually triggered by loading Tramp. See @@ -6522,6 +6561,23 @@ can work around the problem by setting ‘tramp-ssh-controlmaster-options’. Changing your DNS server (e.g. to 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 + +A.17 Symbol’s value as function is void –some +============================================= + +Update ‘dash’, restart Emacs, and then it will be defined. + + +File: magit.info, Node: Where is the branch manager, Prev: Symbol's value as function is void --some, Up: FAQ + +A.18 Where is the branch manager +================================ + +‘y’ is bound to the command that shows the "refs buffer", the successor +of the "branch manager". +  File: magit.info, Node: Keystroke Index, Next: Command Index, Prev: FAQ, Up: Top @@ -6696,10 +6752,10 @@ Appendix B Keystroke Index * F p: Pulling. (line 13) * f u: Fetching. (line 17) * F u: Pulling. (line 17) -* g: Automatic refresh and revert. - (line 78) -* G: Automatic refresh and revert. - (line 87) +* g: Automatic Refreshing of Magit Buffers. + (line 22) +* G: Automatic Refreshing of Magit Buffers. + (line 31) * j: Diff buffer. (line 38) * k: Viewing Git output. (line 19) * k <1>: Applying. (line 37) @@ -6915,6 +6971,8 @@ Appendix C Command Index [index] * Menu: +* auto-revert-mode: Automatic Reverting of File-Visiting Buffers. + (line 62) * forward-line: Editing rebase sequences. (line 39) * git-commit-ack: Editing commit messages. @@ -7165,10 +7223,10 @@ Appendix C Command Index * magit-reflog-current: Reflog. (line 11) * magit-reflog-head: Reflog. (line 19) * magit-reflog-other: Reflog. (line 15) -* magit-refresh: Automatic refresh and revert. - (line 78) -* magit-refresh-all: Automatic refresh and revert. - (line 87) +* magit-refresh: Automatic Refreshing of Magit Buffers. + (line 22) +* magit-refresh-all: Automatic Refreshing of Magit Buffers. + (line 31) * magit-remote-add: Remotes. (line 13) * magit-remote-popup: Remotes. (line 8) * magit-remote-remove: Remotes. (line 28) diff --git a/elpa/magit-20160102.906/magit.info-2 b/elpa/magit-20160117.2129/magit.info-2 similarity index 92% rename from elpa/magit-20160102.906/magit.info-2 rename to elpa/magit-20160117.2129/magit.info-2 index eaea9be81d9c5c9dc1f34d47faf6677838d2ec28..0706819cb0454fc7e2b5120167d24e4a3a19de9a 100644 GIT binary patch delta 828 zcmeyoobk*C#tkK`e2Jwc`MO1^WvN9ay1Dt21+~PL6%-tSg1Lz$naK)4V42LkbcOsh z1-HzcRNb)5;>?oCt9XN$&5SfR7qW7&2nVI66{QwuKvnrBrUMnM<@KMOsmZhX9_Kv` z5oAj;^GZ^S$`W%XU-Xt0$78&oxv3_XmIAWY;*$IV-TXY=(&E%2-ORj#(h@5LC?Lwk ze&z<~Mgon}&C4&zOsj+&MUs&cCYI<%0)sLszj$&Xzo;Tnu41wH0EE*a A_W%F@ delta 312 zcmX@Jf${Tl#tkK`n?=}ISpu+8Frx0ohBQIi8%j@{Xl_XqPhL0qYuRGOBST2!o?pO;gqo0eas zTT+ymoSmAYo0gfAT5P4@SXz>wn^=;W4D>Z-2zWA@Y 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-variable + '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-20151223.1341/magit-popup.info b/elpa/magit-popup-20160117.1513/magit-popup.info similarity index 97% rename from elpa/magit-popup-20151223.1341/magit-popup.info rename to elpa/magit-popup-20160117.1513/magit-popup.info index 00b61d5a..a4b68226 100644 --- a/elpa/magit-popup-20151223.1341/magit-popup.info +++ b/elpa/magit-popup-20160117.1513/magit-popup.info @@ -6,7 +6,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 Jonas Bernoulli + 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 @@ -33,7 +33,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 Jonas Bernoulli + 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 @@ -422,6 +422,13 @@ File: magit-popup.info, Node: Other options, Prev: Customizing existing popups 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") @@ -686,14 +693,14 @@ directly.  Tag Table: -Node: Top989 -Node: Introduction2158 -Node: Usage4735 -Node: Customizing existing popups9392 -Node: Other options14920 -Node: Defining prefix and suffix commands16626 -Node: Defining prefix commands18722 -Node: Defining suffix commands25402 +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 diff --git a/elpa/with-editor-20151223.1341/dir b/elpa/with-editor-20160117.1513/dir similarity index 100% rename from elpa/with-editor-20151223.1341/dir rename to elpa/with-editor-20160117.1513/dir diff --git a/elpa/with-editor-20151223.1341/with-editor-autoloads.el b/elpa/with-editor-20160117.1513/with-editor-autoloads.el similarity index 92% rename from elpa/with-editor-20151223.1341/with-editor-autoloads.el rename to elpa/with-editor-20160117.1513/with-editor-autoloads.el index 7deaeb53..fa01582c 100644 --- a/elpa/with-editor-20151223.1341/with-editor-autoloads.el +++ b/elpa/with-editor-20160117.1513/with-editor-autoloads.el @@ -4,7 +4,7 @@ (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) ;;;### (autoloads nil nil ("with-editor-pkg.el" "with-editor.el") -;;;;;; (22140 6971 36516 0)) +;;;;;; (22173 11883 665867 0)) ;;;*** diff --git a/elpa/with-editor-20151223.1341/with-editor-pkg.el b/elpa/with-editor-20160117.1513/with-editor-pkg.el similarity index 76% rename from elpa/with-editor-20151223.1341/with-editor-pkg.el rename to elpa/with-editor-20160117.1513/with-editor-pkg.el index 97a98cde..a8a94245 100644 --- a/elpa/with-editor-20151223.1341/with-editor-pkg.el +++ b/elpa/with-editor-20160117.1513/with-editor-pkg.el @@ -1,4 +1,4 @@ -(define-package "with-editor" "20151223.1341" "Use the Emacsclient as $EDITOR" +(define-package "with-editor" "20160117.1513" "Use the Emacsclient as $EDITOR" '((emacs "24.4") (async "20150909.2257") (dash "20151021.113")) diff --git a/elpa/with-editor-20151223.1341/with-editor.el b/elpa/with-editor-20160117.1513/with-editor.el similarity index 99% rename from elpa/with-editor-20151223.1341/with-editor.el rename to elpa/with-editor-20160117.1513/with-editor.el index c137837c..fac092cd 100644 --- a/elpa/with-editor-20151223.1341/with-editor.el +++ b/elpa/with-editor-20160117.1513/with-editor.el @@ -1,6 +1,6 @@ ;;; with-editor.el --- Use the Emacsclient as $EDITOR -*- lexical-binding: t -*- -;; Copyright (C) 2014-2015 The Magit Project Contributors +;; Copyright (C) 2014-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. @@ -128,7 +128,7 @@ please see https://github.com/magit/magit/wiki/Emacsclient.")) (setq v (mapconcat #'identity (reverse v) ".")) (list v (concat "-" v) (concat ".emacs" v))) (reverse version-lst)) - (list ""))) + (list "" "emacsclient-snapshot"))) (lambda (exec) (ignore-errors (string-match-p version-reg diff --git a/elpa/with-editor-20151223.1341/with-editor.info b/elpa/with-editor-20160117.1513/with-editor.info similarity index 97% rename from elpa/with-editor-20151223.1341/with-editor.info rename to elpa/with-editor-20160117.1513/with-editor.info index ea246fa9..41419b99 100644 --- a/elpa/with-editor-20151223.1341/with-editor.info +++ b/elpa/with-editor-20160117.1513/with-editor.info @@ -16,7 +16,7 @@ library is made available as a separate package. It also defines some additional functionality which makes it useful even for end-users, who don’t use Magit or another package which uses it internally. - Copyright (C) 2015 Jonas Bernoulli + 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 @@ -53,7 +53,7 @@ library is made available as a separate package. It also defines some additional functionality which makes it useful even for end-users, who don’t use Magit or another package which uses it internally. - Copyright (C) 2015 Jonas Bernoulli + 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 @@ -308,12 +308,12 @@ what is the output of ‘M-x with-editor-debug’?  Tag Table: -Node: Top1540 -Node: Using the With-Editor package3227 -Node: Configuring With-Editor3843 -Node: Using With-Editor commands7450 -Node: Using With-Editor as a library10613 -Node: Debugging12285 +Node: Top1545 +Node: Using the With-Editor package3237 +Node: Configuring With-Editor3853 +Node: Using With-Editor commands7460 +Node: Using With-Editor as a library10623 +Node: Debugging12295  End Tag Table -- 2.47.3