unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Default language environment not calling set-language-environment-hook?
@ 2013-11-24 23:41 Matthias Meulien
  2013-11-25 16:32 ` Davis Herring
       [not found] ` <52937C17.3050700@lanl.gov>
  0 siblings, 2 replies; 6+ messages in thread
From: Matthias Meulien @ 2013-11-24 23:41 UTC (permalink / raw)
  To: emacs-devel

I ran emacs with a minimal `~/.emacs' limited to:

(add-hook 'set-language-environment-hook (lambda ()
             (message "Language environment is " 
             current-language-environment))) 
 
(message "Language environment is " current-language-environment) 
 

The *Messages* buffer contains: "Language environment is ". But 
when asking for the description of the variable 
`current-language-environment' I get:

Its value is "French" Original value was "English" 

I was expecting the `set-language-environment-hook' to be called. 
Am I wrong?
-- 
Matthias



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default language environment not calling set-language-environment-hook?
  2013-11-24 23:41 Default language environment not calling set-language-environment-hook? Matthias Meulien
@ 2013-11-25 16:32 ` Davis Herring
       [not found] ` <52937C17.3050700@lanl.gov>
  1 sibling, 0 replies; 6+ messages in thread
From: Davis Herring @ 2013-11-25 16:32 UTC (permalink / raw)
  To: emacs-devel

> (add-hook 'set-language-environment-hook (lambda ()
>             (message "Language environment is "            
> current-language-environment)))
> (message "Language environment is " current-language-environment)
> 
> The *Messages* buffer contains: "Language environment is ".

Not your question, but you surely want to put %s (or %S) into your
`message' format string so that the value of
`current-language-environment' is actually printed.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default language environment not calling set-language-environment-hook?
       [not found] ` <52937C17.3050700@lanl.gov>
@ 2013-11-25 23:29   ` Matthias Meulien
  2013-11-26  3:49     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Meulien @ 2013-11-25 23:29 UTC (permalink / raw)
  To: emacs-devel

Davis Herring <herring@lanl.gov> writes:

> Not your question, but you surely want to put %s (or %S) into 
> your `message' format string so that the value of 
> `current-language-environment' is actually printed.

You are right. Thanks!

Nonetheless, `set-language-environment-hook' is not called at startup
with emacs trunk.
-- 
Matthias



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default language environment not calling set-language-environment-hook?
  2013-11-25 23:29   ` Matthias Meulien
@ 2013-11-26  3:49     ` Eli Zaretskii
  2013-11-26  9:16       ` Matthias Meulien
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2013-11-26  3:49 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: emacs-devel

> From: Matthias Meulien <orontee@gmail.com>
> Date: Tue, 26 Nov 2013 00:29:36 +0100
> 
> Nonetheless, `set-language-environment-hook' is not called at startup
> with emacs trunk.

I think this is because set-language-environment is called by
startup.el before it processes your .emacs, so the hook is not yet
set.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default language environment not calling set-language-environment-hook?
  2013-11-26  3:49     ` Eli Zaretskii
@ 2013-11-26  9:16       ` Matthias Meulien
  2013-11-26 16:30         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Meulien @ 2013-11-26  9:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

> I think this is because set-language-environment is called by
> startup.el before it processes your .emacs, so the hook is not yet
> set.

That's it!

Should not the docstring of `set-language-environment-hook' warn
developers about this? Something like:

During the start-up process, `set-language-environment' is called
before the user init file is read. Thus adding functions to that
hook in the user init file will have no effect while setting the
default language environment.
-- 
Matthias



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Default language environment not calling set-language-environment-hook?
  2013-11-26  9:16       ` Matthias Meulien
@ 2013-11-26 16:30         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2013-11-26 16:30 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: emacs-devel

> Date: Tue, 26 Nov 2013 10:16:43 +0100
> From: Matthias Meulien <orontee@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> Should not the docstring of `set-language-environment-hook' warn
> developers about this? Something like:
> 
> During the start-up process, `set-language-environment' is called
> before the user init file is read. Thus adding functions to that
> hook in the user init file will have no effect while setting the
> default language environment.

Sounds far-fetched to me.  People who want to hook into the startup
procedure should rather use a couple of hooks provided specifically
for that purpose, like before-init-hook, after-init-hook, etc.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-26 16:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-24 23:41 Default language environment not calling set-language-environment-hook? Matthias Meulien
2013-11-25 16:32 ` Davis Herring
     [not found] ` <52937C17.3050700@lanl.gov>
2013-11-25 23:29   ` Matthias Meulien
2013-11-26  3:49     ` Eli Zaretskii
2013-11-26  9:16       ` Matthias Meulien
2013-11-26 16:30         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).