From 1b47104494b3f0371ece396a00bda59adbd3ffd9 Mon Sep 17 00:00:00 2001 Message-Id: <1b47104494b3f0371ece396a00bda59adbd3ffd9.1718305637.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 23 Apr 2010 16:18:34 +0200 Subject: [PATCH] stgit.el: Add stgit-inhibit-messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Organization: Straylight/Edgeware From: Gustav HÃ¥llberg Signed-off-by: Gustav HÃ¥llberg --- contrib/stgit.el | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/contrib/stgit.el b/contrib/stgit.el index c4b78e2..11f370e 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -410,27 +410,37 @@ (defun stgit-make-run-args (args) (error "Bad element in stgit-make-run-args args: %S" x)))) args)) -(defun stgit-run-silent (&rest args) - (setq args (stgit-make-run-args args)) - (apply 'call-process "stg" nil standard-output nil args)) +(defvar stgit-inhibit-messages nil + "Set to non-nil to inhibit messages when running `stg' commands. +See also `stgit-message'.") +(defun stgit-message (format-spec &rest args) + "Call `message' on the arguments unless `stgit-inhibit-messages' is non-nil." + (unless stgit-inhibit-messages + (apply 'message format-spec args))) (defun stgit-run (&rest args) (setq args (stgit-make-run-args args)) (let ((msgcmd (mapconcat #'identity args " "))) - (message "Running stg %s..." msgcmd) - (apply 'call-process "stg" nil standard-output nil args) - (message "Running stg %s...done" msgcmd))) + (stgit-message "Running stg %s..." msgcmd) + (prog1 + (apply 'call-process "stg" nil standard-output nil args) + (stgit-message "Running stg %s...done" msgcmd)))) + +(defun stgit-run-silent (&rest args) + (let ((stgit-inhibit-messages t)) + (apply 'stgit-run args))) (defun stgit-run-git (&rest args) (setq args (stgit-make-run-args args)) (let ((msgcmd (mapconcat #'identity args " "))) - (message "Running git %s..." msgcmd) - (apply 'call-process "git" nil standard-output nil args) - (message "Running git %s...done" msgcmd))) + (stgit-message "Running git %s..." msgcmd) + (prog1 + (apply 'call-process "git" nil standard-output nil args) + (stgit-message "Running git %s...done" msgcmd)))) (defun stgit-run-git-silent (&rest args) - (setq args (stgit-make-run-args args)) - (apply 'call-process "git" nil standard-output nil args)) + (let ((stgit-inhibit-messages t)) + (apply 'stgit-run-git args))) (defun stgit-index-empty-p () "Returns non-nil if the index contains no changes from HEAD." -- [mdw]