From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: Last use of defadvice in Emacs Date: Fri, 08 Apr 2022 07:21:07 -0700 Message-ID: References: <834k35ctd4.fsf@gnu.org> <25167.38053.15113.49802@retriever.mtv.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=gb18030 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40575"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: eliz@gnu.org, acm@muc.de, bug-cc-mode@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 08 16:47:37 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 1ncpth-000AIO-9I for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Apr 2022 16:47:37 +0200 Original-Received: from localhost ([::1]:47320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncptf-0004Li-Vx for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Apr 2022 10:47:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncpUD-0000Yt-Uy for emacs-devel@gnu.org; Fri, 08 Apr 2022 10:21:17 -0400 Original-Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:33549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncpUC-0003CR-4S for emacs-devel@gnu.org; Fri, 08 Apr 2022 10:21:17 -0400 Original-Received: by mail-pg1-x531.google.com with SMTP id k14so7948227pga.0 for ; Fri, 08 Apr 2022 07:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=bDtir3RpIr69xGLCkA/o3PzCJ9q/QZJ3mHExFBX0RZ4=; b=gWnZBl8gGnEZB749fPpS87uDF/d1QvSXy9ZWvF/3PJTlPFXeJP1kN3DaXQZ5acDrRd itcbehBweAPynuSq7vRMYKiCVfZm3lxmNLXCTkde7SrGo0WGNdLKDjgDqPL8QYC5TYmp ldqHMQJWGO1MQlvzg7pOhfHGMuD5YGZjuukzoXkvW5IqSfnRxsndjojIC+yXxcsJFcBu VTHmuThP51v4HvDAd/gJFI7fPsZKxzClVA/GVAZ9a7GpC1x44HdjOD8XbsEWsGgZVbV/ WlzmobySA6S+IC6d1yo/5ezLIxVfdMLetTAN1XRk81XwlonVZMktIReesXzypK2pfEcA bHag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=bDtir3RpIr69xGLCkA/o3PzCJ9q/QZJ3mHExFBX0RZ4=; b=7vj0ydT8qJGJq/O0kUZ+MCnpZUZFIAL7T9hX8Kz9LS1rFtRhhqoYVsRcBU99euLbIw WOe0oJpgDzIW/vB7Uv3H+wfzYrj9kGcXT5Gkv7BaN+WcY+ff/J6h2f4DAktdVKVA6mJe 4JSQVQo1TV3dHo6hU+VKWHs3vOx8IidjBKswTm64SoSLm0M0przyvpOEzylujjBhDDfk 6BnFW72W136XaKRnB2SHmNbawLEOTLO+ssE8weEVLYaeGW7FLdU5xvN857JHonVx9aiH jDJcmE0X2QpFbKS7awXCHKNP03P1jGPoaPnYzBUiJlUt2wGr+YCN7mevnHvFpAbdPbV0 JnOg== X-Gm-Message-State: AOAM533zERgjLViP3Yro5Wtw16oiAYl/K+0E0dLoAqmLvi69idMHitq9 y+H1n3JOvnKH029BfT1d/1R8z+C4mhWOXQ== X-Google-Smtp-Source: ABdhPJykFHoJA9dhWrdkg72klj0LFSHiZL7g0SrtLzKK0unIMJiKt/AsD0okCi5Wgw1XcvN3ACYo8w== X-Received: by 2002:a05:6a00:1a55:b0:4fd:ef0c:fad1 with SMTP id h21-20020a056a001a5500b004fdef0cfad1mr19673134pfv.50.1649427669541; Fri, 08 Apr 2022 07:21:09 -0700 (PDT) Original-Received: from raman-glaptop (c-24-4-174-65.hsd1.ca.comcast.net. [24.4.174.65]) by smtp.gmail.com with ESMTPSA id bg13-20020a17090b0d8d00b001caa8f51098sm12062916pjb.9.2022.04.08.07.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 07:21:08 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Thu, 07 Apr 2022 22:34:45 -0400") Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=raman@google.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action 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:287963 Archived-At: Stefan Monnier writes: Relevant pieces retained alongside responses: >> 2. Re ad-return-value -- I've almost never had to explicitly set >> ad-return-value -- in around and after advice, I have always >> returned ad-return-value and have never hit issues --- perhaps >> because I've always wrappered my advice body in a let form -- This has never bitten emacspeak because I always leave the return value >> unmolested, and for safely always make sure that ad-return-value >> is the last form in the advice body so that functions or code that >> runs after the advice doesn't break because the original >> function's return value got dropped along the way=20 >> not sure. What kind of breakages happen when returning >> ad-return-value vs explicitly setting ad-return-value at the end >> of the advice body? > > You typically need to set it when you want to do: > > (defadvice some-function (around my-advice activate) > (if (bla bla) > (cons 1 ad-do-it) > (do something else) > (and return some value))) > > which needs to be something like: > > (defadvice some-function (around my-advice activate) > (if (bla bla) > (progn ad-do-it > (push 1 ad-return-value)) > (do something else) > (setq ad-return-value (and return some value)))) > >> 3. I've avoided the complexity around preactivation vs >> activation etc by always saying (... pre act comp) in all my Avoid complexity here =3D=3D "my little brain doesn't have to worry about it" --- all the calls to defadvice in emacspeak say "pre act comp" which means if it needs changing, I can change them all with a single line of perl or sed magic. >> advice forms > > Not sure in which sense this "avoided the complexity". > And most people reading your code won't know what it means, I'm afraid. > > > Stefan > > --=20 Thanks, --Raman(I Search, I Find, I Misplace, I Research) =817=A94 Id: kg:/m/0285kf1 =950=DC8