Commit graph

49 commits

Author SHA1 Message Date
Henrik Lissner
518c97a2ac
Rename {if,when}! -> eval-{if,when}!
To better represent its purpose, as extensions to Emacs' eval-when*
API (for control flow at compile time).
2020-08-27 01:10:08 -04:00
Henrik Lissner
95c5ebc01a
Fix #3726: respect +magit-open-windows-in-direction
Also fixes an issue where `q` would not delete a magit-dedicated split
window (leaving duplicate magit-status windows about).
2020-08-11 13:48:12 -04:00
Henrik Lissner
a16c40d493
tools/magit: split sub-windows to the side
When a log or diff buffer is opened from the magit status buffer, it
would display them in a random window (or split, if none were
available). This changes forces it to predictably open to the right of
the magit status window (using the next window over, if available).
2020-08-06 00:22:39 -04:00
Henrik Lissner
885197bd06
Fix "Cannot determine magit's version" logs on Windows
Magit complains loudly (but harmlessly) when it can't determine its own
version in a sparse clone. This was fixed upstream in
magit/magit@b1b2683 for unix OSes, but not for Windows where symlinks
aren't supported, and so `magit-version` can't resolve its own repo's
root (see raxod502/straight.el#520).
2020-05-20 16:08:52 -04:00
Henrik Lissner
94fc6f714f
Bump :tools magit
magit/magit@d27d6e4 -> magit/magit@b1b2683
magit/forge@e2da806 -> magit/forge@09bf8ad

We no longer need the magit version hack, thanks to magit/magit@b1b2683
2020-05-20 01:10:15 -04:00
Henrik Lissner
ea18c83c0a
General refactors & reformatting across the board 2020-05-15 01:44:53 -04:00
Henrik Lissner
3622e36c75
Fix 'buffer does not seem to be associated with any file' error
Fixes #2869
Closes #2870
2020-04-10 13:47:41 -04:00
Henrik Lissner
93521ba5be
Prevent "version control data is outdated" prompt
The prompt was too intrusive, so update vc state if buffer is modified
instead.
2020-03-14 22:04:49 -04:00
Henrik Lissner
0a9b06ac16
Prevent magit trying to revert non-existent file buffers 2020-02-25 20:23:04 -05:00
Henrik Lissner
24282a454e
Fix revert-buffer--default error after using magit
It too aggressively tries to revert all buffers, even ones that can't be
reverted.
2020-02-24 19:30:35 -05:00
Henrik Lissner
731e1c503d
Lazily revert affected buffers after magit 2020-02-21 13:40:52 -05:00
Henrik Lissner
48cd3e0ad0
tools/magit: prevent 'cannot determine magit's version' warnings
By ensuring the advice runs twice.
2019-12-15 23:43:33 -05:00
Edmund Miller
89f4f9d88f
fix(magit): add bindings for github-review 2019-12-08 13:35:18 -06:00
Henrik Lissner
44e22b7f80
tools/magit: replace +magit/clone w/ magit-clone
The former no longer works, since ghub's API has changed. Meanwhile, the
magit-clone command has grown in features to match (and surpass)
+magit/clone, so we'll just use that instead.
2019-11-23 01:21:25 -05:00
Henrik Lissner
19bfb1285d
Fix #1852: magit not restoring wconf when quitting 2019-10-03 16:43:49 -04:00
Henrik Lissner
bad0dba1fc
tools/magit: refactor magit-version advice
Not strictly necessary, but more correct.
2019-09-20 17:18:16 -04:00
Henrik Lissner
2d365619cd
General refactor & cleanup, across the board 2019-09-13 22:00:34 -04:00
Henrik Lissner
ccaf92b0d3
tools/magit: don't kill all magit buffers when quitting one
And mark all outdated buffers, rather than just the ones in the current
workgroup.
2019-08-28 15:22:14 -04:00
Henrik Lissner
9ab49be564
Fix "fatal: no names found" errors on 'doom rebuild'
Some packages that depend on org (like elfeed) will load the built-in
org early in the rebuild/package install process, which causes org to
define org-release and org-git-version, sometimes overwriting our stubs
for it. Without our hack, org call 'git describe' in the org repo in an
attempt to determine the installed version, which won't work in a sparse
clone. To ensure future definitions never overwrite ours, we advise them
as well.

Also moves magit-version hack to its autoload file, for consistency with
org's hacks.
2019-08-07 16:31:45 -04:00
Henrik Lissner
6b5d65b55b
tools/magit: reuse magit-status window
Instead of opening the same buffer in a new window.
2019-07-22 04:01:18 +02:00
Henrik Lissner
ce4b8940ca
tools/magit: revise default window management for magit
The former default display function would strive to open windows below
the current magit window (splitting it), but this would stack and
quickly become cramped. The behavior is now to reuse the same
window *unless* you're opening the process buffer or from the commit
window.
2019-07-22 02:30:41 +02:00
Henrik Lissner
149b2617b0
💥 revise hook/var fns naming convention (2/2)
This is second of three big naming convention changes. In this commit,
we change the naming conventions for hook functions and variable
functions:

1. Replace the bar | to indicate a hook function with a -h suffix, e.g.

     doom|init-ui -> doom-init-ui-h
     doom|run-local-var-hooks -> doom-run-local-var-hooks-h

2. And add a -fn suffix for functions meant to be set on variables,
   e.g.

     (setq magit-display-buffer-function #'+magit-display-buffer-fn)

See ccf327f8 for the reasoning behind these changes.
2019-07-22 02:30:38 +02:00
Henrik Lissner
51d3b1b424
💥 revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.

In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.

  doom*shut-up -> doom-shut-up-a
  doom*recenter -> doom-recenter-a
  +evil*static-reindent -> +evil--static-reindent-a

The rationale behind this change is:

1. Elisp's own formatting/indenting tools would occasionally struggle
   with | and * (particularly pp and cl-prettyprint). They have no
   problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
   github markdown) struggle with it, sometimes refusing to highlight
   code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
   intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
   on haphazardly way back when Doom was simply "my private config".

Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.

Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
  macro. The old pair weren't as useful. The new def-advice! saves on a
  lot of space.
- Removed "stage" assertions to make sure you were using the right
  macros in the right place. Turned out to not be necessary, we'll
  employ better checks later.
2019-07-22 02:27:45 +02:00
Henrik Lissner
108c7ba5ad
Fix 'selected killed buffer' error on +magit/quit 2019-06-30 13:20:07 +02:00
Huy Duong
c4b325fa4b Fix magit-clone error
magit-clone function has changed signature to work with transient.
So using the new magit-clone-regular instead.

Signed-off-by: Huy Duong <huy.duong@employmenthero.com>
2019-06-03 16:59:03 +07:00
Henrik Lissner
051f792205
tools/magit: remove +magit-display-popup-buffer
Because magit uses transient now, and other plugins that use magit-popup
don't seem to need it anymore.

And update docstring+comments.
2019-05-04 19:13:26 -04:00
Henrik Lissner
5bcab488a7
Add {vc,git-gutter}-mode checks to vc refresher 2019-04-01 13:21:25 -04:00
Henrik Lissner
bdd410cb9c
Refresh vc on-demand after quitting magit #1298
To avoid the long delay when you have many buffers open while quitting
magit.
2019-04-01 13:12:00 -04:00
Henrik Lissner
7f1c275d62
+magit/clone: fix void-function ghub--username 2019-02-18 20:13:37 -05:00
Henrik Lissner
ecfe52f71c
Fix +magit/clone to no longer use magithub 2019-02-18 18:26:19 -05:00
Henrik Lissner
ba0ccc1d34
tools/magit: cleanup magit concurrently
A quick attempt to make +magit/quit faster.
2019-02-14 00:40:19 -05:00
Henrik Lissner
f0465f22cc
tools/magit: fix +magit/quit & default display fn
When used with magit-display-buffer-traditional, q wouldn't close the
window, just kill the buffer inside.
2018-10-07 11:12:51 -04:00
Henrik Lissner
b573fcce20
quit-window on multiple magit-status windows
If you accidentally open multiple magit status windows, you'll be stuck
in a deadlock, where `q` will do nothing. Now, +magit/quit will use
`quit-window` on excess magit-status windows instead.
2018-10-03 00:04:08 -04:00
Henrik Lissner
fcd1e913c5
tools/magit: update vc on +magit/quit
Instead of magit-post-refresh-hook, which fires much more frequently.
Updating vc across all buffers is expensive, so let's only do it when we
quit magit.

Warning: this may make quitting magit expensive when you have many
buffers open. Still searching for a better solution.
2018-09-26 12:10:00 -04:00
Henrik Lissner
7d3ffdff06
Remove third line in section headers
This is truly important stuff. We've saved many lives with this update.
2018-09-09 09:58:19 -04:00
Henrik Lissner
17abb990e4
tools/magit: don't make new windows too tall
Some popups (like logs or revisions) completely consume the current
window.
2018-08-21 22:45:42 +02:00
Henrik Lissner
9e0e586dd8
tools/magit: use current window instead of fullcol
Full column is a bit tempermental. This also removes the need to restore
the window config after quitting magit.

Why the switch from full-frame magit to current-buffer? It is the least
intrusive policy; it doesn't rearrange the user's workspace.
2018-08-19 01:15:22 +02:00
Henrik Lissner
2cc5d223fe
Rewrite how magit windows/popups are managed
The old policy was to invoke magit in fullscreen, but in practice, I've
found myself wanting to peek at other buffers (maybe even notes) while I
manage my project in version control.

So this change introduces two big changes and one fix:

+ Instead of a full-frame policy, we use full-column. e.g. Invoking
  magit-status will take up a full column of windows (and will restore
  them when you quit).
+ Popups are displayed below the current window if called from a magit
  buffer, otherwise as a popup at the bottom of the frame.
+ Fixes popups opening in a random window if called from a magit buffer
  in a popup.

This is only a start and needs more testing.
2018-08-13 21:47:56 +02:00
Henrik Lissner
fd949e7063
Make diff larger when committing via magit
The diff window contains more important information, so we shrink the
git commit window and enlargen the diff window.
2018-06-16 21:48:37 +02:00
Henrik Lissner
01b2856cc2
From eshell, open magit buffers in same window 2018-06-16 15:20:10 +02:00
Henrik Lissner
c305d63dd7
Improve magit display-buffer logic
Now opens derivative magit buffers (from popup magit windows) in
fullscreen.
2018-06-16 14:38:52 +02:00
Henrik Lissner
383ecf7a08
Fix magit rebase/log windows being hidden by diffs 2018-06-10 17:28:17 +02:00
Henrik Lissner
85a0c9efc9
New default display-buffer handler for magit
+magit-display-buffer-fullscreen is a more sophisticated (albeit
experimental) replacement for magit-display-buffer-fullframe-status-v1,
which fullscreens magit, but will also:

a) Keep the status window visible
b) Treat magit buffers not opened from magit-status as popups
2018-06-07 02:51:45 +02:00
Henrik Lissner
bab530ea2e
Revert +hub flag, but disable magithub by default
Must be enabled on a per-project basis. You can change this behavior by
setting +magit-hub-enabled-by-default to non-nil (before magit is
loaded).

Magithub has been made opt-in because:

1. Magithub is imposing, asking the user for a token, especially for
   users who don't use github (much or at all), but may occasionally
   have a project with a github remote.
2. magithub is really slow on first load for medium-to-large repos.
3. It's really easy to enable it through the magithub popup (H C e).
   magithub.enabled is saved into the project's .git/config file, so the
   setting will persist.

Also added a docstring to +magit-hub-features
2018-06-01 11:13:37 +02:00
Henrik Lissner
3a16b70022
Add +magit/clone command & bind to SPC g C #633
magithub-clone doesn't support full urls, magit-clone doesn't support
user/repo notation. +magit/clone supports both.
2018-05-31 13:59:21 +02:00
Benjamin Andresen
8917bc9194 Fix: tools/magit: +magit--kill-buffer function call corrected 2018-04-12 00:41:38 +02:00
Henrik Lissner
460461ef54
tools/magit: clean up after magit more intelligently #506
Ensures magit buffers are cleaned up after magit-status is closed. Will
defer cleanup on process buffers, until the processes have finished.

Also fixes issue where quitting magit will leave leftover windows.
2018-04-08 20:44:40 -04:00
Henrik Lissner
163d0ce70e
tools/magit: don't kill processes 2018-04-04 09:35:39 -04:00
Henrik Lissner
b98e26856d
Add tools/magit/autoload.el 2018-04-04 08:04:54 -04:00