From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#38044: 27.0.50; There should be an easier way to look at a specific vc commit Date: Sun, 24 Nov 2019 00:43:37 +0200 Organization: LINKOV.NET Message-ID: <87mucm43ja.fsf@mail.linkov.net> References: <87ftj5at1q.fsf@gnus.org> <87bltslnpo.fsf@mail.linkov.net> <87d0dvmqu8.fsf@mail.linkov.net> <590e595e-8220-1c7e-bd4a-b2eb0968e289@yandex.ru> <87r226xl8m.fsf@mail.linkov.net> <24c56bca-8d7d-3a20-aeef-5d11f8a075e6@yandex.ru> <87pnhquo4k.fsf@mail.linkov.net> <6087186e-a444-0aac-e87d-596d2e36f0ce@yandex.ru> <877e3wub09.fsf@mail.linkov.net> <5ce7d4f0-3884-fd27-09dc-c38f01a19958@yandex.ru> <83zhgr26c3.fsf@gnu.org> <87blt7qxhz.fsf@mail.linkov.net> <837e3v1aae.fsf@gnu.org> <87y2warzv3.fsf@mail.linkov.net> <83r221xoll.fsf@gnu.org> <83a78pxenu.fsf@gnu.org> <215302ff-8252-1f6c-5f60-aaba01cd615f@yandex.ru> <837e3tx9s8.fsf@gnu.org> <87d0di7959.fsf@linkov.net> <7115df2d-c209-c672-7e92-ff682c4ec8ee@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="227378"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: stephen.berman@gmx.net, 38044@debbugs.gnu.org, larsi@gnus.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 23 23:47:37 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iYeBl-000wzZ-8O for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 23:47:37 +0100 Original-Received: from localhost ([::1]:33076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYeBk-0005DP-1M for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 17:47:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34383) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYeBb-0005DH-GC for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:47:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYeBX-0005zI-MA for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:47:27 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iYeBW-0005z8-An for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:47:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iYeBS-0006nW-1K for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 17:47:18 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Nov 2019 22:47:15 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38044 X-GNU-PR-Package: emacs Original-Received: via spool by 38044-submit@debbugs.gnu.org id=B38044.157454916526046 (code B ref 38044); Sat, 23 Nov 2019 22:47:15 +0000 Original-Received: (at 38044) by debbugs.gnu.org; 23 Nov 2019 22:46:05 +0000 Original-Received: from localhost ([127.0.0.1]:57942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYeAC-0006lM-Pj for submit@debbugs.gnu.org; Sat, 23 Nov 2019 17:46:03 -0500 Original-Received: from butterfly.birch.relay.mailchannels.net ([23.83.209.27]:59302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYe9P-0006kC-Pc for 38044@debbugs.gnu.org; Sat, 23 Nov 2019 17:45:50 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 79D1C580C60; Sat, 23 Nov 2019 22:45:10 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a5.g.dreamhost.com (100-96-83-20.trex.outbound.svc.cluster.local [100.96.83.20]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 86A4B58092A; Sat, 23 Nov 2019 22:45:09 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a5.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Sat, 23 Nov 2019 22:45:10 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Quick-Little: 6857f6ae2fe4c073_1574549110269_4069701066 X-MC-Loop-Signature: 1574549110269:1456320365 X-MC-Ingress-Time: 1574549110269 Original-Received: from pdx1-sub0-mail-a5.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a5.g.dreamhost.com (Postfix) with ESMTP id 1EBF283E49; Sat, 23 Nov 2019 14:45:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=TyDqCpQb+npbHX/R8fGfMkE+AUQ=; b= 0F30Wmceq5yoVevBHC6ClE8YBGoATor4c7hb6Tm0OsJWhZS4WmsJXXskceYoIDFM HLqsd1sdm4416zDLrL84o+3bIED0sEyncUrcFL/hLmobWaTa8tTPuF0R33KL5Fwx JVjrs8V4dL3kMf0ZfclFz8evORddB70b0ap9Ssmdweo= Original-Received: from mail.jurta.org (m91-129-105-73.cust.tele2.ee [91.129.105.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a5.g.dreamhost.com (Postfix) with ESMTPSA id EA15683E4C; Sat, 23 Nov 2019 14:45:00 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a5 In-Reply-To: <7115df2d-c209-c672-7e92-ff682c4ec8ee@yandex.ru> (Dmitry Gutov's message of "Sat, 23 Nov 2019 21:11:15 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172350 Archived-At: --=-=-= Content-Type: text/plain >> - (list start-revision))) >> + (if (eq limit 1) >> + (list "-p" start-revision) >> + (list start-revision)))) >> +A special case is when the prefix argument is 1, in this case >> +it asks for the revision and shows it with its diff." > > I think that's rather ugly (see my comment about having the arguments to be > orthogonal), and it precludes the use of this backend action to print > a more extensive commit log (with diffs, that is). I rewrote the patch to make it more flexible, so now the function can check 'vc-log-view-type' for the value 'with-diff'. >> + (when (and (eq limit 1) revision) >> + (vc-git-region-history-mode)))) > > A Git-specific function in vc.el? Thanks for noticing, this was intended to call a backend function. But now I rewrote this part as well to call region-history-mode from other place: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-print-root-log-with-diff.patch diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ca4c66a06d..02a8a3a525 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1161,6 +1161,8 @@ vc-git-print-log "HEAD" limit))) (list start-revision))) + (when (eq vc-log-view-type 'with-diff) + (list "-p")) '("--"))))))) (defun vc-git-log-outgoing (buffer remote-location) @@ -1226,7 +1228,7 @@ vc-git-log-view-mode (set (make-local-variable 'log-view-file-re) regexp-unmatchable) (set (make-local-variable 'log-view-per-file-logs) nil) (set (make-local-variable 'log-view-message-re) - (if (not (memq vc-log-view-type '(long log-search))) + (if (not (memq vc-log-view-type '(long log-search with-diff))) (cadr vc-git-root-log-format) "^commit *\\([0-9a-z]+\\)")) ;; Allow expanding short log entries. @@ -1235,7 +1237,7 @@ vc-git-log-view-mode (set (make-local-variable 'log-view-expanded-log-entry-function) 'vc-git-expanded-log-entry)) (set (make-local-variable 'log-view-font-lock-keywords) - (if (not (memq vc-log-view-type '(long log-search))) + (if (not (memq vc-log-view-type '(long log-search with-diff))) (list (cons (nth 1 vc-git-root-log-format) (nth 2 vc-git-root-log-format))) (append diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0d29c80d02..5cca3c6dd6 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2361,7 +2361,7 @@ vc-print-log-setup-buttons 'help-echo "Show the log again, including all entries"))) (defun vc-print-log-internal (backend files working-revision - &optional is-start-revision limit) + &optional is-start-revision limit type) "For specified BACKEND and FILES, show the VC log. Leave point at WORKING-REVISION, if it is non-nil. If IS-START-REVISION is non-nil, start the log from WORKING-REVISION @@ -2377,7 +2377,7 @@ vc-print-log-internal (shortlog (not (null (memq (if dir-present 'directory 'file) vc-log-short-style)))) (buffer-name "*vc-change-log*") - (type (if shortlog 'short 'long))) + (type (or type (if shortlog 'short 'long)))) (vc-log-internal-common backend buffer-name files type (lambda (bk buf _type-arg files-arg) @@ -2393,7 +2393,7 @@ vc-print-log-internal (vc-call-backend bk 'show-log-entry working-revision))) (lambda (_ignore-auto _noconfirm) (vc-print-log-internal backend files working-revision - is-start-revision limit))))) + is-start-revision limit type))))) (defvar vc-log-view-type nil "Set this to differentiate the different types of logs.") @@ -2416,7 +2416,10 @@ vc-log-internal-common (let ((inhibit-read-only t)) ;; log-view-mode used to be called with inhibit-read-only bound ;; to t, so let's keep doing it, just in case. - (vc-call-backend backend 'log-view-mode) + (vc-call-backend backend + (if (eq type 'with-diff) + 'region-history-mode + 'log-view-mode)) (set (make-local-variable 'log-view-vc-backend) backend) (set (make-local-variable 'log-view-vc-fileset) files) (set (make-local-variable 'revert-buffer-function) @@ -2475,13 +2478,26 @@ vc-print-log (vc-print-log-internal backend files working-revision nil limit))) ;;;###autoload -(defun vc-print-root-log (&optional limit) +(defun vc-print-root-log (&optional limit revision) "List the change log for the current VC controlled tree in a window. If LIMIT is non-nil, it should be a number specifying the maximum number of revisions to show; the default is `vc-log-show-limit'. -When called interactively with a prefix argument, prompt for LIMIT." +When called interactively with a prefix argument, prompt for LIMIT. +When the prefix argument is a number, use it as LIMIT. +A special case is when the prefix argument is 1, in this case +it asks for the revision and shows it with its diff." (interactive (cond + ((eq current-prefix-arg 1) + (let* ((default (thing-at-point 'word)) + (revision (vc-read-revision + (if default + (format "Revision to show (default %s): " default) + "Revision to show: ") + nil nil default))) + (list 1 revision))) + ((numberp current-prefix-arg) + (list current-prefix-arg)) (current-prefix-arg (let ((lim (string-to-number (read-from-minibuffer @@ -2492,9 +2508,11 @@ vc-print-root-log (list lim))) (t (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) - (let ((backend (vc-deduce-backend)) - (default-directory default-directory) - rootdir) + (let* ((backend (vc-deduce-backend)) + (default-directory default-directory) + (with-diff (and (eq limit 1) revision)) + (vc-log-short-style (unless with-diff vc-log-short-style)) + rootdir) (if backend (setq rootdir (vc-call-backend backend 'root default-directory)) (setq rootdir (read-directory-name "Directory for VC root-log: ")) @@ -2502,7 +2520,8 @@ vc-print-root-log (unless backend (error "Directory is not version controlled"))) (setq default-directory rootdir) - (vc-print-log-internal backend (list rootdir) nil nil limit))) + (vc-print-log-internal backend (list rootdir) revision revision limit + (when with-diff 'with-diff)))) ;;;###autoload (defun vc-print-branch-log (branch) --=-=-=--