Questions tagged [directories]
The directories tag has no usage guidance.
64 questions
1
vote
1
answer
183
views
In DirEd, how can I copy the directory path of a filename?
I have this function
(defun my/dired-copy-dirname-as-kill ()
"Copy the current directory into the kill ring."
(interactive)
(kill-new default-directory))
, but this only copies the ...
1
vote
2
answers
617
views
How to format org-download's image saving directory(s)?
Suppose following org-file (some_random_name.org) that has 2 images with inserted from org-download.
* heading 1
#+DOWNLOADED: /tmp/xls/xl/media/image2_stage2.png @ 2023-02-24 17:36:38
[[file:...
0
votes
1
answer
43
views
Compare recursive flattened/"branch view" list of files between two directories in emacs/linux
I have two folders, "old" and "new". The "new" folder includes files from "old" that have been copied into subfolders by a program.
[-] Test
|--[-] New
| |--...
0
votes
0
answers
29
views
org-babel python cause start emacs from a folder name contains .zip error
I have a folder contains .zip, say a.zip, and org-babel python enabled, then go to that folder and start emacs, I saw error message as below:
Variable binding depth exceeds max-specpdl-size
$ mkdir a....
4
votes
1
answer
2k
views
Why/Does Org Mode requires all files in a single org-directory? Why not subfolders?
I am really confused why org mode doesn't accept subfolders. Refiling captures into subfolders doesn't work (doesn't see any files in subfolders). Org agenda doesn't work (same as refiling). Why is it ...
0
votes
1
answer
493
views
How to comment out multiple or all files in a directory?
I frequently use commands like paredit-comment-dwim, comment-dwim, and comment-region. I am also aware these commands can have a compound effect with the mark command.
But, I would like to comment ...
0
votes
0
answers
35
views
Turn directory to file in dired
I often make the mistake of creating a directory instead of a file in Dired (by hitting +). I then have to delete it and recreate the file, with the same name.
Sometimes, I tried to edit the d file ...
0
votes
1
answer
49
views
How to: make speedbar just expand a directory while staying in current view, instead of 'opening' directory
I love using speedbar (specificall I use sr-speedbar) but I'm having a hard time configuring it to my liking.
One thing I'd like to be able to do, is set it so that there's an "anchor" ...
0
votes
1
answer
221
views
Specifying a subdirectory in the argument of :tangle: effect only non-interactively
Recently, I added to this answer to the question “How to specify a directory to tangle all code blocks into”, the following comment: “AFAICS, specifying a subdirectory in the argument of :tangle ...
4
votes
1
answer
498
views
Is it possible to do a git clone using Magit in a directory which is not under version control?
Suppose I am in a folder called local-projects. Using the terminal, I can do:
[pedro@system:~/quicklisp/local-projects]$ pwd
/home/pedro/quicklisp/local-projects
An important information to ...
1
vote
1
answer
338
views
Open the directory of currently opened file using the OS's file explorer
This is essentially the same question as this one. But the accepted answer there opens Dired for me in Emacs 28 while previously it opened Caja. Could someone offer a fix? I tried commenting there but ...
1
vote
1
answer
70
views
Can I use jump?
I found this package for the bash shell that lets you quickly jump between commonly used folders: https://github.com/gsamokovarov/jump
I use it all the time now.
Jump uses fuzzy matching to find the ...
4
votes
0
answers
2k
views
Emacs won’t access Documents directory on MacOS Big Sur
I am running Emacs 26.3 on MacOS 11.2.1 “Big Sur”. When I try to open the directory ~/Documents, it fails with the message “Listing directory failed but ‘access-file’ worked.” Emacs.app is given ...
2
votes
1
answer
228
views
C-x C-f TAB TAB: Find file completion list: how to highlight subdirectories?
Often I'd like to open a file in a subdirectory. But poor me, I can't remember the name. So when typing C-x C-f and then TAB TAB for the completion list, the list of all files in this directory is ...
0
votes
0
answers
355
views
org-mode conditional dir property
In org-mode, you are able to set the directory property for a heading in a straightforward manner by placing the following text under your heading of choice:
:PROPERTIES:
:DIR: ~/path/to/my_folder/
:...
1
vote
0
answers
58
views
How to get tilde and plus working with the eshell's directory stack
In zsh, when one creates a directory stack with pushd, one is able to reference directories in the stack using a tilde followed by the numerical index of the respective directory in the stack. One ...
2
votes
1
answer
610
views
Selecting a directory like counsel-find-file
I would like to write a function that would prompt the user to select a directory, using an UI like that presented by counsel-find-file.
The starting directory should be an arbitrary directory passed ...
2
votes
1
answer
134
views
Converting init file on Mac/Linux to Windows
I use a package called Deft that needs a directory to store and load files. To define this directory on Mac or GNU/Linux I use the following expression:
(setq deft-directory "~/Dropbox/org")
When ...
2
votes
2
answers
994
views
How to make a temporary directory that gets deleted once the body is finished?
Is there a way to temporarily create a new directory, then remove it when the body of the code has finished?
(with-temp-directory path
(write-test-files-into path)
(other-test-functions path))
;...
2
votes
1
answer
724
views
How to quickly jump to a directory in emacs?
Say I have a project directory called "project". In the directory there are two directories "mini1" and "mini2". Suppose my active buffer is deep within a subdirectory in "mini1". Is there a way to ...
1
vote
1
answer
177
views
How delete folder named "build" in all subfolders?
Emacs 26.1, Dired+, Windows 10
Suppose I has the next dir tree:
myproject
myproject\app\
myproject\app\build
myproject\app\src
myproject\lib\build
myproject\lib\src
myproject\lib2\build
myproject\...
1
vote
0
answers
552
views
How to mount/unmount devices?
I'm interested in mounting/umounting usb and other devices directly from emacs.
In many file managers (like nautilus) the devices are automatically discovered and indicated with an icon, it's possible ...
3
votes
1
answer
108
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
1
answer
2k
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
3
votes
1
answer
335
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
1
answer
125
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
1
answer
561
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
1
answer
73
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
1
answer
313
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 ...
7
votes
4
answers
2k
views
Quickly jump to favorite folders
What I actually want
I have deep folder structures, and often use a dozen folders pretty far down the directory tree. In Nautilus, I use bookmarks to get to them quickly. I want the same thing in ...
2
votes
1
answer
385
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 ...
23
votes
2
answers
10k
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?
6
votes
1
answer
197
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
1
answer
634
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
1
answer
3k
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
4
answers
969
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
1
answer
144
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
1
answer
5k
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 ...
3
votes
2
answers
404
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 ...
2
votes
2
answers
426
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
3
answers
3k
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
1
answer
68
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
1
answer
165
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 ...
4
votes
2
answers
4k
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 ...
2
votes
1
answer
610
views
Function that gets a subdirectory of user-emacs-directory
I remember reading about this function (it's part of Emacs) somewhere, but I can't for the life of me remember what it's called.
It takes a single argument arg (not sure if there's any more optional ...
0
votes
0
answers
102
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
1
answer
185
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
0
answers
253
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 ...
3
votes
1
answer
693
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
2
answers
474
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-...