elisp

elisp: posn-at-point returns nil after goto-char. How to update the display before posn-at-point?

In emacs lisp, posn-at-point is documented as: posn-at-point is a built-in function in C source code. (posn-at-point &optional POS WINDOW) . Return position information for buffer POS in WINDOW. POS defaults to point in WINDOW; WINDOW defaults to the selected window. . Return nil if position is not visible in window. Ot...

Emacs shell-command restart on crash

Is it possible to detect when a long running process started with shell-command crashes, so it can automatically be restarted? Without manually checking its buffer and restarting by hand. ...

Emacs Lisp: How to use ad-get-arg and ad-get-args?

I'm not sure I am using ad-get-args and ad-get-arg right. For example, the following code doesn't work. (defun my-add (a b) (+ a b)) (defadvice my-add (after my-log-on activate) (message "my-add: %s" (ad-get-args))) (my-add 1 2) The last expression causes an error: Debugger entered--Lisp error: (void-function ad-get-args). Th...

Emacs Lisp: how to set encoding for call-process

I thought I knew how to set coding-system (or encoding): use process-coding-system-alist. Apparently, it's not working. ;; -*- coding: utf-8 -*- (require 'cl) (let ((process-coding-system-alist '(("cygwin/bin/bash" . (utf-8-dos . utf-8-unix))))) (setq my-words (list "Lilo" "ಠ_ಠ" "_ಠ" "ಠ_" "ಠ" "Stitch") my-cygwin-bash "C:/cygwin/b...

Code folding for LaTeX in Emacs

Is there an Emacs minor-mode (or piece of elisp code) that lets you selectively hide/show environments while in LaTeX mode? For instance, I would like to move to the beginning of a long \begin{figure} block, hit a keystroke, and have the contents of that figure environment hidden from view. Similarly with \begin{proof} and so on, and ide...

How to Create a Temporary Function in Emacs Lisp

I'm making some tedious calls to a bunch of functions, but the parameters will be determined at runtime. I wrote a simple function to keep my code DRY but giving it a name is unnecessary. I don't use this function anywhere else. I'm trying to do it the way I would in Scheme, but I get a void-function error: (let ((do-work (lambda (x y ...

How do you move the pointer up or down multiple lines with Emacs?

I can move my pointer up and down one line with my arrow key just fine in Emacs, so I'd like to redefine C-n and C-p to move up and down 5 lines at a time. I'm just beginning to learn how to use Emacs, and elisp is very alien to me. I tried using the GNU Emacs lisp reference, but I couldn't find how to bind a keystroke to multiple comm...

Emacs follow-mode with multiple splits

My question is related to the following two: http://stackoverflow.com/questions/970292/emacs-multiple-columns-one-buffer http://stackoverflow.com/questions/2588706/vim-configuration-setting-up-autocomplete-and-columns I'm using MPage now in vim, and it works well even when I have more than two columns. How can I use follow-mode to mimic...

Mode specific key bindings

Hey, I have a minor mode that also comes with a global mode. The mode have some key bindings and I want the user to have the posibility to specify what bindings should work for each mode. (my-minor-mode-bindings-for-mode 'some-mode '(key1 key2 ...)) (my-minor-mode-bindings-for-mode 'some-other-mode '(key3 key4 ...)) So I need some ki...

How can I get paredit mode when doing eval-expression?

I love Emacs' paredit-mode, but I miss it very sorely when doing eval-expression (M-:). How can I have paredit in the minibuffer when doing eval-expression? Thanks! ...

Emacs: adding 1 to every number made of 2 digits inside a marked region

Imagine I've got the following in a text file opened under Emacs: some 34 word 30 another 38 thing 59 to 39 say 10 here 47 and I want to turn into this, adding 1 to every number made of 2 digits: some 35 word 31 another 39 thing 60 to 40 say 11 here 48 (this is a short example, my actual need...

Manipulating columns of numbers in elisp

I have text files with tables like this: Investment advisory and related fees receivable (161,570 ) (71,739 ) (73,135 ) Net purchases of trading investments (93,261 ) (30,701 ...

Using tramp with EmacsW32 and cygwin, possible?

Hi, I have some trouble setting up Tramp with EmacsW32 and cygwin. I have configured emacs to use cygwin as shell using w32shell. I also set the HOME enviromental variable to c:/cygwin/home/myusername Problem is that tramp seems to hang and that no connection is made: "Tramp waiting for prompts for the new shell". I have tried to turn...

emacs/elisp: What is the hash (pound, number sign, octothorp) symbol used for?

What does this do? (add-hook 'compilation-mode-hook #'my-setup-compile-mode) ...and is it different than (add-hook 'compilation-mode-hook 'my-setup-compile-mode) ...

Emacs and Long Shell Commands

Is there a way to run a shell command, have the output show up in a new buffer and have that output show up incrementally? Eshell and other emacs terminal emulators do a find job of this but I see no way to script them. What I'd like to do is write little elisp functions to do stuff like run unit tests, etc. and watch the output trickle...

ido-mode distinguish dired-mode buffer names

Hi, does anyone know of a good way to distinguish dired-mode buffer names from other types of buffers in the minibuffer while using ido-mode? For instance... showing a forward-slash at end of a dired-mode buffer name? ...

eval-after-load vs. mode hook

Is there a difference between setting things for a mode using eval-after-load and using the mode hook? I've seen some code where define-key is used inside a major mode hook, and some other code where define-key is used in eval-after-load form. ...

In Emacs, how do I display a message in the minibuffer with font face properties?

I want to display a colored string of text in the minibuffer, but when I use the 'message' function, the text-properties of are stripped. ...

In Emacs, how do you change Latex mode to treat <% ... %> as a comment?

In Emacs, is there some short code that you can write (in .emacs, latex.el, or some other file) so that Latex mode treats code of form <% ... %> as a comment? ...

How to set up Erlang + Emacs with erlang.el?

I have downloaded and installed Erlang and EmacsW32. But how do I use erlang.el in Emacs? Where do I place it or install it? I have read Erlang/OTP R13B04 documentation and Erlang mode for Emacs documentation but I haven't found any information about how to set up it. UPDATE 1: I have found more documentation on The Erlang mode for Ema...