Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [scratch-buffer]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5 votes
1 answer
208 views

Variable scope issue in scratch buffer?

I encountered an issue with the following code, provided by NickD as an answer to a previous question (link to the question): (defun my-add-string-to-list (LIST-VAR STRING) (add-to-list LIST-VAR ...
Gabriele's user avatar
  • 1,618
0 votes
0 answers
126 views

Can I recover the contents of a scratch buffer?

Using Ubuntu 22.04. I accidentally closed a scratch buffer that I had notes in. Can I recover those contents?
JonahHuron's user avatar
2 votes
1 answer
65 views

Text Property of `initial-scratch-message' Not Taking Effect

;;; ~/.emacs.d/init.el (custom-set-variables '(inhibit-startup-screen t) '(initial-scratch-message #("++" 0 2 (face underline)))) I expect to see an ...
shynur's user avatar
  • 5,318
1 vote
1 answer
364 views

Opening emacs without the scratch buffer when opening a file (Please tell me what is wrong with my init file snippet)?

I recently updated my org-roam package to version 2.2.2 with the following steps: M-x list-packages Then select org-roam and clicked delete. M-x list-packages again Then select org-roam and clicked ...
Inspired_Blue's user avatar
1 vote
2 answers
412 views

How to read JSON file in emacs and display it in the scratch buffers?

I've a json data returned by endpoint which is as below: { "id":"1383", "entryPoint":"Stranger in the night.", "Source":"music" } What I ...
user1146081's user avatar
0 votes
1 answer
114 views

change starting buffer from *scratch* to recentf-open-files

I like the buffer that is opened when type M-x recentf-open-files. I'd love to have it as my starting buffer instead of scratch, but I don't know how. I've tried adding '(initial-buffer-choice '...
delki8's user avatar
  • 105
3 votes
2 answers
347 views

Multiple scratch buffers

Would like to use two scratch buffers on two side-by-side windows. How can I do this thing? Can only also ask for more than two scratch buffers that can be named?
Dilna's user avatar
  • 1
0 votes
2 answers
140 views

How to use `initial-scratch-message` variable to display mutliple status informations after start

I want to use the scratch buffer to display some status informations after starting emacs. I read I can use initial-scratch-message variable for this. But I do not know how to set it up. Here you see ...
buhtz's user avatar
  • 729
1 vote
1 answer
651 views

How do I show initial-scratch-message when the *scratch* buffer is recreated?

By default, a *scratch* buffer is created when Emacs starts. The initial *scratch* buffer contains the following message by default: ;; This buffer is for text that is not saved, and for Lisp ...
Flux's user avatar
  • 603
3 votes
0 answers
99 views

Why is file buffer replaced by scratch buffer on startup?

When I open an R file in ESS-mode, I'd like emacs to setup my panes in a certain format. To this end, I've added the following to my init.el. (add-hook 'ess-mode-hook (lambda() (...
Dan's user avatar
  • 191
0 votes
1 answer
1k views

How to prevent `*scratch*` or `*Messages*` buffer to show up when I open via `emacs -Q`?

I realize when I open emacs using emacs -Q I can see *scratch* for a very short time. Sometimes 1ms or half a second. => How to prevent *scratch* or *Messages* buffer to show up when I open via ...
alper's user avatar
  • 1,380
3 votes
1 answer
176 views

Is there a version of lisp-interaction, à la *scratch* buffer, with asynchronous processing of evaluation?

While I develop some Emacs-Lisp code, I often test it in the *scratch* buffer, just to make sure that what I just wrote behaves like I believe it does. But sometimes evaluating an expression takes ...
phs's user avatar
  • 1,239
2 votes
1 answer
406 views

How to make Emacs "forget" code evaluated in scratch buffer?

I have a function named my-func in my init.el. I copy this function to the scratch buffer, make some changes to it and evaluate it with C - j. I then delete the code in the scratch buffer and then ...
aks's user avatar
  • 145
0 votes
2 answers
236 views

Can I open emacs in nw mode with the scratch buffer? (when emacs is aliased to emacsclient session)

closed that, re-incarnated here: When starting emacs from the shell command line, if you pass the "dot", it opened emacs with a 'dired' of the current directory. But can I do this? emacs '*scratch*'...
american-ninja-warrior's user avatar
1 vote
1 answer
199 views

Can I open emacs in nw mode with the scratch buffer?

When starting emacs from the shell command line, if you pass the "dot", it opened emacs with a 'dired' of the current directory. But can I do this? emacs '*scratch*' so emacs opens with the focus ...
american-ninja-warrior's user avatar
2 votes
2 answers
603 views

Different color theme for scratch buffer

I'd like my *scratch* buffer to have it's own color theme, different to the one I use elsewhere, so that I know when I'm working there. How can I do this?
SabreWolfy's user avatar
  • 1,418
3 votes
4 answers
2k views

How to replace the default contents of the scratch buffer with the contents of a file (if it exists)?

I would like emacs to check for a ~/emacs.d/scratch.txt and use it's contents instead of the default message when emacs starts. How can this be done?
ideasman42's user avatar
  • 8,826
4 votes
1 answer
658 views

I've modified "initial-scratch-message" -- what else must I do to see it effected?

Using the menu Options-Customize Emacs-Browse Customization Themes, I've modified initial-scratch-message. I saved my customizations; and exited Emacs. When I re-start Emacs, the initial-scratch-...
TheGeeko61's user avatar
8 votes
2 answers
955 views

How to disable lisp-interaction when starting Emacs?

When I open Emacs, the *scratch* buffer is in Lisp Interaction mode, but I don't want that. How can I make the buffer have a text mode instead of Lisp Interaction?
new Q Open Wid's user avatar
1 vote
2 answers
806 views

Emacs lisp format doesn't print to *scratch*?

I've got this function (defun mt () (dotimes (x 20) (dotimes (y 20) (format "%3d " (* (1+ x) (1+ y)))) (format "\n"))) in my *scratch*. a Ctr-= prints back mt. But then ...
147pm's user avatar
  • 2,969
0 votes
2 answers
37 views

Trigger custom function when `*Scratch*` is recreated

I would like to run a custom function whenever a new *Scratch* buffer is created because the last uninteresting buffer was killed. I looked at both the C source code and window.el and it appears that ...
lawlist's user avatar
  • 19.2k
3 votes
1 answer
131 views

Web-mode + Dust.js, no indentation?

If I go to scratch, M-x web-mode RET, type in this snippet: <script type="text/x-dust-template"> {#obj_to_iterate} {prop} <----- this should indent {/obj_to_iterate} </script&...
user12968's user avatar
12 votes
3 answers
1k views

never close scratch

If I ever close the *scratch* buffer it is always an accident. I have persistent-scratch so it's as easy as a persistent-scratch-reload but it'd be nice if the scratch couldn't be killed. How can I ...
fommil's user avatar
  • 1,800
3 votes
1 answer
1k views

Set a default scratch buffer

My emacs daemon for ocaml (I use more than one emacs daemon) starts in a tuareg scratch buffer. I am aware of initial-major-mode but this hasn't worked: the scratch is started before (setqinitial-...
Nicolas Scotto Di Perto's user avatar
16 votes
4 answers
4k views

Is it possible to create an org-mode *scratch* buffer?

While working on a document in emacs I often find myself opening a new buffer, doing something in org-mode, copying the org-mode content, and pasting it into my document. I used to create a new org-...
Brian Fitzpatrick's user avatar
4 votes
1 answer
1k views

Scratch always starts in fundamental mode

I don't know what change in my configuration caused this, but scratch buffer always starts in fundamental-mode. I would like to have emacs-lisp-mode in the scratch buffer. I tried to do (setq initial-...
rumember's user avatar
2 votes
1 answer
136 views

Function coloring in scratch buffer

When I am typing in the scratch buffer, I type certain functions such as defun and while and they are recognized by the buffer and appear in purple. However, with other Lisp functions such as set or +,...
Ahmed Noor's user avatar
0 votes
0 answers
33 views

Emacs scratch buffer Lisp eval [duplicate]

So I'm entirely new to programming but I have been trying to familiarize myself with emacs for future scripting. When I am typing in the scratch buffer, I type certain functions such as defun and ...
Ahmed Noor's user avatar
0 votes
1 answer
185 views

current-active-maps shortens map entries [duplicate]

I try to print all key bindings in the current buffer using (current-active-maps) In the message buffer, the entries are not fully printed & are replaced by .... after a level. Like this, ((...
Saravana's user avatar
  • 2,071
7 votes
2 answers
649 views

How can I view the full `package-alist` value (without the truncation characters "...")?

When I do C-h v package-alist, I see something like ((PACKAGE-NAME1 [cl-struct-package-desc PACKAGE-NAME1 (VERSION1) "DESCRIPTION1" (...
Kaushal Modi's user avatar
  • 25.7k
5 votes
1 answer
2k views

Autosave *scratch* to a directory

When typing ls in my home directory, I amm greeted by a lot of this: #%2Ascratch%2A#1399_po# #%2Ascratch%2A#14484YsZ# [...] I also have the following in my init.el (defvar autosave-location (concat ...
PythonNut's user avatar
  • 10.4k
3 votes
3 answers
679 views

Rename scratch buffer and ask confirmation to kill non-file buffers created by user

I tend to use often non-file buffers kinda like post-it-notes and it is way too easy to kill them inadvertently, as there is no confirmation to kill. Even if you enforce the habit of writing only in ...
antonio's user avatar
  • 1,822
23 votes
1 answer
1k views

How can I quickly toggle between a file and a *scratch* buffer having the same major mode?

At times while working on a code, it's useful to quickly open a *scratch* buffer to paste a snippet from that code file. If I am working on a Perl script, I would like to quickly open a *scratch* ...
Kaushal Modi's user avatar
  • 25.7k
46 votes
5 answers
16k views

Re-open *scratch* buffer

If I accidentally closed the scratch buffer in Emacs, how do I create a new scratch buffer?
programking's user avatar
  • 7,224