(enriched-encode): Allow the 3rd argument ORIG-BUF for old Emacsen.
authoryamaoka <yamaoka>
Fri, 25 Feb 2000 02:41:01 +0000 (02:41 +0000)
committeryamaoka <yamaoka>
Fri, 25 Feb 2000 02:41:01 +0000 (02:41 +0000)
ChangeLog
emu.el

index 7a0cd2e..bcc4303 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-02-25  Katsumi Yamaoka   <yamaoka@jpl.org>
+
+       * emu.el (enriched-encode): Allow the 3rd argument ORIG-BUF for old
+       Emacsen.
+
 2000-02-21  Makoto Nakagawa  <Makoto.Nakagawa@jp.compaq.com>
 
        * poe.el (format-time-string): New function for Emacs 19.28 and
diff --git a/emu.el b/emu.el
index d610c53..407ea4b 100644 (file)
--- a/emu.el
+++ b/emu.el
@@ -223,6 +223,29 @@ find-file-hooks, etc.
        (autoload 'enriched-decode "tinyrich")
        ))
 
+(if (or (< emacs-major-version 20)
+       (and (eq emacs-major-version 20)
+            (< emacs-minor-version (if (featurep 'xemacs) 3 1))))
+    (eval-after-load "enriched"
+      '(if (fboundp 'si:enriched-encode)
+          nil
+        (fset 'si:enriched-encode (symbol-function 'enriched-encode))
+        (defun enriched-encode (from to &optional orig-buf)
+          (let* ((si:enriched-initial-annotation enriched-initial-annotation)
+                 (enriched-initial-annotation
+                  (if (stringp si:enriched-initial-annotation)
+                      si:enriched-initial-annotation
+                    (function
+                     (lambda ()
+                       (save-excursion
+                         ;; Eval this in the buffer we are annotating.  This
+                         ;; fixes a bug which was saving incorrect File-Width
+                         ;; information, since we were looking at local
+                         ;; variables in the wrong buffer.
+                         (if orig-buf (set-buffer orig-buf))
+                         (funcall si:enriched-initial-annotation)))))))
+            (si::enriched-encode))))))
+
 
 ;;; @ end
 ;;;