🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1019

Lightbrite problem with hooks.

#1019
From: John S Cooper
Date: Mon, 22 Mar 1993 15:59
60 lines
2477 bytes
When I try to specify my own hook function for mail-setup-hook, I get an
'Error in init file' message.

My code is as follows:

(defun hack-mail-reply ()
	 "Perform some hacks to new mail messages that are replies,
and insert X-Mailer: line into the header of all outgoing messages."
	 (interactive)
	 (save-excursion
	   (mail-position-on-field "X-Mailer")
	   (if (bolp)
	       (insert "X-Mailer: "))
	   (insert "VM " vm-version " under "
		   (let ((len (if running-epoch 9 18)))
		     (substring (emacs-version) 0 len)))))

(setq mail-setup-hook 'hack-mail-reply)


I tracked this down to some code in lightbrite which attempts to
postpend another hook function to this variable:

(brite::postpend-unique-hook 'mail-setup-hook 'brite::do-highlight-on-mail)

;; Author: Daniel LaLiberte (liberte@cs.uiuc.edu).

(defun brite::postpend-unique-hook (hook-var hook-function)
  "Postpend HOOK-VAR with HOOK-FUNCTION, if it is not already an element.
hook-var's value may be a single function or a list of functions."
  (if (boundp hook-var)
      (let ((value (symbol-value hook-var)))
        (if (and (listp value) (not (eq (car value) 'lambda)))
            (and (not (memq hook-function value))
                 (set hook-var (append value (list hook-function))))
          (and (not (eq hook-function value))
               (set hook-var (append value (list hook-function))))))
    (set hook-var (list hook-function))))


This somehow seems to be causing my error message.

If I comment this line out of lightbrite:
; (brite::postpend-unique-hook 'mail-setup-hook 'brite::do-highlight-on-mail)

.. and change my .emacs to this:

(setq mail-setup-hook (list 'hack-mail-reply 'brite::do-highlight-on-mail))

all works well.

I guess the lightbrite function is broken?

Can someone please explain this?

Thanks,
--

    --- John
Technical Details
Message-ID: <JSC.93Mar22155919@saxon.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!appserv.Eng.Sun.COM!appserv!jsc

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,c168ccc6270193d4,start
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1993-03-23 05:50:24 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!appserv.Eng.Sun.COM!appserv!jsc
From: jsc@saxon.Eng.Sun.COM (John S Cooper)
Newsgroups: gnu.epoch.misc
Subject: Lightbrite problem with hooks.
Date: 22 Mar 93 15:59:19
Organization: SunSoft, Inc., Mountain View, CA
Lines: 60
Distribution: gnu
Message-ID: <JSC.93Mar22155919@saxon.Eng.Sun.COM>
NNTP-Posting-Host: saxon