unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* PATCH: (more) compability with emacs 22
@ 2011-08-16  9:31 Tomi Ollila
  2011-08-19 19:31 ` Jameson Graef Rollins
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Ollila @ 2011-08-16  9:31 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: PATCH: (more) compability with emacs 22
  2011-08-16  9:31 PATCH: (more) compability with emacs 22 Tomi Ollila
@ 2011-08-19 19:31 ` Jameson Graef Rollins
  0 siblings, 0 replies; 2+ messages in thread
From: Jameson Graef Rollins @ 2011-08-19 19:31 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

On Tue, 16 Aug 2011 12:31:18 +0300, Tomi Ollila <tomi.ollila@nixu.com> wrote:
> Currently, notmuch-lib.el does not have enough emacs < 23
> compability functions.
> 
> This patch makes notmuch better compatible with emacs 22:

Hi, Tomi.  Thanks for the patch.  A couple of comments about the patch
formatting:

* Patches should always have good log messages.  For instance, you don't
  explain here what exactly is the compatibility issue that this patch
  is solving.  That's an important thing to include in the body of the
  log.

* Patches should be sent directly to the list in the format output by
  "git format-patch".  This allows them to be applied directly from
  mail, with all logs included, without any extra processing.  I highly
  recommend using "git send-email".

> 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))

I think this is a really good idea.  Please feel free to send patches
for this to the list.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-19 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-16  9:31 PATCH: (more) compability with emacs 22 Tomi Ollila
2011-08-19 19:31 ` Jameson Graef Rollins

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).