summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-03-15 12:15:35 +0100
committerRicardo Wurmus <rekado@elephly.net>2023-03-15 12:15:35 +0100
commit1cc9036e7866e5ee343fc7049198ef473430451e (patch)
tree1c823286186838b83969a96e5690a1018b76379e
parentb99987e310a160fb0cd3020cb8440654de1c125c (diff)
magit: Use use-package.
-rw-r--r--init.org77
1 files changed, 39 insertions, 38 deletions
diff --git a/init.org b/init.org
index df02048..c1ede89 100644
--- a/init.org
+++ b/init.org
@@ -663,45 +663,46 @@ TODO: here’s the rest of my shell configuration:
* Magit
#+BEGIN_SRC elisp
-;; full screen magit-status
-(defadvice magit-status (around magit-fullscreen activate)
- (window-configuration-to-register :magit-fullscreen)
- ad-do-it
- (delete-other-windows))
-
-(defun my/magit-quit-session ()
- "Restores the previous window configuration and kills the magit buffer"
- (interactive)
- (kill-buffer)
- (jump-to-register :magit-fullscreen))
-
-(defun my/magit-toggle-whitespace ()
- "Toggles git option -w"
- (interactive)
- (if (member "-w" magit-diff-arguments)
- (my/magit-dont-ignore-whitespace)
- (my/magit-ignore-whitespace)))
-
-(defun my/magit-ignore-whitespace ()
- "Adds git option -w"
- (interactive)
- (add-to-list 'magit-diff-arguments "-w")
- (magit-refresh))
-
-(defun my/magit-dont-ignore-whitespace ()
- "Removes git option -w"
- (interactive)
- (setq magit-diff-arguments (remove "-w" magit-diff-arguments))
- (magit-refresh))
-
-(define-key magit-status-mode-map (kbd "q") 'my/magit-quit-session)
-(define-key magit-status-mode-map (kbd "W") 'my/magit-toggle-whitespace)
-
-(setq magit-diff-refine-hunk 'all)
-#+END_SRC
+(use-package magit
+ :config
+ ;; full screen magit-status
+ (defadvice magit-status (around magit-fullscreen activate)
+ (window-configuration-to-register :magit-fullscreen)
+ ad-do-it
+ (delete-other-windows))
+
+ (defun my/magit-quit-session ()
+ "Restores the previous window configuration and kills the magit buffer"
+ (interactive)
+ (kill-buffer)
+ (jump-to-register :magit-fullscreen))
+
+ (defun my/magit-toggle-whitespace ()
+ "Toggles git option -w"
+ (interactive)
+ (if (member "-w" magit-diff-arguments)
+ (my/magit-dont-ignore-whitespace)
+ (my/magit-ignore-whitespace)))
+
+ (defun my/magit-ignore-whitespace ()
+ "Adds git option -w"
+ (interactive)
+ (add-to-list 'magit-diff-arguments "-w")
+ (magit-refresh))
+
+ (defun my/magit-dont-ignore-whitespace ()
+ "Removes git option -w"
+ (interactive)
+ (setq magit-diff-arguments (remove "-w" magit-diff-arguments))
+ (magit-refresh))
-#+BEGIN_SRC elisp
-(global-set-key (kbd "C-c m") 'magit-status)
+ :custom
+ (magit-diff-refine-hunk 'all)
+ :bind
+ (("C-c m" . magit-status)
+ :map magit-status-mode-map
+ ("q" . my/magit-quit-session)
+ ("W" . my/magit-toggle-whitespace)))
#+END_SRC
* Completion