From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: Change in files.el Date: Wed, 01 Feb 2017 14:12:54 +0000 Message-ID: References: <83bmurz0y9.fsf@gnu.org> <8360kzyxor.fsf@gnu.org> <83ziibxg7j.fsf@gnu.org> <83y3xvxfbs.fsf@gnu.org> <87bmurjack.fsf@udel.edu> <83sho3x9gb.fsf@gnu.org> <20170201034912.GA15975@holos.localdomain> <838tpqvzl4.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114e6804b97acc054778a53c X-Trace: blaine.gmane.org 1485958431 11143 195.159.176.226 (1 Feb 2017 14:13:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Feb 2017 14:13:51 +0000 (UTC) Cc: mvoteiza@udel.edu, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii , =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 01 15:13:44 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYvfK-0002OE-Sy for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2017 15:13:43 +0100 Original-Received: from localhost ([::1]:51198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYvfN-0000vW-9w for ged-emacs-devel@m.gmane.org; Wed, 01 Feb 2017 09:13:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYven-0000ua-Kv for emacs-devel@gnu.org; Wed, 01 Feb 2017 09:13:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYvem-0003Zb-G3 for emacs-devel@gnu.org; Wed, 01 Feb 2017 09:13:09 -0500 Original-Received: from mail-ua0-x22e.google.com ([2607:f8b0:400c:c08::22e]:35277) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYvek-0003Z2-Gr; Wed, 01 Feb 2017 09:13:06 -0500 Original-Received: by mail-ua0-x22e.google.com with SMTP id y9so298381245uae.2; Wed, 01 Feb 2017 06:13:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=puqT6/+74MNm4dpz88GQMJQFq/qvjbEF+/wf90IP1l4=; b=TmtRAfrAzG2/5OqS04eVoDIKFIKjUDzFLsNjb8dAJN7oYUX+dJocDaha9x2VL3opKi yS6KJeN5+SoxKciFtYsvS80T0q4+8ktlPhVXmCFFw+vv+zFpW2l6WZsRbQvplHR8vXQX piDgbSg3D2eutIe6in81S4wj5xuOJQdUAbHoaYbqDG0K4gTxH3L4PWoNxWvaOveDzSd8 NOKjGIUvlJGa38XJpjhe7sXKLJMYfnAXWdjtHniHVgJLinWzxqKFNCCKijAFQ2NIM16n yXBPbnrQEIFXw9DrdwMemAEIMK5W+cLsBx/9f7/IwxgYa905y/SqYVy+DvN0DknfL3VA TWGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=puqT6/+74MNm4dpz88GQMJQFq/qvjbEF+/wf90IP1l4=; b=lnTcf1z5KCMcp3Cz/n4a+dH2Kp/U26/JFmFlF6mq43bIEknwUewT29gw38RVE/AJyx hYZoADUGKN8GO64FZHzwwrXWY+KnBw4aRO8VTA+hgkZ8gIQHdlKv4LDJ8ZMatWTxe4WX TnvPlPDdYSiaKiS0NZ+v+/VWTu/KQmPk9x07SIRB2XoCaIP44APfvr4LtPMXR7r6IdMg JNdB+8O+KiLeIWGhMhD1cP/YOvNdoW02DUPLYKyVk7ydI3SZLiDoeZ/lf2D4kSO/Itvp 395lPoOSG7FMKd/EG0KQFsBkCcZb17Fy206dHpKDUJmtgVefMVfDH5r/zmQbyS8zjIeQ WYXg== X-Gm-Message-State: AIkVDXJdYhmmDXUP1nC7dFzYZcl1pHBNGxAMzcmalJqK62tMcYbRex9N7CKmmeFH4ky0xNZOzFs+7dYUu8DALA== X-Received: by 10.176.3.177 with SMTP id 46mr1441812uau.20.1485958385583; Wed, 01 Feb 2017 06:13:05 -0800 (PST) In-Reply-To: <838tpqvzl4.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c08::22e 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:211842 Archived-At: --001a114e6804b97acc054778a53c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Feb 1, 2017 at 8:14 AM Eli Zaretskii wrote: > > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > > From: Cl=C3=A9ment Pit-Claudel > > Date: Wed, 1 Feb 2017 02:33:14 -0500 > > > > Well, it's not uncommon to want to extend existing behavior, and > add-function lets you do it easily =E2=80=94 more easily than if the vari= able may > be nil. > > Easier than using setq? I doubt that. > Using add-function instead of setq has these advantages: - You do not need to copy-paste the original variable definition, and *then* add your tweaks around it. (add-function :around ..) does that for you. Given that the *-function definitions can be multiple lines long, it saves some clutter from your emacs config. - If the variable customization does not work out, or you discovered a bug in the customization (and you do not have time to debug it), you can remove that safely using (remove-function ..) and get back the original definition.. No need to find the original definition and re-eval that. - If the original definition changes upstream, there are lesser chances of your config breaking if you did add-function than setq. And if it breaks due to an upstream change, just do remove-function till you get time to fix your customization. - Added convenience that you can edebug your customization function that you "add" to the original *-function variable. So you debug focuses only on the customization and not also on the original definition. --=20 Kaushal Modi --001a114e6804b97acc054778a53c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Wed, Feb 1,= 2017 at 8:14 AM Eli Zaretskii <eliz@gnu= .org> wrote:
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> From: Cl=C3=A9ment Pit-Claudel <cpitclaudel@gmail.com> > Date: Wed, 1 Feb 2017 02:33:14 -0500
>
> Well, it's not uncommon to want to extend existing behavior, and a= dd-function lets you do it easily =E2=80=94 more easily than if the variabl= e may be nil.

Easier than using setq?=C2=A0 I doubt that.

Using add-function instead of setq has these advan= tages:

- You do not need to copy-paste the origina= l variable definition, and *then* add your tweaks around it. (add-function = :around ..) does that for you. Given that the *-function definitions can be= multiple lines long, it saves some clutter from your emacs config.
- If the variable customization does not work out, or you discovered a b= ug in the customization (and you do not have time to debug it), you can rem= ove that safely using (remove-function ..) and get back the original defini= tion.. No need to find the original definition and re-eval that.
= - If the original definition changes upstream, there are lesser chances of = your config breaking if you did add-function than setq. And if it breaks du= e to an upstream change, just do remove-function till you get time to fix y= our customization.
- Added convenience that you can edebug your c= ustomization function that you "add" to the original *-function v= ariable. So you debug focuses only on the customization and not also on the= original definition.

-- <= br>

Kaushal Mod= i

--001a114e6804b97acc054778a53c--