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
1 vote
1 answer
50 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 ...
0 votes
1 answer
16 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 ...
1 vote
1 answer
44 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 ...
173 votes
10 answers
114k views

How do I reload a file in a buffer?

I usually work on files which are updated in the file system via version control. What's a quick way to reload a file without having to C-x C-f the file again and getting asked if I want to reload it?
15 votes
2 answers
1k views

Display recursive folder sizes in-line in dired?

I'd like to display the recursive size (the value that would be reported by du) of folder contents in-line in the dired buffer as an additional column or in place of the directory file size. Is this ...
17 votes
9 answers
9k views

Recursively list all files and sub-directories

Is there a way, possibly using a package, to recursively list all the files (with paths) and sub-directories (or at least the empty sub-directories, since the paths to the non-empty ones can be ...
2 votes
2 answers
2k views

Open file in orgmode with external application. Check if file exists and create file from template if necessary

I want to create a file with org-open-at-point from a template if that file does not exist. If it exists, I want to open it in an external app. In org-mode, file-links are created by [[file:path-to-...
2 votes
1 answer
187 views

Manage freedesktop trashcan with dired mode

Trashed files are stored in the FreeDesktop standard location: ~/.local/share/Trash/files. How do I restore or permanently delete files in that folder using dired?
1 vote
2 answers
114 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.)
0 votes
1 answer
157 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 ...
2 votes
2 answers
192 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 ...
0 votes
1 answer
36 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 ...
0 votes
1 answer
57 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&...
1 vote
1 answer
1k views

Test file permissions in Windows

The file-writable-p docstring says: Return t if file FILENAME can be written or created by you. In Windows you cannot usually write on files when they are used by a different app. In these ...
0 votes
1 answer
36 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 /...
0 votes
1 answer
92 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 ...
2 votes
2 answers
395 views

Highlighting automatically on file open

I would like to highlight lines with a certain pattern whenever the file is opened. Specifically when Journal.org is opened I want to run commands like M-s h l to highlight a set of patterns and ...
1 vote
1 answer
32 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, ...
1 vote
2 answers
108 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 ...
1 vote
0 answers
55 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 ...
1 vote
1 answer
117 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) ...
2 votes
1 answer
103 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 ...
0 votes
0 answers
72 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-...
1 vote
0 answers
191 views

Problem saving (C-x C-s) files on a NFS drive with emacs 24/25

Starting with Emacs 24 (using various different versions of Ubuntu and Linux Mint), if I open a file on an NFS drive, modify it and attempt to save it C-x C-s, I get the message of: Saving <...
1 vote
2 answers
2k views

Disk interaction occasionally extremely slow

I'm using GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570 on Windows 7. Somedays (yes, weirdly, it seems to be only some days), Emacs takes a very long time (a few seconds) when reading or ...
0 votes
3 answers
101 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 ...
0 votes
2 answers
82 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 ...
2 votes
2 answers
64 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 ...
1 vote
2 answers
522 views

change default action of opening multiple files in dired

Having marked a bunch of files in dired-mode, if I wanted to open all them at once, I press F. But, the problem is, all the selected files opens in their own separate window and now i've at least as ...
0 votes
2 answers
69 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. ...
0 votes
1 answer
36 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 ...
0 votes
1 answer
43 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 ...
2 votes
1 answer
160 views

What are the '.#' links for? [duplicate]

When an Emacs buffer is modified, a broken link is created. The link's name is a concatenation of '.#' followed by the file's name. For example: $ ls .#spacemacs_ref.org -l lrwxrwxrwx. 1 wolfv wolfv ...
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’...
2 votes
2 answers
758 views

open multiple files in tabs from command line

Emacs-27.1 ships with a new tab-bar-mode minor mode. This puts a tab bar at the top of each Emacs frame. Each tab in the tab bar can display multiple windows. Is there any way to invoke Emacs from the ...
0 votes
0 answers
37 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 ...
2 votes
1 answer
510 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. ...
0 votes
2 answers
84 views

How to automatically create another file that matches a regex based on a file created?

Suppose I create a file in dir1/file1.txt. As soon as I write the file for the first time, I want to create another file in dir2/file1_friend.txt. But when I create a file dir1/file2.txt, I want the ...
0 votes
1 answer
168 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 ...
0 votes
2 answers
23 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 ...
0 votes
1 answer
32 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 ...
1 vote
1 answer
21 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 ...
2 votes
1 answer
34 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")) (...
16 votes
6 answers
7k views

Ivy disable completion for a command in minibuffer

Can I disable ivy completion for a single command while in minibuffer? For example I am in folder ~/code/study/ . If I open find file and autocomplete with Ivy I will see Find file: ~/code/study/ ./...
1 vote
1 answer
56 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 ...
3 votes
1 answer
211 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 ...
0 votes
0 answers
30 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 ...
0 votes
1 answer
18 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 ...
3 votes
1 answer
3k views

Ignoring specific files in recentf-mode [duplicate]

I use company-statistics to sort completion candidates by previous completion choices. It works perfectly, except there is only tiny problem. The file ~/.emacs.d/company-statistics-cache.el pops up in ...
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 ...

1
2 3 4 5 6