Skip to main content

Questions tagged [files]

Use this tag for questions about moving, deleting, or opening files. Or for questions about the difference between a buffer and its file. For topics such as "Saving Files", use "buffers" instead.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 views

How do I save a buffer from EmacsLisp without being prompted for a filename?

I modified an answer to a recent question to try and save the output to a file. It is going to a buffer, but when it hits the (save-buffer) it prompts me for a filename. I want it to save without a ...
Scooter's user avatar
  • 103
0 votes
0 answers
31 views

Is there workaround to mirror a buffer to a file (similar to indirect buffer)?

I am familiar with indirect buffer capability of emacs. From doc string: An indirect buffer shares the text of some other buffer, which is called the base buffer of the indirect buffer. In some ways ...
Name's user avatar
  • 7,967
0 votes
0 answers
28 views

Cant' delete files/directories on Synology

I'm on macOS 14.4.1 and have Emacs 29.2 plus installed from Homebrew. I have an access problem with Dired on my Synology when I try to delete files: "file-error: Removing old name: Operation not ...
Emax2020's user avatar
1 vote
1 answer
50 views

Opening multiple files: how to change default buffer order

When I run $ emacs file1 file2 file3 file4 in a Unix shell, this is the result (using C-x Left and C-x Right to switch buffers): file4 file3 file1 file2 *BufferList* *scratch* The starting buffer is ...
Ness's user avatar
  • 177
0 votes
1 answer
47 views

How to prompt for a virtual buffer (recently killed file buffer) using Ido completion?

When ido-use-virtual-buffers is set to t, ido-switch-buffer shows, after the list of live buffers, a list of killed file buffers in chronological order, last killed first. Those are what Ido calls ...
Arch Stanton's user avatar
  • 1,727
1 vote
1 answer
61 views

Re-visit a file whose buffer I just killed [duplicate]

I've not found any straightforward way to re-visit a file whose buffer I just killed. Sort of like undoing the killing of the buffer. I thought about getting the file's path from Ido's virtual buffers ...
Arch Stanton's user avatar
  • 1,727
1 vote
1 answer
219 views

What causes this "Spawning child process: Exec format error"?

Sometimes when I try to open a file, I get this error. It can be any file type (.org, .html, etc.) Once Emacs gets into the state, it seems to stay messed up, and I have to restart. Emacs version: GNU ...
Rob N's user avatar
  • 691
0 votes
1 answer
38 views

erroneous message editing SMB file

I'm running GNU Emacs 29.1 on a Mac mini. I've used Emacs uninterruptedly since 1987. I don't normally participate in discussion groups like this. When I edit a file in a directory that is in a SMB ...
Lynn David Newton's user avatar
1 vote
1 answer
50 views

What's an easy way to view a copy of a text buffer as a hexl buffer

I sometimes want to look at the hexl-mode view of a text file buffer in one window and in another window I want to keep the original text view. What's an easy procedure to do so? -- Due to the fact ...
halloleo's user avatar
  • 1,365
0 votes
1 answer
141 views

How to print and read a list to(from) a file?

I'd like to save a (extremely minimal) database made of a lisp list and then read it back. The list will look like something as follows: (:foo "bar" :baz "foobar" :foobaz "baz&...
ygy's user avatar
  • 103
1 vote
1 answer
237 views

Visual Glitch whenever loading emacs

I am running emacs on WSL, and whenever I load emacs I get the following screen: It goes away for a half second whenever I click on it, but then it comes back. Very new to this so am unsure what is ...
Dogalon Bruno's user avatar
0 votes
1 answer
56 views

Emacs macro variables

Does Emacs have 'macro variables'? Midnight Commander allows the use of macro substitution expressions like %f %D %t which can be use when running commands. eg %f is the name of the current file in a ...
balanga's user avatar
  • 135
0 votes
1 answer
97 views

Setting `auto-save-file-name-transforms` has the wrong effect: Auto-save files are stored in Emacs config directory

Assume I have the file ~/Documents/bla.org. Now I open a buffer that visits the file ~/Documents/bla.org. I check the value of the (buffer-local) variable buffer-auto-save-file-name, and it reads /...
Berber's user avatar
  • 125
1 vote
1 answer
62 views

Combined search: notmuch mail, org-mode docs, and filesystem locate?

I often look for information that could be either in some org-mode document, in an old email, or somewhere in the file system (and probably other places). Now I can use org-search, notmuch-search, ...
Ketil Malde's user avatar
1 vote
0 answers
76 views

What causes "file changed on disk; really edit the buffer?" for files on a network share?

What causes "file changed on disk; really edit the buffer?" for files on a network share? I edit files on an SMB share and I get constantly this question: "changed on disk; really edit ...
Jason Hunter's user avatar
2 votes
2 answers
220 views

How to make buffer recognize file moved?

Here's a simple use case: I open bar/foo/file in a buffer and I'm working. In eshell, I do mv bar/foo/file bar/baz/foo/file. Now emacs can no longer recognize where to save and doesn't save it ...
user129393192's user avatar
2 votes
1 answer
149 views

Function load raises error on loading an existing file

I started getting an error on loading theme files and tracked it down to the (load) function being called by (load-theme). I tried to isolate the problem with the following test function and am still ...
Daniel Doherty's user avatar
0 votes
0 answers
121 views

"touch file" in dired mode

I found this answer: (eval-after-load 'dired '(progn (define-key dired-mode-map (kbd "c") 'my-dired-create-file) (defun create-new-file (file-list) (defun exsitp-untitled-...
user129393192's user avatar
0 votes
3 answers
133 views

How to delete all the files matching regular expression in elisp?

I want to make some clean-up with auto-generated files. How can I delete all the files matching some regexp mask from within elisp? As an example of desired functionality... Something like the line ...
martinoidar's user avatar
0 votes
2 answers
96 views

How can I interactively replace text in all files in all subfolders?

Emacs 27.1 Linux Mint 21 I have text modifyNetwork in 50 files in differents folders. I need to replace them by text performCommand. What is the easiest way to replace text in all files in all ...
a_subscriber's user avatar
  • 4,204
2 votes
2 answers
74 views

Creating scratch R files

Often I want to create a temporary R file and don't want to save the file or name the file. Is there a way to achieve this outside of using C-x C-f and naming a file? For example, in VSCode or Rstudio ...
cdd's user avatar
  • 217
0 votes
1 answer
41 views

Recent Files on Removable Media (There's no such thing)

Whenever I edit files on removable media, these files disappear from the recent files list, when I remove the media. When I reinsert the media, I have no recent files for that medium and I have to ...
Jason Hunter's user avatar
0 votes
2 answers
79 views

Edit File on USB :: umount Target is busy

If I insert a USB drive and edit a file on it, then kill the buffer, I have to wait atleast five minutes before I'm able to umount the drive $ sudo umount /dev/sdl1 umount: /mnt/sdl1: target is busy. ...
Jason Hunter's user avatar
0 votes
1 answer
45 views

Close File, Still in Use

I have a problem, where after I edit a file on a USB stick and close the file with C-x k, Emacs still has a grip on the file until this message appears a few minutes later: Debugger entered--Lisp ...
Jason Hunter's user avatar
1 vote
2 answers
161 views

How to indicate in the mode-line that current-buffer's file has changed on disk?

How can I show if a file has changed on disk, in the mode-line? (I'm trying to troubleshoot why auto-revert doesn't work for me, and such an indication would help.)
Jason Hunter's user avatar
2 votes
1 answer
48 views

FILE(s) Passed by Shell to Emacs to Visit

The FILE mentioned in the title, is what in $ emacs FILE or $ emacs -file FILE or something else similar. How do I know whether there’s a FILE / FILEs set for Emacs to visit at startup? If there’...
shynur's user avatar
  • 5,815
0 votes
0 answers
45 views

Visit New File doesn't create new directories

Maybe I am completely misremembering but I am sure that Emacs used to create missing directories when using Visit New File command. Let say that ~/Documents exists. And I want to create a new file in ...
mislyde_alfabetisk's user avatar
2 votes
1 answer
818 views

How do I hide the welcome screen if and only if one or more files are opened by emacs upon startup?

Right now, if I do "emacs foo1 foo2" emacs will open with foo1 and the welcome screen showing in two windows splitting the frame vertically. Instead, I want to be shown foo1 and foo2. ...
Thomas's user avatar
  • 21
0 votes
2 answers
30 views

`rename-file` into a different filesystem which does not support permissions

I'm running emacs under WSL 2, in which Windows drives are mounted below /mnt/<Drive Letter> with 9p as the filesystem. That filesystem does not support (setting) permissions on files. I want to ...
Lukas Barth's user avatar
0 votes
1 answer
385 views

How to comment out multiple or all files in a directory?

I frequently use commands like paredit-comment-dwim, comment-dwim, and comment-region. I am also aware these commands can have a compound effect with the mark command. But, I would like to comment ...
Pedro Delfino's user avatar
0 votes
1 answer
36 views

In Magit, is it possible to know when an unstaged change happened? How to find that information?

I have a repository under version control and I am using Magit as an interface to git. I can see one unstaged change in a file after executing magit-status (C-x g). This means the file was changed and ...
Pedro Delfino's user avatar
1 vote
1 answer
22 views

Is it necessary to save buffers as files in order to use command highlight-compare-buffer?

Based on a nice comment from @Drew on this previous question, I tried to use the command highlight-compare-buffers (although he did not mention exactly this comment). My first attempt was actually ...
Pedro Delfino's user avatar
2 votes
1 answer
36 views

How can I ignore non-existing files in a fixed custom tags-search?

I want to search through a fixed set of files and I use the tags-search command for it: (defvar my-files-form '(list "/path/to/one/file" "/path/to/another/file")) (...
halloleo's user avatar
  • 1,365
1 vote
1 answer
69 views

How to comment or uncomment the same lines of code in multiple files at once?

Suppose you have multiple files which has common lines of code or common matches of a regexp pattern. Is there an "emacs way" to comment/uncomment such specific common lines at once in all ...
Julia's user avatar
  • 151
3 votes
1 answer
254 views

Organizing images in emacs

There is image-mode and image-dired, but if you want to do anything except sequential viewing, they become clunky quickly. And they are slow for good quality photographs. I would like to be able to go ...
xeruf's user avatar
  • 354
0 votes
0 answers
35 views

Turn directory to file in dired

I often make the mistake of creating a directory instead of a file in Dired (by hitting +). I then have to delete it and recreate the file, with the same name. Sometimes, I tried to edit the d file ...
smonff's user avatar
  • 1,589
0 votes
1 answer
24 views

read-file-name: input an non-existing file with a default name in ido

I'd like to ask to the user where to save a .png file, where I provide some defaults, like: (read-file-name "Picture name:" "/tmp" "mydefaultname.png") (ideally in a ...
tobiasBora's user avatar
1 vote
1 answer
143 views

Function that determines and returns the programming language of a given file

I'm working on some compiler shortcuts: I want to write a function (cmp FILE-NAME &optional args) that will use FILE-NAME and args to construct the appropriate COMMAND to call (compile COMMAND) ...
andy_programs's user avatar
0 votes
1 answer
131 views

Option similar to `vc-directory-exclusion-list` but for files create by build tools

I'm missing an option variable similar to vc-directory-exclusion-list that holds of a list of auto-generated directory names that contain temporary files that are typically but not exlusively created ...
Nordlöw's user avatar
  • 527
1 vote
2 answers
119 views

Is there some Emacs command that behaves as readlink -f to print the full path of a especific file?

In the terminal, I can do: $ readlink -f docker-compose.yml Which outputs: /home/pedro/projects/docker-stuff/docker-compose.yml I would like to have something like that in Emacs so that I can find ...
Pedro Delfino's user avatar
1 vote
0 answers
56 views

How to open file with it being editable but not writeable?

I teach, and I like to use real files as examples in class. I want to be able to edit the buffer to show student things, but I don't want to risk accidentally writing the changes on the file. What I ...
elPolloDiablo's user avatar
3 votes
1 answer
481 views

Tramp mode - Copying files

when copying files in tramp mode via ssh with Dired I am not able to do anything else in Emacs. Emacs is just not usable till this process has finished. Is there any way to use Emacs while it copies ...
cptflint's user avatar
  • 131
0 votes
0 answers
28 views

Introducing functionality stored in a file into another file defining a minor-mode

I am debugging a minor-mode and have split the file into two files. How would one introduce the functionality in the second file into the minor-mode file? I have my minor-mode called rk-bracemarks ...
Dilna's user avatar
  • 1
0 votes
1 answer
36 views

Being in *shell* buffer, is it possible to open a file with the current Emacs application from a shell command?

After executing the shell command, I have a shell buffer inside Emacs. After executing classic ls -l, there is a file listed that I want to open in Emacs: [pedro@system:~/projects/career-opportunities]...
Pedro Delfino's user avatar
1 vote
1 answer
219 views

How do I get org-todo-list to see changes I made outside of local emacs?

I sync my org files between multiple devices with a Dropbox-like service. When a change is synced to a computer1 that already has Emacs running, org-todo-list subsequently shows stale headings. I am ...
billkw's user avatar
  • 111
1 vote
1 answer
78 views

How to set the file-permissions of a buffer before it's written?

Is it possible to set the permissions on a buffer before it's written to a file? Or is it necessary to change the permissions after writing it? (technically this would allow some small time-frame for ...
ideasman42's user avatar
  • 9,027
2 votes
0 answers
71 views

How to save a Slime Debugger buffer into a file, preserving all its data?

I am using Common Lisp, SBCL, Emacs, and Slime. Often, an error will happen while programming. When an error occurs, Slime opens a Debugger buffer. Sometimes, I would like to save this debugger buffer ...
Pedro Delfino's user avatar
0 votes
0 answers
48 views

Are there any low-level functions for reading files in elisp?

I am looking for something equivalent to this in Python f = open('2021-11-10.org') print(f.readline()) I know you can insert the file-contents into a buffer and do something like this, but that is ...
John Kitchin's user avatar
0 votes
0 answers
137 views

Detect whether a file is "binary" from elisp

I am wondering whether current versions of Emacs have any built in mechanism for guessing whether a file (that my elisp code is about to load, or perhaps has just loaded, into a buffer) is 'binary' ...
zwol's user avatar
  • 281
0 votes
0 answers
196 views

Show progress bar for long operation?

Linux Mint 20.2 Emacs 27.2 When I do some long operation not show progress bar. Is it possible to show progress bar in this situation? Examples of long operations: Copy many files Copy big files ...
a_subscriber's user avatar
  • 4,204

1
2 3 4 5 6