Questions tagged [directories]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

How can we separate folder for .org~ temp file into separate folder [duplicate]

Is it possible to store temp file .org~ file in a separate folder preferably C:\temp. I am using emacs on windows 7 .
0
votes
0answers
9 views

How to make dabbrev look into given directory for completion

I have approx 5000 org files in a directory arranged like this D:\dropbox\EMR\SURNAME NAME\YYYY-MM-DD.org I would like dabbrev to look into directory d:\Dropbox\EMR\ and its subfolders for completion....
1
vote
0answers
69 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 ...
2
votes
1answer
44 views

Quickly navigate through a cascade of otherwise empty directories in helm

I'd like to be able to quickly skip to the bottom of a cascade of otherwise empty directories. Consider the following directory structure: foo/ bar/ baz/ a.txt b.txt If I were in ...
1
vote
1answer
179 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
1answer
57 views

How can I set the default value for reading a directory name?

I have a folder hardcoded in variable: (defvar folder-start-mine "/path/to/start/folder/") Then I want to interactively define new non-existing subfolder name: (defun my-new-defun (sel-subdir) ...
1
vote
1answer
44 views

Printing a list of folders which has been modified today

Is there any way to export a list of folder names which has been modified today using a dired mode or any other package on emacs
0
votes
1answer
264 views

default directory is not working in Windows [duplicate]

I am trying to set the default directory to D:/ by (setq default-directory "D:/") but when I type c-x c-f, it is showing D:\software\emacs\bin, which is the installation directory.
1
vote
1answer
60 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 ...
1
vote
1answer
164 views

Troubleshooting: changing default folder in .emacs not working

I am trying to make emacs start on the folder where all my orgfiles are saved. I achieved this in my windows machine by changing the "Start In" field of the shortcut properties, as suggested in this ...
6
votes
4answers
675 views

Quickly jump to favorite folders

What I actually want I have deep folder structures and use about a dozen folders pretty far down the directory tree a lot. In Nautilus, I use bookmarks to get to them quickly. I want the same thing ...
2
votes
1answer
174 views

Starting Emacs from a USB stick: how to extract the drive letter assigned to the stick?

I have installed Emacs, with all its init files, on a USB stick for use on different PCs. The init files contains paths to the USB stick itself. The problem is that the drive letter assigned for the ...
7
votes
2answers
3k views

How to check if a directory exists in elisp?

I've seen how to check if a file exists (file-exists-p), but how to check if a directory exists?
5
votes
1answer
97 views

Nested File Autocompletion in Emacs?

I'm using emacs (technically: spacemacs with helm). It seems that any time I call a function which requires a directory, I am presented with something like the following: The problem: If I am in /a/...
0
votes
1answer
150 views

NeoTree: Open to CWD of Buffer

Occasionally when I'm navigating around I want Neotree to jump to the folder of the file I'm working in, but when I open Neotree it's still the last place I left it. I can't find any function with M-...
0
votes
1answer
1k views

Change Emacs home directory for all purposes

I have my config files in ~/config/emacs which ~/.emacs is symlinked to. I'm trying to figure out how to make the default "emacs root directory" $HOME in all contexts (unless overridden by a buffer-...
3
votes
4answers
237 views

query-replace on directory

How do I search&replace selected instances (in particular those occurring in strings, not in variable names – but using an equivalent of 'query-replace is safer and still fine, there should not be ...
0
votes
1answer
63 views

In a new shell, move to directory of other current buffer being edited?

I am using emacs to edit Latex. My work flow is to open the latex file, open a new buffer in a separate window via C-x 2. Then moving the context into the new windowbuffer via C-x o, I type M x shell ...
4
votes
1answer
2k views

How to quickly create a new directory without using dired-mode?

Whenever I've to create a new directory in emacs, I enter dired mode, press "+" and enter the new directory name which creates the new directory. Is there a way I can avoid using dired-mode and ...
1
vote
2answers
138 views

Count number of files with specific extension on a folder?

Let's say I'd like to know how many .png images I have in a folder. In shell I'd run: ls -1 | grep .png | wc -l Is there a way to achieve this in emacs (preferably not just reading in from a shell ...
1
vote
2answers
167 views

Current directory of Emacs in batch mode

I run Emacs in batch mode to execute some scripting actions. I'd like to get paths of files relative to where Emacs got started in batch mode: (file-relative-name (buffer-file-name) directory-where-...
7
votes
3answers
1k views

Expanding Dired to show subdirectories/files?

One of the biggest things I miss from other editors (e.g. Sublime, Intellij) is the ability to see the project structure, and expand/minimize directories as needed so I can see what I care about. Is ...
1
vote
1answer
51 views

What is the difference between contrib/lisp and lisp?

I have both of these folders for my load paths, what is the difference? ~/.emacs.d/contrib/lisp/ vs ~/.emacs.d/lisp/ What should I use one versus the other?
2
votes
1answer
119 views

Make emacs aware of updates to files and directories?

In Ubuntu, when I make change to directories or files outside emacs, it seems that emacs doesn't get the update. For example, C-x C-f can't track the current directory which was just moved elsewhere ...
3
votes
2answers
2k views

Setting default-directory does not change find-file directory

I try to set a default path for opening a file via C-x C-f by adding the following to my .emacs: (setq default-directory "~/some_dir/") However, after I launch Emacs in some directory, the find-file ...
0
votes
0answers
77 views

Stop Emacs from adding all subdirs to default-directory

I'm having trouble stopping Emacs from loading all packages in my default-directory. When I call c-h v load-packages I get a listing of all subdirectories inside my elpa directory, which I want to ...
1
vote
1answer
114 views

Append to exec-path the absolute file names of directories that match a regexp?

As explained here, by (setq exec-path (append exec-path '("/sw/bin"))) one can append the directory name /sw/bin to exec-path. Is it possible to append to exec-path the absolute file names of all ...
0
votes
0answers
132 views

tree-mode, view selected file preview in right side window

I am using tree-mode to see the folder contents in a tree like design. It is working awesome. I would like to customize the enter key behaviour. 1) key press on a file node must show the file's ...
2
votes
1answer
336 views

How to specify the directory for file-exists/delete-file/byte-compile-file?

I thought it would be great to save a Elisp file (in my init), and it compiles automatically a byte-compile Elisp-file. So I wrote a function for this. (defun remove-elc-and-compile-on-save () ...
4
votes
2answers
190 views

How can I recursively delete all empty directories?

That is, if I have -empty-dir-a/ -nonempty-dir-a/ -empty-dir-a/ -empty-dir-a/ file-a file-a file-b I would like -nonempty-dir-a/ file-a file-a file-b I'm aware that there are many OS-...
5
votes
4answers
477 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
548 views

Can I stop Emacs from resetting default-directory every time I open a file?

If I: Start Emacs in my home directory (~) Find a file in the ~/Projects/ruby-play directory with C-x C-f Try to find another file with C-x C-f The default directory in the file finder will be ~/...
0
votes
4answers
377 views

How can I save the current Unix working directory in a variable?

I know I can run M-x pwd which will give me Directory ~/ or something like that. Can I get it without the "Directory" bit? Thank you very much.
21
votes
2answers
2k views

Org Mode link to open directory in Dired

I'd like to have a link like [[file:~/projects][Projects]] open directly in Dired rather than Finder (I'm on a Mac), which is what it does now. Is there a way? (Of course there's a way. It's ...
8
votes
1answer
2k views

Function that returns parent directory absolute path

(parent-dir "/home/sk/parent/ab.el") gives "/home/sk/parent" then, (parent-dir "/home/sk/parent") gives "/home/sk" Any elisp function as parent-dir that gives basepath for both file path &...
1
vote
1answer
140 views

Drag the weblink of a file to a dired folder to save in that folder

Assume that I am visiting a folder (directory) on my system by M-x dired in Emacs. Also assume that I am visiting a webpage like http://www.gnu.org/software/emacs/manual/pdf/ by the default web ...
10
votes
4answers
4k 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)?
0
votes
1answer
38 views

Why are my compilations executed in the parent of `default-directory`?

When I run compile, I'm seeing a strange behavior where the shell command is being executed in the parent of default-directory rather than default-directory itself. Here's an example of what I'm doing:...
9
votes
2answers
2k views

Recursively go up to find Makefile and compile

The problem with M-x compile is that if the Makefile isn't in the current directory, it fails. I'd like to have a function that recursively goes up to find a Makefile and run make from this directory....
7
votes
2answers
227 views

How can I have a second .dir-locals?

When collaborating on a project, certain editing variables are set to make sure everyone is producing a similar style of code. In Emacs, these are usually implemented as either file-local variables ...
6
votes
2answers
192 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. ...
10
votes
3answers
2k views

How can I display the parent directory of the current file in the modeline?

I would like to be able to see the location of the current file's parent directory, independent of the current buffer name.
9
votes
4answers
433 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 ...
38
votes
7answers
15k views

Tree-based directory browser?

I love dired, but sometimes (particularly when filming screencasts) I want to see the tree-structure of a directory and its children, a la the tree(1) command. Is there a tree-oriented directory ...