emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Moving my init.el to Org


From: Rainer M Krug
Subject: Re: [O] Moving my init.el to Org
Date: Wed, 03 Sep 2014 13:48:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin)

Oleh <address@hidden> writes:

>>> I'm using a one .el file per mode approach, with around 4000 lines
>>> split into 40 files.
>>>
>>> This approach simplifies things a lot: for instance I haven't touched
>>> Javascript in ages, but all my customizations for it are sitting in
>>> javascript.el without getting in the way of the stuff that I'm using
>>> now. They aren't even loaded unless I open a js file.
>>
>> Interesting - is your configuration online, so that one could take a
>> look at it? I did not find them on your github page?
>
> It's not online since it's a hassle to put it up.

No problem.

>
>> Or how do you do it, that the e.g. javascript.el is only loaded when a
>> js file is opened? Because this is exactly what I would like to have.
>
> It's a three-part setup that goes like this.
> In hooks.el that's loaded unconditionally:
>
>     ...
>     (add-hook 'java-mode-hook 'oleh-java-hook)
>     (add-hook 'tuareg-mode-hook 'oleh-tuareg-hook)
>     (add-hook 'js-mode-hook 'oleh-javascript-hook)
>     (add-hook 'markdown-mode-hook 'oleh-markdown-hook)
>     ...
>
> In modes/javascript.el that's not loaded:
>
>     ;;;###autoload
>     (defun oleh-javascript-hook ()
>       (smart-insert-operator-hook)
>       (moz-minor-mode 1)
>       (define-key js-mode-map (kbd "<f5>") 'js-f5)
>       (define-key js-mode-map (kbd "C-<f5>") 'js-C-f5)
>       ...
>       )
>
> And this function generates the autoloads when a new file is added:
>
>     ;;;###autoload
>     (defun update-all-autoloads ()
>       (interactive)
>       (let ((generated-autoload-file (concat emacs.d "loaddefs.el")))
>         (when (not (file-exists-p generated-autoload-file))
>           (with-current-buffer (find-file-noselect generated-autoload-file)
>             (insert ";;") ;; create the file with non-zero size to
> appease autoload
>             (save-buffer)))
>         (mapcar #'update-directory-autoloads
>                 '("" "oleh" "oleh/modes" "matlab-emacs"))))
>
> The file loaddefs.el is loaded unconditionally as well.  So when a js
> file is opened, `js-mode-hook` is called and the autoloaded
> `oleh-javascript-hook` is called, making sure that
> "oleh/modes/javascript.el" is loaded.

Thanks - looks like an interesting approach which avoids having to use
use-package or req-package.

Thanks a lot for the info,

Rainer
 

>
> regards,
> Oleh
>
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

Attachment: pgpsjPCj1ktWA.pgp
Description: PGP signature


reply via email to

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