On Thu, 30 Apr 2015 06:58:25 +0200 Thierry Volpiatto <
thierry....@gmail.com> wrote:
TV> Ted Zlatanov <
t...@lifelogs.com> writes:
>> My current `helm-mini-sources' are (helm-source-buffers-list
>> helm-source-recentf helm-source-buffer-not-found
>> helm-source-minibuffer-history helm-source-occur helm-source-session
>> helm-source-files-in-current-dir helm-source-files-in-all-dired
>> helm-source-etags-select helm-source-locate) and I'd like all of them to
>> save to `file-name-history' (and any other sources that return file
>> names). Basically I can't see a reason I wouldn't want to save files to
>> `file-name-history'.
>>
>> So I dug into it and I had two questions:
>>
>> 1) the `helm-files-save-history-extra-sources' customization needs work.
>> It's a "value menu" but presents as a string,
TV> No, it is a repeat => string (a list of strings IOW).
Right, that's what I meant :) But the customization interface is
*extremely* unhelpful to users. It should be a choice from the known
source names, which the software knows, right? Giving them a repeat
string is not much better than making it a defvar IMO.
I would also like a way to save for all sources, like I said. So ".*"
could work. Or just accept t as a valid setting for this, meaning all.
If you'd like a patch, I can try to improve this?
>> and it's not clear how to include something like "Recentf".
TV> You just go to customize menu and add Recentf.
TV> or
TV> (add-to-list 'helm-files-save-history-extra-sources "Recentf")
But how do I know to use "Recentf"? It's not obvious when I just want to
customize things. Think of this as a user who wants to customize the
variable after installing Helm from a package. They don't want this
level of engagement with the source code yet :)
>> 2) I think there should be a way to automatically save all file choices
>> to the Emacs `file-name-history'. Currently I accomplished this by
>> overriding the default setup. I only use `helm-mini' so this is
>> probably a dumb solution in general:
>>
>> (add-hook 'helm-exit-minibuffer-hook (lambda () (helm-files-save-file-name-history t)))
TV> This add twice the files to history.
Right, but it's the only way I found to save *all sources* which I said
was my goal :)
>> so, checking `helm-file-completion-source-p', I find that it checks
>>
>> (defvar helm--file-completion-sources
>> '("Find Files" "Read File Name" "Read File Name History")
>>
>> which doesn't include the "Recentf", "Locate", and "Files in Current
>> Directory" etc.
TV> `helm-files-save-history-extra-sources' contain by default locate and find.
OK, but not "Recentf" or "Files in Current Directory" or any others I
use, right?
>> If not, then I have to customize `helm-files-save-history-extra-sources'
>> which as I mentioned is not easy to customize and feels like an
>> unpleasant customization for every Helm user.
TV> Why, as stated above, it's easy, I don't understand what is difficult to
TV> customize this var.
I want to save any file choice I make into the `file-name-history'. The
source I use is irrelevant to me.
This is essential to me. I don't know how to say it more clearly. If
that use case can't be supported by Helm, I'll have to hack it to do so.
TV> BTW, you really should switch to helm-find-files for all your files
TV> task, it will allow you to switch from it to many differents action
TV> related to files (browse-project, locate, find, grep, file history,
TV> etc...), you can also bookmark these sessions.
I tried it before, but find `helm-mini' simpler. It gives me everything
I need in one place without remembering any keybindings.
TV> For file-history, try `C-x C-f C-c h' (assuming C-x C-f is
TV> helm-find-files).
Right, but `file-name-history' is standard across all of Emacs so I
prefer to use it. I don't override the default `C-x C-f' from
`find-file', which does know about `file-name-history'. Without my hack,
I'd hit `C-x C-f Up' and the last file I *opened* in `helm-mini' was not
there.
Let me put it differently: why would anyone *not* want to save their
file choices in `file-name-history'? Isn't that its purpose? Including
only some file sources from `file-name-history' seems like a design
decision, so I'm probably not aware of the original reasons for it.
TV> If you really want to keep helm-mini or helm-for-files, try instead
TV> helm-multi-files which allow to not kick-in locate when searching files:
TV> start typing a filename, if you have no result hit `C-c p' that switch
TV> to locate, hit C-c p again when you want to be back to other sources.
Thanks for the advice. I do prefer the simplicity of `helm-mini'.
Ted