If you have an Emacs-related question, whether newbie or seasoned hacker, this is the place to add it. Edit this page (use the link at the bottom), and add your question at the top of the section “New Questions”. The more frequently asked questions made on this page are archived at OpenQuestions#FAQ for your protection.

Note: You can also post your question to after reading the EmacsFaq. In some ways, that is a better forum for questions.

New Questions

Use “[new]” to introduce your question or answer. Indent answers to questions with “:” – see TextFormattingRules. A new entry shows up in the table of contents here only once you actually Save.

When a question is answered--and sometimes before it is answered, it is moved to a more appropriate page on ThisWiki (See OpenQuestionsDiscussion). The change log should usually say where a question was moved to.

Adding options to mudraw in DocViewMode

How to send arguments to mudraw with doc-view? I don’t really know how to do this. I could possibly hack my way using doc-view.el, but my previous excursions show me that I can deal with simple stuff, and something more complex takes me days off my actual job. I know that DocViewMode can set customizations for ghostscript, for instance, but setting them for mudraw is not possible yet. I managed to do a static change that allows me to have inverted colors (look at the ,"-I"):

(defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
  "This function was modified to have inverted colors"
   "pdf->png" doc-view-pdfdraw-program
   `(,(concat "-o" png)
     ,(format "-r%d" (round doc-view-resolution))
     ,"-I"                                        ; ← change is here
     ,@(if page `(,(format "%d" page))))

I think that this can be useful to someone (what I did and what can be done).

Speedbar-sr should activate the newly opened window

When clicking on a file in the speedbar tree, is it possible to activate that frame when the new buffer opens. For me, the speedbar window remains active

Emacs 23 Conversion - Headers Fail

I’m going from a previous version to 23. The conversion to mbox seems fine. Except: no headers will display. Instead there is an error message that ‘ Search failed: “ “ ‘ A lot of other stuff doesn’t work as well, but this is critical. Any clues please?

Emacs for Prose

I’m a novelist working with large prose text files, and an emacs newbie who’s very enthusiastic about org-mode. I’m trying to add some customizations to my init.el file, but so far I have failed. I’ve found some .el files for these kinds of things, but can’t seem to get it all together into my elisp and init.el files in a way that results in the desired behavior. Any help would be much appreciated! Apologies if I’ve done poorly in this wiki … new to this, too. – Steven Arntson

Automatic startup in org-mode

The problem is that Emacs starts with the scratch buffer, wich has no file attached. Even if we put it in Org Mode, you’d loose anything you type if you forget to save (and Emacs won’t remind you of that because the scratch buffer has no file attached).

It would be better for you to simply open a default file when you start Emacs, perhaps?

(find-file "~/")

Or, alternatively, use org-mode for all text files if you don’t want to use the .org extension?

(add-to-list 'auto-mode-alist '("\\.txt\\'" . org-mode))

Automatic startup in visual-line-mode

Assuming you want this for all text based modes:

(add-hook 'text-mode-hook 'turn-on-visual-line-mode)

Numbered backups created with each save: file01, file02, file03, etc, or similar

(setq version-control t)

This enables what is called “numbered backup files”. From the manual:

Numbered backup file names contain `.~’, the number, and another `~’ after the original file name. Thus, the backup files of `eval.c’ would be called `eval.c.~1~’, `eval.c.~2~’, and so on, all the way through names like `eval.c.~259~’ and beyond.

Enabled n-dashes and smartquotes (typopunct-mode?)

Personally, I use the following to switch org-mode buffers between German and English depending on the buffer content:

(add-hook 'org-mode-hook 'my-org-init)

(defun my-org-init ()
  (when (require 'typopunct nil t)
      (goto-char (point-min))
      (if (> (count-matches (regexp-opt '("der" "die" "das") 'words)) 3)
	  (typopunct-change-language 'deutsch)
	(typopunct-change-language 'english))
      (typopunct-mode 1))))

If you only care about English, you can probably just stick to the following:

(add-hook 'org-mode-hook
  (lambda ()
    (typopunct-change-language 'english))
    (typopunct-mode 1)))

Visible marks for whitespace, tabs, and hard returns

Maybe something like the following?

(global-whitespace-mode 1)

Alternatively, for org-mode only:

(add-hook 'org-mode-hook
  (lambda ()
    (whitespace-mode 1)))

Thank you--I will try these! ~s

Warning when functions are redefined by loading a file?

I want to give some elisp code to a friend. When he loads my code into his environment, is there any way for him to know when one of my functions has the same name as — and is thus inadvertently redefining — a function that has already been defined? Ideally the file loaded is either source “.el” or compiled “.elc”

Common Lisp has packages to prevent name collisions, and the file loader also warns when any function is redefined. I don’t think emacs lisp has the first feature, but hoping there’s a built-in solution something like the second.

I’m aware of Elena’s defadvice to defun solution (Sat, 27 Nov 2010), which seems to work for source files but not compiled files; and, messing with defun makes me nervous (sorry).

Thanks much, Fred

I don’t know of a ready-made way to do what you want. Perhaps someone else does. However, a recommended practice is to use a common prefix for the names of the functions and variables in your library — for example, prefix ‘fred-’ — to avoid name collision. – DrewAdams

doc-view mode looks very blurry on the retina macbook pro.

The png files generated by doc-view look very blurry on the retina macbook pro. I would like to konw if there is a way to fix this issue. (maybe by increasing the resolution of the generated png files to match the resolution of the retina display?) Thank you.

Refer to DocViewMode and edit “Doc View Resolution”. – ArtTaylor

How to open the same directory in the passive pane of Sunrise Commander?

In Sunrise Commander, how can I open the same directory that is currently open in the active pane in the passive pane too?

I can do this quickly in Mucommander by using “CTRL+e”. Is there any way to do this quickly in Sunrise Commander as well? Otherwise, if I want to rename a file, I have to manually browse to ensure that the same folder is opened in both panes before pressing F6 (else, I will be asked if I want to move rather than renaming that folder). In absence of a shortcut to have the same directory open in both panes, the process is rather slow.

Many thanks for the help.

M-o (or Alt-o, if you prefer) is what you need:

    M-o runs the command sr-synchronize-panes, which is an interactive compiled Lisp
    function in `sunrise-commander.el'.

you can always press h in any of the panes in SC to get a full list of all the currently available bindings.

OTOH if all you want is to rename one or more files, the easiest way is to do it in place: press C-x C-q to enter editable mode, change the name of the file(s) and press C-c C-c to commit your changes, or C-c C-k to discard them.

Hope this helps. Cheers. j.a.

How to Program/Customize Emacs Commands?

I apologize for this note. I’ve been using the basic features of Emacs for many years, but am trying to implement some more advanced features. I found this site through Google and would like to implement the code to remove duplicate lines ( Unfortunately that page provides no context (where to put this code, etc.) I’ve been hunting around the site for some time and have yet to find such information anywhere. The site is set up for people with a certain minimum knowledge of the Emacs terminology. The documents for newbies are so voluminous that it would take me forever to go through and figure out what I need to know.

Thanks for your patience in reading.

1. You put EmacsLisp code that you write to customize Emacs in your init file, which is ~/.emacs by default. Use `C-x f ~/.emacs’ to create or access (edit) your init file.

2. For customization of faces and user options, you need not write EmacsLisp code if you don’t want to. Instead, use ‘M-x customize-face’ and ‘M-x customize-option’. The Customize user interface takes a little getting used to, but using it instead of hand-coding EmacsLisp is generally preferable (type-checking, safer initialization and updating).

3. When you use Customize, your preferences are saved by default to your init file. If you also have hand-coded code in the same file, this can be asking for trouble (error prone). You can instead have Customize use a separate file, by setting variable ‘custom-file’ and then adding this to your init file (typically at the end):

  (load-file custom-file)

To set ‘custom-file’, put this in your init file (before the ‘load-file’):

  (setq custom-file  "/the/path/to/my-emacs-custom-file.el")

Variable ‘custom-file’ is an option, but it is (exceptionally) usually better to set it using Lisp code (in your init file. The reason is that Customize will save its value to your ‘custom-file’! IOW, chicken & egg: ‘custom-file’ tells Emacs where your customizations are saved, but if you save the value of ‘custom-file’ itself only in that file then Emacs still won’t know where it is!

4. As an alternative to putting a lot of code in your init file, you can put it in another Lisp file (extension .el) and then load that file from your init file. For example, put the code from DuplicateLines in a file my-emacs-code.el and then add this to your init file:

  (load-file "/the/path/to/my-emacs-code.el")

5. You can also set variable ‘load-path’ to a directory to search for Lisp code, and then use ‘load-library’ with just the library name (‘my-emacs-code’), instead of using ‘load-file’ with an absolute file name.

6. If you end up with a large Lisp file (e.g. `my-emacs-code.el’), you can byte-compile it. If you use ‘load-library’ the byte-compiled version (e.g. `my-emacs-code.elc’) will be loaded instead, and when invoked that code will be faster.

7. Emacs doc and help are your friends. In particular, ‘C-h i’, choose ‘Emacs’, then ‘i’ to look things up in the index. Using ‘i’, look up, for instance, ‘init file’ (Init File) and ‘custom-file’ (Saving Customizations).

HTH – DrewAdams

Is it possible to use fontsets outside emacs?

Using the UnicodeFonts package it is quite easy to set up very sophisticated fontsets in emacs but it is a lot of work and takes quite a lot of time. Emacs uses the fontset like one enormous unicode font with glyphs from many others. It would be nice if the results of this work could be made available to other applications. Is there any way of doing this e.g. by using emacs as a font server or running other applications inside emacs (not necessarily in an emacs window)? Has anyone looked at anything like this?

Perhaps I should add that I use an Ubuntu Linux system and have had quite a lot of C and Common Lisp programming experience in the dim and distant past so I might be able to tackle the problem myself. Can anyone give any pointers as to where to start?

Thanks in advance – Bernard Hurley

Some problems with ispell

Is it possible to scroll the ispell Changes buffer? And is it possible to select from the buffer other then by the keyboard? If you use the “l” option and search in the Ispell Alternative Dictionary you can get an enormous list of words that doesn’t fit on the screen (hence the need for scrolling) and some of the choices use really obscure characters (hence the problems with choosing from the keyboard.) I am not a mousey-clicky person myself but this is one case where being able to use the rodent would be really useful.

Thanks – Bernard Hurley

extent-at function

The latest available spice-mode,, uses the extent-at function. This is not found in emacs 23.3. Did this function go away with some release? (That is hard to believe). Is it Xemacs-only? Note, this is also used in the verilog-mode (same URL). – KevinBuchs

Yes, this is only available in Xemacs. Somebody should port this code! – KevinBuchs

Buffer with different backgroundcolor, possible?

– Michael

Yes, with an overlay:

 (defun set-buffer-background-color (color)
   (let ((overlay (make-overlay (buffer-end -1) (buffer-end +1) (current-buffer) nil t)))
     (overlay-put overlay 'face (list ':background color))))

or with Emacs 23, you can use face remapping:

 (face-remap-add-relative 'default :background "green")


resize buffer window on startup


I’m using Emacs in Supercollider mode, which opens two buffer windows automatically, and makes them equal size. I would like to have one of them bigger then another every time i’m starting emacs with -sclang option… is it possible to put something like (enlarge-window SCLang:workspace 10) or any other thing which will resize buffer window after it created? thank you!


Check out the documentation on the variables ‘default-frame-alist’ and ‘initial-frame-alist’. My need was the opposite, I wanted all my frames the same – but Emacs will treat the first frame differently than the rest, which should be good news for you. In my .emacs, I have something like
(setq default-frame-alist ‘((width . 154) (height . 44)))
and you could add in
(setq initial-frame-alist ‘((top . 1) (left . 1) (width . 80) (height . 55)))
as the documentation suggests.

Swapping international characters

My keyboard layout is Turkish Q. I want to use emacs for latex so I need to type backslash extensively, but it is situated at an awkward Alt-Gr combination on my keyboard, so I want to swap it (and also brackets and braces) with Turkish characters that I don’t use since I type in English.

First in my .emacs file I tried (global-set-key (kbd “ş”) “\”) with no results. Then as a trial I tried (global-set-key (kbd “ş”) “i”) still without luck. Then (global-set-key (kbd “i”) “ş”) did work to my suprise, but (global-set-key (kbd “i”) “\”) didn’t. After much googling I tried using the octal code for \, and I got (global-set-key (kbd “i”) “\134”) to give me a “\” when I press “i”. But of course I need the “i” and I want backslash on another key. It appears that somehow (kbd “ş”) is not understood for some reason, and when I tried to put in the octal code I found for “ş” with C-x = it again didn’t work, probably because it was a 7-digit-long thing. So in short it appears that I can assign Turkish characters to other keys, but not vice versa.

Any explanations of this behaviour and a solution would be much appreciated. (Note, I am very much a noob with both emacs and my debian)

Newly Created Files are Invisible on Vista (64)

I have installed emacs 23.1 on a Vista (64) machine. Quite strangely, the files I create with emacs are not visile by the standard Windows programs (cmd, explorer, notepad), though I can access them with emacs and other program (I found out when creating an Xmingrc file in \Program Files (X86)\Xming. Xming reads Xmingrc, while Windows Explorer, dir and notepad do not. However, notepad anot save a file named Xmingrc in the same position. Also I have “show hidden and system files” in my explorer prefs, so that should not be the problem. the nly difference I see between “visible” files and “ghosts”:in dired, ghosts are listed as belonging to me; regular files belong to “Administrators”. Any idea?

File an Emacs bug: ‘M-x report-emacs-bug’. Give a clear step-by-step recipe, starting with ‘emacs -Q’. The Emacs developers will determine whether it is an Emacs problem, and if so fix it (hopefully). – DrewAdams

I will do so. Since my post I found that I can “Run as Administrator” as a workaround. It appears that the ACL of newly created files is too strict for most tasks (at least that’s my take: if I log in as a different user, I cannot access the files created by emacs as my principal login with anything). Now what’s weird is that most other programs started as that very same user cannot access the file - so, it is impossible to icacls it. Looks as much a Vista bug as an Emacs bug…

This is a feature of Windows Vista which virtualizes the file system and the registry in the attempt to keep existing misbehaved applications to run, such as those which write configuration files to the Windows directory or the application directory assuming the user has rights to do so. See to learn the details why Emacs is virtualized and why Explorer is not.

You can run with elevated priviledges, run as a user with rights to create/change those files, add yourself to a group to have the rights or change the file’s ACL to give you those rights. Running as administrator falls under the first choice if you’re an administrator and under the second if you’re not (you must provide the administrator password in this case). – Paulo Madeira

Errors while loading elisp files

After installing new 23.1 installation on an XP machine, I came across a very annoying issue. When I load some el files, I get errors such as apply: Invalid read syntax: “?” Loading d:/emacs/emacs-23.1/lisp/shell.el (source)… apply: Symbol’s value as variable is void: « When I find the file in question, and eval the buffer, I do not get these errors. Also byte compiled files always fail to load. Thanks.

Customizing Two-Mode-Mode to ignore delimiter when indenting and/or fontifying

At work we are using our own preprocessor to allow Perl embedded inside Verilog HDL source files. Each Perl line must be prepended with a ‘@@’ marker. I have succesfully customized two-mode-mode.el such that is recognizes this start-marker (and end-of-line as the end-marker). Now a problem comes with indenting. Outside these lines, while in verilog-mode, the indenter breaks because of the ‘@@’. Inside a Perl line, the indenter also breaks because of ‘@@’. In other words, neither of the two major modes accept the ‘@@’ as valid syntax, and thus indentation & fontification breaks for both modes.

How can I customize the elisp such that both verilog-mode and cperl-mode ignore our ‘@@’ symbols, yet two-mode-mode.el still recognizes it as the delimited between the two modes ?

Making the GDB/perldb marker more visible

I have a large emacs window with multiple buffers. During a perl debug session, the marker, ⇒, will move to a new window/buffer and I will need to search for it. I could use a marker that is more visible. Perhaps one that is rendered in red or one which blinks. I would really love to have a different background color for the entire buffer line with which the marker is associated. Thanks for your help!

Smart yanking of leading and trailing whitespace

When using Microsoft Word (the horrors!) I noticed a neat feature which wouldn’t be hard to replicate in emacs, so there may already be a package or setting which does this. In Word if I copy a word (or several words) and I accidentally copy the whitespace around the word then the editor is smart enough to strip away the superfluous whitespace during pasting. E.g. if whitespace ends between the word and the period ending the sentence then it is deleted. Or when more than one space character end up between words then they are truncated to a single space.

I know it would have been useful lots of times when editing text with Emacs. Is there a setting which emulates this? – Anonymous

You’re trying with the mouse I presume? Are you using TransientMarkMode or PcSelectionMode already? Seems like these modes should offer what you want or close to it. If you were using the DefaultKillingAndYanking commands you could change their behavior by AdvisingFunctions. – AaronHawley

Emacs library files hot-patch doesn't work (Win32 Emacs)

I am a newbie user of Emacs, and just can’t stop loving it! Besides, I have a minor glitch that constantly irritates myself. As a Emacs user who heavily uses windows, (I am sorry but I am working for the windows app company) I have this simple yet, irritating problem. (under Emacs 22.3.1 - Windows XP)

Whenever I hot-patch (via manually patching) emacs library files, such as python.el, files.el and evaluate and save the functions it really works well, until I restart the emacs. It just goes back to its old behavior

   * I didn't just modified the file, but I bytecompiled and replace the old .elc file as well.
   * I did a full disk search searching for file.el or file.elc but couldn't find any but the file placed in the Emacs directory (which I hot-patched)
   * If I load it forcefully (via '(load "files")' ), it works, but I am just curious about this strange behavior.
  Q. Is there any secret storage where emacs saves all the default libraries in?
     If not, why does it happen? If it has, where is it?
Some elisp libraries that you will almost always use are dumped into the Emacs executable, for faster startup. For those libraries, you cannot just modify the .el file and byte-compile it, you have to redump Emacs as well. files.el is one of those, but python.el is not. I’d suggest not editing the .el files that are distributed with Emacs directly - instead use ‘advice’, or redefine functions in your .emacs after requiring the feature.

Color-themes not working

I am having a problem with the color-themes with GNU Emacs Version 22.1 on Windows Vista. I have the following code in my .emacs file and am able to load any color-theme I want:

(add-to-list 'load-path "c:/GNU Emacs/site-lisp/color-theme-6.6.0") (require 'color-theme) (color-theme-initialize) (setq color-theme-is-global t)

However, after opening a java file the java generics are not properly colored. I know this because I can directly compare with the examples at . My emacs color display of the exact same java code does not match the display on the webpage. It appears that the disparity between the displays is centered around java generics tags.

Always indent with only tabs

I would like to config Emacs so that all indentation is done with tabs, with four-space wide tab stops. (I’m workin in PHP but have been testing in C mode and I suspect the same answer will work in both places.)

What I’m getting (where . indicates a space and _ indicates a tab

    ....if (x == y) {
    _       bar();

What I would like

    _   if (x == y) {
    _   _   bar();
    _   }

.emacs contains

    (setq c-basic-offset 4
        tab-width 4
        indent-tab-mode t)
    (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 ))

I’m using 21.4.1 with version 1.2.0 of php-mode.el. (Not sure which version of c-mode.)

The ‘c-basic-offset’ variable (and a few others) are buffer-local variables. This means that you can set them outside of any buffer, in your .emacs file but they will probably be overriden by code that runs in a mode-hook variable. Try setting the same variables in a hook function. I just fired up a new Emacs session and wrote the following in the *scratch* buffer:

    (defun keramida/cc-indentation ()
      "Set up indentation for cc-mode and friends."
      (make-local-variable 'c-basic-offset)         ;This may not be strictly necessary.
      (setq tab-width 4
            c-basic-offset 4
            indent-tabs-mode t)
      (setq tab-stop-list (list 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64
                                68 72 76 80 84 88 92 96 100 104 108 112 116 120)))
    ;; Sample code to install the hook function for c-mode only.
    (add-hook 'c-mode-hook 'keramida/cc-indentation)
    ;; Sample code to install the hook function for *all* c-mode derivatives (c-mode,
    ;; c++-mode, perl-mode, php-mode, and so on).
    (add-hook 'c-mode-common-hook 'keramida/cc-indentation)

This seems to have worked. When I open a C source file with this Emacs session TAB is displayed using 4 columns, and the buffer-local ‘c-basic-offset’ is automatically set to 4. — GiorgosKeramidas

One more tip. You don’t have to manually type the list of tab stop columns. You can generate a custom list of tabs stops after you have configured ‘tab-width’ with the built-in ‘number-sequence’ function:

    ;; Generate a list of 200 tab-stops every `tab-width' columns.
    (let ((tab-stops 200))
      (number-sequence tab-width (* tab-width tab-stops) tab-width)))

200 tab stops are good enough for a terminal that is very wide. I haven’t seen a terminal with more than 800 or 1600 columns yet, and I suspect it’s going to be very difficult to scroll horizontally in such a terminal, so this should be enough for quite a while. — GiorgosKeramidas

Collaborative editing

This documentation hints at this being possible (as does the Wikipedia comparison of editors, But the documentation for it on this wiki contains two links, of which one is broken ( and one is to work in progress (SubEthaEmacs). So, is this very useful feature in, or is it out? And if in, where is the documentation?

I fixed the broken link with a simple Google search. You should try it next time if you find a link which doesn’t work.
In the meantime has been updated and may be worth another try.

Portable environment for W32

I’ve got the W32 variant of Emacs installed onto a flash drive however I’m not sure how it’s going to handle the home directory when run off the drive. Has anyone gone to any lengths to try to get emacs to behave nicely in MS-Windows off of a flash drive? I like to be able to use the tools I’m used to (or at least growing used to) portable and available no matter where I find myself working.

You can try setting up a .bat file to first set the HOME environment var to the flash drive, and then launch emacs. That should just about do the trick.
You can also do the setup inside the .emacs file instead. describes adding it to your site-start.el, but I’ve used the code (with small modifications) in my emacs.
Setting HOME from .emacs is problematic; .emacs is located in HOME. That is why the article describes adding code to site-lisp/site-start.el, which can sit alongside emacs on the flash device.

undo list persistence?

Is it possible to save the undo list of a file, to another file ( say to myfile.undo )? Together with GotoLastChange, it would allow quickly finding the places in the file you were working on, when you last saved it


My guess is that this is possible to do. It would involve hooking into the save and load hooks of a file, and reading/writing buffer-undo-list. If hte file got modified outside of emacs, the undo-list would be out-of-sync though. --JonathanArkell

Syntax Highlighting

Aquamacs newbie here. I can’t seem to easily find help on user-defined syntax highlighting for any file types. For example I work with a program called Ox, with .ox extensions. The command ‘decl’ is often used for declaring variables. Given my text is green, how I would I go about making ‘decl’ come up blue in .ox files to distinguish the command? Edited to add: simply put, I’m looking to add a new option for .ox files under File>Change Buffer Mode… , that highlights Ox syntax like decl, while, for, if,…etc.

Control Characters Visible in Dired Listing

When running find-grep-dired or find-name-dired, files with executable permissions display control characters around the file name like this:

    -rwxr-xr-x   1 user  users  75383 Aug  2  2005 ^[[1m^[[31m./web/lib/application.js^[[m^[[m

It appears that the buffer is trying to colorize the output, though this is not only an aesthetic problem; it also prevets me from opening the file. I have global-font-lock mode enabled, which works in all other contexts. I cannot find any variable or customize option that governs this. Is this a problem with my emacs setting or my terminal? I am running GNU Emacs through on Mac OS X.

I discovered the problem: my emacs instance was inheriting the environment variable CLICOLOR=1, which dired was trying to use to colorize the ls output. The simple fix was to unset this variable in my InitFile: (setenv "CLICOLOR" nil). But this still begs the question: can color dired output be achieved by maintaining the CLICOLOR variable and somehow tweaking some terminal settings?

Running on Mac OS X 10.3? (missing lib(s))

Is there a way to get this to run on 10.3, or build it for 10.3? I have 10.3.9. My Emacs (9.0rc1) crashes for lack of libncurses.5.4.dylib. (Of course that may only be the first missing library.) Fink only has up to 5.3. If I copy the library from my copy of 10.4, there is just another broken dependency within libncurses. If I symbolic link “libncurses.5.4.dylib” to “libncurses.5.dylib”, the loader refuses to be tricked. Does Emacs actually depend on anything new since libncurses.5?

If you want to fool the linker (possibly a risky prospect, perhaps less so if you only use Carbon Emacs), you need to link libncurses5.3.dylib to libncurses5.4.dylib, not libncurses.5.dylib. However, your best bet is simply to download, compile, and install ncurses from . It should be a simple matter of ./configure; make; sudo make install after you’ve installed the Mac OS dev tools. – SeanO

I use CarbonEmacs, it works great. Get it here for 10.3.9. – SebastienRoccaSerra

How do I determine the font name selected with 'menu-bar options mouse-set-font'?

When using ‘menu-bar options mouse-set-font’ I select (for instance) Andale-medium-11 from the gui. How do I determine what that font name is so I can add to my Preferences.el file or use as set-default-font for that name?

Does the following evaluate to what you want?

    (cdr (assoc 'font (frame-parameters)))

(Type M-: then enter the above, then hit enter)

– sfp

Joystick buttons?

Can I bind defuns to joystick buttons or movements somehow? --ShaeErisson

You can do this under Linux, at least; see JoyStick for any discussion and pointer to code on SourceForgeJohnSturdy (who wants to try this in the next year or so)

Interactive pop-up dialog?

Is there a popup input dialog box for Emacs and/or XEmacs, which returns the string that a user enters?

Well, maybe you could simulate a dialog box by opening a small fram or window and using read-string to get the input?

See the documentation for ‘x-popup-dialog’ in GNU Emacs.

Looking for a Mark Scope function

In all programming languages I use, I often want to work on a scope (like inside an “if” statement, a “for” loop, or a whole “function”).

Does anyone know of an implementation of a ‘mark-scope’ function? Or ‘beginning-of-scope’ and ‘end-of-scope’?

Ideally it would start by marking the smallest current scope, then the region would include bigger and bigger scopes until the whole buffer is marked.


You can mark an area with mark-sexp or ThingAtPoint or mark-enclosing-sexp (from ThingAtPointCommands). However if you want to edit within this region while it’s marked, you may want to use BasicNarrowing after you’ve marked a region. --AmitPatel

Auto-fill within square brackets?

I’m relatively new to Emacs, but have been experimenting with it to see if it would be worth switching. I write in Markdown and use pandoc to convert to whatever I need. In case it matters, I’m running Emacs 23.3.1 on Ubuntu 12.04.

I’m a graduate student in the humanities, so my writing is heavy on the footnotes. Footnotes, in pandoc, are formatted within square brackets. The problem I’m having is that auto-fill mode seems to ignore text within brackets, so my footnotes end up snaking their way across the page--and the only fix I’ve been able to find is to manually break the lines myself, every time I edit the paragraph. That’s obviously less than ideal. (I could also give up on inline footnotes, and leave them all separate references, but I’d prefer not to, and it doesn’t seem like that should be necessary.)

So my question is, is there a way to make auto-fill mode operate on text within brackets, too? Is there a reason it doesn’t by default?

Many thanks. – Brian

It’s not clear how it’s not working. One thing to know about AutoFillMode is that you need to know how the manual FillParagraph commands work to understand Auto Fill Mode. You can manually set or reset the fill prefix and Emacs also has AdaptiveFilling feature. Read the Emacs manual, ‘C-h r m Filling RET’. – AaronHawley

It turns out this is apparently peculiar to Markdown Mode. If I drop into Text Mode, the fill works fine.^[As it is, as soon as I add a footnote in this format that extends beyond a single line--and that includes no end brackets within it--then Emacs refuses to fill it, either automatically or on ‘M-q’.] I read the manual on filling, and while it was helpful on certain other counts, it didn’t give me any insight into why this might be happening. Any other suggestions? – Brian

Answers to frequent questions

These questions are kept here to let people avoid asking frequently asked questions that have answers.

Question: How do I a search and replace on multiple files from within Emacs?

Answer: Multiple strategies exist, and are listed at CategorySearchAndReplace.

Question: How do I install an Emacs mode?

Answer: See CategoryDotEmacs and InstallingPackages, and look at the “Customization” and “Major Modes” sections of the EmacsManual. Most modes not included with Emacs come with documentation or directions in their source(s) on how to install (usually by using ModeHooks). The alternative is perhaps EmacsMacro.

Question: Can I be shown the list of open buffer windows as tabs?

Answer: Yes, see CategoryBufferSwitching.

Question: Can I adjust the X server geometry and location of an emacs window in elisp? --ShaeErisson

Answer: The Emacs terminology is Frame. See also FrameSize.

Question: Can I fill paragraphs like AutoFillMode does, but to the width of the frame rather than to ‘fill-column’?

Answer: Yes, see WordWrapping.

Question: After performing a command on a region, I lose the region and have to manually reselect the region. Can this be avoided?

Answer: See TransientMarkMode.

Question: Is it possible to tunnel info to emacs via SSH without using X11? I prefer using the built-in emacs version shipped with OS X within Though, when I “ssh -X” it opens the server’s version & config for Emacs within an X window on OS X. Is there a way to bypass X11?

Answer: Yes: ‘emacs -nw’ starts a new text-only Emacs session.

Question: Why tetris is not shipped with emacs anymore? I have googled this, without success. Yet this particular feature is still advertised on

Answer: It still comes with my Emacs 24.3.