elisp

configure emacs variables for a specific function

I run an email client in a separate emacs window (usually connecting to gnuserv), for example, emacs -f wl (the email client being Wanderlust, which probably doesn't matter much). Is it possible to make emacs remember my preferred window layout, main window dimensions, fonts, colours, etc., to set these up only when wl is called?...

Emacs indentation of break after switch statement

Right now the standard emacs indentation works like the following: switch (cond) { case 0: { command; } break; } I want the break; to line up with case. Also, is there a list of the c-set-offset commands somewhere? ...

Matching regexp with grouping in emacs

Hi, I'm trying to match a string and then use grouping to create a new string: (let ((url (browse-url-url-at-point))) (if (string-match "http://domain/\\([0-9]+\\)/\\([a-z]+\\)\.\\([0-9]+\\)" url) (setq filename (concat (match-string 1 url) "_" (match-string 2) "." (match-string 3) ".xml")))) When I (print url) I get the foll...

Name of this function in built-in Emacs Lisp library?

The following Emacs Lisp function takes a list of lists and returns a list in which the items of the inner lists have been concatenated to one big list. It is pretty straight-forward and I am convinced something like this must already be part of the standard function library. (defun flatten (LIST) (if LIST (append (car LIST) (fl...

how to align arguments to functions in emacs?

Say if I have the following: func(arg1, arg2, arg3...) func(longargarg1, longerarg2, arg3,...) ... How do I align the arguments so that it's like following? func(arg1 , arg2 , arg3...) func(longargarg1, longerarg2, arg3,...) ... [I can use M-x align-regex to align the first argument, but I cannot cook up with a suitable ...

How to force emacs not to display buffer in a specific window?

My windows configuration looks like this: +----------+-----------+ | | | | | | | | | | | | | | | | +-----------+ | | | +----------+-----------+ And I use the lower right window...

Emacs talking to XCode

I use emacs on my mac to program in Xcode. It works really well for the most part. I double click on a file in xcode, and it pulls it up in an existing emacs window. I compile, and get syntax errors, double click, and they come up in the active emacs window. great. This is all XCode talking to emacs. Does anyone know of a way to get ema...

Wrapping a quoted function in emacs-lisp

I use the cscope emacs extension (and find it quite useful). Unfortunately, it's default behaviour of only searching the current directory and below is insufficient for me, so I use the cscope-set-initial-directory to the directory of my choice. Unfortunately this has become insufficient for me as well because I have multiple different...

Extra newline in emacs' scheme-mode

I'm running ypsilon scheme using Emacs 23's scheme-mode. When I enter an expression in the interpreter, it adds an extra newline (see below). I've never seen this happen for any other interpreter. I know ypsilon isn't doing it, because it looks fine in shell-mode a shell (though shell-mode exhibits the same incorrect behavior). What func...

Check if a string is empty in elisp

Hi, I would like to write an if statement that will do something base on whether a string is empty. For example: (defun prepend-dot-if-not-empty (user-str) (interactive "s") (if (is-empty user-str) (setq user-str (concat "." user-str))) (message user-str)) In this contrived example, I'm using (is-empty) in place of the...

.emacs global-set-key and calling interactive function with argument

In my .emacs i have the following function that transposes a line (defun move-line (n) "Move the current line up or down by N lines." (interactive "p") (let ((col (current-column)) start end) (beginning-of-line) (setq start (point)) (end-of-line) (forward-char) (setq end (point)) ...

Implementing a dired interface in emacs for something other than the filesystem?

The ROOT data analysis framework commonly used in high energy physics uses a binary file format that has internal structure like a real filesystem (i.e. folder & files). The ls() method output from the program look something like this: KEY: TH1D name1 KEY: TH1D name2 KEY: TH2D name3 .... Where "TH1D" and "TH2D" etc. ...

How to set syntax highlighting on for Emacs files

My .emacs is like a roadmap for me where I source many files. Their extension is .emacs: for instance, fileName.emacs The problem is that only ~/.emacs has syntax highlighting. I would like to have the syntax highlighting for all sourced files which end with .emacs. How can you put syntax highlighting on to all sourced .emacs -fil...

Is there any way to create a "project file" in emacs?

I say "project file" in the loosest sense. I have a few python projects that I work on with ropemacs using emacs W32 for Windows. What would be ideal is if I could have an icon I could click on on my desktop to open up emacs, open up the rope project, and set the speed bar in the top-level directory of that project. Then I could also ...

Emacs Wishlist

Emacs is great. To me at least, Emacs is a metaphor of all software. Still, I know that it lacks some features sometimes that you have to actually migrate to other environments. Given emacs is so customizable, and great and everything, we only have to wish for it right? What do you think is a feature that emacs lacks right now? Note: A...

Searching with intelligent bracket counting (Elisp)

I have the following function that deletes the LaTeX command surrounding the current cursor position: (defun remove-tex-cmd () (interactive) (save-excursion (let (cur-point beg-point end-point) (setq cur-point (point)) (catch 'notexcmd (if (not (re-search-backward "\\.*?{" nil t)) ; now the point is at the { ...

how to easily experiment with elisp code that involves moving a cursor (caret)?

I usually play with elisp code on my scratch buffer. I find it hard to play with elisp code that moves cursors in this way because I don't know how to separate the buffer for editing code and the buffer for testing the code. For example if I want to play with the following code: (backward-up-list 1) (backward-sexp 1) (kill-sexp 2) fr...

How to achieve code folding effects in emacs

Whats the best way to do achieve something like code folding, or the type of cycling that org-mode uses. What would be the best solution in elisp to create this type of behavior? EDIT: I'm sorry I was not clear. I want to program something in elisp that does things very similar to code folding, or actually most like org-mode with the ...

Insert spaces instead of TAB in Emacs viper-mode

I am long time-vim user and recently discovered that emacs has viper-mode, offering best of both worlds (at least for me). However one thing is really bothering me since I am mostly coding in python and mixing of tabs and spaces is a big deal. When in insert mode I would like to insert viper-shift-width spaces instead of TAB when I pres...

Getting csharp-mode Emacs syntax highlighting working

Googling "csharp mode emacs" yields the page http://www.emacswiki.org/emacs/CSharpMode which includes a few links to various downloadable emacs lisp files. The 2005 link (DylanMoonfire) is broken, so I downloaded: http://lists.ximian.com/pipermail/mono-list/2002-May/006182.html as ~/.emacslib/csharp-mode.el and added: (auto...