1

I am violating probably the most essential emacs package rule in my .emacs file by loading a specific path to an emacs (workgroups2) package which gets updated. So, everytime a new version is released and when I upgrade I have to edit my emacs file (this is the first line below).

The following is the relevant section of my emacs file. How can I load this without adding a specific path? Let me know what other suggestions you have and thanks!

To be clear the line we are considering is: (add-to-list 'load-path "~/.emacs.d/elpa/workgroups2-20130915.1509")

(add-to-list 'load-path "~/.emacs.d/elpa/workgroups2-20130915.1509")
(require 'workgroups2)
(setq package-enable-at-startup nil)
(package-initialize)

(desktop-save-mode nil)     ; save all opened files (or disable it)                                                                                                         
(setq wg-prefix-key (kbd "C-c w")
      wg-restore-associated-buffers t ; restore all buffers opened in this WG?                                                                                              
      wg-use-default-session-file t   ; turn off for "emacs --daemon"                                                                                                       
      wg-default-session-file "~/.emacs.d/emacs_def.wg"
      wg-use-faces nil
      wg-morph-on nil)                  ; animation off                                                                                                                     

;; Keyboard shortcuts - load, save, switch                                                                                                                                  
(global-set-key (kbd "<pause>")     'wg-reload-session)
(global-set-key (kbd "C-S-<pause>") 'wg-save-session)
(global-set-key (kbd "s-z")         'wg-switch-to-workgroup)
(global-set-key (kbd "s-/")         'wg-switch-to-previous-workgroup)

(workgroups-mode 1)     ; Activate workgroups 

EDIT: If I comment out that line, this is what the debugger gives me:

Debugger entered--Lisp error: (file-error "Cannot open load file" "workgroups2")
  require(workgroups2)
  eval-buffer(#<buffer  *load*> nil "/home/d2b2/.emacs.d/init.el" nil t)  ; Reading at buffer position 6014
  load-with-code-conversion("/home/d2b2/.emacs.d/init.el" "/home/d2b2/.emacs.d/init.el" t t)
  load("/home/d2b2/.emacs.d/init" t t)
  #[0 "^H\205\262^@     \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312Q\202;^@\313\307\314\315#\203*^@\316\202;^@\313\307\314\317#\203:^@\320\nB^R\321\202;^@\316\$
  command-line()
  normal-top-level()

EDIT: Now commenting out both lines we have the following errors:

Debugger entered--Lisp error: (error ":END: line missing at position 186")
  signal(error (":END: line missing at position 186"))
  error(":END: line missing at position %s" 186)
  org-flag-drawer(t)
  org-cycle-hide-drawers(all)
  org-set-startup-visibility()
  org-mode()
  desktop-restore-file-buffer("/home/d2b2/.todo" ".todo" nil)
  #[nil "^H     \236A\206^H^@\305\n^K\f#\207" [desktop-buffer-major-mode desktop-buffer-mode-handlers desktop-buffer-file-name desktop-buffer-name desktop-buffer-misc deskt$
  desktop-create-buffer(206 "/home/d2b2/.todo" ".todo" org-mode (workgroups-mode) 1 (nil nil) nil nil ((buffer-file-coding-system . undecided-unix) (truncate-lines . t)))
  eval-buffer(#<buffer  *load*> nil "/home/d2b2/.emacs.desktop" nil t)  ; Reading at buffer position 813
  load-with-code-conversion("/home/d2b2/.emacs.desktop" "/home/d2b2/.emacs.desktop" t t)
  load("/home/d2b2/.emacs.desktop" t t t)
  desktop-read()
  #[nil "\304\211^X     \235\203^O^@\305^H      \"^Q\306^R)\n\205^Z^@\307 \210\310\211^S\207" [key command-line-args desktop-save-mode inhibit-startup-screen "--no-desktop"$
  run-hooks(after-init-hook)
  command-line()
  normal-top-level()
CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216
  • 1
    As I understand it, you shouldn't need those workgroup2-specific lines at the top. Do you get an error if you omit those? If so, what is it? This Q&A might also be of some use: [Emacs 24 Package System Initialization Problems](http://stackoverflow.com/questions/11127109/emacs-24-package-system-initialization-problems). – phils Oct 20 '13 at 22:19
  • It won't load otherwise and I get an error saying it can't find it. – CodeKingPlusPlus Oct 20 '13 at 22:58
  • If artscan's answer doesn't solve this, could you please run `emacs --debug-init` and add the stack trace into the question. – phils Oct 20 '13 at 23:51
  • I just put that information in the edit! – CodeKingPlusPlus Oct 21 '13 at 00:27
  • Could you please comment out *both* of the workgroups2 lines -- including the `require`. I want to see what's going wrong when you just let the package system do its thing. – phils Oct 21 '13 at 03:31
  • Sorry, checkout the latest edit – CodeKingPlusPlus Oct 21 '13 at 03:40
  • Well it's getting through your init file okay, as it's running `after-init-hook`. The error you're showing doesn't look to me as if it's related to this package at all (seems to be bad syntax in `/home/d2b2/.todo`). Try not loading the desktop file automatically, to verify whether everything else is working? – phils Oct 21 '13 at 04:30

1 Answers1

2

Make sure, that package-directory-list includes your path to elpa ~/.emacs.d/elpa.

Then package.el initializes some package, it adds name of package to package-activated-list and pushes package directory (e.g. ~/.emacs.d/elpa/workgroups2-20130915.1509) to load-path automatically.

For me it works as usual, I don't add any specific pathes for packages manually. The value of package-enable-at-startup is t in my config.

package-enable-at-startup doc: "Whether to activate installed packages when Emacs starts...If the value of package-enable-at-startup is nil, you can type M-x package-initialize to activate the package system at any time."

(require 'workgroups2) is before package initialization in your config, try to move it below.

artscan
  • 2,340
  • 15
  • 26