branch: elpa/helm commit 2a647d7f3553ff0dadc2c00fb4eb7c508c308474 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Allow specifying helm-ff-drag-and-drop-default-directories as a cons cell --- helm-files.el | 19 ++++++++++++++++--- helm-help.el | 8 +++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/helm-files.el b/helm-files.el index a6a24a6de4..d67672bef9 100644 --- a/helm-files.el +++ b/helm-files.el @@ -958,11 +958,17 @@ You want generally to set this to your home desktop directory.") 'helm-ff-drag-and-drop-default-directories "4.0.3") -(defcustom helm-ff-drag-and-drop-default-directories nil - "A list of directories where to drop files on a drag-and-drop action. +(defcustom helm-ff-drag-and-drop-default-directories '(history . 10) + "Directories where to drop files on a drag-and-drop action. +Can be a list of directories, or a cons cell (history . <n>) where <n> is the +first <n> directories of `helm-ff-history'. It is used when no suitable directory is found at drop place, generally when dropping outside of an emacs frame." - :type '(repeat (choice string))) + :type '(choice + (cons + (const :tag "History" history) + integer) + (repeat string))) (defcustom helm-ff-drag-mouse-1-default-action 'copy "Default action when dragging files. @@ -5642,6 +5648,13 @@ When no suitable place to drop is found ask to drop to helm-current-buffer) (or helm-ff-drag-and-drop-default-directories helm-ff-drag-and-drop-default-directory)) + (when (and (eq (car it) 'history) + (numberp (cdr it))) + (setq it (helm-take + (remove helm-ff-default-directory + (helm-fast-remove-dups + helm-ff-history :test 'equal)) + (cdr it)))) (x-popup-menu t (list "Choose target" (cons "" diff --git a/helm-help.el b/helm-help.el index 2278c681ad..294c58ca84 100644 --- a/helm-help.el +++ b/helm-help.el @@ -888,9 +888,11 @@ When mouse support is enabled in Helm (which is the default, see of the buffer you drag-and-drop in. When you drag and drop outside of an emacs frame, the target directory is defined by the variable `helm-ff-drag-and-drop-default-directories' which is a list of -directories you can choose from, it is nil by default, customize it to -your needs. Tip: To trigger this from an Emacs full frame, drag to the -border of the Emacs frame. +directories you can choose from or the first <n> elements of +`helm-ff-history' you specify with a cons cell where the first element +is the symbol =history= and the second an integer, it is '(history . 10) +by default, customize it to your needs. Tip: To trigger this from an +Emacs full frame, drag to the border of the Emacs frame. By default Helm copy files when using drag-and-drop, you can customize `helm-ff-drag-mouse-1-default-action' to modify this.