* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
@ 2015-06-01 15:58 Michael Heerdegen
2015-06-02 15:42 ` Stefan Monnier
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Michael Heerdegen @ 2015-06-01 15:58 UTC (permalink / raw)
To: 20709
Hello,
the doc of `auto-mode-alist' doesn't say that the mode functions
specified must be named functions. That's good IMO, since using
anonymous functions in the alist e.g. while let-binding it can sometimes
be useful.
But this is buggy. Try this:
--8<---------------cut here---------------start------------->8---
;; -*- lexical-binding: t -*-
(setq auto-mode-alist
`((".*" . ,(lambda ()
(emacs-lisp-mode)
'and-do-something-in-addition))))
--8<---------------cut here---------------end--------------->8---
Save it in a file, and load it (uncompiled) so that
auto-mode-alist
=> ((".*" closure (t) nil (emacs-lisp-mode) (quote and-do-something-in-addition)))
Now open any file. You get:
File mode specification error: (void-function closure)
The problem is these lines in the defun of `set-auto-mode' starting from
line 2871 in files.el:
--8<---------------cut here---------------start------------->8---
(if (and mode
(consp mode)
(cadr mode))
(setq mode (car mode)
...
--8<---------------cut here---------------end--------------->8---
i.e., the value in the alist pair is not tested whether it is a
function, and the (REGEXP FUNCTION NON-NIL) case is assumed, which is
wrong.
Thanks,
Michael.
In GNU Emacs 25.0.50.4 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
of 2015-05-30 on drachen
Windowing system distributor `The X.Org Foundation', version 11.0.11701000
System Description: Debian GNU/Linux testing (stretch)
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2015-06-01 15:58 bug#20709: 25.0.50; anonymous functions in `auto-mode-alist' Michael Heerdegen
@ 2015-06-02 15:42 ` Stefan Monnier
2015-06-02 16:18 ` Michael Heerdegen
2019-09-29 23:32 ` Stefan Kangas
2022-01-24 14:05 ` Lars Ingebrigtsen
2 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2015-06-02 15:42 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20709
> File mode specification error: (void-function closure)
Plain bug, yes. Please add a (not (functionp mode)) test in there.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2015-06-02 15:42 ` Stefan Monnier
@ 2015-06-02 16:18 ` Michael Heerdegen
2015-06-02 18:13 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2015-06-02 16:18 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 20709
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> > File mode specification error: (void-function closure)
>
> Plain bug, yes. Please add a (not (functionp mode)) test in there.
Should I do it? I have the rights now, but it'll be my first commit to
the emacs repo, so I'll have to read some stuff before to make sure I
make a commit confirming to the standards.
You don't need to answer, just expect a short delay.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2015-06-02 16:18 ` Michael Heerdegen
@ 2015-06-02 18:13 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2015-06-02 18:13 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20709
>> > File mode specification error: (void-function closure)
>> Plain bug, yes. Please add a (not (functionp mode)) test in there.
> Should I do it?
Sure.
> I have the rights now, but it'll be my first commit to
> the emacs repo, so I'll have to read some stuff before to make sure I
> make a commit confirming to the standards.
> You don't need to answer, just expect a short delay.
No hurry,
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2015-06-01 15:58 bug#20709: 25.0.50; anonymous functions in `auto-mode-alist' Michael Heerdegen
2015-06-02 15:42 ` Stefan Monnier
@ 2019-09-29 23:32 ` Stefan Kangas
2019-09-30 4:39 ` Michael Heerdegen
2022-01-24 14:05 ` Lars Ingebrigtsen
2 siblings, 1 reply; 8+ messages in thread
From: Stefan Kangas @ 2019-09-29 23:32 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20709, Stefan Monnier
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> > File mode specification error: (void-function closure)
>>
>> Plain bug, yes. Please add a (not (functionp mode)) test in there.
>
> Should I do it? I have the rights now, but it'll be my first commit to
> the emacs repo, so I'll have to read some stuff before to make sure I
> make a commit confirming to the standards.
>
> You don't need to answer, just expect a short delay.
Hi Michael,
Did you ever get around to fixing this?
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2019-09-29 23:32 ` Stefan Kangas
@ 2019-09-30 4:39 ` Michael Heerdegen
2019-11-07 0:24 ` Stefan Kangas
0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2019-09-30 4:39 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 20709, Stefan Monnier
Stefan Kangas <stefan@marxist.se> writes:
> Did you ever get around to fixing this?
I don't recall - probably not. I will be absent for three days, I'll
have a look when I'm back.
Regards,
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2019-09-30 4:39 ` Michael Heerdegen
@ 2019-11-07 0:24 ` Stefan Kangas
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Kangas @ 2019-11-07 0:24 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20709, Stefan Monnier
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Stefan Kangas <stefan@marxist.se> writes:
>
>> Did you ever get around to fixing this?
>
> I don't recall - probably not. I will be absent for three days, I'll
> have a look when I'm back.
Just a reminder to please take a look at this when you find some time.
Thanks in advance.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#20709: 25.0.50; anonymous functions in `auto-mode-alist'
2015-06-01 15:58 bug#20709: 25.0.50; anonymous functions in `auto-mode-alist' Michael Heerdegen
2015-06-02 15:42 ` Stefan Monnier
2019-09-29 23:32 ` Stefan Kangas
@ 2022-01-24 14:05 ` Lars Ingebrigtsen
2 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-24 14:05 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 20709
Michael Heerdegen <michael_heerdegen@web.de> writes:
> The problem is these lines in the defun of `set-auto-mode' starting from
> line 2871 in files.el:
>
> (if (and mode
> (consp mode)
> (cadr mode))
> (setq mode (car mode)
> ...
>
> i.e., the value in the alist pair is not tested whether it is a
> function, and the (REGEXP FUNCTION NON-NIL) case is assumed, which is
> wrong.
I've now fixed this in Emacs 29.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-24 14:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-01 15:58 bug#20709: 25.0.50; anonymous functions in `auto-mode-alist' Michael Heerdegen
2015-06-02 15:42 ` Stefan Monnier
2015-06-02 16:18 ` Michael Heerdegen
2015-06-02 18:13 ` Stefan Monnier
2019-09-29 23:32 ` Stefan Kangas
2019-09-30 4:39 ` Michael Heerdegen
2019-11-07 0:24 ` Stefan Kangas
2022-01-24 14:05 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.