make-temp-file can be used to make a directory instead of a file,
this example simply calls make-temp-file, then removes the directory afterwards.
(let ((temp-dir (make-temp-file "foo" t)))
;; do stuff
(delete-directory temp-dir t)))
This same functionality as a macro:
(defmacro with-temp-dir (temp-dir &...
Just use relative directory name
(setq backup-directory-alist '(("." . "editorbackups")))
Function make-backup-file-name-1 will make directory name relative to file's directory and create it:
;; If backup-directory is relative, it should be relative to the
;; file's directory. By expanding explicitly here, we avoid
;; depending on default-directory.
Try C-u M-! and inserting the output from commands below that I adopted from another question / Answer
find . |sort|sed -E -e 's;(^.*[^/]/);\1 ;;s;([^/]*/);*;g;s/^\.$//'
That will give you a directory listing as headings, for example
Select the region and convert headings to a lists using C-c -
You can define a variable in the script that records the directory:
You can then use it in your own functions:
(defun my-shell-command (cmd)
(shell-command (expand-file-name cmd my-shell-directory)))
You can try using C-M-j, as explained here
Q: How do I enter an input that matches one of the candidates instead
of this candidate? Example: create a file bar when a file barricade
exists in the current directory.
A: Press C-M-j. Alternatively, you can make the prompt line selectable
with (setq ivy-use-selectable-prompt t).
By modifying the line:
(let ((default-directory (get-compass-root-dir))))
(setq default-directory (get-compass-root-dir))
I get the desired result. I picked the 'let' code up from scouring other similar natured questions on the interweb, but in this instance it caused an issue. Dont ask me why - im really shooting in the dark with elisp at the minute! ...
If you provide a directory on the command-line, it opens in dired mode. For example
...will open the current directory in dired mode.
The variable `dired-listing-switches' contains the switches sent to the ls command. So adding
(setq dired-listing-switches "-lart")
to your startup config (or customizing it) should do what you want.
You can ...
There is command cd: M-x cd (or bind it to a key).
There is also Dired: C-x d, then C-h m. Or C-h r g dired, which takes you to node Dired of the Emacs manual.
Both of those should help you. See also variable default-directory, using C-h v.
C-h f cd tells you this:
cd is an interactive compiled Lisp function in files.el.
Make DIR ...
(cl-remove-if-not #'file-directory-p (directory-files-recursively "name-of-directory" "autoload" t))
directory-files-recursively seems not well-known for some
for a fuller explanation.
Not exactly sure what you're asking, but perhaps this will help. Offhand, a guess is that bookmarking Dired buffers is close to what you are looking for.
Dired itself lets you have a Dired buffer that contains (only) a given set of files and directories - from anywhere in your file system. You do this by passing a list of them to function dired. See C-h f ...
The code below uses a new feature in 26.1 called variable-watcher. It allows a function to observe changes in some variable's value. But more or less the same could be achieved by using hooks and/or advices covering all standard functions which are changing the directory (e.g. find-file-hook).
There may be unforeseen consequences to this.
;; -*- lexical-...
Emacs manual node Action Arguments tells you this about command-line option --load:
Load a Lisp library named FILE with the function load. If FILE
is not an absolute file name, Emacs first looks for it in the
current directory, then in the directories listed in load-path
(*note Lisp Libraries::).
Warning: If previous command-line arguments ...
Emacs packages will automatically find the project root,
company-gtags (for code completion) from https://github.com/company-mode/company-mode
counsel-git-grep (for grepping) and counsel-git (for finding file) from https://github.com/abo-abo/swiper
IMO, workspace is an outdated idea. Everything should just work out of box without setup.
BTW, unlike ...
I use shell pop to do what I think you are asking for. When I press Ctrl-t, it splits the window, creating a new buffer with a shell in that buffer set to the directory that matches the directory of the buffer I started in. When I press Ctrl-t again, it closes the window and shell it had opened.
You can use the ls command of the built-in eshell for listing the files with some predefined depth.
You have to specify the depth by the right number of concatenated file name generator expressions */.
(eshell-command-result "ls /usr/share/emacs/26.1/*/*/*/*/*/*(.)")
The appended modifier (.)...
Library find-dired+.el can help with this. C-h f find-dired:
find-dired is an interactive compiled Lisp function in
(find-dired DIR ARGS &optional DEPTH-LIMITS EXCLUDED-PATHS)
Run find and put its output in a buffer in Dired Mode.
Then run find-dired-hook and dired-after-readin-hook.
The find’ command run (after ...
The elgrep-search command has options :mindepth and :maxdepth. Elgrep is available via package-install from the melpa package archive (instructions how to add melpa to package-archives can be found on the melpa "Getting Started" page).
You can use elgrep as follows to get a list of matching file names of a specific depth. In the example I search in my HOME-...
It looks like you are trying to save the file ~TUTORIAL at the root of the system (/) instead of saving the file TUTORIAL in your home directory (~/).
Typically when you open a new file Emacs will suggest directory based on the active buffer; however that is only a suggestion and you can always delete it, and enter something else. Emacs itself is not ...
Install https://github.com/technomancy/find-file-in-project (available at http://melpa.org)
M-x find-file-in-current-directory or find-file-in-project-by-selected or find-file-in-project
you got interactive UI to filter candidates. The UI is based on ivy (https://github.com/abo-abo/swiper), so you could input keyword1 keyword2 to tweak the final result (...
You can use org-fstree (install from MELPA or from here). It seems to do exactly what you want, it even makes each heading be a link to the corresponding file or folder.
To use it, just put a line
in your org file and type C-c C-c on it. This will create a copy of the directory tree mapped to nested org headlines.
directory-files accepts match-regexp argument:
(directory-files "my/path/to/dir" nil "^[0-9][0-9.]*$")
should return ("4.03.0" "4.02.9") and you extract the first element of the list using functions first or car.
If you really want to use seq-remove, you can do that too:
(not (string-match "^[0-9][0-9.]*$" s)))
'("." ".." "4....
If you are on MS Windows, consider using this simple way:
Create a Windows shortcut, with:
runemacs.exe (with its path), in field Target. Include any command-line switches you like - e.g., D:\Emacs-25.1\bin\runemacs.exe --debug-init
The directory you want Emacs to start in, in field Start in.
You can also have Emacs start out by visiting that directory ...
Oops, never mind, I read the link I provided earlier again and I finally got how to turn it into an ~/.emacs modification. Specifically I added:
(setq initial-buffer-choice "~/Documents/CodeLite/CPP-Math-Projects/Simple-Pendulum")
to my ~/.emacs file.
Tramp must check whether the directory, you intend to create the new file in, does exist. This can be done only by checking on the remote host. Asking for the password is part of the connection to the remote host.