Emacs: Skip dots in helm-ff and save helm-ff-history in desktop session

master
Pierre Neidhardt 2017-06-12 21:31:08 +01:00
parent f958a0e147
commit a000f83710
1 changed files with 14 additions and 0 deletions

View File

@ -125,4 +125,18 @@ Requires `call-process-to-string' from `functions'."
(setq helm-source-names-using-follow '("Occur" "Git-Grep" "PT" "mark-ring" "Org Headings"))
(defun helm-skip-dots (old-func &rest args)
"Skip . and .. initially in helm-find-files. First call OLD-FUNC with ARGS."
(apply old-func args)
(let ((sel (helm-get-selection)))
(if (and (stringp sel) (string-match "/\\.$" sel))
(helm-next-line 2)))
(let ((sel (helm-get-selection))) ; if we reached .. move back
(if (and (stringp sel) (string-match "/\\.\\.$" sel))
(helm-previous-line 1))))
(advice-add #'helm-preselect :around #'helm-skip-dots)
(advice-add #'helm-ff-move-to-first-real-candidate :around #'helm-skip-dots)
(add-to-list 'desktop-globals-to-save 'helm-ff-history)
(provide 'tool-helm)