home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / lucidem / help / 125 < prev    next >
Encoding:
Text File  |  1992-07-24  |  5.9 KB  |  151 lines

  1. Newsgroups: alt.lucid-emacs.help
  2. Sender: help-lucid-emacs-request@lucid.com
  3. Date: Fri, 24 Jul 92 10:37:25 PDT
  4. Message-ID: <9207241737.AA15150@thalidomide.lucid>
  5. X-Windows: It could happen to you.
  6. From: Jamie Zawinski <jwz@lucid.com>
  7. Subject: Re: Lucid on RS6000 running Aix 3.2
  8. References: <7KE5V1O@math.fu-berlin.de>
  9.     <9207222013.AA37315@eas.gatech.edu>
  10. Path: sparky!uunet!wendy-fate.uu.net!help-lucid-emacs
  11. Lines: 138
  12.  
  13. In message <7KE5V1O@math.fu-berlin.de> Thomas Richter wrote:
  14. >
  15. >     I gave up when I got an error about lock-directory being void
  16. >     while 'temacs -batch -l loadup.el' was working on startup.el.
  17.  
  18. This is because lisp/prim/startup.el wasn't allowing for the fact that the C
  19. code might not have been compiled with support for locking.  Replace the
  20. following two functions with the definition below.
  21.  
  22.     -- Jamie
  23.  
  24. (defun set-default-load-path ()
  25. ;  (send-string-to-terminal (format "\ninitial load path:\n %s" load-path))
  26. ;  (send-string-to-terminal (format "\ninitial exec path:\n %s\n" exec-path))
  27.   ;;
  28.   ;; Make sure there is a reasonable elisp library directory on the load path,
  29.   ;; and a reasonable emacs utility directory on the exec-path, even if this
  30.   ;; emacs was dumped with now-inappropriate defaults.  Look at the directory
  31.   ;; from which this emacs image was run:
  32.   ;;
  33.   ;;   o  If it ends in .../src/, and ../lisp/ exists, then use that for the
  34.   ;;      lisp library (likewise for /etc/ and /lock/).
  35.   ;;   o  If there is a subdirectory of that dir called lisp/ (or etc/ or 
  36.   ;;      lock/), then use that.
  37.   ;;   o  If the emacs program that was run is itself a symlink, then chase
  38.   ;;      the link and try again on the resultant directory.
  39.   ;;
  40.   ;; These heuristics fail if the emacs binary was copied from the main emacs
  41.   ;; tree to some other directory, and links for the lisp directory were not
  42.   ;; put in, but I can't think of a way around that.
  43.   ;;
  44.   (let ((lisp (find-default-load-path-internal "lisp"))
  45.     (etc  (find-default-load-path-internal "etc"))
  46.     (lock (and (boundp 'lock-directory)
  47.            (or lock-directory
  48.                (find-default-load-path-internal "lock")))))
  49.     (if lisp
  50.     (or (member lisp load-path)
  51.         (progn
  52.           ;; If the lisp dir isn't on the load-path, add it.
  53.           (setq load-path (append load-path (list lisp)))
  54.           ;; If the lisp dir wasn't on the load-path, then also add
  55.           ;; any direct subdirectories of the lisp directory to the
  56.           ;; load-path.
  57.           (let (;(files (directory-files lisp))
  58.             (files (directory-files lisp nil nil nil 'dirs-only))
  59.             file)
  60.         (while files
  61.           (setq file (car files))
  62.           (if (and (not (member file '("." ".." "RCS")))
  63.                ;(file-directory-p
  64.                 (setq file (expand-file-name file lisp))
  65.                 ;)
  66.                (not (member file load-path)))
  67.               (setq load-path
  68.                 (nconc load-path
  69.                    (list (file-name-as-directory file)))))
  70.           (setq files (cdr files))))
  71.           )))
  72.     (if etc
  73.     (or (member etc exec-path)
  74.         (setq exec-path (append exec-path (list etc)))))
  75.     (if (and (null exec-directory) etc)
  76.     (setq exec-directory (file-name-as-directory etc)))
  77.     (if (and (boundp 'Info-directory-list) (null Info-directory-list))
  78.     (setq Info-directory-list
  79.           (list (expand-file-name "../info/" exec-directory))))
  80.     (if (boundp 'lock-directory)
  81.     (progn
  82.       (setq lock-directory lock)
  83.       (if (and lock-directory (null superlock-path))
  84.           (setq superlock-path
  85.             (concat lock-directory "!!!SuperLock!!!")))))
  86.     (set-default-load-path-warning)))
  87.  
  88.  
  89. (defun set-default-load-path-warning ()
  90.   (if (and exec-directory load-path
  91.        (or (not (boundp 'lock-directory)) lock-directory))
  92.       nil
  93.     (save-excursion
  94.       (set-buffer (get-buffer-create " *warning-tmp*"))
  95.       (erase-buffer)
  96.       (let ((fill-column 70)
  97.         warnings message guess)
  98.     (if (and (boundp 'lock-directory) (null lock-directory))
  99.         (setq warnings (cons "lock-directory" warnings)))
  100.     (if (null exec-directory)
  101.         (setq warnings (cons "exec-directory" warnings)))
  102.     (if (null load-path)
  103.         (setq warnings (cons "load-path" warnings)))
  104.     (cond ((cdr (cdr warnings))
  105.            (setq message (apply 'format "%s, %s, and %s" warnings)))
  106.           ((cdr warnings)
  107.            (setq message (apply 'format "%s and %s" warnings)))
  108.           (t (setq message (format "variable %s" (car warnings)))))
  109.     (insert "couldn't find an obvious default for " message
  110.         ", and there were no defaults specified in paths.h when emacs "
  111.         "was built.  Perhaps some directories don't exist, or the "
  112.         "emacs executable, " execution-path " is in a strange place?")
  113.     (setq guess (or exec-directory
  114.             (car (reverse load-path))
  115.             (and (string-match "/[^/]+$" execution-path)
  116.                  (substring execution-path 0
  117.                     (match-beginning 0)))))
  118.     (if (and guess (string-match "/\\(src\\|etc\\|lisp\\)/$" guess))
  119.         (setq guess (substring guess 0 (match-beginning 0))))
  120.     (if (and guess (string-match "/$" guess))
  121.         (setq guess (substring guess 0 (match-beginning 0))))
  122.     (if (and (boundp 'lock-directory) (null lock-directory))
  123.         (progn
  124.           (insert
  125.            "\n\nWithout lock-directory set, file locking won't work.  ")
  126.           (if guess
  127.           (insert
  128.            "Consider creating " guess "/lock/ as a directory or "
  129.            "symbolic link for use as the lock directory.  "))))
  130.  
  131.     (if (or (null exec-directory) (null load-path))
  132.         (insert
  133.          "\n\nWithout both exec-directory and load-path, emacs will "
  134.          "be very broken.  "))
  135.     (if (and (null exec-directory) guess)
  136.         (insert
  137.          "Consider making a symbolic link from " guess
  138.          "/etc/ to wherever the appropriate emacs etc directory is"))
  139.     (if (and (null load-path) guess)
  140.         (insert
  141.          (if exec-directory "Consider making a symbolic link " ", and ")
  142.          "from " guess
  143.          "/lisp/ to wherever the appropriate emacs lisp library is.  ")
  144.       (if (and (null exec-directory) guess) (insert ".")))
  145.     (fill-region (point-min) (point-max))
  146.     (goto-char (point-min))
  147.     (insert "\nWARNING:\n")
  148.     (send-string-to-terminal (buffer-string))
  149.     (erase-buffer)
  150.     t))))
  151.