Using evil-leader with use-package: Error (use-package): evil-leader/:config: Invalid function: (global-evil-leader-mode) - emacs

I'm trying to add use-package to my init.el and I'm running into this error:
Error (use-package): evil-leader/:config: Invalid function: (global-evil-leader-mode)
Here's a stripped down init.el that produces that error (assumes evil and evil-leader are already installed)
(package-initialize)
(require 'use-package)
(use-package evil :ensure)
(use-package evil-leader
:ensure
:after evil
:config
((global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
"b" 'buffer-menu)
; Apparently this needs to go after (global-evil-leader-mode)
; https://emacs.stackexchange.com/questions/30332/evil-leader-stops-working-when-i-eval-buffer
(evil-mode t)))
This is how it was set up without use-package working correctly:
(package-initialize)
(require 'evil)
(require 'evil-leader)
(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
"b" 'buffer-menu)
; Apparently this needs to go after (global-evil-leader-mode)
; https://emacs.stackexchange.com/questions/30332/evil-leader-stops-working-when-i-eval-buffer
(evil-mode t)
Any help identifying what I'm doing wrong would be appreciated, thank you!

I thin you should remove the parenthesis after :config

Related

Issue with code in .spacemacs file on Spacemacs startup

I have code in the bottom of my .spacemacs file to create some keybindings and such related to evil-mode. The code is as follows:
;; Evil mode
(use-package evil
:ensure t
:config
(evil-mode 1)
(use-package evil-escape
:ensure t
:config
(evil-escape-mode 1)
(setq-default evil-escape-key-sequence "fd")
(setq-default evil-escape-delay 0.2))
(use-package evil-leader
:ensure t
:config
(global-evil-leader-mode)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"e" 'find-file
"bb" 'switch-to-buffer
"bd" 'kill-buffer-and-window
"by" 'copy-whole-buffer
"cy" 'clipboard-kill-ring-save
"cp" 'clipboard-yank
"fs" 'save-buffer
"ms" 'magit-status
"hs" 'split-window-horizontally
"iu" 'insert-char
"lf" 'load-file
"ne" 'flycheck-next-error
"pe" 'flycheck-previous-error
"rm" 'notmuch
"sm" 'message-send-and-exit
"si" 'whitespace-mode
"tn" 'linum-mode
"tt" 'term
"w1" 'delete-other-windows
"wk" 'windmove-left
"wj" 'windmove-right
"qq" 'save-buffers-kill-emacs
"zp" 'zeal-at-point
)
)
(use-package evil-surround
:ensure t
:config
(global-evil-surround-mode))
(use-package evil-indent-textobject
:ensure t))
For some reason, when I open up Spacemacs with the code in my .spacemacs file, I see the following:
If I remove the code, it opens up correctly, but I can add it back then run M-x eval-region and everything works as expected. I am brand new to Spacemacs from Vim so any help would be much appreciated!
You shouldn't have to import the evil package directly. You just need to set the variable dotspacemacs-editing-style to 'vim. Also, any existing packages should be specified in the dotspacemacs-configuration-layers variable. Any packages that don't come with spacemacs can be added via dotspacemacs-additional-packages or you could create a layer if they need additional configuration. For more info see the docs here http://spacemacs.org/doc/DOCUMENTATION.html#dotfile-configuration
Make sure your code is in between the
(defun dotspacemacs/user-init ()
)
OR
(defun dotspacemacs/user-config ()
)
Functions. There are other ways to get the code evaluated too..
M-x or (SPC SPC) and type
configuration-layer/create-layer
this will prompt you for title and location etc.. with this you can have many more options

Emacs semantic auto-complete show error?

I use emacs semantic to auto-complete C language structure, but when I tag ">" (Message->) it show error "cannot analyze buffers not supported by semantic".
Google many times and I did not find any solution.
Debug Message:
Debugger entered--Lisp error: (error "Cannot analyze buffers not supported by Semantic")
signal(error ("Cannot analyze buffers not supported by Semantic"))
error("Cannot analyze buffers not supported by Semantic")
semantic-analyze-current-context()
byte-code("\301 \210^H\203^V^#\302 \204^Q^#\303 \203^V^#\304^H\305\"\210\306\207" [semantic-current-input-throw-symbol semantic-analyze-current-c$
byte-code("\212\302\211^X\303\215)?\205^X^# \304U\205^X^#\302\211^X\305\215)?)\207" [semantic-current-input-throw-symbol arg csi (byte-code "\3$
semantic-complete-self-insert(1)
call-interactively(semantic-complete-self-insert nil nil)
Version:
CEDET Version: 1.1
Requested File Loaded
Package Version Version Version
----------------------------------------------------------
cedet: 1.1 ok ok
eieio: 1.4 ok ok
semantic: 2.1 ok ok
srecode: 1.1 ok ok
ede: 1.1 ok ok
speedbar: 1.0.4 ok ok
cogre: 1.1 ok Not Loaded
cedet-contrib: 1.1 ok Not Loaded
.emacs setting
(add-to-list 'load-path' "~/.emacs.d/company-mode"
"~/.emacs.d/cedet/common" )
(load "~/.emacs.d/cedet/common/cedet" nil t)
(autoload 'company-mode "company" nil t)
(setq company-idle-delay t)
(global-ede-mode 1)
(semantic-load-enable-code-helpers)
(global-srecode-minor-mode 1)
(add-to-list 'load-path
"~/.emacs.d/plugins")
(require 'yasnippet-bundle)
;;; semantic setup
;; (semantic-load-enable-minimum-features)
;; (semantic-load-enable-code-helpers)
;; (semantic-load-enable-gaudy-code-helpers)
(semantic-load-enable-excessive-code-helpers)
(semantic-load-enable-semantic-debugging-helpers)
(require 'eieio-opt)
;;; gcc setup
(require 'semantic-gcc)
;;; smart complitions setup
(require 'semantic-ia)
;;;
(defun my-cedet-hook()
(local-set-key [(control return)] 'semantic-ia-complete-symbol)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
(local-set-key (kbd "M-n") 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key (kbd "M-/") 'semantic-complete-analyze-inline)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
(local-set-key "\C-cd" 'semantic-ia-fast-jump)
(local-set-key "\C-cr" 'semantic-symref-symbol)
(local-set-key "\C-cR" 'semantic-symref)
;;; c/c++ setting
(local-set-key "." 'semantic-complete-self-insert)
(local-set-key ">" 'semantic-complete-self-insert))
(add-hook 'c-mode-common-hook 'my-cedet-hook)
Thank you!
You're using a horribly outdated CEDET.
Just update to latest Emacs, or at least to 24.3.
Then you can test with zero config:
emacs24.3 -Q ~/test.c
M-x semantic-mode. After this, semantic-ia-complete-symbol will bring up the
appropriate popup.

emacs initialization and updating emacs packages

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

Cedet - Wrong type argument , stringp, 1

I am using the latest cedet version from bzr. My cedet configuration is given below ( Taken from Alex Ott's file ).
(setq cedet-root-path (file-name-as-directory "~/cedet"))
(load-file (concat cedet-root-path "cedet-devel-load.el"))
(add-to-list 'load-path (concat cedet-root-path "contrib"))
;; select which submodes we want to activate
(add-to-list 'semantic-default-submodes 'global-semantic-mru-bookmark-mode)
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
(add-to-list 'semantic-default-submodes 'global-cedet-m3-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode)
(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
;; Activate semantic
(semantic-mode 1)
I always get error "Wrong type argument , stringp 1" whenever I open a C source code.
Looks like (semantic-mode 1)
is causing the issue. Any help is appreciated.
I am using emacs 24, and I didn't see this issue if I use cedet that comes with emacs.
EDIT : Stack trace attached. Will send this to cedet-delevel mailing list also. .~/.semanticdb is not created yet( new laptop ).
Debugger entered--Lisp error: (wrong-type-argument stringp 1)
string-match("\n" 1 0)
split-string(1 "\n")
semantic-cpp-defs(1)
semantic-gcc-setup()
semantic-default-c-setup()
semantic-new-buffer-fcn()
semantic-mode(1)
eval-buffer(#<buffer *load*> nil "/home/sudheesh/Dropbox/cedet_new.el" nil t) ; Reading at buffer position 898
load-with-code-conversion("/home/sudheesh/Dropbox/cedet_new.el" "/home/sudheesh/Dropbox /cedet_new.el" nil nil)
load("/home/sudheesh/Dropbox/cedet_new.el" nil nil t)
load-file("~/Dropbox/cedet_new.el")
SOLVED:
This issue is solved now. I haven't installed g++ compiler. The issue is because of this. Installing g++ compiler solved this issue. Thanks to the support of David Engster from cedet-dlevel mailing list.

ELPA/Marmalade reports "cannot open load file" for ~/.emacs.d/elpa/archives/-pkg

I have installed Marmalade and downloaded some interesting packages. But now, when I start Emacs I get this error:
Cannot open load file: c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/archives/-pkg
If I use --debug-init, I get:
Debugger entered--Lisp error: (file-error "Cannot open load file" "c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/archives/-pkg")
load("c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/archives/-pkg" nil t)
(if (file-directory-p pkg-dir) (load (concat pkg-dir ... "-pkg") nil t))
(let ((pkg-dir ...)) (if (file-directory-p pkg-dir) (load ... nil t)))
package-load-descriptor("c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/" "archives")
(lambda (name) (package-load-descriptor dir name))("archives")
mapc((lambda (name) (package-load-descriptor dir name)) ("anything-1.287" "anything- complete-1.86" "anything-config-0.4.1" "archive-contents" "archive-contents~" "archives" "auto-indent-mode-0.35" "builtin-packages" "builtin-packages~" "clojure-mode-1.7.1" "clojurescript-mode-0.5" "coffee-mode-0.3.0" "color-file-completion-1.0.1" "color-theme-6.6.1" "color-theme-eclipse-0.0.2" "color-theme-github-0.0.3" "color-theme-railscasts-0.0.2" "color-theme-twilight-0.1" "css-mode-1.0" "drag-stuff-0.0.3" "evernote-mode-0.41" "find-file-in-project-2.0" "flymake-coffee-0.4" "flymake-haml-0.5" "flymake-ruby-0.4" "flymake-shell-0.5" "haml-mode-3.0.14" "highlight-parentheses-1.0.1" "html-script-src-0.0.2" "inf-ruby-2.1" "js-comint-0.0.1" "js2-mode-20090814" "lua-mode-20100617" "package.el" "package.el~" "project-local-variables-0.2" "ruby-compilation-0.7" "ruby-electric-1.1" "ruby-mode-1.1" "slime-20100404" "tabbar-2.0.1" "tabbar-ruler-0.2" "yasnippet-0.6.1" "yasnippet-bundle-0.6.1" "zenburn-1.8"))
(if (file-directory-p dir) (mapc (lambda ... ...) (directory-files dir nil "^[^.]")))
(lambda (dir) (if (file-directory-p dir) (mapc ... ...)))("c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/")
mapc((lambda (dir) (if (file-directory-p dir) (mapc ... ...))) ("c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/" "/usr/share/emacs/site-lisp/elpa/"))
package-load-all-descriptors()
package-initialize()
(progn (package-initialize))
(if (load (expand-file-name "~/.emacs.d/elpa/package.el")) (progn (package-initialize)))
(when (load (expand-file-name "~/.emacs.d/elpa/package.el")) (package-initialize))
eval-buffer(#<buffer *load*> nil "c:/Documents and Settings/Carlos/Datos de programa/.emacs" nil t) ; Reading at buffer position 9019
load-with-code-conversion("c:/Documents and Settings/Carlos/Datos de programa/.emacs" "c:/Documents and Settings/Carlos/Datos de programa/.emacs" t t)
load("~/.emacs" t t)
#[nil "\205\264
This file doesn't exist. I've tried searching for this problem with Google but I didn't find anything.
Easy. For whatever reason, the package.el you're now using is the "classic" version from http://tromey.com/elpa/package.el. It's wildly incompatible with recent versions of package.el. How you managed to install Marmalade packages using that version, I don't know; you must have had a different version of package.el when you installed those packages, perhaps because you were using a newer Emacs at the time.
The fix is to use the version bundled with your Emacs (if it's new enough to have one), or to replace your ~/.emacs.d/elpa/package.el with this version instead, as described in the Marmalade instructions.
I've stumbled upon this question while trying to solve a similar problem. In my case, forcing package-initialize have solved the problem:
;; init.el
(require 'package)
(package-initialize)
Even though I did not read the source code for package.el, I believe some kind of laziness in package.el is cousing the problem. Athough this is and old question, I wanted to answer, in case someone else need some help.
For more information on Emacs start-up, see http://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html.
Adding a file, not directory, using touch ~/.emacs.d/elpa/archives/-pkg solved it for me.
I think it may just go away if you manually create a directory at:
c:/Documents and Settings/Carlos/Datos de programa/.emacs.d/elpa/archives/-pkg
In my case I had to add this directive to tell emacs where it can find the files required:
First this line
(add-to-list 'load-path "~/.emacs.d/")
And the required package ...
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))