org-mode broken dynamic clock: Symbol's function definition is void: org-defvaralias - emacs

For months I've been enjoying use of the org dynamic clock block (C-c C-x C-r) to help with my hour clocking. Suddenly I find it's not working, though. The only things I've changed is downloading the list-packages org-contrib and org-mode.
M-x org-version
Org-mode version 7.8.11
Attempt to update/add dynamic block (C-c C-x C-r)
Symbol's function definition is void: org-defvaralias
I tried to do manual execution of defuns in some of the org .el files, but that just made things worse. Any suggestions on the cleanest way to fix this?
I actually can't even clock-in anymore, with the same error.
I have verified that this is a result of the org-contrib install from ELPA, which seems to break it. This is sad, since I was putting good use to other org-contrib files.

I finally got around to fixing this. The key resource was http://orgmode.org/manual/Installation.html, and the solution boils down to two things I was doing wrong when I tried to install through the list-packages:
Remember to start have emacs running without having opened ANY org files or org-config settings. Best way to do this is M-xkill-emacs and start again with emacs -q.
Add to the top of your .emacs file:
;; Configure before loading org mode (package-initialize)
(package-initialize)
I've written a little more about it here.

I don't know if that helps, but you could try:
M-x load-library RET org-compat RET.
Even if it works, this is not the solution, simply an ugly workaround.
Try asking your question on the orgmode mailing list, it gets more audience there.

Related

emacs scratch not interactive mode

I updated a lot of packages that I had directly from github to the MELPA packages. Nonetheless something really weird happened to my *scratch* buffer. The default message is not appearing (the buffer is completely empty), and also the interactive elisp mode is not set (let's say I write (+ 2 2) and then hit C-j and it tells me invalid function). I have no idea why. I don't even know how to debug it to check where the error is. Any ideas?
Finally the problem was generated by flycheck-add-next-checker, for some reason, using the MELPA repositories is generating this error. I just commented the following part of my configuration file.
(eval-after-load 'flycheck
'(progn
;; Add Google C++ Style checker.
;; In default, syntax checked by Clang and Cppcheck.
(flycheck-add-next-checker 'c/c++-clang
'(warnings-only . c/c++-googlelint))))

org mode with clojure - can't get export to work

EDIT I've also asked this question on emacs.stackexchange
I'm a relative emacs newbie and have set up my emacs (24.4.1) to work with clojure as described here.
The gist of it is that I am now using the latest org-mode from git and loading it in my init.el (I am using prelude btw) as below:
(add-to-list 'load-path "~/repos/org-mode/lisp")
(require 'org)
(require 'ob-clojure)
I am trying to use org to write a literate clojure program that I can export to markdown. Clojure and babel now work well, evaluation works etc, but when I try to export my org file I get an error.
load-with-code-conversion: Symbol's value as variable is void: p
The stack trace when I set toggle-debug-on-error is:
Debugger entered--Lisp error: (void-variable p)
eval-buffer(#<buffer *load*> nil
"/Users/krisfoster/repos/org-mode/lisp/ox.el" nil t)
; Reading at buffer position 229233
load-with-code-conversion("/Users/krisfoster/repos/org-mode/lisp/ox.el"
"/Users/krisfoster/repos/org-mode/lisp/ox.el" nil t)
autoload-do-load((autoload "ox" "Export dispatcher for Org mode.\n
\nIt provides an access to common export related tasks in a
buffer.\nIts interface comes in two flavors: standard and
expert.\n\nWhile both share the same set of bindings, only the
former\ndisplays the valid keys associations in a dedicated
buffer.\nScrolling (resp. line-wise motion) in this buffer is done
with\nSPC and DEL (resp. C-n and C-p) keys.\n\nSet variable `org-
export-dispatch-use-expert-ui' to switch to one\nflavor or the
other.\n\nWhen ARG is \\[universal-argument], repeat the last
export action, with the same set\nof options used back then, on
the current buffer.\n\nWhen ARG is \\[universal-argument] \\
[universal-argument], display the asynchronous export
stack.\n\n(fn &optional ARG)" t nil) org-export-dispatch)
command-execute(org-export-dispatch)
I tried to resolve this by (require-ing the various org export packages, the ones in the clone of the org git repo that is, from within my init.el. But no dice - in fact that generated yet more issues. I have tried debugging but can't figure out what is wrong. I am suspecting I need to be requiring something but don't know what.
I have my init.el here - init.el gist
Any-one have any ideas what I am doing wrong?
Thanks in advance.
There was a bug in org-mode around the time you made this post, so the problem may be resolved. However, I noticed a few issues with your init file. Some things which might help
Use the lisp package manager to install your packages (ELPA). This will make your life much easier. The org guys maintain an ELPA repository which is updated regularly and will likely be a little more stable than just pulling in the repo. They have a version called org-plus-contrib which I use and find quite good. Just add
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
You state that your running prelude, but I can't see anything in your init which is loading prelude (only a call to a function which turns off the guru-mode). Prelude is pretty good and quite popular, but if your going to use it, you need to 'drink the cool aid' that is, do things in the prelude way. For example, prelude comes with org-mode and uses ELPA to install it. You need to be careful your not get a blend of org versions. Another alternative to prelude which I found very good is Steve Purcell's emacs.d. I found it a little easier to work with YMMV, but it may be worth checking out as it has good support for the mac. See emacs.d
It is a really good idea to break up your emacs init script into separate files. This makes it easy to comment out lots of stuff when your trying to track down a problem and allows you to just focus on the key bits your trying to get working. I maintain my init.el file as an org file and use babel to generate all the lisp code. You can have a look at it on github. I originally started with Purcell's emacs.d and then borrowed with pride (stole) much of it to go into my own config. It isn't a fine example of how to configure emacs, but might help with your setup
I notice your attempting to use cider as the backend 'evaluator' for clojure code. Note that you only need to do this if you want to have blocks of clojure in your org file which you want to evaluate and then use the result. You don't need to do this if all you want to do is generate *.clj files from your org code. Instead, you just want to 'tangle' your org file, which will generate the updated clj source files, which you can then work on. This keeps things a lot simpler and avoids problems arising when you try to do things with your org file that attempt to evaluate the clojure code and fail. Note also that I expect you would need to do a bit more than just set cider as the backend evaluator - cide is just an interface to a repl. You would need a repl as well.

eval-when-compile not being honored?

I'm attempting to install ace-jump-mode for emacs 24.1.50.1.
I've installed it with M-x package-install, and calling M-x ace-jump-mode activates it and prompts for a letter, but upon entering a letter, I get the error:
Symbol's function definition is void: every
Running emacs -q (and then running (add-to-list 'load-path "~/.emacs.d/elpa") like I have in my .emacs file) allows me to load ace-jump-mode and it functions without an issue. Assuming thus that the error exists in my .emacs, I commented out everything in my .emacs, and reopened emacs regularly, but still get the error.
From some searching around, I think the issue is the code in ace-jump-mode.el
(eval-when-compile
(require 'cl))
is not working correctly when I don't use emacs -q. When I M-x load-library cl, everything works fine.
I imagine that since I can't find any references to this online, its not a common bug, so it must be an issue with my config. I know I could just load cl in my .emacs, but I don't see the need to load the entire package just for one function.
Does anyone know how to fix this? Or, how to load only one function from cl?
Thanks.
Emacs is self documenting, C-h f every will show you that this
function is defined in cl-extra not cl, but loading cl autoloads it, so
it does become available.
Some things with how cl is loaded may have changed with Emacs 24, which
broke this library, I'm not certain. Like you found out, the easiest fix is
to just
(require 'cl)
in your init file. This isn't as a big deal as you make it out. A lot of
libraries you might use will do this anyway, so it's likely you're just
changing the order things get loaded.
The alternative is to just submit a patch to the author of ace-jump-mode
that avoids using every, which is more inconvenient.
Finally, if you ever got ace-jump-mode to work it was because you loaded the
uncompiled ".el" file instead of the compiled ".elc" file, which would have
run (require 'cl), meaning that both cl and cl-seq will have been loaded
somewhere along the way. So there is no magic that can make this work
without loading those files.
(eval-when-compile <foo>) means that <foo> is only executed when compiling the file (or when running it uncompiled). So if you compile your file, the resulting file won't load cl, which is a problem since every is only defined when cl is loaded. (eval-when-compile <foo>) is used to load macros (such as ignore-errors), since these are only needed during compilation, but every is not a macro, hence your problem.

Trying to edit init.el to customize emacs

So I'm relatively new in trying to customize emacs. But I really need to customize is asap. Tabs are a pain in emacs as they are two spaces, and the text is all messed up when it is opened with any other editor after that.
Currently, I only have few lines in my ~/emacs.d/init.el file:
(setq load-path (concat (getenv "HOME") "/.emacs.d/"))
(set-scroll-bar-mode 'right)
(require 'linum)
(global-linum-mode t)
I get an error while starting up emacs:
Loading encoded-kb...done
An error has occurred while loading `/Users/mycomp/.emacs.d/init.el':
Symbol's function definition is void: set-scroll-bar-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
I tried srtating it with the --debug-init option, but my lisp knowledge is not enough to help me figure out what's wrong. Any help on how to get this working or redirecting me to some GOOD tutorials on editing init.el files will be really helpful (yes i did google tutorials on editing the initialization file, but every one of them was terrible).
I'm assuming my code for getting line numbers on the left is also wrong. Could someone please help me with this? Thanks a lot.
I think this line may be the problem:
(setq load-path (concat (getenv "HOME") "/.emacs.d/"))
First of all, I don't think this is required to load ~/emacs.d/init.el. Secondly, if you do want to add a directory to your load-path, you should probably be doing it like this instead:
(add-to-list 'load-path "~/.emacs.d/")
This code adds the directory to the load-path, your code just clobbers it with the single directory.
Use 'M-x apropos' and 'M-x customize-apropos'. For now, those will make your life much easier when you want to customize things.
For instance, to customize things to do with scrolling, 'M-x customize-apropos RET scroll RET' will give you a list of all things that you can customize that have 'scroll' in them. You can look around and find the things that you want by searching the buffer. If you find a particular thing that you want, there's usually a group that it belongs to. You can click on that, and just customize those particular values. Make sure you save the settings.
It might take you a while to figure out what things are called. If you've got an idea, try the apropos search. If that doesn't turn up anything, google can probably sort it out for you.
For now, don't worry about hacking the elisp. This method will write values to your startup file (probably the .emacs?) and you can look and check the syntax later if you're really interested. I customize most of my stuff this way; I only bother actually modifying the file by hand when I'm trying to write my own hooks or functions.

In Emacs, how do I figure out which package is loading tramp?

I have a strange interaction with tramp and cygwin-mount (I think: Emacs: Tab completion of file name appends an extra i:\cygwin). Because of this, I want to disable tramp. I'm unable to find anything in my .emacs which is loading tramp explicitly. I can see "Loading tramp..." when I hit a tab in the find-file minibuffer. I'd like to figure out what package is causing the loading of tramp and disable that. How do I go about doing this? I tried searching for (require 'tramp) but couldn't find anything interesting. The only other option I can think of is to comment out bits of my .emacs one-by-one and see which one works - but this is so brute-force, I'd like a cleverer (and easier) way.
What a great question! If only because I was not aware of the function (eval-after-load file form) which will enable you to write code like the following and put it in your .emacs file:
(eval-after-load "tramp"
'(debug))
Which will, in brute force form, vomit a backtrace in your window and reveal the offending library.
I think you'll find that tramp is turned on by default. If you do:
M-x customize-apropos
Customize (regexp): tramp
('Customize (regexp):' is the prompt from emacs) you'll see two variables listed (at least I do in emacs 23), something like:
If you set tramp-mode to 'off', save for future sessions, and restart emacs tramp should no longer be loaded. I believe you can just turning it off in the current session should allow you to test this, but this doesn't always work with customize variables, although it should do with something like tramp that is part of the standard emacs distribution.
I don't have emacs 22 installed any more, but something similar should work for that too.
I had a similar problem with tramp, when one day I found
"/C:\...\debuglog.txt" on my system.
Because of that file, auto-complete was invoking tramp each time
I entered "/". And tramp was of course giving an error.
auto-complete was calling
(expand-file-name ...)
which, because of the current file-name-handler-alist, was calling tramp.
My solution was:
(delete-if
(lambda (x)
(or (eq (cdr x) 'tramp-completion-file-name-handler)
(eq (cdr x) 'tramp-file-name-handler)))
file-name-handler-alist)
Instrument find-file for debugging and/or instrument your init file for debugging. Then you can step through the loading and see where the tramp stuff is loaded.