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.

45 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
261 views

Why is cloning of file buffers prohibited?

Why does clone-buffer not work on file buffers. I can make it work by the following advice: (advice-add 'clone-buffer :around (lambda (oldfun &rest args) "Allow cloning file buffers." ...
Tobias's user avatar
  • 33.2k
5 votes
0 answers
3k views

Emacs hitting "too many files open"

I am using Ubuntu 14.04LTS 64bit. I encounter this problem when I opened too many files by a emacs function. Error is signaled as a message and prevent me from opening more files. I checked my ...
tom's user avatar
  • 365
4 votes
0 answers
2k views

Emacs won’t access Documents directory on MacOS Big Sur

I am running Emacs 26.3 on MacOS 11.2.1 “Big Sur”. When I try to open the directory ~/Documents, it fails with the message “Listing directory failed but ‘access-file’ worked.” Emacs.app is given ...
Mikelis Bickis's user avatar
4 votes
0 answers
356 views

How to make find-file-other-window reuse existing window

Is it possible to make find-file-other-window open the file in a pre-existing window instead of creating a new one? Currently: |A---|B---| |A-|C-|B---| |----|----| -> ...
sp00kyb00g13's user avatar
4 votes
0 answers
2k views

When using emacsclient, how can I open the file in the active buffer?

When I open a file with emacsclient without invoking -c, Emacs visits the file in a new buffer in the background while leaving my current window configuration in place. I'd like to change this, e.g. ...
Michael A.'s user avatar
2 votes
0 answers
67 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
2 votes
0 answers
158 views

global-auto-revert-mode with confirmation first?

I know I can use (global-auto-revert-mode 1) to automatically revert a buffer if the buffer has been changed in another editor. However, when Emacs detects (automatically) that the buffer has changed, ...
user90726's user avatar
  • 173
2 votes
0 answers
71 views

Is there a predefined way to detect if a file is a Unix socket?

Are there predefined Emacs functions to check if a file is a Unix socket? The best I could come up with is the following code. (defun socket-p (fname) "Return non-nil if FNAME is a Unix Socket, ...
PRouleau's user avatar
  • 796
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-...
jollaWellbuur's user avatar
2 votes
0 answers
89 views

Simple Atom-style jump-to-file

I'm upgrading Emacs and moving from macOS to Windows after quite a few years getting by with a very old setup (eg, custom scripts for Anything). I've installed Helm. I'm interested in a simple way to: ...
pelrow's user avatar
  • 86
2 votes
0 answers
55 views

find-library equivalent for C internal source code files

Is there a built-in Emacs equivalent of find-library for the C internal source code files? If there is an additional step needed to create an index of the files (e.g., make tags) when building Emacs, ...
lawlist's user avatar
  • 19.1k
2 votes
0 answers
144 views

Accidentally visiting a FIFO

I'm in Dired, and one of the files in the current directory is a named pipe (FIFO) prw-r--r--+ 1 ivan staff 0 Feb 6 11:13 some_pipe If I (accidentally) visit it (with dired-visit-file), ...
ivan's user avatar
  • 1,948
2 votes
0 answers
309 views

How to find/grep in Python virtualenv with projectile/helm easier?

How I can customize helm/projectile behaviour to find files and grep in $VIRTUALENV dir easier? Or maybe I can write some function(s) to find/grep in virtualenv of current project?
sivakov512's user avatar
2 votes
1 answer
190 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?
godblessfq's user avatar
  • 1,217
1 vote
1 answer
191 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
1 vote
0 answers
63 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
1 vote
2 answers
135 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
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
1 vote
0 answers
58 views

How to rename files to numbers in Eshell?

List of files: $ ls -1 *.jpg IMG_20210909_0003.jpg IMG_20210909_0004.jpg IMG_20210909_0005.jpg IMG_20210909_0006.jpg IMG_20210909_0007.jpg … I want to rename these files to 1.jpg, 2.jpg, …, and I ...
feklee's user avatar
  • 1,079
1 vote
0 answers
177 views

Sharing .org file between two users

My secretory creates a daily agenda for me by capturing task to shared org file mytodo.org. When I open the agenda or mark the task done, her ability to capture new task gets limited as the mytodo.org ...
Vaibhav's user avatar
  • 11
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 <...
Don Allingham's user avatar
1 vote
0 answers
494 views

How to mount/unmount devices?

I'm interested in mounting/umounting usb and other devices directly from emacs. In many file managers (like nautilus) the devices are automatically discovered and indicated with an icon, it's possible ...
Francesco Cadei's user avatar
1 vote
0 answers
125 views

f.el: f-split behaviour

Using f-split from f.el: (require 'f) (f-split "c:/a/b") returns ("/" "c:" "a" "b") What is the rationale? Shouldn't it be ("c:" "a" "b")? Also in Emacs for Windows the value of: (f-path-...
antonio's user avatar
  • 1,822
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 ...
antonio's user avatar
  • 1,822
1 vote
0 answers
100 views

Dired+: Copy to nonexistent directory

Windows 10, Emacs 25.1, Dired+ I try to copy a file from test folder to nonexistent folder new: But I get this error: Is it possible to make Emacs autocreate folder new and copy the file to it? It ...
Alex's user avatar
  • 801
1 vote
0 answers
50 views

How to write custom read-file-name with expanded set of completions?

I am seeking advice for how to get tab completion in the minibar with a custom set of completion candidates that are either subdirectories or build targets from Makefiles. For context, I'm using the ...
josh's user avatar
  • 111
1 vote
0 answers
52 views

How to write a function for editing a file and then running a command?

I would like to write a function that does the equivalent of the shell command: vim $MY_FILE && $MY_COMMAND In other words, I would like to open a file in a buffer, and then when I save/...
sid-kap's user avatar
  • 544
1 vote
0 answers
150 views

Mac OS X problem accessing file via symlink

GNU Emacs 24 on El Capitan. When opening a file whose path includes a directory which is a symlink, Emacs emits the following error: *ERROR*: Wrong type argument: numberp, "Bus error: 10" If I ...
Daniel's user avatar
  • 196
1 vote
0 answers
41 views

Is it possible to display and edit the contents of a linked file?

In a Stack Overflow question, another poster wants to write OpenGL shader programs near to where they are used. However, performance tuning indicates that you should compile these shaders once at the ...
Shepmaster's user avatar
1 vote
0 answers
160 views

deactivate saveplace.el for filetype

Saveplace is a nice tool to remember where I have left of in a file. But for Org files it causes me problems when I quit emacs in the middle of a heading. My current try to deactivate it in org-files ...
kain88's user avatar
  • 835
0 votes
0 answers
19 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
0 votes
1 answer
36 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,657
0 votes
1 answer
41 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
0 answers
85 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
0 answers
40 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
0 votes
0 answers
31 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
104 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
  • 507
0 votes
0 answers
27 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
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
  • 11.9k
0 votes
0 answers
122 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
  • 272
0 votes
0 answers
163 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,084
0 votes
0 answers
175 views

Setting up Emacs as an external editor on windows 10

Apologies if this has been asked multiple times already, haven't found a useful answer. I am trying to use Emacs as an external editor on two separate applications in windows 10, one is a notes app (...
lumogas's user avatar
0 votes
0 answers
78 views

Can image-dired track renamed files?

I would like to view images using image-dired, then rename them. What I do at the moment: Open image-dired with my directory of choice. Mark an image that I want to rename. In the corresponding dired+...
feklee's user avatar
  • 1,079
0 votes
0 answers
48 views

How to get a list of all folder names under a folder?

I have a folder structure like this,i want get a list that all folder names in pack folder. Then traverse the list and load them ├── pack │   ├── completion │   │   ├── company │   │   │   └── pack-...
xiaodong huan's user avatar
0 votes
0 answers
158 views

How to get thing-at-point between separators

I'm trying to get hold of the current filename at point. In an arbitrary buffer. Say I have list of files in a buffer and I want to be able to do something with each file. For that I need to ...
iLemming's user avatar
  • 1,263