From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: lee Newsgroups: gmane.emacs.help Subject: Re: replacing a function with another one Date: Wed, 12 Mar 2014 18:33:28 +0100 Organization: my virtual residence Message-ID: <87iorjmidz.fsf@yun.yagibdah.de> References: <87vbvofsi6.fsf@yun.yagibdah.de> <87bnxgs4r9.fsf@web.de> <87lhwj1cfz.fsf@yun.yagibdah.de> <87zjkz6vd5.fsf@web.de> <8738ir161u.fsf@yun.yagibdah.de> <87eh2b6nfm.fsf@web.de> <87r46anab5.fsf@yun.yagibdah.de> <87vbvleiey.fsf@yun.yagibdah.de> <87vbvlbm8p.fsf@web.de> <87siqpsdgs.fsf@yun.yagibdah.de> <87iorljkhx.fsf@web.de> <87pplsivy7.fsf@yun.yagibdah.de> <87a9cwtj76.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1394646233 15664 80.91.229.3 (12 Mar 2014 17:43:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 17:43:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 12 18:44:01 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1WNnCB-0002yx-Qd for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 18:43:59 +0100 Original-Received: from localhost ([::1]:33838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNnCB-0007FJ-Eq for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 13:43:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNnB5-0005nl-1E for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 13:42:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNnAz-0004fJ-NQ for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 13:42:50 -0400 Original-Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:52976 helo=yun.yagibdah.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNnAz-0004dy-5O for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 13:42:45 -0400 Original-Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WNnAs-00060N-Oy for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 18:42:38 +0100 In-Reply-To: <87a9cwtj76.fsf@web.de> (Michael Heerdegen's message of "Wed, 12 Mar 2014 00:21:49 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Mail-Followup-To: help-gnu-emacs@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 194.42.186.216 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96467 Archived-At: Michael Heerdegen writes: > lee writes: > >> Maybe the problem is that add-advice is too complicated and convoluted. >> I learned about defadvice in like no time, it=C2=B4s clear and simple --- >> while advice-add is anything but. > > On the contrary. nadvice is as simple as it could be. To understand > how an :around advice works, it takes one line > > (lambda (&rest r) (apply FUNCTION OLDFUN r)) > > That's a non-ambiguous specification from which you can clearly derive > how the advice FUNCTION will be used. It can't be simpler. The problem > is that many people are not so used to lambda expressions and parameter > substitution and so they don't understand it. If you take a pencil and > a sheet of paper and evaluate an example for yourself by hand, step by > step, you'll understand how it works. And no, this is not missing in > the documentation. The Emacs documentation is not an introduction into > lambda calculus and writing LISP code. Once you have really understood > how evaluation of expressions in LISP works, you'll understand the above > definition. Why would you say it=C2=B4s a definition? When you consider "food is edible" as a definition, it doesn=C2=B4t tell you anything. The function is defined in the source. The documentation of it should tell you what it does and how to make it do that. Besides that the documentation of advice-add doesn=C2=B4t do that, advice-add is complicated, convoluted and cryptic. >> Considering all that, wouldn=C2=B4t it be much better to create my own >> mode? > > I don't think this is appropriate, because what you want can be done in > few lines without making much assumptions about the original package. Then what=C2=B4s the purpose of modes, or the concept behind them? As it is now, I can enable a mode, like hi-lock-mode, no matter what kind of file I=C2=B4m editing. The mode provides me with some particular functionality which I can use. It doesn=C2=B4t matter to me how many lines of code it to= ok to create this mode. Now I have some particular functionality I may want to use with many different kinds of files. So why not just enable a mode that gives me this functionality? What does it matter how the mode provides the functionality and how many lines of code it=C2=B4s made of? --=20 Knowledge is volatile and fluid. Software is power.