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
1answer
31 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
1answer
24 views

Search for file content with swiper-all or similar interface

I've been using swiper-all to search for content in buffers. This works really great as I easily can navigate between the files and select the ones I want to work with. Is there some way I can use a ...
0
votes
0answers
38 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 (...
2
votes
1answer
68 views

How do I save raw bytes into a file?

I'm trying to make a .wav file generator in Emacs Lisp. I have some binary data, as a sequence of bytes: (setq binary-data (list 62 236 60)) I would like to insert that data into a file. I expect ...
0
votes
1answer
46 views

reverse buffer order

I open Emacs from the command line to inspect 10+ files, say like this: emacs *.java However, all the files are listed in reverse order. This is getting kind of annoying--I'd like to start with the ...
1
vote
1answer
57 views

Function `cd` not working correctly in conjunction with `tramp` and `compile`

For context I am looking at a remote file; for example: /ssh:desktop:/home/user/project/src/file.cpp. I then issue the interactive command compile like so: cd /ssh:desktop:/home/user/project/Release &...
0
votes
1answer
220 views

Always open new files in the same window

When I open a file externally - through the terminal or the file manager GUI, it opens in a new window. How can I always open a file in a new buffer of an existing emacs session?
1
vote
1answer
32 views

Relationship between frame, buffer, and file

I am trying to check how frame, buffer, and file work. It seems to me that frame commands(C-x 5 ...) create a frame, whether a buffer or file exists or not. Here is what I am thinking: C-x 5 2 1. ...
6
votes
1answer
450 views

How to prevent creating files starting with .# (lock files)?

Emacs 26 I have a file rest.api.rc. When I start editing it, the following lock file is automatically created: .#rest.api.rc After saving file rest.api.rc, the lock file .#rest.api.rc is gone. How ...
0
votes
1answer
146 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-...
4
votes
1answer
188 views

Read first N lines of file into list

The general way this seems to be done using Elisp is to first read the entire file using something like insert-file-contents-literally or find-file-no-select, using split-string on a newline, and then ...
1
vote
1answer
66 views

Reading a list of string from a .txt file

I have a file, myfile.txt, whose content is: (query-replace "foo" "Hello" nil (point-min) (poin-max)) and this function: (defun comment-string-from-file () (interactive) (let ((STRING (with-...
1
vote
1answer
45 views

How to tweak dired-create-empty-file to facilitate the easy creation of files

I currently have bound the command dired-create-empty-file to f7. Emacs then prompts me for a file name. When I press f7 I would like Emacs to automatically create an ORG file and automatically ...
0
votes
2answers
63 views

Load a list from a file (in a script)

I have a script containing this code: (let ((JOURNALS '( ("abhandlungen aus dem mathematischen seminar der hamburgischen universitet" . "Abh. Math. Sem. Univ. Hamburg") ;; ...
0
votes
2answers
77 views

How to insert boilerplate code in a file based on the directory in which it is created?

Suppose I have a file dir1/this_file.txt and dir2/this_file.txt, and I want to insert different boilerplate code not based on the file name or extension, but based on the directory in which the file ...
0
votes
2answers
42 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 ...
2
votes
2answers
79 views

Instruct Emacs never to open files of a certain type or size

In Emacs by default there is a large file warning threshold. I would prefer to instruct Emacs never to open files of a certain type or size. These are files I would prefer always to open in an ...
0
votes
0answers
26 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+...
1
vote
1answer
28 views

How to prompt user for a proper writable file in Emacs Lisp?

I need to prompt the user for a file which is 1) not a directory 2) if already exists, is writable. I know I can use read-file-name, but I'm not sure how to filter out the improper files. ...
0
votes
1answer
50 views

How delete folder named “build” in all subfolders?

Emacs 26.1, Dired+, Windows 10 Suppose I has the next dir tree: myproject myproject\app\ myproject\app\build myproject\app\src myproject\lib\build myproject\lib\src myproject\lib2\build myproject\...
1
vote
1answer
92 views

get the full path (path + filename) of the currently editing file in to the OS clipboard

when editing a file (for example a .pl file) Whats the quickest way to get the full path (path + filename) of the currently editing file in to the OS clipboard. I'm on macOS, where echo "hello" | ...
0
votes
0answers
45 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-...
4
votes
2answers
583 views

How to open all the opened files from a previous session?

Whenever I open my spacemacs I see the recentf buffer which lists 5 files I had open in my previous session. There is only an option to open them one by one, and only five of them, because others are ...
0
votes
1answer
36 views

Using the :match attribute for custom matching for a Helm source

I'm trying to create a Helm source which matches the basename of files. I created a source which splits the basename of files in recentf list and puts the path behind it in parens (it uses the (...
1
vote
0answers
52 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 ...
0
votes
2answers
277 views

read epub with nov

Upon reading epub on emacs, I tried https://github.com/wasamasa/nov.el. Installed and configured step by step as its instructions. When C-x C-f to open an epub, it is displayed as M Filemode ...
-1
votes
2answers
52 views

What tool can I use to compare files by content in dired mode? [closed]

windows 10 (64 bit) Emacs 26.1, Dired+ I need tool that can compare files by content with highlight different symbols. Example: As you can see I mark two files. Is it possible to compare this ...
2
votes
0answers
56 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: ...
3
votes
0answers
113 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---| |----|----| -> ...
2
votes
1answer
233 views

how to ignore current selection from ivy when my typed text matches one

I run into this issue from time to time when I want to create a new file but the new name matches a pattern already so my Ivy auto-complete setup will pick the matched option when I press Enter ...
1
vote
2answers
154 views

Save place in files but don't move the cursor to the saved position automatically

I'd like to have a command that moves the cursor to the last position it was in when I left the buffer (either by killing it or by killing Emacs). I know I can use saveplace.el to save the position ...
1
vote
1answer
49 views

Why does a certain file always gets opened on startup?

I'm using desktop-save-mode to automatically open the files that I had opened in the last session. This mode should also remember the files that I closed so that it no longer opens them in the next ...
1
vote
1answer
38 views

how to copy a deeply nested binary file from one git repo to another [closed]

I want to copy an image file from one github repo to another. The source and destination file paths are deeply nested within the repo (eg. copy ~/code/repo1/src/components/A/components/B/common/...
2
votes
1answer
144 views

Why Emacs (dired+) asks me twice to delete file?

windows 10, Emacs 26.1, dired+ Suppose I want to delete (move to trash) file in dired mode. D Emacs asks me: I press y and now it's asking me again to kill file. Why Emacs asks me twice? I want ...
4
votes
1answer
201 views

Open directory containing file during counsel-file-jump

I use counsel-file-jump to search files recursively. I would like to open the directory that contains a particular file candidate. I can execute counsel-dired after I open the file, which allows me to ...
1
vote
1answer
61 views

emacs 25: display-buffer-other-window behavior change, how to tune for the old way?

I have a number of macros for browsing source code for many emacs versions. I wrote this in 2009 and it's been solid until upgrading to U18.04. I know it worked in U16.04: (defun get-file-from-...
2
votes
1answer
456 views

How do I silently write to a temporary file?

I made a modification in org-pomodoro to send the mode line to a pipe which I use in xmobar, but it keeps spamming my *Messages* buffer, thus making the line which displays it almost useless. (write-...
0
votes
6answers
639 views

How to append contents of multiple files into one file?

Emacs 26.1, Windows 10, Dired+ How to append contents of multiple files in one folder into one file?
2
votes
2answers
129 views

Rename file from space to underscore in dired just the filename. Xah function for this also renames all parent directories

I found this function by xah to do this but it also looks at the parent directories. Ideally, this would just look at the filename not including the parent name or parent directories. Something along ...
1
vote
2answers
270 views

What does the prompt mean for `has changed since visited or saved. Save anyway?`

When I try to save a buffer back to a file: install-packages.sh has changed since visited or saved. Save anyway? (yes or no) I don't know why it happens, but I also see #install-packages.sh# ...
5
votes
0answers
119 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." ...
3
votes
1answer
30 views

How to get TRAMP to respect group sticky bit?

In using TRAMP to create a new file in a remote (Unix) directory, I discovered that TRAMP is not respecting the group sticky bit in that directory. As is standard on a Unix system, the group ...
1
vote
1answer
231 views

Emacs freezes when saving org file in org-mode

For some reason I cannot save files while in org-mode. This happened after I updated to a most recent version of org-mode. If I change to text mode I can save without a problem. I have tried C-x C-w ...
0
votes
1answer
99 views

Tramp keep losing remote file permissions

I use: Emacs 26.1 on Windows 10 with tramp with plink/pscp to edit perl scripts on a remote Linux server The scripts are executable (permissions 755). When I load and then save them, if short time ...
1
vote
0answers
110 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 <...
0
votes
1answer
308 views

How to save a file history?

Is there any packages or extension that will save a file history when you save the file? Example when I save the file it will create a file history of the file and on the later time when I save it ...
3
votes
2answers
542 views

How to open multiple files in multiple windows at startup

In earlier versions of emacs one could use emacs -nw file1 file2 file3 and see three files (and no buffer list) at startup. For recent versions this no longer works. Is it possible to add some code to ...
1
vote
1answer
190 views

How to mount/unmount devices?

I'm interested in mount/umount usb and other devices directly from emacs. In many file mangers (like nautilus) the devices are automatically discovered and indicated with an icon, it's possible to do ...
4
votes
1answer
634 views

Dired: How to find all files under a directory that match a glob pattern (wildcards)?

Emacs 26.1, Windows 10 In my directory: d:/TEMP/test/ I has 2 text files. Also in subdirectories I has 2 text files. If I want to find all files in directory d:/TEMP/test/ I do: C-x d d:/TEMP/test/*...
0
votes
1answer
50 views

Including standard boiler-plate on opening a new latex file [duplicate]

Most of my \LaTeX files have the same boiler plate code, so I would like Emacs to automatically insert this boiler-plate whenever I open a fresh, blank \LaTeX file. In particular, I would like to ...

1
2 3 4 5