unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lektu@terra.es>
Cc: emacs-devel@gnu.org
Subject: Re: occur-mode-hook run too early to be useful
Date: Wed, 28 Aug 2002 17:06:20 +0200	[thread overview]
Message-ID: <20020828164804.A71C.LEKTU@terra.es> (raw)
In-Reply-To: <200208281430.g7SEU5Z04025@rum.cs.yale.edu>

On Wed, 28 Aug 2002 10:30:05 -0400, "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> wrote:

> That would be wrong.  The hook should be run at the end of the major mode's
> function.

Yes, sure. That's the normal way and that's why I asked.

But in this case things aren't that clear, as the distinction between
code in occur-mode and code in occur-1 seems rather arbitrary:

 1. occur-mode is only called from occur-1
 2. occur-mode is called unconditionally
 3. occur-1 is the engine to all the interactive occur functions
 4. M-x occur-mode in a non-occur buffer is meaningless
 5. occur-mode-hook now serves almost no practical purpose

> Another way would be to call `occur-mode' later (which would
> require the occur-revert-arguments variable to be made permanent-local)

That just does credence to my idea that occur-mode is but an ugly
artifact.

> or to provide another hook (like `occur-hook').

Yeah, of course. But it feels a bit silly to have two hooks for almost
nothing. In fact, if I add an `occur-hook' I could move the call to
`turn-on-font-lock' to it and `occur-mode-hook' would be useless... Not
to mention that its docstring just says "Hooks run when `occur' is called.",
so it's difficult, from a user's POV, to see what purpose it serves that
occur-hook does not.

So I think that's what I'm going to do: changing occur-mode-hook to just
occur-hook and executing it at the end of occur-1.

Thanks for your comments,

                                                           /L/e/k/t/u

  reply	other threads:[~2002-08-28 15:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-28  9:16 occur-mode-hook run too early to be useful Juanma Barranquero
2002-08-28 14:30 ` Stefan Monnier
2002-08-28 15:06   ` Juanma Barranquero [this message]
2002-08-28 15:11     ` Stefan Monnier
2002-08-28 15:25       ` Juanma Barranquero
2002-08-28 15:30         ` Juanma Barranquero
2002-08-29 17:50       ` Richard Stallman
2002-08-30  2:14         ` Juanma Barranquero
2002-08-28 15:29     ` Kai Großjohann
2002-08-28 15:32       ` Stefan Monnier
2002-08-28 15:39         ` Kai Großjohann

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=20020828164804.A71C.LEKTU@terra.es \
    --to=lektu@terra.es \
    --cc=emacs-devel@gnu.org \
    /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).