elisp

How to handle conflicting keybindings

paredit binds M-<up> and M-<down>, but I want windmove to own those keybindings. I have paredit-mode set to activate in certain modes only, but windmove is set to run globally. I want windmove to win, but paredit steals those keybindings when it loads. How can I easily stop paredit from stomping on windmove's keybindings? I have been...

Where is the current version of the Emacs calc?

I lost my installation of Dave Gillespie's calc.el by reinstalling Cygwin. It is not included with the default Cygwin install of Emacs. Who is considered the master maintainer these days? Is version 2.02f still most current? ...

Regexps in Elisp to include newlines.

I'm trying to add a special markup to Python documentation strings in emacs (python-mode). Currently I'm able to extract a single line with: (font-lock-add-keywords 'python-mode '(("\\(\"\\{3\\}\\.+\"\\{3\\}\\)" 1 font-lock-doc-face prepend))) This works now: """Foo""" But as soon there is a newline like: """ Foo """ It ...

Elisp performance on Windows and Linux

I have the following dead simple elisp functions; the first removes the fill breaks from the current paragraph, and the second loops through the current document applying the first to each paragraph in turn, in effect removing all single line-breaks from the document. It runs fast on my low-spec Puppy Linux box using emacs 22.3 (10 seco...

sane tab in emacs

I want to override the insane default tabbing scheme in emacs so that it will work like most other editors (eclipse, notepad++). For some reason I can't get it to go. I found a tutorial online ( first google result ), but none of the things there seemed to work. I want to set it so that regardless of mode, tab will insert a tab, and...

How do I run an emacs hook when a buffer is modified?

Building on http://stackoverflow.com/questions/318553/getting-emacs-to-untabify-when-saving-files , I'd like to run a hook to untabify my C++ files when I start modifying the buffer. I tried adding hooks to untabify the buffer on load, but then it untabifies all my writable files that are autoloaded when emacs starts. (For those that wo...

Emacs M-x commands for invoking "GUI-style" menus

Question: How could I find out the M-x equivalent commands for doing GUI-based operations in Emacs, in those cases where my Emacs-variant uses OS-specific desktop functionality? Background: Conventional understanding states that everything in Emacs is a command, and that commands can be invoked via M-x, as long as you know the name of t...

Changing the behvaiour of backward-word and backward-kill-word

Hi, I have a small problem with the way the commands "backward-word" and "backward-kill-word" work. When I hit "backward-kill-word" on a line that is only white-spaces (for example, the first char of an indented line), the command will kill all the white-space, as well as the last word of the previous line. This behavior is completely ...

Help with an interactive Emacs Lisp function for replacing text

I've been using Emacs for a couple months now, and I want to get started in elisp programming. Specifically, I'd like to write my own interactive function. However, I'm more than a bit lost. (interactive ...) has tons of options and I'm not sure which one I want. Then, I don't really know the names of the functions I need. If someone cou...

Is there an emacs variable to turn off backup of files with a specific extension?

For example when editing various data files, the backup data is no use and actually trips up our tools. So I'd like to be able to disable backup for files containing a regexp in the name. justinhj ...

How to make Emacs sql-mode recognize MySQL #-style comments?

I'm reading a bunch of MySQL files that use # (to end-of-line) comments, but my sql-mode doesn't support them. I found the syntax-table part of sql.el that defines /**/ and -- comments, but according to this, Emacs syntax tables support only 2 comment styles. Is there a way to add support for # comments in sql.el easily? ...

Loop over variables in Lisp

I wrote the function (defun test () (let ((str1 "foo") (str2 "bar")) (loop for s in '(str1 str2) do (message s)))) but it does not work. The Elisp Backtrace message is: Debugger entered--Lisp error: (wrong-type-argument stringp str1) How can I make it work? P.S.: the following modified version works perfectly, but I need ...

emacs region highlighting

Is there a way to highlight a string in a text (but not ALL such strings) in a buffer where font-lock-mode is on. Let's imagine I have a buffer with SQL mode and I want to highlight a string in it. The following code does not work (set-text-properties 10 20 '(face hi-yellow)) When I call (font-lock-mode -1) it works, but all sq...

Emacs mode multiline comments

What's the correct method for defining multi-line comments in an emacs mode (like C's /* */)? The elisp examples I see are for comments that start with a single delimiter and end at the end of the line (like C++'s // or perl's #). ...

Setting the line number to a variable in Emacs

I am trying to set the current line number to a variable in Elisp but keep getting a void-variable error! The code is: (setq x what-line) I'd also like to set the total number of lines in the buffer to a variable as well, but get the same error?! ...

emacs - regular expressions in lisp need to be double-escaped...why?

I've been playing around with emacs lisp, and I wanted to write a little function to do a regular expression search and replace. I had a heck of a time getting the regular expression to work correctly because I didn't realize that all the special characters need to be double escaped when writing lisp code (but not when using query-repla...

load a dynamic library from elisp

I need to use some native code and I would like to try elisp as a scripting language. Is it possible to call native functions which are implemented in dynamic library (dll in windows)? Or the only possibility to do it is to implement native code, wrap it with DEFUN (...) macros and recompile emacs? ...

Handling http authenticated urls from elisp

Hi all, is there a library in elisp which helps to get data of a page which is only reachable through HTTP redirect after authentication? I've just started looking at the URL lib. ...

in emacs, what's the best way for keyboard-escape-quit not destroy other windows?

EDIT: I understand there is keyboard-quit (which is normally bounded to C-g); but I'm more interested to know about how one deals with editing functions that come with Emacs (like in this case). I run into this kind of situations from time to time when I want to change just a little bit of some build-in functions. In emacs, when you hit...

Elisp Function Guide?

I have been using Emacs for more than three years now but it still takes me days to write even small functions in Lisp. I've looked through GNU Emacs Lisp Reference Manual but it's huge and structured completely opposite from JavaDoc, not from functions to descriptions but the other way around. What will make my life much easier is some...