senny / cabbage

get the maximum out of emacs
http://senny.github.com/cabbage/
156 stars 21 forks source link

Update cabbage.el #200

Closed mattfidler closed 9 years ago

mattfidler commented 10 years ago

I was trying to make this work with EmacsPortable.App so I can try it out. This should make loading only cabbage.el work just fine. However, when I loaded it I got the error:

Debugger entered--Lisp error: (file-error "Cannot open load file" "perspective")
  require(perspective)
  (progn (add-to-list (quote load-path) library-dir) (require library))
  (if (and library-dir (file-directory-p library-dir)) (progn (add-to-list (quote load-path) library-dir) (require library)))
  (let* ((library-dir (cabbage-vendor-library-dir library))) (if (and library-dir (file-directory-p library-dir)) (progn (add-to-list (quote load-path) library-dir) (require library))))
  cabbage-vendor(perspective)
  eval-buffer(#<buffer  *load*-528408> nil "c:/EmacsPortable.App/Data/start/cabbage/lib/perspective.el" nil t)  ; Reading at buffer position 30
  load-with-code-conversion("c:/EmacsPortable.App/Data/start/cabbage/lib/perspective.el" "c:/EmacsPortable.App/Data/start/cabbage/lib/perspective.el" nil nil)
  load("c:/EmacsPortable.App/Data/start/cabbage/lib/perspective")
  eval-buffer(#<buffer  *load*-232598> nil "c:/EmacsPortable.App/Data/start/cabbage/cabbage.el" nil t)  ; Reading at buffer position 1547
  load-with-code-conversion("c:/EmacsPortable.App/Data/start/cabbage/cabbage.el" "c:/EmacsPortable.App/Data/start/cabbage/cabbage.el" nil nil)
  load("c:/EmacsPortable.App/Data/start/cabbage/cabbage")
  (progn (setq dir (replace-regexp-in-string ".el$" "" (nth 0 dir))) (load dir) (message "Loaded %s" dir))
  (if (= 1 (length dir)) (progn (setq dir (replace-regexp-in-string ".el$" "" (nth 0 dir))) (load dir) (message "Loaded %s" dir)))
  (let ((dir (file-expand-wildcards (format "%s/*.el" start-dir) t))) (if (= 1 (length dir)) (progn (setq dir (replace-regexp-in-string ".el$" "" (nth 0 dir))) (load dir) (message "Loaded %s" dir))))
  (cond ((file-exists-p (expand-file-name ".emacs" start-dir)) (load (expand-file-name ".emacs" start-dir)) (message "Loaded %s/.emacs" start-dir)) ((file-exists-p (expand-file-name "init.el" start-dir)) (load (concat (replace-regexp-in-string "/$" "" start-dir t t) "/init")) (message "Loaded %s/init" (replace-regexp-in-string "/$" "" start-dir t t))) ((file-exists-p (expand-file-name ".emacs.d/init.el" start-dir)) (load (expand-file-name ".emacs.d/init.el" start-dir)) (message "Loaded %s/.emacs.d/init.el" start-dir)) ((file-exists-p (expand-file-name "site-start.el" (expand-file-name "site-lisp" start-dir))) (load (concat (expand-file-name "site-lisp" start-dir) "/site-start")) (message "Loaded %s/site-start/site-lisp" start-dir)) (t (let ((dir (file-expand-wildcards (format "%s/*.el" start-dir) t))) (if (= 1 (length dir)) (progn (setq dir (replace-regexp-in-string ".el$" "" (nth 0 dir))) (load dir) (message "Loaded %s" dir))))))
  (progn (setq start-dir (expand-file-name (getenv "EPSTARTDIR"))) (if (file-exists-p (expand-file-name "elpa" (expand-file-name ".emacs.d" (getenv "EPSTARTDIR")))) (setq package-user-dir (expand-file-name "elpa" (expand-file-name ".emacs.d" (getenv "EPSTARTDIR")))) (if (file-exists-p (expand-file-name "elpa" (getenv "EPSTARTDIR"))) nil (make-directory (expand-file-name "elpa" (getenv "EPSTARTDIR")) t)) (setq package-user-dir (expand-file-name "elpa" (getenv "EPSTARTDIR")))) (message "Using startup at %s" start-dir) (cond ((file-exists-p (expand-file-name ".emacs" start-dir)) (load (expand-file-name ".emacs" start-dir)) (message "Loaded %s/.emacs" start-dir)) ((file-exists-p (expand-file-name "init.el" start-dir)) (load (concat (replace-regexp-in-string "/$" "" start-dir t t) "/init")) (message "Loaded %s/init" (replace-regexp-in-string "/$" "" start-dir t t))) ((file-exists-p (expand-file-name ".emacs.d/init.el" start-dir)) (load (expand-file-name ".emacs.d/init.el" start-dir)) (message "Loaded %s/.emacs.d/init.el" start-dir)) ((file-exists-p (expand-file-name "site-start.el" (expand-file-name "site-lisp" start-dir))) (load (concat (expand-file-name "site-lisp" start-dir) "/site-start")) (message "Loaded %s/site-start/site-lisp" start-dir)) (t (let ((dir (file-expand-wildcards (format "%s/*.el" start-dir) t))) (if (= 1 (length dir)) (progn (setq dir (replace-regexp-in-string ".el$" "" ...)) (load dir) (message "Loaded %s" dir)))))))
  (if start-dir (progn (setq start-dir (expand-file-name (getenv "EPSTARTDIR"))) (if (file-exists-p (expand-file-name "elpa" (expand-file-name ".emacs.d" (getenv "EPSTARTDIR")))) (setq package-user-dir (expand-file-name "elpa" (expand-file-name ".emacs.d" (getenv "EPSTARTDIR")))) (if (file-exists-p (expand-file-name "elpa" (getenv "EPSTARTDIR"))) nil (make-directory (expand-file-name "elpa" (getenv "EPSTARTDIR")) t)) (setq package-user-dir (expand-file-name "elpa" (getenv "EPSTARTDIR")))) (message "Using startup at %s" start-dir) (cond ((file-exists-p (expand-file-name ".emacs" start-dir)) (load (expand-file-name ".emacs" start-dir)) (message "Loaded %s/.emacs" start-dir)) ((file-exists-p (expand-file-name "init.el" start-dir)) (load (concat (replace-regexp-in-string "/$" "" start-dir t t) "/init")) (message "Loaded %s/init" (replace-regexp-in-string "/$" "" start-dir t t))) ((file-exists-p (expand-file-name ".emacs.d/init.el" start-dir)) (load (expand-file-name ".emacs.d/init.el" start-dir)) (message "Loaded %s/.emacs.d/init.el" start-dir)) ((file-exists-p (expand-file-name "site-start.el" (expand-file-name "site-lisp" start-dir))) (load (concat (expand-file-name "site-lisp" start-dir) "/site-start")) (message "Loaded %s/site-start/site-lisp" start-dir)) (t (let ((dir (file-expand-wildcards ... t))) (if (= 1 (length dir)) (progn (setq dir ...) (load dir) (message "Loaded %s" dir))))))))
  (let ((start-dir (getenv "EPSTARTDIR"))) (if start-dir (progn (setq start-dir (expand-file-name (getenv "EPSTARTDIR"))) (if (file-exists-p (expand-file-name "elpa" (expand-file-name ".emacs.d" (getenv "EPSTARTDIR")))) (setq package-user-dir (expand-file-name "elpa" (expand-file-name ".emacs.d" (getenv "EPSTARTDIR")))) (if (file-exists-p (expand-file-name "elpa" (getenv "EPSTARTDIR"))) nil (make-directory (expand-file-name "elpa" (getenv "EPSTARTDIR")) t)) (setq package-user-dir (expand-file-name "elpa" (getenv "EPSTARTDIR")))) (message "Using startup at %s" start-dir) (cond ((file-exists-p (expand-file-name ".emacs" start-dir)) (load (expand-file-name ".emacs" start-dir)) (message "Loaded %s/.emacs" start-dir)) ((file-exists-p (expand-file-name "init.el" start-dir)) (load (concat (replace-regexp-in-string "/$" "" start-dir t t) "/init")) (message "Loaded %s/init" (replace-regexp-in-string "/$" "" start-dir t t))) ((file-exists-p (expand-file-name ".emacs.d/init.el" start-dir)) (load (expand-file-name ".emacs.d/init.el" start-dir)) (message "Loaded %s/.emacs.d/init.el" start-dir)) ((file-exists-p (expand-file-name "site-start.el" (expand-file-name "site-lisp" start-dir))) (load (concat (expand-file-name "site-lisp" start-dir) "/site-start")) (message "Loaded %s/site-start/site-lisp" start-dir)) (t (let ((dir ...)) (if (= 1 ...) (progn ... ... ...))))))))
  (progn (let ((start-dir (getenv "EPSTARTDIR"))) (if start-dir (progn (setq start-dir (expand-file-name (getenv "EPSTARTDIR"))) (if (file-exists-p (expand-file-name "elpa" (expand-file-name ".emacs.d" ...))) (setq package-user-dir (expand-file-name "elpa" (expand-file-name ".emacs.d" ...))) (if (file-exists-p (expand-file-name "elpa" ...)) nil (make-directory (expand-file-name "elpa" ...) t)) (setq package-user-dir (expand-file-name "elpa" (getenv "EPSTARTDIR")))) (message "Using startup at %s" start-dir) (cond ((file-exists-p (expand-file-name ".emacs" start-dir)) (load (expand-file-name ".emacs" start-dir)) (message "Loaded %s/.emacs" start-dir)) ((file-exists-p (expand-file-name "init.el" start-dir)) (load (concat ... "/init")) (message "Loaded %s/init" (replace-regexp-in-string "/$" "" start-dir t t))) ((file-exists-p (expand-file-name ".emacs.d/init.el" start-dir)) (load (expand-file-name ".emacs.d/init.el" start-dir)) (message "Loaded %s/.emacs.d/init.el" start-dir)) ((file-exists-p (expand-file-name "site-start.el" ...)) (load (concat ... "/site-start")) (message "Loaded %s/site-start/site-lisp" start-dir)) (t (let (...) (if ... ...))))))))
  (if (and (getenv "EPSTART") (not (string= "" (getenv "EPSTART"))) (getenv "EPSTARTDIR") (file-exists-p (getenv "EPSTARTDIR"))) (progn (let ((start-dir (getenv "EPSTARTDIR"))) (if start-dir (progn (setq start-dir (expand-file-name (getenv "EPSTARTDIR"))) (if (file-exists-p (expand-file-name "elpa" ...)) (setq package-user-dir (expand-file-name "elpa" ...)) (if (file-exists-p ...) nil (make-directory ... t)) (setq package-user-dir (expand-file-name "elpa" ...))) (message "Using startup at %s" start-dir) (cond ((file-exists-p ...) (load ...) (message "Loaded %s/.emacs" start-dir)) ((file-exists-p ...) (load ...) (message "Loaded %s/init" ...)) ((file-exists-p ...) (load ...) (message "Loaded %s/.emacs.d/init.el" start-dir)) ((file-exists-p ...) (load ...) (message "Loaded %s/site-start/site-lisp" start-dir)) (t (let ... ...))))))))
  eval-buffer(#<buffer  *load*-743330> nil "c:/EmacsPortable.App/App/site-lisp/start.el" nil t)  ; Reading at buffer position 39539
  load-with-code-conversion("c:/EmacsPortable.App/App/site-lisp/start.el" "c:/EmacsPortable.App/App/site-lisp/start.el" nil nil)
  load("c:/EmacsPortable.App/App/site-lisp/start.el")
  (progn (load exported-file))
  (if (file-exists-p exported-file) (progn (load exported-file)))
  (let* ((base-name (file-name-sans-extension file)) (exported-file (concat base-name ".el"))) (if (and (file-exists-p exported-file) (> (age file) (age exported-file))) nil (message "Trying to Tangle %s" file) (condition-case err (progn (org-babel-tangle-file file exported-file "emacs-lisp") (message (format "Tangled %s to %s" file exported-file))) (error (message "Error Tangling %s; %s" file err)))) (if (file-exists-p exported-file) (progn (load exported-file))))
  (progn (if (eq vnew (quote cl--unbound)) (fmakunbound (quote age)) (fset (quote age) vnew)) (let* ((base-name (file-name-sans-extension file)) (exported-file (concat base-name ".el"))) (if (and (file-exists-p exported-file) (> (age file) (age exported-file))) nil (message "Trying to Tangle %s" file) (condition-case err (progn (org-babel-tangle-file file exported-file "emacs-lisp") (message (format "Tangled %s to %s" file exported-file))) (error (message "Error Tangling %s; %s" file err)))) (if (file-exists-p exported-file) (progn (load exported-file)))))
  (unwind-protect (progn (if (eq vnew (quote cl--unbound)) (fmakunbound (quote age)) (fset (quote age) vnew)) (let* ((base-name (file-name-sans-extension file)) (exported-file (concat base-name ".el"))) (if (and (file-exists-p exported-file) (> (age file) (age exported-file))) nil (message "Trying to Tangle %s" file) (condition-case err (progn (org-babel-tangle-file file exported-file "emacs-lisp") (message (format "Tangled %s to %s" file exported-file))) (error (message "Error Tangling %s; %s" file err)))) (if (file-exists-p exported-file) (progn (load exported-file))))) (if (eq old (quote cl--unbound)) (fmakunbound (quote age)) (fset (quote age) old)))
  (let* ((vnew (function (lambda (file) (progn (float-time (time-subtract ... ...)))))) (old (if (fboundp (quote age)) (symbol-function (quote age)) (quote cl--unbound)))) (unwind-protect (progn (if (eq vnew (quote cl--unbound)) (fmakunbound (quote age)) (fset (quote age) vnew)) (let* ((base-name (file-name-sans-extension file)) (exported-file (concat base-name ".el"))) (if (and (file-exists-p exported-file) (> (age file) (age exported-file))) nil (message "Trying to Tangle %s" file) (condition-case err (progn (org-babel-tangle-file file exported-file "emacs-lisp") (message ...)) (error (message "Error Tangling %s; %s" file err)))) (if (file-exists-p exported-file) (progn (load exported-file))))) (if (eq old (quote cl--unbound)) (fmakunbound (quote age)) (fset (quote age) old))))
  ep-load-org("c:/EmacsPortable.App/App/site-lisp/start.org")
  eval-buffer(#<buffer  *load*> nil "c:/EmacsPortable.App/App/site-lisp/site-start.el" nil t)  ; Reading at buffer position 5261
  load-with-code-conversion("c:/EmacsPortable.App/App/site-lisp/site-start.el" "c:/EmacsPortable.App/App/site-lisp/site-start.el" t t)
  load("site-start" t t)
  command-line()
  normal-top-level()
senny commented 10 years ago

@mlf176f2 did you use the install script to set up your cabbage installation? This should place a init.el file into your ~/.emacs.d directory, which has the necessary configuration (see https://github.com/senny/cabbage/blob/master/scripts/install.sh#L104)

mattfidler commented 10 years ago

I don't see how that would help. The modified cabbage.el sets the cabbage repository directory just like the ~/.emacs.d/init.el script, and obviously it loads the cabbage.el

mattfidler commented 10 years ago

Besides, I like to try out configurations with EmacsPortable.App

senny commented 10 years ago

I'm not familiar with EmacsPortable.App could you briefly explain the difference in the loading process and why the current config files, which are copied with the install script don't work?

jone commented 10 years ago

@mlf176f2 It seems that you didn't clone the git submodules which cabbage requires. This is usually done by the install script.

You could try to use the install script and then move the files from $APPDATA/.emacs.d (where the init.el etc. is generated to), to where it belongs within the Emacs portable, which is currently loading cabbage.

Alternatively you could try to clone / update the git modules manually. I think this could be done with something like:

cd c:/EmacsPortable.App/Data/start/cabbage
git submodule init
git submodule sync
git submodule update
mattfidler commented 10 years ago

Sure @senny

EmacsPortable.App puts emacs start-up scripts in separate directory to allow testing of multiple emacs environments without having to change your home drive. It is more mature in windows, with a right-click menu you can select whatever you want to run:

image

It can also be used to run emacs on Mac OSX and linux. I use it from my usb stick on windows, Mac OSX and Puppy Linux (which is booted from my usb stick).

@jone I believe you were right about the sub-modules... Its kind of time consuming to pull all the sub-modules, and my connection keeps being reset.

I still need this patch to allow EmacsPortable.App to use cabbage.

senny commented 10 years ago

This package needs installation, thats why there is a script to keep the submodules in sync and update them accordingly. It's not the goal to "git clone" the repo and load cabbage.el right away.

The installation is separate from the initialization so it needs to happen before you boot Emacs.

mattfidler commented 10 years ago

This is how EmacsPortable.App currently loads start-up scripts:

(when (and (getenv "EPSTART")
           (not (string= "" (getenv "EPSTART")))
           (getenv "EPSTARTDIR")
           (file-exists-p (getenv "EPSTARTDIR")))
  (let ((start-dir (getenv "EPSTARTDIR")))
    (when start-dir
      (setq start-dir (expand-file-name (getenv "EPSTARTDIR")))
      ;; Make sure that the ELPA directories are per each startup
      ;; group.
      (if (file-exists-p (expand-file-name
                            "elpa"
                            (expand-file-name
                             ".emacs.d" (getenv "EPSTARTDIR"))))
          (setq package-user-dir (expand-file-name
                                  "elpa"
                                  (expand-file-name
                                   ".emacs.d"
                                   (getenv "EPSTARTDIR"))))

        (unless (file-exists-p (expand-file-name "elpa" (getenv "EPSTARTDIR")))
          (make-directory (expand-file-name "elpa" (getenv "EPSTARTDIR")) t))
        (setq package-user-dir (expand-file-name "elpa" (getenv "EPSTARTDIR"))))

      (message "Using startup at %s" start-dir)
      (cond
       ((file-exists-p (expand-file-name ".emacs" start-dir))
        (load (expand-file-name ".emacs" start-dir))
        (message "Loaded %s/.emacs" start-dir))

       ((file-exists-p (expand-file-name "init.el" start-dir))
        (load (concat (replace-regexp-in-string "/$" "" start-dir t t) "/init"))
        (message "Loaded %s/init" (replace-regexp-in-string "/$" "" start-dir t t)))
       ((file-exists-p (expand-file-name ".emacs.d/init.el" start-dir))
        (load (expand-file-name ".emacs.d/init.el" start-dir))
        (message "Loaded %s/.emacs.d/init.el" start-dir))

       ((file-exists-p (expand-file-name  "site-start.el" (expand-file-name "site-lisp" start-dir)))
        (load (concat (expand-file-name "site-lisp" start-dir) "/site-start"))
        (message "Loaded %s/site-start/site-lisp" start-dir))
       (t
        (let ((dir (file-expand-wildcards (format "%s/*.el" start-dir) t)))
          (when (= 1 (length dir))
            (setq dir (replace-regexp-in-string ".el$" "" (nth 0 dir)))
            (load dir)
            (message "Loaded %s" dir))))))))

Without making my own init.el in the start-up directory, I would have to remove my .emacs.d and only use only cabbage. I'm not ready to make that sort of commitment, yet. I'm not even sure I like the defaults proposed. I'm less sure that my changes to cabbage will be considered useful.

I understand that you want to make sure that the proper steps are performed, so if you decide not to add this patch that is fine.

mattfidler commented 10 years ago

@jone thanks for your help. The start-up works just fine now (with my patch)

tonini commented 9 years ago

@jone @senny @mlf176f2 could we close this one?

senny commented 9 years ago

yup, closing. Thanks guys.