Checkpoint commit on hp002

This commit is contained in:
mANIApHOBIC 2015-06-13 07:23:18 -07:00
parent 68002c58d9
commit a5f6f9e84e
16 changed files with 11580 additions and 12 deletions

View file

@ -1,8 +1,8 @@
(1 (1
(ace-window . (ace-window .
[(0 8 1) [(0 9 0)
((avy ((avy
(0 1 0))) (0 2 0)))
"Quickly switch windows." single "Quickly switch windows." single
((:url . "https://github.com/abo-abo/ace-window") ((:url . "https://github.com/abo-abo/ace-window")
(:keywords "window" "location"))]) (:keywords "window" "location"))])
@ -79,7 +79,7 @@
((:keywords "extensions") ((:keywords "extensions")
(:url . "http://www.dr-qubit.org/emacs.php"))]) (:url . "http://www.dr-qubit.org/emacs.php"))])
(avy . (avy .
[(0 2 0) [(0 2 1)
((emacs ((emacs
(24 1)) (24 1))
(cl-lib (cl-lib
@ -142,13 +142,13 @@
((:keywords "abbrev" "convenience" "matching") ((:keywords "abbrev" "convenience" "matching")
(:url . "https://github.com/company-mode/company-statistics"))]) (:url . "https://github.com/company-mode/company-statistics"))])
(context-coloring . (context-coloring .
[(6 2 1) [(6 3 0)
((emacs ((emacs
(24)) (24))
(js2-mode (js2-mode
(20150126))) (20150126)))
"Highlight by scope" single "Highlight by scope" single
((:url . "http://elpa.gnu.org/packages/context-coloring.html") ((:url . "https://github.com/jacksonrayhamilton/context-coloring")
(:keywords "convenience" "faces" "tools"))]) (:keywords "convenience" "faces" "tools"))])
(crisp . (crisp .
[(1 3 4) [(1 3 4)
@ -156,7 +156,7 @@
((:url . "http://elpa.gnu.org/packages/crisp.html") ((:url . "http://elpa.gnu.org/packages/crisp.html")
(:keywords "emulations" "brief" "crisp"))]) (:keywords "emulations" "brief" "crisp"))])
(csv-mode . (csv-mode .
[(1 3) [(1 4)
nil "Major mode for editing comma/char separated values" single nil "Major mode for editing comma/char separated values" single
((:url . "http://centaur.maths.qmul.ac.uk/Emacs/") ((:url . "http://centaur.maths.qmul.ac.uk/Emacs/")
(:keywords "convenience"))]) (:keywords "convenience"))])
@ -271,7 +271,7 @@
((:url . "http://elpa.gnu.org/packages/flylisp.html") ((:url . "http://elpa.gnu.org/packages/flylisp.html")
(:keywords))]) (:keywords))])
(ggtags . (ggtags .
[(0 8 9) [(0 8 10)
((emacs ((emacs
(24)) (24))
(cl-lib (cl-lib
@ -348,7 +348,7 @@
((:url . "http://elpa.gnu.org/packages/jumpc.html") ((:url . "http://elpa.gnu.org/packages/jumpc.html")
(:keywords))]) (:keywords))])
(let-alist . (let-alist .
[(1 0 3) [(1 0 4)
nil "Easily let-bind values of an assoc-list by their names" single nil "Easily let-bind values of an assoc-list by their names" single
((:url . "http://elpa.gnu.org/packages/let-alist.html") ((:url . "http://elpa.gnu.org/packages/let-alist.html")
(:keywords "extensions" "lisp"))]) (:keywords "extensions" "lisp"))])
@ -447,7 +447,7 @@
((:url . "http://elpa.gnu.org/packages/omn-mode.html") ((:url . "http://elpa.gnu.org/packages/omn-mode.html")
(:keywords))]) (:keywords))])
(org . (org .
[(20150518) [(20150608)
nil "Outline-based notes management and organizer" tar nil]) nil "Outline-based notes management and organizer" tar nil])
(osc . (osc .
[(0 1) [(0 1)
@ -459,6 +459,11 @@
nil "Predictive abbreviation expansion" single nil "Predictive abbreviation expansion" single
((:url . "http://elpa.gnu.org/packages/pabbrev.html") ((:url . "http://elpa.gnu.org/packages/pabbrev.html")
(:keywords))]) (:keywords))])
(pinentry .
[(0 1)
nil "GnuPG Pinentry server implementation" single
((:url . "http://elpa.gnu.org/packages/pinentry.html")
(:keywords "gnupg"))])
(poker . (poker .
[(0 1) [(0 1)
nil "Texas hold'em poker" single nil "Texas hold'em poker" single
@ -519,6 +524,13 @@
nil "Implementation of Sokoban for Emacs." tar nil "Implementation of Sokoban for Emacs." tar
((:keywords "games") ((:keywords "games")
(:url . "http://elpa.gnu.org/packages/sokoban.html"))]) (:url . "http://elpa.gnu.org/packages/sokoban.html"))])
(sotlisp .
[(1 1)
((emacs
(24 1)))
"Write lisp at the speed of thought." single
((:url . "https://github.com/Malabarba/speed-of-thought-lisp")
(:keywords "convenience" "lisp"))])
(spinner . (spinner .
[(1 3 1) [(1 3 1)
nil "Add spinners and progress-bars to the mode-line for ongoing operations" single nil "Add spinners and progress-bars to the mode-line for ongoing operations" single
@ -541,7 +553,7 @@
((:url . "http://elpa.gnu.org/packages/svg-clock.html") ((:url . "http://elpa.gnu.org/packages/svg-clock.html")
(:keywords "demo" "svg" "clock"))]) (:keywords "demo" "svg" "clock"))])
(swiper . (swiper .
[(0 4 0) [(0 4 1)
((emacs ((emacs
(24 1))) (24 1)))
"Isearch with an overview. Oh, man!" tar "Isearch with an overview. Oh, man!" tar
@ -656,4 +668,9 @@
[(0 8 0) [(0 8 0)
nil "Yet another snippet extension for Emacs." tar nil "Yet another snippet extension for Emacs." tar
((:keywords "convenience" "emulation") ((:keywords "convenience" "emulation")
(:url . "http://github.com/capitaomorte/yasnippet"))])) (:url . "http://github.com/capitaomorte/yasnippet"))])
(ztree .
[(1 0 1)
nil "Text mode directory tree" tar
((:keywords "files" "tools")
(:url . "https://github.com/fourier/ztree"))]))

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,186 @@
Authors
=======
Also see https://github.com/magit/magit/graphs/contributors.
Names below are sorted alphabetically.
Author
------
- Marius Vollmer <marius.vollmer@gmail.com>
Maintainer
----------
- Jonas Bernoulli <jonas@bernoul.li>
Retired Maintainers
-------------------
- Nicolas Dudebout <nicolas.dudebout@gatech.edu>
- Peter J. Weisberg <pj@irregularexpressions.net>
- Phil Jackson <phil@shellarchive.co.uk>
- Rémi Vanicat <vanicat@debian.org>
- Yann Hodique <yann.hodique@gmail.com>
Contributors
------------
- aaa707 <aaa707b@gmail.com>
- Aaron Culich <aculich@gmail.com>
- Abdo Roig-Maranges <abdo.roig@gmail.com>
- acple <silentsphere110@gmail.com>
- Adam Spiers <emacs@adamspiers.org>
- Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Alan Falloon <alan.falloon@gmail.com>
- Alexey Voinov <alexey.v.voinov@gmail.com>
- Alex Ott <alexott@gmail.com>
- Andreas Fuchs <asf@boinkor.net>
- Andreas Liljeqvist <andreas.liljeqvist@robacks.se>
- Andreas Rottmann <a.rottmann@gmx.at>
- Andrei Chițu <andrei.chitu1@gmail.com>
- Andrew Kirkpatrick <andrew.kirkpatrick@adelaide.edu.au>
- Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
- Andrey Smirnov <andrew.smirnov@gmail.com>
- Bastian Beischer <beischer@physik.rwth-aachen.de>
- Ben Walton <bwalton@artsci.utoronto.ca>
- Bradley Wright <brad@intranation.com>
- Brandon W Maister <quodlibetor@gmail.com>
- Brian Warner <warner@lothar.com>
- Bryan Shell <bryan.shell@orbitz.com>
- Chris Bernard <cebernard@gmail.com>
- Chris Done <chrisdone@gmail.com>
- Chris Moore <dooglus@gmail.com>
- Chris Ring <chris@ringthis.com>
- Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
- Christian Kluge <ckfrakturfreak@web.de>
- Christopher Monsanto <chris@monsan.to>
- Cornelius Mika <cornelius.mika@gmail.com>
- Craig Andera <candera@wangdera.com>
- Dale Hagglund <dale.hagglund@gmail.com>
- Damien Cassou <damien.cassou@gmail.com>
- Daniel Brockman <daniel@gointeractive.se>
- Daniel Farina <drfarina@acm.org>
- Daniel Hackney <dan@haxney.org>
- Dan LaManna <dan.lamanna@gmail.com>
- David Abrahams <dave@boostpro.com>
- David Hull <david.hull@openx.com>
- David Wallin <david.wallin@gmail.com>
- Dennis Paskorz <dennis@walltowall.com>
- Divye Kapoor <divye@google.com>
- Dominique Quatravaux <domq@google.com>
- Eli Barzilay <eli@barzilay.org>
- Eric Davis <ed@npri.org>
- Eric Schulte <schulte.eric@gmail.com>
- Evgkeni Sampelnikof <esabof@gmail.com>
- Felix Geller <fgeller@gmail.com>
- Feng Li <fengli@blackmagicdesign.com>
- Geoff Shannon <geoffpshannon@gmail.com>
- George Kadianakis <desnacked@gmail.com>
- Graham Clark <grclark@gmail.com>
- Greg A. Woods <woods@planix.com>
- Greg Sexton <gregsexton@gmail.com>
- Hannu Koivisto <azure@iki.fi>
- Hans-Peter Deifel <hpdeifel@gmx.de>
- Ian Eure <ian.eure@gmail.com>
- Jan Tatarik <jan.tatarik@xing.com>
- Jasper St. Pierre <jstpierre@mecheye.net>
- Jeff Bellegarde <jbellegarde@whitepages.com>
- Jeff Dairiki <dairiki@dairiki.org>
- Jesse Alama <jesse.alama@gmail.com>
- John Wiegley <johnw@newartisans.com>
- Jonas Bernoulli <jonas@bernoul.li>
- Jonathan Roes <jroes@jroes.net>
- Jordan Greenberg <jordan@softwareslave.com>
- Julien Danjou <julien@danjou.info>
- Justin Caratzas <justin.caratzas@gmail.com>
- Kimberly Wolk <kimwolk@hotmail.com>
- Kyle Meyer <kyle@kyleam.com>
- Laurent Laffont <laurent.laffont@gmail.com>
- Leandro Facchinetti <me@leafac.com>
- Lele Gaifax <lele@metapensiero.it>
- Leo Liu <sdl.web@gmail.com>
- Leonardo Etcheverry <leo@kalio.net>
- Lluís Vilanova <vilanova@ac.upc.edu>
- Loic Dachary <loic@dachary.org>
- Luís Borges de Oliveira <lbo@siscog.pt>
- Luke Amdor <luke.amdor@gmail.com>
- Manuel Vázquez Acosta <mva.led@gmail.com>
- Marcel Wolf <mwolf@ml1.net>
- Marc Herbert <marc.herbert@gmail.com>
- Marcin Bachry <hegel666@gmail.com>
- Marco Craveiro <marco.craveiro@gmail.com>
- Marian Schubert <marian.schubert@gooddata.com>
- Marius Vollmer <marius.vollmer@gmail.com>
- Mark Hepburn <Mark.Hepburn@csiro.au>
- Matus Goljer <dota.keys@gmail.com>
- Miles Bader <miles@gnu.org>
- Mitchel Humpherys <mitch.special@gmail.com>
- Moritz Bunkus <moritz@bunkus.org>
- Nathan Weizenbaum <nex342@gmail.com>
- Nguyễn Tuấn Anh <ubolonton@gmail.com>
- Nic Ferier <nic@ferrier.me.uk>
- Nick Alcock <nick.alcock@oracle.com>
- Nick Alexander <nalexander@mozilla.com>
- Nick Dimiduk <ndimiduk@gmail.com>
- Nicolas Dudebout <nicolas.dudebout@gatech.edu>
- Nicolas Richard <theonewiththeevillook@yahoo.fr>
- Noam Postavsky <npostavs@users.sourceforge.net>
- Ole Arndt <oliver.arndt@cegedim.com>
- Óscar Fuentes <ofv@wanadoo.es>
- Paul Stadig <paul@stadig.name>
- Pavel Holejsovsky <pavel.holejsovsky@upek.com>
- Pekka Pessi <nospam@pessi.fi>
- Peter J. Weisberg <pj@irregularexpressions.net>
- Peter Vasil <mail@petervasil.net>
- Philippe Vaucher <philippe.vaucher@gmail.com>
- Philipp Haselwarter <philipp@haselwarter.org>
- Philip Weaver <philip.weaver@gmail.com>
- Phil Jackson <phil@shellarchive.co.uk>
- Pieter Praet <pieter@praet.org>
- Prathamesh Sonpatki <csonpatki@gmail.com>
- rabio <rabiodev@o2.pl>
- Rafael Laboissiere <rafael@laboissiere.net>
- Raimon Grau <raimonster@gmail.com>
- Ramkumar Ramachandra <artagnon@gmail.com>
- Remco van 't Veer <rwvtveer@xs4all.nl>
- Rémi Vanicat <vanicat@debian.org>
- René Stadler <mail@renestadler.de>
- Robert Boone <robo4288@gmail.com>
- Robin Green <greenrd@greenrd.org>
- Roger Crew <crew@cs.stanford.edu>
- Romain Francoise <romain@orebokech.com>
- Ron Parker <rparker@a123systems.com>
- Roy Crihfield <rscrihf@gmail.com>
- Rüdiger Sonderfeld <ruediger@c-plusplus.de>
- Rüdiger Sonderfeld <ruediger@c-plusplus.net>
- Ryan C. Thompson <rct@thompsonclan.org>
- Samuel Bronson <naesten@gmail.com>
- Sanjoy Das <sanjoy@playingwithpointers.com>
- Sean Bryant <sbryant@hackinggibsons.com>
- Sebastian Wiesner <lunaryorn@gmail.com>
- Sébastien Gross <seb@chezwam.org>
- Seong-Kook Shin <cinsky@gmail.com>
- Sergey Pashinin <sergey@pashinin.com>
- Sergey Vinokurov <serg.foo@gmail.com>
- Servilio Afre Puentes <afrepues@mcmaster.ca>
- Štěpán Němec <stepnem@gmail.com>
- Steven Chow <steve@myfreestuffapp.com>
- Steven E. Harris <seh@panix.com>
- Steven Thomas <sthomas314@gmail.com>
- Steve Purcell <steve@sanityinc.com>
- Suhail Shergill <suhailshergill@gmail.com>
- Takafumi Arakaki <aka.tkf@gmail.com>
- Teruki Shigitani <teruki.shigitani@gmail.com>
- Thierry Volpiatto <thierry.volpiatto@gmail.com>
- Thomas Frössman <thomasf@jossystem.se>
- Thomas Jost <thomas.jost@gmail.com>
- Thomas Riccardi <riccardi.thomas@gmail.com>
- Tibor Simko <tibor.simko@cern.ch>
- Timo Juhani Lindfors <timo.lindfors@iki.fi>
- Ting-Yu Lin <aethanyc@gmail.com>
- Tom Feist <shabble@metavore.org>
- Wilfred Hughes <me@wilfred.me.uk>
- Win Treese <treese@acm.org>
- Yann Hodique <yann.hodique@gmail.com>
- York Zhao <gtdplatform@gmail.com>

View file

@ -0,0 +1,123 @@
It's Magit! A Git Porcelain inside Emacs
=========================================
Magit is an interface to the version control system [Git][git],
implemented as an [Emacs][emacs] package.
Unlike the [VC][vc] package which is part of Emacs and strives to
provide a unified interface to various version control systems, Magit
only supports Git and can therefore better take advantage of its
native features.
*Magit supports GNU Emacs 23.2 or later; 24.1 or later is recommended.*
*Magit supports Git 1.7.2.5 or later; 1.8.2 or later is recommended.*
### Table of Contents
* [Installation](#installation)
* [Getting Started](#getting-started)
* [Getting Help](#getting-help)
* [Contributions](#contributions)
* [Dependencies](#dependencies)
Installation
============
We recommend that you use Emacs' package manager (`package.el`),
to install Magit from your preferred Elpa archive ([Melpa][melpa],
[Melpa-Stable][melpa-stable], or [Marmalade][marmalade]). If you
haven't used the package manager before, or would like to install
directly from Magit's Git repository, then consult the detailed
[installation instructions][install].
Getting Started
===============
To get started with Magit show a summary of its status in a
new buffer using <kbd>M-x magit-status RET</kbd>. Navigate the
buffer using <kbd>n</kbd> and <kbd>p</kbd>, and toggle sections using
<kbd>TAB</kbd>. Edit and save some files, refresh the status buffer
using <kbd>g</kbd>, stage files or individual hunks using <kbd>s</kbd>
and initiate a commit using <kbd>c c</kbd> the staged changes. When
done writing the commit message use <kbd>C-c C-c</kbd> to actually
create the commit.
For more details consult the user manual. You can read it with
<kbd>C-u C-h i magit.info RET</kbd> or [on the web][manual]. Magit
also has a [website][website].
Getting Help
============
When something doesn't work as expected please see the [FAQ][faq], and
the list of [open issues][issues], and use the search box at the top
of the latter to find older related issues. If everything else fails
ask for help on the [Emacs Stackexchange][emacsstack] site or the
[mailing list][group].
Contributions
=============
Magit is [hosted on Github][development]. Please contribute by
reporting bugs and suggesting features on the [issue tracker][issues]
or by making code contributions using [pull requests][pulls]. Before
opening a pull request read the brief
[contribution guidelines][contributing].
Please also consider supporting development by making a
[monetary donation][donations]. Thank you!
Magit was started by [Marius Vollmer][marius] and is now maintained
by [Jonas Bernoulli][jonas]. Other Magitians (former maintainers)
are [Nicolas Dudebout][nicolas], [Peter J. Weisberg][peter],
[Phil Jackson][phil], [Rémi Vanicat][remi], and [Yann Hodique][yann].
Many more people have [contributed code][stats-authors] and suggested
features.
Thanks to all of you, may (the history of) the source be with you!
Dependencies
============
If you install Magit using Emacs' package manager then dependencies
are automatically being taken care of. Otherwise you have to track
down dependencies and install them manually.
Magit requires the libraries `git-commit-mode` and `git-rebase-mode`
which are part of the [magit/git-modes][git-modes] repository and are
distributed as separate packages.
The library `magit-wip` additionally requires the [`git-wip`][git-wip]
script, which you have to install manually.
[contributing]: https://github.com/magit/magit/blob/master/CONTRIBUTING.md
[development]: http://github.com/magit/magit
[donations]: http://magit.vc/donations.html
[emacsstack]: http://emacs.stackexchange.com/questions/tagged/magit
[faq]: https://github.com/magit/magit/wiki/FAQ
[group]: https://groups.google.com/forum/?fromgroups#!forum/magit
[install]: https://github.com/magit/magit/wiki/Installation
[issues]: https://github.com/magit/magit/issues
[manual]: http://magit.vc/manual/master
[pulls]: https://github.com/magit/magit/pulls
[stats-authors]: http://magit.vc/stats/authors.html
[website]: http://magit.vc
[jonas]: http://emacsair.me
[marius]: https://github.com/mvollmer
[nicolas]: http://dudebout.com
[peter]: https://github.com/pjweisberg
[phil]: https://github.com/philjackson
[remi]: https://github.com/vanicat
[yann]: http://www.hodique.info
[emacs]: http://www.gnu.org/software/emacs
[git-wip]: https://github.com/bartman/git-wip
[git]: http://git-scm.com
[git-modes]: https://github.com/magit/git-modes
[marmalade]: http://marmalade-repo.org
[melpa]: http://melpa.org
[melpa-stable]: http://stable.melpa.org
[vc]: http://www.gnu.org/software/emacs/manual/html_node/emacs/Version-Control.html

View file

@ -0,0 +1,18 @@
This is the file .../info/dir, which contains the
topmost node of the Info hierarchy, called (dir)Top.
The first time you invoke Info you start off looking at this node.

File: dir, Node: Top This is the top of the INFO tree
This (the Directory node) gives a menu of major topics.
Typing "q" exits, "?" lists all Info commands, "d" returns here,
"h" gives a primer for first-timers,
"mEmacs<Return>" visits the Emacs manual, etc.
In Emacs, you can click mouse button 2 on a menu item or cross reference
to select it.
* Menu:
Emacs
* Magit (1.4.0): (magit). Using Git from Emacs with Magit. (1.4.0)

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,307 @@
;;; magit-blame.el --- blame support for Magit
;; Copyright (C) 2012-2015 The Magit Project Developers
;;
;; For a full list of contributors, see the AUTHORS.md file
;; at the top-level directory of this distribution and at
;; https://raw.github.com/magit/magit/master/AUTHORS.md
;; Author: Yann Hodique <yann.hodique@gmail.com>
;; Package: magit
;; Contains code from Egg (Emacs Got Git) <https://github.com/byplayer/egg>,
;; released under the GNU General Public License version 3 or later.
;; 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:
;; Control git-blame from Magit.
;; This code has been backported from Egg (Magit fork) to Magit.
;;; Code:
(eval-when-compile (require 'cl-lib))
(require 'magit)
(require 'easymenu)
;;; Options
(defgroup magit-blame nil
"Git-blame support for Magit."
:group 'magit-extensions)
(defcustom magit-blame-ignore-whitespace t
"Ignore whitespace when determining blame information."
:group 'magit-blame
:type 'boolean)
(defcustom magit-time-format-string "%Y-%m-%dT%T%z"
"How to format time in magit-blame header."
:group 'magit-blame
:type 'string)
(defface magit-blame-header
'((t :inherit magit-section-title))
"Face for blame header."
:group 'magit-faces)
(defface magit-blame-sha1
'((t :inherit (magit-log-sha1 magit-blame-header)))
"Face for blame sha1."
:group 'magit-faces)
(defface magit-blame-culprit
'((t :inherit magit-blame-header))
"Face for blame culprit."
:group 'magit-faces)
(defface magit-blame-time
'((t :inherit magit-blame-header))
"Face for blame time."
:group 'magit-faces)
(defface magit-blame-subject
'((t :inherit (magit-log-message magit-blame-header)))
"Face for blame tag line."
:group 'magit-faces)
;;; Keymaps
(defvar magit-blame-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "l") 'magit-blame-locate-commit)
(define-key map (kbd "RET") 'magit-blame-locate-commit)
(define-key map (kbd "q") 'magit-blame-mode)
(define-key map (kbd "n") 'magit-blame-next-chunk)
(define-key map (kbd "p") 'magit-blame-previous-chunk)
map)
"Keymap for an annotated section.\\{magit-blame-map}")
(easy-menu-define magit-blame-mode-menu magit-blame-map
"Magit blame menu"
'("Blame"
["Locate Commit" magit-blame-locate-commit t]
["Next" magit-blame-next-chunk t]
["Previous" magit-blame-previous-chunk t]
"---"
["Quit" magit-blame-mode t]))
;;; Mode
(defvar-local magit-blame-buffer-read-only nil)
;;;###autoload
(define-minor-mode magit-blame-mode
"Display blame information inline."
:keymap magit-blame-map
:lighter " blame"
(unless (buffer-file-name)
(user-error "Current buffer has no associated file!"))
(when (and (buffer-modified-p)
(y-or-n-p (format "save %s first? " (buffer-file-name))))
(save-buffer))
(cond (magit-blame-mode
(setq magit-blame-buffer-read-only buffer-read-only)
(magit-blame-file-on (current-buffer))
(set-buffer-modified-p nil)
(setq buffer-read-only t))
(t
(magit-blame-file-off (current-buffer))
(set-buffer-modified-p nil)
(setq buffer-read-only magit-blame-buffer-read-only))))
(defun magit-blame-file-off (buffer)
(save-excursion
(save-restriction
(with-current-buffer buffer
(widen)
(mapc (lambda (ov)
(when (overlay-get ov :blame)
(delete-overlay ov)))
(overlays-in (point-min) (point-max)))))))
(defun magit-blame-file-on (buffer)
(magit-blame-file-off buffer)
(save-excursion
(with-current-buffer buffer
(save-restriction
(with-temp-buffer
(apply 'magit-git-insert "blame" "--porcelain"
`(,@(and magit-blame-ignore-whitespace (list "-w")) "--"
,(file-name-nondirectory (buffer-file-name buffer))))
(magit-blame-parse buffer (current-buffer)))))))
;;; Commands
(defun magit-blame-locate-commit (pos)
"Jump to a commit in the branch history from an annotated blame section."
(interactive "d")
(let ((overlays (overlays-at pos))
sha1)
(dolist (ov overlays)
(when (overlay-get ov :blame)
(setq sha1 (plist-get (nth 3 (overlay-get ov :blame)) :sha1))))
(when sha1
(magit-show-commit sha1))))
(defun magit-blame-next-chunk ()
"Go to the next blame chunk."
(interactive)
(let ((next (next-single-property-change (point) :blame)))
(when next
(goto-char next))))
(defun magit-blame-previous-chunk ()
"Go to the previous blame chunk."
(interactive)
(let ((prev (previous-single-property-change (point) :blame)))
(when prev
(goto-char prev))))
;;; Parse
(defun magit-blame-decode-time (unixtime &optional tz)
"Decode UNIXTIME into (HIGH LOW) format.
The second argument TZ can be used to add the timezone in (-)HHMM
format to UNIXTIME. UNIXTIME should be either a number
containing seconds since epoch or Emacs's (HIGH LOW . IGNORED)
format."
(when (numberp tz)
(unless (numberp unixtime)
(setq unixtime (float-time unixtime)))
(let* ((ptz (abs tz))
(min (+ (* (/ ptz 100) 60)
(mod ptz 100))))
(setq unixtime (+ (* (if (< tz 0) (- min) min) 60) unixtime))))
(when (numberp unixtime)
(setq unixtime (seconds-to-time unixtime)))
unixtime)
(defun magit-blame-format-time-string (format &optional unixtime tz)
"Use FORMAT to format the time UNIXTIME, or now if omitted.
UNIXTIME is specified as a number containing seconds since epoch
or Emacs's (HIGH LOW . IGNORED) format. The optional argument TZ
can be used to set the time zone. If TZ is a number it is
treated as a (-)HHMM offset to Universal Time. If TZ is not
a number and non-nil the time is printed in UTC. If TZ is nil
the local zime zone is used. The format of the function is
similar to `format-time-string' except for %Z which is not
officially supported at the moment."
(unless unixtime
(setq unixtime (current-time)))
(when (numberp tz) ;; TODO add support for %Z
(setq format (replace-regexp-in-string "%z" (format "%+05d" tz) format)))
(format-time-string format (magit-blame-decode-time unixtime tz) tz))
(defun magit-blame-parse (target-buf blame-buf)
"Parse blame-info in buffer BLAME-BUF and decorate TARGET-BUF buffer."
(save-match-data
(let ((blank (propertize " " 'face 'magit-blame-header))
(nl (propertize "\n" 'face 'magit-blame-header))
(commit-hash (make-hash-table :test 'equal :size 577))
commit commit-info old-line new-line num old-file subject author
author-time author-timezone info ov beg end blame)
(with-current-buffer blame-buf
(goto-char (point-min))
;; search for a ful commit info
(while (re-search-forward
"^\\([0-9a-f]\\{40\\}\\) \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\)$"
nil t)
(setq commit (match-string-no-properties 1)
old-line (string-to-number
(match-string-no-properties 2))
new-line (string-to-number
(match-string-no-properties 3))
num (string-to-number
(match-string-no-properties 4)))
;; was this commit already seen (and stored in the hash)?
(setq commit-info (gethash commit commit-hash))
;; Nope, this is the 1st time, the full commit-info follow.
(unless commit-info
(re-search-forward "^author \\(.+\\)$")
(setq author (match-string-no-properties 1))
(re-search-forward "^author-time \\(.+\\)$")
(setq author-time (string-to-number
(match-string-no-properties 1)))
(re-search-forward "^author-tz \\(.+\\)$")
(setq author-timezone (string-to-number
(match-string-no-properties 1)))
(re-search-forward "^summary \\(.+\\)$")
(setq subject (match-string-no-properties 1))
(re-search-forward "^filename \\(.+\\)$")
(setq old-file (match-string-no-properties 1))
(setq commit-info (list :sha1 commit :author author
:author-time author-time
:author-timezone author-timezone
:subject subject :file old-file))
;; save it in the hash
(puthash commit commit-info commit-hash))
;; add the current blame-block into the list INFO.
(setq info (cons (list old-line new-line num commit-info)
info))))
;; now do from beginning
(setq info (nreverse info))
(with-current-buffer target-buf
;; for every blame chunk
(dolist (chunk info)
(setq commit-info (nth 3 chunk)
old-line (nth 0 chunk)
new-line (nth 1 chunk)
num (nth 2 chunk)
commit (plist-get commit-info :sha1)
author (plist-get commit-info :author)
author-time (plist-get commit-info :author-time)
author-timezone (plist-get commit-info :author-timezone)
subject (plist-get commit-info :subject))
(goto-char (point-min))
(forward-line (1- new-line))
(setq beg (line-beginning-position)
end (save-excursion
(forward-line num)
(line-beginning-position)))
;; mark the blame chunk
(put-text-property beg end :blame chunk)
;; make an overlay with blame info as 'before-string
;; on the current chunk.
(setq ov (make-overlay beg end))
(overlay-put ov :blame chunk)
(setq blame (concat
(propertize (substring-no-properties commit 0 8)
'face 'magit-blame-sha1)
blank
(propertize (format "%-20s" author)
'face 'magit-blame-culprit)
blank
(propertize (magit-blame-format-time-string
magit-time-format-string
author-time author-timezone)
'face 'magit-blame-time)
blank
(propertize subject 'face 'magit-blame-subject)
blank nl))
(overlay-put ov 'before-string blame))))))
(provide 'magit-blame)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
;;; magit-blame.el ends here

Binary file not shown.

View file

@ -0,0 +1,735 @@
;;; magit-key-mode.el --- interactively tune git invocation
;; Copyright (C) 2010-2015 The Magit Project Developers
;;
;; For a full list of contributors, see the AUTHORS.md file
;; at the top-level directory of this distribution and at
;; https://raw.github.com/magit/magit/master/AUTHORS.md
;; Author: Phil Jackson <phil@shellarchive.co.uk>
;; Package: 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 `magit-key-mode' which is used throughout
;; Magit to let the user interactively select the command, switches
;; and options to call Git with. It can be though of as a way to
;; provide "postfix" arguments.
;;; Code:
(require 'magit)
(eval-when-compile (require 'cl-lib))
(defvar magit-key-mode-keymaps)
(defvar magit-key-mode-last-buffer)
(defvar magit-pre-key-mode-window-conf)
;;; Options
(defcustom magit-key-mode-show-usage t
"Whether to show usage information when entering a popup."
:group 'magit
:type 'boolean)
;;; Faces
(defface magit-key-mode-header-face
'((t :inherit font-lock-keyword-face))
"Face for key mode header lines."
:group 'magit-faces)
(defface magit-key-mode-button-face
'((t :inherit font-lock-builtin-face))
"Face for key mode buttons."
:group 'magit-faces)
(defface magit-key-mode-switch-face
'((t :inherit font-lock-warning-face))
"Face for key mode switches."
:group 'magit-faces)
(defface magit-key-mode-args-face
'((t :inherit widget-field))
"Face for key mode switch arguments."
:group 'magit-faces)
;;; Keygroups
;;;###autoload
(defvar magit-key-mode-groups
'((dispatch
(actions
("b" "Branching" magit-key-mode-popup-branching)
("B" "Bisecting" magit-key-mode-popup-bisecting)
("c" "Committing" magit-key-mode-popup-committing)
("d" "Diff worktree" magit-diff-working-tree)
("D" "Diff" magit-diff)
("f" "Fetching" magit-key-mode-popup-fetching)
("F" "Pulling" magit-key-mode-popup-pulling)
("g" "Refresh Buffers" magit-refresh-all)
("l" "Logging" magit-key-mode-popup-logging)
("m" "Merging" magit-key-mode-popup-merging)
("M" "Remoting" magit-key-mode-popup-remoting)
("P" "Pushing" magit-key-mode-popup-pushing)
("o" "Submoduling" magit-key-mode-popup-submodule)
("r" "Rewriting" magit-key-mode-popup-rewriting)
("R" "Rebasing" magit-rebase-step)
("s" "Show Status" magit-status)
("S" "Stage all" magit-stage-all)
("t" "Tagging" magit-key-mode-popup-tagging)
("U" "Unstage all" magit-unstage-all)
("v" "Show Commit" magit-show-commit)
("V" "Show File" magit-show)
("w" "Wazzup" magit-wazzup)
("X" "Reset worktree" magit-reset-working-tree)
("y" "Cherry" magit-cherry)
("z" "Stashing" magit-key-mode-popup-stashing)
("!" "Running" magit-key-mode-popup-running)
("$" "Show Process" magit-process)))
(logging
(man-page "git-log")
(actions
("l" "Short" magit-log)
("L" "Long" magit-log-long)
("h" "Head Reflog" magit-reflog-head)
("f" "File log" magit-file-log)
("rl" "Ranged short" magit-log-ranged)
("rL" "Ranged long" magit-log-long-ranged)
("rh" "Reflog" magit-reflog))
(switches
("-m" "Only merge commits" "--merges")
("-s" "No merge commits" "--no-merges")
("-do" "Date Order" "--date-order")
("-f" "First parent" "--first-parent")
("-i" "Case insensitive patterns" "-i")
("-pr" "Pickaxe regex" "--pickaxe-regex")
("-g" "Show Graph" "--graph")
("-n" "Name only" "--name-only")
("-am" "All match" "--all-match")
("-al" "All" "--all"))
(arguments
("=r" "Relative" "--relative=" read-directory-name)
("=c" "Committer" "--committer=" read-from-minibuffer)
("=>" "Since" "--since=" read-from-minibuffer)
("=<" "Before" "--before=" read-from-minibuffer)
("=a" "Author" "--author=" read-from-minibuffer)
("=g" "Grep messages" "--grep=" read-from-minibuffer)
("=G" "Grep patches" "-G" read-from-minibuffer)
("=L" "Trace evolution of line range [long log only]"
"-L" magit-read-file-trace)
("=s" "Pickaxe search" "-S" read-from-minibuffer)
("=b" "Branches" "--branches=" read-from-minibuffer)
("=R" "Remotes" "--remotes=" read-from-minibuffer)))
(running
(actions
("!" "Git Subcommand (from root)" magit-git-command-topdir)
(":" "Git Subcommand (from pwd)" magit-git-command)
("g" "Git Gui" magit-run-git-gui)
("k" "Gitk" magit-run-gitk)))
(fetching
(man-page "git-fetch")
(actions
("f" "Current" magit-fetch-current)
("a" "All" magit-remote-update)
("o" "Other" magit-fetch))
(switches
("-p" "Prune" "--prune")))
(pushing
(man-page "git-push")
(actions
("P" "Push" magit-push)
("t" "Push tags" magit-push-tags))
(switches
("-f" "Force" "--force")
("-d" "Dry run" "-n")
("-u" "Set upstream" "-u")))
(pulling
(man-page "git-pull")
(actions
("F" "Pull" magit-pull))
(switches
("-f" "Force" "--force")
("-r" "Rebase" "--rebase")))
(branching
(man-page "git-branch")
(actions
("v" "Branch manager" magit-branch-manager)
("b" "Checkout" magit-checkout)
("c" "Create" magit-create-branch)
("r" "Rename" magit-rename-branch)
("k" "Delete" magit-delete-branch))
(switches
("-t" "Set upstream configuration" "--track")
("-m" "Merged to HEAD" "--merged")
("-M" "Merged to master" "--merged=master")
("-n" "Not merged to HEAD" "--no-merged")
("-N" "Not merged to master" "--no-merged=master"))
(arguments
("=c" "Contains" "--contains=" magit-read-rev-with-default)
("=m" "Merged" "--merged=" magit-read-rev-with-default)
("=n" "Not merged" "--no-merged=" magit-read-rev-with-default)))
(remoting
(man-page "git-remote")
(actions
("v" "Remote manager" magit-branch-manager)
("a" "Add" magit-add-remote)
("r" "Rename" magit-rename-remote)
("k" "Remove" magit-remove-remote)))
(tagging
(man-page "git-tag")
(actions
("t" "Create" magit-tag)
("k" "Delete" magit-delete-tag))
(switches
("-a" "Annotate" "--annotate")
("-f" "Force" "--force")
("-s" "Sign" "--sign")))
(stashing
(man-page "git-stash")
(actions
("v" "View" magit-diff-stash)
("z" "Save" magit-stash)
("s" "Snapshot" magit-stash-snapshot)
("a" "Apply" magit-stash-apply)
("p" "Pop" magit-stash-pop)
("k" "Drop" magit-stash-drop))
(switches
("-k" "Keep index" "--keep-index")
("-u" "Include untracked files" "--include-untracked")
("-a" "Include all files" "--all")))
(committing
(man-page "git-commit")
(actions
("c" "Commit" magit-commit)
("a" "Amend" magit-commit-amend)
("e" "Extend" magit-commit-extend)
("r" "Reword" magit-commit-reword)
("f" "Fixup" magit-commit-fixup)
("s" "Squash" magit-commit-squash))
(switches
("-a" "Stage all modified and deleted files" "--all")
("-e" "Allow empty commit" "--allow-empty")
("-v" "Show diff of changes to be committed" "--verbose")
("-n" "Bypass git hooks" "--no-verify")
("-s" "Add Signed-off-by line" "--signoff")
("-R" "Claim authorship and reset author date" "--reset-author"))
(arguments
("=A" "Override the author" "--author=" read-from-minibuffer)
("=S" "Sign using gpg" "--gpg-sign=" magit-read-gpg-secret-key)))
(merging
(man-page "git-merge")
(actions
("m" "Merge" magit-merge)
("A" "Abort" magit-merge-abort))
(switches
("-ff" "Fast-forward only" "--ff-only")
("-nf" "No fast-forward" "--no-ff")
("-sq" "Squash" "--squash"))
(arguments
("-st" "Strategy" "--strategy=" read-from-minibuffer)))
(rewriting
(actions
("b" "Begin" magit-rewrite-start)
("s" "Stop" magit-rewrite-stop)
("a" "Abort" magit-rewrite-abort)
("f" "Finish" magit-rewrite-finish)
("d" "Diff pending" magit-rewrite-diff-pending)
("*" "Set unused" magit-rewrite-set-unused)
("." "Set used" magit-rewrite-set-used)))
(apply-mailbox
(man-page "git-am")
(actions
("J" "Apply Mailbox" magit-apply-mailbox))
(switches
("-s" "add a Signed-off-by line to the commit message" "--signoff")
("-3" "allow fall back on 3way merging if needed" "--3way")
("-k" "pass -k flag to git-mailinfo" "--keep")
("-c" "strip everything before a scissors line" "--scissors")
("-p" "pass it through git-apply" "-p")
("-r" "override error message when patch failure occurs" "--resolvemsg")
("-d" "lie about committer date" "--committer-date-is-author-date")
("-D" "use current timestamp for author date" "--ignore-date")
("-b" "pass -b flag to git-mailinfo" "--keep-non-patch"))
(arguments
("=p" "format the patch(es) are in" "--patch-format=" read-from-minibuffer)))
(submodule
(man-page "git-submodule")
(actions
("u" "Update" magit-submodule-update)
("b" "Both update and init" magit-submodule-update-init)
("i" "Init" magit-submodule-init)
("s" "Sync" magit-submodule-sync)))
(bisecting
(man-page "git-bisect")
(actions
("b" "Bad" magit-bisect-bad)
("g" "Good" magit-bisect-good)
("k" "Skip" magit-bisect-skip)
("r" "Reset" magit-bisect-reset)
("s" "Start" magit-bisect-start)
("u" "Run" magit-bisect-run)))
(diff-options
(actions
("s" "Set" magit-set-diff-options)
("d" "Set default" magit-set-default-diff-options)
("c" "Save default" magit-save-default-diff-options)
("r" "Reset to default" magit-reset-diff-options)
("h" "Toggle Hunk Refinement" magit-diff-toggle-refine-hunk))
(switches
("-m" "Show smallest possible diff" "--minimal")
("-p" "Use patience diff algorithm" "--patience")
("-h" "Use histogram diff algorithm" "--histogram")
("-b" "Ignore whitespace changes" "--ignore-space-change")
("-w" "Ignore all whitespace" "--ignore-all-space")
("-W" "Show surrounding functions" "--function-context"))
))
"Holds the key, help, function mapping for the log-mode.
If you modify this make sure you reset `magit-key-mode-keymaps'
to nil.")
(defun magit-key-mode-delete-group (group)
"Delete a group from `magit-key-mode-keymaps'."
(let ((items (assoc group magit-key-mode-groups)))
(when items
;; reset the cache
(setq magit-key-mode-keymaps nil)
;; delete the whole group
(setq magit-key-mode-groups
(delq items magit-key-mode-groups))
;; unbind the defun
(magit-key-mode-de-generate group))
magit-key-mode-groups))
(defun magit-key-mode-add-group (group)
"Add a new group to `magit-key-mode-keymaps'.
If there already is a group of that name then this will
completely remove it and put in its place an empty one of the
same name."
(when (assoc group magit-key-mode-groups)
(magit-key-mode-delete-group group))
(setq magit-key-mode-groups
(cons (list group (list 'actions) (list 'switches) (list 'arguments))
magit-key-mode-groups)))
(defun magit-key-mode-key-defined-p (for-group key)
"Return t if KEY is defined as any option within FOR-GROUP.
The option may be a switch, argument or action."
(catch 'result
(let ((options (magit-key-mode-options-for-group for-group)))
(dolist (type '(actions switches arguments))
(when (assoc key (assoc type options))
(throw 'result t))))))
(defun magit-key-mode-update-group (for-group thing &rest args)
"Abstraction for setting values in `magit-key-mode-keymaps'."
(let* ((options (magit-key-mode-options-for-group for-group))
(things (assoc thing options))
(key (car args)))
(if (cdr things)
(if (magit-key-mode-key-defined-p for-group key)
(error "%s is already defined in the %s group." key for-group)
(setcdr (cdr things) (cons args (cddr things))))
(setcdr things (list args)))
(setq magit-key-mode-keymaps nil)
things))
(defun magit-key-mode-insert-argument (for-group key desc arg read-func)
"Add a new binding KEY in FOR-GROUP which will use READ-FUNC
to receive input to apply to argument ARG git is run. DESC should
be a brief description of the binding."
(magit-key-mode-update-group for-group 'arguments key desc arg read-func))
(defun magit-key-mode-insert-switch (for-group key desc switch)
"Add a new binding KEY in FOR-GROUP which will add SWITCH to git's
command line when it runs. DESC should be a brief description of
the binding."
(magit-key-mode-update-group for-group 'switches key desc switch))
(defun magit-key-mode-insert-action (for-group key desc func)
"Add a new binding KEY in FOR-GROUP which will run command FUNC.
DESC should be a brief description of the binding."
(magit-key-mode-update-group for-group 'actions key desc func))
(defun magit-key-mode-options-for-group (for-group)
"Retrieve the options for the group FOR-GROUP.
This includes switches, commands and arguments."
(or (cdr (assoc for-group magit-key-mode-groups))
(error "Unknown group '%s'" for-group)))
;;; Commands
(defun magit-key-mode-help (for-group)
"Provide help for a key within FOR-GROUP.
The user is prompted for the key."
(let* ((opts (magit-key-mode-options-for-group for-group))
(man-page (cadr (assoc 'man-page opts)))
(seq (read-key-sequence
(format "Enter command prefix%s: "
(if man-page
(format ", `?' for man `%s'" man-page)
""))))
(actions (cdr (assoc 'actions opts))))
(cond
;; if it is an action popup the help for the to-be-run function
((assoc seq actions) (describe-function (nth 2 (assoc seq actions))))
;; if there is "?" show a man page if there is one
((equal seq "?")
(if man-page
(man man-page)
(error "No man page associated with `%s'" for-group)))
(t (error "No help associated with `%s'" seq)))))
(defun magit-key-mode-exec-at-point ()
"Run action/args/option at point."
(interactive)
(let ((key (or (get-text-property (point) 'key-group-executor)
(error "Nothing at point to do."))))
(call-interactively (lookup-key (current-local-map) key))))
(defun magit-key-mode-jump-to-next-exec ()
"Jump to the next action/args/option point."
(interactive)
(let* ((oldp (point))
(old (get-text-property oldp 'key-group-executor))
(p (if (= oldp (point-max)) (point-min) (1+ oldp))))
(while (let ((new (get-text-property p 'key-group-executor)))
(and (not (= p oldp)) (or (not new) (eq new old))))
(setq p (if (= p (point-max)) (point-min) (1+ p))))
(goto-char p)
(skip-chars-forward " ")))
;;; Keymaps
(defvar magit-key-mode-keymaps nil
"This will be filled lazily with proper keymaps.
These keymaps are created using `define-key' as they're requested.")
(defun magit-key-mode-build-keymap (for-group)
"Construct a normal looking keymap for the key mode to use.
Put it in `magit-key-mode-keymaps' for fast lookup."
(let* ((options (magit-key-mode-options-for-group for-group))
(actions (cdr (assoc 'actions options)))
(switches (cdr (assoc 'switches options)))
(arguments (cdr (assoc 'arguments options)))
(map (make-sparse-keymap)))
(suppress-keymap map 'nodigits)
;; ret dwim
(define-key map (kbd "RET") 'magit-key-mode-exec-at-point)
;; tab jumps to the next "button"
(define-key map (kbd "TAB") 'magit-key-mode-jump-to-next-exec)
;; all maps should `quit' with `C-g' or `q'
(define-key map (kbd "C-g") `(lambda ()
(interactive)
(magit-key-mode-command nil)))
(define-key map (kbd "q") `(lambda ()
(interactive)
(magit-key-mode-command nil)))
;; run help
(define-key map (kbd "?") `(lambda ()
(interactive)
(magit-key-mode-help ',for-group)))
(let ((defkey (lambda (k action)
(when (and (lookup-key map (car k))
(not (numberp (lookup-key map (car k)))))
(message "Warning: overriding binding for `%s' in %S"
(car k) for-group)
(ding)
(sit-for 2))
(define-key map (car k)
`(lambda () (interactive) ,action)))))
(dolist (k actions)
(funcall defkey k `(magit-key-mode-command ',(nth 2 k))))
(dolist (k switches)
(funcall defkey k `(magit-key-mode-toggle-option ',for-group ,(nth 2 k))))
(dolist (k arguments)
(funcall defkey k `(magit-key-mode-add-argument
',for-group ,(nth 2 k) ',(nth 3 k)))))
(push (cons for-group map) magit-key-mode-keymaps)
map))
;;; Toggling and Running
(defvar magit-key-mode-prefix nil
"Prefix argument to the command that brought up the key-mode window.
For internal use. Used by the command that's eventually invoked.")
(defvar magit-key-mode-current-args nil
"A hash-table of current argument set.
These will eventually make it to the git command-line.")
(defvar magit-key-mode-current-options nil
"Current option set.
These will eventually make it to the git command-line.")
(defvar magit-custom-options nil
"List of custom options to pass to Git.
Do not customize this (used in the `magit-key-mode' implementation).")
(defun magit-key-mode-command (func)
(let ((current-prefix-arg (or current-prefix-arg magit-key-mode-prefix))
(magit-custom-options magit-key-mode-current-options))
(maphash (lambda (k v)
(push (concat k v) magit-custom-options))
magit-key-mode-current-args)
(set-window-configuration magit-pre-key-mode-window-conf)
(kill-buffer magit-key-mode-last-buffer)
(when func
(setq this-command func)
(call-interactively this-command))))
(defun magit-key-mode-add-argument (for-group arg-name input-func)
(let ((input (funcall input-func (concat arg-name ": "))))
(puthash arg-name input magit-key-mode-current-args)
(magit-key-mode-redraw for-group)))
(defun magit-key-mode-toggle-option (for-group option-name)
"Toggles the appearance of OPTION-NAME in `magit-key-mode-current-options'."
(if (member option-name magit-key-mode-current-options)
(setq magit-key-mode-current-options
(delete option-name magit-key-mode-current-options))
(add-to-list 'magit-key-mode-current-options option-name))
(magit-key-mode-redraw for-group))
;;; Mode
(defvar magit-key-mode-buf-name "*magit-key: %s*"
"Format string to create the name of the magit-key buffer.")
(defvar magit-key-mode-last-buffer nil
"Store the last magit-key buffer used.")
(defvar magit-pre-key-mode-window-conf nil
"Will hold the pre-menu configuration of magit.")
(defun magit-key-mode (for-group &optional original-opts)
"Mode for magit key selection.
All commands, switches and options can be toggled/actioned with
the key combination highlighted before the description."
(interactive)
;; save the window config to restore it as was (no need to make this
;; buffer local)
(setq magit-pre-key-mode-window-conf
(current-window-configuration))
;; setup the mode, draw the buffer
(let ((buf (get-buffer-create (format magit-key-mode-buf-name
(symbol-name for-group)))))
(setq magit-key-mode-last-buffer buf)
(split-window-vertically)
(other-window 1)
(switch-to-buffer buf)
(kill-all-local-variables)
(set (make-local-variable 'scroll-margin) 0)
(set (make-local-variable
'magit-key-mode-current-options)
original-opts)
(set (make-local-variable
'magit-key-mode-current-args)
(make-hash-table))
(set (make-local-variable 'magit-key-mode-prefix) current-prefix-arg)
(magit-key-mode-redraw for-group))
(when magit-key-mode-show-usage
(message (concat "Type a prefix key to toggle it. "
"Run 'actions' with their prefixes. "
"'?' for more help."))))
(defun magit-key-mode-get-key-map (for-group)
"Get or build the keymap for FOR-GROUP."
(or (cdr (assoc for-group magit-key-mode-keymaps))
(magit-key-mode-build-keymap for-group)))
(defun magit-key-mode-redraw (for-group)
"(re)draw the magit key buffer."
(let ((buffer-read-only nil)
(current-exec (get-text-property (point) 'key-group-executor))
(new-exec-pos)
(old-point (point))
(is-first (zerop (buffer-size)))
(actions-p nil))
(erase-buffer)
(make-local-variable 'font-lock-defaults)
(use-local-map (magit-key-mode-get-key-map for-group))
(setq actions-p (magit-key-mode-draw for-group))
(delete-trailing-whitespace)
(setq mode-name "magit-key-mode" major-mode 'magit-key-mode)
(when current-exec
(setq new-exec-pos
(cdr (assoc current-exec
(magit-key-mode-build-exec-point-alist)))))
(cond ((and is-first actions-p)
(goto-char actions-p)
(magit-key-mode-jump-to-next-exec))
(new-exec-pos
(goto-char new-exec-pos)
(skip-chars-forward " "))
(t
(goto-char old-point))))
(setq buffer-read-only t)
(fit-window-to-buffer))
(defun magit-key-mode-build-exec-point-alist ()
(save-excursion
(goto-char (point-min))
(let* ((exec (get-text-property (point) 'key-group-executor))
(exec-alist (and exec `((,exec . ,(point))))))
(cl-do nil ((eobp) (nreverse exec-alist))
(when (not (eq exec (get-text-property (point) 'key-group-executor)))
(setq exec (get-text-property (point) 'key-group-executor))
(when exec (push (cons exec (point)) exec-alist)))
(forward-char)))))
;;; Draw Buffer
(defun magit-key-mode-draw-header (header)
"Draw a header with the correct face."
(insert (propertize header 'face 'magit-key-mode-header-face) "\n"))
(defvar magit-key-mode-args-in-cols nil
"When true, draw arguments in columns as with switches and options.")
(defun magit-key-mode-draw-args (args)
"Draw the args part of the menu."
(magit-key-mode-draw-buttons
"Args"
args
(lambda (x)
(format "(%s) %s"
(nth 2 x)
(propertize (gethash (nth 2 x) magit-key-mode-current-args "")
'face 'magit-key-mode-args-face)))
(not magit-key-mode-args-in-cols)))
(defun magit-key-mode-draw-switches (switches)
"Draw the switches part of the menu."
(magit-key-mode-draw-buttons
"Switches"
switches
(lambda (x)
(format "(%s)" (let ((s (nth 2 x)))
(if (member s magit-key-mode-current-options)
(propertize s 'face 'magit-key-mode-switch-face)
s))))))
(defun magit-key-mode-draw-actions (actions)
"Draw the actions part of the menu."
(magit-key-mode-draw-buttons "Actions" actions nil))
(defun magit-key-mode-draw-buttons (section xs maker
&optional one-col-each)
(when xs
(magit-key-mode-draw-header section)
(magit-key-mode-draw-in-cols
(mapcar (lambda (x)
(let* ((head (propertize (car x) 'face 'magit-key-mode-button-face))
(desc (nth 1 x))
(more (and maker (funcall maker x)))
(text (format " %s: %s%s%s"
head desc (if more " " "") (or more ""))))
(propertize text 'key-group-executor (car x))))
xs)
one-col-each)))
(defun magit-key-mode-draw-in-cols (strings one-col-each)
"Given a list of strings, print in columns (using `insert').
If ONE-COL-EACH is true then don't columify, but rather, draw
each item on one line."
(let ((longest-act (apply 'max (mapcar 'length strings))))
(while strings
(let ((str (car strings)))
(let ((padding (make-string (- (+ longest-act 3) (length str)) ? )))
(insert str)
(if (or one-col-each
(and (> (+ (length padding) ;
(current-column)
longest-act)
(window-width))
(cdr strings)))
(insert "\n")
(insert padding))))
(setq strings (cdr strings))))
(insert "\n"))
(defun magit-key-mode-draw (for-group)
"Draw actions, switches and parameters.
Return the point before the actions part, if any, nil otherwise."
(let* ((options (magit-key-mode-options-for-group for-group))
(switches (cdr (assoc 'switches options)))
(arguments (cdr (assoc 'arguments options)))
(actions (cdr (assoc 'actions options)))
(p nil))
(magit-key-mode-draw-switches switches)
(magit-key-mode-draw-args arguments)
(when actions (setq p (point-marker)))
(magit-key-mode-draw-actions actions)
(insert "\n")
p))
;;; Generate Groups
(defun magit-key-mode-de-generate (group)
"Unbind the function for GROUP."
(fmakunbound
(intern (concat "magit-key-mode-popup-" (symbol-name group)))))
(defun magit-key-mode-generate (group)
"Generate the key-group menu for GROUP."
(let ((opts (magit-key-mode-options-for-group group)))
(eval
`(defun ,(intern (concat "magit-key-mode-popup-" (symbol-name group))) nil
,(concat "Key menu for " (symbol-name group))
(interactive)
(magit-key-mode
(quote ,group)
;; As a tempory kludge it is okay to do this here.
,(cl-case group
(logging
'(list "--graph"))
(diff-options
'(when (local-variable-p 'magit-diff-options)
magit-diff-options))))))))
;; create the interactive functions for the key mode popups (which are
;; applied in the top-level key maps)
(mapc (lambda (g)
(magit-key-mode-generate (car g)))
magit-key-mode-groups)
;;;###autoload (mapc (lambda (g) (eval `(autoload ',(intern (concat "magit-key-mode-popup-" (symbol-name (car g)))) "magit-key-mode" ,(concat "Key menu for " (symbol-name (car g))) t))) magit-key-mode-groups)
(provide 'magit-key-mode)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
;;; magit-key-mode.el ends here

Binary file not shown.

View file

@ -0,0 +1,9 @@
(define-package "magit" "20150608.1139" "control Git from Emacs"
'((cl-lib "0.5")
(git-commit-mode "1.0.0")
(git-rebase-mode "1.0.0"))
:keywords
'("vc" "tools"))
;; Local Variables:
;; no-byte-compile: t
;; End:

View file

@ -0,0 +1,143 @@
;;; magit-wip.el --- git-wip plug-in for Magit
;; Copyright (C) 2012-2015 The Magit Project Developers
;;
;; For a full list of contributors, see the AUTHORS.md file
;; at the top-level directory of this distribution and at
;; https://raw.github.com/magit/magit/master/AUTHORS.md
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Keywords: vc tools
;; Package: 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 plug-in provides support for special work-in-progress refs.
;; This requires the third-party git command "git wip" which is available
;; from https://github.com/bartman/git-wip.
;; To enable `magit-wip-save-mode' enable `global-magit-wip-save-mode'
;; and use the Magit extension mechanism to select the repositories in
;; which you want to use a work-in-progress ref.
;;
;; (global-magit-wip-save-mode 1)
;;
;; $ git config --add magit.extension wip-save # or
;; $ git config --global --add magit.extension wip-save
;; Note that `global-magit-wip-save-mode' is the only mode that uses the
;; extension mechanism for file-visiting buffers all other global modes
;; making use of it to turn on local modes in Magit buffers.
;;; Code:
(require 'magit)
(require 'format-spec)
(defun magit-wip-mode (&rest ignore)
(message "magit-wip-mode is obsolete and doesn't do anything"))
(make-obsolete 'magit-wip-mode "This mode is a noop now" "1.4.0")
;;; Options
(defgroup magit-wip nil
"Git-Wip support for Magit."
:group 'magit-extensions)
(defcustom magit-wip-commit-message "WIP %r"
"Commit message for git-wip commits.
The following `format'-like specs are supported:
%f the full name of the file being saved
%g the root of the git repository
%r the name of the file being saved,
relative to the repository root."
:group 'magit-wip
:type 'string)
(defcustom magit-wip-echo-area-message "Wrote %f (wip)"
"Message shown in the echo area after creating a git-wip commit.
The following `format'-like specs are supported:
%f the full name of the file being saved
%g the root of the git repository
%r the name of the file being saved,
relative to the repository root."
:group 'magit-wip
:type '(choice (const :tag "No message" nil) string))
(defvar magit-wip-save-mode-lighter " Wip")
;;; Mode
;;;###autoload
(define-minor-mode magit-wip-save-mode
"Magit support for committing to a work-in-progress ref.
When this minor mode is turned on and a file is saved inside a
writable git repository then it is also committed to a special
work-in-progress ref."
:lighter magit-wip-save-mode-lighter
(if magit-wip-save-mode
(add-hook 'after-save-hook 'magit-wip-save t t)
(remove-hook 'after-save-hook 'magit-wip-save t)))
;;;###autoload
(define-globalized-minor-mode global-magit-wip-save-mode
magit-wip-save-mode turn-on-magit-wip-save
:group 'magit-wip)
(defun turn-on-magit-wip-save ()
"Conditionally turn on magit-wip-save-mode.
Turn on magit-wip-save-mode if the buffer is a file in a git
repository where wip-save is enabled in git config.
You can activate it with git config magit.extension wip-save."
(when (and (buffer-file-name)
(magit-get-top-dir)
(magit-git-true "rev-parse" "--is-inside-work-tree")
(member "wip-save" (magit-get-all "magit.extension")))
(if (magit-git-success "wip" "-h")
(magit-wip-save-mode 1)
(message "Git command 'git wip' cannot be found"))))
(defun magit-wip-save ()
(let* ((filename (expand-file-name (file-truename (buffer-file-name))))
(filedir (file-name-directory filename))
(toplevel (magit-get-top-dir filedir))
(blobname (file-relative-name filename toplevel))
(spec `((?f . ,filename)
(?r . ,blobname)
(?g . ,toplevel))))
(when (and toplevel (file-writable-p toplevel)
(not (member blobname
(let ((default-directory filedir))
(magit-git-lines
"ls-files" "--other" "--ignored"
"--exclude-standard" "--full-name")))))
(magit-run-git "wip" "save"
(format-spec magit-wip-commit-message spec)
"--editor" "--" filename)
(when magit-wip-echo-area-message
(message (format-spec magit-wip-echo-area-message spec))))))
(provide 'magit-wip)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
;;; magit-wip.el ends here

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff