Skip to content

Conversation

@natsirtguy
Copy link
Contributor

Summary

This PR fixes compatibility with recent polymode changes that removed the pm--visible-buffer-name function in commit 32d0d6d.

Problem

The pm--visible-buffer-name function was removed from polymode and replaced with pm--buffer-name. This caused ein to fail when loading poly-ein.el with an "undefined function" error.

Solution

Replace all instances of pm--visible-buffer-name with pm--buffer-name() in poly-ein.el.

The pm--buffer-name function:

  • When called without arguments: pm--buffer-name() - returns the visible buffer name (equivalent to old pm--visible-buffer-name)
  • When called with 'hidden: pm--buffer-name('hidden) - returns the hidden buffer name (equivalent to old pm--hidden-buffer-name)

Changes

  • Updated poly-ein--record-window-buffer function
  • Updated ido-make-buffer-list-hook lambda function
  • Updated function documentation strings

Testing

  • Code compiles without errors using make test-compile
  • Tested functionality in Emacs with Jupyter notebooks
  • Buffer switching between polymode buffers works correctly

Compatibility

This change maintains backward compatibility while fixing the issue with polymode >= commit 32d0d6d.

Fixes compatibility with polymode commit: polymode/polymode@32d0d6d

Replace pm--visible-buffer-name with pm--buffer-name to maintain
compatibility with polymode commit 32d0d6d which removed the
pm--visible-buffer-name function and replaced it with pm--buffer-name.

The pm--buffer-name function takes an optional 'hidden parameter:
- pm--buffer-name() returns the visible buffer name (equivalent to old pm--visible-buffer-name)
- pm--buffer-name('hidden) returns the hidden buffer name (equivalent to old pm--hidden-buffer-name)

This change fixes the issue where ein would fail to load due to the
undefined pm--visible-buffer-name function.

Fixes compatibility with polymode >= commit 32d0d6d.
### Notes

- Update actions/checkout from v2 to v4
- Update actions/setup-python from v2 to v4
- Update actions/cache from v2 to v4 (both instances)

### Testing

This addresses the workflow failure caused by deprecated action versions.
The updated actions are the current stable releases and should resolve
the CI pipeline issues.

### Issues
* Fixes GitHub Actions deprecation warnings in CI workflow
### Notes

- Change python-version from 3.7 to 3.8 in test matrix
- Python 3.7 reached end-of-life and is no longer available on Ubuntu 24.04
- Python 3.8 is widely supported and compatible with the project requirements

### Testing

This addresses the CI failure where Python 3.7 was not found in the local cache
for Ubuntu 24.04. Python 3.8 should be available and allow the workflow to proceed.

### Issues
* Fixes Python version availability issue in GitHub Actions workflow
### Notes

- Remove emacs_version 26.3 from test matrix
- Keep testing on 27.2, 28.2, and 29.1
- Dependencies now require Emacs 27.1+ (magit and others have updated minimum requirements)

### Testing

This addresses the CI failure where packages required Emacs 27.1 but the workflow
was testing on 26.3. The remaining Emacs versions should be compatible with
current package dependencies.

### Issues
* Fixes Emacs version compatibility issue in GitHub Actions workflow
@bjodah
Copy link

bjodah commented Jun 22, 2025

I've tried these proposed changes and can confirm that it resolves the error with the missing function pm--visible-buffer-name.

As an aside, I ran make dist based on this branch to create my own tarball. But in order to make that build pass with emacs 30.1 I had to apply some other changes too. @natsirtguy I don't know if those additions look relevant to you (perhaps not in this PR), but if you are curious you can see those here:
https://github.com/natsirtguy/emacs-ipython-notebook/compare/fix-polymode-compatibility...bjodah:emacs-ipython-notebook:fix-polymode-compatibility?expand=1

@nailuj05
Copy link

nailuj05 commented Jul 2, 2025

I can also confirm this fixes compatibility on emacs 30.1

@bjodah bjodah mentioned this pull request Sep 22, 2025
@emin63
Copy link

emin63 commented Oct 21, 2025

Can anyone provide hints on how to install?

I built emacs 30.2 from source, compiled ein from https://github.com/bjodah/emacs-ipython-notebook/tree/fix-polymode-compatibility, loaded the compiled ein-autoloads.el, and tried ein:login (after starting a jupyter kernel locally). I then installed dependencies one-by-one from MELPA until ein:login asked me for a URL. At that point I got the following error:

[error] request--callback: could not parse JSON stream: 1, 1, 1
ein: [error] ein:content-query-contents--error http://127.0.0.1:8888/tree?token=REDACTED/ REQUEST-STATUS parse-error DATA (1 1 1)

I had similar issues with emacs 30.1.

Thanks in advance for any help.

@emin63
Copy link

emin63 commented Oct 21, 2025

Can anyone provide hints on how to install?

Nevermind. The problem was not with my install (at least not directly).

For some reason, if I type the full URL (e.g., http://nethermine:8888/lab?token=REDACTED) then I get strange errors but if I just provide the PORT then everything works fine.

@emin63
Copy link

emin63 commented Oct 24, 2025

Apologies for the spam. This seems to be the only and last place to go to get EIN working on emacs 30 so I wanted to share a fix for an issue which others may experience.

I had a lot of strange bugs (e.g., Invalid function: ein:log when trying to use pdb in an EIN buffer). After much hair pulling, I discovered that emacs native compilation was causing the trouble (see also #778). I verified this by doing a clean install of ein after disabling native compilation. For a less nuclear option, I believe the following is a way to get a working install:

;; Native compilation causes problems for pdb in ein
;; so prevent native compilation for ein.
(with-eval-after-load 'comp
  (add-to-list 'native-comp-jit-compilation-deny-list "ein"))
(use-package ein
  :straight (ein :type git
                 :host github
                 :repo "natsirtguy/emacs-ipython-notebook"
                 :branch "fix-polymode-compatibility"))

Thanks @natsirtguy and @bjodah for information in this thread which helped me get this working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants