🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1723

minibuf.el

#1723
From: Ken Wood
Date: Fri, 04 Oct 1991 16:08
82 lines
3479 bytes
Bertil Askelid 6344 writes:
 > 
 > 	I am trying to use your minibuf.el that you posted today. When I try
 > 	to load, emacs complains about not finding the "prepend-unique-hook"
 > 	function. Where can I find that? I am running Epoch 3.2.

Apologies Bertil and anyone else who tried to use this code - I left
an important file out of the posting. prepend-unique-hook is a handy
function we use all the time. I've included it below - add the line

(require 'maclib-toolbox)

to your .emacs before you load minibuf.el .

Ken

Ken Wood, Austek Microsystems, Technology Park, Adelaide, SA 5095, Australia
INTERNET:  kwood@austek.oz.au  UUCP: uunet.uu.net!munnari!austek.oz.au!kwood


;*****************************************************************************
;
; Filename:	maclib-toolbox.el
;
; Description:	Miscellaneous useful programming tools.
;
;*****************************************************************************

(provide 'maclib-toolbox)


;********** Adding to hooks *********

;; From: liberte@cs.uiuc.edu (Daniel LaLiberte)
;; Date: 15 Apr 90 22:41:10 GMT

(defun prepend-unique-hook (hook-var hook-function)
  "Prepend 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
		      (cons hook-function value)))
	  (and (not (eq hook-function value))
	       (set hook-var
		    (list hook-function value)))))
    (set hook-var (list hook-function))
    ))

(defun 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))
    ))



(defun true-mode-name ()
  "Returns the name of the mode in such a form that the mode may be
  re-established by calling the function named by appending '-name' to
  this string.  This differs from the variable called mode-name in that
  this is guaranteed to work while the values held by the variable may
  have embedded spaces or other junk.

  THIS MODE NAME IS GUARANTEED OK TO USE IN THE MODE LINE."
  (let ((major-mode-name (symbol-name major-mode)))
    (substring major-mode-name 0
	       (or   (string-match "-mode" major-mode-name)
		     (length major-mode-name)))))

;; end maclib-toolbox.el
Technical Details
Message-ID: <9110040038.AA10397@angels.adl.austek>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!adl.AUstek.oz.AU!kwood
References: <9110022304.AA06195@proton.ebu.ericsson.se>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,86b65a15f1a97df,start
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1991-10-04 14:43:19 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!adl.AUstek.oz.AU!kwood
From: kwood@adl.AUstek.oz.AU (Ken Wood)
Newsgroups: gnu.epoch.misc
Subject: minibuf.el
Message-ID: <9110040038.AA10397@angels.adl.austek>
Date: 4 Oct 91 16:08:51 GMT
References: <9110022304.AA06195@proton.ebu.ericsson.se>
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 82