reddit / emacs

Helm: turn off full path in Recentf and show icons in Files-from-the-current-directory

TiMueller · 2022-08-06 13:01
Hi everyone, I started using helm and I like it and can already feel its power. But there are two difficulties I am not getting solved. 1) Is it possible to turn off the display of the full path and just show the base filename in Recentf and Files-from-the-current-directory in my helm-mini-buffer? I know it is done in helm-find-files, but I cannot find a way to turn off the path when using the former two. 2) Helm-recentf and helm-find-files use icons, which I like, because it helps me find the right file quick and at a glance. Files-from-the-current-directory doesn't show the icons. I would love to have it consistent, as I have both in a helm-mini-buffer, Recentf and Current-directory. Do you know a way to achieve this? Thank you so much for any advice! Best regards Titus
helm05 · 2022-08-06 16:19
1. Use C-\] to toggle basename, if you want it at startup customize helm-ff-transformer-show-only-basename. 2. For icons in files from current directory, add something like this to your init file: ``` (use-package helm-for-files :config (cl-defmethod helm-setup-user-source ((source helm-files-in-current-dir-source)) (helm-aif (slot-value source 'filtered-candidate-transformer) (setf (slot-value source 'filtered-candidate-transformer) (append (helm-mklist it) (list 'helm-ff-icons-transformer))))) (setq helm-source-files-in-current-dir (helm-make-source "Files from Current Directory" 'helm-files-in-current-dir-source))) ```
helm05 · 2022-08-06 16:29
But for all your tasks for files, you have better time to use `helm-find-files` which is fully maintained and fully featured. The tools from helm-for-files are kept in helm for backward compatibility but they are not developed, only bugfixes if some.
TiMueller · 2022-08-06 18:42
Thank you so much for helping me! I understand that helm-find-files is the better way to do things with Helm. When I use in my config: (setq helm-ff-transformer-show-only-basename t) it has no effect on helm-recentf. And helm-for-files seems to be quite old, as you said, I am having difficulties to install it in my Doom Emacs, it says: "Could not find package helm-for-files in recipe repositories: (org-elpa melpa gnu-elpa-mirror el-get emacsmirror-mirror)". I will focus on helm-find-files then and maybe continue to use Ivy for Recent Files.
helm05 · 2022-08-06 20:23
Seems your helm installation is not correct if `helm-ff-transformer-show-only-basename` have no effect and helm-for-files is not found. Also note that from helm-find-files you can hit C-c h to have the history files which is the same than recentf (recentf is based on history-file) though you can configure it to use recentf if you want with `helm-ff-file-name-history-use-recentf`.
helm05 · 2022-08-06 20:45
Oh! I see `helm-ff-transformer-show-only-basename` is enabled inconditionally in all commands using `recentf`, `helm-mini`, `helm-multi-files` and `helm-for-files`, so it has no effect at startup until you toggle it with `C-]`. This because it is better in these sources to have the full name to know where the file comes from (in helm-find-files it is not a problem as we know in which directory we are).
TiMueller · 2022-08-08 08:20
Thank you very much! You helped me a lot.
TiMueller · 2022-08-10 16:36
May I ask another Helm-related question? I have my bookmarks list sorted by alphabet and am used to this, I know "by heart" which entry is where. In Helm the entrys are sorted by "newest on top". Is there a way to sort them by alphabet? Vanilla emacs has the option: (setq bookmark-sort-flag t) But Helm doesn't seem to use it. In Helm-bookmark.el there is function though that seems to do it: helm-bookmark-filter-setup-alist I just don't find a way to use it to sort my bookmarks. Any help would be greatly appreciated!
helm05 · 2022-08-10 20:03
helm-adaptive is used by default in helm-filtered-bookmark, but you can use basic boomarks instead which do not use helm-adaptive. helm-bookmark-filter-setup-alist is used to setup categorized bookmarks, it is not what you want. If you still want filtered-bookmarks NOT use helm-adaptive, open a bug report on helm (github) I will be happy to make this configurable. Thanks.
helm05 · 2022-08-10 20:06
By basic boomarks I meant M-x helm-bookmarks.
helm05 · 2022-08-10 20:09
You can use also M-x bookmark-jump with helm-mode enabled.
TiMueller · 2022-08-11 06:38
Thank you so much for taking me, a single user, so seriously and even offering to change the code of helm! I am impressed and a bit nervous. It is my first time to open a bug report, I hope I did it right (and I'm not sure wether I should have opened a feature request instead with this wish of mine). M-x helm-bookmarks doesn't sort alphabetically either, even though `bookmark-sort-flag` is set to "t". So I would be happy if you could implement an option. I'd be thrilled if it both worked for helm-bookmarks and for helm-filtered-bookmarks. (What a wonderful idea, those filtered bookmarks!)
helm05 · 2022-08-11 17:59
Was a good bug report, thanks ;-). Should be fixed for both helm-bookmarks and helm-filtered-bookmarks.