Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 324E9429E25 for ; Tue, 16 Aug 2011 02:31:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vD2x6UWl9v+k for ; Tue, 16 Aug 2011 02:31:36 -0700 (PDT) Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 6132B431FB6 for ; Tue, 16 Aug 2011 02:31:21 -0700 (PDT) Received: from taco2.nixu.fi (localhost [127.0.0.1]) by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p7G9VJP7003849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 16 Aug 2011 12:31:19 +0300 Received: (from too@localhost) by taco2.nixu.fi (8.14.3/8.14.3/Submit) id p7G9VIU9003848; Tue, 16 Aug 2011 12:31:18 +0300 X-Authentication-Warning: taco2.nixu.fi: too set sender to tomi.ollila@nixu.com using -f From: Tomi Ollila To: notmuch@notmuchmail.org Subject: PATCH: (more) compability with emacs 22 X-Face: HhBM'cA~ User-Agent: Gnus/5.110014 (No Gnus v0.14) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 09:31:39 -0000 Hi Currently, notmuch-lib.el does not have enough emacs < 23 compability functions. This patch makes notmuch better compatible with emacs 22: --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index f93c957..d6b4108 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -144,12 +144,35 @@ within the current window." ;; Compatibility functions for versions of emacs before emacs 23. ;; -;; Both functions here were copied from emacs 23 with the following copyright: +;; All functions here were copied from emacs 23 with the following copyright: ;; ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003, ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; ;; and under the GPL version 3 (or later) exactly as notmuch itself. + +(compile-on-emacs-prior-to-23 + (load "cl-macs")) + +(compile-on-emacs-prior-to-23 + (defun process-lines (program &rest args) + "Execute PROGRAM with ARGS, returning its output as a list of lines. +Signal an error if the program returns with a non-zero exit status." + (with-temp-buffer + (let ((status (apply 'call-process program nil (current-buffer) nil args))) + (unless (eq status 0) + (error "%s exited with status %s" program status)) + (goto-char (point-min)) + (let (lines) + (while (not (eobp)) + (setq lines (cons (buffer-substring-no-properties + (line-beginning-position) + (line-end-position)) + lines)) + (forward-line 1)) + (nreverse lines)))))) + + (compile-on-emacs-prior-to-23 (defun apply-partially (fun &rest args) "Return a function that is a partial application of FUN to ARGS. --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- I personally would like to move emacs < 23 functionality to separate file, like 'notmuch-lib22.el' and then write the following to notmuch-lib.el: (when (< emacs-major-version 23) (require 'notmuch-lib22)) Tomi