0

I'm trying to upgrade from emacs-27.2 to emacs-30.0.50 under Ubuntu GNU/Linux.

Now, when I use emacs-30.0.50, I get this error on startup:

Wrong number of arguments: make-obsolete-variable, 2

I understand that this is due to the fact that the emacs-30.0.50 version of make-obsolete-variable takes 3 required arguments and one optional argument, while the emacs-27.2 version of make-obsolete-variable takes only 2 required argument and 1 optional argument.

Unfortunately. make-obsolete-variable appears in numerous emacs packages that I am using, most of them 3rd-party packages. It will be a major headache for me to upgrade all of those packages.

I don't care if make-obsolete-variable function is a no-op. What I'm hoping for is some sort of way to tell emacs to turn all those existing make-obsolete-variable calls into do-nothing calls, but I can't figure out a way to make that happen.

I tried putting the following at the top of my $HOME/.emacs file, but it doesn't help ...

(fmakunbound 'make-obsolete-variable)
(unintern 'make-obsolete-variable)
(defun make-obsolete-variable (&optional a b c d)
  )

After doing this, I get numerous errors similar to this one at emacs startup time:

Warning (comp): /usr/local/share/emacs/site-lisp/wl/elmo-date.el: Error: Wrong number of arguments make-obsolete-variable

Is there anything I can do to stop getting these errors under emacs-30.0.50 without upgrading all of my emacs packages which currently make use the old version of this function call?

To clarify, another reason that I don't want to install all new package versions is that I might end up deciding to go back to emacs-27.2, in which case I'd have to reinstall all the old packages again. That would be another major headache.

5
  • The library elmo-date.el does not call the function make-obsolete-variable as far as I am aware. Instead, it calls make-obsolete at lines 38, 41, 43, 180 and 182: github.com/wanderlust/wanderlust/blob/master/elmo/elmo-date.el
    – lawlist
    Apr 23, 2023 at 7:23
  • Why not move your package installation dir (for me this is ~/.emacs.d/elpa) to something else (eg `~/.emacs.d/elpa-emacs-27) to keep your old packages around in case of reverting to emacs-27.2. Installing new packages for versions >=28 is pretty much a must because of native compilation. Apr 23, 2023 at 9:24
  • 1
    Thanks to both of you. I know I can back up directories and install newer package versions. I'm trying to avoid that. I have something like 20 years' worth of elisp code in multiple packages, and some of the packages themselves are obsolete. I'm looking for a shortcut that I can use without having to find, download, and install newer versions of all my old elisp code.
    – HippoMan
    Apr 23, 2023 at 10:52
  • No doubt my wanderlust and related code (such as elmo) is out of date. And the elmo code that I'm using indeed is calling make-obsolete-variable. Again, I'm looking for some sort of shortcut that I can utilize in order to bypass these errors, rather than try to upgrade all my packages.
    – HippoMan
    Apr 23, 2023 at 10:54
  • ... and it turns out that I figured out what I need to do. See the "Answer" that I just now posted.
    – HippoMan
    Apr 23, 2023 at 11:26

1 Answer 1

1

I now realize that the only reason that the hack I suggested above didn't work is because I forgot about the existing *.elc files. And it turns out that the following does indeed work at the top of $HOME/.emacs if I first backup my existing package directories and then delete my existing *.elc files for all my packages (and I now realize that I need to do this for make-obsolete, as well) ...

(fmakunbound 'make-obsolete-variable)
(fmakunbound 'make-obsolete)    
(unintern 'make-obsolete-variable)
(unintern 'make-obsolete)
(defun make-obsolete-variable (&optional a b c d)
  )
(defun make-obsolete (&optional a b c)
  )

Then, I can go back and do byte-recompile-directory in each of my elisp package directories.

After fixing this, I hit a few more issues in emacs-30.0.50 with some of the old packages, but they are smaller, isolated problems, and they can be easily handled on a case-by-case basis.

I just think that it was a mistake on the part of the emacs developers to refactor the calling sequences for make-obsolete-variable and make-obsolete such that those functions fail during emacs upgrades. Those functions are meant to help during upgrades, and in my opinion, these functions themselves should not be impediments to the upgrade process.

For make-obsolete-variable, instead of upgrading from 2 required arguments and 1 optional argument to 3 required arguments, the newer version of the function should have been written to stay with 2 required arguments and 1 optional argument, with logic internal to the function retaining the old behavior when only 2 arguments are supplied by the caller. And a similar procedure should have been utilized for make-obsolete.

In my not-very-ample spare time, I'll eventually write my own versions of make-obsolete-variable and make-obsolete with this implementation in mind, and I'll present that to the emacs developers.

In the mean time, my current hack works for me.

PS: I see the following in the change log. This is what broke the upgrade procedure:

2021-01-03  Stefan Monnier  <[email protected]>

        * lisp/emacs-lisp/byte-run.el (make-obsolete): Make `when` mandatory

        (define-obsolete-function-alias, make-obsolete-variable)
        (define-obsolete-variable-alias): Adjust similarly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.