emacs

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...

How can I reload the interactive shell and run some commands on emacs startup?

I relise that I have to add something like: shell : to my .emacs file. But then how can I get it to do shell commands like: cd /mydirectory : and other shell actions ...

make emacs in a terminal use dark colors and not light font-lock colors

I am using emacs on MacOS 10.6 with Terminal. I have a white background. It's very hard to read quoted C++ strings. They are coming up in pale green. Keywords are in turquoise. After searching through the source I cam across cpp.el and have determined that I am using the cpp-face-light-name-list instead of cpp-face-dark-name-list. Ap...

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. ...

Touchpad scrolling on the mac

I am using emacs from the shell (not aquamacs) on a mac laptop, however whenever I try to scroll up and down it doesn't scroll the file. Is there any way to do this? ...

emacs, override indentation

hi. Hopefully simple question: I have multiply nested namespace: namespace first {namespace second {namespace third { // emacs indents three times // I want to intend here } } } so emacs indents to the third position. However I just want a single indentation. Is it possible to accomplish this effect simply? Thanks...

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...

How to make emacs stay in the current directory

When I start working on a project in emacs, I use M-x cd to get into the project root directory. But every time I use C-x C-f to open a file in one of the subdirectories (like app/model/Store.rb) emacs changes current directory to that of the file. Is there a way to make emacs stay at the root? ...

How to replace a region in emacs with yank buffer contents?

When I use VIM or most modeless editors (Eclipse, NetBeans etc.) I frequently do the following. If I have similar text blocks and I need to change them all, I will change one, copy it (or use non-deleting yank), select next block I need and paste the changed version over it. If I do the same thing in emacs (select region and paste with C...

Running py.test from emacs

What I would like if for C-c C-c to run py.test and display the output in the other buffer if the name of the file being edited begins with test_ and to normally run py-execute-buffer otherwise. How would I do this? I am using emacs 23.1.1 with python-mode and can access py.test from the command line. ...

is there a way to switch bash or zsh from emacs mode to vi mode with a keystroke

I'd like to be able to switch temporarily from emacs mode to vi mode, since vi mode is sometimes better, but I'm usually half-way through typing something before I realize I want I don't want to switch permanently to vi mode, because I normally prefer emacs mode on the command line, mostly because it's what I'm used to, and over the yea...

emacs: inverse search

Is there a way to do a inverse search? I have very big log file where a particular pattern fills up for few dozen pages 20100414 alpha beta 20100414 alpha beta <few dozen pages> 20100414 alpha beta 20100414 gamma delta 20100414 gamma delta <few dozen pages> 20100414 gamma delta Problem is, I don't know what text would be after "alpha ...

Enable scratch buffer to execute R code in emacs-ess

Hello, I have switched to using emacs-ess for my R code development and it is working great. I would like to be able to write some small R code I am using for debugging my R script into the scratch buffer, and be able to execute the scratch buffer code in the R process buffer. I've found how I could change the scratch buffer's mode to te...

why is my emacs yanking the wrong text?

running emacs 22... on ubuntu 9.04, fresh install. When I copy a region of text via C-w (clipboard-kill-ring-save) then yank it back with C-y (clipboard-yank) it pastes random stuff, from some other buffer that isn't even open. It was working fine earlier today and I haven't changed my emacs config. Any ideas why this is suddenly happ...

emacs: interactively search open buffers

Is there a way to search all the open buffers for a particular pattern? C-s interactively searches current buffer. Similarly, is there something that searches all the open buffers? I know I can use "occur", but "Occur" brings a new buffer and changes/messes with the buffer organization. ...

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 make emacs properly indent if-then-else construct in elisp

When I indent if-then-else construct in emacs lisp, the else block doesn't indent properly. What I get is: (defun swank-clojure-decygwinify (path) "Convert path from CYGWIN UNIX style to Windows style" (if (swank-clojure-cygwin) (replace-regexp-in-string "\n" "" (shell-command-to-string (concat "cygpath -w " path))) (path...

docview in emacs: refreshing dvi content automatically

Hello: Is there a way Emacs can automatically refresh the buffer showing the dvi right after my LaTeX compilation? Thank you. ...

How do I forward `<Ctrl>-<Tab>` in Konsole?

I want to use intelligent tabbing in Emacs in C++ mode, but I also want to be able to insert a tab character when necessary. From other posts, I gather that the easiest way is to bind <Ctrl>-<Tab> to indent. However, it appears that Konsole in KUbuntu won't forward the <Ctrl>? My current .emacs file contains: (defun my-c-mode-common-...