From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: [PATCH] Allow hiding stashes from vc-dir Date: Tue, 15 Oct 2019 14:48:28 +0200 Message-ID: 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="74220"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 15 14:48:49 2019 Return-path: Envelope-to: ged-emacs-devel@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 1iKMFt-000JA6-CJ for ged-emacs-devel@m.gmane.org; Tue, 15 Oct 2019 14:48:49 +0200 Original-Received: from localhost ([::1]:44014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKMFr-0005Ul-WE for ged-emacs-devel@m.gmane.org; Tue, 15 Oct 2019 08:48:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43428) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKMFk-0005Sz-79 for emacs-devel@gnu.org; Tue, 15 Oct 2019 08:48:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKMFh-0005J9-Vf for emacs-devel@gnu.org; Tue, 15 Oct 2019 08:48:40 -0400 Original-Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKMFe-0005Hh-DP for emacs-devel@gnu.org; Tue, 15 Oct 2019 08:48:35 -0400 Original-Received: by mail-wr1-x42b.google.com with SMTP id o18so23654193wrv.13 for ; Tue, 15 Oct 2019 05:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:mail-copies-to:gmane-reply-to-list:date:message-id :mime-version; bh=KwXBqDYXgT5LkRnzZrPIsTPQugW3pDbEGu3TKufNR7M=; b=qds2Y7SjtGEjIFRpxBLEwK3auNNmPQVnyCPHqWoOm2/60ofs2dYC+TRz/X8o+0Cu8m 1YsoFJSxvl9f1nIHTcWGUDDdZ5899lYs62iQsE7Fr09TB/cIdQbrYZbR9M8IFO2dDkIG iGlM//U9j5t0An8lapGGwtoEs9VvWnsJaVdUhLCJVszGMZAwu/wZf7E9fAi9TgMlMwwZ mc5dzg+R/iX/VK5SyPWZpVrNXDY2ATaQ1XeHHUpbhMVkLiQTD0T5y3CsrCbDm8RZ3nTp gvdjvPaiW8BclmMuK9g7xjMJmBYUDubXj28NKU98Wia71BwDOY7+xqJ5+wFFU/N9AOVk 8+pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:mail-copies-to :gmane-reply-to-list:date:message-id:mime-version; bh=KwXBqDYXgT5LkRnzZrPIsTPQugW3pDbEGu3TKufNR7M=; b=sj+viO9IA7DgOZEjMeuzfHgkJU9ZME6iwT0DZ7lgwk0HaXydkKZo4tvLYhDNVlC3Ea ktfenQjy5mX5DVvsIz20NatiNSCB93TgO0V02RQ5/a0XBjDE+0Y7BPgk10OMgd3q1dl+ eb7gT/vOixLtSSm9ILuJ9xbk7wvKqjrfUNPZPYvrSLyBXp8MwsGRjJS/TsOIWaGawH3K jF8HajaJbaUUsyksYzF3id3ihZrTZMzkSUNmXwqCh91fir80C7xqlHWy62xC7Go8odxr UPIh2ohufQVnv2A+frnuF7Vw43RNkF/cnmW+9rKHBnHRmfnAlB7B1dUmXXD21sxqLeMt RsLw== X-Gm-Message-State: APjAAAUkwsSEvvCZ5yiLaBft6P4gBFiS1UQaBI7pCmJSn6zI02faf7cU WhrZoXFPztP1kiDVCO2uyLGL5Kv0 X-Google-Smtp-Source: APXvYqxxl3OCycYXq8pejJ1xtMvujIqNJGbxfAFhn2KRtpXetLQFErTIBIKuE+8vnwJr2Z96s1pz+g== X-Received: by 2002:a5d:6685:: with SMTP id l5mr14199330wru.44.1571143709762; Tue, 15 Oct 2019 05:48:29 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id r20sm29467828wrg.61.2019.10.15.05.48.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 05:48:28 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.emacs.devel:241045 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable For various reasons I tend to have a lot of stashes hanging around, which magit can autohide for you. vc-dir doesn=CA=BCt have such an option, and has no commands for doing things with stashes anyway, so I came up with the following.=20 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-vc-git-allow-not-showing-git-stash-list-in-vc-dir.patch >From b02f05fc569f3946366ac2ede27349cd09618265 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Tue, 5 Feb 2019 10:51:42 +0100 Subject: [PATCH] vc-git: allow not showing git stash list in vc-dir To: emacs-devel@gnu.org * lisp/vc/vc-git.el (vc-git-show-stash): New variable. (vc-git-dir-extra-headers): Only show stash list when vc-git-show-stash is t. --- etc/NEWS | 3 +++ lisp/vc/vc-git.el | 49 ++++++++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 271cc6e044..8c3993474c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -733,6 +733,9 @@ The default value is 'find-dired-sort-by-filename'. *** New command 'log-edit-generate-changelog-from-diff', bound to C-c C-w. This generates ChangeLog entries from the VC fileset diff. +*** New customizable variable 'vc-git-show-stash'. +Default t, set it to nil to hide stashes in 'vc-dir' when using git. + *** Recording ChangeLog entries doesn't require an actual file. If a ChangeLog file doesn't exist, and if the new variable 'add-log-dont-create-changelog-file' is non-nil (which is the diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 9715aea1fd..615474cd76 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -192,6 +192,11 @@ vc-git-grep-template :type 'string :version "27.1") +(defcustom vc-git-show-stash t + "Whether to show the git stash list." + :type 'boolean + :version "27.1") + ;; History of Git commands. (defvar vc-git-history nil) @@ -655,7 +660,7 @@ vc-git-dir-extra-headers (let ((str (with-output-to-string (with-current-buffer standard-output (vc-git--out-ok "symbolic-ref" "HEAD")))) - (stash (vc-git-stash-list)) + (stash (when vc-git-show-stash (vc-git-stash-list))) (stash-help-echo "Use M-x vc-git-stash to create stashes.") branch remote remote-url) (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) @@ -688,30 +693,30 @@ vc-git-dir-extra-headers (propertize "Remote : " 'face 'font-lock-type-face) (propertize remote-url 'face 'font-lock-variable-name-face))) - "\n" ;; For now just a heading, key bindings can be added later for various bisect actions (when (file-exists-p (expand-file-name ".git/BISECT_START" (vc-git-root dir))) - (propertize "Bisect : in progress\n" 'face 'font-lock-warning-face)) + (propertize "\nBisect : in progress" 'face 'font-lock-warning-face)) (when (file-exists-p (expand-file-name ".git/rebase-apply" (vc-git-root dir))) - (propertize "Rebase : in progress\n" 'face 'font-lock-warning-face)) - (if stash - (concat - (propertize "Stash :\n" 'face 'font-lock-type-face - 'help-echo stash-help-echo) - (mapconcat - (lambda (x) - (propertize x - 'face 'font-lock-variable-name-face - 'mouse-face 'highlight - 'help-echo "mouse-3: Show stash menu\nRET: Show stash\nA: Apply stash\nP: Apply and remove stash (pop)\nC-k: Delete stash" - 'keymap vc-git-stash-map)) - stash "\n")) - (concat - (propertize "Stash : " 'face 'font-lock-type-face - 'help-echo stash-help-echo) - (propertize "Nothing stashed" - 'help-echo stash-help-echo - 'face 'font-lock-variable-name-face)))))) + (propertize "\nRebase : in progress" 'face 'font-lock-warning-face)) + (when vc-git-show-stash + (if stash + (concat + (propertize "\nStash :\n" 'face 'font-lock-type-face + 'help-echo stash-help-echo) + (mapconcat + (lambda (x) + (propertize x + 'face 'font-lock-variable-name-face + 'mouse-face 'highlight + 'help-echo "mouse-3: Show stash menu\nRET: Show stash\nA: Apply stash\nP: Apply and remove stash (pop)\nC-k: Delete stash" + 'keymap vc-git-stash-map)) + stash "\n")) + (concat + (propertize "\nStash : " 'face 'font-lock-type-face + 'help-echo stash-help-echo) + (propertize "Nothing stashed" + 'help-echo stash-help-echo + 'face 'font-lock-variable-name-face))))))) (defun vc-git-branches () "Return the existing branches, as a list of strings. -- 2.23.0 --=-=-=--