From elisp manual:
-- Function: file-directory-p filename
This function returns ‘t’ if FILENAME is the name of an existing
directory, ‘nil’ otherwise.
See also its docstring, with a note concerning symlinks:
Return t if FILENAME names an existing directory.
Symbolic links to directories count as directories.
There are (at least) two ways. First, typing C-u C-c C-o on a link should force it to be opened in emacs, rather than in an external app. Second, you can permanently override the default behavior by adding an entry to the variable org-file-apps:
(add-to-list 'org-file-apps '(directory . emacs))
which tells org-mode to use dired for all directory links. ...
Additionally you can use dired-subtree from dired-hacks repo.
Here you have short demo and screenshot from my setup where I press i to drill down folder and ; to go back.:
(define-key dired-mode-map "i" 'dired-subtree-insert)
(define-key dired-mode-map ";" 'dired-subtree-remove)
I'm also aware of direx which looks like that: :
There are a couple of options for this.
You can check out dirtree, which is based on dired.
There is also an emacs port of vim's NERDTree called neotree.
Both are excellent packages, though I tend to favor neotree as it has convenient bindings to let me create and delete files and directories. I do not believe dirtree has this support, though I could be ...
file-name-directory does what you request.
However, (file-name-directory "/home/sk/parent/") (with a trailing slash) returns that same directory, not its parent.
This does what I'm guessing you really want:
(file-name-directory (directory-file-name "/home/sk/parent/ab.el")) ; => "/home/sk/parent/"
(file-name-directory (directory-file-name "/home/sk/...
You don't need to do that, if that's your question.
C-x C-f /some/new/directory/newfile.txt
Emacs prints a message to let you know that the directory /some/new/directory/ does not yet exist: Use M-x make-directory RET RET to create the directory and its parents.
Insert text into the new buffer for new file newfile.txt.
C-x C-s to save the file.
You are looking for the function locate-dominating-file. Here is the emacs documentation for this function:
(locate-dominating-file FILE NAME)
Look up the directory hierarchy from FILE for a directory containing
NAME. Stop at the first parent directory containing a file NAME, and
return the directory. Return nil if not found. Instead of a string,...
Using browse-url-of-file should work when given a directory.
You could implement a command that opens the directory of the current file like this:
(defun browse-file-directory ()
"Open the current file's directory however the OS would."
(browse-url-of-file (expand-file-name default-directory))
(error "No `...
You can configure the mode line format as you wish. If you want to show the parent directory together with the buffer name (which is usually the file name, for a buffer that's visiting a file), modify mode-line-buffer-identification; otherwise, add an entry to mode-line-format. There isn't a built-in construct for “parent directory of the current file”, so ...
In Dired you can include a subdirectory using i, with the cursor on the subdir line.
You can do likewise on a subdir line within a subdir listing, so you can list any number of levels of any number of subdirs in the same Dired buffer.
$ on a subdir-listing header line hides/shows that subdir listing. So it corresponds more or less with the expand/contract ...
You can invoke dired with an argument, ie. C-u C-x d and after prompting for the directory it will also let you modify the switches passed to ls. Add R and dired will recursively list all sub-directories, each in it's own section.
If you only want to see the contents of some sub-directories, press i when the point is on a directory name.
You can also use ...
I assume you mean that you want to see the directory instead of the buffer name.
Or if you want your home directory abbreviated to ~/ (instead of an absolute file name, from the root), then:
You could use M-x make-directory DIRNAME RET. The default path is the path to the current buffer folder.
You could bind it to key (like C-x C-f) with (global-set-key (kbd "C-c d") 'make-directory).
You could create buffer in nonexist path with C-x C-f non/exist/path/file.name RET and then create nececcary folders with M-x make-directory RET RET.
You install use
It's configured to display the file path in the mode-line, whenever
Just install it, and then turn it on with (sml/setup).
It also has a lot of features to make that display more concise. For
instance, “~/.emacs.d/” gets replaced with “:ED:” (and you can
configure further replacements).
For ido users
Do C-x C-f (which should call ido-find-file) and enter a non-existent path.
Press M-m (mnemonic for make new dir?). Hit RET.
Continue with typing the new file name that you want to create in that new dir. Hit RET.
According to the documentation:
default-directory is a variable defined in ‘C source code’. Its value
is "~/" Local in buffer *scratch*; global value is nil
Automatically becomes permanently buffer-local when set. This
variable is safe as a file local variable if its value satisfies the
Documentation: Name of ...
For MS Windows:
Load library w32-browser.el and use command w32explore. It does exactly what you are requesting. See MS Shell Execute.
If you also use Dired+ then M-RET on a file or dir name in Dired opens Windows Explorer for it.
It's unclear to me why you want/need to add such symlinks. Why not just use Emacs bookmarks?
If you use Bookmark+ then you can have:
Bookmarks to Dired buffers (which record lots of stuff, including markings, subdir insertions, omit settings, etc.).
Bookmarks to bookmark files (to load different sets of bookmarks).
Bookmarks to bookmark-list displays (...
default-directory is a buffer local variable which can be set by all sorts of things although it is always set on loading a file. The simplest dumb solution is to use the find-file-hook and set it back to what you want:
(add-hook 'find-file-hook #'(lambda () (setq default-directory (expand-file-name "~/"))))
However this does have the disadvantage of ...
For simplicity, here is another take on a function that opens the next or previous file (by name) in the current directory.
(defun find-next-file (&optional backward)
"Find the next file (by name) in the current directory.
With prefix arg, find the previous file."
(let* ((file (expand-file-name buffer-...
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 &...
I just added this feature to helm-make.
Give it a go and let me know if it works as you wanted, you
just need to set the custom:
(setq helm-make-do-save t)
Here's the code that does it:
(let* ((regex (format "^%s" (regexp-quote default-directory)))
As of I think version 26.1, Emacs does support a second additional .dir-locals.el file (aptly named .dir-locals-2.el).
From the Emacs Manual: "Per-Directory Local Variables":
You can also use .dir-locals-2.el; if found, Emacs loads it in
addition to .dir-locals.el. This is useful when .dir-locals.el is
under version control in a shared repository and ...