GNU bug report logs - #41682
makefile-gmake-mode does not trigger "eval-after-load"'s hooks

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <hi-angel <at> yandex.ru>

Date: Wed, 3 Jun 2020 08:20:02 UTC

Severity: normal

Tags: notabug

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41682 in the body.
You can then email your comments to 41682 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Wed, 03 Jun 2020 08:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Konstantin Kharlamov <hi-angel <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Jun 2020 08:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: makefile-gmake-mode does not trigger "eval-after-load"'s hooks
Date: Wed, 03 Jun 2020 11:19:01 +0300
Functions added with (eval-after-load 'makefile-gmake-mode …) do not
trigger when the mode is enabled

# Steps to reproduce:

1. Run: emacs -Q --eval '(eval-after-load 'makefile-gmake-mode '(save-
buffers-kill-emacs))'
2. In Emacs window opened execute: M-x makefile-gmake-mode

## Expected

Emacs quits (because the save-buffers-kill-emacs gets executed)

## Actual

Mode gets enabled, but nothing happens otherwise.

# Version

GNU Emacs 27.0.50 (build 15, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.17.3) of 2020-06-01





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Wed, 03 Jun 2020 08:24:02 GMT) Full text and rfc822 format available.

Message #8 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: 41682 <at> debbugs.gnu.org
Date: Wed, 03 Jun 2020 11:23:01 +0300
Sorry, a typo, this line:

> 1. Run: emacs -Q --eval '(eval-after-load 'makefile-gmake-mode
'(save-buffers-kill-emacs))'

Should be:

1. emacs -Q --eval "(eval-after-load 'makefile-gmake-mode '(save-
buffers-kill-emacs))"





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Wed, 03 Jun 2020 10:22:01 GMT) Full text and rfc822 format available.

Message #11 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Cc: 41682 <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Wed, 03 Jun 2020 11:21:10 +0100
tags 41682 + notabug
quit

Konstantin Kharlamov <hi-angel <at> 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




Added tag(s) notabug. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Wed, 03 Jun 2020 10:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Wed, 03 Jun 2020 10:26:02 GMT) Full text and rfc822 format available.

Message #16 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 41682 <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Wed, 03 Jun 2020 13:25:01 +0300
On Wed, 2020-06-03 at 11:21 +0100, Basil L. Contovounesios wrote:
> tags 41682 + notabug
> quit
> 
> Konstantin Kharlamov <hi-angel <at> 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?


Thank you for through explanation! Sure, this bug can be closed.





Reply sent to "Basil L. Contovounesios" <contovob <at> tcd.ie>:
You have taken responsibility. (Wed, 03 Jun 2020 10:31:02 GMT) Full text and rfc822 format available.

Notification sent to Konstantin Kharlamov <hi-angel <at> yandex.ru>:
bug acknowledged by developer. (Wed, 03 Jun 2020 10:31:02 GMT) Full text and rfc822 format available.

Message #21 received at 41682-done <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Cc: 41682-done <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Wed, 03 Jun 2020 11:30:19 +0100
Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:

> On Wed, 2020-06-03 at 11:21 +0100, Basil L. Contovounesios wrote:
>
>> Is there some other case you're trying to address, or can this bug be
>> closed?
>
> Thank you for through explanation! Sure, this bug can be closed.

Thanks for confirming, closing.

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Sat, 06 Jun 2020 21:40:01 GMT) Full text and rfc822 format available.

Message #24 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 41682 <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Sun, 07 Jun 2020 00:39:30 +0300
On Wed, 2020-06-03 at 11:21 +0100, Basil L. Contovounesios wrote:
> tags 41682 + notabug
> quit
> 
> Konstantin Kharlamov <hi-angel <at> 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?
> 

Thank you, I migrated my emacs config to use the `with-eval-after-load` 
you suggested, but stumbled upon a problem that it doesn't seem to work
with python-mode. I tried as an argument `'python`, `'python-mode`,
``python.el`, `"python"`, `"python.el"` — none of that works for me.
The code I'm trying to execute is simply:

(with-eval-after-load 'python
  '(modify-syntax-entry ?_ "w" python-mode-syntax-table))

Simply removing the "with-" makes it work. Is there anything special
about this macro I should know? 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Sat, 06 Jun 2020 21:42:01 GMT) Full text and rfc822 format available.

Message #27 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 41682 <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Sun, 07 Jun 2020 00:41:26 +0300
On Sun, 2020-06-07 at 00:39 +0300, Konstantin Kharlamov wrote:
> On Wed, 2020-06-03 at 11:21 +0100, Basil L. Contovounesios wrote:
> > tags 41682 + notabug
> > quit
> > 
> > Konstantin Kharlamov <hi-angel <at> 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?
> > 
> 
> Thank you, I migrated my emacs config to use the `with-eval-after-
> load` 
> you suggested, but stumbled upon a problem that it doesn't seem to
> work
> with python-mode. I tried as an argument `'python`, `'python-mode`,
> ``python.el`, `"python"`, `"python.el"` — none of that works for me.
> The code I'm trying to execute is simply:
> 
> (with-eval-after-load 'python
>   '(modify-syntax-entry ?_ "w" python-mode-syntax-table))
> 
> Simply removing the "with-" makes it work. Is there anything special
> about this macro I should know?

I should add, according to documentation at least one of `'python.el`
or `"python.el"` should be working.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Sat, 06 Jun 2020 22:27:01 GMT) Full text and rfc822 format available.

Message #30 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Cc: 41682 <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Sat, 06 Jun 2020 23:26:12 +0100
Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:

> Thank you, I migrated my emacs config to use the `with-eval-after-load` 
> you suggested, but stumbled upon a problem that it doesn't seem to work
> with python-mode. I tried as an argument `'python`, `'python-mode`,
> ``python.el`, `"python"`, `"python.el"` — none of that works for me.
> The code I'm trying to execute is simply:
>
> (with-eval-after-load 'python
>   '(modify-syntax-entry ?_ "w" python-mode-syntax-table))
>
> Simply removing the "with-" makes it work. Is there anything special
> about this macro I should know? 

Yes, its BODY should not be quoted:

  (with-eval-after-load 'python
    (modify-syntax-entry ?_ "w" python-mode-syntax-table))

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41682; Package emacs. (Sat, 06 Jun 2020 22:37:02 GMT) Full text and rfc822 format available.

Message #33 received at 41682 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 41682 <at> debbugs.gnu.org
Subject: Re: bug#41682: makefile-gmake-mode does not trigger
 "eval-after-load"'s hooks
Date: Sun, 07 Jun 2020 01:36:18 +0300
Thank you!

On Sat, 2020-06-06 at 23:26 +0100, Basil L. Contovounesios wrote:
> Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:
> 
> > Thank you, I migrated my emacs config to use the `with-eval-after-
> > load` 
> > you suggested, but stumbled upon a problem that it doesn't seem to
> > work
> > with python-mode. I tried as an argument `'python`, `'python-mode`,
> > ``python.el`, `"python"`, `"python.el"` — none of that works for
> > me.
> > The code I'm trying to execute is simply:
> > 
> > (with-eval-after-load 'python
> >   '(modify-syntax-entry ?_ "w" python-mode-syntax-table))
> > 
> > Simply removing the "with-" makes it work. Is there anything
> > special
> > about this macro I should know? 
> 
> Yes, its BODY should not be quoted:
> 
>   (with-eval-after-load 'python
>     (modify-syntax-entry ?_ "w" python-mode-syntax-table))






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 Jul 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.