all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Special treatment of `term-setup-hook'
@ 2006-10-24  9:02 Juanma Barranquero
  2006-12-07  1:07 ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2006-10-24  9:02 UTC (permalink / raw)


Twice in startup.el there's this code:

 (run-hooks 'emacs-startup-hook)
 (and term-setup-hook
      (run-hooks 'term-setup-hook))

What is so special in `term-setup-hook' that precludes simply doing

 (run-hooks 'emacs-startup-hook)
 (run-hooks 'term-setup-hook)

?

                    /L/e/k/t/u

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

* Re: Special treatment of `term-setup-hook'
  2006-10-24  9:02 Special treatment of `term-setup-hook' Juanma Barranquero
@ 2006-12-07  1:07 ` Juanma Barranquero
  2006-12-07  4:22   ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2006-12-07  1:07 UTC (permalink / raw)


On 10/24/06, Juanma Barranquero <lekktu@gmail.com> wrote:

> What is so special in `term-setup-hook' that precludes simply doing
>
>  (run-hooks 'emacs-startup-hook)
>  (run-hooks 'term-setup-hook)

Will someone object to this patch?

                    /L/e/k/t/u


Index: lisp/startup.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/startup.el,v
retrieving revision 1.422
diff -u -2 -r1.422 startup.el
--- lisp/startup.el	28 Nov 2006 16:46:33 -0000	1.422
+++ lisp/startup.el	7 Dec 2006 00:59:01 -0000
@@ -431,6 +431,5 @@
 	(unless inhibit-startup-hooks
 	  (run-hooks 'emacs-startup-hook)
-	  (and term-setup-hook
-	       (run-hooks 'term-setup-hook)))
+	  (run-hooks 'term-setup-hook))

 	;; Don't do this if we failed to create the initial frame,
@@ -1916,9 +1915,8 @@

     ;; If there are no switches to process, we might as well
-    ;; run this hook now, and there may be some need to do it
+    ;; run these hooks now, and there may be some need to do it
     ;; before doing any output.
     (run-hooks 'emacs-startup-hook)
-    (and term-setup-hook
-	 (run-hooks 'term-setup-hook))
+    (run-hooks 'term-setup-hook)
     (setq inhibit-startup-hooks t)

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

* Re: Special treatment of `term-setup-hook'
  2006-12-07  1:07 ` Juanma Barranquero
@ 2006-12-07  4:22   ` Eli Zaretskii
  2006-12-07 15:58     ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2006-12-07  4:22 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Thu, 7 Dec 2006 02:07:24 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> 
> On 10/24/06, Juanma Barranquero <lekktu@gmail.com> wrote:
> 
> > What is so special in `term-setup-hook' that precludes simply doing
> >
> >  (run-hooks 'emacs-startup-hook)
> >  (run-hooks 'term-setup-hook)
> 
> Will someone object to this patch?

I would.  This is a delicate mechanism, and now is not the time to
change it.  (I understand the problem is not fatal, but if I'm wrong,
please correct me.)

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

* Re: Special treatment of `term-setup-hook'
  2006-12-07  4:22   ` Eli Zaretskii
@ 2006-12-07 15:58     ` Juanma Barranquero
  2006-12-07 16:11       ` Kim F. Storm
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2006-12-07 15:58 UTC (permalink / raw)
  Cc: emacs-devel

On 12/7/06, Eli Zaretskii <eliz@gnu.org> wrote:

> I would.

Fair enough.

> This is a delicate mechanism, and now is not the time to
> change it.

OK, but then I would really like someone to answer my original question:

How can

  (and x
       (run-hooks 'x))

and

  (run-hooks 'x)

be different (other than return value, which isn't used in this case)?

> I understand the problem is not fatal

No, of course not.

                    /L/e/k/t/u

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

* Re: Special treatment of `term-setup-hook'
  2006-12-07 15:58     ` Juanma Barranquero
@ 2006-12-07 16:11       ` Kim F. Storm
  2006-12-07 16:31         ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Kim F. Storm @ 2006-12-07 16:11 UTC (permalink / raw)
  Cc: Eli Zaretskii, emacs-devel

"Juanma Barranquero" <lekktu@gmail.com> writes:

> On 12/7/06, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> I would.
>
> Fair enough.
>
>> This is a delicate mechanism, and now is not the time to
>> change it.
>
> OK, but then I would really like someone to answer my original question:
>
> How can
>
>  (and x
>       (run-hooks 'x))
>
> and
>
>  (run-hooks 'x)
>
> be different (other than return value, which isn't used in this case)?

They are different if x is not bound.

But for the case at hand, I don't see the difference either...

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Special treatment of `term-setup-hook'
  2006-12-07 16:11       ` Kim F. Storm
@ 2006-12-07 16:31         ` Juanma Barranquero
  0 siblings, 0 replies; 6+ messages in thread
From: Juanma Barranquero @ 2006-12-07 16:31 UTC (permalink / raw)
  Cc: emacs-devel

On 12/7/06, Kim F. Storm <storm@cua.dk> wrote:

> They are different if x is not bound.

Well, of course, if you don't mind getting and error :) I expect
people would write either:

 (if (boundp 'x)
      (run-hooks 'x)
    ; error or whatever

or

  (and (boundp 'x)
       x
       (run-hooks 'x))

or, nowadays:

  (when (bound-and-true-p 'x)
     (run-hooks 'x))

which seem clearer for that specific purpose.

> But for the case at hand, I don't see the difference either...

That's what puzzles me.  I don't understand why someone would add (and
term-setup-hook (run-hooks 'term-setup-hook)) instead of the simpler
alternative. But someone did, and I suppose he had a good reason...

That's all idle thinking, of course.

                    /L/e/k/t/u

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

end of thread, other threads:[~2006-12-07 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-24  9:02 Special treatment of `term-setup-hook' Juanma Barranquero
2006-12-07  1:07 ` Juanma Barranquero
2006-12-07  4:22   ` Eli Zaretskii
2006-12-07 15:58     ` Juanma Barranquero
2006-12-07 16:11       ` Kim F. Storm
2006-12-07 16:31         ` Juanma Barranquero

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.