unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* subr-x on older Emacsen
@ 2014-07-15 13:08 Sebastian Wiesner
  2014-07-18 12:21 ` Bozhidar Batsov
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Wiesner @ 2014-07-15 13:08 UTC (permalink / raw)
  To: emacs-devel

Hello,

I’d like to use the new subr-x library in my Emacs Lisp projects, and I’m searching for advice on how to handle backwards compatibility.

As you know, subr-x was only recently introduced in Emacs trunk, and is not available in any Emacs release.  Currently, I simply copy those functions that I need into my code, guarding their definition with `(unless (features 'subr-x) …)'.

This scales poorly across many projects, obviously, so I’d like to know if there is a better approach to handle this problem.  Is their a compatibility package for subr-x on GNU ELPA, similar to cl-lib?

Greetings,
Sebastian Wiesner


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

* Re: subr-x on older Emacsen
  2014-07-15 13:08 subr-x on older Emacsen Sebastian Wiesner
@ 2014-07-18 12:21 ` Bozhidar Batsov
  2014-07-18 15:54   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Bozhidar Batsov @ 2014-07-18 12:21 UTC (permalink / raw)
  To: Sebastian Wiesner, emacs-devel

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

On July 15, 2014 at 4:09:27 PM, Sebastian Wiesner (swiesner@lunaryorn.com) wrote:
Hello, 

I’d like to use the new subr-x library in my Emacs Lisp projects, and I’m searching for advice on how to handle backwards compatibility. 

As you know, subr-x was only recently introduced in Emacs trunk, and is not available in any Emacs release. Currently, I simply copy those functions that I need into my code, guarding their definition with `(unless (features 'subr-x) …)'. 

This scales poorly across many projects, obviously, so I’d like to know if there is a better approach to handle this problem. Is their a compatibility package for subr-x on GNU ELPA, similar to cl-lib? 

While this could be done, there a few caveats:

* subr-x should be considered a built-in package
* newer version might have less functions than older one as ideally parts of subr-x will be promoted to subr
* the compatibility package should check for the presence of each function prior to defining it (follows from the previous bullet point)

Of course, this is part of a much bigger issue as things get constantly added to various Emacs libraries and using them and staying backwards compatible is always problematic. I don’t think we need a subr-x backwards compatibility package, we need an Emacs backwards compatibility package. Perhaps it would include stuff from a few past releases and define the things conditionally if not present?



Greetings, 
Sebastian Wiesner 

[-- Attachment #2: Type: text/html, Size: 3233 bytes --]

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

* Re: subr-x on older Emacsen
  2014-07-18 12:21 ` Bozhidar Batsov
@ 2014-07-18 15:54   ` Stefan Monnier
  2014-07-18 16:16     ` Sebastian Wiesner
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2014-07-18 15:54 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: Sebastian Wiesner, emacs-devel

[ Bozhidar: the text/plain version of your email is hard to follow
  because the quoted text is indistinguishable from the text you wrote!  ]

> I’d like to use the new subr-x library in my Emacs Lisp projects, and I’m
> searching for advice on how to handle backwards compatibility. 

Good question.

The best option I think is to turn subr-x.el into a GNU ELPA package and
to arrange for it to be bundled with the Emacs release tarball.

There's currently no mechanism to do that, tho.  And when we get that
working, there's the other issue of what to do with people building from
Bzr/Git rather than from the tarball.


        Stefan



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

* Re: subr-x on older Emacsen
  2014-07-18 15:54   ` Stefan Monnier
@ 2014-07-18 16:16     ` Sebastian Wiesner
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Wiesner @ 2014-07-18 16:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bozhidar Batsov, emacs-devel

Am 18.07.2014 um 17:54 schrieb Stefan Monnier <monnier@iro.umontreal.ca>:

> 
>> I’d like to use the new subr-x library in my Emacs Lisp projects, and I’m
>> searching for advice on how to handle backwards compatibility. 
> 
> Good question.

So there is no solution?  I’ll keep copying required definitions to my own code then.

Thanks for your answer :)




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

end of thread, other threads:[~2014-07-18 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15 13:08 subr-x on older Emacsen Sebastian Wiesner
2014-07-18 12:21 ` Bozhidar Batsov
2014-07-18 15:54   ` Stefan Monnier
2014-07-18 16:16     ` Sebastian Wiesner

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

	https://git.savannah.gnu.org/cgit/emacs.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).