From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Terminology change/nameing conventions? Date: Fri, 28 May 2010 23:10:07 -0400 Organization: A noiseless patient Spider Message-ID: References: <87pr0fledo.fsf@rapttech.com.au> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1291824284 4516 80.91.229.12 (8 Dec 2010 16:04:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 16:04:44 +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 Dec 08 17:04:40 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQMVT-0000PL-Bk for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 17:04:40 +0100 Original-Received: from localhost ([127.0.0.1]:51848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQMVS-0006Dg-H6 for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 11:04:38 -0500 Original-Path: usenet.stanford.edu!goblin1!goblin.stu.neva.ru!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Injection-Date: Sat, 29 May 2010 03:10:07 +0000 (UTC) Injection-Info: barmar.motzarella.org; posting-host="+bxBiZT/p0ZLLuDb5H+JCw"; logging-data="6979"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FjU0ZcnwpCkfZEdUB8WRf" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:TtlNduv64PjHl8JH4p1YiAk0DTA= Original-Xref: usenet.stanford.edu gnu.emacs.help:178469 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75579 Archived-At: In article <87pr0fledo.fsf@rapttech.com.au>, Tim X wrote: > I was recently doing some work with elisp and noticed what appears to be > differences in conventions regarding nameing. > > In general, I've always thought of the term 'hook' as indicating a > special variable that you could add function names to and that all those > functions would be executed when the hook runs. However, I've noticed > that some modes, e.g. comint mode, uses the term -functions i.e. > comint-output-functions. You use add-hook to add new functions to this > variable. > > So, my question is why isn't this just comint-output-hook? A hook is just for users to add customizations that are done in addition to the normal behavior. E.g. XXX-mode-hook is a place for users to add extra functions to run after XXX-mode. By default, the hook will be empty. comint-output-functions is used as part of the normal behavior of comint. Comint initializes it with some default functions, which users can add to or remove. Subsidiary modes use this to refine the behavior. > > I find this a bit inconsistent and frustrating. Often, when dealing with > a new mode, I will do a regexp of the mode variables to find all the > hooks I can use to customize it. However, now it seems I need to look > for -functions as well. > > While on the topic of nameing, another one which seems a bit silly is > the new functions that have been added with the name -command i.e. > scroll-up-command. Is the additonal -command really necessary? I realise > we have scroll-up (which ironically, is also a command!) and adding > -command may have just been an easy suffix to distinguish it from the > existing scroll-up command, but I still find it a bad choice. In fact, > why do we have scroll-up and scroll-up-command? My view was that any > function defined with (interactive) was a command. I find the addition > of -command a bit pointless and the fact we have scroll-up and > scroll-up-command potentially confusing - which one should I use? What > next - adding -function suffixes! I don't know if this is why the above functions are named like this, but I think that XXX-command should be used for functions that are generally intended ONLY for interactive use, not for use within other functions. For instance, the end-of-buffer function would be better called end-of-buffer-command, because it has the side effect of setting the mark to the old location, which is specifically done for the benefit of interactive users. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***