Emacs: how to stop jedi? - emacs

I regularly use jedi.el, it works great. But I don't know how to stop it !
I manually call it with jedi:setup (which turns jedi-mode on) and try to stop it with jedi-mode but it has no effect. It is unconvenient and it gets in the way with yasnippet.
Do you have a solution ? Thanks.
config: emacs24 and latest jedi.el version from melpa. Result of jedi:show-setup-info:
;; Emacs Lisp version:
(:emacs-version "24.3.1" :jedi-version "0.2.0alpha2" :python-environment-version "0.0.2alpha0")
;; Python version:
((:version "2.7.3 (default, Feb 27 2014, 19:58:35) \n[GCC 4.6.3]" :name "sys" :file nil)
(:version "0.7.0" :name "jedi" :file "/usr/local/lib/python2.7/dist-packages/jedi/__init__.pyc")
(:version "0.0.5" :name "epc" :file "/usr/local/lib/python2.7/dist-packages/epc/__init__.pyc")
(:version "0.0.3" :name "sexpdata" :file "/usr/local/lib/python2.7/dist-packages/sexpdata.pyc"))
;; Command line:
(:virtualenv "/usr/bin/virtualenv" :virtualenv-version "1.7.1.2\n")
;; Customization:
((jedi:complete-on-dot)
(jedi:doc-display-buffer . display-buffer)
(jedi:doc-hook view-mode)
(jedi:doc-mode . rst-mode)
(jedi:environment-root)
(jedi:environment-virtualenv)
(jedi:get-in-function-call-delay . 1000)
(jedi:get-in-function-call-timeout . 3000)
(jedi:goto-definition-config
(nil nil nil)
(t nil nil)
(nil definition nil)
(t definition nil)
(nil nil t)
(t nil t)
(nil definition t)
(t definition t))
(jedi:goto-definition-marker-ring-length . 16)
(jedi:imenu-create-index-function . jedi:create-nested-imenu-index)
(jedi:import-python-el-settings . t)
(jedi:install-imenu)
(jedi:install-python-jedi-dev-command "pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git#dev#egg=jedi")
(jedi:key-complete .
[C-tab])
(jedi:key-goto-definition .
[67108910])
(jedi:key-goto-definition-pop-marker .
[67108908])
(jedi:key-related-names . "r")
(jedi:key-show-doc . "d")
(jedi:server-args)
(jedi:server-command "python" "/home/vdardelx/.emacs.d/elpa/jedi-20140321.1323/jediepcserver.py")
(jedi:setup-keys)
(jedi:tooltip-method pos-tip popup)
(jedi:use-shortcuts)
(python-environment-default-root-name . "default")
(python-environment-directory . "~/.emacs.d/.python-environments")
(python-environment-virtualenv "virtualenv" "--system-site-packages" "--quiet"))

What aspect is conflicting with yasnippet? Is it the use of autocomplete-mode? (which seems to be the other broad consequence of running jedi:setup, and which isn't turned off again when jedi-mode is disabled.)
M-x autocomplete-mode will toggle that off again, or call (autocomplete-mode -1) in code.
You could write a function to disable both modes together, and call that to turn jedi off. A more robust approach would remember the state of autocomplete-mode at the time jedi was enabled in order to restore it afterwards, but it sounds like that's not critical in your case.

Related

Generating inline javascript with cl-who, parenscript and hunchentoot

I'm trying to generate inline javascript, but I have to put the parenscript code inside (:script) and (str) tags using cl-who. ps, ps*, ps-inline and ps-inline* don't seem to make much difference to the generated js.
Is the usual way to write a macro to avoid code duplication, or is there a better way?
Here's my program:
(in-package #:ps-test)
(defmacro standard-page ((&key title) &body body)
`(with-html-output-to-string (*standard-output* nil :prologue t :indent t)
(:html
:lang "en"
(:head
(:meta :http-equiv "Content-Type"
:content "text/html;charset=utf-8")
(:title ,title)
(:link :type "text/css"
:rel "stylesheet"
:href "/style.css"))
(:body
,#body))))
(defun main ()
(with-html-output (*standard-output* nil :indent t :prologue nil)
(standard-page (:title "Parenscript test")
(:div (str "Hello worldzors"))
(:script :type "text/javascript"
(str (ps (alert "Hello world as well")))))))
(define-easy-handler (docroot :uri "/") ()
(main))
(defun start-ps-test ()
(setf (html-mode) :html5)
(setf *js-string-delimiter* #\")
(start (make-instance 'hunchentoot:easy-acceptor :port 8080)))
(defun stop-ps-test ()
(stop *server*))
(defvar *server* (start-ps-test))
Macros are fine in this use case.
The trick is that macros are expanded in a specific order. Say
you define a js macro: when macroexpansion encounters
with-html-output, the inner call to your macros (js (alert "Ho Ho Ho")) looks like a function call, and is left as-is in the generated
code. If your js macro then expands into (:script ...), then the system will complain that :script is an unknown function (assuming you
didn't actually name a function like that). You should emit an
enclosing (who:htm ...) expression to interpret the code using
CL-WHO's code walker.
(defmacro js (code)
`(who:htm
(:script :type "text/javascript" (who:str (ps:ps ,code)))))
This only works in the context of an enclosing with-html-output.
For inline Javascript, you don't want to have a <script> tag around it,
and you can generally simply use ps-inline:
(who:with-html-output (*standard-output*)
(:a :href (ps:ps-inline (void 0))
"A link where the usual HREF behavior is canceled."))
;; prints:
;;
;; <a href='javascript:void(0)'>A link where the usual HREF behavior is canceled.</a>
But feel free to use a macro if you often do the same thing:
(defmacro link (&body body)
`(who:htm (:a :href #.(ps:ps-inline (void 0)) ,#body)))
(who:with-html-output (*standard-output*) (link "Link"))
;; prints:
;;
;; <a href='javascript:void(0)'>Link</a>

Org Babel Source Block Native Fontification

I'm trying to get org-babel source blocks to do native syntax highlighting. I've set org-src-fontify-natively to true, but am still not seeing anything.
Here's my related config:
(setq org-babel-default-header-args
'((:session . "none")
(:results . "replace")
(:exports . "code")
(:cache . "no")
(:noweb . "yes")
(:hlines . "yes")
(:tangle . "yes")
(:padnewline . "yes")))
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(R . t)
(js . t)
(clojure . t)
(org . t)
(sh . t)
(python . t)
(dot . t)
(prolog . t)
(lisp . t)
))
(setq org-edit-src-content-indentation 0
org-src-tab-acts-natively t
org-src-fontify-natively t
org-confirm-babel-evaluate nil
org-src-window-setup 'current-window
org-src-preserve-indentation t
org-src-strip-leading-and-trailing-blank-lines t
)
And here's the org-babel-view-src-block-info (C-c C-v I):
Lang: emacs-lisp
Properties:
:header-args nil
:header-args:emacs-lisp nil
Header Arguments:
:cache no
:exports code
:hlines yes
:lexical no
:noweb yes
:padnewline yes
:results none
:session none
:tangle yes
And my (emacs-version):
GNU Emacs 25.1.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1603))
of 2016-04-03

"Invalid read syntax: )"

I'm trying to change the default font in emacs. I followed the instructions on the emacs wiki and added:
(set-face-attribute 'default nil :font "Avenir" ))
(set-frame-font "Avenir" nil t)
to my ~/.emacs file ( I believe this is my init file as I am on a mac).
When I try to run emacs again I get
Warning (initialization): An error occurred while loading `/Users/name/.emacs':
Invalid read syntax: )
The debug message looks like this:
Debugger entered--Lisp error: (invalid-read-syntax ")")
eval-buffer(# nil "/Users/rex/.emacs" nil t) ;
Reading at bu$ load-with-code-conversion("/Users/name/.emacs"
"/Users/name/.emacs" t t) load("~/.emacs" t t) #[0 "^H\205\262^#
\306=\203^Q^#\307^H\310Q\202;^# \311=\204^^^#\307^H\312$
command-line() normal-top-level()
You have an extra right parenthesis.
(set-face-attribute 'default nil :font "Avenir" )
(set-frame-font "Avenir 13" nil t)

Emacs does not run after package updating

What should I do? After just updating packages my Emacs installation does not initialise. I tried the same process in two Macs with the same result. The error message (using --debug-init) is:
Debugger entered--Lisp error: (void-variable left)
powerline-reset()
require(powerline)
eval-buffer(#<buffer *load*-583073> nil "/Users/sergiobacelar/.emacs.d/starter-kit-misc.el" nil t) ; Reading at buffer position 2361
load-with-code-conversion("/Users/sergiobacelar/.emacs.d/starter-kit-misc.el" "/Users/sergiobacelar/.emacs.d/starter-kit-misc.el" nil nil)
load("/Users/sergiobacelar/.emacs.d/starter-kit-misc.el" nil nil t)
load-file("/Users/sergiobacelar/.emacs.d/starter-kit-misc.el")
org-babel-load-file("/Users/sergiobacelar/.emacs.d/starter-kit-misc.org")
starter-kit-load("starter-kit-misc.org")
eval-buffer(#<buffer *load*-903092> nil "/Users/sergiobacelar/.emacs.d/starter-kit.el" nil t) ; Reading at buffer position 3819
load-with-code-conversion("/Users/sergiobacelar/.emacs.d/starter-kit.el" "/Users/sergiobacelar/.emacs.d/starter-kit.el" nil nil)
load("/Users/sergiobacelar/.emacs.d/starter-kit.el" nil nil t)
load-file("/Users/sergiobacelar/.emacs.d/starter-kit.el")
org-babel-load-file("/Users/sergiobacelar/.emacs.d/starter-kit.org")
eval-buffer(#<buffer *load*> nil "/Users/sergiobacelar/.emacs.d/init.el" nil t) ; Reading at buffer position 2725
load-with-code-conversion("/Users/sergiobacelar/.emacs.d/init.el" "/Users/sergiobacelar/.emacs.d/init.el" t t)
load("/Users/sergiobacelar/.emacs.d/init" t t)
#[0 "\205\262 \306=\203\307\310Q\202; \311=\204\307\312Q\202;\313\307\314\315#\203*\316\202;\313\307\314\317#\203:\320\nB\321\202;\316\322\323\322\211#\210\322=\203a\324\325\326\307\327Q!\"\323\322\211#\210\322=\203`\210\203\243\330!\331\232\203\243\332!\211\333P\334!\203}\211\202\210\334!\203\207\202\210\314\262\203\241\335\"\203\237\336\337#\210\340\341!\210\266\f?\205\260\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
command-line()
normal-top-level()
There is a solution for this in https://github.com/milkypostman/powerline/issues/79. It seems to be a known bug in powerline.el.

Elisp help. Why does the following snippet fail?

I'm trying to write a little script that notifies me when someone talks to me in erc. So I need to write a funcion that recieves what I presume are two strings, nick and msg so I can hook it. But my test function fails. I have tested growl-notify and the format s-expresions and they work fine but I cant get test to work. I have no idea why is it failing. Any pointers?
(defun growl-notify (&key message)
"Use growl for notifications"
(start-process "growlnotify" "growlnotifications" "growlnotify" "-m " message))
(defun test (nick msg)
(growlnotify :message (format "%s: %s" nick msg)))
(test "Ppop" "something")
It gives the following backtrack, hope it helps.
Debugger entered--Lisp error: (void-function growlnotify)
(growlnotify :message (format "%s: %s" nick msg))
test("oi" "poi")
eval((test "oi" "poi") nil)
eval-last-sexp-1(t)
eval-last-sexp(t)
eval-print-last-sexp()
call-interactively(eval-print-last-sexp nil nil)
recursive-edit()
debug(error (wrong-number-of-arguments (lambda (&key message) "Use growl for notifications" (start-process "growlnotify" "growlnotifications" "growlnotify" "-m " message)) 3))
The error message is Debugger entered--Lisp error: (void-function growlnotify), which tells you that growlnotify isn't defined as a function.
If you look at your code, you'll see that you defined it like this: (defun growl-notify (&key message), which defines a function called growl-notify. A simple typo.