unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* autoload
@ 2011-01-24  0:40 Perry Smith
  2011-01-24 12:38 ` autoload Oleksandr Gavenko
  0 siblings, 1 reply; 11+ messages in thread
From: Perry Smith @ 2011-01-24  0:40 UTC (permalink / raw)
  To: help-gnu-emacs

I have a .emacs.d directory with various elisp files I've either written myself over the years or pulled down from the net.

I just spent the past few hours constructing various scripts to automatically byte compile the new files and also create a myautoloads.el file that I load at startup.  It just seems to me that I must be recreating the wheel.

What do others do?

Thanks,
Perry




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

* Re: autoload
       [not found] <mailman.6.1295832280.28254.help-gnu-emacs@gnu.org>
@ 2011-01-24  4:09 ` Stefan Monnier
  2011-01-24  4:49   ` autoload Perry Smith
       [not found]   ` <mailman.22.1295844560.28254.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2011-01-24  4:09 UTC (permalink / raw)
  To: help-gnu-emacs

> I just spent the past few hours constructing various scripts to
> automatically byte compile the new files

As in byte-recompile-directory?

> and also create a myautoloads.el file that I load at startup.

As in update-directory-autoloads?


        Stefan


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

* Re: autoload
  2011-01-24  4:09 ` autoload Stefan Monnier
@ 2011-01-24  4:49   ` Perry Smith
  2011-01-24  6:51     ` autoload e20100633
                       ` (2 more replies)
       [not found]   ` <mailman.22.1295844560.28254.help-gnu-emacs@gnu.org>
  1 sibling, 3 replies; 11+ messages in thread
From: Perry Smith @ 2011-01-24  4:49 UTC (permalink / raw)
  To: help-gnu-emacs


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




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

* Re: autoload
  2011-01-24  4:49   ` autoload Perry Smith
@ 2011-01-24  6:51     ` e20100633
  2011-01-24 16:34       ` autoload Perry Smith
  2011-01-24  7:41     ` autoload Thien-Thi Nguyen
       [not found]     ` <mailman.5.1295855209.17297.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 11+ messages in thread
From: e20100633 @ 2011-01-24  6:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

On Jan 24, 2011, at 5:49 AM, Perry Smith wrote:

> I coupled it with a script:
>
> [snip: #!/bin/sh]
>

Oh god, I was searching for that all day long yesterday. I can't
believe there's nothing in emacs since all those years to byte-
compile a whole directory for the first time -- yeah +1 batch-byte-
recompile-directory is for *recompile*.

Thank you very much for this.

Regards,

~ #ID: e20100633 <e20100633()inbox!lv> #TTY: 9-8M 4554
~ TYPE 1707-A3 S/N L3-M2812 SLACKWARE 13.0 RLU #527034
------------------------------------------------{,_,">
They say that an incubus whose initial is F- sometimes
makes women feel sensitive.          --- Play NetHack!



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

* Re: autoload
  2011-01-24  4:49   ` autoload Perry Smith
  2011-01-24  6:51     ` autoload e20100633
@ 2011-01-24  7:41     ` Thien-Thi Nguyen
       [not found]     ` <mailman.5.1295855209.17297.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 11+ messages in thread
From: Thien-Thi Nguyen @ 2011-01-24  7:41 UTC (permalink / raw)
  To: help-gnu-emacs

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

() Perry Smith <pedzsan@gmail.com>
() Sun, 23 Jan 2011 22:49:13 -0600

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

You are not alone.... (cue eery music here :-D).

Below is do/update-autoload-file.el from ttn-pers-elisp
(nb: copyright out of date; recent changes have been made,
but the package itself has not been released yet).
The cruft is from Emacs 19 dayz -- feel free to ignore.


[-- Attachment #2: update-autoload-file.el --]
[-- Type: application/emacs-lisp, Size: 2080 bytes --]

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

* Re: autoload
  2011-01-24  0:40 autoload Perry Smith
@ 2011-01-24 12:38 ` Oleksandr Gavenko
  0 siblings, 0 replies; 11+ messages in thread
From: Oleksandr Gavenko @ 2011-01-24 12:38 UTC (permalink / raw)
  To: help-gnu-emacs

On 24.01.2011 2:40, Perry Smith wrote:
> I have a .emacs.d directory with various elisp files I've either written myself over the years or pulled down from the net.
>
> I just spent the past few hours constructing various scripts to automatically byte compile the new files and also create a myautoloads.el file that I load at startup.  It just seems to me that I must be recreating the wheel.
>
> What do others do?
>
I store all my *.el files under DVCS (Mercurial) and install it from 
Makefile.

 From '.emacs':

(defvar my-lisp-dir
   (expand-file-name "~/.emacs.d/my-lisp")
   "Here live my lisp packages.")
(add-to-list 'load-path my-lisp-dir t)

(defvar my-autoload (concat my-lisp-dir "/autoload-my.el")
   "Path to autoload for mode files.")

(if (file-exists-p my-autoload)
     (load my-autoload))

 From 'Makefile':

FILES_MODE_EL := $(wildcard *-mode.el)

.PHONY: install
install: .emacs $(FILES_MODE_EL)
	cp .emacs $(HOME)/.emacs
	rm -f -r $(HOME)/.emacs.d/my-lisp
	mkdir -p $(HOME)/.emacs.d/my-lisp
	for file in $(FILES_MODE_EL); do \
		cp -f $$file $(HOME)/.emacs.d/my-lisp; \
	done
	$(EMACS) --batch \
		--eval='(let ( (generated-autoload-file 
"~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads 
"~/.emacs.d/my-lisp") )'

Look at last Makefile command - it generate autoload file automatically.
Compilation I don't use as my *-mode.el files are very short.




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

* Re: autoload
  2011-01-24  6:51     ` autoload e20100633
@ 2011-01-24 16:34       ` Perry Smith
  0 siblings, 0 replies; 11+ messages in thread
From: Perry Smith @ 2011-01-24 16:34 UTC (permalink / raw)
  To: e20100633; +Cc: help-gnu-emacs


On Jan 24, 2011, at 12:51 AM, e20100633 wrote:

> Hello,
> 
> On Jan 24, 2011, at 5:49 AM, Perry Smith wrote:
> 
>> I coupled it with a script:
>> 
>> [snip: #!/bin/sh]
>> 
> 
> Oh god, I was searching for that all day long yesterday. I can't
> believe there's nothing in emacs since all those years to byte-
> compile a whole directory for the first time -- yeah +1 batch-byte-
> recompile-directory is for *recompile*.
> 
> Thank you very much for this.

My git repository for my .emacs.d directory is here: https://github.com/pedz/emacs-lisp

It is very disorganized but folks are welcome to poke around it and take what is useful to them.

Perry




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

* Re: autoload
       [not found]   ` <mailman.22.1295844560.28254.help-gnu-emacs@gnu.org>
@ 2011-01-24 17:28     ` Stefan Monnier
  2011-01-24 19:42       ` autoload Perry Smith
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2011-01-24 17:28 UTC (permalink / raw)
  To: help-gnu-emacs

>>> 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))

IIRC you can use

    --eval "(batch-byte-recompile-directory 0)"

so you don't have to define a new function.

>>> 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:

Right, and there as well you can use

  --eval "(setq generated-autoload-file \"`pwd`/myloaddefs.el\")"

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

Good point.


        Stefan


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

* Re: autoload
  2011-01-24 17:28     ` autoload Stefan Monnier
@ 2011-01-24 19:42       ` Perry Smith
  0 siblings, 0 replies; 11+ messages in thread
From: Perry Smith @ 2011-01-24 19:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


On Jan 24, 2011, at 11:28 AM, 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))
> 
> IIRC you can use
> 
>    --eval "(batch-byte-recompile-directory 0)"
> 
> so you don't have to define a new function.

Ahh... I saw that on another post on this thread but I never
thought about it.  I figured there must be a way to do it, otherwise,
why would it take an argument?

Thanks... now I have another tool in my bag.

Perry




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

* Re: autoload
       [not found]     ` <mailman.5.1295855209.17297.help-gnu-emacs@gnu.org>
@ 2011-01-28  4:11       ` rusi
  2011-01-28 10:10         ` autoload Thien-Thi Nguyen
  0 siblings, 1 reply; 11+ messages in thread
From: rusi @ 2011-01-28  4:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 24, 12:41 pm, Thien-Thi Nguyen <t...@gnuvola.org> wrote:
> () Perry Smith <pedz...@gmail.com>
> () Sun, 23 Jan 2011 22:49:13 -0600
>
>    Its not a lot of work but it just seemed
>    like I can't be the only person doing this.
>
> You are not alone.... (cue eery music here :-D).
>
> Below is do/update-autoload-file.el from ttn-pers-elisp
> (nb: copyright out of date; recent changes have been made,
> but the package itself has not been released yet).
> The cruft is from Emacs 19 dayz -- feel free to ignore.

Hi Thien-Thi

How do you use this?



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

* Re: autoload
  2011-01-28  4:11       ` autoload rusi
@ 2011-01-28 10:10         ` Thien-Thi Nguyen
  0 siblings, 0 replies; 11+ messages in thread
From: Thien-Thi Nguyen @ 2011-01-28 10:10 UTC (permalink / raw)
  To: help-gnu-emacs

() rusi <rustompmody@gmail.com>
() Thu, 27 Jan 2011 20:11:15 -0800 (PST)

   On Jan 24, 12:41 pm, Thien-Thi Nguyen <t...@gnuvola.org> wrote:
   > do/update-autoload-file.el from ttn-pers-elisp

   How do you use this?

You can grab the latest release tarball from:
http://www.gnuvola.org/software/personal-elisp/

See file Makefile.in, specifically targets ‘autoload-file’ and ‘dist’.
(In the not yet released source, ‘all’ also depends on ‘autoload-file’,
which is part of the reason it's not yet released -- i've been using it
quite comfortably in situ.)



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

end of thread, other threads:[~2011-01-28 10:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.6.1295832280.28254.help-gnu-emacs@gnu.org>
2011-01-24  4:09 ` autoload Stefan Monnier
2011-01-24  4:49   ` autoload Perry Smith
2011-01-24  6:51     ` autoload e20100633
2011-01-24 16:34       ` autoload Perry Smith
2011-01-24  7:41     ` autoload Thien-Thi Nguyen
     [not found]     ` <mailman.5.1295855209.17297.help-gnu-emacs@gnu.org>
2011-01-28  4:11       ` autoload rusi
2011-01-28 10:10         ` autoload Thien-Thi Nguyen
     [not found]   ` <mailman.22.1295844560.28254.help-gnu-emacs@gnu.org>
2011-01-24 17:28     ` autoload Stefan Monnier
2011-01-24 19:42       ` autoload Perry Smith
2011-01-24  0:40 autoload Perry Smith
2011-01-24 12:38 ` autoload Oleksandr Gavenko

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).