elisp

"open buffer here" in emacs (ido-mode)

I am using emacs in ido-mode. When selecting a desired buffer, instead of the buffer showing up in the current window I will be taken to a separate frame and window in which the buffer is already open. Is there a way to modify (turn off) this behavior? It seems like something I expect from (pop-to-buffer) but in ido.el there is no such r...

Emacs: Set/Reset python debug breakpoint

I use python debugger pdb. I use emacs for python programming. I use python-mode.el. My idea is to make emacs intuitive. So I need the following help for python programs (.py) Whenever I press 'F9' key, the emacs should put "import pdb; pdb.set_trace();" statements in the current line and move the current line to one line below. Senten...

Change X11 window title after emacs started

When I start emacs, I can use the --title= option to control the title of the x-window that holds the emacs application. Is it possible to change the title after emacs starts from elisp? ...

How to gracefully exit SLIME and EMACS

Hi All, I have a question regarding how to "gracefully exit SLIME", when I quit Emacs. Here is the relevant portion of my config file: ;; SLIME configuration (setq inferior-lisp-program "/usr/local/bin/sbcl") (add-to-list 'load-path "~/Scripts/slime/") (require 'slime) (slime-setup) ;; configure SLIME to gracefully quit when emacs ;;...

Emacs - Can't get buffer-offer-save working

I would like to have Emacs ask me whether I want to save a modified buffer, when that buffer is not associated with a file. To open a new buffer (not visiting a file) I have the following function in my .emacs file: ;; Creates a new empty buffer (defun new-empty-buffer () "Opens a new empty buffer." (interactive) (let ((buf (gene...

Convert decimal <-> hex

Given a list of decimal numbers, how can each number be converted to its equivalent hexadecimal value, and vice versa? For example: (convert2hex 255 64 64); -> (FF 40 40) (convert2dec FF 40 40); -> (255 64 64) (convert2hex 255 64 64 255 64 64 128) (convert2dec FF 40 40 FF 40 40 80) ...

dired mode single window? (emacs)

Hi, is there a way to have dired operate in a single window so that when I traverse through directories I don't have n number of dired buffers for the intermediate directories? However - if I start another dired buffer in a completely separate directory (from the minibuffer rather than hitting [enter] on a subdirectory in an already open...

What elisp or macro magic can make this text transformation?

I have a set of SQL statements formatted like so: INSERT INTO reports.workload (workload_id,event_time,event_type_id,agent_id) VALUES (-42000,'2010-02-23 07:30:38.941436',1,NULL); Right now, the VALUES tuple is aligned at the start with the column name tuple. However, what I want is to have the tuple's el...

Emacs: highlighting TODO *only* in comments

This question is related to another one, Emacs :TODO indicator at left side. I recently came across a minor mode I like a lot called FixmeMode. It supports auto highlighting of TODO marks, and navigating between them. However, I think it makes more sense to recognize the "TODO" strings only in comments, rather than polluting the whole fi...

Changing font-lock color in SMerge mode

In Emacs 23.1 I'm opening up a file with conflict markers from a svn merge and consequently it opens it up in SMerge mode. The conflicted text is highlighted in bright yellow. From what I could find this is whatever the font-lock color is set to, correct? I'd like to change the highlight color in SMerge mode. What would I need to a...

How to choose system type in Emacs

Hello all, I'm trying to configure my .emacs file to work in a Windows, Linux, and Mac environment--specifically, I need it to choose the correct font and a certain directory for org-mode. I have tried the following which loads the correct font, but does not load the path specified for org-mode: ;; On Windows (if (eq system-type 'win...

Adding Completion to (interactive)

Is there any way to add my own completion to an (interactive) elisp function? Ideally, I'd like to pass it a list of strings that it would tab-complete from. I know that using (interactive "D"), (interactive "F") or (interactive "b") give you completion for directories, files and buffer-names respectively, but what about more general inp...

Emacs: same buffer, two windows, one narrowed, one not

I find the narrow-to-region command useful, however it applies to the buffer and not to the current window. I'd like to have one window display a narrowed version of the buffer, while the buffer is displayed widened if it occurs in any other window. Is this possible? ...

I can't find this: How do I use 4 SPACES instead of a TAB in EMACS?

I am making the jump to EMACS, and I can't find what I need to do in my .emacs file to get php-mode AND all other modes to insert 4 spaces instead of a TAB. Help? UPDATE: When I hit tab I still get 8 spaces in a plain file with the given answers. In php-mode I still get 2 spaces. Hitting tab in php mode does nothing, tab in regular EMA...

Auto-detect language in Emacs

If i have a Python (or any other language) file in a buffer in fundamental mode, is there a command that i can use to make the buffer auto detect what language it should be in and switch accordingly? ...

How do I change Zencoding-mode.el to make the <a> tag unfold into <a href=" " target=" "> ?

Would like to use this mode more. If I could customize this then I think it would make it much more usable! ...

matching keys in association lists in emacs lisp

Hi, I'm using folding-mode in emacs and was trying to make a function to insert the appropriate folding marker (start or end) depending on mode. So far I have (defun insert-folding-mode-mark () (interactive) (let ((st "##{{{") (en "##}}}") string-to-insert) (save-excursion (setq string-to-insert ...

Overriding a function in Emacs Lisp

I would like to temporarily override the kill-new function. I have a way I want to reimplement kill-new that works in only in certain contexts, but I don't want to reimplement a special version of kill-region on top of that. (kill-new is called from kill-region) Since Emacs Lisp uses dynamic scoping, this should be possible, right? (...

How to edit multiple strings in emacs at sametime?

I want edit multiple strings at once by selection the list of strings needs to edit. After selection, when I type, it should modify all the text in the selected strings. How to achieve multiple string edit? ...

Add Keyboard Binding To Existing Emacs Mode

I'm attempting my first modification of Emacs. I recorded a little keyboard macro and had Emacs spit it out as elisp, resulting in: (setq add-docstring "\C-rdef\C-n\C-a\C-m\C-p\C-i\C-u6\"\C-u3\C-b") (global-set-key "\C-c\C-d" 'add-docstring) Searching the Emacs reference, though, revealed that C-c C-d is already bound in diff mode...