bongo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bongo-devel] Re: Emacs 21


From: Daniel Jensen
Subject: [bongo-devel] Re: Emacs 21
Date: Tue, 02 Jan 2007 01:47:47 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux)

Daniel Brockman <address@hidden> writes:

> Romain Francoise <address@hidden> writes:
>
>> And now that it byte-compiles successfully in Emacs 21,
>> it doesn't run:
>>
>> | Loading bongo...
>> | Loading executable...done
>> | byte-code: Invalid function: (macro . #[(obsolete-name
>> | current-name &optional when docstring) "[bytecode snipped]"
>> | [obsolete-name current-name when progn make-obsolete-variable] 5
>> | ("/usr/share/emacs21/site-lisp/bongo/bongo-emacs21.elc" . 1838)])

I'm guessing this is because the macro was not defined at compile
time. It was later defined and compiled, but the previously compiled
code does not know about that. Kind of hairy.

> I don't see the fix immediately, and I actually just found
> another byte-compilation problem (introduced by me recently).
> I'll look into this as soon I find the time.

I looked into it. I rearranged a few things for it to work. Please try
this patch.

Note: `bongo-plist-get-all' is used at compile time. That is ...
unorthodox, isn't it?

diff -Naur old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-01-01 21:37:15.000000000 +0100
+++ new-bongo/bongo.el  2007-01-02 01:41:58.000000000 +0100
@@ -83,8 +83,23 @@
   (require 'cl)
   (require 'rx))
 
-(if (<= emacs-major-version 21)
-    (require 'bongo-emacs21)
+(eval-and-compile
+  (if (<= emacs-major-version 21)
+      (require 'bongo-emacs21)
+    (defalias 'bongo-define-obsolete-function-alias
+      'define-obsolete-function-alias)
+    (defalias 'bongo-define-obsolete-variable-alias
+      'define-obsolete-variable-alias)
+    (defalias 'bongo-define-global-minor-mode
+      'define-global-minor-mode)
+    (put 'bongo-define-obsolete-function-alias
+         'lisp-indent-function 'defun)
+    (put 'bongo-define-obsolete-variable-alias
+         'lisp-indent-function 'defun)
+    (put 'bongo-define-global-minor-mode
+         'lisp-indent-function 'defun)))
+
+(when (>= emacs-major-version 22)
   (defalias 'bongo-face-foreground
     'face-foreground)
   (defalias 'bongo-face-background
@@ -93,26 +108,12 @@
     'read-directory-name)
   (defalias 'bongo-run-mode-hooks
     'run-mode-hooks)
-  (eval-and-compile
-    (defalias 'bongo-define-obsolete-function-alias
-      'define-obsolete-function-alias)
-    (defalias 'bongo-define-obsolete-variable-alias
-      'define-obsolete-variable-alias)
-    (put 'bongo-define-obsolete-function-alias
-         'lisp-indent-function 'defun)
-    (put 'bongo-define-obsolete-variable-alias
-         'lisp-indent-function 'defun))
   (defalias 'bongo-custom-set-minor-mode
     'custom-set-minor-mode)
   (defalias 'bongo-customize-mark-as-set
     'customize-mark-as-set)
   (defalias 'bongo-custom-reevaluate-setting
-    'custom-reevaluate-setting)
-  (eval-and-compile
-    (defalias 'bongo-define-global-minor-mode
-      'define-global-minor-mode)
-    (put 'bongo-define-global-minor-mode
-         'lisp-indent-function 'defun)))
+    'custom-reevaluate-setting))
 
 ;; We try to load this library so that we can later decide
 ;; whether to enable Bongo Last.fm mode by default.
@@ -2644,6 +2645,7 @@
       (if entry (prog1 alist (setcdr entry value))
         (cons (cons key value) alist)))))
 
+(eval-and-compile
 (defun bongo-plist-get-all (plist property)
   "Return a list of all values in PLIST corresponding to PROPERTY."
   (let ((result nil))
@@ -2651,7 +2653,7 @@
       (when (eq (car plist) property)
         (push (cadr plist) result))
       (setq plist (cddr plist)))
-    (nreverse result)))
+    (nreverse result))))
 
 (defun bongo-filter-alist (keys alist)
   "Return a new list of each pair in ALIST whose car is in KEYS.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]