From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bill Wohler Newsgroups: gmane.mail.mh-e.devel,gmane.emacs.devel Subject: Compatibility aliases, defsubsts, and macros... Date: Mon, 30 Jan 2006 13:59:13 -0800 Organization: Newt Software Message-ID: <22611.1138658353@olgas.newt.com> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1138658432 7067 80.91.229.2 (30 Jan 2006 22:00:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2006 22:00:32 +0000 (UTC) Cc: mh-e-devel@lists.sourceforge.net Original-X-From: mh-e-devel-admin@lists.sourceforge.net Mon Jan 30 23:00:24 2006 Return-path: Envelope-to: gmmd-mh-e-devel@m.gmane.org Original-Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F3h48-0007T2-BG for gmmd-mh-e-devel@m.gmane.org; Mon, 30 Jan 2006 23:00:05 +0100 Original-Received: from sc8-sf-list1-b.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7]) by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP id 899351369F; Mon, 30 Jan 2006 14:00:03 -0800 (PST) Original-Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1F3h3P-0001kz-OF for mh-e-devel@lists.sourceforge.net; Mon, 30 Jan 2006 13:59:19 -0800 Original-Received: from 69-93-192-76.acornhosting.net ([69.93.192.76] helo=tassie.newt.com) by mail.sourceforge.net with esmtp (Exim 4.44) id 1F3h3O-0000jD-N1 for mh-e-devel@lists.sourceforge.net; Mon, 30 Jan 2006 13:59:20 -0800 Original-Received: from olgas.newt.com (c-67-161-47-42.hsd1.ca.comcast.net [67.161.47.42]) by tassie.newt.com (Postfix) with ESMTP id E00742D4015; Mon, 30 Jan 2006 13:59:14 -0800 (PST) Original-Received: by olgas.newt.com (Postfix, from userid 1000) id D306017002; Mon, 30 Jan 2006 13:59:13 -0800 (PST) Original-Received: from olgas.newt.com (localhost [127.0.0.1]) by olgas.newt.com (Postfix) with ESMTP id CF66D16F4D; Mon, 30 Jan 2006 13:59:13 -0800 (PST) Original-To: emacs-devel@gnu.org X-Mailer: MH-E 7.85+sans-entropy; nmh 1.1; GNU Emacs 22.0.50.4 X-Image-URL: http://www.newt.com/wohler/images/bill-diving.png Mail-Followup-To: emacs-devel@gnu.org, mh-e-devel@lists.sourceforge.net X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by sourceforge.net. See http://spamassassin.org/tag/ for more details. Report problems to http://sf.net/tracker/?func=add&group_id=1&atid=200001 1.0 FORGED_RCVD_HELO Received: contains a forged HELO Original-Sender: mh-e-devel-admin@lists.sourceforge.net Errors-To: mh-e-devel-admin@lists.sourceforge.net X-BeenThere: mh-e-devel@lists.sourceforge.net X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Unsubscribe: , List-Id: Forum for the MH-E developers List-Post: List-Help: List-Subscribe: , List-Archive: X-Original-Date: Mon, 30 Jan 2006 13:59:13 -0800 Xref: news.gmane.org gmane.mail.mh-e.devel:11462 gmane.emacs.devel:49792 Archived-At: I'm a bit confused by the compatibility alias conventions and was hoping someone could clarify them for me. In (elisp)Coding Conventions, I read: 1. It is a bad idea to define aliases for the Emacs primitives. Normally you should use the standard names instead. The case where an alias may be useful is where it facilitates backwards compatibility or portability. 2. If a package needs to define an alias or a new function for compatibility with some other version of Emacs, name it with the package prefix, not with the raw name with which it occurs in the other version. Here is an example from Gnus, which provides many examples of such compatibility issues. (defalias 'gnus-point-at-bol (if (fboundp 'point-at-bol) 'point-at-bol 'line-beginning-position)) Unless I'm missing a subtlety, these two paragraphs seem incompatible with each other. The following seems OK by #1 but not by #2: (unless (fboundp 'assoc-string) (defsubst assoc-string (key list case-fold) "Like `assoc' but specifically for strings. Case is ignored if CASE-FOLD is non-nil. This function added by MH-E for Emacs versions that lack `assoc-string', introduced in Emacs 22." (if case-fold (assoc-ignore-case key list) (assoc key list)))) This seems preferable to creating a function, macro, or alias mh-assoc-string which provides no value-add. In the future, when Emacs 22 is the oldest Emacs version supported, we can simply remove the defsubst and not have to modify the code that calls it. Readers of the code will be able to quickly read "assoc-string" but will be slowed by having to check the docstring or code for "mh-assoc-string" to check for special treatment of our function. Or perhaps this is OK. Since it does nothing in Emacs 22, it is OK by point #1. Since it is using the Emacs name rather than the name in an "other version" of Emacs, it is OK by #2. -- Bill Wohler http://www.newt.com/wohler/ GnuPG ID:610BD9AD Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian! If you're passed on the right, you're in the wrong lane. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642