From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Moving my init.el to Org Date: Wed, 03 Sep 2014 13:48:23 +0200 Message-ID: References: <20140831103706.549dc45b@aga-netbook> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP93J-0008Uc-Vj for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 07:48:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP93D-0006Py-Q0 for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 07:48:41 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:44718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP93D-0006Ps-Jt for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 07:48:35 -0400 Received: by mail-wi0-f172.google.com with SMTP id n3so737035wiv.11 for ; Wed, 03 Sep 2014 04:48:34 -0700 (PDT) In-Reply-To: (Oleh's message of "Wed, 3 Sep 2014 13:17:00 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Oleh Cc: Org-mode mailing list --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Oleh 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 "") 'js-f5) > (define-key js-mode-map (kbd "C-") '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-fil= e) > (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 =20 > > regards, > Oleh > > =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJUBwAPAAoJENvXNx4PUvmC1swH/jrfWPqBuiwZf0Lvhax6pMKn 06ed5dgsR07cekWitaPIriWFXCFm8pOseuUq0BPoVM/FW68ei1JSPlADGyPkLW5p R3JQB75KUsROHLJlkoLoALWUeVNRoFhAphnDLXdLmJn6uvRndeBzE3SbVVDikSgu a01HTf1j8QZtMJoRbPDX8lzOtHFHTTO5M49WETuuUUM/kqmCiNIIWQisAM86jUhk yJzrev/abLpE2qZwzqlxz9NVxrCDwHg4UBgRAc9tP9fvUP+z+4pC2g3x01USFPpb 7W3k3OCEjP0yK3PfQLs+g1oxb5q3pul+9csGWQoXqIh/P+y4lowP3I2ea71cV/U= =Kars -----END PGP SIGNATURE----- --=-=-=--