🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99598

Re: restriction on load-path

#99598
From: Joe Wells
Date: Tue, 24 Jul 1990 00:59
64 lines
3297 bytes
In article <9007131639.AA17061@m.cs.uiuc.edu> hasker@CS.UIUC.EDU (Rob Hasker) writes:

   In the command-line-1 function in startup.el appears the following code:

		   ...
		   ((or (string-equal argi "-l")
			(string-equal argi "-load"))
		    (let ((load-path (cons default-directory load-path)))
		      (load (car command-line-args-left) nil t))
		    ...)

   The problem with this is that because of the let there is no way for a file
   loaded by command line options to change load-path for another command.  In
   my case, I want some initialization to be done before calling the
   byte-compiler.  One of these initializations was supposed to be to reset
   load-path so require's will load the right file.  But putting the
   initialization into a separate file and then doing
	   gnuemacs -batch -l init.el -batch-byte-compile file.el
   doesn't work in the special case of load-path.

I found this annoying also.  For those of you who can't fix the installed
source, you can put something like this in a file (named, say, foo.el) and
load it with "-l foo" on the command line:

    (setq command-line-args-left 
	  (append '("dummy-argument" "-f" "ugly-hack")
		  (cdr command-line-args-left)))
    (defun ugly-hack ()
      (setq load-path
	    (cons "/usr/foo/bar"
		  load-path)))

To fix the source, I'm including a patch to fix this behavior without
losing the old functionality.  I recommend this for inclusion in version
19.  I have tested it, but not in an "installed" configuration, due to
lack of necessary priveleges/time/space.

Enjoy,

-- 
Joe Wells <jbw@uswest.com>
----------------------------------------------------------------------
*** /home/zeb/gnu/dist-18.55/lisp/startup.el	Tue Jun  5 00:11:32 1990
--- startup.el	Mon Jul 23 18:42:53 1990
***************
*** 210,217 ****
  		 (funcall tem))
  		((or (string-equal argi "-l")
  		     (string-equal argi "-load"))
! 		 (let ((load-path (cons default-directory load-path)))
! 		   (load (car command-line-args-left) nil t))
  		 (setq command-line-args-left (cdr command-line-args-left)))
  		((or (string-equal argi "-i")
  		     (string-equal argi "-insert"))
--- 210,218 ----
  		 (funcall tem))
  		((or (string-equal argi "-l")
  		     (string-equal argi "-load"))
! 		 (let ((filename (car command-line-args-left)))
! 		   (or (load (expand-file-name filename default-directory) t t)
! 		       (load filename nil t)))
  		 (setq command-line-args-left (cdr command-line-args-left)))
  		((or (string-equal argi "-i")
  		     (string-equal argi "-insert"))
Technical Details
Message-ID: <JBW.90Jul23185950@zeb.uswest.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!decwrl!elroy.jpl.nasa.gov!ncar!boulder!uswat!jbw
References: <9007131639.AA17061@m.cs.uiuc.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,59d5118d1f5a6918
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-07-23 21:54:13 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!decwrl!elroy.jpl.nasa.gov!ncar!boulder!uswat!jbw
From: jbw@zeb.uswest.com (Joe Wells)
Newsgroups: gnu.emacs.bug
Subject: Re: restriction on load-path
Message-ID: <JBW.90Jul23185950@zeb.uswest.com>
Date: 24 Jul 90 00:59:50 GMT
References: <9007131639.AA17061@m.cs.uiuc.edu>
Sender: news@uswat.UUCP
Distribution: gnu
Organization: U S West Advanced Technologies
Lines: 64
Posted: Tue Jul 24 01:59:50 1990
In-reply-to: hasker@CS.UIUC.EDU's message of 13 Jul 90 16:39:20 GMT