Why can't I use the old theme style file under Emacs 24.1?

I can use my style file under 23.1, 23.4, but after I upgraded Emacs to 24.1, I cannot use the old style files. For example, one of my style files is color-theme-arjen.el . Link here:

https://github.com/credmp/color-theme-arjen/blob/master/color-theme-arjen.el

In my elisp file, I use the following code to load a color theme:

(load-file "~ / emacs / site- lisp / color-theme / master_color-theme-arjen.el") (Color-theme-Arjen)

I don’t know why the color theme works under Emacs 23.1 and 23.4, but just doesn’t work under Emacs 24.1.

While Emacs is loading the file, Emacs gives the following error:

Character function definition invalid: plist-to-alist

If I uncomment the code above and do not upload the style file, the error will be missed.

Does anyone know why this happened? Or how can I debug it?

+5
source share
4 answers

The color theme theme has been updated a lot in 24, there is a package of color themes included in emacs (see M-x customize-themes), and as far as I know, old themes break.

The marmalade color theme package is reportedly working.

You should probably open an error report for color-theme-arjen.

+3
source

Yes, I also found this error. Emacs 24 doesn't seem to have a plist-to-alist function. So you should probably write this yourself. Here is mine. Put this function in the dot-emacs file, then it will be ok.

(defun plist-to-alist (the-plist)
  (defun get-tuple-from-plist (the-plist)
    (when the-plist
      (cons (car the-plist) (cadr the-plist))))

  (let ((alist '()))
    (while the-plist
      (add-to-list 'alist (get-tuple-from-plist the-plist))
      (setq the-plist (cddr the-plist)))
  alist))

Hope this helps :)

+22

, , emacs 24.3.1 MacOS X , :

(load-file "~/lisp/color-theme/color-theme.el")
(load-file "~/lisp/emacs-colors-solarized/color-theme-solarized.el")
(color-theme-solarized 'dark)

, :

(if (featurep 'scroll-bar)
    (scroll-bar-mode -1))

It worked fine. On the other hand, I get the error above. I don’t know why the color-theme-alist function depends on the lack of a scroll bar (calling the plist-to-alist function seems only for XEmacs)

0
source

I definitely thank wenjun.yan. But I would prefer to check if a function exists before it is defined:

(unless (fboundp 'plist-to-alist) 
(defun plist-to-alist (the-plist)
  (defun get-tuple-from-plist (the-plist)
    (when the-plist
      (cons (car the-plist) (cadr the-plist))))
  (let ((alist '()))
    (while the-plist
      (add-to-list 'alist (get-tuple-from-plist the-plist))
      (setq the-plist (cddr the-plist)))
  alist)))
0
source

All Articles