unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Konstantin Kharlamov <hi-angel@yandex.ru>
Cc: 41682@debbugs.gnu.org
Subject: bug#41682: makefile-gmake-mode does not trigger "eval-after-load"'s hooks
Date: Wed, 03 Jun 2020 11:21:10 +0100	[thread overview]
Message-ID: <87o8q01mcp.fsf@tcd.ie> (raw)
In-Reply-To: <7874555c5ba73c3b6b7c9c07e6bde015aa1c7fc7.camel@yandex.ru> (Konstantin Kharlamov's message of "Wed, 03 Jun 2020 11:19:01 +0300")

tags 41682 + notabug
quit

Konstantin Kharlamov <hi-angel@yandex.ru> writes:

> Functions added with (eval-after-load 'makefile-gmake-mode …) do not
> trigger when the mode is enabled

I think you've misunderstood what eval-after-load does.

'makefile-gmake-mode' is a major mode function defined in the file
make-mode.el which provides the named feature 'make-mode'.  See
(info "(elisp) Named Features") and (info "(elisp) Hooks for Loading").

https://www.gnu.org/software/emacs/manual/html_node/elisp/Named-Features.html
https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks-for-Loading.html

eval-after-load, and its newer, preferred sibling with-eval-after-load,
register some Lisp to be run when a file or named feature is or has
already been loaded.

If you want to register some Lisp to run only once, after make-mode.el
is loaded (and makefile-gmake-mode has been defined), then you should
write:

  (with-eval-after-load 'make-mode
    (foo)
    (bar))

If you want to register some Lisp to run every time makefile-gmake-mode
is enabled, then you should write:

  (add-hook 'makefile-gmake-mode-hook #'foo)

If you want to register some Lisp to run every time any make-mode.el
major mode is enabled, then you should write:

  (add-hook 'makefile-mode-hook #'foo)

Is there some other case you're trying to address, or can this bug be
closed?

-- 
Basil





  parent reply	other threads:[~2020-06-03 10:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  8:19 bug#41682: makefile-gmake-mode does not trigger "eval-after-load"'s hooks Konstantin Kharlamov
2020-06-03  8:23 ` bug#41682: Konstantin Kharlamov
2020-06-03 10:21 ` Basil L. Contovounesios [this message]
2020-06-03 10:25   ` bug#41682: makefile-gmake-mode does not trigger "eval-after-load"'s hooks Konstantin Kharlamov
2020-06-03 10:30     ` Basil L. Contovounesios
2020-06-06 21:39   ` Konstantin Kharlamov
2020-06-06 21:41     ` Konstantin Kharlamov
2020-06-06 22:26     ` Basil L. Contovounesios
2020-06-06 22:36       ` Konstantin Kharlamov

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=87o8q01mcp.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=41682@debbugs.gnu.org \
    --cc=hi-angel@yandex.ru \
    /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).