[PATCH] Use correct coding system information for Installation-string

Aidan Kehoe kehoea at parhasard.net
Tue Oct 30 16:14:23 EDT 2007


 Ar an triochadú lá de mí Deireadh Fómhair, scríobh Vin Shelton: 

 > Aidan -
 > 
 > Are you planning to apply this patch?  I can confirm that it does
 > clear up the "No such coding system" error on displaying Current
 > Installation Info.

As I mentioned in another thread, I don’t have home internet access right at
home; I was planning on waiting until I got that back, and then to commit
something; perhaps this, perhaps something less invasive with a more
invasive patch to follow. But it’s taking longer than I expected, so I’ll
commit this from work tomorrow. Thanks for the reminder!


 > On 10/26/07, Aidan Kehoe <kehoea at parhasard.net> wrote:
 > >
 > >  Ar an cúigiú lá is fiche de mí Deireadh Fómhair, scríobh Vin Shelton:
 > >
 > >  > In a recent 21.5 CVS XEmacs selecting Help/Other/Current Installation
 > >  > Info from the menubar yields the following error: "No such coding
 > >  > system".  I've attached my Installation file [even though it's
 > >  > available in the backtrace :-) ].
 > >  >
 > >  > Here's the lisp backtrace:
 > >  >
 > >  > Debugger entered--Lisp error: (invalid-argument "No such coding system" automatic-conversion)
 > >  > [...]
 > >
 > > Okay, using automatic-conversion as the coding system there was wrong in the
 > > original code; Installation-string should not be stored as binary. Here's a
 > > patch that works out its encoding, decodes it using that encoding at dump
 > > time, and eliminates your error.
 > >
 > > Can anyone tell me why version.el was dumped uncompiled? I would search the
 > > mail archives but, you know ...
 > >
 > > My patch of 18087.28114.645429.344798 at parhasard.net was also based on the
 > > logic that byte-compiling it won't make a difference; I didn't get to
 > > committing it. This patch requires that it be compiled in passing, since
 > > init-locale-at-early-startup (which works out the native coding system) is
 > > called at byte-compile time during the build, but not at dump time.
 > >
 > > lisp/ChangeLog addition:
 > >
 > > 2007-10-26  Aidan Kehoe  <kehoea at parhasard.net>
 > >
 > >         * mule/general-late.el:
 > >         Now that all the dumped coding systems are available, decode
 > >         Installation-string using the value for
 > >         Installation-file-coding-system at dump time.
 > >
 > > 2007-10-26  Aidan Kehoe  <kehoea at parhasard.net>
 > >
 > >         * dumped-lisp.el (preloaded-file-list):
 > >         Allow version.el to be compiled.
 > >         * help.el (describe-installation):
 > >         Use and-boundp instead of (and (boundp ...); don't decode
 > >         Installation-string. Call #'error with a DATUM arg.
 > >         * loadup.el:
 > >         * loadup.el (Installation-string): Removed.
 > >         Moved to version.el.
 > >         * loadup.el (really-early-error-handler):
 > >         Move the initialization of Installation-string to version.el too.
 > >         * update-elc-2.el (update-elc-ignored-files):
 > >         * update-elc-2.el (batch-update-elc-2):
 > >         Remove version.el from the ignored files; if Mule is available,
 > >         always recompile it, since Installation-file-coding-system depends
 > >         on relatively complex Mule code.
 > >         * update-elc.el (unbytecompiled-lisp-files):
 > >         Remove version.el.
 > >         * version.el:
 > >         * version.el (Installation-file-coding-system): New.
 > >         Variable reflecting the native coding system at build time, to
 > >         better work out Installation-string.
 > >         * version.el (Installation-string): New.
 > >         Moved from loadup.el; documented in more detail.
 > >
 > >
 > > XEmacs Trunk source patch:
 > > Diff command:   cvs -q diff -u
 > > Files affected: lisp/mule/general-late.el
 > > ===================================================================
 > > RCS lisp/version.el
 > > ===================================================================
 > > RCS lisp/update-elc.el
 > > ===================================================================
 > > RCS lisp/update-elc-2.el
 > > ===================================================================
 > > RCS lisp/unicode.el
 > > ===================================================================
 > > RCS lisp/loadup.el
 > > ===================================================================
 > > RCS lisp/help.el
 > > ===================================================================
 > > RCS lisp/dumped-lisp.el
 > > ===================================================================
 > > RCS
 > >
 > > Index: lisp/dumped-lisp.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/dumped-lisp.el,v
 > > retrieving revision 1.63
 > > diff -u -r1.63 dumped-lisp.el
 > > --- lisp/dumped-lisp.el 2007/07/22 22:03:31     1.63
 > > +++ lisp/dumped-lisp.el 2007/10/26 11:08:00
 > > @@ -33,7 +33,7 @@
 > >         "post-gc"
 > >         "replace"               ; match-string used in version.el.
 > >
 > > -       "version.el"             ; Ignore compiled-by-mistake version.elc
 > > +       "version"
 > >
 > >         "cl"
 > >         "cl-extra"
 > > Index: lisp/help.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/help.el,v
 > > retrieving revision 1.49
 > > diff -u -r1.49 help.el
 > > --- lisp/help.el        2007/08/07 23:08:51     1.49
 > > +++ lisp/help.el        2007/10/26 11:08:00
 > > @@ -829,16 +829,13 @@
 > >  (defun describe-installation ()
 > >    "Display a buffer showing information about this XEmacs was compiled."
 > >    (interactive)
 > > -  (if (and (boundp 'Installation-string)
 > > -          (stringp Installation-string))
 > > +  (if (and-boundp 'Installation-string
 > > +       (stringp Installation-string))
 > >        (with-displaying-help-buffer
 > >         (lambda ()
 > > -        (princ
 > > -         (if (fboundp 'decode-coding-string)
 > > -             (decode-coding-string Installation-string 'automatic-conversion)
 > > -           Installation-string)))
 > > +        (princ Installation-string))
 > >         "Installation")
 > > -    (error "No Installation information available.")))
 > > +    (error 'unimplemented "No Installation information available.")))
 > >
 > >  (defun view-emacs-news ()
 > >    "Display info on recent changes to XEmacs."
 > > Index: lisp/loadup.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/loadup.el,v
 > > retrieving revision 1.33
 > > diff -u -r1.33 loadup.el
 > > --- lisp/loadup.el      2006/12/29 18:09:43     1.33
 > > +++ lisp/loadup.el      2007/10/26 11:08:00
 > > @@ -69,9 +69,6 @@
 > >  (defvar preloaded-file-list nil
 > >    "List of files preloaded into the XEmacs binary image.")
 > >
 > > -(defvar Installation-string nil
 > > -  "Description of XEmacs installation.")
 > > -
 > >  ;(start-profiling)
 > >
 > >  (let ((gc-cons-threshold
 > > @@ -88,22 +85,6 @@
 > >  ;; This is awfully damn early to be getting an error, right?
 > >  (call-with-condition-handler 'really-early-error-handler
 > >      #'(lambda ()
 > > -
 > > -       ;; Initialize Installation-string.  We do it before loading
 > > -       ;; anything so that dumped code can make use of its value.
 > > -       (setq Installation-string
 > > -             (save-current-buffer
 > > -               (set-buffer (get-buffer-create (generate-new-buffer-name
 > > -                                               " *temp*")))
 > > -               ;; insert-file-contents-internal bogusly calls
 > > -               ;; format-decode without checking if it's defined.
 > > -               (fset 'format-decode #'(lambda (f l &optional v) l))
 > > -               (insert-file-contents-internal
 > > -                (expand-file-name "Installation" build-directory))
 > > -               (fmakunbound 'format-decode)
 > > -               (prog1 (buffer-substring)
 > > -                 (kill-buffer (current-buffer)))))
 > > -
 > >         (setq load-path (list source-lisp))
 > >         (setq module-load-path (list
 > >                                 (expand-file-name "modules" build-directory)))
 > > Index: lisp/update-elc-2.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/update-elc-2.el,v
 > > retrieving revision 1.12
 > > diff -u -r1.12 update-elc-2.el
 > > --- lisp/update-elc-2.el        2005/02/03 07:11:20     1.12
 > > +++ lisp/update-elc-2.el        2007/10/26 11:08:00
 > > @@ -65,8 +65,7 @@
 > >      "^make-docfile\\.el$"
 > >      "^site-start\\.el$"
 > >      "^site-load\\.el$"
 > > -    "^site-init\\.el$"
 > > -    "^version\\.el$"))
 > > +    "^site-init\\.el$"))
 > >
 > >  (defvar dirfiles-table (make-hash-table :test 'equal))
 > >
 > > @@ -190,8 +189,12 @@
 > >      (byte-recompile-file (expand-file-name "custom-load.el" dir) 0)
 > >      (when (featurep 'mule)
 > >        (Custom-make-dependencies (expand-file-name "mule" dir))
 > > -      (byte-recompile-file (expand-file-name "mule/custom-load.el" dir) 0))
 > > -    )
 > > +      (byte-recompile-file (expand-file-name "mule/custom-load.el" dir) 0)
 > > +      ;; See the eval-when-compile in the definition of
 > > +      ;; Installation-file-coding-system; if the file name sniffing or the
 > > +      ;; available coding systems have changed, version.elc should be
 > > +      ;; rebuilt.
 > > +      (byte-recompile-file (expand-file-name "version.el" dir) 0)))
 > >    (setq command-line-args-left nil))
 > >
 > >  ;;; update-elc-2.el ends here
 > > Index: lisp/update-elc.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/update-elc.el,v
 > > retrieving revision 1.36
 > > diff -u -r1.36 update-elc.el
 > > --- lisp/update-elc.el  2006/07/16 12:23:58     1.36
 > > +++ lisp/update-elc.el  2007/10/26 11:08:00
 > > @@ -117,8 +117,7 @@
 > >    '("paths.el"
 > >      "dumped-lisp.el"
 > >      "dumped-pkg-lisp.el"
 > > -    "raw-process.el"
 > > -    "version.el")
 > > +    "raw-process.el")
 > >    "Lisp files that should not be byte compiled.
 > >  Files in `additional-dump-dependencies' do not need to be listed here.")
 > >
 > > Index: lisp/version.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/version.el,v
 > > retrieving revision 1.50
 > > diff -u -r1.50 version.el
 > > --- lisp/version.el     2002/08/28 05:36:32     1.50
 > > +++ lisp/version.el     2007/10/26 11:08:00
 > > @@ -129,16 +129,48 @@
 > >  ;;; We hope that this alias is easier for people to find.
 > >  (define-function 'version 'emacs-version)
 > >
 > > -;; Put the emacs version number into the `pure[]' array in a form that
 > > -;; `what(1)' can extract from the executable or a core file.  We don't
 > > -;; actually need this to be pointed to from lisp; pure objects can't
 > > -;; be GCed.
 > > -(concat "\n@" "(#)" (emacs-version)
 > > -       "\n@" "(#)" "Configuration: "
 > > -       system-configuration "\n")
 > > +(defvar Installation-file-coding-system
 > > +  (eval-when-compile `,(coding-system-name (find-coding-system 'native)))
 > > +  "The coding system used to create the `Installation' file.
 > >
 > > -;;Local variables:
 > > -;;version-control: never
 > > -;;End:
 > > +The `Installation' file is created by configure, and the
 > > +`Installation-string' variable reflects its contents.
 > >
 > > -;;; version.el ends here
 > > +This is initialized to reflect the native coding system at the time
 > > +version.el was byte-compiled; ideally it would reflect the native coding
 > > +system of the environment when XEmacs was dumped, but the locale
 > > +initialization code isn't called at dump time, and the appropriate value
 > > +at byte-compile time should be close enough.  Note that this means that the
 > > +value of `Installation-string' during dump time thus reflects loading the
 > > +file using the `binary' coding system.  ")
 > > +
 > > +(defvar Installation-string
 > > +  ;; Initialize Installation-string.  We do it before loading
 > > +  ;; anything so that dumped code can make use of its value.
 > > +  (save-current-buffer
 > > +    (set-buffer (get-buffer-create (generate-new-buffer-name
 > > +                                   " *temp*")))
 > > +    ;; insert-file-contents-internal bogusly calls
 > > +    ;; format-decode without checking if it's defined.
 > > +    (fset 'format-decode #'(lambda (f l &optional v) l))
 > > +    (insert-file-contents-internal
 > > +     (expand-file-name "Installation" build-directory)
 > > +     ;; Relies on our working out the system coding system
 > > +     ;; correctly at startup.
 > > +     nil nil nil nil
 > > +     ;; Installation-file-coding-system is actually respected in
 > > +     ;; mule/general-late.el, after all the dumped coding systems have been
 > > +     ;; loaded.
 > > +     'binary)
 > > +    (fmakunbound 'format-decode)
 > > +    (prog1 (buffer-substring)
 > > +      (kill-buffer (current-buffer))))
 > > +  "Description of XEmacs installation.
 > > +
 > > +This reflects the values that the configure script worked out at build time,
 > > +including things like the C code features included at compile time and the
 > > +installation prefix.  Normally used when submitting a bug report;
 > > +occasionally used, in a way the XEmacs developers don't endorse, to work out
 > > +version information.  ")
 > > +
 > > +;;; version.el ends here
 > > \ No newline at end of file
 > > Index: lisp/mule/general-late.el
 > > ===================================================================
 > > RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/mule/general-late.el,v
 > > retrieving revision 1.4
 > > diff -u -r1.4 general-late.el
 > > --- lisp/mule/general-late.el   2007/08/26 20:00:41     1.4
 > > +++ lisp/mule/general-late.el   2007/10/26 11:08:00
 > > @@ -54,7 +54,16 @@
 > >             (remassoc "German" language-info-alist))
 > >        language-info-alist
 > >        (cons (assoc "English" language-info-alist)
 > > -           (remassoc "English" language-info-alist)))
 > > +           (remassoc "English" language-info-alist))
 > > +
 > > +      ;; Make Installation-string actually reflect the environment at
 > > +      ;; byte-compile time. (We can't necessarily decode it when version.el
 > > +      ;; is loaded, since not all the coding systems are available then.)
 > > +      Installation-string (if-boundp 'Installation-file-coding-system
 > > +                             (decode-coding-string
 > > +                              Installation-string
 > > +                              Installation-file-coding-system)
 > > +                           Installation-string))
 > >
 > >  ;; At this point in the dump, all the charsets have been loaded. Now, load
 > >  ;; their Unicode mappings.
 > >
 > > --
 > > On the quay of the little Black Sea port, where the rescued pair came once
 > > more into contact with civilization, Dobrinton was bitten by a dog which was
 > > assumed to be mad, though it may only have been indiscriminating. (Saki)
 > >
 > >
 > 
 > 
 > -- 
 > The Journey by Mary Oliver
 > http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506

-- 
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)



More information about the XEmacs-Patches mailing list