reddit / emacs

Dired history in Emacs

rucci99 · 2022-02-24 10:11
Danrobi1 · 2022-02-24 11:10
Cool! Thanks for sharing. Note: Kind of weird these functions are not built-in :/
arthurno1 · 2022-02-24 13:57
That's really great. There is already [dired-recent](https://github.com/vifon/dired-recent.el), which has slightly more options and features, but I prefer minimalistic packages. Add it to Melpa, or even better, make a Dired patch for inclusion in Emacs. Dired could really use same kind of navigation as built-in help or info.
divinedominion · 2022-02-24 15:24
Short and sweet, thanks for sharing!
divinedominion · 2022-02-24 15:24
Yeah it sounds like this could be interesting and simple enough for core Emacs
pxoq · 2022-02-24 16:16
Elpher a [gemini](https://en.wikipedia.org/wiki/Gemini_(protocol) client for Emacs is another mode that doesn't really follow the convention. It doesn't implement a forward history command (unlike EWW, the built-in Emacs HTTP text browser) so I constanly forget `r` doesn't work. `l` and `r` is great, I remember when I first used EWW, I found it very intuive since it didn't use `b` for backwards, which is confusing since it overlaps with the mnenomic of bookmarks. Reloading a page is not something I usually do in a text browser so `r` for right makes sense. spreading the love of `l` and `r` keys.
karthink · 2022-02-24 16:44
>Reloading a page is not something I usually do in a text browser so `r` for right makes sense. Emacs and most external packages consistently use `g` for reload anyway. Like most things Emacs this choice looks a little weird at first but the internal consistency is good.
00-11 · 2022-02-24 18:27
[Dired+](https://www.emacswiki.org/emacs/DiredPlus) gives you commands `diredp-dired-recent-dirs` and `diredp-dired-recent-dirs-other-window`, bound globally to `C-x D r` and `C-x 4 D r`), and the same for recent files & directories (commands `diredp-dired-recent-files` and `diredp-dired-recent-files-other-window`, bound globally to `C-x D R` and `C-x 4 D R`). These give you Dired buffers with only your recent dirs, or files & dirs, respectively. You can act on them in all of the usual Dired ways. Each of them also lets you (using a numeric prefix arg) include (non-negative arg) or exclude (negative arg) specific recent files in the listing. A non-numeric prefix arg prompts for `ls` switches for the listing. So does a zero (0) prefix arg (in addition to prompting for files to include). You also have commands to add and remove files & dirs (e.g. the marked ones) to/from your recentf list. And you can revert such a Dired listing (with `g`). And a prefix arg for that has the same behavior as for initial listing: you can include/exclude specific recent files/dirs and specify `ls` switches. Option `diredp-default-sort-arbitrary-function` defines how such a Dired buffer is sorted, by default: * Access order, most recent first * Access order, least recent first * File name, A-Z * File name, Z-A * Full file name, A-Z * Full file name, Z-A You can re-sort it in any of those ways, using `C-M-S-l`. Non-nil option `diredp-recent-files-quit-kills-flag` kills a Dired recent-files/dirs buffer when you quit it with `q`.
ckoneru · 2022-02-25 02:24
Thanks, I have been using this with ivy integration to navigate to recent directories like `recentf` ;; http://pragmaticemacs.com/emacs/open-a-recent-directory-in-dired-revisited/ (defun my/ivy-dired-recent-dirs () "Present a list of recently used directories and open the selected one in dired" (interactive) (let ((recent-dirs (delete-dups (mapcar (lambda (file) (if (file-directory-p file) file (file-name-directory file))) recentf-list)))) (let ((dir (ivy-read "Directory: " recent-dirs :re-builder #'ivy--regex :sort nil :initial-input nil))) (dired dir)))) (global-set-key (kbd "C-x C-d") 'my/ivy-dired-recent-dirs)