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
12
votes
3answers
976 views

Put the current file name in the minibuffer

How can I insert the file name of the active file buffer into a command? When I invoke a command that needs a file name, I am often doing so from a file buffer and want the name of that file while ...
0
votes
1answer
67 views

How to save a file in place even with backups?

In order to prevent NFS caching from leading to stale files, I need to preserve the inode of a file when Emacs saves it. Normally, it does so anyway, but apparently not if backup files come into play....
2
votes
2answers
181 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
3answers
436 views

Appropriate way to deal with file-names and file-name components (“paths”) in emacs lisp?

What is a good, clean to deal with paths in emacs lisp? Common lisp has pathnames, Python has os.path. But I always seem to end up reinventing the wheel and resorting to manual regexes for simple ...
1
vote
2answers
890 views

Add hook for specific files

I am looking to create some customized settings for a specific file. I think I want to add a hook for that file, or something that will create a few settings when that file loads. For example, I have ...
0
votes
0answers
16 views

Auto save is disabled but emacs is making files in the format .#file-name [duplicate]

I set auto save to nil after discovering this, but they keep popping up. Does anyone know what could be causing this? It's not the typical #filename#, it's making a dotfile .#
0
votes
1answer
104 views

Errors after update: “File already exists error list-utils-pkg.el”

When I relaunched emacs after updating some packages, I had an error: Debugger entered--Lisp error: (file-already-exists "File already exists "/home/linevich/.emacs.d/elpa-24-3-1-x86-64-pc-linux-gnu/...
3
votes
1answer
228 views

Debugging open file handles in emacs

Is there a way I can find what file handles emacs has open, and close these references? Or even better, find where they are being open? Emacs is keeping handles to a large number of files (a leak) ...
4
votes
3answers
333 views

Switch buffer to the file path in current cursor position

My .emacs file contains multiple file names as, (load "~/.emacs.d/others/keymaps.el") (load "~/.emacs.d/others/py.el") (load "~/.emacs.d/others/web.el") Is there a way any library, gives way for me ...
3
votes
2answers
237 views

Executing a function when opening a file of certain type

I would like that when I open a file of certain type (say *.abc) certain function (say my-function) automatically executes at the opening. Edit. The function is a buffer-dependent function and should ...
5
votes
1answer
704 views

How to set temporary file directory for flycheck eslint (outside of current directory)

flycheck-mode creates temporary files in the current directory. That is annoying. How can I disable/set the default place for these temporary files. I use javascript eslint syntax checker for react ...
4
votes
2answers
219 views

header2.el: how to increment the version number with dot?

My setup GNU Emacs GUI (version 24.4.51.1 (x86_64-w64-mingw32) compiled from Harroogan Emacs.) Package header2.el, which I use a lot. If you need more detail about header2, ...
29
votes
2answers
5k views

What's the difference between a buffer, a file, a window, and a frame?

When posing questions on this site, people sometimes talk about "windows" when they mean "frames," and "buffers" or "files" when they mean "windows." So: Q: What is the difference between a buffer, ...
3
votes
1answer
146 views

Save changes to an emacs file without changing the date

I sometimes would like to make changes to my emacs files but without changing the date of the modified file. For instance, I would like to write up a brief evaluation of a lecture I might have given. ...
6
votes
2answers
1k views

.tramp_history files

I have noticed that opening a tramp connection on remote hosts sometimes created a .tramp_history file in the user's directory. Is there any way to disable such a behavior? I have to log in to many ...
12
votes
1answer
3k views

Open file in new window after searching it with helm

As written in A Package in a league of its own: Helm there's a way to search for a file using Helm decide after searching whether open it in same or other window My question is: How?
11
votes
5answers
5k views

Comparing two text files on a Windows system

Since ediff-files and ediff-buffers result in apply: Searching for program: no such file or directory, diff error on windows machines. How to compare two files using Emacs on a windows system?
3
votes
0answers
1k 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. ...
14
votes
2answers
7k views

Run command when opening a file of a specific filetype

I'm trying to get a lisp script to run some commands for me when I open a file of a specific filetype. I know that I'm working in the correct init file because if I remove the theme from it, emacs has ...
3
votes
3answers
437 views

How to create a keybinding to a file in Emacs?

I have a frequently opened file in Emacs, which is deep inside my device. I want to bind the F5 key(or any other key) to open that file, how can I do that? (Using android to run emacs. [GNURoot, ...
5
votes
4answers
520 views

Does some command exist, which goes to the next file of the current directory?

I'm looking for a command inside Emacs. For example, you are currently in a directory. In the directory there are 2 files: foo.txt and bar.txt. I have foo.txt opened in Emacs and is being ...
2
votes
1answer
171 views

buffer-file-name is a function, so why doesn't M-x buffer-file-name work? [duplicate]

When trying to run it I get M-x buffer-file-name [No match] But it has a function help entry via C-h f and I can evaluate it with M-: buffer-file-name. So why isn't it accessible via M-x?
7
votes
2answers
1k views

Saving open file list and buffer command history in between sessions

I've discovered desktop-save-mode which allows Emacs to be closed and when it reopens, it appears with the same files that were open before. I want to take this a bit further and I was wondering if I ...
2
votes
2answers
784 views

Use emacs for batch-processing files

I'm a newbie elisp user. I would like to process a few hundred xml files and call an elisp function for each line which does an query-replace to fix a problem in these files. My question is: how do I ...
2
votes
1answer
1k views

Interface with Sqlite

I want to manage simple personal databases, like mp3 collections. I am not aware of any updated lisp object database project working in Emacs (correct me if I am wrong). So I would turn to Sqlite,...
8
votes
4answers
2k views

How do I search and replace over a set of files?

I'd like to define a set of files within which I can search and replace text. To clarify: I would like to be able to search, e.g., in all files xk*.tex in a given directory (and excluding backup ...
6
votes
2answers
842 views

How can I jump to a file and line number from a list in a buffer?

I have a buffer with content like: src/file4.rs:9 src/file4.rs:33 src/file4.rs:64 I'd like to be able to put my cursor on a line and jump to the appropriate file / line in the other window, just ...
3
votes
1answer
1k views

Auto-refresh files when using tramp

I am viewing remote log files using tramp mode in emacs. Is there a way to get tramp to auto-refresh these buffers when they change remotely? If this is not possible, is there a way to reload a ...
2
votes
2answers
954 views

Open file by name matching recursively from current folder

Our project has a folder structure which makes navigating files a bit of a hassle. basefolder --> libs --> libA --> libB ... --> utils --> utilA ... --> apps ...
2
votes
1answer
98 views

meta-data related to the current buffer

How can I retrieve the date/time of the creation of the current file (file-date-time-of-creation) on my system? The same question can arise for the size. A related question was asked here. This is a ...
1
vote
1answer
216 views

Newbie trying to understand emacs filing system [closed]

This is my first time here. I asked my question over at /r/emacs on reddit, however so far I am left with some unanswered questions. I'll copy paste my question along with the link to my post which ...
2
votes
1answer
367 views

What's the fast way to navigate to MAC OSX “Finder”?

On Mac OSX, I'm editing a file in an Emacs buffer. I need to conveniently open the directory containing this file in the MAC OSX Finder. What's the best way to do this?
11
votes
2answers
975 views

Elisp: How to exclude sensitive information from an init file? (ie login credentials)

I want to define a log in function in my init script, but I don't want to hardcode my login credentials. I think a good workaround is to have my init script read in my login credentials from a local ...
2
votes
2answers
319 views

Programmatically add files to existing Dired buffer

I have an existing dired buffer created of arbitrary files (basically as described here). How could I add additional files to this existing buffer? The files may, or may not, be in the same directory ...
1
vote
0answers
134 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 ...
10
votes
4answers
5k views

What is the easiest way to open the folder containing the current file by the default explorer of the OS?

What is the easiest way to open the folder containing the current file by the default explorer of the OS (e.g. explorer.exe in the case of Windows OS)?
3
votes
1answer
368 views

Open .cbr files

Is it possible to open a CBR file with Emacs? I am not asking for a package similar to MComix, just a quick way to read the content of a .cbr file.
2
votes
2answers
395 views

Define key to toggle between javascript implementation and test file

I have been trying to set up a shortcut for jumping between a JavaScript implementation and test. I have particular requirements that are making examples I see harder to apply. I currently work with ...
2
votes
3answers
413 views

How can I open the current buffer in an alternative editor?

Sometimes it may happen that we would like to open the current buffer in another text editor (notepad, gedit, texmaker, ....). What are the best ways to do it?
1
vote
1answer
359 views

Hard and soft links (junctions) under Windows

Let us assume to run the following commands creating links in the Windows prompt (terminal): > mkdir fooDir > echo hello> fooDir\foo > mklink /d fooDirSym fooDir > mklink /j fooDirJunc ...
4
votes
2answers
442 views

Backup saved buffers to Dropbox (or other specific directory)

Is it possible to customize Emacs so that whenever I save a file, Emacs also copies it to a specific folder? This directory could be, for instance, D:\my_backups or C:\Users\username\Dropbox\...
5
votes
3answers
715 views

Load all org files into buffers?

I've got a couple dozen org files that I'd like to have loaded at once. They're in a directory structure something like this: org/dev org/dev/python.org org/dev/emacs.org ... org/dev/ios org/dev/ios/...
1
vote
1answer
633 views

Weird Prompt: file has changed since visited or saved. Save anyway? (yes or no)

I make some edits and press C-x C-s to save. Sometimes, out of blue emacs prompts this: file has changed since visited or saved. Save anyway? (yes or no). Even though I don't have the file open ...
14
votes
4answers
1k views

How to tell Ido to get out of the way when I can already just paste the file name?

I'm trying to make myself use Ido mode. Some times it's nice, but other times it is extremely stupid. Here's my greatest disappointment. I read some log with full file names, then I copy one name, ...
12
votes
1answer
832 views

How to prevent Emacs from breaking hard links?

Let's say I have two files file1 and file2: $ echo aaa >file1 $ ln file1 file2 Then I check that the inodes are the same: $ ls -i 18749779 file1 18749779 file2 which shows that the two files ...
6
votes
2answers
196 views

Save all open files in current folder and subfolders

Some of my projects are organised in way that the there isn't one make file at the top route of the project (git/svn/...) folder but I have several small Makefiles in subfolders of the project. ...
4
votes
1answer
153 views

Most recent files visited

I am looking for a solution for recently visited files and/or directories by applications run in gnome terminal here When I saw that question I thought of Emacs. Emacs has recentf-mode, does that ...
0
votes
1answer
403 views

selecting files with regular expression using ido-find-file

With regular find-file it's possible to supply *.[ch] to open all .c or .h files in a directory. ido-find-file doesn't seem to support this behavior. I know I can press C-f while ido-find-file is ...
4
votes
1answer
164 views

Sporadical change of permissions of file being edited

I have a strange behavior - sometimes while editing, permissions of .rs files are changed from 0644 to 0755. I'm not sure if it is specific for rust-mode or not as so far it is the only mode I ...
2
votes
1answer
64 views

Detect whether a new file has been visited by user or by lisp code

I would like to check whether a new file has been visited by an interactive command (e.g. visited using C-x C-f) or if it has been visited programmatically by some Lisp code. Use case: I cooked my ...