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.
Related
I'm trying to get doremi working in emacs. Specifically, at this stage, to allow me to quickly scroll through a condensed list of color-themes and see each theme as I go through it. For this I would use the 'M-x doremi-color-themes+' command.
What I've done:
Installed color-themes (successfull)
Installed doremi.el, doremi-cmd.el, ring+.el and added
(add-to-list 'loadpath "~/elisp/themes")
(add-to-list 'loadpath "~/elisp/doremi/")
(require 'color-theme)
(color-theme-initialize)
(color-theme-classic)
;; create a list of color themes to scroll through using 'doremi-cmd
(setq my-color-themes (list 'color-theme-classic
'color-theme-retro-green
'color-theme-gray30
'color-theme-subtle-hacker
'color-theme-jonadabian-slate))
(require 'doremi)
(require 'doremi-cmd)
(require 'ring+)
to the .emacs file.
What emacs does:
When I type the comand 'M-x doremi-color-themes+' into the mini-buffer it seems to accept that I've given it a valid command and tells me to use the and arrow keys to move through the list. But when I do that all that happens is the cursor moves up and down in the active window. No changing of color-themes.
Being somewhat new to emacs (and especially customising it) I'm sure I have missed a step or put something in the wrong place. Perhaps there's some sort of (setq 'bla-bla-bla (...)) I need to do?
Sorry for your trouble. Please state your Emacs version (M-x emacs-version), and your version of color-theme.el.
You do not need to require library ring+.el if you use Emacs 23 or later (its code was included in GnuEmacs 23.)
You do not need to use (color-theme-initialize) or (color-theme-classic). The former is done automatically by doremi-color-themes+.
Try starting from emacs -Q (i.e., no init file, ~/.emacs), to be sure there is no interference from stuff in your init file.
Your variable my-color-themes is not referenced anywhere. Instead of defining that variable, just customize user option doremi-color-themes. (Or leave its value nil, which means that all color themes will be cycled through.)
Feel free to contact me by email if you continue to have a problem. Or continue here, if you prefer.
[Just to be sure: you are using color-theme.el, right? There is a lot of confusion out there between Emacs "custom themes" and color themes. Do Re Mi supports both, but they are different critters.]
After a bit for back and forth with #Drew we found a solution to the problem.
It turned out the major problem was that I was using emacs in 'terminal mode' rather than as a GUI application. Bare in mind I'm using a mac.
In the context of Terminal, my arrow keys send escape sequences and so doremi cannot read the event as intended. So it just escapes and applies the message to the active buffer.
There is an answer.
By adding the following lines to my .emacs file (or whatever your init file for emacs is) I was able to redirect doremi to use two other keys. ie. not the up and down arrows.
(setq doremi-down-keys '(?n))
(setq doremi-up-keys '(?p))
Doing this tells doremi to use 'n' as the down key and 'p' as the up key. And all works just fine.
Because I am only new to the world of programming and computing I may often use incorrect terminology. If this is the case please let me know and I will edit accordingly for clarity and consistency.
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.
After adding the following code in my .emacs file, comes up some error during startup of emacs. I am a newbie of emacs, is there some one can help me figure out where are the errors come from?
Added code in .emacs:
;; Auto-saving the Desktop
(require 'desktop)
(desktop-save-mode 1)
(defun my-desktop-save ()
(interactive)
;; Don't call desktop-save-in-desktop-dir, as it prints a message.
(if (eq (desktop-owner) (emacs-pid))
(desktop-save desktop-dirname)))
(add-hook 'auto-save-hook 'my-desktop-save)
Errors:
Looking at the function definition for what's breaking, it seems that the error is that prj-file is NIL in line 492. (The other expand-filename call in the function shouldn't ever have a nil, since it's the car of a non-nil list of filenames).
Now, prj-file is the first filename in /home/shenyan/Test/memcached-1.4.11 matching the regexp "\\(Root\\)?ProjStep.ede" and presumably there isn't one. Since memcached presumably doesn't have an EDE project file, what's gone wrong must be that line 508's call to ede-project-p did something weird when called with this subdirectory of /home/shenyan/Test/.
I can't work out exactly why that happened, but you can debug things quite easily. First bring up your *scratch* buffer to type emacs lisp easily. To check my guess, insert the following code into the buffer
(ede-directory-project-p "/home/shenyan/Test/memcached-1.4.11")
and run it by hitting C-x C-e with cursor on the closing bracket. If it returns nil I was wrong. Otherwise, you've found the culprit and should probably debug it further by hunting through the bits of ede-directory-project-p in ede-files.el.
Probably what's going on is that your /home/shenyan/Test/ directory has something that tells EDE to search subdirectories (or maybe that's the default?) and then the memcached subdirectory has a file whose name makes EDE think it should be searched for a project file. If you work out exactly what happened, you might consider submitting a bug to the EDE developers: they probably shouldn't error out if the project file doesn't exist.
The question arises with connection to the problem of adding child dirs to the load-path. Here's a solution. Unfortunately - it seems to revert the load-path. I tried to fix it myself, but can't do and need help.
So my question is: how do I revert a load-path.
I tried (setq load-path (reverse load-path)) but it fails - which suggests that load-path is not a list...
Edit:
Reversing load path works, indeed - I don't know what I did wrong when I tried it before posting.
I'm facing a very strange problem simple.el shadows sunrise-commander.el - while it supposed to load before that. I thought - the problem is in the order in which I have dirs in a load path - but now - when I reversed the load-path - progmodes dir is before the sunrise one - the problem is still around. I'm puzzled.
I'll reformulate my question then: how do I make sure that a given extension is loading after the core Emacs's code?
Edit 2:
In case shadow doesn't mean, what I think - my actual problem is that many sunrise-commander and icicles keys are binded to core emacs functions. For example when I use icicles M-p is binded to
M-p runs the command recenter-top-bottom, which is an interactive
compiled Lisp function in `window.el'.
While it should be previous-history-element. Similarly, when I use sunrise-commander M-u is binded to
M-u runs the command subword-backward, which is an interactive
compiled Lisp function in `subword.el'.
while it realy should be sr-history-next.
Edit 3:
Oh I solved it! In the old days I used to install emacs things system-wide, thru synaptic package manager. Then I came with a resolution - that this way it is impossible to have my customizations with me. And after that I maintain a local emacs and emacs packages. So all I has to do is to remove all the system-wide emacs stuff.
** Edit 4**:
Nope it is not that. It way ErgoEmacs keybindings extension. After I commented it out I have M-n and M-p working fine in icicles. Though RET in Sunrise commander still calls dired function - not the sunrise one. Hopefully will solve it later.
Extensions are loaded by either require or load. The load-path simply specifies a list of folders in which require will search. Imagine you have the .emacs.d/vendor dir full of Emacs extensions and it's added to your load-path (the order of entries in the load path doesn't matter unless the same extension is in several of the folders there - something known as load-path shadowing, that can be examined with M-x list-load-path-shadows). You can do one of two things at this point:
(require 'extension)
;; or
(load "~/emacs.d/vendor/extension.el)
require has the added benefit, that it wouldn't load a library twice. So, to answer you question - to make sure that an extensions is loaded after the core (very few things are loaded automatically by Emacs) it just has to be required or loaded after the stuff you want it loaded after.
After you second edit I think you should take a look at this great article on keybindings in Emacs.
Not sure if it matters, but regarding "how do I load something before simple.el": you can't because simple.el is preloaded in the `emacs' executable, so it's loaded long before the .emacs is loaded.
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.