bug-global
[Top][All Lists]
Advanced

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

RE: Keybinding Patch gtags.el


From: Stan Moore
Subject: RE: Keybinding Patch gtags.el
Date: Tue, 10 Sep 2013 18:13:35 -0400

 From: Shigio YAMAGUCHI [mailto:address@hidden
> Sent: Monday, September 09, 2013 10:27 PM
> To: Stan Moore
> Cc: address@hidden
> Subject: Re: Keybinding Patch gtags.el
> 
> On Thu, 5 Sep 2013 19:52:20 -0400
> "Stan Moore" <address@hidden> wrote:
> 
> Sorry for may late reply.
> 
> > ;; (add-hook 'c-mode-hook
> > ;;    '(lambda ()
> > ;;       (setq gtags-suggested-key-mapping t)
> > ;;       (gtags-mode 1)
> > ;; ))
> 
> Though you are going to invoke 'setq' in a hook, it seems that it doesn't
> follow the custom of emacs.
> If you invoke the code ('setq ...') statically out of the hook, is there
any
> problem?

The crux of the problem is timing. The variable must be set before the mode
is active so you could set it anywhere prior to activating the mode. Lately
I've been moving things into hooks to accommodate the package system. With
packages, they aren't on the load path until AFTER .emacs is processed so
autoloads can't work. I suppose there are options but I've been putting
things into hooks that run after init; and in several I need to setup
configuration variable status. 

In this case my personal preference was to get ahead of the curve and put
the whole gtags setup in the hook. In the future, if gtags is added to the
load path late I won't even notice because the c-mode hooks will always come
after the "system" init is finished. The packages almost make "system" init
a two stage process so this allows for that possibility and doesn’t have any
real side effects of it is relatively harmless. 

At the moment I'm using a local copy of gtags but if a newer version was to
show up in packages I would probably just add the package and that would
break gtags if the variable wasn't set after the "system" init and before
the mode is activated. The first time I had that happen with a different
package it was nontrivial to figure out what was happening. When I found out
that packages are added to the load path after .emacs it was a surprise. The
packages system is causing many to dig through crufty old parts of .emacs
and in the long run that's probably a good thing. 

The above notwithstanding, I wouldn't have any problem if the documentation
examples set the variable globally and loaded the mode in the typical
fashion. The keybindings work fine as long as the variable is set before the
mode is activated.

Stan
 





reply via email to

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