Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* helm-files.el (helm-ff-save-history): Don't save file-name-history …

…here (we don't want to save when C-g'ing).

(helm-files-save-file-name-history): Save file-name-history with this function in helm-after-action-hook.
  • Loading branch information...
commit cefecdeeb4bac26a8ff58a05551c726c565fc5a2 1 parent eea7e49
@thierryvolpiatto thierryvolpiatto authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 helm-files.el
View
16 helm-files.el
@@ -1451,12 +1451,20 @@ e.g helm.el$ => \".*h.*e.*l.*m[.]e.*l$\"
Store the selected file-name in the `file-name-history'."
(when (and helm-ff-default-directory
(helm-file-completion-source-p))
- (push helm-ff-default-directory helm-ff-history)
- ;; we use `abbreviate-file-name' here because other parts of Emacs seems to,
- ;; and we don't want to introduce duplicates.
- (add-to-history 'file-name-history (abbreviate-file-name (helm-get-selection)))))
+ (push helm-ff-default-directory helm-ff-history)))
(add-hook 'helm-cleanup-hook 'helm-ff-save-history)
+(defun helm-files-save-file-name-history ()
+ (let ((sel (helm-get-selection))
+ (history-delete-duplicates t))
+ (when (and (helm-file-completion-source-p)
+ (file-exists-p sel))
+ ;; we use `abbreviate-file-name' here because other parts of Emacs seems to,
+ ;; and we don't want to introduce duplicates.
+ (add-to-history 'file-name-history
+ (abbreviate-file-name (helm-get-selection))))))
+(add-hook 'helm-after-action-hook 'helm-files-save-file-name-history)
+
(defun helm-ff-valid-symlink-p (file)
(file-exists-p (file-truename file)))
Please sign in to comment.
Something went wrong with that request. Please try again.