unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andrea Crotti <andrea.crotti.0@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Magit and seeing the whole diff
Date: Sat, 18 Dec 2010 21:21:04 +0100	[thread overview]
Message-ID: <m1bp4i96j3.fsf@ip1-201.halifax.rwth-aachen.de> (raw)

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?




             reply	other threads:[~2010-12-18 20:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-18 20:21 Andrea Crotti [this message]
2010-12-19 11:05 ` Magit and seeing the whole diff 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1bp4i96j3.fsf@ip1-201.halifax.rwth-aachen.de \
    --to=andrea.crotti.0@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).