From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: vc-dwim when nothing to commit Date: Mon, 04 May 2015 16:18:51 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87wq0o6qqc.fsf@lifelogs.com> References: <86egoeusg2.fsf@example.com> <83pp7yp5po.fsf@gnu.org> <87383yqkpc.fsf_-_@lifelogs.com> <838udp997g.fsf@gnu.org> <87pp71pwgi.fsf@lifelogs.com> <83wq197l6r.fsf@gnu.org> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1430770762 14076 80.91.229.3 (4 May 2015 20:19:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 May 2015 20:19:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 04 22:19:15 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YpMpe-0004fa-UO for ged-emacs-devel@m.gmane.org; Mon, 04 May 2015 22:19:15 +0200 Original-Received: from localhost ([::1]:35872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpMpe-0003rT-39 for ged-emacs-devel@m.gmane.org; Mon, 04 May 2015 16:19:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpMpQ-0003rL-2W for emacs-devel@gnu.org; Mon, 04 May 2015 16:19:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpMpL-0005Ma-2I for emacs-devel@gnu.org; Mon, 04 May 2015 16:19:00 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:35719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpMpK-0005Le-RB for emacs-devel@gnu.org; Mon, 04 May 2015 16:18:54 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YpMpH-0004SF-HT for emacs-devel@gnu.org; Mon, 04 May 2015 22:18:51 +0200 Original-Received: from c-98-229-61-72.hsd1.ma.comcast.net ([98.229.61.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 May 2015 22:18:51 +0200 Original-Received: from tzz by c-98-229-61-72.hsd1.ma.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 May 2015 22:18:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 65 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-98-229-61-72.hsd1.ma.comcast.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:loP/e6cG0R2dII8yF6HjgTlkyp0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186206 Archived-At: On Sat, 18 Apr 2015 14:03:24 +0300 Eli Zaretskii wrote: >> From: Ted Zlatanov >> Date: Sat, 18 Apr 2015 06:22:37 -0400 >> EZ> Of course, bonus points for guessing the next command (not necessarily EZ> "git push") given the previous one and the existence of telltale files EZ> below .git/. That would be much more in line with the spirit of EZ> vc-next-action, IMO. >> >> Right, so the history would be per repository and the very first initial >> guess would be "git push" usually? I would use that. >> >> Unless there's a strong protest, I can try implementing a first cut of >> this. I like that it fills a void, where you say "DWIM" after a Git >> commit and VC goes "huh? go away!" :) EZ> Please do, and TIA! Don't be bothered by "strong protest", I don't EZ> think we will see anything like that. I tried this for myself. Just adding a command prompt is trivial: #+begin_src diff diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index bb4dd60..a7af2ed 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1175,7 +1175,8 @@ (defun vc-next-action (verbose) (dolist (file files) (vc-checkout file))) (t ;; do nothing - (message "Fileset is up-to-date")))) + (message "Fileset is up-to-date") + (call-interactively 'shell-command)))) ;; Files have local changes ((vc-compatible-state state 'edited) (let ((ready-for-commit files)) #+end_src but it doesn't have its own history or context, doesn't prefill the command, and the output is displayed in an annoying buffer. I tried polishing the interaction but I kept coming back to "run eshell or ansi-term and up-arrow brings up the last 'git push' in the current directory" which is one keystroke for me. That's because I really, really want to know if `git push' fails, and which refs it failed to push. If there's a failure, I usually want to be in a shell and to fix it. If not, I don't want to see any popup buffers. So maybe the best way to do it for Git is: 1) check to see if there's anything to push (local tracking branch is ahead of remote). If not, do nothing. 2) Else, prompt to "git push" and capture the output. This piece should have its own command history. 3) if there was any failure (I don't know if the return code is sufficient to determine that), bring up eshell or ansi-term with the failure output pre-inserted Does that seem reasonable? It's what I would want to use, but maybe it's too heavy for most people. Ted