From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Crotti Newsgroups: gmane.emacs.help Subject: Magit and seeing the whole diff Date: Sat, 18 Dec 2010 21:21:04 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1292704856 22535 80.91.229.12 (18 Dec 2010 20:40:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 18 Dec 2010 20:40:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 18 21:40:52 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PU3aF-00088A-KA for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Dec 2010 21:40:51 +0100 Original-Received: from localhost ([127.0.0.1]:50577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PU3aF-0002pT-2p for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Dec 2010 15:40:51 -0500 Original-Received: from [140.186.70.92] (port=56917 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PU3Lh-0005WL-6I for help-gnu-emacs@gnu.org; Sat, 18 Dec 2010 15:26:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PU3L1-0007vY-07 for help-gnu-emacs@gnu.org; Sat, 18 Dec 2010 15:25:45 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:37687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PU3L0-0007uM-PB for help-gnu-emacs@gnu.org; Sat, 18 Dec 2010 15:25:06 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PU3Kz-0008Ov-4V for help-gnu-emacs@gnu.org; Sat, 18 Dec 2010 21:25:05 +0100 Original-Received: from ip1-201.halifax.rwth-aachen.de ([137.226.108.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 18 Dec 2010 21:25:05 +0100 Original-Received: from andrea.crotti.0 by ip1-201.halifax.rwth-aachen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 18 Dec 2010 21:25:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 41 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip1-201.halifax.rwth-aachen.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:fRMXk/zWa8aR0J5SYgjc0HXiPqw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77663 Archived-At: 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?