Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
18 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 ...
0
votes
1answer
37 views

Backtrace on file open

I am curious about the origin of certain files under ~/.emacs.d, such as: places, url/cookies, tramp, eshell/history, eshell/lastdir, auto-save-list/.saves-15234-mymachine~, request/curl-cookie-jar. ...
0
votes
2answers
45 views

Get file name relative to projectile root

I am trying to write a little function to get the projectile relative path of a buffer. My idea is to delete the substring projectile-project-root from the string buffer-file-name. For example: root-...
1
vote
1answer
31 views

Problem with file-exists-p function on Linux running as VirtualBox guest

Until this morning, my emacs setup (running on Arch Linux as a VirtualBox guest) was working absolutely fine. Then for no obvious reason I started experiencing the following issue: If I opened an ...
0
votes
1answer
39 views

Dired: File open using external viewers, based on filetype, and without prompting

When I hit RETURN on a filename in Dired, I'd like Emacs to automatically do one of several things, depending on the file's type: 1 - If it's a text file, I'd like to open the file in a new buffer in ...
2
votes
1answer
61 views

Normalize string to make it file/path safe

Often I find my self doing this C-x C-f to create a file, while in the mini buffer prompt, paste a url like "https://github.com/seamusabshere/cache_method/issues/15" from the clipboard. Since "https:...
1
vote
1answer
58 views

Autocompletion of relative, not absolute, file name

I am typing a Tex file with Emacs and I want to be able to include the relative path of an image file name from inside Emacs. For example, my Tex file that is being opened in Emacs is located at ~/...
0
votes
0answers
33 views

Problem opening files

I am having some problems with emacs on windows 10 (GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30). Sometimes when I try to open an org file emacs does not opens it and rewrites it ...
1
vote
1answer
57 views

Open a file in read-only preprocessed mode

I often create files with a special extension, e.g. pkl (python pickle), and would like to display these in a read-only buffer after processing them with some external command. E.g. in the case of ...
1
vote
1answer
68 views

Move a file to a directory in the filesystem with emacs lisp

What is the function to move files? I want to emulate the following shell command: mv file dir As described here, the closest is rename-file, but this would be emulating this: mv file newfile
2
votes
0answers
126 views

Navigate C/C++ Source Code with Emacs [closed]

So, i'm finally starting to work with a multi-file Project in C++ and am in need for smart navigation and completion! So far, i've used company-mode (with irony and company-headers), which is great if ...
0
votes
1answer
63 views

Emacs daemon multiple buffers for same file

When running Emacs as a daemon, function find-file automatically selects and uses a preexisting buffer that is visiting the same file. My problem is, when using the same buffer in multiple frames ...
1
vote
1answer
27 views

How can I make Emacs wait until a file is unlocked and then lock it?

I want to override Emacs' default locking behavior to work in a noninteractive setting. To that end, when Emacs encounters a lock (as in file-locked-p), I would like it to wait patiently for the lock ...
1
vote
0answers
45 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-...
1
vote
1answer
29 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
50 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 ...
0
votes
0answers
15 views

why cant emacs fsharp mode display pop-up information nor execute interactively?

When I try to use fsharp to display type signatures and tooltips, the buffer tells me that File 'c:\user\path\[file_name]' not parsed. I've read that this is common when you are using fs files. In ...
1
vote
2answers
44 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
114 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
182 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
70 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
114 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
55 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?
0
votes
1answer
57 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
33 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, ...
0
votes
1answer
37 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
87 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
66 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 ...
0
votes
0answers
47 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
48 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
24 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
46 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 ...
1
vote
2answers
35 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
59 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
64 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
40 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 ...
5
votes
1answer
95 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
24 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 ...
0
votes
1answer
197 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
56 views

What are the '.#' links for?

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
2answers
113 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 ...
1
vote
1answer
578 views

Loading and executing .el file if it exists on startup

I am having trouble telling Emacs to load and evaluate an additional .el file which only contains some lisp code to load an org file ;; keep my personal settings not in the .emacs file ;; http://www....
0
votes
2answers
303 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
93 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
39 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
95 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 ...
14
votes
6answers
2k 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 ...
6
votes
4answers
1k 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/ ./...
3
votes
2answers
746 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
129 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 ...