Search code examples
emacsbatch-processing

How to run emacs in batch mode and have it automatically follow GIT Repository Links


I am trying to run Emacs on Verilog source file that are Git Controlled. I also set emacs to follow symbolic links. But despite that I get this -

    emacs -batch real_wrap.sv -f verilog-auto -f save-buffer -l verilog-mode  --eval="(set vc-follow-symlinks t)"
    Loading /usr/share/emacs/site-lisp/site-start.d/auctex.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/gnuplot-init.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/po-mode-init.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/preview-latex.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...
    Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...
    Loading vc-git...
    Symbolic link to Git-controlled source file; follow link? (yes or no) 

Emacs is still getting into interactive mode and asking whether (or not) to follow link. Any thoughts on how not to have Emacs do this ? The version of Emacs is 23.1.1


Solution

  • As @Serge has pointed out in the comments, your mistake is using set instead of setq.

    The default value of vc-follow-symlinks is the symbol ask. Therefore (set vc-follow-symlinks t) is equivalent to (setq ask t) and has no effect at all on the value of vc-follow-symlinks, but rather sets a value for a variable named ask.

    The "q" in setq means "quoted", as its symbol argument is not evaluated, whereas the argument to set does get evaluated. You could manually quote the argument with (set 'vc-follow-symlinks t) but in practice you would invariably use setq.