A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
4
votes
4answers
446 views

How to support multiple extensions in Deft?

In deft mode I can change the default text extension using (setq deft-extension "txt") Is there any way to support multiple file types? (e.g. I have a mix of .txt .md and .org files in my directory)...
3
votes
1answer
235 views

`find-file-hook` problem for large buffer that is just one long line

I got a file(for instance, ~/.mozilla/firefox/xxx.default/sessionstore-backups/recovery.bak) that its content is one whole line and size of over 1MB, if I open it in Emacs, Emacs will become very ...
2
votes
1answer
84 views

Warning about modification of files which should be static

Some files in Emacs should not be modified, for example: an .el.gz library file which is expected to behave "properly" an external extension, which will be overwritten on update Anyway, there are ...
8
votes
2answers
368 views

How should I get the filename of the original buffer in an indirect cloned buffer?

I wanted to look at different portions of a buffer in two different frames, as I have two monitors of different shapes that I can't easily span a single frame over. Some googling led me to use clone-...
9
votes
2answers
621 views

How can I create a dired buffer listing all open files?

I have a mechanism for burning items to disc from a dired buffer. Unfortunately, the file's I've patched are strewn accross the file system. How can I create a dired buffer from all open files?
11
votes
2answers
829 views

What's wrong with `find-file-noselect`?

In a recent answer by lunaryorn, he stated: However, I'd recommend against most other parts of Org, for reasons already stated in comments: It's old, and full of legacy and harmful practices (...
17
votes
2answers
5k views

Save current file with a slightly different name

My files have long filenames and a part of the filename is a date and a version number. Often I'd like to save the file in the buffer using nearly the same name, just change version number or date. ...
1
vote
2answers
116 views

Remove entries in Dired buffer without deleting actual underlying objects

Is there a way to do this for both non-Elisp and Elisp? For Elisp, the only thing I can think of is to create a new Dired buffer from a new list of files, but is there a better way? Note: I want to ...
10
votes
3answers
426 views

Get all filenames in current Dired buffer with Elisp

As the title suggests, how do I get all the file entries in a Dired buffer using Elisp?
6
votes
1answer
603 views

Specify major-mode for files with multiple extensions

In my .emacs file, I have: (setq-default major-mode (lambda () (let ((buffer-file-name (replace-regexp-in-string "\\.tmp$" "" ...
10
votes
2answers
498 views

Programmatically insert files into Dired buffer

I have a list of file names (with full path) and I want to create a Dired buffer listing this set of files. How would I go about doing that? How do I create a Dired buffer from a list of file names? ...
4
votes
3answers
720 views

find-grep-dired equivalents for ack and ag

Is there an equivalent find-grep-dired using ack or ag? With the ability to specify the directory where the search starts? The Dired output itself is not so important (in fact I prefer the ack-mode ...
9
votes
4answers
2k views

How to check whether a buffer is visiting a file?

I'd like to check whether some (say, current) buffer is visiting a file or not. I could say: (if (buffer-file-name) ...) but it seems to be not very elegant - what I'm interested in is only the ...
9
votes
4answers
3k views

Recursively open files matching regexp in marked directories

Generally speaking, I would like to be able to open all files within a given set of directories (and their subdirectories) where the filename matches a given regexp. For example /home/nispio/...
9
votes
4answers
493 views

Opening a new file whose parent directory doesn't exist yet

When opening a new file whose parent directory doesn't exist yet, I either open a shell window, or an Emacs shell buffer, and then mkdir the directory in it. I find this cumbersome. Is there an ...
1
vote
2answers
238 views

dired: is file under point local or remote?

In a dired buffer, how can I determine whether the file under the point, i.e. (dired-get-file-for-visit), is local or remote? Is there something like (dired-local-file-p) or maybe (tramp-local-file-p ...
5
votes
1answer
995 views

Character encoding when copying some text from somewhere to Emacs and saving to a file

Suppose I copy some text from a source (e.g. a webpage, a text file opened in an editor such as gedit or emacs) to a buffer in emacs, and then save the buffer to a text file. When I copy the text ...
16
votes
3answers
3k views

How can I find the path to an executable with Emacs Lisp?

My current use case is to find where the Cask executable is (it can be installed in at least two places, and there's an issue open about this). I need to require cask this way: (require 'cask "~/....
113
votes
9answers
70k views

How do I reload a file in a buffer?

I usually work on files which are updated in the file system via version control. What's a quick way to reload a file without having to C-x C-f the file again and getting asked if I want to reload it?
56
votes
5answers
12k views

Edit file with super-user rights

When you have to edit system files, it's an usual situation that you launched Emacs with a normal user before, so the file will be write-protected. What can I do to gain root privileges? I mean ...