help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: autoload


From: Perry Smith
Subject: Re: autoload
Date: Sun, 23 Jan 2011 22:49:13 -0600

On Jan 23, 2011, at 10:09 PM, Stefan Monnier wrote:

>> I just spent the past few hours constructing various scripts to
>> automatically byte compile the new files
> 
> As in byte-recompile-directory?

Roughtly.  but batch-byte-recompile-directory does not create the elc if it 
doesn't already exist unless you wrap it.  So I wrote:

(defun batch-byte-recompile-directory-all ()
  (batch-byte-recompile-directory 0))


> 
>> and also create a myautoloads.el file that I load at startup.
> 
> As in update-directory-autoloads?

Again... roughly but you have to wrap it so that the autoloads go to a local 
file:

(defun batch-update-my-autoloads (&optional file)
  (defvar command-line-args-left)       ;Avoid 'free variable' warning
  (let ((generated-autoload-file "~/.emacs.d/pedz/myloaddefs.el")
        (temp command-line-args-left))
    (while temp
      (update-file-autoloads (car temp))
      (setq temp (cdr temp)))
    (save-some-buffers t)))

Oh... And update-directory-autoloads doesn't walk down the tree...

Its not a lot of work but it just seemed like I can't be the only person doing 
this.

I coupled it with a script:

#!/bin/sh
#
# Script to run after doing a git pull
#
# Emacs is taken as /Applications/Emacs.app/Contents/MacOS/Emacs if it
# exists (a Mac platform), otherwise, we just use emacs.
if [[ -x /Applications/Emacs.app/Contents/MacOS/Emacs ]] ; then
    EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
else
    EMACS=emacs
fi

# First, make all the .elc files:

${EMACS} -batch -l batch-commands.el -f batch-byte-recompile-directory-all

# Now, update the myloaddefs.el file:

find . -type f -name '*.el' -print | \
    egrep -v '/\.git' | \
    xargs egrep -l '# *autoload' | \
    xargs ${EMACS} \
        -batch \
        -l batch-commands.el \
        -f batch-update-my-autoloads

# We don't want myloaddefs.el compiled because it confuses me.

rm -f pedz/myloadsdefs.elc

pedz




reply via email to

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