unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Leo <sdl.web@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Why js2-mode in Emacs 23.2?
Date: Mon, 10 Aug 2009 12:41:58 +0200	[thread overview]
Message-ID: <E4E004A1-89AF-4470-85E8-1EAAD8C613CE@gmail.com> (raw)
In-Reply-To: <xbaiocqo6os5.fsf@cam.ac.uk>


On Aug 10, 2009, at 10:44 AM, Leo wrote:

> On 2009-08-10 01:49 +0100, Daniel Colascione wrote:
> [...]
>>> eval-after-load should not be used in emacs packages.
>>
>> Why not?
>
> On 2009-08-10 08:06 +0100, Carsten Dominik wrote:
> [...]
>>> eval-after-load should not be used in emacs packages.
>>
>> Why not?
>>
>> - Carsten
>
> I seem to recall RMS said that sometime ago. It is also documented  in
> the elisp manual:
>
> ,----[ (info "(elisp)Hooks for Loading") ]
> |    In general, well-designed Lisp programs should not use this  
> feature.
> | The clean and modular ways to interact with a Lisp library are (1)
> | examine and set the library's variables (those which are meant for
> | outside use), and (2) call the library's functions.  If you wish  
> to do
> | (1), you can do it immediately--there is no need to wait for when  
> the
> | library is loaded.  To do (2), you must load the library (preferably
> | with `require').
> |
> |    But it is OK to use `eval-after-load' in your personal
> | customizations if you don't feel they must meet the design standards
> | for programs meant for wider use.
> `----


I see.  Still, I can imagine good use cases for it.  For example,
if your package needs to do some tweaking to correctly interact with
some library, but if that library is only used by very few people.
In this case you'd want to avoid loading the library just to apply  
your tweaks.
I'd say this is a good case for using eval-after-load in a normal  
Emacs library.

Here is an example from Org-mode:

(eval-after-load "imenu"
   '(progn
      (add-hook 'imenu-after-jump-hook
	       (lambda ()
		 (if (eq major-mode 'org-mode)
		     (org-show-context 'org-goto))))))

When imenu jumps into a location in a file that is hidden by outline  
folding,
then the context of point needs to be revealed.  However, loading imenu
just to do this setup is useless for user who do use imenu at all.


- Carsten





  parent reply	other threads:[~2009-08-10 10:41 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-09 23:34 Why js2-mode in Emacs 23.2? Deniz Dogan
2009-08-09 23:38 ` Lennart Borgman
2009-08-09 23:46   ` Daniel Colascione
2009-08-09 23:50     ` Deniz Dogan
2009-08-09 23:56       ` Lennart Borgman
2009-08-09 23:56       ` Daniel Colascione
2009-08-09 23:55     ` Lennart Borgman
2009-08-09 23:58       ` Daniel Colascione
2009-08-10  0:00         ` Lennart Borgman
2009-08-10  0:06           ` Daniel Colascione
2009-08-10  0:17             ` Lennart Borgman
2009-08-10  0:46               ` Daniel Colascione
2009-08-10  0:55                 ` Lennart Borgman
2009-08-10  0:18         ` Leo
2009-08-10  0:49           ` Daniel Colascione
2009-08-10  7:06           ` Carsten Dominik
2009-08-10  8:44             ` Leo
2009-08-10  8:54               ` CHENG Gao
2009-08-10  9:26                 ` Leo
2009-08-10 10:22                   ` Richard Riley
2009-08-10 15:21                   ` eval-after-load not harmful after all (Was: Re: Why js-2mode?) Daniel Colascione
2009-08-10 17:01                     ` Drew Adams
2009-08-10 17:21                       ` eval-after-load not harmful after all Stefan Monnier
2009-08-11  0:43                       ` eval-after-load not harmful after all (Was: Re: Why js-2mode?) Stephen J. Turnbull
2009-08-11  0:46                         ` Drew Adams
2009-08-11 14:06                           ` Stephen J. Turnbull
2009-08-11 15:08                           ` eval-after-load not harmful after all Stefan Monnier
2009-08-16 21:43                             ` Leo
2009-08-17  0:34                               ` Lennart Borgman
2009-08-17 11:44                                 ` Leo
2009-08-17 11:55                                   ` Lennart Borgman
2009-08-17 12:26                                     ` Leo
2009-08-17 14:40                                       ` Lennart Borgman
2009-08-11  0:53                         ` eval-after-load not harmful after all (Was: Re: Why js-2mode?) Lennart Borgman
2009-08-11  3:06                         ` Daniel Colascione
2009-08-11  9:17                           ` Leo
2009-08-11 14:37                           ` Stephen J. Turnbull
2009-08-10 10:41               ` Carsten Dominik [this message]
2009-08-10 13:04                 ` Why js2-mode in Emacs 23.2? Leo
2009-08-10 14:55                   ` Stefan Monnier
2009-08-11  1:13                 ` Glenn Morris
2009-08-11  3:02                   ` Daniel Colascione
2009-08-11  4:28                     ` Dan Nicolaescu
2009-08-11  4:33                       ` Daniel Colascione
2009-08-11  4:39                         ` Dan Nicolaescu
2009-08-11  4:45                           ` Daniel Colascione
2009-08-11  4:37                     ` Glenn Morris
2009-08-10  2:47         ` Stefan Monnier
2009-08-10  2:55           ` Lennart Borgman
2009-08-10 13:12             ` Stefan Monnier
2009-08-10  0:32   ` Leo
2009-08-10  0:48     ` Daniel Colascione
2009-08-10  2:55       ` Stefan Monnier
2009-08-10  3:24         ` Miles Bader
2009-08-10  3:27           ` Lennart Borgman
2009-08-10  3:45             ` Daniel Colascione
2009-08-10  5:18             ` Jason Rumney
2009-08-10  5:51           ` Xah Lee
2009-08-10  6:22             ` Xah Lee
2009-08-10  6:59               ` Miles Bader
2009-08-10 11:01             ` Lennart Borgman
2009-08-10 17:35             ` "Font-lock is limited to text matching" is a myth Daniel Colascione
2009-08-10 18:04               ` Lennart Borgman
2009-08-10 20:42                 ` David Engster
2009-08-10 20:51                   ` Lennart Borgman
2009-08-10 22:06                     ` Eric M. Ludlam
2009-08-10 22:19                       ` Lennart Borgman
2009-08-11  1:50                         ` Eric M. Ludlam
2009-08-11  6:47                           ` Steve Yegge
2009-08-11  9:17                             ` Miles Bader
2009-08-11 12:13                             ` Daniel Colascione
2009-08-11 14:37                               ` Miles Bader
2009-08-11 14:49                                 ` Lennart Borgman
2009-08-11 14:57                                   ` Daniel Colascione
2009-08-11 14:53                                 ` Daniel Colascione
2009-08-11 15:08                                   ` Lennart Borgman
2009-08-11 15:36                                   ` Miles Bader
2009-08-11 15:56                                 ` Stephen J. Turnbull
2009-08-11 15:54                                   ` Lennart Borgman
2009-08-11 17:00                                     ` Stephen J. Turnbull
2009-08-11 17:19                                       ` Lennart Borgman
2009-08-11 15:57                                   ` Miles Bader
2009-08-11 17:06                                     ` Stephen J. Turnbull
2009-08-11 14:50                               ` Chong Yidong
2009-08-11 15:06                                 ` Daniel Colascione
2009-08-11 15:11                                   ` Lennart Borgman
2009-08-11 15:16                                     ` Daniel Colascione
2009-08-11 15:44                                       ` Lennart Borgman
2009-08-11 18:04                                   ` joakim
2009-08-11 18:08                                     ` Lennart Borgman
2009-08-11 19:12                                       ` joakim
2009-08-11 17:09                               ` Stefan Monnier
2009-08-11 16:04                             ` Stefan Monnier
2009-08-11 18:10                               ` Edward O'Connor
2009-08-12  1:58                               ` Steve Yegge
2009-08-12 13:48                                 ` Chong Yidong
2009-08-12 16:07                                   ` Lennart Borgman
2009-08-12 22:08                                   ` Steve Yegge
2009-08-14  1:22                                 ` Stefan Monnier
2009-08-12  2:16                               ` Eric M. Ludlam
2009-08-12  6:43                                 ` Miles Bader
2009-08-12 11:28                                   ` Xah Lee
2010-11-23 14:43                                   ` Stefan Monnier
2009-08-12 15:21                               ` asynchronous parsing (was: "Font-lock is limited to text matching" is a myth) Ted Zlatanov
2009-08-12 17:16                                 ` asynchronous parsing joakim
2009-08-12 19:39                                   ` Ted Zlatanov
2009-08-12 20:01                                     ` joakim
2009-08-13  2:51                                 ` Stefan Monnier
2009-08-13 14:51                                   ` Ted Zlatanov
2009-08-11 19:48                           ` "Font-lock is limited to text matching" is a myth Lennart Borgman
2009-08-10 18:47               ` Stefan Monnier
2009-08-10 18:55                 ` Lennart Borgman
2009-08-11  3:33                   ` Stefan Monnier
2009-08-10 14:49           ` Why js2-mode in Emacs 23.2? Stefan Monnier
2009-08-10  6:46         ` Deniz Dogan
2009-08-10 14:53           ` Stefan Monnier
2009-08-10 14:05       ` Stephen Eilert
2009-08-10 14:37         ` Lennart Borgman
2009-08-10 14:42           ` Deniz Dogan
2009-08-10 19:12           ` Stephen Eilert
2009-08-10 14:41         ` Deniz Dogan
2009-08-10 14:57           ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E4E004A1-89AF-4470-85E8-1EAAD8C613CE@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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