unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Magit and seeing the whole diff
@ 2010-12-18 20:21 Andrea Crotti
  2010-12-19 11:05 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 6+ messages in thread
From: Andrea Crotti @ 2010-12-18 20:21 UTC (permalink / raw)
  To: help-gnu-emacs

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?




^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <mailman.9.1292703974.5735.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2010-12-21  9:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-18 20:21 Magit and seeing the whole diff Andrea Crotti
2010-12-19 11:05 ` Thien-Thi Nguyen
2010-12-20 13:06   ` Andrea Crotti
2010-12-21  9:31     ` Thien-Thi Nguyen
     [not found] <mailman.9.1292703974.5735.help-gnu-emacs@gnu.org>
2010-12-20 12:48 ` Sébastien Vauban
2010-12-20 13:51   ` Andrea Crotti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).