From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: New Package for GNU ELPA Date: Sun, 22 May 2016 13:06:26 -0400 Message-ID: <5741E712.8040306@gmail.com> References: <87posef3dc.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DWO2VjBCB5ujwrmQV44bQt6RT5uUPVodI" X-Trace: ger.gmane.org 1463936843 12940 80.91.229.3 (22 May 2016 17:07:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 May 2016 17:07:23 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 22 19:07:13 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b4WqO-0003Ox-Pb for ged-emacs-devel@m.gmane.org; Sun, 22 May 2016 19:07:13 +0200 Original-Received: from localhost ([::1]:43936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4WqN-0003zb-Ca for ged-emacs-devel@m.gmane.org; Sun, 22 May 2016 13:07:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4Wpl-0003yn-Kf for emacs-devel@gnu.org; Sun, 22 May 2016 13:06:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4Wph-0006zz-BP for emacs-devel@gnu.org; Sun, 22 May 2016 13:06:32 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.24]:54407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4Wph-0006zr-0s for emacs-devel@gnu.org; Sun, 22 May 2016 13:06:29 -0400 Original-Received: from [18.189.83.142] ([18.189.83.142]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0MYvSd-1b0Jai2vq7-00Vjxw for ; Sun, 22 May 2016 19:06:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <87posef3dc.fsf@gnu.org> X-Provags-ID: V03:K0:m8+8Q56FtzdZ+3PQ8e20fDlKfXH2l9B+oUVW9BZAtbCUkMz7Lbj hKHlcku0hL7DBWVkvzNj8GfM6G7rFLSCkYtrfRAV8BDnQJNH80hkBqHhdsAB75xMZqTO+p7 rBnoP5q2ZJnzptX+KKjQv+J1yz8XdUEw43YMJ6HDOFCsIAiULpielyYlxrTXUYvmT4ZXqJp hDD+nvmtg99rEqM/PbD4g== X-UI-Out-Filterresults: notjunk:1;V01:K0:EJ4hvyj+kuE=:vc/8M2MhN4uq++THtRGxFy n/6s88v/U88zRoX1OpyDExbazk/Ibm9ynHezSouvEB4P5VaJ516RT3DXTtBeemiiRwCUBdpBe p/hhpRxq5kwPJfh5VJXkJj/df2A09Sv5H5ShvAeqQI6sQolmu114pztb6jy4AEPZ810Cvlw+n d1JvrFBZF9jBi8r4l8V4/tIC2G+wFvaBbDBIGlbNzUb9dbQDTnr7UqI9AfGxGMHxhcApZ1zOc qPY8pt/YSVUsesnFlDdxpqrWSLLwCk6Q5c8KwD/IOrNd4o1xKG8AvrxNX2teQYzpQ5ioyZyS4 9vzuMnR2OKTy4EslyDGiHfdiqlbuxSB8EeWIziyRVPsB20yToaJ13A21D5K0c9yto2LbB7dhe m6q3SqI6N2+wEPUbJLYHORnoeXa2nUdHurLXHS/ZxH3wySbap57AKGxiKVus7AWKzF7pkXZZ2 N5wem/3w1Vplq8a0U3afQzSg0ddLlYCqrB4pxRGNSM5oLiJl5301PfsoRQdz0mrKJufxUyTlv /OTfZlwoDlaG9HpbfzXSMvZSbF1LU1ATpmhOf0EFYmoE8mzl6ieSbfmLDfR6kSmd2qSu7oHxA 8gq4hRTKwz76YDEQEtn3wO/oeNwr7d3ntVsxvIRurn+a/DieH1hCUAHbWmobaTLCU1pmXIhlW ic6T5LQ7qe3Ru3WCzZqsu780g1xQ8vVyfOJfIuaGO5LifNDM9YPEhK+xJrIz4xCHHunY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:203941 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DWO2VjBCB5ujwrmQV44bQt6RT5uUPVodI Content-Type: multipart/mixed; boundary="RXOinCCA70OjLnP2Xp5KQR3jaiBTlD6pK" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <5741E712.8040306@gmail.com> Subject: Re: New Package for GNU ELPA References: <87posef3dc.fsf@gnu.org> In-Reply-To: <87posef3dc.fsf@gnu.org> --RXOinCCA70OjLnP2Xp5KQR3jaiBTlD6pK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > ;; Add font lock for both macros. > (font-lock-add-keywords > 'emacs-lisp-mode > '(("(\\(define-hook-helper\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" > (1 font-lock-keyword-face) > (2 font-lock-constant-face nil t)) > ("(\\(define-mode-hook-helper\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)= ?" > (1 font-lock-keyword-face) > (2 font-lock-constant-face nil t)))) Is there a reason why these two macros aren't highlighted properly by def= ault? I don't think other packages do this. On 2016-05-22 12:45, Ian Dunn wrote: >=20 > I'd like to offer my new package, hook-helpers > (https://savannah.nongnu.org/projects/hook-helpers-el/), to GNU ELPA. > I've already filled out copyright paperwork for Emacs. >=20 >=20 >=20 > Often times, I see people define a function to be used once in a hook. = If they don=E2=80=99t do this, then it will be an anonymous function. If = the anonymous function is modified, then the function can=E2=80=99t be re= moved. With a function outside of the |add-hook| call, it looks messy. >=20 > The |define-hook-helper| macro is a solution to this. Think of it as an= anaphoric |add-hook|, but one that can be called many times without risk= ing redundant hook functions. It gives a cleaner look and feel to Emacs c= onfiguration files, and could even be used in actual libraries. >=20 > The purpose of this package is to build upon add-hook and remove-hook. = When you have something like the following: >=20 > (defun my/after-init-hook () > (set-scroll-bar-mode nil)) > =20 >=20 > You=E2=80=99ve got to remember to actually add this to the after-init-h= ook variable. Alternatively, you can use a lambda function: >=20 > (add-hook 'after-init-hook (lambda () (set-scroll-bar-mode nil))) > =20 >=20 > But then if you want to modify the function, it=E2=80=99s permanently s= tuck on the after-init-hook variable, and you have to deal with it. It=E2= =80=99s not a problem for after-init-hook, which is used once, but would = be a problem for a mode hook, like text-mode-hook. >=20 > Instead, hook-helpers can do the following: >=20 > (define-hook-helper after-init > (set-scroll-bar-mode nil)) > =20 >=20 > Which handles everything for you. >=20 >=20 >=20 >=20 --RXOinCCA70OjLnP2Xp5KQR3jaiBTlD6pK-- --DWO2VjBCB5ujwrmQV44bQt6RT5uUPVodI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXQecSAAoJEPqg+cTm90wjarsP/3XqJza8gGJ/Cr1sB7t3St75 PUglDo8MWaC236UrXJE2MS5nSoo9yO2/w/fSTMWeQ8hoTiAjg1PWjNYAZjo6/a2X MauD+XlDmh2vXIdbYaPztDo+o+4KTCzTfEoNsO0yzGZ7Lmx4d+N/ujTxOMxzUlHa sEv9GOsyLHZipB2FLON6F0d6LeFuGBJQH9BRXU2BOoYu56KjF6GYF27HSL5GeFS9 DPqXsUJ2WiNycJ1B1zSLXfpRVSoo895fSAmsIUKYK9XGQpIMlafa6MDVu9yaefJZ iswyoQHpm/I5xw9yIRCYUuYXxXux2z1wKGd6AzCrL/XHxrjUUp3g1z2GJf3iT+LT FpYx6SlrblWZibryE3oJrIR9youSf9JtYNt2V2429xqNXbGEuPVP0ai6ip3IFZrL Tb7ubL0cveysCGshJeD3AMW7PrwmpICWditoGz8CfjTvNzGB0m1vjl0yPlOAfLDY lK651Kt7nXLOIE9JPO8/0j/okwQoWsmMh/J8sOVOc5fqiMwlYglyfwthmm1wIHuE whT3IaFxiLbJ6mQ6mDd+Vz9iH+Kekz3dEEBcU+0JQk38gw+HrnoKugLiWU30akz/ L42pAx4MuDiTxBHHxsDtFYnpFpT3bmaV7SMQoK26OdWqChoPlWJguGmOoX2ZDqZw ixTGma+wTyX8ihAHjzzv =/d13 -----END PGP SIGNATURE----- --DWO2VjBCB5ujwrmQV44bQt6RT5uUPVodI--