[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Magit and seeing the whole diff
From: |
Andrea Crotti |
Subject: |
Magit and seeing the whole diff |
Date: |
Sat, 18 Dec 2010 21:21:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) |
I was trying to make a small (but for me nice) enhancemente to magit.el.
I also forked the repo so then if it works I can try to propose it.
Don't know if someone used it but basically I would like to
1. see automatically the "diff --cached HEAD" when I execute
magit-status.
2. when I write the commit message, see the whole diff right below.
In this way I'm sure that I'm not committing something I don't want and
I can write everything in the comments.
The function to modify could be this:
(defun magit-pop-to-log-edit (operation)
(let ((dir default-directory)
(buf (get-buffer-create magit-log-edit-buffer-name)))
(setq magit-pre-log-edit-window-configuration
(current-window-configuration))
(pop-to-buffer buf)
(when (file-exists-p ".git/MERGE_MSG")
;; --- my addition
;TODO: not working yet, try to see the diff as show in the rest of the
code
(insert (shell-command-to-string "git diff HEAD"))
;; --- end
(insert-file-contents ".git/MERGE_MSG"))
(setq default-directory dir)
(magit-log-edit-mode)
(message "Type C-c C-c to %s (C-c C-k to cancel)." operation)))
This is very rough and should be changed to use the code already present
to call git, but the thing is that if I evaluate this function like this
my instruction is completely SKIPPED!
I also tried with edebug to see what happens and well is just skipped.
In the doc before it was marked as a "compiled" function, but when I
modify and evaluate it it's marked as a lisp function, so from my
understanding is my own function, not the old compiled one.
Any idea?
- Magit and seeing the whole diff,
Andrea Crotti <=