bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Bug#316852: gettext-el: po-validate prevents proper initialization o


From: Bruno Haible
Subject: Re: Bug#316852: gettext-el: po-validate prevents proper initialization of compile.el (fwd)
Date: Mon, 11 Jul 2005 13:03:10 +0200
User-agent: KMail/1.5

Sven Joachim wrote:
> ii  emacs21 [emacsen]             21.4a-1    The GNU Emacs editor
> ii  gettext                       0.14.4-2   GNU Internationalization
> utilities
> ...
> There is a bug in po-mode.el, more precisely in the function
> po-validate, which can prevent a proper initialization of the Emacs
> "compile" package, i.e. important variables such as "compile-command"
> may be undefined. To reproduce this bug, take the following steps:
>
> * Start Emacs and load a .po file: emacs -q /tmp/junk.po
> * In Emacs, type:
>   C-x C-s         to save the file
>   V               to call "po-validate"
>   M-x compile     to start a compilation process.
>
> You will get the error message
> "Symbol's value as variable is void: compile-command".
>
> I believe I have found out the reason for this. In the function
> po-validate, the "compile" package is implicitly loaded by a call to
> the autoloaded compile command. But this call takes place inside a let*
> form, so all defcustoms and defvars from compile.el are evaluated only
> temporarily -- and lost afterwards. Subsequent invocations of the
> "compile" command won't define them, as the "compile" package is
> already loaded.
>
> To fix this, "po-validate" can explicitly load the "compile" feature
> if not already present, as in the following patch:
>
> ------------------------------------------------------------------
> diff -u /usr/share/emacs/site-lisp/gettext/po-mode.el
> /home/sven/elisp/po-mode.el
> --- /usr/share/emacs/site-lisp/gettext/po-mode.el     2005-05-05
> 17:07:51.000000000 +0200
> +++ /home/sven/elisp/po-mode.el       2005-07-04 08:34:38.000000000 +0200
> @@ -3096,6 +3096,7 @@
>  (defun po-validate ()
>    "Use 'msgfmt' for validating the current PO file contents."
>    (interactive)
> +  (require 'compile)         ; make sure 'compile.el' is initialized
>    (let* ((dev-null
>         (cond ((boundp 'null-device) null-device) ; since Emacs 20.3
>               ((memq system-type '(windows-nt windows-95)) "NUL")
> -------------------------------------------------------------------
>
> Note that I have only tested this patch with GNU Emacs, because I
> don't have XEmacs installed.

Thanks a lot for this report and fix. I don't understand anything about
Emacs Lisp, but your explanation about defcustoms and defvars sounds
convincing. And I've verified that in your scenario, in both Emacs and
XEmacs, the error goes away through your patch. So I've applied your fix.

I'd like to thank you also for showing an ideal bug report:
  - You tell the version numbers of all implied software.
  - You indicate the steps to reproduce the problem in an unambiguous way.
  - You tell what error you observed (not just a fuzzy "doesn't work").
  - You present a fix.
  - You tell to which extent you have verified your fix.
If there was a prize for the most well-done bug report, it would go to you!

All the best, and many thanks!

                Bruno





reply via email to

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