FAQ Database Discussion Community

## how to detect if emacs is running in a terminal or a window?

emacs
I'm hoping to be able to branch on a flag in emacs to detect whether it is running in a terminal or a windowed app (i.e. the OS X Emacs app) Is there such a flag?...

## Org-mode: How do I fold all levels but the current in a sparse tree?

emacs,org-mode
After doing C-c / to create a sparse tree, move the cursor to some interesting place and C-c C-c to remove highlights I'd like to be able to collapse all levels but the current one. Is there some way doing it? I'd like to maintain the cursor positioned in the...

## How to remove the temporary files starting and ending with '#' created by Emacs when it closes?

emacs,backup,kill-process
When Emacs is closed with modified buffers present, it creates a file with the format '#file_name#' for recovery purpose in its parent directory for each modified buffer (except for scratch). When recover-file command is used when Emacs opens the next time, the previously modified buffer of the file is recovered....

## Emacs: syntax highlight for non-code files

file,emacs,syntax-highlighting
Let's us suppose I want to create a file (using emacs) to explain something about programming. For example, a mylib-tutorial.txt. Is there a way to turn on syntax highlight on specific parts of a file containing code? For example: Tutorial --------- This call behaves as follow: void foo(&resource); This call...

## what's difference between 'delete' and 'remove' in Emacs Lisp

emacs,elisp
I am learning Elisp by reading others' code. Then I found people use both delete and remove to delete element from sequence. I checked the document and the code of remove it seams just a wrapper for delete which when the sequence is a list, do a copy-sequence. Is it...

## Emacs config for scala development [closed]

scala,emacs
Can anyone point me to a repo to get a proper scala development config for emacs? I'm pretty new on emacs and I went through some tutorial regarding how to setup ensime for emacs, but I didn't succeed.

osx,emacs

## EMACS-Live + Slime error at startup

emacs,common-lisp,slime,kubuntu
Ok, I must be missing something obvious. I'm getting stuck since yesterday to launch Emacs-live + slime. I'm using EMACS 24.3.1, installed Emacs-live and it worked well (if I start emacs-live without Slime it works), downloaded Slime-Pack from git and added this line to .emacs-live.el (live-append-packs '(~/.live-packs/slime-pack/)) I'm on a...

## Can I stop Emacs from resetting default-directory every time I open a file?

emacs,directory,editing
I've already asked the same question on Emacs. If it's not permitted, I'm sorry and I will delete the question. If I: Start Emacs in my home directory (~) Find a file in the ~/Projects/ruby-play directory with C-x C-f Try to find another file with C-x C-f The default directory...

## How to get Emacs to sort lines by length?

sorting,emacs,elisp
I'd like to be able to highlight a region in Emacs and then sort the region by line length. The closest I've found is the following code which I think will sort by length: (sort-subr t #'forward-line #'end-of-line nil nil (lambda (l1 l2) (apply #'< (mapcar (lambda (range) (- (cdr...

## how control the time span of highlighting searched word when press “*” under evil in emacs?

emacs,evil-mode
In evil mode, when press *, it will highlight the all the words the same under the cursor, but the highlight will disapper very soon. How can I control how long to keep the highlight? I am using prelude versiosn of emacs.

## How do I prevent org-mode from executing all of the babel source blocks?

emacs,org-mode,org-babel
I have an org file with lots of babel source blocks in it that only need to be re-executed when the code is changed. How do I prevent org from executing all of the blocks during export? In other words, set them all to manual execution only? I would prefer...

## Determining in emacs the module in which function is defined?

emacs,ocaml
Say I have the following open A open List let double = map (fun x -> 2*x) [1;2;3] In emacs with merlin-mode I can place the cursor on map and execute merlin-type-enclosing to get the type of map. Is there a similar command (in merlin, tuareg, or others) that can...

## emacs call-interactively and key simulation

emacs,elisp
I want to write a small function that saves the cursor's current position, mark the whole buffer, indents it and then goes back to the previous cursor position. I understand there might be easier way to achieve the same result but I'd like to understand how these principles work in...