From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Niklas Eklund Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/detached 827e3d64fe: Bug fix: Incorrect initialization of projectile Date: Thu, 25 Aug 2022 18:30:11 +0000 Message-ID: References: <166119825097.26859.927185263202609197@vcs2.savannah.gnu.org> <20220822195731.3F972C0088A@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17279"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 25 21:13:15 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRIHz-0004KN-GP for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Aug 2022 21:13:15 +0200 Original-Received: from localhost ([::1]:52156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRIHy-0000Sr-D8 for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Aug 2022 15:13:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRHcQ-0007cT-LW for emacs-devel@gnu.org; Thu, 25 Aug 2022 14:30:19 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:60111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRHcO-0001Xg-FW for emacs-devel@gnu.org; Thu, 25 Aug 2022 14:30:18 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0F9A4240104 for ; Thu, 25 Aug 2022 20:30:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1661452213; bh=T4PHRHsTvh+xk12t+6T2TwQJnXWIrXjKRaJa1YocUYE=; h=From:To:Cc:Subject:Date:From; b=FCKywVk52/VFf5YFUz428v7swvmXRRckLUxjU7W6nxr5pIQVkblPpTW0yfq/LlL1g eFV9ovieYdFCcczijNqsOXl9MFPQQ01j5nWtFChw7L/8QDuMm6Wgjj6SP2IzyETadE eCtHnOuCWqWs0Hs+u8AhMD4rGSyqIsfcbk+TTXM+JXfvORlHkucGL8Xczk8KhwDGyd 6TT9SW1sraI4q0JiI+wiKlnLy/kxSnDpPWMLMmR/pltp7jAwsnDHNw3veraE218c1s HoHoIZjgLOw2Nz3nqFR+wvG2VaJ84fVG4kNetXvCTHARyY9ehyA98CX8dBiGqIz9AC FQ60s5J3SGC0w== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MDBN42VZtz6tpV; Thu, 25 Aug 2022 20:30:12 +0200 (CEST) In-Reply-To: Received-SPF: pass client-ip=185.67.36.66; envelope-from=niklas.eklund@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 25 Aug 2022 15:08:32 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294104 Archived-At: Stefan Monnier writes: Hi Stefan, > Hi Niklas, > >> @@ -150,7 +150,7 @@ >> >> (defun detached-init--projectile () >> "Initialize integration with `projectile'." >> - (when (functionp #'projectile) >> + (when (featurep 'projectile) >> (advice-add 'projectile-run-compilation >> :override #'detached-extra-projectile-run-compilation))) >> > > I suspect that you can then also remove the corresponding > `declare-function`. > More importantly, `advice-add` can be used on a symbol whose function is > not yet defined, so you can skip the `when` test altogether. That's very neat that the check can be skipped, thanks for the suggestion! > The same applies to the following: > > (when (functionp #'dired-rsync) > (advice-add #'dired-rsync--do-run :override #'detached-extra-dired-rsync))) > > where my stylistic checker additionally complains about: > - #' kind of says that `dired-rsync` is a function, so using `functionp` > on it is a bit weird. Usually, code does (fboundp 'dired-rsync) > instead. Aha, I had been thinking it should be quoted since it was a function but now I understand that better. Btw what stylistic checker are you running that shows you this? :) > - `advice-add` takes as first argument a symbol. That symbol is > expected to contains a function, indeed, but it can't just take any > function (e.g. a (lambda ...) would be an error), for that reason > I think using ' rather than #' is preferable (e.g. if you consider > that Common Lisp (and `cl-flet`) will treat #' as a reference > to the function stored in the symbol (much like `symbol-function`) > rather than as the symbol itself). That make sense with the lambda example, thanks for the explenation! > > Stefan /Niklas