emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Useful package? Compat.el
@ 2021-10-11 10:36 Timothy
  2021-10-11 14:28 ` Russell Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy @ 2021-10-11 10:36 UTC (permalink / raw)
  To: Org-mode


[-- Attachment #1.1: Type: text/plain, Size: 408 bytes --]

Hi,

I’ve recently come across an interesting looking library available on ELPA,
<https://git.sr.ht/~pkal/compat>. I’m thinking in future this could allow us to
both use newer features and also support older versions of Emacs, e.g.

Org 10.X is developed for Emacs 28.1 and newer, but supports Emacs 24.3 and
newer with compat.el.

Just tossing this out as an idea :)

All the best,
Timothy

[-- Attachment #1.2: Type: text/html, Size: 2920 bytes --]

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

* Re: Useful package? Compat.el
  2021-10-11 10:36 Useful package? Compat.el Timothy
@ 2021-10-11 14:28 ` Russell Adams
  2021-10-11 14:40   ` Timothy
  0 siblings, 1 reply; 4+ messages in thread
From: Russell Adams @ 2021-10-11 14:28 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Oct 11, 2021 at 06:36:50PM +0800, Timothy wrote:
> I’ve recently come across an interesting looking library available on ELPA,
> <https://git.sr.ht/~pkal/compat>. I’m thinking in future this could allow us to
> both use newer features and also support older versions of Emacs, e.g.
>
> Org 10.X is developed for Emacs 28.1 and newer, but supports Emacs 24.3 and
> newer with compat.el.

That's interesting, using a library to wrap new Emacs functionality
and implement a common replacement instead of custom work-arounds in
local code.

Do you have any examples of where this could shorten code in Org?

I believe it's a tall order to add a dependency, but if it eliminates
large chunks of backward compatibility code then maybe that's
something to consider.

Thanks.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


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

* Re: Useful package? Compat.el
  2021-10-11 14:28 ` Russell Adams
@ 2021-10-11 14:40   ` Timothy
  2021-10-11 18:04     ` Joost Kremers
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy @ 2021-10-11 14:40 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi Russel,

> Do you have any examples of where this could shorten code in Org?

I don’t have any examples on hand, but Org is already rolling some compat code
for old Emacs versions, and we’ve had issues where people have accidentally used
functions which are “too new” (but a few years old, and so nobody picked it up
till someone raised an issue). I can also personally recall times when I’ve had
to refactor code to make it uglier and more verbose to avoid using newer
functions. All of this is why I’m thinking this could be an interesting idea.

> I believe it’s a tall order to add a dependency, but if it eliminates
> large chunks of backward compatibility code then maybe that’s
> something to consider.

I think the way to do this would be as a “soft” dependency, i.e. not needed for
anyone running a recent version of Emacs, but needed if you want to use Org with
an old version of Emacs. Not sure how this would best be done, but if this were
to be useful, this is how I’d imagine it working.

All the best,
Timothy

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

* Re: Useful package? Compat.el
  2021-10-11 14:40   ` Timothy
@ 2021-10-11 18:04     ` Joost Kremers
  0 siblings, 0 replies; 4+ messages in thread
From: Joost Kremers @ 2021-10-11 18:04 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode


On Mon, Oct 11 2021, Timothy wrote:
> I think the way to do this would be as a “soft” dependency, i.e. not needed for
> anyone running a recent version of Emacs, but needed if you want to use Org with
> an old version of Emacs. Not sure how this would best be done, but if this were
> to be useful, this is how I’d imagine it working.

IIUC you can simply specify a dependency on `compat` and the package itself will
make sure only the necessary compatibility functions are loaded given the Emacs
version it's running in. So if you're running Emacs 28, nothing is loaded; if
you're running Emacs 27, `compat-28.1` is loaded to ensure packages written for
Emacs 28 can still be used; if you're running Emacs 26, both `compat-27.1` and
`compat-28.1` are loaded, etc.

-- 
Joost Kremers
Life has its moments


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

end of thread, other threads:[~2021-10-11 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 10:36 Useful package? Compat.el Timothy
2021-10-11 14:28 ` Russell Adams
2021-10-11 14:40   ` Timothy
2021-10-11 18:04     ` Joost Kremers

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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 NNTP newsgroup(s).