From: Stefan Monnier Date: Sun, 3 Jan 2021 22:25:06 +0000 (-0500) Subject: * admin/last-chance.el (last-chance): Use `grep`s return value X-Git-Tag: emacs-28.0.90~4409 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=20ad0cc03b73f6576ece195bb16878415c313d45;p=emacs.git * admin/last-chance.el (last-chance): Use `grep`s return value (compilation-finish-functions): Only set it buffer-locally. --- diff --git a/admin/last-chance.el b/admin/last-chance.el index fd5b8e9bd7a..e8021129e30 100644 --- a/admin/last-chance.el +++ b/admin/last-chance.el @@ -105,18 +105,14 @@ defaulting to the one at point." "Symbol: " obarray nil nil one nil one))))) - (let ((default-directory (or (vc-root-dir) - default-directory))) - (grep (format "%s %s" - last-chance-grep-command - symbol))) - (setf (buffer-local-value 'last-chance-symbol - (process-buffer - (car compilation-in-progress))) - symbol)) - -(add-to-list 'compilation-finish-functions - 'last-chance-cleanup) + (with-current-buffer + (let ((default-directory (or (vc-root-dir) + default-directory))) + (grep (format "%s %s" + last-chance-grep-command + symbol))) + (add-hook 'compilation-finish-functions #'last-chance-cleanup nil t) + (setq-local last-chance-symbol symbol))) (provide 'last-chance)