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
2
votes
1answer
44 views

Ignore both uppercase and lowercase versions of the extensions listed in completion-ignored-extensions

How can I get Emacs to ignore, say, both .pdf and .PDF files without listing both ".pdf" and ".PDF" in completion-ignored-extensions?
1
vote
3answers
56 views

Is there a way to periodically record the files being opened in emacs?

Sometimes my ubuntu freezes, and I am using Emacs that has many files opened inside it. I have to reboot Ubuntu, and lose the track of what files I have opened. Is there a way to periodically record ...
1
vote
3answers
90 views

call write-file interactively with prompting

I have a function that creates a buffer, with a default file name, and would like the first user action for that buffer be a prompt to write the buffer to a file, allowing the user to change the ...
1
vote
1answer
311 views

Combine find file at point and find file in project

I'm very new to customizing Emacs, and haven't written Elisp commands before. I'm struggling to find a command and key binding that combines find-file-at-point and find-file-in-project (or similar), ...
0
votes
1answer
555 views

prelude-ivy: How to select and open multiple files

I have installed Ivy (along with Swiper and Counsel) as part of Prelude by doing a (require 'prelude-ivy) in my prelude-modules.el file. It seems to work, but I am not able to figure out how to do ...
0
votes
1answer
165 views

How to programmatically insert a string at the end of some file?

How to silently (in background) create a new line at the end of a specific file, say /path/to/file.txt (which is not necessarily a visiting file and is not necessarily already open in emacs) and ...
0
votes
1answer
262 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 ...
3
votes
1answer
235 views

How restore file from trash?

Windows 10, Emacs 25.1 In my init.el I set: delete-by-moving-to-trash t So as result when I delete file it move to trash. Nice. But how I restore delete file from trash by Emacs?
1
vote
1answer
62 views

Is there a better way to write this?

I'm walking a directory tree upwards from default-directory in a loop, so I need a way to say "take the last component off this path that ends in a slash and return a result that ends in a slash". The ...
2
votes
0answers
47 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, ...
1
vote
1answer
66 views

How to programmatically extract path to etags executable

Q:  Assuming that we open Emacs with a path to ../Emacs.app/Contents/MacOS/Emacs, how can we programmatically extract the path to etags located at ../Emacs.app/Contents/MacOS/bin/etags. [The location ...
2
votes
2answers
139 views

How to lookup buffer visiting file opened via TRAMP

Motivation / Background I use the ffap counterparts of common file- and directory-finding commands, i.e. find-file-at-point, dired-at-point et al. in place of find-file, dired et al., respectively. I ...
2
votes
2answers
119 views

move file associated with open buffer to a specific folder

For a long time I've been using this function (originally made by Steve Yegge) to move files in emacs. This lets the user move the file associated with the currently open buffer to a different folder ...
1
vote
0answers
58 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 ...
0
votes
1answer
86 views

file-notify-add-watch : get file path string

I would to do a specific action (create an org-mod link) when a new file appears in a given directory. For that I need to catch the event but also the path of the new file. I managed to use file-...
0
votes
0answers
39 views

C-x C-f Edit File As Root [duplicate]

Is there a way to open a local file for editing as a root? I need to make some changes to a config file located at ~/.emacs.d/init.el, but the Emacs tells me that the buffer is read-only.
0
votes
0answers
66 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 ...
2
votes
2answers
70 views

Aliases on minibuffer for quick switching of directories

I would like to know if there is an easy way for me to jump to specific folders when specifying paths in the minibuffer. For example, when I do find-file and my current directory is in ~ and I want ...
0
votes
1answer
67 views

Multiple replacements for directories in init file

Now, I've checked many questions here to get an answer for what I want, but every question seems a bit different that that what I need. I use org-babel to create an init file. I often change my config ...
1
vote
2answers
94 views

How to get emacs to prompt when a new buffer is changed on save?

for background, I am an emacs newbie and long time unix user... What I am trying to do is to work in emacs in a pattern that is familiar to someone who has used a windows, linux, mac text editor such ...
1
vote
1answer
49 views

Search files with many search options. Is it possible?

Windows 10, Emacs 25.1 Suppose I have some folder (not project folder). In this folder I has 10 subfolders. Suppose: I has to find some file. I don't what is the name of this file. I exactly known ...
6
votes
1answer
184 views

Why does calling expand-file-name indirectly produce a different result?

Running the following in ielm in emacs -Q: ELISP> (defun wh/expand-file-name (name &optional default-directory) (expand-file-name name default-directory)) wh/expand-file-name ELISP> (...
1
vote
0answers
27 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 ...
5
votes
1answer
547 views

Get filename from dired using elisp

Using elisp, I call this function (dired "~"), for example, to get to my Home directory in dired mode. When I press RET on one of the files, I want to capture the file path and store it in a variable ...
1
vote
1answer
92 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 ...
3
votes
2answers
798 views

How to determine if a string is a valid file name?

Q: How do I determine if a string is a valid file name (i.e., uses only valid characters)? The variable file-name-invalid-regexp was the only thing I could find (docstring: "Regexp recognizing file ...
0
votes
2answers
543 views

File names encoding when running shell-command on Windows XP

I faced a problem when pdflatex launched from Emacs couldn't compile files whose name contained Russian characters. The same code worked on Linux, so I suspected that something is wrong with encoding ...
0
votes
2answers
216 views

Make the emacs command history size unlimited so I can keep track of files?

I'd like to make the size of the emacs command history unlimited. I open and edit too many files in many different folders and I need a way to keep track of them. The emacs command history looks ...
1
vote
2answers
54 views

Building Command to Append Selected Text to End of File (w/Tab Completion)

Problem: I'm trying to write a command that takes the selected text and appends it the end of a file of my choice. There also needs to be a tab completion (or autocompletion) element to the command, ...
1
vote
1answer
184 views

How to rsync/fetch/download the folder open with ssh/tramp

I work in a folder on the server, peyote2 in this case. I can edit files there etc, we all know that. However I have there a pdb file (RNA 3D structure) that to view I have to download it to my ...
15
votes
6answers
3k 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 ...
8
votes
4answers
3k 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/ ./...
4
votes
2answers
1k views

What's the equivalent of `helm-find` in ivy/counsel? I want to find files **recursively**

helm-find is Preconfigured ‘helm’ for the find shell command I need the same functionality with ivy/counsel.
1
vote
1answer
183 views

Copy part of the file in the buffer

I need to copy part of the file (with re-search-forward) to another file under the marker. I know how to use re-search-forward, but I have problems with buffer. Am i right with my logic? 1) open ...
2
votes
0answers
94 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), ...
2
votes
1answer
72 views

Conditional switch to file on startup

I'm using spacemacs and currently I'm using the following in my user-config to switch to the scratch buffer when emacs starts: (setq inhibit-splash-screen t) (switch-to-buffer "*scratch*") However, ...
1
vote
1answer
239 views

Single function to return file contents as a string

I'm wondering if there's a terse (i.e. single function) approach for reading a file's content given its path and returning it as a string. My go-to has been: (with-temp-buffer (insert-file-...
2
votes
3answers
104 views

Is there a command in emacs similar to `find` in findutils?

In emacs, the command M-x grep runs grep program. Is there a command in emacs for running find in findutils, or do similar thing? Thanks.
0
votes
1answer
55 views

Interactive Function to Create a Buffer in a Default Folder with Autocompletion of the File Name with the Predefined Prefix

Could you please tell me how I can write a function which creates and visits a buffer in a particular directory (a default directory name is hard coded, but it would be nice to have an opportunity to ...
1
vote
0answers
35 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/...
2
votes
1answer
2k views

How to toggle neotree in the project directory?

There is a nice example of how to open neotree in the project rootsee: https://www.emacswiki.org/emacs/NeoTree (find-file-in-project and Projectile sections). However, I'd like to toggle neotree, so ...
2
votes
2answers
287 views

tagging files for filtering

I am new to emacs and I been trying to find how to tag multiple files with multiple tags and then filter or search based on the tags. If you are familiar with the way tags work in Evernote or ...
1
vote
1answer
209 views

Save REPL buffer as file?

I've seen a discussion on someone trying to save the actual state of a Lisp Slime REPL. I just want to save a text version of a Geiser Racket REPL session, e.g., *ch1*, while using org-mode. (Then I ...
1
vote
1answer
750 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 ...
1
vote
1answer
426 views

How can I add meta data to text files by using “file-props.el”

I have a large number of text files with notes, and would like to add meta data (tags and comments) to each file, and display them when using dired. I am using windows 10, and emacs 25.0.93.1 (x86_w64-...
7
votes
4answers
10k views

Spacemacs: kill buffer and kill window in one command?

Is there a spacemacs command that both closes the window and kills the buffer? In other words, the equivalent of Vim's :q?
2
votes
1answer
56 views

Saving very big files

I just noticed that Emacs will trim a very big file before saving it. I opened a 4.6 GB file (not the best thing to do, but anyway) and after saving, the file was trimmed to around 375 MB. It didn't ...
2
votes
0answers
151 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?
1
vote
1answer
221 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 ...
2
votes
1answer
504 views

Read a config file and get some value into elisp variable

I'm trying to read a value of variable context from the config file. I use something like this (but have got an error..): (with-current-buffer (insert-file-contents "/home/user/liquibase.properties") ...