elisp

Insert whole month of dates in emacs lisp

I'm doing a bit of programming here and there in Emacs Lisp, but I'm not entirely sure how to go about certain things. I'm trying to insert a whole month of dates, each on a new line like the list below: January 01/01/09 Mon: 02/01/09 Tue: 03/01/09 Wed: etc How would I go about doing that? I've found how to format dates, but I can...

Emacs Elisp dynamic interactive prompt

Hello! I am trying to have a dynamic prompt from my elisp function. I want something like replace-regexp where it will show you the last regexp entered. I tried (interactive (concat "sab" "bab"))) that doesnt work! I also tried message like format (interactive "s %s" last-used-regexp) and that doesn't work! Anyone know how t...

Match regular expression as keyword in define-generic-mode

I'm trying to write a new mode for emacs, using define-generic-mode. I've found a few tutorials which show how you can add keywords (as strings) which will then be highlighted. Is it possible to give define-generic-mode a regular expression so that it can then highlight anything that matches that as a keyword? I'd like to have a mode in...

In Emacs Lisp, how do I check if a variable is defined?

In Emacs Lisp, how do I check if a variable is defined? ...

How do you use (list-at-point) in elisp?

I sometimes use (number-at-point), (string-at-point), (sexp-at-point) and I had a need for: (list-at-point) I want to be able to grab some text like: a b c d and use list-at-point to grab it as an elisp list, and then do some processing on it. But I can't seem to get list-at-point to return anything but nil. I'm using Emacs on win...

Function for finding and returning the match from a regular expression

I'm looking for a function which will try to find and return whatever was matched by the regular expression \\(\\S-\\) and probably nil if nothing was found. The search should start from (point) and search to the end of the document. ...

Interactive emacs lisp function to swap two words with eachother

My first foray into the quirky world of emacs lisp is a function which takes two strings and swaps them with eachother: (defun swap-strings (a b) "Replace all occurances of a with b and vice versa" (interactive "*sFirst Swap Word: \nsSecond Swap Word: ") (save-excursion (while (re-search-forward (concat a "\\|" b) nil t) ...

Emacs function to message the python function I'm in

I'm editing some Python code with rather long functions and decided it would be useful to quickly get the function name without scrolling up. I put this bit of code together to do it. Is there something built in to emacs in general, or the standard python mode in particular, which I can use instead? (defun python-show-function-name() ...

Does anyone have an Emacs macro for indenting (and unindenting) blocks of text?

Does anyone have an Emacs macro for indenting (and unindenting) blocks of text? And I mean "indent" in the commonly-understood sense, not in Emacspeak. In other words, I want to mark a region, press C-u 2, run this macro, and have it add two spaces before every line in the region. Or press C-u -2 before running the macro and have it re...

Unable to add a directory and all its subdirectories to load-path in Emacs

The question is similar to one. However, it differs in putting all subdirectories achievable in the folder too. Jouni's code which puts first level folders achievable (let ((base "~/Projects/emacs")) (add-to-list 'load-path base) (dolist (f (directory-files base)) (let ((name (concat base "/" f))) (when (and (file-direc...

Is there an Emacs Lisp library for generating HTML?

I'm looking for a solution that allows me to write native Emacs Lisp code and at compile time turns it into HTML, like Franz's htmlgen: (html ((:div class "post") (:h1 "Title") (:p "Hello, World!"))) Of course I can write my own macros, but I'm interested if there are any projects around this problem. ...

breaking a running emacs lisp program

I'm having a problem with an emacs lisp package that I pulled down from the ubuntu distribution. The package is JDEE, and it complains of 'Args out of range: "63", 0, 4' in the mini buffer and the Messages buffer whenever I open a file. This bug appears to have been reported last September but no action has been taken. I'm not an emac...

Emacs Modes: "Command attempted to use minibuffer while in minibuffer"

Scenario: I start to type M-x to type a command I switch to another emacs window/buffer because I realise I'm executing the command in the wrong window I start to type M-x again to execute the command in the correct window Result: I get the dreaded "Command attempted to use minibuffer while in minibuffer" This happens to me multiple...

Emacs: Preventing gud & pdb from controlling windows

I'm using pdb to debug Python programs and am unhappy with it's behaviour. I have the screen divided into multiple emacs windows, and when I execute pdb, it (randomly?) replaces one of the windows with the output of the *gud* debugger. Also, when a breakpoint is encountered, even if the debugging buffer is already visible in a wind...

How to maximize Emacs on Windows at startup?

This is driving me crazy: I simply want Emacs to maximize to whatever screen resolution I have at startup. Ideally I like a cross-platform (Windows & Linux) solution that works on any screen resolution, but I can't even get it to work on just Window XP with even hard-coded sizes. Here are what I tried: Setting the initial-frame-alist...

emacs working with big xml files

Often I need to read big XML files (> 100 MB) which have a fairly simple structure. I would like to use emacs, but it does not support big files very well. I am thinking maybe I can use a java application which can do SAX or StAX parsing for me and provide me with all necessary operations (e.g. search). What is the "right way" to communi...

Splitting window in Emacs Lisp function

I'd like to be able to run a shell command on the current file that I'm editing and have the output be shown in the Shell Command Output window. I've been able to define the function which is shown below. (defun cpp-check () "Run cpp-check on current file the buffer is visiting." (shell-command (concat "/home/sburke/downloads/c...

Emacs: Is there a way to generate a skeleton ChangeLog from diff?

I'd like to partly automate creation of GNU-style ChangeLog entries when working with source code in version control. The add-changelog-entry-other-window works with one file at a time and you have to visit the file to use it. What I'd like to see instead is to have some command that would take an output of diff -u -p (or have integrati...

Mapping Caps Lock to Control from within emacs on Windows

When reading either of these questions or the EmacsWiki article about mapping Caps Lock to Control in emacs in Windows, the best answers seem to involve the registry. My question is what a user can do when they can't modify the registry of the machine because they don't have admin rights. Is there a way to do the mapping from within emac...

How to preserve clipboard content in Emacs on Windows?

This is scenario that I ran into a few times: I copy some text from other program. Go to Emacs and did some editing before I paste/yank the text in. C-y to yank and voila ... not the text I intended to paste in. Then I realize that while I am moving things around, I used commands like kill-line and backward-kill-word, and those killed l...