Wattskemov
Wattskemov

Reputation: 756

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

I can use my style file under 23.1, 23.4, but after I update Emacs to 24.1, I can't use the old style files. For example, one of my style files is color-theme-arjen.el. Here is the link:

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

In my elisp file, I use following code to load the 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 & 23.4 but just doesn't work under Emacs 24.1.

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

Symbol's function definition is void: plist-to-alist

If I uncomment above code and don't load the style file, the error is dismissed.

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

Upvotes: 5

Views: 3106

Answers (4)

douardo
douardo

Reputation: 765

I definitely thanks wenjun.yan. But i would rather want to check if the function exist before defining it :

(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)))

Upvotes: 0

toastboy70
toastboy70

Reputation: 1

I have little idea why, but when installing the solarized theme in emacs 24.3.1 on MacOS X, I found that if I put my init lines:

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

after I turned off the scroll bars:

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

it worked fine. The other way around, I get the error above. I've no idea why the color-theme-alist function is affected by the absence of a scroll bar (the plist-to-alist function call seems to be only for XEmacs)

Upvotes: 0

wenjun.yan
wenjun.yan

Reputation: 618

Yeah , I found this bug too. It seems that the Emacs 24 dosen't have the ' plist-to-alist ' function. So probably you should write it yourself. Here is mine. Put this function in your 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 it helps : )

Upvotes: 21

jdd
jdd

Reputation: 4336

The color theme stuff was heavily revamped in 24, there is a color theme package included with emacs (see M-x customize-themes), and as far as I know breakage of older themes is expected.

The color theme package from marmalade reportedly works as well.

You should probably open a bug report for color-theme-arjen.

Upvotes: 3

Related Questions