* Activate an input-method from file-local variables?
@ 2006-07-15 14:38 Stefan Monnier
2006-07-15 14:47 ` Aidan Kehoe
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2006-07-15 14:38 UTC (permalink / raw)
Many of the files I edit use funny unicode math chars which I enter with the
help of the "TeX" input method. How can I make it such that those files
have the TeX input method activated as soon as I open them?
Currently I add an `eval: (activate-input-method "TeX")' to the
local-variables and then arrange for it not to trigger a prompt, but it
seems like there should be a more "official" way to do it.
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-15 14:38 Activate an input-method from file-local variables? Stefan Monnier
@ 2006-07-15 14:47 ` Aidan Kehoe
2006-07-15 14:55 ` David Kastrup
2006-07-15 21:57 ` Stefan Monnier
0 siblings, 2 replies; 16+ messages in thread
From: Aidan Kehoe @ 2006-07-15 14:47 UTC (permalink / raw)
Cc: emacs-devel
Ar an cúigiú lá déag de mí Iúil, scríobh Stefan Monnier:
> Many of the files I edit use funny unicode math chars which I enter with the
> help of the "TeX" input method.
> How can I make it such that those files
> have the TeX input method activated as soon as I open them?
>
> Currently I add an `eval: (activate-input-method "TeX")' to the
> local-variables and then arrange for it not to trigger a prompt, but it
> seems like there should be a more "official" way to do it.
I do a
(make-variable-buffer-local 'default-input-method)
in my init file and then add
default-input-method: "TeX"
to the local-variables of the relevant files. (I also give sensible default
values for default-input-method and input-method-history (also made
buffer-local) in my init file.)
--
Santa Maradona, priez pour moi!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-15 14:47 ` Aidan Kehoe
@ 2006-07-15 14:55 ` David Kastrup
2006-07-15 16:55 ` Aidan Kehoe
2006-07-15 21:57 ` Stefan Monnier
1 sibling, 1 reply; 16+ messages in thread
From: David Kastrup @ 2006-07-15 14:55 UTC (permalink / raw)
Cc: Stefan Monnier, emacs-devel
Aidan Kehoe <kehoea@parhasard.net> writes:
> I do a
>
> (make-variable-buffer-local 'default-input-method)
>
> in my init file
Why?
> and then add
>
> default-input-method: "TeX"
>
> to the local-variables of the relevant files.
Guess why they are named "local variables" ...
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-15 14:55 ` David Kastrup
@ 2006-07-15 16:55 ` Aidan Kehoe
2006-07-16 6:25 ` Richard Stallman
0 siblings, 1 reply; 16+ messages in thread
From: Aidan Kehoe @ 2006-07-15 16:55 UTC (permalink / raw)
Cc: Stefan Monnier, emacs-devel
Ar an cúigiú lá déag de mí Iúil, scríobh David Kastrup:
> > I do a
> >
> > (make-variable-buffer-local 'default-input-method)
> >
> > in my init file
>
> Why?
>
> > and then add
> >
> > default-input-method: "TeX"
> >
> > to the local-variables of the relevant files.
>
> Guess why they are named "local variables" ...
I guessed because they were a change to the global variable that was done
locally from the file in question--I ommited to read the three lines in the
XEmacs lispref that mention the connection to buffer-local variables, and am
having trouble finding something that mentions it explicitly in the GNU
Emacs Lisp reference manual. (And since “coding” is treated specially
anyway--no variable of that name normally exists--its buffer-local treatment
says nothing about file local variables as a whole.) Ah, here we are; three
throwaway sentences in “Local Variables in Files,” no mention whatsoever in
“Creating and Deleting Buffer-Local Bindings.”
Thank you for the pointer--it’s nice to learn something new.
--
Santa Maradona, priez pour moi!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-15 14:47 ` Aidan Kehoe
2006-07-15 14:55 ` David Kastrup
@ 2006-07-15 21:57 ` Stefan Monnier
2006-07-16 11:36 ` Aidan Kehoe
1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2006-07-15 21:57 UTC (permalink / raw)
Cc: emacs-devel
> in my init file and then add
> default-input-method: "TeX"
> to the local-variables of the relevant files. (I also give sensible default
AFAICT this does not do what I want: it doesn't *activate* the
input method. You still need to hit C-\ to activate it.
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-15 16:55 ` Aidan Kehoe
@ 2006-07-16 6:25 ` Richard Stallman
2006-07-16 11:59 ` Aidan Kehoe
0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2006-07-16 6:25 UTC (permalink / raw)
Cc: monnier, emacs-devel
XEmacs lispref that mention the connection to buffer-local variables, and am
We try to improve GNU Emacs documentation, but we cannot be
responsible for deficiencies of forked versions such as GNU XEmacs.
having trouble finding something that mentions it explicitly in the GNU
Emacs Lisp reference manual. (And since ?coding? is treated specially
File local variables are a user feature, not a Lisp programming
feature, so they are documented in the Emacs Manual.
Ah, here we are; three
throwaway sentences in Local Variables in Files,
I see you found the section in the Emacs Manual which documents them.
(There is an xref to it in the Lisp Manual.)
Why do you call that text "throwaway"? It is right at the start of
the section, and states the point explicitly. It says everything
there is to say about the question.
no mention whatsoever in
Creating and Deleting Buffer-Local Bindings.
(When you mention a section title, would you please say which
manual you're talking about? That would help me find it
so I can think about your point.)
That section describes Lisp facilities for creating and deleting
buffer-local bindings. File local variable lists don't belong there.
Anyway, it seems that I can make the xref in the Lisp Manual clearer,
and restate this basic point. What do you think of this new text?
A file can specify local variable values; Emacs uses these to create
buffer-local bindings for those variables in the buffer visiting that
file. @xref{File variables, , Local Variables in Files, emacs, The
GNU Emacs Manual}, for basic information about file local variables.
This section describes the functions and variables that affect
processing of file local variables.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-15 21:57 ` Stefan Monnier
@ 2006-07-16 11:36 ` Aidan Kehoe
2006-07-16 12:32 ` Stefan Monnier
0 siblings, 1 reply; 16+ messages in thread
From: Aidan Kehoe @ 2006-07-16 11:36 UTC (permalink / raw)
Cc: emacs-devel
Ar an cúigiú lá déag de mí Iúil, scríobh Stefan Monnier:
> AFAICT this does not do what I want: it doesn't *activate* the
> input method. You still need to hit C-\ to activate it.
Ah, excuse my misunderstanding. Looking through the source of
activate-input-method, as well as setting current-input-method, it calls
input-method-specific initialisation code, so simply setting a file-local
variable would seem to be impossible. You could, of course, add something
like the below to your init file, and specify hack-activate-input-method
appropriately in the files you want it to work for.
(defun hack-activating-input-method ()
"If `hack-activate-input-method' is bound, activate it as an input method.
See the function documentation `activate-input-method' for details on
activating input methods. "
(when (boundp 'hack-activate-input-method)
(activate-input-method hack-activate-input-method)))
(add-hook 'find-file-hooks 'hack-activating-input-method)
--
Santa Maradona, priez pour moi!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-16 6:25 ` Richard Stallman
@ 2006-07-16 11:59 ` Aidan Kehoe
2006-07-17 1:41 ` Richard Stallman
0 siblings, 1 reply; 16+ messages in thread
From: Aidan Kehoe @ 2006-07-16 11:59 UTC (permalink / raw)
Cc: emacs-devel
Ar an séú lá déag de mí Iúil, scríobh Richard Stallman:
> XEmacs lispref that mention the connection to buffer-local variables,
> and am
>
> We try to improve GNU Emacs documentation, but we cannot be
> responsible for deficiencies of forked versions such as GNU XEmacs.
I didn’t suggest that you were; I mentioned the XEmacs documentation because
it was relevant to answering David’s question.
> having trouble finding something that mentions it explicitly in the GNU
> Emacs Lisp reference manual. (And since ?coding? is treated specially
>
> File local variables are a user feature, not a Lisp programming
> feature,
They are both. You need an awareness of programming Lisp to use them,
something not true for most things detailed in the Emacs Manual.
> so they are documented in the Emacs Manual.
>
> Ah, here we are; three
> throwaway sentences in Local Variables in Files,
>
> I see you found the section in the Emacs Manual which documents them.
> (There is an xref to it in the Lisp Manual.)
>
> Why do you call that text "throwaway"? It is right at the start of
> the section, and states the point explicitly. It says everything
> there is to say about the question.
It doesn’t call them buffer-local variables. In GNU Emacs, variables can be
local to a let binding or lambda, local to a buffer, or local to a frame. I
read the first sentence ‘A file can specify local variable values for use
when you edit the file with Emacs.’ as just one more semantic extension of
the word ‘local’; the phrase ‘it automatically makes those variables local
to the buffer’ and a couple of phrases more in that section are what says
that the variables are buffer-local.
I call those three phrases ‘throwaway’ because they don’t arise at the start
of any section, they are mentioned in passing rather than emphasised.
> no mention whatsoever in
> Creating and Deleting Buffer-Local Bindings.
>
> (When you mention a section title, would you please say which
> manual you're talking about? That would help me find it
> so I can think about your point.)
>
> That section describes Lisp facilities for creating and deleting
> buffer-local bindings. File local variable lists don't belong there.
File local variable lists create buffer-local bindings! That’s what David
just explained to me.
> Anyway, it seems that I can make the xref in the Lisp Manual clearer,
> and restate this basic point. What do you think of this new text?
>
> A file can specify local variable values; Emacs uses these to create
> buffer-local bindings for those variables in the buffer visiting that
> file. @xref{File variables, , Local Variables in Files, emacs, The
> GNU Emacs Manual}, for basic information about file local variables.
> This section describes the functions and variables that affect
> processing of file local variables.
I find it much clearer; thank you for your thought on this.
--
Santa Maradona, priez pour moi!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-16 11:36 ` Aidan Kehoe
@ 2006-07-16 12:32 ` Stefan Monnier
2006-07-18 1:25 ` Kenichi Handa
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2006-07-16 12:32 UTC (permalink / raw)
Cc: emacs-devel
>> AFAICT this does not do what I want: it doesn't *activate* the
>> input method. You still need to hit C-\ to activate it.
> Ah, excuse my misunderstanding. Looking through the source of
> activate-input-method, as well as setting current-input-method, it calls
> input-method-specific initialisation code, so simply setting a file-local
> variable would seem to be impossible. You could, of course, add something
> like the below to your init file, and specify hack-activate-input-method
> appropriately in the files you want it to work for.
That seems much more complex than my current solution of using
`eval: (activate-input-method "TeX")' and adding
(put 'activate-input-method 'safe-local-eval-function t).
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-16 11:59 ` Aidan Kehoe
@ 2006-07-17 1:41 ` Richard Stallman
2006-07-17 7:29 ` Aidan Kehoe
0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2006-07-17 1:41 UTC (permalink / raw)
Cc: emacs-devel
> File local variables are a user feature, not a Lisp programming
> feature,
They are both. You need an awareness of programming Lisp to use them,
something not true for most things detailed in the Emacs Manual.
On the contrary, users can make file-local variable bindings for most
of the variables described in the Emacs Manual without knowing how to
program. They only need to know Lisp syntax for the values they use.
I call those three phrases ?throwaway? because they don?t arise at the start
of any section, they are mentioned in passing rather than emphasised.
It looks like the start of the section to me:
@node File Variables
@subsection Local Variables in Files
@cindex local variables in files
@cindex file local variables
A file can specify local variable values for use when you edit the
file with Emacs. Visiting the file checks for local variable
specifications; it automatically makes these variables local to the
buffer, and sets them to the values specified in the file.
> That section describes Lisp facilities for creating and deleting
> buffer-local bindings. File local variable lists don't belong there.
File local variable lists create buffer-local bindings! That?s what David
just explained to me.
The description of buffer-local bindings includes that section and
several others. That section is about Lisp facilities for creating
such bindings. Other aspects of buffer-local bindings are described
in the neighboring sections.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-17 1:41 ` Richard Stallman
@ 2006-07-17 7:29 ` Aidan Kehoe
2006-07-18 0:12 ` Richard Stallman
0 siblings, 1 reply; 16+ messages in thread
From: Aidan Kehoe @ 2006-07-17 7:29 UTC (permalink / raw)
Cc: emacs-devel
Ar an séú lá déag de mí Iúil, scríobh Richard Stallman:
> > File local variables are a user feature, not a Lisp programming
> > feature,
>
> They are both. You need an awareness of programming Lisp to use them,
> something not true for most things detailed in the Emacs Manual.
>
> On the contrary, users can make file-local variable bindings for most of
> the variables described in the Emacs Manual without knowing how to
> program. They only need to know Lisp syntax for the values they use.
That is, they need to have an awareness of programming Lisp.
> I call those three phrases “throwaway” because they don’t arise at
> the start of any section, they are mentioned in passing rather than
> emphasised.
>
> It looks like the start of the section to me:
As I wrote, calling them “local variables” does not say to me that they are
buffer-local, because there exist at least three distinct types of local
variables in the editor--four if you conceive of lexical-let as different
from let.
It’s only the phrase “it automatically makes these variables local to the
buffer” (and two more like it, later in the same section) that makes the
buffer-local aspect evident.
--
Santa Maradona, priez pour moi!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-17 7:29 ` Aidan Kehoe
@ 2006-07-18 0:12 ` Richard Stallman
0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2006-07-18 0:12 UTC (permalink / raw)
Cc: emacs-devel
> On the contrary, users can make file-local variable bindings for most of
> the variables described in the Emacs Manual without knowing how to
> program. They only need to know Lisp syntax for the values they use.
That is, they need to have an awareness of programming Lisp.
That statement is misleading because it would imply a level of
knowledge far beyond what these people really need to know. All they
need to know is how to write the values they want to use.
As I wrote, calling them ?local variables? does not say to me that they are
buffer-local, because there exist at least three distinct types of local
variables in the editor--four if you conceive of lexical-let as different
from let.
That is a valid point. However,
It?s only the phrase ?it automatically makes these variables local to the
buffer? (and two more like it, later in the same section) that makes the
buffer-local aspect evident.
since that phrase is just two lines later, I think the point is clear
enough now.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-16 12:32 ` Stefan Monnier
@ 2006-07-18 1:25 ` Kenichi Handa
2006-07-18 14:44 ` Stefan Monnier
2006-07-18 14:59 ` Richard Stallman
0 siblings, 2 replies; 16+ messages in thread
From: Kenichi Handa @ 2006-07-18 1:25 UTC (permalink / raw)
Cc: kehoea, emacs-devel
In article <jwvmzb9pw8q.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> AFAICT this does not do what I want: it doesn't *activate* the
>>> input method. You still need to hit C-\ to activate it.
>> Ah, excuse my misunderstanding. Looking through the source of
>> activate-input-method, as well as setting current-input-method, it calls
>> input-method-specific initialisation code, so simply setting a file-local
>> variable would seem to be impossible. You could, of course, add something
>> like the below to your init file, and specify hack-activate-input-method
>> appropriately in the files you want it to work for.
> That seems much more complex than my current solution of using
> `eval: (activate-input-method "TeX")' and adding
> (put 'activate-input-method 'safe-local-eval-function t).
Provided that a local variable specified in a file is
customizable, does :set function of it called?
If so, I think the most natural solution is to change
(defvar current-input-method ...)
to
(defcustom current-input-method ...)
and provide a proper :set function (perhaps one that calls
activate-input-method). Then a user can have this in his
file:
;; Local Variables:
;; current-input-method: "INPUT_METHOD_NAME"
;; End:
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-18 1:25 ` Kenichi Handa
@ 2006-07-18 14:44 ` Stefan Monnier
2006-07-19 0:45 ` Kenichi Handa
2006-07-18 14:59 ` Richard Stallman
1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2006-07-18 14:44 UTC (permalink / raw)
Cc: kehoea, emacs-devel
>> That seems much more complex than my current solution of using
>> `eval: (activate-input-method "TeX")' and adding
>> (put 'activate-input-method 'safe-local-eval-function t).
> Provided that a local variable specified in a file is
> customizable, does :set function of it called?
Currently no: it just uses `set'. Using the custom setter might be an
option, but we should be careful with it: Custom's support for buffer-local
settings is mostly untested (And hence not overly reliable).
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-18 1:25 ` Kenichi Handa
2006-07-18 14:44 ` Stefan Monnier
@ 2006-07-18 14:59 ` Richard Stallman
1 sibling, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2006-07-18 14:59 UTC (permalink / raw)
Cc: kehoea, monnier, emacs-devel
Provided that a local variable specified in a file is
customizable, does :set function of it called?
No. In principle, that might be an interesting feature. But it is
not straightforward (:set functions set the default value, not the
current value which might be a local binding). Also, it is somewhat
worrisome in its implications.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Activate an input-method from file-local variables?
2006-07-18 14:44 ` Stefan Monnier
@ 2006-07-19 0:45 ` Kenichi Handa
0 siblings, 0 replies; 16+ messages in thread
From: Kenichi Handa @ 2006-07-19 0:45 UTC (permalink / raw)
Cc: kehoea, emacs-devel
In article <jwv7j2b9dpw.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> That seems much more complex than my current solution of using
>>> `eval: (activate-input-method "TeX")' and adding
>>> (put 'activate-input-method 'safe-local-eval-function t).
>> Provided that a local variable specified in a file is
>> customizable, does :set function of it called?
> Currently no: it just uses `set'. Using the custom setter might be an
> option, but we should be careful with it: Custom's support for buffer-local
> settings is mostly untested (And hence not overly reliable).
Ummm, then, we must wait for that getting reliable, or
implement a code that checks the value of
current-input-method and, if necessary, calls a proper
activating function in read_char or somewhere.
Those should be after the release.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-07-19 0:45 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-15 14:38 Activate an input-method from file-local variables? Stefan Monnier
2006-07-15 14:47 ` Aidan Kehoe
2006-07-15 14:55 ` David Kastrup
2006-07-15 16:55 ` Aidan Kehoe
2006-07-16 6:25 ` Richard Stallman
2006-07-16 11:59 ` Aidan Kehoe
2006-07-17 1:41 ` Richard Stallman
2006-07-17 7:29 ` Aidan Kehoe
2006-07-18 0:12 ` Richard Stallman
2006-07-15 21:57 ` Stefan Monnier
2006-07-16 11:36 ` Aidan Kehoe
2006-07-16 12:32 ` Stefan Monnier
2006-07-18 1:25 ` Kenichi Handa
2006-07-18 14:44 ` Stefan Monnier
2006-07-19 0:45 ` Kenichi Handa
2006-07-18 14:59 ` Richard Stallman
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).