FAQ Database Discussion Community

## How to omit certain folders on ido-switch-buffers and ido-dired?

emacs,dired,ido
I would like to ignore certain folders turning up via ido-dired when changing buffers in Emacs. These folders are system folders on a Mac and should not be removed otherwise, so at least I would like to hide them (especially annoying is, for example, ~/Documents which is suggested when one...

## 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 do EMACS Lisp programmers read text files for non-editing purposes?

file-io,emacs,elisp
What do EMACS Lisp programmers do, when they want to write something roughly the equivalent of... for line in open("foo.txt", "r", encoding="utf-8").readlines(): ...(split on ws and call a fn, or whatever)... ..? When I look in the EMACS lisp help, I see functions about opening files into text editing buffers...

## How can one automatically have emacs turn on auto-fill-mode for a git commit?

git,emacs,mode
I'm wondering if there's a way to have emacs turn on auto-fill-mode when it's launched by git during a commit? I've looked at the command line options and perhaps I could use --load, or something like that to start with auto-fill-mode, but I suspect there's a better way? Also, git...

## Yasnippet snippet for C/C++ while doesn't work correctly

emacs,yasnippet
I have just installed yasnippet package for emacs and am trying to configure snippets. Everything works fine except one particular snipet. File: ~/.emacs.d/elpa/yasnippet-20150212.240/snippets/cc-mode/while # -*- mode: snippet -*- # name: while # key: while # -- while (${1:condition}) {$0 } The problem is that when I use the snippet...

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

## Implementing streams with elisp

emacs,elisp,sicp
I'm reading section 3.5 of the SICP book, and I'm trying to implement streams using Elisp. The book implements streams using the Scheme language as follows: The core structure of a stream is a pair whose car is the current value of the sequence and its cdr is the promise...

emacs,org-mode
I am trying to setup org-capture or org file for following issue: Task A is the major task. It depend upon minor tasks B and Task C. Now in org-agenda view, I should be able to see Task B and Task C. When they are done, I should be able...

## Emacs' autosave files and ember-cli

ember.js,emacs,ember-cli
I'm new using ember-cli and I use emacs as my editor. Anytime I modify a file, I get this error in the ember server console events.js:72 throw er; // Unhandled 'error' event ^ Error: ENOENT, stat '/home/user/projects/ember-cli-101/example-1/borrowers/app/routes/.#friends.js' and then I have to restart my server. I have read that I...

## Emacs open run command save exit

shell,emacs
I use google-c-style.el for C/C++ projects in Emacs. Like many Emacs modes, the indentation is automatically set. For any given file I can open it, select the whole document, then press Tab to reset all indentations, save it, then exit. I have a large code base that I'd like to...

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

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

## How can you automate a find-dired query-replace?

emacs
M-x find-dired: you will be prompted for a root directory and a filename pattern. Press t to "toggle mark" for all files found. Press Q for "Query-Replace in Files..." you will be prompted for query/substitution regexps. How can you define a function like my-find-dired that goes through steps 1-3...

## Collapse lowest level of plain lists with one command in orgmode?

emacs,org-mode
I want to use orgmode for writing a simple exam with a bunch of multiple choice questions. The structure I thought of was something like this: * Multiple Choice 1. Who was the founder of rationalism? a) Locke b) Copernicus c) Descartes d) Plato - C 2. Locke believed that...

## Emacs bindings documentation

emacs,elisp
I am writing some bindings to lambdas in my ~/.emacs and would like to have a description of what the function does appear when I do (for example) C-c ?. I tried to put a string immediately after lambda () but that still does nothing. How do I get something...

## Elisp: how to make this function short

emacs,macros,elisp
I am implementing an plugin, which a lot of project types are remembered. For example: angular, meteor, ember, rails ... And keyed arguments are used. The function creates an hash table with provided keys and values, and assign the hash table to another hash table. Code below: (defun jst-remember-project-type (type...

## How to find aliases in emacs

emacs,alias
I want to check if there is a default\ existing aliasing for a function (in this case:x-clipboard-yank, but the question is general). Is there an emacs function that displays active aliases I can use to figure it up? The expected behavior is like the shell alias command.

## elisp: defmacro with lambda

emacs,elisp
Sorry, I tried few times and I can't build simple defmacro - can anybody help me with that: So, I want define macro which will expand to: (define-key keymap "*" (lambda () (interactive) (some-func "*"))) I tried something like: (defmacro wrap-and-define-key (keymap key func) (define-key ,keymap ,key (lambda () (interactive)...

osx,emacs

## Shell (zsh) through Emacs?

emacs,zsh
I usually run emacs in a terminal to work. I would like to run a shell inside a emacs window. I've found the shell command, but I would like to run the zsh I usually use inside (with my own configuration). Is it possible? EDIT : I succeeded to run...

## Tramp-Mode does not disconnect from sudo shell?

emacs,tramp
I used emacs' tramp-mode to edit root-owned files with the syntax /sudo::<filepath> This works perfectly well, but I cannot seem to get tramp to end the sudo session without manually killing the subprocess via htop or some other process manager. The tramp-cleanup-*-connection commands do not end the session. How do...

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

## match-* functions not behaving?

emacs,elisp
I'm trying to write a elisp function that marks a Python test function as green or red depending on the input. The arguments are pretty self-explanatory. The navigation part works, but the put-text-property part simply does nothing. I've tried eval-ing the match-* functions, but I cannot make sense of the...

## How to set a single key binding for a sequence of commands in Emacs

emacs,emacs24
The Emacs manual only has an example to set a binding for a single command. How to do so for a sequence of commands. Specifically the following. [M-down] to [C-u 1 C-v] [M-up] to [C-u 1 M-v] Which is practically single line scrolling....

## Error in Dired sorting on Windows (with Cygwin Emacs)

windows,emacs,cygwin,dired
In a Cygwin Emacs on Windows, in Dired, if I try to sort by time (for example), I get the error: insert-directory: Listing directory failed but access-file' worked In a Windows Emacs binary on Windows, I do not have any problem, but Emacs uses its own implementation of ls IIUC....

## Emacs Search exact word

emacs,xemacs
I'm working in verilog most of the time, and my favorite editor is emacs. There a feature in vi (vim) I like but I don't know how to do it in emacs I would like to do an exact word search, for example - let's say I have this text:...

## Run a command after every input to minibuffer

emacs,elisp
I want to set up a sort of ISearch mode replacement in Emacs, where I can run a command after every input to the minibuffer. Is it possible? EDIT 1: The idea is to completely replace ISearch with my own mode. Ideally, I'd like it to have most of the...

## Automatically turn on enriched mode and make newlines between paragraphs hard in Emacs

emacs
I want to turn on enriched-mode in Emacs by default, so that my *scratch* buffer would always open in that mode. I've got my *scratch* persistent across sessions (http://dorophone.blogspot.com/2011/11/how-to-make-emacs-scratch-buffer.html). I added (enriched-mode) to my .emacs file, but then every start up I need to answer the question: Make newlines between...

## Emacsclient crashes when evaluating window functions

emacs,window,eval
To not bore anyone here with specifics, whenever I evaluate an expression similar to this one: emacsclient -t -e '(set-buffer *scratch*)' the client will flash up on the terminal and crash. This seems to be happening with all window-changing functions. Is the client not supposed to work like that? Running...

## Print org-mode files

emacs,printing,org-mode
I'm wondering how you guys do print your org files from emacs? Like when you have a meeting and you can't bring your laptop so you quickly print your main TODO list to have something to work on! Do you export org files to another format before printing? PDF? Latex?...

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

## How to use rlwrap in Gauche running on emacs in MinGW?

emacs,scheme
I am new to Scheme, and using gosh running on emacs buffer, in MinGW on Windows. It seems that people use readline or rlwrap to use history and more, but I still cannot figure out to accomplish the setting. Though it may be easy to run one on Linux using...

## How to match everything except a particular pattern after/before a specific string constant

regex,emacs
ATS(inline, const, unused) /* Variadic Macro */ OTS(inline, const, unused) I'm trying to match inline, const, unused keywords only in ATS macro. i tried ATS([^,]*) but it only matches inline keyword. Edit: I need to change the color of all ATS parameters. this only works on the first parameter. (font-lock-add-keywords...

## Is it possible to turn off qualification of symbols when using clojure syntax quote in a macro?

emacs,clojure,elisp
I am generating emacs elisp code from a clojure function. I originally started off using a defmacro, but I realized since I'm going cross-platform and have to manually eval the code into the elisp environment anyway, I can just as easily use a standard clojure function. But basically what I'm...

## Italicise word in emacs

emacs,elisp
I am slightly new to emacs. I am editing a document in latex and I have words that I would like to put in italics. I would like a simple macro where if I place a cursor on the word, and hit a key combination the word is sorrounded with...

## Using vim to develop instead of Emacs on Windows

vim,emacs
I have used Emacs for a long time, say, 6 or 7 years. And it seems that I got Emacs Pinky somehow. Now I am trying to switch to vim, and it's a very good editor, just like Emacs, except that I wonder how you guys develop with it. Using...

## how to enable minor-modes for scratch buffer

emacs
I want to get rainbow-delimiters enabled for .el files as well as the scratch buffer. The installation page says that the (global-rainbow-delimiters-mode) is disabled. is there a scratch-buffer-mode-hook that I can add on to?

## Is there a region change hook in emacs lisp?

emacs,elisp
I'm trying to get the content of current selected region in buffer. I'm aware of idle timer, but a hook should be more efficient/cleaner...

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

## idris-mode – Buffer *idris-repl* has no process

emacs,idris
I'm trying to get idris-mode to work. I am using HEAD from both idris-dev and idris-mode. Whenever I execute C-l (idris-load-file) I get this error Debugger entered--Lisp error: (file-error "make client process failed" "connection refused" :name "Idris Ideslave" :buffer "*idris-connection*" :host "127.0.0.1" :service 0 :nowait nil) make-network-process(:name "Idris Ideslave" :buffer...