elisp

What is in your .emacs file?

Hey Emacs users. I've started to use Emacs and I've been looking up ways to improve my .emacs file. Some of the stuff goes over my head. But what I wanted to know is what is in your .emacs file that your couldn't go without. ...

How to display autocomplete choices in emacs?

I'm working on autocompletion implementation in emacs for haxe programming language. I already figured out how to obtain list of autocompletions which I wants to present. The list is in format: '((name1 type1 desc1) (name2 type2 desc2) ... I want to display to user list containing text in format "name1 type1" after cursor position ...

Are there any emacs key combinations reserved for custom commands?

If I want to create a custom key combination to run a command, are there any keyboard shortcuts reserved for this? I always find it difficult to decide on which shortcut to override because I'm not sure what commands I shouldn't override and which commands plugins I may install in the future will try to set. ...

How do I Pass a Function as a Parameter in Emacs?

I'm trying to add a function I created to a hook, but the obvious (to my Schemer mind) way doesn't seem to work. The function is used in 2 places and I want to keep my code DRY so no anonymous function. Though I could wrap my function in a lambda, there must be a better way. Doesn't work: (defun my-function () ;; do my stuff) (add-...

How do I do cross-project refactorings with ropemacs?

I have a file structure that looks something like this: project1_root/ tests/ ... src/ .ropeproject/ project1/ ... (project1 source code) project2_root/ tests/ ... src/ .ropeproject/ project2/ ... (project2 source) I'm frequently switching back an...

Emacs-Lisp: How to package emacs-lisp program as PC application?

Just wondering if it's possible to package and deploy emacs and Lisp program as PC application such that once downloaded, running setup.exe (kind of), then the user can start application to make emacs run the specific Lisp program as if the application were implemented by other languages and platform, such as .Net, or Python. With this...

let and flet in emacs lisp

Greetings. I wonder if there is an emacs lisp veteran out there - I don't know if you would call it the canonical formulation, but to bind a local function I am advised by the GNU manual to use 'flet': (defun adder-with-flet (x) (flet ( (f (x) (+ x 3)) ) (f x)) ) However, by accident I tried (after having played in Scheme for a...

How do I byte-compile everything in my .emacs.d directory?

I have decided to check out Emacs, and I liked it very much. Now, I'm using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to default install of Emacs. I have customized it a little, added some stuff like yasnippet, color-themes, unbound, and other stuff. I've set up a github repository where ...

How to automatically save files on lose focus in Emacs.

Is it possible to configure Emacs, so that it saves all files when the emacs window loses focus? ...

emacs list-buffers behavior

In GNU emacs, every time I hit Ctrl-x Ctrl-b to see all of my buffers, the window is split to show the buffer list, or if I have my window already split in 2 (for instance, I will have a shell running in the lower window), the buffer list appears in the other window. My desired behavior is for the buffer list to appear in my active win...

How do I swap CTRL and CAPS LOCK on Carbon Emacs on OSX without doing it OS-wide?

I've recently started learning emacs since I was unhappy with Textmate and as a starting point read the "Effective Emacs" article by Steve Yegge. I was very keen on his CTRL -> CAPS LOCK swap, but I don't want to do it OS-wide, I want this swap to only occur in emacs every time I run it. I was wondering if there's a way to do this in th...

In need of an emacs-lisp function to open certain file types as read only.

I have been using emacs for some time now and am slowly getting the hang of things. However, I don't know enough emacs-lisp to implement the following functionality: I want to define a list (say prog-modes), which will be a list of the programming modes I use (.c, .cpp, .h, .el, .py). If the file I'm opening is of a type mentioned in th...

Command to center screen horizontally around cursor on emacs?

I'm familiar with and use very frequently the C-l (recenter-top-bottom) to Move current line to window center, top, and bottom, successively. I'd like to have an equivalent command to move the current column to window center, left and right borders, successively. Either built-in or a snippet of Elisp. ...

Error in emacs elisp when binding a lambda to a key

I am getting a "Wrong type argument: commandp, (lambda nil (forward-line 5))" here. (global-set-key [?\M-n] '(lambda () (forward-line 5))) What is the error? I'm fairly sure it's simple & I'm missing something obvious. ...

How to create buffer similar to *compilation* in Emacs?

I have an asynchronous process in Emacs, which creates a TAGS file. This process creates a process buffer called *ctags*. If the process result is "finished\n", I kill the buffer. If the process result is anything else I want to display the process buffer similar to the *compilation* status output when running M-x compile. I.e. I w...

longlines mode in Emacs

Hi, I recently discovered longlines mode in Emacs (after having been a regular user for 5 yrs!). So I set in my .emacs file (add-hook 'text-mode-hook 'turn-on-auto-fill) (add-hook 'text-mode-hook 'longlines-mode) (do I still need auto-fill? I can't tell...) which also sets org-mode to operate in longlines-mode as well. This seems t...

How to disable cursor in emacs when emacs doesn't have focus?

I'm using emacs 22.3.3 over X on a Windows box. When I've switched to another window, the cursor stays enabled (which means if it's blinking, it still blinks). Every other program I've ever used disables the cursor when the window doesn't have focus. Since emacs is different, I keep accidentally typing input meant for emacs into other ...

how to avoid accidentally killing text in emacs?

I have a highlighting mode (forget what it's called) that shows me, through highlighting the text, what region I have selected between mark and point. this comes in very handy when killing regions. However, sometimes, even when no text is visibly highlighted but i accidentally press C-w it still occasionally kills some text. My question ...

How do I get the number of days in the month specified by an elisp time?

In elisp I have a time in the (form of three integers), and I can get the month using decode-time. What I'd like to get is the number of days in that month (and year), using elisp functions (rather than write my own). i.e: (defun days-in-month-at-time(t) ; Figure out month and year with decode-time ; return number of days in th...

What's the best way to handle multiple like-named files in emacs?

One problem that I have with emacs is that it doesn't seem to handle like-named files in different directories very well. For example, if I'm not careful, I'll end up with 20 __init__.py buffers open. What I've been doing is using M-x rename-buffer and renaming it to indicate what package it's within. However, doing this manually is s...