From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Wedler, Christoph" Newsgroups: gmane.emacs.devel Subject: [Suggestion] New function `emacs-version>=' Date: Fri, 2 May 2003 21:55:31 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <67B8CED503F3D511BB9F0008C75DAD66054855C9@dewdfx17> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: main.gmane.org 1051905387 31688 80.91.224.249 (2 May 2003 19:56:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 2 May 2003 19:56:27 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri May 02 21:56:26 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Bgdu-0008Ex-00 for ; Fri, 02 May 2003 21:56:26 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19Bgfa-0007HR-00 for ; Fri, 02 May 2003 21:58:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Bgew-0002sv-03 for emacs-devel@quimby.gnus.org; Fri, 02 May 2003 15:57:30 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19BgeZ-0002gr-00 for emacs-devel@gnu.org; Fri, 02 May 2003 15:57:07 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Bgdy-00024Q-00 for emacs-devel@gnu.org; Fri, 02 May 2003 15:56:30 -0400 Original-Received: from smtpde02.sap-ag.de ([155.56.68.170]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Bgd7-0001Cf-00 for emacs-devel@gnu.org; Fri, 02 May 2003 15:55:37 -0400 Original-Received: from sap-ag.de (smtpde02) by smtpde02.sap-ag.de (out) with ESMTP id VAA07075 for ; Fri, 2 May 2003 21:55:51 +0200 (MESZ) Original-To: "Emacs-Devel (E-mail)" X-Mailer: Internet Mail Service (5.5.2656.59) X-SAP: out X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13629 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13629 I would like to see the following function defined in Emacs[1]: (defun emacs-version>= (major &optional minor patch) "Return true if the Emacs version is >= to the given version. The version is provided by the required argument MAJOR, and the optional arguments MINOR and PATCH. Only the non-nil arguments are used in the test." (cond ((> emacs-major-version major)) ((< emacs-major-version major) nil) ((null minor)) ((> emacs-minor-version minor)) ((< emacs-minor-version minor) nil) ((null patch)) ((string-match "^[0-9]+\\.[0-9]+\\.\\([0-9]+\\)" emacs-version) (>= (string-to-int (match-string 1 emacs-version)) patch))))) (Of course, a constant `emacs-patch-version' could be defined, as well. The function above would be changed to use it.) Specific features or bug fixes are only available in newer Emacsen and packages must be able to cope with it. A test like `fboundp' is only the right test iff the new feature to test for availibility is a function, it is not the right test for - I need to check the availibility for feature/fix A - feature/fix A is provided with Emacs-X.Y - function F is new with Emacs-X.Y - therefore I test with (fboundp 'F) The right test is - I need to check the availibility for feature/fix A - feature/fix A is provided with Emacs-X.Y - therefore I test with (emacs-version>= X Y) Like it or not, a test like `emacs-version>=' would be useful for many packages, thus a corresponding function would be useful to define in Emacs. - Christoph [1] This function is already defined in XEmacs.