all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* beginner's question:add-hook&AUCTeX
@ 2011-08-25  5:30 Shiyuan
  2011-08-25  6:35 ` Tassilo Horn
  0 siblings, 1 reply; 5+ messages in thread
From: Shiyuan @ 2011-08-25  5:30 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

Hi,
    I want to swap the C-j and C-m key. According to the documentation,
AUCTeX will evaluate the LaTeX-mode-hook so I add the following to my
.emacs,

(add-hook 'LaTeX-mode-hook (lambda()
                 (local-set-key (kbd "C-m")
'reindent-then-newline-and-indent)))
(add-hook 'LaTeX-mode-hook (lambda()
                 (local-set-key (kbd "C-j") 'newline)))

However, it has no effect. It seems it's not evaluated at all. Any help is
appreciated.

Gu.

[-- Attachment #2: Type: text/html, Size: 542 bytes --]

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

* Re: beginner's question:add-hook&AUCTeX
  2011-08-25  5:30 beginner's question:add-hook&AUCTeX Shiyuan
@ 2011-08-25  6:35 ` Tassilo Horn
  0 siblings, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2011-08-25  6:35 UTC (permalink / raw)
  To: help-gnu-emacs

Shiyuan <gshy2014@gmail.com> writes:

Hi Shiyuan,

>     I want to swap the C-j and C-m key. According to the documentation,
> AUCTeX will evaluate the LaTeX-mode-hook so I add the following to my
> .emacs,
>
> (add-hook 'LaTeX-mode-hook (lambda()
>                  (local-set-key (kbd "C-m")
> 'reindent-then-newline-and-indent)))
> (add-hook 'LaTeX-mode-hook (lambda()
>                  (local-set-key (kbd "C-j") 'newline)))

Looks good, I'd say.

> However, it has no effect. It seems it's not evaluated at all.

Are you sure that AUCTeX is really loaded?  If it is, then the output of
C-h f latex-mode RET is:

,----[ C-h f latex-mode RET ]
| latex-mode is an alias for `TeX-latex-mode' in `tex-site.el'.
| 
| (latex-mode)
| 
| Major mode in AUCTeX for editing LaTeX files.
| See info under AUCTeX for full documentation.
| 
| [...]
`----

If AUCTeX is not loaded, then the standard emacs latex-mode (that
doesn't define/use LaTeX-mode-hook) is used producing this output:

,----[ C-h f latex-mode RET (in emacs -Q)]
| latex-mode is an interactive compiled Lisp function in `tex-mode.el'.
| 
| (latex-mode)
| 
| Parent mode: `tex-mode'.
`----

Bye,
Tassilo




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

* Re: beginner's question: add-hook& AUCTeX
  2011-08-25 19:46 Re:Re:beginner's question: add-hook& AUCTeX Shiyuan
@ 2011-08-25 19:57 ` Jambunathan K
  2011-08-26 14:53 ` Tassilo Horn
  1 sibling, 0 replies; 5+ messages in thread
From: Jambunathan K @ 2011-08-25 19:57 UTC (permalink / raw)
  To: Shiyuan; +Cc: help-gnu-emacs

Shiyuan <gshy2014@gmail.com> writes:

> Thanks, Tassilo.
> It turns out that the problem is caused by another line of my .emacs
> file,
> which I want to append the load-path,
> (setq load-path (append (list nil "~/lisp") load-path))
> if the "nil" is deleted, it works fine. But I don't understand why
> adding the current directory to load-path messes up the loading of
> AUCTeX. I don't have any lisp package s in my current directory.

Just making a guess here: 'current directory' is really a
shifting-sand. It is the directory whichever happens to be current when
the Emacs searches the load-path. Now you really have no control over
that do you.

You can have some insight in to load-path related issues by doing a 

M-x locate-library RET whatever-library RET

I haven't seen the parent thread so what I say maynot be of much
help. Atleast you will have another tool in your armour.


>
>     >>Hi Shiyuan,
>    
>     >>     I want to swap the C-j and C-m key. According to the
>     documentation,
>     >> AUCTeX will evaluate the LaTeX-mode-hook so I add the
>     following to my
>     >> .emacs,
>     >>
>     >> (add-hook 'LaTeX-mode-hook (lambda()
>     >>                  (local-set-key (kbd "C-m")
>     >> 'reindent-then-newline-and-
>     >>indent)))
>     >> (add-hook 'LaTeX-mode-hook (lambda()
>     >>                  (local-set-key (kbd "C-j") 'newline)))
>    
>     >Looks good, I'd say.
>    
>     >> However, it has no effect. It seems it's not evaluated at all.
>    
>     >Are you sure that AUCTeX is really loaded?  If it is, then the
>     output of
>     >C-h f latex-mode RET is:
>    
>     >,----[ C-h f latex-mode RET ]
>     >| latex-mode is an alias for `TeX-latex-mode' in `tex-site.el'.
>     >|
>     >| (latex-mode)
>     >|
>     >| Major mode in AUCTeX for editing LaTeX files.
>     >| See info under AUCTeX for full documentation.
>     >|
>     >| [...]
>     >`----
>    
>     >If AUCTeX is not loaded, then the standard emacs latex-mode
>     (that
>     >doesn't define/use LaTeX-mode-hook) is used producing this
>     output:
>     >
>     >,----[ C-h f latex-mode RET (in emacs -Q)]
>     >| latex-mode is an interactive compiled Lisp function in
>     `tex-mode.el'.
>     >|
>     >| (latex-mode)
>     >|
>     >| Parent mode: `tex-mode'.
>     >`----
>     >
>     >Bye,
>     >Tassilo
>
>
>

-- 



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

* Re: beginner's question: add-hook& AUCTeX
  2011-08-25 19:46 Re:Re:beginner's question: add-hook& AUCTeX Shiyuan
  2011-08-25 19:57 ` beginner's " Jambunathan K
@ 2011-08-26 14:53 ` Tassilo Horn
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2011-08-26 14:53 UTC (permalink / raw)
  To: help-gnu-emacs

Shiyuan <gshy2014@gmail.com> writes:

Hi!

> It turns out that the problem is caused by another line of my .emacs file,
> which I want to append the load-path,
> (setq load-path (append (list nil "~/lisp") load-path))
> if the "nil" is deleted, it works fine. But I don't understand why adding
> the current directory to load-path messes up the loading of AUCTeX. I don't
> have any lisp package s in my current directory.

nil in `load-path' means `default-directory' which is usually your HOME,
but might be redefined on a per-buffer basis, or maybe even bound
dynamically in some code loading lisp files.  I'd really refrain from
using nil in `load-path'.  Sounds like a can of worms to me...

Bye,
Tassilo




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

* Re: beginner's question:add-hook&AUCTeX
@ 2011-08-26 16:42 PJ Weisberg
  0 siblings, 0 replies; 5+ messages in thread
From: PJ Weisberg @ 2011-08-26 16:42 UTC (permalink / raw)
  Cc: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Friday, August 26, 2011, Tassilo Horn <tassilo@member.fsf.org> wrote:
> nil in `load-path' means `default-directory' which is usually your HOME,
> but might be redefined on a per-buffer basis, or maybe even bound
> dynamically in some code loading lisp files.  I'd really refrain from
> using nil in `load-path'.  Sounds like a can of worms to me...

It's *always* defined on a per-buffer basis.  Typically it's the directory
of the file you're editing.

-- 

-PJ

[-- Attachment #2: Type: text/html, Size: 596 bytes --]

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

end of thread, other threads:[~2011-08-26 16:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 16:42 beginner's question:add-hook&AUCTeX PJ Weisberg
  -- strict thread matches above, loose matches on Subject: below --
2011-08-25 19:46 Re:Re:beginner's question: add-hook& AUCTeX Shiyuan
2011-08-25 19:57 ` beginner's " Jambunathan K
2011-08-26 14:53 ` Tassilo Horn
2011-08-25  5:30 beginner's question:add-hook&AUCTeX Shiyuan
2011-08-25  6:35 ` Tassilo Horn

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.