From: Gustav HÃ¥llberg Date: Fri, 23 Apr 2010 14:18:34 +0000 (+0200) Subject: stgit.el: Add stgit-inhibit-messages X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/1b47104494b3f0371ece396a00bda59adbd3ffd9 stgit.el: Add stgit-inhibit-messages Signed-off-by: Gustav HÃ¥llberg --- 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."