unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Strange code in derived.el.
@ 2005-06-09 16:02 Lute Kamstra
  2005-06-09 16:14 ` Stefan Monnier
  2005-06-10 13:29 ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Lute Kamstra @ 2005-06-09 16:02 UTC (permalink / raw)


I don't understand this piece of code at the end of
define-derived-mode in lisp/emacs-lisp/derived.el:

,----
| 	 ;; Run the hooks, if any.
| 	 ;; Make the generated code work in older Emacs versions
| 	 ;; that do not yet have run-mode-hooks.
| 	 (if (fboundp 'run-mode-hooks)
| 	     (run-mode-hooks ',hook)
| 	   (run-hooks ',hook))))))
`----

Is the expansion of this define-derive-mode macro ever run in older
Emacsen?  Wouldn't delay-mode-hooks (used unconditionally) be missing
as well, then?

Shall I just delete the test?

Lute.


Index: lisp/emacs-lisp/derived.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/derived.el,v
retrieving revision 1.6
diff -c -r1.6 derived.el
*** lisp/emacs-lisp/derived.el	21 May 2005 22:35:35 -0000	1.6
--- lisp/emacs-lisp/derived.el	9 Jun 2005 15:39:48 -0000
***************
*** 235,245 ****
  	  ,@body
  	  )
  	 ;; Run the hooks, if any.
! 	 ;; Make the generated code work in older Emacs versions
! 	 ;; that do not yet have run-mode-hooks.
! 	 (if (fboundp 'run-mode-hooks)
! 	     (run-mode-hooks ',hook)
! 	   (run-hooks ',hook))))))
  
  ;; PUBLIC: find the ultimate class of a derived mode.
  
--- 235,241 ----
  	  ,@body
  	  )
  	 ;; Run the hooks, if any.
! 	 (run-mode-hooks ',hook)))))
  
  ;; PUBLIC: find the ultimate class of a derived mode.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange code in derived.el.
  2005-06-09 16:02 Strange code in derived.el Lute Kamstra
@ 2005-06-09 16:14 ` Stefan Monnier
  2005-06-10 13:29 ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2005-06-09 16:14 UTC (permalink / raw)
  Cc: emacs-devel

> I don't understand this piece of code at the end of
> define-derived-mode in lisp/emacs-lisp/derived.el:

> ,----
> | 	 ;; Run the hooks, if any.
> | 	 ;; Make the generated code work in older Emacs versions
> | 	 ;; that do not yet have run-mode-hooks.
> | 	 (if (fboundp 'run-mode-hooks)
> | 	     (run-mode-hooks ',hook)
> | 	   (run-hooks ',hook))))))
> `----

> Is the expansion of this define-derive-mode macro ever run in older
> Emacsen?

Hopefully not.  Such forward compatibility on .elc files is generally not
guaranteed.

> Wouldn't delay-mode-hooks (used unconditionally) be missing as well, then?

No: it's a macro so it'll be expanded away.

> Shall I just delete the test?

I'd say yes, but since someone went to the trouble of adding it (I didn't
write it in the original code) maybe this someone can explain why she found
it to be necessary/useful.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange code in derived.el.
  2005-06-09 16:02 Strange code in derived.el Lute Kamstra
  2005-06-09 16:14 ` Stefan Monnier
@ 2005-06-10 13:29 ` Richard Stallman
  2005-06-10 14:32   ` Lute Kamstra
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2005-06-10 13:29 UTC (permalink / raw)
  Cc: emacs-devel

    Is the expansion of this define-derive-mode macro ever run in older
    Emacsen?  Wouldn't delay-mode-hooks (used unconditionally) be missing
    as well, then?

    Shall I just delete the test?

Please leave it alone.  There is no need to change this
and there are lots of other things that need doing so we
can make a release.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange code in derived.el.
  2005-06-10 13:29 ` Richard Stallman
@ 2005-06-10 14:32   ` Lute Kamstra
  2005-06-10 16:03     ` Stefan Monnier
  2005-06-11 12:17     ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Lute Kamstra @ 2005-06-10 14:32 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     Is the expansion of this define-derive-mode macro ever run in older
>     Emacsen?  Wouldn't delay-mode-hooks (used unconditionally) be missing
>     as well, then?
>
>     Shall I just delete the test?
>
> Please leave it alone.  There is no need to change this

Ok.

> and there are lots of other things that need doing so we
> can make a release.

I know: I'm working on them.  At the moment, I am trying to fix all
major modes that don't use run-mode-hooks and all derived major modes
that don't delay the running of their parent's hooks.  To make sure I
make no mistakes I was studying the code of define-derived-mode.  When
I see code I don't understand, I feel less confident about making
changes on related things.  Maybe you could explain the rationale
behind the test so that I can take that into account when I'm fixing
the derived modes?

Lute.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange code in derived.el.
  2005-06-10 14:32   ` Lute Kamstra
@ 2005-06-10 16:03     ` Stefan Monnier
  2005-06-11  6:46       ` Lute Kamstra
  2005-06-11 12:17     ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2005-06-10 16:03 UTC (permalink / raw)
  Cc: rms, emacs-devel

> changes on related things.  Maybe you could explain the rationale
> behind the test so that I can take that into account when I'm fixing
> the derived modes?

The additional check is only relevant when compiling unbundled packages
(the bundled packages are never used with a different Emacs version).
So you shouldn't worry about it when modifying emacs/lisp/**/*.el files.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange code in derived.el.
  2005-06-10 16:03     ` Stefan Monnier
@ 2005-06-11  6:46       ` Lute Kamstra
  0 siblings, 0 replies; 7+ messages in thread
From: Lute Kamstra @ 2005-06-11  6:46 UTC (permalink / raw)
  Cc: rms, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> changes on related things.  Maybe you could explain the rationale
>> behind the test so that I can take that into account when I'm fixing
>> the derived modes?
>
> The additional check is only relevant when compiling unbundled packages
> (the bundled packages are never used with a different Emacs version).

But people compile packages with a new Emacs and then run them with an
old Emacs?  I thought we only try to support the other way around.

> So you shouldn't worry about it when modifying emacs/lisp/**/*.el files.

Ok.

Thanks,

  Lute.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange code in derived.el.
  2005-06-10 14:32   ` Lute Kamstra
  2005-06-10 16:03     ` Stefan Monnier
@ 2005-06-11 12:17     ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2005-06-11 12:17 UTC (permalink / raw)
  Cc: emacs-devel

    I know: I'm working on them.  At the moment, I am trying to fix all
    major modes that don't use run-mode-hooks and all derived major modes
    that don't delay the running of their parent's hooks.

Thank you--that is very useful.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-11 12:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09 16:02 Strange code in derived.el Lute Kamstra
2005-06-09 16:14 ` Stefan Monnier
2005-06-10 13:29 ` Richard Stallman
2005-06-10 14:32   ` Lute Kamstra
2005-06-10 16:03     ` Stefan Monnier
2005-06-11  6:46       ` Lute Kamstra
2005-06-11 12:17     ` Richard Stallman

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