]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
update helm.
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Sat, 20 Feb 2016 12:53:00 +0000 (13:53 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Sat, 20 Feb 2016 14:43:55 +0000 (15:43 +0100)
70 files changed:
bba.org
elpa/helm-20160217.958/emacs-helm.sh [new file with mode: 0755]
elpa/helm-20160217.958/helm-adaptive.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-apt.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-autoloads.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-bookmark.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-buffers.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-color.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-command.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-config.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-dabbrev.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-easymenu.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-elisp-package.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-elisp.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-elscreen.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-eshell.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-eval.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-external.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-files.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-font.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-grep.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-help.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-id-utils.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-imenu.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-info.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-locate.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-man.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-misc.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-mode.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-multi-match.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-net.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-org.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-pkg.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-plugin.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-regexp.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-ring.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-semantic.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-sys.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-tags.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-types.el [new file with mode: 0644]
elpa/helm-20160217.958/helm-utils.el [new file with mode: 0644]
elpa/helm-aws-20141206.1208/helm-aws-autoloads.el [deleted file]
elpa/helm-aws-20141206.1208/helm-aws-pkg.el [deleted file]
elpa/helm-aws-20141206.1208/helm-aws.el [deleted file]
elpa/helm-aws-20151124.133/helm-aws-autoloads.el [new file with mode: 0644]
elpa/helm-aws-20151124.133/helm-aws-pkg.el [new file with mode: 0644]
elpa/helm-aws-20151124.133/helm-aws.el [new file with mode: 0644]
elpa/helm-aws-readme.txt
elpa/helm-core-20160217.958/helm-core-autoloads.el [new file with mode: 0644]
elpa/helm-core-20160217.958/helm-core-pkg.el [new file with mode: 0644]
elpa/helm-core-20160217.958/helm-lib.el [new file with mode: 0644]
elpa/helm-core-20160217.958/helm-multi-match.el [new file with mode: 0644]
elpa/helm-core-20160217.958/helm-source.el [new file with mode: 0644]
elpa/helm-core-20160217.958/helm.el [new file with mode: 0644]
elpa/helm-descbinds-20160108.1947/helm-descbinds-autoloads.el [new file with mode: 0644]
elpa/helm-descbinds-20160108.1947/helm-descbinds-pkg.el [new file with mode: 0644]
elpa/helm-descbinds-20160108.1947/helm-descbinds.el [new file with mode: 0644]
elpa/helm-descbinds-readme.txt
elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el [deleted file]
elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el [deleted file]
elpa/helm-projectile-20150621.1322/helm-projectile.el [deleted file]
elpa/helm-projectile-20151220.221/helm-projectile-autoloads.el [new file with mode: 0644]
elpa/helm-projectile-20151220.221/helm-projectile-pkg.el [new file with mode: 0644]
elpa/helm-projectile-20151220.221/helm-projectile.el [new file with mode: 0644]
elpa/helm-swoop-20150704.839/helm-swoop-autoloads.el [deleted file]
elpa/helm-swoop-20150704.839/helm-swoop-pkg.el [deleted file]
elpa/helm-swoop-20150704.839/helm-swoop.el [deleted file]
elpa/helm-swoop-20160131.533/helm-swoop-autoloads.el [new file with mode: 0644]
elpa/helm-swoop-20160131.533/helm-swoop-pkg.el [new file with mode: 0644]
elpa/helm-swoop-20160131.533/helm-swoop.el [new file with mode: 0644]

diff --git a/bba.org b/bba.org
index 3533da7ce5fdeec6607630df6257411297eec6f9..6e698711dd103668eefbc7b2f247f00b186783d0 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -2034,7 +2034,7 @@ Some links you might check out:
   (if (>= emacs-major-version 24)
       (progn
         (add-to-list 'load-path
-                     "~/.emacs.d/elpa/helm-20160105.2046")
+                     "~/.emacs.d/elpa/helm-20160217.958")
         (require 'helm)
         (helm-mode 1)
         (global-set-key (kbd "M-y") 'helm-show-kill-ring)
@@ -2078,7 +2078,7 @@ Some links you might check out:
 #+BEGIN_SRC emacs-lisp
   (if (>= emacs-major-version 24)
       (progn
-        (add-to-list 'load-path "~/.emacs.d/elpa/helm-descbinds-20151019.230")
+        (add-to-list 'load-path "~/.emacs.d/elpa/helm-descbinds-20160108.1947")
         (require 'helm-descbinds)
         (define-key global-map (kbd "C-h b") 'helm-descbinds)
         )
diff --git a/elpa/helm-20160217.958/emacs-helm.sh b/elpa/helm-20160217.958/emacs-helm.sh
new file mode 100755 (executable)
index 0000000..e71cc10
--- /dev/null
@@ -0,0 +1,106 @@
+#!/usr/bin/env bash
+
+
+## Copyright (C) 2012 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+## 
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+## Commentary:
+
+# Preconfigured Emacs with a basic helm configuration.
+# Useful to start quickly an emacs -Q with helm.
+# Run it from this directory or symlink it somewhere in your PATH.
+
+# If TEMP env var exists use it otherwise declare it.
+[ -z $TEMP ] && declare TEMP="/tmp"
+
+CONF_FILE="$TEMP/helm-cfg.el"
+EMACS=emacs
+
+case $1 in
+    -P)
+        shift 1
+        declare EMACS=$1
+        shift 1
+        ;;
+    -h)
+        echo "Usage: ${0##*/} [-P} Emacs path [-h} help [--] EMACS ARGS"
+        exit 2
+        ;;
+esac
+
+cd $(dirname "$0")
+
+# Check if autoload file exists.
+# It is maybe in a different directory if
+# emacs-helm.sh is a symlink.
+LS=$(ls -l $0 | awk '{print $11}')
+if [ ! -z $LS ]; then
+    AUTO_FILE="$(dirname $LS)/helm-autoloads.el"
+else
+    AUTO_FILE="helm-autoloads.el"
+fi
+if [ ! -e "$AUTO_FILE" ]; then
+    echo No autoloads found, please run make first to generate autoload file
+    exit 2
+fi
+
+
+cat > $CONF_FILE <<EOF
+(setq initial-scratch-message (concat initial-scratch-message
+";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\
+;; This Emacs is Powered by \`HELM' using\n\
+;; emacs program \"$EMACS\".\n\
+;; This is a minimal \`helm' configuration to discover \`helm' or debug it.\n\
+;; You can retrieve this minimal configuration in \"$CONF_FILE\" \n\
+;; Some originals emacs commands have been replaced by own \`helm' commands:\n\n\
+;; - \`find-file'(C-x C-f)            =>\`helm-find-files'\n\
+;; - \`occur'(M-s o)                  =>\`helm-occur'\n\
+;; - \`list-buffers'(C-x C-b)         =>\`helm-buffers-list'\n\
+;; - \`completion-at-point'(M-tab)    =>\`helm-lisp-completion-at-point'[1]\n\
+;; - \`dabbrev-expand'(M-/)           =>\`helm-dabbrev'\n\n\
+;; - \`execute-extended-command'(M-x) =>\`helm-M-x'\n\n
+;; Some others native emacs commands are \"helmized\" by \`helm-mode'.\n\
+;; [1] Coming with emacs-24.4 \`completion-at-point' is \"helmized\" by \`helm-mode'\n\
+;; which provide helm completion in many other places like \`shell-mode'.\n\
+;; You will find embeded help for most helm commands with \`C-h m'.\n\
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))
+
+(setq package-user-dir (directory-file-name
+                        (file-name-directory
+                         (directory-file-name default-directory))))
+(unless (member "helm.el" (directory-files default-directory))
+  (setq package-load-list '((helm-core t) (helm t) (async t) (popup t)))
+  (package-initialize))
+(add-to-list 'load-path (file-name-directory (file-truename "$0")))
+(setq default-frame-alist '((vertical-scroll-bars . nil)
+                            (tool-bar-lines . 0)
+                            (menu-bar-lines . 0)
+                            (fullscreen . nil)))
+(blink-cursor-mode -1)
+(require 'helm-config)
+(helm-mode 1)
+(define-key global-map [remap find-file] 'helm-find-files)
+(define-key global-map [remap occur] 'helm-occur)
+(define-key global-map [remap list-buffers] 'helm-buffers-list)
+(define-key global-map [remap dabbrev-expand] 'helm-dabbrev)
+(global-set-key (kbd "M-x") 'helm-M-x)
+(unless (boundp 'completion-in-region-function)
+  (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)
+  (define-key emacs-lisp-mode-map       [remap completion-at-point] 'helm-lisp-completion-at-point))
+(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$CONF_FILE") (delete-file "$CONF_FILE"))))
+EOF
+
+$EMACS -Q -l $CONF_FILE $@
+
diff --git a/elpa/helm-20160217.958/helm-adaptive.el b/elpa/helm-20160217.958/helm-adaptive.el
new file mode 100644 (file)
index 0000000..09cce1e
--- /dev/null
@@ -0,0 +1,244 @@
+;;; helm-adaptive.el --- Adaptive Sorting of Candidates. -*- lexical-binding: t -*-
+
+;; Original Author: Tamas Patrovics
+
+;; Copyright (C) 2007 Tamas Patrovics
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+
+\f
+(defgroup helm-adapt nil
+  "Adaptative sorting of candidates for Helm."
+  :group 'helm)
+
+(defcustom helm-adaptive-history-file
+  "~/.emacs.d/helm-adaptive-history"
+  "Path of file where history information is stored."
+  :type 'string
+  :group 'helm-adapt)
+
+(defcustom helm-adaptive-history-length 50
+  "Maximum number of candidates stored for a source."
+  :type 'number
+  :group 'helm-adapt)
+
+\f
+;; Internal
+(defvar helm-adaptive-done nil
+  "nil if history information is not yet stored for the current
+selection.")
+
+(defvar helm-adaptive-history nil
+  "Contains the stored history information.
+Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) ...)")
+
+(defun helm-adaptive-done-reset ()
+  (setq helm-adaptive-done nil))
+
+;;;###autoload
+(define-minor-mode helm-adaptive-mode
+  "Toggle adaptive sorting in all sources."
+  :group 'helm-adapt
+  :require 'helm-adaptive
+  :global t
+  (if helm-adaptive-mode
+      (progn
+        (unless helm-adaptive-history
+          (helm-adaptive-maybe-load-history))
+        (add-hook 'kill-emacs-hook 'helm-adaptive-save-history)
+        ;; Should run at beginning of `helm-initial-setup'.
+        (add-hook 'helm-before-initialize-hook 'helm-adaptive-done-reset)
+        ;; Should run at beginning of `helm-exit-minibuffer'.
+        (add-hook 'helm-before-action-hook 'helm-adaptive-store-selection)
+        ;; Should run at beginning of `helm-select-action'.
+        (add-hook 'helm-select-action-hook 'helm-adaptive-store-selection))
+    (helm-adaptive-save-history)
+    (setq helm-adaptive-history nil)
+    (remove-hook 'kill-emacs-hook 'helm-adaptive-save-history)
+    (remove-hook 'helm-before-initialize-hook 'helm-adaptive-done-reset)
+    (remove-hook 'helm-before-action-hook 'helm-adaptive-store-selection)
+    (remove-hook 'helm-select-action-hook 'helm-adaptive-store-selection)))
+
+(defun helm-adapt-use-adaptive-p (&optional source-name)
+  "Return current source only if it use adaptive history, nil otherwise."
+  (when helm-adaptive-mode
+    (let* ((source (or source-name (helm-get-current-source)))
+           (adapt-source (or (assoc-default 'filtered-candidate-transformer
+                                            (assoc (assoc-default 'type source)
+                                                   helm-type-attributes))
+                             (assoc-default 'candidate-transformer
+                                            (assoc (assoc-default 'type source)
+                                                   helm-type-attributes))
+                             (assoc-default 'filtered-candidate-transformer source)
+                             (assoc-default 'candidate-transformer source))))
+      (if (listp adapt-source)
+          (and (member 'helm-adaptive-sort adapt-source) source)
+        (and (eq adapt-source 'helm-adaptive-sort) source)))))
+
+(defun helm-adaptive-store-selection ()
+  "Store history information for the selected candidate."
+  (unless helm-adaptive-done
+    (setq helm-adaptive-done t)
+    (let ((source (helm-adapt-use-adaptive-p)))
+      (when source
+        (let* ((source-name (or (assoc-default 'type source)
+                                (assoc-default 'name source)))
+               (source-info (or (assoc source-name helm-adaptive-history)
+                                (progn
+                                  (push (list source-name) helm-adaptive-history)
+                                  (car helm-adaptive-history))))
+               (selection (helm-get-selection))
+               (selection-info (progn
+                                 (setcdr source-info
+                                         (cons
+                                          (let ((found (assoc selection (cdr source-info))))
+                                            (if (not found)
+                                                ;; new entry
+                                                (list selection)
+                                              ;; move entry to the beginning of the
+                                              ;; list, so that it doesn't get
+                                              ;; trimmed when the history is
+                                              ;; truncated
+                                              (setcdr source-info
+                                                      (delete found (cdr source-info)))
+                                              found))
+                                          (cdr source-info)))
+                                 (cadr source-info)))
+               (pattern-info (progn
+                               (setcdr selection-info
+                                       (cons
+                                        (let ((found (assoc helm-pattern (cdr selection-info))))
+                                          (if (not found)
+                                              ;; new entry
+                                              (cons helm-pattern 0)
+
+                                            ;; move entry to the beginning of the
+                                            ;; list, so if two patterns used the
+                                            ;; same number of times then the one
+                                            ;; used last appears first in the list
+                                            (setcdr selection-info
+                                                    (delete found (cdr selection-info)))
+                                            found))
+                                        (cdr selection-info)))
+                               (cadr selection-info))))
+
+          ;; increase usage count
+          (setcdr pattern-info (1+ (cdr pattern-info)))
+
+          ;; truncate history if needed
+          (if (> (length (cdr selection-info)) helm-adaptive-history-length)
+              (setcdr selection-info
+                      (cl-subseq (cdr selection-info) 0 helm-adaptive-history-length))))))))
+
+(defun helm-adaptive-maybe-load-history ()
+  "Load `helm-adaptive-history-file' which contain `helm-adaptive-history'.
+Returns nil if `helm-adaptive-history-file' doesn't exist."
+  (when (file-readable-p helm-adaptive-history-file)
+    (load-file helm-adaptive-history-file)))
+
+(defun helm-adaptive-save-history (&optional arg)
+  "Save history information to file given by `helm-adaptive-history-file'."
+  (interactive "p")
+  (with-temp-buffer
+    (insert
+     ";; -*- mode: emacs-lisp -*-\n"
+     ";; History entries used for helm adaptive display.\n")
+    (prin1 `(setq helm-adaptive-history ',helm-adaptive-history)
+           (current-buffer))
+    (insert ?\n)
+    (write-region (point-min) (point-max) helm-adaptive-history-file nil
+                  (unless arg 'quiet))))
+
+(defun helm-adaptive-sort (candidates source)
+  "Sort the CANDIDATES for SOURCE by usage frequency.
+This is a filtered candidate transformer you can use with the
+`filtered-candidate-transformer' attribute."
+  (let* ((source-name (or (assoc-default 'type source)
+                          (assoc-default 'name source)))
+         (source-info (assoc source-name helm-adaptive-history)))
+    (if source-info
+        (let ((usage
+               ;; ... assemble a list containing the (CANIDATE . USAGE-COUNT)
+               ;; pairs
+               (mapcar (lambda (candidate-info)
+                         (let ((count 0))
+                           (cl-dolist (pattern-info (cdr candidate-info))
+                             (if (not (equal (car pattern-info)
+                                             helm-pattern))
+                                 (cl-incf count (cdr pattern-info))
+
+                               ;; if current pattern is equal to the previously
+                               ;; used one then this candidate has priority
+                               ;; (that's why its count is boosted by 10000) and
+                               ;; it only has to compete with other candidates
+                               ;; which were also selected with the same pattern
+                               (setq count (+ 10000 (cdr pattern-info)))
+                               (cl-return)))
+                           (cons (car candidate-info) count)))
+                       (cdr source-info))))
+          (if (and usage (consp usage))
+              ;; sort the list in descending order, so candidates with highest
+              ;; priorty come first
+              (progn
+                (setq usage (sort usage (lambda (first second)
+                                          (> (cdr first) (cdr second)))))
+
+                ;; put those candidates first which have the highest usage count
+                (cl-loop for (info . _freq) in usage
+                      for member = (cl-member info candidates
+                                              :test 'helm-adaptive-compare)
+                      when member collect (car member) into sorted
+                      and do
+                      (setq candidates (cl-remove info candidates
+                                                  :test 'helm-adaptive-compare))
+                      finally return (append sorted candidates)))
+            (message "Your `%s' is maybe corrupted or too old, \
+you should reinitialize it with `helm-reset-adaptive-history'"
+                     helm-adaptive-history-file)
+            (sit-for 1)
+            candidates))
+      ;; if there is no information stored for this source then do nothing
+      candidates)))
+
+;;;###autoload
+(defun helm-reset-adaptive-history ()
+  "Delete all `helm-adaptive-history' and his file.
+Useful when you have a old or corrupted `helm-adaptive-history-file'."
+  (interactive)
+  (when (y-or-n-p "Really delete all your `helm-adaptive-history'? ")
+    (setq helm-adaptive-history nil)
+    (delete-file helm-adaptive-history-file)))
+
+(defun helm-adaptive-compare (x y)
+  "Compare candidates X and Y taking into account that the
+candidate can be in (DISPLAY . REAL) format."
+  (equal (if (listp x) (cdr x) x)
+         (if (listp y) (cdr y) y)))
+
+
+(provide 'helm-adaptive)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-adaptive.el ends here
diff --git a/elpa/helm-20160217.958/helm-apt.el b/elpa/helm-20160217.958/helm-apt.el
new file mode 100644 (file)
index 0000000..53c8433
--- /dev/null
@@ -0,0 +1,300 @@
+;;; helm-apt.el --- Helm interface for Debian/Ubuntu packages (apt-*) -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-utils)
+(require 'helm-external)
+(require 'helm-help)
+
+(declare-function term-line-mode "term")
+(declare-function term-char-mode "term")
+(declare-function term-send-input "term")
+(declare-function term-send-eof "term")
+
+\f
+(defgroup helm-apt nil
+  "Apt related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-apt-cache-show-function 'helm-apt-cache-show-1
+  "Function of one argument used to show apt package.
+Default is `helm-apt-cache-show-1' but you can use `apt-utils-show-package-1'
+from `apt-utils.el' to have something more enhanced.
+If nil default `helm-apt-cache-show-1' will be used."
+  :type 'function
+  :group 'helm-apt)
+
+(defcustom helm-apt-actions
+  '(("Show package description" . helm-apt-cache-show)
+    ("Install package(s)" . helm-apt-install)
+    ("Reinstall package(s)" . helm-apt-reinstall)
+    ("Remove package(s)" . helm-apt-uninstall)
+    ("Purge package(s)" . helm-apt-purge))
+  "Actions for helm apt."
+  :group 'helm-apt
+  :type '(alist :key-type string :value-type function))
+
+(defface helm-apt-installed
+    '((t (:foreground "green")))
+  "Face used for apt installed candidates."
+  :group 'helm-apt)
+
+(defface helm-apt-deinstalled
+    '((t (:foreground "DimGray")))
+  "Face used for apt deinstalled candidates."
+  :group 'helm-apt)
+
+\f
+(defvar helm-apt-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-I")   'helm-apt-show-only-installed)
+    (define-key map (kbd "M-U")   'helm-apt-show-only-not-installed)
+    (define-key map (kbd "M-D")   'helm-apt-show-only-deinstalled)
+    (define-key map (kbd "M-A")   'helm-apt-show-all)
+    map))
+
+\f
+(defvar helm-source-apt
+  (helm-build-in-buffer-source "APT"
+    :init #'helm-apt-init
+    :candidate-transformer #'helm-apt-candidate-transformer
+    :display-to-real #'helm-apt-display-to-real
+    :update #'helm-apt-refresh
+    :keymap helm-apt-map
+    :help-message 'helm-apt-help-message
+    :action 'helm-apt-actions
+    :persistent-action #'helm-apt-persistent-action
+    :persistent-help "Show package description"))
+
+;;; Internals vars
+(defvar helm-apt-search-command "apt-cache search '%s'")
+(defvar helm-apt-show-command "apt-cache show '%s'")
+(defvar helm-apt-installed-packages nil)
+(defvar helm-apt-all-packages nil)
+(defvar helm-apt-input-history nil)
+(defvar helm-apt-show-only 'all)
+(defvar helm-apt-term-buffer nil)
+(defvar helm-apt-default-archs nil)
+
+(defun helm-apt-refresh ()
+  "Refresh installed candidates list."
+  (setq helm-apt-installed-packages nil)
+  (setq helm-apt-all-packages nil))
+
+(defun helm-apt-persistent-action (candidate)
+  "Persistent action for APT source."
+  (helm-apt-cache-show candidate))
+
+(defun helm-apt--installed-package-name (name)
+  (cl-loop for arch in helm-apt-default-archs
+           thereis (or (assoc-default
+                        name helm-apt-installed-packages)
+                       (assoc-default
+                        (format "%s:%s" name arch)
+                        helm-apt-installed-packages))))
+
+(defun helm-apt-candidate-transformer (candidates)
+  "Show installed CANDIDATES and the ones to deinstall in a different color."
+  (cl-loop for cand in candidates
+        for name = (helm-apt-display-to-real cand)
+        for deinstall = (string=
+                         (helm-apt--installed-package-name name)
+                         "deinstall")
+        for install = (string=
+                       (helm-apt--installed-package-name name)
+                       "install")
+        for show = (cond ((and deinstall
+                               (memq helm-apt-show-only '(all deinstalled)))
+                          (propertize cand 'face 'helm-apt-deinstalled))
+                         ((and install
+                               (memq helm-apt-show-only '(all installed)))
+                          (propertize cand 'face 'helm-apt-installed))
+                         ((and (eq helm-apt-show-only 'noinstalled)
+                               (not install)) cand)
+                         ((eq helm-apt-show-only 'all) cand))
+        when show collect show))
+
+(defun helm-apt-show-only-installed ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-apt-show-only 'installed)
+    (helm-update)))
+(put 'helm-apt-show-only-installed 'helm-only t)
+
+(defun helm-apt-show-only-not-installed ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-apt-show-only 'noinstalled)
+    (helm-update)))
+(put 'helm-apt-show-only-not-installed 'helm-only t)
+
+(defun helm-apt-show-only-deinstalled ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-apt-show-only 'deinstalled)
+    (helm-update)))
+(put 'helm-apt-show-only-deinstalled 'helm-only t)
+
+(defun helm-apt-show-all ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-apt-show-only 'all)
+    (helm-update)))
+(put 'helm-apt-show-all 'helm-only t)
+
+(defun helm-apt-init ()
+  "Initialize list of debian packages."
+  (let ((query ""))
+    (unless (and helm-apt-installed-packages
+                 helm-apt-all-packages)
+      (message "Loading package list...")
+      (setq helm-apt-installed-packages
+            (with-temp-buffer
+              (call-process-shell-command "dpkg --get-selections"
+                                          nil (current-buffer))
+              (cl-loop for i in (split-string (buffer-string) "\n" t)
+                    for p = (split-string i)
+                    collect (cons (car p) (cadr p)))))
+      (helm-init-candidates-in-buffer
+          'global
+        (setq helm-apt-all-packages
+              (with-temp-buffer
+                (call-process-shell-command
+                 (format helm-apt-search-command query)
+                 nil (current-buffer))
+                (buffer-string))))
+      (message "Loading package list done")
+      (sit-for 0.5))))
+
+(defun helm-apt-display-to-real (line)
+  "Return only name of a debian package.
+LINE is displayed like:
+package name - description."
+  (car (split-string line " - ")))
+
+(defvar helm-apt-show-current-package nil)
+(define-derived-mode helm-apt-show-mode
+    special-mode "helm-apt-show"
+    "Mode to display infos on apt packages.")
+
+(defun helm-apt-cache-show (package)
+  "Show information on apt package PACKAGE."
+  (if (and (functionp helm-apt-cache-show-function)
+           (not (eq helm-apt-cache-show-function
+                    'helm-apt-cache-show)))
+      ;; A function, call it.
+      (funcall helm-apt-cache-show-function package)
+    ;; nil or whatever use default.
+    (helm-apt-cache-show-1 package)))
+
+(defun helm-apt-cache-show-1 (package)
+  (let* ((command (format helm-apt-show-command package))
+         (buf     (get-buffer-create "*helm apt show*")))
+    (switch-to-buffer buf)
+    (unless (string= package helm-apt-show-current-package)
+      (let ((inhibit-read-only t))
+        (erase-buffer)
+        (save-excursion
+          (call-process-shell-command
+           command nil (current-buffer) t))))
+    (helm-apt-show-mode)
+    (set (make-local-variable 'helm-apt-show-current-package)
+         package)))
+
+(defun helm-apt-install (_package)
+  "Run 'apt-get install' shell command on PACKAGE."
+  (helm-apt-generic-action :action 'install))
+
+(defun helm-apt-reinstall (_package)
+  "Run 'apt-get install --reinstall' shell command on PACKAGE."
+  (helm-apt-generic-action :action 'reinstall))
+
+(defun helm-apt-uninstall (_package)
+  "Run 'apt-get remove' shell command on PACKAGE."
+  (helm-apt-generic-action :action 'uninstall))
+
+(defun helm-apt-purge (_package)
+  "Run 'apt-get purge' shell command on PACKAGE."
+  (helm-apt-generic-action :action 'purge))
+
+(cl-defun helm-apt-generic-action (&key action)
+  "Run 'apt-get ACTION'.
+Support install, remove and purge actions."
+  (if (and helm-apt-term-buffer
+           (buffer-live-p (get-buffer helm-apt-term-buffer)))
+      (switch-to-buffer helm-apt-term-buffer)
+    (ansi-term (getenv "SHELL") "term apt")
+    (setq helm-apt-term-buffer (buffer-name)))
+  (term-line-mode)
+  (let ((command   (cl-case action
+                     (install   "sudo apt-get install ")
+                     (reinstall "sudo apt-get install --reinstall ")
+                     (uninstall "sudo apt-get remove ")
+                     (purge     "sudo apt-get purge ")
+                     (t          (error "Unknown action"))))
+        (beg       (point))
+        end
+        (cand-list (mapconcat (lambda (x) (format "'%s'" x))
+                              (helm-marked-candidates) " ")))
+    (goto-char (point-max))
+    (insert (concat command cand-list))
+    (setq end (point))
+    (if (y-or-n-p (format "%s package(s)" (symbol-name action)))
+        (progn
+          (setq helm-external-commands-list nil)
+          (setq helm-apt-installed-packages nil)
+          (term-char-mode) (term-send-input))
+      (delete-region beg end))))
+
+;;;###autoload
+(defun helm-apt (arg)
+  "Preconfigured `helm' : frontend of APT package manager.
+With a prefix arg reload cache."
+  (interactive "P")
+  (setq helm-apt-show-only 'all)
+  (unless helm-apt-default-archs
+    (setq helm-apt-default-archs
+          (append (split-string
+                   (shell-command-to-string
+                    "dpkg --print-architecture")
+                   "\n" t)
+                  (split-string
+                   (shell-command-to-string
+                    "dpkg --print-foreign-architectures")
+                   "\n" t))))
+  (let ((query (read-string "Search Package: " nil 'helm-apt-input-history)))
+    (when arg (helm-apt-refresh))
+    (helm :sources 'helm-source-apt
+          :prompt "Search Package: "
+          :input query
+          :buffer "*helm apt*"
+          :history 'helm-apt-input-history)))
+
+
+(provide 'helm-apt)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-apt.el ends here
diff --git a/elpa/helm-20160217.958/helm-autoloads.el b/elpa/helm-20160217.958/helm-autoloads.el
new file mode 100644 (file)
index 0000000..3162d96
--- /dev/null
@@ -0,0 +1,923 @@
+;;; helm-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-adaptive" "helm-adaptive.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-adaptive.el
+
+(defvar helm-adaptive-mode nil "\
+Non-nil if Helm-Adaptive mode is enabled.
+See the command `helm-adaptive-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `helm-adaptive-mode'.")
+
+(custom-autoload 'helm-adaptive-mode "helm-adaptive" nil)
+
+(autoload 'helm-adaptive-mode "helm-adaptive" "\
+Toggle adaptive sorting in all sources.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'helm-reset-adaptive-history "helm-adaptive" "\
+Delete all `helm-adaptive-history' and his file.
+Useful when you have a old or corrupted `helm-adaptive-history-file'.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-apt" "helm-apt.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-apt.el
+
+(autoload 'helm-apt "helm-apt" "\
+Preconfigured `helm' : frontend of APT package manager.
+With a prefix arg reload cache.
+
+\(fn ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-bookmark.el
+
+(autoload 'helm-bookmarks "helm-bookmark" "\
+Preconfigured `helm' for bookmarks.
+
+\(fn)" t nil)
+
+(autoload 'helm-filtered-bookmarks "helm-bookmark" "\
+Preconfigured helm for bookmarks (filtered by category).
+Optional source `helm-source-bookmark-addressbook' is loaded
+only if external library addressbook-bookmark.el is available.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-buffers.el
+
+(autoload 'helm-buffers-list "helm-buffers" "\
+Preconfigured `helm' to list buffers.
+
+\(fn)" t nil)
+
+(autoload 'helm-mini "helm-buffers" "\
+Preconfigured `helm' lightweight version (buffer -> recentf).
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-color" "helm-color.el" (22215 7711 0
+;;;;;;  0))
+;;; Generated autoloads from helm-color.el
+
+(autoload 'helm-colors "helm-color" "\
+Preconfigured `helm' for color.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-command" "helm-command.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-command.el
+
+(autoload 'helm-M-x "helm-command" "\
+Preconfigured `helm' for Emacs commands.
+It is `helm' replacement of regular `M-x' `execute-extended-command'.
+
+Unlike regular `M-x' emacs vanilla `execute-extended-command' command,
+the prefix args if needed, are passed AFTER starting `helm-M-x'.
+
+You can get help on each command by persistent action.
+
+\(fn ARG &optional COMMAND-NAME)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-config" "helm-config.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-config.el
+
+(autoload 'helm-configuration "helm-config" "\
+Customize `helm'.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-dabbrev.el
+
+(autoload 'helm-dabbrev "helm-dabbrev" "\
+Preconfigured helm for dynamic abbreviations.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (22215 7711 0
+;;;;;;  0))
+;;; Generated autoloads from helm-elisp.el
+
+(autoload 'helm-lisp-completion-at-point "helm-elisp" "\
+Preconfigured helm for lisp symbol completion at point.
+
+\(fn)" t nil)
+
+(autoload 'helm-complete-file-name-at-point "helm-elisp" "\
+Preconfigured helm to complete file name at point.
+
+\(fn &optional FORCE)" t nil)
+
+(autoload 'helm-lisp-indent "helm-elisp" "\
+
+
+\(fn)" t nil)
+
+(autoload 'helm-lisp-completion-or-file-name-at-point "helm-elisp" "\
+Preconfigured helm to complete lisp symbol or filename at point.
+Filename completion happen if string start after or between a double quote.
+
+\(fn)" t nil)
+
+(autoload 'helm-apropos "helm-elisp" "\
+Preconfigured helm to describe commands, functions, variables and faces.
+
+\(fn)" t nil)
+
+(autoload 'helm-manage-advice "helm-elisp" "\
+Preconfigured `helm' to disable/enable function advices.
+
+\(fn)" t nil)
+
+(autoload 'helm-locate-library "helm-elisp" "\
+Preconfigured helm to locate elisp libraries.
+
+\(fn)" t nil)
+
+(autoload 'helm-timers "helm-elisp" "\
+Preconfigured `helm' for timers.
+
+\(fn)" t nil)
+
+(autoload 'helm-complex-command-history "helm-elisp" "\
+Preconfigured helm for complex command history.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-elisp-package" "helm-elisp-package.el"
+;;;;;;  (22215 7711 0 0))
+;;; Generated autoloads from helm-elisp-package.el
+
+(autoload 'helm-list-elisp-packages "helm-elisp-package" "\
+Preconfigured helm for listing and handling emacs packages.
+
+\(fn ARG)" t nil)
+
+(autoload 'helm-list-elisp-packages-no-fetch "helm-elisp-package" "\
+Preconfigured helm for emacs packages.
+Same as `helm-list-elisp-packages' but don't fetch packages on remote.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-elscreen" "helm-elscreen.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-elscreen.el
+
+(autoload 'helm-elscreen "helm-elscreen" "\
+Preconfigured helm to list elscreen.
+
+\(fn)" t nil)
+
+(autoload 'helm-elscreen-history "helm-elscreen" "\
+Preconfigured helm to list elscreen in history order.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-eshell.el
+
+(autoload 'helm-esh-pcomplete "helm-eshell" "\
+Preconfigured helm to provide helm completion in eshell.
+
+\(fn)" t nil)
+
+(autoload 'helm-eshell-history "helm-eshell" "\
+Preconfigured helm for eshell history.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-eval" "helm-eval.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-eval.el
+
+(autoload 'helm-eval-expression "helm-eval" "\
+Preconfigured helm for `helm-source-evaluation-result'.
+
+\(fn ARG)" t nil)
+
+(autoload 'helm-eval-expression-with-eldoc "helm-eval" "\
+Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support. 
+
+\(fn)" t nil)
+
+(autoload 'helm-calcul-expression "helm-eval" "\
+Preconfigured helm for `helm-source-calculation-result'.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-external" "helm-external.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-external.el
+
+(autoload 'helm-run-external-command "helm-external" "\
+Preconfigured `helm' to run External PROGRAM asyncronously from Emacs.
+If program is already running exit with error.
+You can set your own list of commands with
+`helm-external-commands-list'.
+
+\(fn PROGRAM)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-files" "helm-files.el" (22215 7711 0
+;;;;;;  0))
+;;; Generated autoloads from helm-files.el
+
+(autoload 'helm-browse-project "helm-files" "\
+Preconfigured helm to browse projects.
+Browse files and see status of project with its vcs.
+Only HG and GIT are supported for now.
+Fall back to `helm-browse-project-find-files'
+if current directory is not under control of one of those vcs.
+With a prefix ARG browse files recursively, with two prefix ARG
+rebuild the cache.
+If the current directory is found in the cache, start
+`helm-browse-project-find-files' even with no prefix ARG.
+NOTE: The prefix ARG have no effect on the VCS controlled directories.
+
+Needed dependencies for VCS:
+<https://github.com/emacs-helm/helm-ls-git>
+and
+<https://github.com/emacs-helm/helm-ls-hg>
+and
+<http://melpa.org/#/helm-ls-svn>.
+
+\(fn ARG)" t nil)
+
+(autoload 'helm-find "helm-files" "\
+Preconfigured `helm' for the find shell command.
+
+\(fn ARG)" t nil)
+
+(autoload 'helm-find-files "helm-files" "\
+Preconfigured `helm' for helm implementation of `find-file'.
+Called with a prefix arg show history if some.
+Don't call it from programs, use `helm-find-files-1' instead.
+This is the starting point for nearly all actions you can do on files.
+
+\(fn ARG)" t nil)
+
+(autoload 'helm-for-files "helm-files" "\
+Preconfigured `helm' for opening files.
+Run all sources defined in `helm-for-files-preferred-list'.
+
+\(fn)" t nil)
+
+(autoload 'helm-multi-files "helm-files" "\
+Preconfigured helm similar to `helm-for-files' but that don't run locate.
+Allow toggling from locate to others sources.
+This allow seeing first if what you search is in other sources before launching
+locate.
+
+\(fn)" t nil)
+
+(autoload 'helm-recentf "helm-files" "\
+Preconfigured `helm' for `recentf'.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-font" "helm-font.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-font.el
+
+(autoload 'helm-select-xfont "helm-font" "\
+Preconfigured `helm' to select Xfont.
+
+\(fn)" t nil)
+
+(autoload 'helm-ucs "helm-font" "\
+Preconfigured helm for `ucs-names' math symbols.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-grep" "helm-grep.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-grep.el
+
+(autoload 'helm-goto-precedent-file "helm-grep" "\
+Go to precedent file in helm grep/etags buffers.
+
+\(fn)" t nil)
+
+(autoload 'helm-goto-next-file "helm-grep" "\
+Go to precedent file in helm grep/etags buffers.
+
+\(fn)" t nil)
+
+(autoload 'helm-do-grep-ag "helm-grep" "\
+Preconfigured helm for grepping with AG in `default-directory'.
+
+\(fn)" t nil)
+
+(autoload 'helm-grep-do-git-grep "helm-grep" "\
+Preconfigured helm for git-grepping `default-directory'.
+With a prefix arg ARG git-grep the whole repository.
+
+\(fn ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-help" "helm-help.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-help.el
+
+(autoload 'helm-documentation "helm-help" "\
+Preconfigured helm for helm documentation.
+With a prefix arg refresh the documentation.
+
+Find here the documentation of all sources actually documented.
+
+\(fn ARG)" t nil)
+
+(defvar helm-comp-read-mode-line "\\<helm-comp-read-map>C/\\[helm-cr-empty-string]:Empty \\<helm-map>\\[helm-help]:Help \\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend")
+
+(defvar helm-read-file-name-mode-line-string "\\<helm-read-file-map>\\[helm-help]:Help C/\\[helm-cr-empty-string]:Empty \\<helm-map>\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend" "\
+String displayed in mode-line in `helm-source-find-files'.")
+
+(defvar helm-top-mode-line "\\<helm-top-map>\\[helm-help]:Help \\<helm-map>\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend")
+
+(autoload 'helm-describe-helm-attribute "helm-help" "\
+Display the full documentation of HELM-ATTRIBUTE.
+HELM-ATTRIBUTE should be a symbol.
+
+\(fn HELM-ATTRIBUTE)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-id-utils" "helm-id-utils.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-id-utils.el
+
+(autoload 'helm-gid "helm-id-utils" "\
+Preconfigured helm for `gid' command line of `ID-Utils'.
+Need A database created with the command `mkid'
+above `default-directory'.
+Need id-utils as dependency which provide `mkid', `gid' etc...
+See <https://www.gnu.org/software/idutils/>.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (22215 7711 0
+;;;;;;  0))
+;;; Generated autoloads from helm-imenu.el
+
+(autoload 'helm-imenu "helm-imenu" "\
+Preconfigured `helm' for `imenu'.
+
+\(fn)" t nil)
+
+(autoload 'helm-imenu-in-all-buffers "helm-imenu" "\
+Preconfigured helm for fetching imenu entries of all buffers.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-info" "helm-info.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-info.el
+
+(autoload 'helm-info "helm-info" "\
+Preconfigured `helm' for searching Info files' indices.
+
+\(fn)" t nil)
+
+(autoload 'helm-info-at-point "helm-info" "\
+Preconfigured `helm' for searching info at point.
+With a prefix-arg insert symbol at point.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-locate" "helm-locate.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-locate.el
+
+(autoload 'helm-projects-find-files "helm-locate" "\
+Find files with locate in `helm-locate-project-list'.
+With a prefix arg refresh the database in each project.
+
+\(fn UPDATE)" t nil)
+
+(autoload 'helm-locate-read-file-name "helm-locate" "\
+
+
+\(fn PROMPT)" nil nil)
+
+(autoload 'helm-locate "helm-locate" "\
+Preconfigured `helm' for Locate.
+Note: you can add locate options after entering pattern.
+See 'man locate' for valid options and also `helm-locate-command'.
+
+You can specify a local database with prefix argument ARG.
+With two prefix arg, refresh the current local db or create it
+if it doesn't exists.
+
+To create a user specific db, use
+\"updatedb -l 0 -o db_path -U directory\".
+Where db_path is a filename matched by
+`helm-locate-db-file-regexp'.
+
+\(fn ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-man" "helm-man.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-man.el
+
+(autoload 'helm-man-woman "helm-man" "\
+Preconfigured `helm' for Man and Woman pages.
+With a prefix arg reinitialize the cache.
+
+\(fn ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-misc" "helm-misc.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-misc.el
+
+(autoload 'helm-browse-menubar "helm-misc" "\
+Preconfigured helm to the menubar using lacarte.el.
+
+\(fn)" t nil)
+
+(autoload 'helm-world-time "helm-misc" "\
+Preconfigured `helm' to show world time.
+Default action change TZ environment variable locally to emacs.
+
+\(fn)" t nil)
+
+(autoload 'helm-insert-latex-math "helm-misc" "\
+Preconfigured helm for latex math symbols completion.
+
+\(fn)" t nil)
+
+(autoload 'helm-ratpoison-commands "helm-misc" "\
+Preconfigured `helm' to execute ratpoison commands.
+
+\(fn)" t nil)
+
+(autoload 'helm-stumpwm-commands "helm-misc" "\
+Preconfigured helm for stumpwm commands.
+
+\(fn)" t nil)
+
+(autoload 'helm-minibuffer-history "helm-misc" "\
+Preconfigured `helm' for `minibuffer-history'.
+
+\(fn)" t nil)
+
+(autoload 'helm-comint-input-ring "helm-misc" "\
+Preconfigured `helm' that provide completion of `comint' history.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-mode" "helm-mode.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-mode.el
+
+(autoload 'helm-comp-read "helm-mode" "\
+Read a string in the minibuffer, with helm completion.
+
+It is helm `completing-read' equivalent.
+
+- PROMPT is the prompt name to use.
+
+- COLLECTION can be a list, vector, obarray or hash-table.
+  It can be also a function that receives three arguments:
+  the values string, predicate and t. See `all-completions' for more details.
+
+Keys description:
+
+- TEST: A predicate called with one arg i.e candidate.
+
+- INITIAL-INPUT: Same as input arg in `helm'.
+
+- PRESELECT: See preselect arg of `helm'.
+
+- DEFAULT: This option is used only for compatibility with regular
+  Emacs `completing-read' (Same as DEFAULT arg of `completing-read').
+
+- BUFFER: Name of helm-buffer.
+
+- MUST-MATCH: Candidate selected must be one of COLLECTION.
+
+- FUZZY: Enable fuzzy matching.
+
+- REVERSE-HISTORY: When non--nil display history source after current
+  source completion.
+
+- REQUIRES-PATTERN: Same as helm attribute, default is 0.
+
+- HISTORY: A list containing specific history, default is nil.
+  When it is non--nil, all elements of HISTORY are displayed in
+  a special source before COLLECTION.
+
+- INPUT-HISTORY: A symbol. the minibuffer input history will be
+  stored there, if nil or not provided, `minibuffer-history'
+  will be used instead.
+
+- CASE-FOLD: Same as `helm-case-fold-search'.
+
+- DEL-INPUT: Boolean, when non--nil (default) remove the partial
+  minibuffer input from HISTORY is present.
+
+- PERSISTENT-ACTION: A function called with one arg i.e candidate.
+
+- PERSISTENT-HELP: A string to document PERSISTENT-ACTION.
+
+- MODE-LINE: A string or list to display in mode line.
+  Default is `helm-comp-read-mode-line'.
+
+- KEYMAP: A keymap to use in this `helm-comp-read'.
+  (the keymap will be shared with history source)
+
+- NAME: The name related to this local source.
+
+- EXEC-WHEN-ONLY-ONE: Bound `helm-execute-action-at-once-if-one'
+  to non--nil. (possibles values are t or nil).
+
+- VOLATILE: Use volatile attribute.
+
+- SORT: A predicate to give to `sort' e.g `string-lessp'
+  Use this only on small data as it is ineficient.
+  If you want to sort faster add a sort function to
+  FC-TRANSFORMER.
+  Note that FUZZY when enabled is already providing a sort function.
+
+- FC-TRANSFORMER: A `filtered-candidate-transformer' function
+  or a list of functions.
+
+- HIST-FC-TRANSFORMER: A `filtered-candidate-transformer'
+  function for the history source.
+
+- MARKED-CANDIDATES: If non--nil return candidate or marked candidates as a list.
+
+- NOMARK: When non--nil don't allow marking candidates.
+
+- ALISTP: (default is non--nil) See `helm-comp-read-get-candidates'.
+
+- CANDIDATES-IN-BUFFER: when non--nil use a source build with
+  `helm-source-in-buffer' which is much faster.
+  Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil.
+
+Any prefix args passed during `helm-comp-read' invocation will be recorded
+in `helm-current-prefix-arg', otherwise if prefix args were given before
+`helm-comp-read' invocation, the value of `current-prefix-arg' will be used.
+That's mean you can pass prefix args before or after calling a command
+that use `helm-comp-read' See `helm-M-x' for example.
+
+\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (buffer \"*Helm Completions*\") MUST-MATCH FUZZY REVERSE-HISTORY (requires-pattern 0) HISTORY INPUT-HISTORY (case-fold helm-comp-read-case-fold-search) (del-input t) (persistent-action nil) (persistent-help \"DoNothing\") (mode-line helm-comp-read-mode-line) HELP-MESSAGE (keymap helm-comp-read-map) (name \"Helm Completions\") CANDIDATES-IN-BUFFER EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND VOLATILE SORT (fc-transformer (quote helm-cr-default-transformer)) HIST-FC-TRANSFORMER MARKED-CANDIDATES NOMARK (alistp t) (candidate-number-limit helm-candidate-number-limit))" nil nil)
+
+(autoload 'helm-read-file-name "helm-mode" "\
+Read a file name with helm completion.
+It is helm `read-file-name' emulation.
+
+Argument PROMPT is the default prompt to use.
+
+Keys description:
+
+- NAME: Source name, default to \"Read File Name\".
+
+- INITIAL-INPUT: Where to start read file name, default to `default-directory'.
+
+- BUFFER: `helm-buffer' name default to \"*Helm Completions*\".
+
+- TEST: A predicate called with one arg 'candidate'.
+
+- CASE-FOLD: Same as `helm-case-fold-search'.
+
+- PRESELECT: helm preselection.
+
+- HISTORY: Display HISTORY in a special source.
+
+- MUST-MATCH: Can be 'confirm, nil, or t.
+
+- MARKED-CANDIDATES: When non--nil return a list of marked candidates.
+
+- NOMARK: When non--nil don't allow marking candidates.
+
+- ALISTP: Don't use `all-completions' in history (take effect only on history).
+
+- PERSISTENT-ACTION: a persistent action function.
+
+- PERSISTENT-HELP: persistent help message.
+
+- MODE-LINE: A mode line message, default is `helm-read-file-name-mode-line-string'.
+
+\(fn PROMPT &key (name \"Read File Name\") (initial-input default-directory) (buffer \"*Helm file completions*\") TEST (case-fold helm-file-name-case-fold-search) PRESELECT HISTORY MUST-MATCH DEFAULT MARKED-CANDIDATES (candidate-number-limit helm-ff-candidate-number-limit) NOMARK (alistp t) (persistent-action (quote helm-find-files-persistent-action)) (persistent-help \"Hit1 Expand Candidate, Hit2 or (C-u) Find file\") (mode-line helm-read-file-name-mode-line-string))" nil nil)
+
+(defvar helm-mode nil "\
+Non-nil if Helm mode is enabled.
+See the command `helm-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `helm-mode'.")
+
+(custom-autoload 'helm-mode "helm-mode" nil)
+
+(autoload 'helm-mode "helm-mode" "\
+Toggle generic helm completion.
+
+All functions in Emacs that use `completing-read'
+or `read-file-name' and friends will use helm interface
+when this mode is turned on.
+However you can modify this behavior for functions of your choice
+with `helm-completing-read-handlers-alist'.
+
+Called with a positive arg, turn on unconditionally, with a
+negative arg turn off.
+You can turn it on with `helm-mode'.
+
+Some crap emacs functions may not be supported,
+e.g `ffap-alternate-file' and maybe others
+You can add such functions to `helm-completing-read-handlers-alist'
+with a nil value.
+
+Note: This mode is incompatible with Emacs23.
+
+\(fn &optional ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-net" "helm-net.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-net.el
+
+(autoload 'helm-surfraw "helm-net" "\
+Preconfigured `helm' to search PATTERN with search ENGINE.
+
+\(fn PATTERN ENGINE)" t nil)
+
+(autoload 'helm-google-suggest "helm-net" "\
+Preconfigured `helm' for google search with google suggest.
+
+\(fn)" t nil)
+
+(autoload 'helm-wikipedia-suggest "helm-net" "\
+Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-org" "helm-org.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-org.el
+
+(autoload 'helm-org-agenda-files-headings "helm-org" "\
+Preconfigured helm for org files headings.
+
+\(fn)" t nil)
+
+(autoload 'helm-org-in-buffer-headings "helm-org" "\
+Preconfigured helm for org buffer headings.
+
+\(fn)" t nil)
+
+(autoload 'helm-org-parent-headings "helm-org" "\
+Preconfigured helm for org headings that are parents of the
+current heading.
+
+\(fn)" t nil)
+
+(autoload 'helm-org-capture-templates "helm-org" "\
+Preconfigured helm for org templates.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-regexp.el
+
+(autoload 'helm-moccur-mode "helm-regexp" "\
+Major mode to provide actions in helm moccur saved buffer.
+
+Special commands:
+\\{helm-moccur-mode-map}
+
+\(fn)" t nil)
+
+(autoload 'helm-regexp "helm-regexp" "\
+Preconfigured helm to build regexps.
+`query-replace-regexp' can be run from there against found regexp.
+
+\(fn)" t nil)
+
+(autoload 'helm-occur "helm-regexp" "\
+Preconfigured helm for Occur.
+
+\(fn)" t nil)
+
+(autoload 'helm-occur-from-isearch "helm-regexp" "\
+Invoke `helm-occur' from isearch.
+
+\(fn)" t nil)
+
+(autoload 'helm-multi-occur-from-isearch "helm-regexp" "\
+Invoke `helm-multi-occur' from isearch.
+
+With a prefix arg, reverse the behavior of
+`helm-moccur-always-search-in-current'.
+The prefix arg can be set before calling
+`helm-multi-occur-from-isearch' or during the buffer selection.
+
+\(fn &optional ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-ring" "helm-ring.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-ring.el
+
+(defvar helm-push-mark-mode nil "\
+Non-nil if Helm-Push-Mark mode is enabled.
+See the command `helm-push-mark-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `helm-push-mark-mode'.")
+
+(custom-autoload 'helm-push-mark-mode "helm-ring" nil)
+
+(autoload 'helm-push-mark-mode "helm-ring" "\
+Provide an improved version of `push-mark'.
+Modify the behavior of `push-mark' to update
+the `global-mark-ring' after each new visit.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'helm-mark-ring "helm-ring" "\
+Preconfigured `helm' for `helm-source-mark-ring'.
+
+\(fn)" t nil)
+
+(autoload 'helm-global-mark-ring "helm-ring" "\
+Preconfigured `helm' for `helm-source-global-mark-ring'.
+
+\(fn)" t nil)
+
+(autoload 'helm-all-mark-rings "helm-ring" "\
+Preconfigured `helm' for `helm-source-global-mark-ring' and `helm-source-mark-ring'.
+
+\(fn)" t nil)
+
+(autoload 'helm-register "helm-ring" "\
+Preconfigured `helm' for Emacs registers.
+
+\(fn)" t nil)
+
+(autoload 'helm-show-kill-ring "helm-ring" "\
+Preconfigured `helm' for `kill-ring'.
+It is drop-in replacement of `yank-pop'.
+
+First call open the kill-ring browser, next calls move to next line.
+
+\(fn)" t nil)
+
+(autoload 'helm-execute-kmacro "helm-ring" "\
+Preconfigured helm for keyboard macros.
+Define your macros with `f3' and `f4'.
+See (info \"(emacs) Keyboard Macros\") for detailed infos.
+This command is useful when used with persistent action.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (22215 7711
+;;;;;;  0 0))
+;;; Generated autoloads from helm-semantic.el
+
+(autoload 'helm-semantic "helm-semantic" "\
+Preconfigured `helm' for `semantic'.
+If ARG is supplied, pre-select symbol at point instead of current
+
+\(fn ARG)" t nil)
+
+(autoload 'helm-semantic-or-imenu "helm-semantic" "\
+Preconfigured helm for `semantic' or `imenu'.
+If ARG is supplied, pre-select symbol at point instead of current
+semantic tag in scope.
+
+If `semantic-mode' is active in the current buffer, then use
+semantic for generating tags, otherwise fall back to `imenu'.
+Fill in the symbol at point by default.
+
+\(fn ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-sys" "helm-sys.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-sys.el
+
+(autoload 'helm-top "helm-sys" "\
+Preconfigured `helm' for top command.
+
+\(fn)" t nil)
+
+(autoload 'helm-list-emacs-process "helm-sys" "\
+Preconfigured `helm' for emacs process.
+
+\(fn)" t nil)
+
+(autoload 'helm-xrandr-set "helm-sys" "\
+Preconfigured helm for xrandr.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-tags" "helm-tags.el" (22215 7711 0 0))
+;;; Generated autoloads from helm-tags.el
+
+(autoload 'helm-etags-select "helm-tags" "\
+Preconfigured helm for etags.
+If called with a prefix argument REINIT
+or if any of the tag files have been modified, reinitialize cache.
+
+This function aggregates three sources of tag files:
+
+  1) An automatically located file in the parent directories,
+     by `helm-etags-get-tag-file'.
+  2) `tags-file-name', which is commonly set by `find-tag' command.
+  3) `tags-table-list' which is commonly set by `visit-tags-table' command.
+
+\(fn REINIT)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil "helm-utils" "helm-utils.el" (22215 7711 0
+;;;;;;  0))
+;;; Generated autoloads from helm-utils.el
+
+(defvar helm-popup-tip-mode nil "\
+Non-nil if Helm-Popup-Tip mode is enabled.
+See the command `helm-popup-tip-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `helm-popup-tip-mode'.")
+
+(custom-autoload 'helm-popup-tip-mode "helm-utils" nil)
+
+(autoload 'helm-popup-tip-mode "helm-utils" "\
+Show help-echo informations in a popup tip at end of line.
+
+\(fn &optional ARG)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil nil ("helm-easymenu.el" "helm-multi-match.el"
+;;;;;;  "helm-pkg.el" "helm-plugin.el" "helm-types.el") (22215 7711
+;;;;;;  934049 0))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-autoloads.el ends here
diff --git a/elpa/helm-20160217.958/helm-bookmark.el b/elpa/helm-20160217.958/helm-bookmark.el
new file mode 100644 (file)
index 0000000..94f63f6
--- /dev/null
@@ -0,0 +1,739 @@
+;;; helm-bookmark.el --- Helm for Emacs regular Bookmarks. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'bookmark)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-types)
+(require 'helm-utils)
+(require 'helm-info)
+(require 'helm-adaptive)
+(require 'helm-net)
+
+(declare-function addressbook-bookmark-edit "ext:addressbook-bookmark.el" (bookmark))
+(declare-function message-buffers "message.el")
+(declare-function addressbook-set-mail-buffer-1 "ext:addressbook-bookmark.el"
+                  (&optional bookmark-name append cc))
+
+\f
+(defgroup helm-bookmark nil
+  "Predefined configurations for `helm.el'."
+  :group 'helm)
+
+(defcustom helm-bookmark-show-location nil
+  "Show location of bookmark on display."
+  :group 'helm-bookmark
+  :type 'boolean)
+
+(defcustom helm-bookmark-default-filtered-sources
+  (append '(helm-source-bookmark-files&dirs
+            helm-source-bookmark-helm-find-files
+            helm-source-bookmark-info
+            helm-source-bookmark-gnus
+            helm-source-bookmark-man
+            helm-source-bookmark-images
+            helm-source-bookmark-w3m)
+          (and (locate-library "addressbook-bookmark")
+               (list 'helm-source-bookmark-addressbook))
+          (list 'helm-source-bookmark-uncategorized
+                'helm-source-bookmark-set))
+  "List of sources to use in `helm-filtered-bookmarks'."
+  :group 'helm-bookmark
+  :type '(repeat (choice symbol)))
+
+(defcustom helm-bookmark-addressbook-actions
+  '(("Show Contact(s)"
+     . (lambda (candidate)
+         (let* ((contacts (helm-marked-candidates))
+                (current-prefix-arg helm-current-prefix-arg))
+           (bookmark-jump
+            (helm-bookmark-get-bookmark-from-name (car contacts)))
+           (helm-aif (cdr contacts)
+               (let ((current-prefix-arg '(4)))
+                 (cl-loop for bmk in it do
+                          (bookmark-jump
+                           (helm-bookmark-get-bookmark-from-name bmk))))))))
+    ("Mail To" . helm-bookmark-addressbook-send-mail-1)
+    ("Mail Cc" . (lambda (_candidate)
+                   (helm-bookmark-addressbook-send-mail-1 nil 'cc)))
+    ("Mail Bcc" . (lambda (_candidate)
+                    (helm-bookmark-addressbook-send-mail-1 nil 'bcc)))
+    ("Edit Bookmark"
+     . (lambda (candidate)
+         (let ((bmk (helm-bookmark-get-bookmark-from-name
+                     candidate)))
+           (addressbook-bookmark-edit
+            (assoc bmk bookmark-alist)))))
+    ("Delete bookmark(s)" . helm-delete-marked-bookmarks)
+    ("Insert Email at point"
+     . (lambda (candidate)
+         (let* ((bmk   (helm-bookmark-get-bookmark-from-name
+                        candidate))
+                (mlist (split-string
+                        (assoc-default
+                         'email (assoc bmk bookmark-alist))
+                        ", ")))
+           (insert
+            (if (> (length mlist) 1)
+                (helm-comp-read
+                 "Insert Mail Address: " mlist :must-match t)
+                (car mlist))))))
+    ("Show annotation"
+     . (lambda (candidate)
+         (let ((bmk (helm-bookmark-get-bookmark-from-name
+                     candidate)))
+           (bookmark-show-annotation bmk))))
+    ("Edit annotation"
+     . (lambda (candidate)
+         (let ((bmk (helm-bookmark-get-bookmark-from-name
+                     candidate)))
+           (bookmark-edit-annotation bmk))))
+    ("Show Google map"
+     . (lambda (candidate)
+         (let* ((bmk (helm-bookmark-get-bookmark-from-name
+                      candidate))
+                (full-bmk (assoc bmk bookmark-alist)))
+           (addressbook-google-map full-bmk)))))
+  "Actions for addressbook bookmarks."
+  :group 'helm-bookmark
+  :type '(alist :key-type string :value-type function))
+
+\f
+(defface helm-bookmark-info
+    '((t (:foreground "green")))
+  "Face used for W3m Emacs bookmarks (not w3m bookmarks)."
+  :group 'helm-bookmark)
+
+(defface helm-bookmark-w3m
+    '((t (:foreground "yellow")))
+  "Face used for W3m Emacs bookmarks (not w3m bookmarks)."
+  :group 'helm-bookmark)
+
+(defface helm-bookmark-gnus
+    '((t (:foreground "magenta")))
+  "Face used for Gnus bookmarks."
+  :group 'helm-bookmark)
+
+(defface helm-bookmark-man
+    '((t (:foreground "Orange4")))
+  "Face used for Woman/man bookmarks."
+  :group 'helm-bookmark)
+
+(defface helm-bookmark-file
+    '((t (:foreground "Deepskyblue2")))
+  "Face used for file bookmarks."
+  :group 'helm-bookmark)
+
+(defface helm-bookmark-directory
+    '((t (:inherit helm-ff-directory)))
+  "Face used for file bookmarks."
+  :group 'helm-bookmark)
+
+(defface helm-bookmark-addressbook
+    '((t (:foreground "tomato")))
+  "Face used for addressbook bookmarks."
+  :group 'helm-bookmark)
+
+\f
+(defvar helm-bookmark-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "C-c o") 'helm-bookmark-run-jump-other-window)
+    (define-key map (kbd "C-d")   'helm-bookmark-run-delete)
+    (define-key map (kbd "C-]")   'helm-bookmark-toggle-filename)
+    (define-key map (kbd "M-e")   'helm-bookmark-run-edit)
+    map)
+  "Generic Keymap for emacs bookmark sources.")
+
+(defclass helm-source-basic-bookmarks (helm-source-in-buffer helm-type-bookmark)
+   ((init :initform (lambda ()
+                      (bookmark-maybe-load-default-file)
+                      (helm-init-candidates-in-buffer
+                          'global
+                        (bookmark-all-names))))
+    (filtered-candidate-transformer :initform 'helm-bookmark-transformer)))
+
+(defvar helm-source-bookmarks
+  (helm-make-source "Bookmarks" 'helm-source-basic-bookmarks)
+  "See (info \"(emacs)Bookmarks\").")
+
+(defun helm-bookmark-transformer (candidates _source)
+  (cl-loop for i in candidates
+        for loc = (bookmark-location i)
+        for len =  (string-width i)
+        for trunc = (if (> len bookmark-bmenu-file-column)
+                        (helm-substring i bookmark-bmenu-file-column)
+                      i)
+        for sep = (make-string (- (+ bookmark-bmenu-file-column 2)
+                                  (length trunc))
+                               ? )
+        if helm-bookmark-show-location
+        collect (cons (concat trunc sep (if (listp loc) (car loc) loc)) i)
+        else collect i))
+
+(defun helm-bookmark-toggle-filename-1 (_candidate)
+  (let* ((real (helm-get-selection helm-buffer))
+         (trunc (if (> (string-width real) bookmark-bmenu-file-column)
+                    (helm-substring real bookmark-bmenu-file-column)
+                    real))
+         (loc (bookmark-location real)))
+    (setq helm-bookmark-show-location (not helm-bookmark-show-location))
+    (helm-update (if helm-bookmark-show-location
+                           (concat (regexp-quote trunc)
+                                   " +"
+                                   (regexp-quote
+                                    (if (listp loc) (car loc) loc)))
+                           (regexp-quote real)))))
+
+(defun helm-bookmark-toggle-filename ()
+  "Toggle bookmark location visibility."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'toggle-filename
+                  '(helm-bookmark-toggle-filename-1 . never-split))
+    (helm-execute-persistent-action 'toggle-filename)))
+(put 'helm-bookmark-toggle-filename 'helm-only t)
+
+(defun helm-bookmark-jump (candidate)
+  "Jump to bookmark from keyboard."
+  (let ((current-prefix-arg helm-current-prefix-arg)
+        non-essential)
+    (bookmark-jump candidate)))
+
+(defun helm-bookmark-jump-other-window (candidate)
+  (let (non-essential)
+    (bookmark-jump-other-window candidate)))
+
+\f
+;;; bookmark-set
+;;
+(defvar helm-source-bookmark-set
+  (helm-build-dummy-source "Set Bookmark"
+    :filtered-candidate-transformer
+    (lambda (_candidates _source)
+      (list (or (and (not (string= helm-pattern ""))
+                     helm-pattern)
+                "Enter a bookmark name to record")))
+    :action '(("Set bookmark" . (lambda (candidate)
+                                  (if (string= helm-pattern "")
+                                      (message "No bookmark name given for record")
+                                      (bookmark-set candidate))))))
+  "See (info \"(emacs)Bookmarks\").")
+
+\f
+;;; Predicates
+;;
+(defconst helm-bookmark--non-file-filename "   - no file -"
+  "Name to use for `filename' entry, for non-file bookmarks.")
+
+(defun helm-bookmark-gnus-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK is a Gnus bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-gnus)
+      (eq (bookmark-get-handler bookmark) 'gnus-summary-bookmark-jump)
+      (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-gnus)))
+
+(defun helm-bookmark-w3m-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK is a W3m bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-w3m)
+      (eq (bookmark-get-handler bookmark) 'bookmark-w3m-bookmark-jump)
+      (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-w3m)))
+
+(defun helm-bookmark-woman-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK is a Woman bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-woman)
+      (eq (bookmark-get-handler bookmark) 'woman-bookmark-jump)
+      (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-woman)))
+
+(defun helm-bookmark-man-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK is a Man bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (or (eq (bookmark-get-handler bookmark) 'bmkext-jump-man)
+      (eq (bookmark-get-handler bookmark) 'Man-bookmark-jump)
+      (eq (bookmark-get-handler bookmark) 'bookmarkp-jump-man)))
+
+(defun helm-bookmark-woman-man-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK is a Man or Woman bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (or (helm-bookmark-man-bookmark-p bookmark)
+      (helm-bookmark-woman-bookmark-p bookmark)))
+
+(defun helm-bookmark-info-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK is an Info bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (eq (bookmark-get-handler bookmark) 'Info-bookmark-jump))
+
+(defun helm-bookmark-image-bookmark-p (bookmark)
+  "Return non-nil if BOOKMARK bookmarks an image file."
+  (if (stringp bookmark)
+      (assoc 'image-type (assoc bookmark bookmark-alist))
+    (assoc 'image-type bookmark)))
+
+(defun helm-bookmark-file-p (bookmark)
+  "Return non-nil if BOOKMARK bookmarks a file or directory.
+BOOKMARK is a bookmark name or a bookmark record.
+This excludes bookmarks of a more specific kind (Info, Gnus, and W3m)."
+  (let* ((filename   (bookmark-get-filename bookmark))
+         (isnonfile  (equal filename helm-bookmark--non-file-filename))) 
+    (and filename (not isnonfile) (not (bookmark-get-handler bookmark)))))
+
+(defun helm-bookmark-helm-find-files-p (bookmark)
+  "Return non-nil if BOOKMARK bookmarks a `helm-find-files' session.
+BOOKMARK is a bookmark name or a bookmark record."
+  (eq (bookmark-get-handler bookmark) 'helm-ff-bookmark-jump))
+
+(defun helm-bookmark-addressbook-p (bookmark)
+  "Return non--nil if BOOKMARK is a contact recorded with addressbook-bookmark.
+BOOKMARK is a bookmark name or a bookmark record."
+  (if (listp bookmark)
+      (string= (assoc-default 'type bookmark) "addressbook")
+    (string= (assoc-default
+              'type (assoc bookmark bookmark-alist)) "addressbook")))
+
+(defun helm-bookmark-uncategorized-bookmark-p (bookmark)
+  "Return non--nil if BOOKMARK match no known category."
+  (cl-loop for pred in '(helm-bookmark-addressbook-p
+                         helm-bookmark-gnus-bookmark-p
+                         helm-bookmark-w3m-bookmark-p
+                         helm-bookmark-woman-man-bookmark-p
+                         helm-bookmark-info-bookmark-p
+                         helm-bookmark-image-bookmark-p
+                         helm-bookmark-file-p
+                         helm-bookmark-helm-find-files-p
+                         helm-bookmark-addressbook-p)
+           never (funcall pred bookmark)))
+
+(defun helm-bookmark-filter-setup-alist (fn)
+  "Return a filtered `bookmark-alist' sorted alphabetically."
+  (cl-loop for b in bookmark-alist
+           for name = (car b)
+           when (funcall fn b) collect
+           (propertize name 'location (bookmark-location name))))
+\f
+;;; Bookmark handlers
+;;
+(defvar w3m-async-exec)
+(defun helm-bookmark-jump-w3m (bookmark)
+  "Jump to W3m bookmark BOOKMARK, setting a new tab.
+If `browse-url-browser-function' is set to something else
+than `w3m-browse-url' use it."
+  (require 'helm-net)
+  (let ((file  (or (bookmark-prop-get bookmark 'filename)
+                   (bookmark-prop-get bookmark 'url)))
+        (buf   (generate-new-buffer-name "*w3m*"))
+        (w3m-async-exec nil)
+        (really-use-w3m (equal browse-url-browser-function 'w3m-browse-url)))
+    (helm-browse-url file really-use-w3m)
+    (when really-use-w3m
+      (bookmark-default-handler
+       `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark))))))
+
+;; All bookmarks recorded with the handler provided with w3m
+;; (`bookmark-w3m-bookmark-jump') will use our handler which open
+;; the bookmark in a new tab or in an external browser depending
+;; on `browse-url-browser-function'.
+(defalias 'bookmark-w3m-bookmark-jump 'helm-bookmark-jump-w3m)
+
+;; Provide compatibility with old handlers provided in external
+;; packages bookmark-extensions.el and bookmark+.
+(defalias 'bmkext-jump-woman 'woman-bookmark-jump)
+(defalias 'bmkext-jump-man 'Man-bookmark-jump)
+(defalias 'bmkext-jump-w3m 'helm-bookmark-jump-w3m)
+(defalias 'bmkext-jump-gnus 'gnus-summary-bookmark-jump)
+(defalias 'bookmarkp-jump-gnus 'gnus-summary-bookmark-jump)
+(defalias 'bookmarkp-jump-w3m 'helm-bookmark-jump-w3m)
+(defalias 'bookmarkp-jump-woman 'woman-bookmark-jump)
+(defalias 'bookmarkp-jump-man 'Man-bookmark-jump)
+
+\f
+;;;; Filtered bookmark sources
+;;
+;;
+(defclass helm-source-filtered-bookmarks (helm-source-in-buffer helm-type-bookmark)
+  ((filtered-candidate-transformer
+    :initform '(helm-adaptive-sort
+                helm-highlight-bookmark))))
+
+;;; W3m bookmarks.
+;;
+(defun helm-bookmark-w3m-setup-alist ()
+  "Specialized filter function for bookmarks w3m."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-w3m-bookmark-p))
+
+(defvar helm-source-bookmark-w3m
+  (helm-make-source "Bookmark W3m" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-w3m-setup-alist)))))
+
+;;; Images
+;;
+(defun helm-bookmark-images-setup-alist ()
+  "Specialized filter function for images bookmarks."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-image-bookmark-p))
+
+(defvar helm-source-bookmark-images
+  (helm-make-source "Bookmark Images" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-images-setup-alist)))))
+
+;;; Woman Man
+;;
+(defun helm-bookmark-man-setup-alist ()
+  "Specialized filter function for bookmarks w3m."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-woman-man-bookmark-p))
+
+(defvar helm-source-bookmark-man
+  (helm-make-source "Bookmark Woman&Man" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-man-setup-alist)))))
+
+;;; Gnus
+;;
+(defun helm-bookmark-gnus-setup-alist ()
+  "Specialized filter function for bookmarks gnus."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-gnus-bookmark-p))
+
+(defvar helm-source-bookmark-gnus
+  (helm-make-source "Bookmark Gnus" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-gnus-setup-alist)))))
+
+;;; Info
+;;
+(defun helm-bookmark-info-setup-alist ()
+  "Specialized filter function for bookmarks info."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-info-bookmark-p))
+
+(defvar helm-source-bookmark-info
+  (helm-make-source "Bookmark Info" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-info-setup-alist)))))
+
+;;; Files and directories
+;;
+(defun helm-bookmark-local-files-setup-alist ()
+  "Specialized filter function for bookmarks locals files."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-file-p))
+
+(defvar helm-source-bookmark-files&dirs
+  (helm-make-source "Bookmark Files&Directories" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-local-files-setup-alist)))))
+
+;;; Helm find files sessions.
+;;
+(defun helm-bookmark-helm-find-files-setup-alist ()
+  "Specialized filter function for `helm-find-files' bookmarks."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-helm-find-files-p))
+
+(defvar helm-source-bookmark-helm-find-files
+  (helm-make-source "Bookmark helm-find-files sessions" 'helm-source-filtered-bookmarks
+      :init (lambda ()
+              (bookmark-maybe-load-default-file)
+              (helm-init-candidates-in-buffer
+                  'global (helm-bookmark-helm-find-files-setup-alist)))
+      :persistent-action (lambda (_candidate) (ignore))
+      :persistent-help "Do nothing"))
+
+;;; Uncategorized bookmarks
+;;
+(defun helm-bookmark-uncategorized-setup-alist ()
+  "Specialized filter function for uncategorized bookmarks."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-uncategorized-bookmark-p))
+
+(defvar helm-source-bookmark-uncategorized
+  (helm-make-source "Bookmark uncategorized" 'helm-source-filtered-bookmarks
+    :init (lambda ()
+            (bookmark-maybe-load-default-file)
+            (helm-init-candidates-in-buffer
+                'global (helm-bookmark-uncategorized-setup-alist)))))
+
+;;; Addressbook.
+;;
+;;
+(defclass helm-bookmark-addressbook-class (helm-source-in-buffer)
+  ((init :initform (lambda ()
+                     (require 'addressbook-bookmark nil t)
+                     (bookmark-maybe-load-default-file)
+                     (helm-init-candidates-in-buffer
+                         'global
+                       (helm-bookmark-addressbook-setup-alist))))
+   (persistent-action :initform
+                      (lambda (candidate)
+                        (let ((bmk (helm-bookmark-get-bookmark-from-name
+                                    candidate)))
+                          (bookmark--jump-via bmk 'switch-to-buffer))))
+   (persistent-help :initform "Show contact - Prefix with C-u to append")
+   (filtered-candidate-transformer :initform
+                                   '(helm-adaptive-sort
+                                     helm-highlight-bookmark))
+   (action :initform 'helm-bookmark-addressbook-actions)))
+
+(defun helm-bookmark-addressbook-send-mail-1 (_candidate &optional cc)
+  (let* ((contacts (helm-marked-candidates))
+         (bookmark      (helm-bookmark-get-bookmark-from-name
+                         (car contacts)))
+         (append   (message-buffers)))
+    (addressbook-set-mail-buffer-1 bookmark append)
+    (helm-aif (cdr contacts)
+        (progn
+          (when cc (addressbook-set-mail-buffer-1 (car it) nil cc))
+          (cl-loop for bmk in (cdr it) do
+                   (addressbook-set-mail-buffer-1
+                    (helm-bookmark-get-bookmark-from-name bmk) 'append cc))))))
+
+(defun helm-bookmark-addressbook-setup-alist ()
+  "Specialized filter function for addressbook bookmarks."
+  (helm-bookmark-filter-setup-alist 'helm-bookmark-addressbook-p))
+
+(defvar helm-source-bookmark-addressbook
+  (helm-make-source "Bookmark Addressbook" 'helm-bookmark-addressbook-class))
+
+;;; Transformer
+;;
+\f
+(defun helm-highlight-bookmark (bookmarks _source)
+  "Used as `filtered-candidate-transformer' to colorize bookmarks.
+Work both with standard Emacs bookmarks and bookmark-extensions.el."
+  (let ((non-essential t))
+    (cl-loop for i in bookmarks
+          for isfile        = (bookmark-get-filename i)
+          for hff           = (helm-bookmark-helm-find-files-p i)
+          for handlerp      = (and (fboundp 'bookmark-get-handler)
+                                   (bookmark-get-handler i))
+          for isw3m         = (and (fboundp 'helm-bookmark-w3m-bookmark-p)
+                                   (helm-bookmark-w3m-bookmark-p i))
+          for isgnus        = (and (fboundp 'helm-bookmark-gnus-bookmark-p)
+                                   (helm-bookmark-gnus-bookmark-p i))
+          for isman         = (and (fboundp 'helm-bookmark-man-bookmark-p) ; Man
+                                   (helm-bookmark-man-bookmark-p i))
+          for iswoman       = (and (fboundp 'helm-bookmark-woman-bookmark-p) ; Woman
+                                   (helm-bookmark-woman-bookmark-p i))
+          for isannotation  = (bookmark-get-annotation i)
+          for isabook       = (string= (bookmark-prop-get i 'type)
+                                       "addressbook")
+          for isinfo        = (eq handlerp 'Info-bookmark-jump)
+          for loc = (bookmark-location i)
+          for len =  (string-width i)
+          for trunc = (if (and helm-bookmark-show-location
+                               (> len bookmark-bmenu-file-column))
+                          (helm-substring
+                           i bookmark-bmenu-file-column)
+                        i)
+          ;; Add a * if bookmark have annotation
+          if (and isannotation (not (string-equal isannotation "")))
+          do (setq trunc (concat "*" (if helm-bookmark-show-location trunc i)))
+          for sep = (and helm-bookmark-show-location
+                         (make-string (- (+ bookmark-bmenu-file-column 2)
+                                         (string-width trunc))
+                                      ? ))
+          for bmk = (cond ( ;; info buffers
+                           isinfo
+                           (propertize trunc 'face 'helm-bookmark-info
+                                       'help-echo isfile))
+                          ( ;; w3m buffers
+                           isw3m
+                           (propertize trunc 'face 'helm-bookmark-w3m
+                                       'help-echo isfile))
+                          ( ;; gnus buffers
+                           isgnus
+                           (propertize trunc 'face 'helm-bookmark-gnus
+                                       'help-echo isfile))
+                          ( ;; Man Woman
+                           (or iswoman isman)
+                           (propertize trunc 'face 'helm-bookmark-man
+                                       'help-echo isfile))
+                          ( ;; Addressbook
+                           isabook
+                           (propertize trunc 'face 'helm-bookmark-addressbook))
+                          ( ;; directories
+                           (and isfile
+                                (or hff
+                                    ;; This is needed because `non-essential'
+                                    ;; is not working on Emacs-24.2 and the behavior
+                                    ;; of tramp seems to have changed since previous
+                                    ;; versions (Need to reenter password even if a
+                                    ;; first connection have been established,
+                                    ;; probably when host is named differently
+                                    ;; i.e machine/localhost)
+                                    (and (not (file-remote-p isfile))
+                                         (file-directory-p isfile))))
+                           (propertize trunc 'face 'helm-bookmark-directory
+                                       'help-echo isfile))
+                          ( ;; regular files
+                           t
+                           (propertize trunc 'face 'helm-bookmark-file
+                                       'help-echo isfile)))
+          collect (if helm-bookmark-show-location
+                      (cons (concat bmk sep (if (listp loc) (car loc) loc))
+                            i)
+                    (cons bmk i)))))
+
+\f
+;;; Edit/rename/save bookmarks.
+;;
+;;
+(defun helm-bookmark-edit-bookmark (bookmark-name)
+  "Edit bookmark's name and file name, and maybe save them.
+BOOKMARK-NAME is the current (old) name of the bookmark to be renamed."
+  (let ((bmk (helm-bookmark-get-bookmark-from-name bookmark-name))
+        (handler (bookmark-prop-get bookmark-name 'handler)))
+    (if (eq handler 'addressbook-bookmark-jump)
+        (addressbook-bookmark-edit
+         (assoc bmk bookmark-alist))
+      (helm-bookmark-edit-bookmark-1 bookmark-name handler))))
+
+(defun helm-bookmark-edit-bookmark-1 (bookmark-name handler)
+  (let* ((helm--reading-passwd-or-string t)
+         (bookmark-fname (bookmark-get-filename bookmark-name))
+         (bookmark-loc   (bookmark-prop-get bookmark-name 'location))
+         (new-name       (read-from-minibuffer "Name: " bookmark-name))
+         (new-loc        (read-from-minibuffer "FileName or Location: "
+                                               (or bookmark-fname
+                                                   (if (consp bookmark-loc)
+                                                       (car bookmark-loc)
+                                                     bookmark-loc))))
+         (docid           (and (eq handler 'mu4e-bookmark-jump)
+                               (read-number "Docid: " (cdr bookmark-loc)))))
+    (when docid
+      (setq new-loc (cons new-loc docid)))
+    (when (and (not (equal new-name "")) (not (equal new-loc ""))
+               (y-or-n-p "Save changes? "))
+      (if bookmark-fname
+          (progn
+            (helm-bookmark-rename bookmark-name new-name 'batch)
+            (bookmark-set-filename new-name new-loc))
+        (bookmark-prop-set
+         (bookmark-get-bookmark bookmark-name) 'location new-loc)
+        (helm-bookmark-rename bookmark-name new-name 'batch))
+      (helm-bookmark-maybe-save-bookmark)
+      (list new-name new-loc))))
+
+(defun helm-bookmark-maybe-save-bookmark ()
+  "Increment save counter and maybe save `bookmark-alist'."
+  (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count))
+  (when (bookmark-time-to-save-p) (bookmark-save)))
+
+(defun helm-bookmark-rename (old &optional new batch)
+  "Change bookmark's name from OLD to NEW.
+Interactively:
+ If called from the keyboard, then prompt for OLD.
+ If called from the menubar, select OLD from a menu.
+If NEW is nil, then prompt for its string value.
+
+If BATCH is non-nil, then do not rebuild the menu list.
+
+While the user enters the new name, repeated `C-w' inserts consecutive
+words from the buffer into the new bookmark name."
+  (interactive (list (bookmark-completing-read "Old bookmark name")))
+  (bookmark-maybe-historicize-string old)
+  (bookmark-maybe-load-default-file)
+  (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point)))
+  (setq bookmark-current-buffer (current-buffer))
+  (let ((newname  (or new  (read-from-minibuffer
+                            "New name: " nil
+                            (let ((now-map  (copy-keymap minibuffer-local-map)))
+                              (define-key now-map  "\C-w" 'bookmark-yank-word)
+                              now-map)
+                            nil 'bookmark-history))))
+    (bookmark-set-name old newname)
+    (setq bookmark-current-bookmark  newname)
+    (unless batch (bookmark-bmenu-surreptitiously-rebuild-list))
+    (helm-bookmark-maybe-save-bookmark) newname))
+
+(defun helm-bookmark-run-edit ()
+  "Run `helm-bookmark-edit-bookmark' from keyboard."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-bookmark-edit-bookmark)))
+(put 'helm-bookmark-run-edit 'helm-only t)
+
+\f
+(defun helm-bookmark-run-jump-other-window ()
+  "Jump to bookmark from keyboard."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'bookmark-jump-other-window)))
+(put 'helm-bookmark-run-jump-other-window 'helm-only t)
+
+(defun helm-bookmark-run-delete ()
+  "Delete bookmark from keyboard."
+  (interactive)
+  (with-helm-alive-p
+    (when (y-or-n-p "Delete bookmark(s)?")
+      (helm-exit-and-execute-action 'helm-delete-marked-bookmarks))))
+(put 'helm-bookmark-run-delete 'helm-only t)
+
+(defun helm-bookmark-get-bookmark-from-name (bmk)
+  "Return bookmark name even if it is a bookmark with annotation.
+e.g prepended with *."
+  (let ((bookmark (replace-regexp-in-string "\\`\\*" "" bmk)))
+    (if (assoc bookmark bookmark-alist) bookmark bmk)))
+
+(defun helm-delete-marked-bookmarks (_ignore)
+  "Delete this bookmark or all marked bookmarks."
+  (cl-dolist (i (helm-marked-candidates))
+    (bookmark-delete (helm-bookmark-get-bookmark-from-name i)
+                     'batch)))
+
+
+;;;###autoload
+(defun helm-bookmarks ()
+  "Preconfigured `helm' for bookmarks."
+  (interactive)
+  (helm :sources '(helm-source-bookmarks
+                   helm-source-bookmark-set)
+        :buffer "*helm bookmarks*"
+        :default (buffer-name helm-current-buffer)))
+
+;;;###autoload
+(defun helm-filtered-bookmarks ()
+  "Preconfigured helm for bookmarks (filtered by category).
+Optional source `helm-source-bookmark-addressbook' is loaded
+only if external library addressbook-bookmark.el is available."
+  (interactive)
+  (helm :sources helm-bookmark-default-filtered-sources
+        :prompt "Search Bookmark: "
+        :buffer "*helm filtered bookmarks*"
+        :default (list (thing-at-point 'symbol)
+                       (buffer-name helm-current-buffer))))
+
+(provide 'helm-bookmark)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-bookmark.el ends here
diff --git a/elpa/helm-20160217.958/helm-buffers.el b/elpa/helm-20160217.958/helm-buffers.el
new file mode 100644 (file)
index 0000000..c456b86
--- /dev/null
@@ -0,0 +1,895 @@
+;;; helm-buffers.el --- helm support for buffers. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+\f
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-types)
+(require 'helm-utils)
+(require 'helm-elscreen)
+(require 'helm-grep)
+(require 'helm-plugin)
+(require 'helm-regexp)
+(require 'helm-help)
+
+(declare-function ido-make-buffer-list "ido" (default))
+(declare-function ido-add-virtual-buffers-to-list "ido")
+(declare-function helm-comp-read "helm-mode")
+
+\f
+(defgroup helm-buffers nil
+  "Buffers related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-boring-buffer-regexp-list
+  '("\\` " "\\*helm" "\\*helm-mode" "\\*Echo Area" "\\*Minibuf")
+  "The regexp list that match boring buffers.
+Buffer candidates matching these regular expression will be
+filtered from the list of candidates if the
+`helm-skip-boring-buffers' candidate transformer is used."
+  :type  '(repeat (choice regexp))
+  :group 'helm-buffers)
+
+(defcustom helm-white-buffer-regexp-list nil
+  "The regexp list of not boring buffers.
+These buffers will be displayed even if they match one of
+`helm-boring-buffer-regexp-list'."
+  :type '(repeat (choice regexp))
+  :group 'helm-buffers)
+
+(defcustom helm-buffers-favorite-modes '(lisp-interaction-mode
+                                         emacs-lisp-mode
+                                         text-mode
+                                         org-mode)
+  "List of preferred mode to open new buffers with."
+  :type '(repeat (choice function))
+  :group 'helm-buffers)
+
+(defcustom helm-buffer-max-length 20
+  "Max length of buffer names before truncate.
+When disabled (nil) use the longest buffer-name length found."
+  :group 'helm-buffers
+  :type  '(choice (const :tag "Disabled" nil)
+           (integer :tag "Length before truncate")))
+
+(defcustom helm-buffer-details-flag t
+  "Always show details in buffer list when non--nil."
+  :group 'helm-buffers
+  :type 'boolean)
+
+(defcustom helm-buffers-fuzzy-matching nil
+  "Fuzzy matching buffer names when non--nil.
+Only buffer names are fuzzy matched when this is enabled,
+`major-mode' matching is not affected by this."
+  :group 'helm-buffers
+  :type 'boolean)
+
+(defcustom helm-buffer-skip-remote-checking nil
+  "Ignore checking for `file-exists-p' on remote files."
+  :group 'helm-buffers
+  :type 'boolean)
+
+(defcustom helm-buffers-truncate-lines t
+  "Truncate lines in `helm-buffers-list' when non--nil."
+  :group 'helm-buffers
+  :type 'boolean)
+
+(defcustom helm-mini-default-sources '(helm-source-buffers-list
+                                       helm-source-recentf
+                                       helm-source-buffer-not-found)
+  "Default sources list used in `helm-mini'."
+  :group 'helm-buffers
+  :type '(repeat (choice symbol)))
+
+(defcustom helm-buffers-end-truncated-string "..."
+  "The string to display at end of truncated buffer names."
+  :type 'string
+  :group 'helm-buffers)
+
+\f
+;;; Faces
+;;
+;;
+(defgroup helm-buffers-faces nil
+  "Customize the appearance of helm-buffers."
+  :prefix "helm-"
+  :group 'helm-buffers
+  :group 'helm-faces)
+
+(defface helm-buffer-saved-out
+    '((t (:foreground "red" :background "black")))
+  "Face used for buffer files modified outside of emacs."
+  :group 'helm-buffers-faces)
+
+(defface helm-buffer-not-saved
+    '((t (:foreground "Indianred2")))
+  "Face used for buffer files not already saved on disk."
+  :group 'helm-buffers-faces)
+
+(defface helm-buffer-size
+    '((((background dark)) :foreground "RosyBrown")
+      (((background light)) :foreground "SlateGray"))
+  "Face used for buffer size."
+  :group 'helm-buffers-faces)
+
+(defface helm-buffer-process
+    '((t (:foreground "Sienna3")))
+  "Face used for process status in buffer."
+  :group 'helm-buffers-faces)
+
+(defface helm-buffer-directory
+    '((t (:foreground "DarkRed" :background "LightGray")))
+  "Face used for directories in `helm-buffers-list'."
+  :group 'helm-buffers-faces)
+
+(defface helm-buffer-file
+    '((t :inherit font-lock-builtin-face))
+  "Face for buffer file names in `helm-buffers-list'."
+  :group 'helm-buffers-faces)
+
+\f
+;;; Buffers keymap
+;;
+(defvar helm-buffer-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    ;; No need to have separate command for grep and zgrep
+    ;; as we don't use recursivity for buffers.
+    ;; So use zgrep for both as it is capable to handle non--compressed files.
+    (define-key map (kbd "M-g s")     'helm-buffer-run-zgrep)
+    (define-key map (kbd "C-s")       'helm-buffers-run-multi-occur)
+    (define-key map (kbd "C-c o")     'helm-buffer-switch-other-window)
+    (define-key map (kbd "C-c C-o")   'helm-buffer-switch-other-frame)
+    (define-key map (kbd "C-c =")     'helm-buffer-run-ediff)
+    (define-key map (kbd "M-=")       'helm-buffer-run-ediff-merge)
+    (define-key map (kbd "C-=")       'helm-buffer-diff-persistent)
+    (define-key map (kbd "M-U")       'helm-buffer-revert-persistent)
+    (define-key map (kbd "C-c d")     'helm-buffer-run-kill-persistent)
+    (define-key map (kbd "M-D")       'helm-buffer-run-kill-buffers)
+    (define-key map (kbd "C-x C-s")   'helm-buffer-save-persistent)
+    (define-key map (kbd "C-M-%")     'helm-buffer-run-query-replace-regexp)
+    (define-key map (kbd "M-%")       'helm-buffer-run-query-replace)
+    (define-key map (kbd "M-m")       'helm-toggle-all-marks)
+    (define-key map (kbd "M-a")       'helm-mark-all)
+    (define-key map (kbd "C-]")       'helm-toggle-buffers-details)
+    (define-key map (kbd "C-c a")     'helm-buffers-toggle-show-hidden-buffers)
+    (define-key map (kbd "<C-M-SPC>") 'helm-buffers-mark-similar-buffers)
+    map)
+  "Keymap for buffer sources in helm.")
+
+(defvar helm-buffers-ido-virtual-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "C-c o")   'helm-ff-run-switch-other-window)
+    (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame)
+    (define-key map (kbd "M-g s")   'helm-ff-run-grep)
+    (define-key map (kbd "M-g z")   'helm-ff-run-zgrep)
+    (define-key map (kbd "M-D")     'helm-ff-run-delete-file)
+    (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally)
+    map))
+
+\f
+(defvar helm-buffers-list-cache nil)
+(defvar helm-buffer-max-len-mode nil)
+
+(defun helm-buffers-list--init ()
+  ;; Issue #51 Create the list before `helm-buffer' creation.
+  (setq helm-buffers-list-cache (funcall (helm-attr 'buffer-list)))
+  (let ((result (cl-loop for b in helm-buffers-list-cache
+                         maximize (length b) into len-buf
+                         maximize (length (with-current-buffer b
+                                            (format-mode-line mode-name)))
+                         into len-mode
+                         finally return (cons len-buf len-mode))))
+    (unless (default-value 'helm-buffer-max-length)
+      (helm-set-local-variable 'helm-buffer-max-length (car result)))
+    (unless (default-value 'helm-buffer-max-len-mode)
+      (helm-set-local-variable 'helm-buffer-max-len-mode (cdr result)))))
+
+(defclass helm-source-buffers (helm-source-sync helm-type-buffer)
+  ((buffer-list
+    :initarg :buffer-list
+    :initform #'helm-buffer-list
+    :custom function
+    :documentation
+    "  A function with no arguments to create buffer list.")
+   (init :initform 'helm-buffers-list--init)
+   (candidates :initform helm-buffers-list-cache)
+   (matchplugin :initform nil)
+   (match :initform 'helm-buffers-match-function)
+   (persistent-action :initform 'helm-buffers-list-persistent-action)
+   (resume :initform (lambda ()
+                       (run-with-idle-timer
+                        0.1 nil (lambda ()
+                                  (with-helm-buffer
+                                    (helm-force-update))))))
+   (keymap :initform helm-buffer-map)
+   (migemo :initform 'nomultimatch)
+   (volatile :initform t)
+   (help-message :initform 'helm-buffer-help-message)
+   (persistent-help
+    :initform
+    "Show this buffer / C-u \\[helm-execute-persistent-action]: Kill this buffer")))
+
+(defvar helm-source-buffers-list nil)
+
+(defvar helm-source-buffer-not-found
+  (helm-build-dummy-source
+   "Create buffer"
+   :action (helm-make-actions
+            "Create buffer (C-u choose mode)"
+            (lambda (candidate)
+             (let ((mjm (or (and helm-current-prefix-arg
+                                 (intern-soft (helm-comp-read
+                                               "Major-mode: "
+                                               helm-buffers-favorite-modes)))
+                            (cl-loop for (r . m) in auto-mode-alist
+                                     when (string-match r candidate)
+                                     return m)))
+                   (buffer (get-buffer-create candidate)))
+               (if mjm
+                   (with-current-buffer buffer (funcall mjm))
+                   (set-buffer-major-mode buffer))
+               (switch-to-buffer buffer))))))
+
+(defvar ido-temp-list)
+(defvar ido-ignored-list)
+(defvar ido-process-ignore-lists)
+(defvar ido-use-virtual-buffers)
+(defvar ido-virtual-buffers)
+
+(defvar helm-source-ido-virtual-buffers
+  (helm-build-sync-source "Ido virtual buffers"
+    :candidates (lambda ()
+                  (let (ido-temp-list
+                        ido-ignored-list
+                        (ido-process-ignore-lists t))
+                    (when ido-use-virtual-buffers
+                      (ido-add-virtual-buffers-to-list)
+                      ido-virtual-buffers)))
+    :fuzzy-match helm-buffers-fuzzy-matching
+    :keymap helm-buffers-ido-virtual-map
+    :help-message 'helm-buffers-ido-virtual-help-message
+    :action '(("Find file" . helm-find-many-files)
+              ("Find file other window" . find-file-other-window)
+              ("Find file other frame" . find-file-other-frame)
+              ("Find file as root" . helm-find-file-as-root)
+              ("Grep File(s) `C-u recurse'" . helm-find-files-grep)
+              ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep)
+              ("View file" . view-file)
+              ("Delete file(s)" . helm-delete-marked-files)
+              ("Open file externally (C-u to choose)"
+               . helm-open-file-externally))))
+
+\f
+(defvar ido-use-virtual-buffers)
+(defvar ido-ignore-buffers)
+(defun helm-buffer-list ()
+  "Return the current list of buffers.
+Currently visible buffers are put at the end of the list.
+See `ido-make-buffer-list' for more infos."
+  (require 'ido)
+  (let ((ido-process-ignore-lists t)
+        ido-ignored-list
+        ido-ignore-buffers
+        ido-use-virtual-buffers)
+    (ido-make-buffer-list nil)))
+
+(defun helm-buffer-size (buffer)
+  "Return size of BUFFER."
+  (with-current-buffer buffer
+    (save-restriction
+      (widen)
+      (helm-file-human-size
+       (- (position-bytes (point-max))
+          (position-bytes (point-min)))))))
+
+(defun helm-buffer--show-details (buf-name prefix help-echo
+                                  size mode dir face1 face2
+                                  proc details type)
+  (append
+   (list
+    (concat prefix
+            (propertize buf-name 'face face1
+                        'help-echo help-echo
+                        'type type)))
+   (and details
+        (list size mode
+              (propertize
+               (if proc
+                   (format "(%s %s in `%s')"
+                           (process-name proc)
+                           (process-status proc) dir)
+                 (format "(in `%s')" dir))
+               'face face2)))))
+
+(defun helm-buffer--details (buffer &optional details)
+  (let* ((mode (with-current-buffer buffer (format-mode-line mode-name)))
+         (buf (get-buffer buffer))
+         (size (propertize (helm-buffer-size buf)
+                           'face 'helm-buffer-size))
+         (proc (get-buffer-process buf))
+         (dir (with-current-buffer buffer (abbreviate-file-name default-directory)))
+         (file-name (helm-aif (buffer-file-name buf) (abbreviate-file-name it)))
+         (name (buffer-name buf))
+         (name-prefix (when (file-remote-p dir)
+                        (propertize "@ " 'face 'helm-ff-prefix))))
+    ;; No fancy things on remote buffers.
+    (if (and name-prefix helm-buffer-skip-remote-checking)
+        (helm-buffer--show-details
+         name name-prefix file-name size mode dir
+         'helm-buffer-file 'helm-buffer-process nil details 'filebuf)
+      (cond
+        ( ;; A dired buffer.
+         (rassoc buf dired-buffers)
+         (helm-buffer--show-details
+          name name-prefix dir size mode dir
+          'helm-buffer-directory 'helm-buffer-process nil details 'dired))
+        ;; A buffer file modified somewhere outside of emacs.=>red
+        ((and file-name
+              (file-exists-p file-name)
+              (not (verify-visited-file-modtime buf)))
+         (helm-buffer--show-details
+          name name-prefix file-name size mode dir
+          'helm-buffer-saved-out 'helm-buffer-process nil details 'modout))
+        ;; A new buffer file not already saved on disk (or a deleted file) .=>indianred2
+        ((and file-name (not (file-exists-p file-name)))
+         (helm-buffer--show-details
+          name name-prefix file-name size mode dir
+          'helm-buffer-not-saved 'helm-buffer-process nil details 'notsaved))
+        ;; A buffer file modified and not saved on disk.=>orange
+        ((and file-name (buffer-modified-p buf))
+         (helm-buffer--show-details
+          name name-prefix file-name size mode dir
+          'helm-ff-symlink 'helm-buffer-process nil details 'mod))
+        ;; A buffer file not modified and saved on disk.=>green
+        (file-name
+         (helm-buffer--show-details
+          name name-prefix file-name size mode dir
+          'helm-buffer-file 'helm-buffer-process nil details 'filebuf))
+        ;; Any non--file buffer.=>grey italic
+        (t
+         (helm-buffer--show-details
+          name (and proc name-prefix) dir size mode dir
+          'italic 'helm-buffer-process proc details 'nofile))))))
+
+(defun helm-highlight-buffers (buffers _source)
+  "Transformer function to highlight BUFFERS list.
+Should be called after others transformers i.e (boring buffers)."
+  (cl-loop for i in buffers
+        for (name size mode meta) = (if helm-buffer-details-flag
+                                        (helm-buffer--details i 'details)
+                                      (helm-buffer--details i))
+        for truncbuf = (if (> (string-width name) helm-buffer-max-length)
+                           (helm-substring-by-width
+                            name helm-buffer-max-length
+                            helm-buffers-end-truncated-string)
+                         (concat name
+                                 (make-string
+                                       (- (+ helm-buffer-max-length
+                                             (length helm-buffers-end-truncated-string))
+                                          (string-width name)) ? )))
+        for len = (length mode)
+        when (> len helm-buffer-max-len-mode)
+        do (setq helm-buffer-max-len-mode len)
+        for fmode = (concat (make-string
+                             (- (max helm-buffer-max-len-mode len) len) ? )
+                            mode)
+        ;; The max length of a number should be 1023.9X where X is the
+        ;; units, this is 7 characters.
+        for formatted-size = (and size (format "%7s" size))
+        collect (cons (if helm-buffer-details-flag
+                          (concat truncbuf "\t" formatted-size
+                                  "  " fmode "  " meta)
+                        name)
+                      (get-buffer i))))
+
+(defun helm-buffer--get-preselection (buffer)
+  (let ((bufname (buffer-name buffer)))
+    (concat "^"
+            (if (and (null helm-buffer-details-flag)
+                     (numberp helm-buffer-max-length)
+                     (> (string-width bufname)
+                        helm-buffer-max-length))
+                (regexp-quote
+                 (helm-substring-by-width
+                  bufname helm-buffer-max-length
+                  helm-buffers-end-truncated-string))
+                (concat (regexp-quote bufname)
+                        (if helm-buffer-details-flag
+                            "$" "[[:blank:]]+"))))))
+
+(defun helm-toggle-buffers-details ()
+  (interactive)
+  (with-helm-alive-p
+    (let ((preselect (helm-buffer--get-preselection
+                      (helm-get-selection))))
+      (setq helm-buffer-details-flag (not helm-buffer-details-flag))
+      (helm-force-update preselect))))
+(put 'helm-toggle-buffers-details 'helm-only t)
+
+(defun helm-buffers-sort-transformer (candidates _source)
+  (if (string= helm-pattern "")
+      candidates
+    (sort candidates
+          (lambda (s1 s2)
+              (< (string-width s1) (string-width s2))))))
+
+(defun helm-buffers-mark-similar-buffers-1 ()
+  (with-helm-window
+    (let ((type (get-text-property
+                 0 'type (helm-get-selection nil 'withprop))))
+      (save-excursion
+        (goto-char (helm-get-previous-header-pos))
+        (helm-next-line)
+        (let* ((next-head (helm-get-next-header-pos))
+               (end       (and next-head
+                               (save-excursion
+                                 (goto-char next-head)
+                                 (forward-line -1)
+                                 (point))))
+               (maxpoint  (or end (point-max))))
+          (while (< (point) maxpoint)
+            (helm-mark-current-line)
+            (let ((cand (helm-get-selection nil 'withprop)))
+              (when (and (not (helm-this-visible-mark))
+                         (eq (get-text-property 0 'type cand) type))
+                (helm-make-visible-mark)))
+            (forward-line 1) (end-of-line))))
+      (helm-mark-current-line)
+      (helm-display-mode-line (helm-get-current-source) t)
+      (message "%s candidates marked" (length helm-marked-candidates)))))
+
+(defun helm-buffers-mark-similar-buffers ()
+    "Mark All buffers that have same property `type' than current.
+i.e same color."
+  (interactive)
+  (with-helm-alive-p
+    (let ((marked (helm-marked-candidates)))
+      (if (and (>= (length marked) 1)
+               (with-helm-window helm-visible-mark-overlays))
+          (helm-unmark-all)
+          (helm-buffers-mark-similar-buffers-1)))))
+(put 'helm-buffers-mark-similar-buffers 'helm-only t)
+
+\f
+;;; match functions
+;;
+(defun helm-buffer--match-mjm (pattern mjm)
+  (when (string-match "\\`\\*" pattern)
+    (cl-loop with patterns = (split-string (substring pattern 1) ",")
+             for pat in patterns
+             if (string-match "\\`!" pat)
+             collect (string-match (substring pat 1) mjm) into neg
+             else collect (string-match pat mjm) into pos
+             finally return
+             (let ((neg-test (cl-loop for i in neg thereis (numberp i)))
+                   (pos-test (cl-loop for i in pos thereis (numberp i))))
+               (or
+                (and neg (not pos) (not neg-test))
+                (and pos pos-test)
+                (and neg neg-test (not neg-test)))))))
+
+(defun helm-buffer--match-pattern (pattern candidate)
+  (let ((bfn (if (and helm-buffers-fuzzy-matching
+                      (not helm-migemo-mode)
+                      (not (string-match "\\`\\^" pattern)))
+                 #'helm--mapconcat-pattern
+                 #'identity))
+        (mfn (if helm-migemo-mode
+                 #'helm-mm-migemo-string-match #'string-match)))
+    (if (string-match "\\`!" pattern)
+        (not (funcall mfn (funcall bfn (substring pattern 1))
+                      candidate))
+        (funcall mfn (funcall bfn pattern) candidate))))
+
+(defun helm-buffers--match-from-mjm (candidate)
+  (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate))
+         (buf  (get-buffer cand))
+         (regexp (cl-loop with pattern = helm-pattern
+                          for p in (split-string pattern)
+                          when (string-match "\\`\\*" p)
+                          return p)))
+    (if regexp
+        (when buf
+          (with-current-buffer buf
+            (let ((mjm (format-mode-line mode-name)))
+              (helm-buffer--match-mjm regexp mjm))))
+        t)))
+
+(defun helm-buffers--match-from-pat (candidate)
+  (let ((regexp-list (cl-loop with pattern = helm-pattern
+                              for p in (split-string pattern)
+                              unless (string-match
+                                      "\\`\\(\\*\\)\\|\\(/\\)\\|\\(@\\)" p)
+                              collect p)))
+    (if regexp-list
+        (cl-loop for re in regexp-list
+                 always (helm-buffer--match-pattern re candidate))
+        t)))
+
+(defun helm-buffers--match-from-inside (candidate)
+  (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate))
+         (buf  (get-buffer cand))
+         (regexp (cl-loop with pattern = helm-pattern
+                          for p in (split-string pattern)
+                          when (string-match "\\`@\\(.*\\)" p)
+                          return (match-string 1 p))))
+    (if (and buf regexp)
+        (with-current-buffer buf
+          (save-excursion
+            (goto-char (point-min))
+            (if helm-migemo-mode
+                (helm-mm-migemo-forward regexp nil t)
+             (re-search-forward regexp nil t))))
+        t)))
+
+(defun helm-buffers--match-from-directory (candidate)
+  (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate))
+         (buf  (get-buffer cand))
+         (buf-fname (buffer-file-name buf))
+         (regexps (cl-loop with pattern = helm-pattern
+                          for p in (split-string pattern)
+                          when (string-match "\\`/" p)
+                          collect p)))
+    (if regexps
+        (cl-loop for re in regexps
+                 thereis 
+                 (and buf-fname
+                      (string-match
+                       (substring re 1) (helm-basedir buf-fname))))
+        t)))
+
+(defun helm-buffers-match-function (candidate)
+  "Default function to match buffers."
+  (and (helm-buffers--match-from-pat candidate)
+       (helm-buffers--match-from-mjm candidate)
+       (helm-buffers--match-from-inside candidate)
+       (helm-buffers--match-from-directory candidate)))
+
+\f
+(defun helm-buffer-query-replace-1 (&optional regexp-flag buffers)
+  "Query replace in marked buffers.
+If REGEXP-FLAG is given use `query-replace-regexp'."
+  (let ((prompt (if regexp-flag "Query replace regexp" "Query replace"))
+        (bufs   (or buffers (helm-marked-candidates)))
+        (helm--reading-passwd-or-string t))
+    (cl-loop with args = (query-replace-read-args prompt regexp-flag t)
+             for buf in bufs
+             do
+             (save-window-excursion
+               (switch-to-buffer buf)
+               (save-excursion
+                 (let ((case-fold-search t))
+                   (goto-char (point-min))
+                   (apply #'perform-replace
+                          (list (nth 0 args) (nth 1 args)
+                                t regexp-flag (nth 2 args) nil
+                                multi-query-replace-map))))))))
+
+(defun helm-buffer-query-replace-regexp (_candidate)
+  (helm-buffer-query-replace-1 'regexp))
+
+(defun helm-buffer-query-replace (_candidate)
+  (helm-buffer-query-replace-1))
+
+(defun helm-buffer-toggle-diff (candidate)
+  "Toggle diff buffer CANDIDATE with it's file."
+  (let (helm-persistent-action-use-special-display)
+    (helm-aif (get-buffer-window "*Diff*")
+        (progn (kill-buffer "*Diff*")
+               (set-window-buffer it helm-current-buffer))
+      (diff-buffer-with-file (get-buffer candidate)))))
+
+(defun helm-buffer-diff-persistent ()
+  "Toggle diff buffer without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'diff-action 'helm-buffer-toggle-diff)
+    (helm-execute-persistent-action 'diff-action)))
+(put 'helm-buffer-diff-persistent 'helm-only t)
+
+(defun helm-revert-buffer (candidate)
+  (with-current-buffer candidate
+    (helm-aif (buffer-file-name)
+        (and (file-exists-p it) (revert-buffer t t)))))
+
+(defun helm-revert-marked-buffers (_ignore)
+  (mapc 'helm-revert-buffer (helm-marked-candidates)))
+
+(defun helm-buffer-revert-and-update (_candidate)
+  (let ((marked (helm-marked-candidates))
+        (preselect (helm-buffers--quote-truncated-buffer
+                    (helm-get-selection))))
+    (cl-loop for buf in marked do (helm-revert-buffer buf))
+    (when (> (length marked) 1) (helm-unmark-all))
+    (helm-force-update preselect)))
+
+(defun helm-buffer-revert-persistent ()
+  "Revert buffer without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'revert-action '(helm-buffer-revert-and-update . never-split))
+    (helm-execute-persistent-action 'revert-action)))
+(put 'helm-buffer-revert-persistent 'helm-only t)
+
+(defun helm-buffer-save-and-update (_candidate)
+  (let ((marked (helm-marked-candidates))
+        (preselect (helm-get-selection nil t))
+        (enable-recursive-minibuffers t))
+    (cl-loop for buf in marked do
+          (with-current-buffer (get-buffer buf)
+            (when (buffer-file-name) (save-buffer))))
+    (when (> (length marked) 1) (helm-unmark-all))
+    (helm-force-update (regexp-quote preselect))))
+
+(defun helm-buffer-save-persistent ()
+  "Save buffer without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'save-action '(helm-buffer-save-and-update . never-split))
+    (helm-execute-persistent-action 'save-action)))
+(put 'helm-buffer-save-persistent 'helm-only t)
+
+(defun helm-buffer-run-kill-persistent ()
+  "Kill buffer without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'kill-action '(helm-buffers-persistent-kill . never-split))
+    (helm-execute-persistent-action 'kill-action)))
+(put 'helm-buffer-run-kill-persistent 'helm-only t)
+
+(defun helm-kill-marked-buffers (_ignore)
+  (let* ((bufs (helm-marked-candidates))
+         (killed-bufs (cl-count-if 'kill-buffer bufs)))
+    (with-helm-buffer
+      (setq helm-marked-candidates nil
+            helm-visible-mark-overlays nil))
+    (message "Killed %s buffer(s)" killed-bufs)))
+
+(defun helm-buffer-run-kill-buffers ()
+  "Run kill buffer action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-kill-marked-buffers)))
+(put 'helm-buffer-run-kill-buffers 'helm-only t)
+
+(defun helm-buffer-run-grep ()
+  "Run Grep action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-grep-buffers)))
+(put 'helm-buffer-run-grep 'helm-only t)
+
+(defun helm-buffer-run-zgrep ()
+  "Run Grep action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-zgrep-buffers)))
+(put 'helm-buffer-run-zgrep 'helm-only t)
+
+(defun helm-buffer-run-query-replace-regexp ()
+  "Run Query replace regexp action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-buffer-query-replace-regexp)))
+(put 'helm-buffer-run-query-replace-regexp 'helm-only t)
+
+(defun helm-buffer-run-query-replace ()
+  "Run Query replace action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-buffer-query-replace)))
+(put 'helm-buffer-run-query-replace 'helm-only t)
+
+(defun helm-buffer-switch-other-window ()
+  "Run switch to other window action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-switch-to-buffers-other-window)))
+(put 'helm-buffer-switch-other-window 'helm-only t)
+
+(defun helm-buffer-switch-other-frame ()
+  "Run switch to other frame action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'switch-to-buffer-other-frame)))
+(put 'helm-buffer-switch-other-frame 'helm-only t)
+
+(defun helm-buffer-switch-to-elscreen ()
+  "Run switch to elscreen  action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-buffer-on-elscreen)))
+(put 'helm-buffer-switch-to-elscreen 'helm-only t)
+
+(defun helm-buffer-run-ediff ()
+  "Run ediff action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ediff-marked-buffers)))
+(put 'helm-buffer-run-ediff 'helm-only t)
+
+(defun helm-buffer-run-ediff-merge ()
+  "Run ediff action from `helm-source-buffers-list'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ediff-marked-buffers-merge)))
+(put 'helm-buffer-run-ediff-merge 'helm-only t)
+
+(defun helm-buffers-persistent-kill-1 (buffer)
+  "Persistent action to kill buffer."
+  (if (eql (get-buffer buffer) (get-buffer helm-current-buffer))
+      (progn
+        (message "Can't kill `helm-current-buffer' without quitting session")
+        (sit-for 1))
+      (with-current-buffer (get-buffer buffer)
+        (kill-buffer buffer))
+      (helm-delete-current-selection)
+      (with-helm-temp-hook 'helm-after-persistent-action-hook
+        (helm-force-update (regexp-quote (helm-get-selection nil t))))))
+
+(defun helm-buffers--quote-truncated-buffer (buffer)
+  (let ((bufname (and (bufferp buffer)
+                      (buffer-name buffer))))
+    (when bufname
+      (regexp-quote
+       (if helm-buffer-max-length
+           (helm-substring-by-width
+            bufname helm-buffer-max-length
+            "")
+           bufname)))))
+
+(defun helm-buffers-persistent-kill (_buffer)
+  (let ((marked (helm-marked-candidates)))
+    (unwind-protect
+         (cl-loop for b in marked
+               do (progn (helm-preselect
+                          (format "^%s"
+                                  (helm-buffers--quote-truncated-buffer b)))
+                         (when (y-or-n-p (format "kill buffer (%s)? " b))
+                           (helm-buffers-persistent-kill-1 b))
+                         (message nil)))
+      (with-helm-buffer
+        (setq helm-marked-candidates nil
+              helm-visible-mark-overlays nil))
+      (helm-force-update (helm-buffers--quote-truncated-buffer
+                          (helm-get-selection))))))
+
+(defun helm-buffers-list-persistent-action (candidate)
+  (let ((current (window-buffer helm-persistent-action-display-window)))
+    (if (or (eql current (get-buffer helm-current-buffer))
+            (not (eql current (get-buffer candidate))))
+        (switch-to-buffer candidate)
+        (switch-to-buffer helm-current-buffer))))
+
+(defun helm-ediff-marked-buffers (_candidate &optional merge)
+  "Ediff 2 marked buffers or CANDIDATE and `helm-current-buffer'.
+With optional arg MERGE call `ediff-merge-buffers'."
+  (let ((lg-lst (length (helm-marked-candidates)))
+        buf1 buf2)
+    (cl-case lg-lst
+      (0
+       (error "Error:You have to mark at least 1 buffer"))
+      (1
+       (setq buf1 helm-current-buffer
+             buf2 (cl-first (helm-marked-candidates))))
+      (2
+       (setq buf1 (cl-first (helm-marked-candidates))
+             buf2 (cl-second (helm-marked-candidates))))
+      (t
+       (error "Error:To much buffers marked!")))
+    (if merge
+        (ediff-merge-buffers buf1 buf2)
+      (ediff-buffers buf1 buf2))))
+
+(defun helm-ediff-marked-buffers-merge (candidate)
+  "Ediff merge `helm-current-buffer' with CANDIDATE.
+See `helm-ediff-marked-buffers'."
+  (helm-ediff-marked-buffers candidate t))
+
+(defun helm-multi-occur-as-action (_candidate)
+  "Multi occur action for `helm-source-buffers-list'.
+Can be used by any source that list buffers."
+  (let ((helm-moccur-always-search-in-current
+         (if helm-current-prefix-arg
+             (not helm-moccur-always-search-in-current)
+           helm-moccur-always-search-in-current))
+        (buffers (helm-marked-candidates))
+        (input (cl-loop for i in (split-string helm-pattern " " t)
+                     thereis (and (string-match "\\`@\\(.*\\)" i)
+                                  (match-string 1 i)))))
+    (helm-multi-occur-1 buffers input)))
+
+(defun helm-buffers-run-multi-occur ()
+  "Run `helm-multi-occur-as-action' by key."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-multi-occur-as-action)))
+(put 'helm-buffers-run-multi-occur 'helm-only t)
+
+(defun helm-buffers-toggle-show-hidden-buffers ()
+  (interactive)
+  (with-helm-alive-p
+    (let ((filter-attrs (helm-attr 'filtered-candidate-transformer
+                                   helm-source-buffers-list)))
+      (if (memq 'helm-shadow-boring-buffers filter-attrs)
+          (helm-attrset 'filtered-candidate-transformer
+                        (cons 'helm-skip-boring-buffers
+                              (remove 'helm-shadow-boring-buffers
+                                      filter-attrs))
+                        helm-source-buffers-list t)
+        (helm-attrset 'filtered-candidate-transformer
+                      (cons 'helm-shadow-boring-buffers
+                            (remove 'helm-skip-boring-buffers
+                                    filter-attrs))
+                      helm-source-buffers-list t))
+      (helm-force-update))))
+(put 'helm-buffers-toggle-show-hidden-buffers 'helm-only t)
+
+\f
+;;; Candidate Transformers
+;;
+;;
+(defun helm-skip-boring-buffers (buffers _source)
+  (helm-skip-entries buffers
+                     helm-boring-buffer-regexp-list
+                     helm-white-buffer-regexp-list))
+
+(defun helm-shadow-boring-buffers (buffers _source)
+  "Buffers matching `helm-boring-buffer-regexp' will be
+displayed with the `file-name-shadow' face if available."
+  (helm-shadow-entries buffers helm-boring-buffer-regexp-list))
+
+\f
+;;;###autoload
+(defun helm-buffers-list ()
+  "Preconfigured `helm' to list buffers."
+  (interactive)
+  (unless helm-source-buffers-list
+    (setq helm-source-buffers-list
+          (helm-make-source "Buffers" 'helm-source-buffers)))
+  (helm :sources '(helm-source-buffers-list
+                   helm-source-ido-virtual-buffers
+                   helm-source-buffer-not-found)
+        :buffer "*helm buffers*"
+        :keymap helm-buffer-map
+        :truncate-lines helm-buffers-truncate-lines))
+
+;;;###autoload
+(defun helm-mini ()
+  "Preconfigured `helm' lightweight version \(buffer -> recentf\)."
+  (interactive)
+  (require 'helm-files)
+  (unless helm-source-buffers-list
+    (setq helm-source-buffers-list
+          (helm-make-source "Buffers" 'helm-source-buffers)))
+  (helm :sources helm-mini-default-sources
+        :buffer "*helm mini*"
+        :ff-transformer-show-only-basename nil
+        :truncate-lines helm-buffers-truncate-lines))
+
+(provide 'helm-buffers)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-buffers.el ends here
diff --git a/elpa/helm-20160217.958/helm-color.el b/elpa/helm-20160217.958/helm-color.el
new file mode 100644 (file)
index 0000000..4eadfa5
--- /dev/null
@@ -0,0 +1,164 @@
+;;; helm-color.el --- colors and faces -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+
+;;; Customize Face
+;;
+;;
+(defun helm-custom-faces-init ()
+  "Initialize buffer for `helm-source-customize-face'."
+  (unless (helm-candidate-buffer)
+    (save-selected-window
+      (list-faces-display)
+      (message nil))
+    (helm-init-candidates-in-buffer
+        'global
+      (with-current-buffer (get-buffer "*Faces*")
+        (buffer-substring
+         (next-single-char-property-change (point-min) 'face)
+         (point-max))))
+    (kill-buffer "*Faces*")))
+
+(defvar helm-source-customize-face
+  (helm-build-in-buffer-source "Customize Face"
+    :init 'helm-custom-faces-init
+    :get-line 'buffer-substring
+    :action '(("Customize"
+               . (lambda (line)
+                   (customize-face (intern (car (split-string line))))))
+              ("Copy name"
+               . (lambda (line)
+                   (kill-new (car (split-string line " " t)))))))
+  "See (info \"(emacs)Faces\")")
+
+;;; Colors browser
+;;
+;;
+(defun helm-colors-init ()
+  (unless (helm-candidate-buffer)
+    (save-selected-window
+      (list-colors-display)
+      (message nil))
+    (helm-init-candidates-in-buffer
+        'global
+      (with-current-buffer (get-buffer "*Colors*")
+        (buffer-string)))
+    (kill-buffer "*Colors*")))
+
+(defun helm-color-insert-name (candidate)
+  (with-helm-current-buffer
+    (insert (helm-colors-get-name candidate))))
+
+(defun helm-color-kill-name (candidate)
+  (kill-new (helm-colors-get-name candidate)))
+
+(defun helm-color-insert-rgb (candidate)
+  (with-helm-current-buffer
+    (insert (helm-colors-get-rgb candidate))))
+
+(defun helm-color-kill-rgb (candidate)
+  (kill-new (helm-colors-get-rgb candidate)))
+
+(defun helm-color-run-insert-name ()
+  "Insert name of color from `helm-source-colors'"
+  (interactive)
+  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-name)))
+(put 'helm-color-run-insert-name 'helm-only t)
+
+(defun helm-color-run-kill-name ()
+  "Kill name of color from `helm-source-colors'"
+  (interactive)
+  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-name)))
+(put 'helm-color-run-kill-name 'helm-only t)
+
+(defun helm-color-run-insert-rgb ()
+  "Insert RGB of color from `helm-source-colors'"
+  (interactive)
+  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-rgb)))
+(put 'helm-color-run-insert-rgb 'helm-only t)
+
+(defun helm-color-run-kill-rgb ()
+  "Kill RGB of color from `helm-source-colors'"
+  (interactive)
+  (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-rgb)))
+(put 'helm-color-run-kill-rgb 'helm-only t)
+
+(defvar helm-color-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "C-c n") 'helm-color-run-insert-name)
+    (define-key map (kbd "C-c N") 'helm-color-run-kill-name)
+    (define-key map (kbd "C-c r") 'helm-color-run-insert-rgb)
+    (define-key map (kbd "C-c R") 'helm-color-run-kill-rgb)
+    map))
+
+(defvar helm-source-colors
+  (helm-build-in-buffer-source "Colors"
+    :init 'helm-colors-init
+    :get-line 'buffer-substring
+    :keymap helm-color-map
+    :persistent-help "Kill entry in RGB format."
+    :persistent-action 'helm-color-kill-rgb
+    :help-message 'helm-colors-help-message
+    :action
+    '(("Copy Name (C-c N)" . helm-color-kill-name)
+      ("Copy RGB (C-c R)" . helm-color-kill-rgb)
+      ("Insert Name (C-c n)" . helm-color-insert-name)
+      ("Insert RGB (C-c r)" . helm-color-insert-rgb))))
+
+(defun helm-colors-get-name (candidate)
+  "Get color name."
+  (replace-regexp-in-string
+   " " ""
+   (with-temp-buffer
+     (insert (capitalize candidate))
+     (goto-char (point-min))
+     (search-forward-regexp "\\s-\\{2,\\}")
+     (delete-region (point) (point-max))
+     (buffer-string))))
+
+(defun helm-colors-get-rgb (candidate)
+  "Get color RGB."
+  (replace-regexp-in-string
+   " " ""
+   (with-temp-buffer
+     (insert (capitalize candidate))
+     (goto-char (point-max))
+     (search-backward-regexp "\\s-\\{2,\\}")
+     (delete-region (point) (point-min))
+     (buffer-string))))
+
+;;;###autoload
+(defun helm-colors ()
+  "Preconfigured `helm' for color."
+  (interactive)
+  (helm :sources '(helm-source-colors helm-source-customize-face)
+        :buffer "*helm colors*"))
+
+(provide 'helm-color)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-color.el ends here
diff --git a/elpa/helm-20160217.958/helm-command.el b/elpa/helm-20160217.958/helm-command.el
new file mode 100644 (file)
index 0000000..9f79485
--- /dev/null
@@ -0,0 +1,256 @@
+;;; helm-command.el --- Helm execute-exended-command. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-mode)
+(require 'helm-elisp)
+
+\f
+(defgroup helm-command nil
+  "Emacs command related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-M-x-requires-pattern 0
+  "Value of requires-pattern for `helm-M-x'.
+Show all candidates on startup when 0 (default)."
+  :group 'helm-command
+  :type 'boolean)
+
+(defcustom helm-M-x-always-save-history nil
+  "`helm-M-x' Save command in `extended-command-history' even when it fail."
+  :group 'helm-command
+  :type  'boolean)
+
+(defcustom helm-M-x-reverse-history nil
+  "The history source of `helm-M-x' appear in second position when non--nil."
+  :group 'helm-command
+  :type 'boolean)
+
+(defcustom helm-M-x-fuzzy-match nil
+  "Enable fuzzy matching in `helm-M-x' when non--nil.")
+
+\f
+;;; Faces
+;;
+;;
+(defgroup helm-command-faces nil
+  "Customize the appearance of helm-command."
+  :prefix "helm-"
+  :group 'helm-command
+  :group 'helm-faces)
+
+(defface helm-M-x-key '((t (:foreground "orange" :underline t)))
+  "Face used in helm-M-x to show keybinding."
+  :group 'helm-command-faces)
+
+\f
+(defvar helm-M-x-input-history nil)
+
+\f
+(cl-defun helm-M-x-get-major-mode-command-alist (mode-map)
+  "Return alist of MODE-MAP."
+  (when mode-map
+    (cl-loop for key being the key-seqs of mode-map using (key-bindings com)
+             for str-key  = (key-description key)
+             for ismenu   = (string-match "<menu-bar>" str-key)
+             unless ismenu collect (cons str-key com))))
+
+(defun helm-get-mode-map-from-mode (mode)
+  "Guess the mode-map name according to MODE.
+Some modes don't use conventional mode-map name
+so we need to guess mode-map name. e.g python-mode ==> py-mode-map.
+Return nil if no mode-map found."
+  (cl-loop ;; Start with a conventional mode-map name.
+        with mode-map    = (intern-soft (format "%s-map" mode))
+        with mode-string = (symbol-name mode)
+        with mode-name   = (replace-regexp-in-string "-mode" "" mode-string)
+        while (not mode-map)
+        for count downfrom (length mode-name)
+        ;; Return when no result after parsing entire string.
+        when (eq count 0) return nil
+        for sub-name = (substring mode-name 0 count)
+        do (setq mode-map (intern-soft (format "%s-map" (concat sub-name "-mode"))))
+        finally return mode-map))
+
+(defun helm-M-x-current-mode-map-alist ()
+  "Return mode-map alist of current `major-mode'."
+  (let ((map-sym (helm-get-mode-map-from-mode major-mode)))
+    (when (and map-sym (boundp map-sym))
+      (helm-M-x-get-major-mode-command-alist (symbol-value map-sym)))))
+
+
+(defun helm-M-x-transformer-1 (candidates &optional sort)
+  "Transformer function to show bindings in emacs commands.
+Show global bindings and local bindings according to current `major-mode'.
+If SORT is non nil sort list with `helm-generic-sort-fn'.
+Note that SORT should not be used when fuzzy matching because
+fuzzy matching is running its own sort function with a different algorithm."
+  (with-helm-current-buffer
+    (cl-loop with local-map = (helm-M-x-current-mode-map-alist)
+          for cand in candidates
+          for local-key  = (car (rassq cand local-map))
+          for key        = (substitute-command-keys (format "\\[%s]" cand))
+          unless (get (intern (if (consp cand) (car cand) cand)) 'helm-only)
+          collect
+          (cons (cond ((and (string-match "^M-x" key) local-key)
+                       (format "%s (%s)"
+                               cand (propertize
+                                     local-key
+                                     'face 'helm-M-x-key)))
+                      ((string-match "^M-x" key) cand)
+                      (t (format "%s (%s)"
+                                 cand (propertize
+                                       key
+                                       'face 'helm-M-x-key))))
+                cand)
+          into ls
+          finally return
+          (if sort (sort ls #'helm-generic-sort-fn) ls))))
+
+(defun helm-M-x-transformer (candidates _source)
+  "Transformer function for `helm-M-x' candidates."
+  (helm-M-x-transformer-1 candidates (null helm--in-fuzzy)))
+
+(defun helm-M-x-transformer-hist (candidates _source)
+  "Transformer function for `helm-M-x' candidates."
+  (helm-M-x-transformer-1 candidates))
+
+(defun helm-M-x--notify-prefix-arg ()
+  ;; Notify a prefix-arg set AFTER calling M-x.
+  (when prefix-arg
+    (with-helm-window
+      (helm-display-mode-line (helm-get-current-source) 'force))))
+
+(defun helm-cmd--get-current-function-name ()
+  (save-excursion
+    (beginning-of-defun)
+    (cadr (split-string (buffer-substring-no-properties
+                         (point-at-bol) (point-at-eol))))))
+
+(defun helm-cmd--get-preconfigured-commands (&optional dir)
+  (let* ((helm-dir (or dir (helm-basedir (locate-library "helm"))))
+         (helm-autoload-file (expand-file-name "helm-autoloads.el" helm-dir))
+         results)
+    (when (file-exists-p helm-autoload-file)
+      (with-temp-buffer
+        (insert-file-contents helm-autoload-file)
+        (while (re-search-forward "Preconfigured" nil t)
+          (push (substring (helm-cmd--get-current-function-name) 1) results))))
+    results))
+
+(defun helm-M-x-read-extended-command (&optional collection history)
+  "Read command name to invoke in `helm-M-x'.
+Helm completion is not provided when executing or defining
+kbd macros.
+Optional arg COLLECTION is to allow using another COLLECTION
+than the default which is OBARRAY."
+  (if (or defining-kbd-macro executing-kbd-macro)
+      (if helm-mode
+          (unwind-protect
+               (progn
+                 (helm-mode -1)
+                 (read-extended-command))
+            (helm-mode 1))
+          (read-extended-command))
+      (let* ((orig-fuzzy-sort-fn helm-fuzzy-sort-fn)
+             (helm-fuzzy-sort-fn (lambda (candidates source)
+                                   (funcall orig-fuzzy-sort-fn
+                                            candidates source 'real)))
+             (helm--mode-line-display-prefarg t)
+             (tm (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg))
+             (helm-move-selection-after-hook
+              (cons (lambda () (setq current-prefix-arg nil))
+                    helm-move-selection-after-hook)))
+        (setq extended-command-history
+              (cl-loop for c in extended-command-history
+                       when (and c (commandp (intern c)))
+                       do (set-text-properties 0 (length c) nil c)
+                       and collect c))
+        (unwind-protect
+             (let ((msg "Error: Specifying a prefix arg before calling `helm-M-x'"))
+               (when current-prefix-arg
+                 (ding)
+                 (message "%s" msg)
+                 (while (not (sit-for 1))
+                   (discard-input))
+                 (user-error msg))
+               (setq current-prefix-arg nil)
+               (helm-comp-read
+                "M-x " (or collection obarray)
+                :test 'commandp
+                :requires-pattern helm-M-x-requires-pattern
+                :name "Emacs Commands"
+                :buffer "*helm M-x*"
+                :persistent-action (lambda (candidate)
+                                     (helm-elisp--persistent-help
+                                      candidate 'helm-describe-function))
+                :persistent-help "Describe this command"
+                :history (or history extended-command-history)
+                :reverse-history helm-M-x-reverse-history
+                :input-history 'helm-M-x-input-history
+                :del-input nil
+                :help-message 'helm-M-x-help-message
+                :must-match t
+                :fuzzy helm-M-x-fuzzy-match
+                :nomark t
+                :candidates-in-buffer t
+                :fc-transformer 'helm-M-x-transformer
+                :hist-fc-transformer 'helm-M-x-transformer-hist))
+          (cancel-timer tm)
+          (setq helm--mode-line-display-prefarg nil)))))
+
+;;;###autoload
+(defun helm-M-x (arg &optional command-name)
+  "Preconfigured `helm' for Emacs commands.
+It is `helm' replacement of regular `M-x' `execute-extended-command'.
+
+Unlike regular `M-x' emacs vanilla `execute-extended-command' command,
+the prefix args if needed, are passed AFTER starting `helm-M-x'.
+
+You can get help on each command by persistent action."
+  (interactive (list current-prefix-arg (helm-M-x-read-extended-command)))
+  (let ((sym-com (and (stringp command-name) (intern-soft command-name))))
+    ;; Avoid having `this-command' set to *exit-minibuffer.
+    (setq this-command sym-com
+          ;; Handle C-x z (repeat) Issue #322
+          real-this-command sym-com)
+    ;; If helm-M-x is called with regular emacs completion (kmacro)
+    ;; use the value of arg otherwise use helm-current-prefix-arg.
+    (let ((prefix-arg (or helm-current-prefix-arg arg)))
+      ;; This ugly construct is to save history even on error.
+      (unless helm-M-x-always-save-history
+        (command-execute sym-com 'record))
+      (setq extended-command-history
+            (cons command-name
+                  (delete command-name extended-command-history)))
+      (when helm-M-x-always-save-history
+        (command-execute sym-com 'record)))))
+
+
+(provide 'helm-command)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-command.el ends here
diff --git a/elpa/helm-20160217.958/helm-config.el b/elpa/helm-20160217.958/helm-config.el
new file mode 100644 (file)
index 0000000..219a689
--- /dev/null
@@ -0,0 +1,169 @@
+;;; helm-config.el --- Applications library for `helm.el' -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+\f
+;;; Require
+;;
+;;
+(declare-function async-bytecomp-package-mode "ext:async-bytecomp.el")
+(when (require 'async-bytecomp nil t)
+  (and (fboundp 'async-bytecomp-package-mode)
+       (async-bytecomp-package-mode 1)))
+
+\f
+(defgroup helm-config nil
+  "Various configurations for Helm."
+  :group 'helm)
+
+(defcustom helm-command-prefix-key "C-x c"
+  "The key `helm-command-prefix' is bound to in the global map."
+  :type '(choice (string :tag "Key") (const :tag "no binding"))
+  :group 'helm-config
+  :set
+  (lambda (var key)
+    (when (and (boundp var) (symbol-value var))
+      (define-key (current-global-map)
+          (read-kbd-macro (symbol-value var)) nil))
+    (when key
+      (define-key (current-global-map)
+          (read-kbd-macro key) 'helm-command-prefix))
+    (set var key)))
+
+(defcustom helm-minibuffer-history-key "C-r"
+  "The key `helm-minibuffer-history' is bound to in minibuffer local maps."
+  :type '(choice (string :tag "Key") (const :tag "no binding"))
+  :group 'helm-config
+  :set
+  (lambda (var key)
+    (cl-dolist (map '(minibuffer-local-completion-map
+                      minibuffer-local-filename-completion-map
+                      minibuffer-local-filename-must-match-map ; Emacs 23.1.+
+                      minibuffer-local-isearch-map
+                      minibuffer-local-map
+                      minibuffer-local-must-match-filename-map ; Older Emacsen
+                      minibuffer-local-must-match-map
+                      minibuffer-local-ns-map))
+      (when (and (boundp map) (keymapp (symbol-value map)))
+        (when (and (boundp var) (symbol-value var))
+          (define-key (symbol-value map)
+              (read-kbd-macro (symbol-value var)) nil))
+        (when key
+          (define-key (symbol-value map)
+              (read-kbd-macro key) 'helm-minibuffer-history))))
+    (set var key)))
+\f
+;;; Command Keymap
+;;
+;;
+(defvar helm-command-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "a")         'helm-apropos)
+    (define-key map (kbd "e")         'helm-etags-select)
+    (define-key map (kbd "l")         'helm-locate)
+    (define-key map (kbd "s")         'helm-surfraw)
+    (define-key map (kbd "r")         'helm-regexp)
+    (define-key map (kbd "m")         'helm-man-woman)
+    (define-key map (kbd "t")         'helm-top)
+    (define-key map (kbd "/")         'helm-find)
+    (define-key map (kbd "i")         'helm-semantic-or-imenu)
+    (define-key map (kbd "I")         'helm-imenu-in-all-buffers)
+    (define-key map (kbd "<tab>")     'helm-lisp-completion-at-point)
+    (define-key map (kbd "p")         'helm-list-emacs-process)
+    (define-key map (kbd "C-x r b")   'helm-filtered-bookmarks)
+    (define-key map (kbd "M-y")       'helm-show-kill-ring)
+    (define-key map (kbd "C-c <SPC>") 'helm-all-mark-rings)
+    (define-key map (kbd "C-x C-f")   'helm-find-files)
+    (define-key map (kbd "f")         'helm-multi-files)
+    (define-key map (kbd "C-:")       'helm-eval-expression-with-eldoc)
+    (define-key map (kbd "C-,")       'helm-calcul-expression)
+    (define-key map (kbd "M-x")       'helm-M-x)
+    (define-key map (kbd "M-s o")     'helm-occur)
+    (define-key map (kbd "M-g a")     'helm-do-grep-ag)
+    (define-key map (kbd "c")         'helm-colors)
+    (define-key map (kbd "F")         'helm-select-xfont)
+    (define-key map (kbd "8")         'helm-ucs)
+    (define-key map (kbd "C-c f")     'helm-recentf)
+    (define-key map (kbd "C-c g")     'helm-google-suggest)
+    (define-key map (kbd "h i")       'helm-info-at-point)
+    (define-key map (kbd "h r")       'helm-info-emacs)
+    (define-key map (kbd "h g")       'helm-info-gnus)
+    (define-key map (kbd "h h")       'helm-documentation)
+    (define-key map (kbd "C-x C-b")   'helm-buffers-list)
+    (define-key map (kbd "C-x r i")   'helm-register)
+    (define-key map (kbd "C-c C-x")   'helm-run-external-command)
+    (define-key map (kbd "b")         'helm-resume)
+    (define-key map (kbd "M-g i")     'helm-gid)
+    (define-key map (kbd "@")         'helm-list-elisp-packages)
+    map))
+
+;; Don't override the keymap we just defined with an empty
+;; keymap.  This also protect bindings changed by the user.
+(defvar helm-command-prefix)
+(define-prefix-command 'helm-command-prefix)
+(fset 'helm-command-prefix helm-command-map)
+(setq  helm-command-prefix helm-command-map)
+
+\f
+;;; Menu
+
+(require 'helm-easymenu)
+
+\f
+;;;###autoload
+(defun helm-configuration ()
+  "Customize `helm'."
+  (interactive)
+  (customize-group "helm"))
+
+\f
+;;; Fontlock
+(cl-dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
+  (font-lock-add-keywords
+   mode
+   '(("(\\<\\(with-helm-after-update-hook\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-temp-hook\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-window\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-quittable\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-current-buffer\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-buffer\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-show-completion\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-default-directory\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-display-same-window\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(with-helm-restore-variables\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(define-helm-type-attribute\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(helm-multi-key-defun\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(helm-while-no-input\\)\\>" 1 font-lock-keyword-face)
+     ("(\\<\\(helm-aif\\)\\>" 1 font-lock-keyword-face))))
+
+\f
+;;; Load the autoload file
+;;  It should have been generated either by
+;;  package.el or the make file.
+
+(load "helm-autoloads" nil t)
+
+(provide 'helm-config)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-config.el ends here
diff --git a/elpa/helm-20160217.958/helm-dabbrev.el b/elpa/helm-20160217.958/helm-dabbrev.el
new file mode 100644 (file)
index 0000000..7e768d9
--- /dev/null
@@ -0,0 +1,356 @@
+;;; helm-dabbrev.el --- Helm implementation of dabbrev. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'helm)
+(require 'helm-help)
+(require 'helm-elisp) ; For show-completion.
+\f
+(defgroup helm-dabbrev nil
+  "Dabbrev related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-dabbrev-always-search-all t
+  "Always search in all buffers when non--nil.
+Note that even if nil, a search in all buffers
+will occur if the length of candidates is <= than
+`helm-dabbrev-max-length-result'."
+  :group 'helm-dabbrev
+  :type 'boolean)
+
+(defcustom helm-dabbrev-max-length-result 20
+  "Max length of candidates before searching in all buffers.
+If number of candidates found in current-buffer is <= to this,
+search in all buffers.
+Have no effect when `helm-dabbrev-always-search-all' is non--nil."
+  :group 'helm-dabbrev
+  :type 'integer)
+
+(defcustom helm-dabbrev-ignored-buffers-regexps
+  '("\\*helm" "\\*Messages" "\\*Echo Area" "\\*Buffer List")
+  "List of regexps matching names of buffers that helm-dabbrev should not check."
+  :group 'helm-dabbrev
+  :type '(repeat regexp))
+
+(defcustom helm-dabbrev-related-buffer-fn #'helm-dabbrev--same-major-mode-p
+  "A function that decide if a buffer to search in is related to `current-buffer'.
+This is actually determined by comparing `major-mode' of the buffer to search
+and the `current-buffer'.
+The function take one arg, the buffer which is current, look at
+`helm-dabbrev--same-major-mode-p' for example.
+
+When nil all buffers are considered related to `current-buffer'."
+  :group 'helm-dabbrev
+  :type 'function)
+
+(defcustom helm-dabbrev-major-mode-assoc
+  '((emacs-lisp-mode . lisp-interaction-mode))
+  "Major mode association alist.
+This allow helm-dabbrev searching in buffers with the associated `major-mode'.
+e.g \(emacs-lisp-mode . lisp-interaction-mode\)
+will allow searching in the lisp-interaction-mode buffer when `current-buffer'
+is an `emacs-lisp-mode' buffer and vice versa i.e
+no need to provide \(lisp-interaction-mode . emacs-lisp-mode\) association.
+
+When nil check is the searched buffer have same `major-mode'
+than the `current-buffer'.
+This have no effect when `helm-dabbrev-related-buffer-fn' is nil or of course
+bound to a function that doesn't handle this var."
+  :type '(alist :key-type symbol :value-type symbol)
+  :group 'helm-dabbrev)
+
+(defcustom helm-dabbrev-lineno-around 30
+  "Search first in this number of lines before an after point."
+  :group 'helm-dabbrev
+  :type 'integer)
+
+(defcustom helm-dabbrev-cycle-threshold nil
+  "Number of time helm-dabbrev cycle before displaying helm completion.
+When nil or 0 disable cycling."
+  :group 'helm-dabbrev
+  :type '(choice (const :tag "Cycling disabled" nil) integer))
+
+(defcustom helm-dabbrev-case-fold-search 'smart
+  "Set `case-fold-search' in `helm-dabbrev'.
+Same as `helm-case-fold-search' but for `helm-dabbrev'.
+Note that this is not affecting searching in helm buffer,
+but the initial search for all candidates in buffer(s)."
+  :group 'helm-dabbrev
+  :type '(choice (const :tag "Ignore case" t)
+          (const :tag "Respect case" nil)
+          (other :tag "Smart" 'smart)))
+
+\f
+(defvar helm-dabbrev-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-/") 'helm-next-line)
+    (define-key map (kbd "M-:") 'helm-previous-line)
+    map))
+
+;; Internal
+(defvar helm-dabbrev--exclude-current-buffer-flag nil)
+(defvar helm-dabbrev--cache nil)
+(defvar helm-dabbrev--data nil)
+(defvar helm-dabbrev--regexp "\\s-\\|\t\\|[(\[\{\"'`=<$;.]\\|\\s\\\\|^")
+(cl-defstruct helm-dabbrev-info dabbrev limits iterator)
+
+\f
+(defun helm-dabbrev--buffer-list ()
+  (cl-loop with lst = (buffer-list)
+        for buf in (if helm-dabbrev--exclude-current-buffer-flag
+                       (cdr lst) lst)
+        unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps
+                     thereis (string-match r (buffer-name buf)))
+        collect buf))
+
+(defun helm-dabbrev--same-major-mode-p (start-buffer)
+  ;; START-BUFFER is the current-buffer where we start searching.
+  ;; Determine the major-mode of START-BUFFER as `cur-maj-mode'.
+  ;; Each time the loop go in another buffer we try to find if its
+  ;; `major-mode' is:
+  ;; - same as the `cur-maj-mode'
+  ;; - derived from `cur-maj-mode'
+  ;; - have an assoc entry (major-mode . cur-maj-mode)
+  ;; - have an rassoc entry (cur-maj-mode . major-mode)
+  ;; - check if one of these entries inherit from another one in
+  ;;   `helm-dabbrev-major-mode-assoc'.
+  (let* ((cur-maj-mode  (with-current-buffer start-buffer major-mode))
+         (c-assoc-mode  (assq cur-maj-mode helm-dabbrev-major-mode-assoc))
+         (c-rassoc-mode (rassq cur-maj-mode helm-dabbrev-major-mode-assoc))
+         (o-assoc-mode  (assq major-mode helm-dabbrev-major-mode-assoc))
+         (o-rassoc-mode (rassq major-mode helm-dabbrev-major-mode-assoc))
+         (cdr-c-assoc-mode (cdr c-assoc-mode))
+         (cdr-o-assoc-mode (cdr o-assoc-mode)))
+    (or (eq major-mode cur-maj-mode)
+        (derived-mode-p cur-maj-mode)
+        (or (eq cdr-c-assoc-mode major-mode)
+            (eq (car c-rassoc-mode) major-mode)
+            (eq (cdr (assq cdr-c-assoc-mode helm-dabbrev-major-mode-assoc))
+                major-mode)
+            (eq (car (rassq cdr-c-assoc-mode helm-dabbrev-major-mode-assoc))
+                major-mode))
+        (or (eq cdr-o-assoc-mode cur-maj-mode)
+            (eq (car o-rassoc-mode) cur-maj-mode)
+            (eq (cdr (assq cdr-o-assoc-mode helm-dabbrev-major-mode-assoc))
+                cur-maj-mode)
+            (eq (car (rassq cdr-o-assoc-mode helm-dabbrev-major-mode-assoc))
+                cur-maj-mode)))))
+
+(defun helm-dabbrev--collect (str limit ignore-case all)
+  (let* ((case-fold-search ignore-case)
+         (buffer1 (current-buffer)) ; start buffer.
+         (minibuf (minibufferp buffer1))
+         result pos-before pos-after
+         (search-and-store
+          (lambda (pattern direction)
+              (while (cl-case direction
+                       (1   (search-forward pattern nil t))
+                       (-1  (search-backward pattern nil t))
+                       (2   (let ((pos
+                                   (save-excursion
+                                     (forward-line
+                                      helm-dabbrev-lineno-around)
+                                     (point))))
+                              (setq pos-after pos)
+                              (search-forward pattern pos t)))
+                       (-2  (let ((pos
+                                   (save-excursion
+                                     (forward-line
+                                      (- helm-dabbrev-lineno-around))
+                                     (point))))
+                              (setq pos-before pos)
+                              (search-backward pattern pos t))))
+                (let* ((replace-regexp (concat "\\(" helm-dabbrev--regexp "\\)\\'"))
+                       (match-1 (helm-aif (thing-at-point 'symbol)
+                                    ;; `thing-at-point' returns
+                                    ;; the quote outside of e-lisp mode,
+                                    ;; e.g in message mode,
+                                    ;; `foo' => foo'
+                                    ;; but in e-lisp like modes:
+                                    ;; `foo' => foo
+                                    ;; so remove it [1].
+                                    (replace-regexp-in-string
+                                     replace-regexp
+                                     "" (substring-no-properties it))))
+                       (match-2 (helm-aif (thing-at-point 'filename)
+                                    ;; Same as in [1].
+                                    (replace-regexp-in-string
+                                     replace-regexp
+                                     "" (substring-no-properties it))))
+                       (lst (if (string= match-1 match-2)
+                                (list match-1)
+                              (list match-1 match-2))))
+                  (cl-loop for match in lst
+                        unless (or (string= str match)
+                                   (member match result))
+                        do (push match result)))))))
+    (cl-loop for buf in (if all (helm-dabbrev--buffer-list)
+                          (list (current-buffer)))
+          
+          do (with-current-buffer buf
+               (when (or minibuf ; check against all buffers when in minibuffer.
+                         (if helm-dabbrev-related-buffer-fn
+                             (funcall helm-dabbrev-related-buffer-fn buffer1)
+                             t))
+                 (save-excursion
+                   ;; Start searching before thing before point.
+                   (goto-char (- (point) (length str)))
+                   ;; Search the last 30 lines before point.
+                   (funcall search-and-store str -2)) ; store pos [1]
+                 (save-excursion
+                   ;; Search the next 30 lines after point.
+                   (funcall search-and-store str 2)) ; store pos [2]
+                 (save-excursion
+                   ;; Search all before point.
+                   (goto-char pos-before) ; start from [1]
+                   (funcall search-and-store str -1))
+                 (save-excursion
+                   ;; Search all after point.
+                   (goto-char pos-after) ; start from [2]
+                   (funcall search-and-store str 1))))
+          when (> (length result) limit) return (nreverse result)
+          finally return (nreverse result))))
+
+(defun helm-dabbrev--get-candidates (abbrev)
+  (cl-assert abbrev nil "[No Match]")
+  (with-current-buffer (current-buffer)
+    (let* ((dabbrev-get (lambda (str all-bufs)
+                            (helm-dabbrev--collect
+                             str helm-candidate-number-limit
+                             (cl-case helm-dabbrev-case-fold-search
+                               (smart (helm-set-case-fold-search-1 abbrev))
+                               (t helm-dabbrev-case-fold-search))
+                             all-bufs)))
+           (lst (funcall dabbrev-get abbrev helm-dabbrev-always-search-all)))
+      (if (and (not helm-dabbrev-always-search-all)
+               (<= (length lst) helm-dabbrev-max-length-result))
+          ;; Search all but don't recompute current-buffer.
+          (let ((helm-dabbrev--exclude-current-buffer-flag t))
+            (append lst (funcall dabbrev-get abbrev 'all-bufs)))
+        lst))))
+\f
+(defun helm-dabbrev-default-action (candidate)
+  (with-helm-current-buffer
+    (let* ((limits (helm-bounds-of-thing-before-point
+                    helm-dabbrev--regexp))
+           (beg (car limits))
+           (end (point)))
+      (run-with-timer
+       0.01 nil
+       'helm-insert-completion-at-point
+       beg end candidate))))
+
+;;;###autoload
+(defun helm-dabbrev ()
+  "Preconfigured helm for dynamic abbreviations."
+  (interactive)
+  (let ((dabbrev (helm-thing-before-point nil helm-dabbrev--regexp))
+        (limits (helm-bounds-of-thing-before-point helm-dabbrev--regexp))
+        (enable-recursive-minibuffers t)
+        (cycling-disabled-p (or (null helm-dabbrev-cycle-threshold)
+                                (zerop helm-dabbrev-cycle-threshold)))
+        (helm-execute-action-at-once-if-one t)
+        (helm-quit-if-no-candidate
+         (lambda ()
+             (message "[Helm-dabbrev: No expansion found]"))))
+    (cl-assert (and (stringp dabbrev) (not (string= dabbrev "")))
+               nil "[Helm-dabbrev: Nothing found before point]")
+    (when (and
+           ;; have been called at least once.
+           (helm-dabbrev-info-p helm-dabbrev--data)
+           ;; But user have moved with some other command
+           ;; in the meaning time.
+           (not (eq last-command 'helm-dabbrev)))
+      (setq helm-dabbrev--data nil))
+    (when cycling-disabled-p
+      (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev)))
+    (unless (or cycling-disabled-p
+                (helm-dabbrev-info-p helm-dabbrev--data))
+      (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev))
+      (setq helm-dabbrev--data
+            (make-helm-dabbrev-info
+             :dabbrev dabbrev
+             :limits limits
+             :iterator
+             (helm-iter-list
+              (cl-loop for i in helm-dabbrev--cache when
+                       (and i (string-match
+                               (concat "^" (regexp-quote dabbrev)) i))
+                       collect i into selection
+                       when (and selection
+                                 (= (length selection)
+                                    helm-dabbrev-cycle-threshold))
+                       ;; When selection len reach
+                       ;; `helm-dabbrev-cycle-threshold'
+                       ;; return selection.
+                       return selection
+                       ;; selection len never reach
+                       ;; `helm-dabbrev-cycle-threshold'
+                       ;; return selection.
+                       finally return selection)))))
+    (let ((iter (and (helm-dabbrev-info-p helm-dabbrev--data)
+                     (helm-dabbrev-info-iterator helm-dabbrev--data)))
+          deactivate-mark)
+      ;; Cycle until iterator is consumed.
+      (helm-aif (and iter (helm-iter-next iter))
+          (progn
+            (helm-insert-completion-at-point
+             (car (helm-dabbrev-info-limits helm-dabbrev--data))
+             (cdr limits) it)
+            ;; Move already tried candidates to end of list.
+            (setq helm-dabbrev--cache (append (remove it helm-dabbrev--cache)
+                                              (list it))))
+        ;; If the length of candidates is only one when computed
+        ;; that's mean the unique matched item have already been
+        ;; inserted by the iterator, so no need to reinsert the old dabbrev,
+        ;; just let helm exiting with "No expansion found".
+        (let ((old-dabbrev (if (helm-dabbrev-info-p helm-dabbrev--data)
+                               (helm-dabbrev-info-dabbrev helm-dabbrev--data)
+                               dabbrev)))
+          (unless (cdr (all-completions old-dabbrev helm-dabbrev--cache))
+            (setq cycling-disabled-p t))
+          ;; Iterator is now empty, reset dabbrev to initial value
+          ;; and start helm completion.
+          (unless cycling-disabled-p
+            (setq dabbrev old-dabbrev
+                  limits  (helm-dabbrev-info-limits helm-dabbrev--data))
+            (setq helm-dabbrev--data nil)
+            (delete-region (car limits) (point))
+            (insert dabbrev))
+          (with-helm-show-completion (car limits) (cdr limits)
+            (helm :sources (helm-build-in-buffer-source "Dabbrev Expand"
+                             :data helm-dabbrev--cache
+                             :persistent-action 'ignore
+                             :persistent-help "DoNothing"
+                             :keymap helm-dabbrev-map
+                             :action 'helm-dabbrev-default-action)
+                  :buffer "*helm dabbrev*"
+                  :input (concat "^" dabbrev " ")
+                  :resume 'noresume
+                  :allow-nest t)))))))
+
+(provide 'helm-dabbrev)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-dabbrev.el ends here
diff --git a/elpa/helm-20160217.958/helm-easymenu.el b/elpa/helm-20160217.958/helm-easymenu.el
new file mode 100644 (file)
index 0000000..498ea76
--- /dev/null
@@ -0,0 +1,90 @@
+;;; helm-easymenu.el --- Helm easymenu definitions. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'easymenu)
+
+(easy-menu-add-item
+ nil '("Tools")
+ '("Helm"
+   ["Find any Files/Buffers" helm-multi-files t]
+   ["Helm Everywhere (Toggle)" helm-mode t]
+   ["Helm resume" helm-resume t]
+   "----"
+   ("Files"
+    ["Find files" helm-find-files t]
+    ["Recent Files" helm-recentf t]
+    ["Locate" helm-locate t]
+    ["Search Files with find" helm-find t]
+    ["Bookmarks" helm-filtered-bookmarks t])
+   ("Buffers"
+    ["Find buffers" helm-buffers-list t])
+   ("Commands"
+    ["Emacs Commands" helm-M-x t]
+    ["Externals Commands" helm-run-external-command t])
+   ("Help"
+    ["Helm Apropos" helm-apropos t])
+   ("Info"
+    ["Info at point" helm-info-at-point t]
+    ["Emacs Manual index" helm-info-emacs t]
+    ["Gnus Manual index" helm-info-gnus t]
+    ["Helm documentation" helm-documentation t])
+   ("Org"
+    ["Org headlines in org agenda files" helm-org-agenda-files-headings t]
+    ["Org headlines in buffer" helm-org-in-buffer-headings t])
+   ("Elpa"
+    ["Elisp packages" helm-list-elisp-packages t]
+    ["Elisp packages no fetch" helm-list-elisp-packages-no-fetch t])
+   ("Tools"
+    ["Occur" helm-occur t]
+    ["Grep current directory with AG" helm-do-grep-ag t]
+    ["Gid"  helm-gid t]
+    ["Etags" helm-etags-select t]
+    ["Lisp complete at point" helm-lisp-completion-at-point t]
+    ["Browse Kill ring" helm-show-kill-ring t]
+    ["Browse register" helm-register t]
+    ["Mark Ring" helm-all-mark-rings t]
+    ["Regexp handler" helm-regexp t]
+    ["Colors & Faces" helm-colors t]
+    ["Show xfonts" helm-select-xfont t]
+    ["Ucs Symbols" helm-ucs t]
+    ["Imenu" helm-imenu t]
+    ["Imenu all" helm-imenu-in-all-buffers t]
+    ["Semantic or Imenu" helm-semantic-or-imenu t]
+    ["Google Suggest" helm-google-suggest t]
+    ["Eval expression" helm-eval-expression-with-eldoc t]
+    ["Calcul expression" helm-calcul-expression t]
+    ["Man pages" helm-man-woman t]
+    ["Top externals process" helm-top t]
+    ["Emacs internals process" helm-list-emacs-process t])
+   "----"
+   ["Preferred Options" helm-configuration t])
+ "Spell Checking")
+
+(easy-menu-add-item nil '("Tools") '("----") "Spell Checking")
+
+
+(provide 'helm-easymenu)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-easymenu.el ends here
diff --git a/elpa/helm-20160217.958/helm-elisp-package.el b/elpa/helm-20160217.958/helm-elisp-package.el
new file mode 100644 (file)
index 0000000..abbb545
--- /dev/null
@@ -0,0 +1,390 @@
+;;; helm-elisp-package.el --- helm interface for package.el -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'package)
+
+(defgroup helm-el-package nil
+  "helm elisp packages."
+  :group 'helm)
+
+(defcustom helm-el-package-initial-filter 'all
+  "Show only installed, upgraded or all packages at startup."
+  :group 'helm-el-package
+  :type '(radio :tag "Initial filter for elisp packages"
+          (const :tag "Show all packages" all)
+          (const :tag "Show installed packages" installed)
+          (const :tag "Show not installed packages" uninstalled)
+          (const :tag "Show upgradable packages" upgrade)))
+
+;; internals vars
+(defvar helm-el-package--show-only 'all)
+(defvar helm-el-package--initialized-p nil)
+(defvar helm-el-package--tabulated-list nil)
+(defvar helm-el-package--upgrades nil)
+(defvar helm-el-package--removable-packages nil)
+
+(defun helm-el-package--init ()
+  (when (null package-alist)
+    (setq helm-el-package--show-only 'all))
+  (when (fboundp 'package--removable-packages)
+    (setq helm-el-package--removable-packages
+          (package--removable-packages)))
+  (save-selected-window
+    (list-packages helm-el-package--initialized-p)
+    (setq helm-el-package--initialized-p t)
+    (message nil))
+  (helm-init-candidates-in-buffer
+      'global
+    (with-current-buffer (get-buffer "*Packages*")
+      (setq helm-el-package--tabulated-list tabulated-list-entries)
+      (buffer-string)))
+  (setq helm-el-package--upgrades (helm-el-package-menu--find-upgrades))
+  (if helm-force-updating-p
+      (if helm-el-package--upgrades
+          (message "%d package(s) can be upgraded, Refreshing packages list done"
+                   (length helm-el-package--upgrades))
+          (message "Refreshing packages list done, no upgrades available"))
+      (setq helm-el-package--show-only (if helm-el-package--upgrades
+                                           'upgrade
+                                           helm-el-package-initial-filter)))
+  (kill-buffer "*Packages*"))
+
+(defun helm-el-package-describe (candidate)
+  (let ((id (get-text-property 0 'tabulated-list-id candidate)))
+    (describe-package (if (fboundp 'package-desc-name)
+                          (package-desc-name id)
+                        (car id)))))
+
+(defun helm-el-package-visit-homepage (candidate)
+  (let* ((id (get-text-property 0 'tabulated-list-id candidate))
+         (pkg (if (fboundp 'package-desc-name) (package-desc-name id)
+                (car id)))
+         (desc (cadr (assoc pkg package-archive-contents)))
+         (extras (package-desc-extras desc))
+         (url (and (listp extras) (cdr-safe (assoc :url extras)))))
+    (if (stringp url)
+        (browse-url url)
+      (message "Package %s has no homepage"
+               (propertize (symbol-name pkg)
+                           'face 'font-lock-keyword-face)))))
+
+(defun helm-el-run-visit-homepage ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-el-package-visit-homepage)))
+(put 'helm-el-run-visit-homepage 'helm-only t)
+
+(defun helm-el-package-install-1 (pkg-list)
+  (cl-loop with mkd = pkg-list
+        for p in mkd
+        for id = (get-text-property 0 'tabulated-list-id p)
+        do (package-install
+            (if (fboundp 'package-desc-name)
+                (package-desc-name id)
+              (car id)))
+        collect (if (fboundp 'package-desc-full-name)
+                        id
+                      (car id))
+        into installed-list
+        finally do (progn
+                     (when (boundp 'package-selected-packages)
+                       (customize-save-variable
+                        'package-selected-packages
+                        (append (mapcar 'package-desc-name installed-list)
+                                package-selected-packages)))
+                     (if (fboundp 'package-desc-full-name)
+                         (message (format "%d packages installed:\n(%s)"
+                                          (length installed-list)
+                                          (mapconcat #'package-desc-full-name
+                                                     installed-list ", ")))
+                         (message (format "%d packages installed:\n(%s)"
+                                          (length installed-list)
+                                          (mapconcat 'symbol-name installed-list ", ")))))))
+
+(defun helm-el-package-install (_candidate)
+  (helm-el-package-install-1 (helm-marked-candidates)))
+
+(defun helm-el-run-package-install ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-el-package-install)))
+(put 'helm-el-run-package-install 'helm-only t)
+
+(defun helm-el-package-uninstall-1 (pkg-list)
+  (cl-loop with mkd = pkg-list
+        for p in mkd
+        for id = (get-text-property 0 'tabulated-list-id p)
+        do
+        (condition-case-unless-debug err
+            (with-no-warnings
+              (if (fboundp 'package-desc-full-name)
+                  ;; emacs 24.4
+                  (package-delete id)
+                ;; emacs 24.3
+                (package-delete (symbol-name (car id))
+                                (package-version-join (cdr id)))))
+          (error (message (cadr err))))
+        unless (assoc (elt id 1) package-alist)
+        collect (if (fboundp 'package-desc-full-name)
+                        id
+                      (cons (symbol-name (car id))
+                            (package-version-join (cdr id))))
+        into delete-list
+        finally do (if delete-list
+                       (if (fboundp 'package-desc-full-name)
+                           ;; emacs 24.4
+                           (message (format "%d packages deleted:\n(%s)"
+                                            (length delete-list)
+                                            (mapconcat #'package-desc-full-name
+                                                       delete-list ", ")))
+                           ;; emacs 24.3
+                           (message (format "%d packages deleted:\n(%s)"
+                                            (length delete-list)
+                                            (mapconcat (lambda (x)
+                                                         (concat (car x) "-" (cdr x)))
+                                                       delete-list ", ")))
+                           ;; emacs 24.3 doesn't update
+                           ;; its `package-alist' after deleting.
+                           (cl-loop for p in package-alist
+                                    when (assq (symbol-name (car p)) delete-list)
+                                    do (setq package-alist (delete p package-alist))))
+                       "No package deleted")))
+
+(defun helm-el-package-uninstall (_candidate)
+  (helm-el-package-uninstall-1 (helm-marked-candidates)))
+
+(defun helm-el-run-package-uninstall ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-el-package-uninstall)))
+(put 'helm-el-run-package-uninstall 'helm-only t)
+
+(defun helm-el-package-menu--find-upgrades ()
+  (cl-loop for entry in helm-el-package--tabulated-list
+           for pkg-desc = (car entry)
+           for status = (package-desc-status pkg-desc)
+           when (member status '("installed" "unsigned" "dependency"))
+           collect pkg-desc
+           into installed
+           when (member status '("available" "new"))
+           collect (cons (package-desc-name pkg-desc) pkg-desc)
+           into available
+           finally return
+           (cl-loop for pkg in installed
+                    for avail-pkg = (assq (package-desc-name pkg) available)
+                    when (and avail-pkg
+                              (version-list-< (package-desc-version pkg)
+                                              (package-desc-version
+                                               (cdr avail-pkg))))
+                    collect avail-pkg)))
+
+(defun helm-el-package-upgrade-1 (pkg-list)
+  (cl-loop for p in pkg-list
+           for pkg-desc = (car p)
+           for upgrade = (cdr (assq (package-desc-name pkg-desc)
+                                    helm-el-package--upgrades))
+           do
+           (cond ((null upgrade)
+                  (ignore))
+                 ((equal pkg-desc upgrade)
+                  ;;Install.
+                  (package-install pkg-desc))
+                 (t
+                  ;; Delete.
+                  (if (boundp 'package-selected-packages)
+                      (with-no-warnings
+                        (package-delete pkg-desc t t))
+                      (package-delete pkg-desc))))))
+
+(defun helm-el-package-upgrade (_candidate)
+  (helm-el-package-upgrade-1
+   (cl-loop with pkgs = (helm-marked-candidates)
+            for p in helm-el-package--tabulated-list
+            for pkg = (car p)
+            if (member (symbol-name (package-desc-name pkg)) pkgs)
+            collect p)))
+
+(defun helm-el-run-package-upgrade ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-el-package-upgrade)))
+(put 'helm-el-run-package-upgrade 'helm-only t)
+
+(defun helm-el-package-upgrade-all ()
+  (if helm-el-package--upgrades
+      (with-helm-display-marked-candidates
+        helm-marked-buffer-name (mapcar (lambda (x) (symbol-name (car x)))
+                                        helm-el-package--upgrades)
+        (when (y-or-n-p "Upgrade all packages? ")
+          (helm-el-package-upgrade-1 helm-el-package--tabulated-list)))
+      (message "No packages to upgrade actually!")))
+
+(defun helm-el-package-upgrade-all-action (_candidate)
+  (helm-el-package-upgrade-all))
+
+(defun helm-el-run-package-upgrade-all ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-el-package-upgrade-all-action)))
+(put 'helm-el-run-package-upgrade-all 'helm-only t)
+
+(defun helm-el-package--transformer (candidates _source)
+  (cl-loop for c in candidates
+           for id = (get-text-property 0 'tabulated-list-id c)
+           for name = (if (fboundp 'package-desc-name)
+                          (package-desc-name id)
+                          (car id))
+           for installed-p = (assq name package-alist)
+           for upgrade-p = (assq name helm-el-package--upgrades)
+           for user-installed-p = (and (boundp 'package-selected-packages)
+                                       (memq name package-selected-packages))
+           do (when user-installed-p (put-text-property 0 2 'display "S " c))
+           do (when (memq name helm-el-package--removable-packages)
+                (put-text-property 0 2 'display "U " c)
+                (put-text-property
+                 2 (+ (length (symbol-name name)) 2)
+                 'face 'font-lock-variable-name-face c))
+           for cand = (cons c (car (split-string c)))
+           when (or (and upgrade-p
+                         (eq helm-el-package--show-only 'upgrade))
+                    (and installed-p
+                         (eq helm-el-package--show-only 'installed))
+                    (and (not installed-p)
+                         (eq helm-el-package--show-only 'uninstalled)) 
+                    (eq helm-el-package--show-only 'all))
+           collect cand))
+
+(defun helm-el-package-show-upgrade ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-el-package--show-only 'upgrade)
+    (helm-update)))
+(put 'helm-el-package-show-upgrade 'helm-only t)
+
+(defun helm-el-package-show-installed ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-el-package--show-only 'installed)
+    (helm-update)))
+(put 'helm-el-package-show-installed 'helm-only t)
+
+(defun helm-el-package-show-all ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-el-package--show-only 'all)
+    (helm-update)))
+(put 'helm-el-package-show-all 'helm-only t)
+
+(defun helm-el-package-show-uninstalled ()
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-el-package--show-only 'uninstalled)
+    (helm-update)))
+(put 'helm-el-package-show-uninstalled 'helm-only t)
+
+(defvar helm-el-package-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-I")   'helm-el-package-show-installed)
+    (define-key map (kbd "M-O")   'helm-el-package-show-uninstalled)
+    (define-key map (kbd "M-U")   'helm-el-package-show-upgrade)
+    (define-key map (kbd "M-A")   'helm-el-package-show-all)
+    (define-key map (kbd "C-c i") 'helm-el-run-package-install)
+    (define-key map (kbd "C-c r") 'helm-el-run-package-reinstall)
+    (define-key map (kbd "C-c d") 'helm-el-run-package-uninstall)
+    (define-key map (kbd "C-c u") 'helm-el-run-package-upgrade)
+    (define-key map (kbd "C-c U") 'helm-el-run-package-upgrade-all)
+    (define-key map (kbd "C-c @") 'helm-el-run-visit-homepage)
+    map))
+
+(defvar helm-source-list-el-package nil)
+(defclass helm-list-el-package-source (helm-source-in-buffer)
+  ((init :initform 'helm-el-package--init)
+   (get-line :initform 'buffer-substring)
+   (filtered-candidate-transformer :initform 'helm-el-package--transformer)
+   (action-transformer
+    :initform
+    (lambda (actions candidate)
+      (let ((pkg-desc (get-text-property
+                       0 'tabulated-list-id candidate))
+            (acts (if helm-el-package--upgrades
+                      (append actions '(("Upgrade all packages"
+                                         . helm-el-package-upgrade-all-action)))
+                      actions)))
+        (cond ((and (package-installed-p (package-desc-name pkg-desc))
+                    (cdr (assq (package-desc-name pkg-desc)
+                          helm-el-package--upgrades)))
+               (append '(("Upgrade package(s)" . helm-el-package-upgrade)
+                         ("Uninstall package(s)" . helm-el-package-uninstall)) acts))
+              ((cdr (assq (package-desc-name pkg-desc)
+                          helm-el-package--upgrades))
+               (append '(("Upgrade package(s)" . helm-el-package-upgrade)) acts))
+              ((package-installed-p (package-desc-name pkg-desc))
+               (append acts '(("Reinstall package(s)" . helm-el-package-reinstall)
+                              ("Uninstall package(s)" . helm-el-package-uninstall))))
+              (t (append acts '(("Install packages(s)" . helm-el-package-install))))))))
+   (help-message :initform 'helm-el-package-help-message)
+   (keymap :initform helm-el-package-map)
+   (update :initform 'helm-el-package--update)
+   (candidate-number-limit :initform 9999)
+   (action :initform '(("Describe package" . helm-el-package-describe)
+                       ("Visit homepage" . helm-el-package-visit-homepage)))))
+
+(defun helm-el-package--update ()
+  (setq helm-el-package--initialized-p nil))
+
+(defun helm-el-package-reinstall (_pkg)
+  (cl-loop for p in (helm-marked-candidates)
+           for pkg-desc = (get-text-property 0 'tabulated-list-id p)
+           for name = (package-desc-name pkg-desc)
+           do (if (fboundp 'package-reinstall)
+                  (package-reinstall name)
+                  (package-delete pkg-desc)
+                  (package-install name))))
+
+(defun helm-el-run-package-reinstall ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-el-package-reinstall)))
+(put 'helm-el-run-package-reinstall 'helm-only t)
+
+;;;###autoload
+(defun helm-list-elisp-packages (arg)
+  "Preconfigured helm for listing and handling emacs packages."
+  (interactive "P")
+  (when arg (setq helm-el-package--initialized-p nil))
+  (unless helm-source-list-el-package
+    (setq helm-source-list-el-package
+          (helm-make-source "list packages" 'helm-list-el-package-source)))
+  (helm :sources 'helm-source-list-el-package
+        :buffer "*helm list packages*"))
+
+;;;###autoload
+(defun helm-list-elisp-packages-no-fetch ()
+  "Preconfigured helm for emacs packages.
+Same as `helm-list-elisp-packages' but don't fetch packages on remote."
+  (interactive)
+  (let ((helm-el-package--initialized-p t))
+    (helm-list-elisp-packages nil)))
+
+(provide 'helm-elisp-package)
+
+;;; helm-elisp-package.el ends here
diff --git a/elpa/helm-20160217.958/helm-elisp.el b/elpa/helm-20160217.958/helm-elisp.el
new file mode 100644 (file)
index 0000000..b2f40b4
--- /dev/null
@@ -0,0 +1,903 @@
+;;; helm-elisp.el --- Elisp symbols completion for helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-types)
+(require 'helm-utils)
+(require 'helm-info)
+(require 'helm-eval)
+(require 'helm-files)
+(require 'advice)
+
+(declare-function 'helm-describe-function "helm-lib")
+(declare-function 'helm-describe-variable "helm-lib")
+(declare-function 'helm-describe-face "helm-lib")
+
+\f
+;;; Customizable values
+
+(defgroup helm-elisp nil
+  "Elisp related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-turn-on-show-completion t
+  "Display candidate in buffer while moving selection when non--nil."
+  :group 'helm-elisp
+  :type  'boolean)
+
+(defcustom helm-show-completion-use-special-display t
+  "A special display will be used in Lisp completion if non--nil.
+All functions that are wrapped in macro `with-helm-show-completion'
+will be affected."
+  :group 'helm-elisp
+  :type  'boolean)
+
+(defcustom helm-show-completion-min-window-height 7
+  "Minimum completion window height used in show completion.
+This is used in macro `with-helm-show-completion'."
+  :group 'helm-elisp
+  :type  'integer)
+
+(defcustom helm-lisp-quoted-function-list
+  '(funcall apply mapc cl-mapc mapcar cl-mapcar
+    callf callf2 cl-callf cl-callf2 fset
+    fboundp fmakunbound symbol-function)
+  "List of function where quoted function completion happen.
+e.g give only function names after \(funcall '."
+  :group 'helm-elisp
+  :type '(repeat (choice symbol)))
+
+(defcustom helm-lisp-unquoted-function-list
+  '(function defadvice)
+  "List of function where unquoted function completion happen.
+e.g give only function names after \(function ."
+  :group 'helm-elisp
+  :type '(repeat (choice symbol)))
+
+(defcustom helm-apropos-fuzzy-match nil
+  "Enable fuzzy matching for `helm-apropos' when non-nil."
+  :group 'helm-elisp
+  :type 'boolean)
+
+(defcustom helm-lisp-fuzzy-completion nil
+  "Enable fuzzy matching in emacs-lisp completion when non-nil.
+NOTE: This enable fuzzy matching in helm native implementation of
+elisp completion, but not on helmized elisp completion, i.e
+fuzzy completion is not available in `completion-at-point'."
+  :group 'helm-elisp
+  :type 'boolean)
+
+(defcustom helm-apropos-function-list '(helm-def-source--emacs-commands
+                                        helm-def-source--emacs-functions
+                                        helm-def-source--eieio-classes
+                                        helm-def-source--eieio-generic
+                                        helm-def-source--emacs-variables
+                                        helm-def-source--emacs-faces
+                                        helm-def-source--helm-attributes)
+  "A list of functions that build helm sources to use in `helm-apropos'."
+  :group 'helm-elisp
+  :type '(repeat (choice symbol)))
+
+\f
+;;; Faces
+;;
+;;
+(defgroup helm-elisp-faces nil
+  "Customize the appearance of helm-elisp."
+  :prefix "helm-"
+  :group 'helm-elisp
+  :group 'helm-faces)
+
+(defface helm-lisp-show-completion
+    '((t (:background "DarkSlateGray")))
+  "Face used for showing candidates in `helm-lisp-completion'."
+  :group 'helm-elisp-faces)
+
+(defface helm-lisp-completion-info
+    '((t (:foreground "red")))
+  "Face used for showing info in `helm-lisp-completion'."
+  :group 'helm-elisp-faces)
+
+(defcustom helm-elisp-help-function
+  'helm-elisp-show-help
+  "Function for displaying help for Lisp symbols."
+  :group 'helm-elisp
+  :type '(choice (function :tag "Open help for the symbol."
+                  helm-elisp-show-help)
+                 (function :tag "Show one liner in modeline."
+                  helm-elisp-show-doc-modeline)))
+
+\f
+;;; Show completion.
+;;
+;; Provide show completion with macro `with-helm-show-completion'.
+
+(defvar helm-show-completion-overlay nil)
+
+;; Called each time cursor move in helm-buffer.
+(defun helm-show-completion ()
+  (with-helm-current-buffer
+    (overlay-put helm-show-completion-overlay
+                 'display (substring-no-properties
+                           (helm-get-selection)))))
+
+(defun helm-show-completion-init-overlay (beg end)
+  (when (and helm-turn-on-show-completion beg end)
+    (setq helm-show-completion-overlay (make-overlay beg end))
+    (overlay-put helm-show-completion-overlay
+                 'face 'helm-lisp-show-completion)))
+
+(defun helm-show-completion-display-function (buffer &rest _args)
+  "A special resized helm window is used depending on position in BUFFER."
+  (with-selected-window (selected-window)
+    (if (window-dedicated-p)
+        (helm-default-display-buffer buffer)
+      (let* ((screen-size  (+ (count-screen-lines (window-start) (point) t)
+                              1                         ; mode-line
+                              (if header-line-format 1 0))) ; header-line
+             (def-size     (- (window-height)
+                              helm-show-completion-min-window-height))
+             (upper-height (max window-min-height (min screen-size def-size)))
+             split-window-keep-point)
+        (recenter -1)
+        (set-window-buffer (if (active-minibuffer-window)
+                               (minibuffer-selected-window)
+                               (split-window nil upper-height
+                                             helm-split-window-default-side))
+                           buffer)))))
+
+(defmacro with-helm-show-completion (beg end &rest body)
+  "Show helm candidate in an overlay at point.
+BEG and END are the beginning and end position of the current completion
+in `helm-current-buffer'.
+BODY is an helm call where we want to enable show completion.
+If `helm-turn-on-show-completion' is nil just do nothing."
+  (declare (indent 2) (debug t))
+  `(let ((helm-move-selection-after-hook
+          (and helm-turn-on-show-completion
+               (append (list 'helm-show-completion)
+                       helm-move-selection-after-hook))))
+     (with-helm-temp-hook 'helm-after-initialize-hook
+       (with-helm-buffer
+         (set (make-local-variable 'helm-display-function)
+              (if helm-show-completion-use-special-display
+                  'helm-show-completion-display-function
+                'helm-default-display-buffer))))
+     (unwind-protect
+          (progn
+            (helm-show-completion-init-overlay ,beg ,end)
+            ,@body)
+       (when (and helm-turn-on-show-completion
+                  helm-show-completion-overlay
+                  (overlayp helm-show-completion-overlay))
+         (delete-overlay helm-show-completion-overlay)))))
+
+\f
+;;; Lisp symbol completion.
+;;
+;;
+(defun helm-lisp-completion--predicate-at-point (beg)
+  ;; Return a predicate for `all-completions'.
+  (let ((fn-sym-p (lambda ()
+                    (or
+                     (and (eq (char-before) ?\ )
+                          (save-excursion
+                            (skip-syntax-backward " " (point-at-bol))
+                            (memq (symbol-at-point)
+                                  helm-lisp-unquoted-function-list)))
+                     (and (eq (char-before) ?\')
+                          (save-excursion
+                            (forward-char -1)
+                            (eq (char-before) ?\#)))))))
+    (save-excursion
+      (goto-char beg)
+      (if (or
+           ;; Complete on all symbols in non--lisp modes (logs mail etc..)
+           (not (memq major-mode '(emacs-lisp-mode
+                                   lisp-interaction-mode
+                                   inferior-emacs-lisp-mode)))
+           (not (or (funcall fn-sym-p)
+                    (and (eq (char-before) ?\')
+                         (save-excursion
+                           (forward-char (if (funcall fn-sym-p) -2 -1))
+                           (skip-syntax-backward " " (point-at-bol))
+                           (memq (symbol-at-point)
+                                 helm-lisp-quoted-function-list)))
+                    (eq (char-before) ?\())) ; no paren before str.
+           ;; Looks like we are in a let statement.
+           (condition-case nil
+               (progn (up-list -2) (forward-char 1)
+                      (eq (char-after) ?\())
+             (error nil)))
+          (lambda (sym)
+            (or (boundp sym) (fboundp sym) (symbol-plist sym)))
+        #'fboundp))))
+
+(defun helm-thing-before-point (&optional limits regexp)
+  "Return symbol name before point.
+If REGEXP is specified return what REGEXP find before point.
+By default match the beginning of symbol before point.
+With LIMITS arg specified return the beginning and end position
+of symbol before point."
+  (save-excursion
+    (let (beg
+          (end (point))
+          (boundary (field-beginning nil nil (point-at-bol))))
+      (if (re-search-backward (or regexp "\\_<") boundary t)
+          (setq beg (match-end 0))
+        (setq beg boundary))
+      (unless (= beg end)
+        (if limits
+            (cons beg end)
+          (buffer-substring-no-properties beg end))))))
+
+(defun helm-bounds-of-thing-before-point (&optional regexp)
+  "Get the beginning and end position of `helm-thing-before-point'.
+Return a cons \(beg . end\)."
+  (helm-thing-before-point 'limits regexp))
+
+(defun helm-insert-completion-at-point (beg end str)
+  ;; When there is no space after point
+  ;; we are completing inside a symbol or
+  ;; after a partial symbol with the next arg aside
+  ;; without space, in this case mark the region.
+  ;; deleting it would remove the
+  ;; next arg which is unwanted.
+  (delete-region beg end)
+  (insert str)
+  (let ((pos (cdr (or (bounds-of-thing-at-point 'symbol)
+                      ;; needed for helm-dabbrev.
+                      (bounds-of-thing-at-point 'filename)))))
+    (when (and pos (< (point) pos))
+      (push-mark pos t t))))
+
+(defvar helm-lisp-completion--cache nil)
+(defvar helm-lgst-len nil)
+;;;###autoload
+(defun helm-lisp-completion-at-point ()
+  "Preconfigured helm for lisp symbol completion at point."
+  (interactive)
+  (setq helm-lgst-len 0)
+  (let* ((target     (helm-thing-before-point))
+         (beg        (car (helm-bounds-of-thing-before-point)))
+         (end        (point))
+         (pred       (and beg (helm-lisp-completion--predicate-at-point beg)))
+         (loc-vars   (and (fboundp 'elisp--local-variables)
+                          (ignore-errors
+                            (mapcar #'symbol-name (elisp--local-variables)))))
+         (glob-syms  (and target pred (all-completions target obarray pred)))
+         (candidates (append loc-vars glob-syms))
+         (helm-quit-if-no-candidate t)
+         (helm-execute-action-at-once-if-one t)
+         (enable-recursive-minibuffers t))
+    (setq helm-lisp-completion--cache (cl-loop for sym in candidates
+                                            for len = (length sym)
+                                            when (> len helm-lgst-len)
+                                            do (setq helm-lgst-len len)
+                                            collect sym))
+    (if candidates
+        (with-helm-show-completion beg end
+          ;; Overlay is initialized now in helm-current-buffer.
+          (helm
+           :sources (helm-build-in-buffer-source "Lisp completion"
+                      :data helm-lisp-completion--cache
+                      :persistent-action 'helm-lisp-completion-persistent-action
+                      :nomark t
+                      :fuzzy-match helm-lisp-fuzzy-completion
+                      :persistent-help (helm-lisp-completion-persistent-help)
+                      :filtered-candidate-transformer
+                      'helm-lisp-completion-transformer
+                      :action `(lambda (candidate)
+                                 (with-helm-current-buffer
+                                   (run-with-timer
+                                    0.01 nil
+                                    'helm-insert-completion-at-point
+                                    ,beg ,end candidate))))
+           :input (if helm-lisp-fuzzy-completion
+                      target (concat target " "))
+           :resume 'noresume
+           :buffer "*helm lisp completion*"
+           :allow-nest t))
+      (message "[No Match]"))))
+
+(defun helm-lisp-completion-persistent-action (candidate &optional name)
+  "Show documentation for the function.
+Documentation is shown briefly in mode-line or completely
+in other window according to the value of `helm-elisp-help-function'."
+  (funcall helm-elisp-help-function candidate name))
+
+(defun helm-lisp-completion-persistent-help ()
+  "Return persistent-help according to the value of `helm-elisp-help-function'"
+    (cl-ecase helm-elisp-help-function
+      (helm-elisp-show-doc-modeline "Show brief doc in mode-line")
+      (helm-elisp-show-help "Toggle show help for the symbol")))
+
+(defun helm-elisp--show-help-1 (candidate &optional name)
+  (let ((sym (intern-soft candidate)))
+    (cl-typecase sym
+      ((and fboundp boundp)
+       (if (member name '("describe-function" "describe-variable"))
+           (funcall (intern (format "helm-%s" name)) sym)
+           ;; When there is no way to know what to describe
+           ;; prefer describe-function.
+           (helm-describe-function sym)))
+      (fboundp  (helm-describe-function sym))
+      (bound    (helm-describe-variable sym))
+      (face     (helm-describe-face sym)))))
+
+(defun helm-elisp-show-help (candidate &optional name)
+  "Show full help for the function CANDIDATE.
+Arg NAME specify the name of the top level function
+calling helm generic completion (e.g \"describe-function\")."
+  (helm-elisp--persistent-help
+   candidate 'helm-elisp--show-help-1 name))
+
+(defun helm-elisp-show-doc-modeline (candidate &optional name)
+  "Show brief documentation for the function in modeline."
+  (let ((cursor-in-echo-area t)
+        mode-line-in-non-selected-windows)
+    (helm-show-info-in-mode-line
+     (propertize
+      (helm-get-first-line-documentation
+       (intern candidate) name)
+      'face 'helm-lisp-completion-info))))
+
+(defun helm-lisp-completion-transformer (candidates _source)
+  "Helm candidates transformer for lisp completion."
+  (cl-loop for c in candidates
+        for sym = (intern c)
+        for annot = (cl-typecase sym
+                      (command " (Com)")
+                      (class   " (Class)")
+                      (generic " (Gen)")
+                      (fbound  " (Fun)")
+                      (bound   " (Var)")
+                      (face    " (Face)"))
+        for spaces = (make-string (- helm-lgst-len (length c)) ? )
+        collect (cons (concat c spaces annot) c) into lst
+        finally return (sort lst #'helm-generic-sort-fn)))
+
+(defun helm-get-first-line-documentation (sym &optional name)
+  "Return first line documentation of symbol SYM.
+If SYM is not documented, return \"Not documented\"."
+  (let ((doc (cl-typecase sym
+               ((and fboundp boundp)
+                (cond ((string= name "describe-function")
+                       (documentation sym t))
+                      ((string= name  "describe-variable")
+                       (documentation-property sym 'variable-documentation t))
+                      (t (documentation sym t))))
+               (fbound  (documentation sym t))
+               (bound   (documentation-property sym 'variable-documentation t))
+               (face    (face-documentation sym)))))
+    (if (and doc (not (string= doc ""))
+             ;; `documentation' return "\n\n(args...)"
+             ;; for CL-style functions.
+             (not (string-match-p "^\n\n" doc)))
+        (car (split-string doc "\n"))
+      "Not documented")))
+
+;;; File completion.
+;;
+;; Complete file name at point.
+
+;;;###autoload
+(defun helm-complete-file-name-at-point (&optional force)
+  "Preconfigured helm to complete file name at point."
+  (interactive)
+  (require 'helm-mode)
+  (let* ((tap (thing-at-point 'filename))
+         beg
+         (init (and tap
+                    (or force
+                        (save-excursion
+                          (end-of-line)
+                          (search-backward tap (point-at-bol) t)
+                          (setq beg (point))
+                          (looking-back "[^'`( ]" (1- (point)))))
+                    (expand-file-name
+                     (substring-no-properties tap))))
+         (end  (point))
+         (helm-quit-if-no-candidate t)
+         (helm-execute-action-at-once-if-one t)
+         completion)
+    (with-helm-show-completion beg end
+      (setq completion (helm-read-file-name "FileName: "
+                                            :initial-input init)))
+    (when (and completion (not (string= completion "")))
+      (delete-region beg end) (insert (if (string-match "^~" tap)
+                                          (abbreviate-file-name completion)
+                                        completion)))))
+
+;;;###autoload
+(defun helm-lisp-indent ()
+  ;; It is meant to use with `helm-define-multi-key' which
+  ;; does not support args for functions yet, so use `current-prefix-arg'
+  ;; for now instead of (interactive "P").
+  (interactive)
+  (let ((tab-always-indent (or (eq tab-always-indent 'complete)
+                               tab-always-indent)))
+    (indent-for-tab-command current-prefix-arg)))
+
+;;;###autoload
+(defun helm-lisp-completion-or-file-name-at-point ()
+  "Preconfigured helm to complete lisp symbol or filename at point.
+Filename completion happen if string start after or between a double quote."
+  (interactive)
+  (let* ((tap (thing-at-point 'filename)))
+    (if (and tap (save-excursion
+                   (end-of-line)
+                   (search-backward tap (point-at-bol) t)
+                   (looking-back "[^'`( ]" (1- (point)))))
+        (helm-complete-file-name-at-point)
+      (helm-lisp-completion-at-point))))
+
+\f
+;;; Apropos
+;;
+;;
+(defun helm-apropos-init (test default)
+  "Init candidates buffer for `helm-apropos' sources."
+  (require 'helm-help)
+  (helm-init-candidates-in-buffer 'global
+    (let ((default-symbol (and (stringp default)
+                               (intern-soft default)))
+          (symbols (all-completions "" obarray test)))
+      (if (and default-symbol (funcall test default-symbol))
+          (cons default-symbol symbols)
+        symbols))))
+
+(defun helm-apropos-init-faces (default)
+  "Init candidates buffer for faces for `helm-apropos'."
+  (require 'helm-help)
+  (with-current-buffer (helm-candidate-buffer 'global)
+    (goto-char (point-min))
+    (let ((default-symbol (and (stringp default)
+                               (intern-soft default)))
+          (faces (face-list)))
+      (when (and default-symbol (facep default-symbol))
+        (insert (concat default "\n")))
+      (insert
+       (mapconcat #'prin1-to-string
+                  (if default
+                      (cl-remove-if (lambda (sym) (string= sym default)) faces)
+                    faces)
+                  "\n")))))
+
+(defun helm-apropos-default-sort-fn (candidates _source)
+  (if (string= helm-pattern "")
+      candidates
+      (sort candidates #'helm-generic-sort-fn)))
+
+(defun helm-def-source--emacs-variables (&optional default)
+  (helm-build-in-buffer-source "Variables"
+    :init `(lambda ()
+             (helm-apropos-init
+              (lambda (x) (and (boundp x) (not (keywordp x)))) ,default))
+    :fuzzy-match helm-apropos-fuzzy-match
+    :filtered-candidate-transformer (and (null helm-apropos-fuzzy-match)
+                                         'helm-apropos-default-sort-fn)
+    :nomark t
+    :persistent-action (lambda (candidate)
+                         (helm-elisp--persistent-help
+                          candidate 'helm-describe-variable))
+    :persistent-help "Describe variable"
+    :action '(("Describe variable" . helm-describe-variable)
+              ("Find variable" . helm-find-variable)
+              ("Info lookup" . helm-info-lookup-symbol)
+              ("Set variable" . helm-set-variable))
+    :action-transformer
+    (lambda (actions candidate)
+      (let ((sym (helm-symbolify candidate)))
+        (if (custom-variable-p sym)
+            (append
+             actions
+             (let ((standard-value (eval (car (get sym 'standard-value)))))
+               (unless (equal standard-value (symbol-value sym))
+                 `(("Reset Variable to default value" .
+                    ,(lambda (candidate)
+                       (let ((sym (helm-symbolify candidate)))
+                         (set sym standard-value)))))))
+             '(("Customize variable" .
+                (lambda (candidate)
+                  (customize-option (helm-symbolify candidate))))))
+          actions)))))
+
+(defun helm-def-source--emacs-faces (&optional default)
+  "Create `helm' source for faces to be displayed with
+`helm-apropos'."
+  (helm-build-in-buffer-source "Faces"
+    :init (lambda () (helm-apropos-init-faces default))
+    :fuzzy-match helm-apropos-fuzzy-match
+    :filtered-candidate-transformer
+    (append (and (null helm-apropos-fuzzy-match)
+                 '(helm-apropos-default-sort-fn))
+            (list
+             (lambda (candidates _source)
+               (cl-loop for c in candidates
+                        collect (propertize c 'face (intern c))))))
+    :persistent-action (lambda (candidate)
+                         (helm-elisp--persistent-help
+                          candidate 'helm-describe-face))
+    :persistent-help "Describe face"
+    :nomark t
+    :action '(("Describe face" . helm-describe-face)
+              ("Find face" . helm-find-face-definition)
+              ("Customize face" . (lambda (candidate)
+                                    (customize-face (helm-symbolify candidate)))))))
+
+(defun helm-def-source--helm-attributes (&optional _default)
+  (let ((def-act (lambda (candidate)
+                   (let (special-display-buffer-names
+                         special-display-regexps
+                         helm-persistent-action-use-special-display)
+                     (with-output-to-temp-buffer "*Help*"
+                       (princ (get (intern candidate) 'helm-attrdoc)))))))
+    (helm-build-sync-source "Helm attributes"
+      :candidates (lambda ()
+                    (mapcar 'symbol-name helm-attributes))
+      :fuzzy-match helm-apropos-fuzzy-match
+      :nomark t
+      :persistent-action (lambda (candidate)
+                           (helm-elisp--persistent-help
+                            candidate def-act))
+      :persistent-help "Describe helm attribute"
+      :action def-act)))
+
+(defun helm-def-source--emacs-commands (&optional default)
+  (helm-build-in-buffer-source "Commands"
+    :init `(lambda ()
+             (helm-apropos-init 'commandp ,default))
+    :fuzzy-match helm-apropos-fuzzy-match
+    :filtered-candidate-transformer (and (null helm-apropos-fuzzy-match)
+                                         'helm-apropos-default-sort-fn)
+    :nomark t
+    :persistent-action (lambda (candidate)
+                         (helm-elisp--persistent-help
+                          candidate 'helm-describe-function))
+    :persistent-help "Describe command"
+    :action '(("Describe function" . helm-describe-function)
+              ("Find function" . helm-find-function)
+              ("Info lookup" . helm-info-lookup-symbol))))
+
+(defun helm-def-source--emacs-functions (&optional default)
+  (helm-build-in-buffer-source "Functions"
+    :init `(lambda ()
+             (helm-apropos-init (lambda (x)
+                                    (and (fboundp x)
+                                         (not (commandp x))
+                                         (not (generic-p x))
+                                         (not (class-p x))))
+                                ,default))
+    :fuzzy-match helm-apropos-fuzzy-match
+    :filtered-candidate-transformer (and (null helm-apropos-fuzzy-match)
+                                         'helm-apropos-default-sort-fn)
+    :persistent-action (lambda (candidate)
+                         (helm-elisp--persistent-help
+                          candidate 'helm-describe-function))
+    :persistent-help "Describe function"
+    :nomark t
+    :action '(("Describe function" . helm-describe-function)
+              ("Find function" . helm-find-function)
+              ("Info lookup" . helm-info-lookup-symbol))))
+
+(defun helm-def-source--eieio-classes (&optional default)
+  (helm-build-in-buffer-source "Classes"
+    :init `(lambda ()
+             (helm-apropos-init (lambda (x)
+                                    (class-p x))
+                                ,default))
+    :fuzzy-match helm-apropos-fuzzy-match
+    :filtered-candidate-transformer (and (null helm-apropos-fuzzy-match)
+                                         'helm-apropos-default-sort-fn)
+    :nomark t
+    :persistent-action (lambda (candidate)
+                         (helm-elisp--persistent-help
+                          candidate 'helm-describe-function))
+    :persistent-help "Describe class"
+    :action '(("Describe function" . helm-describe-function)
+              ("Find function" . helm-find-function)
+              ("Info lookup" . helm-info-lookup-symbol))))
+
+(defun helm-def-source--eieio-generic (&optional default)
+  (helm-build-in-buffer-source "Generic functions"
+    :init `(lambda ()
+             (helm-apropos-init (lambda (x)
+                                  (generic-p x))
+                                ,default))
+    :fuzzy-match helm-apropos-fuzzy-match
+    :filtered-candidate-transformer (and (null helm-apropos-fuzzy-match)
+                                         'helm-apropos-default-sort-fn)
+    :nomark t
+    :persistent-action (lambda (candidate)
+                         (helm-elisp--persistent-help
+                          candidate 'helm-describe-function))
+    :persistent-help "Describe generic function"
+    :action '(("Describe function" . helm-describe-function)
+              ("Find function" . helm-find-function)
+              ("Info lookup" . helm-info-lookup-symbol))))
+
+(defun helm-info-lookup-symbol-1 (c)
+  (let ((helm-execute-action-at-once-if-one t)
+        (helm-quit-if-no-candidate
+         `(lambda ()
+            (message "`%s' Not Documented as a symbol" ,c))))
+    (helm :sources '(helm-source-info-elisp
+                     helm-source-info-cl
+                     helm-source-info-eieio)
+          :resume 'noresume
+          :buffer "*helm lookup*"
+          :input c)))
+
+(defun helm-info-lookup-symbol (candidate)
+  (run-with-timer 0.01 nil #'helm-info-lookup-symbol-1 candidate))
+
+(defun helm-elisp--persistent-help (candidate fun &optional name)
+  (let ((hbuf (get-buffer (help-buffer))))
+    (if (and (helm-attr 'help-running-p)
+             (string= candidate (helm-attr 'help-current-symbol))
+             (null helm-persistent-action-use-special-display))
+        (progn
+          ;; When started from a help buffer,
+          ;; Don't kill this buffer as it is helm-current-buffer.
+          (unless (equal hbuf helm-current-buffer)
+            (kill-buffer hbuf)
+            (set-window-buffer (get-buffer-window hbuf)
+                               helm-current-buffer))
+          (helm-attrset 'help-running-p nil))
+        (if name (funcall fun candidate name) (funcall fun candidate))
+        (helm-attrset 'help-running-p t))
+    (helm-attrset 'help-current-symbol candidate)))
+
+;;;###autoload
+(defun helm-apropos ()
+  "Preconfigured helm to describe commands, functions, variables and faces."
+  (interactive)
+  (let ((default (thing-at-point 'symbol)))
+    (helm :sources
+          (mapcar (lambda (func)
+                    (funcall func default))
+                  helm-apropos-function-list)
+          :buffer "*helm apropos*"
+          :preselect (and default (concat "\\_<" (regexp-quote default) "\\_>")))))
+
+\f
+;;; Advices
+;;
+;;
+(defvar helm-source-advice
+  '((name . "Function Advice")
+    (candidates . helm-advice-candidates)
+    (action ("Toggle Enable/Disable" . helm-advice-toggle))
+    (persistent-action . helm-advice-persistent-action)
+    (nomark)
+    (multiline)
+    (persistent-help . "Describe function / C-u C-j: Toggle advice")))
+
+(defun helm-advice-candidates ()
+  (cl-loop for (fname) in ad-advised-functions
+        for function = (intern fname)
+        append
+        (cl-loop for class in ad-advice-classes append
+              (cl-loop for advice in (ad-get-advice-info-field function class)
+                    for enabled = (ad-advice-enabled advice)
+                    collect
+                    (cons (format
+                           "%s %s %s"
+                           (if enabled "Enabled " "Disabled")
+                           (propertize fname 'face 'font-lock-function-name-face)
+                           (ad-make-single-advice-docstring advice class nil))
+                          (list function class advice))))))
+
+(defun helm-advice-persistent-action (func-class-advice)
+  (if current-prefix-arg
+      (helm-advice-toggle func-class-advice)
+    (describe-function (car func-class-advice))))
+
+(defun helm-advice-toggle (func-class-advice)
+  (cl-destructuring-bind (function _class advice) func-class-advice
+    (cond ((ad-advice-enabled advice)
+           (ad-advice-set-enabled advice nil)
+           (message "Disabled"))
+          (t
+           (ad-advice-set-enabled advice t)
+           (message "Enabled")))
+    (ad-activate function)
+    (and helm-in-persistent-action
+         (helm-advice-update-current-display-string))))
+
+(defun helm-advice-update-current-display-string ()
+  (helm-edit-current-selection
+    (let ((newword (cond ((looking-at "Disabled") "Enabled")
+                         ((looking-at "Enabled")  "Disabled"))))
+      (when newword
+        (delete-region (point) (progn (forward-word 1) (point)))
+        (insert newword)))))
+
+;;;###autoload
+(defun helm-manage-advice ()
+  "Preconfigured `helm' to disable/enable function advices."
+  (interactive)
+  (helm-other-buffer 'helm-source-advice "*helm advice*"))
+
+\f
+;;; Locate elisp library
+;;
+;;
+(defun helm-locate-library-scan-list ()
+  (cl-loop for dir in load-path
+        when (file-directory-p dir)
+        append (directory-files dir t (concat (regexp-opt (get-load-suffixes))
+                                              "\\'"))
+        into lst
+        finally return (helm-fast-remove-dups lst :test 'equal)))
+
+;;;###autoload
+(defun helm-locate-library ()
+  "Preconfigured helm to locate elisp libraries."
+  (interactive)
+  (helm :sources (helm-build-in-buffer-source  "Elisp libraries (Scan)"
+                   :data (lambda () (helm-locate-library-scan-list))
+                   :fuzzy-match t
+                   :keymap helm-generic-files-map
+                   :match-part (lambda (candidate)
+                                 (if helm-ff-transformer-show-only-basename
+                                     (helm-basename candidate) candidate))
+                   :filter-one-by-one (lambda (c)
+                                        (if helm-ff-transformer-show-only-basename
+                                            (cons (helm-basename c) c) c))
+                   :action (helm-actions-from-type-file))
+        :buffer "*helm locate library*"))
+
+(defun helm-set-variable (var)
+  "Set value to VAR interactively."
+  (let* ((sym (helm-symbolify var))
+         (val (default-value sym)))
+    (set-default sym (eval-minibuffer (format "Set `%s': " var)
+                                      (if (or (stringp val) (memq val '(nil t)))
+                                          (prin1-to-string val)
+                                          (format "'%s" (prin1-to-string val)))))))
+
+\f
+;;; Elisp Timers.
+;;
+;;
+(defclass helm-absolute-time-timers-class (helm-source-sync helm-type-timers)
+  ((candidates :initform timer-list)
+   (allow-dups :initform t)
+   (candidate-transformer
+    :initform
+    (lambda (candidates)
+      (cl-loop for timer in candidates
+               collect (cons (helm-elisp--format-timer timer) timer))))))
+
+(defvar helm-source-absolute-time-timers
+  (helm-make-source "Absolute Time Timers" 'helm-absolute-time-timers-class))
+
+(defclass helm-idle-time-timers-class (helm-source-sync helm-type-timers)
+  ((candidates :initform timer-idle-list)
+   (allow-dups :initform t)
+   (candidate-transformer
+    :initform
+    (lambda (candidates)
+      (cl-loop for timer in candidates
+               collect (cons (helm-elisp--format-timer timer) timer))))))
+
+(defvar helm-source-idle-time-timers
+  (helm-make-source "Idle Time Timers" 'helm-idle-time-timers-class))
+
+(defun helm-elisp--format-timer (timer)
+  (format "%s repeat=%s %s(%s)"
+          (let ((time (timer--time timer)))
+            (if (timer--idle-delay timer)
+                (format-time-string "idle-for=%5s" time)
+              (format-time-string "%m/%d %T" time)))
+          (or (timer--repeat-delay timer) "nil")
+          (mapconcat 'identity (split-string
+                                (prin1-to-string (timer--function timer))
+                                "\n") " ")
+          (mapconcat 'prin1-to-string (timer--args timer) " ")))
+
+;;;###autoload
+(defun helm-timers ()
+  "Preconfigured `helm' for timers."
+  (interactive)
+  (helm :sources '(helm-source-absolute-time-timers
+                   helm-source-idle-time-timers)
+        :buffer "*helm timers*"))
+
+\f
+;;; Complex command history
+;;
+;;
+(defun helm-btf--usable-p ()
+  "Return t if current version of `backtrace-frame' accept 2 arguments."
+  (condition-case nil
+      (progn (backtrace-frame 1 'condition-case) t)
+    (wrong-number-of-arguments nil)))
+
+(if (helm-btf--usable-p)        ; Check if BTF accept more than one arg.
+    ;; Emacs 24.4.
+    (dont-compile
+      (defvar helm-sexp--last-sexp nil)
+      ;; This wont work compiled.
+      (defun helm-sexp-eval-1 ()
+        (interactive)
+        (unwind-protect
+             (progn
+               ;; Trick called-interactively-p into thinking that `cand' is
+               ;; an interactive call, See `repeat-complex-command'.
+               (add-hook 'called-interactively-p-functions
+                         #'helm-complex-command-history--called-interactively-skip)
+               (eval (read helm-sexp--last-sexp)))
+          (remove-hook 'called-interactively-p-functions
+                       #'helm-complex-command-history--called-interactively-skip)))
+
+      (defun helm-complex-command-history--called-interactively-skip (i _frame1 frame2)
+        (and (eq 'eval (cadr frame2))
+             (eq 'helm-sexp-eval-1
+                 (cadr (backtrace-frame (+ i 2) #'called-interactively-p)))
+             1))
+
+      (defun helm-sexp-eval (_candidate)
+        (call-interactively #'helm-sexp-eval-1)))
+  ;; Emacs 24.3
+  (defun helm-sexp-eval (cand)
+    (let ((sexp (read cand)))
+      (condition-case err
+          (if (> (length (remove nil sexp)) 1)
+              (eval sexp)
+            (apply 'call-interactively sexp))
+        (error (message "Evaluating gave an error: %S" err)
+               nil)))))
+
+(defvar helm-source-complex-command-history
+  (helm-build-sync-source "Complex Command History"
+    :candidates (lambda ()
+                  ;; Use cdr to avoid adding
+                  ;; `helm-complex-command-history' here.
+                  (cl-loop for i in command-history
+                           unless (equal i '(helm-complex-command-history))
+                           collect (prin1-to-string i)))
+    :action (helm-make-actions
+             "Eval" (lambda (candidate)
+                      (and (boundp 'helm-sexp--last-sexp)
+                           (setq helm-sexp--last-sexp candidate))
+                      (run-with-timer 0.1 nil #'helm-sexp-eval candidate))
+             "Edit and eval" (lambda (candidate)
+                               (edit-and-eval-command "Eval: " (read candidate))))
+    :persistent-action #'helm-sexp-eval))
+
+;;;###autoload
+(defun helm-complex-command-history ()
+  "Preconfigured helm for complex command history."
+  (interactive)
+  (helm :sources 'helm-source-complex-command-history
+        :buffer "*helm complex commands*"))
+
+(provide 'helm-elisp)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-elisp.el ends here
diff --git a/elpa/helm-20160217.958/helm-elscreen.el b/elpa/helm-20160217.958/helm-elscreen.el
new file mode 100644 (file)
index 0000000..ea16b0d
--- /dev/null
@@ -0,0 +1,102 @@
+;;; helm-elscreen.el -- Elscreen support -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+
+(declare-function elscreen-find-screen-by-buffer "ext:elscreen.el" (buffer &optional create))
+(declare-function elscreen-find-file "ext:elscreen.el" (filename))
+(declare-function elscreen-goto "ext:elscreen.el" (screen))
+(declare-function elscreen-get-conf-list "ext:elscreen.el" (type))
+
+(defun helm-find-buffer-on-elscreen (candidate)
+  "Open buffer in new screen, if marked buffers open all in elscreens."
+  (helm-require-or-error 'elscreen 'helm-find-buffer-on-elscreen)
+  (helm-aif (helm-marked-candidates)
+      (cl-dolist (i it)
+        (let ((target-screen (elscreen-find-screen-by-buffer
+                              (get-buffer i) 'create)))
+          (elscreen-goto target-screen)))
+    (let ((target-screen (elscreen-find-screen-by-buffer
+                          (get-buffer candidate) 'create)))
+      (elscreen-goto target-screen))))
+
+(defun helm-elscreen-find-file (file)
+  (helm-require-or-error 'elscreen 'helm-elscreen-find-file)
+  (elscreen-find-file file))
+
+(defclass helm-source-elscreen (helm-source-sync)
+  ((candidates
+    :initform
+    (lambda ()
+      (when (cdr (elscreen-get-screen-to-name-alist))
+        (cl-sort (cl-loop for (screen . name) in (elscreen-get-screen-to-name-alist)
+                       collect (cons (format "[%d] %s" screen name) screen))
+                 #'< :key #'cdr))))
+   (action :initform
+           '(("Change Screen" .
+              (lambda (candidate)
+                (elscreen-goto candidate)))
+             ("Kill Screen(s)" .
+              (lambda (_)
+                (cl-dolist (i (helm-marked-candidates))
+                  (elscreen-goto i)
+                  (elscreen-kill))))
+             ("Only Screen" .
+              (lambda (candidate)
+                (elscreen-goto candidate)
+                (elscreen-kill-others)))))
+   (migemo :initform t)))
+
+(defclass helm-source-elscreen-history (helm-source-elscreen)
+  ((candidates
+    :initform
+    (lambda ()
+      (let ((sname (elscreen-get-screen-to-name-alist)))
+        (when (cdr sname)
+          (cl-loop for screen in (cdr (elscreen-get-conf-list 'screen-history))
+                collect (cons (format "[%d] %s" screen (cdr (assq screen sname)))
+                              screen))))))))
+
+(defvar helm-source-elscreen-list
+  (helm-make-source "ElScreen" 'helm-source-elscreen))
+
+(defvar helm-source-elscreen-history-list
+  (helm-make-source "ElScreen History" 'helm-source-elscreen-history))
+
+;;;###autoload
+(defun helm-elscreen ()
+  "Preconfigured helm to list elscreen."
+  (interactive)
+  (helm-other-buffer 'helm-source-elscreen-list "*Helm ElScreen*"))
+
+;;;###autoload
+(defun helm-elscreen-history ()
+  "Preconfigured helm to list elscreen in history order."
+  (interactive)
+  (helm-other-buffer 'helm-source-elscreen-history-list "*Helm ElScreen*"))
+
+(provide 'helm-elscreen)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-elscreen.el ends here
diff --git a/elpa/helm-20160217.958/helm-eshell.el b/elpa/helm-20160217.958/helm-eshell.el
new file mode 100644 (file)
index 0000000..aa61329
--- /dev/null
@@ -0,0 +1,268 @@
+;;; helm-eshell.el --- pcomplete and eshell completion for helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; Enable like this in .emacs:
+;; (add-hook 'eshell-mode-hook
+;;           (lambda ()
+;;               (eshell-cmpl-initialize)
+;;               (define-key eshell-mode-map [remap pcomplete] 'helm-esh-pcomplete)
+;;               (define-key eshell-mode-map (kbd "M-p") 'helm-eshell-history)))
+
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-lib)
+(require 'helm-help)
+(require 'helm-elisp)
+
+(declare-function eshell-read-aliases-list "em-alias")
+(declare-function eshell-send-input "esh-mode" (&optional use-region queue-p no-newline))
+(declare-function eshell-bol "esh-mode")
+(declare-function eshell-parse-arguments "esh-arg" (beg end))
+(declare-function eshell-backward-argument "esh-mode" (&optional arg))
+(declare-function helm-quote-whitespace "helm-lib")
+
+\f
+(defgroup helm-eshell nil
+  "Helm eshell completion and history."
+  :group 'helm)
+
+(defcustom helm-eshell-hist-ignoredups nil
+  "Same as `eshell-hist-ignoredups' which see but for helm."
+  :group 'helm-eshell
+  :type 'boolean)
+
+\f
+(defvar helm-eshell-history-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-p") 'helm-next-line)
+    map)
+  "Keymap for `helm-eshell-history'.")
+
+(defvar helm-esh-completion-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "TAB") 'helm-next-line)
+    map)
+  "Keymap for `helm-esh-pcomplete'.")
+
+\f
+(defclass helm-esh-source (helm-source-sync)
+  ((init :initform (lambda ()
+                     (setq pcomplete-current-completions nil
+                           pcomplete-last-completion-raw nil)
+                     ;; Eshell-command add this hook in all minibuffers
+                     ;; Remove it for the helm one. (Fixed in Emacs24)
+                     (remove-hook 'minibuffer-setup-hook 'eshell-mode)))
+   (candidates :initform 'helm-esh-get-candidates)
+   (nomark :initform t)
+   (persistent-action :initform 'ignore)
+   (filtered-candidate-transformer
+    :initform
+    (lambda (candidates _sources)
+      (cl-loop 
+       for i in candidates
+       collect
+       (cond ((string-match "\\`~/?" helm-ec-target)
+              (abbreviate-file-name i))
+             ((string-match "\\`/" helm-ec-target) i)
+             (t
+              (file-relative-name i)))
+       into lst
+       finally return (sort lst 'helm-generic-sort-fn))))
+   (action :initform 'helm-ec-insert))
+  "Helm class to define source for Eshell completion.")
+
+;; Internal.
+(defvar helm-ec-target "")
+(defun helm-ec-insert (candidate)
+  "Replace text at point with CANDIDATE.
+The function that call this should set `helm-ec-target' to thing at point."
+  (let ((pt (point)))
+    (when (and helm-ec-target
+               (search-backward helm-ec-target nil t)
+               (string= (buffer-substring (point) pt) helm-ec-target))
+      (delete-region (point) pt)))
+  (when (string-match "\\`\\*" helm-ec-target) (insert "*"))
+  (cond ((string-match "\\`~/?" helm-ec-target)
+         (insert (helm-quote-whitespace (abbreviate-file-name candidate))))
+        ((string-match "\\`/" helm-ec-target)
+         (insert (helm-quote-whitespace candidate)))
+        (t
+         (insert (concat (and (string-match "\\`[.]/" helm-ec-target) "./")
+                         (helm-quote-whitespace
+                          (file-relative-name candidate)))))))
+
+(defun helm-esh-get-candidates ()
+  "Get candidates for eshell completion using `pcomplete'."
+  (catch 'pcompleted
+    (with-helm-current-buffer
+      (let* ((pcomplete-stub)
+             pcomplete-seen pcomplete-norm-func
+             pcomplete-args pcomplete-last pcomplete-index
+             (pcomplete-autolist pcomplete-autolist)
+             (pcomplete-suffix-list pcomplete-suffix-list)
+             (table (pcomplete-completions))
+             (entry (or (try-completion helm-pattern
+                                        (pcomplete-entries))
+                        helm-pattern)))
+        (cl-loop ;; expand entry too to be able to compare it with file-cand.
+              with exp-entry = (and (stringp entry)
+                                    (not (string= entry ""))
+                                    (file-name-as-directory
+                                     (expand-file-name entry default-directory)))
+              for i in (all-completions pcomplete-stub table)
+              ;; Transform the related names to abs names.
+              for file-cand = (and exp-entry
+                                   (if (file-remote-p i) i
+                                     (expand-file-name
+                                      i (file-name-directory entry))))
+              ;; Compare them to avoid dups.
+              for file-entry-p = (and (stringp exp-entry)
+                                      (stringp file-cand)
+                                      ;; Fix :/tmp/foo/ $ cd foo
+                                      (not (file-directory-p file-cand))
+                                      (file-equal-p exp-entry file-cand))
+              if (and file-cand (or (file-remote-p file-cand)
+                                    (file-exists-p file-cand))
+                      (not file-entry-p))
+              collect file-cand into ls
+              else
+              ;; Avoid adding entry here.
+              unless file-entry-p collect i into ls
+              finally return
+              (if (and exp-entry
+                       (file-directory-p exp-entry)
+                       ;; If the car of completion list is
+                       ;; an executable, probably we are in
+                       ;; command completion, so don't add a
+                       ;; possible file related entry here.
+                       (and ls (not (executable-find (car ls))))
+                       ;; Don't add entry if already in prompt.
+                       (not (file-equal-p exp-entry pcomplete-stub)))
+                  (append (list exp-entry)
+                          ;; Entry should not be here now but double check.
+                          (remove entry ls))
+                ls))))))
+\f
+;;; Eshell history.
+;;
+;;
+(defclass helm-eshell-history-source (helm-source-in-buffer)
+  ((init :initform
+         (lambda ()
+           (let ((eshell-hist-ignoredups helm-eshell-hist-ignoredups))
+             (eshell-write-history eshell-history-file-name t)
+             (with-current-buffer (helm-candidate-buffer 'global)
+               (insert-file-contents eshell-history-file-name)))
+           ;; Same comment as in `helm-source-esh'
+           (remove-hook 'minibuffer-setup-hook 'eshell-mode)))
+   (nomark :initform t)
+   (keymap :initform helm-eshell-history-map)
+   (filtered-candidate-transformer :initform (lambda (candidates sources)
+                                               (reverse candidates)))
+   (candidate-number-limit :initform 9999)
+   (action :initform (lambda (candidate)
+                       (eshell-kill-input)
+                       (insert candidate))))
+  "Helm class to define source for Eshell history.")
+
+\f
+;;;###autoload
+(defun helm-esh-pcomplete ()
+  "Preconfigured helm to provide helm completion in eshell."
+  (interactive)
+  (let* ((helm-quit-if-no-candidate t)
+         (helm-execute-action-at-once-if-one t)
+         (end (point-marker))
+         (beg (save-excursion (eshell-bol) (point)))
+         (args (catch 'eshell-incomplete
+                 (eshell-parse-arguments beg end)))
+         (target
+          (or (and (looking-back " " (1- (point))) " ")
+              (buffer-substring-no-properties
+               (save-excursion
+                 (eshell-backward-argument 1) (point))
+               end)))
+         (first (car args)) ; Maybe lisp delimiter "(".
+         last ; Will be the last but parsed by pcomplete.
+         del-space)
+    (setq helm-ec-target (or target " ")
+          end (point)
+          ;; Reset beg for `with-helm-show-completion'.
+          beg (or (and target (not (string= target " "))
+                       (- end (length target)))
+                  ;; Nothing at point.
+                  (progn (insert " ") (setq del-space t) (point))))
+    (cond ((eq first ?\()
+           (helm-lisp-completion-or-file-name-at-point))
+          ;; In eshell `pcomplete-parse-arguments' is called
+          ;; with `pcomplete-parse-arguments-function'
+          ;; locally bound to `eshell-complete-parse-arguments'
+          ;; which is calling `lisp-complete-symbol',
+          ;; calling it before would popup the
+          ;; *completions* buffer.
+          (t (setq last (replace-regexp-in-string
+                         "\\`\\*" ""
+                         (car (last (ignore-errors
+                                      (pcomplete-parse-arguments))))))
+             (with-helm-show-completion beg end
+               (or (helm :sources (helm-make-source "Eshell completions" 'helm-esh-source)
+                         :buffer "*helm pcomplete*"
+                         :keymap helm-esh-completion-map
+                         :resume 'noresume
+                         :input (and (stringp last)
+                                     (helm-ff-set-pattern last)))
+                   (and del-space (looking-back "\\s-" (1- (point)))
+                        (delete-char -1))))))))
+
+;;;###autoload
+(defun helm-eshell-history ()
+  "Preconfigured helm for eshell history."
+  (interactive)
+  (let* ((end   (point))
+         (beg   (save-excursion (eshell-bol) (point)))
+         (input (buffer-substring beg end))
+         flag-empty)
+    (when (eq beg end)
+      (insert " ")
+      (setq flag-empty t)
+      (setq end (point)))
+    (unwind-protect
+         (with-helm-show-completion beg end
+           (helm :sources (helm-make-source "Eshell history"
+                              'helm-eshell-history-source)
+                 :buffer "*helm eshell history*"
+                 :resume 'noresume
+                 :input input))
+      (when (and flag-empty
+                 (looking-back " " (1- (point))))
+        (delete-char -1)))))
+
+(provide 'helm-eshell)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-eshell ends here
diff --git a/elpa/helm-20160217.958/helm-eval.el b/elpa/helm-20160217.958/helm-eval.el
new file mode 100644 (file)
index 0000000..6f30435
--- /dev/null
@@ -0,0 +1,204 @@
+;;; helm-eval.el --- eval expressions from helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'eldoc)
+(require 'edebug)
+
+\f
+(defgroup helm-eval nil
+  "Eval related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-eldoc-in-minibuffer-show-fn
+  'helm-show-info-in-mode-line
+  "A function to display eldoc info.
+Should take one arg: the string to display."
+  :group 'helm-eval
+  :type  'symbol)
+
+(defcustom helm-show-info-in-mode-line-delay 12
+  "Eldoc will show info in mode-line during this delay if user is idle."
+  :type  'integer
+  :group 'helm-eval)
+
+\f
+;;; Eldoc compatibility between emacs-24 and emacs-25
+;;
+(if (require 'elisp-mode nil t)    ; emacs-25
+    ;; Maybe the eldoc functions have been
+    ;; already aliased by eldoc-eval.
+    (cl-loop for (f . a) in '((eldoc-current-symbol .
+                               elisp--current-symbol)
+                              (eldoc-fnsym-in-current-sexp .
+                               elisp--fnsym-in-current-sexp) 
+                              (eldoc-get-fnsym-args-string .
+                               elisp-get-fnsym-args-string) 
+                              (eldoc-get-var-docstring .
+                               elisp-get-var-docstring))
+             unless (fboundp f)
+             do (defalias f a))
+    ;; Emacs-24.
+    (declare-function eldoc-current-symbol "eldoc")
+    (declare-function eldoc-get-fnsym-args-string "eldoc" (sym &optional index))
+    (declare-function eldoc-get-var-docstring "eldoc" (sym))
+    (declare-function eldoc-fnsym-in-current-sexp "eldoc"))
+
+;;; Evaluation Result
+;;
+;;
+;; Internal
+(defvar helm-eldoc-active-minibuffers-list nil)
+
+(defvar helm-eval-expression-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "<C-return>") 'helm-eval-new-line-and-indent)
+    (define-key map (kbd "<M-tab>")      'lisp-indent-line)
+    (define-key map (kbd "<C-tab>")    'helm-lisp-completion-at-point)
+    (define-key map (kbd "C-p")        'previous-line)
+    (define-key map (kbd "C-n")        'next-line)
+    (define-key map (kbd "<up>")       'previous-line)
+    (define-key map (kbd "<down>")     'next-line)
+    (define-key map (kbd "<right>")    'forward-char)
+    (define-key map (kbd "<left>")     'backward-char)
+    map))
+
+(defun helm-build-evaluation-result-source ()
+  (helm-build-dummy-source "Evaluation Result"
+    :multiline t
+    :mode-line "C-RET: nl-and-indent, M-tab: reindent, C-tab:complete, C-p/n: next/prec-line."
+    :filtered-candidate-transformer (lambda (_candidates _source)
+                                      (list
+                                       (condition-case nil
+                                           (with-helm-current-buffer
+                                             (pp-to-string
+                                              (if edebug-active
+                                                  (edebug-eval-expression
+                                                   (read helm-pattern))
+                                                  (eval (read helm-pattern)))))
+                                         (error "Error"))))
+    :nohighlight t
+    :action '(("Copy result to kill-ring" . (lambda (candidate)
+                                              (kill-new
+                                               (replace-regexp-in-string
+                                                "\n" "" candidate))
+                                              (message "Result copied to kill-ring")))
+              ("copy sexp to kill-ring" . (lambda (_candidate)
+                                            (kill-new helm-input)
+                                            (message "Sexp copied to kill-ring"))))))
+
+(defun helm-eval-new-line-and-indent ()
+  (interactive)
+  (newline) (lisp-indent-line))
+
+(defun helm-eldoc-store-minibuffer ()
+  "Store minibuffer buffer name in `helm-eldoc-active-minibuffers-list'."
+  (with-selected-window (minibuffer-window)
+    (push (current-buffer) helm-eldoc-active-minibuffers-list)))
+
+(defun helm-eldoc-show-in-eval ()
+  "Return eldoc in mode-line for current minibuffer input."
+  (let ((buf (window-buffer (active-minibuffer-window))))
+    (condition-case err
+        (when (member buf helm-eldoc-active-minibuffers-list)
+          (with-current-buffer buf
+            (let* ((sym     (save-excursion
+                              (unless (looking-back ")\\|\"" (1- (point)))
+                                (forward-char -1))
+                              (eldoc-current-symbol)))
+                   (info-fn (eldoc-fnsym-in-current-sexp))
+                   (doc     (or (eldoc-get-var-docstring sym)
+                                (eldoc-get-fnsym-args-string
+                                 (car info-fn) (cadr info-fn)))))
+              (when doc (funcall helm-eldoc-in-minibuffer-show-fn doc)))))
+      (error (message "Eldoc in minibuffer error: %S" err) nil))))
+
+(defun helm-show-info-in-mode-line (str)
+  "Display string STR in mode-line."
+  (save-selected-window
+    (with-current-buffer helm-buffer
+      (let ((mode-line-format (concat " " str)))
+        (force-mode-line-update)
+        (sit-for helm-show-info-in-mode-line-delay))
+      (force-mode-line-update))))
+
+;;; Calculation Result
+;;
+;;
+(defvar helm-source-calculation-result
+  (helm-build-dummy-source "Calculation Result"
+    :filtered-candidate-transformer (lambda (_candidates _source)
+                                      (list
+                                       (condition-case nil
+                                           (calc-eval helm-pattern)
+                                         (error "error"))))
+    :nohighlight t
+    :action '(("Copy result to kill-ring" . (lambda (candidate)
+                                              (kill-new candidate)
+                                              (message "Result \"%s\" copied to kill-ring"
+                                                       candidate)))
+              ("Copy operation to kill-ring" . (lambda (_candidate)
+                                                 (kill-new helm-input)
+                                                 (message "Calculation copied to kill-ring"))))))
+
+;;;###autoload
+(defun helm-eval-expression (arg)
+  "Preconfigured helm for `helm-source-evaluation-result'."
+  (interactive "P")
+  (helm :sources (helm-build-evaluation-result-source)
+        :input (when arg (thing-at-point 'sexp))
+        :buffer "*helm eval*"
+        :echo-input-in-header-line nil
+        :history 'read-expression-history
+        :keymap helm-eval-expression-map))
+
+(defvar eldoc-idle-delay)
+;;;###autoload
+(defun helm-eval-expression-with-eldoc ()
+  "Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support. "
+  (interactive)
+  (let ((timer (run-with-idle-timer
+                eldoc-idle-delay 'repeat
+                'helm-eldoc-show-in-eval)))
+    (unwind-protect
+         (minibuffer-with-setup-hook
+             'helm-eldoc-store-minibuffer
+           (call-interactively 'helm-eval-expression))
+      (and timer (cancel-timer timer))
+      (setq helm-eldoc-active-minibuffers-list
+            (cdr helm-eldoc-active-minibuffers-list)))))
+
+;;;###autoload
+(defun helm-calcul-expression ()
+  "Preconfigured helm for `helm-source-calculation-result'."
+  (interactive)
+  (helm :sources 'helm-source-calculation-result
+        :buffer "*helm calcul*"))
+
+(provide 'helm-eval)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-eval.el ends here
diff --git a/elpa/helm-20160217.958/helm-external.el b/elpa/helm-20160217.958/helm-external.el
new file mode 100644 (file)
index 0000000..693e1c4
--- /dev/null
@@ -0,0 +1,217 @@
+;;; helm-external.el --- Run Externals commands within Emacs with helm completion. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-net)
+
+\f
+(defgroup helm-external nil
+  "External related Applications and libraries for Helm." 
+  :group 'helm)
+
+(defcustom helm-raise-command nil
+  "A shell command to jump to a window running specific program.
+Need external program wmctrl.
+This will be use with `format', so use something like \"wmctrl -xa %s\"."
+  :type 'string
+  :group 'helm-external)
+
+(defcustom helm-external-programs-associations nil
+  "Alist to store externals programs associated with file extension.
+This variable overhide setting in .mailcap file.
+e.g : '\(\(\"jpg\" . \"gqview\"\) (\"pdf\" . \"xpdf\"\)\) "
+  :type '(alist :key-type string :value-type string)
+  :group 'helm-external)
+
+(defcustom helm-default-external-file-browser "nautilus"
+  "Default external file browser for your system.
+Directories will be opened externally with it when
+opening file externally in `helm-find-files'.
+Set to nil if you do not have external file browser
+or do not want to use it.
+Windows users should set that to \"explorer.exe\"."
+  :group 'helm-external
+  :type  'string)
+
+\f
+;;; Internals
+(defvar helm-external-command-history nil)
+(defvar helm-external-commands-list nil
+  "A list of all external commands the user can execute.
+If this variable is not set by the user, it will be calculated
+automatically.")
+
+(defun helm-external-commands-list-1 (&optional sort)
+  "Returns a list of all external commands the user can execute.
+If `helm-external-commands-list' is non-nil it will
+return its contents.  Else it calculates all external commands
+and sets `helm-external-commands-list'."
+  (helm-aif helm-external-commands-list
+      it
+    (setq helm-external-commands-list
+          (cl-loop
+                for dir in (split-string (getenv "PATH") path-separator)
+                when (and (file-exists-p dir) (file-accessible-directory-p dir))
+                for lsdir = (cl-loop for i in (directory-files dir t)
+                                  for bn = (file-name-nondirectory i)
+                                  when (and (not (member bn completions))
+                                            (not (file-directory-p i))
+                                            (file-executable-p i))
+                                  collect bn)
+                append lsdir into completions
+                finally return
+                (if sort (sort completions 'string-lessp) completions)))))
+
+(defun helm-run-or-raise (exe &optional file)
+  "Generic command that run asynchronously EXE.
+If EXE is already running just jump to his window if `helm-raise-command'
+is non--nil.
+When FILE argument is provided run EXE with FILE.
+In this case EXE must be provided as \"EXE %s\"."
+  (let* ((real-com (car (split-string (replace-regexp-in-string
+                                       "%s" "" exe))))
+         (proc     (if file (concat real-com " " file) real-com))
+         process-connection-type)
+    (if (get-process proc)
+        (if helm-raise-command
+            (shell-command  (format helm-raise-command real-com))
+          (error "Error: %s is already running" real-com))
+      (when (cl-loop for i in helm-external-commands-list thereis (string= real-com i))
+        (message "Starting %s..." real-com)
+        (if file
+            (start-process-shell-command
+             proc nil (format exe (shell-quote-argument
+                                   (if (eq system-type 'windows-nt)
+                                       (helm-w32-prepare-filename file)
+                                     file))))
+          (start-process-shell-command proc nil real-com))
+        (set-process-sentinel
+         (get-process proc)
+         (lambda (process event)
+             (when (and (string= event "finished\n")
+                        helm-raise-command
+                        (not (helm-get-pid-from-process-name real-com)))
+               (shell-command  (format helm-raise-command "emacs")))
+             (message "%s process...Finished." process))))
+      (setq helm-external-commands-list
+            (cons real-com
+                  (delete real-com helm-external-commands-list))))))
+
+(defun helm-get-mailcap-for-file (filename)
+  "Get the command to use for FILENAME from mailcap files.
+The command is like <command %s> and is meant to use with `format'."
+  (mailcap-parse-mailcaps)
+  (let* ((ext  (file-name-extension filename))
+         (mime (when ext (mailcap-extension-to-mime ext)))
+         (result (when mime (mailcap-mime-info mime))))
+    ;; If elisp file have no associations in .mailcap
+    ;; `mailcap-maybe-eval' is returned, in this case just return nil.
+    (when (stringp result) result)))
+
+(defun helm-get-default-program-for-file (filename)
+  "Try to find a default program to open FILENAME.
+Try first in `helm-external-programs-associations' and then in mailcap file
+if nothing found return nil."
+  (let* ((ext      (file-name-extension filename))
+         (def-prog (assoc-default ext helm-external-programs-associations)))
+    (cond ((and def-prog (not (string= def-prog "")))
+           (concat def-prog " %s"))
+          ((and helm-default-external-file-browser
+                (file-directory-p filename))
+           (concat helm-default-external-file-browser " %s"))
+          (t (helm-get-mailcap-for-file filename)))))
+
+(defun helm-open-file-externally (file)
+  "Open FILE with an external program.
+Try to guess which program to use with `helm-get-default-program-for-file'.
+If not found or a prefix arg is given query the user which tool to use."
+  (let* ((fname          (expand-file-name file))
+         (collection     (helm-external-commands-list-1 'sort))
+         (def-prog       (helm-get-default-program-for-file fname))
+         (real-prog-name (if (or helm-current-prefix-arg (not def-prog))
+                             ;; Prefix arg or no default program.
+                             (prog1
+                                 (helm-comp-read
+                                  "Program: " collection
+                                  :must-match t
+                                  :name "Open file Externally"
+                                  :del-input nil
+                                  :history helm-external-command-history)
+                               ;; Always prompt to set this program as default.
+                               (setq def-prog nil))
+                           ;; No prefix arg or default program exists.
+                           (replace-regexp-in-string " %s\\| '%s'" "" def-prog)))
+         (program        (concat real-prog-name " %s")))
+    (unless (or def-prog ; Association exists, no need to record it.
+                ;; Don't try to record non--filenames associations (e.g urls).
+                (not (file-exists-p fname)))
+      (when
+          (y-or-n-p
+           (format
+            "Do you want to make `%s' the default program for this kind of files? "
+            real-prog-name))
+        (helm-aif (assoc (file-name-extension fname)
+                         helm-external-programs-associations)
+            (setq helm-external-programs-associations
+                  (delete it helm-external-programs-associations)))
+        (push (cons (file-name-extension fname)
+                    (helm-read-string
+                     "Program (Add args maybe and confirm): " real-prog-name))
+              helm-external-programs-associations)
+        (customize-save-variable 'helm-external-programs-associations
+                                 helm-external-programs-associations)))
+    (helm-run-or-raise program file)
+    (setq helm-external-command-history
+          (cons real-prog-name
+                (delete real-prog-name
+                        (cl-loop for i in helm-external-command-history
+                              when (executable-find i) collect i))))))
+
+;;;###autoload
+(defun helm-run-external-command (program)
+  "Preconfigured `helm' to run External PROGRAM asyncronously from Emacs.
+If program is already running exit with error.
+You can set your own list of commands with
+`helm-external-commands-list'."
+  (interactive (list
+                (helm-comp-read
+                 "RunProgram: "
+                 (helm-external-commands-list-1 'sort)
+                 :must-match t
+                 :del-input nil
+                 :name "External Commands"
+                 :history helm-external-command-history)))
+  (helm-run-or-raise program)
+  (setq helm-external-command-history
+        (cons program (delete program
+                              (cl-loop for i in helm-external-command-history
+                                    when (executable-find i) collect i)))))
+
+
+(provide 'helm-external)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-external ends here
diff --git a/elpa/helm-20160217.958/helm-files.el b/elpa/helm-20160217.958/helm-files.el
new file mode 100644 (file)
index 0000000..8421597
--- /dev/null
@@ -0,0 +1,3516 @@
+;;; helm-files.el --- helm file browser and related. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+\f
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-types)
+(require 'helm-utils)
+(require 'helm-external)
+(require 'helm-grep)
+(require 'helm-help)
+(require 'helm-locate)
+(require 'helm-bookmark)
+(require 'helm-tags)
+(require 'helm-buffers)
+(require 'thingatpt)
+(require 'ffap)
+(require 'dired-aux)
+(require 'dired-x)
+(require 'tramp)
+(require 'image-dired)
+
+(declare-function find-library-name "find-func.el" (library))
+(declare-function w32-shell-execute "ext:w32fns.c" (operation document &optional parameters show-flag))
+(declare-function gnus-dired-attach "ext:gnus-dired.el" (files-to-attach))
+(declare-function image-dired-display-image "image-dired.el" (file &optional original-size))
+(declare-function image-dired-update-property "image-dired.el" (prop value))
+(declare-function eshell-read-aliases-list "em-alias")
+(declare-function eshell-send-input "esh-mode" (&optional use-region queue-p no-newline))
+(declare-function eshell-kill-input "esh-mode")
+(declare-function eshell-bol "esh-mode")
+(declare-function eshell-quote-argument "esh-arg.el")
+(declare-function helm-ls-git-ls "ext:helm-ls-git")
+(declare-function helm-hg-find-files-in-project "ext:helm-ls-hg")
+(declare-function helm-gid "helm-id-utils.el")
+(declare-function helm-ls-svn-ls "ext:helm-ls-svn")
+
+(defvar recentf-list)
+(defvar helm-mm-matching-method)
+
+\f
+(defgroup helm-files nil
+  "Files applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-boring-file-regexp-list
+  (mapcar (lambda (f)
+            (concat
+             (rx-to-string
+              (replace-regexp-in-string
+               "/$" "" f) t) "$"))
+          completion-ignored-extensions)
+  "The regexp list matching boring files."
+  :group 'helm-files
+  :type  '(repeat (choice regexp)))
+
+(defcustom helm-for-files-preferred-list
+  '(helm-source-buffers-list
+    helm-source-recentf
+    helm-source-bookmarks
+    helm-source-file-cache
+    helm-source-files-in-current-dir
+    helm-source-locate)
+  "Your preferred sources to find files."
+  :type '(repeat (choice symbol))
+  :group 'helm-files)
+
+(defcustom helm-tramp-verbose 0
+  "Just like `tramp-verbose' but specific to helm.
+When set to 0 don't show tramp messages in helm.
+If you want to have the default tramp messages set it to 3."
+  :type 'integer
+  :group 'helm-files)
+
+(defcustom helm-ff-auto-update-initial-value nil
+  "Auto update when only one candidate directory is matched.
+Default value when starting `helm-find-files' is nil because
+it prevent using <backspace> to delete char backward and by the way
+confuse beginners.
+For a better experience with `helm-find-files' set this to non--nil
+and use C-<backspace> to toggle it."
+  :group 'helm-files
+  :type  'boolean)
+
+(defcustom helm-ff-lynx-style-map t
+  "Use arrow keys to navigate with `helm-find-files'.
+You will have to restart Emacs or reeval `helm-find-files-map'
+and `helm-read-file-map' for this take effect."
+  :group 'helm-files
+  :type 'boolean)
+
+(defcustom helm-ff-history-max-length 100
+  "Number of elements shown in `helm-find-files' history."
+  :group 'helm-files
+  :type 'integer)
+
+(defcustom helm-ff-fuzzy-matching t
+  "Enable fuzzy matching for `helm-find-files' when non--nil.
+See `helm-ff--transform-pattern-for-completion' for more info."
+  :group 'helm-files
+  :type 'boolean)
+
+(defcustom helm-ff-tramp-not-fancy t
+  "No colors when listing remote files when set to non--nil.
+This make listing much faster, specially on slow machines."
+  :group 'helm-files
+  :type  'boolean)
+
+(defcustom helm-ff-exif-data-program "exiftran"
+  "Program used to extract exif data of an image file."
+  :group 'helm-files
+  :type 'string)
+
+(defcustom helm-ff-exif-data-program-args "-d"
+  "Arguments used for `helm-ff-exif-data-program'."
+  :group 'helm-files
+  :type 'string)
+
+(defcustom helm-ff-newfile-prompt-p t
+  "Whether Prompt or not when creating new file.
+This set `ffap-newfile-prompt'."
+  :type  'boolean
+  :group 'helm-files)
+
+(defcustom helm-ff-avfs-directory "~/.avfs"
+  "The default avfs directory, usually '~/.avfs'.
+When this is set you will be able to expand archive filenames with `C-j'
+inside an avfs directory mounted with mountavfs.
+See <http://sourceforge.net/projects/avf/>."
+  :type  'string
+  :group 'helm-files)
+
+(defcustom helm-ff-file-compressed-list '("gz" "bz2" "zip" "7z")
+  "Minimal list of compressed files extension."
+  :type  '(repeat (choice string))
+  :group 'helm-files)
+
+(defcustom helm-ff-printer-list nil
+  "A list of available printers on your system.
+When non--nil let you choose a printer to print file.
+Otherwise when nil the variable `printer-name' will be used.
+On Unix based systems (lpstat command needed) you don't need to set this,
+`helm-ff-find-printers' will find a list of available printers for you."
+  :type '(repeat (choice string))
+  :group 'helm-files)
+
+(defcustom helm-ff-transformer-show-only-basename t
+  "Show only basename of candidates in `helm-find-files'.
+This can be toggled at anytime from `helm-find-files' with \
+\\<helm-find-files-map>\\[helm-ff-run-toggle-basename]."
+  :type 'boolean
+  :group 'helm-files)
+
+(defcustom helm-ff-signal-error-on-dot-files t
+  "Signal error when file is `.' or `..' on file deletion when non--nil.
+Default is non--nil.
+WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree."
+  :group 'helm-files
+  :type  'boolean)
+
+(defcustom helm-ff-search-library-in-sexp nil
+  "Search for library in `require' and `declare-function' sexp."
+  :group 'helm-files
+  :type  'boolean)
+
+(defcustom helm-tooltip-hide-delay 25
+  "Hide tooltips automatically after this many seconds."
+  :group 'helm-files
+  :type 'integer)
+
+(defcustom helm-ff-file-name-history-use-recentf nil
+  "Use `recentf-list' instead of `file-name-history' in `helm-find-files'."
+  :group 'helm-files
+  :type 'boolean)
+
+(defcustom helm-ff-skip-boring-files nil
+  "Non--nil to skip files matching regexps in `helm-boring-file-regexp-list'.
+This take effect in `helm-find-files' and file completion used by `helm-mode'
+i.e `helm-read-file-name'."
+  :group 'helm-files
+  :type  'boolean)
+
+(defcustom helm-ff-candidate-number-limit 5000
+  "The `helm-candidate-number-limit' for `helm-find-files', `read-file-name' and friends."
+  :group 'helm-files
+  :type 'integer)
+
+(defcustom helm-findutils-skip-boring-files t
+  "Ignore files matching regexps in `completion-ignored-extensions'."
+  :group 'helm-files
+  :type  'boolean)
+
+(defcustom helm-findutils-search-full-path nil
+  "Search in full path with shell command find when non--nil.
+I.e use the -path/ipath arguments of find instead of -name/iname."
+  :group 'helm-files
+  :type 'boolean)
+
+(defcustom helm-files-save-history-extra-sources
+  '("Find" "Locate" "Recentf"
+    "Files from Current Directory" "File Cache")
+  "Extras source that save candidate to `file-name-history'."
+  :group 'helm-files
+  :type '(repeat (choice string)))
+
+(defcustom helm-find-files-before-init-hook nil
+  "Hook that run before initialization of `helm-find-files'."
+  :group 'helm-files
+  :type 'hook)
+
+(defcustom helm-find-files-after-init-hook nil
+  "Hook that run after initialization of `helm-find-files'."
+  :group 'helm-files
+  :type 'hook)
+
+(defcustom helm-multi-files-toggle-locate-binding "C-c p"
+  "Default binding to switch back and forth locate in `helm-multi-files'."
+  :group 'helm-files
+  :type 'string)
+
+(defcustom helm-find-files-bookmark-prefix "Helm-find-files: "
+  "bookmark name prefix of `helm-find-files' sessions."
+  :group 'helm-files
+  :type 'string)
+
+(defcustom helm-ff-guess-ffap-filenames nil
+  "Use ffap to guess local filenames at point in `helm-find-files'.
+This doesn't disable url or mail at point, see
+`helm-ff-guess-ffap-urls' for this."
+  :group 'helm-files
+  :type 'boolean)
+
+(defcustom helm-ff-guess-ffap-urls t
+  "Use ffap to guess local urls at point in `helm-find-files'.
+This doesn't disable guessing filenames at point,
+see `helm-ff-guess-ffap-filenames' for this."
+  :group 'helm-files
+  :type 'boolean)
+
+(defcustom helm-substitute-in-filename-stay-on-remote nil
+  "Don't switch back to local filesystem when expanding pattern with / or ~/."
+  :group 'helm-files
+  :type 'boolean)
+
+\f
+;;; Faces
+;;
+;;
+(defgroup helm-files-faces nil
+  "Customize the appearance of helm-files."
+  :prefix "helm-"
+  :group 'helm-files
+  :group 'helm-faces)
+
+(defface helm-ff-prefix
+    '((t (:background "yellow" :foreground "black")))
+  "Face used to prefix new file or url paths in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-executable
+    '((t (:foreground "green")))
+  "Face used for executable files in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-directory
+    '((t (:foreground "DarkRed" :background "LightGray")))
+  "Face used for directories in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-dotted-directory
+    '((t (:foreground "black" :background "DimGray")))
+  "Face used for dotted directories in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-dotted-symlink-directory
+    '((t (:foreground "DarkOrange" :background "DimGray")))
+  "Face used for dotted symlinked directories in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-symlink
+    '((t (:foreground "DarkOrange")))
+  "Face used for symlinks in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-invalid-symlink
+    '((t (:foreground "black" :background "red")))
+  "Face used for invalid symlinks in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-ff-file
+    '((t (:inherit font-lock-builtin-face)))
+  "Face used for file names in `helm-find-files'."
+  :group 'helm-files-faces)
+
+(defface helm-history-deleted
+    '((t (:inherit helm-ff-invalid-symlink)))
+  "Face used for deleted files in `file-name-history'."
+  :group 'helm-files-faces)
+
+(defface helm-history-remote
+    '((t (:foreground "Indianred1")))
+  "Face used for remote files in `file-name-history'."
+  :group 'helm-files-faces)
+
+\f
+;;; Helm-find-files - The helm file browser.
+;;
+;; Keymaps
+(defvar helm-find-files-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "C-]")           'helm-ff-run-toggle-basename)
+    (define-key map (kbd "C-x C-f")       'helm-ff-run-locate)
+    (define-key map (kbd "C-x C-d")       'helm-ff-run-browse-project)
+    (define-key map (kbd "C-x r m")       'helm-ff-bookmark-set)
+    (define-key map (kbd "C-x r b")       'helm-find-files-toggle-to-bookmark)
+    (define-key map (kbd "C-s")           'helm-ff-run-grep)
+    (define-key map (kbd "M-g s")         'helm-ff-run-grep)
+    (define-key map (kbd "M-g p")         'helm-ff-run-pdfgrep)
+    (define-key map (kbd "M-g z")         'helm-ff-run-zgrep)
+    (define-key map (kbd "M-g a")         'helm-ff-run-grep-ag)
+    (define-key map (kbd "M-g g")         'helm-ff-run-git-grep)
+    (define-key map (kbd "M-g i")         'helm-ff-run-gid)
+    (define-key map (kbd "M-.")           'helm-ff-run-etags)
+    (define-key map (kbd "M-R")           'helm-ff-run-rename-file)
+    (define-key map (kbd "M-C")           'helm-ff-run-copy-file)
+    (define-key map (kbd "M-B")           'helm-ff-run-byte-compile-file)
+    (define-key map (kbd "M-L")           'helm-ff-run-load-file)
+    (define-key map (kbd "M-S")           'helm-ff-run-symlink-file)
+    (define-key map (kbd "M-H")           'helm-ff-run-hardlink-file)
+    (define-key map (kbd "M-D")           'helm-ff-run-delete-file)
+    (define-key map (kbd "M-K")           'helm-ff-run-kill-buffer-persistent)
+    (define-key map (kbd "C-c d")         'helm-ff-persistent-delete)
+    (define-key map (kbd "M-e")           'helm-ff-run-switch-to-eshell)
+    (define-key map (kbd "C-c i")         'helm-ff-run-complete-fn-at-point)
+    (define-key map (kbd "C-c o")         'helm-ff-run-switch-other-window)
+    (define-key map (kbd "C-c C-o")       'helm-ff-run-switch-other-frame)
+    (define-key map (kbd "C-c C-x")       'helm-ff-run-open-file-externally)
+    (define-key map (kbd "C-c X")         'helm-ff-run-open-file-with-default-tool)
+    (define-key map (kbd "M-!")           'helm-ff-run-eshell-command-on-file)
+    (define-key map (kbd "M-%")           'helm-ff-run-query-replace-on-marked)
+    (define-key map (kbd "C-c =")         'helm-ff-run-ediff-file)
+    (define-key map (kbd "M-=")           'helm-ff-run-ediff-merge-file)
+    (define-key map (kbd "M-p")           'helm-ff-run-switch-to-history)
+    (define-key map (kbd "C-c h")         'helm-ff-file-name-history)
+    (define-key map (kbd "M-i")           'helm-ff-properties-persistent)
+    (define-key map (kbd "C-}")           'helm-narrow-window)
+    (define-key map (kbd "C-{")           'helm-enlarge-window)
+    (define-key map (kbd "C-<backspace>") 'helm-ff-run-toggle-auto-update)
+    (define-key map (kbd "C-c <DEL>")     'helm-ff-run-toggle-auto-update)
+    (define-key map (kbd "C-c C-a")       'helm-ff-run-gnus-attach-files)
+    (define-key map (kbd "C-c p")         'helm-ff-run-print-file)
+    (define-key map (kbd "C-c /")         'helm-ff-run-find-sh-command)
+    ;; Next 2 have no effect if candidate is not an image file.
+    (define-key map (kbd "M-l")           'helm-ff-rotate-left-persistent)
+    (define-key map (kbd "M-r")           'helm-ff-rotate-right-persistent)
+    (define-key map (kbd "C-l")           'helm-find-files-up-one-level)
+    (define-key map (kbd "C-r")           'helm-find-files-down-last-level)
+    (define-key map (kbd "C-c r")         'helm-ff-run-find-file-as-root)
+    (define-key map (kbd "C-x C-v")       'helm-ff-run-find-alternate-file)
+    (define-key map (kbd "C-c @")         'helm-ff-run-insert-org-link)
+    (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward
+                                  nil nil 'helm-ff-delete-char-backward--exit-fn)
+    (when helm-ff-lynx-style-map
+      (define-key map (kbd "<left>")      'helm-find-files-up-one-level)
+      (define-key map (kbd "<right>")     'helm-execute-persistent-action))
+    (delq nil map))
+  "Keymap for `helm-find-files'.")
+
+(defvar helm-read-file-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "<C-return>")    'helm-cr-empty-string)
+    (define-key map (kbd "<M-RET>")       'helm-cr-empty-string)
+    (define-key map (kbd "C-]")           'helm-ff-run-toggle-basename)
+    (define-key map (kbd "C-.")           'helm-find-files-up-one-level)
+    (define-key map (kbd "C-l")           'helm-find-files-up-one-level)
+    (define-key map (kbd "C-r")           'helm-find-files-down-last-level)
+    (define-key map (kbd "C-c h")         'helm-ff-file-name-history)
+    (define-key map (kbd "C-<backspace>") 'helm-ff-run-toggle-auto-update)
+    (define-key map (kbd "C-c <DEL>")     'helm-ff-run-toggle-auto-update)
+    (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward
+                                  nil nil 'helm-ff-delete-char-backward--exit-fn)
+    (when helm-ff-lynx-style-map
+      (define-key map (kbd "<left>")      'helm-find-files-up-one-level)
+      (define-key map (kbd "<right>")     'helm-execute-persistent-action)
+      (define-key map (kbd "<M-left>")    'helm-previous-source)
+      (define-key map (kbd "<M-right>")   'helm-next-source))
+    (delq nil map))
+  "Keymap for `helm-read-file-name'.")
+
+\f
+;; Internal.
+(defvar helm-find-files-doc-header " (\\<helm-find-files-map>\\[helm-find-files-up-one-level]: Go up one level)"
+  "*The doc that is inserted in the Name header of a find-files or dired source.")
+(defvar helm-ff-auto-update-flag nil
+  "Internal, flag to turn on/off auto-update in `helm-find-files'.
+Don't set it directly, use instead `helm-ff-auto-update-initial-value'.")
+(defvar helm-ff-last-expanded nil
+  "Store last expanded directory or file.")
+(defvar helm-ff-default-directory nil)
+(defvar helm-ff-history nil)
+(defvar helm-ff-cand-to-mark nil)
+(defvar helm-ff-url-regexp
+  "\\`\\(news\\(post\\)?:\\|nntp:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\):/?/?\\).*"
+  "Same as `ffap-url-regexp' but match earlier possible url.")
+(defvar helm-tramp-file-name-regexp "\\`/\\([^[/:]+\\|[^/]+]\\):")
+(defvar helm-marked-buffer-name "*helm marked*")
+(defvar helm-ff--auto-update-state nil)
+(defvar helm-ff--deleting-char-backward nil)
+(defvar helm-multi-files--toggle-locate nil)
+(defvar helm-ff--move-to-first-real-candidate t)
+(defvar helm-find-files--toggle-bookmark nil)
+
+\f
+;;; Helm-find-files
+;;
+;;
+(defcustom helm-find-files-actions
+  (helm-make-actions
+   "Find File" 'helm-find-file-or-marked
+   "Find file in Dired" 'helm-point-file-in-dired
+   (lambda () (and (locate-library "elscreen") "Find file in Elscreen"))
+   'helm-elscreen-find-file
+   "View file" 'view-file
+   "Checksum File" 'helm-ff-checksum
+   "Query replace fnames on marked" 'helm-ff-query-replace-on-marked
+   "Query replace contents on marked" 'helm-ff-query-replace
+   "Query replace regexp contents on marked" 'helm-ff-query-replace-regexp
+   "Serial rename files" 'helm-ff-serial-rename
+   "Serial rename by symlinking files" 'helm-ff-serial-rename-by-symlink
+   "Serial rename by copying files" 'helm-ff-serial-rename-by-copying
+   "Open file with default tool" 'helm-open-file-with-default-tool
+   "Find file in hex dump" 'hexl-find-file
+   "Browse project" 'helm-ff-browse-project
+   "Complete at point `C-c i'" 'helm-insert-file-name-completion-at-point
+   "Insert as org link `C-c @'" 'helm-files-insert-as-org-link
+   "Find shell command `C-c /'" 'helm-ff-find-sh-command
+   "Add marked files to file-cache" 'helm-ff-cache-add-file
+   "Open file externally `C-c C-x, C-u to choose'" 'helm-open-file-externally
+   "Grep File(s) `C-s, C-u Recurse'" 'helm-find-files-grep
+   "Grep current directory with AG" 'helm-find-files-ag
+   "Git grep" 'helm-ff-git-grep
+   "Zgrep File(s) `M-g z, C-u Recurse'" 'helm-ff-zgrep
+   "Gid" 'helm-ff-gid
+   "Switch to Eshell `M-e'" 'helm-ff-switch-to-eshell
+   "Etags `M-., C-u reload tag file'" 'helm-ff-etags-select
+   "Eshell command on file(s) `M-!, C-u take all marked as arguments.'"
+   'helm-find-files-eshell-command-on-file
+   "Find file as root `C-c r'" 'helm-find-file-as-root
+   "Find alternate file" 'find-alternate-file
+   "Ediff File `C-='" 'helm-find-files-ediff-files
+   "Ediff Merge File `C-c ='" 'helm-find-files-ediff-merge-files
+   "Delete File(s) `M-D'" 'helm-delete-marked-files
+   "Copy file(s) `M-C, C-u to follow'" 'helm-find-files-copy
+   "Rename file(s) `M-R, C-u to follow'" 'helm-find-files-rename
+   "Symlink files(s) `M-S, C-u to follow'" 'helm-find-files-symlink
+   "Relsymlink file(s) `C-u to follow'" 'helm-find-files-relsymlink
+   "Hardlink file(s) `M-H, C-u to follow'" 'helm-find-files-hardlink
+   "Find file other window `C-c o'" 'helm-find-files-other-window
+   "Switch to history `M-p'" 'helm-find-files-switch-to-hist
+   "Find file other frame `C-c C-o'" 'find-file-other-frame
+   "Print File `C-c p, C-u to refresh'" 'helm-ff-print
+   "Locate `C-x C-f, C-u to specify locate db'" 'helm-ff-locate)
+  "Actions for `helm-find-files'."
+  :group 'helm-files
+  :type '(alist :key-type string :value-type function))
+
+(defvar helm-source-find-files nil
+  "The main source to browse files.
+Should not be used among other sources.")
+
+(defclass helm-source-ffiles (helm-source-sync)
+  ((header-name
+    :initform (lambda (name)
+                (concat name (substitute-command-keys
+                              helm-find-files-doc-header))))
+   (init
+    :initform (lambda ()
+                (setq helm-ff-auto-update-flag
+                      helm-ff-auto-update-initial-value)
+                (setq helm-ff--auto-update-state
+                      helm-ff-auto-update-flag)
+                (helm-set-local-variable 'bookmark-make-record-function
+                                         #'helm-ff-make-bookmark-record)))
+   (candidates :initform 'helm-find-files-get-candidates)
+   (filtered-candidate-transformer :initform 'helm-ff-sort-candidates)
+   (filter-one-by-one :initform 'helm-ff-filter-candidate-one-by-one)
+   (persistent-action :initform 'helm-find-files-persistent-action)
+   (persistent-help :initform "Hit1 Expand Candidate, Hit2 or (C-u) Find file")
+   (help-message :initform 'helm-ff-help-message)
+   (volatile :initform t)
+   (migemo :initform t)
+   (nohighlight :initform t)
+   (keymap :initform helm-find-files-map)
+   (candidate-number-limit :initform 'helm-ff-candidate-number-limit)
+   (action-transformer
+    :initform 'helm-find-files-action-transformer)
+   (action :initform 'helm-find-files-actions)
+   (before-init-hook :initform 'helm-find-files-before-init-hook)
+   (after-init-hook :initform 'helm-find-files-after-init-hook)))
+
+;; Bookmark handlers.
+;;
+(defun helm-ff-make-bookmark-record ()
+  "The `bookmark-make-record-function' for `helm-find-files'."
+  (with-helm-buffer
+    `((filename . ,helm-ff-default-directory)
+      (presel . ,(helm-get-selection))
+      (handler . helm-ff-bookmark-jump))))
+
+(defun helm-ff-bookmark-jump (bookmark)
+  "bookmark handler for `helm-find-files'."
+  (let ((fname (bookmark-prop-get bookmark 'filename))
+        (presel (bookmark-prop-get bookmark 'presel)))
+    (helm-find-files-1 fname (if helm-ff-transformer-show-only-basename
+                                 (helm-basename presel)
+                                 presel))))
+
+(defun helm-ff-bookmark-set ()
+  "Record `helm-find-files' session in bookmarks."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-buffer
+      (bookmark-set
+       (concat helm-find-files-bookmark-prefix
+               (abbreviate-file-name helm-ff-default-directory))))
+    (message "Helm find files session bookmarked! ")))
+(put 'helm-ff-bookmark-set 'helm-only t)
+
+(defun helm-dwim-target-directory ()
+  "Return value of `default-directory' of buffer in other window.
+If there is only one window return the value ot `default-directory'
+for current buffer."
+  (with-helm-current-buffer
+    (let ((num-windows (length (remove (get-buffer-window helm-marked-buffer-name)
+                                       (window-list)))))
+      (expand-file-name
+       (if (> num-windows 1)
+           (save-selected-window
+             (other-window 1)
+             default-directory)
+           ;; Using the car of *ff-history allow
+           ;; allow staying in the directory visited instead of current.
+           (or (car-safe helm-ff-history) default-directory))))))
+
+(defun helm-find-files-do-action (action)
+  "Generic function for creating actions from `helm-source-find-files'.
+ACTION must be an action supported by `helm-dired-action'."
+  (let* ((ifiles (mapcar 'expand-file-name ; Allow modify '/foo/.' -> '/foo'
+                         (helm-marked-candidates :with-wildcard t)))
+         (cand   (helm-get-selection)) ; Target
+         (prompt (format "%s %s file(s) to: "
+                         (capitalize (symbol-name action))
+                         (length ifiles)))
+         helm-ff--move-to-first-real-candidate
+         (helm-always-two-windows t)
+         (helm-reuse-last-window-split-state t)
+         (helm-split-window-default-side
+          (eq helm-split-window-default-side 'same))
+         helm-split-window-in-side-p
+         (parg   helm-current-prefix-arg)
+         helm-display-source-at-screen-top ; prevent setting window-start.
+         helm-ff-auto-update-initial-value
+         (dest   (with-helm-display-marked-candidates
+                   helm-marked-buffer-name
+                   (mapcar (lambda (f)
+                               (if (file-directory-p f)
+                                   (concat (helm-basename f) "/")
+                                 (helm-basename f)))
+                           ifiles)
+                   (with-helm-current-buffer
+                     (helm-read-file-name
+                      prompt
+                      :preselect (unless (cdr ifiles)
+                                   (if helm-ff-transformer-show-only-basename
+                                       (helm-basename cand) cand))
+                      :initial-input (helm-dwim-target-directory)
+                      :history (helm-find-files-history :comp-read nil))))))
+    (helm-dired-action
+     dest :files ifiles :action action :follow parg)))
+
+(defun helm-find-files-copy (_candidate)
+  "Copy files from `helm-find-files'."
+  (helm-find-files-do-action 'copy))
+
+(defun helm-find-files-rename (_candidate)
+  "Rename files from `helm-find-files'."
+  (helm-find-files-do-action 'rename))
+
+(defun helm-find-files-symlink (_candidate)
+  "Symlink files from `helm-find-files'."
+  (helm-find-files-do-action 'symlink))
+
+(defun helm-find-files-relsymlink (_candidate)
+  "Relsymlink files from `helm-find-files'."
+  (helm-find-files-do-action 'relsymlink))
+
+(defun helm-find-files-hardlink (_candidate)
+  "Hardlink files from `helm-find-files'."
+  (helm-find-files-do-action 'hardlink))
+
+(defun helm-find-files-other-window (_candidate)
+  "Keep current-buffer and open files in separate windows."
+  (let* ((files (helm-marked-candidates))
+         (buffers (mapcar 'find-file-noselect files)))
+    (switch-to-buffer-other-window (car buffers))
+    (helm-aif (cdr buffers)
+        (save-selected-window
+          (cl-loop for buffer in it
+                   do (progn
+                        (select-window (split-window))
+                        (switch-to-buffer buffer)))))))
+
+(defun helm-find-files-byte-compile (_candidate)
+  "Byte compile elisp files from `helm-find-files'."
+  (let ((files    (helm-marked-candidates :with-wildcard t))
+        (parg     helm-current-prefix-arg))
+    (cl-loop for fname in files
+          do (byte-compile-file fname parg))))
+
+(defun helm-find-files-load-files (_candidate)
+  "Load elisp files from `helm-find-files'."
+  (let ((files    (helm-marked-candidates :with-wildcard t)))
+    (cl-loop for fname in files
+          do (load fname))))
+
+(defun helm-find-files-ediff-files-1 (candidate &optional merge)
+  "Generic function to ediff/merge files in `helm-find-files'."
+  (let* ((bname  (helm-basename candidate))
+         (marked (helm-marked-candidates :with-wildcard t))
+         (prompt (if merge "Ediff Merge `%s' With File: "
+                   "Ediff `%s' With File: "))
+         (fun    (if merge 'ediff-merge-files 'ediff-files))
+         (input  (helm-dwim-target-directory))
+         (presel (if helm-ff-transformer-show-only-basename
+                     (helm-basename candidate)
+                   (expand-file-name
+                    (helm-basename candidate)
+                    input))))
+    (if (= (length marked) 2)
+        (funcall fun (car marked) (cadr marked))
+      (funcall fun candidate (helm-read-file-name
+                              (format prompt bname)
+                              :initial-input input
+                              :preselect presel)))))
+
+(defun helm-find-files-ediff-files (candidate)
+  (helm-find-files-ediff-files-1 candidate))
+
+(defun helm-find-files-ediff-merge-files (candidate)
+  (helm-find-files-ediff-files-1 candidate 'merge))
+
+(defun helm-find-files-grep (_candidate)
+  "Default action to grep files from `helm-find-files'."
+  (helm-do-grep-1 (helm-marked-candidates :with-wildcard t)
+                  helm-current-prefix-arg))
+
+(defun helm-ff-git-grep (_candidate)
+  "Default action to git-grep `helm-ff-default-directory'."
+  (helm-grep-git-1 helm-ff-default-directory helm-current-prefix-arg))
+
+(defun helm-find-files-ag (_candidate)
+  (helm-grep-ag-1 helm-ff-default-directory))
+
+(defun helm-ff-zgrep (_candidate)
+  "Default action to zgrep files from `helm-find-files'."
+  (helm-ff-zgrep-1 (helm-marked-candidates :with-wildcard t) helm-current-prefix-arg))
+
+(defun helm-ff-pdfgrep (_candidate)
+  "Default action to pdfgrep files from `helm-find-files'."
+  (let ((cands (cl-loop for file in (helm-marked-candidates :with-wildcard t)
+                     if (or (string= (file-name-extension file) "pdf")
+                            (string= (file-name-extension file) "PDF"))
+                     collect file))
+        (helm-pdfgrep-default-function 'helm-pdfgrep-init))
+    (when cands
+      (helm-do-pdfgrep-1 cands))))
+
+(defun helm-ff-etags-select (candidate)
+  "Default action to jump to etags from `helm-find-files'."
+  (when (get-buffer helm-action-buffer)
+    (kill-buffer helm-action-buffer))
+  (let* ((source-name (assoc-default 'name (helm-get-current-source)))
+         (default-directory (if (string= source-name "Find Files")
+                                helm-ff-default-directory
+                              (file-name-directory candidate))))
+    (helm-etags-select helm-current-prefix-arg)))
+
+(defun helm-find-files-switch-to-hist (_candidate)
+  "Switch to helm-find-files history."
+  (helm-find-files t))
+
+(defvar eshell-command-aliases-list nil)
+(defvar helm-eshell-command-on-file-input-history nil)
+(defun helm-find-files-eshell-command-on-file-1 (&optional map)
+  "Run `eshell-command' on CANDIDATE or marked candidates.
+This is done possibly with an eshell alias, if no alias found, you can type in
+an eshell command.
+
+Basename of CANDIDATE can be a wild-card.
+e.g you can do \"eshell-command command *.el\"
+Where \"*.el\" is the CANDIDATE.
+
+It is possible to do eshell-command command <CANDIDATE> <some more args>
+like this: \"command %s some more args\".
+
+If MAP is given run `eshell-command' on all marked files at once,
+Otherwise, run `eshell-command' on each marked files.
+In other terms, with a prefix arg do on the three marked files
+\"foo\" \"bar\" \"baz\":
+
+\"eshell-command command foo bar baz\"
+
+otherwise do
+
+\"eshell-command command foo\"
+\"eshell-command command bar\"
+\"eshell-command command baz\"
+
+Note:
+If `eshell' or `eshell-command' have not been run once,
+or if you have no eshell aliases `eshell-command-aliases-list'
+will not be loaded first time you use this."
+  (when (or eshell-command-aliases-list
+            (y-or-n-p "Eshell is not loaded, run eshell-command without alias anyway? "))
+    (and eshell-command-aliases-list (eshell-read-aliases-list))
+    (let* ((cand-list (helm-marked-candidates))
+           (default-directory (or helm-ff-default-directory
+                                  ;; If candidate is an url *-ff-default-directory is nil
+                                  ;; so keep value of default-directory.
+                                  default-directory))
+           (command (helm-comp-read
+                     "Command: "
+                     (cl-loop for (a . c) in eshell-command-aliases-list
+                              when (string-match "\\(\\$1\\|\\$\\*\\)$" (car c))
+                              collect (propertize a 'help-echo (car c)) into ls
+                              finally return (sort ls 'string<))
+                     :buffer "*helm eshell on file*"
+                     :name "Eshell command"
+                     :mode-line
+                     '("Eshell alias"
+                       "C-h m: Help, \\[universal-argument]: Insert output at point")
+                     :help-message 'helm-esh-help-message
+                     :input-history
+                     'helm-eshell-command-on-file-input-history))
+           (alias-value (car (assoc-default command eshell-command-aliases-list)))
+           cmd-line)
+      (if (or (equal helm-current-prefix-arg '(16))
+              (equal map '(16)))
+          ;; Two time C-u from `helm-comp-read' mean print to current-buffer.
+          ;; i.e `eshell-command' will use this value.
+          (setq current-prefix-arg '(16))
+          ;; Else reset the value of `current-prefix-arg'
+          ;; to avoid printing in current-buffer.
+          (setq current-prefix-arg nil))
+      (if (and (or
+                ;; One prefix-arg have been passed before `helm-comp-read'.
+                ;; If map have been set with C-u C-u (value == '(16))
+                ;; ignore it.
+                (and map (equal map '(4)))
+                ;; One C-u from `helm-comp-read'.
+                (equal helm-current-prefix-arg '(4))
+                ;; An alias that finish with $*
+                (and alias-value
+                     ;; If command is an alias be sure it accept
+                     ;; more than one arg i.e $*.
+                     (string-match "\\$\\*$" alias-value)))
+               (cdr cand-list))
+
+          ;; Run eshell-command with ALL marked files as arguments.
+          ;; This wont work on remote files, because tramp handlers depends
+          ;; on `default-directory' (limitation).
+          (let ((mapfiles (mapconcat 'eshell-quote-argument cand-list " ")))
+            (if (string-match "'%s'\\|\"%s\"\\|%s" command)
+                (setq cmd-line (format command mapfiles)) ; See [1]
+                (setq cmd-line (format "%s %s" command mapfiles)))
+            (helm-log "%S" cmd-line)
+            (eshell-command cmd-line))
+
+          ;; Run eshell-command on EACH marked files.
+          ;; To work with tramp handler we have to call
+          ;; COMMAND on basename of each file, using
+          ;; its basedir as `default-directory'.
+          (cl-loop for f in cand-list
+                   for dir = (and (not (string-match ffap-url-regexp f))
+                                  (helm-basedir f))
+                   for file = (eshell-quote-argument
+                               (format "%s" (if (and dir (file-remote-p dir))
+                                                (helm-basename f) f)))
+                   for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command)
+                                 ;; [1] This allow to enter other args AFTER filename
+                                 ;; i.e <command %s some_more_args>
+                                 (format command file)
+                                 (format "%s %s" command file))
+                   do (let ((default-directory (or dir default-directory)))
+                        (eshell-command com)))))))
+
+(defun helm-find-files-eshell-command-on-file (_candidate)
+  "Run `eshell-command' on CANDIDATE or marked candidates.
+See `helm-find-files-eshell-command-on-file-1' for more info."
+  (helm-find-files-eshell-command-on-file-1 helm-current-prefix-arg))
+
+(defun helm-ff-switch-to-eshell (_candidate)
+  "Switch to eshell and cd to `helm-ff-default-directory'."
+  (let ((cd-eshell (lambda ()
+                       (eshell-kill-input)
+                       (goto-char (point-max))
+                       (insert
+                        (format "cd '%s'" helm-ff-default-directory))
+                       (eshell-send-input))))
+    (if (get-buffer "*eshell*")
+        (switch-to-buffer "*eshell*")
+      (call-interactively 'eshell))
+    (unless (get-buffer-process (current-buffer))
+      (funcall cd-eshell))))
+
+(defun helm-ff-serial-rename-action (method)
+  "Rename all marked files in `helm-ff-default-directory' with METHOD.
+See `helm-ff-serial-rename-1'."
+  (let* ((helm--reading-passwd-or-string t)
+         (cands     (helm-marked-candidates :with-wildcard t))
+         (def-name  (car cands))
+         (name      (helm-read-string "NewName: "
+                                      (replace-regexp-in-string
+                                       "[0-9]+$" ""
+                                       (helm-basename
+                                        def-name
+                                        (file-name-extension def-name)))))
+         (start     (read-number "StartAtNumber: "))
+         (extension (helm-read-string "Extension: "
+                                      (file-name-extension (car cands))))
+         (dir       (expand-file-name
+                     (helm-read-file-name
+                      "Serial Rename to directory: "
+                      :initial-input
+                      (expand-file-name helm-ff-default-directory)
+                      :test 'file-directory-p
+                      :must-match t)))
+         done)
+    (with-helm-display-marked-candidates
+      helm-marked-buffer-name (mapcar 'helm-basename cands)
+      (if (y-or-n-p
+           (format "Rename %s file(s) to <%s> like this ?\n%s "
+                   (length cands) dir (format "%s <-> %s%s.%s"
+                                              (helm-basename (car cands))
+                                              name start extension)))
+          (progn
+            (helm-ff-serial-rename-1
+             dir cands name start extension :method method)
+            (setq done t)
+            (message nil))))
+    (if done
+        (with-helm-current-buffer (helm-find-files-1 dir))
+      (message "Operation aborted"))))
+
+(defun helm-ff-member-directory-p (file directory)
+  (let ((dir-file (expand-file-name
+                   (file-name-as-directory (file-name-directory file))))
+        (cur-dir  (expand-file-name (file-name-as-directory directory))))
+    (string= dir-file cur-dir)))
+
+(cl-defun helm-ff-serial-rename-1
+    (directory collection new-name start-at-num extension &key (method 'rename))
+  "rename files in COLLECTION to DIRECTORY with the prefix name NEW-NAME.
+Rename start at number START-AT-NUM - ex: prefixname-01.jpg.
+EXTENSION is the file extension to use, in empty prompt,
+reuse the original extension of file.
+METHOD can be one of rename, copy or symlink.
+Files will be renamed if they are files of current directory, otherwise they
+will be treated with METHOD.
+Default METHOD is rename."
+  ;; Maybe remove directories selected by error in collection.
+  (setq collection (cl-remove-if 'file-directory-p collection))
+  (let* ((tmp-dir  (file-name-as-directory
+                    (concat (file-name-as-directory directory)
+                            (symbol-name (cl-gensym "tmp")))))
+         (fn       (cl-case method
+                     (copy    'copy-file)
+                     (symlink 'make-symbolic-link)
+                     (rename  'rename-file)
+                     (t (error "Error: Unknown method %s" method)))))
+    (make-directory tmp-dir)
+    (unwind-protect
+         (progn
+           ;; Rename all files to tmp-dir with new-name.
+           ;; If files are not from start directory, use method
+           ;; to move files to tmp-dir.
+           (cl-loop for i in collection
+                 for count from start-at-num
+                 for fnum = (if (< count 10) "0%s" "%s")
+                 for nname = (concat tmp-dir new-name (format fnum count)
+                                     (if (not (string= extension ""))
+                                         (format ".%s" (replace-regexp-in-string
+                                                        "[.]" "" extension))
+                                       (file-name-extension i 'dot)))
+                 do (if (helm-ff-member-directory-p i directory)
+                        (rename-file i nname)
+                      (funcall fn i nname)))
+           ;; Now move all from tmp-dir to destination.
+           (cl-loop with dirlist = (directory-files
+                                    tmp-dir t directory-files-no-dot-files-regexp)
+                 for f in dirlist do
+                 (if (file-symlink-p f)
+                     (make-symbolic-link (file-truename f)
+                                         (concat (file-name-as-directory directory)
+                                                 (helm-basename f)))
+                   (rename-file f directory))))
+      (delete-directory tmp-dir t))))
+
+(defun helm-ff-serial-rename (_candidate)
+  "Serial rename all marked files to `helm-ff-default-directory'.
+Rename only file of current directory, and symlink files coming from
+other directories.
+See `helm-ff-serial-rename-1'."
+  (helm-ff-serial-rename-action 'rename))
+
+(defun helm-ff-serial-rename-by-symlink (_candidate)
+  "Serial rename all marked files to `helm-ff-default-directory'.
+Rename only file of current directory, and symlink files coming from
+other directories.
+See `helm-ff-serial-rename-1'."
+  (helm-ff-serial-rename-action 'symlink))
+
+(defun helm-ff-serial-rename-by-copying (_candidate)
+  "Serial rename all marked files to `helm-ff-default-directory'.
+Rename only file of current directory, and copy files coming from
+other directories.
+See `helm-ff-serial-rename-1'."
+  (helm-ff-serial-rename-action 'copy))
+
+(defun helm-ff-query-replace-on-marked-1 (candidates)
+  "Query replace on filenames of CANDIDATES.
+This doesn't replace inside the files, only modify filenames."
+  (with-helm-display-marked-candidates
+    helm-marked-buffer-name
+    (mapcar 'helm-basename candidates)
+    (let* ((regexp (read-string "Replace regexp on filename(s): "))
+           (str    (read-string (format "Replace regexp `%s' with: " regexp))))
+      (cl-loop with query = "y"
+               with count = 0
+               for old in candidates
+               for new = (concat (helm-basedir old)
+                                 (replace-regexp-in-string
+                                  regexp str
+                                  (helm-basename old)))
+               ;; If `regexp' is not matched in `old'
+               ;; `replace-regexp-in-string' will
+               ;; return `old' unmodified.
+               unless (string= old new)
+               do (progn
+                    (unless (string= query "!")
+                      (while (not (member
+                                   (setq query
+                                         (string
+                                          (read-key
+                                           (propertize
+                                            (format
+                                             "Replace `%s' by `%s' [!,y,n,q]"
+                                             old new)
+                                            'face 'minibuffer-prompt))))
+                                   '("y" "!" "n" "q")))
+                        (message "Please answer by y,n,! or q") (sit-for 1)))
+                    (when (string= query "q")
+                      (cl-return (message "Operation aborted")))
+                    (unless (string= query "n")
+                      (rename-file old new)
+                      (cl-incf count)))
+               finally (message "%d Files renamed" count))))
+  ;; This fix the emacs bug where "Emacs-Lisp:" is sent
+  ;; in minibuffer (not the echo area).
+  (sit-for 0.1)
+  (with-current-buffer (window-buffer (minibuffer-window))
+    (delete-minibuffer-contents)))
+
+;; The action.
+(defun helm-ff-query-replace-on-marked (_candidate)
+  (let ((marked (helm-marked-candidates :with-wildcard t)))
+    (helm-ff-query-replace-on-marked-1 marked)))
+
+;; The command for `helm-find-files-map'.
+(defun helm-ff-run-query-replace-on-marked ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-query-replace-on-marked)))
+(put 'helm-ff-run-query-replace-on-marked 'helm-only t)
+
+(defun helm-ff-query-replace (_candidate)
+  (let ((bufs (cl-loop for f in (helm-marked-candidates :with-wildcard t)
+                       collect (buffer-name (find-file-noselect f)))))
+    (helm-buffer-query-replace-1 nil bufs)))
+
+(defun helm-ff-query-replace-regexp (_candidate)
+  (let ((bufs (cl-loop for f in (helm-marked-candidates :with-wildcard t)
+                       collect (buffer-name (find-file-noselect f)))))
+    (helm-buffer-query-replace-1 'regexp bufs)))
+
+(defun helm-ff-run-query-replace ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-query-replace)))
+(put 'helm-ff-run-query-replace 'helm-only t)
+
+(defun helm-ff-run-query-replace-regexp ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-query-replace-regexp)))
+(put 'helm-ff-run-query-replace-regexp 'helm-only t)
+
+(defun helm-ff-toggle-auto-update (_candidate)
+  (setq helm-ff-auto-update-flag (not helm-ff-auto-update-flag))
+  (setq helm-ff--auto-update-state helm-ff-auto-update-flag)
+  (message "[Auto expansion %s]"
+           (if helm-ff-auto-update-flag "enabled" "disabled")))
+
+(defun helm-ff-run-toggle-auto-update ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'toggle-auto-update '(helm-ff-toggle-auto-update . never-split))
+    (helm-execute-persistent-action 'toggle-auto-update)))
+(put 'helm-ff-run-toggle-auto-update 'helm-only t)
+
+(defun helm-ff-delete-char-backward ()
+  "Disable helm find files auto update and delete char backward."
+  (interactive)
+  (with-helm-alive-p
+    (setq helm-ff-auto-update-flag nil)
+    (setq helm-ff--deleting-char-backward t)
+    (call-interactively
+     (lookup-key (current-global-map)
+                 (read-kbd-macro "DEL")))))
+(put 'helm-ff-delete-char-backward 'helm-only t)
+
+(defun helm-ff-delete-char-backward--exit-fn ()
+  (setq helm-ff-auto-update-flag helm-ff--auto-update-state)
+  (setq helm-ff--deleting-char-backward nil))
+
+(defun helm-ff-run-switch-to-history ()
+  "Run Switch to history action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (when (helm-file-completion-source-p)
+      (helm-exit-and-execute-action 'helm-find-files-switch-to-hist))))
+(put 'helm-ff-run-switch-to-history 'helm-only t)
+
+(defun helm-ff-run-grep ()
+  "Run Grep action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-grep)))
+(put 'helm-ff-run-grep 'helm-only t)
+
+(defun helm-ff-run-git-grep ()
+  "Run git-grep action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-git-grep)))
+(put 'helm-ff-run-git-grep 'helm-only t)
+
+(defun helm-ff-run-grep-ag ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-ag)))
+(put 'helm-ff-run-grep-ag 'helm-only t)
+
+(defun helm-ff-run-pdfgrep ()
+  "Run Pdfgrep action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-pdfgrep)))
+(put 'helm-ff-run-pdfgrep 'helm-only t)
+
+(defun helm-ff-run-zgrep ()
+  "Run Grep action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-zgrep)))
+(put 'helm-ff-run-zgrep 'helm-only t)
+
+(defun helm-ff-run-copy-file ()
+  "Run Copy file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-copy)))
+(put 'helm-ff-run-copy-file 'helm-only t)
+
+(defun helm-ff-run-rename-file ()
+  "Run Rename file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-rename)))
+(put 'helm-ff-run-rename-file 'helm-only t)
+
+(defun helm-ff-run-byte-compile-file ()
+  "Run Byte compile file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-byte-compile)))
+(put 'helm-ff-run-byte-compile-file 'helm-only t)
+
+(defun helm-ff-run-load-file ()
+  "Run Load file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-load-files)))
+(put 'helm-ff-run-load-file 'helm-only t)
+
+(defun helm-ff-run-eshell-command-on-file ()
+  "Run eshell command on file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action
+     'helm-find-files-eshell-command-on-file)))
+(put 'helm-ff-run-eshell-command-on-file 'helm-only t)
+
+(defun helm-ff-run-ediff-file ()
+  "Run Ediff file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-ediff-files)))
+(put 'helm-ff-run-ediff-file 'helm-only t)
+
+(defun helm-ff-run-ediff-merge-file ()
+  "Run Ediff merge file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action
+     'helm-find-files-ediff-merge-files)))
+(put 'helm-ff-run-ediff-merge-file 'helm-only t)
+
+(defun helm-ff-run-symlink-file ()
+  "Run Symlink file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-symlink)))
+(put 'helm-ff-run-symlink-file 'helm-only t)
+
+(defun helm-ff-run-hardlink-file ()
+  "Run Hardlink file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-hardlink)))
+(put 'helm-ff-run-hardlink-file 'helm-only t)
+
+(defun helm-ff-run-delete-file ()
+  "Run Delete file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-delete-marked-files)))
+(put 'helm-ff-run-delete-file 'helm-only t)
+
+(defun helm-ff-run-complete-fn-at-point ()
+  "Run complete file name action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action
+     'helm-insert-file-name-completion-at-point)))
+(put 'helm-ff-run-complete-fn-at-point 'helm-only t)
+
+(defun helm-ff-run-switch-to-eshell ()
+  "Run switch to eshell action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-switch-to-eshell)))
+(put 'helm-ff-run-switch-to-eshell 'helm-only t)
+
+(defun helm-ff-run-switch-other-window ()
+  "Run switch to other window action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-files-other-window)))
+(put 'helm-ff-run-switch-other-window 'helm-only t)
+
+(defun helm-ff-run-switch-other-frame ()
+  "Run switch to other frame action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'find-file-other-frame)))
+(put 'helm-ff-run-switch-other-frame 'helm-only t)
+
+(defun helm-ff-run-open-file-externally ()
+  "Run open file externally command action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-open-file-externally)))
+(put 'helm-ff-run-open-file-externally 'helm-only t)
+
+(defun helm-ff-run-open-file-with-default-tool ()
+  "Run open file externally command action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-open-file-with-default-tool)))
+(put 'helm-ff-run-open-file-with-default-tool 'helm-only t)
+
+(defun helm-ff-locate (candidate)
+  "Locate action function for `helm-find-files'."
+  (helm-locate-set-command)
+  (let ((input (concat (helm-basename
+                        (expand-file-name
+                         candidate
+                         helm-ff-default-directory))
+                       ;; The locate '-b' option doesn't exists
+                       ;; in everything (es).
+                       (unless (and (eq system-type 'windows-nt)
+                                    (string-match "^es" helm-locate-command))
+                         " -b"))))
+    (helm-locate-1 helm-current-prefix-arg nil 'from-ff input)))
+
+(defun helm-ff-run-locate ()
+  "Run locate action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-locate)))
+(put 'helm-ff-run-locate 'helm-only t)
+
+(defun helm-files-insert-as-org-link (candidate)
+  (insert (format "[[%s][]]" candidate))
+  (goto-char (- (point) 2)))
+
+(defun helm-ff-run-insert-org-link ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-files-insert-as-org-link)))
+(put 'helm-ff-run-insert-org-link 'helm-only t)
+
+(defun helm-ff-run-find-file-as-root ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-find-file-as-root)))
+(put 'helm-ff-run-find-file-as-root 'helm-only t)
+
+(defun helm-ff-run-find-alternate-file ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'find-alternate-file)))
+(put 'helm-ff-run-find-alternate-file 'helm-only t)
+
+(defun helm-ff-run-gnus-attach-files ()
+  "Run gnus attach files command action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-gnus-attach-files)))
+(put 'helm-ff-run-gnus-attach-files 'helm-only t)
+
+(defun helm-ff-run-etags ()
+  "Run Etags command action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-etags-select)))
+(put 'helm-ff-run-etags 'helm-only t)
+
+(defvar lpr-printer-switch)
+(defun helm-ff-print (_candidate)
+  "Print marked files.
+
+You may to set in order
+variables `lpr-command',`lpr-switches' and/or `printer-name',
+but with no settings helm should detect your printer(s) and
+print with the default `lpr' settings.
+
+NOTE: DO NOT set the \"-P\" flag in `lpr-switches', if you really
+have to modify this, do it in `lpr-printer-switch'.
+  
+Same as `dired-do-print' but for helm."
+  (require 'lpr)
+  (when (or helm-current-prefix-arg
+            (not helm-ff-printer-list))
+    (setq helm-ff-printer-list
+          (helm-ff-find-printers)))
+  (let* ((file-list (helm-marked-candidates :with-wildcard t))
+         (len (length file-list))
+         (printer-name (if helm-ff-printer-list
+                           (helm-comp-read
+                            "Printer: " helm-ff-printer-list)
+                         printer-name))
+         (lpr-switches
+         (if (and (stringp printer-name)
+                  (string< "" printer-name))
+             (cons (concat lpr-printer-switch printer-name)
+                   lpr-switches)
+              lpr-switches))
+         (command (helm-read-string
+                   (format "Print *%s File(s):\n%s with: "
+                           len
+                           (mapconcat
+                            (lambda (f) (format "- %s\n" f))
+                            file-list ""))
+                   (when (and lpr-command lpr-switches)
+                     (mapconcat 'identity
+                                (cons lpr-command
+                                      (if (stringp lpr-switches)
+                                          (list lpr-switches)
+                                          lpr-switches))
+                                " "))))
+         (file-args (mapconcat (lambda (x)
+                                   (format "'%s'" x))
+                               file-list " "))
+         (cmd-line (concat command " " file-args)))
+    (if command
+        (start-process-shell-command "helm-print" nil cmd-line)
+      (error "Error: Please verify your printer settings in Emacs."))))
+
+(defun helm-ff-run-print-file ()
+  "Run Print file action from `helm-source-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-print)))
+(put 'helm-ff-run-print-file 'helm-only t)
+
+(defun helm-ff-checksum (file)
+  "Calculate the checksum of FILE.
+The checksum is copied to kill-ring."
+  (let ((algo (intern (helm-comp-read
+                       "Algorithm: "
+                       '(md5 sha1 sha224 sha256 sha384 sha512)))))
+    (kill-new (with-temp-buffer
+                (insert-file-contents-literally file)
+                (secure-hash algo (current-buffer))))
+    (message "Checksum copied to kill-ring.")))
+
+(defun helm-ff-toggle-basename (_candidate)
+  (with-helm-buffer
+    (setq helm-ff-transformer-show-only-basename
+          (not helm-ff-transformer-show-only-basename))
+    (let* ((cand   (helm-get-selection nil t))
+           (target (if helm-ff-transformer-show-only-basename
+                       (helm-basename cand) cand)))
+      (helm-force-update (regexp-quote target)))))
+
+(defun helm-ff-run-toggle-basename ()
+  (interactive)
+  (with-helm-alive-p
+    (unless (helm-empty-source-p)
+      (helm-ff-toggle-basename nil))))
+(put 'helm-ff-run-toggle-basename 'helm-only t)
+
+(cl-defun helm-reduce-file-name (fname level &key unix-close expand)
+  "Reduce FNAME by LEVEL from end or beginning depending LEVEL value.
+If LEVEL is positive reduce from end else from beginning.
+If UNIX-CLOSE is non--nil close filename with /.
+If EXPAND is non--nil expand-file-name."
+  (let* ((exp-fname  (expand-file-name fname))
+         (fname-list (split-string
+                     (if (or (string= fname "~/") expand)
+                         exp-fname fname)
+                     "/" t))
+         (len        (length fname-list))
+         (pop-list   (if (< level 0)
+                         (cl-subseq fname-list (* level -1))
+                       (cl-subseq fname-list 0 (- len level))))
+         (result     (mapconcat 'identity pop-list "/"))
+        (abbrev-fname  (string-match "^~" result))
+         (empty      (string= result "")))
+    (when unix-close (setq result (concat result "/")))
+    (cond ((and abbrev-fname (string= result "~/")) "~/")
+         (abbrev-fname result)
+         ((and (< level 0) empty) "../")
+         ((< level 0) (concat "../" result))
+         ((and (eq system-type 'windows-nt)
+                (not (file-remote-p fname)))
+           ;; Result is starting by a volume name i.e "c:/".
+           result)
+          ;; Expand to "/" or "c:/".
+         (empty (expand-file-name "/"))
+         (t (concat "/" result)))))
+
+(defvar helm-find-files--level-tree nil)
+(defvar helm-find-files--level-tree-iterator nil)
+(defun helm-find-files-up-one-level (arg)
+  "Go up one level like unix command `cd ..'.
+If prefix numeric arg is given go ARG level up."
+  (interactive "p")
+  (with-helm-alive-p
+    (when (and (helm-file-completion-source-p)
+               (not (helm-ff-invalid-tramp-name-p)))
+      (with-helm-window
+        (when helm-follow-mode
+          (helm-follow-mode -1) (message nil)))
+      ;; When going up one level we want to be at the line
+      ;; corresponding to actual directory, so store this info
+      ;; in `helm-ff-last-expanded'.
+      (let ((cur-cand (helm-get-selection))
+            (new-pattern (helm-reduce-file-name
+                          helm-pattern arg :unix-close t :expand t)))
+        (cond ((file-directory-p helm-pattern)
+               (setq helm-ff-last-expanded helm-ff-default-directory))
+              ((file-exists-p helm-pattern)
+               (setq helm-ff-last-expanded helm-pattern))
+              ((and cur-cand (file-exists-p cur-cand))
+               (setq helm-ff-last-expanded cur-cand)))
+        (unless helm-find-files--level-tree
+          (setq helm-find-files--level-tree
+                (cons helm-ff-default-directory
+                      helm-find-files--level-tree)))
+        (setq helm-find-files--level-tree-iterator nil)
+        (push new-pattern helm-find-files--level-tree)
+        (helm-set-pattern new-pattern helm-suspend-update-flag)
+        (with-helm-after-update-hook (helm-ff-retrieve-last-expanded))))))
+(put 'helm-find-files-up-one-level 'helm-only t)
+
+(defun helm-find-files-down-last-level ()
+  "Retrieve previous paths reached by `C-l' in helm-find-files."
+  (interactive)
+  (with-helm-alive-p
+    (when (and (helm-file-completion-source-p)
+               (not (helm-ff-invalid-tramp-name-p)))
+      (unless helm-find-files--level-tree-iterator 
+        (setq helm-find-files--level-tree-iterator
+              (helm-iter-list (cdr helm-find-files--level-tree))))
+      (setq helm-find-files--level-tree nil)
+      (helm-aif (helm-iter-next helm-find-files--level-tree-iterator)
+          (helm-set-pattern it)
+        (setq helm-find-files--level-tree-iterator nil)))))
+(put 'helm-find-files-down-last-level 'helm-only t)
+
+(defun helm-find-files--reset-level-tree ()
+  (setq helm-find-files--level-tree-iterator nil
+        helm-find-files--level-tree nil))
+
+(add-hook 'helm-cleanup-hook 'helm-find-files--reset-level-tree)
+(add-hook 'post-self-insert-hook 'helm-find-files--reset-level-tree)
+(add-hook 'helm-after-persistent-action-hook 'helm-find-files--reset-level-tree)
+
+(defun helm-ff-retrieve-last-expanded ()
+  "Move overlay to last visited directory `helm-ff-last-expanded'.
+This happen after using `helm-find-files-up-one-level',
+or hitting C-j on \"..\"."
+  (when helm-ff-last-expanded
+    (let ((presel (if helm-ff-transformer-show-only-basename
+                      (helm-basename
+                       (directory-file-name helm-ff-last-expanded))
+                    (directory-file-name helm-ff-last-expanded))))
+      (with-helm-window
+        (when (re-search-forward (concat "^" (regexp-quote presel) "$") nil t)
+          (forward-line 0)
+          (helm-mark-current-line)))
+      (setq helm-ff-last-expanded nil))))
+
+(defun helm-ff-move-to-first-real-candidate ()
+  "When candidate is an incomplete file name move to first real candidate."
+  (helm-aif (and (helm-file-completion-source-p)
+                 (not (helm-empty-source-p))
+                 (not (string-match
+                       "\\`[Dd]ired-"
+                       (assoc-default 'name (helm-get-current-source))))
+                 helm-ff--move-to-first-real-candidate
+                 (helm-get-selection))
+      (unless (or (not (stringp it))
+                  (and (string-match helm-tramp-file-name-regexp it)
+                       (not (file-remote-p it nil t)))
+                  (file-exists-p it))
+        (helm-next-line))))
+(add-hook 'helm-after-update-hook 'helm-ff-move-to-first-real-candidate)
+
+;;; Auto-update - helm-find-files auto expansion of directories.
+;;
+;;
+(defun helm-ff-update-when-only-one-matched ()
+  "Expand to directory when sole completion.
+When only one candidate is remaining and it is a directory,
+expand to this directory.
+This happen only when `helm-ff-auto-update-flag' is non--nil
+or when `helm-pattern' is equal to \"~/\"."
+  (when (and (helm-file-completion-source-p)
+             (not (helm-ff-invalid-tramp-name-p)))
+    (with-helm-window
+      (let* ((history-p   (string= (assoc-default
+                                    'name (helm-get-current-source))
+                                   "Read File Name History"))
+             (pat         (if (string-match helm-tramp-file-name-regexp
+                                            helm-pattern)
+                              (helm-create-tramp-name helm-pattern)
+                              helm-pattern))
+             (completed-p (string= (file-name-as-directory
+                                    (expand-file-name
+                                     (substitute-in-file-name pat)))
+                                   helm-ff-default-directory))
+             (candnum (helm-get-candidate-number))
+             (lt2-p   (and (<= candnum 2)
+                           (>= (string-width (helm-basename helm-pattern)) 2)))
+             (cur-cand (prog2
+                           (unless (or completed-p
+                                       (file-exists-p pat)
+                                       history-p (null lt2-p))
+                             ;; Only one non--existing candidate
+                             ;; and one directory candidate, move to it,
+                             ;; but not when renaming, copying etc...,
+                             ;; so for this use
+                             ;; `helm-ff-move-to-first-real-candidate'
+                             ;; instead of `helm-next-line' (Issue #910).
+                             (helm-ff-move-to-first-real-candidate))
+                           (helm-get-selection))))
+        (when (and (or (and helm-ff-auto-update-flag
+                            (null helm-ff--deleting-char-backward)
+                            (not (get-buffer-window helm-action-buffer 'visible))
+                            ;; Issue #295
+                            ;; File predicates are returning t
+                            ;; with paths like //home/foo.
+                            ;; So check it is not the case by regexp
+                            ;; to allow user to do C-a / to start e.g
+                            ;; entering a tramp method e.g /sudo::.
+                            (not (string-match "\\`//" helm-pattern))
+                            (not (eq last-command 'helm-yank-text-at-point)))
+                       ;; Fix issue #542.
+                       (string= helm-pattern "~/")
+                       ;; Only one remaining directory, expand it.
+                       (and (= candnum 1)
+                            helm-ff--auto-update-state
+                            (file-accessible-directory-p pat)
+                            (null helm-ff--deleting-char-backward)))
+                   (or
+                    ;; Only one candidate remaining
+                    ;; and at least 2 char in basename.
+                    lt2-p
+                    ;; Already completed.
+                    completed-p)
+                   (not history-p) ; Don't try to auto complete in history.
+                   (stringp cur-cand)
+                   (file-accessible-directory-p cur-cand))
+          (if (and (not (helm-dir-is-dot cur-cand)) ; [1]
+                   ;; Maybe we are here because completed-p is true
+                   ;; but check this again to be sure. (Windows fix)
+                   (<= candnum 2))      ; [2]
+              ;; If after going to next line the candidate
+              ;; is not one of "." or ".." [1]
+              ;; and only one candidate is remaining [2],
+              ;; assume candidate is a new directory to expand, and do it.
+              (helm-set-pattern (file-name-as-directory cur-cand))
+              ;; The candidate is one of "." or ".."
+              ;; that mean we have entered the last letter of the directory name
+              ;; in prompt, so expansion is already done, just add the "/" at end
+              ;; of name unless helm-pattern ends with "."
+              ;; (i.e we are writing something starting with ".")
+              (unless (string-match "\\`.*[.]\\{1\\}\\'" helm-pattern)
+                (helm-set-pattern
+                 ;; Need to expand-file-name to avoid e.g /ssh:host:./ in prompt.
+                 (expand-file-name (file-name-as-directory helm-pattern)))))
+          (helm-check-minibuffer-input))))))
+
+(defun helm-ff-auto-expand-to-home-or-root ()
+  "Allow expanding to home/user directory or root or text yanked after pattern."
+  (when (and (helm-file-completion-source-p)
+             (string-match
+              "/?\\$.*/\\|/\\./\\|/\\.\\./\\|/~.*/\\|//\\|\\(/[[:alpha:]]:/\\|\\s\\+\\)"
+              helm-pattern)
+             (with-current-buffer (window-buffer (minibuffer-window)) (eolp))
+             (not (string-match helm-ff-url-regexp helm-pattern)))
+    (let* ((match (match-string 0 helm-pattern))
+           (input (cond ((string= match "/./")
+                         (expand-file-name default-directory))
+                        ((string= helm-pattern "/../") "/")
+                        ((string-match-p "\\`/\\$" match)
+                         (let ((sub (substitute-in-file-name match)))
+                           (if (file-directory-p sub)
+                               sub (replace-regexp-in-string "/\\'" "" sub))))
+                        (t (expand-file-name
+                            (helm-substitute-in-filename helm-pattern)
+                            ;; [Windows] On UNC paths "/" expand to current machine,
+                            ;; so use the root of current Drive. (i.e "C:/")
+                            (and (memq system-type '(windows-nt ms-dos))
+                                 (getenv "SystemDrive")) ; nil on Unix.
+                            )))))
+      (if (file-directory-p input)
+          (setq helm-ff-default-directory
+                (setq input (file-name-as-directory input)))
+        (setq helm-ff-default-directory (file-name-as-directory
+                                         (file-name-directory input))))
+      (with-helm-window
+        (helm-set-pattern input)
+        (helm-check-minibuffer-input)))))
+
+(defun helm-substitute-in-filename (fname)
+  "Substitute all parts of FNAME from start up to \"~/\" or \"/\".
+On windows system substitute from start up to \"/[[:lower:]]:/\".
+This function is needed for `helm-ff-auto-expand-to-home-or-root'
+and should be used carefully elsewhere, or not at all, using
+`substitute-in-file-name' instead."
+  (cond ((and ffap-url-regexp
+              (string-match-p ffap-url-regexp fname))
+         fname)
+        ((and (file-remote-p fname)
+              helm-substitute-in-filename-stay-on-remote)
+         (let ((sub (substitute-in-file-name fname)))
+           (if (file-directory-p sub)
+               sub (replace-regexp-in-string "/\\'" "" sub))))
+        (t
+         (with-temp-buffer
+           (insert fname)
+           (goto-char (point-min))
+           (skip-chars-forward "/") ;; Avoid infloop in UNC paths Issue #424
+           (if (re-search-forward "~.*/?\\|//\\|/[[:alpha:]]:/" nil t)
+               (let ((match (match-string 0)))
+                 (goto-char (if (or (string= match "//")
+                                    (string-match-p "/[[:alpha:]]:/" match))
+                                (1+ (match-beginning 0))
+                                (match-beginning 0)))
+                 (buffer-substring-no-properties (point) (point-at-eol)))
+               fname)))))
+
+(add-hook 'helm-after-update-hook 'helm-ff-update-when-only-one-matched)
+(add-hook 'helm-after-update-hook 'helm-ff-auto-expand-to-home-or-root)
+
+(defun helm-point-file-in-dired (file)
+  "Put point on filename FILE in dired buffer."
+  (unless (and ffap-url-regexp
+               (string-match-p ffap-url-regexp file))
+    (let ((target (expand-file-name (helm-substitute-in-filename file))))
+      (dired (file-name-directory target))
+      (dired-goto-file target))))
+
+(defun helm-create-tramp-name (fname)
+  "Build filename for `helm-pattern' like /su:: or /sudo::."
+  (apply #'tramp-make-tramp-file-name
+         (cl-loop with v = (tramp-dissect-file-name fname)
+               for i across v collect i)))
+
+(cl-defun helm-ff-tramp-hostnames (&optional (pattern helm-pattern))
+  "Get a list of hosts for tramp method found in `helm-pattern'.
+Argument PATTERN default to `helm-pattern', it is here only for debugging
+purpose."
+  (when (string-match helm-tramp-file-name-regexp pattern)
+    (let ((method      (match-string 1 pattern))
+          (tn          (match-string 0 pattern))
+          (all-methods (mapcar 'car tramp-methods)))
+      (helm-fast-remove-dups
+       (cl-loop for (f . h) in (tramp-get-completion-function method)
+             append (cl-loop for e in (funcall f (car h))
+                          for host = (and (consp e) (cadr e))
+                          when (and host (not (member host all-methods)))
+                          collect (concat tn host)))
+       :test 'equal))))
+
+(defun helm-ff-before-action-hook-fn ()
+  "Exit helm when user try to execute action on an invalid tramp fname."
+  (let ((cand (helm-get-selection)))
+    (when (and (helm-file-completion-source-p)
+               (stringp cand)
+               (helm-ff-invalid-tramp-name-p cand) ; Check candidate.
+               (helm-ff-invalid-tramp-name-p)) ; check helm-pattern.
+      (error "Error: Unknown file or directory `%s'" cand))))
+(add-hook 'helm-before-action-hook 'helm-ff-before-action-hook-fn)
+
+(cl-defun helm-ff-invalid-tramp-name-p (&optional (pattern helm-pattern))
+  "Return non--nil when PATTERN is an invalid tramp filename."
+  (string= (helm-ff-set-pattern pattern)
+           "Invalid tramp file name"))
+
+(defun helm-ff-set-pattern (pattern)
+  "Handle tramp filenames in `helm-pattern'."
+  (let ((methods (mapcar 'car tramp-methods))
+        (reg "\\`/\\([^[/:]+\\|[^/]+]\\):.*:")
+        cur-method tramp-name)
+    ;; In some rare cases tramp can return a nil input,
+    ;; so be sure pattern is a string for safety (Issue #476).
+    (unless pattern (setq pattern ""))
+    (cond ((string-match helm-ff-url-regexp pattern) pattern)
+          ((string-match "\\`\\$" pattern)
+           (substitute-in-file-name pattern))
+          ((string= pattern "") "")
+          ((string-match "\\`[.]\\{1,2\\}/\\'" pattern)
+           (expand-file-name pattern))
+          ((string-match ".*\\(~?/?[.]\\{1\\}/\\)\\'" pattern)
+           (expand-file-name default-directory))
+          ((string-match ".*\\(~//\\|//\\)\\'" pattern)
+           (expand-file-name "/")) ; Expand to "/" or "c:/"
+          ((string-match "\\`\\(~/\\|.*/~/\\)\\'" pattern)
+           (expand-file-name "~/"))
+          ;; Match "/method:maybe_hostname:~"
+          ((and (string-match (concat reg "~") pattern)
+                (setq cur-method (match-string 1 pattern))
+                (member cur-method methods))
+           (setq tramp-name (expand-file-name
+                             (helm-create-tramp-name
+                              (match-string 0 pattern))))
+           (replace-match tramp-name nil t pattern))
+          ;; Match "/method:maybe_hostname:"
+          ((and (string-match reg pattern)
+                (setq cur-method (match-string 1 pattern))
+                (member cur-method methods))
+           (setq tramp-name (helm-create-tramp-name
+                             (match-string 0 pattern)))
+           (replace-match tramp-name nil t pattern))
+          ;; Match "/hostname:"
+          ((and (string-match  helm-tramp-file-name-regexp pattern)
+                (setq cur-method (match-string 1 pattern))
+                (and cur-method (not (member cur-method methods))))
+           (setq tramp-name (helm-create-tramp-name
+                             (match-string 0 pattern)))
+           (replace-match tramp-name nil t pattern))
+          ;; Match "/method:" in this case don't try to connect.
+          ((and (not (string-match reg pattern))
+                (string-match helm-tramp-file-name-regexp pattern)
+                (member (match-string 1 pattern) methods))
+           "Invalid tramp file name")   ; Write in helm-buffer.
+          ;; Return PATTERN unchanged.
+          (t pattern))))
+
+(defun helm-find-files-get-candidates (&optional require-match)
+  "Create candidate list for `helm-source-find-files'."
+  (let* ((path          (helm-ff-set-pattern helm-pattern))
+         (dir-p         (file-accessible-directory-p path))
+         basedir
+         invalid-basedir
+         non-essential
+         (tramp-verbose helm-tramp-verbose)) ; No tramp message when 0.
+    (set-text-properties 0 (length path) nil path)
+    ;; Issue #118 allow creation of newdir+newfile.
+    (unless (or
+             ;; A tramp file name not completed.
+             (string= path "Invalid tramp file name")
+             ;; An empty pattern
+             (string= path "")
+             ;; Check if base directory of PATH is valid.
+             (helm-aif (file-name-directory path)
+                 ;; If PATH is a valid directory IT=PATH,
+                 ;; else IT=basedir of PATH.
+                 (file-directory-p it)))
+      ;; BASEDIR is invalid, that's mean user is starting
+      ;; to write a non--existing path in minibuffer
+      ;; probably to create a 'new_dir' or a 'new_dir+new_file'.
+      (setq invalid-basedir t))
+    ;; Don't set now `helm-pattern' if `path' == "Invalid tramp file name"
+    ;; like that the actual value (e.g /ssh:) is passed to
+    ;; `helm-ff-tramp-hostnames'.
+    (unless (or (string= path "Invalid tramp file name")
+                invalid-basedir)      ; Leave  helm-pattern unchanged.
+      (setq helm-ff-auto-update-flag  ; [1]
+            ;; Unless auto update is disabled at startup or
+            ;; interactively, start auto updating only at third char.
+            (unless (or (null helm-ff-auto-update-initial-value)
+                        (null helm-ff--auto-update-state)
+                        ;; But don't enable auto update when
+                        ;; deleting backward.
+                        helm-ff--deleting-char-backward
+                        (and dir-p (not (string-match-p "/\\'" path))))
+              (or (>= (length (helm-basename path)) 3) dir-p)))
+      (setq helm-pattern (helm-ff--transform-pattern-for-completion path))
+      ;; This have to be set after [1] to allow deleting char backward.
+      (setq basedir (expand-file-name
+                     (if (and dir-p helm-ff-auto-update-flag)
+                         ;; Add the final "/" to path
+                         ;; when `helm-ff-auto-update-flag' is enabled.
+                         (file-name-as-directory path)
+                         (if (string= path "") "/"
+                             (file-name-directory path)))))
+      (setq helm-ff-default-directory
+            (if (string= helm-pattern "")
+                (expand-file-name "/")  ; Expand to "/" or "c:/"
+                ;; If path is an url *default-directory have to be nil.
+                (unless (or (string-match helm-ff-url-regexp path)
+                            (and ffap-url-regexp
+                                 (string-match ffap-url-regexp path)))
+                  basedir))))
+    (cond ((string= path "Invalid tramp file name")
+           (or (helm-ff-tramp-hostnames) ; Hostnames completion.
+               (prog2
+                   ;; `helm-pattern' have not been modified yet.
+                   ;; Set it here to the value of `path' that should be now
+                   ;; "Invalid tramp file name" and set the candidates list
+                   ;; to ("Invalid tramp file name") to make `helm-pattern'
+                   ;; match single candidate "Invalid tramp file name".
+                   (setq helm-pattern path)
+                   ;; "Invalid tramp file name" is now printed
+                   ;; in `helm-buffer'.
+                   (list path))))
+          ((or (and (file-regular-p path)
+                    (eq last-repeatable-command 'helm-execute-persistent-action))
+               ;; `ffap-url-regexp' don't match until url is complete.
+               (string-match helm-ff-url-regexp path)
+               invalid-basedir
+               (and (not (file-exists-p path)) (string-match "/$" path))
+               (and ffap-url-regexp (string-match ffap-url-regexp path)))
+           (list path))
+          ((string= path "") (helm-ff-directory-files "/" t))
+          ;; Check here if directory is accessible (not working on Windows).
+          ((and (file-directory-p path) (not (file-readable-p path)))
+           (list (format "file-error: Opening directory permission denied `%s'" path)))
+          ;; A fast expansion of PATH is made only if `helm-ff-auto-update-flag'
+          ;; is enabled.
+          ((and dir-p helm-ff-auto-update-flag)
+           (helm-ff-directory-files path t))
+          (t (append (unless (or require-match
+                                 ;; When `helm-ff-auto-update-flag' has been
+                                 ;; disabled, whe don't want PATH to be added on top
+                                 ;; if it is a directory.
+                                 dir-p)
+                       (list path))
+                     (helm-ff-directory-files basedir t))))))
+
+(defun helm-ff-directory-files (directory &optional full)
+  "List contents of DIRECTORY.
+Argument FULL mean absolute path.
+It is same as `directory-files' but always returns the
+dotted filename '.' and '..' even on root directories in Windows
+systems."
+  (setq directory (file-name-as-directory
+                   (expand-file-name directory)))
+  (let* (file-error
+         (ls   (condition-case err
+                   (directory-files
+                    directory full directory-files-no-dot-files-regexp)
+                 ;; Handle file-error from here for Windows
+                 ;; because predicates like `file-readable-p' and friends
+                 ;; seem broken on emacs for Windows systems (always returns t).
+                 ;; This should never be called on GNU/Linux/Unix
+                 ;; as the error is properly intercepted in
+                 ;; `helm-find-files-get-candidates' by `file-readable-p'.
+                 (file-error
+                  (prog1
+                      (list (format "%s:%s"
+                                    (car err)
+                                    (mapconcat 'identity (cdr err) " ")))
+                    (setq file-error t)))))
+        (dot  (concat directory "."))
+        (dot2 (concat directory "..")))
+    (append (and (not file-error) (list dot dot2)) ls)))
+
+(defun helm-ff-handle-backslash (fname)
+  ;; Allow creation of filenames containing a backslash.
+  (cl-loop with bad = '((92 . ""))
+        for i across fname
+        for isbad = (assq i bad)
+        if isbad concat (cdr isbad)
+        else concat (string i)))
+
+(defun helm-ff-fuzzy-matching-p ()
+  (and helm-ff-fuzzy-matching
+       (not (memq helm-mm-matching-method '(multi1 multi3p)))))
+
+(defun helm-ff--transform-pattern-for-completion (pattern)
+  "Maybe return PATTERN with it's basename modified as a regexp.
+This happen only when `helm-ff-fuzzy-matching' is enabled.
+This provide a similar behavior as `ido-enable-flex-matching'.
+See also `helm--mapconcat-pattern'.
+If PATTERN is an url returns it unmodified.
+When PATTERN contain a space fallback to multi-match.
+If basename contain one or more space fallback to multi-match.
+If PATTERN is a valid directory name,return PATTERN unchanged."
+  ;; handle bad filenames containing a backslash.
+  (setq pattern (helm-ff-handle-backslash pattern))
+  (let ((bn      (helm-basename pattern))
+        (bd      (or (helm-basedir pattern) ""))
+        (dir-p   (file-directory-p pattern))
+        (tramp-p (cl-loop for (m . f) in tramp-methods
+                       thereis (string-match m pattern))))
+    ;; Always regexp-quote base directory name to handle
+    ;; crap dirnames such e.g bookmark+
+    (cond
+      ((or (and dir-p tramp-p (string-match ":\\'" pattern))
+           (string= pattern "")
+           (and dir-p (<= (length bn) 2))
+           ;; Fix Issue #541 when BD have a subdir similar
+           ;; to BN, don't switch to match plugin
+           ;; which will match both.
+           (and dir-p (string-match (regexp-quote bn) bd)))
+       ;; Use full PATTERN on e.g "/ssh:host:".
+       (regexp-quote pattern))
+      ;; Prefixing BN with a space call multi-match completion.
+      ;; This allow showing all files/dirs matching BN (Issue #518).
+      ;; FIXME: some multi-match methods may not work here.
+      (dir-p (concat (regexp-quote bd) " " (regexp-quote bn)))
+      ((or (not (helm-ff-fuzzy-matching-p))
+           (string-match "\\s-" bn))    ; Fall back to multi-match.
+       (concat (regexp-quote bd) bn))
+      ((or (string-match "[*][.]?.*" bn) ; Allow entering wilcard.
+           (string-match "/$" pattern)     ; Allow mkdir.
+           (string-match helm-ff-url-regexp pattern)
+           (and (string= helm-ff-default-directory "/") tramp-p))
+       ;; Don't treat wildcards ("*") as regexp char.
+       ;; (e.g ./foo/*.el => ./foo/[*].el)
+       (concat (regexp-quote bd)
+               (replace-regexp-in-string "[*]" "[*]" bn)))
+      (t (concat (regexp-quote bd)
+                 (if (>= (length bn) 2) ; wait 2nd char before concating.
+                     (helm--mapconcat-pattern bn)
+                     (concat ".*" (regexp-quote bn))))))))
+
+(defun helm-dir-is-dot (dir)
+  (string-match "\\(?:/\\|\\`\\)\\.\\{1,2\\}\\'" dir))
+
+(defun helm-ff-save-history ()
+  "Store the last value of `helm-ff-default-directory' in `helm-ff-history'.
+Note that only existing directories are saved here."
+  (when (and helm-ff-default-directory
+             (helm-file-completion-source-p)
+             (file-directory-p helm-ff-default-directory))
+    (set-text-properties 0 (length helm-ff-default-directory)
+                         nil helm-ff-default-directory)
+    (push helm-ff-default-directory helm-ff-history)))
+(add-hook 'helm-cleanup-hook 'helm-ff-save-history)
+
+(defun helm-files-save-file-name-history (&optional force)
+  "Save selected file to `file-name-history'."
+  (let ((src-name (assoc-default 'name (helm-get-current-source))))
+    (when (or force (helm-file-completion-source-p)
+              (member src-name helm-files-save-history-extra-sources))
+      (let ((mkd (helm-marked-candidates))
+            (history-delete-duplicates t))
+        (cl-loop for sel in mkd
+              when (and sel
+                        (stringp sel)
+                        (file-exists-p sel)
+                        (not (file-directory-p sel)))
+              do
+              ;; 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 sel)))))))
+(add-hook 'helm-exit-minibuffer-hook 'helm-files-save-file-name-history)
+
+(defun helm-ff-valid-symlink-p (file)
+  (helm-aif (condition-case-unless-debug nil
+                ;; `file-truename' send error
+                ;; on cyclic symlinks (Issue #692).
+                (file-truename file)
+              (error nil))
+      (file-exists-p it)))
+
+(defun helm-get-default-mode-for-file (filename)
+  "Return the default mode to open FILENAME."
+  (let ((mode (cl-loop for (r . m) in auto-mode-alist
+                    thereis (and (string-match r filename) m))))
+    (or (and (symbolp mode) mode) "Fundamental")))
+
+(defun helm-ff-properties (candidate)
+  "Show file properties of CANDIDATE in a tooltip or message."
+  (let* ((all                (helm-file-attributes candidate))
+         (dired-line         (helm-file-attributes
+                              candidate :dired t :human-size t))
+         (type               (cl-getf all :type))
+         (mode-type          (cl-getf all :mode-type))
+         (owner              (cl-getf all :uid))
+         (owner-right        (cl-getf all :user t))
+         (group              (cl-getf all :gid))
+         (group-right        (cl-getf all :group))
+         (other-right        (cl-getf all :other))
+         (size               (helm-file-human-size (cl-getf all :size)))
+         (modif              (cl-getf all :modif-time))
+         (access             (cl-getf all :access-time))
+         (ext                (helm-get-default-program-for-file candidate))
+         (tooltip-hide-delay (or helm-tooltip-hide-delay tooltip-hide-delay)))
+    (if (and (window-system) tooltip-mode)
+        (tooltip-show
+         (concat
+          (helm-basename candidate) "\n"
+          dired-line "\n"
+          (format "Mode: %s\n" (helm-get-default-mode-for-file candidate))
+          (format "Ext prog: %s\n" (or (and ext (replace-regexp-in-string
+                                                 " %s" "" ext))
+                                       "Not defined"))
+          (format "Type: %s: %s\n" type mode-type)
+          (when (string= type "symlink")
+            (format "True name: '%s'\n"
+                    (cond ((string-match "^\.#" (helm-basename candidate))
+                           "Autosave symlink")
+                          ((helm-ff-valid-symlink-p candidate)
+                           (file-truename candidate))
+                          (t "Invalid Symlink"))))
+          (format "Owner: %s: %s\n" owner owner-right)
+          (format "Group: %s: %s\n" group group-right)
+          (format "Others: %s\n" other-right)
+          (format "Size: %s\n" size)
+          (format "Modified: %s\n" modif)
+          (format "Accessed: %s\n" access)))
+      (message dired-line) (sit-for 5))))
+
+(defun helm-ff-properties-persistent ()
+  "Show properties without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'properties-action '(helm-ff-properties . never-split))
+    (helm-execute-persistent-action 'properties-action)))
+(put 'helm-ff-properties-persistent 'helm-only t)
+
+(defun helm-ff-persistent-delete ()
+  "Delete current candidate without quitting."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'quick-delete '(helm-ff-quick-delete . never-split))
+    (helm-execute-persistent-action 'quick-delete)))
+(put 'helm-ff-persistent-delete 'helm-only t)
+
+(defun helm-ff-dot-file-p (file)
+  "Check if FILE is `.' or `..'."
+  (member (helm-basename file) '("." "..")))
+
+(defun helm-ff-quick-delete (_candidate)
+  "Delete file CANDIDATE without quitting."
+  (let ((marked (helm-marked-candidates)))
+    (unwind-protect
+         (save-selected-window
+           (cl-loop for c in marked do
+                    (progn (helm-preselect
+                            (if (and helm-ff-transformer-show-only-basename
+                                     (not (helm-ff-dot-file-p c)))
+                                (helm-basename c) c))
+                           (when (y-or-n-p
+                                  (format "Really Delete file `%s'? " c))
+                             (helm-delete-file
+                              c helm-ff-signal-error-on-dot-files 'synchro)
+                             (helm-delete-current-selection)
+                             (message nil)))))
+      (with-helm-buffer
+        (setq helm-marked-candidates nil
+              helm-visible-mark-overlays nil))
+      (helm-force-update
+       (let ((presel (helm-get-selection)))
+         (regexp-quote (if (and helm-ff-transformer-show-only-basename
+                                (not (helm-ff-dot-file-p presel)))
+                           (helm-basename presel) presel)))))))
+
+(defun helm-ff-kill-buffer-fname (candidate)
+  (let* ((buf      (get-file-buffer candidate))
+         (buf-name (buffer-name buf)))
+    (cond ((and buf (eq buf (get-buffer helm-current-buffer)))
+           (user-error
+            "Can't kill `helm-current-buffer' without quitting session"))
+          (buf (kill-buffer buf) (message "Buffer `%s' killed" buf-name))
+          (t (message "No buffer to kill")))))
+
+(defun helm-ff-kill-or-find-buffer-fname (candidate)
+  "Find file CANDIDATE or kill it's buffer if it is visible.
+Never kill `helm-current-buffer'.
+Never kill buffer modified.
+This is called normally on third hit of \
+\\<helm-map>\\[helm-execute-persistent-action]
+in `helm-find-files-persistent-action'."
+  (let* ((buf      (get-file-buffer candidate))
+         (buf-name (buffer-name buf))
+         (win (get-buffer-window buf))
+         (helm--reading-passwd-or-string t))
+    (cond ((and buf win (eq buf (get-buffer helm-current-buffer)))
+           (user-error
+            "Can't kill `helm-current-buffer' without quitting session"))
+          ((and buf win (buffer-modified-p buf))
+           (message "Can't kill modified buffer, please save it before"))
+          ((and buf win)
+           (kill-buffer buf)
+           (set-window-buffer win helm-current-buffer)
+           (message "Buffer `%s' killed" buf-name))
+          (t (find-file candidate)))))
+
+(defun helm-ff-run-kill-buffer-persistent ()
+  "Execute `helm-ff-kill-buffer-fname' without quitting."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'kill-buffer-fname 'helm-ff-kill-buffer-fname)
+    (helm-execute-persistent-action 'kill-buffer-fname)))
+(put 'helm-ff-run-kill-buffer-persistent 'helm-only t)
+
+(defun helm-ff-prefix-filename (fname &optional file-or-symlinkp new-file)
+  "Return filename FNAME maybe prefixed with [?] or [@].
+If FILE-OR-SYMLINKP is non--nil this mean we assume FNAME is an
+existing filename or valid symlink and there is no need to test it.
+NEW-FILE when non--nil mean FNAME is a non existing file and
+return FNAME prefixed with [?]."
+  (let* ((prefix-new (propertize
+                      " " 'display
+                      (propertize "[?]" 'face 'helm-ff-prefix)))
+         (prefix-url (propertize
+                      " " 'display
+                      (propertize "[@]" 'face 'helm-ff-prefix))))
+    (cond (file-or-symlinkp fname)
+          ((or (string-match helm-ff-url-regexp fname)
+               (and ffap-url-regexp (string-match ffap-url-regexp fname)))
+           (concat prefix-url " " fname))
+          (new-file (concat prefix-new " " fname)))))
+
+(defun helm-ff-score-candidate-for-pattern (str pattern)
+  (if (member str '("." ".."))
+      200
+      (helm-score-candidate-for-pattern str pattern)))
+
+(defun helm-ff-sort-candidates (candidates _source)
+  "Sort function for `helm-source-find-files'.
+Return candidates prefixed with basename of `helm-input' first."
+  (if (or (and (file-directory-p helm-input)
+               (string-match "/\\'" helm-input))
+          (string-match "\\`\\$" helm-input)
+          (null candidates))
+      candidates
+      (let* ((c1        (car candidates))
+             (cand1real (if (consp c1) (cdr c1) c1))
+             (cand1     (unless (file-exists-p cand1real) c1))
+             (rest-cand (if cand1 (cdr candidates) candidates))
+             (memo-src  (make-hash-table :test 'equal))
+             (all (sort rest-cand
+                        (lambda (s1 s2)
+                            (let* ((score (lambda (str)
+                                            (helm-ff-score-candidate-for-pattern
+                                             str (helm-basename helm-input))))
+                                   (bn1 (helm-basename (if (consp s1) (cdr s1) s1)))
+                                   (bn2 (helm-basename (if (consp s2) (cdr s2) s2)))
+                                   (sc1 (or (gethash bn1 memo-src)
+                                            (puthash bn1 (funcall score bn1) memo-src)))
+                                   (sc2 (or (gethash bn2 memo-src)
+                                            (puthash bn2 (funcall score bn2) memo-src))))
+                              (cond ((= sc1 sc2)
+                                     (< (string-width bn1)
+                                        (string-width bn2)))
+                                    ((> sc1 sc2))))))))
+        (if cand1 (cons cand1 all) all))))
+
+(defun helm-ff-filter-candidate-one-by-one (file)
+  "`filter-one-by-one' Transformer function for `helm-source-find-files'."
+  ;; Handle boring files
+  (unless (and helm-ff-skip-boring-files
+               (cl-loop for r in helm-boring-file-regexp-list
+                        ;; Prevent user doing silly thing like
+                        ;; adding the dotted files to boring regexps (#924).
+                        thereis (and (not (string-match "\\.$" file))
+                                     (string-match r file))))
+    ;; Handle tramp files.
+    (if (and (string-match helm-tramp-file-name-regexp helm-pattern)
+             helm-ff-tramp-not-fancy)
+        (if helm-ff-transformer-show-only-basename
+            (if (helm-dir-is-dot file)
+                file
+              (cons (or (helm-ff-get-host-from-tramp-invalid-fname file)
+                        (helm-basename file))
+                    file))
+          file)
+      ;; Now highlight.
+      (let* ((disp (if (and helm-ff-transformer-show-only-basename
+                            (not (helm-dir-is-dot file))
+                            (not (and ffap-url-regexp
+                                      (string-match ffap-url-regexp file)))
+                            (not (string-match helm-ff-url-regexp file)))
+                       (or (helm-ff-get-host-from-tramp-invalid-fname file)
+                           (helm-basename file)) file))
+             (attr (file-attributes file))
+             (type (car attr)))
+
+        (cond ((string-match "file-error" file) file)
+              ( ;; A not already saved file.
+               (and (stringp type)
+                    (not (helm-ff-valid-symlink-p file))
+                    (not (string-match "^\.#" (helm-basename file))))
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-invalid-symlink) t)
+                     file))
+              ;; A dotted directory symlinked.
+              ((and (helm-ff-dot-file-p file) (stringp type))
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-dotted-symlink-directory) t)
+                     file))
+              ;; A dotted directory.
+              ((helm-ff-dot-file-p file)
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-dotted-directory) t)
+                     file))
+              ;; A symlink.
+              ((stringp type)
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-symlink) t)
+                     file))
+              ;; A directory.
+              ((eq t type)
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-directory) t)
+                     file))
+              ;; An executable file.
+              ((and attr (string-match "x" (nth 8 attr)))
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-executable) t)
+                     file))
+              ;; A file.
+              ((and attr (null type))
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-file) t)
+                     file))
+              ;; A non--existing file.
+              (t
+               (cons (helm-ff-prefix-filename
+                      (propertize disp 'face 'helm-ff-file) nil 'new-file)
+                     file)))))))
+
+(defun helm-find-files-action-transformer (actions candidate)
+  "Action transformer for `helm-source-find-files'."
+  (let ((str-at-point (with-helm-current-buffer
+                        (buffer-substring-no-properties
+                         (point-at-bol) (point-at-eol)))))
+    (cond ((with-helm-current-buffer
+             (eq major-mode 'message-mode))
+           (append actions
+                   '(("Gnus attach file(s)" . helm-ff-gnus-attach-files))))
+          ((save-match-data
+             (and ffap-url-regexp
+                  (not (string-match-p ffap-url-regexp str-at-point))
+                  (not (with-helm-current-buffer (eq major-mode 'dired-mode)))
+                  (string-match ":\\([0-9]+:?\\)" str-at-point)
+                  ))
+           (append '(("Find file to line number" . helm-ff-goto-linum))
+                   actions))
+          ((string-match (image-file-name-regexp) candidate)
+           (append actions
+                   '(("Rotate image right `M-r'" . helm-ff-rotate-image-right)
+                     ("Rotate image left `M-l'" . helm-ff-rotate-image-left))))
+          ((string-match "\.el$" (helm-aif (helm-marked-candidates)
+                                     (car it) candidate))
+           (append actions
+                   '(("Byte compile lisp file(s) `M-B, C-u to load'"
+                      . helm-find-files-byte-compile)
+                     ("Load File(s) `M-L'" . helm-find-files-load-files))))
+          ((and (string-match "\.html?$" candidate)
+                (file-exists-p candidate))
+           (append actions
+                   '(("Browse url file" . browse-url-of-file))))
+          ((or (string= (file-name-extension candidate) "pdf")
+               (string= (file-name-extension candidate) "PDF"))
+           (append actions
+                   '(("Pdfgrep File(s)" . helm-ff-pdfgrep))))
+          (t actions))))
+
+(defun helm-ff-goto-linum (candidate)
+  "Find file CANDIDATE and maybe jump to line number found in fname at point.
+line number should be added at end of fname preceded with \":\".
+e.g \"foo:12\"."
+  (let ((linum (with-helm-current-buffer
+                 (let ((str (buffer-substring-no-properties
+                             (point-at-bol) (point-at-eol))))
+                   (when (string-match ":\\([0-9]+:?\\)" str)
+                     (match-string 1 str))))))
+    (find-file candidate)
+    (and linum (not (string= linum ""))
+         (helm-goto-line (string-to-number linum) t))))
+
+(defun helm-ff-gnus-attach-files (_candidate)
+  "Run `gnus-dired-attach' on `helm-marked-candidates' or CANDIDATE."
+  (require 'gnus-dired)
+  (let ((flist (helm-marked-candidates :with-wildcard t)))
+    (gnus-dired-attach flist)))
+
+(defvar image-dired-display-image-buffer)
+(defun helm-ff-rotate-current-image-1 (file &optional num-arg)
+  "Rotate current image at NUM-ARG degrees.
+This is a destructive operation on FILE made by external tool mogrify."
+  (setq file (file-truename file)) ; For symlinked images.
+  ;; When FILE is not an image-file, do nothing.
+  (when (string-match (image-file-name-regexp) file)
+    (if (executable-find "mogrify")
+        (progn
+          (shell-command (format "mogrify -rotate %s %s"
+                                 (or num-arg 90)
+                                 (shell-quote-argument file)))
+          (when (buffer-live-p image-dired-display-image-buffer)
+            (kill-buffer image-dired-display-image-buffer))
+          (image-dired-display-image file)
+          (message nil)
+          (display-buffer (get-buffer image-dired-display-image-buffer)))
+      (error "mogrify not found"))))
+
+(defun helm-ff-rotate-image-left (candidate)
+  "Rotate image file CANDIDATE left.
+This affect directly file CANDIDATE."
+  (helm-ff-rotate-current-image-1 candidate -90))
+
+(defun helm-ff-rotate-image-right (candidate)
+  "Rotate image file CANDIDATE right.
+This affect directly file CANDIDATE."
+  (helm-ff-rotate-current-image-1 candidate))
+
+(defun helm-ff-rotate-left-persistent ()
+  "Rotate image left without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'image-action1 'helm-ff-rotate-image-left)
+    (helm-execute-persistent-action 'image-action1)))
+(put 'helm-ff-rotate-left-persistent 'helm-only t)
+
+(defun helm-ff-rotate-right-persistent ()
+  "Rotate image right without quitting helm."
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'image-action2 'helm-ff-rotate-image-right)
+    (helm-execute-persistent-action 'image-action2)))
+(put 'helm-ff-rotate-right-persistent 'helm-only t)
+
+(defun helm-ff-exif-data (candidate)
+  "Extract exif data from file CANDIDATE using `helm-ff-exif-data-program'."
+  (if (and helm-ff-exif-data-program
+           (executable-find helm-ff-exif-data-program))
+      (shell-command-to-string (format "%s %s %s"
+                                       helm-ff-exif-data-program
+                                       helm-ff-exif-data-program-args
+                                       candidate))
+    (format "No program %s found to extract exif"
+            helm-ff-exif-data-program)))
+
+(defun helm-find-files-persistent-action (candidate)
+  "Open subtree CANDIDATE without quitting helm.
+If CANDIDATE is not a directory expand CANDIDATE filename.
+If CANDIDATE is alone, open file CANDIDATE filename.
+That's mean:
+First hit on C-j expand CANDIDATE second hit open file.
+If a prefix arg is given or `helm-follow-mode' is on open file."
+  (let* ((follow        (or (buffer-local-value
+                             'helm-follow-mode
+                             (get-buffer-create helm-buffer))
+                            helm--temp-follow-flag))
+         (new-pattern   (helm-get-selection))
+         (num-lines-buf (with-current-buffer helm-buffer
+                          (count-lines (point-min) (point-max))))
+         (insert-in-minibuffer (lambda (fname)
+                                   (with-selected-window (minibuffer-window)
+                                     (unless follow
+                                       (delete-minibuffer-contents)
+                                       (set-text-properties 0 (length fname)
+                                                            nil fname)
+                                       (insert fname))))))
+    (cond ((and (helm-ff-invalid-tramp-name-p)
+                (string-match helm-tramp-file-name-regexp candidate))
+           ;; First hit insert hostname and
+           ;; second hit insert ":" and expand.
+           (if (string= candidate helm-pattern)
+               (funcall insert-in-minibuffer (concat candidate ":"))
+               (funcall insert-in-minibuffer candidate)))
+          (;; A symlink directory, expand it but not to its truename
+           ;; unless a prefix arg is given.
+           (and (file-directory-p candidate) (file-symlink-p candidate))
+           (funcall insert-in-minibuffer
+                    (file-name-as-directory
+                     (if current-prefix-arg
+                         (file-truename (expand-file-name candidate))
+                         (expand-file-name candidate)))))
+          ;; A directory, open it.
+          ((file-directory-p candidate)
+           (when (string= (helm-basename candidate) "..")
+             (setq helm-ff-last-expanded helm-ff-default-directory))
+           (funcall insert-in-minibuffer (file-name-as-directory
+                                          (expand-file-name candidate))))
+          ;; A symlink file, expand to it's true name. (first hit)
+          ((and (file-symlink-p candidate) (not current-prefix-arg) (not follow))
+           (funcall insert-in-minibuffer (file-truename candidate)))
+          ;; A regular file, expand it, (first hit)
+          ((and (>= num-lines-buf 3) (not current-prefix-arg) (not follow))
+           (setq helm-pattern "")       ; Force update.
+           (funcall insert-in-minibuffer new-pattern))
+          ;; An image file and it is the second hit on C-j,
+          ;; show the file in `image-dired'.
+          ((string-match (image-file-name-regexp) candidate)
+           (when (buffer-live-p (get-buffer image-dired-display-image-buffer))
+             (kill-buffer image-dired-display-image-buffer))
+           ;; Fix emacs bug never fixed upstream.
+           (unless (file-directory-p image-dired-dir)
+             (make-directory image-dired-dir))
+           (image-dired-display-image candidate)
+           (message nil)
+           (switch-to-buffer image-dired-display-image-buffer)
+           (with-current-buffer image-dired-display-image-buffer
+             (let ((exif-data (helm-ff-exif-data candidate)))
+               (setq default-directory helm-ff-default-directory)
+               (image-dired-update-property 'help-echo exif-data))))
+          ;; Allow browsing archive on avfs fs.
+          ;; Assume volume is already mounted with mountavfs.
+          ((and helm-ff-avfs-directory
+                (string-match
+                 (regexp-quote (expand-file-name helm-ff-avfs-directory))
+                 (file-name-directory candidate))
+                (helm-ff-file-compressed-p candidate))
+           (funcall insert-in-minibuffer (concat candidate "#")))
+          ;; On second hit we open file.
+          ;; On Third hit we kill it's buffer maybe.
+          (t
+           (helm-ff-kill-or-find-buffer-fname candidate)))))
+
+(defun helm-ff-file-compressed-p (candidate)
+  "Whether CANDIDATE is a compressed file or not."
+  (member (file-name-extension candidate)
+          helm-ff-file-compressed-list))
+
+(defun helm-insert-file-name-completion-at-point (candidate)
+  "Insert file name completion at point."
+  (with-helm-current-buffer
+    (if buffer-read-only
+        (error "Error: Buffer `%s' is read-only" (buffer-name))
+      (let* ((end         (point))
+             (tap         (thing-at-point 'filename))
+             (guess       (and (stringp tap) (substring-no-properties tap)))
+             (beg         (- (point) (length guess)))
+             (full-path-p (and (stringp guess)
+                               (or (string-match-p
+                                    (concat "^" (getenv "HOME"))
+                                    guess)
+                                   (string-match-p
+                                    "\\`\\(/\\|[[:lower:][:upper:]]:/\\)"
+                                    guess)))))
+        (set-text-properties 0 (length candidate) nil candidate)
+        (if (and guess (not (string= guess ""))
+                 (or (string-match "^\\(~/\\|/\\|[[:lower:][:upper:]]:/\\)"
+                                   guess)
+                     (file-exists-p candidate)))
+            (progn
+              (delete-region beg end)
+              (insert (cond (full-path-p
+                             (expand-file-name candidate))
+                            ((string= (match-string 1 guess) "~/")
+                              (abbreviate-file-name candidate))
+                            (t (file-relative-name candidate)))))
+            (insert (cond ((equal helm-current-prefix-arg '(4))
+                           (abbreviate-file-name candidate))
+                          ((equal helm-current-prefix-arg '(16))
+                           (file-relative-name candidate))
+                          (t candidate))))))))
+
+(cl-defun helm-find-files-history (&key (comp-read t))
+  "The `helm-find-files' history.
+Show the first `helm-ff-history-max-length' elements of
+`helm-ff-history' in an `helm-comp-read'."
+  (let ((history (when helm-ff-history
+                   (helm-fast-remove-dups helm-ff-history
+                                          :test 'equal))))
+    (when history
+      (setq helm-ff-history
+            (if (>= (length history) helm-ff-history-max-length)
+                (cl-subseq history 0 helm-ff-history-max-length)
+              history))
+      (if comp-read
+          (helm-comp-read
+           "Switch to Directory: "
+           helm-ff-history
+           :name "Helm Find Files History"
+           :must-match t)
+        helm-ff-history))))
+
+(defun helm-find-files-1 (fname &optional preselect)
+  "Find FNAME with `helm' completion.
+Like `find-file' but with `helm' support.
+Use it for non--interactive calls of `helm-find-files'."
+  (when (get-buffer helm-action-buffer)
+    (kill-buffer helm-action-buffer))
+  (setq helm-find-files--toggle-bookmark nil)
+  (let* ( ;; Be sure we don't erase the precedent minibuffer if some.
+         (helm-ff-auto-update-initial-value
+          (and helm-ff-auto-update-initial-value
+               (not (minibuffer-window-active-p (minibuffer-window)))))
+         (tap (thing-at-point 'filename))
+         (def (and tap (or (file-remote-p tap)
+                           (expand-file-name tap)))))
+    (unless helm-source-find-files
+      (setq helm-source-find-files (helm-make-source
+                                    "Find Files" 'helm-source-ffiles)))
+    (unwind-protect
+         (helm :sources 'helm-source-find-files
+               :input fname
+               :case-fold-search helm-file-name-case-fold-search
+               :preselect preselect
+               :ff-transformer-show-only-basename
+               helm-ff-transformer-show-only-basename
+               :default def
+               :prompt "Find Files or Url: "
+               :buffer "*Helm Find Files*")
+      (setq helm-ff-default-directory nil))))
+
+(defun helm-find-files-toggle-to-bookmark ()
+  "Toggle helm-bookmark for `helm-find-files' and `helm-find-files.'"
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-buffer
+      (if (setq helm-find-files--toggle-bookmark
+                (not helm-find-files--toggle-bookmark))
+          (progn
+            (helm-set-pattern "" t)
+            (helm-set-sources '(helm-source-bookmark-helm-find-files)))
+          ;; Switch back to helm-find-files.
+          (helm-set-pattern "./" t) ; Back to initial directory of hff session.
+          (helm-set-sources '(helm-source-find-files))
+          (helm--maybe-update-keymap))))) 
+(put 'helm-find-files-toggle-to-bookmark 'helm-only t)
+
+(defun helm-find-files-initial-input (&optional input)
+  "Return INPUT if present, otherwise try to guess it."
+  (let ((ffap-machine-p-known 'reject)
+        (ffap-alist (and helm-ff-guess-ffap-filenames ffap-alist))
+        (ffap-url-regexp (and helm-ff-guess-ffap-urls ffap-url-regexp)))
+    (unless (eq major-mode 'image-mode)
+      (or (and input (or (and (file-remote-p input) input)
+                         (expand-file-name input)))
+          (helm-find-files-input
+           (ffap-guesser)
+           (thing-at-point 'filename))))))
+
+(defun helm-find-files-input (file-at-pt thing-at-pt)
+  "Try to guess a default input for `helm-find-files'."
+  (let* ((non-essential t)
+         (remp (or (and file-at-pt (file-remote-p file-at-pt))
+                   (and thing-at-pt (file-remote-p thing-at-pt))))
+         (def-dir (helm-current-directory))
+         (urlp (and file-at-pt ffap-url-regexp
+                    (string-match ffap-url-regexp file-at-pt)))
+         (lib     (when helm-ff-search-library-in-sexp
+                    (helm-find-library-at-point)))
+         (hlink   (helm-ff-find-url-at-point))
+         (file-p  (and file-at-pt
+                       (not (string= file-at-pt ""))
+                       (not remp)
+                       (file-exists-p file-at-pt)
+                       thing-at-pt
+                       (not (string= thing-at-pt ""))
+                       (file-exists-p
+                        (file-name-directory
+                         (expand-file-name thing-at-pt def-dir))))))
+    (cond (lib)      ; e.g we are inside a require sexp.
+          (hlink)    ; String at point is an hyperlink.
+          (file-p    ; a regular file
+           (helm-aif (ffap-file-at-point) (expand-file-name it)))
+          (urlp file-at-pt) ; possibly an url or email.
+          ((and file-at-pt
+                (not remp)
+                (file-exists-p file-at-pt))
+           file-at-pt))))
+
+(defun helm-ff-find-url-at-point ()
+  "Try to find link to an url in text-property at point."
+  (let* ((he      (get-text-property (point) 'help-echo))
+         (ov      (overlays-at (point)))
+         (ov-he   (and ov (overlay-get
+                           (car (overlays-at (point))) 'help-echo)))
+         (w3m-l   (get-text-property (point) 'w3m-href-anchor))
+         (nt-prop (get-text-property (point) 'nt-link)))
+    ;; Org link.
+    (when (and (stringp he) (string-match "^LINK: " he))
+      (setq he (replace-match "" t t he)))
+    (cl-loop for i in (list he ov-he w3m-l nt-prop)
+          thereis (and (stringp i) ffap-url-regexp (string-match ffap-url-regexp i) i))))
+
+(defun helm-find-library-at-point ()
+  "Try to find library path at point.
+Find inside `require' and `declare-function' sexp."
+  (require 'find-func)
+  (let* ((beg-sexp (save-excursion (search-backward "(" (point-at-bol) t)))
+         (end-sexp (save-excursion (search-forward ")" (point-at-eol) t)))
+         (sexp     (and beg-sexp end-sexp
+                        (buffer-substring-no-properties
+                         (1+ beg-sexp) (1- end-sexp)))))
+    (ignore-errors
+      (cond ((and sexp (string-match "require \'.+[^)]" sexp))
+             (find-library-name
+              (replace-regexp-in-string
+               "'\\|\)\\|\(" ""
+               ;; If require use third arg, ignore it,
+               ;; always use library path found in `load-path'.
+               (cl-second (split-string (match-string 0 sexp))))))
+            ((and sexp (string-match-p "^declare-function" sexp))
+             (find-library-name
+              (replace-regexp-in-string
+               "\"\\|ext:" ""
+               (cl-third (split-string sexp)))))
+            (t nil)))))
+
+\f
+;;; Handle copy, rename, symlink, relsymlink and hardlink from helm.
+;;
+;;
+(defun helm-ff--valid-default-directory ()
+  (with-helm-current-buffer
+    (cl-loop for b in (buffer-list)
+             for cd = (with-current-buffer b default-directory)
+             when (eq (car (file-attributes cd)) t)
+             return cd)))
+
+(defvar dired-async-mode)
+(cl-defun helm-dired-action (candidate
+                             &key action follow (files (dired-get-marked-files)))
+  "Execute ACTION on FILES to CANDIDATE.
+Where ACTION is a symbol that can be one of:
+'copy, 'rename, 'symlink,'relsymlink, 'hardlink.
+Argument FOLLOW when non--nil specify to follow FILES to destination for the actions
+copy and rename."
+  (when (get-buffer dired-log-buffer) (kill-buffer dired-log-buffer))
+  ;; When default-directory in current-buffer is an invalid directory,
+  ;; (e.g buffer-file directory have been renamed somewhere else)
+  ;; be sure to use a valid value to give to dired-create-file.
+  ;; i.e start-process is creating a process buffer based on default-directory.
+  (let ((default-directory (helm-ff--valid-default-directory))
+        (fn     (cl-case action
+                  (copy       'dired-copy-file)
+                  (rename     'dired-rename-file)
+                  (symlink    'make-symbolic-link)
+                  (relsymlink 'dired-make-relative-symlink)
+                  (hardlink   'dired-hardlink)))
+        (marker (cl-case action
+                  ((copy rename)   dired-keep-marker-copy)
+                  (symlink        dired-keep-marker-symlink)
+                  (relsymlink     dired-keep-marker-relsymlink)
+                  (hardlink       dired-keep-marker-hardlink)))
+        (dirflag (and (= (length files) 1)
+                      (file-directory-p (car files))
+                      (not (file-directory-p candidate))))
+        (dired-async-state (if (and (boundp 'dired-async-mode)
+                                    dired-async-mode)
+                               1 -1)))
+    (and follow (fboundp 'dired-async-mode) (dired-async-mode -1))
+    (when (and (cdr files) (not (file-directory-p candidate)))
+      (error "%s: target `%s' is not a directory" action candidate))
+    (unwind-protect
+         (dired-create-files
+          fn (symbol-name action) files
+          ;; CANDIDATE is the destination.
+          (if (file-directory-p candidate)
+              ;; When CANDIDATE is a directory, build file-name in this directory.
+              ;; Else we use CANDIDATE.
+              (lambda (from)
+                  (expand-file-name (file-name-nondirectory from) candidate))
+              (lambda (_from) candidate))
+          marker)
+      (and (fboundp 'dired-async-mode)
+           (dired-async-mode dired-async-state)))
+    (push (file-name-as-directory
+           (if (file-directory-p candidate)
+               (expand-file-name candidate)
+             (file-name-directory candidate)))
+          helm-ff-history)
+    ;; If follow is non--nil we should not be in async mode.
+    (when (and follow
+               (not (memq action '(symlink relsymlink hardlink)))
+               (not (get-buffer dired-log-buffer)))
+      (let ((target (directory-file-name candidate)))
+        (unwind-protect
+             (progn
+               (setq helm-ff-cand-to-mark
+                     (helm-get-dest-fnames-from-list files candidate dirflag))
+               (with-helm-after-update-hook (helm-ff-maybe-mark-candidates))
+               (if (and dirflag (eq action 'rename))
+                   (helm-find-files-1 (file-name-directory target)
+                                      (if helm-ff-transformer-show-only-basename
+                                          (helm-basename target) target))
+                 (helm-find-files-1 (file-name-as-directory
+                                     (expand-file-name candidate)))))
+          (setq helm-ff-cand-to-mark nil))))))
+
+(defun helm-get-dest-fnames-from-list (flist dest-cand rename-dir-flag)
+  "Transform filenames of FLIST to abs of DEST-CAND.
+If RENAME-DIR-FLAG is non--nil collect the `directory-file-name' of transformed
+members of FLIST."
+  ;; At this point files have been renamed/copied at destination.
+  ;; That's mean DEST-CAND exists.
+  (cl-loop
+        with dest = (expand-file-name dest-cand)
+        for src in flist
+        for basename-src = (helm-basename src)
+        for fname = (cond (rename-dir-flag (directory-file-name dest))
+                          ((file-directory-p dest)
+                           (concat (file-name-as-directory dest) basename-src))
+                          (t dest))
+        when (file-exists-p fname)
+        collect fname into tmp-list
+        finally return (sort tmp-list 'string<)))
+
+(defun helm-ff-maybe-mark-candidates ()
+  "Mark all candidates of list `helm-ff-cand-to-mark'.
+This is used when copying/renaming/symlinking etc... and
+following files to destination."
+  (when (and (string= (assoc-default 'name (helm-get-current-source))
+                      (assoc-default 'name helm-source-find-files))
+             helm-ff-cand-to-mark)
+    (with-helm-window
+      (while helm-ff-cand-to-mark
+        (if (string= (car helm-ff-cand-to-mark) (helm-get-selection))
+            (progn
+              (helm-make-visible-mark)
+              (helm-next-line)
+              (setq helm-ff-cand-to-mark (cdr helm-ff-cand-to-mark)))
+          (helm-next-line)))
+      (unless (helm-this-visible-mark)
+        (helm-prev-visible-mark)))))
+
+\f
+;;; Routines for files
+;;
+;;
+(defun helm-file-buffers (filename)
+  "Returns a list of buffer names corresponding to FILENAME."
+  (cl-loop with name = (expand-file-name filename)
+        for buf in (buffer-list)
+        for bfn = (buffer-file-name buf)
+        when (and bfn (string= name bfn))
+        collect (buffer-name buf)))
+
+(defun helm-delete-file (file &optional error-if-dot-file-p synchro)
+  "Delete the given file after querying the user.
+Ask to kill buffers associated with that file, too."
+  (when (and error-if-dot-file-p
+             (helm-ff-dot-file-p file))
+    (error "Error: Cannot operate on `.' or `..'"))
+  (let ((buffers (helm-file-buffers file))
+        (helm--reading-passwd-or-string t))
+    (if (or (< emacs-major-version 24) synchro)
+        ;; `dired-delete-file' in Emacs versions < 24
+        ;; doesn't support delete-by-moving-to-trash
+        ;; so use `delete-directory' and `delete-file'
+        ;; that handle it.
+        (cond ((and (not (file-symlink-p file))
+                    (file-directory-p file)
+                    (directory-files file t dired-re-no-dot))
+               (when (y-or-n-p (format "Recursive delete of `%s'? " file))
+                 (delete-directory file 'recursive)))
+              ((and (not (file-symlink-p file))
+                    (file-directory-p file))
+               (delete-directory file))
+              (t (delete-file file)))
+      (dired-delete-file
+       file dired-recursive-deletes delete-by-moving-to-trash))
+    (when buffers
+      (cl-dolist (buf buffers)
+        (when (y-or-n-p (format "Kill buffer %s, too? " buf))
+          (kill-buffer buf))))))
+
+(defun helm-delete-marked-files (_ignore)
+  (let* ((files (helm-marked-candidates :with-wildcard t))
+         (len (length files)))
+    (with-helm-display-marked-candidates
+      helm-marked-buffer-name
+      (mapcar (lambda (f)
+                  (if (file-directory-p f)
+                      (concat (helm-basename f) "/")
+                    (helm-basename f)))
+              files)
+      (if (not (y-or-n-p (format "Delete *%s File(s)" len)))
+          (message "(No deletions performed)")
+        (cl-dolist (i files)
+          (set-text-properties 0 (length i) nil i)
+          (helm-delete-file i helm-ff-signal-error-on-dot-files))
+        (message "%s File(s) deleted" len)))))
+
+(defun helm-find-file-or-marked (candidate)
+  "Open file CANDIDATE or open helm marked files in separate windows.
+Called with a prefix arg open files in background without selecting them."
+  (let ((marked (helm-marked-candidates :with-wildcard t))
+        (url-p (and ffap-url-regexp ; we should have only one candidate.
+                    (string-match ffap-url-regexp candidate)))
+        (ffap-newfile-prompt helm-ff-newfile-prompt-p)
+        (find-file-wildcards nil)
+        (make-dir-fn
+         (lambda (dir &optional helm-ff)
+             (when (or (not confirm-nonexistent-file-or-buffer)
+                     (y-or-n-p (format "Create directory `%s'? " dir)))
+               (let ((dirfname (directory-file-name dir)))
+                 (if (file-exists-p dirfname)
+                     (error
+                      "Mkdir: Unable to create directory `%s': file exists."
+                      (helm-basename dirfname))
+                   (make-directory dir 'parent)))
+               (when helm-ff
+                 ;; Allow having this new dir in history
+                 ;; to be able to retrieve it immediately
+                 ;; if we want to e.g copy a file from somewhere in it.
+                 (setq helm-ff-default-directory
+                       (file-name-as-directory dir))
+                 (push helm-ff-default-directory helm-ff-history))
+               (or (and helm-ff (helm-find-files-1 dir)) t))))
+        (helm--reading-passwd-or-string t))
+    (if (cdr marked)
+        (if helm-current-prefix-arg
+            (dired-simultaneous-find-file marked nil)
+            (mapc 'find-file-noselect (cdr marked))
+            (find-file (car marked)))
+      (if (and (not (file-exists-p candidate))
+               (not url-p)
+               (string-match "/$" candidate))
+          ;; A a non--existing filename ending with /
+          ;; Create a directory and jump to it.
+          (funcall make-dir-fn candidate 'helm-ff)
+        ;; A non--existing filename NOT ending with / or
+        ;; an existing filename, create or jump to it.
+        ;; If the basedir of candidate doesn't exists,
+        ;; ask for creating it.
+        (let ((dir (and (not url-p) (helm-basedir candidate))))
+          (find-file-at-point
+           (cond ((and dir (file-directory-p dir))
+                  (substitute-in-file-name candidate))
+                 (url-p candidate)
+                 ((funcall make-dir-fn dir) candidate))))))))
+
+(defun helm-shadow-boring-files (files)
+  "Files matching `helm-boring-file-regexp' will be
+displayed with the `file-name-shadow' face if available."
+  (helm-shadow-entries files helm-boring-file-regexp-list))
+
+(defun helm-skip-boring-files (files)
+  "Files matching `helm-boring-file-regexp' will be skipped."
+  (helm-skip-entries files helm-boring-file-regexp-list))
+
+(defun helm-skip-current-file (files)
+  "Current file will be skipped."
+  (remove (buffer-file-name helm-current-buffer) files))
+
+(defun helm-w32-pathname-transformer (args)
+  "Change undesirable features of windows pathnames to ones more acceptable to
+other candidate transformers."
+  (if (eq system-type 'windows-nt)
+      (helm-transform-mapcar
+       (lambda (x)
+         (replace-regexp-in-string
+          "/cygdrive/\\(.\\)" "\\1:"
+          (replace-regexp-in-string "\\\\" "/" x)))
+       args)
+    args))
+
+(defun helm-transform-file-load-el (actions candidate)
+  "Add action to load the file CANDIDATE if it is an emacs lisp
+file.  Else return ACTIONS unmodified."
+  (if (member (file-name-extension candidate) '("el" "elc"))
+      (append actions '(("Load Emacs Lisp File" . load-file)))
+    actions))
+
+(defun helm-transform-file-browse-url (actions candidate)
+  "Add an action to browse the file CANDIDATE if it is a html file or URL.
+Else return ACTIONS unmodified."
+  (let ((browse-action '("Browse with Browser" . browse-url)))
+    (cond ((string-match "^http\\|^ftp" candidate)
+           (cons browse-action actions))
+          ((string-match "\\.html?$" candidate)
+           (append actions (list browse-action)))
+          (t actions))))
+
+(defun helm-multi-files-toggle-to-locate ()
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-buffer
+      (if (setq helm-multi-files--toggle-locate
+                (not helm-multi-files--toggle-locate))
+          (progn
+            (helm-set-sources (unless (memq 'helm-source-locate
+                                            helm-sources)
+                                (cons 'helm-source-locate helm-sources)))
+            (helm-set-source-filter '(helm-source-locate)))
+          (helm-kill-async-processes)
+          (helm-set-sources (remove 'helm-source-locate
+                                    helm-for-files-preferred-list))
+          (helm-set-source-filter nil)))))
+(put 'helm-multi-files-toggle-to-locate 'helm-only t)
+
+\f
+;;; List of files gleaned from every dired buffer
+;;
+;;
+(defun helm-files-in-all-dired-candidates ()
+  (save-excursion
+    (cl-loop for (f . b) in dired-buffers
+          when (buffer-live-p b)
+          append (let ((dir (with-current-buffer b dired-directory)))
+                   (if (listp dir) (cdr dir)
+                     (directory-files f t dired-re-no-dot))))))
+
+;; (dired '("~/" "~/.emacs.d/.emacs-custom.el" "~/.emacs.d/.emacs.bmk"))
+
+(defclass helm-files-dired-source (helm-source-sync helm-type-file)
+  ((candidates :initform #'helm-files-in-all-dired-candidates)))
+
+(defvar helm-source-files-in-all-dired
+  (helm-make-source "Files in all dired buffer." 'helm-files-dired-source))
+
+\f
+;;; File Cache
+;;
+;;
+(defvar file-cache-alist)
+
+(defclass helm-file-cache (helm-source-in-buffer helm-type-file)
+  ((init :initform (lambda () (require 'filecache)))))
+
+(defun helm-file-cache-get-candidates ()
+  (cl-loop for item in file-cache-alist append
+           (cl-destructuring-bind (base &rest dirs) item
+             (cl-loop for dir in dirs collect
+                      (concat dir base)))))
+
+(defvar helm-source-file-cache nil)
+
+(defcustom helm-file-cache-fuzzy-match nil
+  "Enable fuzzy matching in `helm-source-file-cache' when non--nil."
+  :group 'helm-files
+  :type 'boolean
+  :set (lambda (var val)
+         (set var val)
+         (setq helm-source-file-cache
+               (helm-make-source "File Cache" 'helm-file-cache
+                 :fuzzy-match helm-file-cache-fuzzy-match
+                 :data 'helm-file-cache-get-candidates))))
+
+(cl-defun helm-file-cache-add-directory-recursively
+    (dir &optional match (ignore-dirs t))
+  (require 'filecache)
+  (cl-loop for f in (helm-walk-directory
+                     dir
+                     :path 'full
+                     :directories nil
+                     :match match
+                     :skip-subdirs ignore-dirs) 
+           do (file-cache-add-file f)))
+
+(defun helm-ff-cache-add-file (_candidate)
+  (require 'filecache)
+  (let ((mkd (helm-marked-candidates :with-wildcard t)))
+    (mapc 'file-cache-add-file mkd)))
+
+(defun helm-ff-file-cache-remove-file-1 (file)
+  "Remove FILE from `file-cache-alist'."
+  (let ((entry (assoc (helm-basename file) file-cache-alist))
+        (dir   (helm-basedir file))
+        new-entry)
+    (setq new-entry (remove dir entry))
+    (when (= (length entry) 1)
+      (setq new-entry nil))
+    (setq file-cache-alist
+          (cons new-entry (remove entry file-cache-alist)))))
+
+(defun helm-ff-file-cache-remove-file (_file)
+  "Remove marked files from `file-cache-alist.'"
+  (let ((mkd (helm-marked-candidates)))
+    (mapc 'helm-ff-file-cache-remove-file-1 mkd)))
+
+(defun helm-transform-file-cache (actions _candidate)
+  (let ((source (helm-get-current-source)))
+    (if (string= (assoc-default 'name source) "File Cache")
+        (append actions
+                '(("Remove marked files from file-cache"
+                   . helm-ff-file-cache-remove-file)))
+        actions)))
+
+\f
+;;; File name history
+;;
+;;
+(defvar helm-source-file-name-history
+  (helm-build-sync-source "File Name History"
+    :candidates 'file-name-history
+    :persistent-action #'ignore
+    :filtered-candidate-transformer #'helm-file-name-history-transformer
+    :action 'helm-type-file-actions))
+
+(defvar helm-source--ff-file-name-history nil
+  "[Internal] This source is build to be used with `helm-find-files'.
+Don't use it in your own code unless you know what you are doing.")
+
+(defun helm-file-name-history-transformer (candidates _source)
+  (cl-loop for c in candidates collect
+        (cond ((file-remote-p c)
+               (cons (propertize c 'face 'helm-history-remote) c))
+              ((file-exists-p c)
+               (cons (propertize c 'face 'helm-ff-file) c))
+              (t (cons (propertize c 'face 'helm-history-deleted) c)))))
+
+(defun helm-ff-file-name-history ()
+  "Switch to `file-name-history' without quitting `helm-find-files'."
+  (interactive)
+  (unless helm-source--ff-file-name-history
+    (setq helm-source--ff-file-name-history
+          (helm-build-sync-source "File name history"
+            :init (lambda ()
+                    (with-helm-alive-p
+                      (when helm-ff-file-name-history-use-recentf
+                        (require 'recentf)
+                        (or recentf-mode (recentf-mode 1)))))
+            :candidates (lambda ()
+                          (if helm-ff-file-name-history-use-recentf
+                              recentf-list
+                              file-name-history))
+            :fuzzy-match t
+            :persistent-action 'ignore
+            :migemo t
+            :filtered-candidate-transformer 'helm-file-name-history-transformer
+            :action (helm-make-actions
+                     "Find file" (lambda (candidate)
+                                   (helm-set-pattern
+                                    (expand-file-name candidate))
+                                   (with-helm-after-update-hook (helm-exit-minibuffer)))
+                     "Find file in helm" (lambda (candidate)
+                                           (helm-set-pattern
+                                            (expand-file-name candidate)))))))
+  (with-helm-alive-p
+    (helm :sources 'helm-source--ff-file-name-history
+          :buffer "*helm-file-name-history*"
+          :allow-nest t
+          :resume 'noresume)))
+(put 'helm-ff-file-name-history 'helm-only t)
+
+;;; Recentf files
+;;
+;;
+(defvar helm-recentf--basename-flag nil)
+
+(defun helm-recentf-pattern-transformer (pattern)
+  (let ((pattern-no-flag (replace-regexp-in-string " -b" "" pattern)))
+    (cond ((and (string-match " " pattern-no-flag)
+                (string-match " -b\\'" pattern))
+           (setq helm-recentf--basename-flag t)
+           pattern-no-flag)
+        ((string-match "\\([^ ]*\\) -b\\'" pattern)
+         (prog1 (match-string 1 pattern)
+           (setq helm-recentf--basename-flag t)))
+        (t (setq helm-recentf--basename-flag nil)
+           pattern))))
+
+(defclass helm-recentf-source (helm-source-sync helm-type-file)
+  ((init :initform (lambda ()
+                     (require 'recentf)
+                     (recentf-mode 1)))
+   (candidates :initform (lambda () recentf-list))
+   (pattern-transformer :initform 'helm-recentf-pattern-transformer)
+   (match-part :initform (lambda (candidate)
+                           (if (or helm-ff-transformer-show-only-basename
+                                   helm-recentf--basename-flag)
+                               (helm-basename candidate) candidate)))
+   (migemo :initform t)
+   (persistent-action :initform 'helm-ff-kill-or-find-buffer-fname)))
+
+(defmethod helm--setup-source :after ((source helm-recentf-source))
+  (set-slot-value
+   source 'action
+   (append (symbol-value (helm-actions-from-type-file))
+           '(("Delete file(s) from recentf" .
+              (lambda (_candidate)
+                (cl-loop for file in (helm-marked-candidates)
+                         do (setq recentf-list (delq file recentf-list)))))))))
+
+(defvar helm-source-recentf nil 
+  "See (info \"(emacs)File Conveniences\").
+Set `recentf-max-saved-items' to a bigger value if default is too small.")
+
+(defcustom helm-recentf-fuzzy-match nil
+  "Enable fuzzy matching in `helm-source-recentf' when non--nil."
+  :group 'helm-files
+  :type 'boolean
+  :set (lambda (var val)
+         (set var val)
+         (setq helm-source-recentf
+               (helm-make-source "Recentf" 'helm-recentf-source
+                 :fuzzy-match helm-recentf-fuzzy-match))))
+
+;;; Browse project
+;; Need dependencies:
+;; <https://github.com/emacs-helm/helm-ls-git>
+;; <https://github.com/emacs-helm/helm-ls-hg>
+;; Only hg and git are supported for now.
+(defvar helm--browse-project-cache (make-hash-table :test 'equal))
+
+(defun helm-browse-project-get-buffers (root-directory)
+  (cl-loop for b in (helm-buffer-list)
+           ;; FIXME: Why default-directory is root-directory
+           ;; for current-buffer when coming from helm-quit-and-find-file.
+           for cd = (with-current-buffer b default-directory)
+           for bn = (buffer-file-name (get-buffer b))
+           if (or (and bn (file-in-directory-p bn root-directory))
+                  (and (null bn)
+                       (file-in-directory-p cd root-directory)))
+           collect b))
+
+(defun helm-browse-project-build-buffers-source (directory)
+  (helm-make-source "Buffers in project" 'helm-source-buffers
+    :header-name (lambda (name)
+                   (format
+                    "%s (%s)"
+                    name (abbreviate-file-name directory)))
+    :buffer-list (lambda () (helm-browse-project-get-buffers directory))))
+
+(defun helm-browse-project-find-files (directory &optional refresh)
+  (when refresh (remhash directory helm--browse-project-cache))
+  (unless (gethash directory helm--browse-project-cache)
+    (puthash directory (helm-walk-directory
+                        directory
+                        :directories nil :path 'full :skip-subdirs t)
+             helm--browse-project-cache))
+  (helm :sources `(,(helm-browse-project-build-buffers-source directory)
+                   ,(helm-build-in-buffer-source "Browse project"
+                     :data (gethash directory helm--browse-project-cache)
+                     :header-name (lambda (name)
+                                    (format
+                                     "%s (%s)"
+                                     name (abbreviate-file-name directory)))
+                     :match-part (lambda (c)
+                                   (if helm-ff-transformer-show-only-basename
+                                       (helm-basename c) c))
+                     :filter-one-by-one
+                     (lambda (c)
+                       (if helm-ff-transformer-show-only-basename
+                           (cons (propertize (helm-basename c)
+                                             'face 'helm-ff-file)
+                                 c)
+                           (propertize c 'face 'helm-ff-file)))
+                     :keymap helm-generic-files-map
+                     :action 'helm-type-file-actions)) 
+        :buffer "*helm browse project*"))
+
+;;;###autoload
+(defun helm-browse-project (arg)
+  "Preconfigured helm to browse projects.
+Browse files and see status of project with its vcs.
+Only HG and GIT are supported for now.
+Fall back to `helm-browse-project-find-files'
+if current directory is not under control of one of those vcs.
+With a prefix ARG browse files recursively, with two prefix ARG
+rebuild the cache.
+If the current directory is found in the cache, start
+`helm-browse-project-find-files' even with no prefix ARG.
+NOTE: The prefix ARG have no effect on the VCS controlled directories.
+
+Needed dependencies for VCS:
+<https://github.com/emacs-helm/helm-ls-git>
+and
+<https://github.com/emacs-helm/helm-ls-hg>
+and
+<http://melpa.org/#/helm-ls-svn>."
+  (interactive "P")
+  (cond ((and (require 'helm-ls-git nil t)
+              (fboundp 'helm-ls-git-root-dir)
+              (helm-ls-git-root-dir))
+         (helm-ls-git-ls))
+        ((and (require 'helm-ls-hg nil t)
+              (fboundp 'helm-hg-root)
+              (helm-hg-root))
+         (helm-hg-find-files-in-project))
+        ((and (require 'helm-ls-svn nil t)
+              (fboundp 'helm-ls-svn-root-dir)
+              (helm-ls-svn-root-dir))
+         (helm-ls-svn-ls))
+        (t (let ((cur-dir (helm-browse-project-get--root-dir
+                           (helm-current-directory))))
+             (if (or arg (gethash cur-dir helm--browse-project-cache))
+                 (helm-browse-project-find-files cur-dir (equal arg '(16)))
+                 (helm :sources (helm-browse-project-build-buffers-source cur-dir)
+                       :buffer "*helm browse project*"))))))
+
+(defun helm-browse-project-get--root-dir (directory)
+  (cl-loop with dname = (file-name-as-directory directory)
+           while (and dname (not (gethash dname helm--browse-project-cache)))
+           if (file-remote-p dname)
+           do (setq dname nil) else
+           do (setq dname (helm-basedir (substring dname 0 (1- (length dname)))))
+           finally return (or dname (file-name-as-directory directory))))
+
+(defun helm-ff-browse-project (_candidate)
+  "Browse project in current directory.
+See `helm-browse-project'."
+  (with-helm-default-directory helm-ff-default-directory
+      (helm-browse-project helm-current-prefix-arg)))
+
+(defun helm-ff-run-browse-project ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-browse-project)))
+(put 'helm-ff-run-browse-project 'helm-only t)
+
+(defun helm-ff-gid (_candidate)
+  (with-helm-default-directory helm-ff-default-directory
+      (helm-gid)))
+
+(defun helm-ff-run-gid ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-gid)))
+(put 'helm-ff-run-gid 'helm-only t)
+
+;;; session.el files
+;;
+;;  session (http://emacs-session.sourceforge.net/) is an alternative to
+;;  recentf that saves recent file history and much more.
+(defvar session-file-alist)
+(defvar helm-source-session
+  (helm-build-sync-source "Session"
+    :candidates (lambda ()
+                  (cl-delete-if-not (lambda (f)
+                                        (or (string-match helm-tramp-file-name-regexp f)
+                                            (file-exists-p f)))
+                                    (mapcar 'car session-file-alist)))
+    :keymap helm-generic-files-map
+    :help-message helm-generic-file-help-message
+    :action 'helm-type-file-actions)
+  "File list from emacs-session.")
+
+\f
+;;; Files in current dir
+;;
+;;
+(defun helm-highlight-files (files)
+  "A basic transformer for helm files sources.
+Colorize only symlinks, directories and files."
+  (cl-loop for i in files
+        for disp = (if (and helm-ff-transformer-show-only-basename
+                            (not (helm-dir-is-dot i))
+                            (not (and ffap-url-regexp
+                                      (string-match ffap-url-regexp i)))
+                            (not (string-match helm-ff-url-regexp i)))
+                       (helm-basename i) i)
+        for type = (and (null helm-ff-tramp-not-fancy)
+                        (car (file-attributes i)))
+        collect
+        (cond ((and helm-ff-tramp-not-fancy
+                    (string-match helm-tramp-file-name-regexp i))
+               (cons disp i))
+              ((stringp type)
+               (cons (propertize disp
+                                 'face 'helm-ff-symlink
+                                 'help-echo (expand-file-name i))
+                     i))
+              ((eq type t)
+               (cons (propertize disp
+                                 'face 'helm-ff-directory
+                                 'help-echo (expand-file-name i))
+                     i))
+              (t (cons (propertize disp
+                                   'face 'helm-ff-file
+                                   'help-echo (expand-file-name i))
+                       i)))))
+
+(defclass helm-files-in-current-dir-source (helm-source-sync helm-type-file)
+  ((candidates :initform (lambda ()
+                           (with-helm-current-buffer
+                             (let ((dir (helm-current-directory)))
+                               (when (file-accessible-directory-p dir)
+                                 (directory-files dir t))))))
+   (pattern-transformer :initform 'helm-recentf-pattern-transformer)
+   (match-part :initform (lambda (candidate)
+                           (if (or helm-ff-transformer-show-only-basename
+                                   helm-recentf--basename-flag)
+                               (helm-basename candidate) candidate)))
+   (fuzzy-match :initform t)
+   (migemo :initform t)))
+
+(defvar helm-source-files-in-current-dir
+  (helm-make-source "Files from Current Directory"
+      helm-files-in-current-dir-source))
+
+\f
+;;; External searching file tools.
+;;
+;; Tracker desktop search
+(defvar helm-source-tracker-cand-incomplete nil "Contains incomplete candidate")
+(defun helm-source-tracker-transformer (candidates _source)
+  (helm-log "received: %S" candidates)
+  (cl-loop for cand in candidates
+           for path = (when (stringp helm-source-tracker-cand-incomplete)
+                        (caar (helm-highlight-files
+                               (list helm-source-tracker-cand-incomplete))))
+           for built = (if (not (stringp cand)) cand
+                         (let ((snippet cand))
+                           (unless (or (null path)
+                                      (string= "" path)
+                                      (not (string-match-p
+                                          "\\`[[:space:]]*\\.\\.\\."
+                                          snippet)))
+                             (let ((complete-candidate
+                                    (cons (concat path "\n" snippet) path)))
+                               (setq helm-source-tracker-cand-incomplete nil)
+                               (helm-log "built: %S" complete-candidate)
+                               complete-candidate))))
+           when (and (stringp cand)
+                   (string-match "\\`[[:space:]]*file://" cand))
+           do (setq helm-source-tracker-cand-incomplete ; save path
+                    (replace-match "" t t cand)) end
+           collect built))
+
+(defvar helm-source-tracker-search
+  (helm-build-async-source "Tracker Search"
+    :candidates-process
+     (lambda ()
+       (start-process "tracker-search-process" nil
+                      "tracker-search"
+                      "--disable-color"
+                      "--limit=512"
+                      helm-pattern))
+    :filtered-candidate-transformer #'helm-source-tracker-transformer
+    ;;(multiline) ; https://github.com/emacs-helm/helm/issues/529
+    :keymap helm-generic-files-map
+    :action 'helm-type-file-actions
+    :action-transformer '(helm-transform-file-load-el
+                          helm-transform-file-browse-url)
+    :requires-pattern 3)
+  "Source for retrieving files matching the current input pattern
+with the tracker desktop search.")
+
+;; Spotlight (MacOS X desktop search)
+(defclass helm-mac-spotlight-source (helm-source-async helm-type-file)
+  ((candidates-process :initform
+                       (lambda ()
+                         (start-process
+                          "mdfind-process" nil "mdfind" helm-pattern)))
+   (requires-pattern :initform 3)))
+
+(defvar helm-source-mac-spotlight
+  (helm-make-source "mdfind" helm-mac-spotlight-source)
+  "Source for retrieving files via Spotlight's command line
+utility mdfind.")
+
+\f
+;;; Findutils
+;;
+;;
+(defvar helm-source-findutils
+  (helm-build-async-source "Find"
+    :header-name (lambda (name)
+                   (concat name " in [" (helm-default-directory) "]"))
+    :candidates-process 'helm-find-shell-command-fn
+    :filtered-candidate-transformer 'helm-findutils-transformer
+    :action-transformer 'helm-transform-file-load-el
+    :persistent-action 'helm-ff-kill-or-find-buffer-fname
+    :action 'helm-type-file-actions
+    :keymap helm-generic-files-map
+    :candidate-number-limit 9999
+    :requires-pattern 3))
+
+(defun helm-findutils-transformer (candidates _source)
+  (let (non-essential
+        (default-directory (helm-default-directory)))
+    (cl-loop for i in candidates
+             for abs = (expand-file-name
+                        (helm-aif (file-remote-p default-directory)
+                            (concat it i) i))
+             for type = (car (file-attributes abs))
+             for disp = (if (and helm-ff-transformer-show-only-basename
+                                 (not (string-match "[.]\\{1,2\\}$" i)))
+                            (helm-basename abs) abs)
+             collect (cond ((eq t type)
+                            (cons (propertize disp 'face 'helm-ff-directory)
+                                  abs))
+                           ((stringp type)
+                            (cons (propertize disp 'face 'helm-ff-symlink)
+                                  abs))
+                           (t (cons (propertize disp 'face 'helm-ff-file)
+                                    abs))))))
+
+(defun helm-find--build-cmd-line ()
+  (require 'find-cmd)
+  (let* ((default-directory (or (file-remote-p default-directory 'localname)
+                                default-directory))
+         (patterns+options (split-string helm-pattern "\\(\\`\\| +\\)\\* +"))
+         (fold-case (helm-set-case-fold-search (car patterns+options)))
+         (patterns (split-string (car patterns+options)))
+         (additional-options (and (cdr patterns+options)
+                                  (list (concat (cadr patterns+options) " "))))
+         (ignored-dirs ())
+         (ignored-files (when helm-findutils-skip-boring-files
+                          (cl-loop for f in completion-ignored-extensions
+                                   if (string-match "/$" f)
+                                   do (push (replace-match "" nil t f)
+                                            ignored-dirs)
+                                   else collect (concat "*" f))))
+         (path-or-name (if helm-findutils-search-full-path
+                           '(ipath path) '(iname name)))
+         (name-or-iname (if fold-case
+                            (car path-or-name) (cadr path-or-name))))
+    (find-cmd (and ignored-dirs
+                   `(prune (name ,@ignored-dirs)))
+              (and ignored-files
+                   `(not (name ,@ignored-files)))
+              `(and ,@(mapcar
+                       (lambda (pattern)
+                         `(,name-or-iname ,(concat "*" pattern "*")))
+                       patterns)
+                    ,@additional-options))))
+
+(defun helm-find-shell-command-fn ()
+  "Asynchronously fetch candidates for `helm-find'.
+Additional find options can be specified after a \"*\"
+separator."
+  (let* (process-connection-type
+         non-essential
+         (cmd (helm-find--build-cmd-line))
+         (proc (start-file-process-shell-command "hfind" helm-buffer cmd)))
+    (helm-log "Find command:\n%s" cmd)
+    (prog1 proc
+      (set-process-sentinel
+       proc
+       (lambda (process event)
+           (helm-process-deferred-sentinel-hook
+            process event (helm-default-directory))
+           (if (string= event "finished\n")
+               (with-helm-window
+                 (setq mode-line-format
+                       '(" " mode-line-buffer-identification " "
+                         (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                         (:eval (propertize
+                                 (format "[Find process finished - (%s results)]" 
+                                         (max (1- (count-lines
+                                                   (point-min) (point-max)))
+                                              0))
+                                 'face 'helm-locate-finish))))
+                 (force-mode-line-update))
+               (helm-log "Error: Find %s"
+                         (replace-regexp-in-string "\n" "" event))))))))
+
+(defun helm-find-1 (dir)
+  (let ((default-directory (file-name-as-directory dir)))
+    (helm :sources 'helm-source-findutils
+          :buffer "*helm find*"
+          :ff-transformer-show-only-basename nil
+          :case-fold-search helm-file-name-case-fold-search)))
+
+;; helm-find-files integration.
+(defun helm-ff-find-sh-command (_candidate)
+  "Run `helm-find' from `helm-find-files'."
+  (helm-find-1 helm-ff-default-directory))
+
+(defun helm-ff-run-find-sh-command ()
+  "Run find shell command action with key from `helm-find-files'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-ff-find-sh-command)))
+(put 'helm-ff-run-find-sh-command 'helm-only t)
+
+\f
+;;; Preconfigured commands
+;;
+;;
+;;;###autoload
+(defun helm-find (arg)
+  "Preconfigured `helm' for the find shell command."
+  (interactive "P")
+  (let ((directory
+         (if arg
+             (file-name-as-directory
+              (read-directory-name "DefaultDirectory: "))
+           default-directory)))
+    (helm-find-1 directory)))
+
+(defvar org-directory)
+;;;###autoload
+(defun helm-find-files (arg)
+  "Preconfigured `helm' for helm implementation of `find-file'.
+Called with a prefix arg show history if some.
+Don't call it from programs, use `helm-find-files-1' instead.
+This is the starting point for nearly all actions you can do on files."
+  (interactive "P")
+  (let* ((hist            (and arg helm-ff-history (helm-find-files-history)))
+         (default-input   (or hist (helm-find-files-initial-input)))
+         (input           (cond ((and (eq major-mode 'org-agenda-mode)
+                                      org-directory
+                                      (not default-input))
+                                 (expand-file-name org-directory))
+                                ((and (eq major-mode 'dired-mode) default-input)
+                                 (file-name-directory default-input))
+                                ((and (not (string= default-input ""))
+                                      default-input))
+                                (t (expand-file-name (helm-current-directory)))))
+         (input-as-presel (null (nth 0 (file-attributes input))))
+         (presel          (helm-aif (or hist
+                                        (and input-as-presel input)
+                                        (buffer-file-name (current-buffer))
+                                        (and (eq major-mode 'dired-mode)
+                                             default-input))
+                              (if helm-ff-transformer-show-only-basename
+                                  (helm-basename it) it))))
+    (set-text-properties 0 (length input) nil input)
+    (helm-find-files-1 input (and presel (concat "^" (regexp-quote presel))))))
+
+;;;###autoload
+(defun helm-for-files ()
+  "Preconfigured `helm' for opening files.
+Run all sources defined in `helm-for-files-preferred-list'."
+  (interactive)
+  (unless helm-source-buffers-list
+    (setq helm-source-buffers-list
+          (helm-make-source "Buffers" 'helm-source-buffers)))
+  (helm :sources helm-for-files-preferred-list
+        :ff-transformer-show-only-basename nil
+        :buffer "*helm for files*"))
+
+;;;###autoload
+(defun helm-multi-files ()
+  "Preconfigured helm similar to `helm-for-files' but that don't run locate.
+Allow toggling from locate to others sources.
+This allow seeing first if what you search is in other sources before launching
+locate."
+  (interactive)
+  (unless helm-source-buffers-list
+    (setq helm-source-buffers-list
+          (helm-make-source "Buffers" 'helm-source-buffers)))
+  (setq helm-multi-files--toggle-locate nil)
+  (let ((sources (remove 'helm-source-locate helm-for-files-preferred-list))
+        (old-key (lookup-key
+                  helm-map
+                  (read-kbd-macro helm-multi-files-toggle-locate-binding))))
+    (with-helm-temp-hook 'helm-after-initialize-hook
+      (define-key helm-map (kbd helm-multi-files-toggle-locate-binding)
+        'helm-multi-files-toggle-to-locate))
+    (unwind-protect
+         (helm :sources sources
+               :ff-transformer-show-only-basename nil
+               :buffer "*helm multi files*")
+      (define-key helm-map (kbd helm-multi-files-toggle-locate-binding)
+        old-key))))
+
+;;;###autoload
+(defun helm-recentf ()
+  "Preconfigured `helm' for `recentf'."
+  (interactive)
+  (helm :sources 'helm-source-recentf
+        :ff-transformer-show-only-basename nil
+        :buffer "*helm recentf*"))
+
+(provide 'helm-files)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-files.el ends here
diff --git a/elpa/helm-20160217.958/helm-font.el b/elpa/helm-20160217.958/helm-font.el
new file mode 100644 (file)
index 0000000..8968aa9
--- /dev/null
@@ -0,0 +1,198 @@
+;;; helm-font --- Font and ucs selection for Helm -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+
+(defgroup helm-font nil
+  "Related applications to display fonts in helm."
+  :group 'helm)
+
+(defvar helm-ucs-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "<C-backspace>") 'helm-ucs-persistent-delete)
+    (define-key map (kbd "<C-left>")      'helm-ucs-persistent-backward)
+    (define-key map (kbd "<C-right>")     'helm-ucs-persistent-forward)
+    (define-key map (kbd "<C-return>")    'helm-ucs-persistent-insert)
+    map)
+  "Keymap for `helm-ucs'.")
+
+(defface helm-ucs-char
+    '((t (:foreground "Gold")))
+  "Face used to display ucs characters."
+  :group 'helm-font)
+
+;;; Xfont selection
+;;
+;;
+(defvar helm-xfonts-cache nil)
+(defvar helm-previous-font nil)
+(defvar helm-source-xfonts
+  (helm-build-sync-source "X Fonts"
+    :init (lambda ()
+            (unless helm-xfonts-cache
+              (setq helm-xfonts-cache
+                    (x-list-fonts "*")))
+            ;; Save current font so it can be restored in cleanup
+            (setq helm-previous-font (cdr (assoc 'font (frame-parameters)))))
+    :candidates 'helm-xfonts-cache
+    :action '(("Copy font to kill ring" . (lambda (elm)
+                                            (kill-new elm)))
+              ("Set font" . (lambda (elm)
+                              (kill-new elm)
+                              (set-frame-font elm 'keep-size)
+                              (message "Font copied to kill ring"))))
+    :cleanup (lambda ()
+               ;; Restore previous font
+               (set-frame-font helm-previous-font 'keep-size))
+    :persistent-action (lambda (new-font)
+                         (set-frame-font new-font 'keep-size)
+                         (kill-new new-font))
+    :persistent-help "Preview font and copy to kill-ring"))
+
+;;; 𝕌𝕔𝕤 𝕊𝕪𝕞𝕓𝕠𝕝 𝕔𝕠𝕞𝕡𝕝𝕖𝕥𝕚𝕠𝕟
+;;
+;;
+(defvar helm-ucs--max-len nil)
+(defvar helm-ucs--names nil)
+
+(defun helm-calculate-ucs-max-len ()
+  "Calculate the length of longest `ucs-names' candidate."
+  (cl-loop for (_n . v) in (ucs-names)
+           maximize (length (format "#x%x:" v)) into code
+           maximize (max 1 (string-width (format "%c" v))) into char
+           finally return (cons code char)))
+
+(defun helm-ucs-init ()
+  "Initialize an helm buffer with ucs symbols.
+Only math* symbols are collected."
+  (unless helm-ucs--max-len
+    (setq helm-ucs--max-len
+          (helm-calculate-ucs-max-len)))
+  (or helm-ucs--names
+      (setq helm-ucs--names
+            (cl-loop for (n . v) in (ucs-names)
+                     for len = (length (format "#x%x:" v))
+                     for diff = (- (car helm-ucs--max-len) len)
+                     for code = (format "(#x%x): " v)
+                     for char = (propertize (format "%c" v)
+                                            'face 'helm-ucs-char)
+                     unless (string= "" n) collect
+                     (concat code (make-string diff ? )
+                             char "  " n)))))
+
+(defun helm-ucs-forward-char (_candidate)
+  (with-helm-current-buffer
+    (forward-char 1)))
+
+(defun helm-ucs-backward-char (_candidate)
+  (with-helm-current-buffer
+    (forward-char -1)))
+
+(defun helm-ucs-delete-backward (_candidate)
+  (with-helm-current-buffer
+    (delete-char -1)))
+
+(defun helm-ucs-insert (candidate n)
+  (when (string-match
+         "^(\\(#x[a-f0-9]+\\)): *\\(.\\) *\\([^:]+\\)+"
+         candidate)
+    (with-helm-current-buffer
+      (insert (match-string n candidate)))))
+
+(defun helm-ucs-insert-char (candidate)
+  (helm-ucs-insert candidate 2))
+
+(defun helm-ucs-insert-code (candidate)
+  (helm-ucs-insert candidate 1))
+
+(defun helm-ucs-insert-name (candidate)
+  (helm-ucs-insert candidate 3))
+
+(defun helm-ucs-persistent-insert ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'action-insert 'helm-ucs-insert-char)
+    (helm-execute-persistent-action 'action-insert)))
+(put 'helm-ucs-persistent-insert 'helm-only t)
+
+(defun helm-ucs-persistent-forward ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'action-forward 'helm-ucs-forward-char)
+    (helm-execute-persistent-action 'action-forward)))
+(put 'helm-ucs-persistent-forward 'helm-only t)
+
+(defun helm-ucs-persistent-backward ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'action-back 'helm-ucs-backward-char)
+    (helm-execute-persistent-action 'action-back)))
+(put 'helm-ucs-persistent-backward 'helm-only t)
+
+(defun helm-ucs-persistent-delete ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-attrset 'action-delete 'helm-ucs-delete-backward)
+    (helm-execute-persistent-action 'action-delete)))
+(put 'helm-ucs-persistent-delete 'helm-only t)
+
+(defvar helm-source-ucs
+  (helm-build-in-buffer-source "Ucs names"
+    :data #'helm-ucs-init
+    :get-line #'buffer-substring
+    :help-message 'helm-ucs-help-message
+    :match-part (lambda (candidate) (cadr (split-string candidate ":")))
+    :filtered-candidate-transformer
+    (lambda (candidates _source) (sort candidates #'helm-generic-sort-fn))
+    :action '(("Insert character" . helm-ucs-insert-char)
+              ("Insert character name" . helm-ucs-insert-name)
+              ("Insert character code in hex" . helm-ucs-insert-code)
+              ("Forward char" . helm-ucs-forward-char)
+              ("Backward char" . helm-ucs-backward-char)
+              ("Delete char backward" . helm-ucs-delete-backward)))
+  "Source for collecting `ucs-names' math symbols.")
+
+;;;###autoload
+(defun helm-select-xfont ()
+  "Preconfigured `helm' to select Xfont."
+  (interactive)
+  (helm :sources 'helm-source-xfonts
+        :buffer "*helm select xfont*"))
+
+;;;###autoload
+(defun helm-ucs ()
+  "Preconfigured helm for `ucs-names' math symbols."
+  (interactive)
+  (let ((char (helm-aif (char-after) (string it))))
+    (helm :sources 'helm-source-ucs
+          :keymap  helm-ucs-map
+          :input (and char (multibyte-string-p char) char))))
+
+(provide 'helm-font)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-font.el ends here
diff --git a/elpa/helm-20160217.958/helm-grep.el b/elpa/helm-20160217.958/helm-grep.el
new file mode 100644 (file)
index 0000000..d2d6959
--- /dev/null
@@ -0,0 +1,1326 @@
+;;; helm-grep.el --- Helm Incremental Grep. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-regexp)
+
+;;; load wgrep proxy if it's available
+(require 'wgrep-helm nil t)
+
+(declare-function helm-buffer-list "helm-buffers")
+(declare-function helm-elscreen-find-file "helm-elscreen" (file))
+(declare-function View-quit "view")
+(declare-function doc-view-goto-page "doc-view" (page))
+(declare-function helm-mm-split-pattern "helm-multi-match")
+(declare-function helm--ansi-color-apply "helm-lib")
+(defvar helm--ansi-color-regexp)
+
+\f
+(defgroup helm-grep nil
+  "Grep related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-grep-default-command
+  "grep --color=always -a -d skip %e -n%cH -e %p %f"
+  "Default grep format command for `helm-do-grep-1'.
+Where:
+'%e' format spec is for --exclude or --include grep options or
+     ack-grep --type option.               (Not mandatory)
+
+'%c' format spec is for case-fold-search,
+     whether to use the -i option of grep. (Not mandatory)
+     When you specify this spec, helm grep will use smartcase
+     that is when a upcase character is found in pattern case will
+     be respected and no '-i' option will be used, otherwise, when
+     no upcase character is found in pattern always use '-i'.
+     If you don't want this behavior, don't use this spec and
+     specify or not the '-i' option.
+     Note that with ack-grep this is not needed, just specify
+     the '--smart-case' option.
+
+'%p' format spec is for pattern.           (Mandatory)
+
+'%f' format spec is for filenames.         (Mandatory)
+
+If your grep version doesn't support the --exclude/include args
+don't specify the '%e' format spec.
+
+Helm also support ack-grep and git-grep ,
+here a default command example for ack-grep:
+
+\(setq helm-grep-default-command \"ack-grep -Hn --smart-case --no-group %e %p %f\"
+       helm-grep-default-recurse-command \"ack-grep -H --smart-case --no-group %e %p %f\")
+
+You can ommit the %e spec if you don't want to be prompted for types.
+
+NOTE: Helm for ack-grep support ANSI sequences, so you can remove
+the \"--no-color\" option safely (recommended).
+
+Same for grep you can use safely the option \"--color=always\" (default).
+You can customize the color of matches using GREP_COLORS env var.
+e.g: \(setenv \"GREP_COLORS\" \"ms=30;43:mc=30;43:sl=01;37:cx=:fn=35:ln=32:bn=32:se=36\")
+
+To enable ANSI color in git-grep just add \"--color=always\".
+To customize the ANSI color in git-grep, GREP_COLORS have no effect,
+you will have to setup this in your .gitconfig:
+
+    [color \"grep\"]
+        match = black yellow
+
+where \"black\" is the foreground and \"yellow\" the background.
+See the git documentation for more infos.
+
+`helm-grep-default-command' and `helm-grep-default-recurse-command'are
+independents, so you can enable `helm-grep-default-command' with ack-grep
+and `helm-grep-default-recurse-command' with grep if you want to be faster
+on recursive grep.
+
+NOTE: Remote grepping is not available with ack-grep,
+      and badly supported with grep because tramp handle badly
+      repeated remote processes in a short delay (< to 5s)."
+  :group 'helm-grep
+  :type  'string)
+
+(defcustom helm-grep-default-recurse-command
+  "grep --color=always -a -d recurse %e -n%cH -e %p %f"
+  "Default recursive grep format command for `helm-do-grep-1'.
+See `helm-grep-default-command' for format specs and infos about ack-grep."
+  :group 'helm-grep
+  :type  'string)
+
+(defcustom helm-default-zgrep-command
+  "zgrep --color=always -a -n%cH -e %p %f"
+  "Default command for Zgrep.
+See `helm-grep-default-command' for infos on format specs.
+Option --color=always is supported and can be used safely
+to replace the helm internal match highlighting,
+see `helm-grep-default-command' for more infos."
+  :group 'helm-grep
+  :type  'string)
+
+(defcustom helm-pdfgrep-default-command
+  "pdfgrep --color always -niH %s %s"
+  "Default command for pdfgrep.
+Option \"--color always\" is supported starting helm version 1.7.8,
+when used matchs will be highlighted according to GREP_COLORS env var."
+  :group 'helm-grep
+  :type  'string)
+
+(defcustom helm-grep-use-ioccur-style-keys t
+  "Use Arrow keys to jump to occurences."
+  :group 'helm-grep
+  :type  'boolean)
+
+(defcustom helm-pdfgrep-default-read-command nil
+  "Default command to read pdf files from pdfgrep.
+Where '%f' format spec is filename and '%p' is page number.
+e.g In Ubuntu you can set it to:
+
+    \"evince --page-label=%p '%f'\"
+
+If set to nil `doc-view-mode' will be used instead of an external command."
+  :group 'helm-grep
+  :type  'string)
+
+(defcustom helm-grep-max-length-history 100
+  "Max number of elements to save in `helm-grep-history'."
+  :group 'helm-grep
+  :type 'integer)
+
+(defcustom helm-zgrep-file-extension-regexp
+  ".*\\(\\.gz\\|\\.bz\\|\\.xz\\|\\.lzma\\)$"
+  "Default file extensions zgrep will search in."
+  :group 'helm-grep
+  :type 'string)
+
+(defcustom helm-grep-preferred-ext nil
+  "This file extension will be preselected for grep."
+  :group 'helm-grep
+  :type  'string)
+
+(defcustom helm-grep-save-buffer-name-no-confirm nil
+  "when *hgrep* already exists,auto append suffix."
+  :group 'helm-grep
+  :type 'boolean)
+
+(defcustom helm-grep-ignored-files
+  (cons ".#*" (delq nil (mapcar (lambda (s)
+                                  (unless (string-match-p "/\\'" s)
+                                    (concat "*" s)))
+                                completion-ignored-extensions)))
+  "List of file names which `helm-grep' shall exclude."
+  :group 'helm-grep
+  :type '(repeat string))
+
+(defcustom helm-grep-ignored-directories
+  helm-walk-ignore-directories
+  "List of names of sub-directories which `helm-grep' shall not recurse into."
+  :group 'helm-grep
+  :type '(repeat string))
+
+(defcustom helm-grep-truncate-lines t
+  "When nil the grep line that appears will not be truncated."
+  :group 'helm-grep
+  :type 'boolean)
+
+(defcustom helm-grep-file-path-style 'basename
+  "File path display style when grep results are displayed.
+Possible value are:
+    basename: displays only the filename, none of the directory path
+    absolute: displays absolute path
+    relative: displays relative path from root grep directory."
+  :group 'helm-grep
+  :type '(choice (const :tag "Basename" basename)
+                 (const :tag "Absolute" absolute)
+                 (const :tag "Relative" relative)))
+
+\f
+;;; Faces
+;;
+;;
+(defgroup helm-grep-faces nil
+  "Customize the appearance of helm-grep."
+  :prefix "helm-"
+  :group 'helm-grep
+  :group 'helm-faces)
+
+(defface helm-grep-match
+  '((((background light)) :foreground "#b00000")
+    (((background dark))  :foreground "gold1"))
+  "Face used to highlight grep matches."
+  :group 'helm-grep-faces)
+
+(defface helm-grep-file
+    '((t (:foreground "BlueViolet"
+          :underline t)))
+  "Face used to highlight grep results filenames."
+  :group 'helm-grep-faces)
+
+(defface helm-grep-lineno
+    '((t (:foreground "Darkorange1")))
+  "Face used to highlight grep number lines."
+  :group 'helm-grep-faces)
+
+(defface helm-grep-finish
+    '((t (:foreground "Green")))
+  "Face used in mode line when grep is finish."
+  :group 'helm-grep-faces)
+
+(defface helm-grep-cmd-line
+    '((t (:inherit diff-added)))
+  "Face used to highlight grep command line when no results."
+  :group 'helm-grep-faces)
+
+\f
+;;; Keymaps
+;;
+;;
+(defvar helm-grep-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-<down>") 'helm-goto-next-file)
+    (define-key map (kbd "M-<up>")   'helm-goto-precedent-file)
+    (define-key map (kbd "C-c o")    'helm-grep-run-other-window-action)
+    (define-key map (kbd "C-c C-o")  'helm-grep-run-other-frame-action)
+    (define-key map (kbd "C-w")      'helm-yank-text-at-point)
+    (define-key map (kbd "C-x C-s")  'helm-grep-run-save-buffer)
+    (when helm-grep-use-ioccur-style-keys
+      (define-key map (kbd "<right>")  'helm-execute-persistent-action)
+      (define-key map (kbd "<left>")  'helm-grep-run-default-action))
+    (delq nil map))
+  "Keymap used in Grep sources.")
+
+(defvar helm-pdfgrep-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-<down>") 'helm-goto-next-file)
+    (define-key map (kbd "M-<up>")   'helm-goto-precedent-file)
+    (define-key map (kbd "C-w")      'helm-yank-text-at-point)
+    map)
+  "Keymap used in pdfgrep.")
+
+(defvar helm-grep-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "RET")      'helm-grep-mode-jump)
+    (define-key map (kbd "C-o")      'helm-grep-mode-jump-other-window)
+    (define-key map (kbd "<C-down>") 'helm-grep-mode-jump-other-window-forward)
+    (define-key map (kbd "<C-up>")   'helm-grep-mode-jump-other-window-backward)
+    (define-key map (kbd "<M-down>") 'helm-gm-next-file)
+    (define-key map (kbd "<M-up>")   'helm-gm-precedent-file)
+    (define-key map (kbd "M-n")      'helm-grep-mode-jump-other-window-forward)
+    (define-key map (kbd "M-p")      'helm-grep-mode-jump-other-window-backward)
+    (define-key map (kbd "M-N")      'helm-gm-next-file)
+    (define-key map (kbd "M-P")      'helm-gm-precedent-file)
+    map))
+
+\f
+;;; Internals vars
+;;
+;;
+(defvar helm-rzgrep-cache (make-hash-table :test 'equal))
+(defvar helm-grep-default-function 'helm-grep-init)
+(defvar helm-zgrep-recurse-flag nil)
+(defvar helm-grep-history nil)
+(defvar helm-grep-last-targets nil)
+(defvar helm-grep-include-files nil)
+(defvar helm-grep-in-recurse nil)
+(defvar helm-grep-use-zgrep nil)
+(defvar helm-grep-default-directory-fn nil
+  "A function that should return a directory to expand candidate to.
+It is intended to use as a let-bound variable, DON'T set this globaly.")
+(defvar helm-pdfgrep-targets nil)
+(defvar helm-grep-last-cmd-line nil)
+(defvar helm-grep-split-line-regexp "^\\([[:lower:][:upper:]]?:?.*?\\):\\([0-9]+\\):\\(.*\\)")
+
+\f
+;;; Init
+;;
+;;
+(defun helm-grep-prepare-candidates (candidates in-directory)
+  "Prepare filenames and directories CANDIDATES for grep command line."
+  ;; If one or more candidate is a directory, search in all files
+  ;; of this candidate (e.g /home/user/directory/*).
+  ;; If r option is enabled search also in subdidrectories.
+  ;; We need here to expand wildcards to support crap windows filenames
+  ;; as grep doesn't accept quoted wildcards (e.g "dir/*.el").
+  (if helm-zgrep-recurse-flag
+      (mapconcat 'shell-quote-argument candidates " ")
+    ;; When candidate is a directory, search in all its files.
+    ;; NOTE that `file-expand-wildcards' will return also
+    ;; directories, they will be ignored by grep but not
+    ;; by ack-grep that will grep all files of this directory
+    ;; without recursing in their subdirs though, see that as a one
+    ;; level recursion with ack-grep.
+    ;; So I leave it as it is, considering it is a feature. [1]
+    (cl-loop for i in candidates append
+          (cond ((string-match "^git" helm-grep-default-command)
+                 (list i))
+                ;; Candidate is a directory and we use recursion or ack.
+                ((and (file-directory-p i)
+                      (or helm-grep-in-recurse
+                          ;; ack-grep accept directory [1].
+                          (helm-grep-use-ack-p)))
+                 (list (expand-file-name i)))
+                ;; Grep doesn't support directory only when not in recurse.
+                ((file-directory-p i)
+                 (file-expand-wildcards
+                  (concat (file-name-as-directory (expand-file-name i)) "*") t))
+                ;; Candidate is a file or wildcard and we use recursion, use the
+                ;; current directory instead of candidate.
+                ((and (or (file-exists-p i) (string-match "[*]" i))
+                      helm-grep-in-recurse)
+                 (list (expand-file-name
+                        (directory-file-name ; Needed for windoze.
+                         (file-name-directory (directory-file-name i))))))
+                ;; Else should be one or more file/directory
+                ;; possibly marked.
+                ;; When real is a normal filename without wildcard
+                ;; file-expand-wildcards returns a list of one file.
+                ;; wildcards should have been already handled by
+                ;; helm-read-file-name or helm-find-files but do it from
+                ;; here too in case we are called from elsewhere.
+                (t (file-expand-wildcards i t))) into all-files ; [1]
+          finally return
+          (let ((files (if (file-remote-p in-directory)
+                       ;; Grep don't understand tramp filenames
+                       ;; use the local name.
+                       (mapcar (lambda (x)
+                                   (file-remote-p x 'localname))
+                               all-files)
+                       all-files)))
+            (if (string-match "^git" helm-grep-default-command)
+                (mapconcat 'identity files " ")
+                (mapconcat 'shell-quote-argument files " "))))))
+
+(defun helm-grep-command (&optional recursive)
+  (let* ((com (if recursive
+                  helm-grep-default-recurse-command
+                  helm-grep-default-command))
+         (exe (and com (car (split-string com " ")))))
+    (if (and exe (string= exe "git")) "git-grep" exe)))
+
+(cl-defun helm-grep-use-ack-p (&key where)
+  (let* ((rec-com (helm-grep-command t))
+         (norm-com (helm-grep-command))
+         (norm-com-ack-p (string-match "\\`ack" norm-com))
+         (rec-com-ack-p (and rec-com (string-match "\\`ack" rec-com))))
+    (cl-case where
+      (default   (and norm-com norm-com-ack-p))
+      (recursive (and rec-com rec-com-ack-p))
+      (strict    (and norm-com rec-com rec-com-ack-p norm-com-ack-p))
+      (t         (and (not (and norm-com (string= norm-com "git-grep")))
+                      (or (and norm-com norm-com-ack-p)
+                          (and rec-com rec-com-ack-p)))))))
+
+(defun helm-grep--prepare-cmd-line (only-files &optional include zgrep)
+  (let* ((default-directory (or (helm-default-directory)
+                                (expand-file-name helm-ff-default-directory)))
+         (fnargs            (helm-grep-prepare-candidates
+                             only-files default-directory))
+         (ignored-files     (unless (helm-grep-use-ack-p)
+                              (mapconcat
+                               (lambda (x)
+                                   (concat "--exclude="
+                                           (shell-quote-argument x)))
+                               helm-grep-ignored-files " ")))
+         (ignored-dirs      (unless (helm-grep-use-ack-p)
+                              (mapconcat
+                               ;; Need grep version >=2.5.4
+                               ;; of Gnuwin32 on windoze.
+                               (lambda (x)
+                                   (concat "--exclude-dir="
+                                           (shell-quote-argument x)))
+                               helm-grep-ignored-directories " ")))
+         (exclude           (unless (helm-grep-use-ack-p)
+                              (if helm-grep-in-recurse
+                                  (concat (or include ignored-files)
+                                          " " ignored-dirs)
+                                ignored-files)))
+         (types             (and (helm-grep-use-ack-p)
+                                 ;; When %e format spec is not specified
+                                 ;; in `helm-grep-default-command'
+                                 ;; we need to pass an empty string
+                                 ;; to types to avoid error.
+                                 (or include "")))
+         (smartcase         (if (helm-grep-use-ack-p) ""
+                              (unless (let ((case-fold-search nil))
+                                        (string-match-p
+                                         "[[:upper:]]" helm-pattern)) "i"))))
+    (format-spec
+     helm-grep-default-command
+     (delq nil
+           (list (unless zgrep
+                   (if types
+                       (cons ?e types)
+                     (cons ?e exclude)))
+                 (cons ?c (or smartcase ""))
+                 (cons ?p (shell-quote-argument helm-pattern))
+                 (cons ?f fnargs))))))
+
+(defun helm-grep-init (cmd-line)
+  "Start an asynchronous grep process with CMD-LINE using ZGREP if non--nil."
+  (let* ((default-directory (or helm-ff-default-directory
+                                (helm-default-directory)))
+         (zgrep (string-match "\\`zgrep" cmd-line))
+         ;; Use pipe only with grep, zgrep or git-grep.
+         (process-connection-type (and (not zgrep) (helm-grep-use-ack-p)))
+         (tramp-verbose helm-tramp-verbose)
+         non-essential)
+    ;; Start grep process.
+    (helm-log "Starting Grep process in directory `%s'" default-directory)
+    (helm-log "Command line used was:\n\n%s"
+              (concat ">>> " (propertize cmd-line 'face 'helm-grep-cmd-line) "\n\n"))
+    (prog1            ; This function should return the process first.
+        (start-file-process-shell-command
+         "grep" helm-buffer cmd-line)
+      ;; Init sentinel.
+      (set-process-sentinel
+       (get-buffer-process helm-buffer)
+       (lambda (process event)
+           (let* ((err      (process-exit-status process))
+                  (noresult (= err 1)))
+             (unless err
+               (helm-process-deferred-sentinel-hook
+                process event (helm-default-directory)))
+             (cond ((and noresult
+                         ;; [FIXME] This is a workaround for zgrep
+                         ;; that exit with code 1
+                         ;; after a certain amount of results.
+                         (not (with-helm-buffer helm-grep-use-zgrep)))
+                    (with-helm-buffer
+                      (insert (concat "* Exit with code 1, no result found,"
+                                      " command line was:\n\n "
+                                      (propertize helm-grep-last-cmd-line
+                                                  'face 'helm-grep-cmd-line)))
+                      (setq mode-line-format
+                            '(" " mode-line-buffer-identification " "
+                              (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                              (:eval (propertize
+                                      (format
+                                       "[%s process finished - (no results)] "
+                                       (if helm-grep-use-zgrep
+                                           "Zgrep"
+                                         (capitalize
+                                          (if helm-grep-in-recurse
+                                              (helm-grep-command t)
+                                            (helm-grep-command)))))
+                                      'face 'helm-grep-finish))))))
+                   ((string= event "finished\n")
+                    (with-helm-window
+                      (setq mode-line-format
+                            '(" " mode-line-buffer-identification " "
+                              (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                              (:eval (propertize
+                                      (format
+                                       "[%s process finished - (%s results)] "
+                                       (if helm-grep-use-zgrep
+                                           "Zgrep"
+                                         (capitalize
+                                          (if helm-grep-in-recurse
+                                              (helm-grep-command t)
+                                            (helm-grep-command))))
+                                       (helm-get-candidate-number))
+                                      'face 'helm-grep-finish))))
+                      (force-mode-line-update)))
+                   ;; Catch error output in log.
+                   (t (helm-log
+                       "Error: %s %s"
+                       (if helm-grep-use-zgrep "Zgrep" "Grep")
+                       (replace-regexp-in-string "\n" "" event))))))))))
+
+(defun helm-grep-collect-candidates ()
+  (let ((cmd-line (helm-grep--prepare-cmd-line
+                   helm-grep-last-targets
+                   helm-grep-include-files
+                   helm-grep-use-zgrep)))
+    (set (make-local-variable 'helm-grep-last-cmd-line) cmd-line)
+    (funcall helm-grep-default-function cmd-line)))
+
+\f
+;;; Actions
+;;
+;;
+(defun helm-grep-action (candidate &optional where mark)
+  "Define a default action for `helm-do-grep-1' on CANDIDATE.
+WHERE can be one of other-window, elscreen, other-frame."
+  (let* ((split        (helm-grep-split-line candidate))
+         (lineno       (string-to-number (nth 1 split)))
+         (loc-fname        (or (with-current-buffer
+                                   (if (eq major-mode 'helm-grep-mode)
+                                       (current-buffer)
+                                       helm-buffer)
+                                 (get-text-property (point-at-bol) 'help-echo))
+                               (car split)))
+         (tramp-method (file-remote-p (or helm-ff-default-directory
+                                          default-directory) 'method))
+         (tramp-host   (file-remote-p (or helm-ff-default-directory
+                                          default-directory) 'host))
+         (tramp-prefix (concat "/" tramp-method ":" tramp-host ":"))
+         (fname        (if tramp-host
+                           (concat tramp-prefix loc-fname) loc-fname)))
+    (cl-case where
+      (other-window (find-file-other-window fname))
+      (elscreen     (helm-elscreen-find-file fname))
+      (other-frame  (find-file-other-frame fname))
+      (grep         (helm-grep-save-results-1))
+      (pdf          (if helm-pdfgrep-default-read-command
+                        (helm-pdfgrep-action-1 split lineno (car split))
+                      (find-file (car split)) (doc-view-goto-page lineno)))
+      (t            (find-file fname)))
+    (unless (or (eq where 'grep) (eq where 'pdf))
+      (helm-goto-line lineno))
+    (when mark
+      (set-marker (mark-marker) (point))
+      (push-mark (point) 'nomsg))
+    ;; Save history
+    (unless (or helm-in-persistent-action
+                (eq major-mode 'helm-grep-mode)
+                (string= helm-pattern ""))
+      (setq helm-grep-history
+            (cons helm-pattern
+                  (delete helm-pattern helm-grep-history)))
+      (when (> (length helm-grep-history)
+               helm-grep-max-length-history)
+        (setq helm-grep-history
+              (delete (car (last helm-grep-history))
+                      helm-grep-history))))))
+
+(defun helm-grep-persistent-action (candidate)
+  "Persistent action for `helm-do-grep-1'.
+With a prefix arg record CANDIDATE in `mark-ring'."
+  (if current-prefix-arg
+      (helm-grep-action candidate nil 'mark)
+    (helm-grep-action candidate))
+  (helm-highlight-current-line))
+
+(defun helm-grep-other-window (candidate)
+  "Jump to result in other window from helm grep."
+  (helm-grep-action candidate 'other-window))
+
+(defun helm-grep-other-frame (candidate)
+  "Jump to result in other frame from helm grep."
+  (helm-grep-action candidate 'other-frame))
+
+(defun helm-grep-jump-elscreen (candidate)
+  "Jump to result in elscreen from helm grep."
+  (helm-grep-action candidate 'elscreen))
+
+(defun helm-goto-next-or-prec-file (n)
+  "Go to next or precedent candidate file in helm grep/etags buffers.
+If N is positive go forward otherwise go backward."
+  (let* ((allow-mode (or (eq major-mode 'helm-grep-mode)
+                         (eq major-mode 'helm-moccur-mode)))
+         (sel (if allow-mode
+                  (buffer-substring (point-at-bol) (point-at-eol))
+                (helm-get-selection nil t)))
+         (current-line-list  (helm-grep-split-line sel))
+         (current-fname      (nth 0 current-line-list))
+         (bob-or-eof         (if (eq n 1) 'eobp 'bobp))
+         (mark-maybe (lambda ()
+                         (if allow-mode
+                             (ignore)
+                           (helm-mark-current-line)))))
+    (catch 'break
+      (while (not (funcall bob-or-eof))
+        (forward-line n) ; Go forward or backward depending of n value.
+        ;; Exit when current-fname is not matched or in `helm-grep-mode'
+        ;; the line is not a grep line i.e 'fname:num:tag'.
+        (setq sel (buffer-substring (point-at-bol) (point-at-eol)))
+        (unless (or (string= current-fname
+                             (car (helm-grep-split-line sel)))
+                    (and (eq major-mode 'helm-grep-mode)
+                         (not (get-text-property (point-at-bol) 'help-echo))))
+          (funcall mark-maybe)
+          (throw 'break nil))))
+    (cond ((and (> n 0) (eobp))
+           (re-search-backward ".")
+           (forward-line 0)
+           (funcall mark-maybe))
+          ((and (< n 0) (bobp))
+           (helm-aif (next-single-property-change (point-at-bol) 'help-echo)
+               (goto-char it)
+             (forward-line 1))
+           (funcall mark-maybe)))
+    (helm-log-run-hook 'helm-move-selection-after-hook)))
+
+;;;###autoload
+(defun helm-goto-precedent-file ()
+  "Go to precedent file in helm grep/etags buffers."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-window
+      (helm-goto-next-or-prec-file -1))))
+(put 'helm-goto-precedent-file 'helm-only t)
+
+;;;###autoload
+(defun helm-goto-next-file ()
+  "Go to precedent file in helm grep/etags buffers."
+  (interactive)
+  (with-helm-window
+    (helm-goto-next-or-prec-file 1)))
+
+(defun helm-grep-run-default-action ()
+  "Run grep default action from `helm-do-grep-1'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-grep-action)))
+(put 'helm-grep-run-default-action 'helm-only t)
+
+(defun helm-grep-run-other-window-action ()
+  "Run grep goto other window action from `helm-do-grep-1'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-grep-other-window)))
+(put 'helm-grep-run-other-window-action 'helm-only t)
+
+(defun helm-grep-run-other-frame-action ()
+  "Run grep goto other frame action from `helm-do-grep-1'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-grep-other-frame)))
+(put 'helm-grep-run-other-frame-action 'helm-only t)
+
+(defun helm-grep-run-save-buffer ()
+  "Run grep save results action from `helm-do-grep-1'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-grep-save-results)))
+(put 'helm-grep-run-save-buffer 'helm-only t)
+
+\f
+;;; helm-grep-mode
+;;
+;;
+(defun helm-grep-save-results (candidate)
+  (helm-grep-action candidate 'grep))
+
+(defun helm-grep-save-results-1 ()
+  "Save helm grep result in a `helm-grep-mode' buffer."
+  (let ((buf "*hgrep*")
+        new-buf)
+    (when (get-buffer buf)
+      (if helm-grep-save-buffer-name-no-confirm
+          (setq new-buf  (format "*hgrep|%s|-%s" helm-pattern
+                                 (format-time-string "%H-%M-%S*")))
+          (setq new-buf (helm-read-string "GrepBufferName: " buf))
+          (cl-loop for b in (helm-buffer-list)
+                   when (and (string= new-buf b)
+                             (not (y-or-n-p
+                                   (format "Buffer `%s' already exists overwrite? "
+                                           new-buf))))
+                   do (setq new-buf (helm-read-string "GrepBufferName: " "*hgrep "))))
+      (setq buf new-buf))
+    (with-current-buffer (get-buffer-create buf)
+      (setq buffer-read-only t)
+      (let ((inhibit-read-only t))
+        (erase-buffer)
+        (insert "-*- mode: helm-grep -*-\n\n"
+                (format "Grep Results for `%s':\n\n" helm-pattern))
+        (save-excursion
+          (insert (with-current-buffer helm-buffer
+                    (goto-char (point-min)) (forward-line 1)
+                    (buffer-substring (point) (point-max))))))
+      (helm-grep-mode) (pop-to-buffer buf))
+    (message "Helm Grep Results saved in `%s' buffer" buf)))
+
+(define-derived-mode helm-grep-mode
+    special-mode "helm-grep"
+    "Major mode to provide actions in helm grep saved buffer.
+
+Special commands:
+\\{helm-grep-mode-map}"
+    (set (make-local-variable 'helm-grep-last-cmd-line)
+         (with-helm-buffer helm-grep-last-cmd-line))
+    (set (make-local-variable 'revert-buffer-function)
+         #'helm-grep-mode--revert-buffer-function))
+
+(defun helm-grep-mode--revert-buffer-function (&optional _ignore-auto _noconfirm)
+  (goto-char (point-min))
+  (re-search-forward "^Grep Results for" nil t)
+  (forward-line 0)
+  (when (re-search-forward "^$" nil t)
+    (forward-line 1))
+  (let ((inhibit-read-only t))
+    (delete-region (point) (point-max)))
+  (message "Reverting buffer...")
+  (set-process-sentinel
+   (start-file-process-shell-command
+    "hgrep"  (generate-new-buffer "*hgrep revert*") helm-grep-last-cmd-line)
+   (lambda (process event)
+     (when (string= event "finished\n")
+       (with-current-buffer (current-buffer)
+         (let ((inhibit-read-only t))
+           (save-excursion
+             (cl-loop for line in (with-current-buffer (process-buffer process)
+                                    (prog1 (split-string (buffer-string) "\n")
+                                      (kill-buffer)))
+                      when (string-match helm-grep-split-line-regexp line)
+                      do (insert (propertize
+                                  (car (helm-grep-filter-one-by-one line))
+                                  ;; needed for wgrep.
+                                  'helm-realvalue line)
+                                 "\n"))))
+         (message "Reverting buffer done"))))))
+
+(defun helm-gm-next-file ()
+  (interactive)
+  (helm-goto-next-or-prec-file 1))
+
+(defun helm-gm-precedent-file ()
+  (interactive)
+  (helm-goto-next-or-prec-file -1))
+
+(defun helm-grep-mode-jump ()
+  (interactive)
+  (helm-grep-action
+   (buffer-substring (point-at-bol) (point-at-eol))))
+
+(defun helm-grep-mode-jump-other-window-1 (arg)
+  (let ((candidate (buffer-substring (point-at-bol) (point-at-eol))))
+    (condition-case nil
+        (progn
+          (save-selected-window
+            (helm-grep-action candidate 'other-window)
+            (recenter))
+          (forward-line arg))
+      (error nil))))
+
+(defun helm-grep-mode-jump-other-window-forward ()
+  (interactive)
+  (helm-grep-mode-jump-other-window-1 1))
+
+(defun helm-grep-mode-jump-other-window-backward ()
+  (interactive)
+  (helm-grep-mode-jump-other-window-1 -1))
+
+(defun helm-grep-mode-jump-other-window ()
+  (interactive)
+  (let ((candidate (buffer-substring (point-at-bol) (point-at-eol))))
+    (condition-case nil
+        (helm-grep-action candidate 'other-window)
+      (error nil))))
+
+\f
+;;; ack-grep types
+;;
+;;
+(defun helm-grep-hack-types ()
+  "Return a list of known ack-grep types."
+  (with-temp-buffer
+    ;; "--help-types" works with both 1.96 and 2.1+, while
+    ;; "--help types" works only with 1.96 Issue #422.
+    ;; `helm-grep-command' should return the ack executable
+    ;; when this function is used in the right context
+    ;; i.e After checking is we are using ack-grep with
+    ;; `helm-grep-use-ack-p'.
+    (call-process (helm-grep-command t) nil t nil "--help-types")
+    (goto-char (point-min))
+    (cl-loop while (re-search-forward
+                    "^ *--\\(\\[no\\]\\)\\([^. ]+\\) *\\(.*\\)" nil t)
+             collect (cons (concat (match-string 2)
+                                   " [" (match-string 3) "]")
+                           (match-string 2))
+             collect (cons (concat "no" (match-string 2)
+                                   " [" (match-string 3) "]")
+                           (concat "no" (match-string 2))))))
+
+(defun helm-grep-ack-types-transformer (candidates _source)
+  (cl-loop for i in candidates
+        if (stringp i)
+        collect (rassoc i helm-grep-ack-types-cache)
+        else
+        collect i))
+
+(defvar helm-grep-ack-types-cache nil)
+(defun helm-grep-read-ack-type ()
+  "Select types for the '--type' argument of ack-grep."
+  (require 'helm-mode)
+  (require 'helm-adaptive)
+  (setq helm-grep-ack-types-cache (helm-grep-hack-types))
+  (let ((types (helm-comp-read
+                "Types: " helm-grep-ack-types-cache
+                :name "*Ack-grep types*"
+                :marked-candidates t
+                :must-match t
+                :fc-transformer '(helm-adaptive-sort
+                                  helm-grep-ack-types-transformer)
+                :buffer "*helm ack-types*")))
+    (mapconcat (lambda (type) (concat "--type=" type)) types " ")))
+
+\f
+;;; grep extensions
+;;
+;;
+(defun helm-grep-guess-extensions (files)
+  "Try to guess file extensions in FILES list when using grep recurse.
+These extensions will be added to command line with --include arg of grep."
+  (cl-loop with ext-list = (list helm-grep-preferred-ext "*")
+        with lst = (if (file-directory-p (car files))
+                       (directory-files
+                        (car files) nil
+                        directory-files-no-dot-files-regexp)
+                     files)
+        for i in lst
+        for ext = (file-name-extension i 'dot)
+        for glob = (and ext (not (string= ext ""))
+                        (concat "*" ext))
+        unless (or (not glob)
+                   (and glob-list (member glob glob-list))
+                   (and glob-list (member glob ext-list))
+                   (and glob-list (member glob helm-grep-ignored-files)))
+        collect glob into glob-list
+        finally return (delq nil (append ext-list glob-list))))
+
+(defun helm-grep-get-file-extensions (files)
+  "Try to return a list of file extensions to pass to '--include' arg of grep."
+  (let* ((all-exts (helm-grep-guess-extensions
+                    (mapcar 'expand-file-name files)))
+         (extensions (helm-comp-read "Search Only in: " all-exts
+                                     :marked-candidates t
+                                     :fc-transformer 'helm-adaptive-sort
+                                     :buffer "*helm grep exts*"
+                                     :name "*helm grep extensions*")))
+    (when (listp extensions) ; Otherwise it is empty string returned by C-RET.
+      ;; If extensions is a list of one string containing spaces,
+      ;; assume user entered more than one glob separated by space(s) and
+      ;; split this string to pass it later to mapconcat.
+      ;; e.g '("*.el *.py")
+      (cl-loop for i in extensions
+               append (split-string-and-unquote i " ")))))
+
+\f
+;;; Set up source
+;;
+;;
+(defvar helm-source-grep nil)
+(defun helm-do-grep-1 (targets &optional recurse zgrep exts default-input input)
+  "Launch grep on a list of TARGETS files.
+When RECURSE is given use -r option of grep and prompt user
+to set the --include args of grep.
+You can give more than one arg separated by space at prompt.
+e.g *.el *.py *.tex.
+From lisp use the EXTS argument as a list of extensions as above.
+If you are using ack-grep, you will be prompted for --type
+instead and EXTS will be ignored.
+If prompt is empty `helm-grep-ignored-files' are added to --exclude.
+Argument DEFAULT-INPUT is use as `default' arg of `helm' and INPUT
+is used as `input' arg of `helm', See `helm' docstring.
+ZGREP when non--nil use zgrep instead, without prompting for a choice
+in recurse, and ignoring EXTS, search being made on
+`helm-zgrep-file-extension-regexp'."
+  (when (and (helm-grep-use-ack-p)
+             helm-ff-default-directory
+             (file-remote-p helm-ff-default-directory))
+    (error "Error: Remote operation not supported with ack-grep."))
+  (let* (non-essential
+         (exts (and recurse
+                    ;; [FIXME] I could handle this from helm-walk-directory.
+                    (not zgrep) ; zgrep doesn't handle -r opt.
+                    (not (helm-grep-use-ack-p :where 'recursive))
+                    (or exts (helm-grep-get-file-extensions targets))))
+         (include-files (and exts
+                             (mapconcat (lambda (x)
+                                            (concat "--include="
+                                                    (shell-quote-argument x)))
+                                        (if (> (length exts) 1)
+                                            (remove "*" exts)
+                                          exts) " ")))
+         (types (and (not include-files)
+                     (not zgrep)
+                     recurse
+                     (helm-grep-use-ack-p :where 'recursive)
+                     ;; When %e format spec is not specified
+                     ;; ignore types and do not prompt for choice.
+                     (string-match "%e" helm-grep-default-command)
+                     (helm-grep-read-ack-type)))
+         (follow (and helm-follow-mode-persistent
+                      (assoc-default 'follow helm-source-grep))))
+    ;; When called as action from an other source e.g *-find-files
+    ;; we have to kill action buffer.
+    (when (get-buffer helm-action-buffer)
+      (kill-buffer helm-action-buffer))
+    ;; If `helm-find-files' haven't already started,
+    ;; give a default value to `helm-ff-default-directory'.
+    (unless helm-ff-default-directory
+      (setq helm-ff-default-directory default-directory))
+    ;; We need to store these vars locally
+    ;; to pass infos later to `helm-resume'.
+    (helm-set-local-variable 'helm-zgrep-recurse-flag (and recurse zgrep)
+                             'helm-grep-last-targets targets
+                             'helm-grep-include-files (or include-files types)
+                             'helm-grep-in-recurse recurse
+                             'helm-grep-use-zgrep zgrep
+                             'helm-grep-default-command
+                             (cond (zgrep helm-default-zgrep-command)
+                                   (recurse helm-grep-default-recurse-command)
+                                   ;; When resuming the local value of
+                                   ;; `helm-grep-default-command' is used, only git-grep
+                                   ;; should need this.
+                                   (t helm-grep-default-command)))
+    ;; Setup the source.
+    (setq helm-source-grep
+          (helm-build-async-source
+           (if zgrep "Zgrep" (capitalize (if recurse
+                                             (helm-grep-command t)
+                                             (helm-grep-command))))
+            :candidates-process 'helm-grep-collect-candidates
+            :filter-one-by-one 'helm-grep-filter-one-by-one
+            :keymap helm-grep-map
+            :nohighlight t
+            :nomark t
+            :candidate-number-limit 9999
+            :help-message 'helm-grep-help-message
+            :history 'helm-grep-history
+            :action (helm-make-actions
+                     "Find File" 'helm-grep-action
+                     "Find file other frame" 'helm-grep-other-frame
+                     (lambda () (and (locate-library "elscreen")
+                                     "Find file in Elscreen"))
+                     'helm-grep-jump-elscreen
+                     "Save results in grep buffer" 'helm-grep-save-results
+                     "Find file other window" 'helm-grep-other-window)
+            :persistent-action 'helm-grep-persistent-action
+            :persistent-help "Jump to line (`C-u' Record in mark ring)"
+            :requires-pattern 2
+            :follow follow))
+    (helm
+     :sources 'helm-source-grep
+     :buffer (format "*helm %s*" (if zgrep "zgrep" (helm-grep-command recurse)))
+     :default default-input
+     :input input
+     :keymap helm-grep-map
+     :history 'helm-grep-history
+     :truncate-lines helm-grep-truncate-lines)))
+
+
+\f
+;;; zgrep
+;;
+;;
+(defun helm-ff-zgrep-1 (flist recursive)
+  (unwind-protect
+       (let* ((def-dir (or helm-ff-default-directory
+                           default-directory))
+              (only    (if recursive
+                           (or (gethash def-dir helm-rzgrep-cache)
+                               (puthash
+                                def-dir
+                                (helm-walk-directory
+                                 def-dir
+                                 :directories nil
+                                 :path 'full
+                                 :match helm-zgrep-file-extension-regexp)
+                                helm-rzgrep-cache))
+                         flist)))
+         (helm-do-grep-1 only recursive 'zgrep))
+    (setq helm-zgrep-recurse-flag nil)))
+
+\f
+;;; transformers
+;;
+;;
+(defun helm-grep-split-line (line)
+  "Split a grep output line."
+  ;; The output of grep may send a truncated line in this chunk,
+  ;; so don't split until grep line is valid, that is
+  ;; once the second part of the line comes with next chunk
+  ;; send by process.
+  (when (string-match helm-grep-split-line-regexp line)
+    ;; Don't use split-string because buffer/file name or string
+    ;; may contain a ":".
+    (cl-loop for n from 1 to 3 collect (match-string n line))))
+
+(defun helm-grep--filter-candidate-1 (candidate &optional dir)
+  (let* ((root   (or dir (and helm-grep-default-directory-fn
+                              (funcall helm-grep-default-directory-fn))))
+         (ansi-p (string-match-p helm--ansi-color-regexp candidate))
+         (line   (if ansi-p (helm--ansi-color-apply candidate) candidate))
+         (split  (helm-grep-split-line line))
+         (fname  (if (and root split)
+                     (expand-file-name (car split) root)
+                   (car-safe split)))
+         (lineno (nth 1 split))
+         (str    (nth 2 split))
+         (display-fname (cl-ecase helm-grep-file-path-style
+                          (basename (and fname (file-name-nondirectory fname)))
+                          (absolute fname)
+                          (relative (and fname root
+                                         (file-relative-name fname root))))))
+    (if (and display-fname lineno str)
+        (cons (concat (propertize display-fname
+                                  'face 'helm-grep-file
+                                  'help-echo fname)
+                      ":"
+                      (propertize lineno 'face 'helm-grep-lineno)
+                      ":"
+                      (if ansi-p str (helm-grep-highlight-match str)))
+              line)
+        "")))
+
+(defun helm-grep-filter-one-by-one (candidate)
+  "`filter-one-by-one' transformer function for `helm-do-grep-1'."
+  (let ((helm-grep-default-directory-fn
+         (or helm-grep-default-directory-fn
+             (lambda () (or helm-ff-default-directory
+                            (helm-default-directory)
+                            default-directory)))))
+    (if (consp candidate)
+        ;; Already computed do nothing (default as input).
+        candidate
+        (and (stringp candidate)
+             (helm-grep--filter-candidate-1 candidate)))))
+
+(defun helm-grep-highlight-match (str &optional multi-match)
+  "Highlight in string STR all occurences matching `helm-pattern'."
+  (let (beg end)
+    (condition-case-unless-debug nil
+        (with-temp-buffer
+          (insert (propertize str 'read-only nil)) ; Fix (#1176)
+          (goto-char (point-min))
+          (cl-loop for reg in
+                   (if multi-match
+                       ;; (m)occur.
+                       (cl-loop for r in (helm-mm-split-pattern
+                                          helm-pattern)
+                                unless (string-match "\\`!" r)
+                                collect
+                                (helm-aif (and helm-migemo-mode
+                                               (assoc r helm-mm--previous-migemo-info))
+                                    (cdr it) r))
+                       ;; async sources (grep, gid etc...)
+                       (list helm-input))
+                   do
+                   (while (and (re-search-forward reg nil t)
+                               (> (- (setq end (match-end 0))
+                                     (setq beg (match-beginning 0))) 0))
+                     (add-text-properties beg end '(face helm-grep-match)))
+                   do (goto-char (point-min))) 
+          (buffer-string))
+      (error nil))))
+
+\f
+;;; Grep from buffer list
+;;
+;;
+(defun helm-grep-buffers-1 (candidate &optional zgrep)
+  "Run grep on all file--buffers or CANDIDATE if it is a file--buffer.
+If one of selected buffers is not a file--buffer,
+it is ignored and grep will run on all others file--buffers.
+If only one candidate is selected and it is not a file--buffer,
+switch to this buffer and run `helm-occur'.
+If a prefix arg is given run grep on all buffers ignoring non--file-buffers."
+  (let* ((prefarg (or current-prefix-arg helm-current-prefix-arg))
+         (helm-ff-default-directory
+          (if (and helm-ff-default-directory
+                   (file-remote-p helm-ff-default-directory))
+              default-directory
+            helm-ff-default-directory))
+         (cands (if prefarg
+                    (buffer-list)
+                  (helm-marked-candidates)))
+         (win-conf (current-window-configuration))
+         ;; Non--fname and remote buffers are ignored.
+         (bufs (cl-loop for buf in cands
+                     for fname = (buffer-file-name (get-buffer buf))
+                     when (and fname (not (file-remote-p fname)))
+                     collect (expand-file-name fname))))
+    (if bufs
+        (if zgrep
+            (helm-do-grep-1 bufs nil 'zgrep)
+          (helm-do-grep-1 bufs))
+      ;; bufs is empty, thats mean we have only CANDIDATE
+      ;; and it is not a buffer-filename, fallback to occur.
+      (switch-to-buffer candidate)
+      (when (get-buffer helm-action-buffer)
+        (kill-buffer helm-action-buffer))
+      (helm-occur)
+      (when (eq helm-exit-status 1)
+        (set-window-configuration win-conf)))))
+
+(defun helm-grep-buffers (candidate)
+  "Action to grep buffers."
+  (helm-grep-buffers-1 candidate))
+
+(defun helm-zgrep-buffers (candidate)
+  "Action to zgrep buffers."
+  (helm-grep-buffers-1 candidate 'zgrep))
+
+\f
+;;; Helm interface for pdfgrep
+;;  pdfgrep program <http://pdfgrep.sourceforge.net/>
+;;  and a pdf-reader (e.g xpdf) are needed.
+;;
+(defvar helm-pdfgrep-default-function 'helm-pdfgrep-init)
+(defun helm-pdfgrep-init (only-files)
+  "Start an asynchronous pdfgrep process in ONLY-FILES list."
+  (let* ((default-directory (or helm-ff-default-directory
+                                default-directory))
+         (fnargs   (helm-grep-prepare-candidates
+                    (if (file-remote-p default-directory)
+                        (mapcar (lambda (x)
+                                    (file-remote-p x 'localname))
+                                only-files)
+                      only-files)
+                    default-directory))
+         (cmd-line (format helm-pdfgrep-default-command
+                           helm-pattern
+                           fnargs))
+         process-connection-type)
+    ;; Start pdf grep process.
+    (helm-log "Starting Pdf Grep process in directory `%s'" default-directory)
+    (helm-log "Command line used was:\n\n%s"
+              (concat ">>> " (propertize cmd-line 'face 'helm-grep-cmd-line) "\n\n"))
+    (prog1
+        (start-file-process-shell-command
+         "pdfgrep" helm-buffer cmd-line)
+      (message nil)
+      (set-process-sentinel
+       (get-buffer-process helm-buffer)
+       (lambda (_process event)
+           (if (string= event "finished\n")
+               (with-helm-window
+                 (setq mode-line-format
+                       '(" " mode-line-buffer-identification " "
+                         (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                         (:eval (propertize
+                                 (format "[Pdfgrep Process Finish - %s result(s)] "
+                                         (max (1- (count-lines
+                                                   (point-min) (point-max))) 0))
+                                 'face 'helm-grep-finish))))
+                 (force-mode-line-update))
+             (helm-log "Error: Pdf grep %s"
+                       (replace-regexp-in-string "\n" "" event))))))))
+
+(defun helm-do-pdfgrep-1 (only)
+  "Launch pdfgrep with a list of ONLY files."
+  (unless (executable-find "pdfgrep")
+    (error "Error: No such program `pdfgrep'."))
+  (let* (helm-grep-in-recurse) ; recursion is never used in pdfgrep.
+    ;; When called as action from an other source e.g *-find-files
+    ;; we have to kill action buffer.
+    (when (get-buffer helm-action-buffer)
+      (kill-buffer helm-action-buffer))
+    (setq helm-pdfgrep-targets only)
+    (helm
+     :sources (helm-build-async-source "PdfGrep"
+                :init (lambda ()
+                        ;; If `helm-find-files' haven't already started,
+                        ;; give a default value to `helm-ff-default-directory'.
+                        (setq helm-ff-default-directory (or helm-ff-default-directory
+                                                            default-directory)))
+                :candidates-process (lambda ()
+                                      (funcall helm-pdfgrep-default-function helm-pdfgrep-targets))
+                :nohighlight t
+                :nomark t
+                :filter-one-by-one #'helm-grep-filter-one-by-one
+                :candidate-number-limit 9999
+                :history 'helm-grep-history
+                :keymap helm-pdfgrep-map
+                :help-message 'helm-pdfgrep-help-message
+                :action #'helm-pdfgrep-action
+                :persistent-help "Jump to PDF Page"
+                :requires-pattern 2)
+     :buffer "*helm pdfgrep*"
+     :history 'helm-grep-history)))
+
+(defun helm-pdfgrep-action (candidate)
+  (helm-grep-action candidate 'pdf))
+
+(defun helm-pdfgrep-action-1 (_split pageno fname)
+  (save-selected-window
+    (start-file-process-shell-command
+     "pdf-reader" nil
+     (format-spec helm-pdfgrep-default-read-command
+                  (list (cons ?f fname) (cons ?p pageno))))))
+\f
+;;; AG - AT
+;;
+;;  https://github.com/ggreer/the_silver_searcher
+;;  https://github.com/monochromegane/the_platinum_searcher
+
+(defcustom helm-grep-ag-command
+  "ag --line-numbers -S --hidden --color --nogroup %s %s"
+  "The default command for AG or PT.
+Takes two format specs, the first for pattern and the second for directory.
+
+You must use an output format that fit with helm grep, that is:
+
+    \"filename:line-number:string\"
+
+The option \"--nogroup\" allow this.
+The option \"--line-numbers\" is also mandatory except with PT (not supported).
+
+You can use safely \"--color\" (default)."
+  :group 'helm-grep
+  :type 'string)
+
+(defun helm-grep--ag-command ()
+  (car (split-string helm-grep-ag-command)))
+
+(defun helm-grep-ag-init (directory)
+  (let ((cmd-line (format helm-grep-ag-command
+                          (shell-quote-argument helm-pattern)
+                          (shell-quote-argument directory))))
+    (set (make-local-variable 'helm-grep-last-cmd-line) cmd-line)
+    (prog1
+        (start-process-shell-command
+         "ag" helm-buffer cmd-line)
+      (set-process-sentinel
+       (get-buffer-process helm-buffer)
+       (lambda (_process event)
+         (when (string= event "finished\n")
+           (with-helm-window
+             (setq mode-line-format
+                   '(" " mode-line-buffer-identification " "
+                     (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                     (:eval (propertize
+                             (format
+                              "[%s process finished - (%s results)] "
+                              (upcase (helm-grep--ag-command))
+                              (helm-get-candidate-number))
+                             'face 'helm-grep-finish))))
+             (force-mode-line-update))))))))
+
+(defvar helm-source-grep-ag nil)
+(defun helm-grep-ag-1 (directory)
+  (setq helm-source-grep-ag
+        (helm-build-async-source (upcase (helm-grep--ag-command))
+          :header-name (lambda (name)
+                         (format "%s [%s]"
+                                 name (abbreviate-file-name directory)))
+          :candidates-process
+          (lambda () (helm-grep-ag-init directory))
+          :nohighlight t
+          :keymap helm-grep-map
+          :help-message 'helm-grep-help-message
+          :filter-one-by-one 'helm-grep-filter-one-by-one
+          :persistent-action 'helm-grep-persistent-action
+          :candidate-number-limit 99999
+          :requires-pattern 2
+          :nomark t
+          :action (helm-make-actions
+                   "Find File" 'helm-grep-action
+                   "Find file other frame" 'helm-grep-other-frame
+                   (lambda () (and (locate-library "elscreen")
+                                   "Find file in Elscreen"))
+                   'helm-grep-jump-elscreen
+                   "Save results in grep buffer" 'helm-grep-save-results
+                   "Find file other window" 'helm-grep-other-window)))
+  (helm :sources 'helm-source-grep-ag
+        :keymap helm-grep-map
+        :truncate-lines helm-grep-truncate-lines
+        :buffer (format "*helm %s*" (helm-grep--ag-command))))
+
+;;; Git grep
+;;
+;;
+(defcustom helm-grep-git-grep-command
+  "git grep -n%cH --color=always --exclude-standard --no-index --full-name -e %p -- %f"
+  "The git grep default command line.
+The option \"--color=always\" can be used safely.
+The color of matched items can be customized in your .gitconfig
+See `helm-grep-default-command' for more infos.
+
+The \"--exclude-standard\" and \"--no-index\" switches allow
+skipping unwanted files specified in ~/.gitignore_global
+and searching files not already staged.
+You have also to enable this in global \".gitconfig\" with
+    \"git config --global core.excludesfile ~/.gitignore_global\"."
+  :group 'helm-grep
+  :type 'string)
+
+(defun helm-grep-git-1 (directory &optional all)
+  (require 'vc)
+  (let* ((helm-grep-default-command helm-grep-git-grep-command)
+         helm-grep-default-recurse-command
+         ;; Expand filename of each candidate with the git root dir.
+         ;; The filename will be in the help-echo prop.
+         (helm-grep-default-directory-fn (lambda ()
+                                           (vc-find-root directory ".git")))
+         (helm-ff-default-directory (funcall helm-grep-default-directory-fn)))
+    (cl-assert helm-ff-default-directory nil "Not inside a Git repository")
+    (helm-do-grep-1 (if all '("") `(,(expand-file-name directory))))))
+
+\f
+;;;###autoload
+(defun helm-do-grep-ag ()
+  "Preconfigured helm for grepping with AG in `default-directory'."
+  (interactive)
+  (require 'helm-files)
+  (helm-grep-ag-1 default-directory))
+
+;;;###autoload
+(defun helm-grep-do-git-grep (arg)
+  "Preconfigured helm for git-grepping `default-directory'.
+With a prefix arg ARG git-grep the whole repository."
+  (interactive "P")
+  (require 'helm-files)
+  (helm-grep-git-1 default-directory arg))
+
+
+(provide 'helm-grep)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-grep.el ends here
diff --git a/elpa/helm-20160217.958/helm-help.el b/elpa/helm-20160217.958/helm-help.el
new file mode 100644 (file)
index 0000000..edecf3a
--- /dev/null
@@ -0,0 +1,1433 @@
+;;; helm-help.el --- Help messages for Helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'helm)
+
+(defvar helm-org-headings--nofilename)
+(declare-function helm-source-org-headings-for-files "helm-org.el")
+
+\f
+(defgroup helm-help nil
+  "Embedded help for `helm'."
+  :group 'helm)
+
+(defface helm-helper
+    '((t :inherit helm-header))
+  "Face for helm help string in minibuffer."
+  :group 'helm-help)
+
+(defcustom helm-documentation-file "~/.emacs.d/helm-doc.org"
+  "The file where you want to save helm documentation."
+  :group 'helm-help
+  :type 'string)
+\f
+(defvar helm-help--string-list '(helm-help-message
+                                 helm-buffer-help-message
+                                 helm-ff-help-message
+                                 helm-read-file-name-help-message
+                                 helm-generic-file-help-message
+                                 helm-grep-help-message
+                                 helm-pdfgrep-help-message
+                                 helm-etags-help-message
+                                 helm-ucs-help-message
+                                 helm-bookmark-help-message
+                                 helm-esh-help-message
+                                 helm-buffers-ido-virtual-help-message
+                                 helm-moccur-help-message
+                                 helm-top-help-message
+                                 helm-apt-help-message
+                                 helm-el-package-help-message
+                                 helm-M-x-help-message
+                                 helm-imenu-help-message
+                                 helm-colors-help-message
+                                 helm-semantic-help-message
+                                 helm-kmacro-help-message))
+
+\f
+;;;###autoload
+(defun helm-documentation (arg)
+  "Preconfigured helm for helm documentation.
+With a prefix arg refresh the documentation.
+
+Find here the documentation of all sources actually documented."
+  (interactive "P")
+  (require 'helm-org)
+  (when arg (delete-file helm-documentation-file)
+        (helm-aif (get-file-buffer helm-documentation-file)
+            (kill-buffer it)))
+  (unless (file-exists-p helm-documentation-file)
+    (with-temp-file helm-documentation-file
+      (erase-buffer)
+      (cl-loop for elm in helm-help--string-list
+               for str = (symbol-value elm)
+               do (insert (substitute-command-keys
+                           (if (functionp str) (funcall str) str))
+                          "\n\n"))))
+  (let ((helm-org-headings--nofilename t))
+    (helm :sources (helm-source-org-headings-for-files
+                    (list helm-documentation-file))
+          :candidate-number-limit 99999
+          :buffer "*helm documentation*")))
+\f
+;;; Local help messages.
+
+;;; `helm-buffer-list' help
+;;
+;;
+(defvar helm-buffer-help-message
+  "* Helm Buffer
+
+** Tips
+
+*** Completion
+
+**** Major-mode
+
+You can enter a partial name of major-mode (e.g. lisp, sh) to narrow down buffers.
+To specify the major-mode, prefix it with \"*\" e.g. \"*lisp\".
+If you want to match all buffers but the ones with a specific major-mode (negation),
+prefix the major-mode with \"!\" e.g. \"*!lisp\".
+If you want to specify more than one major-mode, separate them with \",\",
+e.g. \"*!lisp,!sh,!fun\" will list all buffers but the ones in lisp-mode, sh-mode and
+fundamental-mode.
+
+Enter then a space and a pattern to narrow down to buffers matching this pattern.
+
+**** Search inside buffers
+
+If you enter a space and a pattern prefixed by \"@\" helm will search for text matching
+this pattern INSIDE the buffer (i.e not in the name of buffer).
+NOTE that if you enter your pattern prefixed with \"@\" but escaped, helm will search a buffer
+matching \"@pattern\" but will not search inside.
+
+**** Search by directory name
+
+If you prefix the beginning of pattern with \"/\" the match will occur on directory name
+of buffer, it is interesting to narrow down to one directory for example, subsequent string
+entered after a space will match on buffer-name only.
+Note that negation is not supported for matching on buffer-file-name.
+You can specify more than one directory starting from helm v1.6.8
+ 
+**** Fuzzy matching
+
+Note that if `helm-buffers-fuzzy-matching' is non--nil you will have
+fuzzy matching on buffer names (not on directory name matching and major-mode though).
+A pattern starting with \"^\" will disable fuzzy matching and will match by exact regexp.
+
+**** Examples
+
+if I enter in pattern prompt:
+
+    \"*lisp ^helm @moc\"
+
+helm will narrow down the list by selecting only buffers that are in lisp mode, start by helm
+and match \"moc\" in their contents.
+
+if I enter in pattern prompt:
+
+    \"*lisp ^helm moc\"
+
+Notice there is no \"@\" this time
+helm will look for lisp mode buffers starting by \"helm\" and have \"moc\" in their name.
+
+if I enter in pattern prompt:
+
+    \"*!lisp !helm\"
+
+helm will narrow down to buffers that are not in \"lisp\" mode and that do not match \"helm\"
+
+if I enter in pattern prompt:
+
+    /helm/ w3
+
+helm will narrow down to buffers that are in any \"helm\" subdirectory and matching w3.
+
+*** Creating buffers
+
+When creating a new buffer use \\[universal-argument] to choose a mode for your buffer in a list.
+This list is customizable, see `helm-buffers-favorite-modes'.
+
+*** Killing buffers
+
+You have a command to kill buffer(s) and quit emacs and a command to kill buffers one by one
+\(no marked\) without quitting helm.
+
+You can run this persistent kill buffer command either with the regular
+`helm-execute-persistent-action' called with a prefix arg (C-u C-j) or with its specific command
+`helm-buffer-run-kill-persistent' see binding below.
+
+*** Meaning of colors and prefixes for buffers
+
+Remote buffers are prefixed with '@'.
+Red        => Buffer have its file modified on disk by an external process.
+Indianred2 => Buffer exists but its file have been deleted.
+Orange     => Buffer is modified and its file not saved to disk.
+Italic     => A non--file buffer.
+
+** Commands
+\\<helm-buffer-map>
+\\[helm-buffer-run-zgrep]\t\tGrep Buffer(s) works as zgrep too (C-u grep all buffers but non--file buffers).
+\\[helm-buffers-run-multi-occur]\t\tMulti Occur buffer or marked buffers. (C-u toggle force searching current-buffer).
+\\[helm-buffer-switch-other-window]\t\tSwitch other window.
+\\[helm-buffer-switch-other-frame]\t\tSwitch other frame.
+\\[helm-buffer-run-query-replace-regexp]\t\tQuery replace regexp in marked buffers.
+\\[helm-buffer-run-query-replace]\t\tQuery replace in marked buffers.
+\\[helm-buffer-run-ediff]\t\tEdiff current buffer with candidate.  If two marked buffers ediff those buffers.
+\\[helm-buffer-run-ediff-merge]\t\tEdiff merge current buffer with candidate.  If two marked buffers ediff merge those buffers.
+\\[helm-buffer-diff-persistent]\t\tToggle Diff buffer with saved file without quitting.
+\\[helm-buffer-revert-persistent]\t\tRevert buffer without quitting.
+\\[helm-buffer-save-persistent]\t\tSave buffer without quitting.
+\\[helm-buffer-run-kill-buffers]\t\tDelete marked buffers and quit.
+\\[helm-buffer-run-kill-persistent]\t\tDelete buffer without quitting helm.
+\\[helm-toggle-all-marks]\t\tToggle all marks.
+\\[helm-mark-all]\t\tMark all.
+\\[helm-toggle-buffers-details]\t\tToggle details.
+\\[helm-buffers-toggle-show-hidden-buffers]\t\tShow hidden buffers.
+\\[helm-buffers-mark-similar-buffers]\t\tMark all buffers with same type (color) than current.")
+
+;;; Find files help (`helm-find-files')
+;;
+;;
+(defvar helm-ff-help-message
+  "* Helm Find Files
+
+** Tips
+
+*** Navigation summary
+
+For a better experience you can enable auto completion by setting
+`helm-ff-auto-update-initial-value' to non-nil in your init file.
+It is not enabled by default to not confuse new users.
+
+**** Use `C-j' (persistent action) on a directory to go down one level
+
+On a symlinked directory a prefix arg will allow expanding to its true name.
+
+**** Use `C-l' on a directory to go up one level
+
+**** Use `C-r' to walk back the resulting tree of all the `C-l' you did
+
+Note: The tree is reinitialized each time you enter a new tree with `C-j'
+or by entering some pattern in prompt.
+
+*** Find file at point
+
+Helm is using `ffap' partially or completely to find file at point
+depending on value of `helm-ff-guess-ffap-filenames'.
+You can use full `ffap' by setting this to non-nil (annoying).
+Default value is nil which make `ffap' working partially.
+
+**** Find file at number line
+
+With something like this at point:
+
+    ~/elisp/helm/helm.el:1234
+
+Helm will find this file at line number 1234.
+
+**** Find url at point
+
+When an url is found at point, helm expand to that url only.
+Pressing RET jump to that url using `browse-url-browser-function'.
+
+**** Find mail at point
+
+When a mail address is found at point helm expand to this email address
+prefixed by \"mailto:\". Pressing RET open a message buffer with this mail
+address.
+
+*** Quick pattern expansion
+
+**** Enter `~/' at end of pattern to quickly reach home directory
+
+**** Enter `/' at end of pattern to quickly reach root of your file system
+
+**** Enter `./' at end of pattern to quickly reach `default-directory' (initial start of session)
+
+If you are already in `default-directory' this will move cursor on top.
+
+**** Enter `../' at end of pattern will reach upper directory, moving cursor on top
+
+NOTE: This is different to using `C-l' in that `C-l' don't move cursor on top but stay on previous
+subdir name.
+
+**** Enter any environment var (e.g. `$HOME') at end of pattern, it will be expanded
+
+**** You can yank any valid filename after pattern, it will be expanded
+
+*** Helm find files is fuzzy matching (start on third char entered)
+
+e.g. \"fob\" or \"fbr\" will complete \"foobar\"
+but \"fb\" will wait for a third char for completing.
+
+*** Use `C-u C-j' to watch an image or `C-<down>'
+
+*** `C-j' on a filename will expand in helm-buffer to this filename
+
+Second hit on `C-j' will display buffer filename.
+Third hit on `C-j' will kill buffer filename.
+NOTE: `C-u C-j' will display buffer directly.
+
+*** To browse images directories turn on `helm-follow-mode' and navigate with arrow keys
+
+You can also use `helm-follow-action-forward' and `helm-follow-action-backward'
+\(`C-<down' and `C-<left>').
+
+*** You can turn off/on (toggle) autoupdate completion at any moment with `C-DEL'
+
+It is useful when auto completion is enabled and when trying to create a new file
+or directory you want to prevent helm trying to complete what you are writing.
+NOTE: On a terminal C-<backspace> may not work, use in this case C-c <backspace>.
+
+*** You can create a new directory and a new file at the same time
+
+Just write the path in prompt and press `<RET>'.
+e.g. You can create \"~/new/newnew/newnewnew/my_newfile.txt\".
+
+*** To create a new directory, add a \"/\" at end of new name and press <RET>
+
+*** To create a new file just write the filename not ending with \"/\"
+
+*** Recursive search from helm find files
+
+**** You can use helm browse project (see binding below)
+
+- With no prefix arg
+  If your current directory is under version control
+  with one of git or hg and you have installed helm-ls-git and/or helm-ls-hg
+  https://github.com/emacs-helm/helm-ls-git.git
+  https://github.com/emacs-helm/helm-ls-hg
+  you will see all your files under version control, otherwise
+  you will be back to helm-find-files.
+- With one prefix arg
+  You will see all the files under this directory
+  and other subdirectories (recursion) and this list of files will be cached.
+- With two prefix args
+  same but the cache will be refreshed.
+
+**** You can start a recursive search with Locate of Find (See commands below)
+
+With Locate you can use a local db with a prefix arg. If the localdb doesn't already
+exists, you will be prompted for its creation, if it exists and you want to refresh it,
+give two prefix args.
+
+*** Insert filename at point or complete filename at point
+
+On insertion (no completion, i.e nothing at point):
+
+- `C-c i'         => insert absolute file name.
+- `C-u C-c i'     => insert abbreviate file name.
+- `C-u C-u C-c i' => insert relative file name.
+
+On completion:
+
+- target starts by ~/           => insert abbreviate file name.
+- target starts by / or [a-z]:/ => insert full path.
+- otherwise                     => insert relative file name.
+
+*** Using wildcard to select multiple files
+
+Use of wilcard is supported to give a set of files to an action:
+
+e.g. You can copy all the files with \".el\" extension by using \"*.el\"
+and then run your copy action.
+
+You can do the same but with \"**.el\" (note the two stars),
+this will select recursively all \".el\" files under current directory.
+
+NOTE: When using an action that involve an external backend (e.g. grep), using \"**\"
+is not advised (even if it works fine) because it will be slower to select all your files,
+you have better time letting the backend doing it, it will be faster.
+However, if you know you have not many files it is reasonable to use this,
+also using not recursive wilcard (e.g. \"*.el\") is perfectly fine for this.
+
+This feature (\"**\") is activated by default with the option `helm-file-globstar'.
+The directory selection with \"**foo/\" like bash shopt globstar option is not supported yet.
+
+*** Copying renaming asynchronously
+
+If you use async library (if you have installed helm from MELPA you do) you can enable
+async for copying/renaming etc... your files by enabling `dired-async-mode'.
+
+Note that even when async is enabled, running a copy/rename action with a prefix arg
+will execute action synchronously, it will follow also the first file of the marked files
+in its destination directory.
+
+*** Bookmark your `helm-find-files' session
+
+You can bookmark your `helm-find-files' session with `C-x r m'.
+You can retrieve later these bookmarks easily by using M-x helm-filtered-bookmarks
+or from the current `helm-find-files' session just hitting `C-x r b'.
+
+*** Run Gid from `helm-find-files'
+
+You can navigate to a project containing an ID file created with the `mkid'
+command from id-utils, and run the `gid' command which will use the symbol at point
+in `helm-current-buffer' as default.
+
+** Commands
+\\<helm-find-files-map>
+\\[helm-ff-run-locate]\t\tRun Locate (C-u to specify locate db, M-n insert basename of candidate)
+\\[helm-ff-run-browse-project]\t\tBrowse project (`C-u' recurse, `C-u C-u' recurse and refresh db)
+\\[helm-ff-run-find-sh-command]\t\tRun Find shell command from this directory.
+\\[helm-ff-run-grep]\t\tRun Grep (C-u Recursive).
+\\[helm-ff-run-pdfgrep]\t\tRun Pdfgrep on marked files.
+\\[helm-ff-run-zgrep]\t\tRun zgrep (C-u Recursive).
+\\[helm-ff-run-grep-ag]\t\tRun AG grep on current directory.
+\\[helm-ff-run-git-grep]\t\tRun git-grep on current directory.
+\\[helm-ff-run-gid]\t\tRun gid (id-utils).
+\\[helm-ff-run-etags]\t\tRun Etags (C-u use thing-at-point `C-u C-u' reload cache)
+\\[helm-ff-run-rename-file]\t\tRename File (C-u Follow).
+\\[helm-ff-run-query-replace-on-marked]\t\tQuery replace on marked files.
+\\[helm-ff-run-copy-file]\t\tCopy File (C-u Follow).
+\\[helm-ff-run-byte-compile-file]\t\tByte Compile File (C-u Load).
+\\[helm-ff-run-load-file]\t\tLoad File.
+\\[helm-ff-run-symlink-file]\t\tSymlink File.
+\\[helm-ff-run-hardlink-file]\t\tHardlink file.
+\\[helm-ff-run-delete-file]\t\tDelete File.
+\\[helm-ff-run-kill-buffer-persistent]\t\tKill buffer candidate without quitting.
+\\[helm-ff-persistent-delete]\t\tDelete file without quitting.
+\\[helm-ff-run-switch-to-eshell]\t\tSwitch to Eshell.
+\\[helm-ff-run-eshell-command-on-file]\t\tEshell command on file (C-u Apply on marked files, otherwise treat them sequentially).
+\\[helm-ff-run-ediff-file]\t\tEdiff file.
+\\[helm-ff-run-ediff-merge-file]\t\tEdiff merge file.
+\\[helm-ff-run-complete-fn-at-point]\t\tComplete file name at point.
+\\[helm-ff-run-switch-other-window]\t\tSwitch other window.
+\\[helm-ff-run-switch-other-frame]\t\tSwitch other frame.
+\\[helm-ff-run-open-file-externally]\t\tOpen file with external program (C-u to choose).
+\\[helm-ff-run-open-file-with-default-tool]\t\tOpen file externally with default tool.
+\\[helm-ff-rotate-left-persistent]\t\tRotate Image Left.
+\\[helm-ff-rotate-right-persistent]\t\tRotate Image Right.
+\\[helm-find-files-up-one-level]\t\tGo down precedent directory.
+\\[helm-ff-run-switch-to-history]\t\tSwitch to last visited directories history.
+\\[helm-ff-file-name-history]\t\tSwitch to file name history.
+\\[helm-ff-properties-persistent]\t\tShow file properties in a tooltip.
+\\[helm-mark-all]\t\tMark all visibles candidates.
+\\[helm-ff-run-toggle-auto-update]\t\tToggle auto expansion of directories.
+\\[helm-unmark-all]\t\tUnmark all candidates, visibles and invisibles.
+\\[helm-ff-run-gnus-attach-files]\t\tGnus attach files to message buffer.
+\\[helm-ff-run-print-file]\t\tPrint file, (C-u to refresh printers list).
+\\[helm-enlarge-window]\t\tEnlarge helm window.
+\\[helm-narrow-window]\t\tNarrow helm window.
+\\[helm-ff-run-toggle-basename]\t\tToggle basename/fullpath.
+\\[helm-ff-run-find-file-as-root]\t\tFind file as root.
+\\[helm-ff-run-find-alternate-file]\t\tFind alternate file.
+\\[helm-ff-run-insert-org-link]\t\tInsert org link.")
+
+;;; Help for `helm-read-file-name'
+;;
+;;
+(defvar helm-read-file-name-help-message
+  "* Helm read file name
+
+** Tips
+
+If you are here, you are probably using a vanilla command like `find-file'
+helmized by `helm-mode', this is cool, but it is even better for your file
+navigation to use `helm-find-files' which is fully featured.
+
+*** Navigation
+
+**** Enter `~/' at end of pattern to quickly reach home directory
+
+**** Enter `/' at end of pattern to quickly reach root of your file system
+
+**** Enter `./' at end of pattern to quickly reach `default-directory' (initial start of session)
+
+If you are in `default-directory' move cursor on top.
+
+**** Enter `../' at end of pattern will reach upper directory, moving cursor on top
+
+NOTE: This different to using `C-l' in that `C-l' don't move cursor on top but stay on previous
+subdir name.
+
+**** You can complete with partial basename (start on third char entered)
+
+E.g. \"fob\" or \"fbr\" will complete \"foobar\"
+but \"fb\" will wait for a third char for completing.
+
+*** Persistent actions
+
+By default `helm-read-file-name' use the persistent actions of `helm-find-files'
+
+**** Use `C-u C-j' to watch an image
+
+**** `C-j' on a filename will expand in helm-buffer to this filename
+
+Second hit on `C-j' will display buffer filename.
+Third hit on `C-j' will kill buffer filename.
+NOTE: `C-u C-j' will display buffer directly.
+
+**** To browse images directories turn on `helm-follow-mode' and navigate with arrow keys
+
+*** Delete characters backward
+
+When you want to delete backward characters, e.g. to create a new file or directory,
+autoupdate may keep updating to an existent directory preventing you from doing so.
+In this case, type C-<backspace> and then <backspace>.
+This should not be needed when copying/renaming files because autoupdate is disabled
+by default in that case.
+NOTE: On a terminal C-<backspace> may not work, use in this case C-c <backspace>.
+
+*** Create new directory and files
+
+**** Create a new directory and a new file at the same time
+
+You can create a new directory and a new file at the same time, 
+just write the path in prompt and press <RET>.
+E.g. You can create \"~/new/newnew/newnewnew/my_newfile.txt\".
+
+**** To create a new directory, add a \"/\" at end of new name and press <RET>
+
+**** To create a new file just write the filename not ending with \"/\"
+
+_NOTE_: File and directory creation work only in some commands (e.g `find-file')
+and will not work in other commands where it is not intended to return a file or a directory
+\(e.g `list-directory').
+
+** Commands
+\\<helm-read-file-map>
+\\[helm-find-files-up-one-level]\t\tGo down precedent directory.
+\\[helm-ff-run-toggle-auto-update]\t\tToggle auto expansion of directories.
+\\[helm-ff-run-toggle-basename]\t\tToggle basename.
+\\[helm-ff-file-name-history]\t\tFile name history.
+C/\\[helm-cr-empty-string]\t\tMaybe return empty string (unless `must-match').
+\\[helm-next-source]\t\tGoto next source.
+\\[helm-previous-source]\t\tGoto previous source.")
+
+;;; Generic file help - Used by locate.
+;;
+;;
+(defvar helm-generic-file-help-message
+  "* Helm Generic files
+
+** Tips
+
+*** Locate
+
+You can add after writing search pattern any of the locate command line options.
+e.g. -b, -e, -n <number>...etc.
+See Man locate for more infos.
+
+Some other sources (at the moment recentf and file in current directory sources)
+support the -b flag for compatibility with locate when they are used with it.
+
+*** Browse project
+
+When your directory is not under version control,
+don't forget to refresh your cache when files have been added/removed in your directory.
+
+*** Find command
+
+Recursively search files using \"find\" shell command.
+
+Candidates are all filenames that match all given globbing patterns.
+This respects the options `helm-case-fold-search' and
+`helm-findutils-search-full-path'.
+
+You can pass arbitrary options directly to find after a \"*\" separator.
+For example, this would find all files matching \"book\" that are larger
+than 1 megabyte:
+
+    book * -size +1M
+
+** Commands
+\\<helm-generic-files-map>
+\\[helm-ff-run-toggle-basename]\t\tToggle basename.
+\\[helm-ff-run-grep]\t\tRun grep (C-u recurse).
+\\[helm-ff-run-zgrep]\t\tRun zgrep.
+\\[helm-ff-run-gid]\t\tRun gid (id-utils).
+\\[helm-ff-run-pdfgrep]\t\tRun Pdfgrep on marked files.
+\\[helm-ff-run-copy-file]\t\tCopy file(s)
+\\[helm-ff-run-rename-file]\t\tRename file(s).
+\\[helm-ff-run-symlink-file]\t\tSymlink file(s).
+\\[helm-ff-run-hardlink-file]\t\tHardlink file(s).
+\\[helm-ff-run-delete-file]\t\tDelete file(s).
+\\[helm-ff-run-byte-compile-file]\t\tByte compile file(s) (C-u load) (elisp).
+\\[helm-ff-run-load-file]\t\tLoad file(s) (elisp).
+\\[helm-ff-run-ediff-file]\t\tEdiff file.
+\\[helm-ff-run-ediff-merge-file]\t\tEdiff merge file.
+\\[helm-ff-run-switch-other-window]\t\tSwitch other window.
+\\[helm-ff-properties-persistent]\t\tShow file properties.
+\\[helm-ff-run-etags]\t\tRun etags (C-u use tap, C-u C-u reload DB).
+\\[helm-yank-text-at-point]\t\tYank text at point.
+\\[helm-ff-run-open-file-externally]\t\tOpen file with external program (C-u to choose).
+\\[helm-ff-run-open-file-with-default-tool]\t\tOpen file externally with default tool.
+\\[helm-ff-run-insert-org-link]\t\tInsert org link.")
+
+;;; Grep help
+;;
+;;
+(defvar helm-grep-help-message
+  "* Helm Grep
+
+** Tips
+
+*** You can start grep with a prefix arg to recurse in subdirectories
+
+*** You can use wild card when selecting files (e.g. *.el)
+
+*** You can grep in many differents directories by marking files or wild cards
+
+*** You can save your results in a `helm-grep-mode' buffer, see commands below
+
+Once in this buffer you can use emacs-wgrep to edit your changes.
+
+*** Important
+
+Grepping on remote file will work only with grep, not ack-grep, but it is
+anyway bad supported as tramp doesn't support multiple process running in a
+short delay (less than 5s actually) among other things,
+so I strongly advice hitting `C-!' (i.e suspend process)
+before entering anything in pattern, and hit again `C-!' when
+your regexp is ready to send to remote process, even if helm is handling
+this by delaying each process at 5s. 
+Or even better don't use tramp at all and mount your remote file system on SSHFS.
+
+* Helm Gid
+
+** Tips
+
+Helm gid read the database created with the `mkid' command from id-utils.
+The name of the database file can be customized with `helm-gid-db-file-name', it
+is usually \"ID\".
+Helm Gid use the symbol at point as default-input.
+You have access to this command also from `helm-find-files' which allow you to
+navigate to another directory to consult its database.
+
+* Helm AG
+
+** Tips
+
+Helm AG is different from grep or ack-grep in that it works on a directory and not
+a list of files.
+You can ignore files and directories by using a \".agignore\" file, local to directory
+or global when placed in home directory (See AG man page for more infos).
+This file supports same entries as what you will find in `helm-grep-ignored-files' and
+`helm-grep-ignored-directories'.
+As always you can access helm AG from `helm-find-files'.
+
+** Commands
+\\<helm-grep-map>
+\\[helm-goto-next-file]\t\tNext File.
+\\[helm-goto-precedent-file]\t\tPrecedent File.
+\\[helm-yank-text-at-point]\t\tYank Text at point in minibuffer.
+\\[helm-grep-run-other-window-action]\t\tJump other window.
+\\[helm-grep-run-other-frame-action]\t\tJump other frame.
+\\[helm-grep-run-default-action]\t\tRun default action (Same as RET).
+\\[helm-grep-run-save-buffer]\t\tSave to a `helm-grep-mode' enabled buffer.")
+
+;;; Pdf grep help
+;;
+;;
+(defvar helm-pdfgrep-help-message
+  "* Helm PdfGrep Map
+
+** Commands
+\\<helm-pdfgrep-map>
+\\[helm-goto-next-file]\t\tNext File.
+\\[helm-goto-precedent-file]\t\tPrecedent File.
+\\[helm-yank-text-at-point]\t\tYank Text at point in minibuffer.")
+
+;;; Etags help
+;;
+;;
+(defvar helm-etags-help-message
+  "* Helm Etags Map
+
+** Commands
+\\<helm-etags-map>
+\\[helm-goto-next-file]\t\tNext File.
+\\[helm-goto-precedent-file]\t\tPrecedent File.
+\\[helm-yank-text-at-point]\t\tYank Text at point in minibuffer.")
+
+;;; Ucs help
+;;
+;;
+(defvar helm-ucs-help-message
+  "* Helm Ucs
+
+** Tips
+
+Use commands below to insert unicode characters
+in current-buffer without quitting helm.
+
+** Commands
+\\<helm-ucs-map>
+\\[helm-ucs-persistent-insert]\t\tInsert char.
+\\[helm-ucs-persistent-forward]\t\tForward char.
+\\[helm-ucs-persistent-backward]\t\tBackward char.
+\\[helm-ucs-persistent-delete]\t\tDelete char backward.")
+
+;;; Bookmark help
+;;
+;;
+(defvar helm-bookmark-help-message
+  "* Helm bookmark name
+
+** Commands
+\\<helm-bookmark-map>
+\\[helm-bookmark-run-jump-other-window]\t\tJump other window.
+\\[helm-bookmark-run-delete]\t\tDelete bookmark.
+\\[helm-bookmark-run-edit]\t\tEdit bookmark.
+\\[helm-bookmark-toggle-filename]\t\tToggle bookmark location visibility.")
+
+;;; Eshell command on file help
+;;
+;;
+(defvar helm-esh-help-message
+  "* Helm eshell on file
+
+** Tips
+
+*** Passing extra args after filename
+
+Normally your command or alias will be called with file as argument. E.g.,
+
+    <command> 'candidate_file'
+
+But you can also pass an argument or more after 'candidate_file' like this:
+
+    <command> %s [extra_args]
+
+'candidate_file' will be added at '%s' and your command will look at this:
+
+    <command> 'candidate_file' [extra_args]
+
+*** Specify many files as args (marked files)
+
+E.g. <command> file1 file2 ...
+
+Call `helm-find-files-eshell-command-on-file' with one prefix-arg
+Otherwise you can pass one prefix-arg from the command selection buffer.
+NOTE: This is not working on remote files.
+
+With two prefix-arg before starting or from the command selection buffer
+the output is printed to your `current-buffer'.
+
+Note that with no prefix-arg or a prefix-arg value of '(16) (C-u C-u)
+the command is called once for each file like this:
+
+    <command> file1 <command> file2 etc...
+
+** Commands
+\\<helm-esh-on-file-map>")
+
+;;; Ido virtual buffer help
+;;
+;;
+(defvar helm-buffers-ido-virtual-help-message
+  "* Helm ido virtual buffers
+
+** Commands
+\\<helm-buffers-ido-virtual-map>
+\\[helm-ff-run-switch-other-window]\t\tSwitch other window.
+\\[helm-ff-run-switch-other-frame]\t\tSwitch other frame.
+\\[helm-ff-run-grep]\t\tGrep file.
+\\[helm-ff-run-zgrep]\t\tZgrep file.
+\\[helm-ff-run-delete-file]\t\tDelete file.
+\\[helm-ff-run-open-file-externally]\t\tOpen file externally.")
+
+;;; Moccur help
+;;
+;;
+(defvar helm-moccur-help-message
+  "* Helm Moccur
+
+** Tips
+
+*** Matching
+
+Multiple regexp matching is allowed, just enter a space to separate your regexps.
+
+Matching empty lines is supported with the regexp \"^$\", you will get the results
+with only the buffer-name and the line number, you can of course save and edit these
+results (i.e add text to the empty line) .
+
+*** Automatically matching symbol at point
+
+You can match automatically the symbol at point, but keeping
+the minibuffer empty ready to write into.
+This is disabled by default, to enable this you have to add `helm-source-occur'
+and `helm-source-moccur' to `helm-sources-using-default-as-input'.
+
+*** Jump to the corresponding line in the searched buffer
+
+You can do this with `C-j' (persistent-action), to do it repetitively
+you can use `C-<up>' and `C-<down>' or enable `helm-follow-mode' with `C-c C-f'.
+
+*** Saving results
+
+Same as with helm-grep, you can save the results with `C-x C-s'.
+Of course if you don't save your results, you can get back your session
+with `helm-resume'.
+
+*** Refreshing the resumed session.
+
+When the buffer(s) where you ran helm-(m)occur have been modified, you will be
+warned of this with the buffer flashing to red, you can refresh the buffer by running
+`C-c C-u'.
+This can be done automatically by customizing `helm-moccur-auto-update-on-resume'.
+
+*** Refreshing a saved buffer
+
+Type `g' to update your buffer.
+
+*** Edit a saved buffer
+
+First, install wgrep https://github.com/mhayashi1120/Emacs-wgrep
+and then:
+
+1) C-c C-p to edit the buffer(s).
+2) C-x C-s to save your changes.
+
+Tip: Use the excellent iedit https://github.com/tsdh/iedit
+to modify occurences in your buffer.
+
+** Commands
+\\<helm-moccur-map>
+\\[helm-goto-next-file]\t\tNext Buffer.
+\\[helm-goto-precedent-file]\t\tPrecedent Buffer.
+\\[helm-yank-text-at-point]\t\tYank Text at point in minibuffer.
+\\[helm-moccur-run-goto-line-ow]\t\tGoto line in other window.
+\\[helm-moccur-run-goto-line-of]\t\tGoto line in new frame.")
+
+;;; Helm Top
+;;
+;;
+(defvar helm-top-help-message
+  "* Helm Top
+
+** Tips
+
+** Commands
+\\<helm-top-map>
+\\[helm-top-run-sort-by-com]\t\tSort by commands.
+\\[helm-top-run-sort-by-cpu]\t\tSort by cpu usage.
+\\[helm-top-run-sort-by-user]\t\tSort alphabetically by user.
+\\[helm-top-run-sort-by-mem]\t\tSort by memory.")
+
+;;; Helm Apt
+;;
+;;
+(defvar helm-apt-help-message
+  "* Helm Apt
+
+** Tips
+
+** Commands
+\\<helm-apt-map>
+\\[helm-apt-show-all]\t\tShow all packages.
+\\[helm-apt-show-only-installed]\t\tShow installed packages only.
+\\[helm-apt-show-only-not-installed]\t\tShow not installed packages only.
+\\[helm-apt-show-only-deinstalled]\t\tShow deinstalled (not purged yet) packages only.>")
+
+;;; Helm elisp package
+;;
+;;
+(defvar helm-el-package-help-message
+  "* Helm elisp package
+
+** Tips
+
+*** Compile all your packages asynchronously
+
+When using async (if you have installed from MELPA you do), only helm, helm-core,
+and magit are compiled asynchronously, if you want all your packages compiled async,
+add to your init file:
+    
+     (setq async-bytecomp-allowed-packages '(all))
+    
+*** Upgrade elisp packages
+
+On initial start (when emacs is fetching packages on remote), if helm find
+package to upgrade it will start in the upgradables packages view showing the packages
+availables to upgrade.
+On further starts, you will have to refresh the list with `C-c C-u', if helm find upgrades
+you will have a message telling you some packages are available for upgrade, you can switch to
+upgrade view (see below) to see what packages are available for upgrade or just hit `C-c U'.
+to upgrade all.
+
+To see upgradables packages hit <M-U>.
+
+Then you can install all upgradables packages with the upgrade all action (`C-c C-u'),
+or upgrade only the specific packages by marking them (the new ones) and running
+the upgrade action (visible only when there is upgradables packages).
+Of course you can upgrade a single package by just running the upgrade action
+without marking it (`C-c u' or RET) .
+
+\*WARNING* You are strongly advised to RESTART emacs after UPGRADING packages.
+
+*** Meaning of flags prefixing packages (Emacs-25)
+
+- The flag \"S\" that prefix package names mean that this package is one of `package-selected-packages'.
+This feature is only available with emacs-25.
+
+- The flag \"U\" that prefix package names mean that this package is no more needed.
+This feature is only available with emacs-25.
+
+** Commands
+\\<helm-el-package-map>
+\\[helm-el-package-show-all]\t\tShow all packages.
+\\[helm-el-package-show-installed]\t\tShow installed packages only.
+\\[helm-el-package-show-uninstalled]\t\tShow not installed packages only.
+\\[helm-el-package-show-upgrade]\t\tShow upgradable packages only.
+\\[helm-el-run-package-install]\t\tInstall package(s).
+\\[helm-el-run-package-reinstall]\t\tReinstall package(s).
+\\[helm-el-run-package-uninstall]\t\tUninstall package(s).
+\\[helm-el-run-package-upgrade]\t\tUpgrade package(s).
+\\[helm-el-run-package-upgrade-all]\t\tUpgrade all packages upgradables.
+\\[helm-el-run-visit-homepage]\t\tVisit package homepage.")
+
+;;; Helm M-x
+;;
+;;
+(defvar helm-M-x-help-message
+  "* Helm M-x
+
+** Tips
+
+*** You can get help on any command with persistent action (C-j)
+
+*** Prefix Args
+
+All the prefix args passed BEFORE running `helm-M-x' are ignored,
+you should get an error message if you do so.
+When you want to pass prefix args, pass them AFTER starting `helm-M-x',
+you will see a prefix arg counter appearing in mode-line notifying you
+the number of prefix args entered.")
+
+;;; helm-imenu
+;;
+;;
+(defvar helm-imenu-help-message
+  "* Helm imenu
+
+** Tips
+
+** Commands
+\\<helm-imenu-map>
+\\[helm-imenu-next-section]\t\tGo to next section.
+\\[helm-imenu-previous-section]\t\tGo to previous section.")
+
+;;; helm-colors
+;;
+;;
+(defvar helm-colors-help-message
+  "* Helm colors
+
+** Commands
+\\<helm-color-map>
+\\[helm-color-run-insert-name]\t\tInsert the entry'name.
+\\[helm-color-run-kill-name]\t\tKill the entry's name.
+\\[helm-color-run-insert-rgb]\t\tInsert entry in RGB format.
+\\[helm-color-run-kill-rgb]\t\tKill entry in RGB format.")
+
+;;; helm semantic
+;;
+;;
+(defvar helm-semantic-help-message
+  "* Helm semantic
+
+** Tips
+
+** Commands
+\\<helm-semantic-map>")
+
+;;; helm kmacro
+;;
+;;
+(defvar helm-kmacro-help-message
+  "* Helm kmacro
+
+** Tips
+
+- Start recording some keys with `f3'
+- Record new kmacro with `f4'
+- Start `helm-execute-kmacro' to list all your macros.
+
+Use persistent action to run your kmacro as many time as needed,
+you can change of kmacro with `helm-next-line' `helm-previous-line'.
+
+NOTE: You can't record keys running helm commands except `helm-M-x' unless
+you don't choose from there a command using helm completion.
+
+** Commands
+\\<helm-kmacro-map>")
+
+\f
+;;; Mode line strings
+;;
+;;
+;;;###autoload
+(defvar helm-comp-read-mode-line "\
+\\<helm-comp-read-map>\
+C/\\[helm-cr-empty-string]:Empty \
+\\<helm-map>\
+\\[helm-help]:Help \
+\\[helm-select-action]:Act \
+\\[helm-maybe-exit-minibuffer]/\
+f1/f2/f-n:NthAct \
+\\[helm-toggle-suspend-update]:Tog.suspend")
+
+;;;###autoload
+(defvar helm-read-file-name-mode-line-string "\
+\\<helm-read-file-map>\
+\\[helm-help]:Help \
+C/\\[helm-cr-empty-string]:Empty \
+\\<helm-map>\
+\\[helm-select-action]:Act \
+\\[helm-maybe-exit-minibuffer]/\
+f1/f2/f-n:NthAct \
+\\[helm-toggle-suspend-update]:Tog.suspend"
+  "String displayed in mode-line in `helm-source-find-files'.")
+
+;;;###autoload
+(defvar helm-top-mode-line "\
+\\<helm-top-map>\
+\\[helm-help]:Help \
+\\<helm-map>\
+\\[helm-select-action]:Act \
+\\[helm-maybe-exit-minibuffer]/\
+f1/f2/f-n:NthAct \
+\\[helm-toggle-suspend-update]:Tog.suspend")
+
+\f
+;;; Attribute Documentation
+;;
+;;
+;;;###autoload
+(defun helm-describe-helm-attribute (helm-attribute)
+  "Display the full documentation of HELM-ATTRIBUTE.
+HELM-ATTRIBUTE should be a symbol."
+  (interactive (list (intern
+                      (completing-read
+                       "Describe helm attribute: "
+                       (mapcar 'symbol-name helm-attributes)
+                       nil t))))
+  (with-output-to-temp-buffer "*Help*"
+    (princ (get helm-attribute 'helm-attrdoc))))
+
+(helm-document-attribute 'name "mandatory"
+  "  The name of the source. It is also the heading which appears
+  above the list of matches from the source. Must be unique.")
+
+(helm-document-attribute 'header-name "optional"
+  "  A function returning the display string of the header. Its
+  argument is the name of the source. This attribute is useful to
+  add an additional information with the source name.")
+
+(helm-document-attribute 'candidates "mandatory if candidates-in-buffer attribute is not provided"
+  "  Specifies how to retrieve candidates from the source. It can
+  either be a variable name, a function called with no parameters
+  or the actual list of candidates.
+
+  The list must be a list whose members are strings, symbols
+  or (DISPLAY . REAL) pairs.
+
+  In case of (DISPLAY . REAL) pairs, the DISPLAY string is shown
+  in the Helm buffer, but the REAL one is used as action
+  argument when the candidate is selected. This allows a more
+  readable presentation for candidates which would otherwise be,
+  for example, too long or have a common part shared with other
+  candidates which can be safely replaced with an abbreviated
+  string for display purposes.
+
+  Note that if the (DISPLAY . REAL) form is used then pattern
+  matching is done on the displayed string, not on the real
+  value.
+
+  If the candidates have to be retrieved asynchronously (for
+  example, by an external command which takes a while to run)
+  then the function should start the external command
+  asynchronously and return the associated process object.
+  Helm will take care of managing the process (receiving the
+  output from it, killing it if necessary, etc.). The process
+  should return candidates matching the current pattern (see
+  variable `helm-pattern'.)
+  You should use instead `candidates-process' attribute for
+  async processes, a warning will popup when using async process
+  in a `candidates' attribute.
+
+  Note that currently results from asynchronous sources appear
+  last in the helm buffer regardless of their position in
+  `helm-sources'.")
+
+(helm-document-attribute 'candidates-process
+    "Same as `candidates' attributes but for process function."
+  "  You should use this attribute when using a function involving
+  an async process instead of `candidates'.")
+
+(helm-document-attribute 'action "mandatory if type attribute is not provided"
+  "  It is a list of (DISPLAY . FUNCTION) pairs or FUNCTION.
+  FUNCTION is called with one parameter: the selected candidate.
+
+  An action other than the default can be chosen from this list
+  of actions for the currently selected candidate (by default
+  with TAB). The DISPLAY string is shown in the completions
+  buffer and the FUNCTION is invoked when an action is
+  selected. The first action of the list is the default.")
+
+(helm-document-attribute 'coerce "optional"
+  "  It's a function called with one argument: the selected
+  candidate.
+
+  This function is intended for type convertion. In normal case,
+  the selected candidate (string) is passed to action
+  function. If coerce function is specified, it is called just
+  before action function.
+
+  Example: converting string to symbol
+    (coerce . intern)")
+
+(helm-document-attribute 'type "optional if action attribute is provided"
+  "  Indicates the type of the items the source returns.
+
+  Merge attributes not specified in the source itself from
+  `helm-type-attributes'.
+
+  This attribute is implemented by plug-in.")
+
+(helm-document-attribute 'init "optional"
+  "  Function called with no parameters when helm is started. It
+  is useful for collecting current state information which can be
+  used to create the list of candidates later.
+
+  For example, if a source needs to work with the current
+  directory then it can store its value here, because later
+  helm does its job in the minibuffer and in the
+  `helm-buffer' and the current directory can be different
+  there.")
+
+(helm-document-attribute 'match "optional"
+  "  List of functions called with one parameter: a candidate. The
+  function should return non-nil if the candidate matches the
+  current pattern (see variable `helm-pattern').
+
+  This attribute allows the source to override the default
+  pattern matching based on `string-match'. It can be used, for
+  example, to implement a source for file names and do the
+  pattern matching on the basename of files, since it's more
+  likely one is typing part of the basename when searching for a
+  file, instead of some string anywhere else in its path.
+
+  If the list contains more than one function then the list of
+  matching candidates from the source is constructed by appending
+  the results after invoking the first function on all the
+  potential candidates, then the next function, and so on. The
+  matching candidates supplied by the first function appear first
+  in the list of results and then results from the other
+  functions, respectively.
+
+  This attribute has no effect for asynchronous sources (see
+  attribute `candidates'), since they perform pattern matching
+  themselves.")
+
+(helm-document-attribute 'candidate-transformer "optional"
+  "  It's a function or a list of functions called with one argument
+  when the completion list from the source is built. The argument
+  is the list of candidates retrieved from the source. The
+  function should return a transformed list of candidates which
+  will be used for the actual completion.  If it is a list of
+  functions, it calls each function sequentially.
+
+  This can be used to transform or remove items from the list of
+  candidates.
+
+  Note that `candidates' is run already, so the given transformer
+  function should also be able to handle candidates with (DISPLAY
+  . REAL) format.")
+
+(helm-document-attribute 'filtered-candidate-transformer "optional"
+  "  It has the same format as `candidate-transformer', except the
+  function is called with two parameters: the candidate list and
+  the source.
+
+  This transformer is run on the candidate list which is already
+  filtered by the current pattern. While `candidate-transformer'
+  is run only once, it is run every time the input pattern is
+  changed.
+
+  It can be used to transform the candidate list dynamically, for
+  example, based on the current pattern.
+
+  In some cases it may also be more efficent to perform candidate
+  transformation here, instead of with `candidate-transformer'
+  even if this transformation is done every time the pattern is
+  changed.  For example, if a candidate set is very large then
+  `candidate-transformer' transforms every candidate while only
+  some of them will actually be dislpayed due to the limit
+  imposed by `helm-candidate-number-limit'.
+
+  Note that `candidates' and `candidate-transformer' is run
+  already, so the given transformer function should also be able
+  to handle candidates with (DISPLAY . REAL) format.
+
+  This option has no effect for asynchronous sources. (Not yet,
+  at least.")
+
+(helm-document-attribute 'action-transformer "optional"
+  "  It's a function or a list of functions called with two
+  arguments when the action list from the source is
+  assembled. The first argument is the list of actions, the
+  second is the current selection.  If it is a list of functions,
+  it calls each function sequentially.
+
+  The function should return a transformed action list.
+
+  This can be used to customize the list of actions based on the
+  currently selected candidate.")
+
+(helm-document-attribute 'pattern-transformer "optional"
+  "  It's a function or a list of functions called with one argument
+  before computing matches. Its argument is `helm-pattern'.
+  Functions should return transformed `helm-pattern'.
+
+  It is useful to change interpretation of `helm-pattern'.")
+
+(helm-document-attribute 'delayed "optional"
+  "  Candidates from the source are shown only if the user stops
+  typing and is idle for `helm-idle-delay' seconds.
+  If a value is given to delayed attr, this value is used instead only
+  if it is > to `helm-idle-delay'.")
+
+(helm-document-attribute 'volatile "optional"
+  "  Indicates the source assembles the candidate list dynamically,
+  so it shouldn't be cached within a single Helm
+  invocation. It is only applicable to synchronous sources,
+  because asynchronous sources are not cached.")
+
+(helm-document-attribute 'requires-pattern "optional"
+  "  If present matches from the source are shown only if the
+  pattern is not empty. Optionally, it can have an integer
+  parameter specifying the required length of input which is
+  useful in case of sources with lots of candidates.")
+
+(helm-document-attribute 'persistent-action "optional"
+  "  Can be a either a Function called with one parameter (the
+  selected candidate) or a cons cell where first element is this
+  same function and second element a symbol (e.g. never-split)
+  that inform `helm-execute-persistent-action'to not split his
+  window to execute this persistent action.")
+
+(helm-document-attribute 'candidates-in-buffer "optional"
+  "  Shortcut attribute for making and narrowing candidates using
+  buffers.  This newly-introduced attribute prevents us from
+  forgetting to add volatile and match attributes.
+
+  See docstring of `helm-candidates-in-buffer'.
+
+  (candidates-in-buffer) is equivalent of three attributes:
+    (candidates . helm-candidates-in-buffer)
+    (volatile)
+    (match identity)
+
+  (candidates-in-buffer . candidates-function) is equivalent of:
+    (candidates . candidates-function)
+    (volatile)
+    (match identity)
+
+  This attribute is implemented by plug-in.")
+
+(helm-document-attribute 'search "optional"
+  "  List of functions like `re-search-forward' or `search-forward'.
+  Buffer search function used by `helm-candidates-in-buffer'.
+  By default, `helm-candidates-in-buffer' uses
+  `re-search-forward'. This attribute is meant to be used with
+  (candidates . helm-candidates-in-buffer) or
+  (candidates-in-buffer) in short.")
+
+(helm-document-attribute 'get-line "optional"
+  "  A function like `buffer-substring-no-properties' or `buffer-substring'.
+  This function converts point of line-beginning and point of line-end,
+  which represents a candidate computed by `helm-candidates-in-buffer'.
+  By default, `helm-candidates-in-buffer' uses
+  `buffer-substring-no-properties'.")
+
+(helm-document-attribute 'display-to-real "optional"
+  "  Function called with one parameter; the selected candidate.
+
+  The function transforms the selected candidate, and the result
+  is passed to the action function.  The display-to-real
+  attribute provides another way to pass other string than one
+  shown in Helm buffer.
+
+  Traditionally, it is possible to make candidates,
+  candidate-transformer or filtered-candidate-transformer
+  function return a list with (DISPLAY . REAL) pairs. But if REAL
+  can be generated from DISPLAY, display-to-real is more
+  convenient and faster.")
+
+(helm-document-attribute 'real-to-display "optional"
+  "  Function called with one parameter; the selected candidate.
+
+  The inverse of display-to-real attribute.
+
+  The function transforms the selected candidate, which is passed
+  to the action function, for display.  The real-to-display
+  attribute provides the other way to pass other string than one
+  shown in Helm buffer.
+
+  Traditionally, it is possible to make candidates,
+  candidate-transformer or filtered-candidate-transformer
+  function return a list with (DISPLAY . REAL) pairs. But if
+  DISPLAY can be generated from REAL, real-to-display is more
+  convenient.
+
+  Note that DISPLAY parts returned from candidates /
+  candidate-transformer are IGNORED as the name `display-to-real'
+  says.")
+
+(helm-document-attribute 'cleanup "optional"
+  "  Function called with no parameters when *helm* buffer is
+  closed. It is useful for killing unneeded candidates buffer.
+
+  Note that the function is executed BEFORE performing action.")
+
+(helm-document-attribute 'candidate-number-limit "optional"
+  "  Override `helm-candidate-number-limit' only for this source.")
+
+(helm-document-attribute 'accept-empty "optional"
+  "  Pass empty string \"\" to action function.")
+
+(helm-document-attribute 'dummy "optional"
+  "  Set `helm-pattern' to candidate. If this attribute is
+  specified, The candidates attribute is ignored.
+
+  This attribute is implemented by plug-in.")
+
+(helm-document-attribute 'multiline "optional"
+  "  Enable to selection multiline candidates.")
+
+(helm-document-attribute 'update "optional"
+  (substitute-command-keys
+   "  Function called with no parameters at before \"init\" function when \
+\\<helm-map>\\[helm-force-update] is pressed."))
+
+(helm-document-attribute 'mode-line "optional"
+  "  Source local `helm-mode-line-string' (included in
+  `mode-line-format'). It accepts also variable/function name.")
+
+(helm-document-attribute 'header-line "optional"
+  "  Source local `header-line-format'.
+  It accepts also variable/function name. ")
+
+(helm-document-attribute
+    'resume "optional"
+  "  Function called with no parameters at end of initialization
+  when `helm-resume' is started.
+  If this function try to do something against `helm-buffer', \(e.g. updating,
+  searching etc...\) probably you should run it in a timer to ensure
+  `helm-buffer' is ready.")
+
+(helm-document-attribute 'keymap "optional"
+  "  Specific keymap for this source.
+  It is useful to have a keymap per source when using more than
+  one source.  Otherwise, a keymap can be set per command with
+  `helm' argument KEYMAP.  NOTE: when a source have `helm-map' as
+  keymap attr, the global value of `helm-map' will override the
+  actual local one.")
+
+(helm-document-attribute 'help-message "optional"
+  "  Help message for this source.
+  If not present, `helm-help-message' value will be used.")
+
+(helm-document-attribute 'match-part "optional"
+  "  Allow matching candidate in the line with `candidates-in-buffer'.
+  In candidates-in-buffer sources, match is done with
+  `re-search-forward' which allow matching only a regexp on the
+  `helm-buffer'; when this search is done, match-part allow
+  matching only a specific part of the current line e.g. with a
+  line like this:
+
+  filename:candidate-containing-the-word-filename
+
+  What you want is to ignore \"filename\" part and match only
+  \"candidate-containing-the-word-filename\"
+
+  So give a function matching only the part of candidate after \":\"
+
+  If source contain match-part attribute, match is computed only
+  on part of candidate returned by the call of function provided
+  by this attribute. The function should have one arg, candidate,
+  and return only a specific part of candidate.
+
+  NOTE: This have effect only on sources using
+  `candidates-in-buffer'.")
+
+(helm-document-attribute 'match-strict "optional"
+  "  When specifying a match function within a source and
+  helm-multi-match is enabled, the result of all matching
+  functions will be concatened, which in some cases is not what
+  is wanted. When using `match-strict' only this or these
+  functions will be used. You can specify those functions as a
+  list of functions or a single symbol function. For anonymous
+  function don't add the dot, e.g:
+
+  \(match-strict (lambda () (foo))).")
+
+(helm-document-attribute 'nohighlight "optional"
+  "  Disable highlight match in this source.")
+
+(helm-document-attribute 'no-matchplugin "optional"
+  "  Disable matchplugin for this source.")
+
+(helm-document-attribute 'history "optional"
+  "  Allow passing history variable to helm from source.
+  It should be a quoted symbol evaluated from source, i.e:
+  (history . ,'history-var)")
+
+(helm-document-attribute 'follow "optional"
+  "  Enable `helm-follow-mode' for this source only.
+  You must give it a value of 1 or -1, though giving a -1 value
+  is surely not what you want, e.g: (follow . 1)
+
+  See `helm-follow-mode' for more infos")
+
+(helm-document-attribute 'follow-delay "optional"
+  "  `helm-follow-mode' will execute persistent-action after this delay.
+  Otherwise value of `helm-follow-input-idle-delay' is used if non--nil,
+  If none of these are found fallback to `helm-input-idle-delay'.")
+
+(helm-document-attribute 'allow-dups "optional"
+  "  Allow helm collecting duplicates candidates.")
+
+(helm-document-attribute 'filter-one-by-one "optional"
+  "  A transformer function that treat candidates one by one.
+  It is called with one arg the candidate.
+  It is faster than `filtered-candidate-transformer' or `candidates-transformer',
+  but should be used only in sources that recompute constantly their candidates,
+  e.g. `helm-source-find-files'.
+  Filtering happen early and candidates are treated
+  one by one instead of re-looping on the whole list.
+  If used with `filtered-candidate-transformer' or `candidates-transformer'
+  these functions should treat the candidates transformed by the `filter-one-by-one'
+  function in consequence.")
+
+(helm-document-attribute 'nomark "optional"
+  "  Don't allow marking candidates when this attribute is present.")
+
+(provide 'helm-help)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-help.el ends here
diff --git a/elpa/helm-20160217.958/helm-id-utils.el b/elpa/helm-20160217.958/helm-id-utils.el
new file mode 100644 (file)
index 0000000..15f6bc4
--- /dev/null
@@ -0,0 +1,126 @@
+;;; helm-id-utils.el --- Helm interface for id-utils. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'helm-grep)
+(require 'helm-help)
+
+(defgroup helm-id-utils nil
+  "ID-Utils related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-gid-program "gid"
+  "Name of gid command (usually `gid').
+For Mac OS X users, if you install GNU coreutils, the name `gid'
+might be occupied by `id' from GNU coreutils, and you should set
+it to correct name (or absolute path), for example, if using
+MacPorts to install id-utils, it should be `gid32'."
+  :group 'helm-id-utils
+  :type 'file)
+
+(defcustom helm-gid-db-file-name "ID"
+  "Name of a database file created by `mkid' command from `ID-utils'."
+  :group 'helm-id-utils
+  :type 'string)
+
+(defun helm-gid-candidates-process ()
+  (let ((proc (start-process
+               "gid" nil helm-gid-program
+               "-r" helm-pattern)))
+    (set (make-local-variable 'helm-grep-last-cmd-line)
+         (format "%s -r %s" helm-gid-program helm-pattern))
+    (prog1 proc
+      (set-process-sentinel
+       proc (lambda (_process event)
+              (when (string= event "finished\n")
+                (with-helm-window
+                  (setq mode-line-format
+                        '(" " mode-line-buffer-identification " "
+                          (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                          (:eval (propertize
+                                  (format "[Helm Gid process finished - (%s results)]" 
+                                          (max (1- (count-lines
+                                                    (point-min) (point-max)))
+                                               0))
+                                  'face 'helm-locate-finish))))
+                  (force-mode-line-update))
+                (helm-log "Error: Gid %s"
+                          (replace-regexp-in-string "\n" "" event))))))))
+
+(defun helm-gid-filtered-candidate-transformer (candidates _source)
+  ;; "gid -r" may add dups in some rare cases.
+  (cl-loop for c in (helm-fast-remove-dups candidates :test 'equal)
+           collect (helm-grep--filter-candidate-1 c)))
+
+(defclass helm-gid-source (helm-source-async)
+  ((header-name
+    :initform
+    (lambda (name)
+      (concat name " [" (helm-attr 'db-dir) "]")))
+   (db-dir :initarg :db-dir
+           :initform nil
+           :custom string
+           :documentation " Location of ID file.")
+   (candidates-process :initform #'helm-gid-candidates-process)
+   (filtered-candidate-transformer
+    :initform #'helm-gid-filtered-candidate-transformer)
+   (candidate-number-limit :initform 99999)
+   (action :initform (helm-make-actions
+                      "Find File" 'helm-grep-action
+                      "Find file other frame" 'helm-grep-other-frame
+                      (lambda () (and (locate-library "elscreen")
+                                      "Find file in Elscreen"))
+                      'helm-grep-jump-elscreen
+                      "Save results in grep buffer" 'helm-grep-save-results
+                      "Find file other window" 'helm-grep-other-window))
+   (persistent-action :initform 'helm-grep-persistent-action)
+   (history :initform 'helm-grep-history)
+   (nohighlight :initform t)
+   (help-message :initform 'helm-grep-help-message)
+   (requires-pattern :initform 2)))
+
+;;;###autoload
+(defun helm-gid ()
+  "Preconfigured helm for `gid' command line of `ID-Utils'.
+Need A database created with the command `mkid'
+above `default-directory'.
+Need id-utils as dependency which provide `mkid', `gid' etc...
+See <https://www.gnu.org/software/idutils/>."
+  (interactive)
+  (let* ((db (locate-dominating-file
+              default-directory
+              helm-gid-db-file-name))
+         (helm-grep-default-directory-fn
+          (lambda () default-directory))
+         (helm--maybe-use-default-as-input t))
+    (cl-assert db nil "No DataBase found, create one with `mkid'")
+    (helm :sources (helm-make-source "Gid" 'helm-gid-source
+                     :db-dir db)
+          :buffer "*helm gid*"
+          :keymap helm-grep-map
+          :truncate-lines helm-grep-truncate-lines)))
+
+(provide 'helm-id-utils)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-id-utils ends here
diff --git a/elpa/helm-20160217.958/helm-imenu.el b/elpa/helm-20160217.958/helm-imenu.el
new file mode 100644 (file)
index 0000000..ba4848a
--- /dev/null
@@ -0,0 +1,276 @@
+;;; helm-imenu.el --- Helm interface for Imenu -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'imenu)
+(require 'helm-utils)
+(require 'helm-help)
+
+\f
+(defgroup helm-imenu nil
+  "Imenu related libraries and applications for helm."
+  :group 'helm)
+
+(defcustom helm-imenu-delimiter " / "
+  "Delimit types of candidates and his value in `helm-buffer'."
+  :group 'helm-imenu
+  :type 'string)
+
+(defcustom helm-imenu-execute-action-at-once-if-one
+  #'helm-imenu--execute-action-at-once-p
+  "Goto the candidate when only one is remaining."
+  :group 'helm-imenu
+  :type 'function)
+
+(defcustom helm-imenu-lynx-style-map t
+  "Use Arrow keys to jump to occurences."
+  :group 'helm-imenu
+  :type  'boolean)
+
+\f
+;;; keymap
+(defvar helm-imenu-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-<down>") 'helm-imenu-next-section)
+    (define-key map (kbd "M-<up>")   'helm-imenu-previous-section)
+    (when helm-imenu-lynx-style-map
+      (define-key map (kbd "<left>")  'helm-maybe-exit-minibuffer)
+      (define-key map (kbd "<right>") 'helm-execute-persistent-action))
+    (delq nil map)))
+
+(defun helm-imenu-next-or-previous-section (n)
+  (with-helm-buffer
+    (let* ((fn (lambda ()
+                 (car (split-string (helm-get-selection nil t)
+                                    helm-imenu-delimiter))))
+           (curtype (funcall fn))
+           (move-fn (if (> n 0) #'helm-next-line #'helm-previous-line))
+           (stop-fn (if (> n 0)
+                        #'helm-end-of-source-p
+                        #'helm-beginning-of-source-p)))
+      (catch 'break
+        (while (not (funcall stop-fn))
+          (funcall move-fn)
+          (unless (string= curtype (funcall fn))
+            (throw 'break nil)))))))
+
+(defun helm-imenu-next-section ()
+  (interactive)
+  (helm-imenu-next-or-previous-section 1))
+
+(defun helm-imenu-previous-section ()
+  (interactive)
+  (helm-imenu-next-or-previous-section -1))
+
+\f
+;;; Internals
+(defvar helm-cached-imenu-alist nil)
+(make-variable-buffer-local 'helm-cached-imenu-alist)
+
+(defvar helm-cached-imenu-candidates nil)
+(make-variable-buffer-local 'helm-cached-imenu-candidates)
+
+(defvar helm-cached-imenu-tick nil)
+(make-variable-buffer-local 'helm-cached-imenu-tick)
+
+\f
+(defvar helm-source-imenu nil "See (info \"(emacs)Imenu\")")
+(defvar helm-source-imenu-all nil)
+
+(defclass helm-imenu-source (helm-source-sync)
+  ((candidates :initform 'helm-imenu-candidates)
+   (candidate-transformer :initform 'helm-imenu-transformer)
+   (persistent-action :initform 'helm-imenu-persistent-action)
+   (persistent-help :initform "Show this entry")
+   (keymap :initform helm-imenu-map)
+   (help-message :initform 'helm-imenu-help-message)
+   (action :initform 'helm-imenu-action)))
+
+(defcustom helm-imenu-fuzzy-match nil
+  "Enable fuzzy matching in `helm-source-imenu'."
+  :group 'helm-imenu
+  :type  'boolean
+  :set (lambda (var val)
+         (set var val)
+         (setq helm-source-imenu
+               (helm-make-source "Imenu" 'helm-imenu-source
+                 :fuzzy-match helm-imenu-fuzzy-match))))
+\f
+(defun helm-imenu--maybe-switch-to-buffer (candidate)
+  (helm-aif (marker-buffer (cdr candidate))
+      (switch-to-buffer it)))
+
+(defun helm-imenu--execute-action-at-once-p ()
+  (let ((cur (helm-get-selection))
+        (mb (with-helm-current-buffer
+              (save-excursion
+                (goto-char (point-at-bol))
+                 (point-marker)))))
+    (if (equal (cdr cur) mb)
+        (prog1 nil
+          (helm-set-pattern "")
+          (helm-force-update))
+        t)))
+
+(defun helm-imenu-action (candidate)
+  "Default action for `helm-source-imenu'."
+  (helm-log-run-hook 'helm-goto-line-before-hook)
+  (helm-imenu--maybe-switch-to-buffer candidate)
+  (imenu candidate)
+  ;; If semantic is supported in this buffer
+  ;; imenu used `semantic-imenu-goto-function'
+  ;; and position have been highlighted,
+  ;; no need to highlight again.
+  (unless (eq imenu-default-goto-function
+              'semantic-imenu-goto-function)
+    (helm-highlight-current-line nil nil nil nil 'pulse)))
+
+(defun helm-imenu-persistent-action (candidate)
+  "Default persistent action for `helm-source-imenu'."
+  (helm-imenu--maybe-switch-to-buffer candidate)
+  (imenu candidate)
+  (helm-highlight-current-line))
+
+(defun helm-imenu-candidates (&optional buffer)
+  (with-current-buffer (or buffer helm-current-buffer)
+    (let ((tick (buffer-modified-tick)))
+      (if (eq helm-cached-imenu-tick tick)
+          helm-cached-imenu-candidates
+        (setq imenu--index-alist nil)
+        (prog1 (setq helm-cached-imenu-candidates
+                     (let ((index (imenu--make-index-alist t))) 
+                       (helm-imenu--candidates-1
+                        (delete (assoc "*Rescan*" index) index))))
+          (setq helm-cached-imenu-tick tick))))))
+
+(defun helm-imenu-candidates-in-all-buffers ()
+  (let* ((lst (buffer-list))
+         (progress-reporter (make-progress-reporter
+                             "Imenu indexing buffers..." 1 (length lst))))
+    (prog1
+        (cl-loop for b in lst
+                 for count from 1
+                 for mm = (with-current-buffer b major-mode)
+                 for cmm = (with-helm-current-buffer major-mode)
+                 when (or (with-helm-current-buffer
+                            (derived-mode-p mm))
+                          (with-current-buffer b
+                            (derived-mode-p cmm)))
+                 do (progress-reporter-update progress-reporter count)
+                 and
+                 append (with-current-buffer b
+                          (helm-imenu-candidates b)))
+      (progress-reporter-done progress-reporter))))
+
+(defun helm-imenu--candidates-1 (alist)
+  (cl-loop for elm in alist
+           nconc (if (imenu--subalist-p elm)
+                     (helm-imenu--candidates-1
+                      (cl-loop for (e . v) in (cdr elm) collect
+                               (cons (propertize
+                                      e 'helm-imenu-type (car elm))
+                                     ;; If value is an integer, convert it
+                                     ;; to a marker, otherwise it is a cons cell
+                                     ;; and it will be converted on next recursions.
+                                     ;; (Issue #1060) [1]. 
+                                     (if (integerp v) (copy-marker v) v))))
+                     (and (cdr elm) ; bug in imenu, should not be needed.
+                          (setcdr elm (copy-marker (cdr elm))) ; Same as [1].
+                          (list elm)))))
+
+(defun helm-imenu--get-prop (item)
+  ;; property value of ITEM can have itself
+  ;; a property value which have itself a property value
+  ;; ...and so on; Return a list of all these
+  ;; properties values starting at ITEM.
+  (let* ((prop (get-text-property 0 'helm-imenu-type item))
+         (lst  (list prop item)))
+    (when prop
+      (while prop
+        (setq prop (get-text-property 0 'helm-imenu-type prop))
+        (and prop (push prop lst)))
+      lst)))
+
+(defun helm-imenu-transformer (candidates)
+  (cl-loop for (k . v) in candidates
+        for types = (or (helm-imenu--get-prop k)
+                        (list "Function" k))
+        for bufname = (buffer-name (marker-buffer v))
+        for disp1 = (mapconcat
+                     (lambda (x)
+                       (propertize
+                        x 'face (cond ((string= x "Variables")
+                                       'font-lock-variable-name-face)
+                                      ((string= x "Function")
+                                       'font-lock-function-name-face)
+                                      ((string= x "Types")
+                                       'font-lock-type-face))))
+                     types helm-imenu-delimiter)
+        for disp = (propertize disp1 'help-echo bufname)
+        collect
+        (cons disp (cons k v))))
+\f
+;;;###autoload
+(defun helm-imenu ()
+  "Preconfigured `helm' for `imenu'."
+  (interactive)
+  (unless helm-source-imenu
+    (setq helm-source-imenu
+          (helm-make-source "Imenu" 'helm-imenu-source
+            :fuzzy-match helm-imenu-fuzzy-match)))
+  (let ((imenu-auto-rescan t)
+        (str (thing-at-point 'symbol))
+        (helm-execute-action-at-once-if-one
+         helm-imenu-execute-action-at-once-if-one))
+    (helm :sources 'helm-source-imenu
+          :default (list (concat "\\_<" str "\\_>") str)
+          :preselect str
+          :buffer "*helm imenu*")))
+
+;;;###autoload
+(defun helm-imenu-in-all-buffers ()
+  "Preconfigured helm for fetching imenu entries of all buffers."
+  (interactive)
+  (unless helm-source-imenu-all
+    (setq helm-source-imenu-all
+          (helm-make-source "Imenu in all buffers" 'helm-imenu-source
+            :candidates 'helm-imenu-candidates-in-all-buffers
+            :fuzzy-match helm-imenu-fuzzy-match)))
+  (let ((imenu-auto-rescan t)
+        (str (thing-at-point 'symbol))
+        (helm-execute-action-at-once-if-one
+         helm-imenu-execute-action-at-once-if-one))
+    (helm :sources 'helm-source-imenu-all
+          :default (list (concat "\\_<" str "\\_>") str)
+          :preselect (unless (memq 'helm-source-imenu-all
+                                   helm-sources-using-default-as-input)
+                       str)
+          :buffer "*helm imenu all*")))
+
+(provide 'helm-imenu)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-imenu.el ends here
diff --git a/elpa/helm-20160217.958/helm-info.el b/elpa/helm-20160217.958/helm-info.el
new file mode 100644 (file)
index 0000000..1abcd2e
--- /dev/null
@@ -0,0 +1,238 @@
+;;; helm-info.el --- Browse info index with helm -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-lib)
+(require 'helm-plugin)
+(require 'info)
+
+(declare-function Info-index-nodes "info" (&optional file))
+(declare-function Info-goto-node "info" (&optional fork))
+(declare-function Info-find-node "info.el" (filename nodename &optional no-going-back))
+(defvar Info-history)
+(defvar Info-directory-list)
+\f
+;;; Customize
+
+(defgroup helm-info nil
+  "Info-related applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-info-default-sources
+  '(helm-source-info-elisp
+    helm-source-info-cl
+    helm-source-info-eieio
+    helm-source-info-pages)
+  "Default sources to use for looking up symbols at point in Info
+files with `helm-info-at-point'."
+  :group 'helm-info
+  :type '(repeat (choice symbol)))
+\f
+;;; Build info-index sources with `helm-info-source' class.
+
+(cl-defun helm-info-init (&optional (file (helm-attr 'info-file)))
+  ;; Allow reinit candidate buffer when using edebug.
+  (helm-aif (and debug-on-error
+                 (helm-candidate-buffer))
+      (kill-buffer it))
+  (unless (helm-candidate-buffer)
+    (save-window-excursion
+      (info file)
+      (let ((tobuf (helm-candidate-buffer 'global))
+            (infobuf (current-buffer))
+            Info-history
+            start end)
+        (cl-dolist (node (Info-index-nodes))
+          (Info-goto-node node)
+          (goto-char (point-min))
+          (while (search-forward "\n* " nil t)
+            (unless (search-forward "Menu:\n" (1+ (point-at-eol)) t)
+              (setq start (point-at-bol)
+                    end (point-at-eol))
+              (with-current-buffer tobuf
+                (insert-buffer-substring infobuf start end)
+                (insert "\n")))))))))
+
+(defun helm-info-goto (node-line)
+  (Info-goto-node (car node-line))
+  (helm-goto-line (cdr node-line)))
+
+(defun helm-info-display-to-real (line)
+  (and (string-match
+        ;; This regexp is stolen from Info-apropos-matches
+        "\\* +\\([^\n]*.+[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" line)
+       (cons (format "(%s)%s" (helm-attr 'info-file) (match-string 2 line))
+             (string-to-number (or (match-string 3 line) "1")))))
+
+(defclass helm-info-source (helm-source-in-buffer)
+  ((info-file :initarg :info-file
+              :initform nil
+              :custom 'string)
+   (init :initform #'helm-info-init)
+   (display-to-real :initform #'helm-info-display-to-real)
+   (get-line :initform #'buffer-substring)
+   (action :initform '(("Goto node" . helm-info-goto)))))
+
+(defmacro helm-build-info-source (fname &rest args)
+  `(helm-make-source (concat "Info Index: " ,fname) 'helm-info-source
+     :info-file ,fname ,@args))
+
+(defun helm-build-info-index-command (name doc source buffer)
+  "Define a helm command NAME with documentation DOC.
+Arg SOURCE will be an existing helm source named
+`helm-source-info-<NAME>' and BUFFER a string buffer name."
+  (defalias (intern (concat "helm-info-" name))
+      (lambda ()
+        (interactive)
+        (helm :sources source
+              :buffer buffer
+              :candidate-number-limit 1000))
+    doc))
+
+(defun helm-define-info-index-sources (var-value &optional commands)
+  "Define helm sources named helm-source-info-<NAME>.
+Sources are generated for all entries of `helm-default-info-index-list'.
+If COMMANDS arg is non-nil, also build commands named `helm-info-<NAME>'.
+Where NAME is an element of `helm-default-info-index-list'."
+  (cl-loop for str in var-value
+           for sym = (intern (concat "helm-source-info-" str))
+           do (set sym (helm-build-info-source str))
+           when commands
+           do (helm-build-info-index-command
+               str (format "Predefined helm for %s info." str)
+               sym (format "*helm info %s*" str))))
+
+(defun helm-info-index-set (var value)
+  (set var value)
+  (helm-define-info-index-sources value t))
+\f
+;;; Search Info files
+
+;; `helm-info' is the main entry point here. It prompts the user for an Info
+;; file, then a term in the file's index to jump to.
+
+(defvar helm-info-searched (make-ring 32)
+  "Ring of previously searched Info files.")
+
+(defun helm-get-info-files ()
+  "Return list of Info files to use for `helm-info'.
+
+Elements of the list are strings of Info file names without
+extensions (e.g. \"emacs\" for file \"emacs.info.gz\"). Info
+files are found by searching directories in
+`Info-directory-list'."
+  (let ((files (cl-loop for d in (or Info-directory-list
+                                     Info-default-directory-list)
+                        when (file-directory-p d)
+                        append (directory-files d nil "\\.info"))))
+    (helm-fast-remove-dups
+     (cl-loop for f in files collect
+              (helm-file-name-sans-extension f))
+     :test 'equal)))
+
+(defcustom helm-default-info-index-list
+  (helm-get-info-files)
+  "Info files to search in with `helm-info'."
+  :group 'helm-info
+  :type  '(repeat (choice string))
+  :set   'helm-info-index-set)
+
+(defun helm-info-search-index (candidate)
+  "Search the index of CANDIDATE's Info file using the function
+helm-info-<CANDIDATE>."
+  (let ((helm-info-function
+         (intern-soft (concat "helm-info-" candidate))))
+    (when (fboundp helm-info-function)
+      (funcall helm-info-function)
+      (ring-insert helm-info-searched candidate))))
+
+(defun helm-def-source--info-files ()
+  "Return a `helm' source for Info files."
+  (helm-build-sync-source "Helm Info"
+    :candidates
+    (lambda () (copy-sequence helm-default-info-index-list))
+    :candidate-number-limit 999
+    :candidate-transformer
+    (lambda (candidates)
+      (sort candidates #'string-lessp))
+    :nomark t
+    :action '(("Search index" . helm-info-search-index))))
+
+;;;###autoload
+(defun helm-info ()
+  "Preconfigured `helm' for searching Info files' indices."
+  (interactive)
+  (let ((default (unless (ring-empty-p helm-info-searched)
+                   (ring-ref helm-info-searched 0))))
+    (helm :sources (helm-def-source--info-files)
+          :buffer "*helm Info*"
+          :preselect (and default
+                          (concat "\\_<" (regexp-quote default) "\\_>")))))
+\f
+;;;; Info at point
+
+;; `helm-info-at-point' is the main entry point here. It searches for the
+;; symbol at point through the Info sources defined in
+;; `helm-info-default-sources' and jumps to it.
+
+(defvar helm-info--pages-cache nil
+  "Cache for all Info pages on the system.")
+
+(defvar helm-source-info-pages
+  (helm-build-sync-source "Info Pages"
+    :init #'helm-info-pages-init
+    :candidates (lambda () helm-info--pages-cache)
+    :action '(("Show with Info" .(lambda (node-str)
+                                  (info (replace-regexp-in-string
+                                         "^[^:]+: " "" node-str)))))
+    :requires-pattern 2)
+  "Helm source for Info pages.")
+
+(defun helm-info-pages-init ()
+  "Collect candidates for initial Info node Top."
+  (if helm-info--pages-cache
+      helm-info--pages-cache
+    (let ((info-topic-regexp "\\* +\\([^:]+: ([^)]+)[^.]*\\)\\.")
+          topics)
+      (with-temp-buffer
+        (Info-find-node "dir" "top")
+        (goto-char (point-min))
+        (while (re-search-forward info-topic-regexp nil t)
+          (push (match-string-no-properties 1) topics))
+        (kill-buffer))
+      (setq helm-info--pages-cache topics))))
+
+;;;###autoload
+(defun helm-info-at-point ()
+  "Preconfigured `helm' for searching info at point.
+With a prefix-arg insert symbol at point."
+  (interactive)
+  (helm :sources helm-info-default-sources
+        :buffer "*helm info*"))
+\f
+(provide 'helm-info)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-info.el ends here
diff --git a/elpa/helm-20160217.958/helm-locate.el b/elpa/helm-20160217.958/helm-locate.el
new file mode 100644 (file)
index 0000000..a29bf3e
--- /dev/null
@@ -0,0 +1,410 @@
+;;; helm-locate.el --- helm interface for locate. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;; NOTE for WINDOZE users:
+;; You have to install Everything with his command line interface here:
+;; http://www.voidtools.com/download.php
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-types)
+(require 'helm-help)
+
+\f
+(defgroup helm-locate nil
+  "Locate related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-locate-db-file-regexp "m?locate\.db$"
+  "Default regexp to match locate database.
+If nil Search in all files."
+  :type  'string
+  :group 'helm-locate)
+
+(defcustom helm-ff-locate-db-filename "locate.db"
+  "The basename of the locatedb file you use locally in your directories.
+When this is set and `helm' find such a file in the directory from
+where you launch locate, it will use this file and will not prompt you
+for a db file.
+Note that this happen only when locate is launched with a prefix arg."
+  :group 'helm-locate
+  :type 'string)
+
+(defcustom helm-locate-command nil
+  "A list of arguments for locate program.
+Normally the default value should work on any system.
+
+If nil it will be calculated when `helm-locate' startup
+with these default values for different systems:
+
+Gnu/linux: \"locate %s -e --regex %s\"
+berkeley-unix: \"locate %s %s\"
+windows-nt: \"es %s %s\"
+Others: \"locate %s %s\"
+
+This string will be passed to format so it should end with `%s'.
+The first format spec is used for the \"-i\" value of locate/es,
+So don't set it directly but use `helm-locate-case-fold-search'
+for this.
+The \"-r\" option must be the last option, however if not specified you will
+be able to specify it during helm invocation by prefixing the pattern
+you enter with \"-r\"."
+  :type 'string
+  :group 'helm-locate)
+
+(defcustom helm-locate-create-db-command
+  "updatedb -l 0 -o %s -U %s"
+  "Command used to create a locale locate db file."
+  :type 'string
+  :group 'helm-locate)
+
+(defcustom helm-locate-case-fold-search helm-case-fold-search
+  "It have the same meaning as `helm-case-fold-search'.
+The -i option of locate will be used depending of value of
+`helm-pattern' when this is set to 'smart.
+When nil \"-i\" will not be used at all.
+and when non--nil it will always be used.
+NOTE: the -i option of the \"es\" command used on windows does
+the opposite of \"locate\" command."
+  :group 'helm-locate
+  :type 'symbol)
+
+(defcustom helm-locate-fuzzy-match nil
+  "Enable fuzzy matching in `helm-locate'."
+  :group 'helm-locate
+  :type 'boolean)
+
+(defcustom helm-locate-project-list nil
+  "A list of directories, your projects.
+When set, allow browsing recursively files in all
+directories of this list with `helm-projects-find-files'."
+  :group 'helm-locate
+  :type '(repeat string))
+
+\f
+(defvar helm-generic-files-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "C-]")     'helm-ff-run-toggle-basename)
+    (define-key map (kbd "C-s")     'helm-ff-run-grep)
+    (define-key map (kbd "M-g s")   'helm-ff-run-grep)
+    (define-key map (kbd "M-g z")   'helm-ff-run-zgrep)
+    (define-key map (kbd "M-g p")   'helm-ff-run-pdfgrep)
+    (define-key map (kbd "C-c g")   'helm-ff-run-gid)
+    (define-key map (kbd "M-R")     'helm-ff-run-rename-file)
+    (define-key map (kbd "M-C")     'helm-ff-run-copy-file)
+    (define-key map (kbd "M-B")     'helm-ff-run-byte-compile-file)
+    (define-key map (kbd "M-L")     'helm-ff-run-load-file)
+    (define-key map (kbd "M-S")     'helm-ff-run-symlink-file)
+    (define-key map (kbd "M-H")     'helm-ff-run-hardlink-file)
+    (define-key map (kbd "M-D")     'helm-ff-run-delete-file)
+    (define-key map (kbd "C-=")     'helm-ff-run-ediff-file)
+    (define-key map (kbd "C-c =")   'helm-ff-run-ediff-merge-file)
+    (define-key map (kbd "C-c o")   'helm-ff-run-switch-other-window)
+    (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame)
+    (define-key map (kbd "M-i")     'helm-ff-properties-persistent)
+    (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally)
+    (define-key map (kbd "C-c X")   'helm-ff-run-open-file-with-default-tool)
+    (define-key map (kbd "M-.")     'helm-ff-run-etags)
+    (define-key map (kbd "C-w")     'helm-yank-text-at-point)
+    (define-key map (kbd "C-c @")   'helm-ff-run-insert-org-link)
+    map)
+  "Generic Keymap for files.")
+
+\f
+(defface helm-locate-finish
+    '((t (:foreground "Green")))
+  "Face used in mode line when locate process is finish."
+  :group 'helm-locate)
+
+\f
+(defun helm-ff-find-locatedb (&optional from-ff)
+  "Try to find if a local locatedb file is available.
+The search is done in `helm-ff-default-directory' or
+fall back to `default-directory' if FROM-FF is nil."
+  (when helm-ff-locate-db-filename
+    (cond ((and helm-ff-default-directory
+                from-ff
+                (file-exists-p (expand-file-name
+                                helm-ff-locate-db-filename
+                                helm-ff-default-directory))
+                (expand-file-name
+                 helm-ff-locate-db-filename
+                 helm-ff-default-directory)))
+          ((and (not from-ff)
+                (file-exists-p (expand-file-name
+                                helm-ff-locate-db-filename
+                                default-directory))
+                (expand-file-name
+                 helm-ff-locate-db-filename
+                 default-directory))))))
+
+
+(defun helm-locate-create-db-default-function (db-name directory)
+  "Default function used to create a locale locate db file.
+Argument DB-NAME name of the db file.
+Argument DIRECTORY root of file system subtree to scan."
+  (format helm-locate-create-db-command db-name directory))
+
+(defvar helm-locate-create-db-function
+  #'helm-locate-create-db-default-function
+  "Function used to create a locale locate db file.
+It should receive the same arguments as
+`helm-locate-create-db-default-function'.")
+
+(defun helm-locate-1 (&optional localdb init from-ff default)
+  "Generic function to run Locate.
+Prefix arg LOCALDB when (4) search and use a local locate db file when it
+exists or create it, when (16) force update of existing db file
+even if exists.
+It have no effect when locate command is 'es'.
+INIT is a string to use as initial input in prompt.
+See `helm-locate-with-db' and `helm-locate'."
+  (require 'helm-mode)
+  (helm-locate-set-command)
+  (let ((pfn (lambda (candidate)
+                 (if (file-directory-p candidate)
+                     (message "Error: The locate Db should be a file")
+                   (if (= (shell-command
+                           (funcall helm-locate-create-db-function
+                                    candidate
+                                    helm-ff-default-directory))
+                          0)
+                       (message "New locatedb file `%s' created" candidate)
+                     (error "Failed to create locatedb file `%s'" candidate)))))
+        (locdb (and localdb
+                    (not (string-match "^es" helm-locate-command))
+                    (or (and (equal '(4) localdb)
+                             (helm-ff-find-locatedb from-ff))
+                        (helm-read-file-name
+                         "Create Locate Db file: "
+                         :initial-input (expand-file-name "locate.db"
+                                                          (or helm-ff-default-directory
+                                                              default-directory))
+                         :preselect helm-locate-db-file-regexp
+                         :test (lambda (x)
+                                   (if helm-locate-db-file-regexp
+                                       ;; Select only locate db files and directories
+                                       ;; to allow navigation.
+                                       (or (string-match
+                                            helm-locate-db-file-regexp x)
+                                           (file-directory-p x))
+                                     x)))))))
+    (when (and locdb (or (equal localdb '(16))
+                         (not (file-exists-p locdb))))
+      (funcall pfn locdb))
+    (helm-locate-with-db (and localdb locdb) init default)))
+
+(defun helm-locate-set-command ()
+  "Setup `helm-locate-command' if not already defined."
+  (unless helm-locate-command
+    (setq helm-locate-command
+          (cl-case system-type
+            (gnu/linux "locate %s -e --regex %s")
+            (berkeley-unix "locate %s %s")
+            (windows-nt "es %s %s")
+            (t "locate %s %s")))))
+
+(defvar helm-file-name-history nil)
+(defun helm-locate-with-db (&optional db initial-input default)
+  "Run locate -d DB.
+If DB is not given or nil use locate without -d option.
+Argument DB can be given as a string or list of db files.
+Argument INITIAL-INPUT is a string to use as initial-input.
+See also `helm-locate'."
+  (require 'helm-files)
+  (when (and db (stringp db)) (setq db (list db)))
+  (helm-locate-set-command)
+  (let ((helm-locate-command
+         (if db
+             (replace-regexp-in-string
+              "locate"
+              (format "locate -d %s"
+                      (mapconcat 'identity
+                                 ;; Remove eventually
+                                 ;; marked directories by error.
+                                 (cl-loop for i in db
+                                       unless (file-directory-p i)
+                                       collect i) ":"))
+              helm-locate-command)
+           helm-locate-command)))
+    (setq helm-file-name-history (mapcar 'helm-basename file-name-history))
+    (helm :sources 'helm-source-locate
+          :buffer "*helm locate*"
+          :ff-transformer-show-only-basename nil
+          :input initial-input
+          :default default
+          :history 'helm-file-name-history)))
+
+(defun helm-locate-init ()
+  "Initialize async locate process for `helm-source-locate'."
+  (let* ((locate-is-es (string-match "\\`es" helm-locate-command))
+         (real-locate (string-match "\\`locate" helm-locate-command))
+         (case-sensitive-flag (if locate-is-es "-i" ""))
+         (ignore-case-flag (if (or locate-is-es
+                                   (not real-locate)) "" "-i"))
+         (args (split-string helm-pattern " "))
+         (cmd (format helm-locate-command
+                      (cl-case helm-locate-case-fold-search
+                        (smart (let ((case-fold-search nil))
+                                 (if (string-match "[[:upper:]]" helm-pattern)
+                                     case-sensitive-flag
+                                     ignore-case-flag)))
+                        (t (if helm-locate-case-fold-search
+                               ignore-case-flag
+                               case-sensitive-flag)))
+                      (concat
+                       ;; The pattern itself.
+                       (shell-quote-argument (car args)) " "
+                       ;; Possible locate args added
+                       ;; after pattern, don't quote them.
+                       (mapconcat 'identity (cdr args) " ")))))
+    (helm-log "Starting helm-locate process")
+    (helm-log "Command line used was:\n\n%s"
+              (concat ">>> " (propertize cmd 'face 'font-lock-comment-face) "\n\n"))
+    (prog1
+        (start-process-shell-command
+         "locate-process" helm-buffer
+         cmd)
+      (set-process-sentinel
+       (get-buffer-process helm-buffer)
+       (lambda (process event)
+         (let* ((err (process-exit-status process))
+                (noresult (= err 1)))
+           (cond (noresult
+                  (with-helm-buffer
+                    (unless (cdr helm-sources)
+                      (insert (concat "* Exit with code 1, no result found,"
+                                      " command line was:\n\n "
+                                      cmd)))))
+                 ((string= event "finished\n")
+                  (with-helm-window
+                    (setq mode-line-format
+                          '(" " mode-line-buffer-identification " "
+                            (:eval (format "L%s" (helm-candidate-number-at-point))) " "
+                            (:eval (propertize
+                                    (format "[Locate process finished - (%s results)]"
+                                            (max (1- (count-lines
+                                                      (point-min) (point-max)))
+                                                 0))
+                                    'face 'helm-locate-finish))))
+                    (force-mode-line-update)))
+                 (t
+                  (helm-log "Error: Locate %s"
+                            (replace-regexp-in-string "\n" "" event))))))))))
+
+(defclass helm-locate-source (helm-source-async helm-type-file)
+  ((init :initform 'helm-locate-set-command)
+   (candidates-process :initform 'helm-locate-init)
+   (requires-pattern :initform 3)
+   (history :initform 'helm-file-name-history)
+   (persistent-action :initform 'helm-ff-kill-or-find-buffer-fname)
+   (candidate-number-limit :initform 9999)))
+
+(defvar helm-source-locate
+  (helm-make-source "Locate" 'helm-locate-source
+    :pattern-transformer 'helm-locate-pattern-transformer))
+
+(defun helm-locate-pattern-transformer (pattern)
+  (if helm-locate-fuzzy-match
+      (cond ((string-match
+              " " (replace-regexp-in-string " -b" "" pattern)) pattern)
+            ((string-match "\\([^ ]*\\) -b" pattern)
+             (concat (helm--mapconcat-pattern
+                      (match-string 1 pattern)) " -b"))
+            (t (helm--mapconcat-pattern pattern)))
+      pattern))
+
+(defun helm-locate-find-dbs-in-projects (&optional update)
+  (let* ((pfn (lambda (candidate directory)
+                (unless (= (shell-command
+                            (funcall helm-locate-create-db-function
+                                     candidate
+                                     directory))
+                           0)
+                  (error "Failed to create locatedb file `%s'" candidate)))))
+    (cl-loop for p in helm-locate-project-list
+             for db = (expand-file-name
+                       helm-ff-locate-db-filename
+                       (file-name-as-directory p))
+             if (and (null update) (file-exists-p db))
+             collect db
+             else do (funcall pfn db p)
+             and collect db)))
+
+;;;###autoload
+(defun helm-projects-find-files (update)
+  "Find files with locate in `helm-locate-project-list'.
+With a prefix arg refresh the database in each project."
+  (interactive "P")
+  (helm-locate-set-command)
+  (cl-assert (and (string-match-p "\\`locate" helm-locate-command)
+                  (executable-find "updatedb"))
+             nil "Unsupported locate version")
+  (let ((dbs (helm-locate-find-dbs-in-projects update)))
+    (if dbs
+        (helm-locate-with-db dbs)
+        (user-error "No projects found, please setup `helm-locate-project-list'"))))
+
+;;;###autoload
+(defun helm-locate-read-file-name (prompt)
+  (let* ((src `((name . "Locate read fname")
+                (init . helm-locate-set-command)
+                (candidates-process . helm-locate-init)
+                (action . identity)
+                (requires-pattern . 3)
+                (history . ,'helm-file-name-history)
+                (candidate-transformer . (helm-skip-boring-files
+                                          helm-highlight-files))
+                (candidate-number-limit . 9999)
+                (no-matchplugin))))
+    (or (helm :sources src
+              :ff-transformer-show-only-basename nil
+              :prompt prompt
+              :buffer "*helm locate read fname*"
+              :resume 'noresume)
+        (keyboard-quit))))
+
+;;;###autoload
+(defun helm-locate (arg)
+  "Preconfigured `helm' for Locate.
+Note: you can add locate options after entering pattern.
+See 'man locate' for valid options and also `helm-locate-command'.
+
+You can specify a local database with prefix argument ARG.
+With two prefix arg, refresh the current local db or create it
+if it doesn't exists.
+
+To create a user specific db, use
+\"updatedb -l 0 -o db_path -U directory\".
+Where db_path is a filename matched by
+`helm-locate-db-file-regexp'."
+  (interactive "P")
+  (setq helm-ff-default-directory default-directory)
+  (helm-locate-1 arg nil nil (thing-at-point 'filename)))
+
+(provide 'helm-locate)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-locate.el ends here
diff --git a/elpa/helm-20160217.958/helm-man.el b/elpa/helm-20160217.958/helm-man.el
new file mode 100644 (file)
index 0000000..8ba5795
--- /dev/null
@@ -0,0 +1,115 @@
+;;; helm-man.el --- Man and woman UI -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+
+(defvar woman-topic-all-completions)
+(defvar woman-manpath)
+(defvar woman-path)
+(defvar woman-expanded-directory-path)
+(declare-function woman-file-name "woman.el" (topic &optional re-cache))
+(declare-function woman-file-name-all-completions "woman.el" (topic))
+(declare-function Man-getpage-in-background "man.el" (topic))
+(declare-function woman-expand-directory-path "woman.el" (path-dirs path-regexps))
+(declare-function woman-topic-all-completions "woman.el" (path))
+(declare-function helm-generic-sort-fn "helm-utils.el" (S1 S2))
+
+(defgroup helm-man nil
+  "Man and Woman applications for helm."
+  :group 'helm)
+
+(defcustom helm-man-or-woman-function 'Man-getpage-in-background
+  "Default command to display a man page."
+  :group 'helm-man
+  :type '(radio :tag "Preferred command to display a man page"
+          (const :tag "Man" Man-getpage-in-background)
+          (const :tag "Woman" woman)))
+
+(defcustom helm-man-format-switches "-l %s"
+  "Arguments to pass to the `manual-entry' function.
+Arguments are passed to `manual-entry' with `format.'
+Default use \"-l\" which may not be supported on old man versions,
+in this case use \"%s\" as value to pass only the filename as argument.
+See Issue #1035"
+  :group 'helm-man
+  :type 'string)
+
+;; Internal
+(defvar helm-man--pages nil
+  "All man pages on system.
+Will be calculated the first time you invoke helm with this
+source.")
+
+(defun helm-man-default-action (candidate)
+  "Default action for jumping to a woman or man page from helm."
+  (let ((wfiles (mapcar
+                 'car (woman-file-name-all-completions candidate))))
+    (condition-case nil
+        (if (> (length wfiles) 1)
+            (let ((file (helm-comp-read
+                         "ManFile: " wfiles :must-match t)))
+              (if (eq helm-man-or-woman-function 'Man-getpage-in-background)
+                  (manual-entry (format helm-man-format-switches file))
+                  (woman-find-file file)))
+          (funcall helm-man-or-woman-function candidate))
+      ;; If woman is unable to format correctly
+      ;; use man instead.
+      (error (kill-buffer)              ; Kill woman buffer.
+             (Man-getpage-in-background candidate)))))
+
+(defun helm-man--init ()
+  (require 'woman)
+  (require 'helm-utils)
+  (unless helm-man--pages
+    (setq woman-expanded-directory-path
+          (woman-expand-directory-path woman-manpath woman-path))
+    (setq woman-topic-all-completions
+          (woman-topic-all-completions woman-expanded-directory-path))
+    (setq helm-man--pages (mapcar 'car woman-topic-all-completions)))
+  (helm-init-candidates-in-buffer 'global helm-man--pages))
+
+(defvar helm-source-man-pages
+  (helm-build-in-buffer-source "Manual Pages"
+    :init #'helm-man--init 
+    :persistent-action #'ignore
+    :filtered-candidate-transformer
+     (lambda (candidates _source)
+       (sort candidates #'helm-generic-sort-fn))
+    :action  '(("Display Man page" . helm-man-default-action))))
+
+;;;###autoload
+(defun helm-man-woman (arg)
+  "Preconfigured `helm' for Man and Woman pages.
+With a prefix arg reinitialize the cache."
+  (interactive "P")
+  (when arg (setq helm-man--pages nil))
+    (helm :sources 'helm-source-man-pages
+          :buffer "*Helm man woman*"))
+
+(provide 'helm-man)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-man.el ends here
diff --git a/elpa/helm-20160217.958/helm-misc.el b/elpa/helm-20160217.958/helm-misc.el
new file mode 100644 (file)
index 0000000..b297a62
--- /dev/null
@@ -0,0 +1,334 @@
+;;; helm-misc.el --- Various functions for helm -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-types)
+
+(declare-function display-time-world-display "time.el")
+(defvar display-time-world-list)
+
+\f
+(defgroup helm-misc nil
+  "Various Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-time-zone-home-location "Paris"
+  "The time zone of your home"
+  :group 'helm-misc
+  :type 'string)
+
+(defcustom helm-timezone-actions
+  '(("Set timezone env (TZ)" . (lambda (candidate)
+                                 (setenv "TZ" candidate))))
+  "Actions for helm-timezone."
+  :group 'helm-misc
+  :type '(alist :key-type string :value-type function))
+
+(defcustom helm-mini-default-sources '(helm-source-buffers-list
+                                       helm-source-recentf
+                                       helm-source-buffer-not-found)
+  "Default sources list used in `helm-mini'."
+  :group 'helm-misc
+  :type '(repeat (choice symbol)))
+
+(defface helm-time-zone-current
+    '((t (:foreground "green")))
+  "Face used to colorize current time in `helm-world-time'."
+  :group 'helm-misc)
+
+(defface helm-time-zone-home
+    '((t (:foreground "red")))
+  "Face used to colorize home time in `helm-world-time'."
+  :group 'helm-misc)
+
+
+\f
+;;; Latex completion
+(defvar LaTeX-math-menu)
+(defun helm-latex-math-candidates ()
+  "Collect candidates for latex math completion."
+  (cl-loop for i in (cddr LaTeX-math-menu)
+        for elm = (cl-loop for s in i when (vectorp s)
+                        collect (cons (aref s 0) (aref s 1)))
+        append elm))
+
+(defvar helm-source-latex-math
+  '((name . "Latex Math Menu")
+    (init . (lambda ()
+              (with-helm-current-buffer
+                (LaTeX-math-mode 1))))
+    (candidate-number-limit . 9999)
+    (candidates . helm-latex-math-candidates)
+    (action . (lambda (candidate)
+                (call-interactively candidate)))))
+
+\f
+;;; Jabber Contacts (jabber.el)
+(defun helm-jabber-online-contacts ()
+  "List online Jabber contacts."
+  (with-no-warnings
+    (cl-loop for item in (jabber-concat-rosters)
+          when (get item 'connected)
+          collect
+          (if (get item 'name)
+              (cons (get item 'name) item)
+            (cons (symbol-name item) item)))))
+
+(defvar helm-source-jabber-contacts
+  '((name . "Jabber Contacts")
+    (init . (lambda () (require 'jabber)))
+    (candidates . (lambda () (mapcar 'car (helm-jabber-online-contacts))))
+    (action . (lambda (x)
+                (jabber-chat-with
+                 (jabber-read-account)
+                 (symbol-name
+                  (cdr (assoc x (helm-jabber-online-contacts)))))))))
+
+;;; World time
+;;
+(defun helm-time-zone-transformer (candidates _source)
+  (cl-loop for i in candidates
+           for (z . p) in display-time-world-list
+           collect
+           (cons 
+            (cond ((string-match (format-time-string "%H:%M" (current-time)) i)
+                   (propertize i 'face 'helm-time-zone-current))
+                  ((string-match helm-time-zone-home-location i)
+                   (propertize i 'face 'helm-time-zone-home))
+                  (t i))
+            z)))
+
+(defvar helm-source-time-world
+  (helm-build-in-buffer-source "Time World List"
+    :data (lambda ()
+            (with-temp-buffer
+              (display-time-world-display display-time-world-list)
+              (buffer-string)))
+    :action 'helm-timezone-actions
+    :filtered-candidate-transformer 'helm-time-zone-transformer))
+
+;;; LaCarte
+;;
+;;
+(declare-function lacarte-get-overall-menu-item-alist "ext:lacarte.el" (&optional MAPS))
+
+(defun helm-lacarte-candidate-transformer (cands)
+  (mapcar (lambda (cand)
+            (let* ((item (car cand))
+                   (match (string-match "[^>] \\((.*)\\)$" item)))
+              (when match
+                (put-text-property (match-beginning 1) (match-end 1)
+                                   'face 'helm-M-x-key item))
+              cand))
+          cands))
+
+(defclass helm-lacarte (helm-source-sync helm-type-command)
+    ((init :initform (lambda () (require 'lacarte)))
+     (candidates :initform 'helm-lacarte-get-candidates)
+     (candidate-transformer :initform 'helm-lacarte-candidate-transformer)
+     (candidate-number-limit :initform 9999)))
+
+(defun helm-lacarte-get-candidates (&optional maps)
+  "Extract candidates for menubar using lacarte.el.
+See http://www.emacswiki.org/cgi-bin/wiki/download/lacarte.el.
+Optional argument MAPS is a list specifying which keymaps to use: it
+can contain the symbols `local', `global', and `minor', mean the
+current local map, current global map, and all current minor maps."
+  (with-helm-current-buffer
+    ;; FIXME: do we still need to remove possible '(nil) candidates.
+    (lacarte-get-overall-menu-item-alist maps)))
+
+;;;###autoload
+(defun helm-browse-menubar ()
+  "Preconfigured helm to the menubar using lacarte.el."
+  (interactive)
+  (require 'lacarte)
+  (helm :sources (mapcar 
+                  (lambda (spec) (helm-make-source (car spec) 'helm-lacarte
+                              :candidates (lambda () (helm-lacarte-get-candidates (cdr spec)))))
+                  '(("Major Mode"  . (local))
+                    ("Minor Modes" . (minor))
+                    ("Global Map"  . (global))))
+        :buffer "*helm lacarte*"))
+
+(defun helm-call-interactively (cmd-or-name)
+  "Execute CMD-OR-NAME as Emacs command.
+It is added to `extended-command-history'.
+`helm-current-prefix-arg' is used as the command's prefix argument."
+  (setq extended-command-history
+        (cons (helm-stringify cmd-or-name)
+              (delete (helm-stringify cmd-or-name) extended-command-history)))
+  (let ((current-prefix-arg helm-current-prefix-arg)
+        (cmd (helm-symbolify cmd-or-name)))
+    (if (stringp (symbol-function cmd))
+        (execute-kbd-macro (symbol-function cmd))
+      (setq this-command cmd)
+      (call-interactively cmd))))
+
+;;; Minibuffer History
+;;
+;;
+(defvar helm-source-minibuffer-history
+  (helm-build-sync-source "Minibuffer History"
+    :header-name (lambda (name)
+                   (format "%s (%s)" name minibuffer-history-variable))
+    :candidates
+     (lambda ()
+       (let ((history (cl-loop for i in
+                               (symbol-value minibuffer-history-variable)
+                               unless (string= "" i) collect i)))
+         (if (consp (car history))
+             (mapcar 'prin1-to-string history)
+             history)))
+    :migemo t
+    :multiline t
+    :action (lambda (candidate)
+              (delete-minibuffer-contents)
+              (insert candidate))))
+
+;;; Shell history
+;;
+;;
+(defun helm-comint-input-ring-action (candidate)
+  "Default action for comint history."
+  (with-helm-current-buffer
+    (delete-region (comint-line-beginning-position) (point-max))
+    (insert candidate)))
+
+(defvar helm-source-comint-input-ring
+  '((name . "Comint history")
+    (candidates . (lambda ()
+                    (with-helm-current-buffer
+                      (ring-elements comint-input-ring))))
+    (action . helm-comint-input-ring-action))
+  "Source that provide helm completion against `comint-input-ring'.")
+
+\f
+;;; Helm ratpoison UI
+;;
+;;
+(defvar helm-source-ratpoison-commands
+  '((name . "Ratpoison Commands")
+    (init . helm-ratpoison-commands-init)
+    (candidates-in-buffer)
+    (action ("Execute the command" . helm-ratpoison-commands-execute))
+    (display-to-real . helm-ratpoison-commands-display-to-real)
+    (candidate-number-limit)))
+
+(defun helm-ratpoison-commands-init ()
+  (unless (helm-candidate-buffer)
+    (with-current-buffer (helm-candidate-buffer 'global)
+      ;; with ratpoison prefix key
+      (save-excursion
+        (call-process "ratpoison" nil (current-buffer) nil "-c" "help"))
+      (while (re-search-forward "^\\([^ ]+\\) \\(.+\\)$" nil t)
+        (replace-match "<ratpoison> \\1: \\2"))
+      (goto-char (point-max))
+      ;; direct binding
+      (save-excursion
+        (call-process "ratpoison" nil (current-buffer) nil "-c" "help top"))
+      (while (re-search-forward "^\\([^ ]+\\) \\(.+\\)$" nil t)
+        (replace-match "\\1: \\2")))))
+
+(defun helm-ratpoison-commands-display-to-real (display)
+  (and (string-match ": " display)
+       (substring display (match-end 0))))
+
+(defun helm-ratpoison-commands-execute (candidate)
+  (call-process "ratpoison" nil nil nil "-ic" candidate))
+
+;;; Helm stumpwm UI
+;;
+;;
+(defvar helm-source-stumpwm-commands
+  '((name . "Stumpwm Commands")
+    (init . helm-stumpwm-commands-init)
+    (candidates-in-buffer)
+    (action ("Execute the command" . helm-stumpwm-commands-execute))
+    (candidate-number-limit)))
+
+(defun helm-stumpwm-commands-init ()
+  (with-current-buffer (helm-candidate-buffer 'global)
+    (save-excursion
+      (call-process "stumpish" nil (current-buffer) nil "commands"))
+    (while (re-search-forward "[ ]*\\([^ ]+\\)[ ]*\n?" nil t)
+      (replace-match "\n\\1\n"))
+    (delete-blank-lines)
+    (sort-lines nil (point-min) (point-max))
+    (goto-char (point-max))))
+
+(defun helm-stumpwm-commands-execute (candidate)
+  (call-process "stumpish" nil nil nil  candidate))
+
+;;;###autoload
+(defun helm-world-time ()
+  "Preconfigured `helm' to show world time.
+Default action change TZ environment variable locally to emacs."
+  (interactive)
+  (helm-other-buffer 'helm-source-time-world "*helm world time*"))
+
+;;;###autoload
+(defun helm-insert-latex-math ()
+  "Preconfigured helm for latex math symbols completion."
+  (interactive)
+  (helm-other-buffer 'helm-source-latex-math "*helm latex*"))
+
+;;;###autoload
+(defun helm-ratpoison-commands ()
+  "Preconfigured `helm' to execute ratpoison commands."
+  (interactive)
+  (helm-other-buffer 'helm-source-ratpoison-commands
+                     "*helm ratpoison commands*"))
+
+;;;###autoload
+(defun helm-stumpwm-commands()
+  "Preconfigured helm for stumpwm commands."
+  (interactive)
+  (helm-other-buffer 'helm-source-stumpwm-commands
+                     "*helm stumpwm commands*"))
+
+;;;###autoload
+(defun helm-minibuffer-history ()
+  "Preconfigured `helm' for `minibuffer-history'."
+  (interactive)
+  (let ((enable-recursive-minibuffers t))
+    (helm :sources 'helm-source-minibuffer-history
+          :buffer "*helm minibuffer-history*")))
+
+;;;###autoload
+(defun helm-comint-input-ring ()
+  "Preconfigured `helm' that provide completion of `comint' history."
+  (interactive)
+  (when (derived-mode-p 'comint-mode)
+    (helm :sources 'helm-source-comint-input-ring
+          :input (buffer-substring-no-properties (comint-line-beginning-position)
+                                                 (point-at-eol))
+          :buffer "*helm comint history*")))
+
+
+(provide 'helm-misc)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-misc.el ends here
diff --git a/elpa/helm-20160217.958/helm-mode.el b/elpa/helm-20160217.958/helm-mode.el
new file mode 100644 (file)
index 0000000..c68fa61
--- /dev/null
@@ -0,0 +1,1212 @@
+;;; helm-mode.el --- Enable helm completion everywhere. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-files)
+
+\f
+(defgroup helm-mode nil
+  "Enable helm completion."
+  :group 'helm)
+
+(defcustom helm-completing-read-handlers-alist
+  '((describe-function . helm-completing-read-symbols)
+    (describe-variable . helm-completing-read-symbols)
+    (describe-symbol . helm-completing-read-symbols)
+    (debug-on-entry . helm-completing-read-symbols)
+    (find-function . helm-completing-read-symbols)
+    (disassemble . helm-completing-read-symbols)
+    (trace-function . helm-completing-read-symbols)
+    (trace-function-foreground . helm-completing-read-symbols)
+    (trace-function-background . helm-completing-read-symbols)
+    (find-tag . helm-completing-read-with-cands-in-buffer)
+    (ffap-alternate-file . nil)
+    (tmm-menubar . nil)
+    (find-file . nil)
+    (execute-extended-command . nil))
+  "Alist of handlers to replace `completing-read', `read-file-name' in `helm-mode'.
+Each entry is a cons cell like \(emacs_command . completing-read_handler\)
+where key and value are symbols.
+
+Each key is an Emacs command that use originaly `completing-read'.
+
+Each value maybe an helm function that take same arguments as
+`completing-read' plus NAME and BUFFER, where NAME is the name of the new
+helm source and BUFFER the name of the buffer we will use.
+This function prefix name must start by \"helm\".
+
+See `helm-completing-read-symbols' for example.
+
+Note that this function will be reused for ALL the `completing-read'
+of this command, so it should handle all cases, e.g
+If first `completing-read' complete against symbols and
+second `completing-read' should handle only buffer,
+your specialized function should handle the both.
+
+If the value of an entry is nil completion will fall back to
+emacs vanilla behavior.
+e.g If you want to disable helm completion for `describe-function':
+\(describe-function . nil\).
+
+Ido is also supported, you can use `ido-completing-read' and
+`ido-read-file-name' as value of an entry or just 'ido.
+e.g ido completion for `find-file':
+\(find-file . ido\)
+same as
+\(find-file . ido-read-file-name\)
+Note that you don't need to enable `ido-mode' for this to work."
+  :group 'helm-mode
+  :type '(alist :key-type symbol :value-type symbol))
+
+(defcustom helm-comp-read-case-fold-search helm-case-fold-search
+  "Default Local setting of `helm-case-fold-search' for `helm-comp-read'.
+See `helm-case-fold-search' for more info."
+  :group 'helm-mode
+  :type 'symbol)
+
+(defcustom helm-mode-handle-completion-in-region t
+  "Whether to replace or not `completion-in-region-function'.
+This enable support for `completing-read-multiple' and `completion-at-point'
+when non--nil."
+  :group 'helm-mode
+  :type 'boolean)
+
+(defcustom helm-mode-reverse-history t
+  "Display history source after current source in `helm-mode' handled commands."
+  :group 'helm-mode
+  :type 'boolean)
+
+(defcustom helm-mode-no-completion-in-region-in-modes nil
+  "A list of modes that do not want helm for `completion-in-region'."
+  :group 'helm-mode
+  :type 'boolean)
+
+(defcustom helm-completion-in-region-fuzzy-match nil
+  "Whether `helm-completion-in-region' use fuzzy matching or not.
+Affect among others `completion-at-point', `completing-read-multiple'."
+  :group 'helm-mode
+  :type 'boolean)
+
+(defcustom helm-mode-fuzzy-match nil
+  "Enable fuzzy matching in `helm-mode' globally.
+Note that this will slow down completion and modify sorting
+which is unwanted in many places.
+This affect only the functions with completing-read helmized by helm-mode.
+To fuzzy match `completion-at-point' and friends see
+`helm-completion-in-region-fuzzy-match'."
+  :group 'helm-mode
+  :type 'boolean)
+
+(defcustom helm-mode-minibuffer-setup-hook-black-list '(minibuffer-completion-help)
+  "Incompatible `minibuffer-setup-hook' functions go here.
+A list of symbols.
+Helm-mode is rejecting all lambda's, byte-code fns
+and all functions belonging in this list from `minibuffer-setup-hook'."
+  :group 'helm-mode
+  :type '(repeat (choice symbol)))
+
+\f
+(defvar helm-comp-read-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "<C-return>") 'helm-cr-empty-string)
+    (define-key map (kbd "<M-RET>") 'helm-cr-empty-string)
+    map)
+  "Keymap for `helm-comp-read'.")
+
+(defvar helm-comp-read-must-match-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "RET")
+      'helm-confirm-and-exit-minibuffer)
+    map)
+  "Keymap use as must-match-map in `helm-comp-read' and `helm-read-file-name'.")
+
+\f
+;;; Internal
+;;
+;;
+;; Flag to know if `helm-pattern' have been added
+;; to candidate list in `helm-comp-read'.
+(defvar helm-cr-unknown-pattern-flag nil)
+
+\f
+;;; Helm `completing-read' replacement
+;;
+;;
+(defun helm-cr-empty-string ()
+  "Return empty string."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action
+     (lambda (_candidate)
+         (identity "")))))
+(put 'helm-cr-empty-string 'helm-only t)
+
+(defun helm-mode--keyboard-quit ()
+  ;; Use this instead of `keyboard-quit'
+  ;; to avoid deactivating mark in current-buffer.
+  (let ((debug-on-quit nil))
+    (signal 'quit nil)))
+
+(cl-defun helm-comp-read-get-candidates (collection &optional test sort-fn alistp (input ""))
+  "Convert COLLECTION to list removing elements that don't match TEST.
+See `helm-comp-read' about supported COLLECTION arguments.
+
+SORT-FN is a predicate to sort COLLECTION.
+
+ALISTP when non--nil will not use `all-completions' to collect
+candidates because it doesn't handle alists correctly for helm.
+i.e In `all-completions' the car of each pair is used as value.
+In helm we want to use the cdr instead like \(display . real\),
+so we return the alist as it is with no transformation by all-completions.
+
+e.g
+
+\(setq A '((a . 1) (b . 2) (c . 3)))
+==>((a . 1) (b . 2) (c . 3))
+\(helm-comp-read \"test: \" A :alistp nil
+                              :exec-when-only-one t
+                              :initial-input \"a\")
+==>\"a\" Which is not what we expect.
+
+\(helm-comp-read \"test: \" A :alistp t
+                              :exec-when-only-one t
+                              :initial-input \"1\")
+==>\"1\"
+
+See docstring of `all-completions' for more info.
+
+If COLLECTION is an `obarray', a TEST should be needed. See `obarray'."
+  ;; Ensure COLLECTION is computed from `helm-current-buffer'
+  ;; because some functions used as COLLECTION work
+  ;; only in the context of current-buffer (Issue #1030) .
+  (with-helm-current-buffer
+    (let ((cands
+           (cond ((vectorp collection)
+                  (all-completions input collection test))
+                 ((and (symbolp collection) (boundp collection)
+                       ;; Issue #324 history is let-bounded and given
+                       ;; quoted as hist argument of completing-read.
+                       ;; See example in `rcirc-browse-url'.
+                       (symbolp (symbol-value collection)))
+                  nil)
+                 ;; When collection is a symbol, most of the time
+                 ;; it should be a symbol used as a minibuffer-history.
+                 ;; The value of this symbol in this case return a list
+                 ;; of string which maybe are converted later as symbol
+                 ;; in special cases.
+                 ;; we treat here commandp as a special case as it return t
+                 ;; also with a string unless its last arg is provided.
+                 ;; Also, the history collections generally collect their
+                 ;; elements as string, so intern them to call predicate.
+                 ((and (symbolp collection) (boundp collection) test)
+                  (let ((predicate `(lambda (elm)
+                                      (condition-case err
+                                          (if (eq (quote ,test) 'commandp)
+                                              (funcall (quote ,test) (intern elm))
+                                              (funcall (quote ,test) elm))
+                                        (wrong-type-argument
+                                         (funcall (quote ,test) (intern elm)))))))
+                    (all-completions input (symbol-value collection) predicate)))
+                 ((and (symbolp collection) (boundp collection))
+                  (all-completions input (symbol-value collection)))
+                 ;; Normally file completion should not be handled here,
+                 ;; but special cases like `find-file-at-point' do it.
+                 ;; Handle here specially such cases.
+                 ((and (functionp collection) minibuffer-completing-file-name)
+                  (cl-loop for f in (funcall collection helm-pattern test t)
+                           unless (member f '("./" "../"))
+                           if (string-match ffap-url-regexp helm-pattern)
+                           collect f
+                           else
+                           collect (concat (file-name-as-directory
+                                            (helm-basedir helm-pattern)) f)))
+                 ((functionp collection)
+                  (funcall collection input test t))
+                 ((and alistp test)
+                  (cl-loop for i in collection when (funcall test i) collect i))
+                 (alistp collection)
+                 (t (all-completions input collection test)))))
+      (if sort-fn (sort cands sort-fn) cands))))
+
+(defun helm-cr-default-transformer (candidates _source)
+  "Default filter candidate function for `helm-comp-read'."
+  (cl-loop for c in candidates
+        for cand = (if (stringp c) (replace-regexp-in-string "\\s\\" "" c) c)
+        for pat = (replace-regexp-in-string "\\s\\" "" helm-pattern)
+        if (and (equal cand pat) helm-cr-unknown-pattern-flag)
+        collect
+        (cons (concat (propertize
+                       " " 'display
+                       (propertize "[?]" 'face 'helm-ff-prefix))
+                      c)
+              c)
+        into lst
+        else collect (if (and (stringp c)
+                              (string-match "\n" c))
+                         (cons (replace-regexp-in-string "\n" "->" c) c)
+                         c)
+        into lst
+        finally return (helm-fast-remove-dups lst :test 'equal)))
+
+(defun helm-comp-read--move-to-first-real-candidate ()
+  (helm-aif (helm-get-selection nil 'withprop)
+      (when (string= (get-text-property 0 'display it) "[?]")
+        (helm-next-line))))
+
+;;;###autoload
+(cl-defun helm-comp-read (prompt collection
+                          &key
+                            test
+                            initial-input
+                            default
+                            preselect
+                            (buffer "*Helm Completions*")
+                            must-match
+                            fuzzy
+                            reverse-history
+                            (requires-pattern 0)
+                            history
+                            input-history
+                            (case-fold helm-comp-read-case-fold-search)
+                            (del-input t)
+                            (persistent-action nil)
+                            (persistent-help "DoNothing")
+                            (mode-line helm-comp-read-mode-line)
+                            help-message
+                            (keymap helm-comp-read-map)
+                            (name "Helm Completions")
+                            candidates-in-buffer
+                            exec-when-only-one
+                            quit-when-no-cand
+                            volatile
+                            sort
+                            (fc-transformer 'helm-cr-default-transformer)
+                            hist-fc-transformer
+                            marked-candidates
+                            nomark
+                            (alistp t)
+                            (candidate-number-limit helm-candidate-number-limit))
+  "Read a string in the minibuffer, with helm completion.
+
+It is helm `completing-read' equivalent.
+
+- PROMPT is the prompt name to use.
+
+- COLLECTION can be a list, vector, obarray or hash-table.
+  It can be also a function that receives three arguments:
+  the values string, predicate and t. See `all-completions' for more details.
+
+Keys description:
+
+- TEST: A predicate called with one arg i.e candidate.
+
+- INITIAL-INPUT: Same as input arg in `helm'.
+
+- PRESELECT: See preselect arg of `helm'.
+
+- DEFAULT: This option is used only for compatibility with regular
+  Emacs `completing-read' (Same as DEFAULT arg of `completing-read').
+
+- BUFFER: Name of helm-buffer.
+
+- MUST-MATCH: Candidate selected must be one of COLLECTION.
+
+- FUZZY: Enable fuzzy matching.
+
+- REVERSE-HISTORY: When non--nil display history source after current
+  source completion.
+
+- REQUIRES-PATTERN: Same as helm attribute, default is 0.
+
+- HISTORY: A list containing specific history, default is nil.
+  When it is non--nil, all elements of HISTORY are displayed in
+  a special source before COLLECTION.
+
+- INPUT-HISTORY: A symbol. the minibuffer input history will be
+  stored there, if nil or not provided, `minibuffer-history'
+  will be used instead.
+
+- CASE-FOLD: Same as `helm-case-fold-search'.
+
+- DEL-INPUT: Boolean, when non--nil (default) remove the partial
+  minibuffer input from HISTORY is present.
+
+- PERSISTENT-ACTION: A function called with one arg i.e candidate.
+
+- PERSISTENT-HELP: A string to document PERSISTENT-ACTION.
+
+- MODE-LINE: A string or list to display in mode line.
+  Default is `helm-comp-read-mode-line'.
+
+- KEYMAP: A keymap to use in this `helm-comp-read'.
+  (the keymap will be shared with history source)
+
+- NAME: The name related to this local source.
+
+- EXEC-WHEN-ONLY-ONE: Bound `helm-execute-action-at-once-if-one'
+  to non--nil. (possibles values are t or nil).
+
+- VOLATILE: Use volatile attribute.
+
+- SORT: A predicate to give to `sort' e.g `string-lessp'
+  Use this only on small data as it is ineficient.
+  If you want to sort faster add a sort function to
+  FC-TRANSFORMER.
+  Note that FUZZY when enabled is already providing a sort function.
+
+- FC-TRANSFORMER: A `filtered-candidate-transformer' function
+  or a list of functions.
+
+- HIST-FC-TRANSFORMER: A `filtered-candidate-transformer'
+  function for the history source.
+
+- MARKED-CANDIDATES: If non--nil return candidate or marked candidates as a list.
+
+- NOMARK: When non--nil don't allow marking candidates.
+
+- ALISTP: \(default is non--nil\) See `helm-comp-read-get-candidates'.
+
+- CANDIDATES-IN-BUFFER: when non--nil use a source build with
+  `helm-source-in-buffer' which is much faster.
+  Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil.
+
+Any prefix args passed during `helm-comp-read' invocation will be recorded
+in `helm-current-prefix-arg', otherwise if prefix args were given before
+`helm-comp-read' invocation, the value of `current-prefix-arg' will be used.
+That's mean you can pass prefix args before or after calling a command
+that use `helm-comp-read' See `helm-M-x' for example."
+
+  (when (get-buffer helm-action-buffer)
+    (kill-buffer helm-action-buffer))
+  (let ((action-fn `(("Sole action (Identity)"
+                      . (lambda (candidate)
+                          (if ,marked-candidates
+                              (helm-marked-candidates)
+                            (identity candidate)))))))
+    ;; Assume completion have been already required,
+    ;; so always use 'confirm.
+    (when (eq must-match 'confirm-after-completion)
+      (setq must-match 'confirm))
+    (let* ((minibuffer-completion-confirm must-match)
+           (must-match-map (when must-match helm-comp-read-must-match-map))
+           (loc-map (if must-match-map
+                        (make-composed-keymap
+                         must-match-map (or keymap helm-map))
+                      (or keymap helm-map)))
+           (minibuffer-completion-predicate test)
+           (minibuffer-completion-table collection)
+           (helm-read-file-name-mode-line-string
+            (replace-regexp-in-string "helm-maybe-exit-minibuffer"
+                                      "helm-confirm-and-exit-minibuffer"
+                                      helm-read-file-name-mode-line-string))
+           (get-candidates (lambda ()
+                             (let ((cands (helm-comp-read-get-candidates
+                                           collection test sort alistp)))
+                               (setq helm-cr-unknown-pattern-flag nil)
+                               (unless (or (eq must-match t)
+                                           (string= helm-pattern "")
+                                           (assoc helm-pattern cands)
+                                           (assoc (intern helm-pattern) cands)
+                                           (member helm-pattern cands)
+                                           (member (downcase helm-pattern) cands)
+                                           (member (upcase helm-pattern) cands))
+                                 (setq cands (append (list
+                                                      ;; Unquote helm-pattern
+                                                      ;; when it is added
+                                                      ;; as candidate.
+                                                      (replace-regexp-in-string
+                                                       "\\s\\" "" helm-pattern))
+                                                     cands))
+                                 (setq helm-cr-unknown-pattern-flag t))
+                               ;; When DEFAULT is initially a list, candidates
+                               ;; come already computed with DEFAULT list appended,
+                               ;; and DEFAULT is set to the car of this list.
+                               (if (and default (not (string= default "")))
+                                   (delq nil (cons default (delete default cands)))
+                                 cands))))
+           (history-get-candidates (lambda ()
+                                     (let ((all (helm-comp-read-get-candidates
+                                                 history test nil alistp)))
+                                       (when all
+                                         (delete
+                                          ""
+                                          (helm-fast-remove-dups
+                                           (if (and default (not (string= default "")))
+                                               (delq nil (cons default
+                                                               (delete default all)))
+                                             all)
+                                           :test 'equal))))))
+           (src-hist (helm-build-sync-source (format "%s History" name)
+                         :candidates history-get-candidates
+                         :fuzzy-match fuzzy
+                         :filtered-candidate-transformer
+                         (append '((lambda (candidates sources)
+                                     (cl-loop for i in candidates
+                                              ;; Input is added to history in completing-read's
+                                              ;; and may be regexp-quoted, so unquote it.
+                                              for cand = (replace-regexp-in-string "\\s\\" "" i)
+                                              collect cand)))
+                                 (and hist-fc-transformer (helm-mklist hist-fc-transformer)))
+                         :persistent-action persistent-action
+                         :persistent-help persistent-help
+                         :mode-line mode-line
+                         :help-message help-message
+                         :action action-fn))
+           (src (helm-build-sync-source name
+                  :candidates get-candidates
+                  :filtered-candidate-transformer fc-transformer
+                  :requires-pattern requires-pattern
+                  :persistent-action persistent-action
+                  :persistent-help persistent-help
+                  :fuzzy-match fuzzy
+                  :mode-line mode-line
+                  :help-message help-message
+                  :action action-fn))
+           (src-1 (helm-build-in-buffer-source name
+                    :data get-candidates
+                    :filtered-candidate-transformer fc-transformer
+                    :requires-pattern requires-pattern
+                    :persistent-action persistent-action
+                    :fuzzy-match fuzzy
+                    :persistent-help persistent-help
+                    :mode-line mode-line
+                    :help-message help-message
+                    :action action-fn))
+           (src-list (list src-hist
+                           (if candidates-in-buffer
+                               src-1
+                             (if volatile
+                                 (append src '((volatile)))
+                               src))))
+           (helm-execute-action-at-once-if-one exec-when-only-one)
+           (helm-quit-if-no-candidate quit-when-no-cand)
+           result)
+      (when nomark
+        (setq src-list (cl-loop for src in src-list
+                             collect (cons '(nomark) src))))
+      (when reverse-history (setq src-list (nreverse src-list)))
+      (add-hook 'helm-after-update-hook 'helm-comp-read--move-to-first-real-candidate)
+      (unwind-protect
+           (setq result (helm
+                         :sources src-list
+                         :input initial-input
+                         :default default
+                         :preselect preselect
+                         :prompt prompt
+                         :resume 'noresume
+                         :candidate-number-limit candidate-number-limit
+                         :case-fold-search case-fold
+                         :keymap loc-map
+                         :history (and (symbolp input-history) input-history)
+                         :buffer buffer))
+        (remove-hook 'helm-after-update-hook 'helm-comp-read--move-to-first-real-candidate))
+      ;; Avoid adding an incomplete input to history.
+      (when (and result history del-input)
+        (cond ((and (symbolp history) ; History is a symbol.
+                    (not (symbolp (symbol-value history)))) ; Fix Issue #324.
+               ;; Be sure history is not a symbol with a nil value.
+               (helm-aif (symbol-value history) (setcar it result)))
+              ((consp history) ; A list with a non--nil value.
+               (setcar history result))
+              (t ; Possibly a symbol with a nil value.
+               (set history (list result)))))
+      (or
+       result
+       (when (and (eq helm-exit-status 0)
+                  (eq must-match 'confirm))
+         ;; Return empty string only if it is the DEFAULT
+         ;; value and helm-pattern is empty.
+         ;; otherwise return helm-pattern
+         (if (and (string= helm-pattern "") default)
+             default (identity helm-pattern)))
+       (unless (or (eq helm-exit-status 1)
+                   must-match)  ; FIXME this should not be needed now.
+         default)
+       (helm-mode--keyboard-quit)))))
+
+;; Generic completing-read
+;;
+;; Support also function as collection.
+;; e.g M-x man is supported.
+;; Support hash-table and vectors as collection.
+;; NOTE:
+;; Some crap emacs functions may not be supported
+;; like ffap-alternate-file (bad use of completing-read)
+;; and maybe others.
+;; Provide a mode `helm-mode' which turn on
+;; helm in all `completing-read' and `read-file-name' in Emacs.
+;;
+(defvar helm-completion-mode-string " Helm")
+
+(defvar helm-completion-mode-quit-message
+  "Helm completion disabled")
+
+(defvar helm-completion-mode-start-message
+  "Helm completion enabled")
+
+;;; Specialized handlers
+;;
+;;
+(defun helm-completing-read-symbols
+    (prompt _collection test _require-match init
+     hist default _inherit-input-method name buffer)
+  "Specialized function for fast symbols completion in `helm-mode'."
+  (require 'helm-elisp)
+  (or
+   (helm
+    :sources (helm-build-in-buffer-source name
+               :init (lambda ()
+                       (helm-apropos-init (lambda (x)
+                                            (and (funcall test x)
+                                                 (not (keywordp x))))
+                                          (or (car-safe default) default)))
+               :filtered-candidate-transformer 'helm-apropos-default-sort-fn
+               :fuzzy-match helm-mode-fuzzy-match
+               :persistent-action
+               (lambda (candidate)
+                 (helm-lisp-completion-persistent-action
+                  candidate name))
+               :persistent-help (helm-lisp-completion-persistent-help))
+    :prompt prompt
+    :buffer buffer
+    :input init
+    :history hist
+    :resume 'noresume
+    :default (or default ""))
+     (helm-mode--keyboard-quit)))
+
+
+;;; Generic completing read
+;;
+;;
+(defun helm-completing-read-default-1
+    (prompt collection test require-match
+     init hist default _inherit-input-method
+     name buffer &optional cands-in-buffer exec-when-only-one)
+  "Call `helm-comp-read' with same args as `completing-read'.
+Extra optional arg CANDS-IN-BUFFER mean use `candidates-in-buffer'
+method which is faster.
+It should be used when candidate list don't need to rebuild dynamically."
+  (let ((history (or (car-safe hist) hist))
+        (alistp cands-in-buffer)
+        (initial-input (helm-aif (pcase init
+                                   ((pred (stringp)) init)
+                                   ;; INIT is a cons cell.
+                                   (`(,l . ,_ll) l))
+                           (if minibuffer-completing-file-name it
+                               (regexp-quote it)))))
+    (when (and default (listp default))
+      ;; When DEFAULT is a list move the list on head of COLLECTION
+      ;; and set it to its car. #bugfix `grep-read-files'.
+      (setq collection
+            ;; COLLECTION is maybe a function or a table.
+            (append default
+                    (helm-comp-read-get-candidates
+                     collection test nil (listp collection))))
+      ;; Ensure `all-completions' will not be used
+      ;; a second time to recompute COLLECTION [1].
+      (setq alistp t)
+      (setq default (car default)))
+    (helm-comp-read
+     prompt collection
+     :test test
+     :history history
+     :reverse-history helm-mode-reverse-history
+     :input-history history
+     :must-match require-match
+     :alistp alistp ; Ensure `all-completions' is used when non-nil [1].
+     :name name
+     :requires-pattern (if (and (string= default "")
+                                (or (eq require-match 'confirm)
+                                    (eq require-match
+                                        'confirm-after-completion)))
+                           1 0)
+     :candidates-in-buffer cands-in-buffer
+     :exec-when-only-one exec-when-only-one
+     :fuzzy helm-mode-fuzzy-match
+     :buffer buffer
+     ;; If DEF is not provided, fallback to empty string
+     ;; to avoid `thing-at-point' to be appended on top of list
+     :default (or default "")
+     ;; Fail with special characters (e.g in gnus "nnimap+gmail:")
+     ;; if regexp-quote is not used.
+     ;; when init is added to history, it will be unquoted by
+     ;; helm-comp-read.
+     :initial-input initial-input)))
+
+(defun helm-completing-read-with-cands-in-buffer
+    (prompt collection test require-match
+     init hist default inherit-input-method
+     name buffer)
+  "Same as `helm-completing-read-default-1' but use candidates-in-buffer."
+  ;; Some commands like find-tag may use `read-file-name' from inside
+  ;; the calculation of collection. in this case it clash with
+  ;; candidates-in-buffer that reuse precedent data (files) which is wrong.
+  ;; So (re)calculate collection outside of main helm-session.
+  (let ((cands (all-completions (or init "") collection)))
+    (helm-completing-read-default-1 prompt cands test require-match
+                                    init hist default inherit-input-method
+                                    name buffer t)))
+
+(cl-defun helm--completing-read-default
+    (prompt collection &optional
+                         predicate require-match
+                         initial-input hist def
+                         inherit-input-method)
+  "An helm replacement of `completing-read'.
+This function should be used only as a `completing-read-function'.
+
+Don't use it directly, use instead `helm-comp-read' in your programs.
+
+See documentation of `completing-read' and `all-completions' for details."
+  (let* ((current-command (or (helm-this-command) this-command))
+         (str-command     (helm-symbol-name current-command))
+         (buf-name        (format "*helm-mode-%s*" str-command))
+         (entry           (assq current-command
+                                helm-completing-read-handlers-alist))
+         (def-com         (cdr-safe entry))
+         (str-defcom      (and def-com (helm-symbol-name def-com)))
+         (def-args        (list prompt collection predicate require-match
+                                initial-input hist def inherit-input-method))
+         ;; Append the two extra args needed to set the buffer and source name
+         ;; in helm specialized functions.
+         (any-args        (append def-args (list str-command buf-name)))
+         helm-completion-mode-start-message ; Be quiet
+         helm-completion-mode-quit-message
+         ;; Be sure this pesty *completion* buffer doesn't popup.
+         ;; Note: `minibuffer-with-setup-hook' may setup a lambda
+         ;; calling `minibuffer-completion-help' or other minibuffer
+         ;; functions we DONT WANT here, in these cases removing the hook
+         ;; (a symbol) have no effect. Issue #448.
+         ;; Because `minibuffer-completion-table' and
+         ;; `minibuffer-completion-predicate' are not bound
+         ;; anymore here, these functions should have no effect now,
+         ;; except in some rare cases like in `woman-file-name',
+         ;; so remove all incompatible functions
+         ;; from `minibuffer-setup-hook' (Issue #1205, #1240).
+         ;; otherwise helm have not the time to close its initial session.
+         (minibuffer-setup-hook
+          (cl-loop for h in minibuffer-setup-hook
+                   unless (or (consp h) ; a lambda.
+                              (byte-code-function-p h)
+                              (memq h helm-mode-minibuffer-setup-hook-black-list))
+                   collect h))
+         ;; Disable hack that could be used before `completing-read'.
+         ;; i.e (push ?\t unread-command-events).
+         unread-command-events)
+    (when (eq def-com 'ido) (setq def-com 'ido-completing-read))
+    (unless (or (not entry) def-com)
+      ;; An entry in *read-handlers-alist exists but have
+      ;; a nil value, so we exit from here, disable `helm-mode'
+      ;; and run the command again with it original behavior.
+      ;; `helm-mode' will be restored on exit.
+      (cl-return-from helm--completing-read-default
+        (unwind-protect
+             (progn
+               (helm-mode -1)
+               (apply completing-read-function def-args))
+          (helm-mode 1))))
+    ;; If we use now `completing-read' we MUST turn off `helm-mode'
+    ;; to avoid infinite recursion and CRASH. It will be reenabled on exit.
+    (when (or (eq def-com 'completing-read)
+              ;; All specialized functions are prefixed by "helm"
+              (and (stringp str-defcom)
+                   (not (string-match "^helm" str-defcom))))
+      (helm-mode -1))
+    (unwind-protect
+         (cond (;; An helm specialized function exists, run it.
+                (and def-com helm-mode)
+                (apply def-com any-args))
+               (;; Try to handle `ido-completing-read' everywhere.
+                (and def-com (eq def-com 'ido-completing-read))
+                (setcar (memq collection def-args)
+                        (all-completions "" collection predicate))
+                (apply def-com def-args))
+               (;; User set explicitely `completing-read' or something similar
+                ;; in *read-handlers-alist, use this with exactly the same
+                ;; args as in `completing-read'.
+                ;; If we are here `helm-mode' is now disabled.
+                def-com
+                (apply def-com def-args))
+               (t ; Fall back to classic `helm-comp-read'.
+                (helm-completing-read-default-1
+                 prompt collection predicate require-match
+                 initial-input hist def inherit-input-method
+                 str-command buf-name)))
+      (helm-mode 1)
+      ;; When exiting minibuffer, `this-command' is set to
+      ;; `helm-exit-minibuffer', which is unwanted when starting
+      ;; on another `completing-read', so restore `this-command' to
+      ;; initial value when exiting.
+      (setq this-command current-command))))
+\f
+;;; Generic read-file-name
+;;
+;;
+;;;###autoload
+(cl-defun helm-read-file-name
+    (prompt
+     &key
+       (name "Read File Name")
+       (initial-input default-directory)
+       (buffer "*Helm file completions*")
+       test
+       (case-fold helm-file-name-case-fold-search)
+       preselect
+       history
+       must-match
+       default
+       marked-candidates
+       (candidate-number-limit helm-ff-candidate-number-limit)
+       nomark
+       (alistp t)
+       (persistent-action 'helm-find-files-persistent-action)
+       (persistent-help "Hit1 Expand Candidate, Hit2 or (C-u) Find file")
+       (mode-line helm-read-file-name-mode-line-string))
+  "Read a file name with helm completion.
+It is helm `read-file-name' emulation.
+
+Argument PROMPT is the default prompt to use.
+
+Keys description:
+
+- NAME: Source name, default to \"Read File Name\".
+
+- INITIAL-INPUT: Where to start read file name, default to `default-directory'.
+
+- BUFFER: `helm-buffer' name default to \"*Helm Completions*\".
+
+- TEST: A predicate called with one arg 'candidate'.
+
+- CASE-FOLD: Same as `helm-case-fold-search'.
+
+- PRESELECT: helm preselection.
+
+- HISTORY: Display HISTORY in a special source.
+
+- MUST-MATCH: Can be 'confirm, nil, or t.
+
+- MARKED-CANDIDATES: When non--nil return a list of marked candidates.
+
+- NOMARK: When non--nil don't allow marking candidates.
+
+- ALISTP: Don't use `all-completions' in history (take effect only on history).
+
+- PERSISTENT-ACTION: a persistent action function.
+
+- PERSISTENT-HELP: persistent help message.
+
+- MODE-LINE: A mode line message, default is `helm-read-file-name-mode-line-string'."
+  
+  (when (get-buffer helm-action-buffer)
+    (kill-buffer helm-action-buffer))
+  ;; Assume completion have been already required,
+  ;; so always use 'confirm.
+  (when (eq must-match 'confirm-after-completion)
+    (setq must-match 'confirm))
+  (let* ((action-fn `(("Sole action (Identity)"
+                       . (lambda (candidate)
+                           (if ,marked-candidates
+                               (helm-marked-candidates :with-wildcard t)
+                             (identity candidate))))))
+         ;; Be sure we don't erase the underlying minibuffer if some.
+         (helm-ff-auto-update-initial-value
+          (and helm-ff-auto-update-initial-value
+               (not (minibuffer-window-active-p (minibuffer-window)))))
+         helm-full-frame
+         (hist (and history (helm-comp-read-get-candidates
+                             history nil nil alistp)))
+         (minibuffer-completion-confirm must-match)
+         (must-match-map (when must-match helm-comp-read-must-match-map))
+         (cmap (if must-match-map
+                   (make-composed-keymap
+                    must-match-map helm-read-file-map)
+                 helm-read-file-map))
+         (minibuffer-completion-predicate test)
+         (minibuffer-completing-file-name t)
+         (helm-read-file-name-mode-line-string
+          (replace-regexp-in-string "helm-maybe-exit-minibuffer"
+                                    "helm-confirm-and-exit-minibuffer"
+                                    helm-read-file-name-mode-line-string))
+         (src-list
+          (list
+           ;; History source.
+           (helm-build-sync-source (format "%s History" name)
+             :header-name (lambda (name)
+                            (concat name (substitute-command-keys
+                                          helm-find-files-doc-header)))
+             :mode-line mode-line
+             :candidates hist
+             :nohighlight t
+             :persistent-action persistent-action
+             :persistent-help persistent-help
+             :nomark nomark
+             :action action-fn)
+           ;; Other source.
+           (helm-build-sync-source name
+             :header-name (lambda (name)
+                            (concat name (substitute-command-keys
+                                          helm-find-files-doc-header)))
+             :init (lambda ()
+                     (setq helm-ff-auto-update-flag
+                           helm-ff-auto-update-initial-value)
+                     (setq helm-ff--auto-update-state
+                           helm-ff-auto-update-flag))
+             :mode-line mode-line
+             :help-message 'helm-read-file-name-help-message
+             :nohighlight t
+             :candidates
+             (lambda ()
+               (append (and (not (file-exists-p helm-pattern))
+                            (list helm-pattern))
+                       (if test
+                           (cl-loop with hn = (helm-ff-tramp-hostnames)
+                                    for i in (helm-find-files-get-candidates
+                                              must-match)
+                                    when (or (member i hn) ; A tramp host
+                                             (funcall test i)) ; Test ok
+                                    collect i)
+                           (helm-find-files-get-candidates must-match))))
+             :filtered-candidate-transformer 'helm-ff-sort-candidates
+             :filter-one-by-one 'helm-ff-filter-candidate-one-by-one
+             :persistent-action persistent-action
+             :persistent-help persistent-help
+             :volatile t
+             :nomark nomark
+             :action action-fn)))
+         ;; Helm result.
+         (result (helm
+                  :sources src-list
+                  :input (expand-file-name initial-input)
+                  :prompt prompt
+                  :keymap cmap
+                  :candidate-number-limit candidate-number-limit
+                  :resume 'noresume
+                  :case-fold-search case-fold
+                  :default default
+                  :buffer buffer
+                  :preselect preselect)))
+    (or
+     (cond ((and result (stringp result)
+                 (string= result "") ""))
+           ((and result
+                 (stringp result)
+                 (file-equal-p result initial-input)
+                 default)
+            (if (listp default) (car default) default))
+           ((and result (stringp result))
+            (expand-file-name result))
+           ((and result (listp result))
+            (mapcar #'expand-file-name result))
+           (t result))
+     (when (and (not (string= helm-pattern ""))
+                (eq helm-exit-status 0)
+                (eq must-match 'confirm))
+       (identity helm-pattern))
+     (helm-mode--keyboard-quit))))
+
+(defun helm-mode--default-filename (fname dir initial)
+  (unless dir (setq dir default-directory))
+  (unless (file-name-absolute-p dir)
+    (setq dir (expand-file-name dir)))
+  (unless (or fname (consp fname))
+    (setq fname (expand-file-name
+                 (or initial buffer-file-name dir)
+                 dir)))
+  (if (and fname (consp fname))
+      (setq fname (cl-loop for f in fname
+                           collect (expand-file-name f dir)))
+      (if (file-name-absolute-p fname)
+          fname (expand-file-name fname dir))))
+
+(cl-defun helm--generic-read-file-name
+    (prompt &optional dir default-filename mustmatch initial predicate)
+  "Generic helm replacement of `read-file-name'.
+Don't use it directly, use instead `helm-read-file-name' in your programs."
+  (let* ((init (or initial dir default-directory))
+         (current-command (or (helm-this-command) this-command))
+         (str-command (helm-symbol-name current-command))
+         (helm--file-completion-sources
+          (cons str-command
+                (remove str-command helm--file-completion-sources)))
+         (buf-name (format "*helm-mode-%s*" str-command))
+         (entry (assq current-command
+                      helm-completing-read-handlers-alist))
+         (def-com  (cdr-safe entry))
+         (str-defcom (and def-com (helm-symbol-name def-com)))
+         (def-args (list prompt dir default-filename mustmatch initial predicate))
+         ;; Append the two extra args needed to set the buffer and source name
+         ;; in helm specialized functions.
+         (any-args (append def-args (list str-command buf-name)))
+         (ido-state ido-mode)
+         helm-completion-mode-start-message ; Be quiet
+         helm-completion-mode-quit-message  ; Same here
+         fname)
+    (setq default-filename (helm-mode--default-filename
+                            default-filename dir initial))
+    ;; Some functions that normally call `completing-read' can switch
+    ;; brutally to `read-file-name' (e.g find-tag), in this case
+    ;; the helm specialized function will fail because it is build
+    ;; for `completing-read', so set it to 'incompatible to be sure
+    ;; we switch to `helm-read-file-name' and don't try to call it
+    ;; with wrong number of args.
+    (when (eq def-com 'ido)
+      (setq def-com 'ido-read-file-name) (ido-mode 1))
+    (when (and def-com (> (length (help-function-arglist def-com)) 8))
+      (setq def-com 'incompatible))
+    (unless (or (not entry) def-com)
+      (cl-return-from helm--generic-read-file-name
+        (unwind-protect
+             (progn
+               (helm-mode -1)
+               (apply read-file-name-function def-args))
+          (helm-mode 1))))
+    ;; If we use now `read-file-name' we MUST turn off `helm-mode'
+    ;; to avoid infinite recursion and CRASH. It will be reenabled on exit.
+    (when (or (eq def-com 'read-file-name)
+              (eq def-com 'ido-read-file-name)
+              (and (stringp str-defcom)
+                   (not (string-match "^helm" str-defcom))))
+      (helm-mode -1))
+    (unwind-protect
+         (setq fname
+               (cond (;; A specialized function exists, run it
+                      ;; with the two extra args specific to helm..
+                      (and def-com helm-mode
+                           (not (eq def-com 'ido-read-file-name))
+                           (not (eq def-com 'incompatible)))
+                      (apply def-com any-args))
+                     (;; Def-com value is `ido-read-file-name'
+                      ;; run it with default args.
+                      (and def-com (eq def-com 'ido-read-file-name))
+                      (ido-mode 1)
+                      (apply def-com def-args))
+                     (;; Def-com value is `read-file-name'
+                      ;; run it with default args.
+                      (eq def-com 'read-file-name)
+                      (apply def-com def-args))
+                     (t ; Fall back to classic `helm-read-file-name'.
+                      (helm-read-file-name
+                       prompt
+                       :name str-command
+                       :buffer buf-name
+                       :default default-filename
+                       :initial-input (expand-file-name init dir)
+                       :alistp nil
+                       :must-match mustmatch
+                       :test predicate))))
+      (helm-mode 1)
+      (ido-mode (if ido-state 1 -1))
+      ;; Same comment as in `helm--completing-read-default'.
+      (setq this-command current-command))
+    (if (eq predicate 'file-directory-p) ; Using `read-directory-name'.
+        (file-name-as-directory fname) fname)))
+
+(defun helm-mode--advice-lisp--local-variables (old--fn &rest args)
+  (ignore-errors
+    (apply old--fn args)))
+
+(defun helm--completion-in-region (start end collection &optional predicate)
+  "Helm replacement of `completion--in-region'.
+Can be used as value for `completion-in-region-function'."
+  (cl-declare (special require-match prompt))
+  (if (memq major-mode helm-mode-no-completion-in-region-in-modes)
+      (funcall helm--old-completion-in-region-function
+               start end collection predicate)
+    (advice-add
+     'lisp--local-variables
+     :around #'helm-mode--advice-lisp--local-variables)
+    (unwind-protect
+        (let* ((enable-recursive-minibuffers t)
+               (input (buffer-substring-no-properties start end))
+               (current-command (or (helm-this-command) this-command))
+               (str-command (helm-symbol-name current-command))
+               (buf-name (format "*helm-mode-%s*" str-command))
+               (require-match (or (and (boundp 'require-match) require-match)
+                                  minibuffer-completion-confirm
+                                  ;; If prompt have not been propagated here, that's
+                                  ;; probably mean we have no prompt and we are in
+                                  ;; completion-at-point or friend, so use a non--nil
+                                  ;; value for require-match.
+                                  (not (boundp 'prompt))))
+               ;; `completion-extra-properties' is let-bounded in `completion-at-point'.
+               ;; `afun' is a closure to call against each string in `data'.
+               ;; it provide the annotation info for each string.
+               ;; e.g "foo" => "foo <f>" where foo is a function.
+               ;; See Issue #407.
+               (afun (plist-get completion-extra-properties :annotation-function))
+               (metadata (completion-metadata
+                          (buffer-substring-no-properties start (point))
+                          collection predicate))
+               (data (completion-all-completions
+                      (buffer-substring start end)
+                      collection
+                      predicate
+                      (- (point) start)
+                      metadata))
+               ;; `completion-all-completions' store the base-size in the last `cdr',
+               ;; so data looks like this: '(a b c d . 0) and (last data) == (d . 0).
+               (last-data (last data))
+               (base-size (helm-aif (cdr (last data))
+                              (prog1 it
+                                (setcdr last-data nil))
+                            0))
+               (init-space-suffix (unless (or helm-completion-in-region-fuzzy-match
+                                              (string-suffix-p " " input))
+                                    " "))
+               (file-comp-p (or (eq (completion-metadata-get metadata 'category) 'file)
+                                (helm-mode--in-file-completion-p)
+                                ;; Assume that when `afun' and `predicate' are null
+                                ;; we are in filename completion.
+                                (and (null afun) (null predicate))))
+               ;; Completion-at-point and friends have no prompt.
+               (result (if (stringp data)
+                           data
+                         (helm-comp-read
+                          (or (and (boundp 'prompt) prompt) "Pattern: ")
+                          (if file-comp-p
+                              (cl-loop for f in data unless
+                                       (string-match "\\`\\.\\{1,2\\}/\\'" f)
+                                       collect f)
+                            (if afun
+                                (mapcar (lambda (s)
+                                          (let ((ann (funcall afun s)))
+                                            (if ann
+                                                (cons
+                                                 (concat
+                                                  s
+                                                  (propertize
+                                                   " " 'display
+                                                   (propertize
+                                                    ann
+                                                    'face 'completions-annotations)))
+                                                 s)
+                                              s)))
+                                        data)
+                              data))
+                          :name str-command
+                          :fuzzy helm-completion-in-region-fuzzy-match
+                          :nomark t
+                          :initial-input
+                          (cond ((and file-comp-p
+                                      (not (string-match "/\\'" input)))
+                                 (concat (helm-basename input)
+                                         (unless (string= input "")
+                                           init-space-suffix)))
+                                ((string-match "/\\'" input) nil)
+                                ((or (null require-match)
+                                     (stringp require-match))
+                                 input)
+                                (t (concat input init-space-suffix)))
+                          :buffer buf-name
+                          :fc-transformer (append (list 'helm-cr-default-transformer)
+                                                  (unless helm-completion-in-region-fuzzy-match
+                                                    (list (lambda (candidates _source)
+                                                            (sort candidates 'helm-generic-sort-fn)))))
+                          :exec-when-only-one t
+                          :quit-when-no-cand
+                          (lambda ()
+                            ;; Delay message to overwrite "Quit".
+                            (run-with-timer
+                             0.01 nil
+                             (lambda ()
+                               (message "[No matches]")))
+                            t) ; exit minibuffer immediately.
+                          :must-match require-match))))
+          (when result
+            (choose-completion-string
+             result (current-buffer)
+             (list (+ start base-size) end)
+             completion-list-insert-choice-function)))
+      (advice-remove 'lisp--local-variables
+                     #'helm-mode--advice-lisp--local-variables))))
+
+(defun helm-mode--in-file-completion-p ()
+  (with-helm-current-buffer
+    (run-hook-with-args-until-success 'file-name-at-point-functions)))
+
+(when (boundp 'completion-in-region-function)
+  (defconst helm--old-completion-in-region-function completion-in-region-function))
+
+;;;###autoload
+(define-minor-mode helm-mode
+    "Toggle generic helm completion.
+
+All functions in Emacs that use `completing-read'
+or `read-file-name' and friends will use helm interface
+when this mode is turned on.
+However you can modify this behavior for functions of your choice
+with `helm-completing-read-handlers-alist'.
+
+Called with a positive arg, turn on unconditionally, with a
+negative arg turn off.
+You can turn it on with `helm-mode'.
+
+Some crap emacs functions may not be supported,
+e.g `ffap-alternate-file' and maybe others
+You can add such functions to `helm-completing-read-handlers-alist'
+with a nil value.
+
+Note: This mode is incompatible with Emacs23."
+  :group 'helm-mode
+  :global t
+  :lighter helm-completion-mode-string
+  (cl-assert (boundp 'completing-read-function) nil
+             "`helm-mode' not available, upgrade to Emacs-24")
+  (if helm-mode
+      (if (fboundp 'add-function)
+          (progn
+            (add-function :override completing-read-function
+                          #'helm--completing-read-default)
+            (add-function :override read-file-name-function
+                          #'helm--generic-read-file-name)
+            (when helm-mode-handle-completion-in-region
+              (add-function :override completion-in-region-function
+                            #'helm--completion-in-region)))
+          (setq completing-read-function 'helm--completing-read-default
+                read-file-name-function  'helm--generic-read-file-name)
+          (when (and (boundp 'completion-in-region-function)
+                     helm-mode-handle-completion-in-region)
+            (setq completion-in-region-function #'helm--completion-in-region))
+          (message helm-completion-mode-start-message))
+      (if (fboundp 'remove-function)
+          (progn
+            (remove-function completing-read-function #'helm--completing-read-default)
+            (remove-function read-file-name-function #'helm--generic-read-file-name)
+            (remove-function completion-in-region-function #'helm--completion-in-region))
+          (setq completing-read-function (and (fboundp 'completing-read-default)
+                                        'completing-read-default)
+                read-file-name-function  (and (fboundp 'read-file-name-default)
+                                              'read-file-name-default))
+          (when (and (boundp 'completion-in-region-function)
+                     (boundp 'helm--old-completion-in-region-function))
+            (setq completion-in-region-function helm--old-completion-in-region-function))
+          (message helm-completion-mode-quit-message))))
+
+(provide 'helm-mode)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-mode.el ends here
diff --git a/elpa/helm-20160217.958/helm-multi-match.el b/elpa/helm-20160217.958/helm-multi-match.el
new file mode 100644 (file)
index 0000000..3e740da
--- /dev/null
@@ -0,0 +1,373 @@
+;;; helm-multi-match.el --- Multiple regexp matching methods for helm -*- lexical-binding: t -*-
+
+;; Original Author: rubikitch
+
+;; Copyright (C) 2008 ~ 2011 rubikitch
+;; Copyright (C) 2011 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; Author: Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+;; URL: http://github.com/emacs-helm/helm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm-lib)
+
+\f
+(defgroup helm-multi-match nil
+  "Helm multi match."
+  :group 'helm)
+
+(defcustom helm-mm-matching-method 'multi3
+  "Matching method for helm match plugin.
+You can set here different methods to match candidates in helm.
+Here are the possible value of this symbol and their meaning:
+- multi1: Respect order, prefix of pattern must match.
+- multi2: Same but with partial match.
+- multi3: The best, multiple regexp match, allow negation.
+- multi3p: Same but prefix must match.
+
+Default is multi3, you should keep this for a better experience.
+
+Note that multi1 and multi3p are incompatible with fuzzy matching
+in file completion and by the way fuzzy matching will be disabled there
+when these options are used."
+  :type  '(radio :tag "Matching methods for helm"
+           (const :tag "Multiple regexp 1 ordered with prefix match"         multi1)
+           (const :tag "Multiple regexp 2 ordered with partial match"        multi2)
+           (const :tag "Multiple regexp 3 matching no order, partial, best." multi3)
+           (const :tag "Multiple regexp 3p matching with prefix match"       multi3p))
+  :group 'helm-multi-match)
+
+\f
+;; Internal
+(defconst helm-mm-default-match-functions
+  '(helm-mm-exact-match helm-mm-match))
+(defconst helm-mm-default-search-functions
+  '(helm-mm-exact-search helm-mm-search))
+
+\f
+;;; Build regexps
+;;
+;;
+(defvar helm-mm-space-regexp "[\\ ] "
+  "Regexp to represent space itself in multiple regexp match.")
+
+(defun helm-mm-split-pattern (pattern)
+  "Split PATTERN if it contain spaces and return resulting list.
+If spaces in PATTERN are escaped, don't split at this place.
+i.e \"foo bar\"=> (\"foo\" \"bar\")
+but \"foo\ bar\"=> (\"foobar\")."
+  (if (string= pattern "")
+      '("")
+    (cl-loop for s in (split-string
+                       (replace-regexp-in-string helm-mm-space-regexp
+                                                 "\000\000" pattern)
+                       " " t)
+          collect (replace-regexp-in-string "\000\000" " " s))))
+
+(defun helm-mm-1-make-regexp (pattern)
+  "Replace spaces in PATTERN with \"\.*\"."
+  (mapconcat 'identity (helm-mm-split-pattern pattern) ".*"))
+
+\f
+;;; Exact match.
+;;
+;;
+;; Internal.
+(defvar helm-mm-exact-pattern-str nil)
+(defvar helm-mm-exact-pattern-real nil)
+
+(defun helm-mm-exact-get-pattern (pattern)
+  (unless (equal pattern helm-mm-exact-pattern-str)
+    (setq helm-mm-exact-pattern-str pattern
+          helm-mm-exact-pattern-real (concat "\n" pattern "\n")))
+  helm-mm-exact-pattern-real)
+
+
+(cl-defun helm-mm-exact-match (str &optional (pattern helm-pattern))
+  (if case-fold-search
+      (progn
+        (setq str (downcase str)
+              pattern (downcase pattern))
+        (string= str pattern))
+      (string= str pattern)))
+
+(defun helm-mm-exact-search (pattern &rest _ignore)
+  (and (search-forward (helm-mm-exact-get-pattern pattern) nil t)
+       (forward-line -1)))
+
+\f
+;;; Prefix match
+;;
+;;
+;; Internal
+(defvar helm-mm-prefix-pattern-str nil)
+(defvar helm-mm-prefix-pattern-real nil)
+
+(defun helm-mm-prefix-get-pattern (pattern)
+  (unless (equal pattern helm-mm-prefix-pattern-str)
+    (setq helm-mm-prefix-pattern-str pattern
+          helm-mm-prefix-pattern-real (concat "\n" pattern)))
+  helm-mm-prefix-pattern-real)
+
+(defun helm-mm-prefix-match (str &optional pattern)
+  ;; In filename completion basename and basedir may be
+  ;; quoted, unquote them for string comparison (Issue #1283).
+  (setq pattern (replace-regexp-in-string
+                 "\\\\" "" (or pattern helm-pattern)))
+  (let ((len (length pattern)))
+    (and (<= len (length str))
+         (string= (substring str 0 len) pattern ))))
+
+(defun helm-mm-prefix-search (pattern &rest _ignore)
+  (search-forward (helm-mm-prefix-get-pattern pattern) nil t))
+
+\f
+;;; Multiple regexp patterns 1 (order is preserved / prefix).
+;;
+;;
+;; Internal
+(defvar helm-mm-1-pattern-str nil)
+(defvar helm-mm-1-pattern-real nil)
+
+(defun helm-mm-1-get-pattern (pattern)
+  (unless (equal pattern helm-mm-1-pattern-str)
+    (setq helm-mm-1-pattern-str pattern
+          helm-mm-1-pattern-real
+          (concat "^" (helm-mm-1-make-regexp pattern))))
+  helm-mm-1-pattern-real)
+
+(cl-defun helm-mm-1-match (str &optional (pattern helm-pattern))
+  (string-match (helm-mm-1-get-pattern pattern) str))
+
+(defun helm-mm-1-search (pattern &rest _ignore)
+  (re-search-forward (helm-mm-1-get-pattern pattern) nil t))
+
+\f
+;;; Multiple regexp patterns 2 (order is preserved / partial).
+;;
+;;
+;; Internal
+(defvar helm-mm-2-pattern-str nil)
+(defvar helm-mm-2-pattern-real nil)
+
+(defun helm-mm-2-get-pattern (pattern)
+  (unless (equal pattern helm-mm-2-pattern-str)
+    (setq helm-mm-2-pattern-str pattern
+          helm-mm-2-pattern-real
+          (concat "^.*" (helm-mm-1-make-regexp pattern))))
+  helm-mm-2-pattern-real)
+
+(cl-defun helm-mm-2-match (str &optional (pattern helm-pattern))
+  (string-match (helm-mm-2-get-pattern pattern) str))
+
+(defun helm-mm-2-search (pattern &rest _ignore)
+  (re-search-forward (helm-mm-2-get-pattern pattern) nil t))
+
+\f
+;;; Multiple regexp patterns 3 (permutation).
+;;
+;;
+;; Internal
+(defvar helm-mm-3-pattern-str nil)
+(defvar helm-mm-3-pattern-list nil)
+
+(defun helm-mm-3-get-patterns (pattern)
+  "Return `helm-mm-3-pattern-list', a list of predicate/regexp cons cells.
+e.g ((identity . \"foo\") (identity . \"bar\")).
+This is done only if `helm-mm-3-pattern-str' is same as PATTERN."
+  (unless (equal pattern helm-mm-3-pattern-str)
+    (setq helm-mm-3-pattern-str pattern
+          helm-mm-3-pattern-list
+          (helm-mm-3-get-patterns-internal pattern)))
+  helm-mm-3-pattern-list)
+
+(defun helm-mm-3-get-patterns-internal (pattern)
+  "Return a list of predicate/regexp cons cells.
+e.g ((identity . \"foo\") (identity . \"bar\"))."
+  (unless (string= pattern "")
+    (cl-loop for pat in (helm-mm-split-pattern pattern)
+          collect (if (string= "!" (substring pat 0 1))
+                      (cons 'not (substring pat 1))
+                    (cons 'identity pat)))))
+
+(cl-defun helm-mm-3-match (str &optional (pattern helm-pattern))
+  "Check if PATTERN match STR.
+When PATTERN contain a space, it is splitted and matching is done
+with the several resulting regexps against STR.
+e.g \"bar foo\" will match \"foobar\" and \"barfoo\".
+Argument PATTERN, a string, is transformed in a list of
+cons cell with `helm-mm-3-get-patterns' if it contain a space.
+e.g \"foo bar\"=>((identity . \"foo\") (identity . \"bar\")).
+Then each predicate of cons cell(s) is called with regexp of same
+cons cell against STR (a candidate).
+i.e (identity (string-match \"foo\" \"foo bar\")) => t."
+  (let ((pat (helm-mm-3-get-patterns pattern)))
+    (cl-loop for (predicate . regexp) in pat
+             always (funcall predicate
+                             (condition-case _err
+                                 ;; FIXME: Probably do nothing when
+                                 ;; using fuzzy leaving the job
+                                 ;; to the fuzzy fn.
+                                 (string-match regexp str)
+                               (invalid-regexp nil))))))
+
+(defun helm-mm-3-search-base (pattern searchfn1 searchfn2)
+  "Try to find PATTERN in `helm-buffer' with SEARCHFN1 and SEARCHFN2.
+This is the search function for `candidates-in-buffer' enabled sources.
+Use the same method as `helm-mm-3-match' except it search in buffer
+instead of matching on a string.
+i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t."
+  (cl-loop with pat = (if (stringp pattern)
+                          (helm-mm-3-get-patterns pattern)
+                          pattern)
+           when (eq (caar pat) 'not) return
+           ;; Pass the job to `helm-search-match-part'.
+           (prog1 (list (point-at-bol) (point-at-eol))
+             (forward-line 1))
+           while (condition-case _err
+                     (funcall searchfn1 (or (cdar pat) "") nil t)
+                   (invalid-regexp nil))
+           for bol = (point-at-bol)
+           for eol = (point-at-eol)
+           if (cl-loop for (pred . str) in (cdr pat) always
+                       (progn (goto-char bol)
+                              (funcall pred (condition-case _err
+                                                (funcall searchfn2 str eol t)
+                                              (invalid-regexp nil)))))
+           do (goto-char eol) and return t
+           else do (goto-char eol)
+           finally return nil))
+
+(defun helm-mm-3-search (pattern &rest _ignore)
+  (when (stringp pattern)
+    (setq pattern (helm-mm-3-get-patterns pattern)))
+  (helm-mm-3-search-base
+   pattern 're-search-forward 're-search-forward))
+\f
+;;; mp-3 with migemo
+;;
+;;
+(defvar helm-mm--previous-migemo-info nil
+  "[Internal] Cache previous migemo query.")
+(make-local-variable 'helm-mm--previous-migemo-info)
+
+(declare-function migemo-get-pattern "ext:migemo.el")
+(declare-function migemo-search-pattern-get "ext:migemo.el")
+
+(define-minor-mode helm-migemo-mode
+    "Enable migemo in helm.
+It will be available in the sources handling it,
+i.e the sources which have the slot :migemo with non--nil value."
+  :lighter " Hmio"
+  :group 'helm
+  :global t
+  (cl-assert (featurep 'migemo)
+             nil "No feature called migemo found, install migemo.el."))
+
+(defun helm-mm-migemo-get-pattern (pattern)
+  (let ((regex (migemo-get-pattern pattern)))
+    (if (ignore-errors (string-match regex "") t)
+        (concat regex "\\|" pattern) pattern)))
+
+(defun helm-mm-migemo-search-pattern-get (pattern)
+  (let ((regex (migemo-search-pattern-get pattern)))
+    (if (ignore-errors (string-match regex "") t)
+        (concat regex "\\|" pattern) pattern)))
+
+(defun helm-mm-migemo-string-match (pattern str)
+  "Migemo version of `string-match'."
+  (unless (assoc pattern helm-mm--previous-migemo-info)
+    (with-helm-buffer
+      (setq helm-mm--previous-migemo-info
+            (push (cons pattern (helm-mm-migemo-get-pattern pattern))
+                  helm-mm--previous-migemo-info))))
+  (string-match (assoc-default pattern helm-mm--previous-migemo-info) str))
+
+(cl-defun helm-mm-3-migemo-match (str &optional (pattern helm-pattern))
+  (and helm-migemo-mode
+       (cl-loop for (pred . re) in (helm-mm-3-get-patterns pattern)
+                always (funcall pred (helm-mm-migemo-string-match re str)))))
+
+(defun helm-mm-migemo-forward (word &optional bound noerror count)
+  (with-helm-buffer
+    (unless (assoc word helm-mm--previous-migemo-info)
+      (setq helm-mm--previous-migemo-info
+            (push (cons word (if (delq 'ascii (find-charset-string word))
+                                 word
+                               (helm-mm-migemo-search-pattern-get word)))
+                  helm-mm--previous-migemo-info))))
+  (re-search-forward
+   (assoc-default word helm-mm--previous-migemo-info) bound noerror count))
+
+(defun helm-mm-3-migemo-search (pattern &rest _ignore)
+  (and helm-migemo-mode
+       (helm-mm-3-search-base
+        pattern 'helm-mm-migemo-forward 'helm-mm-migemo-forward)))
+
+\f
+;;; mp-3p- (multiple regexp pattern 3 with prefix search)
+;;
+;;
+(defun helm-mm-3p-match (str &optional pattern)
+  "Check if PATTERN match STR.
+Same as `helm-mm-3-match' but more strict, matching against prefix also.
+e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to
+`helm-mm-3-match'."
+  (let* ((pat (helm-mm-3-get-patterns (or pattern helm-pattern)))
+         (first (car pat)))
+    (and (funcall (car first) (helm-mm-prefix-match str (cdr first)))
+         (cl-loop for (predicate . regexp) in (cdr pat)
+               always (funcall predicate (string-match regexp str))))))
+
+(defun helm-mm-3p-search (pattern &rest _ignore)
+  (when (stringp pattern)
+    (setq pattern (helm-mm-3-get-patterns pattern)))
+  (helm-mm-3-search-base
+   pattern 'helm-mm-prefix-search 're-search-forward))
+
+\f
+;;; Generic multi-match/search functions
+;;
+;;
+(cl-defun helm-mm-match (str &optional (pattern helm-pattern))
+  (let ((fun (cl-ecase helm-mm-matching-method
+               (multi1 #'helm-mm-1-match)
+               (multi2 #'helm-mm-2-match)
+               (multi3 #'helm-mm-3-match)
+               (multi3p #'helm-mm-3p-match))))
+    (funcall fun str pattern)))
+
+(defun helm-mm-search (pattern &rest _ignore)
+  (let ((fun (cl-ecase helm-mm-matching-method
+               (multi1 #'helm-mm-1-search)
+               (multi2 #'helm-mm-2-search)
+               (multi3 #'helm-mm-3-search)
+               (multi3p #'helm-mm-3p-search))))
+    (funcall fun pattern)))
+
+
+(provide 'helm-multi-match)
+
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-multi-match.el ends here
diff --git a/elpa/helm-20160217.958/helm-net.el b/elpa/helm-20160217.958/helm-net.el
new file mode 100644 (file)
index 0000000..cdcc53e
--- /dev/null
@@ -0,0 +1,526 @@
+;;; helm-net.el --- helm browse url and search web. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'url)
+(require 'xml)
+(require 'browse-url)
+
+\f
+(defgroup helm-net nil
+  "Net related applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-google-suggest-default-browser-function nil
+  "The browse url function you prefer to use with google suggest.
+When nil, use the first browser function available
+See `helm-browse-url-default-browser-alist'."
+  :group 'helm-net
+  :type 'symbol)
+
+(defcustom helm-home-url "http://www.google.fr"
+  "Default url to use as home url."
+  :group 'helm-net
+  :type 'string)
+
+(defcustom helm-surfraw-default-browser-function nil
+  "The browse url function you prefer to use with surfraw.
+When nil, fallback to `browse-url-browser-function'."
+  :group 'helm-net
+  :type 'symbol)
+
+(defcustom helm-google-suggest-url
+  "http://google.com/complete/search?output=toolbar&q="
+  "URL used for looking up Google suggestions."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-google-suggest-search-url
+  "http://www.google.com/search?ie=utf-8&oe=utf-8&q=%s"
+  "URL used for Google searching."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-net-prefer-curl nil
+  "When non--nil use CURL external program to fetch data.
+Otherwise `url-retrieve-synchronously' is used."
+  :type 'boolean
+  :group 'helm-net)
+
+(defvaralias 'helm-google-suggest-use-curl-p 'helm-net-prefer-curl)
+(make-obsolete-variable 'helm-google-suggest-use-curl-p 'helm-net-prefer-curl "1.7.7")
+
+(defcustom helm-surfraw-duckduckgo-url
+  "https://duckduckgo.com/lite/?q=%s&kp=1"
+  "The duckduckgo url.
+This is a format string, don't forget the `%s'.
+If you have personal settings saved on duckduckgo you should have
+a personal url, see your settings on duckduckgo."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-wikipedia-suggest-url
+  "https://en.wikipedia.org/w/api.php?action=opensearch&search="
+  "Url used for looking up Wikipedia suggestions."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-search-suggest-action-wikipedia-url
+  "https://en.wikipedia.org/wiki/Special:Search?search=%s"
+  "The Wikipedia search url.
+This is a format string, don't forget the `%s'."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-wikipedia-summary-url
+  "http://en.wikipedia.org/w/api.php?action=parse&format=json&prop=text&section=0&page="
+  "URL for getting the summary of a Wikipedia topic."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-wikipedia-follow-delay 2
+  "Delay before wikipedia summary popup."
+  :type 'number
+  :group 'helm-net)
+
+(defcustom helm-search-suggest-action-youtube-url
+  "http://www.youtube.com/results?aq=f&search_query=%s"
+  "The Youtube search url.
+This is a format string, don't forget the `%s'."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-search-suggest-action-imdb-url
+  "http://www.imdb.com/find?s=all&q=%s"
+  "The IMDb search url.
+This is a format string, don't forget the `%s'."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-search-suggest-action-google-maps-url
+  "http://maps.google.com/maps?f=q&source=s_q&q=%s"
+  "The Google Maps search url.
+This is a format string, don't forget the `%s'."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-search-suggest-action-google-news-url
+  "http://www.google.com/search?safe=off&prmd=nvlifd&source=lnms&tbs=nws:1&q=%s"
+  "The Google News search url.
+This is a format string, don't forget the `%s'."
+  :type 'string
+  :group 'helm-net)
+
+(defcustom helm-google-suggest-actions
+  '(("Google Search" . helm-google-suggest-action)
+    ("Wikipedia" . (lambda (candidate)
+                     (helm-search-suggest-perform-additional-action
+                      helm-search-suggest-action-wikipedia-url
+                      candidate)))
+    ("Youtube" . (lambda (candidate)
+                   (helm-search-suggest-perform-additional-action
+                    helm-search-suggest-action-youtube-url
+                    candidate)))
+    ("IMDb" . (lambda (candidate)
+                (helm-search-suggest-perform-additional-action
+                 helm-search-suggest-action-imdb-url
+                 candidate)))
+    ("Google Maps" . (lambda (candidate)
+                       (helm-search-suggest-perform-additional-action
+                        helm-search-suggest-action-google-maps-url
+                        candidate)))
+    ("Google News" . (lambda (candidate)
+                       (helm-search-suggest-perform-additional-action
+                        helm-search-suggest-action-google-news-url
+                        candidate))))
+  "List of actions for google suggest sources."
+  :group 'helm-net
+  :type '(alist :key-type string :value-type function))
+
+(defcustom helm-browse-url-firefox-new-window "-new-tab"
+  "Allow choosing to browse url in new window or new tab.
+Can be \"-new-tab\" (default) or \"-new-window\"."
+  :group 'helm-net
+  :type '(radio
+          (const :tag "New tab" "-new-tab")
+          (const :tag "New window" "-new-window")))
+
+\f
+;;; Additional actions for search suggestions
+;;
+;;
+;; Internal
+
+(defun helm-search-suggest-perform-additional-action (url query)
+  "Perform the search via URL using QUERY as input."
+  (browse-url (format url (url-hexify-string query))))
+
+(defun helm-net--url-retrieve-sync (request parser)
+  (if helm-net-prefer-curl
+      (with-temp-buffer
+        (call-process "curl" nil t nil request)
+        (funcall parser))
+      (with-current-buffer (url-retrieve-synchronously request)
+        (funcall parser))))
+
+\f
+;;; Google Suggestions
+;;
+;;
+(defun helm-google-suggest-parser ()
+  (cl-loop
+   with result-alist = (xml-get-children
+                        (car (xml-parse-region
+                              (point-min) (point-max)))
+                        'CompleteSuggestion)
+   for i in result-alist collect
+   (cdr (cl-caadr (assoc 'suggestion i)))))
+
+(defun helm-google-suggest-fetch (input)
+  "Fetch suggestions for INPUT from XML buffer."
+  (let ((request (concat helm-google-suggest-url
+                         (url-hexify-string input))))
+    (helm-net--url-retrieve-sync
+     request #'helm-google-suggest-parser)))
+
+(defun helm-google-suggest-set-candidates (&optional request-prefix)
+  "Set candidates with result and number of google results found."
+  (let ((suggestions (helm-google-suggest-fetch
+                      (or (and request-prefix
+                               (concat request-prefix
+                                       " " helm-pattern))
+                          helm-pattern))))
+    (if (member helm-pattern suggestions)
+        suggestions
+        ;; if there is no suggestion exactly matching the input then
+        ;; prepend a Search on Google item to the list
+        (append
+         suggestions
+         (list (cons (format "Search for '%s' on Google" helm-input)
+                     helm-input))))))
+
+(defun helm-ggs-set-number-result (num)
+  (if num
+      (progn
+        (and (numberp num) (setq num (number-to-string num)))
+        (cl-loop for i in (reverse (split-string num "" t))
+              for count from 1
+              append (list i) into C
+              when (= count 3)
+              append (list ",") into C
+              and do (setq count 0)
+              finally return
+              (replace-regexp-in-string
+               "^," "" (mapconcat 'identity (reverse C) ""))))
+    "?"))
+
+(defun helm-google-suggest-action (candidate)
+  "Default action to jump to a google suggested candidate."
+  (let ((arg (format helm-google-suggest-search-url
+                     (url-hexify-string candidate))))
+    (helm-aif helm-google-suggest-default-browser-function
+        (funcall it arg)
+      (helm-browse-url arg))))
+
+(defvar helm-google-suggest-default-function
+  'helm-google-suggest-set-candidates
+  "Default function to use in helm google suggest.")
+
+(defvar helm-source-google-suggest
+  (helm-build-sync-source "Google Suggest"
+    :candidates (lambda ()
+                  (funcall helm-google-suggest-default-function))
+    :action 'helm-google-suggest-actions
+    :volatile t
+    :keymap helm-map
+    :requires-pattern 3))
+
+(defun helm-google-suggest-emacs-lisp ()
+  "Try to emacs lisp complete with google suggestions."
+  (helm-google-suggest-set-candidates "emacs lisp"))
+
+;;; Wikipedia suggestions
+;;
+;;
+(declare-function json-read-from-string "json" (string))
+(defun helm-wikipedia-suggest-fetch ()
+  "Fetch Wikipedia suggestions and return them as a list."
+  (require 'json)
+  (let ((request (concat helm-wikipedia-suggest-url
+                         (url-hexify-string helm-pattern))))
+    (helm-net--url-retrieve-sync
+     request #'helm-wikipedia--parse-buffer)))
+
+(defun helm-wikipedia--parse-buffer ()
+  (goto-char (point-min))
+  (when (re-search-forward "^\\[.+\\[\\(.*\\)\\]\\]" nil t)
+    (cl-loop for i across (aref (json-read-from-string (match-string 0)) 1)
+          collect i into result
+          finally return (or result
+                             (append
+                              result
+                              (list (cons (format "Search for '%s' on wikipedia"
+                                                  helm-pattern)
+                                          helm-pattern)))))))
+
+(defvar helm-wikipedia--summary-cache (make-hash-table :test 'equal))
+(defun helm-wikipedia-persistent-action (candidate)
+  (unless (string= (format "Search for '%s' on wikipedia"
+                           helm-pattern)
+                   (helm-get-selection nil t))
+    (message "Fetching summary from Wikipedia...")
+    (let ((buf (get-buffer-create "*helm wikipedia summary*"))
+          result mess)
+      (while (progn
+               (setq result (or (gethash candidate helm-wikipedia--summary-cache)
+                                (puthash candidate
+                                         (prog1
+                                             (helm-wikipedia-fetch-summary candidate)
+                                           (setq mess "Done"))
+                                         helm-wikipedia--summary-cache)))
+               (when (and result
+                          (listp result))
+                 (setq candidate (cdr result))
+                 (message "Redirected to %s" candidate)
+                 t)))
+      (if (not result)
+          (message "Error when getting summary.")
+        (with-current-buffer buf
+          (erase-buffer)
+          (setq cursor-type nil)
+          (insert result)
+          (fill-region (point-min) (point-max))
+          (goto-char (point-min)))
+        (display-buffer buf)
+        (message mess)))))
+
+(defun helm-wikipedia-fetch-summary (input)
+  (let* ((request (concat helm-wikipedia-summary-url
+                          (url-hexify-string input))))
+    (helm-net--url-retrieve-sync
+     request #'helm-wikipedia--parse-summary)))
+
+(defun helm-wikipedia--parse-summary ()
+  (goto-char (point-min))
+  (when (search-forward "{" nil t)
+    (let ((result (cdr (assoc '*
+                              (assoc 'text
+                                     (assoc 'parse
+                                            (json-read-from-string
+                                             (buffer-substring-no-properties
+                                              (1- (point)) (point-max)))))))))
+      (when result
+        (if (string-match "<span class=\"redirectText\"><a href=[^>]+>\\([^<]+\\)" result)
+            (cons 'redirect (match-string 1 result))
+
+          ;; find the beginning of the summary text in the result
+
+          ;; check if there is a table before the summary and skip that
+          (when (or (string-match "</table>\\(\n<div.*?</div>\\)?\n<p>" result)
+                    ;; otherwise just find the first paragraph
+                    (string-match "<p>" result))
+            ;; remove cruft and do a simple formatting 
+            (replace-regexp-in-string
+             "Cite error: .*" ""
+             (replace-regexp-in-string
+              "&#160;" ""
+              (replace-regexp-in-string
+               "\\[[^\]]+\\]" ""
+               (replace-regexp-in-string
+                "<[^>]*>" ""
+                (replace-regexp-in-string
+                 "</p>\n<p>" "\n\n"
+                 (substring result (match-end 0)))))))))))))
+
+
+(defvar helm-source-wikipedia-suggest
+  (helm-build-sync-source "Wikipedia Suggest"
+    :candidates #'helm-wikipedia-suggest-fetch
+    :action '(("Wikipedia" . (lambda (candidate)
+                               (helm-search-suggest-perform-additional-action
+                                helm-search-suggest-action-wikipedia-url
+                                candidate))))
+    :persistent-action #'helm-wikipedia-persistent-action
+    :volatile t
+    :keymap helm-map
+    :follow 1
+    :follow-delay helm-wikipedia-follow-delay
+    :requires-pattern 3))
+
+\f
+;;; Web browser functions.
+;;
+;;
+;; If default setting of `w3m-command' is not
+;; what you want and you modify it, you will have to reeval
+;; also `helm-browse-url-default-browser-alist'.
+
+(defvar helm-browse-url-chromium-program "chromium-browser")
+(defvar helm-browse-url-uzbl-program "uzbl-browser")
+(defvar helm-browse-url-conkeror-program "conkeror")
+(defvar helm-browse-url-default-browser-alist
+  `((,(or (and (boundp 'w3m-command) w3m-command)
+          "/usr/bin/w3m") . w3m-browse-url)
+    (,browse-url-firefox-program . browse-url-firefox)
+    (,helm-browse-url-chromium-program . helm-browse-url-chromium)
+    (,helm-browse-url-conkeror-program . helm-browse-url-conkeror)
+    (,helm-browse-url-uzbl-program . helm-browse-url-uzbl)
+    (,browse-url-kde-program . browse-url-kde)
+    (,browse-url-gnome-moz-program . browse-url-gnome-moz)
+    (,browse-url-mozilla-program . browse-url-mozilla)
+    (,browse-url-galeon-program . browse-url-galeon)
+    (,browse-url-netscape-program . browse-url-netscape)
+    (,browse-url-mosaic-program . browse-url-mosaic)
+    (,browse-url-xterm-program . browse-url-text-xterm)
+    ("emacs" . eww-browse-url))
+  "*Alist of \(executable . function\) to try to find a suitable url browser.")
+
+(cl-defun helm-generic-browser (url cmd-name &rest args)
+  "Browse URL with NAME browser."
+  (let ((proc (concat cmd-name " " url)))
+    (message "Starting %s..." cmd-name)
+    (apply 'start-process proc nil cmd-name
+           (append args (list url)))
+    (set-process-sentinel
+     (get-process proc)
+     (lambda (process event)
+         (when (string= event "finished\n")
+           (message "%s process %s" process event))))))
+
+(defun helm-browse-url-firefox (url &optional _ignore)
+  "Same as `browse-url-firefox' but detach from emacs.
+So when you quit emacs you can keep your firefox open
+and not be prompted to kill firefox process.
+
+NOTE: Probably not supported on some systems (e.g Windows)."
+  (interactive (list (read-string "URL: " (browse-url-url-at-point))
+                     nil))
+  (let ((process-environment (browse-url-process-environment)))
+    (call-process-shell-command
+     (format "(%s %s %s &)"
+             browse-url-firefox-program
+             helm-browse-url-firefox-new-window
+             url))))
+
+(defun helm-browse-url-chromium (url &optional _ignore)
+  "Browse URL with google chrome browser."
+  (interactive "sURL: ")
+  (helm-generic-browser
+   url helm-browse-url-chromium-program))
+
+(defun helm-browse-url-uzbl (url &optional _ignore)
+  "Browse URL with uzbl browser."
+  (interactive "sURL: ")
+  (helm-generic-browser url helm-browse-url-uzbl-program "-u"))
+
+(defun helm-browse-url-conkeror (url &optional _ignore)
+  "Browse URL with conkeror browser."
+  (interactive "sURL: ")
+  (helm-generic-browser url helm-browse-url-conkeror-program))
+
+(defun helm-browse-url-default-browser (url &rest args)
+  "Find the first available browser and ask it to load URL."
+  (let ((default-browser-fn
+         (cl-loop for (exe . fn) in helm-browse-url-default-browser-alist
+               thereis (and exe (executable-find exe) (fboundp fn) fn))))
+    (if default-browser-fn
+        (apply default-browser-fn url args)
+      (error "No usable browser found"))))
+
+(defun helm-browse-url (url &rest args)
+  "Default command to browse URL."
+  (if browse-url-browser-function
+      (browse-url url args)
+    (helm-browse-url-default-browser url args)))
+
+\f
+;;; Surfraw
+;;
+;; Need external program surfraw.
+;; <http://surfraw.alioth.debian.org/>
+
+;; Internal
+(defvar helm-surfraw-engines-history nil)
+(defvar helm-surfraw-input-history nil)
+(defvar helm-surfraw--elvi-cache nil)
+
+(defun helm-build-elvi-list ()
+  "Return list of all engines and descriptions handled by surfraw."
+  (or helm-surfraw--elvi-cache
+      (setq helm-surfraw--elvi-cache
+            (cdr (with-temp-buffer
+                   (call-process "surfraw" nil t nil "-elvi")
+                   (split-string (buffer-string) "\n"))))))
+
+;;;###autoload
+(defun helm-surfraw (pattern engine)
+  "Preconfigured `helm' to search PATTERN with search ENGINE."
+  (interactive (list (read-string "SearchFor: "
+                                  nil 'helm-surfraw-input-history
+                                  (thing-at-point 'symbol))
+                     (helm-comp-read
+                      "Engine: "
+                      (helm-build-elvi-list)
+                      :must-match t
+                      :name "Surfraw Search Engines"
+                      :del-input nil
+                      :history helm-surfraw-engines-history)))
+  (let* ((engine-nodesc (car (split-string engine)))
+         (url (if (string= engine-nodesc "duckduckgo")
+                  ;; "sr duckduckgo -p foo" is broken, workaround.
+                  (format helm-surfraw-duckduckgo-url
+                          (url-hexify-string pattern))
+                (with-temp-buffer
+                  (apply 'call-process "surfraw" nil t nil
+                         (append  (list engine-nodesc "-p") (split-string pattern)))
+                  (replace-regexp-in-string
+                   "\n" "" (buffer-string)))))
+         (browse-url-browser-function (or helm-surfraw-default-browser-function
+                                          browse-url-browser-function)))
+    (if (string= engine-nodesc "W")
+        (helm-browse-url helm-home-url)
+      (helm-browse-url url)
+      (setq helm-surfraw-engines-history
+            (cons engine (delete engine helm-surfraw-engines-history))))))
+
+;;;###autoload
+(defun helm-google-suggest ()
+  "Preconfigured `helm' for google search with google suggest."
+  (interactive)
+  (helm-other-buffer 'helm-source-google-suggest "*helm google*"))
+
+;;;###autoload
+(defun helm-wikipedia-suggest ()
+  "Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest."
+  (interactive)
+  (helm :sources 'helm-source-wikipedia-suggest
+        :buffer "*helm wikipedia*"))
+
+
+(provide 'helm-net)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-net.el ends here
diff --git a/elpa/helm-20160217.958/helm-org.el b/elpa/helm-20160217.958/helm-org.el
new file mode 100644 (file)
index 0000000..19c2882
--- /dev/null
@@ -0,0 +1,276 @@
+;;; helm-org.el --- Helm for org headlines and keywords completion -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-utils)
+(require 'org)
+
+(declare-function org-agenda-switch-to "org-agenda.el")
+
+(defgroup helm-org nil
+  "Org related functions for helm."
+  :group 'helm)
+
+(defcustom helm-org-headings-fontify nil
+  "Fontify org buffers before parsing them.
+This reflect fontification in helm-buffer when non--nil.
+NOTE: This will be slow on large org buffers."
+  :group 'helm-org
+  :type 'boolean)
+
+(defcustom helm-org-format-outline-path nil
+  "Show all org level as path."
+  :group 'helm-org
+  :type 'boolean)
+
+(defcustom helm-org-show-filename nil
+  "Show org filenames in `helm-org-agenda-files-headings' when non--nil.
+Note this have no effect in `helm-org-in-buffer-headings'."
+  :group 'helm-org
+  :type 'boolean)
+
+(defcustom helm-org-headings-min-depth 1
+  "Minimum depth of org headings to start with."
+  :group 'helm-org
+  :type 'integer)
+
+(defcustom helm-org-headings-max-depth 8
+  "Go down to this maximum depth of org headings."
+  :group 'helm-org
+  :type 'integer)
+
+(defcustom helm-org-headings-actions
+  '(("Go to heading" . helm-org-goto-marker)
+    ("Open in indirect buffer `C-RET'" . helm-org--open-heading-in-indirect-buffer)
+    ("Refile to this heading `C-w`''" . helm-org-heading-refile)
+    ("Insert link to this heading `C-l`''" . helm-org-insert-link-to-heading-at-marker))
+  "Default actions alist for
+  `helm-source-org-headings-for-files'."
+  :group 'helm-org
+  :type '(alist :key-type string :value-type function))
+
+(defcustom helm-org-truncate-lines t
+  "Truncate org-header-lines when non-nil"
+  :type 'boolean
+  :group 'helm-org)
+
+;;; Org capture templates
+;;
+;;
+(defvar org-capture-templates)
+(defun helm-source-org-capture-templates ()
+  (helm-build-sync-source "Org Capture Templates:"
+    :candidates (cl-loop for template in org-capture-templates
+                         collect (cons (nth 1 template) (nth 0 template)))
+    :action '(("Do capture" . (lambda (template-shortcut)
+                                (org-capture nil template-shortcut))))))
+
+;;; Org headings
+;;
+;;
+(defun helm-org-goto-marker (marker)
+  (switch-to-buffer (marker-buffer marker))
+  (goto-char (marker-position marker))
+  (org-show-context)
+  (re-search-backward "^\\*+ " nil t)
+  (org-show-entry))
+
+(defun helm-org--open-heading-in-indirect-buffer (marker)
+  (helm-org-goto-marker marker)
+  (org-tree-to-indirect-buffer)
+
+  ;; Put the non-indirect buffer at the bottom of the prev-buffers
+  ;; list so it won't be selected when the indirect buffer is killed
+  (set-window-prev-buffers nil (append (cdr (window-prev-buffers))
+                                       (car (window-prev-buffers)))))
+
+(defun helm-org--run-open-heading-in-indirect-buffer ()
+  "Open selected Org heading in an indirect buffer."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action #'helm-org--open-heading-in-indirect-buffer)))
+(put 'helm-org--run-open-heading-in-indirect-buffer 'helm-only t)
+
+(defvar helm-org-headings-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "<C-return>") 'helm-org--run-open-heading-in-indirect-buffer)
+    (define-key map (kbd "C-w") 'helm-org-heading-refile)
+    (define-key map (kbd "C-l") 'helm-org-insert-link-to-heading-at-marker)
+    map)
+  "Keymap for `helm-source-org-headings-for-files'.")
+
+(defclass helm-org-headings-class (helm-source-sync)
+  ((parents
+    :initarg :parents
+    :initform nil
+    :custom boolean)
+   (match :initform
+          (lambda (candidate)
+            (string-match
+             helm-pattern
+             (helm-aif (get-text-property 0 'helm-real-display candidate)
+                 it
+               candidate))))
+   (action :initform 'helm-org-headings-actions)
+   (keymap :initform 'helm-org-headings-map)))
+
+(defmethod helm--setup-source :after ((source helm-org-headings-class))
+  (let ((parents (slot-value source 'parents)))
+    (set-slot-value source 'candidate-transformer
+                    (lambda (candidates)
+                      (let ((cands (helm-org-get-candidates candidates parents)))
+                        (if parents (nreverse cands) cands))))))
+
+(defun helm-source-org-headings-for-files (filenames &optional parents)
+  (helm-make-source "Org Headings" helm-org-headings-class
+    :parents parents
+    :candidates filenames))
+
+(defun helm-org-get-candidates (filenames &optional parents)
+  (apply #'append
+         (mapcar (lambda (filename)
+                   (helm-org--get-candidates-in-file
+                    filename
+                    helm-org-headings-fontify
+                    (or parents (null helm-org-show-filename))
+                    parents))
+                 filenames)))
+
+(defun helm-org--get-candidates-in-file (filename &optional fontify nofname parents)
+  (with-current-buffer (pcase filename
+                         ((pred bufferp) filename)
+                         ((pred stringp) (find-file-noselect filename)))
+    (let ((match-fn (if fontify
+                        #'match-string
+                      #'match-string-no-properties))
+          (search-fn (lambda ()
+                       (re-search-forward
+                        org-complex-heading-regexp nil t)))
+          (file (unless nofname
+                  (concat (helm-basename filename) ":"))))
+      (when parents
+        (add-function :around (var search-fn)
+                      (lambda (old-fn &rest args)
+                                (when (org-up-heading-safe)
+                                  (apply old-fn args)))))
+      (save-excursion
+        (save-restriction
+          (widen)
+          (unless parents (goto-char (point-min)))
+          (cl-loop with width = (window-width (helm-window))
+                   while (funcall search-fn)
+                   for beg = (point-at-bol)
+                   for end = (point-at-eol)
+                   when (and fontify
+                             (null (text-property-any
+                                    beg end 'fontified t)))
+                   do (jit-lock-fontify-now beg end)
+                   for level = (length (match-string-no-properties 1))
+                   for heading = (funcall match-fn 4)
+                   if (and (>= level helm-org-headings-min-depth)
+                           (<= level helm-org-headings-max-depth))
+                   collect `(,(propertize
+                               (if helm-org-format-outline-path
+                                   (org-format-outline-path
+                                    (append (apply #'org-get-outline-path
+                                                   (unless parents
+                                                     (list t level heading)))
+                                            (list heading))
+                                    width file)
+                                   (if file
+                                       (concat file (funcall match-fn  0))
+                                       (funcall match-fn  0)))
+                               'helm-real-display heading)
+                              . ,(point-marker))))))))
+
+(defun helm-org-insert-link-to-heading-at-marker (marker)
+  (with-current-buffer (marker-buffer marker)
+    (let ((heading-name (save-excursion (goto-char (marker-position marker))
+                                        (nth 4 (org-heading-components))))
+          (file-name (buffer-file-name)))
+      (with-helm-current-buffer
+        (org-insert-link
+         file-name (concat "file:" file-name "::*" heading-name))))))
+
+(defun helm-org-heading-refile (marker)
+  (save-selected-window
+    (when (eq major-mode 'org-agenda-mode)
+      (org-agenda-switch-to))
+    (org-cut-subtree)
+    (let ((target-level (with-current-buffer (marker-buffer marker)
+                          (goto-char (marker-position marker))
+                          (org-current-level))))
+      (helm-org-goto-marker marker)
+      (org-end-of-subtree t t)
+      (org-paste-subtree (+ target-level 1)))))
+
+;;;###autoload
+(defun helm-org-agenda-files-headings ()
+  "Preconfigured helm for org files headings."
+  (interactive)
+  (helm :sources (helm-source-org-headings-for-files (org-agenda-files))
+        :candidate-number-limit 99999
+        :truncate-lines helm-org-truncate-lines
+        :buffer "*helm org headings*"))
+
+;;;###autoload
+(defun helm-org-in-buffer-headings ()
+  "Preconfigured helm for org buffer headings."
+  (interactive)
+  (let ((helm-org-show-filename nil))
+    (helm :sources (helm-source-org-headings-for-files
+                    (list (current-buffer)))
+          :candidate-number-limit 99999
+          :truncate-lines helm-org-truncate-lines
+          :buffer "*helm org inbuffer*")))
+
+;;;###autoload
+(defun helm-org-parent-headings ()
+  "Preconfigured helm for org headings that are parents of the
+current heading."
+  (interactive)
+  ;; Use a large max-depth to ensure all parents are displayed.
+  (let ((helm-org-headings-min-depth 1)
+        (helm-org-headings-max-depth  50))
+    (helm :sources (helm-source-org-headings-for-files
+                    (list (current-buffer)) t)
+          :candidate-number-limit 99999
+          :truncate-lines helm-org-truncate-lines
+          :buffer "*helm org parent headings*")))
+
+;;;###autoload
+(defun helm-org-capture-templates ()
+  "Preconfigured helm for org templates."
+  (interactive)
+  (helm :sources (helm-source-org-capture-templates)
+        :candidate-number-limit 99999
+        :truncate-lines helm-org-truncate-lines
+        :buffer "*helm org capture templates*"))
+
+
+(provide 'helm-org)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-org.el ends here
diff --git a/elpa/helm-20160217.958/helm-pkg.el b/elpa/helm-20160217.958/helm-pkg.el
new file mode 100644 (file)
index 0000000..d46f0a1
--- /dev/null
@@ -0,0 +1,9 @@
+(define-package "helm" "20160217.958" "Helm is an Emacs incremental and narrowing framework"
+  '((emacs "24.3")
+    (async "1.6")
+    (popup "0.5.3")
+    (helm-core "1.9.1"))
+  :url "https://emacs-helm.github.io/helm/")
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
diff --git a/elpa/helm-20160217.958/helm-plugin.el b/elpa/helm-20160217.958/helm-plugin.el
new file mode 100644 (file)
index 0000000..976a734
--- /dev/null
@@ -0,0 +1,137 @@
+;;; helm-plugin.el --- Helm plugins -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-utils)
+
+\f
+;;; Plug-in: `info-index'
+;;
+;;
+(defun helm-make-info-source (source file)
+  `(,@source
+    (name . ,(concat "Info Index: " file))
+    (info-file . ,file)
+    (init . helm-info-init)
+    (display-to-real . helm-info-display-to-real)
+    (get-line . buffer-substring)
+    (candidates-in-buffer)
+    (action ("Goto node" . helm-info-goto))))
+
+(defun helm-compile-source--info-index (source)
+  (helm-aif (helm-interpret-value (assoc-default 'info-index source))
+      (helm-make-info-source source it)
+    source))
+
+(add-to-list 'helm-compile-source-functions 'helm-compile-source--info-index)
+
+(helm-document-attribute 'info-index "info-index plugin"
+  "  Create a source of info index very easily.
+
+  Example:
+
+  (defvar helm-source-info-wget '((info-index . \"wget\"))")
+
+\f
+;;; Plug-in: `candidates-file'
+;;
+;; List all lines in a file.
+(defun helm-compile-source--candidates-file (source)
+  (if (assoc-default 'candidates-file source)
+      `((init helm-p-candidates-file-init
+              ,@(let ((orig-init (assoc-default 'init source)))
+                     (cond ((null orig-init) nil)
+                           ((functionp orig-init) (list orig-init))
+                           (t orig-init))))
+        (candidates-in-buffer)
+        ,@source)
+    source))
+(add-to-list 'helm-compile-source-functions 'helm-compile-source--candidates-file)
+
+(defun helm-p-candidates-file-init ()
+  (cl-destructuring-bind (file &optional updating)
+      (helm-mklist (helm-attr 'candidates-file))
+    (setq file (helm-interpret-value file))
+    (with-current-buffer (helm-candidate-buffer 'global)
+      (insert-file-contents file)
+      (when updating
+        (buffer-disable-undo)
+        (font-lock-mode -1)
+        (auto-revert-mode 1)))))
+
+(helm-document-attribute 'candidates-file "candidates-file plugin"
+  "  Use a file as the candidates buffer.
+
+  1st argument is a filename, string or function name or variable
+  name. If optional 2nd argument is non-nil, the file is opened with
+  `auto-revert-mode' enabled.
+
+  Example:
+
+  \(defvar helm-source-test-file
+    '((name . \"test1\")
+      (candidates-file \"~/.emacs.el\" t)))
+
+  Will list all lines in .emacs.el.")
+
+\f
+;;; Plug-in: `persistent-help'
+;;
+;; Add help about persistent action in `helm-buffer' header.
+(defun helm-compile-source--persistent-help (source)
+  (if (assoc 'header-line source)
+      source
+      (append source '((header-line . helm-persistent-help-string)))))
+(add-to-list 'helm-compile-source-functions 'helm-compile-source--persistent-help)
+
+(defun helm-persistent-help-string ()
+  (substitute-command-keys
+   (concat "\\<helm-map>\\[helm-execute-persistent-action]: "
+           (or (helm-interpret-value (helm-attr 'persistent-help))
+               (helm-aif (or (assoc-default
+                              'persistent-action
+                              (helm-get-current-source))
+                             (assoc-default
+                              'action (helm-get-current-source)))
+                   (cond ((symbolp it)
+                          (symbol-name it))
+                         ((listp it)
+                          (or (ignore-errors (caar it))  ""))))
+               "")
+           " (keeping session)")))
+
+\f
+;;; Document new attributes
+;;
+;;
+(helm-document-attribute 'persistent-help "persistent-help plug-in"
+  "  A string to explain persistent-action of this source. It also
+  accepts a function or a variable name.")
+
+
+(provide 'helm-plugin)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-plugin ends here
diff --git a/elpa/helm-20160217.958/helm-regexp.el b/elpa/helm-20160217.958/helm-regexp.el
new file mode 100644 (file)
index 0000000..793144d
--- /dev/null
@@ -0,0 +1,643 @@
+;;; helm-regexp.el --- In buffer regexp searching and replacement for helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-utils)
+(require 'helm-plugin)
+
+(declare-function helm-mm-split-pattern "helm-multi-match")
+
+\f
+(defgroup helm-regexp nil
+  "Regexp related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-moccur-always-search-in-current nil
+  "Helm multi occur always search in current buffer when non--nil."
+  :group 'helm-regexp
+  :type 'boolean)
+
+(defcustom helm-moccur-use-ioccur-style-keys t
+  "Similar to `helm-grep-use-ioccur-style-keys' but for multi occur."
+  :group 'helm-regexp
+  :type 'boolean)
+
+(defcustom helm-moccur-auto-update-on-resume nil
+  "Allow auto updating helm-(m)occur buffer when outdated.
+noask => Always update without asking
+nil   => Don't update but signal buffer needs update
+never => Never update and do not signal buffer needs update
+Any other non--nil value update after confirmation."
+  :group 'helm-regexp
+  :type '(radio :tag "Allow auto updating helm-(m)occur buffer when outdated."
+          (const :tag "Always update without asking" noask)
+          (const :tag "Never update and do not signal buffer needs update" never)
+          (const :tag "Don't update but signal buffer needs update" nil)
+          (const :tag "Update after confirmation" t)))
+
+(defcustom helm-source-multi-occur-actions
+  '(("Go to Line" . helm-moccur-goto-line)
+    ("Goto line other window" . helm-moccur-goto-line-ow)
+    ("Goto line new frame" . helm-moccur-goto-line-of))
+  "Actions for helm-occur and helm-moccur."
+  :group 'helm-regexp
+  :type '(alist :key-type string :value-type function))
+
+(defcustom helm-moccur-truncate-lines t
+  "When nil the (m)occur line that appears will not be truncated."
+  :group 'helm-regexp
+  :type 'boolean)
+
+\f
+(defface helm-moccur-buffer
+    '((t (:foreground "DarkTurquoise" :underline t)))
+  "Face used to highlight moccur buffer names."
+  :group 'helm-regexp)
+
+(defface helm-resume-need-update
+    '((t (:background "red")))
+  "Face used to flash moccur buffer when it needs update."
+  :group 'helm-regexp)
+
+\f
+(defvar helm-moccur-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-<down>") 'helm-goto-next-file)
+    (define-key map (kbd "M-<up>")   'helm-goto-precedent-file)
+    (define-key map (kbd "C-w")      'helm-yank-text-at-point)
+    (define-key map (kbd "C-c o")    'helm-moccur-run-goto-line-ow)
+    (define-key map (kbd "C-c C-o")  'helm-moccur-run-goto-line-of)
+    (define-key map (kbd "C-x C-s")  'helm-moccur-run-save-buffer)
+    (when helm-moccur-use-ioccur-style-keys
+      (define-key map (kbd "<right>")  'helm-execute-persistent-action)
+      (define-key map (kbd "<left>")   'helm-moccur-run-default-action))
+    (delq nil map))
+  "Keymap used in Moccur source.")
+
+\f
+;; History vars
+(defvar helm-build-regexp-history nil)
+(defvar helm-occur-history nil)
+
+(defun helm-query-replace-regexp (_candidate)
+  "Query replace regexp from `helm-regexp'.
+With a prefix arg replace only matches surrounded by word boundaries,
+i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
+  (let ((regexp helm-input))
+    (apply 'query-replace-regexp
+           (helm-query-replace-args regexp))))
+
+(defun helm-kill-regexp-as-sexp (_candidate)
+  "Kill regexp in a format usable in lisp code."
+  (helm-regexp-kill-new
+   (prin1-to-string helm-input)))
+
+(defun helm-kill-regexp (_candidate)
+  "Kill regexp as it is in `helm-pattern'."
+  (helm-regexp-kill-new helm-input))
+
+(defun helm-query-replace-args (regexp)
+  "create arguments of `query-replace-regexp' action in `helm-regexp'."
+  (let ((region-only (helm-region-active-p)))
+    (list
+     regexp
+     (query-replace-read-to regexp
+                            (format "Query replace %sregexp %s"
+                                    (if helm-current-prefix-arg "word " "")
+                                    (if region-only "in region " ""))
+                            t)
+     helm-current-prefix-arg
+     (when region-only (region-beginning))
+     (when region-only (region-end)))))
+
+(defvar helm-source-regexp
+  (helm-build-in-buffer-source "Regexp Builder"
+    :init (lambda ()
+            (helm-init-candidates-in-buffer
+                'global (with-temp-buffer
+                          (insert-buffer-substring helm-current-buffer)
+                          (buffer-string))))
+    :get-line #'helm-regexp-get-line
+    :persistent-action #'helm-regexp-persistent-action
+    :persistent-help "Show this line"
+    :multiline t
+    :matchplugin nil
+    :requires-pattern 2
+    :mode-line "Press TAB to select action."
+    :action '(("Kill Regexp as sexp" . helm-kill-regexp-as-sexp)
+              ("Query Replace Regexp (C-u Not inside word.)"
+               . helm-query-replace-regexp)
+              ("Kill Regexp" . helm-kill-regexp))))
+
+(defun helm-regexp-get-line (s e)
+  (let ((matches (match-data))
+        (line    (buffer-substring s e)))
+    (propertize
+     (cl-loop with ln = (format "%5d: %s" (1- (line-number-at-pos s)) line)
+           for i from 0 to (1- (/ (length matches) 2))
+           concat (format "\n         %s'%s'" (format "Group %d: " i)
+                          (match-string i))
+           into ln1
+           finally return (concat ln ln1))
+     'helm-realvalue s)))
+
+(defun helm-regexp-persistent-action (pt)
+  (helm-goto-char pt)
+  (helm-highlight-current-line))
+
+(defun helm-regexp-kill-new (input)
+  (kill-new input)
+  (message "Killed: %s" input))
+
+\f
+;;; Occur
+;;
+;;
+(defvar helm-source-occur nil)
+(defun helm-occur-init-source ()
+  (unless helm-source-occur
+    (setq helm-source-occur
+          (helm-make-source "Occur" 'helm-source-multi-occur))))
+
+\f
+;;; Multi occur
+;;
+;;
+
+;; Internal
+(defvar helm-multi-occur-buffer-list nil)
+(defvar helm-multi-occur-buffer-tick nil)
+(defun helm-moccur-init ()
+  "Create the initial helm multi occur buffer."
+  (helm-init-candidates-in-buffer
+      'global
+    (cl-loop with buffers = (helm-attr 'moccur-buffers)
+             for buf in buffers
+             for bufstr = (with-current-buffer buf (buffer-string))
+             do (add-text-properties
+                 0 (length bufstr)
+                 `(buffer-name ,(buffer-name (get-buffer buf)))
+                 bufstr)
+             concat bufstr)))
+
+(defun helm-moccur--next-or-previous-char ()
+  (save-excursion
+    (or (re-search-forward "^." nil t)
+        (re-search-backward "^." nil t))))
+
+(defun helm-moccur-get-line (beg end)
+  "Format line for `helm-source-moccur'."
+  (prog1
+      (format "%s:%d:%s"
+              (get-text-property (if (= beg end)
+                                     (helm-moccur--next-or-previous-char)
+                                     beg)
+                                 'buffer-name)
+              (save-restriction
+                (narrow-to-region (or (previous-single-property-change
+                                       (point) 'buffer-name) 1)
+                                  (or (next-single-property-change
+                                       (if (= beg end)
+                                           (helm-moccur--next-or-previous-char)
+                                           (point))
+                                       'buffer-name)
+                                      (point-max)))
+                (line-number-at-pos beg))
+              ;; When matching empty line, use empty string
+              ;; to allow saving and modifying with wgrep.
+              (if (= beg end) "" (buffer-substring beg end)))
+    ;; When matching empty line, forward char ("\n")
+    ;; to not be blocked forever here.
+    (when (= beg end) (forward-char 1))))
+
+(cl-defun helm-moccur-action (candidate
+                              &optional (method (quote buffer)) mark)
+  "Jump to CANDIDATE with METHOD.
+arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
+  (require 'helm-grep)
+  (let* ((split (helm-grep-split-line candidate))
+         (buf (car split))
+         (lineno (string-to-number (nth 1 split)))
+         (split-pat (helm-mm-split-pattern helm-input)))
+    (cl-case method
+      (buffer              (switch-to-buffer buf))
+      (buffer-other-window (switch-to-buffer-other-window buf))
+      (buffer-other-frame  (switch-to-buffer-other-frame buf)))
+    (helm-goto-line lineno)
+    ;; Move point to the nearest matching regexp from bol.
+    (cl-loop for reg in split-pat
+          when (save-excursion
+                 (condition-case _err
+                     (if helm-migemo-mode
+                         (helm-mm-migemo-forward reg (point-at-eol) t)
+                       (re-search-forward reg (point-at-eol) t))
+                   (invalid-regexp nil)))
+          collect (match-beginning 0) into pos-ls
+          finally (when pos-ls (goto-char (apply #'min pos-ls))))
+    (when mark
+      (set-marker (mark-marker) (point))
+      (push-mark (point) 'nomsg))))
+
+(defun helm-moccur-persistent-action (candidate)
+  (helm-moccur-goto-line candidate)
+  (helm-highlight-current-line))
+
+(defun helm-moccur-goto-line (candidate)
+  "From multi occur, switch to buffer and go to nth 1 CANDIDATE line."
+  (helm-moccur-action
+   candidate 'buffer (or current-prefix-arg         ; persistent.
+                         helm-current-prefix-arg))) ; exit.
+
+(defun helm-moccur-goto-line-ow (candidate)
+  "Go to CANDIDATE line in other window.
+Same as `helm-moccur-goto-line' but go in other window."
+  (helm-moccur-action
+   candidate 'buffer-other-window
+   (or current-prefix-arg         ; persistent.
+       helm-current-prefix-arg))) ; exit.
+
+(defun helm-moccur-goto-line-of (candidate)
+  "Go to CANDIDATE line in new frame.
+Same as `helm-moccur-goto-line' but go in new frame."
+  (helm-moccur-action
+   candidate 'buffer-other-frame
+   (or current-prefix-arg         ; persistent.
+       helm-current-prefix-arg))) ; exit.
+
+(defun helm-moccur-run-goto-line-ow ()
+  "Run goto line other window action from `helm-source-moccur'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-moccur-goto-line-ow)))
+(put 'helm-moccur-run-goto-line-ow 'helm-only t)
+
+(defun helm-moccur-run-goto-line-of ()
+  "Run goto line new frame action from `helm-source-moccur'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-moccur-goto-line-of)))
+(put 'helm-moccur-run-goto-line-of 'helm-only t)
+
+(defun helm-moccur-run-default-action ()
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-moccur-goto-line)))
+(put 'helm-moccur-run-default-action 'helm-only t)
+
+(defvar helm-source-moccur nil)
+(defclass helm-source-multi-occur (helm-source-in-buffer)
+  ((init :initform (lambda ()
+                     (require 'helm-grep)
+                     (helm-moccur-init)))
+   (filter-one-by-one :initform 'helm-moccur-filter-one-by-one)
+   (get-line :initform helm-moccur-get-line)
+   (nohighlight :initform t)
+   (nomark :initform t)
+   (migemo :initform t)
+   (action :initform 'helm-source-multi-occur-actions)
+   (persistent-action :initform 'helm-moccur-persistent-action)
+   (persistent-help :initform "Go to line")
+   (resume :initform 'helm-moccur-resume-fn)
+   (candidate-number-limit :initform 9999)
+   (help-message :initform 'helm-moccur-help-message)
+   (keymap :initform helm-moccur-map)
+   (history :initform 'helm-occur-history)
+   (requires-pattern :initform 2)))
+
+(defun helm-moccur-resume-fn ()
+  (with-helm-buffer
+    (let (new-tick-ls buffer-is-modified)
+      (set (make-local-variable 'helm-multi-occur-buffer-list)
+           (cl-loop for b in helm-multi-occur-buffer-list
+                    when (buffer-live-p (get-buffer b))
+                    collect b))
+      (setq buffer-is-modified (/= (length helm-multi-occur-buffer-list)
+                                   (length (helm-attr 'moccur-buffers))))
+      (helm-attrset 'moccur-buffers helm-multi-occur-buffer-list)
+      (setq new-tick-ls (cl-loop for b in helm-multi-occur-buffer-list
+                                 collect (buffer-chars-modified-tick (get-buffer b))))
+      (when buffer-is-modified
+        (setq helm-multi-occur-buffer-tick new-tick-ls))
+      (cl-assert (> (length helm-multi-occur-buffer-list) 0) nil
+                 "helm-resume error: helm-(m)occur buffer list is empty")
+      (unless (eq helm-moccur-auto-update-on-resume 'never)
+        (when (or buffer-is-modified
+                  (cl-loop for b in helm-multi-occur-buffer-list
+                           for new-tick = (buffer-chars-modified-tick (get-buffer b))
+                           for tick in helm-multi-occur-buffer-tick
+                           thereis (/= tick new-tick)))
+          (helm-aif helm-moccur-auto-update-on-resume
+              (when (or (eq it 'noask)
+                        (y-or-n-p "Helm (m)occur Buffer outdated, update? "))
+                (run-with-idle-timer 0.1 nil (lambda ()
+                                               (with-helm-buffer
+                                                 (helm-force-update)
+                                                 (message "Helm (m)occur Buffer have been udated")
+                                                 (sit-for 1) (message nil))))
+                (unless buffer-is-modified (setq helm-multi-occur-buffer-tick new-tick-ls)))
+            (run-with-idle-timer 0.1 nil (lambda ()
+                                           (with-helm-buffer
+                                             (let ((ov (make-overlay (save-excursion
+                                                                       (goto-char (point-min))
+                                                                       (forward-line 1)
+                                                                       (point))
+                                                                     (point-max))))
+                                               (overlay-put ov 'face 'helm-resume-need-update)
+                                               (sit-for 0.3) (delete-overlay ov)
+                                               (message "[Helm occur Buffer outdated (C-c C-u to update)]")))))
+            (unless buffer-is-modified
+              (with-helm-after-update-hook
+                (setq helm-multi-occur-buffer-tick new-tick-ls)
+                (message "Helm (m)occur Buffer have been udated")))))))))
+
+(defun helm-moccur-filter-one-by-one (candidate)
+  "`filter-one-by-one' function for `helm-source-moccur'."
+  (require 'helm-grep)
+  (let* ((split  (helm-grep-split-line candidate))
+         (buf    (car split))
+         (lineno (nth 1 split))
+         (str    (nth 2 split)))
+    (cons (concat (propertize
+                   buf
+                   'face 'helm-moccur-buffer
+                   'help-echo (buffer-file-name
+                               (get-buffer buf))
+                   'buffer-name buf)
+                  ":"
+                  (propertize lineno 'face 'helm-grep-lineno)
+                  ":"
+                  (helm-grep-highlight-match str t))
+          candidate)))
+
+(defun helm-multi-occur-1 (buffers &optional input)
+  "Main function to call `helm-source-moccur' with BUFFERS list."
+  (let ((bufs (if helm-moccur-always-search-in-current
+                  (cons
+                   ;; will become helm-current-buffer later.
+                   (buffer-name (current-buffer))
+                   (remove helm-current-buffer buffers))
+                  buffers)))
+    (unless helm-source-moccur
+      (setq helm-source-moccur
+            (helm-make-source "Moccur" 'helm-source-multi-occur)))
+    (helm-attrset 'moccur-buffers bufs helm-source-moccur)
+    (helm-set-local-variable 'helm-multi-occur-buffer-list bufs)
+    (helm-set-local-variable
+     'helm-multi-occur-buffer-tick
+     (cl-loop for b in bufs
+              collect (buffer-chars-modified-tick (get-buffer b)))))
+  (helm :sources 'helm-source-moccur
+        :buffer "*helm multi occur*"
+        :history 'helm-occur-history
+        :keymap helm-moccur-map
+        :input input
+        :truncate-lines helm-moccur-truncate-lines))
+
+(defun helm-moccur-run-save-buffer ()
+  "Run moccur save results action from `helm-moccur'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action 'helm-moccur-save-results)))
+(put 'helm-moccur-run-save-buffer 'helm-only t)
+
+\f
+;;; helm-moccur-mode
+;;
+;;
+(defvar helm-moccur-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "RET")      'helm-moccur-mode-goto-line)
+    (define-key map (kbd "C-o")      'helm-moccur-mode-goto-line-ow)
+    (define-key map (kbd "<C-down>") 'helm-moccur-mode-goto-line-ow-forward)
+    (define-key map (kbd "<C-up>")   'helm-moccur-mode-goto-line-ow-backward)
+    (define-key map (kbd "<M-down>") 'helm-gm-next-file)
+    (define-key map (kbd "<M-up>")   'helm-gm-precedent-file)
+    (define-key map (kbd "M-n")      'helm-moccur-mode-goto-line-ow-forward)
+    (define-key map (kbd "M-p")      'helm-moccur-mode-goto-line-ow-backward)
+    (define-key map (kbd "M-N")      'helm-gm-next-file)
+    (define-key map (kbd "M-P")      'helm-gm-precedent-file)
+    map))
+
+(defun helm-moccur-mode-goto-line ()
+  (interactive)
+  (helm-aif (get-text-property (point) 'helm-realvalue)
+    (helm-moccur-goto-line it)))
+
+(defun helm-moccur-mode-goto-line-ow ()
+  (interactive)
+  (helm-aif (get-text-property (point) 'helm-realvalue)
+    (helm-moccur-goto-line-ow it)))
+
+(defun helm-moccur-mode-goto-line-ow-forward-1 (arg)
+  (condition-case nil
+      (progn
+        (save-selected-window
+          (helm-moccur-mode-goto-line-ow)
+          (recenter))
+        (forward-line arg))
+    (error nil)))
+
+(defun helm-moccur-mode-goto-line-ow-forward ()
+  (interactive)
+  (helm-moccur-mode-goto-line-ow-forward-1 1))
+
+(defun helm-moccur-mode-goto-line-ow-backward ()
+  (interactive)
+  (helm-moccur-mode-goto-line-ow-forward-1 -1))
+
+(defun helm-moccur-save-results (_candidate)
+  "Save helm moccur results in a `helm-moccur-mode' buffer."
+  (let ((buf "*hmoccur*")
+        new-buf)
+    (when (get-buffer buf)
+      (setq new-buf (helm-read-string "OccurBufferName: " buf))
+      (cl-loop for b in (helm-buffer-list)
+            when (and (string= new-buf b)
+                      (not (y-or-n-p
+                            (format "Buffer `%s' already exists overwrite? "
+                                    new-buf))))
+            do (setq new-buf (helm-read-string "OccurBufferName: " "*hmoccur ")))
+      (setq buf new-buf))
+    (with-current-buffer (get-buffer-create buf)
+      (setq buffer-read-only t)
+      (let ((inhibit-read-only t))
+        (erase-buffer)
+        (insert "-*- mode: helm-moccur -*-\n\n"
+                (format "Moccur Results for `%s':\n\n" helm-input))
+        (save-excursion
+          (insert (with-current-buffer helm-buffer
+                    (goto-char (point-min)) (forward-line 1)
+                    (buffer-substring (point) (point-max))))))
+      (helm-moccur-mode) (pop-to-buffer buf))
+    (message "Helm Moccur Results saved in `%s' buffer" buf)))
+
+;;;###autoload
+(define-derived-mode helm-moccur-mode
+    special-mode "helm-moccur"
+    "Major mode to provide actions in helm moccur saved buffer.
+
+Special commands:
+\\{helm-moccur-mode-map}"
+    (set (make-local-variable 'helm-multi-occur-buffer-list)
+         (with-helm-buffer helm-multi-occur-buffer-list))
+    (set (make-local-variable 'revert-buffer-function)
+         #'helm-moccur-mode--revert-buffer-function))
+
+(defun helm-moccur-mode--revert-buffer-function (&optional _ignore-auto _noconfirm)
+  (goto-char (point-min))
+  (let (pattern)
+    (when (re-search-forward "^Moccur Results for `\\(.*\\)'" nil t)
+      (setq pattern (match-string 1))
+      (forward-line 0)
+      (when (re-search-forward "^$" nil t)
+        (forward-line 1))
+      (let ((inhibit-read-only t)
+            (buffer (current-buffer))
+            (buflst helm-multi-occur-buffer-list))
+        (delete-region (point) (point-max))
+        (message "Reverting buffer...")
+        (save-excursion
+          (with-temp-buffer
+            (insert
+             "\n"
+             (cl-loop for buf in buflst
+                      for bufstr = (or (and (buffer-live-p (get-buffer buf))
+                                            (with-current-buffer buf
+                                              (buffer-string)))
+                                       "")
+                      unless (string= bufstr "")
+                      do (add-text-properties
+                          0 (length bufstr)
+                          `(buffer-name ,(buffer-name (get-buffer buf)))
+                          bufstr)
+                      concat bufstr)
+             "\n")
+            (goto-char (point-min))
+            (cl-loop while (re-search-forward pattern nil t)
+                     for line = (helm-moccur-get-line (point-at-bol) (point-at-eol))
+                     when line
+                     do (with-current-buffer buffer
+                          (insert
+                           (propertize
+                            (car (helm-moccur-filter-one-by-one line))
+                            'helm-realvalue line)
+                           "\n")))))
+        (message "Reverting buffer done")))))
+
+\f
+;;; Predefined commands
+;;
+;;
+
+;;;###autoload
+(defun helm-regexp ()
+  "Preconfigured helm to build regexps.
+`query-replace-regexp' can be run from there against found regexp."
+  (interactive)
+  (save-restriction
+    (when (and (helm-region-active-p)
+               ;; Don't narrow to region if buffer is already narrowed.
+               (not (helm-current-buffer-narrowed-p (current-buffer))))
+      (narrow-to-region (region-beginning) (region-end)))
+    (helm :sources helm-source-regexp
+          :buffer "*helm regexp*"
+          :prompt "Regexp: "
+          :history 'helm-build-regexp-history)))
+
+;;;###autoload
+(defun helm-occur ()
+  "Preconfigured helm for Occur."
+  (interactive)
+  (helm-occur-init-source)
+  (let ((bufs (list (buffer-name (current-buffer)))))
+    (helm-attrset 'moccur-buffers bufs helm-source-occur)
+    (helm-set-local-variable 'helm-multi-occur-buffer-list bufs)
+    (helm-set-local-variable
+     'helm-multi-occur-buffer-tick
+     (cl-loop for b in bufs
+              collect (buffer-chars-modified-tick (get-buffer b)))))
+  (helm :sources 'helm-source-occur
+        :buffer "*helm occur*"
+        :history 'helm-occur-history
+        :preselect (and (memq 'helm-source-occur helm-sources-using-default-as-input)
+                        (format "%s:%d:" (regexp-quote (buffer-name))
+                                (line-number-at-pos (point))))
+        :truncate-lines helm-moccur-truncate-lines))
+
+;;;###autoload
+(defun helm-occur-from-isearch ()
+  "Invoke `helm-occur' from isearch."
+  (interactive)
+  (let ((input (if isearch-regexp
+                   isearch-string
+                 (regexp-quote isearch-string)))
+        (bufs (list (buffer-name (current-buffer)))))
+    (isearch-exit)
+    (helm-occur-init-source)
+    (helm-attrset 'moccur-buffers bufs helm-source-occur)
+    (helm-set-local-variable 'helm-multi-occur-buffer-list bufs)
+    (helm-set-local-variable
+     'helm-multi-occur-buffer-tick
+     (cl-loop for b in bufs
+              collect (buffer-chars-modified-tick (get-buffer b))))
+    (helm :sources 'helm-source-occur
+          :buffer "*helm occur*"
+          :history 'helm-occur-history
+          :input input
+          :truncate-lines helm-moccur-truncate-lines)))
+
+;;;###autoload
+(defun helm-multi-occur-from-isearch (&optional _arg)
+  "Invoke `helm-multi-occur' from isearch.
+
+With a prefix arg, reverse the behavior of
+`helm-moccur-always-search-in-current'.
+The prefix arg can be set before calling
+`helm-multi-occur-from-isearch' or during the buffer selection."
+  (interactive "p")
+  (let (buf-list
+        helm-moccur-always-search-in-current
+        (input (if isearch-regexp
+                   isearch-string
+                 (regexp-quote isearch-string))))
+    (isearch-exit)
+    (setq buf-list (helm-comp-read "Buffers: "
+                                   (helm-buffer-list)
+                                   :name "Occur in buffer(s)"
+                                   :marked-candidates t))
+    (setq helm-moccur-always-search-in-current
+          (if (or current-prefix-arg
+                  helm-current-prefix-arg)
+              (not helm-moccur-always-search-in-current)
+            helm-moccur-always-search-in-current))
+    (helm-multi-occur-1 buf-list input)))
+
+
+(provide 'helm-regexp)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-regexp.el ends here
diff --git a/elpa/helm-20160217.958/helm-ring.el b/elpa/helm-20160217.958/helm-ring.el
new file mode 100644 (file)
index 0000000..eafb621
--- /dev/null
@@ -0,0 +1,470 @@
+;;; helm-ring.el --- kill-ring, mark-ring, and register browsers for helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-utils)
+(require 'helm-help)
+(require 'helm-elisp)
+
+(declare-function undo-tree-restore-state-from-register "ext:undo-tree.el" (register))
+
+\f
+(defgroup helm-ring nil
+  "Ring related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-kill-ring-threshold 3
+  "Minimum length of a candidate to be listed by `helm-source-kill-ring'."
+  :type 'integer
+  :group 'helm-ring)
+
+(defcustom helm-kill-ring-max-lines-number 5
+  "Max number of lines displayed per candidate in kill-ring browser.
+If nil or zero (disabled), don't truncate candidate, show all."
+  :type '(choice (const :tag "Disabled" nil)
+          (integer :tag "Max number of lines"))
+  :group 'helm-ring)
+
+(defcustom helm-register-max-offset 160
+  "Max size of string register entries before truncating."
+  :group 'helm-ring
+  :type  'integer)
+
+(defcustom helm-kill-ring-actions
+  '(("Yank" . helm-kill-ring-action)
+    ("Delete" . (lambda (_candidate)
+                  (cl-loop for cand in (helm-marked-candidates)
+                           do (setq kill-ring
+                                    (delete cand kill-ring))))))
+  "List of actions for kill ring source."
+  :group 'helm-ring
+  :type '(alist :key-type string :value-type function))
+
+\f
+;;; Kill ring
+;;
+;;
+(defvar helm-kill-ring-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-y") 'helm-next-line)
+    (define-key map (kbd "M-u") 'helm-previous-line)
+    map)
+  "Keymap for `helm-show-kill-ring'.")
+
+(defvar helm-source-kill-ring
+  (helm-build-sync-source "Kill Ring"
+    :init (lambda () (helm-attrset 'last-command last-command))
+    :candidates #'helm-kill-ring-candidates
+    :filtered-candidate-transformer #'helm-kill-ring-transformer
+    :action 'helm-kill-ring-actions
+    :persistent-action (lambda (_candidate) (ignore))
+    :persistent-help "DoNothing"
+    :keymap helm-kill-ring-map
+    :migemo t
+    :multiline t)
+  "Source for browse and insert contents of kill-ring.")
+
+(defun helm-kill-ring-candidates ()
+  (cl-loop for kill in (helm-fast-remove-dups kill-ring :test 'equal)
+        unless (or (< (length kill) helm-kill-ring-threshold)
+                   (string-match "\\`[\n[:blank:]]+\\'" kill))
+        collect kill))
+
+(defun helm-kill-ring-transformer (candidates _source)
+  "Display only the `helm-kill-ring-max-lines-number' lines of candidate."
+  (cl-loop for i in candidates
+           when (get-text-property 0 'read-only i)
+           do (set-text-properties 0 (length i) '(read-only nil) i)
+           for nlines = (with-temp-buffer (insert i) (count-lines (point-min) (point-max)))
+           if (and helm-kill-ring-max-lines-number
+                   (> nlines helm-kill-ring-max-lines-number))
+           collect (cons
+                    (with-temp-buffer
+                      (insert i)
+                      (goto-char (point-min))
+                      (concat
+                       (buffer-substring
+                        (point-min)
+                        (save-excursion
+                          (forward-line helm-kill-ring-max-lines-number)
+                          (point)))
+                       "[...]")) i)
+           else collect i))
+
+(defun helm-kill-ring-action (str)
+  "Insert STR in `kill-ring' and set STR to the head.
+If this action is executed just after `yank',
+replace with STR as yanked string."
+  (with-helm-current-buffer
+    (setq kill-ring (delete str kill-ring))
+    (if (not (eq (helm-attr 'last-command helm-source-kill-ring) 'yank))
+        (insert-for-yank str)
+      ;; from `yank-pop'
+      (let ((inhibit-read-only t)
+            (before (< (point) (mark t))))
+        (if before
+            (funcall (or yank-undo-function 'delete-region) (point) (mark t))
+          (funcall (or yank-undo-function 'delete-region) (mark t) (point)))
+        (setq yank-undo-function nil)
+        (set-marker (mark-marker) (point) helm-current-buffer)
+        (insert-for-yank str)
+        ;; Set the window start back where it was in the yank command,
+        ;; if possible.
+        (set-window-start (selected-window) yank-window-start t)
+        (when before
+          ;; This is like exchange-point-and-mark, but doesn't activate the mark.
+          ;; It is cleaner to avoid activation, even though the command
+          ;; loop would deactivate the mark because we inserted text.
+          (goto-char (prog1 (mark t)
+                       (set-marker (mark-marker) (point) helm-current-buffer))))))
+    (kill-new str)))
+
+\f
+;;;; <Mark ring>
+;; DO NOT use these sources with other sources use
+;; the commands `helm-mark-ring', `helm-global-mark-ring' or
+;; `helm-all-mark-rings' instead.
+
+(defun helm-mark-ring-line-string-at-pos (pos)
+  "Return line string at position POS."
+  (save-excursion
+    (goto-char pos)
+    (forward-line 0)
+    (let ((line (car (split-string (thing-at-point 'line) "[\n\r]"))))
+      (if (string= "" line)
+          "<EMPTY LINE>"
+        line))))
+
+(defun helm-mark-ring-get-candidates ()
+  (with-helm-current-buffer
+    (cl-loop with marks = (if (mark t) (cons (mark-marker) mark-ring) mark-ring)
+             for i in marks
+             with max-line-number = (line-number-at-pos (point-max))
+             with width = (length (number-to-string max-line-number))
+             for m = (format (concat "%" (number-to-string width) "d: %s")
+                             (line-number-at-pos i)
+                             (helm-mark-ring-line-string-at-pos i))
+             unless (and recip (member m recip))
+             collect m into recip
+             finally return recip)))
+
+(defvar helm-source-mark-ring
+  (helm-build-sync-source "mark-ring"
+    :candidates #'helm-mark-ring-get-candidates
+    :action '(("Goto line"
+               . (lambda (candidate)
+                   (helm-goto-line (string-to-number candidate))))) 
+    :persistent-action (lambda (candidate)
+                         (helm-goto-line (string-to-number candidate))
+                         (helm-highlight-current-line))
+    :persistent-help "Show this line"))
+
+;;; Global-mark-ring
+(defvar helm-source-global-mark-ring
+  (helm-build-sync-source "global-mark-ring"
+    :candidates #'helm-global-mark-ring-get-candidates
+    :action '(("Goto line"
+              . (lambda (candidate)
+                  (let ((items (split-string candidate ":")))
+                    (switch-to-buffer (cl-second items))
+                    (helm-goto-line (string-to-number (car items)))))))
+    :persistent-action (lambda (candidate)
+                         (let ((items (split-string candidate ":")))
+                           (switch-to-buffer (cl-second items))
+                           (helm-goto-line (string-to-number (car items)))
+                           (helm-highlight-current-line)))
+    :persistent-help "Show this line"))
+
+(defun helm-global-mark-ring-format-buffer (marker)
+  (with-current-buffer (marker-buffer marker)
+    (goto-char marker)
+    (forward-line 0)
+    (let ((line (pcase (thing-at-point 'line)
+                  ((and line (pred stringp)
+                        (guard (not (string-match-p "\\`\n?\\'" line))))
+                   (car (split-string line "[\n\r]")))
+                  (_ "<EMPTY LINE>"))))
+      (format "%7d:%s:    %s"
+              (line-number-at-pos) (marker-buffer marker) line))))
+
+(defun helm-global-mark-ring-get-candidates ()
+  (let ((marks global-mark-ring))
+    (when marks
+      (cl-loop for i in marks
+               for mb = (marker-buffer i)
+               for gm = (unless (or (string-match "^ " (format "%s" mb))
+                                    (null mb))
+                          (helm-global-mark-ring-format-buffer i))
+               when (and gm (not (member gm recip)))
+               collect gm into recip
+               finally return recip))))
+
+(defun helm--push-mark (&optional location nomsg activate)
+  "[Internal] Don't use directly, use instead `helm-push-mark-mode'."
+  (unless (null (mark t))
+    (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring))
+    (when (> (length mark-ring) mark-ring-max)
+      (move-marker (car (nthcdr mark-ring-max mark-ring)) nil)
+      (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil)))
+  (set-marker (mark-marker) (or location (point)) (current-buffer))
+  ;; Now push the mark on the global mark ring.
+  (setq global-mark-ring (cons (copy-marker (mark-marker))
+                               ;; Avoid having multiple entries
+                               ;; for same buffer in `global-mark-ring'.
+                               (cl-loop with mb = (current-buffer)
+                                        for m in global-mark-ring
+                                        for nmb = (marker-buffer m)
+                                        unless (eq mb nmb)
+                                        collect m)))
+  (when (> (length global-mark-ring) global-mark-ring-max)
+    (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) nil)
+    (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil))
+  (or nomsg executing-kbd-macro (> (minibuffer-depth) 0)
+      (message "Mark set"))
+  (when (or activate (not transient-mark-mode))
+    (set-mark (mark t)))
+  nil)
+
+(defadvice push-mark (around helm-push-mark-mode)
+  (helm--push-mark location nomsg activate))
+
+;;;###autoload
+(define-minor-mode helm-push-mark-mode
+    "Provide an improved version of `push-mark'.
+Modify the behavior of `push-mark' to update
+the `global-mark-ring' after each new visit."
+  :group 'helm-ring
+  :global t
+  (if helm-push-mark-mode
+      (if (fboundp 'advice-add)
+          (advice-add 'push-mark :override #'helm--push-mark)
+          (ad-activate 'push-mark))
+      (if (fboundp 'advice-remove)
+          (advice-remove 'push-mark #'helm--push-mark)
+          (ad-deactivate 'push-mark))))
+\f
+;;;; <Register>
+;;; Insert from register
+(defvar helm-source-register
+  (helm-build-sync-source "Registers"
+    :candidates #'helm-register-candidates
+    :action-transformer #'helm-register-action-transformer
+    :persistent-help ""
+    :multiline t
+    :action '(("Delete Register(s)" .
+               (lambda (_candidate)
+                 (cl-loop for candidate in (helm-marked-candidates)
+                          for register = (car candidate)
+                          do (setq register-alist
+                                (delq (assoc register register-alist)
+                                      register-alist)))))))
+  "See (info \"(emacs)Registers\")")
+
+(defun helm-register-candidates ()
+  "Collecting register contents and appropriate commands."
+  (cl-loop for (char . val) in register-alist
+        for key    = (single-key-description char)
+        for string-actions =
+        (cond
+          ((numberp val)
+           (list (int-to-string val)
+                 'insert-register
+                 'increment-register))
+          ((markerp val)
+           (let ((buf (marker-buffer val)))
+             (if (null buf)
+                 (list "a marker in no buffer")
+               (list (concat
+                      "a buffer position:"
+                      (buffer-name buf)
+                      ", position "
+                      (int-to-string (marker-position val)))
+                     'jump-to-register
+                     'insert-register))))
+          ((and (consp val) (window-configuration-p (car val)))
+           (list "window configuration."
+                 'jump-to-register))
+          ((and (vectorp val)
+                (fboundp 'undo-tree-register-data-p)
+                (undo-tree-register-data-p (elt val 1)))
+           (list
+            "Undo-tree entry."
+            'undo-tree-restore-state-from-register))
+          ((or (and (vectorp val) (eq 'registerv (aref val 0)))
+               (and (consp val) (frame-configuration-p (car val))))
+           (list "frame configuration."
+                 'jump-to-register))
+          ((and (consp val) (eq (car val) 'file))
+           (list (concat "file:"
+                         (prin1-to-string (cdr val))
+                         ".")
+                 'jump-to-register))
+          ((and (consp val) (eq (car val) 'file-query))
+           (list (concat "file:a file-query reference: file "
+                         (car (cdr val))
+                         ", position "
+                         (int-to-string (car (cdr (cdr val))))
+                         ".")
+                 'jump-to-register))
+          ((consp val)
+           (let ((lines (format "%4d" (length val))))
+             (list (format "%s: %s\n" lines
+                           (truncate-string-to-width
+                            (mapconcat 'identity (list (car val))
+                                       "^J") (- (window-width) 15)))
+                   'insert-register)))
+          ((stringp val)
+           (list
+            ;; without properties
+            (concat (substring-no-properties
+                     val 0 (min (length val) helm-register-max-offset))
+                    (if (> (length val) helm-register-max-offset)
+                        "[...]" ""))
+            'insert-register
+            'append-to-register
+            'prepend-to-register)))
+        unless (null string-actions) ; Fix Issue #1107.
+        collect (cons (format "Register %3s:\n %s" key (car string-actions))
+                      (cons char (cdr string-actions)))))
+
+(defun helm-register-action-transformer (actions register-and-functions)
+  "Decide actions by the contents of register."
+  (cl-loop with transformer-actions = nil
+           with func-actions =
+        '((insert-register
+           "Insert Register" .
+           (lambda (c) (insert-register (car c))))
+          (jump-to-register
+           "Jump to Register" .
+           (lambda (c) (jump-to-register (car c))))
+          (append-to-register
+           "Append Region to Register" .
+           (lambda (c) (append-to-register
+                        (car c) (region-beginning) (region-end))))
+          (prepend-to-register
+           "Prepend Region to Register" .
+           (lambda (c) (prepend-to-register
+                        (car c) (region-beginning) (region-end))))
+          (increment-register
+           "Increment Prefix Arg to Register" .
+           (lambda (c) (increment-register
+                        helm-current-prefix-arg (car c))))
+          (undo-tree-restore-state-from-register
+           "Restore Undo-tree register" .
+           (lambda (c) (and (fboundp 'undo-tree-restore-state-from-register)
+                            (undo-tree-restore-state-from-register (car c))))))
+        for func in (cdr register-and-functions)
+        for cell = (assq func func-actions)
+        when cell
+        do (push (cdr cell) transformer-actions)
+        finally return (append (nreverse transformer-actions) actions)))
+
+;;;###autoload
+(defun helm-mark-ring ()
+  "Preconfigured `helm' for `helm-source-mark-ring'."
+  (interactive)
+  (helm :sources 'helm-source-mark-ring
+        :resume 'noresume
+        :buffer "*helm mark*"))
+
+;;;###autoload
+(defun helm-global-mark-ring ()
+  "Preconfigured `helm' for `helm-source-global-mark-ring'."
+  (interactive)
+  (helm :sources 'helm-source-global-mark-ring
+        :resume 'noresume
+        :buffer "*helm global mark*"))
+
+;;;###autoload
+(defun helm-all-mark-rings ()
+  "Preconfigured `helm' for `helm-source-global-mark-ring' and \
+`helm-source-mark-ring'."
+  (interactive)
+  (helm :sources '(helm-source-mark-ring
+                   helm-source-global-mark-ring)
+        :resume 'noresume
+        :buffer "*helm mark ring*"))
+
+;;;###autoload
+(defun helm-register ()
+  "Preconfigured `helm' for Emacs registers."
+  (interactive)
+  (helm :sources 'helm-source-register
+        :resume 'noresume
+        :buffer "*helm register*"))
+
+;;;###autoload
+(defun helm-show-kill-ring ()
+  "Preconfigured `helm' for `kill-ring'.
+It is drop-in replacement of `yank-pop'.
+
+First call open the kill-ring browser, next calls move to next line."
+  (interactive)
+  (let ((enable-recursive-minibuffers t))
+    (helm :sources helm-source-kill-ring
+          :buffer "*helm kill ring*"
+          :resume 'noresume
+          :allow-nest t)))
+
+;;;###autoload
+(defun helm-execute-kmacro ()
+  "Preconfigured helm for keyboard macros.
+Define your macros with `f3' and `f4'.
+See (info \"(emacs) Keyboard Macros\") for detailed infos.
+This command is useful when used with persistent action."
+  (interactive)
+  (helm :sources
+        (helm-build-sync-source "Kmacro"
+          :candidates (lambda ()
+                        (helm-fast-remove-dups
+                         (cons (kmacro-ring-head)
+                               kmacro-ring)
+                         :test 'equal))
+          :multiline t
+          :candidate-transformer
+          (lambda (candidates)
+            (cl-loop for c in candidates collect
+                     (propertize (help-key-description (car c) nil)
+                                 'helm-realvalue c)))
+          :persistent-help "Execute kmacro"
+          :help-message 'helm-kmacro-help-message
+          :action
+          (helm-make-actions
+           "Execute kmacro (`C-u <n>' to execute <n> times)"
+           (lambda (candidate)
+             (interactive)
+             ;; Move candidate on top of list for next use.
+             (setq kmacro-ring (delete candidate kmacro-ring))
+             (kmacro-push-ring)
+             (kmacro-split-ring-element candidate)
+             (kmacro-exec-ring-item
+              candidate helm-current-prefix-arg))))
+        :buffer "*helm kmacro*"))
+
+(provide 'helm-ring)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-ring.el ends here
diff --git a/elpa/helm-20160217.958/helm-semantic.el b/elpa/helm-20160217.958/helm-semantic.el
new file mode 100644 (file)
index 0000000..1380182
--- /dev/null
@@ -0,0 +1,223 @@
+;;; helm-semantic.el --- Helm interface for Semantic -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Daniel Hackney <danNOSPAMhaxney.org>
+;; Author: Daniel Hackney <danNOSPAMhaxney.org>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Uses `candidates-in-buffer' for speed.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'semantic)
+(require 'helm-help)
+(require 'helm-imenu)
+
+(declare-function pulse-momentary-highlight-one-line "pulse.el" (point &optional face))
+
+(defgroup helm-semantic nil
+  "Semantic tags related libraries and applications for helm."
+  :group 'helm)
+
+(defcustom helm-semantic-lynx-style-map t
+  "Use Arrow keys to jump to occurences."
+  :group 'helm-semantic
+  :type  'boolean)
+
+(defcustom helm-semantic-display-style
+  '((python-mode . semantic-format-tag-summarize)
+    (c-mode . semantic-format-tag-concise-prototype-c-mode)
+    (emacs-lisp-mode . semantic-format-tag-abbreviate-emacs-lisp-mode))
+  "Function to present a semantic tag according to `major-mode'.
+
+It is an alist where the `car' of each element is a `major-mode' and
+the `cdr' a `semantic-format-tag-*' function.
+
+If no function is found for current `major-mode', fall back to
+`semantic-format-tag-summarize' default function.
+
+You can have more or less informations depending of the `semantic-format-tag-*'
+function you choose.
+
+All the supported functions are prefixed with \"semantic-format-tag-\",
+you have completion on these functions with `C-M i' in the customize interface."
+  :group 'helm-semantic
+  :type '(alist :key-type symbol :value-type symbol))
+
+;;; keymap
+(defvar helm-semantic-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (when helm-semantic-lynx-style-map
+      (define-key map (kbd "<left>")  'helm-maybe-exit-minibuffer)
+      (define-key map (kbd "<right>") 'helm-execute-persistent-action))
+    (delq nil map)))
+
+;; Internals vars
+(defvar helm-semantic--tags-cache nil)
+
+(defun helm-semantic--fetch-candidates (tags depth &optional class)
+  "Write the contents of TAGS to the current buffer."
+  (let ((class class) cur-type
+        (stylefn (or (with-helm-current-buffer
+                       (assoc-default major-mode helm-semantic-display-style))
+                     #'semantic-format-tag-summarize)))
+    (cl-dolist (tag tags)
+      (when (listp tag)
+        (cl-case (setq cur-type (semantic-tag-class tag))
+          ((function variable type)
+           (let ((spaces (make-string (* depth 2) ?\s))
+                 (type-p (eq cur-type 'type)))
+             (unless (and (> depth 0) (not type-p))
+               (setq class nil))
+             (insert
+              (if (and class (not type-p))
+                  (format "%s%s(%s) "
+                          spaces (if (< depth 2) "" "├►") class)
+                spaces)
+              ;; Save the tag for later
+              (propertize (funcall stylefn tag nil t)
+                          'semantic-tag tag)
+              "\n")
+             (and type-p (setq class (car tag)))
+             ;; Recurse to children
+             (unless (eq cur-type 'function)
+               (helm-semantic--fetch-candidates
+                (semantic-tag-components tag) (1+ depth) class))))
+
+          ;; Don't do anything with packages or includes for now
+          ((package include)
+           (insert
+            (propertize (funcall stylefn tag nil t)
+                        'semantic-tag tag)
+            "\n")
+           )
+          ;; Catch-all
+          (t))))))
+
+(defun helm-semantic-default-action (_candidate &optional persistent)
+  ;; By default, helm doesn't pass on the text properties of the selection.
+  ;; Fix this.
+  (helm-log-run-hook 'helm-goto-line-before-hook)
+  (with-current-buffer helm-buffer
+    (when (looking-at " ")
+      (goto-char (next-single-property-change
+                  (point-at-bol) 'semantic-tag nil (point-at-eol)))) 
+    (let ((tag (get-text-property (point) 'semantic-tag)))
+      (semantic-go-to-tag tag)
+      (unless persistent
+        (pulse-momentary-highlight-one-line (point))))))
+
+(defun helm-semantic--maybe-set-needs-update ()
+  (with-helm-current-buffer
+    (when (semantic-parse-tree-needs-update-p)
+      (semantic-parse-tree-set-needs-update))))
+
+(defvar helm-source-semantic nil)
+
+(defclass helm-semantic-source (helm-source-in-buffer)
+  ((init :initform (lambda ()
+                     (helm-semantic--maybe-set-needs-update)
+                     (setq helm-semantic--tags-cache (semantic-fetch-tags))
+                     (with-current-buffer (helm-candidate-buffer 'global)
+                       (let ((major-mode (with-helm-current-buffer major-mode)))
+                         (helm-semantic--fetch-candidates helm-semantic--tags-cache 0)))))
+   (get-line :initform 'buffer-substring)
+   (persistent-help :initform "Show this entry")
+   (keymap :initform 'helm-semantic-map)
+   (help-message :initform 'helm-semantic-help-message)
+   (persistent-action :initform (lambda (elm)
+                                  (helm-semantic-default-action elm t)
+                                  (helm-highlight-current-line)))
+   (action :initform 'helm-semantic-default-action)))
+
+(defcustom helm-semantic-fuzzy-match nil
+  "Enable fuzzy matching in `helm-source-semantic'."
+  :group 'helm-semantic
+  :type  'boolean
+  :set (lambda (var val)
+         (set var val)
+         (setq helm-source-semantic
+               (helm-make-source "Semantic Tags" 'helm-semantic-source
+                 :fuzzy-match helm-semantic-fuzzy-match))))
+
+;;;###autoload
+(defun helm-semantic (arg)
+  "Preconfigured `helm' for `semantic'.
+If ARG is supplied, pre-select symbol at point instead of current"
+  (interactive "P")
+  (let ((tag (helm-aif (semantic-current-tag-parent)
+                  (cons (format "\\_<%s\\_>" (car it))
+                        (format "\\_<%s\\_>" (car (semantic-current-tag))))
+                (format "\\_<%s\\_>" (car (semantic-current-tag))))))
+    (unless helm-source-semantic
+      (setq helm-source-semantic
+            (helm-make-source "Semantic Tags" 'helm-semantic-source
+              :fuzzy-match helm-semantic-fuzzy-match)))
+    (helm :sources 'helm-source-semantic
+          :candidate-number-limit 9999
+          :preselect (if arg
+                         (thing-at-point 'symbol)
+                       tag)
+          :buffer "*helm semantic*")))
+
+;;;###autoload
+(defun helm-semantic-or-imenu (arg)
+  "Preconfigured helm for `semantic' or `imenu'.
+If ARG is supplied, pre-select symbol at point instead of current
+semantic tag in scope.
+
+If `semantic-mode' is active in the current buffer, then use
+semantic for generating tags, otherwise fall back to `imenu'.
+Fill in the symbol at point by default."
+  (interactive "P")
+  (unless helm-source-semantic
+    (setq helm-source-semantic
+          (helm-make-source "Semantic Tags" 'helm-semantic-source
+            :fuzzy-match helm-semantic-fuzzy-match)))
+  (unless helm-source-imenu
+    (setq helm-source-imenu
+          (helm-make-source "Imenu" 'helm-imenu-source
+            :fuzzy-match helm-imenu-fuzzy-match)))
+  (let* ((source (if (semantic-active-p)
+                     'helm-source-semantic
+                     'helm-source-imenu))
+         (imenu-p (eq source 'helm-source-imenu))
+         (imenu-auto-rescan imenu-p)
+         (helm-execute-action-at-once-if-one
+          (and imenu-p
+               helm-imenu-execute-action-at-once-if-one))
+         (tag (helm-aif (semantic-current-tag-parent)
+                  (cons (format "\\_<%s\\_>" (car it))
+                        (format "\\_<%s\\_>" (car (semantic-current-tag))))
+                (format "\\_<%s\\_>" (car (semantic-current-tag))))))
+    (helm :sources source
+          :candidate-number-limit 9999
+          :preselect (if (or arg imenu-p)
+                         (thing-at-point 'symbol)
+                         tag)
+          :buffer "*helm semantic/imenu*")))
+
+(provide 'helm-semantic)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-semantic.el ends here
diff --git a/elpa/helm-20160217.958/helm-sys.el b/elpa/helm-20160217.958/helm-sys.el
new file mode 100644 (file)
index 0000000..4c94ff2
--- /dev/null
@@ -0,0 +1,300 @@
+;;; helm-sys.el --- System related functions for helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-utils)
+
+\f
+(defgroup helm-sys nil
+  "System related helm library."
+  :group 'helm)
+
+(defface helm-top-columns
+    '((t :inherit helm-header))
+  "Face for helm help string in minibuffer."
+  :group 'helm-sys)
+
+\f
+(defun helm-top-command-set-fn (var _value)
+  (set var
+       (cl-case system-type
+         (darwin "env COLUMNS=%s ps -axo pid,user,pri,nice,ucomm,tty,start,vsz,%%cpu,%%mem,etime,command")
+         (t      "env COLUMNS=%s top -b -n 1"))))
+
+(defcustom helm-top-command "env COLUMNS=%s top -b -n 1"
+  "Top command used to display output of top.
+To use top command, a version supporting batch mode (-b option) is needed.
+On Mac OSX top command doesn't support this, so ps command
+is used by default instead.
+If you modify this the number and order of elements displayed
+should be the same as top command to have the sort commands
+working properly, that is 12 elements with the 2 first being
+PID and USER and the last 4 being %CPU, %MEM, TIME and COMMAND.
+A format string where %s will be replaced with `frame-width'."
+  :group 'helm-sys
+  :type 'string
+  :set  'helm-top-command-set-fn)
+
+\f
+;;; Top (process)
+;;
+;;
+(defvar helm-top-sort-fn nil)
+(defvar helm-top-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-P")   'helm-top-run-sort-by-cpu)
+    (define-key map (kbd "M-C")   'helm-top-run-sort-by-com)
+    (define-key map (kbd "M-M")   'helm-top-run-sort-by-mem)
+    (define-key map (kbd "M-U")   'helm-top-run-sort-by-user)
+    map))
+
+(defvar helm-source-top
+  (helm-build-in-buffer-source "Top"
+    :header-name (lambda (name) (concat name " (Press C-c C-u to refresh)"))
+    :init #'helm-top-init
+    :nomark t
+    :display-to-real #'helm-top-display-to-real
+    :persistent-action #'helm-top-sh-persistent-action
+    :persistent-help "SIGTERM"
+    :help-message 'helm-top-help-message
+    :follow 'never
+    :keymap helm-top-map
+    :filtered-candidate-transformer #'helm-top-sort-transformer
+    :action-transformer #'helm-top-action-transformer))
+
+(defun helm-top-transformer (candidates _source)
+  "Transformer for `helm-top'.
+Return empty string for non--valid candidates."
+  (cl-loop for disp in candidates collect
+        (cond ((string-match "^ *[0-9]+" disp) disp)
+              ((string-match "^ *PID" disp)
+               (cons (propertize disp 'face 'helm-top-columns) ""))
+              (t (cons disp "")))))
+
+(defun helm-top-action-transformer (actions _candidate)
+  "Action transformer for `top'.
+Show actions only on line starting by a PID."
+  (let ((disp (helm-get-selection nil t)))
+    (cond ((string-match "^ *[0-9]+" disp)
+           (list '("kill (SIGTERM)" . (lambda (pid) (helm-top-sh "TERM" pid)))
+                 '("kill (SIGKILL)" . (lambda (pid) (helm-top-sh "KILL" pid)))
+                 '("kill (SIGINT)" .  (lambda (pid) (helm-top-sh "INT" pid)))
+                 '("kill (Choose signal)"
+                   . (lambda (pid)
+                       (helm-top-sh
+                        (helm-comp-read (format "Kill [%s] with signal: " pid)
+                                        '("ALRM" "HUP" "INT" "KILL" "PIPE" "POLL"
+                                          "PROF" "TERM" "USR1" "USR2" "VTALRM"
+                                          "STKFLT" "PWR" "WINCH" "CHLD" "URG"
+                                          "TSTP" "TTIN" "TTOU" "STOP" "CONT"
+                                          "ABRT" "FPE" "ILL" "QUIT" "SEGV"
+                                          "TRAP" "SYS" "EMT" "BUS" "XCPU" "XFSZ")
+                                        :must-match t)
+                        pid)))))
+          (t actions))))
+
+(defun helm-top-sh (sig pid)
+  "Run kill shell command with signal SIG on PID for `helm-top'."
+  (let ((cmd (format "kill -%s %s" sig pid)))
+    (message "Executed %s\n%s" cmd (shell-command-to-string cmd))))
+
+(defun helm-top-sh-persistent-action (pid)
+  (delete-other-windows)
+  (helm-top-sh "TERM" pid)
+  (helm-force-update))
+
+(defun helm-top-init ()
+  "Insert output of top command in candidate buffer."
+  (unless helm-top-sort-fn (helm-top-set-mode-line "CPU"))
+  (with-current-buffer (helm-candidate-buffer 'global)
+    (call-process-shell-command
+     (format helm-top-command (frame-width))
+     nil (current-buffer))))
+
+(defun helm-top-display-to-real (line)
+  "Return pid only from LINE."
+  (car (split-string line)))
+
+;; Sort top command
+
+(defun helm-top-set-mode-line (str)
+  (if (string-match "Sort:\\[\\(.*\\)\\] " helm-top-mode-line)
+      (setq helm-top-mode-line (replace-match str nil nil helm-top-mode-line 1))
+    (setq helm-top-mode-line (concat (format "Sort:[%s] " str) helm-top-mode-line))))
+
+(defun helm-top-sort-transformer (candidates source)
+  (helm-top-transformer
+   (if helm-top-sort-fn
+       (cl-loop for c in candidates
+                if (string-match "^ *[0-9]+" c)
+                collect c into pid-cands
+                else collect c into header-cands
+                finally return (append
+                                header-cands
+                                (sort pid-cands helm-top-sort-fn)))
+       candidates)
+   source))
+
+(defun helm-top-sort-by-com (s1 s2)
+  (let* ((split-1 (split-string s1))
+         (split-2 (split-string s2))
+         (com-1 (nth 11 split-1))
+         (com-2 (nth 11 split-2)))
+    (string< com-1 com-2)))
+
+(defun helm-top-sort-by-mem (s1 s2)
+  (let* ((split-1 (split-string s1))
+         (split-2 (split-string s2))
+         (mem-1 (string-to-number (nth 9 split-1)))
+         (mem-2 (string-to-number (nth 9 split-2))))
+    (> mem-1 mem-2)))
+
+(defun helm-top-sort-by-user (s1 s2)
+  (let* ((split-1 (split-string s1))
+         (split-2 (split-string s2))
+         (user-1 (nth 1 split-1))
+         (user-2 (nth 1 split-2)))
+    (string< user-1 user-2)))
+
+(defun helm-top-run-sort-by-com ()
+  (interactive)
+  (helm-top-set-mode-line "COM")
+  (setq helm-top-sort-fn 'helm-top-sort-by-com)
+  (helm-force-update))
+
+(defun helm-top-run-sort-by-cpu ()
+  (interactive)
+  (helm-top-set-mode-line "CPU")
+  (setq helm-top-sort-fn nil)
+  (helm-force-update))
+
+(defun helm-top-run-sort-by-mem ()
+  (interactive)
+  (helm-top-set-mode-line "MEM")
+  (setq helm-top-sort-fn 'helm-top-sort-by-mem)
+  (helm-force-update))
+
+(defun helm-top-run-sort-by-user ()
+  (interactive)
+  (helm-top-set-mode-line "USER")
+  (setq helm-top-sort-fn 'helm-top-sort-by-user)
+  (helm-force-update))
+
+\f
+;;; X RandR resolution change
+;;
+;;
+;;; FIXME I do not care multi-display.
+
+(defun helm-xrandr-info ()
+  "Return a pair with current X screen number and current X display name."
+  (with-temp-buffer
+    (call-process "xrandr" nil (current-buffer) nil
+                  "--current")
+    (let (screen output)
+      (goto-char (point-min))
+      (save-excursion
+        (when (re-search-forward "\\(^Screen \\)\\([0-9]\\):" nil t)
+          (setq screen (match-string 2))))
+      (when (re-search-forward "^\\(.*\\) connected" nil t)
+        (setq output (match-string 1)))
+      (list screen output))))
+
+(defun helm-xrandr-screen ()
+  "Return current X screen number."
+  (car (helm-xrandr-info)))
+
+(defun helm-xrandr-output ()
+  "Return current X display name."
+  (cadr (helm-xrandr-info)))
+
+(defvar helm-source-xrandr-change-resolution
+  '((name . "Change Resolution")
+    (candidates
+     . (lambda ()
+         (with-temp-buffer
+           (call-process "xrandr" nil (current-buffer) nil
+                         "--screen" (helm-xrandr-screen) "-q")
+           (goto-char 1)
+           (cl-loop with modes = nil
+                 while (re-search-forward "   \\([0-9]+x[0-9]+\\)" nil t)
+                 for mode = (match-string 1)
+                 unless (member mode modes)
+                 collect mode into modes
+                 finally return modes))))
+    (action
+     ("Change Resolution"
+      . (lambda (mode)
+          (call-process "xrandr" nil nil nil
+                        "--screen" (helm-xrandr-screen)
+                        "--output" (helm-xrandr-output)
+                        "--mode" mode))))))
+
+\f
+;;; Emacs process
+;;
+;;
+(defvar helm-source-emacs-process
+  '((name . "Emacs Process")
+    (init . (lambda () (list-processes--refresh)))
+    (candidates . (lambda () (mapcar #'process-name (process-list))))
+    (persistent-action . (lambda (elm)
+                           (delete-process (get-process elm))
+                           (helm-delete-current-selection)))
+    (persistent-help . "Kill Process")
+    (action ("Kill Process" . (lambda (elm)
+                                (delete-process (get-process elm)))))))
+
+\f
+;;;###autoload
+(defun helm-top ()
+  "Preconfigured `helm' for top command."
+  (interactive)
+  (save-window-excursion
+    (unless helm-alive-p (delete-other-windows))
+    (helm :sources 'helm-source-top
+          :buffer "*helm top*" :full-frame t
+          :candidate-number-limit 9999
+          :preselect "^\\s-*[0-9]+")))
+
+;;;###autoload
+(defun helm-list-emacs-process ()
+  "Preconfigured `helm' for emacs process."
+  (interactive)
+  (helm-other-buffer 'helm-source-emacs-process "*helm process*"))
+
+;;;###autoload
+(defun helm-xrandr-set ()
+  "Preconfigured helm for xrandr."
+  (interactive)
+  (helm :sources 'helm-source-xrandr-change-resolution
+        :buffer "*helm xrandr*"))
+
+(provide 'helm-sys)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-sys.el ends here
diff --git a/elpa/helm-20160217.958/helm-tags.el b/elpa/helm-20160217.958/helm-tags.el
new file mode 100644 (file)
index 0000000..99b6fce
--- /dev/null
@@ -0,0 +1,345 @@
+;;; helm-tags.el --- Helm for Etags. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'helm-utils)
+(require 'helm-grep)
+
+\f
+(defgroup helm-tags nil
+  "Tags related Applications and libraries for Helm."
+  :group 'helm)
+
+(defcustom helm-etags-tag-file-name "TAGS"
+  "Etags tag file name."
+  :type  'string
+  :group 'helm-tags)
+
+(defcustom helm-etags-tag-file-search-limit 10
+  "The limit level of directory to search tag file.
+Don't search tag file deeply if outside this value."
+  :type  'number
+  :group 'helm-tags)
+
+(defcustom helm-etags-match-part-only 'tag
+  "Allow choosing the tag part of CANDIDATE in `helm-source-etags-select'.
+A tag looks like this:
+    filename: \(defun foo
+You can choose matching against only end part of tag (i.e \"foo\"),
+against only the tag part (i.e \"(defun foo\"),
+or against the whole candidate (i.e \"(filename: (defun foo\")."
+  :type '(choice
+          (const :tag "Match only tag" tag)
+          (const :tag "Match last part of tag" endtag)
+          (const :tag "Match all file+tag" all))
+  :group 'helm-tags)
+
+(defcustom helm-etags-execute-action-at-once-if-one t
+  "Whether to jump straight to the selected tag if there's only
+one match."
+  :type 'boolean
+  :group 'helm-tags)
+
+\f
+(defgroup helm-tags-faces nil
+  "Customize the appearance of helm-tags faces."
+  :prefix "helm-"
+  :group 'helm-tags
+  :group 'helm-faces)
+
+(defface helm-etags-file
+    '((t (:foreground "Lightgoldenrod4"
+          :underline t)))
+  "Face used to highlight etags filenames."
+  :group 'helm-tags-faces)
+
+\f
+;;; Etags
+;;
+;;
+(defun helm-etags-run-switch-other-window ()
+  "Run switch to other window action from `helm-source-etags-select'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action
+     (lambda (c)
+       (helm-etags-action-goto 'find-file-other-window c)))))
+(put 'helm-etags-run-switch-other-window 'helm-only t)
+
+(defun helm-etags-run-switch-other-frame ()
+  "Run switch to other frame action from `helm-source-etags-select'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-exit-and-execute-action
+     (lambda (c)
+       (helm-etags-action-goto 'find-file-other-frame c)))))
+(put 'helm-etags-run-switch-other-frame 'helm-only t)
+
+(defvar helm-etags-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (define-key map (kbd "M-<down>") 'helm-goto-next-file)
+    (define-key map (kbd "M-<up>")   'helm-goto-precedent-file)
+    (define-key map (kbd "C-w")      'helm-yank-text-at-point)
+    (define-key map (kbd "C-c o")    'helm-etags-run-switch-other-window)
+    (define-key map (kbd "C-c C-o")  'helm-etags-run-switch-other-frame)
+    map)
+  "Keymap used in Etags.")
+
+(defvar helm-etags-mtime-alist nil
+  "Store the last modification time of etags files here.")
+(defvar helm-etags-cache (make-hash-table :test 'equal)
+  "Cache content of etags files used here for faster access.")
+
+(defun helm-etags-get-tag-file (&optional directory)
+  "Return the path of etags file if found.
+Lookes recursively in parents directorys for a
+`helm-etags-tag-file-name' file."
+  ;; Get tag file from `default-directory' or upper directory.
+  (let ((current-dir (helm-etags-find-tag-file-directory
+                      (or directory default-directory))))
+    ;; Return nil if not find tag file.
+    (when current-dir
+      (expand-file-name helm-etags-tag-file-name current-dir))))
+
+(defun helm-etags-all-tag-files ()
+  "Return files from the following sources;
+  1) An automatically located file in the parent directories, by `helm-etags-get-tag-file'.
+  2) `tags-file-name', which is commonly set by `find-tag' command.
+  3) `tags-table-list' which is commonly set by `visit-tags-table' command."
+  (helm-fast-remove-dups
+   (delq nil
+         (append (list (helm-etags-get-tag-file)
+                       tags-file-name)
+                 tags-table-list))
+   :test 'equal))
+
+(defun helm-etags-find-tag-file-directory (current-dir)
+  "Try to find the directory containing tag file.
+If not found in CURRENT-DIR search in upper directory."
+  (let ((file-exists? (lambda (dir)
+                          (let ((tag-path (expand-file-name
+                                           helm-etags-tag-file-name dir)))
+                            (and (stringp tag-path)
+                                 (file-regular-p tag-path)
+                                 (file-readable-p tag-path))))))
+    (cl-loop with count = 0
+          until (funcall file-exists? current-dir)
+          ;; Return nil if outside the value of
+          ;; `helm-etags-tag-file-search-limit'.
+          if (= count helm-etags-tag-file-search-limit)
+          do (cl-return nil)
+          ;; Or search upper directories.
+          else
+          do (cl-incf count)
+          (setq current-dir (expand-file-name (concat current-dir "../")))
+          finally return current-dir)))
+
+(defun helm-etags-get-header-name (_x)
+  "Create header name for this helm etags session."
+  (concat "Etags in "
+          (with-helm-current-buffer
+            (helm-etags-get-tag-file))))
+
+(defun helm-etags-create-buffer (file)
+  "Create the `helm-buffer' based on contents of etags tag FILE."
+  (let* (max
+         (split (with-temp-buffer
+                  (insert-file-contents file)
+                  (prog1
+                      (split-string (buffer-string) "\n" 'omit-nulls)
+                    (setq max (line-number-at-pos (point-max))))))
+         (progress-reporter (make-progress-reporter "Loading tag file..." 0 max)))
+    (cl-loop
+          with fname
+          with cand
+          for i in split for count from 0
+          for elm = (unless (string-match "^\x0c" i)    ;; "^L"
+                      (helm-aif (string-match "\177" i) ;; "^?"
+                          (substring i 0 it)
+                        i))
+          for linum = (when (string-match "[0-9]+,?[0-9]*$" i)
+                        (car (split-string (match-string 0 i) ",")))
+          do (cond ((and elm (string-match "^\\([^,]+\\),[0-9]+$" elm))
+                    (setq fname (propertize (match-string 1 elm)
+                                            'face 'helm-etags-file)))
+                   (elm (setq cand (format "%s:%s:%s" fname linum elm)))
+                   (t (setq cand nil)))
+          when cand do (progn
+                         (insert (propertize (concat cand "\n") 'linum linum))
+                         (progress-reporter-update progress-reporter count)))))
+
+(defun helm-etags-init ()
+  "Feed `helm-buffer' using `helm-etags-cache' or tag file.
+If no entry in cache, create one."
+  (let ((tagfiles (helm-etags-all-tag-files)))
+    (when tagfiles
+      (with-current-buffer (helm-candidate-buffer 'global)
+        (dolist (f tagfiles)
+          (helm-aif (gethash f helm-etags-cache)
+              ;; An entry is present in cache, insert it.
+              (insert it)
+            ;; No entry, create a new buffer using content of tag file (slower).
+            (helm-etags-create-buffer f)
+            ;; Store content of buffer in cache.
+            (puthash f (buffer-string) helm-etags-cache)
+            ;; Store or set the last modification of tag file.
+            (helm-aif (assoc f helm-etags-mtime-alist)
+                ;; If an entry exists modify it.
+                (setcdr it (helm-etags-mtime f))
+              ;; No entry create a new one.
+              (add-to-list 'helm-etags-mtime-alist
+                           (cons f (helm-etags-mtime f))))))))))
+
+(defvar helm-source-etags-select nil
+  "Helm source for Etags.")
+
+(defun helm-etags-build-source ()
+  (helm-build-in-buffer-source "Etags"
+    :header-name 'helm-etags-get-header-name
+    :init 'helm-etags-init
+    :get-line 'buffer-substring
+    :match-part (lambda (candidate)
+                  ;; Match only the tag part of CANDIDATE
+                  ;; and not the filename.
+                  (cl-ecase helm-etags-match-part-only
+                      (endtag (cadr (split-string
+                                     (cl-caddr (helm-grep-split-line candidate)))))
+                      (tag    (cl-caddr (helm-grep-split-line candidate)))
+                      (all    candidate)))
+    :fuzzy-match helm-etags-fuzzy-match
+    :help-message 'helm-etags-help-message
+    :keymap helm-etags-map
+    :action '(("Go to tag" . (lambda (c)
+                               (helm-etags-action-goto 'find-file c)))
+              ("Go to tag in other window" . (lambda (c)
+                                               (helm-etags-action-goto
+                                                'find-file-other-window
+                                                c)))
+              ("Go to tag in other frame" . (lambda (c)
+                                              (helm-etags-action-goto
+                                               'find-file-other-frame
+                                               c))))
+    :persistent-help "Go to line"
+    :persistent-action (lambda (candidate)
+                         (helm-etags-action-goto 'find-file candidate)
+                         (helm-highlight-current-line))))
+
+(defcustom helm-etags-fuzzy-match nil
+  "Use fuzzy matching in `helm-etags-select'."
+  :group 'helm-tags
+  :type 'boolean
+  :set (lambda (var val)
+         (set var val)
+         (setq helm-source-etags-select
+                (helm-etags-build-source))))
+
+(defvar find-tag-marker-ring)
+
+(defun helm-etags-action-goto (switcher candidate)
+  "Helm default action to jump to an etags entry in other window."
+  (require 'etags)
+  (helm-log-run-hook 'helm-goto-line-before-hook)
+  (let* ((split (helm-grep-split-line candidate))
+         (fname (cl-loop for tagf being the hash-keys of helm-etags-cache
+                      for f = (expand-file-name
+                               (car split) (file-name-directory tagf))
+                      when (file-exists-p f)
+                      return f))
+         (elm   (cl-caddr split))
+         (linum (string-to-number (cadr split))))
+    (if (null fname)
+        (error "file %s not found" fname)
+      (ring-insert find-tag-marker-ring (point-marker))
+      (funcall switcher fname)
+      (helm-goto-line linum t)
+      (when (search-forward elm nil t)
+        (goto-char (match-beginning 0))))))
+
+(defun helm-etags-mtime (file)
+  "Last modification time of etags tag FILE."
+  (cadr (nth 5 (file-attributes file))))
+
+(defun helm-etags-file-modified-p (file)
+  "Check if tag FILE have been modified in this session.
+If FILE is nil return nil."
+  (let ((last-modif (and file
+                         (assoc-default file helm-etags-mtime-alist))))
+    (and last-modif
+         (/= last-modif (helm-etags-mtime file)))))
+
+;;;###autoload
+(defun helm-etags-select (reinit)
+  "Preconfigured helm for etags.
+If called with a prefix argument REINIT
+or if any of the tag files have been modified, reinitialize cache.
+
+This function aggregates three sources of tag files:
+
+  1) An automatically located file in the parent directories,
+     by `helm-etags-get-tag-file'.
+  2) `tags-file-name', which is commonly set by `find-tag' command.
+  3) `tags-table-list' which is commonly set by `visit-tags-table' command."
+  (interactive "P")
+  (let ((tag-files (helm-etags-all-tag-files))
+        (helm-execute-action-at-once-if-one
+         helm-etags-execute-action-at-once-if-one)
+        (str (if (region-active-p)
+                 (buffer-substring-no-properties
+                  (region-beginning) (region-end))
+                 ;; Use a raw syntax-table to determine tap.
+                 ;; This may be wrong when calling etags
+                 ;; with hff from a buffer that use
+                 ;; a different syntax, but most of the time it
+                 ;; should be better.
+                 (with-syntax-table (standard-syntax-table)
+                   (thing-at-point 'symbol)))))
+    (if (cl-notany 'file-exists-p tag-files)
+        (message "Error: No tag file found.\
+Create with etags shell command, or visit with `find-tag' or `visit-tags-table'.")
+        (cl-loop for k being the hash-keys of helm-etags-cache
+                 unless (member k tag-files)
+                 do (remhash k helm-etags-cache))
+        (mapc (lambda (f)
+                (when (or (equal reinit '(4))
+                          (and helm-etags-mtime-alist
+                               (helm-etags-file-modified-p f)))
+                  (remhash f helm-etags-cache)))
+              tag-files)
+        (unless helm-source-etags-select
+          (setq helm-source-etags-select
+                (helm-etags-build-source)))
+        (helm :sources 'helm-source-etags-select
+              :keymap helm-etags-map
+              :default (if helm-etags-fuzzy-match
+                           str
+                           (list (concat "\\_<" str "\\_>") str))
+              :buffer "*helm etags*"))))
+
+(provide 'helm-tags)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-tags.el ends here
diff --git a/elpa/helm-20160217.958/helm-types.el b/elpa/helm-20160217.958/helm-types.el
new file mode 100644 (file)
index 0000000..9c5755c
--- /dev/null
@@ -0,0 +1,277 @@
+;;; helm-types.el --- Helm types classes and methods. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015  Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; Author: Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+;; URL: http://github.com/emacs-helm/helm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'eieio)
+
+\f
+;;  Files
+(defclass helm-type-file (helm-source) ()
+  "A class to define helm type file.")
+
+(defmethod helm-source-get-action-from-type ((object helm-type-file))
+  (slot-value object 'action))
+
+(defun helm-actions-from-type-file ()
+  (let ((source (make-instance 'helm-type-file)))
+    (helm--setup-source source)
+    (helm-source-get-action-from-type source)))
+
+(defcustom helm-type-file-actions
+  (helm-make-actions
+    "Find file"                             'helm-find-many-files
+    "Find file as root"                     'helm-find-file-as-root
+    "Find file other window"                'helm-find-files-other-window
+    "Find file other frame"                 'find-file-other-frame
+    "Open dired in file's directory"        'helm-open-dired
+    "Grep File(s) `C-u recurse'"            'helm-find-files-grep
+    "Zgrep File(s) `C-u Recurse'"           'helm-ff-zgrep
+    "Pdfgrep File(s)"                       'helm-ff-pdfgrep
+    "Insert as org link"                    'helm-files-insert-as-org-link
+    "Checksum File"                         'helm-ff-checksum
+    "Ediff File"                            'helm-find-files-ediff-files
+    "Ediff Merge File"                      'helm-find-files-ediff-merge-files
+    "Etags `M-., C-u reload tag file'"      'helm-ff-etags-select
+    "View file"                             'view-file
+    "Insert file"                           'insert-file
+    "Add marked files to file-cache"        'helm-ff-cache-add-file
+    "Delete file(s)"                        'helm-delete-marked-files
+    "Copy file(s) `M-C, C-u to follow'"     'helm-find-files-copy
+    "Rename file(s) `M-R, C-u to follow'"   'helm-find-files-rename
+    "Symlink files(s) `M-S, C-u to follow'" 'helm-find-files-symlink
+    "Relsymlink file(s) `C-u to follow'"    'helm-find-files-relsymlink
+    "Hardlink file(s) `M-H, C-u to follow'" 'helm-find-files-hardlink
+    "Open file externally (C-u to choose)"  'helm-open-file-externally
+    "Open file with default tool"           'helm-open-file-with-default-tool
+    "Find file in hex dump"                 'hexl-find-file)
+  "Default actions for type files."
+  :group 'helm-files
+  :type '(alist :key-type string :value-type function))
+
+(defmethod helm--setup-source :primary ((_source helm-type-file)))
+
+(defmethod helm--setup-source :before ((source helm-type-file))
+  (set-slot-value source 'action 'helm-type-file-actions)
+  (set-slot-value source 'persistent-help "Show this file")
+  (set-slot-value source 'action-transformer '(helm-transform-file-load-el
+                                               helm-transform-file-browse-url
+                                               helm-transform-file-cache))
+  (set-slot-value source 'candidate-transformer '(helm-skip-boring-files
+                                                  helm-highlight-files
+                                                  helm-w32-pathname-transformer))
+  (set-slot-value source 'help-message 'helm-generic-file-help-message)
+  (set-slot-value source 'keymap helm-generic-files-map))
+
+\f
+;; Bookmarks
+(defclass helm-type-bookmark (helm-source) ()
+  "A class to define type bookmarks.")
+
+(defcustom helm-type-bookmark-actions
+  (helm-make-actions
+   "Jump to bookmark" 'helm-bookmark-jump
+   "Jump to BM other window" 'helm-bookmark-jump-other-window
+   "Bookmark edit annotation" 'bookmark-edit-annotation
+   "Bookmark show annotation" 'bookmark-show-annotation
+   "Delete bookmark(s)" 'helm-delete-marked-bookmarks
+   "Edit Bookmark" 'helm-bookmark-edit-bookmark
+   "Rename bookmark" 'helm-bookmark-rename
+   "Relocate bookmark" 'bookmark-relocate)
+  "Default actions for type bookmarks."
+  :group 'helm-bookmark
+  :type '(alist :key-type string
+                   :value-type function))
+
+(defmethod helm-source-get-action-from-type ((object helm-type-bookmark))
+  (slot-value object 'action))
+
+(defmethod helm--setup-source :primary ((_source helm-type-bookmark)))
+
+(defmethod helm--setup-source :before ((source helm-type-bookmark))
+  (set-slot-value source 'action 'helm-type-bookmark-actions)
+  (set-slot-value source 'keymap helm-bookmark-map)
+  (set-slot-value source 'help-message 'helm-bookmark-help-message)
+  (set-slot-value source 'migemo t))
+
+\f
+;; Buffers
+(defclass helm-type-buffer (helm-source) ()
+  "A class to define type buffer.")
+
+(defcustom helm-type-buffer-actions
+  (helm-make-actions
+   "Switch to buffer(s)" 'helm-switch-to-buffers
+   (lambda () (and (locate-library "popwin")
+                   "Switch to buffer in popup window"))
+   'popwin:popup-buffer
+   "Switch to buffer(s) other window `C-c o'"
+   'helm-switch-to-buffers-other-window
+   "Switch to buffer other frame `C-c C-o'"
+   'switch-to-buffer-other-frame
+   (lambda () (and (locate-library "elscreen")
+                   "Display buffer in Elscreen"))
+   'helm-find-buffer-on-elscreen
+   "Query replace regexp `C-M-%'"
+   'helm-buffer-query-replace-regexp
+   "Query replace `M-%'" 'helm-buffer-query-replace
+   "View buffer" 'view-buffer
+   "Display buffer" 'display-buffer
+   "Grep buffers `M-g s' (C-u grep all buffers)"
+   'helm-zgrep-buffers
+   "Multi occur buffer(s) `C-s'" 'helm-multi-occur-as-action
+   "Revert buffer(s) `M-U'" 'helm-revert-marked-buffers
+   "Insert buffer" 'insert-buffer
+   "Kill buffer(s) `M-D'" 'helm-kill-marked-buffers
+   "Diff with file `C-='" 'diff-buffer-with-file
+   "Ediff Marked buffers `C-c ='" 'helm-ediff-marked-buffers
+   "Ediff Merge marked buffers `M-='"
+   (lambda (candidate)
+     (helm-ediff-marked-buffers candidate t)))
+  "Default actions for type buffers."
+  :group 'helm-buffers
+  :type '(alist :key-type string :value-type function))
+
+(defmethod helm-source-get-action-from-type ((object helm-type-buffer))
+  (slot-value object 'action))
+
+(defmethod helm--setup-source :primary ((_source helm-type-buffer)))
+
+(defmethod helm--setup-source :before ((source helm-type-buffer))
+  (set-slot-value source 'action 'helm-type-buffer-actions)
+  (set-slot-value source 'persistent-help "Show this buffer")
+  (set-slot-value
+   source 'filtered-candidate-transformer
+   '(helm-skip-boring-buffers
+     helm-buffers-sort-transformer
+     helm-highlight-buffers)))
+\f
+;; Functions
+(defclass helm-type-function (helm-source) ()
+  "A class to define helm type function.")
+
+(defcustom helm-type-function-actions
+  (helm-make-actions
+   "Describe command" 'describe-function
+   "Add command to kill ring" 'helm-kill-new
+   "Go to command's definition" 'find-function
+   "Debug on entry" 'debug-on-entry
+   "Cancel debug on entry" 'cancel-debug-on-entry
+   "Trace function" 'trace-function
+   "Trace function (background)" 'trace-function-background
+   "Untrace function" 'untrace-function)
+    "Default actions for type functions."
+  :group 'helm-elisp
+  :type '(alist :key-type string :value-type function))
+
+(defmethod helm-source-get-action-from-type ((object helm-type-function))
+  (slot-value object 'action))
+
+(defun helm-actions-from-type-function ()
+  (let ((source (make-instance 'helm-type-function)))
+    (helm--setup-source source)
+    (helm-source-get-action-from-type source)))
+
+(defmethod helm--setup-source :primary ((_source helm-type-function)))
+
+(defmethod helm--setup-source :before ((source helm-type-function))
+  (set-slot-value source 'action 'helm-type-function-actions)
+  (set-slot-value source 'action-transformer
+                  'helm-transform-function-call-interactively)
+  (set-slot-value source 'candidate-transformer
+                  'helm-mark-interactive-functions)
+  (set-slot-value source 'coerce 'helm-symbolify))
+
+\f
+;; Commands
+(defclass helm-type-command (helm-source) ()
+  "A class to define helm type command.")
+
+(defun helm-actions-from-type-command ()
+  (let ((source (make-instance 'helm-type-command)))
+    (helm--setup-source source)
+    (helm-source-get-action-from-type source)))
+
+(defcustom helm-type-command-actions
+  (append (helm-make-actions
+           "Call interactively" 'helm-call-interactively)
+          (helm-actions-from-type-function))
+  "Default actions for type command."
+  :group 'helm-command
+  :type '(alist :key-type string :value-type function))
+
+(defmethod helm--setup-source :primary ((_source helm-type-command)))
+
+(defmethod helm--setup-source :before ((source helm-type-command))
+  (set-slot-value
+   source 'action 'helm-type-command-actions)
+  (set-slot-value source 'coerce 'helm-symbolify)
+  (set-slot-value source 'persistent-action 'describe-function))
+
+;; Timers
+(defclass helm-type-timers (helm-source) ()
+  "A class to define helm type timers.")
+
+(defcustom helm-type-timers-actions
+  '(("Cancel Timer" . (lambda (_timer)
+                        (let ((mkd (helm-marked-candidates)))
+                          (cl-loop for timer in mkd
+                                   do (cancel-timer timer)))))
+    ("Describe Function" . (lambda (tm)
+                             (describe-function (timer--function tm))))
+    ("Find Function" . (lambda (tm)
+                         (helm-aif (timer--function tm)
+                             (if (byte-code-function-p it)
+                                 (message "Can't find anonymous function `%s'" it)
+                                 (find-function it))))))
+  "Default actions for type timers."
+  :group 'helm-elisp
+  :type '(alist :key-type string :value-type function))
+
+(defmethod helm--setup-source :primary ((_source helm-type-timers)))
+
+(defmethod helm--setup-source :before ((source helm-type-timers))
+  (set-slot-value source 'action 'helm-type-timers-actions)
+  (set-slot-value source 'persistent-action
+                  (lambda (tm)
+                    (describe-function (timer--function tm))))
+  (set-slot-value source 'persistent-help "Describe Function"))
+\f
+;; Builders.
+(defun helm-build-type-file ()
+  (helm-make-type 'helm-type-file))
+
+(defun helm-build-type-function ()
+  (helm-make-type 'helm-type-function))
+
+(defun helm-build-type-command ()
+  (helm-make-type 'helm-type-command))
+
+(provide 'helm-types)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-types.el ends here
diff --git a/elpa/helm-20160217.958/helm-utils.el b/elpa/helm-20160217.958/helm-utils.el
new file mode 100644 (file)
index 0000000..cfd8e6c
--- /dev/null
@@ -0,0 +1,664 @@
+;;; helm-utils.el --- Utilities Functions for helm. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-help)
+(require 'compile) ; Fixme: Is this needed?
+(require 'dired)
+
+(declare-function helm-find-files-1 "helm-files.el" (fname &optional preselect))
+(declare-function popup-tip "ext:popup")
+(defvar winner-boring-buffers)
+
+\f
+(defgroup helm-utils nil
+  "Utilities routines for Helm."
+  :group 'helm)
+
+(defcustom helm-su-or-sudo "sudo"
+  "What command to use for root access."
+  :type 'string
+  :group 'helm-utils)
+
+(defcustom helm-default-kbsize 1024.0
+  "Default Kbsize to use for showing files size.
+It is a float, usually 1024.0 but could be 1000.0 on some systems."
+  :group 'helm-utils
+  :type 'float)
+
+(define-obsolete-variable-alias
+  'helm-highlight-number-lines-around-point
+  'helm-highlight-matches-around-point-max-lines
+  "20160119")
+
+(defcustom helm-highlight-matches-around-point-max-lines 15
+  "Number of lines around point where matched items are highlighted."
+  :group 'helm-utils
+  :type 'integer)
+
+(defcustom helm-buffers-to-resize-on-pa nil
+  "A list of helm buffers where the helm-window should be reduced on persistent actions."
+  :group 'helm-utils
+  :type '(repeat (choice string)))
+
+(defcustom helm-resize-on-pa-text-height 12
+  "The size of the helm-window when resizing on persistent action."
+  :group 'helm-utils
+  :type 'integer)
+
+(defcustom helm-sources-using-help-echo-popup '("Moccur" "Imenu in all buffers"
+                                                "Ack-Grep" "AG" "Gid" "Git-Grep")
+  "Show the buffer name or the filename in a popup at selection."
+  :group 'helm-utils
+  :type '(repeat (choice string)))
+
+\f
+(defvar helm-goto-line-before-hook '(helm-save-current-pos-to-mark-ring)
+  "Run before jumping to line.
+This hook run when jumping from `helm-goto-line', `helm-etags-default-action',
+and `helm-imenu-default-action'.
+This allow you to retrieve a previous position after using the different helm
+tools for searching (etags, grep, gid, (m)occur etc...).
+By default positions are added to `mark-ring' you can also add to register
+by using instead (or adding) `helm-save-pos-to-register-before-jump'.
+In this case last position is added to the register
+`helm-save-pos-before-jump-register'.")
+
+(defvar helm-save-pos-before-jump-register ?_
+  "The register where `helm-save-pos-to-register-before-jump' save position.")
+
+\f
+;;; Faces.
+;;
+(defface helm-selection-line
+    '((t (:inherit highlight :distant-foreground "black")))
+  "Face used in the `helm-current-buffer' when jumping to candidate."
+  :group 'helm-faces)
+
+(defface helm-match-item
+    '((t (:inherit isearch)))
+  "Face used to highlight item matched in a selected line."
+  :group 'helm-faces)
+
+\f
+;; CUA workaround
+(defadvice cua-delete-region (around helm-avoid-cua activate)
+  (ignore-errors ad-do-it))
+
+(defadvice copy-region-as-kill (around helm-avoid-cua activate)
+  (if cua-mode
+      (ignore-errors ad-do-it)
+    ad-do-it))
+
+\f
+;;; Utils functions
+;;
+;;
+(defun helm-switch-to-buffers (buffer-or-name &optional other-window)
+  "Switch to buffer BUFFER-OR-NAME.
+If more than one buffer marked switch to these buffers in separate windows.
+If OTHER-WINDOW is specified keep current-buffer and switch to others buffers
+in separate windows."
+  (let* ((mkds (helm-marked-candidates))
+         (size (/ (window-height) (length mkds))))
+    (or (<= window-min-height size)
+        (error "Too many buffers to visit simultaneously."))
+    (helm-aif (cdr mkds)
+        (progn
+          (if other-window
+              (switch-to-buffer-other-window (car mkds))
+            (switch-to-buffer (car mkds)))
+          (save-selected-window
+            (cl-loop for b in it
+                  do (progn
+                       (select-window (split-window))
+                       (switch-to-buffer b)))))
+      (if other-window
+          (switch-to-buffer-other-window buffer-or-name)
+        (switch-to-buffer buffer-or-name)))))
+
+(defun helm-switch-to-buffers-other-window (buffer-or-name)
+  "switch to buffer BUFFER-OR-NAME in other window.
+See `helm-switch-to-buffers' for switching to marked buffers."
+  (helm-switch-to-buffers buffer-or-name t))
+
+(cl-defun helm-current-buffer-narrowed-p (&optional
+                                            (buffer helm-current-buffer))
+  "Check if BUFFER is narrowed.
+Default is `helm-current-buffer'."
+  (with-current-buffer buffer
+    (let ((beg (point-min))
+          (end (point-max))
+          (total (buffer-size)))
+      (or (/= beg 1) (/= end (1+ total))))))
+
+(defun helm-goto-char (loc)
+  "Go to char, revealing if necessary."
+  (goto-char loc)
+  (when (or (eq major-mode 'org-mode)
+            (and (boundp 'outline-minor-mode)
+                 outline-minor-mode))
+    (require 'org) ; On some old Emacs versions org may not be loaded.
+    (org-reveal)))
+
+(defun helm-goto-line (lineno &optional noanim)
+  "Goto LINENO opening only outline headline if needed.
+Animation is used unless NOANIM is non--nil."
+  (helm-log-run-hook 'helm-goto-line-before-hook)
+  (goto-char (point-min))
+  (helm-goto-char (point-at-bol lineno))
+  (unless noanim
+    (helm-highlight-current-line nil nil nil nil 'pulse)))
+
+(defun helm-save-pos-to-register-before-jump ()
+  "Save current buffer position to `helm-save-pos-before-jump-register'.
+To use this add it to `helm-goto-line-before-hook'."
+  (with-helm-current-buffer
+    (unless helm-in-persistent-action
+      (point-to-register helm-save-pos-before-jump-register))))
+
+(defun helm-save-current-pos-to-mark-ring ()
+  "Save current buffer position to mark ring.
+To use this add it to `helm-goto-line-before-hook'."
+  (with-helm-current-buffer
+    (unless helm-in-persistent-action
+      (set-marker (mark-marker) (point))
+      (push-mark (point) 'nomsg))))
+
+(defun helm-show-all-in-this-source-only (arg)
+  "Show only current source of this helm session with all its candidates.
+With a numeric prefix arg show only the ARG number of candidates."
+  (interactive "p")
+  (with-helm-alive-p
+    (with-helm-window
+      (with-helm-default-directory (helm-default-directory)
+          (let ((helm-candidate-number-limit (and (> arg 1) arg)))
+            (helm-set-source-filter
+             (list (assoc-default 'name (helm-get-current-source)))))))))
+(put 'helm-show-all-in-this-source-only 'helm-only t)
+
+(defun helm-display-all-sources ()
+  "Display all sources previously hidden by `helm-set-source-filter'."
+  (interactive)
+  (with-helm-alive-p
+    (helm-set-source-filter nil)))
+(put 'helm-display-all-sources 'helm-only t)
+
+(defun helm-displaying-source-names ()
+  "Return the list of sources name for this helm session."
+  (with-current-buffer helm-buffer
+    (goto-char (point-min))
+    (cl-loop with pos
+          while (setq pos (next-single-property-change (point) 'helm-header))
+          do (goto-char pos)
+          collect (buffer-substring-no-properties (point-at-bol)(point-at-eol))
+          do (forward-line 1))))
+
+(defun helm-handle-winner-boring-buffers ()
+  "Add `helm-buffer' to `winner-boring-buffers' when quitting/exiting helm.
+Add this function to `helm-cleanup-hook' when you don't want to see helm buffers
+after running winner-undo/redo."
+  (require 'winner)
+  (cl-pushnew helm-buffer winner-boring-buffers :test 'equal))
+(add-hook 'helm-cleanup-hook #'helm-handle-winner-boring-buffers)
+
+(defun helm-quit-and-find-file ()
+  "Drop into `helm-find-files' from `helm'.
+If current selection is a buffer or a file, `helm-find-files'
+from its directory."
+  (interactive)
+  (with-helm-alive-p
+    (require 'helm-grep)
+    (helm-run-after-exit
+     (lambda (f)
+       (if (file-exists-p f)
+           (helm-find-files-1 (file-name-directory f)
+                              (concat
+                               "^"
+                               (regexp-quote
+                                (if helm-ff-transformer-show-only-basename
+                                    (helm-basename f) f))))
+           (helm-find-files-1 f)))
+     (let* ((sel       (helm-get-selection))
+            (grep-line (and (stringp sel)
+                            (helm-grep-split-line sel)))
+            (bmk-name  (and (stringp sel)
+                            (not grep-line)
+                            (replace-regexp-in-string "\\`\\*" "" sel)))
+            (bmk       (and bmk-name (assoc bmk-name bookmark-alist)))
+            (buf       (helm-aif (and (bufferp sel) (get-buffer sel))
+                           (buffer-name it)))
+            (default-preselection (or (buffer-file-name helm-current-buffer)
+                                      default-directory)))
+       (cond
+         ;; Buffer.
+         (buf (or (buffer-file-name sel)
+                  (car (rassoc buf dired-buffers))
+                  (and (with-current-buffer buf
+                         (eq major-mode 'org-agenda-mode))
+                       org-directory
+                       (expand-file-name org-directory))
+                  (with-current-buffer buf default-directory)))
+         ;; Bookmark.
+         (bmk (helm-aif (bookmark-get-filename bmk)
+                  (if (and ffap-url-regexp
+                           (string-match ffap-url-regexp it))
+                      it (expand-file-name it))
+                default-directory))
+         ((or (file-remote-p sel)
+              (file-exists-p sel))
+          (expand-file-name sel))
+         ;; Grep.
+         ((and grep-line (file-exists-p (car grep-line)))
+          (expand-file-name (car grep-line)))
+         ;; Occur.
+         (grep-line
+          (with-current-buffer (get-buffer (car grep-line))
+            (or (buffer-file-name) default-directory)))
+         ;; Url.
+         ((and ffap-url-regexp (string-match ffap-url-regexp sel)) sel)
+         ;; Default.
+         (t default-preselection))))))
+(put 'helm-quit-and-find-file 'helm-only t)
+
+(defun helm-generic-sort-fn (s1 s2)
+  "Sort predicate function for helm candidates.
+Args S1 and S2 can be single or \(display . real\) candidates,
+that is sorting is done against real value of candidate."
+  (let* ((pattern (regexp-quote helm-pattern))
+         (reg1  (concat "\\_<" pattern "\\_>"))
+         (reg2  (concat "\\_<" pattern))
+         (reg3  helm-pattern)
+         (split (split-string pattern))
+         (str1  (if (consp s1) (cdr s1) s1))
+         (str2  (if (consp s2) (cdr s2) s2))
+         (score (lambda (str r1 r2 r3 lst)
+                    (+ (if (string-match (concat "\\`" pattern) str) 1 0)
+                       (cond ((string-match r1 str) 5)
+                             ((and (string-match " " pattern)
+                                   (string-match (concat "\\_<" (car lst)) str)
+                                   (cl-loop for r in (cdr lst)
+                                            always (string-match r str))) 4)
+                             ((and (string-match " " pattern)
+                                   (cl-loop for r in lst always (string-match r str))) 3)
+                             ((string-match r2 str) 2)
+                             ((string-match r3 str) 1)
+                             (t 0)))))
+         (sc1 (funcall score str1 reg1 reg2 reg3 split))
+         (sc2 (funcall score str2 reg1 reg2 reg3 split)))
+    (cond ((or (zerop (string-width pattern))
+               (and (zerop sc1) (zerop sc2)))
+           (string-lessp str1 str2))
+          ((= sc1 sc2)
+           (< (length str1) (length str2)))
+          (t (> sc1 sc2)))))
+
+(defun helm-ff-get-host-from-tramp-invalid-fname (fname)
+  "Extract hostname from an incomplete tramp file name.
+Return nil on valid file name remote or not."
+  (let* ((str (helm-basename fname))
+         (split (split-string str ":"))
+         (meth (car (member (car split) (mapcar 'car tramp-methods))))) 
+    (when (and meth (<= (length split) 2))
+      (cadr split))))
+
+(cl-defun helm-file-human-size (size &optional (kbsize helm-default-kbsize))
+  "Return a string showing SIZE of a file in human readable form.
+SIZE can be an integer or a float depending it's value.
+`file-attributes' will take care of that to avoid overflow error.
+KBSIZE if a floating point number, defaulting to `helm-default-kbsize'."
+  (let ((M (cons "M" (/ size (expt kbsize 2))))
+        (G (cons "G" (/ size (expt kbsize 3))))
+        (K (cons "K" (/ size kbsize)))
+        (B (cons "B" size)))
+    (cl-loop with result = B
+          for (a . b) in
+          (cl-loop for (x . y) in (list M G K B)
+                unless (< y 1) collect (cons x y))
+          when (< b (cdr result)) do (setq result (cons a b))
+          finally return (if (string= (car result) "B")
+                             (format "%s" size)
+                           (format "%.1f%s" (cdr result) (car result))))))
+
+(cl-defun helm-file-attributes
+    (file &key type links uid gid access-time modif-time
+            status size mode gid-change inode device-num dired human-size
+            mode-type mode-owner mode-group mode-other (string t))
+  "Return `file-attributes' elements of FILE separately according to key value.
+Availables keys are:
+- TYPE: Same as nth 0 `files-attributes' if STRING is nil
+        otherwise return either symlink, directory or file (default).
+- LINKS: See nth 1 `files-attributes'.
+- UID: See nth 2 `files-attributes'.
+- GID: See nth 3 `files-attributes'.
+- ACCESS-TIME: See nth 4 `files-attributes', however format time
+               when STRING is non--nil (the default).
+- MODIF-TIME: See nth 5 `files-attributes', same as above.
+- STATUS: See nth 6 `files-attributes', same as above.
+- SIZE: See nth 7 `files-attributes'.
+- MODE: See nth 8 `files-attributes'.
+- GID-CHANGE: See nth 9 `files-attributes'.
+- INODE: See nth 10 `files-attributes'.
+- DEVICE-NUM: See nth 11 `files-attributes'.
+- DIRED: A line similar to what 'ls -l' return.
+- HUMAN-SIZE: The size in human form, see `helm-file-human-size'.
+- MODE-TYPE, mode-owner,mode-group, mode-other: Split what
+  nth 7 `files-attributes' return in four categories.
+- STRING: When non--nil (default) `helm-file-attributes' return
+          more friendly values.
+If you want the same behavior as `files-attributes' ,
+\(but with return values in proplist\) use a nil value for STRING.
+However when STRING is non--nil, time and type value are different from what
+you have in `file-attributes'."
+  (let* ((all (cl-destructuring-bind
+                    (type links uid gid access-time modif-time
+                          status size mode gid-change inode device-num)
+                  (file-attributes file string)
+                (list :type        (if string
+                                       (cond ((stringp type) "symlink") ; fname
+                                             (type "directory")         ; t
+                                             (t "file"))                ; nil
+                                     type)
+                      :links       links
+                      :uid         uid
+                      :gid         gid
+                      :access-time (if string
+                                       (format-time-string
+                                        "%Y-%m-%d %R" access-time)
+                                     access-time)
+                      :modif-time  (if string
+                                       (format-time-string
+                                        "%Y-%m-%d %R" modif-time)
+                                     modif-time)
+                      :status      (if string
+                                       (format-time-string
+                                        "%Y-%m-%d %R" status)
+                                     status)
+                      :size        size
+                      :mode        mode
+                      :gid-change  gid-change
+                      :inode       inode
+                      :device-num  device-num)))
+         (modes (helm-split-mode-file-attributes (cl-getf all :mode))))
+    (cond (type (cl-getf all :type))
+          (links (cl-getf all :links))
+          (uid   (cl-getf all :uid))
+          (gid   (cl-getf all :gid))
+          (access-time (cl-getf all :access-time))
+          (modif-time (cl-getf all :modif-time))
+          (status (cl-getf all :status))
+          (size (cl-getf all :size))
+          (mode (cl-getf all :mode))
+          (gid-change (cl-getf all :gid-change))
+          (inode (cl-getf all :inode))
+          (device-num (cl-getf all :device-num))
+          (dired
+           (concat
+            (helm-split-mode-file-attributes (cl-getf all :mode) t) " "
+            (number-to-string (cl-getf all :links)) " "
+            (cl-getf all :uid) ":"
+            (cl-getf all :gid) " "
+            (if human-size
+                (helm-file-human-size (cl-getf all :size))
+              (int-to-string (cl-getf all :size))) " "
+              (cl-getf all :modif-time)))
+          (human-size (helm-file-human-size (cl-getf all :size)))
+          (mode-type (cl-getf modes :mode-type))
+          (mode-owner (cl-getf modes :user))
+          (mode-group (cl-getf modes :group))
+          (mode-other (cl-getf modes :other))
+          (t (append all modes)))))
+
+(defun helm-split-mode-file-attributes (str &optional string)
+  "Split mode file attributes STR into a proplist.
+If STRING is non--nil return instead a space separated string."
+  (cl-loop with type = (substring str 0 1)
+        with cdr = (substring str 1)
+        for i across cdr
+        for count from 1
+        if (<= count 3)
+        concat (string i) into user
+        if (and (> count 3) (<= count 6))
+        concat (string i) into group
+        if (and (> count 6) (<= count 9))
+        concat (string i) into other
+        finally return
+        (if string
+            (mapconcat 'identity (list type user group other) " ")
+          (list :mode-type type :user user :group group :other other))))
+
+(defmacro with-helm-display-marked-candidates (buffer-or-name candidates &rest body)
+  (declare (indent 0) (debug t))
+  (helm-with-gensyms (buffer window)
+    `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name))
+            ,window)
+       (unwind-protect
+            (with-current-buffer ,buffer
+              (dired-format-columns-of-files ,candidates)
+              (select-window
+               (setq ,window (temp-buffer-window-show
+                              ,buffer
+                              '(display-buffer-below-selected
+                                (window-height . fit-window-to-buffer)))))
+              (progn ,@body))
+         (quit-window 'kill ,window)))))
+
+;;; Persistent Action Helpers
+;;
+;;
+;; Internal
+(defvar helm-match-line-overlay nil)
+(defvar helm--match-item-overlays nil)
+
+(defun helm-highlight-current-line (&optional start end buf face pulse)
+  "Highlight and underline current position"
+  (let* ((start (or start (line-beginning-position)))
+         (end (or end (1+ (line-end-position))))
+         (start-match (if (or (null helm-highlight-matches-around-point-max-lines)
+                              (zerop helm-highlight-matches-around-point-max-lines))
+                          start
+                        (save-excursion
+                          (forward-line
+                           (- helm-highlight-matches-around-point-max-lines))
+                          (point-at-bol))))
+         (end-match   (if (or (null helm-highlight-matches-around-point-max-lines)
+                              (zerop helm-highlight-matches-around-point-max-lines))
+                          end
+                        (save-excursion
+                          (forward-line
+                           helm-highlight-matches-around-point-max-lines)
+                          (point-at-eol))))
+         (args (list start end buf)))
+    (if (not helm-match-line-overlay)
+        (setq helm-match-line-overlay (apply 'make-overlay args))
+      (apply 'move-overlay helm-match-line-overlay args))
+    (overlay-put helm-match-line-overlay
+                 'face (or face 'helm-selection-line))
+    (catch 'empty-line
+      (cl-loop with ov
+               for r in (helm-remove-if-match
+                         "\\`!" (split-string helm-input))
+               do (save-excursion
+                    (goto-char start-match)
+                    (while (condition-case _err
+                               (if helm-migemo-mode
+                                   (helm-mm-migemo-forward r end-match t)
+                                 (re-search-forward r end-match t))
+                             (invalid-regexp nil))
+                      (let ((s (match-beginning 0))
+                            (e (match-end 0)))
+                        (if (= s e)
+                            (throw 'empty-line nil)
+                          (push (setq ov (make-overlay s e))
+                                helm--match-item-overlays)
+                          (overlay-put ov 'face 'helm-match-item)
+                          (overlay-put ov 'priority 1)))))))
+    (recenter)
+    (when pulse
+      (sit-for 0.3)
+      (helm-match-line-cleanup))))
+
+(defun helm-match-line-cleanup ()
+  (when helm-match-line-overlay
+    (delete-overlay helm-match-line-overlay)
+    (setq helm-match-line-overlay nil))
+  (when helm--match-item-overlays
+    (mapc 'delete-overlay helm--match-item-overlays)))
+
+(defun helm-match-line-update ()
+  (when helm-match-line-overlay
+    (delete-overlay helm-match-line-overlay)
+    (helm-highlight-current-line)))
+
+(defun helm-persistent-autoresize-hook ()
+  (when (and helm-buffers-to-resize-on-pa
+             (member helm-buffer helm-buffers-to-resize-on-pa)
+             (eq helm-split-window-state 'vertical))
+    (set-window-text-height (helm-window) helm-resize-on-pa-text-height)))
+
+(add-hook 'helm-after-persistent-action-hook 'helm-persistent-autoresize-hook)
+(add-hook 'helm-cleanup-hook 'helm-match-line-cleanup)
+(add-hook 'helm-after-persistent-action-hook 'helm-match-line-update)
+
+;;; Popup buffer-name or filename in grep/moccur/imenu-all.
+;;
+(defvar helm--show-help-echo-timer nil)
+
+(defun helm-cancel-help-echo-timer ()
+  (when helm--show-help-echo-timer
+    (cancel-timer helm--show-help-echo-timer)
+    (setq helm--show-help-echo-timer nil)))
+
+(defun helm-show-help-echo ()
+  (when helm--show-help-echo-timer
+    (cancel-timer helm--show-help-echo-timer)
+    (setq helm--show-help-echo-timer nil))
+  (when (and helm-alive-p
+             (member (assoc-default 'name (helm-get-current-source))
+                     helm-sources-using-help-echo-popup))
+    (setq helm--show-help-echo-timer
+          (run-with-idle-timer
+           1 nil
+           (lambda ()
+             (with-helm-window
+               (helm-aif (get-text-property (point-at-bol) 'help-echo)
+                   (popup-tip (concat " " (abbreviate-file-name it))
+                              :around nil
+                              :point (save-excursion
+                                       (end-of-visual-line) (point))))))))))
+
+;;;###autoload
+(define-minor-mode helm-popup-tip-mode
+    "Show help-echo informations in a popup tip at end of line."
+  :global t
+  (require 'popup)
+  (if helm-popup-tip-mode
+      (progn
+        (add-hook 'helm-update-hook 'helm-show-help-echo) ; Needed for async sources.
+        (add-hook 'helm-move-selection-after-hook 'helm-show-help-echo)
+        (add-hook 'helm-cleanup-hook 'helm-cancel-help-echo-timer))
+      (remove-hook 'helm-update-hook 'helm-show-help-echo)
+      (remove-hook 'helm-move-selection-after-hook 'helm-show-help-echo)
+      (remove-hook 'helm-cleanup-hook 'helm-cancel-help-echo-timer)))
+
+(defun helm-open-file-with-default-tool (file)
+  "Open FILE with the default tool on this platform."
+  (let (process-connection-type)
+    (if (eq system-type 'windows-nt)
+        (helm-w32-shell-execute-open-file file)
+      (start-process "helm-open-file-with-default-tool"
+                     nil
+                     (cond ((eq system-type 'gnu/linux)
+                            "xdg-open")
+                           ((or (eq system-type 'darwin) ;; Mac OS X
+                                (eq system-type 'macos)) ;; Mac OS 9
+                            "open"))
+                     file))))
+
+(defun helm-open-dired (file)
+  "Opens a dired buffer in FILE's directory.  If FILE is a
+directory, open this directory."
+  (if (file-directory-p file)
+      (dired file)
+    (dired (file-name-directory file))
+    (dired-goto-file file)))
+
+(defun helm-require-or-error (feature function)
+  (or (require feature nil t)
+      (error "Need %s to use `%s'." feature function)))
+
+(defun helm-find-file-as-root (candidate)
+  (let* ((buf (helm-basename candidate))
+         (host (file-remote-p candidate 'host))
+         (remote-path (format "/%s:%s:%s"
+                              helm-su-or-sudo
+                              (or host "")
+                              (expand-file-name
+                               (if host
+                                   (file-remote-p candidate 'localname)
+                                 candidate))))
+         non-essential)
+    (if (buffer-live-p (get-buffer buf))
+        (progn
+          (set-buffer buf)
+          (find-alternate-file remote-path))
+      (find-file remote-path))))
+
+(defun helm-find-many-files (_ignore)
+  (let ((helm--reading-passwd-or-string t))
+    (mapc 'find-file (helm-marked-candidates))))
+
+(defun helm-read-repeat-string (prompt &optional count)
+  "Prompt as many time PROMPT is not empty.
+If COUNT is non--nil add a number after each prompt."
+  (cl-loop with elm
+        while (not (string= elm ""))
+        for n from 1
+        do (when count
+             (setq prompt (concat prompt (int-to-string n) ": ")))
+        collect (setq elm (helm-read-string prompt)) into lis
+        finally return (remove "" lis)))
+
+(defun helm-html-bookmarks-to-alist (file url-regexp bmk-regexp)
+  "Parse html bookmark FILE and return an alist with (title . url) as elements."
+  (let (bookmarks-alist url title)
+    (with-temp-buffer
+      (insert-file-contents file)
+      (goto-char (point-min))
+      (while (re-search-forward "href=\\|^ *<DT><A HREF=" nil t)
+        (forward-line 0)
+        (when (re-search-forward url-regexp nil t)
+          (setq url (match-string 0)))
+        (when (re-search-forward bmk-regexp nil t)
+          (setq title (match-string 1)))
+        (push (cons title url) bookmarks-alist)
+        (forward-line)))
+    (nreverse bookmarks-alist)))
+
+
+(provide 'helm-utils)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-utils.el ends here
diff --git a/elpa/helm-aws-20141206.1208/helm-aws-autoloads.el b/elpa/helm-aws-20141206.1208/helm-aws-autoloads.el
deleted file mode 100644 (file)
index 75891bc..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-;;; helm-aws-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-
-\f
-;;;### (autoloads (helm-aws) "helm-aws" "helm-aws.el" (21889 46341
-;;;;;;  0 0))
-;;; Generated autoloads from helm-aws.el
-
-(autoload 'helm-aws "helm-aws" "\
-
-
-\(fn)" t nil)
-
-;;;***
-\f
-;;;### (autoloads nil nil ("helm-aws-pkg.el") (21889 46341 288795
-;;;;;;  0))
-
-;;;***
-\f
-(provide 'helm-aws-autoloads)
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; coding: utf-8
-;; End:
-;;; helm-aws-autoloads.el ends here
diff --git a/elpa/helm-aws-20141206.1208/helm-aws-pkg.el b/elpa/helm-aws-20141206.1208/helm-aws-pkg.el
deleted file mode 100644 (file)
index aca696b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-(define-package "helm-aws" "20141206.1208" "Manage AWS EC2 server instances directly from Emacs" (quote ((helm "1.5.3"))))
diff --git a/elpa/helm-aws-20141206.1208/helm-aws.el b/elpa/helm-aws-20141206.1208/helm-aws.el
deleted file mode 100644 (file)
index 7312499..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-;;; helm-aws.el --- Manage AWS EC2 server instances directly from Emacs
-
-;; Copyright (C) 2014 istib
-
-;; Author: istib
-;; URL: https://github.com/istib/helm-aws
-;; Package-Version: 20141206.1208
-;; Version: 20141205.1
-;; X-Original-Version: 0.2
-;; Package-Requires: ((helm "1.5.3"))
-;; Keywords:
-
-;; This file is not part of GNU Emacs
-
-;; This file is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; For a full copy of the GNU General Public License
-;; see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; Manage AWS EC2 server instances directly from Emacs
-
-;; A call to `helm-aws' will show a list of running instances on your configured
-;; AWS account. Helm actions to launch a terminal, dired, or ping are accessible.
-;; 
-;; Requires a configured installation of AWS command-line interface (http://aws.amazon.com/cli/)
-
-
-;;; Code:
-(require 'json)
-
-(defvar aws-user-account
-  "ubuntu"
-  "User account name for AWS servers. Assuming that your PEM keys are placed on each instance")
-
-(defvar aws-ec2-command
-  "aws ec2 describe-instances"
-  "Command to list instances. Run `aws configure` to set up AWS cli")
-
-(defun aws-run-ec2-command ()
-  "returns json"
-  (let ((aws-result-buffer (generate-new-buffer-name "*aws-ec2*")))
-    (with-temp-buffer
-      (shell-command aws-ec2-command (current-buffer) nil)
-      (buffer-substring-no-properties (point-min) (point-max)))))
-
-(defun aws-parse-server-list (input)
-  ""
-  (let* ((json-object-type 'plist)
-         (aws-json         (json-read-from-string input))
-         (reservations     (plist-get aws-json :Reservations))
-         (instances        (mapcar (lambda (el) (plist-get el :Instances)) reservations))
-         (instance-vector  (cdr instances)) ;; drop first, as it's metadata
-         (instance-list    (mapcar (lambda (x) (elt x 0)) instance-vector)))
-    instance-list))
-
-(defun aws-is-instance-active-p (instance)
-  "predicate that determines whether the given instance is running"
-  (let* ((state (plist-get instance :State))
-         (code (plist-get state :Code)))
-    (eq code 16)))
-
-(defun aws-format-instance-string (instance)
-  "Constructs a human-friendly string of a server instance - showing name, IP and launch date"
-  (let* ((ip (plist-get instance :PrivateIpAddress))
-         (tags (elt (plist-get instance :Tags) 0))
-         (name (plist-get tags :Value))
-         (launch-time (plist-get instance :LaunchTime))
-         (launch-date (car (split-string launch-time "T"))))
-    (concat name " - " ip " - " launch-date)))
-
-(defun aws-get-ip-from-instance-string (instance-str)
-  "extracts IP address back from constructed string"
-  (let* ((components (split-string instance-str " - ")))
-    (cadr components)))
-
-(defun aws-get-active-instances ()
-  "used to populate list in helm-aws"
-  (let* ((aws-result       (aws-run-ec2-command))
-         (instance-list    (aws-parse-server-list aws-result))
-         (active-instances (-filter 'aws-is-instance-active-p instance-list)))
-    (mapcar 'aws-format-instance-string active-instances)))
-
-(defun aws-ssh-into-instance (ip-address)
-  "Use SSH to connect to remote instance"
-  (let ((switches (list ip-address "-l" aws-user-account)))
-    (set-buffer (apply 'make-term "ssh" "ssh" nil switches))
-    (term-mode)
-    (term-char-mode)
-    (switch-to-buffer "*ssh*")))
-
-(defun aws-find-file-on-instance (ip-address)
-  "Use dired to access directory structure of remote instance"
-  (let ((path (concat "/ssh:" aws-user-account "@" ip-address ":")))
-    (find-file path)))
-
-
-;;;###autoload
-(defun helm-aws ()
-  (interactive)
-  (let ((choices (aws-get-active-instances)))
-    (helm
-     :sources '((name . "EC2 Instances")
-                (candidates . choices)
-                (action . (("SSH"                   . (lambda (instance-str)
-                                                        (aws-ssh-into-instance (aws-get-ip-from-instance-string instance-str))))
-                           ("Dired"                 . (lambda (instance-str)
-                                                        (aws-find-file-on-instance (aws-get-ip-from-instance-string instance-str))))
-                           ("Ping"                  . (lambda (instance-str)
-                                                        (ping (aws-get-ip-from-instance-string instance-str))))
-                           ("Insert IP into buffer" . (lambda (instance-str)
-                                                        (insert (aws-get-ip-from-instance-string instance-str))))))))))
-
-(provide 'helm-aws)
-
-;;; helm-aws.el ends here
diff --git a/elpa/helm-aws-20151124.133/helm-aws-autoloads.el b/elpa/helm-aws-20151124.133/helm-aws-autoloads.el
new file mode 100644 (file)
index 0000000..fe93cf1
--- /dev/null
@@ -0,0 +1,21 @@
+;;; helm-aws-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-aws" "helm-aws.el" (22215 7747 0 0))
+;;; Generated autoloads from helm-aws.el
+
+(autoload 'helm-aws "helm-aws" "\
+Show helm with a table of aws information.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-aws-autoloads.el ends here
diff --git a/elpa/helm-aws-20151124.133/helm-aws-pkg.el b/elpa/helm-aws-20151124.133/helm-aws-pkg.el
new file mode 100644 (file)
index 0000000..027bbad
--- /dev/null
@@ -0,0 +1 @@
+(define-package "helm-aws" "20151124.133" "Manage AWS EC2 server instances directly from Emacs" '((helm "1.5.3") (cl-lib "0.5") (s "1.9.0")) :url "https://github.com/istib/helm-aws")
diff --git a/elpa/helm-aws-20151124.133/helm-aws.el b/elpa/helm-aws-20151124.133/helm-aws.el
new file mode 100644 (file)
index 0000000..1f81ee0
--- /dev/null
@@ -0,0 +1,177 @@
+;;; helm-aws.el --- Manage AWS EC2 server instances directly from Emacs
+
+;; Copyright (C) 2014 istib
+
+;; Author: istib
+;; URL: https://github.com/istib/helm-aws
+;; Package-Version: 20151124.133
+;; Version: 20141205.1
+;; X-Original-Version: 0.2
+;; Package-Requires: ((helm "1.5.3")(cl-lib "0.5")(s "1.9.0"))
+;; Keywords:
+
+;; This file is not part of GNU Emacs
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; For a full copy of the GNU General Public License
+;; see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Manage AWS EC2 server instances directly from Emacs
+
+;; A call to `helm-aws' will show a list of running instances on your configured
+;; AWS account.  Helm actions to launch a terminal, dired, or ping are accessible.
+;; 
+;; Requires a configured installation of AWS command-line interface (http://aws.amazon.com/cli/)
+
+
+;;; Code:
+(require 'json)
+(require 'cl-lib)
+(require 's)
+
+(defvar aws-user-account
+  "ubuntu"
+  "User account name for AWS servers.  Assuming that your PEM keys are placed on each instance.")
+
+(defvar aws-ec2-command
+  "aws ec2 describe-instances"
+  "Command to list instances.  Run `aws configure` to set up AWS cli.")
+
+(defun aws-run-ec2-command ()
+  "Return the full json from running describe-instances."
+  (let ((aws-result-buffer (generate-new-buffer-name "*aws-ec2*")))
+    (with-temp-buffer
+      (shell-command aws-ec2-command (current-buffer) nil)
+      (buffer-substring-no-properties (point-min) (point-max)))))
+
+(defun aws-parse-server-list (input)
+  "Extract instances from describe-instances.
+Argument INPUT json input in string form."
+  (let* ((json-object-type 'plist)
+         (aws-json         (json-read-from-string input))
+         (reservations     (plist-get aws-json :Reservations))
+         (instances        (mapcar (lambda (el) (plist-get el :Instances)) reservations))
+         (instance-vector  (cdr instances)) ;; drop first, as it's metadata
+         (instance-list    (mapcar (lambda (x) (elt x 0)) instance-vector)))
+    instance-list))
+
+(defun aws-is-instance-active-p (instance)
+  "Predicate that determines whether the given INSTANCE is running."
+  (let* ((state (plist-get instance :State))
+         (code (plist-get state :Code)))
+    (eq code 16)))
+
+(defun aws-format-instance-helm-row (instance)
+  "Constructs a human-friendly string of a server instance.
+show: <name>, <IP> and <launch date>.
+Argument INSTANCE is the aws json in plist form"
+  (let* ((ip (plist-get instance :PrivateIpAddress))
+         (instance-id (plist-get instance :InstanceId))
+         (instance-state (plist-get (plist-get instance :State) :Name))
+         (tags (plist-get instance :Tags))
+         (nameTag (cl-remove-if-not #'(lambda (tag) (string= (plist-get tag :Key) "Name")) tags))
+         (name (if (= (length nameTag) 1) (plist-get (elt nameTag 0) :Value) instance-id))
+         (launch-time (plist-get instance :LaunchTime))
+         (launch-date (car (split-string launch-time "T")))
+         (formatted-string
+          (concat (format "%-30s" (s-truncate 30 name)) " | "
+                  (format "%15s" ip) " | "
+                  (format "%-10s" instance-state) " | "
+                  launch-date)))
+    (cons formatted-string instance)))
+
+(defun aws-get-ip-from-instance (instance-json)
+  "Extracts IP address from INSTANCE-JSON."
+  (plist-get instance-json :PrivateIpAddress))
+
+(defun aws-sort-helm-rows (a b)
+  "Compare results from `aws-format-instance-helm-row' A and B."
+  (string< (downcase (car a)) (downcase (car b))))
+
+(defun aws-get-active-instances ()
+  "Used to populate data for `helm-aws'."
+  (let* ((aws-result       (aws-run-ec2-command))
+         (instance-list    (aws-parse-server-list aws-result))
+         (instance-list (mapcar 'aws-format-instance-helm-row instance-list))
+         (instance-list (sort instance-list 'aws-sort-helm-rows))
+         )
+    instance-list))
+
+(defun aws-ssh-into-instance (ip-address)
+  "Use SSH to connect to remote instance.
+Argument IP-ADDRESS is the ip address for the instance you want ssh to."
+  (let ((switches (list ip-address "-l" aws-user-account)))
+    (set-buffer (apply 'make-term "ssh" "ssh" nil switches))
+    (term-mode)
+    (term-char-mode)
+    (switch-to-buffer "*ssh*")))
+
+(defun aws-find-file-on-instance (ip-address)
+  "Use dired to access directory structure of remote instance.
+Argument IP-ADDRESS is the ip address for the instance you want to run `find-file' on."
+  (let ((path (concat "/ssh:" aws-user-account "@" ip-address ":")))
+    (find-file path)))
+
+(defun aws-instance-details (instance-json)
+  "Dump the instance json into a buffer *aws-details*.
+Argument INSTANCE-JSON is the json behind the row of helm data."
+  (interactive)
+  (let* ((json-encoding-pretty-print t)
+         (json (json-encode instance-json)))
+    (switch-to-buffer (get-buffer-create "*aws-details*"))
+    (let ((inhibit-read-only t))
+      (erase-buffer)
+      (delete-other-windows)
+      (insert json)
+      (goto-char (point-min))
+      (set-buffer-modified-p nil)
+      (view-mode)
+      (message "Press q to quit."))))
+
+(defun aws-instance-toggle-stop-start (instance-json)
+  "Toggle the instance state for INSTANCE-JSON.
+If it is stopped, start it.  If it is running, stop it."
+  (let* ((instance-id (plist-get instance-json :InstanceId))
+         (instance-state (plist-get (plist-get instance-json :State) :Name))
+         (toggle-action (if (string= instance-state "running") "stop-instances" "start-instances"))
+         (command (format "aws ec2 %s --instance-ids %s" toggle-action instance-id)))
+    (compile command)))
+
+;;;###autoload
+(defun helm-aws ()
+  "Show helm with a table of aws information."
+  (interactive)
+  (let ((choices (aws-get-active-instances)))
+    (helm
+     :buffer "*helm-aws*"
+     :sources '((name . "EC2 Instances")
+                (candidates . choices)
+                (action . (("SSH" .
+                            (lambda (instance-json)
+                              (aws-ssh-into-instance (aws-get-ip-from-instance instance-json))))
+                           ("Dired" .
+                            (lambda (instance-json)
+                              (aws-find-file-on-instance (aws-get-ip-from-instance instance-json))))
+                           ("Ping" .
+                            (lambda (instance-json)
+                              (ping (aws-get-ip-from-instance instance-json))))
+                           ("Insert IP into buffer" .
+                            (lambda (instance-json)
+                              (insert (aws-get-ip-from-instance instance-json))))
+                           ("Save instance json to buffer" . aws-instance-details)
+                           ("Toggle Stop/Start instance" . aws-instance-toggle-stop-start)))))))
+
+(provide 'helm-aws)
+
+;;; helm-aws.el ends here
index 42d8664bf708d87d0053dfd08efce5fafd496291..241fd389c9adb7dd779ef11cb814af59c032ac58 100644 (file)
@@ -1,6 +1,6 @@
 Manage AWS EC2 server instances directly from Emacs
 
 A call to `helm-aws' will show a list of running instances on your configured
-AWS account. Helm actions to launch a terminal, dired, or ping are accessible.
+AWS account.  Helm actions to launch a terminal, dired, or ping are accessible.
 
 Requires a configured installation of AWS command-line interface (http://aws.amazon.com/cli/)
diff --git a/elpa/helm-core-20160217.958/helm-core-autoloads.el b/elpa/helm-core-20160217.958/helm-core-autoloads.el
new file mode 100644 (file)
index 0000000..92f393d
--- /dev/null
@@ -0,0 +1,202 @@
+;;; helm-core-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm" "helm.el" (22215 7773 0 0))
+;;; Generated autoloads from helm.el
+
+(autoload 'helm-define-multi-key "helm" "\
+In KEYMAP, define key sequence KEY for function list FUNCTIONS.
+Each function run sequentially each time the key KEY is pressed.
+If DELAY is specified switch back to initial function of FUNCTIONS list
+after DELAY seconds.
+The functions in FUNCTIONS list are functions with no args.
+e.g
+  (defun foo ()
+    (message \"Run foo\"))
+  (defun bar ()
+    (message \"Run bar\"))
+  (defun baz ()
+    (message \"Run baz\"))
+
+\(helm-define-multi-key global-map \"<f5> q\" '(foo bar baz) 2)
+
+Each time \"<f5> q\" is pressed the next function is executed, if you wait
+More than 2 seconds, next hit will run again the first function and so on.
+
+\(fn KEYMAP KEY FUNCTIONS &optional DELAY)" nil nil)
+
+(autoload 'helm-multi-key-defun "helm" "\
+Define NAME as a multi-key command running FUNS.
+After DELAY seconds the FUNS list is reinitialised.
+See `helm-define-multi-key'.
+
+\(fn NAME DOCSTRING FUNS &optional DELAY)" nil t)
+
+(put 'helm-multi-key-defun 'lisp-indent-function '2)
+
+(autoload 'helm-define-key-with-subkeys "helm" "\
+Allow defining in MAP a KEY and SUBKEY to COMMAND.
+
+This allow typing KEY to call COMMAND the first time and
+type only SUBKEY on subsequent calls.
+
+Arg MAP is the keymap to use, SUBKEY is the initial short keybinding to
+call COMMAND.
+
+Arg OTHER-SUBKEYS is an alist specifying other short keybindings
+to use once started.
+e.g:
+
+\(helm-define-key-with-subkeys global-map
+   (kbd \"C-x v n\") ?n 'git-gutter:next-hunk '((?p . git-gutter:previous-hunk)))
+
+
+In this example, `C-x v n' will run `git-gutter:next-hunk'
+subsequent hits on \"n\" will run this command again
+and subsequent hits on \"p\" will run `git-gutter:previous-hunk'.
+
+Arg MENU is a string to display in minibuffer
+to describe SUBKEY and OTHER-SUBKEYS.
+Arg EXIT-FN specify a function to run on exit.
+
+Any other keys pressed run their assigned command defined in MAP
+and exit the loop running EXIT-FN if specified.
+
+NOTE: SUBKEY and OTHER-SUBKEYS bindings support
+only char syntax actually (e.g ?n)
+so don't use strings, vectors or whatever to define them.
+
+\(fn MAP KEY SUBKEY COMMAND &optional OTHER-SUBKEYS MENU EXIT-FN)" nil nil)
+
+(put 'helm-define-key-with-subkeys 'lisp-indent-function '1)
+
+(autoload 'helm-debug-open-last-log "helm" "\
+Open helm log file of last helm session.
+If `helm-last-log-file' is nil, switch to `helm-debug-buffer' .
+
+\(fn)" t nil)
+
+(autoload 'helm "helm" "\
+Main function to execute helm sources.
+
+Keywords supported:
+:sources :input :prompt :resume :preselect
+:buffer :keymap :default :history :allow-nest
+
+Extra LOCAL-VARS keywords are supported, see below.
+
+PLIST is a list like (:key1 val1 :key2 val2 ...) or
+\(&optional sources input prompt resume
+            preselect buffer keymap default history).
+
+Basic keywords are the following:
+
+:sources
+
+A list of sources used for this session.  It also accepts a
+symbol, interpreted as a variable of a helm source
+i.e (a symbol can be passed instead of a list of sources).
+It also accepts an alist representing a helm source, which is
+detected by (assq 'name ANY-SOURCES).
+NOTE: In this case the source is embedded in the helm command and
+have no symbol name, so it is not reachable from outside.
+It will be referenced in `helm-sources' as a whole alist.
+
+:input
+
+Temporary value of `helm-pattern', ie. initial input of minibuffer.
+
+:prompt
+
+Prompt other than \"pattern: \".
+
+:resume
+
+If t, Resurrect previously instance of `helm'.  Skip the initialization.
+If 'noresume, this instance of `helm' cannot be resumed.
+
+:preselect
+
+Initially selected candidate.  Specified by exact candidate or a regexp.
+
+:buffer
+
+`helm-buffer' instead of *helm*.
+
+:keymap
+
+`helm-map' for current `helm' session.
+
+:default
+
+A default argument that will be inserted in minibuffer with \\<minibuffer-local-map>\\[next-history-element].
+When nil or not present `thing-at-point' will be used instead.
+If `helm--maybe-use-default-as-input' is non--nil display will be
+updated using :default arg as input unless :input is specified,
+which in this case will take precedence on :default
+This is a string or a list, in this case the car of the list will
+be used as initial default input, but you will be able to cycle in this
+list with \\<minibuffer-local-map>\\[next-history-element].
+
+:history
+
+By default all minibuffer input is pushed to `minibuffer-history',
+if an argument HISTORY is provided, input will be pushed to HISTORY.
+History element should be a symbol.
+
+:allow-nest
+
+Allow running this helm command within a running helm session.
+
+Of course, conventional arguments are supported, the two are same.
+
+\(helm :sources sources :input input :prompt prompt :resume resume
+       :preselect preselect :buffer buffer :keymap keymap :default default
+       :history history)
+
+and
+
+\(helm sources input prompt resume preselect buffer keymap default history)
+
+are the same.
+
+However the use of non keyword args is deprecated and should not be used.
+
+Other keywords are interpreted as local variables of this helm session.
+The `helm-' prefix can be omitted.  For example,
+
+\(helm :sources 'helm-source-buffers-list
+       :buffer \"*buffers*\" :candidate-number-limit 10)
+
+means starting helm session with `helm-source-buffers'
+source in *buffers* buffer and set variable `helm-candidate-number-limit'
+to 10 as session local variable.
+
+\(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)" nil nil)
+
+(autoload 'helm-other-buffer "helm" "\
+Simplified interface of `helm' with other `helm-buffer'.
+Call `helm' with only ANY-SOURCES and ANY-BUFFER as args.
+
+\(fn ANY-SOURCES ANY-BUFFER)" nil nil)
+
+(autoload 'helm-debug-toggle "helm" "\
+Enable/disable helm debug from outside of helm session.
+
+\(fn)" t nil)
+
+;;;***
+\f
+;;;### (autoloads nil nil ("helm-core-pkg.el" "helm-lib.el" "helm-multi-match.el"
+;;;;;;  "helm-source.el") (22215 7773 270790 0))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-core-autoloads.el ends here
diff --git a/elpa/helm-core-20160217.958/helm-core-pkg.el b/elpa/helm-core-20160217.958/helm-core-pkg.el
new file mode 100644 (file)
index 0000000..e3073b5
--- /dev/null
@@ -0,0 +1,7 @@
+(define-package "helm-core" "20160217.958" "Development files for Helm"
+  '((emacs "24.3")
+    (async "1.6"))
+  :url "https://emacs-helm.github.io/helm/")
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
diff --git a/elpa/helm-core-20160217.958/helm-lib.el b/elpa/helm-core-20160217.958/helm-lib.el
new file mode 100644 (file)
index 0000000..cd7cd2a
--- /dev/null
@@ -0,0 +1,714 @@
+;;; helm-lib.el --- Helm routines. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015  Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; Author: Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+;; URL: http://github.com/emacs-helm/helm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; All helm functions that don't require specific helm code should go here.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'dired)
+
+\f
+;;; User vars.
+;;
+(defcustom helm-file-globstar t
+  "Same as globstar bash shopt option.
+When non--nil a pattern beginning with two stars will expand recursively.
+Directories expansion is not supported yet."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-yank-text-at-point-function nil
+  "The function used to forward point with `helm-yank-text-at-point'.
+With a nil value, fallback to default `forward-word'.
+The function should take one arg, an integer like `forward-word'.
+NOTE: Using `forward-symbol' here is not very useful as it is already
+provided by \\<helm-map>\\[next-history-element]."
+  :type  'function
+  :group 'helm)
+
+(defcustom helm-scroll-amount nil
+  "Scroll amount when scrolling other window in a helm session.
+It is used by `helm-scroll-other-window'
+and `helm-scroll-other-window-down'.
+
+If you prefer scrolling line by line, set this value to 1."
+  :group 'helm
+  :type 'integer)
+
+\f
+;;; Internal vars
+;;
+(defvar helm-yank-point nil)
+(defvar helm-pattern ""
+  "The input pattern used to update the helm buffer.")
+(defvar helm-buffer "*helm*"
+  "Buffer showing completions.")
+(defvar helm-current-buffer nil
+  "Current buffer when `helm' is invoked.")
+(defvar helm-suspend-update-flag nil)
+(defvar helm-action-buffer "*helm action*"
+  "Buffer showing actions.")
+\f
+;;; Macros helper.
+;;
+(defmacro helm-with-gensyms (symbols &rest body)
+  "Bind the SYMBOLS to fresh uninterned symbols and eval BODY."
+  (declare (indent 1))
+  `(let ,(mapcar (lambda (s)
+                   ;; Use cl-gensym here instead of make-symbol
+                   ;; to ensure a symbol that have a live that go
+                   ;; beyond the live of its macro have different name.
+                   ;; i.e symbols created with `with-helm-temp-hook'
+                   ;; should have random names.
+                   `(,s (cl-gensym (symbol-name ',s))))
+                 symbols)
+     ,@body))
+\f
+;;; Iterators
+;;
+(defun helm-iter-list (seq)
+  "Return an iterator object from SEQ."
+  (let ((lis seq))
+    (lambda ()
+      (let ((elm (car lis)))
+        (setq lis (cdr lis))
+        elm))))
+
+(defun helm-iter-next (iterator)
+  "Return next elm of ITERATOR."
+  (funcall iterator))
+
+(defun helm-make-actions (&rest args)
+  "Build an alist with (NAME . ACTION) elements with each pairs in ARGS.
+Where NAME is a string or a function returning a string or nil and ACTION
+a function.
+If NAME returns nil the pair is skipped.
+
+\(fn NAME ACTION ...)"
+  (cl-loop for i on args by #'cddr
+           for name  = (car i)
+           when (functionp name)
+           do (setq name (funcall name))
+           when name
+           collect (cons name (cadr i))))
+
+(defmacro helm-aif (test-form then-form &rest else-forms)
+  "Like `if' but set the result of TEST-FORM in a temprary variable called `it'.
+THEN-FORM and ELSE-FORMS are then excuted just like in `if'."
+  (declare (indent 2) (debug t))
+  `(let ((it ,test-form))
+     (if it ,then-form ,@else-forms)))
+
+(defun helm-current-line-contents ()
+  "Current line string without properties."
+  (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
+\f
+;;; Fuzzy matching routines
+;;
+(defsubst helm--mapconcat-pattern (pattern)
+  "Transform string PATTERN in regexp for further fuzzy matching.
+e.g helm.el$
+    => \"[^h]*h[^e]*e[^l]*l[^m]*m[^.]*[.][^e]*e[^l]*l$\"
+    ^helm.el$
+    => \"helm[.]el$\"."
+  (let ((ls (split-string-and-unquote pattern "")))
+    (if (string= "^" (car ls))
+        ;; Exact match.
+        (mapconcat (lambda (c)
+                     (if (and (string= c "$")
+                              (string-match "$\\'" pattern))
+                         c (regexp-quote c)))
+                   (cdr ls) "")
+        ;; Fuzzy match.
+        (mapconcat (lambda (c)
+                     (if (and (string= c "$")
+                              (string-match "$\\'" pattern))
+                         c (format "[^%s]*%s" c (regexp-quote c))))
+                   ls ""))))
+
+(defsubst helm--collect-pairs-in-string (string)
+  (cl-loop for str on (split-string string "" t) by 'cdr
+           when (cdr str)
+           collect (list (car str) (cadr str))))
+\f
+;;; Help routines.
+;;
+(defun helm-help-internal (bufname insert-content-fn)
+  "Show long message during `helm' session in BUFNAME.
+INSERT-CONTENT-FN is the function that insert
+text to be displayed in BUFNAME."
+  (let ((winconf (current-frame-configuration)))
+    (unwind-protect
+         (progn
+           (setq helm-suspend-update-flag t)
+           (set-buffer (get-buffer-create bufname))
+           (switch-to-buffer bufname)
+           (delete-other-windows)
+           (delete-region (point-min) (point-max))
+           (org-mode)
+           (save-excursion
+             (funcall insert-content-fn))
+           (buffer-disable-undo)
+           (helm-help-event-loop))
+      (setq helm-suspend-update-flag nil)
+      (set-frame-configuration winconf))))
+
+(defun helm-help-scroll-up (amount)
+  (condition-case _err
+      (scroll-up-command amount)
+    (beginning-of-buffer nil)
+    (end-of-buffer nil)))
+
+(defun helm-help-scroll-down (amount)
+  (condition-case _err
+      (scroll-down-command amount)
+    (beginning-of-buffer nil)
+    (end-of-buffer nil)))
+
+(defun helm-help-next-line ()
+  (condition-case _err
+      (call-interactively #'next-line)
+    (beginning-of-buffer nil)
+    (end-of-buffer nil)))
+
+(defun helm-help-previous-line ()
+  (condition-case _err
+      (call-interactively #'previous-line)
+    (beginning-of-buffer nil)
+    (end-of-buffer nil)))
+
+(defun helm-help-toggle-mark ()
+  (if (region-active-p)
+      (deactivate-mark)
+      (push-mark nil nil t)))
+
+;; For movement of cursor in help buffer we need to call interactively
+;; commands for impaired people using a synthetizer (#1347).
+(defun helm-help-event-loop ()
+  (let ((prompt (propertize
+                 "[SPC,C-v,down,next:NextPage  b,M-v,up,prior:PrevPage C-s/r:Isearch q:Quit]"
+                 'face 'helm-helper))
+        scroll-error-top-bottom)
+    (cl-loop for event = (read-key prompt) do
+             (cl-case event
+               ((?\C-v ? down next) (helm-help-scroll-up helm-scroll-amount))
+               ((?\M-v ?b up prior) (helm-help-scroll-down helm-scroll-amount))
+               (?\C-s (isearch-forward))
+               (?\C-r (isearch-backward))
+               (?\C-a (call-interactively #'move-beginning-of-line))
+               (?\C-e (call-interactively #'move-end-of-line))
+               (?\C-f (call-interactively #'forward-char))
+               (?\C-b (call-interactively #'backward-char))
+               (?\C-n (helm-help-next-line))
+               (?\C-p (helm-help-previous-line))
+               (?\M-a (call-interactively #'backward-sentence))
+               (?\M-e (call-interactively #'forward-sentence))
+               (?\M-f (call-interactively #'forward-word))
+               (?\M-b (call-interactively #'backward-word))
+               (?\C-  (helm-help-toggle-mark))
+               (?\M-w (copy-region-as-kill
+                       (region-beginning) (region-end))
+                      (deactivate-mark))
+               (?q    (cl-return))
+               (t     (ignore))))))
+
+\f
+;;; List processing
+;;
+(defun helm-flatten-list (seq &optional omit-nulls)
+  "Return a list of all single elements of sublists in SEQ."
+  (let (result)
+    (cl-labels ((flatten (seq)
+                  (cl-loop
+                        for elm in seq
+                        if (and (or elm
+                                    (null omit-nulls))
+                                (or (atom elm)
+                                    (functionp elm)
+                                    (and (consp elm)
+                                         (cdr elm)
+                                         (atom (cdr elm)))))
+                        do (push elm result)
+                        else do (flatten elm))))
+      (flatten seq))
+    (nreverse result)))
+
+(defun helm-mklist (obj)
+  "If OBJ is a list \(but not lambda\), return itself.
+Otherwise make a list with one element."
+  (if (and (listp obj) (not (functionp obj)))
+      obj
+    (list obj)))
+
+(cl-defmacro helm-position (item seq &key (test 'eq) all)
+  "A simple and faster replacement of CL `position'.
+Return position of first occurence of ITEM found in SEQ.
+Argument SEQ can be a string, in this case ITEM have to be a char.
+Argument ALL, if non--nil specify to return a list of positions of
+all ITEM found in SEQ."
+  (let ((key (if (stringp seq) 'across 'in)))
+    `(cl-loop for c ,key ,seq
+           for index from 0
+           when (funcall ,test c ,item)
+           if ,all collect index into ls
+           else return index
+           finally return ls)))
+
+(cl-defun helm-fast-remove-dups (seq &key (test 'eq))
+  "Remove duplicates elements in list SEQ.
+This is same as `remove-duplicates' but with memoisation.
+It is much faster, especially in large lists.
+A test function can be provided with TEST argument key.
+Default is `eq'."
+  (cl-loop with cont = (make-hash-table :test test)
+        for elm in seq
+        unless (gethash elm cont)
+        do (puthash elm elm cont)
+        finally return
+        (cl-loop for i being the hash-values in cont collect i)))
+
+(defun helm-skip-entries (seq black-regexp-list &optional white-regexp-list)
+  "Remove entries which matches one of REGEXP-LIST from SEQ."
+  (cl-loop for i in seq
+           unless (and (cl-loop for re in black-regexp-list
+                                thereis (and (stringp i)
+                                             (string-match-p re i)))
+                       (null
+                        (cl-loop for re in white-regexp-list
+                                thereis (and (stringp i)
+                                             (string-match-p re i)))))
+           collect i))
+
+(defun helm-shadow-entries (seq regexp-list)
+  "Put shadow property on entries in SEQ matching a regexp in REGEXP-LIST."
+  (let ((face 'italic))
+    (cl-loop for i in seq
+          if (cl-loop for regexp in regexp-list
+                   thereis (and (stringp i)
+                                (string-match regexp i)))
+          collect (propertize i 'face face)
+          else collect i)))
+
+(defun helm-remove-if-not-match (regexp seq)
+  "Remove all elements of SEQ that don't match REGEXP."
+  (cl-loop for s in seq
+           for str = (cond ((symbolp s)
+                            (symbol-name s))
+                           ((consp s)
+                            (car s))
+                           (t s))
+           when (string-match-p regexp str)
+           collect s))
+
+(defun helm-remove-if-match (regexp seq)
+  "Remove all elements of SEQ that match REGEXP."
+  (cl-loop for s in seq
+           for str = (cond ((symbolp s)
+                            (symbol-name s))
+                           ((consp s)
+                            (car s))
+                           (t s))
+           unless (string-match-p regexp str)
+           collect s))
+
+(defun helm-transform-mapcar (function args)
+  "`mapcar' for candidate-transformer.
+
+ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...)
+
+\(helm-transform-mapcar 'upcase '(\"foo\" \"bar\"))
+=> (\"FOO\" \"BAR\")
+\(helm-transform-mapcar 'upcase '((\"1st\" . \"foo\") (\"2nd\" . \"bar\")))
+=> ((\"1st\" . \"FOO\") (\"2nd\" . \"BAR\"))
+"
+  (cl-loop for arg in args
+        if (consp arg)
+        collect (cons (car arg) (funcall function (cdr arg)))
+        else
+        collect (funcall function arg)))
+\f
+;;; Strings processing.
+;;
+(defun helm-stringify (str-or-sym)
+  "Get string of STR-OR-SYM."
+  (if (stringp str-or-sym)
+      str-or-sym
+    (symbol-name str-or-sym)))
+
+(defun helm-substring (str width)
+  "Return the substring of string STR from 0 to WIDTH.
+Handle multibyte characters by moving by columns."
+  (with-temp-buffer
+    (save-excursion
+      (insert str))
+    (move-to-column width)
+    (buffer-substring (point-at-bol) (point))))
+
+(defun helm-substring-by-width (str width &optional endstr)
+  "Truncate string STR to end at column WIDTH.
+Similar to `truncate-string-to-width'.
+Add ENDSTR at end of truncated STR.
+Add spaces at end if needed to reach WIDTH when STR is shorter than WIDTH."
+  (cl-loop for ini-str = str
+        then (substring ini-str 0 (1- (length ini-str)))
+        for sw = (string-width ini-str)
+        when (<= sw width) return
+        (concat ini-str endstr (make-string (- width sw) ? ))))
+
+(defun helm-string-multibyte-p (str)
+  "Check if string STR contains multibyte characters."
+  (cl-loop for c across str
+        thereis (> (char-width c) 1)))
+
+(defun helm-get-pid-from-process-name (process-name)
+  "Get pid from running process PROCESS-NAME."
+  (cl-loop with process-list = (list-system-processes)
+        for pid in process-list
+        for process = (assoc-default 'comm (process-attributes pid))
+        when (and process (string-match process-name process))
+        return pid))
+
+(defun helm-ff-find-printers ()
+  "Return a list of available printers on Unix systems."
+  (when (executable-find "lpstat")
+    (let ((printer-list (with-temp-buffer
+                          (call-process "lpstat" nil t nil "-a")
+                          (split-string (buffer-string) "\n"))))
+      (cl-loop for p in printer-list
+            for printer = (car (split-string p))
+            when printer
+            collect printer))))
+
+(defun helm-region-active-p ()
+  (and transient-mark-mode mark-active (/= (mark) (point))))
+
+(defun helm-quote-whitespace (candidate)
+  "Quote whitespace, if some, in string CANDIDATE."
+  (replace-regexp-in-string " " "\\\\ " candidate))
+
+\f
+;;; Symbols routines
+;;
+(defun helm-symbolify (str-or-sym)
+  "Get symbol of STR-OR-SYM."
+  (if (symbolp str-or-sym)
+      str-or-sym
+    (intern str-or-sym)))
+
+(defun helm-symbol-name (obj)
+  (if (or (consp obj) (byte-code-function-p obj))
+      "Anonymous"
+      (symbol-name obj)))
+
+(defun helm-describe-function (func)
+  "FUNC is symbol or string."
+  (describe-function (helm-symbolify func))
+  (message nil))
+
+(defun helm-describe-variable (var)
+  "VAR is symbol or string."
+  (describe-variable (helm-symbolify var))
+  (message nil))
+
+(defun helm-describe-face (face)
+  "VAR is symbol or string."
+  (describe-face (helm-symbolify face))
+  (message nil))
+
+(defun helm-find-function (func)
+  "FUNC is symbol or string."
+  (find-function (helm-symbolify func)))
+
+(defun helm-find-variable (var)
+  "VAR is symbol or string."
+  (find-variable (helm-symbolify var)))
+
+(defun helm-find-face-definition (face)
+  "FACE is symbol or string."
+  (find-face-definition (helm-symbolify face)))
+
+(defun helm-kill-new (candidate &optional replace)
+  "CANDIDATE is symbol or string.
+See `kill-new' for argument REPLACE."
+  (kill-new (helm-stringify candidate) replace))
+\f
+;;; Files routines
+;;
+(defun helm-file-name-sans-extension (filename)
+  "Same as `file-name-sans-extension' but remove all extensions."
+  (helm-aif (file-name-sans-extension filename)
+      ;; Start searching at index 1 for files beginning with a dot (#1335).
+      (if (string-match "\\." (helm-basename it) 1)
+          (helm-file-name-sans-extension it)
+          it)))
+
+(defun helm-basename (fname &optional ext)
+  "Print FNAME  with any  leading directory  components removed.
+If specified, also remove filename extension EXT.
+Arg EXT can be specified as a string with or without dot."
+  (let ((non-essential t))
+    (if (and ext (or (string= (file-name-extension fname) ext)
+                     (string= (file-name-extension fname t) ext))
+             (not (file-directory-p fname)))
+        (file-name-sans-extension (file-name-nondirectory fname))
+      (file-name-nondirectory (directory-file-name fname)))))
+
+(defun helm-basedir (fname)
+  "Return the base directory of filename ending by a slash."
+  (helm-aif (and fname
+                 (or (and (string= fname "~") "~")
+                     (file-name-directory fname)))
+      (file-name-as-directory it)))
+
+(defun helm-current-directory ()
+  "Return current-directory name at point.
+Useful in dired buffers when there is inserted subdirs."
+  (expand-file-name
+   (if (eq major-mode 'dired-mode)
+       (dired-current-directory)
+       default-directory)))
+
+(defun helm-w32-prepare-filename (file)
+  "Convert filename FILE to something usable by external w32 executables."
+  (replace-regexp-in-string ; For UNC paths
+   "/" "\\"
+   (replace-regexp-in-string ; Strip cygdrive paths
+    "/cygdrive/\\(.\\)" "\\1:"
+    file nil nil) nil t))
+
+(defun helm-w32-shell-execute-open-file (file)
+  (with-no-warnings
+    (w32-shell-execute "open" (helm-w32-prepare-filename file))))
+
+;; Same as `vc-directory-exclusion-list'.
+(defvar helm-walk-ignore-directories
+  '("SCCS" "RCS" "CVS" "MCVS" ".svn" ".git" ".hg" ".bzr"
+    "_MTN" "_darcs" "{arch}" ".gvfs"))
+
+(cl-defun helm-walk-directory (directory &key (path 'basename)
+                                           (directories t)
+                                           match skip-subdirs)
+  "Walk through DIRECTORY tree.
+Argument PATH can be one of basename, relative, full, or a function
+called on file name, default to basename.
+Argument DIRECTORIES when non--nil (default) return also directories names,
+otherwise skip directories names.
+Argument MATCH can be a predicate or a regexp.
+Argument SKIP-SUBDIRS when non--nil will skip `helm-walk-ignore-directories'
+unless it is given as a list of directories, in this case this list will be used
+instead of `helm-walk-ignore-directories'."
+  (let* ((result '())
+         (fn (cl-case path
+               (basename 'file-name-nondirectory)
+               (relative 'file-relative-name)
+               (full     'identity)
+               (t        path))))
+    (cl-labels ((ls-rec (dir)
+                  (unless (and skip-subdirs
+                               (member (helm-basename dir)
+                                       (if (listp skip-subdirs)
+                                           skip-subdirs
+                                         helm-walk-ignore-directories)))
+                    (cl-loop with ls = (sort (file-name-all-completions "" dir)
+                                             'string-lessp)
+                          for f in ls
+                          ;; Use `directory-file-name' to remove the final slash.
+                          ;; Needed to avoid infloop on symlinks symlinking
+                          ;; a directory inside it [1].
+                          for file = (directory-file-name
+                                      (expand-file-name f dir))
+                          unless (member f '("./" "../"))
+                          ;; A directory.
+                          if (char-equal (aref f (1- (length f))) ?/)
+                          do (progn (when directories
+                                      (push (funcall fn file) result))
+                                    ;; Don't recurse in symlinks.
+                                    ;; `file-symlink-p' have to be called
+                                    ;; on the directory with its final
+                                    ;; slash removed [1].
+                                    (and (not (file-symlink-p file))
+                                         (ls-rec file)))
+                          else do
+                          (if match
+                              (and (if (functionp match)
+                                       (funcall match f)
+                                     (and (stringp match)
+                                          (string-match match f)))
+                                   (push (funcall fn file) result))
+                            (push (funcall fn file) result))))))
+      (ls-rec directory)
+      (nreverse result))))
+
+(defun helm-file-expand-wildcards (pattern &optional full)
+  "Same as `file-expand-wildcards' but allow recursion.
+Recursion happen when PATTERN starts with two stars.
+Directories expansion is not supported."
+  (let ((bn (helm-basename pattern)))
+    (if (and helm-file-globstar
+             (string-match "\\`\\*\\{2\\}\\(.*\\)" bn))
+        (helm-walk-directory (helm-basedir pattern)
+                             :path (cl-case full
+                                     (full 'full)
+                                     (relative 'relative)
+                                     ((basename nil) 'basename)
+                                     (t 'full))
+                             :directories nil
+                             :match (wildcard-to-regexp bn)
+                             :skip-subdirs t)
+        (file-expand-wildcards pattern full))))
+\f
+;;; helm internals
+;;
+(defun helm-set-pattern (pattern &optional noupdate)
+  "Set minibuffer contents to PATTERN.
+if optional NOUPDATE is non-nil, helm buffer is not changed."
+  (with-selected-window (or (active-minibuffer-window) (minibuffer-window))
+    (delete-minibuffer-contents)
+    (insert pattern))
+  (when noupdate
+    (setq helm-pattern pattern)))
+
+(defun helm-minibuffer-completion-contents ()
+  "Return the user input in a minibuffer before point as a string.
+That is what completion commands operate on."
+  (buffer-substring (field-beginning) (point)))
+
+(defmacro with-helm-buffer (&rest body)
+  "Eval BODY inside `helm-buffer'."
+  (declare (indent 0) (debug t))
+  `(with-current-buffer (helm-buffer-get)
+     ,@body))
+
+(defmacro with-helm-current-buffer (&rest body)
+  "Eval BODY inside `helm-current-buffer'."
+  (declare (indent 0) (debug t))
+  `(with-current-buffer (or (and (buffer-live-p helm-current-buffer)
+                                 helm-current-buffer)
+                            (setq helm-current-buffer
+                                  (current-buffer)))
+     ,@body))
+
+(defun helm-buffer-get ()
+  "Return `helm-action-buffer' if shown otherwise `helm-buffer'."
+  (if (helm-action-window)
+      helm-action-buffer
+    helm-buffer))
+
+(defun helm-window ()
+  "Window of `helm-buffer'."
+  (get-buffer-window (helm-buffer-get) 0))
+
+(defun helm-action-window ()
+  "Window of `helm-action-buffer'."
+  (get-buffer-window helm-action-buffer 'visible))
+
+(defmacro with-helm-window (&rest body)
+  "Be sure BODY is excuted in the helm window."
+  (declare (indent 0) (debug t))
+  `(with-selected-window (helm-window)
+     ,@body))
+
+\f
+;; Yank text at point.
+;;
+;;
+(defun helm-yank-text-at-point ()
+  "Yank text at point in `helm-current-buffer' into minibuffer."
+  (interactive)
+  (with-helm-current-buffer
+    (let ((fwd-fn (or helm-yank-text-at-point-function #'forward-word)))
+      ;; Start to initial point if C-w have never been hit.
+      (unless helm-yank-point (setq helm-yank-point (point)))
+      (save-excursion
+        (goto-char helm-yank-point)
+        (funcall fwd-fn 1)
+        (helm-set-pattern
+         (concat
+          helm-pattern (replace-regexp-in-string
+                        "\\`\n" ""
+                        (buffer-substring-no-properties
+                         helm-yank-point (point)))))
+        (setq helm-yank-point (point))))))
+
+(defun helm-reset-yank-point ()
+  (setq helm-yank-point nil))
+
+(add-hook 'helm-cleanup-hook 'helm-reset-yank-point)
+(add-hook 'helm-after-initialize-hook 'helm-reset-yank-point)
+
+;;; Ansi
+;;
+;;
+(defvar helm--ansi-color-regexp
+  "\033\\[\\(K\\|[0-9;]*m\\)")
+(defvar helm--ansi-color-drop-regexp
+  "\033\\[\\([ABCDsuK]\\|[12][JK]\\|=[0-9]+[hI]\\|[0-9;]*[Hf]\\)")
+(defun helm--ansi-color-apply (string)
+  "A version of `ansi-color-apply' immune to upstream changes.
+
+Similar to the emacs-24.5 version without support to `ansi-color-context'
+which is buggy in emacs.
+
+Modify also `ansi-color-regexp' by using own variable `helm--ansi-color-regexp'
+that match whole STRING.
+
+This is needed to provide compatibility for both emacs-25 and emacs-24.5
+as emacs-25 version of `ansi-color-apply' is partially broken."
+  (let ((start 0)
+        codes end escape-sequence
+        result colorized-substring)
+    ;; Find the next escape sequence.
+    (while (setq end (string-match helm--ansi-color-regexp string start))
+      (setq escape-sequence (match-string 1 string))
+      ;; Colorize the old block from start to end using old face.
+      (when codes
+        (put-text-property
+         start end 'font-lock-face (ansi-color--find-face codes) string))
+      (setq colorized-substring (substring string start end)
+            start (match-end 0))
+      ;; Eliminate unrecognized ANSI sequences.
+      (while (string-match helm--ansi-color-drop-regexp colorized-substring)
+        (setq colorized-substring
+              (replace-match "" nil nil colorized-substring)))
+      (push colorized-substring result)
+      ;; Create new face, by applying escape sequence parameters.
+      (setq codes (ansi-color-apply-sequence escape-sequence codes)))
+    ;; If the rest of the string should have a face, put it there.
+    (when codes
+      (put-text-property
+       start (length string)
+       'font-lock-face (ansi-color--find-face codes) string))
+    ;; Save the remainder of the string to the result.
+    (if (string-match "\033" string start)
+        (push (substring string start (match-beginning 0)) result)
+        (push (substring string start) result))
+    (apply 'concat (nreverse result))))
+
+(provide 'helm-lib)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-lib ends here
diff --git a/elpa/helm-core-20160217.958/helm-multi-match.el b/elpa/helm-core-20160217.958/helm-multi-match.el
new file mode 100644 (file)
index 0000000..3e740da
--- /dev/null
@@ -0,0 +1,373 @@
+;;; helm-multi-match.el --- Multiple regexp matching methods for helm -*- lexical-binding: t -*-
+
+;; Original Author: rubikitch
+
+;; Copyright (C) 2008 ~ 2011 rubikitch
+;; Copyright (C) 2011 ~ 2015 Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; Author: Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+;; URL: http://github.com/emacs-helm/helm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm-lib)
+
+\f
+(defgroup helm-multi-match nil
+  "Helm multi match."
+  :group 'helm)
+
+(defcustom helm-mm-matching-method 'multi3
+  "Matching method for helm match plugin.
+You can set here different methods to match candidates in helm.
+Here are the possible value of this symbol and their meaning:
+- multi1: Respect order, prefix of pattern must match.
+- multi2: Same but with partial match.
+- multi3: The best, multiple regexp match, allow negation.
+- multi3p: Same but prefix must match.
+
+Default is multi3, you should keep this for a better experience.
+
+Note that multi1 and multi3p are incompatible with fuzzy matching
+in file completion and by the way fuzzy matching will be disabled there
+when these options are used."
+  :type  '(radio :tag "Matching methods for helm"
+           (const :tag "Multiple regexp 1 ordered with prefix match"         multi1)
+           (const :tag "Multiple regexp 2 ordered with partial match"        multi2)
+           (const :tag "Multiple regexp 3 matching no order, partial, best." multi3)
+           (const :tag "Multiple regexp 3p matching with prefix match"       multi3p))
+  :group 'helm-multi-match)
+
+\f
+;; Internal
+(defconst helm-mm-default-match-functions
+  '(helm-mm-exact-match helm-mm-match))
+(defconst helm-mm-default-search-functions
+  '(helm-mm-exact-search helm-mm-search))
+
+\f
+;;; Build regexps
+;;
+;;
+(defvar helm-mm-space-regexp "[\\ ] "
+  "Regexp to represent space itself in multiple regexp match.")
+
+(defun helm-mm-split-pattern (pattern)
+  "Split PATTERN if it contain spaces and return resulting list.
+If spaces in PATTERN are escaped, don't split at this place.
+i.e \"foo bar\"=> (\"foo\" \"bar\")
+but \"foo\ bar\"=> (\"foobar\")."
+  (if (string= pattern "")
+      '("")
+    (cl-loop for s in (split-string
+                       (replace-regexp-in-string helm-mm-space-regexp
+                                                 "\000\000" pattern)
+                       " " t)
+          collect (replace-regexp-in-string "\000\000" " " s))))
+
+(defun helm-mm-1-make-regexp (pattern)
+  "Replace spaces in PATTERN with \"\.*\"."
+  (mapconcat 'identity (helm-mm-split-pattern pattern) ".*"))
+
+\f
+;;; Exact match.
+;;
+;;
+;; Internal.
+(defvar helm-mm-exact-pattern-str nil)
+(defvar helm-mm-exact-pattern-real nil)
+
+(defun helm-mm-exact-get-pattern (pattern)
+  (unless (equal pattern helm-mm-exact-pattern-str)
+    (setq helm-mm-exact-pattern-str pattern
+          helm-mm-exact-pattern-real (concat "\n" pattern "\n")))
+  helm-mm-exact-pattern-real)
+
+
+(cl-defun helm-mm-exact-match (str &optional (pattern helm-pattern))
+  (if case-fold-search
+      (progn
+        (setq str (downcase str)
+              pattern (downcase pattern))
+        (string= str pattern))
+      (string= str pattern)))
+
+(defun helm-mm-exact-search (pattern &rest _ignore)
+  (and (search-forward (helm-mm-exact-get-pattern pattern) nil t)
+       (forward-line -1)))
+
+\f
+;;; Prefix match
+;;
+;;
+;; Internal
+(defvar helm-mm-prefix-pattern-str nil)
+(defvar helm-mm-prefix-pattern-real nil)
+
+(defun helm-mm-prefix-get-pattern (pattern)
+  (unless (equal pattern helm-mm-prefix-pattern-str)
+    (setq helm-mm-prefix-pattern-str pattern
+          helm-mm-prefix-pattern-real (concat "\n" pattern)))
+  helm-mm-prefix-pattern-real)
+
+(defun helm-mm-prefix-match (str &optional pattern)
+  ;; In filename completion basename and basedir may be
+  ;; quoted, unquote them for string comparison (Issue #1283).
+  (setq pattern (replace-regexp-in-string
+                 "\\\\" "" (or pattern helm-pattern)))
+  (let ((len (length pattern)))
+    (and (<= len (length str))
+         (string= (substring str 0 len) pattern ))))
+
+(defun helm-mm-prefix-search (pattern &rest _ignore)
+  (search-forward (helm-mm-prefix-get-pattern pattern) nil t))
+
+\f
+;;; Multiple regexp patterns 1 (order is preserved / prefix).
+;;
+;;
+;; Internal
+(defvar helm-mm-1-pattern-str nil)
+(defvar helm-mm-1-pattern-real nil)
+
+(defun helm-mm-1-get-pattern (pattern)
+  (unless (equal pattern helm-mm-1-pattern-str)
+    (setq helm-mm-1-pattern-str pattern
+          helm-mm-1-pattern-real
+          (concat "^" (helm-mm-1-make-regexp pattern))))
+  helm-mm-1-pattern-real)
+
+(cl-defun helm-mm-1-match (str &optional (pattern helm-pattern))
+  (string-match (helm-mm-1-get-pattern pattern) str))
+
+(defun helm-mm-1-search (pattern &rest _ignore)
+  (re-search-forward (helm-mm-1-get-pattern pattern) nil t))
+
+\f
+;;; Multiple regexp patterns 2 (order is preserved / partial).
+;;
+;;
+;; Internal
+(defvar helm-mm-2-pattern-str nil)
+(defvar helm-mm-2-pattern-real nil)
+
+(defun helm-mm-2-get-pattern (pattern)
+  (unless (equal pattern helm-mm-2-pattern-str)
+    (setq helm-mm-2-pattern-str pattern
+          helm-mm-2-pattern-real
+          (concat "^.*" (helm-mm-1-make-regexp pattern))))
+  helm-mm-2-pattern-real)
+
+(cl-defun helm-mm-2-match (str &optional (pattern helm-pattern))
+  (string-match (helm-mm-2-get-pattern pattern) str))
+
+(defun helm-mm-2-search (pattern &rest _ignore)
+  (re-search-forward (helm-mm-2-get-pattern pattern) nil t))
+
+\f
+;;; Multiple regexp patterns 3 (permutation).
+;;
+;;
+;; Internal
+(defvar helm-mm-3-pattern-str nil)
+(defvar helm-mm-3-pattern-list nil)
+
+(defun helm-mm-3-get-patterns (pattern)
+  "Return `helm-mm-3-pattern-list', a list of predicate/regexp cons cells.
+e.g ((identity . \"foo\") (identity . \"bar\")).
+This is done only if `helm-mm-3-pattern-str' is same as PATTERN."
+  (unless (equal pattern helm-mm-3-pattern-str)
+    (setq helm-mm-3-pattern-str pattern
+          helm-mm-3-pattern-list
+          (helm-mm-3-get-patterns-internal pattern)))
+  helm-mm-3-pattern-list)
+
+(defun helm-mm-3-get-patterns-internal (pattern)
+  "Return a list of predicate/regexp cons cells.
+e.g ((identity . \"foo\") (identity . \"bar\"))."
+  (unless (string= pattern "")
+    (cl-loop for pat in (helm-mm-split-pattern pattern)
+          collect (if (string= "!" (substring pat 0 1))
+                      (cons 'not (substring pat 1))
+                    (cons 'identity pat)))))
+
+(cl-defun helm-mm-3-match (str &optional (pattern helm-pattern))
+  "Check if PATTERN match STR.
+When PATTERN contain a space, it is splitted and matching is done
+with the several resulting regexps against STR.
+e.g \"bar foo\" will match \"foobar\" and \"barfoo\".
+Argument PATTERN, a string, is transformed in a list of
+cons cell with `helm-mm-3-get-patterns' if it contain a space.
+e.g \"foo bar\"=>((identity . \"foo\") (identity . \"bar\")).
+Then each predicate of cons cell(s) is called with regexp of same
+cons cell against STR (a candidate).
+i.e (identity (string-match \"foo\" \"foo bar\")) => t."
+  (let ((pat (helm-mm-3-get-patterns pattern)))
+    (cl-loop for (predicate . regexp) in pat
+             always (funcall predicate
+                             (condition-case _err
+                                 ;; FIXME: Probably do nothing when
+                                 ;; using fuzzy leaving the job
+                                 ;; to the fuzzy fn.
+                                 (string-match regexp str)
+                               (invalid-regexp nil))))))
+
+(defun helm-mm-3-search-base (pattern searchfn1 searchfn2)
+  "Try to find PATTERN in `helm-buffer' with SEARCHFN1 and SEARCHFN2.
+This is the search function for `candidates-in-buffer' enabled sources.
+Use the same method as `helm-mm-3-match' except it search in buffer
+instead of matching on a string.
+i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t."
+  (cl-loop with pat = (if (stringp pattern)
+                          (helm-mm-3-get-patterns pattern)
+                          pattern)
+           when (eq (caar pat) 'not) return
+           ;; Pass the job to `helm-search-match-part'.
+           (prog1 (list (point-at-bol) (point-at-eol))
+             (forward-line 1))
+           while (condition-case _err
+                     (funcall searchfn1 (or (cdar pat) "") nil t)
+                   (invalid-regexp nil))
+           for bol = (point-at-bol)
+           for eol = (point-at-eol)
+           if (cl-loop for (pred . str) in (cdr pat) always
+                       (progn (goto-char bol)
+                              (funcall pred (condition-case _err
+                                                (funcall searchfn2 str eol t)
+                                              (invalid-regexp nil)))))
+           do (goto-char eol) and return t
+           else do (goto-char eol)
+           finally return nil))
+
+(defun helm-mm-3-search (pattern &rest _ignore)
+  (when (stringp pattern)
+    (setq pattern (helm-mm-3-get-patterns pattern)))
+  (helm-mm-3-search-base
+   pattern 're-search-forward 're-search-forward))
+\f
+;;; mp-3 with migemo
+;;
+;;
+(defvar helm-mm--previous-migemo-info nil
+  "[Internal] Cache previous migemo query.")
+(make-local-variable 'helm-mm--previous-migemo-info)
+
+(declare-function migemo-get-pattern "ext:migemo.el")
+(declare-function migemo-search-pattern-get "ext:migemo.el")
+
+(define-minor-mode helm-migemo-mode
+    "Enable migemo in helm.
+It will be available in the sources handling it,
+i.e the sources which have the slot :migemo with non--nil value."
+  :lighter " Hmio"
+  :group 'helm
+  :global t
+  (cl-assert (featurep 'migemo)
+             nil "No feature called migemo found, install migemo.el."))
+
+(defun helm-mm-migemo-get-pattern (pattern)
+  (let ((regex (migemo-get-pattern pattern)))
+    (if (ignore-errors (string-match regex "") t)
+        (concat regex "\\|" pattern) pattern)))
+
+(defun helm-mm-migemo-search-pattern-get (pattern)
+  (let ((regex (migemo-search-pattern-get pattern)))
+    (if (ignore-errors (string-match regex "") t)
+        (concat regex "\\|" pattern) pattern)))
+
+(defun helm-mm-migemo-string-match (pattern str)
+  "Migemo version of `string-match'."
+  (unless (assoc pattern helm-mm--previous-migemo-info)
+    (with-helm-buffer
+      (setq helm-mm--previous-migemo-info
+            (push (cons pattern (helm-mm-migemo-get-pattern pattern))
+                  helm-mm--previous-migemo-info))))
+  (string-match (assoc-default pattern helm-mm--previous-migemo-info) str))
+
+(cl-defun helm-mm-3-migemo-match (str &optional (pattern helm-pattern))
+  (and helm-migemo-mode
+       (cl-loop for (pred . re) in (helm-mm-3-get-patterns pattern)
+                always (funcall pred (helm-mm-migemo-string-match re str)))))
+
+(defun helm-mm-migemo-forward (word &optional bound noerror count)
+  (with-helm-buffer
+    (unless (assoc word helm-mm--previous-migemo-info)
+      (setq helm-mm--previous-migemo-info
+            (push (cons word (if (delq 'ascii (find-charset-string word))
+                                 word
+                               (helm-mm-migemo-search-pattern-get word)))
+                  helm-mm--previous-migemo-info))))
+  (re-search-forward
+   (assoc-default word helm-mm--previous-migemo-info) bound noerror count))
+
+(defun helm-mm-3-migemo-search (pattern &rest _ignore)
+  (and helm-migemo-mode
+       (helm-mm-3-search-base
+        pattern 'helm-mm-migemo-forward 'helm-mm-migemo-forward)))
+
+\f
+;;; mp-3p- (multiple regexp pattern 3 with prefix search)
+;;
+;;
+(defun helm-mm-3p-match (str &optional pattern)
+  "Check if PATTERN match STR.
+Same as `helm-mm-3-match' but more strict, matching against prefix also.
+e.g \"bar foo\" will match \"barfoo\" but not \"foobar\" contrarily to
+`helm-mm-3-match'."
+  (let* ((pat (helm-mm-3-get-patterns (or pattern helm-pattern)))
+         (first (car pat)))
+    (and (funcall (car first) (helm-mm-prefix-match str (cdr first)))
+         (cl-loop for (predicate . regexp) in (cdr pat)
+               always (funcall predicate (string-match regexp str))))))
+
+(defun helm-mm-3p-search (pattern &rest _ignore)
+  (when (stringp pattern)
+    (setq pattern (helm-mm-3-get-patterns pattern)))
+  (helm-mm-3-search-base
+   pattern 'helm-mm-prefix-search 're-search-forward))
+
+\f
+;;; Generic multi-match/search functions
+;;
+;;
+(cl-defun helm-mm-match (str &optional (pattern helm-pattern))
+  (let ((fun (cl-ecase helm-mm-matching-method
+               (multi1 #'helm-mm-1-match)
+               (multi2 #'helm-mm-2-match)
+               (multi3 #'helm-mm-3-match)
+               (multi3p #'helm-mm-3p-match))))
+    (funcall fun str pattern)))
+
+(defun helm-mm-search (pattern &rest _ignore)
+  (let ((fun (cl-ecase helm-mm-matching-method
+               (multi1 #'helm-mm-1-search)
+               (multi2 #'helm-mm-2-search)
+               (multi3 #'helm-mm-3-search)
+               (multi3p #'helm-mm-3p-search))))
+    (funcall fun pattern)))
+
+
+(provide 'helm-multi-match)
+
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-multi-match.el ends here
diff --git a/elpa/helm-core-20160217.958/helm-source.el b/elpa/helm-core-20160217.958/helm-source.el
new file mode 100644 (file)
index 0000000..71d22b5
--- /dev/null
@@ -0,0 +1,1016 @@
+;;; helm-source.el --- Helm source creation. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015  Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; Author: Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+;; URL: http://github.com/emacs-helm/helm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Interface to create helm sources easily.
+;; Actually the eieo objects are transformed in alist for compatibility.
+;; In the future this package should allow creating source as eieo objects
+;; without conversion to alist, teaching helm to read such a structure.
+;; The compatibility with alists would be kept.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'eieio)
+(require 'helm-lib)
+
+(defvar helm-fuzzy-sort-fn)
+(defvar helm-fuzzy-match-fn)
+(defvar helm-fuzzy-search-fn)
+
+(declare-function helm-init-candidates-in-buffer "helm.el")
+(declare-function helm-interpret-value "helm.el")
+(declare-function helm-fuzzy-highlight-matches "helm.el")
+
+\f
+(defgeneric helm--setup-source (source)
+  "Prepare slots and handle slot errors before creating a helm source.")
+
+(defgeneric helm-setup-user-source (source)
+  "Allow users modifying slots in SOURCE just before creation.")
+
+\f
+;;; Classes for sources
+;;
+;;
+(defclass helm-source ()
+  ((name
+    :initarg :name
+    :initform nil
+    :custom string
+    :documentation
+    "  The name of the source.
+  A string which is also the heading which appears
+  above the list of matches from the source. Must be unique.")
+
+   (header-name
+    :initarg :header-name
+    :initform nil
+    :custom function
+    :documentation
+    "  A function returning the display string of the header.
+  Its argument is the name of the source. This attribute is useful to
+  add an additional information with the source name.
+  It doesn't modify the name of the source.")
+
+   (init
+    :initarg :init
+    :initform nil
+    :custom function
+    :documentation
+    "  Function called with no parameters when helm is started.
+  It is useful for collecting current state information which can be
+  used to create the list of candidates later.
+  Initialization of `candidates-in-buffer' is done here
+  with `helm-init-candidates-in-buffer'.")
+
+   (candidates
+    :initarg :candidates
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  Specifies how to retrieve candidates from the source.
+  It can either be a variable name, a function called with no parameters
+  or the actual list of candidates.
+
+  The list must be a list whose members are strings, symbols
+  or (DISPLAY . REAL) pairs.
+
+  In case of (DISPLAY . REAL) pairs, the DISPLAY string is shown
+  in the Helm buffer, but the REAL one is used as action
+  argument when the candidate is selected. This allows a more
+  readable presentation for candidates which would otherwise be,
+  for example, too long or have a common part shared with other
+  candidates which can be safely replaced with an abbreviated
+  string for display purposes.
+
+  Note that if the (DISPLAY . REAL) form is used then pattern
+  matching is done on the displayed string, not on the real
+  value.")
+
+   (update
+    :initarg :update
+    :initform nil
+    :custom function
+    :documentation
+    "  Function called with no parameters at before \"init\" function
+  when `helm-force-update' is called.")
+
+   (cleanup
+    :initarg :cleanup
+    :initform nil
+    :custom function
+    :documentation
+    "  Function called with no parameters when *helm* buffer is
+  closed. It is useful for killing unneeded candidates buffer.
+
+  Note that the function is executed BEFORE performing action.")
+
+   (delayed
+    :initarg :delayed
+    :initform nil
+    :custom (choice null integer)
+    :documentation
+    "  Candidates from the source are shown only if the user stops
+  typing and is idle for `helm-idle-delay' seconds.
+  If a value is given to delayed attr, this value is used instead only
+  if it is > to `helm-idle-delay'.")
+
+   (keymap
+    :initarg :keymap
+    :initform nil
+    :custom sexp
+    :documentation
+    "  Specific keymap for this source.
+  It is useful to have a keymap per source when using more than
+  one source.  Otherwise, a keymap can be set per command with
+  `helm' argument KEYMAP.  NOTE: when a source have `helm-map' as
+  keymap attr, the global value of `helm-map' will override the
+  actual local one.")
+
+   (action
+    :initarg :action
+    :initform 'identity
+    :custom (alist :key-type string
+                   :value-type function)
+    :documentation
+    "  An alist of (DISPLAY . FUNCTION) pairs, a variable name  or a function.
+  FUNCTION is called with one parameter: the selected candidate.
+
+  An action other than the default can be chosen from this list
+  of actions for the currently selected candidate (by default
+  with TAB). The DISPLAY string is shown in the completions
+  buffer and the FUNCTION is invoked when an action is
+  selected. The first action of the list is the default.
+
+  You should use `helm-make-actions' to build this alist easily.")
+
+   (persistent-action
+    :initarg :persistent-action
+    :initform nil
+    :custom function
+    :documentation
+    "  Can be a either a Function called with one parameter (the
+  selected candidate) or a cons cell where first element is this
+  same function and second element a symbol (e.g never-split)
+  that inform `helm-execute-persistent-action'to not split his
+  window to execute this persistent action.")
+
+   (persistent-help
+    :initarg :persistent-help
+    :initform nil
+    :custom string
+    :documentation
+    "  A string to explain persistent-action of this source. It also
+  accepts a function or a variable name.
+  It will be displayed in `header-line'.
+  Have no effect when `helm-echo-input-in-header-line' is non--nil.")
+
+   (help-message
+    :initarg :help-message
+    :initform nil
+    :custom (choice string function)
+    :documentation
+    "  Help message for this source.
+  If not present, `helm-help-message' value will be used.")
+
+   (multiline
+    :initarg :multiline
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Enable to selection multiline candidates.")
+
+   (requires-pattern
+    :initarg :requires-pattern
+    :initform nil
+    :custom integer
+    :documentation
+    "  If present matches from the source are shown only if the
+  pattern is not empty. Optionally, it can have an integer
+  parameter specifying the required length of input which is
+  useful in case of sources with lots of candidates.")
+
+   (candidate-transformer
+    :initarg :candidate-transformer
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  It's a function or a list of functions called with one argument
+  when the completion list from the source is built. The argument
+  is the list of candidates retrieved from the source. The
+  function should return a transformed list of candidates which
+  will be used for the actual completion.  If it is a list of
+  functions, it calls each function sequentially.
+
+  This can be used to transform or remove items from the list of
+  candidates.
+
+  Note that `candidates' is run already, so the given transformer
+  function should also be able to handle candidates with (DISPLAY
+  . REAL) format.")
+
+   (filtered-candidate-transformer
+    :initarg :filtered-candidate-transformer
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  It has the same format as `candidate-transformer', except the
+  function is called with two parameters: the candidate list and
+  the source.
+
+  This transformer is run on the candidate list which is already
+  filtered by the current pattern. While `candidate-transformer'
+  is run only once, it is run every time the input pattern is
+  changed.
+
+  It can be used to transform the candidate list dynamically, for
+  example, based on the current pattern.
+
+  In some cases it may also be more efficent to perform candidate
+  transformation here, instead of with `candidate-transformer'
+  even if this transformation is done every time the pattern is
+  changed.  For example, if a candidate set is very large then
+  `candidate-transformer' transforms every candidate while only
+  some of them will actually be displayed due to the limit
+  imposed by `helm-candidate-number-limit'.
+
+  Note that `candidates' and `candidate-transformer' is run
+  already, so the given transformer function should also be able
+  to handle candidates with (DISPLAY . REAL) format.")
+
+   (filter-one-by-one
+    :initarg :filter-one-by-one
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  A transformer function that treat candidates one by one.
+  It is called with one arg the candidate.
+  It is faster than `filtered-candidate-transformer' or
+  `candidates-transformer', but should be used only in sources
+  that recompute constantly their candidates, e.g `helm-source-find-files'.
+  Filtering happen early and candidates are treated
+  one by one instead of re-looping on the whole list.
+  If used with `filtered-candidate-transformer' or `candidates-transformer'
+  these functions should treat the candidates transformed by the
+  `filter-one-by-one' function in consequence.")
+
+   (display-to-real
+    :initarg :display-to-real
+    :initform nil
+    :custom function
+    :documentation
+    "  Function called with one parameter; the selected candidate.
+
+  The function transforms the selected candidate, and the result
+  is passed to the action function.  The display-to-real
+  attribute provides another way to pass to action other string than
+  the one shown in Helm buffer.
+
+  Traditionally, it is possible to make candidates,
+  candidate-transformer or filtered-candidate-transformer
+  function return a list with (DISPLAY . REAL) pairs. But if REAL
+  can be generated from DISPLAY, display-to-real is more
+  convenient and faster.
+
+  NOTE: This is deprecated and you have better time using `filter-one-by-one'.")
+
+   (real-to-display
+    :initarg :real-to-display
+    :initform nil
+    :custom function
+    :documentation
+    "  Function called with one parameter; the selected candidate.
+  The real value of candidates will be shown in display.
+  See `display-to-real'.")
+
+   (action-transformer
+    :initarg :action-transformer
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  It's a function or a list of functions called with two
+  arguments when the action list from the source is
+  assembled. The first argument is the list of actions, the
+  second is the current selection.  If it is a list of functions,
+  it calls each function sequentially.
+
+  The function should return a transformed action list.
+
+  This can be used to customize the list of actions based on the
+  currently selected candidate.")
+
+   (pattern-transformer
+    :initarg :pattern-transformer
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  It's a function or a list of functions called with one argument
+  before computing matches. Its argument is `helm-pattern'.
+  Functions should return transformed `helm-pattern'.
+
+  It is useful to change interpretation of `helm-pattern'.")
+
+   (candidate-number-limit
+    :initarg :candidate-number-limit
+    :initform nil
+    :custom integer
+    :documentation
+    "  Override `helm-candidate-number-limit' only for this source.")
+
+   (volatile
+    :initarg :volatile
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Indicates the source assembles the candidate list dynamically,
+  so it shouldn't be cached within a single Helm
+  invocation. It is only applicable to synchronous sources,
+  because asynchronous sources are not cached.")
+
+   (match
+    :initarg :match
+    :initform nil
+    :custom (choice function list)
+    :documentation
+    "  List of functions called with one parameter: a candidate. The
+  function should return non-nil if the candidate matches the
+  current pattern (see variable `helm-pattern').
+
+  When using `candidates-in-buffer' its default value is `identity' and
+  don't have to be changed, use the `search' slot instead.
+
+  This attribute allows the source to override the default
+  pattern matching based on `string-match'. It can be used, for
+  example, to implement a source for file names and do the
+  pattern matching on the basename of files, since it's more
+  likely one is typing part of the basename when searching for a
+  file, instead of some string anywhere else in its path.
+
+  If the list contains more than one function then the list of
+  matching candidates from the source is constructed by appending
+  the results after invoking the first function on all the
+  potential candidates, then the next function, and so on. The
+  matching candidates supplied by the first function appear first
+  in the list of results and then results from the other
+  functions, respectively.
+
+  This attribute has no effect for asynchronous sources (see
+  attribute `candidates'), since they perform pattern matching
+  themselves.
+
+  Note that FUZZY-MATCH slot will overhide value of this slot.")
+
+   (fuzzy-match
+    :initarg :fuzzy-match
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Enable fuzzy matching in this source.
+  This will overwrite settings in MATCH slot, and for
+  sources built with child class `helm-source-in-buffer' the SEARCH slot.
+  This is an easy way of enabling fuzzy matching, but you can use the MATCH
+  or SEARCH slots yourself if you want something more elaborated, mixing
+  different type of match (See `helm-source-buffers' class for example).")
+
+   (nomark
+    :initarg :nomark
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Don't allow marking candidates when this attribute is present.")
+
+   (nohighlight
+    :initarg :nohighlight
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Disable highlighting matches in this source.
+  This will disable generic highlighting of matches,
+  but some specialized highlighting can be done from elsewhere,
+  i.e from `filtered-candidate-transformer' or `filter-one-by-one' slots.
+  So use this to either disable completely highlighting in your source,
+  or to disable highlighting and use a specialized highlighting matches
+  function for this source.
+  Remember that this function should run AFTER all filter functions if those
+  filter functions are modifying face properties, though it is possible to
+  avoid this by using new `add-face-text-property' in your filter functions.")
+
+   (allow-dups
+    :initarg :allow-dups
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Allow helm collecting duplicates candidates.")
+
+   (history
+    :initarg :history
+    :initform nil
+    :custom symbol
+    :documentation
+    "  Allow passing history variable to helm from source.
+  It should be a quoted symbol.")
+
+   (coerce
+    :initarg :coerce
+    :initform nil
+    :custom function
+    :documentation
+    "  It's a function called with one argument: the selected candidate.
+  This function is intended for type convertion. In normal case,
+  the selected candidate (string) is passed to action
+  function. If coerce function is specified, it is called just
+  before action function.
+
+  Example: converting string to symbol
+    (coerce . intern)")
+
+   (mode-line
+    :initarg :mode-line
+    :initform nil
+    :custom (choice string sexp)
+    :documentation
+    "  Source local `helm-mode-line-string' (included in
+  `mode-line-format'). It accepts also variable/function name.")
+
+   (header-line
+    :initarg :header-line
+    :initform nil
+    :custom (choice string function)
+    :documentation
+    "  Source local `header-line-format'.
+  Have no effect when `helm-echo-input-in-header-line' is non--nil.
+  It accepts also variable/function name.")
+
+   (resume
+    :initarg :resume
+    :initform nil
+    :custom function
+    :documentation
+    "  Function called with no parameters at end of initialization
+  when `helm-resume' is started.
+  If this function try to do something against `helm-buffer', \(e.g updating,
+  searching etc...\) probably you should run it in a timer to ensure
+  `helm-buffer' is ready.")
+
+   (follow
+    :initarg :follow
+    :initform nil
+    :custom integer
+    :documentation
+    "  Enable `helm-follow-mode' for this source only.
+  You must give it a value of 1 or -1, though giving a -1 value
+  is surely not what you want, e.g: (follow . 1)
+
+  See `helm-follow-mode' for more infos.")
+
+   (follow-delay
+    :initarg :follow-delay
+    :initform nil
+    :custom integer
+    :documentation
+    "  `helm-follow-mode' will execute persistent-action after this delay.
+  Otherwise value of `helm-follow-input-idle-delay' is used if non--nil,
+  If none of these are found fallback to `helm-input-idle-delay'.")
+
+   (dont-plug
+    :initarg :dont-plug
+    :initform '(helm-compile-source--persistent-help)
+    :custom list
+    :documentation
+    "  A list of compile functions plugin to ignore.")
+
+   (matchplugin
+    :initarg :matchplugin
+    :initform t
+    :custom boolean)
+
+   (match-part
+    :initarg :match-part
+    :initform nil
+    :custom function
+    :documentation
+    "  Allow matching only one part of candidate.
+  If source contain match-part attribute, match is computed only
+  on part of candidate returned by the call of function provided
+  by this attribute. The function should have one arg, candidate,
+  and return only a specific part of candidate.")
+
+   (before-init-hook
+    :initarg :before-init-hook
+    :initform nil
+    :custom symbol
+    :documentation
+    "  A local hook that run at beginning of initilization of this source.
+  i.e Before the creation of `helm-buffer'.
+
+  Should be a variable (defined with defvar).
+  Can be also an anonymous function or a list of functions
+  directly added to slot, this is not recommended though.")
+
+   (after-init-hook
+    :initarg :after-init-hook
+    :initform nil
+    :custom symbol
+    :documentation
+    "  A local hook that run at end of initilization of this source.
+  i.e After the creation of `helm-buffer'.
+
+  Should be a variable.
+  Can be also an anonymous function or a list of functions
+  directly added to slot, this is not recommended though."))
+
+  "Main interface to define helm sources."
+  :abstract t)
+
+(defclass helm-source-sync (helm-source)
+  ((candidates
+    :initform '("ERROR: You must specify the `candidates' slot, either with a list or a function"))
+
+   (dont-plug
+    :initform '(helm-compile-source--multi-match
+                helm-compile-source--persistent-help
+                ;; Ensure this will not be plugged
+                ;; if user have somewhere old helm-migemo.el.
+                helm-compile-source--migemo))
+
+   (migemo
+    :initarg :migemo
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Enable migemo.
+  When multimatch is disabled, you can give the symbol 'nomultimatch as value
+  to force not using generic migemo matching function.
+  In this case you have to provide your own migemo matching funtion
+  that kick in when `helm-migemo-mode' is enabled.
+  Otherwise it will be available for this source once `helm-migemo-mode'
+  is enabled when non-nil.")
+
+   (match-strict
+    :initarg :match-strict
+    :initform nil
+    :custom function
+    :documentation
+    "  When specifying a match function within a source and
+  helm-multi-match is enabled, the result of all matching
+  functions will be concatened, which in some cases is not what
+  is wanted. When using `match-strict' only this or these
+  functions will be used. You can specify those functions as a
+  list of functions or a single symbol function.
+
+  NOTE: This have the same effect as using :MATCHPLUGIN nil."))
+
+  "Use this class to make helm sources using a list of candidates.
+This list should be given as a normal list, a variable handling a list
+or a function returning a list.
+Matching is done basically with `string-match' against each candidate.")
+
+(defclass helm-source-async (helm-source)
+  ((candidates-process
+    :initarg :candidates-process
+    :initform nil
+    :custom function
+    :documentation
+    "  This attribute is used to define a process as candidate.
+  The value must be a process.
+
+  NOTE:
+  When building the source at runtime you can give directly a process
+  as value, otherwise wrap the process call into a function.
+  The process buffer should be nil, otherwise, if you use
+  `helm-buffer' give to the process a sentinel.")
+
+   (matchplugin :initform nil)
+   (dont-plug :initform '(helm-compile-source--multi-match
+                          helm-compile-source--persistent-help)))
+
+  "Use this class to define a helm source calling an external process.
+The :candidates slot is not allowed even if described because this class
+inherit from `helm-source'.")
+
+(defclass helm-source-in-buffer (helm-source)
+  ((init
+    :initform 'helm-default-init-source-in-buffer-function)
+
+   (data
+    :initarg :data
+    :initform nil
+    :custom (choice list string)
+    :documentation
+    "  A string or a list that will be used to feed the `helm-candidates-buffer'.
+  This data will be passed in a function added to the init slot and
+  the buffer will be build with `helm-init-candidates-in-buffer'.
+  This is an easy and fast method to build a `candidates-in-buffer' source.")
+
+   (dont-plug
+    :initform '(helm-compile-source--candidates-in-buffer
+                helm-compile-source--multi-match
+                helm-compile-source--persistent-help
+                helm-compile-source--migemo))
+
+   (migemo
+    :initarg :migemo
+    :initform nil
+    :custom boolean
+    :documentation
+    "  Enable migemo.
+  When multimatch is disabled, you can give the symbol 'nomultimatch as value
+  to force not using generic migemo matching function.
+  In this case you have to provide your own migemo matching funtion
+  that kick in when `helm-migemo-mode' is enabled.
+  Otherwise it will be available for this source once `helm-migemo-mode'
+  is enabled when non-nil.")
+
+   (candidates
+    :initform 'helm-candidates-in-buffer)
+
+   (volatile
+    :initform t)
+
+   (match
+    :initform '(identity))
+
+   (get-line
+    :initarg :get-line
+    :initform 'buffer-substring-no-properties
+    :custom function
+    :documentation
+    "  A function like `buffer-substring-no-properties' or `buffer-substring'.
+  This function converts point of line-beginning and point of line-end,
+  which represents a candidate computed by `helm-candidates-in-buffer'.
+  By default, `helm-candidates-in-buffer' uses
+  `buffer-substring-no-properties'.")
+
+   (search
+    :initarg :search
+    :initform '(helm-candidates-in-buffer-search-default-fn)
+    :custom (choice function list)
+    :documentation
+    "  List of functions like `re-search-forward' or `search-forward'.
+  Buffer search function used by `helm-candidates-in-buffer'.
+  By default, `helm-candidates-in-buffer' uses `re-search-forward'.
+  The function should take one arg PATTERN.
+  If your search function needs to handle negation like matchplugin,
+  this function should returns in such case a cons cell of two integers defining
+  the beg and end positions to match in the line previously matched by
+  `re-search-forward' or similar, and move point to next line
+  (See how the `helm-mm-3-search-base' and `helm-fuzzy-search' functions are working).
+
+  NOTE: FUZZY-MATCH slot will overhide value of this slot.")
+
+   (search-strict
+    :initarg :search-strict
+    :initform nil
+    :custom function
+    :documentation
+    "  When specifying a search function within a source and
+  helm-multi-match is enabled, the result of all searching
+  functions will be concatened, which in some cases is not what
+  is wanted. When using `search-strict' only this or these
+  functions will be used. You can specify those functions as a
+  list of functions or a single symbol function.
+
+  NOTE: This have the same effect as using a nil value for
+        :MATCHPLUGIN slot."))
+
+  "Use this source to make helm sources storing candidates inside a buffer.
+Contrarily to `helm-source-sync' candidates are matched using a function
+like `re-search-forward', see below documentation of :search slot.")
+
+(defclass helm-source-dummy (helm-source)
+  ((candidates
+    :initform '("dummy"))
+
+   (filtered-candidate-transformer
+    :initform 'helm-dummy-candidate)
+
+   (matchplugin
+    :initform nil)
+
+   (accept-empty
+    :initarg :accept-empty
+    :initform t
+    :custom boolean
+    :documentation
+    "  Allow exiting with an empty string.
+  You should keep the default value.")
+
+   (match
+    :initform 'identity)
+
+   (volatile
+    :initform t)))
+
+(defclass helm-source-in-file (helm-source-in-buffer)
+  ((init :initform (lambda ()
+                     (let ((file (helm-attr 'candidates-file)))
+                       (with-current-buffer (helm-candidate-buffer 'global)
+                         (insert-file-contents file)))))
+   (candidates-file
+    :initarg :candidates-file
+    :initform nil
+    :custom string
+    :documentation "A filename."))
+
+  "The contents of the file will be used as candidates in buffer.")
+
+\f
+;;; Error functions
+;;
+;;
+(defun helm-default-init-source-in-buffer-function ()
+  (helm-init-candidates-in-buffer 'global
+    '("ERROR: No buffer handling your data, use either the `init' slot or the `data' slot.")))
+
+\f
+;;; Internal Builder functions.
+;;
+;;
+(defun helm--create-source (object)
+  "[INTERNAL] Build a helm source from OBJECT.
+Where OBJECT is an instance of an eieio class."
+  (cl-loop for s in (object-slots object)
+           for slot-val = (slot-value object s)
+           when slot-val
+           collect (cons s (unless (eq t slot-val) slot-val))))
+
+(defun helm-make-source (name class &rest args)
+  "Build a `helm' source named NAME with ARGS for CLASS.
+Argument NAME is a string which define the source name, so no need to use
+the keyword :name in your source, NAME will be used instead.
+Argument CLASS is an eieio class object.
+Arguments ARGS are keyword value pairs as defined in CLASS."
+  (declare (indent 2))
+  (let ((source (apply #'make-instance class name args)))
+    (set-slot-value source 'name name)
+    (helm--setup-source source)
+    (helm-setup-user-source source)
+    (helm--create-source source)))
+
+(defun helm-make-type (class &rest args)
+  (let ((source (apply #'make-instance class args)))
+    (set-slot-value source 'name nil)
+    (helm--setup-source source)
+    (helm--create-source source)))
+
+(defvar helm-mm-default-search-functions)
+(defvar helm-mm-default-match-functions)
+
+(defun helm-source-mm-get-search-or-match-fns (source method)
+  (let ((defmatch         (helm-aif (slot-value source 'match)
+                              (helm-mklist it)))
+        (defmatch-strict  (helm-aif (and (eq method 'match)
+                                         (slot-value source 'match-strict))
+                              (helm-mklist it)))
+        (defsearch        (helm-aif (and (eq method 'search)
+                                         (slot-value source 'search))
+                              (helm-mklist it)))
+        (defsearch-strict (helm-aif (and (eq method 'search-strict)
+                                         (slot-value source 'search-strict))
+                              (helm-mklist it)))
+        (migemo           (slot-value source 'migemo)))
+    (cl-case method
+      (match (cond (defmatch-strict)
+                   (migemo
+                    (append helm-mm-default-match-functions
+                            defmatch '(helm-mm-3-migemo-match)))
+                   (defmatch
+                    (append helm-mm-default-match-functions defmatch))
+                   (t helm-mm-default-match-functions)))
+      (search (cond (defsearch-strict)
+                    (migemo
+                     (append helm-mm-default-search-functions
+                             defsearch '(helm-mm-3-migemo-search)))
+                    (defsearch
+                     (append helm-mm-default-search-functions defsearch))
+                    (t helm-mm-default-search-functions))))))
+
+\f
+;;; Modifiers
+;;
+(cl-defun helm-source-add-action-to-source-if (name fn source predicate
+                                                    &optional (index 4))
+  "Same as `helm-add-action-to-source-if' but for SOURCE defined as eieio object.
+You can use this inside a `helm--setup-source' method for a SOURCE defined as
+an eieio class."
+  (let* ((actions     (slot-value source 'action))
+         (action-transformers (slot-value source 'action-transformer))
+         (new-action  (list (cons name fn)))
+         (transformer `(lambda (actions candidate)
+                         (cond ((funcall (quote ,predicate) candidate)
+                                (helm-append-at-nth
+                                 actions (quote ,new-action) ,index))
+                               (t actions)))))
+    (if (functionp actions)
+        (set-slot-value source 'action (list (cons "Default action" actions)))
+        (set-slot-value source 'action (helm-interpret-value actions source)))
+    (when (or (symbolp action-transformers) (functionp action-transformers))
+      (setq action-transformers (list action-transformers)))
+    (set-slot-value
+     source
+     'action-transformer
+     (delq nil (append (list transformer) action-transformers)))))
+
+\f
+;;; Methods to build sources.
+;;
+;;
+(defun helm-source--persistent-help-string (string source)
+  (substitute-command-keys
+   (concat "\\<helm-map>\\[helm-execute-persistent-action]: "
+           (or (format "%s (keeping session)" string)
+               (slot-value source 'header-line)))))
+
+(defun helm-source--header-line (source)
+  (substitute-command-keys
+   (concat "\\<helm-map>\\[helm-execute-persistent-action]: "
+           (helm-aif (or (slot-value source 'persistent-action)
+                         (slot-value source 'action))
+               (cond ((and (symbolp it)
+                           (functionp it)
+                           (eq it 'identity))
+                      "Do Nothing")
+                     ((and (symbolp it)
+                           (boundp it)
+                           (listp (symbol-value it))
+                           (stringp (caar (symbol-value it))))
+                      (caar (symbol-value it)))
+                     ((or (symbolp it) (functionp it))
+                      (helm-symbol-name it))
+                     ((listp it)
+                      (let ((action (car it)))
+                        ;; It comes from :action ("foo" . function).
+                        (if (stringp (car action))
+                            (car action)
+                            ;; It comes from :persistent-action
+                            ;; (function . 'nosplit) Fix Issue #788.
+                            (if (or (symbolp action)
+                                    (functionp action))
+                                (helm-symbol-name action)))))
+                     (t ""))
+             "")
+           " (keeping session)")))
+
+(defmethod helm--setup-source :primary ((_source helm-source)))
+
+(defmethod helm--setup-source :before ((source helm-source))
+  (helm-aif (slot-value source 'keymap)
+      (and (symbolp it) (set-slot-value source 'keymap (symbol-value it))))
+  (helm-aif (slot-value source 'persistent-help)
+      (set-slot-value source 'header-line
+                      (helm-source--persistent-help-string it source))
+    (set-slot-value source 'header-line (helm-source--header-line source)))
+  (helm-aif (slot-value source 'candidate-number-limit)
+      (and (symbolp it) (set-slot-value
+                         source 'candidate-number-limit (symbol-value it))))
+  (when (and (slot-value source 'fuzzy-match) helm-fuzzy-sort-fn)
+    (set-slot-value source 'filtered-candidate-transformer
+                    (helm-aif (slot-value source 'filtered-candidate-transformer)
+                        (append (helm-mklist it)
+                                (list helm-fuzzy-sort-fn))
+                      (list helm-fuzzy-sort-fn))))
+  (unless (slot-value source 'nohighlight)
+    (set-slot-value source 'filtered-candidate-transformer
+                    (helm-aif (slot-value source 'filtered-candidate-transformer)
+                        (append (helm-mklist it)
+                                (list #'helm-fuzzy-highlight-matches))
+                      (list #'helm-fuzzy-highlight-matches)))))
+
+(defmethod helm-setup-user-source ((_source helm-source)))
+
+(defmethod helm--setup-source ((source helm-source-sync))
+  (when (slot-value source 'fuzzy-match)
+    (helm-aif (slot-value source 'match)
+        (set-slot-value source 'match (append (helm-mklist it)
+                                              (list helm-fuzzy-match-fn)))
+      (set-slot-value source 'match helm-fuzzy-match-fn)))
+  (when (slot-value source 'matchplugin)
+    (set-slot-value source 'match
+                    (helm-source-mm-get-search-or-match-fns source 'match)))
+  (helm-aif (and (null (slot-value source 'matchplugin))
+                 (slot-value source 'migemo))
+      (unless (eq it 'nomultimatch) ; Use own migemo fn.
+        (set-slot-value source 'match
+                        (append (helm-mklist (slot-value source 'match))
+                                '(helm-mm-3-migemo-match))))))
+
+(defmethod helm--setup-source ((source helm-source-in-buffer))
+  (let ((cur-init (slot-value source 'init)))
+    (helm-aif (slot-value source 'data)
+        (set-slot-value
+         source
+         'init (delq
+                nil
+                (list
+                 (and (null (eq 'helm-default-init-source-in-buffer-function
+                                cur-init))
+                      cur-init)
+                 (lambda ()
+                   (helm-init-candidates-in-buffer
+                       'global
+                     (if (functionp it) (funcall it) it))))))))
+  (when (slot-value source 'fuzzy-match)
+    (helm-aif (slot-value source 'search)
+        (set-slot-value source 'search (append (helm-mklist it)
+                                               (list helm-fuzzy-search-fn)))
+      (set-slot-value source 'search (list helm-fuzzy-search-fn))))
+  (when (slot-value source 'matchplugin)
+    (set-slot-value
+     source 'search (helm-source-mm-get-search-or-match-fns source 'search)))
+  (helm-aif (and (null (slot-value source 'matchplugin))
+                 (slot-value source 'migemo))
+      (unless (eq it 'nomultimatch)
+        (set-slot-value source 'search
+                        (append (helm-mklist (slot-value source 'search))
+                                '(helm-mm-3-migemo-search)))))
+  (let ((mtc (slot-value source 'match)))
+    (cl-assert (or (equal '(identity) mtc)
+                   (eq 'identity mtc))
+               nil "Invalid slot value for `match'")
+    (cl-assert (eq (slot-value source 'volatile) t)
+               nil "Invalid slot value for `volatile'")))
+
+(defmethod helm--setup-source ((source helm-source-async))
+  (cl-assert (null (slot-value source 'candidates))
+             nil "Incorrect use of `candidates' use `candidates-process' instead")
+  (cl-assert (null (slot-value source 'matchplugin))
+             nil "`matchplugin' not allowed in async sources."))
+
+(defmethod helm--setup-source ((source helm-source-dummy))
+  (let ((mtc (slot-value source 'match)))
+    (cl-assert (or (equal '(identity) mtc)
+                   (eq 'identity mtc))
+               nil "Invalid slot value for `match'")
+    (cl-assert (eq (slot-value source 'volatile) t)
+               nil "Invalid slot value for `volatile'")
+    (cl-assert (equal (slot-value source 'candidates) '("dummy"))
+               nil "Invalid slot value for `candidates'")
+    (cl-assert (eq (slot-value source 'accept-empty) t)
+               nil "Invalid slot value for `accept-empty'")))
+
+\f
+;;; User functions
+;;
+;;  Sources
+(defmacro helm-build-sync-source (name &rest args)
+  "Build a synchronous helm source with name NAME.
+Args ARGS are keywords provided by `helm-source-sync'."
+  (declare (indent 1))
+  `(helm-make-source ,name 'helm-source-sync ,@args))
+
+(defmacro helm-build-async-source (name &rest args)
+  "Build a asynchronous helm source with name NAME.
+Args ARGS are keywords provided by `helm-source-async'."
+  (declare (indent 1))
+  `(helm-make-source ,name 'helm-source-async ,@args))
+
+(defmacro helm-build-in-buffer-source (name &rest args)
+  "Build a helm source with name NAME using `candidates-in-buffer' method.
+Args ARGS are keywords provided by `helm-source-in-buffer'."
+  (declare (indent 1))
+  `(helm-make-source ,name 'helm-source-in-buffer ,@args))
+
+(defmacro helm-build-dummy-source (name &rest args)
+  "Build a helm source with name NAME using `dummy' method.
+Args ARGS are keywords provided by `helm-source-dummy'."
+  (declare (indent 1))
+  `(helm-make-source ,name 'helm-source-dummy ,@args))
+
+(defmacro helm-build-in-file-source (name file &rest args)
+  "Build a helm source with NAME name using `candidates-in-files' method.
+Arg FILE is a filename, the contents of this file will be
+used as candidates in buffer.
+Args ARGS are keywords provided by `helm-source-in-file'."
+  (declare (indent 1))
+  `(helm-make-source ,name 'helm-source-in-file
+     :candidates-file ,file ,@args))
+
+
+(provide 'helm-source)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm-source ends here
diff --git a/elpa/helm-core-20160217.958/helm.el b/elpa/helm-core-20160217.958/helm.el
new file mode 100644 (file)
index 0000000..1837913
--- /dev/null
@@ -0,0 +1,5641 @@
+;;; helm.el --- Emacs incremental and narrowing framework -*- lexical-binding: t -*-
+
+;; Copyright (C) 2007         Tamas Patrovics
+;;               2008 ~ 2011  rubikitch <rubikitchNOSPAMruby-lang.org>
+;;               2011 ~ 2015  Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; This is a fork of anything.el wrote by Tamas Patrovics.
+
+;; Authors of anything.el: Tamas Patrovics
+;;                         rubikitch <rubikitchNOSPAMruby-lang.org>
+;;                         Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+
+;; Author: Thierry Volpiatto <thierry.volpiattoNOSPAMgmail.com>
+;; URL: http://github.com/emacs-helm/helm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'advice) ; Shutup byte compiler about ad-deactivate.
+(require 'helm-lib)
+(require 'helm-multi-match)
+(require 'helm-source)
+
+\f
+;;; Multi keys
+;;
+;;
+;;;###autoload
+(defun helm-define-multi-key (keymap key functions &optional delay)
+  "In KEYMAP, define key sequence KEY for function list FUNCTIONS.
+Each function run sequentially each time the key KEY is pressed.
+If DELAY is specified switch back to initial function of FUNCTIONS list
+after DELAY seconds.
+The functions in FUNCTIONS list are functions with no args.
+e.g
+  \(defun foo ()
+    (message \"Run foo\"))
+  \(defun bar ()
+    (message \"Run bar\"))
+  \(defun baz ()
+    (message \"Run baz\"))
+
+\(helm-define-multi-key global-map \"<f5> q\" '(foo bar baz) 2)
+
+Each time \"<f5> q\" is pressed the next function is executed, if you wait
+More than 2 seconds, next hit will run again the first function and so on."
+  (define-key keymap key (helm-make-multi-command functions delay)))
+
+;;;###autoload
+(defmacro helm-multi-key-defun (name docstring funs &optional delay)
+  "Define NAME as a multi-key command running FUNS.
+After DELAY seconds the FUNS list is reinitialised.
+See `helm-define-multi-key'."
+  (declare (indent 2))
+  (setq docstring (if docstring (concat docstring "\n\n")
+                    "This is a helmish multi-key command."))
+  `(defalias (quote ,name) (helm-make-multi-command ,funs ,delay) ,docstring))
+
+(defun helm-make-multi-command (functions &optional delay)
+  "Return an anonymous multi-key command running FUNCTIONS.
+Run each function of FUNCTIONS list in turn when called within DELAY seconds."
+  (declare (indent 1))
+  (let ((funs functions)
+        (iter (cl-gensym "helm-iter-key"))
+        (timeout delay))
+    (eval (list 'defvar iter nil))
+    (lambda () (interactive) (helm-run-multi-key-command funs iter timeout))))
+
+(defun helm-run-multi-key-command (functions iterator delay)
+  (let ((fn (lambda ()
+                (cl-loop for count from 1 to (length functions)
+                      collect count)))
+        next)
+    (unless (and (symbol-value iterator)
+                 ;; Reset iterator when another key is pressed.
+                 (eq this-command real-last-command))
+      (set iterator (helm-iter-list (funcall fn))))
+    (setq next (helm-iter-next (symbol-value iterator)))
+    (unless next
+      (set iterator (helm-iter-list (funcall fn)))
+      (setq next (helm-iter-next (symbol-value iterator))))
+    (and next (symbol-value iterator) (call-interactively (nth (1- next) functions)))
+    (when delay (run-with-idle-timer delay nil `(lambda ()
+                                                  (setq ,iterator nil))))))
+
+(helm-multi-key-defun helm-toggle-resplit-and-swap-windows
+    "Multi key command to resplit and swap helm window.
+First call run `helm-toggle-resplit-window',
+second call within 0.5s run `helm-swap-windows'."
+  '(helm-toggle-resplit-window helm-swap-windows) 1)
+(put 'helm-toggle-resplit-and-swap-windows 'helm-only t)
+
+;;;###autoload
+(defun helm-define-key-with-subkeys (map key subkey command
+                                         &optional other-subkeys menu exit-fn)
+  "Allow defining in MAP a KEY and SUBKEY to COMMAND.
+
+This allow typing KEY to call COMMAND the first time and
+type only SUBKEY on subsequent calls.
+
+Arg MAP is the keymap to use, SUBKEY is the initial short keybinding to
+call COMMAND.
+
+Arg OTHER-SUBKEYS is an alist specifying other short keybindings
+to use once started.
+e.g:
+
+\(helm-define-key-with-subkeys global-map
+   \(kbd \"C-x v n\") ?n 'git-gutter:next-hunk '((?p . git-gutter:previous-hunk))\)
+
+
+In this example, `C-x v n' will run `git-gutter:next-hunk'
+subsequent hits on \"n\" will run this command again
+and subsequent hits on \"p\" will run `git-gutter:previous-hunk'.
+
+Arg MENU is a string to display in minibuffer
+to describe SUBKEY and OTHER-SUBKEYS.
+Arg EXIT-FN specify a function to run on exit.
+
+Any other keys pressed run their assigned command defined in MAP
+and exit the loop running EXIT-FN if specified.
+
+NOTE: SUBKEY and OTHER-SUBKEYS bindings support
+only char syntax actually (e.g ?n)
+so don't use strings, vectors or whatever to define them."
+  (declare (indent 1))
+  (define-key map key
+    (lambda ()
+      (interactive)
+      (unwind-protect
+          (progn
+            (call-interactively command)
+            (while (let ((input (read-key menu)) other kb com)
+                     (setq last-command-event input)
+                     (cond
+                      ((eq input subkey)
+                       (call-interactively command)
+                       t)
+                      ((setq other (assoc input other-subkeys))
+                       (call-interactively (cdr other))
+                       t)
+                      (t
+                       (setq kb (vector last-command-event))
+                       (setq com (lookup-key map kb))
+                       (if (commandp com)
+                           (call-interactively com)
+                         (setq unread-command-events
+                               (nconc (mapcar 'identity kb)
+                                      unread-command-events)))
+                       nil)))))
+        (and exit-fn (funcall exit-fn))))))
+
+\f
+;;; Keymap
+;;
+;;
+(defvar helm-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map minibuffer-local-map)
+    (define-key map (kbd "<down>")     'helm-next-line)
+    (define-key map (kbd "<up>")       'helm-previous-line)
+    (define-key map (kbd "C-n")        'helm-next-line)
+    (define-key map (kbd "C-p")        'helm-previous-line)
+    (define-key map (kbd "<C-down>")   'helm-follow-action-forward)
+    (define-key map (kbd "<C-up>")     'helm-follow-action-backward)
+    (define-key map (kbd "<prior>")    'helm-previous-page)
+    (define-key map (kbd "<next>")     'helm-next-page)
+    (define-key map (kbd "M-v")        'helm-previous-page)
+    (define-key map (kbd "C-v")        'helm-next-page)
+    (define-key map (kbd "M-<")        'helm-beginning-of-buffer)
+    (define-key map (kbd "M->")        'helm-end-of-buffer)
+    (define-key map (kbd "C-g")        'helm-keyboard-quit)
+    (define-key map (kbd "<right>")    'helm-next-source)
+    (define-key map (kbd "<left>")     'helm-previous-source)
+    (define-key map (kbd "<RET>")      'helm-maybe-exit-minibuffer)
+    (define-key map (kbd "C-i")        'helm-select-action)
+    (define-key map (kbd "C-z")        'helm-execute-persistent-action)
+    (define-key map (kbd "C-j")        'helm-execute-persistent-action)
+    (define-key map (kbd "C-o")        'helm-next-source)
+    (define-key map (kbd "C-l")        'helm-recenter-top-bottom-other-window)
+    (define-key map (kbd "M-C-l")      'helm-reposition-window-other-window)
+    (define-key map (kbd "C-M-v")      'helm-scroll-other-window)
+    (define-key map (kbd "M-<next>")   'helm-scroll-other-window)
+    (define-key map (kbd "C-M-y")      'helm-scroll-other-window-down)
+    (define-key map (kbd "C-M-S-v")    'helm-scroll-other-window-down)
+    (define-key map (kbd "M-<prior>")  'helm-scroll-other-window-down)
+    (define-key map (kbd "<C-M-down>") 'helm-scroll-other-window)
+    (define-key map (kbd "<C-M-up>")   'helm-scroll-other-window-down)
+    (define-key map (kbd "C-@")        'helm-toggle-visible-mark)
+    (define-key map (kbd "C-SPC")      'helm-toggle-visible-mark)
+    (define-key map (kbd "M-SPC")      'helm-toggle-visible-mark)
+    (define-key map (kbd "M-[")        nil)
+    (define-key map (kbd "M-(")        'helm-prev-visible-mark)
+    (define-key map (kbd "M-)")        'helm-next-visible-mark)
+    (define-key map (kbd "C-k")        'helm-delete-minibuffer-contents)
+    (define-key map (kbd "C-x C-f")    'helm-quit-and-find-file)
+    (define-key map (kbd "M-m")        'helm-toggle-all-marks)
+    (define-key map (kbd "M-a")        'helm-mark-all)
+    (define-key map (kbd "M-U")        'helm-unmark-all)
+    (define-key map (kbd "C-w")        'helm-yank-text-at-point)
+    (define-key map (kbd "C-M-a")      'helm-show-all-in-this-source-only)
+    (define-key map (kbd "C-M-e")      'helm-display-all-sources)
+    (define-key map (kbd "C-r")        'undefined)
+    (define-key map (kbd "C-s")        'undefined)
+    (define-key map (kbd "M-s")        'undefined)
+    (define-key map (kbd "C-}")        'helm-narrow-window)
+    (define-key map (kbd "C-{")        'helm-enlarge-window)
+    (define-key map (kbd "C-c -")      'helm-swap-windows)
+    (define-key map (kbd "C-c C-y")    'helm-yank-selection)
+    (define-key map (kbd "C-c C-k")    'helm-kill-selection-and-quit)
+    (define-key map (kbd "C-c C-i")    'helm-copy-to-buffer)
+    (define-key map (kbd "C-c C-f")    'helm-follow-mode)
+    (define-key map (kbd "C-c C-u")    'helm-refresh)
+    (define-key map (kbd "C-c >")      'helm-toggle-truncate-line)
+    (define-key map (kbd "M-p")        'previous-history-element)
+    (define-key map (kbd "M-n")        'next-history-element)
+    (define-key map (kbd "C-!")        'helm-toggle-suspend-update)
+    (define-key map (kbd "C-x b")      'helm-resume-previous-session-after-quit)
+    (define-key map (kbd "C-x C-b")    'helm-resume-list-buffers-after-quit)
+    ;; Disable `file-cache-minibuffer-complete'.
+    (define-key map (kbd "<C-tab>")    'undefined)
+    ;; Multi keys
+    (define-key map (kbd "C-t")        'helm-toggle-resplit-and-swap-windows)
+    ;; Debugging command
+    (define-key map (kbd "C-h C-d")    'undefined)
+    (define-key map (kbd "C-h C-d")    'helm-enable-or-switch-to-debug)
+    ;; Allow to eval keymap without errors.
+    (define-key map [f1] nil)
+    (define-key map (kbd "C-h C-h")    'undefined)
+    (define-key map (kbd "C-h h")      'undefined)
+    ;; Use `describe-mode' key in `global-map'.
+    (cl-dolist (k (where-is-internal 'describe-mode global-map))
+      (define-key map k 'helm-help))
+    (define-key map (kbd "C-c ?")    'helm-help)
+    ;; Bind all actions from 1 to 12 to their corresponding nth index+1.
+    (cl-loop for n from 0 to 12 do
+             (define-key map (kbd (format "<f%s>" (1+ n)))
+               `(lambda ()
+                  (interactive)
+                  (helm-select-nth-action ,n))))
+    ;; Bind keys to allow executing default action
+    ;; on first 9 candidates before and after selection.
+    (cl-loop for n from 1 to 9
+         for key = (format "C-c %d" n)
+         for key- = (format "C-x %d" n)
+         for fn = `(lambda ()
+                     (interactive)
+                     (helm-execute-selection-action-at-nth ,n))
+         for fn- = `(lambda ()
+                      (interactive)
+                      (helm-execute-selection-action-at-nth ,(- n)))
+         do (progn
+              (define-key map (kbd key) fn)
+              (define-key map (kbd key-) fn-)))
+    map)
+  "Keymap for helm.")
+
+\f
+(defgroup helm nil
+  "Open helm."
+  :prefix "helm-" :group 'convenience)
+
+(defcustom helm-completion-window-scroll-margin 5
+  " `scroll-margin' to use for helm completion window.
+Which see.  Set to 0 to disable.
+NOTE: This have no effect when `helm-display-source-at-screen-top'
+id non--nil."
+  :group 'helm
+  :type  'integer)
+
+(defcustom helm-display-source-at-screen-top t
+  "Display candidates at the top of screen.
+This happen when using `helm-next-source' and `helm-previous-source'.
+NOTE: When non--nil (default) disable `helm-completion-window-scroll-margin'."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-candidate-number-limit 100
+  "Limit candidate number globally.
+Do not show more candidates than this limit from individual sources.
+It is usually pointless to show hundreds of matches
+when the pattern is empty, because it is much simpler to type a
+few characters to narrow down the list of potential candidates.
+
+Set it to nil if you don't want this limit."
+  :group 'helm
+  :type '(choice (const :tag "Disabled" nil) integer))
+
+(defcustom helm-idle-delay 0.01
+  "Be idle for this many seconds, before updating in delayed sources.
+This is useful for sources involving heavy operations
+\(like launching external programs\), so that candidates
+from the source are not retrieved unnecessarily if the user keeps typing.
+
+It also can be used to declutter the results helm displays,
+so that results from certain sources are not shown with every
+character typed, only if the user hesitates a bit.
+Be sure to know what you are doing when modifying this."
+  :group 'helm
+  :type 'float)
+
+(defcustom helm-input-idle-delay 0.01
+  "Be idle for this many seconds, before updating.
+
+Unlike `helm-idle-delay', it is also effective for non-delayed sources.
+If nil, candidates are collected immediately.
+
+Note:  If this value is too low compared to `helm-idle-delay',
+you may have duplicated sources when using multiples sources.
+Safe value is always >= `helm-idle-delay'.
+Default settings are equal value for both.
+Be sure to know what you are doing when modifying this."
+  :group 'helm
+  :type 'float)
+
+(defcustom helm-exit-idle-delay 0
+  "Be idle for this many seconds before exiting minibuffer while helm is updating.
+Note that this does nothing when helm-buffer is up to date
+\(i.e exit without delay in this condition\)."
+  :group 'helm
+  :type 'float)
+
+(defcustom helm-full-frame nil
+  "Use current window to show the candidates.
+If t then Helm doesn't pop up a new window."
+  :group 'helm
+  :type 'boolean)
+
+(defvaralias 'helm-samewindow 'helm-full-frame)
+(make-obsolete-variable 'helm-samewindow 'helm-full-frame "1.4.8.1")
+
+(defcustom helm-quick-update nil
+  "If non-nil, suppress displaying sources which are out of screen at first.
+They are treated as delayed sources at this input.
+This flag makes `helm' a bit faster with many sources."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-candidate-separator
+  "--------------------"
+  "Candidates separator of `multiline' source."
+  :group 'helm
+  :type 'string)
+
+(defcustom helm-save-configuration-functions
+  '(set-window-configuration . current-window-configuration)
+  "The functions used to restore/save window or frame configurations.
+It is a pair where the car is the function to restore window or frame config,
+and the cdr is the function to save the window or frame config.
+
+If you want to save and restore frame configuration, set this variable to
+ '\(set-frame-configuration . current-frame-configuration\)
+NOTE: This may not work properly with own-frame minibuffer settings.
+Older version saves/restores frame configuration, but the default is changed now
+because flickering can occur in some environment."
+  :group 'helm
+  :type 'sexp)
+
+(defcustom helm-persistent-action-use-special-display nil
+  "If non-nil, use `special-display-function' in persistent action."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-display-function 'helm-default-display-buffer
+  "Function to display *helm* buffer.
+It is `helm-default-display-buffer' by default,
+which affects `helm-full-frame'."
+  :group 'helm
+  :type 'symbol)
+
+(defcustom helm-case-fold-search 'smart
+  "Add 'smart' option to `case-fold-search'.
+When smart is enabled, ignore case in the search strings
+if pattern contains no uppercase characters.
+Otherwise, with a nil or t value, the behavior is same as
+`case-fold-search'.
+Default value is smart, other possible values are nil and t.
+NOTE: This have no effect in asynchronous sources, you will
+have to implement a similar feature directly in the process.
+See in helm-grep.el how it is implemented."
+  :group 'helm
+  :type '(choice (const :tag "Ignore case" t)
+          (const :tag "Respect case" nil)
+          (other :tag "Smart" 'smart)))
+
+(defcustom helm-file-name-case-fold-search
+  (if (memq system-type
+            '(cygwin windows-nt ms-dos darwin))
+      t
+    helm-case-fold-search)
+  "Local setting of `helm-case-fold-search' for reading filenames.
+
+See `helm-case-fold-search' for more info."
+  :group 'helm
+  :type 'symbol)
+
+(defcustom helm-reuse-last-window-split-state nil
+  "Reuse the last state of window split, vertical or horizontal.
+That is when you use `helm-toggle-resplit-window' the next helm session
+will reuse the same window scheme than the one of last session unless
+`helm-split-window-default-side' is 'same or 'other."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-split-window-preferred-function 'helm-split-window-default-fn
+  "Default function used for splitting window."
+  :group 'helm
+  :type 'function)
+
+(defcustom helm-split-window-default-side 'below
+  "The default side to display `helm-buffer'.
+Must be one acceptable arg for `split-window' SIDE,
+that is `below', `above', `left' or `right'.
+
+Other acceptable values are `same' which always display `helm-buffer'
+in current window and `other' that display `helm-buffer' below if only one
+window or in `other-window-for-scrolling' if available.
+
+A nil value as same effect as `below'.
+If `helm-full-frame' is non--nil, it take precedence on this.
+
+See also `helm-split-window-in-side-p' and `helm-always-two-windows' that
+take precedence on this.
+
+NOTE: this have no effect if `helm-split-window-preferred-function' is not
+`helm-split-window-default-fn' unless this new function handle this."
+  :group 'helm
+  :type 'symbol)
+
+(defcustom helm-display-buffer-default-size nil
+  "Initial height of `helm-buffer', an integer or a function.
+If a function, it should take one arg the window and it is in charge of
+resizing the window, its return value is ignored.
+See `display-buffer' for more info."
+  :group 'helm
+  :type '(choice integer function))
+
+(defcustom helm-split-window-in-side-p nil
+  "Force splitting inside selected window when non--nil.
+See also `helm-split-window-default-side'.
+
+NOTE: this have no effect if `helm-split-window-preferred-function' is not
+`helm-split-window-default-fn' unless this new function handle this."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-always-two-windows nil
+  "When non--nil helm will use two windows in this frame.
+That is one window to display `helm-buffer' and one to display
+`helm-current-buffer'.
+
+Note: this have no effect when `helm-split-window-in-side-p' is non--nil,
+or when `helm-split-window-default-side' is set to 'same.
+
+When `helm-autoresize-mode' is enabled, setting this to nil
+will have no effect.
+
+Also when non-nil it overhides the effect of `helm-split-window-default-side'
+set to `other'."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-sources-using-default-as-input '(helm-source-imenu
+                                                 helm-source-imenu-all
+                                                 helm-source-info-elisp
+                                                 helm-source-etags-select
+                                                 helm-source-man-pages
+                                                 helm-source-occur
+                                                 helm-source-moccur)
+  "List of helm sources that need to use `helm--maybe-use-default-as-input'.
+When a source is member of this list, default `thing-at-point'
+will be used as input."
+  :group 'helm
+  :type '(repeat (choice symbol)))
+
+(defcustom helm-delete-minibuffer-contents-from-point t
+  "When non--nil, `helm-delete-minibuffer-contents' delete region from `point'.
+Otherwise delete `minibuffer-contents'.
+See documentation of `helm-delete-minibuffer-contents'."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-follow-mode-persistent nil
+  "Retrieve last state of `helm-follow-mode' in next helm session when non--nil.
+This will not make it persistent through emacs sessions though,
+you will have to set explicitely the `follow' attribute in the source where
+you want this mode enabled definitely."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-prevent-escaping-from-minibuffer t
+  "Prevent escaping from minibuffer during helm session."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-move-to-line-cycle-in-source nil
+  "Move to end or beginning of source when reaching top or bottom of source.
+This happen when using `helm-next/previous-line'."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-fuzzy-match-fn 'helm-fuzzy-match
+  "The function for fuzzy matching in `helm-source-sync' based sources."
+  :group 'helm
+  :type 'function)
+
+(defcustom helm-fuzzy-search-fn 'helm-fuzzy-search
+  "The function for fuzzy matching in `helm-source-in-buffer' based sources."
+  :group 'helm
+  :type 'function)
+
+(defcustom helm-fuzzy-sort-fn 'helm-fuzzy-matching-default-sort-fn
+  "The sort transformer function used in fuzzy matching.
+When nil no sorting will be done."
+  :group 'helm
+  :type 'function)
+
+(defcustom helm-fuzzy-matching-highlight-fn 'helm-fuzzy-default-highlight-match
+  "The function to highlight matches in fuzzy matching.
+When nil no highlighting will be done."
+  :group 'helm
+  :type 'function)
+
+(defcustom helm-autoresize-max-height 40
+  "Specifies a maximum height and defaults to the height of helm window's frame in percentage.
+
+See `fit-window-to-buffer' for more infos."
+  :group 'helm
+  :type 'integer)
+
+(defcustom helm-autoresize-min-height 10
+  "Specifies a minimum height and defaults to the height of helm window's frame in percentage.
+
+If nil the default of `window-min-height' is used
+See `fit-window-to-buffer' for more infos."
+  :group 'helm
+  :type 'integer)
+
+(defcustom helm-input-method-verbose-flag nil
+  "The default value of `input-method-verbose-flag' to use in helm minibuffer.
+It is nil by default to allow helm updating and exiting without turning off
+the input method when complex methods are in use, if you set it to any other
+value allowed by `input-method-verbose-flag' you will have at each time you want
+to exit or helm update to disable the `current-input-method' with `C-\\'."
+  :group 'helm
+  :type '(radio :tag "A flag to control extra guidance given by input methods in helm."
+          (const :tag "Never provide guidance" nil)
+          (const :tag "Always provide guidance" t)
+          (const :tag "Provide guidance only in complex methods" complex-only)))
+
+(defcustom helm-display-header-line t
+  "Display header-line when non nil."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-inherit-input-method t
+  "Inherit `current-input-method' from `current-buffer' when non--nil.
+The default is to enable this by default, the user can toggle the current
+input method with `toggle-input-method'."
+  :group 'helm
+  :type 'boolean)
+
+(defcustom helm-echo-input-in-header-line nil
+  "Send current input in header-line."
+  :group 'helm
+  :type 'boolean)
+
+\f
+;;; Faces
+;;
+;;
+(defgroup helm-faces nil
+  "Customize the appearance of helm."
+  :prefix "helm-"
+  :group 'faces
+  :group 'helm)
+
+(defface helm-source-header
+    '((((background dark))
+       :background "#22083397778B"
+       :foreground "white"
+       :weight bold :height 1.3 :family "Sans Serif")
+      (((background light))
+       :background "#abd7f0"
+       :foreground "black"
+       :weight bold :height 1.3 :family "Sans Serif"))
+  "Face for source header in the helm buffer."
+  :group 'helm-faces)
+
+(defface helm-visible-mark
+    '((((min-colors 88) (background dark))
+       (:background "green1" :foreground "black"))
+      (((background dark))
+       (:background "green" :foreground "black"))
+      (((background light)) :background "#d1f5ea")
+      (((min-colors 88))
+       (:background "green1"))
+      (t (:background "green")))
+  "Face for visible mark."
+  :group 'helm-faces)
+
+(defface helm-header
+    '((t (:inherit header-line)))
+  "Face for header lines in the helm buffer."
+  :group 'helm-faces)
+
+(defface helm-candidate-number
+    '((((background dark)) :background "Yellow" :foreground "black")
+      (((background light)) :background "#faffb5" :foreground "black"))
+  "Face for candidate number in mode-line." :group 'helm-faces)
+
+(defface helm-selection
+    '((((background dark)) :background "ForestGreen"
+       :distant-foreground "black")
+      (((background light)) :background "#b5ffd1"
+       :distant-foreground "black"))
+  "Face for currently selected item in the helm buffer."
+  :group 'helm-faces)
+
+(defface helm-separator
+    '((((background dark)) :foreground "red")
+      (((background light)) :foreground "#ffbfb5"))
+  "Face for multiline source separator."
+  :group 'helm-faces)
+
+(defface helm-action
+    '((t (:underline t)))
+  "Face for action lines in the helm action buffer."
+  :group 'helm-faces)
+
+(defface helm-prefarg
+    '((((background dark)) :foreground "green")
+      (((background light)) :foreground "red"))
+  "Face for showing prefix arg in mode-line."
+  :group 'helm-faces)
+
+(defface helm-match
+  '((((background light)) :foreground "#b00000")
+    (((background dark))  :foreground "gold1"))
+  "Face used to highlight matches."
+  :group 'helm-faces)
+
+(defface helm-header-line-left-margin
+  '((t (:foreground "black" :background "yellow")))
+  "Face used to highlight helm-header sign in left-margin."
+  :group 'helm-faces)
+
+\f
+;;; Variables.
+;;
+;;
+(defvar helm-type-attributes nil
+  "It's a list of \(TYPE ATTRIBUTES ...\).
+ATTRIBUTES are the same as attributes for `helm-sources'.
+TYPE connects the value to the appropriate sources.
+Don't set this directly, use instead `define-helm-type-attribute'.
+
+This allows specifying common attributes for several sources.
+For example, sources which provide files can specify
+common attributes with a `file' type.")
+
+(defvar helm-source-filter nil
+  "A list of source names to be displayed.
+Other sources won't appear in the search results.
+If nil then there is no filtering.
+See also `helm-set-source-filter'.")
+
+(defvar helm-selection-overlay nil
+  "Overlay used to highlight the currently selected item.")
+
+(defvar helm-async-processes nil
+  "List of information about asynchronous processes managed by helm.")
+
+(defvar helm-before-initialize-hook nil
+  "Run before helm initialization.
+This hook is run before init functions in `helm-sources',
+that is before creation of `helm-buffer'.
+Local variables for `helm-buffer' that need a value from `current-buffer'
+can be set here with `helm-set-local-variable'.")
+
+(defvar helm-after-initialize-hook nil
+  "Run after helm initialization.
+This hook run after `helm-buffer' is created but not from `helm-buffer'
+so the hook have to specify in which buffer it should run.")
+
+(defvar helm-update-hook nil
+  "Run after the helm buffer was updated according the new input pattern.
+This hook is run at the beginning of buffer.
+The first candidate is selected after running this hook.
+See also `helm-after-update-hook'.")
+
+(defvar helm-after-update-hook nil
+  "Run after the helm buffer was updated according the new input pattern.
+This is very similar to `helm-update-hook' but selection is not moved.
+It is useful to select a particular object instead of the first one.")
+
+(defvar helm-cleanup-hook nil
+  "Run after exiting the minibuffer and before performing an
+action.
+
+This hook is run even if the minibuffer is exited
+abnormally (e.g. via `helm-keyboard-quit`).")
+
+(defvar helm-select-action-hook nil
+  "Run when opening the action buffer.")
+
+(defvar helm-before-action-hook nil
+  "Run before executing action.
+Contrarily to `helm-cleanup-hook',
+this hook run before helm minibuffer is closed
+and before performing action.")
+
+(defvar helm-after-action-hook nil
+  "Run after executing action.")
+
+(defvar helm-exit-minibuffer-hook nil
+  "Run just before exiting the minibuffer.
+
+This hook is run if the minibuffer is exited normally (e.g. via
+candidate selection).  It is NOT run if the minibuffer is exited
+abnormally (e.g. via `helm-keyboard-quit`).")
+
+(defvar helm-after-persistent-action-hook nil
+  "Run after executing persistent action.")
+
+(defvar helm-move-selection-before-hook nil
+  "Run before moving selection in `helm-buffer'.")
+
+(defvar helm-move-selection-after-hook nil
+  "Run after moving selection in `helm-buffer'.")
+
+(defvar helm-after-preselection-hook nil
+  "Run after preselection in `helm-buffer'.")
+
+(defvar helm-window-configuration-hook nil
+  "Run when switching to and back from action buffer.")
+
+(defconst helm-restored-variables
+  '(helm-candidate-number-limit
+    helm-source-filter
+    helm-source-in-each-line-flag
+    helm-map
+    helm-sources)
+  "Variables which are restored after `helm' invocation.")
+
+(defvar helm-execute-action-at-once-if-one nil
+  "Execute default action and exit when only one candidate is remaining.
+It can be also a function called with no args returning a boolean value.")
+
+(defvar helm-quit-if-no-candidate nil
+  "Quit when there is no candidates when non--nil.
+This variable accepts a function, which is executed if no candidate.")
+
+(defvar helm-source-in-each-line-flag nil
+  "Non-nil means add helm-source text-property in each candidate.
+experimental feature.")
+
+(defvar helm-debug-variables nil
+  "A list of helm variables to show in `helm-debug-output'.
+Otherwise all variables started with `helm-' are shown.")
+
+(defvar helm-debug-buffer "*Debug Helm Log*")
+
+(defvar helm-debug nil
+  "If non-nil, write log message into `helm-debug-buffer' buffer.
+It is disabled by default because `helm-debug-buffer' grows quickly.")
+
+(defvar helm-compile-source-functions
+  '(helm-compile-source--type
+    helm-compile-source--dummy
+    helm-compile-source--candidates-in-buffer)
+  "Functions to compile elements of `helm-sources' (plug-in).")
+
+(defvar helm-mode-line-string "\
+\\<helm-map>\
+\\[helm-help]:Help \
+\\[helm-select-action]:Act \
+\\[helm-maybe-exit-minibuffer]/\
+f1/f2/f-n:NthAct \
+\\[helm-toggle-suspend-update]:Tog.suspend"
+  "Help string displayed in mode-line in `helm'.
+It can be a string or a list of two args, in this case,
+first arg is a string that will be used as name for candidates number,
+second arg any string to display in mode line.
+If nil, use default `mode-line-format'.")
+
+(defvar helm-minibuffer-set-up-hook nil
+  "Hook that run at initialization of minibuffer.
+Useful for modifying the settings of minibuffer in helm.
+
+Here an example to hide minibuffer when using
+`helm-echo-input-in-header-line':
+
+      (add-hook 'helm-minibuffer-set-up-hook #'helm-hide-minibuffer-maybe)
+
+Note that we check `helm-echo-input-in-header-line' value
+from `helm-buffer' which allow detecting possible local
+value of this var.")
+
+(defvar helm-help-message
+     "* Helm Generic Help
+
+\\<helm-map>`helm' is an Emacs incremental completion and selection narrowing framework.
+
+Narrow the list by typing some pattern,
+Multiple patterns are allowed by separating with a space.
+Select with natural Emacs operations, choose with RET.
+
+** Help
+
+C-h m\t\tRun this generic help for helm.
+
+** Basic Operations
+
+These are the default key bindings:
+
+| Key     | Alternative Keys | Command                                                   |
+|---------+------------------+-----------------------------------------------------------|
+| C-p     | Up               | Previous Line                                             |
+| C-n     | Down             | Next Line                                                 |
+| M-v     | PageUp           | Previous Page                                             |
+| C-v     | PageDown         | Next Page                                                 |
+| Enter   |                  | Execute first (default) action / Select                   |
+| M-<     |                  | First Line                                                |
+| M->     |                  | Last Line                                                 |
+| C-M-S-v | M-PageUp, C-M-y  | Previous Page (other-window)                              |
+| C-M-v   | M-PageDown       | Next Page (other-window)                                  |
+| Tab     | C-i              | Show action list                                          |
+| Left    |                  | Previous Source                                           |
+| Right   | C-o              | Next Source                                               |
+| C-k     |                  | Delete pattern (with prefix arg delete from point to end) |
+| C-j     | C-z              | Persistent Action (Execute and keep helm session)         |
+
+** Shortcuts For nth Action
+
+f1-12: Execute nth 1 to 12 Action(s).
+
+** Shortcuts for executing Default Action on nth candidate
+
+C-x <n> => execute default action on number <n> candidate before selection.
+C-c <n> => execute default action on number <n> candidate after selection.
+
+Of course this works only on the 9 first and previous candidates.
+
+Helm provides nothing to visualize candidates numbers, up to you to install
+linum-relative package and enable linum-relative in helm..
+
+** Visible Marks
+
+Visible marks store candidate. Some actions uses marked candidates.
+
+** Miscellaneous Commands
+
+\\[helm-toggle-resplit-and-swap-windows]\t\tToggle vertical/horizontal split on first hit and swap helm window on second hit.
+\\[helm-quit-and-find-file]\t\tDrop into `helm-find-files'.
+\\[helm-kill-selection-and-quit]\t\tKill display value of candidate and quit (with prefix arg kill the real value).
+\\[helm-yank-selection]\t\tYank selection into pattern.
+\\[helm-follow-mode]\t\tToggle automatical execution of persistent action.
+\\[helm-follow-action-forward]\tRun persistent action and goto next line.
+\\[helm-follow-action-backward]\t\tRun persistent action and goto previous line.
+\\[helm-refresh]\t\tRecalculate and redisplay candidates.
+\\[helm-toggle-suspend-update]\t\tSuspend/reenable update.
+
+** Global Commands
+
+\\<global-map>\\[helm-resume] revives last `helm' session.
+It is very useful, so you should bind any key.
+
+** Helm Map
+\\{helm-map}"
+  "Detailed help message string for `helm'.
+It also accepts function or variable symbol.")
+
+(defvar helm-autoresize-mode) ;; Undefined in `helm-default-display-buffer'.
+
+\f
+;;; Internal Variables
+;;
+;;
+(defvar helm-current-prefix-arg nil
+  "Record `current-prefix-arg' when exiting minibuffer.")
+(defvar helm-saved-action nil
+  "Saved value of the currently selected action by key.")
+(defvar helm-saved-current-source nil
+  "Value of the current source when the action list is shown.")
+(defvar helm-compiled-sources nil
+  "Compiled version of `helm-sources'.")
+(defvar helm-in-persistent-action nil
+  "Flag whether in persistent-action or not.")
+(defvar helm-last-buffer nil
+  "`helm-buffer' of previously `helm' session.")
+(defvar helm-saved-selection nil
+  "Value of the currently selected object when the action list is shown.")
+(defvar helm-sources nil
+  "[INTERNAL] Value of current sources in use, a list.")
+(defvar helm-buffer-file-name nil
+  "Variable `buffer-file-name' when `helm' is invoked.")
+(defvar helm-candidate-cache (make-hash-table :test 'equal)
+  "Holds the available candidate within a single helm invocation.")
+(defvar helm-input ""
+  "The input typed in the candidates panel.")
+(defvar helm-input-local nil
+  "Internal, store locally `helm-pattern' value for later use in `helm-resume'.")
+(defvar helm-source-name nil)
+(defvar helm-current-source nil)
+(defvar helm-candidate-buffer-alist nil)
+(defvar helm-tick-hash (make-hash-table :test 'equal))
+(defvar helm-issued-errors nil)
+(defvar helm-debug-root-directory nil
+  "When non--nil, save helm log to `helm-last-log-file'.
+Be aware that if you set that, you will end up with a huge directory
+of log files, so use that only for debugging purpose.
+See `helm-log-save-maybe' for more info.")
+(defvar helm-last-log-file nil
+  "The name of the last helm session log file.")
+(defvar helm-follow-mode nil)
+(defvar helm--local-variables nil)
+(defvar helm-split-window-state nil)
+(defvar helm--window-side-state nil)
+(defvar helm-selection-point nil)
+(defvar helm-alive-p nil)
+(defvar helm-visible-mark-overlays nil)
+(defvar helm-update-blacklist-regexps '("^" "^ *" "$" "!" " " "\\b"
+                                        "\\<" "\\>" "\\_<" "\\_>" ".*"))
+(defvar helm-force-updating-p nil)
+(defvar helm-exit-status 0
+  "Flag to inform whether helm have exited or quitted.
+Exit with 0 mean helm have exited executing an action.
+Exit with 1 mean helm have quitted with \\[keyboard-quit]
+It is useful for example to restore a window config if helm abort
+in special cases.
+See `helm-exit-minibuffer' and `helm-keyboard-quit'.")
+(defvar helm-minibuffer-confirm-state nil)
+(defvar helm-quit nil)
+(defvar helm-attributes nil "List of all `helm' attributes.")
+(defvar helm-buffers nil
+  "All of `helm-buffer' in most recently used order.")
+(defvar helm-current-position nil
+  "Cons of \(point . window-start\)  when `helm' is invoked.
+It is needed to restore position in `helm-current-buffer'
+when `helm' is keyboard-quitted.")
+(defvar helm-last-frame-or-window-configuration nil
+  "Used to store window or frame configuration when helm start.")
+(defvar helm-onewindow-p nil)
+(defvar helm-types nil)
+(defvar helm--mode-line-string-real nil) ; The string to display in mode-line.
+(defvar helm-persistent-action-display-window nil)
+(defvar helm-marked-candidates nil
+  "Marked candadates.  List of \(source . real\) pair.")
+(defvar helm--mode-line-display-prefarg nil)
+(defvar helm--temp-follow-flag nil
+  "[INTERNAL] A simple flag to notify persistent action we are following.")
+(defvar helm--reading-passwd-or-string nil)
+(defvar helm--in-update nil)
+(defvar helm--in-fuzzy nil)
+(defvar helm--maybe-use-default-as-input nil
+  "Flag to notify the use of use-default-as-input.
+Use only in let-bindings.
+Use :default arg of `helm' as input to update display.
+Note that if also :input is specified as `helm' arg, it will take
+precedence on :default.")
+(defvar helm--temp-hooks nil
+  "Store temporary hooks added by `with-helm-temp-hook'.")
+(defvar helm-truncate-lines nil
+  "[Internal] Don't set this globally, it is used as a local var.")
+(defvar helm--prompt nil)
+(defvar helm--file-completion-sources
+  '("Find Files" "Read File Name" "Read File Name History")
+  "Sources that use the *find-files mechanism can be added here.
+Sources generated by `helm-mode' don't need to be added here, it will
+be done automatically.
+You should not modify this yourself unless you know what you do.")
+;; Same as `ffap-url-regexp' but keep it here to ensure `ffap-url-regexp' is not nil.
+(defvar helm--url-regexp "\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)")
+\f
+;; Utility: logging
+(defun helm-log (format-string &rest args)
+  "Log message `helm-debug' is non-nil.
+Messages are written to the `helm-debug-buffer' buffer.
+
+Argument FORMAT-STRING is a string to use with `format'.
+Use optional arguments ARGS like in `format'."
+  (when helm-debug
+    (with-current-buffer (get-buffer-create helm-debug-buffer)
+      (outline-mode)
+      (buffer-disable-undo)
+      (set (make-local-variable 'inhibit-read-only) t)
+      (goto-char (point-max))
+      (insert (let ((tm (current-time)))
+                (format (concat (if (string-match "Start session" format-string)
+                                    "* " "** ")
+                                "%s.%06d (%s)\n %s\n")
+                        (format-time-string "%H:%M:%S" tm)
+                        (nth 2 tm)
+                        (helm-log-get-current-function)
+                        (apply #'format (cons format-string args))))))))
+
+(defun helm-log-run-hook (hook)
+  "Run HOOK like `run-hooks' but write these actions to helm log buffer."
+  (helm-log "Executing %s with value = %S" hook (symbol-value hook))
+  (helm-log "Executing %s with global value = %S" hook (default-value hook))
+  (run-hooks hook)
+  (helm-log "executed %s" hook))
+
+(defun helm-log-get-current-function ()
+  "Get function name calling `helm-log'.
+The original idea is from `tramp-debug-message'."
+  (cl-loop with exclude-func-re = "^helm-\\(?:interpret\\|log\\|.*funcall\\)"
+        for btn from 1 to 40
+        for btf = (cl-second (backtrace-frame btn))
+        for fn  = (if (symbolp btf) (symbol-name btf) "")
+        if (and (string-match "^helm" fn)
+                (not (string-match exclude-func-re fn)))
+        return fn))
+
+(defun helm-log-error (&rest args)
+  "Accumulate error messages into `helm-issued-errors'.
+ARGS are args given to `format'.
+e.g (helm-log-error \"Error %s: %s\" (car err) (cdr err))."
+  (apply 'helm-log (concat "ERROR: " (car args)) (cdr args))
+  (let ((msg (apply 'format args)))
+    (unless (member msg helm-issued-errors)
+      (add-to-list 'helm-issued-errors msg))))
+
+(defun helm-log-save-maybe ()
+  "May be save log buffer to `helm-last-log-file'.
+If `helm-debug-root-directory' is non--nil and a valid directory,
+a directory named 'helm-debug-<date of today>'
+will be created there and the log recorded in a file named
+at the date and time of today in this directory."
+  (when (and (stringp helm-debug-root-directory)
+             (file-directory-p helm-debug-root-directory)
+             helm-debug)
+    (let ((logdir (expand-file-name (concat "helm-debug-"
+                                            (format-time-string "%Y%m%d"))
+                                    helm-debug-root-directory)))
+      (make-directory logdir t)
+      (with-current-buffer (get-buffer-create helm-debug-buffer)
+        (write-region (point-min) (point-max)
+                      (setq helm-last-log-file
+                            (expand-file-name
+                             (format-time-string "%Y%m%d-%H%M%S")
+                             logdir))
+                      nil 'silent)
+        (kill-buffer)))))
+
+;;;###autoload
+(defun helm-debug-open-last-log ()
+  "Open helm log file of last helm session.
+If `helm-last-log-file' is nil, switch to `helm-debug-buffer' ."
+  (interactive)
+  (if helm-last-log-file
+      (view-file helm-last-log-file)
+    (switch-to-buffer helm-debug-buffer)
+    (view-mode 1) (visual-line-mode 1)))
+
+(defun helm-print-error-messages ()
+  "Print error messages in `helm-issued-errors'."
+  (and helm-issued-errors
+       (message "Helm issued errors: %s"
+                (mapconcat 'identity (reverse helm-issued-errors) "\n"))))
+
+\f
+;; Programming Tools
+
+(defun helm-this-command ()
+  "Return the actual command in action.
+Like `this-command' but return the real command,
+not `exit-minibuffer' or unwanted functions."
+  (cl-loop with bl = '(helm-maybe-exit-minibuffer
+                       helm-confirm-and-exit-minibuffer
+                       helm-exit-minibuffer
+                       exit-minibuffer)
+        for count from 1 to 50
+        for btf = (backtrace-frame count)
+        for fn = (cl-second btf)
+        if (and
+            ;; In some case we may have in the way an
+            ;; advice compiled resulting in byte-code,
+            ;; ignore it (Issue #691).
+            (symbolp fn)
+            (commandp fn)
+            (not (memq fn bl)))
+        return fn
+        else
+        if (and (eq fn 'call-interactively)
+                (> (length btf) 2))
+        return (cadr (cdr btf))))
+
+\f
+;; Test tools
+(defmacro with-helm-time-after-update (&rest body)
+  (helm-with-gensyms (start-time time-elapsed)
+    `(let ((,start-time (float-time)) ,time-elapsed)
+       (add-hook 'helm-after-update-hook
+                 (lambda ()
+                   (setq ,time-elapsed (- (float-time) ,start-time))
+                   (keyboard-quit)))
+       (unwind-protect ,@body
+         (remove-hook 'helm-after-update-hook
+                      (lambda ()
+                        (setq  ,time-elapsed (- (float-time) ,start-time))
+                        (keyboard-quit))))
+       ,time-elapsed)))
+
+\f
+;; Helm API
+
+(defmacro with-helm-restore-variables (&rest body)
+  "Restore `helm-restored-variables' after executing BODY."
+  (declare (indent 0) (debug t))
+  (helm-with-gensyms (orig-vars)
+    `(let ((,orig-vars (mapcar (lambda (v)
+                                 (cons v (symbol-value v)))
+                               helm-restored-variables)))
+       (unwind-protect (progn ,@body)
+         (cl-loop for (var . value) in ,orig-vars
+               do (set var value))
+         (helm-log "restore variables")))))
+
+(defmacro with-helm-default-directory (directory &rest body)
+  (declare (indent 2) (debug t))
+  `(let ((default-directory (or (and ,directory
+                                     (file-name-as-directory ,directory))
+                                default-directory)))
+     ,@body))
+
+(defun helm-default-directory ()
+  "Return the local value of `default-directory' in `helm-buffer'."
+  (buffer-local-value 'default-directory (get-buffer helm-buffer)))
+
+(defmacro with-helm-temp-hook (hook &rest body)
+  "Execute temporarily BODY as a function for HOOK."
+  (declare (indent 1) (debug t))
+  (helm-with-gensyms (helm--hook)
+    `(progn
+       (defun ,helm--hook ()
+         (unwind-protect
+              (progn ,@body)
+           (remove-hook ,hook (quote ,helm--hook))
+           (fmakunbound (quote ,helm--hook))))
+       (push (cons ',helm--hook ,hook) helm--temp-hooks)
+       (add-hook ,hook (quote ,helm--hook)))))
+
+(defmacro with-helm-after-update-hook (&rest body)
+  "Execute BODY at end of `helm-update'."
+  (declare (indent 0) (debug t))
+  `(with-helm-temp-hook 'helm-after-update-hook ,@body))
+
+(defmacro with-helm-alive-p (&rest body)
+  "Return error when BODY run outside helm context."
+  (declare (indent 0) (debug t))
+  `(progn
+     (if helm-alive-p
+         (progn ,@body)
+       (error "Running helm command outside of context"))))
+
+(defun helm-attr (attribute-name &optional source compute)
+  "Get the value of ATTRIBUTE-NAME of SRC.
+If SRC is omitted, use current source.
+If COMPUTE is non--nil compute value of ATTRIBUTE-NAME
+with `helm-interpret-value'.  COMPUTE can have also 'ignorefn as
+value, in this case `helm-interpret-value' will return a function
+as value inchanged, but will eval a symbol which is bound
+(i.e a variable)."
+  (let ((src (or source (helm-get-current-source))))
+    (helm-aif (or (assq attribute-name src)
+                  (helm-get-attribute-from-source-type attribute-name src))
+        (if compute
+            (helm-interpret-value (cdr it) src compute)
+            (cdr it)))))
+
+(cl-defun helm-attr-defined (attribute-name
+                             &optional (src (helm-get-current-source)))
+  "Return non-nil if ATTRIBUTE-NAME of SRC is defined.
+if SRC is omitted, use current source."
+  (and (helm-attr attribute-name src) t))
+
+(cl-defun helm-attrset (attribute-name value
+                        &optional
+                          (src (helm-get-current-source))
+                          alter-type)
+  "Set the value of ATTRIBUTE-NAME of source SRC to VALUE.
+If ATTRIBUTE-NAME doesn't exists in source it is created with value VALUE.
+If ALTER-TYPE is non--nil alter the value of ATTRIBUTE-NAME in `helm-attributes'
+if it exists.
+If SRC is omitted, use current source.
+If operation succeed, return value, otherwise nil."
+  (let ((from-type (helm-get-attribute-from-source-type attribute-name src))
+        done)
+    (helm-aif (or (assq attribute-name src)
+                  (and alter-type from-type))
+        (prog1 (setcdr it value) (setq done t))
+      (unless from-type
+        (setcdr src (cons (cons attribute-name value) (cdr src)))
+        (setq done t)))
+    (and done value)))
+
+(defun helm-get-attribute-from-source-type (attribute source)
+  "Get ATTRIBUTE from type attribute of SOURCE."
+  (when (assq 'type source)
+    (assq attribute
+          (assq (cdr (assq 'type source))
+                helm-type-attributes))))
+
+(defun helm-get-attribute-from-type (attribute type)
+  "Get ATTRIBUTE from TYPE.
+arg TYPE is an existing type defined in `helm-type-attributes'."
+  (assq attribute (assq type helm-type-attributes)))
+
+(defun helm-get-actions-from-type (source)
+  "Get actions list from type attribute of SOURCE."
+  (when (assq 'type source)
+    (helm-get-attribute-from-source-type 'action source)))
+
+(defun helm-inherit-attribute-from-source (attribute source)
+  "Get the ATTRIBUTE of SOURCE."
+  (helm-aif (assq attribute source)
+      it
+    (helm-get-attribute-from-source-type attribute source)))
+
+(defun helm-append-at-nth (seq elm index)
+  "Append ELM at INDEX in SEQ."
+  (let ((len (length seq)))
+    (cond ((> index len) (setq index len))
+          ((< index 0) (setq index 0)))
+    (if (zerop index)
+        (append elm seq)
+        (cl-loop for i in seq
+                 for count from 1 collect i
+                 when (= count index)
+                 if (listp elm) append elm
+                 else collect elm))))
+
+(defun helm-add-action-to-source (name fn source &optional index)
+  "Add new action NAME linked to function FN to SOURCE.
+Function FN should be a valid function that take one arg i.e candidate,
+argument NAME is a string that will appear in action menu
+and SOURCE should be an existing helm source already loaded.
+If INDEX is specified, action is added in action list at INDEX,
+otherwise it is added at end.
+This allow user to add a specific action to an existing source
+without modifying source code."
+  (let ((actions    (helm-attr 'action source 'ignorefn))
+        (new-action (list (cons name fn))))
+    (when (functionp actions)
+      (setq actions (list (cons "Default action" actions))))
+    (helm-attrset 'action
+                  (if index
+                      (helm-append-at-nth actions new-action index)
+                    (append actions new-action))
+                  source)))
+
+(defun helm-delete-action-from-source (action-or-name source)
+  "Delete ACTION-OR-NAME from SOURCE.
+ACTION-OR-NAME can either be the name of action or the symbol function
+associated to name."
+  (let* ((actions    (helm-attr 'action source 'ignorefn))
+         (del-action (if (symbolp action-or-name)
+                         (rassoc action-or-name actions)
+                       (assoc action-or-name actions))))
+    (helm-attrset 'action (delete del-action actions) source)))
+
+(cl-defun helm-add-action-to-source-if (name fn source predicate
+                                        &optional (index 4) test-only)
+  "Add new action NAME linked to function FN to SOURCE.
+Action NAME will be available when the current candidate matches PREDICATE.
+This function add an entry in the `action-transformer' attribute
+of SOURCE (or create one if not found).
+Function PREDICATE should take one arg candidate.
+Function FN should be a valid function that take one arg i.e candidate,
+argument NAME is a string that will appear in action menu
+and SOURCE should be an existing helm source already loaded.
+If INDEX is specified, action is added in action list at INDEX.
+Value of INDEX should be always >=1, default to 4.
+This allow user to add a specific `action-tranformer'
+to an existing source without modifying source code.
+E.g
+Add the action \"Byte compile file async\" linked to
+function 'async-byte-compile-file to source `helm-source-find-files'
+only when predicate helm-ff-candidates-lisp-p return non--nil:
+
+\(helm-add-action-to-source-if \"Byte compile file async\"
+                              'async-byte-compile-file
+                              helm-source-find-files
+                              'helm-ff-candidates-lisp-p\)."
+  (let* ((actions     (helm-attr 'action source 'ignorefn))
+         (action-transformers (helm-attr 'action-transformer source))
+         (new-action  (list (cons name fn)))
+         (transformer `(lambda (actions candidate)
+                         (cond ((funcall (quote ,predicate) candidate)
+                                (helm-append-at-nth
+                                 actions (quote ,new-action) ,index))
+                               (t actions)))))
+    (when (functionp actions)
+      (helm-attrset 'action (list (cons "Default action" actions)) source))
+    (when (or (symbolp action-transformers) (functionp action-transformers))
+      (setq action-transformers (list action-transformers)))
+    (if test-only                       ; debug
+        (delq nil (append (list transformer) action-transformers))
+      (helm-attrset 'action-transformer
+                    (helm-fast-remove-dups
+                     (delq nil (append (list transformer) action-transformers))
+                     :test 'equal)
+                    source))))
+
+(defun helm-set-source-filter (sources)
+  "Set the value of `helm-source-filter' to SOURCES and update.
+
+This function sets a filter for helm sources and it may be
+called while helm is running. It can be used to toggle
+displaying of sources dynamically. For example, additional keys
+can be bound into `helm-map' to display only the file-related
+results if there are too many matches from other sources and
+you're after files only:
+
+Shift+F shows only file results from some sources:
+
+\(define-key helm-map \"F\" 'helm-my-show-files-only)
+
+\(defun helm-my-show-files-only ()
+  (interactive)
+  (helm-set-source-filter '(\"File Name History\"
+                                  \"Files from Current Directory\")))
+
+Shift+A shows all results:
+
+\(define-key helm-map \"A\" 'helm-my-show-all)
+
+\(defun helm-my-show-all ()
+  (interactive)
+  (helm-set-source-filter nil))
+
+The -my- part is added to avoid collisions with
+existing Helm function names."
+  (let ((cur-disp-sel (with-current-buffer helm-buffer
+                        (helm-get-selection nil t))))
+    (setq helm-source-filter (helm--normalize-filter-sources sources))
+    (helm-log "helm-source-filter = %S" helm-source-filter)
+    ;; Use force-update to run init/update functions.
+    (helm-force-update (and (stringp cur-disp-sel)
+                            (regexp-quote cur-disp-sel)))))
+
+(defun helm--normalize-filter-sources (sources)
+  (cl-loop for s in sources collect
+           (cl-typecase s
+             (symbolp (assoc-default 'name (symbol-value s)))
+             (listp   (assoc-default 'name s))
+             (stringp s))))
+
+(defun helm-set-sources (sources &optional no-init no-update)
+  "Set SOURCES during `helm' invocation.
+If NO-INIT is non-nil, skip executing init functions of SOURCES.
+If NO-UPDATE is non-nil, skip executing `helm-update'."
+  (with-current-buffer helm-buffer
+    (setq helm-compiled-sources nil
+          helm-sources sources)
+    (helm-log "helm-compiled-sources = %S" helm-compiled-sources)
+    (helm-log "helm-sources = %S" helm-sources))
+  (unless no-init (helm-funcall-foreach 'init))
+  (unless no-update (helm-update)))
+
+(defun helm-get-sources ()
+  "Return compiled `helm-sources', which is memoized.
+
+Attributes:
+
+- type
+  `helm-type-attributes' are merged in.
+- candidates-buffer
+  candidates, volatile and match attribute are created."
+  (cond
+    ;; action
+    ((helm-action-window)
+     helm-sources)
+    ;; memoized
+    (helm-compiled-sources)
+    ;; first time
+    (t
+     (prog1
+         (setq helm-compiled-sources
+               (helm-compile-sources
+                helm-sources helm-compile-source-functions))
+       (helm-log "helm-compiled-sources = %S" helm-compiled-sources)))))
+
+(cl-defun helm-get-selection (&optional (buffer nil buffer-s)
+                                force-display-part)
+  "Return the currently selected item or nil.
+if BUFFER is nil or unspecified, use helm-buffer as default value.
+If FORCE-DISPLAY-PART is non-nil, return the display string.
+If FORCE-DISPLAY-PART value is 'withprop the display string is returned
+with its properties."
+  (setq buffer (if (and buffer buffer-s) buffer helm-buffer))
+  (unless (helm-empty-buffer-p buffer)
+    (with-current-buffer buffer
+      (let* ((disp-fn (if (eq force-display-part 'withprop)
+                          'buffer-substring
+                        'buffer-substring-no-properties))
+             (selection
+              (or (and (not force-display-part)
+                       (get-text-property (overlay-start
+                                           helm-selection-overlay)
+                                          'helm-realvalue))
+                  ;; It is needed to return properties of DISP in some case,
+                  ;; e.g for `helm-confirm-and-exit-minibuffer',
+                  ;; so use `buffer-substring' here when 'withprop is specified.
+                  (let ((disp (funcall
+                               disp-fn
+                               (overlay-start helm-selection-overlay)
+                               (1- (overlay-end helm-selection-overlay))))
+                        (source (helm-get-current-source)))
+                    (helm-aif (and (not force-display-part)
+                                   (assoc-default 'display-to-real source))
+                        (helm-funcall-with-source source it disp)
+                      disp)))))
+        (unless (equal selection "")
+          (helm-log "selection = %S" selection)
+          selection)))))
+
+(defun helm-get-actions-from-current-source ()
+  "Return the associated action for the selected candidate.
+It is a function symbol \(sole action\) or list
+of \(action-display . function\)."
+  (unless (helm-empty-buffer-p (helm-buffer-get))
+    (helm-aif (helm-attr 'action-transformer)
+        (helm-composed-funcall-with-source
+         (helm-get-current-source) it
+         (helm-attr 'action nil 'ignorefn)
+         ;; Check if the first given transformer
+         ;; returns the same set of actions for each
+         ;; candidate in marked candidates.
+         ;; If so use the car of marked to determine
+         ;; the set of actions, otherwise use the selection.
+         (if (cl-loop with marked = (helm-marked-candidates)
+                      with act = (car (helm-mklist it))
+                      with acts = (funcall act nil (car marked))
+                      for c in marked
+                      always (equal (funcall act nil c) acts))
+             (car (helm-marked-candidates))
+             (helm-get-selection)))
+      (helm-attr 'action nil 'ignorefn))))
+
+(defun helm-get-current-source ()
+  "Return the source for the current selection.
+Allow also checking if helm-buffer contain candidates."
+  (or helm-current-source
+      (with-current-buffer (helm-buffer-get)
+        (or
+         ;; This happen only when `helm-source-in-each-line-flag'
+         ;; is non--nil and there is candidates in buffer.
+         (get-text-property (point) 'helm-source)
+         ;; Return nil when no--candidates.
+         (cl-block exit
+           ;; This goto-char shouldn't be necessary, but point is moved to
+           ;; point-min somewhere else which shouldn't happen.
+           (goto-char (overlay-start helm-selection-overlay))
+           (let* ((header-pos (or (helm-get-previous-header-pos)
+                                  (helm-get-next-header-pos)))
+                  (source-name
+                   (save-excursion
+                     (unless header-pos
+                       (cl-return-from exit nil))
+                     (goto-char header-pos)
+                     (helm-current-line-contents))))
+             (cl-loop for source in (helm-get-sources) thereis
+                   (and (equal (assoc-default 'name source) source-name)
+                        source))))))))
+
+(defun helm-buffer-is-modified (buffer)
+  "Return non-nil when BUFFER is modified since `helm' was invoked."
+  (let* ((b (get-buffer buffer))
+         (key (concat (buffer-name b) "/" (helm-attr 'name)))
+         (source-tick (or (gethash key helm-tick-hash) 0))
+         (buffer-tick (buffer-chars-modified-tick b))
+         (modifiedp (/= source-tick buffer-tick)))
+    (puthash key buffer-tick helm-tick-hash)
+    (helm-log "buffer = %S" buffer)
+    (helm-log "modifiedp = %S" modifiedp)
+    modifiedp))
+
+(defun helm-current-buffer-is-modified ()
+  "Check if `helm-current-buffer' is modified since `helm' was invoked."
+  (helm-buffer-is-modified helm-current-buffer))
+
+(defun helm-run-after-exit (function &rest args)
+  "Exectute FUNCTION with ARGS after exiting `helm'.
+The action is to call FUNCTION with arguments ARGS.
+Contrarily to `helm-exit-and-execute-action' this can be used
+to call non--actions functions with any ARGS or no ARGS at all.
+
+Use this on commands invoked from keybindings, but not
+on action functions invoked as action from the action menu,
+i.e functions called with RET."
+  (helm-kill-async-processes)
+  (helm-log "function = %S" function)
+  (helm-log "args = %S" args)
+  (helm-exit-and-execute-action
+   (lambda (_candidate)
+     (apply function args))))
+
+(defun helm-exit-and-execute-action (action)
+  "Exit current helm session and execute ACTION.
+Argument ACTION is a function called with one arg (candidate)
+and part of the actions of current source.
+
+Use this on commands invoked from keybindings, but not
+on action functions invoked as action from the action menu,
+i.e functions called with RET."
+  (setq helm-saved-action action)
+  (setq helm-saved-selection (helm-get-selection))
+  (helm-exit-minibuffer))
+
+(defalias 'helm-run-after-quit 'helm-run-after-exit)
+(make-obsolete 'helm-run-after-quit 'helm-run-after-exit "1.7.7")
+(defalias 'helm-quit-and-execute-action 'helm-exit-and-execute-action)
+(make-obsolete 'helm-quit-and-execute-action 'helm-exit-and-execute-action "1.7.7")
+
+(defun helm-interpret-value (value &optional source compute)
+  "Interpret VALUE as variable, function or literal and return it.
+If VALUE is a function, call it with no arguments and return the value
+unless COMPUTE value is 'ignorefn.
+If SOURCE compute VALUE for this source.
+If VALUE is a variable, return the value.
+If VALUE is a symbol, but it is not a function or a variable, cause an error.
+Otherwise, return VALUE itself."
+  (cond ((and source (functionp value) (not (eq compute 'ignorefn)))
+         (helm-funcall-with-source source value))
+        ((and (functionp value) (not (eq compute 'ignorefn)))
+         (funcall value))
+        ((and (symbolp value) (boundp value))
+         (symbol-value value))
+        ((and (symbolp value) (not (functionp value)))
+         (error
+          "helm-interpret-value: Symbol must be a function or a variable"))
+        (t
+         value)))
+
+(defun helm-set-local-variable (&rest args)
+  "Bind each pair in ARGS locally to `helm-buffer'.
+
+Use this to set local vars before calling helm.
+
+When used from an init or update function
+(i.e when `helm-force-update' is running) the variables are set
+using `make-local-variable' within the `helm-buffer'.
+
+Usage: helm-set-local-variable ([VAR VALUE]...)
+Just like `setq' except that the vars are not set sequentially.
+IOW Don't use VALUE of previous VAR to set the VALUE of next VAR.
+
+\(fn VAR VALUE ...)"
+  (if helm-force-updating-p
+      (with-helm-buffer
+        (cl-loop for i on args by #'cddr
+                 do (set (make-local-variable (car i)) (cadr i))))
+      (setq helm--local-variables
+            (append (cl-loop for i on args by #'cddr
+                             collect (cons (car i) (cadr i)))
+                    helm--local-variables))))
+
+\f
+;; Core: API helper
+(cl-defun helm-empty-buffer-p (&optional (buffer helm-buffer))
+  "Check if BUFFER have candidates.
+Default value for BUFFER is `helm-buffer'."
+  (zerop (buffer-size (and buffer (get-buffer buffer)))))
+
+(defun helm-empty-source-p ()
+  "Check if current source contains candidates.
+This happen only in certains cases when e.g the last element
+of a source is deleted without updating the source."
+  (with-helm-window
+    (or (helm-empty-buffer-p)
+        (and (helm-end-of-source-p)
+             (eq (point-at-bol) (point-at-eol))
+             (or
+              (save-excursion
+                (forward-line -1)
+                (helm-pos-header-line-p))
+              (bobp))))))
+
+\f
+;; Core: tools
+
+(defun helm-funcall-with-source (source functions &rest args)
+  "Call from SOURCE FUNCTIONS list or single function FUNCTIONS with ARGS.
+FUNCTIONS can be a symbol or a list of functions.
+Return the result of last function call."
+  (let ((helm-source-name (assoc-default 'name source))
+        (helm-current-source source)
+        (funs (if (functionp functions) (list functions) functions)))
+    (helm-log "helm-source-name = %S" helm-source-name)
+    (helm-log "functions = %S" functions)
+    (helm-log "args = %S" args)
+    (cl-loop with result for fn in funs
+             do (setq result (apply fn args))
+             finally return result)))
+
+(defun helm-funcall-foreach (sym &optional sources)
+  "Call the associated function to SYM for each source if any."
+  (let ((sources (or sources (helm-get-sources))))
+    (cl-dolist (source sources)
+      (helm-aif (assoc-default sym source)
+          (helm-funcall-with-source source it)))))
+
+(defun helm-normalize-sources (sources)
+  "If SOURCES is only one source, make a list of one element."
+  (cond ((or (and sources
+                  (symbolp sources))
+             (and (listp sources) (assq 'name sources)))
+         (list sources))
+        (sources)
+        (t helm-sources)))
+
+(defun helm-get-candidate-number (&optional in-current-source)
+  "Return candidates number in `helm-buffer'.
+If IN-CURRENT-SOURCE is provided return number of candidates
+in the source where point is."
+  (with-helm-buffer
+    (if (or (helm-empty-buffer-p)
+            (helm-empty-source-p))
+        0
+        (save-excursion
+          (if in-current-source
+              (goto-char (helm-get-previous-header-pos))
+              (goto-char (point-min)))
+          (forward-line 1)
+          (if (helm-pos-multiline-p)
+              (cl-loop with count-multi = 1
+                       while (and (not (if in-current-source
+                                           (save-excursion
+                                             (forward-line 2)
+                                             (or (helm-pos-header-line-p) (eobp)))
+                                           (eobp)))
+                                  (search-forward helm-candidate-separator nil t))
+                       do (cl-incf count-multi)
+                       finally return count-multi)
+              (cl-loop with ln = 0
+                       while (not (if in-current-source
+                                      (or (helm-pos-header-line-p) (eobp))
+                                      (eobp)))
+                       ;; Don't count empty lines maybe added by popup (#1370).
+                       unless (or (eq (point-at-bol) (point-at-eol))
+                                  (helm-pos-header-line-p))
+                       do (cl-incf ln)
+                       do (forward-line 1) finally return ln))))))
+
+(defmacro with-helm-quittable (&rest body)
+  "If an error occur in execution of BODY, quit helm safely."
+  (declare (indent 0) (debug t))
+  `(condition-case _v
+       (let (inhibit-quit)
+         ,@body)
+     (quit (setq quit-flag t)
+           (setq helm-quit t)
+           (exit-minibuffer)
+           (keyboard-quit)
+           ;; See comment about this in `with-local-quit'.
+           (eval '(ignore nil)))))
+
+(defun helm-compose (arg-lst func-lst)
+  "Apply arguments specified in ARG-LST with each function of FUNC-LST.
+The result of each function will be the new `car' of ARG-LST.
+Each function in FUNC-LST must accept (length ARG-LST) arguments
+\(See examples below) .
+This function allows easy sequencing of transformer functions.
+Where generally, ARG-LST is '(candidates-list source) and FUNC-LST a
+list of transformer functions that take one or two arguments depending
+we are using 'filtered-candidate-transformer' or 'candidate-transformer'.
+e.g
+filtered-candidate-transformer:
+\(helm-compose '((1 2 3 4 5 6 7)
+                '((name . \"A helm source\") (candidates . (a b c))))
+              '((lambda (candidates _source)
+                  (cl-loop for i in candidates
+                        when (cl-oddp i) collect i))
+                (lambda (candidates _source)
+                  (cl-loop for i in candidates collect (1+ i)))))
+=>(2 4 6 8)
+
+candidate-transformer:
+\(helm-compose '((1 2 3 4 5 6 7))
+                '((lambda (candidates)
+                  (cl-loop for i in candidates
+                        when (cl-oddp i) collect i))
+                (lambda (candidates)
+                  (cl-loop for i in candidates collect (1+ i)))))
+=> (2 4 6 8)."
+  (cl-dolist (func func-lst)
+    (setcar arg-lst (apply func arg-lst)))
+  (car arg-lst))
+
+(defun helm-composed-funcall-with-source (source funcs &rest args)
+  "With SOURCE apply `helm-funcall-with-source' with each FUNCS and ARGS.
+This is used in transformers to modify candidates list."
+  (if (functionp funcs)
+      (apply 'helm-funcall-with-source source funcs args)
+      (apply 'helm-funcall-with-source source
+             (lambda (&rest oargs) (helm-compose oargs funcs))
+             args)))
+
+\f
+;; Core: entry point
+;; `:allow-nest' is not in this list because it is treated before.
+(defconst helm-argument-keys
+  '(:sources :input :prompt :resume
+    :preselect :buffer :keymap :default :history))
+
+;;;###autoload
+(defun helm (&rest plist)
+  "Main function to execute helm sources.
+
+Keywords supported:
+:sources :input :prompt :resume :preselect
+:buffer :keymap :default :history :allow-nest
+
+Extra LOCAL-VARS keywords are supported, see below.
+
+PLIST is a list like \(:key1 val1 :key2 val2 ...\) or
+\(&optional sources input prompt resume
+            preselect buffer keymap default history\).
+
+Basic keywords are the following:
+
+\:sources
+
+A list of sources used for this session.  It also accepts a
+symbol, interpreted as a variable of a helm source
+i.e (a symbol can be passed instead of a list of sources).
+It also accepts an alist representing a helm source, which is
+detected by \(assq 'name ANY-SOURCES\).
+NOTE: In this case the source is embedded in the helm command and
+have no symbol name, so it is not reachable from outside.
+It will be referenced in `helm-sources' as a whole alist.
+
+\:input
+
+Temporary value of `helm-pattern', ie. initial input of minibuffer.
+
+\:prompt
+
+Prompt other than \"pattern: \".
+
+\:resume
+
+If t, Resurrect previously instance of `helm'.  Skip the initialization.
+If 'noresume, this instance of `helm' cannot be resumed.
+
+\:preselect
+
+Initially selected candidate.  Specified by exact candidate or a regexp.
+
+\:buffer
+
+`helm-buffer' instead of *helm*.
+
+\:keymap
+
+`helm-map' for current `helm' session.
+
+\:default
+
+A default argument that will be inserted in minibuffer \
+with \\<minibuffer-local-map>\\[next-history-element].
+When nil or not present `thing-at-point' will be used instead.
+If `helm--maybe-use-default-as-input' is non--nil display will be
+updated using :default arg as input unless :input is specified,
+which in this case will take precedence on :default
+This is a string or a list, in this case the car of the list will
+be used as initial default input, but you will be able to cycle in this
+list with \\<minibuffer-local-map>\\[next-history-element].
+
+\:history
+
+By default all minibuffer input is pushed to `minibuffer-history',
+if an argument HISTORY is provided, input will be pushed to HISTORY.
+History element should be a symbol.
+
+\:allow-nest
+
+Allow running this helm command within a running helm session.
+
+Of course, conventional arguments are supported, the two are same.
+
+\(helm :sources sources :input input :prompt prompt :resume resume
+       :preselect preselect :buffer buffer :keymap keymap :default default
+       :history history\)
+
+and
+
+\(helm sources input prompt resume preselect buffer keymap default history\)
+
+are the same.
+
+However the use of non keyword args is deprecated and should not be used.
+
+Other keywords are interpreted as local variables of this helm session.
+The `helm-' prefix can be omitted.  For example,
+
+\(helm :sources 'helm-source-buffers-list
+       :buffer \"*buffers*\" :candidate-number-limit 10\)
+
+means starting helm session with `helm-source-buffers'
+source in *buffers* buffer and set variable `helm-candidate-number-limit'
+to 10 as session local variable.
+
+\(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)"
+  (let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest))
+                       (and helm-alive-p (memq 'allow-nest plist)))
+                   #'helm-nest)
+                  ((keywordp (car plist))
+                   #'helm)
+                  (t #'helm-internal))))
+    (if (and helm-alive-p (eq fn #'helm))
+        (if (helm-alive-p)
+            ;; A helm session is normally running.
+            (error "Error: Trying to run helm within a running helm session")
+          ;; A helm session is already running and user jump somewhere else
+          ;; without desactivating it.
+          (with-helm-buffer
+            (prog1
+                (message "Aborting an helm session running in background")
+              ;; `helm-alive-p' will be reset in unwind-protect forms.
+              (helm-keyboard-quit))))
+      (if (keywordp (car plist))
+          ;; Parse `plist' and move not regular `helm-argument-keys'
+          ;; to `helm--local-variables', then calling helm on itself
+          ;; with normal arguments (the non--arguments-keys removed)
+          ;; will end up in [1].
+          (progn
+            (setq helm--local-variables
+                  (append helm--local-variables
+                          ;; Vars passed by keyword on helm call
+                          ;; take precedence on same vars
+                          ;; that may have been passed before helm call.
+                          (helm-parse-keys plist)))
+            (apply fn (mapcar (lambda (key) (plist-get plist key))
+                              helm-argument-keys)))
+        (apply fn plist))))) ; [1] fn == helm-internal.
+
+(defun helm-alive-p ()
+  "Check if `helm' is alive.
+An `helm' session is considered alive if `helm-alive-p' is non--nil,
+the `helm-buffer' is visible, and cursor is in minibuffer."
+  (and helm-alive-p
+       (get-buffer-window helm-buffer 'visible)
+       (minibuffer-window-active-p (minibuffer-window))
+       (minibufferp (current-buffer))))
+
+(defun helm-parse-keys (keys)
+  "Parse the KEYS arguments of `helm'.
+Return only the keys that are not in `helm-argument-keys',
+prefix them with \"helm\" and convert them to alist.
+This allow to add arguments that are not part of `helm-argument-keys',
+but are valid helm variables.
+e.g :candidate-number-limit will be bound to `helm-candidate-number-limit'
+in source.
+
+  (helm-parse-keys '(:sources ((name . \"test\")
+                               (candidates . (a b c)))
+                     :buffer \"toto\"
+                     :candidate-number-limit 4))
+  ==> ((helm-candidate-number-limit . 4))."
+
+  (cl-loop for (key value) on keys by #'cddr
+           for symname = (substring (symbol-name key) 1)
+           for sym = (intern (if (string-match "^helm-" symname)
+                                 symname
+                                 (concat "helm-" symname)))
+           unless (memq key helm-argument-keys)
+           collect (cons sym value)))
+
+;;; Core: entry point helper
+(defun helm-internal (&optional
+                        any-sources any-input
+                        any-prompt any-resume
+                        any-preselect any-buffer
+                        any-keymap any-default any-history)
+  "The internal helm function called by `helm'.
+For ANY-SOURCES ANY-INPUT ANY-PROMPT ANY-RESUME ANY-PRESELECT ANY-BUFFER and
+ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
+  ;; Activate the advice for `tramp-read-passwd'.
+  (if (fboundp 'advice-add)
+      (progn
+        (advice-add 'tramp-read-passwd :around #'helm--advice-tramp-read-passwd)
+        (advice-add 'ange-ftp-get-passwd :around #'helm--advice-ange-ftp-get-passwd))
+      (ad-activate 'tramp-read-passwd)
+      (ad-activate 'ange-ftp-get-passwd))
+  (helm-log (concat "[Start session] " (make-string 41 ?+)))
+  (helm-log "any-prompt = %S" any-prompt)
+  (helm-log "any-preselect = %S" any-preselect)
+  (helm-log "any-buffer = %S" any-buffer)
+  (helm-log "any-keymap = %S" any-keymap)
+  (helm-log "any-default = %S" any-default)
+  (helm-log "any-history = %S" any-history)
+  (setq helm--prompt (or any-prompt "pattern: "))
+  (let ((non-essential t)
+        (input-method-verbose-flag helm-input-method-verbose-flag)
+        (old--cua cua-mode)
+        (helm--maybe-use-default-as-input
+         (and (null any-input)
+              (or helm--maybe-use-default-as-input ; it is let-bounded so use it.
+                  (cl-loop for s in (helm-normalize-sources any-sources)
+                           thereis (memq s helm-sources-using-default-as-input))))))
+    ;; cua-mode overhide local helm bindings.
+    ;; disable this stupid thing if enabled.
+    (and cua-mode (cua-mode -1))
+    (unwind-protect
+         (condition-case-unless-debug _v
+             (let ( ;; `helm-source-name' is non-nil
+                   ;; when `helm' is invoked by action, reset it.
+                   helm-source-name
+                   helm-current-source
+                   helm-in-persistent-action
+                   helm-quit
+                   (helm-buffer (or any-buffer helm-buffer)))
+               (with-helm-restore-variables
+                 (helm-initialize
+                  any-resume any-input any-default any-sources)
+                 (helm-display-buffer helm-buffer)
+                 ;; We are now in helm-buffer.
+                 (when helm-prevent-escaping-from-minibuffer
+                   (helm--remap-mouse-mode 1)) ; Disable mouse bindings.
+                 (add-hook 'post-command-hook 'helm--maybe-update-keymap)
+                 (add-hook 'post-command-hook 'helm--update-header-line)
+                 (helm-log "show prompt")
+                 (unwind-protect
+                      (helm-read-pattern-maybe
+                       any-prompt any-input any-preselect
+                       any-resume any-keymap any-default any-history)
+                   (helm-cleanup)))
+               (prog1
+                   (unless helm-quit (helm-execute-selection-action))
+                 (helm-log (concat "[End session] " (make-string 41 ?-)))))
+           (quit
+            (helm-restore-position-on-quit)
+            (helm-log (concat "[End session (quit)] " (make-string 34 ?-)))
+            nil))
+      (if (fboundp 'advice-add)
+          (progn
+            (advice-remove 'tramp-read-passwd
+                           #'helm--advice-tramp-read-passwd)
+            (advice-remove 'ange-ftp-get-passwd
+                           #'helm--advice-ange-ftp-get-passwd))
+          (ad-deactivate 'tramp-read-passwd)
+          (ad-deactivate 'ange-ftp-get-passwd))
+      (helm-log "helm-alive-p = %S" (setq helm-alive-p nil))
+      (helm--remap-mouse-mode -1)       ; Reenable mouse bindings.
+      (setq helm-alive-p nil)
+      ;; Reset helm-pattern so that lambda's using it
+      ;; before running helm will not start with its old value.
+      (setq helm-pattern "")
+      (and old--cua (cua-mode 1))
+      (helm-log-save-maybe))))
+
+\f
+;;; Helm resume
+;;
+;;
+(defun helm-resume (arg)
+  "Resurrect previously invoked `helm'.
+Called with a prefix arg, allow choosing among all existing
+helm buffers.  i.e choose among various helm sessions.
+Called from lisp, you can specify a buffer-name as a string with ARG."
+  (interactive "P")
+  (let (any-buffer helm-full-frame cur-dir)
+    (if arg
+        (if (and (stringp arg) (bufferp (get-buffer arg)))
+            (setq any-buffer arg)
+          (setq any-buffer (helm-resume-select-buffer)))
+      (setq any-buffer helm-last-buffer))
+    (cl-assert any-buffer nil
+               "helm-resume: No helm buffers found to resume")
+    ;; Reset `cursor-type' to nil as it have been set to t
+    ;; when quitting previous session.
+    (with-current-buffer any-buffer (setq cursor-type nil))
+    (setq helm-full-frame (buffer-local-value
+                           'helm-full-frame (get-buffer any-buffer)))
+    (setq helm-compiled-sources nil)
+    (setq cur-dir (buffer-local-value
+                   'default-directory (get-buffer any-buffer)))
+    (setq helm-saved-selection nil
+          helm-saved-action nil)
+    (unless (buffer-live-p helm-current-buffer)
+      ;; `helm-current-buffer' may have been killed.
+      (setq helm-current-buffer (current-buffer)))
+    ;; Restart with same `default-directory' value this session
+    ;; was initially started with.
+    (with-helm-default-directory cur-dir
+        (helm
+         :sources (buffer-local-value
+                   'helm-sources (get-buffer any-buffer))
+         :input (buffer-local-value 'helm-input-local (get-buffer any-buffer))
+         :prompt (buffer-local-value 'helm--prompt (get-buffer any-buffer))
+         :resume t
+         :buffer any-buffer))))
+
+(defun helm-resume-previous-session-after-quit (arg)
+  "Resume previous helm session within running helm."
+  (interactive "p")
+  (with-helm-alive-p
+    (if (> (length helm-buffers) arg)
+        (helm-run-after-exit `(lambda () (helm-resume (nth ,arg helm-buffers))))
+        (message "No previous helm sessions to resume yet!"))))
+(put 'helm-resume-previous-session-after-quit 'helm-only t)
+
+(defun helm-resume-list-buffers-after-quit ()
+  "List resumable helm buffers within running helm."
+  (interactive)
+  (with-helm-alive-p
+    (if (> (length helm-buffers) 0)
+        (helm-run-after-exit (lambda () (helm-resume t)))
+        (message "No previous helm sessions to resume yet!"))))
+(put 'helm-resume-list-buffers-after-quit 'helm-only t)
+
+(defun helm-resume-p (any-resume)
+  "Whether current helm session is resumed or not."
+  (eq any-resume t))
+
+(defun helm-resume-select-buffer ()
+  "Select an `helm-buffer' in `helm-buffers' list to resume a helm session.
+Return nil if no `helm-buffer' found."
+  (when helm-buffers
+    (or (helm :sources '(((name . "Resume helm buffer")
+                          (candidates . helm-buffers)
+                          (action . identity)))
+              :resume 'noresume
+              :buffer "*helm resume*")
+        (keyboard-quit))))
+
+\f
+;;;###autoload
+(defun helm-other-buffer (any-sources any-buffer)
+  "Simplified interface of `helm' with other `helm-buffer'.
+Call `helm' with only ANY-SOURCES and ANY-BUFFER as args."
+  (helm :sources any-sources :buffer any-buffer))
+
+(defun helm-nest (&rest same-as-helm)
+  "Allow calling `helm' whithin a running helm session.
+Arguments SAME-AS-HELM are the same as `helm', which see."
+  (with-helm-window
+    (let ((orig-helm-current-buffer helm-current-buffer)
+          (orig-helm-buffer helm-buffer)
+          (orig-helm--prompt helm--prompt)
+          (orig-helm--in-fuzzy helm--in-fuzzy)
+          (orig-helm-last-frame-or-window-configuration
+           helm-last-frame-or-window-configuration)
+          (orig-one-window-p helm-onewindow-p))
+      (unwind-protect
+           (let (helm-current-position
+                 helm-current-buffer
+                 helm-pattern
+                 (helm-buffer (or (cl-getf same-as-helm :buffer)
+                                  (nth 5 same-as-helm)
+                                  "*Helm*"))
+                 helm-sources
+                 helm-compiled-sources
+                 (helm-full-frame t)
+                 (enable-recursive-minibuffers t))
+             (apply #'helm same-as-helm))
+        (with-current-buffer orig-helm-buffer
+          (setq helm-alive-p t) ; Nested session set this to nil on exit.
+          (setq helm-buffer orig-helm-buffer)
+          (setq helm--prompt orig-helm--prompt)
+          (setq helm--in-fuzzy orig-helm--in-fuzzy)
+          (helm-initialize-overlays helm-buffer)
+          (unless (helm-empty-buffer-p) (helm-mark-current-line t))
+          (setq helm-last-frame-or-window-configuration
+                orig-helm-last-frame-or-window-configuration)
+          (setq cursor-type nil)
+          (setq helm-current-buffer orig-helm-current-buffer)
+          (setq helm-onewindow-p orig-one-window-p)
+          ;; Be sure advices, hooks, and local modes keep running.
+          (if (fboundp 'advice-add)
+              (progn
+                (advice-add 'tramp-read-passwd
+                            :around #'helm--advice-tramp-read-passwd)
+                (advice-add 'ange-ftp-get-passwd
+                            :around #'helm--advice-ange-ftp-get-passwd))
+              (ad-activate 'tramp-read-passwd)
+              (ad-activate 'ange-ftp-get-passwd))
+          (when helm-prevent-escaping-from-minibuffer
+            (helm--remap-mouse-mode 1))
+          (unless (cl-loop for h in post-command-hook
+                           thereis (memq h '(helm--maybe-update-keymap
+                                             helm--update-header-line)))
+            (add-hook 'post-command-hook 'helm--maybe-update-keymap)
+            (add-hook 'post-command-hook 'helm--update-header-line))
+          (helm-display-mode-line (helm-get-current-source)))))))
+
+\f
+;;; Core: Accessors
+;;
+(defun helm-current-position (save-or-restore)
+  "Restore or save current position in `helm-current-buffer'.
+Argument SAVE-OR-RESTORE is one of save or restore."
+  (cl-case save-or-restore
+    (save
+     (helm-log "Save position at %S" (cons (point) (window-start)))
+     (setq helm-current-position (cons (point) (window-start))))
+    (restore
+     ;; Maybe `helm-current-buffer' have been deleted
+     ;; during helm session so check if it is here
+     ;; otherwise position in underlaying buffer will be lost.
+     (when (get-buffer-window helm-current-buffer 'visible)
+       (helm-log "Restore position at  %S in buffer %s"
+                 helm-current-position
+                 (buffer-name (current-buffer)))
+       (goto-char (car helm-current-position))
+       ;; Fix this position with the NOFORCE arg of `set-window-start'
+       ;; otherwise, if there is some other buffer than `helm-current-buffer'
+       ;; one, position will be lost.
+       (set-window-start (selected-window) (cdr helm-current-position) t)))))
+
+
+(defun helm-frame-or-window-configuration (save-or-restore)
+  "Save or restore last frame or window configuration.
+Possible value of SAVE-OR-RESTORE are 'save and 'restore.
+window or frame configuration is saved/restored according to values of
+`helm-save-configuration-functions'."
+  (helm-log "helm-save-configuration-functions = %S"
+            helm-save-configuration-functions)
+  (let ((window-persistent-parameters (append '((no-other-window . t))
+                                              window-persistent-parameters)))
+    (cl-case save-or-restore
+      (save    (setq helm-last-frame-or-window-configuration
+                     (funcall (cdr helm-save-configuration-functions))))
+      (restore (funcall (car helm-save-configuration-functions)
+                        helm-last-frame-or-window-configuration)
+               ;; Restore frame focus.
+               ;; This is needed for minibuffer own-frame config
+               ;; when recursive minibuffers are in use.
+               ;; e.g M-: + helm-minibuffer-history.
+               (let ((frame (if (minibufferp helm-current-buffer)
+                                (selected-frame)
+                              (last-nonminibuffer-frame))))
+                 (select-frame-set-input-focus frame))))))
+
+(defun helm-split-window-default-fn (window)
+  (let (split-width-threshold)
+    (if (and (fboundp 'window-in-direction)
+             ;; Don't try to split when starting in a minibuffer
+             ;; e.g M-: and try to use helm-show-kill-ring.
+             (not (minibufferp helm-current-buffer)))
+        (if (or (one-window-p t)
+                helm-split-window-in-side-p)
+            (split-window
+             (selected-window) nil (if (eq helm-split-window-default-side 'other)
+                                       'below helm-split-window-default-side))
+          ;; If more than one window reuse one of them.
+          (cl-case helm-split-window-default-side
+            (left  (or (helm-window-in-direction 'left)
+                       (helm-window-in-direction 'above)
+                       (selected-window)))
+            (above (or (helm-window-in-direction 'above)
+                       (helm-window-in-direction 'left)
+                       (selected-window)))
+            (right (or (helm-window-in-direction 'right)
+                       (helm-window-in-direction 'below)
+                       (selected-window)))
+            (below (or (helm-window-in-direction 'below)
+                       (helm-window-in-direction 'right)
+                       (selected-window)))
+            (same  (selected-window))
+            (other (other-window-for-scrolling))
+            (t     (or (window-next-sibling) (selected-window)))))
+      (split-window-sensibly window))))
+
+(defun helm-window-in-direction (direction)
+  "Same as `window-in-direction' but check if window is dedicated."
+  (helm-aif (window-in-direction direction)
+      (and (not (window-dedicated-p it)) it)))
+
+\f
+;;; Display helm buffer
+;;
+;;
+(defun helm-display-buffer (buffer)
+  "Display BUFFER.
+The function used to display `helm-buffer'."
+  (let (pop-up-frames
+        (split-window-preferred-function
+         helm-split-window-preferred-function)
+        (helm-split-window-default-side
+         (if (and (not helm-full-frame)
+                  helm-reuse-last-window-split-state)
+             (cond ((eq helm-split-window-default-side 'same) 'same)
+                   ((eq helm-split-window-default-side 'other) 'other)
+                   (helm--window-side-state)
+                   (t helm-split-window-default-side))
+           helm-split-window-default-side)))
+    (prog1
+        (funcall (with-current-buffer buffer helm-display-function) buffer)
+      (setq helm-onewindow-p (one-window-p t))
+      ;; Don't allow other-window and friends switching out of minibuffer.
+      (when helm-prevent-escaping-from-minibuffer
+        (helm-prevent-switching-other-window)))))
+
+(cl-defun helm-prevent-switching-other-window (&key (enabled t))
+  "Allow setting `no-other-window' window parameter in all windows.
+Arg ENABLE will be the value of the `no-other-window' window property."
+  (walk-windows
+   (lambda (w)
+       (unless (window-dedicated-p w)
+         (set-window-parameter w 'no-other-window enabled)))
+   0))
+
+(defun helm-default-display-buffer (buffer)
+  "Default function to display `helm-buffer' BUFFER.
+It uses `switch-to-buffer' or `display-buffer' depending of value
+of `helm-full-frame' and/or `helm-split-window-default-side'."
+  (if (or (buffer-local-value 'helm-full-frame (get-buffer buffer))
+          (and (eq helm-split-window-default-side 'same)
+               (one-window-p t)))
+      (progn (delete-other-windows) (switch-to-buffer buffer))
+    (when (and (or helm-always-two-windows helm-autoresize-mode
+                   (and (not helm-split-window-in-side-p)
+                        (eq (save-selected-window
+                              (funcall helm-split-window-preferred-function
+                                       (selected-window)))
+                            (get-buffer-window helm-current-buffer))))
+               (not (eq helm-split-window-default-side 'same))
+               (not (minibufferp helm-current-buffer))
+               (not helm-split-window-in-side-p))
+      (delete-other-windows))
+    (display-buffer
+     buffer `(nil . ((window-height . ,helm-display-buffer-default-size))))))
+
+\f
+;;; Core: initialize
+;;
+(defun helm-initialize (any-resume any-input any-default any-sources)
+  "Start initialization of `helm' session.
+For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'."
+  (helm-log "start initialization: any-resume=%S any-input=%S"
+            any-resume any-input)
+  (helm-frame-or-window-configuration 'save)
+  (setq helm-sources (helm-normalize-sources any-sources))
+  (setq helm--in-fuzzy
+        (cl-loop for s in helm-sources
+                 for matchfns = (helm-match-functions
+                                 (if (symbolp s) (symbol-value s) s))
+                 for searchfns = (helm-search-functions
+                                  (if (symbolp s) (symbol-value s) s))
+                 when (or (member 'helm-fuzzy-match matchfns)
+                          (member 'helm-fuzzy-search searchfns))
+                 return t))
+  (helm-log "sources = %S" helm-sources)
+  (helm-current-position 'save)
+  (if (helm-resume-p any-resume)
+      (helm-initialize-overlays (helm-buffer-get))
+    (helm-initial-setup any-default))
+  (setq helm-alive-p t)
+  (unless (eq any-resume 'noresume)
+    (helm-recent-push helm-buffer 'helm-buffers)
+    (setq helm-last-buffer helm-buffer))
+  (when any-input
+    (setq helm-input any-input
+          helm-pattern any-input)
+    (helm--fuzzy-match-maybe-set-pattern))
+  ;; If a `resume' attribute is present `helm-funcall-foreach'
+  ;; will run its function.
+  (when (helm-resume-p any-resume)
+    (helm-funcall-foreach 'resume))
+  (helm-log "end initialization"))
+
+(defun helm-initialize-overlays (buffer)
+  "Initialize helm overlays in BUFFER."
+  (helm-log "overlay setup")
+  (if helm-selection-overlay
+      ;; make sure the overlay belongs to the helm buffer if
+      ;; it's newly created
+      (move-overlay helm-selection-overlay (point-min) (point-min)
+                    (get-buffer buffer))
+
+    (setq helm-selection-overlay
+          (make-overlay (point-min) (point-min) (get-buffer buffer)))
+    (overlay-put helm-selection-overlay 'face 'helm-selection)
+    (overlay-put helm-selection-overlay 'priority 1)))
+
+(defun helm-restore-position-on-quit ()
+  "Restore position in `helm-current-buffer' when quitting."
+  (helm-current-position 'restore))
+
+(defun helm-recent-push (elt list-var)
+  "Add ELT to the value of LIST-VAR as most recently used value."
+  (let ((m (member elt (symbol-value list-var))))
+    (and m (set list-var (delq (car m) (symbol-value list-var))))
+    (push elt (symbol-value list-var))))
+
+(defun helm--current-buffer ()
+  "[internal] Return `current-buffer' BEFORE `helm-buffer' is initialized.
+Note that this will return the minibuffer in use after helm have started,
+so to get the buffer where helm started while in a helm session,
+use `helm-current-buffer'.
+It is intended to use this only in `helm-initial-setup'."
+  (if (minibuffer-window-active-p (minibuffer-window))
+      ;; If minibuffer is active be sure to use it's buffer
+      ;; as `helm-current-buffer', this allow to use helm
+      ;; from an already active minibuffer (M-: etc...)
+      (window-buffer (active-minibuffer-window))
+    ;; Fix Issue #456
+    ;; Use this instead of `current-buffer' to ensure
+    ;; helm session started in helm-mode from a completing-read
+    ;; Use really the buffer where we started and not the one
+    ;; where the completing-read is wrapped. i.e
+    ;; (with-current-buffer SOME-OTHER-BUFFER (completing-read [...])
+    (window-buffer (with-selected-window (minibuffer-window)
+                     (minibuffer-selected-window)))))
+
+(defun helm--run-init-hooks (hook)
+  "Run after and before init hooks local to source.
+See :after-init-hook and :before-init-hook in `helm-source'."
+  (cl-loop with sname = (cl-ecase hook
+                          (before-init-hook "h-before-init-hook")
+                          (after-init-hook "h-after-init-hook"))
+           with h = (cl-gensym sname)
+           for s in (helm-get-sources)
+           for hv = (assoc-default hook s)
+           if (and hv (not (symbolp hv)))
+           do (set h hv)
+           and do (helm-log-run-hook h)
+           else do (helm-log-run-hook hv)))
+
+(defun helm-initial-setup (any-default)
+  "Initialize helm settings and set up the helm buffer."
+  ;; Run global hook.
+  (helm-log-run-hook 'helm-before-initialize-hook)
+  ;; Run local source hook.
+  (helm--run-init-hooks 'before-init-hook)
+  ;; For initialization of helm locals vars that need
+  ;; a value from current buffer, it is here.
+  (helm-set-local-variable 'current-input-method current-input-method)
+  (setq helm-current-prefix-arg nil
+        helm-saved-action nil
+        helm-saved-selection nil
+        helm-suspend-update-flag nil
+        helm-current-buffer (helm--current-buffer)
+        helm-buffer-file-name buffer-file-name
+        helm-issued-errors nil
+        helm-compiled-sources nil
+        helm-saved-current-source nil)
+  (unless (and (or helm-split-window-state
+                   helm--window-side-state)
+               helm-reuse-last-window-split-state)
+    (setq helm-split-window-state
+          (if (or (null split-width-threshold)
+                  (and (integerp split-width-threshold)
+                       (>= split-width-threshold (+ (frame-width) 4))))
+              'vertical 'horizontal))
+    (setq helm--window-side-state
+          (or helm-split-window-default-side 'below)))
+  ;; Call the init function for sources where appropriate
+  (helm-funcall-foreach
+   'init (and helm-source-filter
+              (cl-remove-if-not (lambda (s)
+                                    (member (assoc-default 'name s)
+                                            helm-source-filter))
+                                (helm-get-sources))))
+  (setq helm-pattern (or (and helm--maybe-use-default-as-input
+                              (or (if (listp any-default)
+                                      (car any-default) any-default)
+                                  (with-helm-current-buffer
+                                    (thing-at-point 'symbol))))
+                         ""))
+  (setq helm-input "")
+  (clrhash helm-candidate-cache)
+  (helm-create-helm-buffer)
+  (helm-clear-visible-mark)
+  ;; Run global hook.
+  (helm-log-run-hook 'helm-after-initialize-hook)
+  ;; Run local source hook.
+  (helm--run-init-hooks 'after-init-hook))
+
+(defun helm-create-helm-buffer ()
+  "Create and setup `helm-buffer'."
+  (let ((root-dir default-directory))
+    (with-current-buffer (get-buffer-create helm-buffer)
+      (helm-log "kill local variables: %S" (buffer-local-variables))
+      (kill-all-local-variables)
+      (set (make-local-variable 'inhibit-read-only) t)
+      (buffer-disable-undo)
+      (erase-buffer)
+      (set (make-local-variable 'helm-map) helm-map)
+      (make-local-variable 'helm-sources)
+      (set (make-local-variable 'helm-follow-mode) nil)
+      (set (make-local-variable 'helm-display-function) helm-display-function)
+      (set (make-local-variable 'helm-selection-point) nil)
+      (set (make-local-variable 'scroll-margin)
+           (if helm-display-source-at-screen-top
+               0 helm-completion-window-scroll-margin))
+      (set (make-local-variable 'default-directory) root-dir)
+      (set (make-local-variable 'helm-marked-candidates) nil)
+      (set (make-local-variable 'helm--prompt) helm--prompt)
+      (helm-initialize-persistent-action)
+      (helm-log "helm-display-function = %S" helm-display-function)
+      (helm-log "helm--local-variables = %S" helm--local-variables)
+      (cl-loop for (var . val) in helm--local-variables
+               do (set (make-local-variable var) val)
+               finally (setq helm--local-variables nil))
+      (setq truncate-lines helm-truncate-lines) ; already local.
+      (setq cursor-type nil)
+      (setq mode-name "Helm"))
+    (helm-initialize-overlays helm-buffer)
+    (get-buffer helm-buffer)))
+
+(define-minor-mode helm--minor-mode
+    "[INTERNAL] Enable keymap in helm minibuffer.
+This mode have no effect when run outside of helm context.
+Please don't use it.
+
+\\{helm-map}"
+  :group 'helm
+  :keymap (and helm-alive-p helm-map)
+  (unless helm-alive-p (setq helm--minor-mode nil)))
+
+(defun helm--reset-default-pattern ()
+  (setq helm-pattern "")
+  (setq helm--maybe-use-default-as-input nil))
+
+(defun helm-read-pattern-maybe (any-prompt any-input
+                                any-preselect any-resume any-keymap
+                                any-default any-history)
+  "Read pattern with prompt ANY-PROMPT and initial input ANY-INPUT.
+For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
+  (if (and (helm-resume-p any-resume)
+           ;; When no source, helm-buffer is empty
+           ;; or contain non--candidate lines (e.g grep exit status)
+           (helm-get-current-source))
+      (helm-mark-current-line t)
+      (helm-update any-preselect))
+  (with-current-buffer (helm-buffer-get)
+    (let* ((src        (helm-get-current-source))
+           (src-keymap (assoc-default 'keymap src))
+           (hist       (or (and any-history (symbolp any-history) any-history)
+                           ;; Needed for resuming.
+                           (assoc-default 'history src)))
+           (timer nil)
+           blink-matching-paren
+           (resize-mini-windows (and (null helm-echo-input-in-header-line)
+                                     resize-mini-windows))
+           (first-src (car helm-sources))
+           (first-src-val (if (symbolp first-src)
+                              (symbol-value first-src)
+                              first-src))
+           (source-process-p (or (assq 'candidates-process src)
+                                 (assq 'candidates-process first-src-val)))
+           (source-delayed-p (or (assq 'delayed src)
+                                 (assq 'delayed first-src-val))))
+      (helm-log "helm-get-candidate-number => %S"
+                (helm-get-candidate-number))
+      (helm-log "helm-execute-action-at-once-if-one = %S"
+                helm-execute-action-at-once-if-one)
+      (helm-log "helm-quit-if-no-candidate = %S" helm-quit-if-no-candidate)
+      ;; If source is delayed `helm-execute-action-at-once-if-one'
+      ;; and `helm-quit-if-no-candidate' are handled after update finish.
+      (when source-delayed-p
+        ;; Note that we quickly add the hook now when `helm-update'
+        ;; is already started, but because source is delayed the hook
+        ;; should have the time to be passed !!!
+        ;; the hook will remove itself once done.
+        (with-helm-after-update-hook (helm-exit-or-quit-maybe)))
+      ;; Reset `helm-pattern' for non--delayed sources and update
+      ;; display if no result found with precedent value of `helm-pattern'
+      ;; unless `helm-quit-if-no-candidate' is non--nil, in this case
+      ;; Don't force update with an empty pattern.
+      ;; Reset also `helm--maybe-use-default-as-input' as this checking
+      ;; happen only on startup.
+      (when helm--maybe-use-default-as-input
+        ;; Store value of `default' temporarily here waiting next update
+        ;; to allow actions like helm-moccur-action matching pattern
+        ;; at the place it jump to.
+        (setq helm-input helm-pattern)
+        (if (or source-delayed-p source-process-p)
+            ;; Reset pattern to next update.
+            (with-helm-after-update-hook
+              (helm--reset-default-pattern))
+            ;; Reset pattern right now.
+            (helm--reset-default-pattern))
+        ;; Ensure force-update when no candidates
+        ;; when we start with an empty pattern.
+        (and (helm-empty-buffer-p)
+             (null helm-quit-if-no-candidate)
+             (helm-force-update)))
+      ;; Handle `helm-execute-action-at-once-if-one' and
+      ;; `helm-quit-if-no-candidate' now only for not--delayed sources.
+      (cond ((and (if (functionp helm-execute-action-at-once-if-one)
+                      (funcall helm-execute-action-at-once-if-one)
+                      helm-execute-action-at-once-if-one)
+                  (not source-delayed-p)
+                  (= (helm-get-candidate-number) 1))
+             (ignore))              ; Don't enter the minibuffer loop.
+            ((and helm-quit-if-no-candidate
+                  (not source-delayed-p)
+                  (= (helm-get-candidate-number) 0))
+             (setq helm-quit t)
+             (and (functionp helm-quit-if-no-candidate)
+                  (funcall helm-quit-if-no-candidate)))
+            (t              ; Enter now minibuffer and wait for input.
+             (let ((tap (or any-default
+                            (with-helm-current-buffer
+                              (thing-at-point 'symbol)))))
+               (unwind-protect
+                    (minibuffer-with-setup-hook
+                        (lambda ()
+                          ;; Start minor-mode with global value of helm-map.
+                          (helm--minor-mode 1)
+                          ;; Now overhide the global value of `helm-map' with
+                          ;; the local one which is in this order:
+                          ;; - The keymap of current source.
+                          ;; - The value passed in ANY-KEYMAP
+                          ;;   which will become buffer local.
+                          ;; - Or fallback to the global value of helm-map.
+                          (helm--maybe-update-keymap
+                           (or src-keymap any-keymap helm-map))
+                          (helm-log-run-hook 'helm-minibuffer-set-up-hook)
+                          (setq timer
+                                (run-with-idle-timer
+                                 (max helm-input-idle-delay 0.001) 'repeat
+                                 (lambda ()
+                                   ;; Stop updating in persistent action
+                                   ;; or when `helm-suspend-update-flag'
+                                   ;; is non--nil.
+                                   (unless (or helm-in-persistent-action
+                                               helm-suspend-update-flag)
+                                     (save-selected-window
+                                       (helm-check-minibuffer-input)
+                                       (helm-print-error-messages))))))
+                          (helm--update-header-line)) ; minibuffer has already been filled here
+                      (read-from-minibuffer (or any-prompt "pattern: ")
+                                            any-input helm-map
+                                            nil hist tap
+                                            helm-inherit-input-method))
+                 (when timer (cancel-timer timer) (setq timer nil)))))))))
+
+(defun helm-exit-or-quit-maybe ()
+  "Exit and run default action if only one candidate, quit if no candidates.
+This function is handling `helm-execute-action-at-once-if-one' and
+`helm-quit-if-no-candidate' in delayed sources."
+  (with-helm-window
+    (cond ((and (if (functionp helm-execute-action-at-once-if-one)
+                    (funcall helm-execute-action-at-once-if-one)
+                    helm-execute-action-at-once-if-one)
+                (= (helm-get-candidate-number) 1))
+           (helm-exit-minibuffer))
+          ((and helm-quit-if-no-candidate
+                (= (helm-get-candidate-number) 0))
+           (setq helm-quit t)
+           (and (functionp helm-quit-if-no-candidate)
+                (funcall helm-quit-if-no-candidate))
+           (keyboard-quit)))))
+
+(defun helm-toggle-suspend-update ()
+  "Enable or disable update of display in helm.
+This can be useful for e.g writing quietly a complex regexp."
+  (interactive)
+  (with-helm-alive-p
+    (when (setq helm-suspend-update-flag (not helm-suspend-update-flag))
+      (helm-kill-async-processes)
+      (setq helm-pattern ""))
+    (message (if helm-suspend-update-flag
+                 "Helm update suspended!"
+                 "Helm update reenabled!"))))
+(put 'helm-toggle-suspend-update 'helm-only t)
+
+(defadvice tramp-read-passwd (around disable-helm-update)
+  ;; Suspend update when prompting for a tramp password.
+  (setq helm-suspend-update-flag t)
+  (setq overriding-terminal-local-map nil)
+  (setq helm--reading-passwd-or-string t)
+  (let (stimers)
+    (unwind-protect
+         (progn
+           (setq stimers (with-timeout-suspend))
+           ad-do-it)
+      (with-timeout-unsuspend stimers)
+      (setq helm--reading-passwd-or-string nil)
+      (setq helm-suspend-update-flag nil))))
+
+(defun helm--advice-tramp-read-passwd (old--fn &rest args)
+  ;; Suspend update when prompting for a tramp password.
+  (setq helm-suspend-update-flag t)
+  (setq overriding-terminal-local-map nil)
+  (setq helm--reading-passwd-or-string t)
+  (unwind-protect
+       ;; No need to suspend timer in emacs-24.4
+       ;; it is fixed upstream.
+       (apply old--fn args)
+    (setq helm--reading-passwd-or-string nil)
+    (setq helm-suspend-update-flag nil)))
+
+(defun helm--advice-ange-ftp-get-passwd (old--fn &rest args)
+  ;; Suspend update when prompting for a ange password.
+  (setq helm-suspend-update-flag t)
+  (setq overriding-terminal-local-map nil)
+  (setq helm--reading-passwd-or-string t)
+  (unwind-protect
+       (apply old--fn args)
+    (setq helm--reading-passwd-or-string nil)
+    (setq helm-suspend-update-flag nil)))
+
+(defadvice ange-ftp-get-passwd (around disable-helm-update)
+  ;; Suspend update when prompting for a ange password.
+  (setq helm-suspend-update-flag t)
+  (setq overriding-terminal-local-map nil)
+  (setq helm--reading-passwd-or-string t)
+  (unwind-protect
+       ad-do-it
+    (setq helm--reading-passwd-or-string nil)
+    (setq helm-suspend-update-flag nil)))
+
+(defun helm--maybe-update-keymap (&optional map)
+  "Handle differents keymaps in multiples sources.
+
+It will override `helm-map' with the local map of current source.
+If no map is found in current source do nothing (keep previous map)."
+  (with-helm-buffer
+    (helm-aif (or map (assoc-default 'keymap (helm-get-current-source)))
+        ;; We used a timer in the past to leave
+        ;; enough time to helm to setup its keymap
+        ;; when changing source from a recursive minibuffer.
+        ;; e.g C-x C-f M-y C-g
+        ;; => *find-files have now the bindings of *kill-ring.
+        ;; It is no more true now we are using `minor-mode-overriding-map-alist'
+        ;; and `helm--minor-mode' thus it fix issue #1076 for emacs-24.3
+        ;; where concurrent timers are not supported.
+        ;; i.e update keymap+check input.
+        (with-current-buffer (window-buffer (minibuffer-window))
+          (setq minor-mode-overriding-map-alist `((helm--minor-mode . ,it)))))))
+
+;;; Prevent loosing focus when using mouse.
+;;
+(defvar helm--remap-mouse-mode-map
+  (let ((map (make-sparse-keymap)))
+    (cl-loop for k in '([mouse-1] [mouse-2] [mouse-3]
+                        [down-mouse-1] [down-mouse-2] [down-mouse-3]
+                        [drag-mouse-1] [drag-mouse-2] [drag-mouse-3]
+                        [double-mouse-1] [double-mouse-2] [double-mouse-3]
+                        [triple-mouse-1] [triple-mouse-2] [triple-mouse-3])
+             do (define-key map k 'undefined))
+    map))
+
+(define-minor-mode helm--remap-mouse-mode
+    "[INTERNAL] Prevent escaping helm minibuffer with mouse clicks.
+Do nothing when used outside of helm context.
+
+WARNING: Do not use this mode yourself, it is internal to helm."
+  :group 'helm
+  :global t
+  :keymap helm--remap-mouse-mode-map
+  (unless helm-alive-p
+    (setq helm--remap-mouse-mode-map nil)))
+\f
+;; Core: clean up
+
+(defun helm-cleanup ()
+  "Clean up the mess when helm exit or quit."
+  (helm-log "start cleanup")
+  (with-current-buffer helm-buffer
+    ;; bury-buffer from this window.
+    (bury-buffer) ;[1]
+    (remove-hook 'post-command-hook 'helm--maybe-update-keymap)
+    (remove-hook 'post-command-hook 'helm--update-header-line)
+    ;; Be sure we call this from helm-buffer.
+    (helm-funcall-foreach 'cleanup))
+  (helm-kill-async-processes)
+  ;; Remove the temporary hooks added
+  ;; by `with-helm-temp-hook' that
+  ;; may not have been consumed.
+  (when helm--temp-hooks
+    (cl-loop for (fn . hook) in helm--temp-hooks
+             do (set hook (delete fn (symbol-value hook)))))
+  ;; When running helm from a dedicated frame
+  ;; with no minibuffer, helm will run in the main frame
+  ;; which have a minibuffer, so be sure to disable
+  ;; the `no-other-window' prop there.
+  (helm-prevent-switching-other-window :enabled nil)
+  (helm-log-run-hook 'helm-cleanup-hook)
+  (helm-frame-or-window-configuration 'restore)
+  ;; [1] now bury-buffer from underlying windows otherwise,
+  ;; if this window is killed the underlying buffer will
+  ;; be a helm buffer.
+  (replace-buffer-in-windows helm-buffer)
+  (setq helm-alive-p nil)
+  (setq helm-debug nil)
+  ;; This is needed in some cases where last input
+  ;; is yielded infinitely in minibuffer after helm session.
+  (helm-clean-up-minibuffer))
+
+(defun helm-clean-up-minibuffer ()
+  "Remove contents of minibuffer."
+  (let ((miniwin (minibuffer-window)))
+    ;; Clean only current minibuffer used by helm.
+    ;; i.e The precedent one is active.
+    (unless (minibuffer-window-active-p miniwin)
+      (with-current-buffer (window-buffer miniwin)
+        (delete-minibuffer-contents)))))
+
+\f
+;;; Core: input handling
+;;
+;;
+(defun helm-check-minibuffer-input ()
+  "Check minibuffer content."
+  (with-helm-quittable
+    (with-selected-window (or (active-minibuffer-window)
+                              (minibuffer-window))
+      (helm-check-new-input (minibuffer-contents)))))
+
+(defun helm-check-new-input (input)
+  "Check INPUT string and update the helm buffer if necessary."
+  ;; First time minibuffer is entered
+  ;; we check value of `helm-pattern' that have been set
+  ;; in `helm-initial-setup' when `helm--maybe-use-default-as-input'
+  ;; is non--nil.  After this initial check, reset
+  ;; `helm--maybe-use-default-as-input' and ignore this.
+  ;; This happen only when source is `delayed'.
+  (when helm--maybe-use-default-as-input ; nil when non--delayed.
+    (setq input helm-pattern))
+  (unless (equal input helm-pattern)
+    (setq helm-pattern input)
+    (unless (helm-action-window)
+      (setq helm-input helm-pattern))
+    (helm-log "helm-pattern = %S" helm-pattern)
+    (helm-log "helm-input = %S" helm-input)
+    (setq helm--in-update t)
+    (helm-update)))
+
+(defun helm--reset-update-flag ()
+  (run-with-idle-timer
+   helm-exit-idle-delay nil
+   (lambda () (setq helm--in-update nil))))
+
+(add-hook 'helm-after-update-hook #'helm--reset-update-flag)
+
+\f
+;;; Core: source compiler
+;;
+;;
+(defun helm-compile-sources (sources funcs)
+  "Compile SOURCES with FUNCS.
+See `helm-compile-source-functions'.
+Helm plug-ins are realized by this function."
+  (mapcar
+   (lambda (source)
+     (cl-loop with src = (if (listp source) source (symbol-value source))
+              for noplug = (assoc 'dont-plug src)
+              for f in funcs
+              unless (and noplug (memq f (cdr noplug)))
+              do (setq src (funcall f src))
+              finally (cl-return src)))
+   sources))
+
+\f
+;; Core: all candidates
+
+(defun helm-get-candidates (source)
+  "Retrieve and return the list of candidates from SOURCE."
+  (let* (inhibit-quit
+         (candidate-fn (assoc-default 'candidates source))
+         (candidate-proc (assoc-default 'candidates-process source))
+         (type-error (lambda ()
+                       (error
+                        "`%s' must either be a function, a variable or a list"
+                        (or candidate-fn candidate-proc))))
+         (candidates (condition-case-unless-debug err
+                         ;; Process candidates-(process) function
+                         ;; It may return a process or a list of candidates.
+                         (if candidate-proc
+                             ;; Calling `helm-interpret-value' with no
+                             ;; SOURCE arg force the use of `funcall'
+                             ;; and not `helm-funcall-with-source'.
+                             (helm-interpret-value candidate-proc)
+                           (helm-interpret-value candidate-fn source))
+                       (error (helm-log "Error: %S" err) nil))))
+    (when (and (processp candidates) (not candidate-proc))
+      (warn "Candidates function `%s' should be called in a `candidates-process' attribute"
+            candidate-fn))
+    (cond ((processp candidates)
+           ;; Candidates will be filtered later in process filter.
+           candidates)
+          ((or (null candidates)
+               ;; Can happen when the output of a process
+               ;; is empty, and the candidates function call
+               ;; something like (split-string (buffer-string) "\n")
+               ;; which result in a list of one empty string (Issue #938).
+               ;; e.g (completing-read "test: " '(""))
+               (equal candidates '("")))
+           nil)
+          ((listp candidates)
+           ;; Transform candidates with `candidate-transformer' functions if
+           ;; some, otherwise return candidates.
+           (helm-transform-candidates candidates source))
+          (t (funcall type-error)))))
+
+(defmacro helm-while-no-input (&rest body)
+  "Same as `while-no-input' but without testing with `input-pending-p'."
+  (declare (debug t) (indent 0))
+  (let ((catch-sym (make-symbol "input"))
+        inhibit-quit)
+    `(with-local-quit
+       (catch ',catch-sym
+         (let ((throw-on-input ',catch-sym))
+           ,@body)))))
+
+(defun helm-get-cached-candidates (source)
+  "Return the cached value of candidates for SOURCE.
+Cache the candidates if there is not yet a cached value."
+  (let* ((name (assoc-default 'name source))
+         (candidate-cache (gethash name helm-candidate-cache)))
+    (helm-aif candidate-cache
+        (prog1 it (helm-log "Use cached candidates"))
+      (helm-log "No cached candidates, calculate candidates")
+      (let ((candidates (helm-get-candidates source)))
+        (cond ((processp candidates)
+               (push (cons candidates
+                           (append source
+                                   (list (cons 'item-count 0)
+                                         (cons 'incomplete-line ""))))
+                     helm-async-processes)
+               (set-process-filter candidates 'helm-output-filter)
+               (setq candidates nil))
+              ((not (assoc 'volatile source))
+               (puthash name candidates helm-candidate-cache)))
+        candidates))))
+
+\f
+;;; Core: candidate transformers
+
+(defun helm-process-candidate-transformer (candidates source)
+  "Execute `candidate-transformer' function(s) on CANDIDATES in SOURCE."
+  (helm-aif (assoc-default 'candidate-transformer source)
+      (helm-composed-funcall-with-source source it candidates)
+    candidates))
+
+(defun helm-process-filtered-candidate-transformer (candidates source)
+  "Execute `filtered-candidate-transformer' function(s) on CANDIDATES in SOURCE."
+  (helm-aif (assoc-default 'filtered-candidate-transformer source)
+      (helm-composed-funcall-with-source source it candidates source)
+    candidates))
+
+(defmacro helm--maybe-process-filter-one-by-one-candidate (candidate source)
+  "Execute `filter-one-by-one' function(s) on CANDIDATE in SOURCE."
+  `(helm-aif (assoc-default 'filter-one-by-one ,source)
+       (if (and (listp it)
+                (not (functionp it))) ;; Don't treat lambda's as list.
+           (cl-loop for f in it
+                 do (setq ,candidate (funcall f ,candidate))
+                 finally return ,candidate)
+         (setq ,candidate (funcall it ,candidate)))
+     ,candidate))
+
+(defun helm--initialize-one-by-one-candidates (candidates source)
+  "Process the CANDIDATES with the `filter-one-by-one' function in SOURCE.
+Return CANDIDATES when pattern is empty."
+  (helm-aif (and (string= helm-pattern "")
+                 (assoc-default 'filter-one-by-one source))
+      (cl-loop for cand in candidates collect
+               (helm--maybe-process-filter-one-by-one-candidate cand source))
+    candidates))
+
+(defun helm-process-filtered-candidate-transformer-maybe
+    (candidates source process-p)
+  "Execute `filtered-candidate-transformer' function(s) on CANDIDATES in SOURCE.
+When PROCESS-P is non-nil execute `filtered-candidate-transformer'
+functions if some, otherwise return CANDIDATES."
+  (if process-p
+      ;; When no filter return CANDIDATES unmodified.
+      (helm-process-filtered-candidate-transformer candidates source)
+    candidates))
+
+(defun helm-process-real-to-display (candidates source)
+  "Execute real-to-display function on all CANDIDATES of SOURCE."
+  (helm-aif (assoc-default 'real-to-display source)
+      (setq candidates (helm-funcall-with-source
+                        source 'mapcar
+                        (lambda (cand_)
+                          (if (consp cand_)
+                              ;; override DISPLAY from candidate-transformer
+                              (cons (funcall it (cdr cand_)) (cdr cand_))
+                            (cons (funcall it cand_) cand_)))
+                        candidates))
+    candidates))
+
+(defun helm-transform-candidates (candidates source &optional process-p)
+  "Transform CANDIDATES of SOURCE according to candidate transformers.
+When PROCESS-P is non-nil execute the `filtered-candidate-transformer' functions
+otherwise only the `candidate-transformer' functions are processed.
+When attribute `real-to-display' is present, execute its function on all maybe
+filtered CANDIDATES."
+  (helm-process-real-to-display
+   (helm-process-filtered-candidate-transformer-maybe
+    (helm-process-candidate-transformer
+     (helm--initialize-one-by-one-candidates candidates source) source)
+    source process-p)
+   source))
+
+\f
+;; Core: narrowing candidates
+(defun helm-candidate-number-limit (source)
+  "Apply candidate-number-limit attribute value.
+This overhide variable `helm-candidate-number-limit'.
+
+e.g:
+If \(candidate-number-limit\) is in SOURCE, show all candidates in SOURCE.
+If \(candidate-number-limit . 123\) is in SOURCE limit candidate to 123."
+  (helm-aif (assq 'candidate-number-limit source)
+      (or (cdr it) 99999999)
+    (or helm-candidate-number-limit 99999999)))
+
+(defun helm-candidate-get-display (candidate)
+  "Get searched display part from CANDIDATE.
+CANDIDATE is a string, a symbol, or \(DISPLAY . REAL\) cons cell."
+  (cond ((car-safe candidate))
+        ((symbolp candidate)
+         (symbol-name candidate))
+        ((numberp candidate)
+         (number-to-string candidate))
+        (t candidate)))
+
+(defun helm-process-pattern-transformer (pattern source)
+  "Execute pattern-transformer attribute PATTERN function in SOURCE."
+  (helm-aif (assoc-default 'pattern-transformer source)
+      (helm-composed-funcall-with-source source it pattern)
+    pattern))
+
+(defun helm-default-match-function (candidate)
+  "Check if `helm-pattern' match CANDIDATE.
+Default function to match candidates according to `helm-pattern'."
+  (string-match helm-pattern candidate))
+
+\f
+;;; Fuzzy matching
+;;
+;;
+(defvar helm--fuzzy-regexp-cache (make-hash-table :test 'eq))
+(defun helm--fuzzy-match-maybe-set-pattern ()
+  ;; Computing helm-pattern with helm--mapconcat-pattern
+  ;; is costly, so cache it once time for all and reuse it
+  ;; until pattern change.
+  (when helm--in-fuzzy
+    (let ((fun (if (string-match "\\`\\^" helm-pattern)
+                   #'identity
+                   #'helm--mapconcat-pattern)))
+      (clrhash helm--fuzzy-regexp-cache)
+      ;; FIXME: Splitted part are not handled here,
+      ;; I must compute them in `helm-search-match-part'
+      ;; when negation and in-buffer are used.
+      (if (string-match "\\`!" helm-pattern)
+          (puthash 'helm-pattern
+                   (if (> (length helm-pattern) 1)
+                       (list (funcall fun (substring helm-pattern 1 2))
+                             (funcall fun (substring helm-pattern 1)))
+                       '("" ""))
+                   helm--fuzzy-regexp-cache)
+          (puthash 'helm-pattern
+                   (if (> (length helm-pattern) 0)
+                       (list (funcall fun (substring helm-pattern 0 1))
+                             (funcall fun helm-pattern))
+                       '("" ""))
+                   helm--fuzzy-regexp-cache)))))
+
+(defun helm-fuzzy-match (candidate)
+  "Check if `helm-pattern' fuzzy match CANDIDATE.
+This function is used with sources build with `helm-source-sync'."
+  (unless (string-match " " helm-pattern)
+    ;; When pattern have one or more spaces, let
+    ;; multi-match doing the job with no fuzzy matching.[1]
+    (let ((regexp (cadr (gethash 'helm-pattern helm--fuzzy-regexp-cache))))
+      (if (string-match "\\`!" helm-pattern)
+          (not (string-match regexp candidate))
+          (string-match regexp candidate)))))
+
+(defun helm-fuzzy-search (pattern)
+  "Same as `helm-fuzzy-match' but for sources build with `helm-source-in-buffer'."
+  (unless (string-match " " helm-pattern)
+    ;; Same as in `helm-fuzzy-match' ref[1].
+    (let* ((regexps (gethash 'helm-pattern helm--fuzzy-regexp-cache))
+           (partial-regexp (car regexps))
+           (regexp (cadr regexps)))
+      (if (string-match "\\`!" pattern)
+          ;; Don't try to search here, just return
+          ;; the position of line and go ahead,
+          ;; letting `helm-search-match-part' checking if
+          ;; pattern match against this line.
+          (prog1 (list (point-at-bol) (point-at-eol))
+            (forward-line 1))
+          ;; We could use here directly `re-search-forward'
+          ;; on the regexp produced by `helm--mapconcat-pattern',
+          ;; but it is very slow because emacs have to do an incredible
+          ;; amount of loops to match e.g "[^f]*o[^o]..." in the whole buffer,
+          ;; more the regexp is long more the amount of loops grow.
+          ;; (Probably leading to a max-lisp-eval-depth error if both
+          ;; regexp and buffer are too big)
+          ;; So just search the first bit of pattern e.g "[^f]*f", and
+          ;; then search the corresponding line with the whole regexp,
+          ;; which increase dramatically the speed of the search.
+          (cl-loop while (re-search-forward partial-regexp nil t)
+                   for bol = (point-at-bol)
+                   for eol = (point-at-eol)
+                   if (progn (goto-char bol)
+                             (re-search-forward regexp eol t))
+                   do (goto-char eol) and return t
+                   else do (goto-char eol)
+                   finally return nil)))))
+
+(defun helm-score-candidate-for-pattern (candidate pattern)
+  "Give a score to CANDIDATE according to PATTERN.
+Score is calculated against number of contiguous matches found with PATTERN.
+If PATTERN is fully matched in CANDIDATE a maximal score (100) is given.
+A bonus of one point is given when PATTERN prefix match CANDIDATE.
+Contiguous matches have a coefficient of 2."
+  (let* ((cand (if (stringp candidate)
+                   candidate (helm-stringify candidate)))
+         (pat-lookup (helm--collect-pairs-in-string pattern))
+         (str-lookup (helm--collect-pairs-in-string cand))
+         (bonus (if (equal (car pat-lookup) (car str-lookup)) 1 0))
+         (bonus1 (and (string-match (concat "\\<" (regexp-quote pattern) "\\>")
+                                    cand)
+                      100)))
+    (+ bonus (or bonus1
+                 ;; Give a coefficient of 2 for contiguous matches.
+                 ;; That's mean that "wiaaaki" will not take precedence
+                 ;; on "aaawiki" when matching on "wiki" even if "wiaaaki"
+                 ;; starts by "wi".
+                 (* (length (cl-nintersection
+                             pat-lookup str-lookup :test 'equal))
+                    2)))))
+
+(defun helm-fuzzy-matching-default-sort-fn (candidates _source &optional use-real)
+  "The transformer for sorting candidates in fuzzy matching.
+It is sorting on the display part of by default.
+
+Sort CANDIDATES according to their score calculated by
+`helm-score-candidate-for-pattern'.  When two candidates have the
+same score sort is made by length.  Set USE-REAL to non-nil to
+sort on the real part."
+  (if (string= helm-pattern "")
+      candidates
+    (let ((table-scr (make-hash-table :test 'equal)))
+      (sort candidates
+            (lambda (s1 s2)
+              ;; Score and measure the length on real or display part of candidate
+              ;; according to `use-real'.
+              (let* ((real-or-disp-fn (if use-real #'cdr #'car))
+                     (cand1 (if (consp s1)
+                                (funcall real-or-disp-fn s1)
+                              s1))
+                     (cand2 (if (consp s2)
+                                (funcall real-or-disp-fn s2)
+                              s2))
+                     (data1 (or (gethash cand1 table-scr)
+                                (puthash cand1
+                                         (list (helm-score-candidate-for-pattern
+                                                cand1 helm-pattern)
+                                               (length (helm-stringify cand1)))
+                                         table-scr)))
+                     (data2 (or (gethash cand2 table-scr)
+                                (puthash cand2
+                                         (list (helm-score-candidate-for-pattern
+                                                cand2 helm-pattern)
+                                               (length (helm-stringify cand2)))
+                                         table-scr)))
+                     (len1 (cadr data1))
+                     (len2 (cadr data2))
+                     (scr1 (car data1))
+                     (scr2 (car data2)))
+                (cond ((= scr1 scr2)
+                       (< len1 len2))
+                      ((> scr1 scr2)))))))))
+
+(defun helm-fuzzy-default-highlight-match (candidate)
+  "The default function to highlight matches in fuzzy matching.
+It is meant to use with `filter-one-by-one' slot."
+  (let* ((pair (and (consp candidate) candidate))
+         (display (helm-stringify (if pair (car pair) candidate)))
+         (real (cdr pair))
+         (regex (helm-aif (and helm-migemo-mode
+                               (assoc helm-pattern
+                                      helm-mm--previous-migemo-info))
+                    (cdr it)
+                  helm-pattern))
+         ;; FIXME This is called at each turn, cache it to optimize.
+         (mp (helm-aif (helm-attr 'match-part (helm-get-current-source))
+                 (funcall it display))))
+    (with-temp-buffer
+      (insert (propertize display 'read-only nil)) ; Fix (#1176)
+      (goto-char (point-min))
+      (when mp
+        ;; FIXME the first part of display may contain an occurence of mp.
+        ;; e.g "helm-adaptive.el:27:(defgroup helm-adapt"
+        (search-forward mp nil t)
+        (goto-char (match-beginning 0)))
+      (if (re-search-forward regex (and mp (+ (point) (length mp))) t)
+          (add-text-properties
+           (match-beginning 0) (match-end 0) '(face helm-match))
+          (cl-loop with multi-match
+                   with patterns = (if (string-match-p " " helm-pattern)
+                                       (prog1 (split-string helm-pattern)
+                                         (setq multi-match t))
+                                       (split-string helm-pattern "" t))
+                   for p in patterns
+                   for re = (or (and helm-migemo-mode
+                                     (assoc-default
+                                      p helm-mm--previous-migemo-info))
+                                p)
+                   do
+                   (when (re-search-forward re nil t)
+                     (add-text-properties
+                      (match-beginning 0) (match-end 0)
+                      '(face helm-match)))
+                   (when multi-match (goto-char (point-min)))))
+      (setq display (buffer-string)))
+    (if real (cons display real) display)))
+
+(defun helm-fuzzy-highlight-matches (candidates _source)
+  "The filtered-candidate-transformer function to highlight matches in fuzzy.
+See `helm-fuzzy-default-highlight-match'."
+  (cl-loop for c in candidates
+           collect (funcall helm-fuzzy-matching-highlight-fn c)))
+
+(defun helm-match-functions (source)
+  (let ((matchfns (or (assoc-default 'match source)
+                      (assoc-default 'match-strict source)
+                      #'helm-default-match-function)))
+    (if (and (listp matchfns) (not (functionp matchfns)))
+        matchfns (list matchfns))))
+
+(defun helm-search-functions (source)
+  (let ((searchfns (assoc-default 'search source)))
+    (if (and (listp searchfns) (not (functionp searchfns)))
+        searchfns (list searchfns))))
+
+(defun helm-take-first-elements (seq n)
+  "Return the N first element of SEQ if SEQ is longer than N.
+It is used to narrow down list of candidates to `helm-candidate-number-limit'."
+  (if (> (length seq) n) (cl-subseq seq 0 n) seq))
+
+(cl-defun helm-set-case-fold-search (&optional (pattern helm-pattern))
+  "Used to set the value of `case-fold-search' in helm.
+Return t or nil depending of value of `helm-case-fold-search'
+and `helm-pattern'."
+  (let ((helm-case-fold-search
+         (helm-aif (assq 'case-fold-search (helm-get-current-source))
+             (cdr it)
+           helm-case-fold-search))
+        ;; Only parse basename for filenames
+        ;; to avoid setting case sensitivity
+        ;; when expanded directories contains upcase
+        ;; characters.
+        (bn-or-pattern (if (string-match "[~/]*" pattern)
+                           (helm-basename pattern)
+                           pattern)))
+    (helm-set-case-fold-search-1 bn-or-pattern)))
+
+(defun helm-set-case-fold-search-1 (pattern)
+  (cl-case helm-case-fold-search
+    (smart (let ((case-fold-search nil))
+             (if (string-match "[[:upper:]]" pattern) nil t)))
+    (t helm-case-fold-search)))
+
+(defun helm-match-from-candidates (cands matchfns match-part-fn limit source)
+  (condition-case-unless-debug err
+      (cl-loop with hash = (make-hash-table :test 'equal)
+               with allow-dups = (assq 'allow-dups source)
+               with case-fold-search = (helm-set-case-fold-search)
+               with count = 0
+               for iter from 1
+               for fn in matchfns
+               when (< count limit) nconc
+               (cl-loop for c in cands
+                        for dup = (gethash c hash)
+                        while (and (< count limit)
+                                   ;; When allowing dups check if DUP
+                                   ;; have been already found in previous loop
+                                   ;; by comparing its value with ITER.
+                                   (or (and allow-dups dup (= dup iter))
+                                       (null dup)))
+                        for target = (helm-candidate-get-display c)
+                        for part = (if match-part-fn
+                                       (funcall match-part-fn target)
+                                       target)
+                        when (funcall fn part) do
+                        (progn
+                          ;; Modify candidate before pushing it to hash.
+                          (helm--maybe-process-filter-one-by-one-candidate c source)
+                          ;; Give as value the iteration number of
+                          ;; inner loop to be able to check if
+                          ;; the duplicate have not been found in previous loop.
+                          (puthash c iter hash)
+                          (cl-incf count))
+                        and when c collect c))
+    (error (unless (eq (car err) 'invalid-regexp) ; Always ignore regexps errors.
+             (helm-log-error "helm-match-from-candidates in source `%s': %s %s"
+                             (assoc-default 'name source) (car err) (cdr err)))
+           nil)))
+
+(defun helm-compute-matches (source)
+  "Start computing candidates in SOURCE."
+  (save-current-buffer
+    (let ((matchfns (helm-match-functions source))
+          (matchpartfn (assoc-default 'match-part source))
+          (helm-source-name (assoc-default 'name source))
+          (helm-current-source source)
+          (limit (helm-candidate-number-limit source))
+          (helm-pattern (helm-process-pattern-transformer
+                         helm-pattern source)))
+      (helm--fuzzy-match-maybe-set-pattern)
+      ;; If source have a `filtered-candidate-transformer' attr
+      ;; Filter candidates with this func, otherwise just compute
+      ;; candidates.
+      (helm-process-filtered-candidate-transformer
+       (if (or (equal helm-pattern "")
+               (equal matchfns '(identity)))
+           ;; Compute all candidates up to LIMIT.
+           (helm-take-first-elements
+            (helm-get-cached-candidates source) limit)
+         ;; Compute candidates according to pattern with their match fns.
+         (helm-match-from-candidates
+          (helm-get-cached-candidates source) matchfns matchpartfn limit source))
+       source))))
+
+(defun helm-render-source (source matches)
+  "Display MATCHES from SOURCE according to its settings."
+  (helm-log "Source name = %S" (assoc-default 'name source))
+  (when matches
+    (helm-insert-header-from-source source)
+    (if (not (assq 'multiline source))
+        (cl-loop for m in matches
+                 for count from 1
+                 do (helm-insert-match m 'insert source count))
+      (let ((start (point))
+            (count 0)
+            separate)
+        (cl-dolist (match matches)
+          (cl-incf count)
+          (if separate
+              (helm-insert-candidate-separator)
+            (setq separate t))
+          (helm-insert-match match 'insert source count))
+        (put-text-property start (point) 'helm-multiline t)))))
+
+(defmacro helm--maybe-use-while-no-input (&rest body)
+  "Wrap BODY in `helm-while-no-input' unless initializing a remote connection."
+  `(progn
+     (if (and (file-remote-p helm-pattern)
+              (not (file-remote-p helm-pattern nil t)))
+         ;; Tramp will ask for passwd, don't use `helm-while-no-input'.
+         ,@body
+       (helm-log "Using here `helm-while-no-input'")
+       (helm-while-no-input ,@body))))
+
+(defun helm--collect-matches (src-list)
+  (let ((matches (helm--maybe-use-while-no-input
+                  (cl-loop for src in src-list
+                           collect (helm-compute-matches src)))))
+    (unless (eq matches t) matches)))
+
+(defun helm--compute-sources (src-list)
+  (cl-loop with matches = (helm--collect-matches src-list)
+        for src in src-list
+        for mtc in matches
+        do (helm-render-source src mtc)))
+
+(cl-defun helm-process-delayed-sources (delayed-sources &optional preselect source)
+  "Process helm DELAYED-SOURCES.
+Move selection to string or regexp PRESELECT if non--nil.
+This function is called in `helm-process-delayed-sources-timer'
+when emacs is idle for `helm-idle-delay'."
+  (with-helm-quittable
+    (helm-log "Delayed sources = %S"
+              (mapcar (lambda (s)
+                        (assoc-default 'name s))
+                      delayed-sources))
+    (with-current-buffer (helm-buffer-get)
+      (save-excursion
+        (goto-char (point-max))
+        (helm--compute-sources delayed-sources)
+        (when (and (not (helm-empty-buffer-p))
+                   ;; No selection yet.
+                   (= (overlay-start helm-selection-overlay)
+                      (overlay-end helm-selection-overlay)))
+          (helm-update-move-first-line 'without-hook)))
+      (save-excursion
+        (goto-char (point-min))
+        (helm-log-run-hook 'helm-update-hook))
+      (setq helm-force-updating-p nil)
+      (unless (assoc 'candidates-process source)
+        (helm-display-mode-line (helm-get-current-source))
+        (helm-log-run-hook 'helm-after-update-hook))
+      (when preselect (helm-preselect preselect source)))))
+
+\f
+;;; Core: helm-update
+;;
+(defun helm-update (&optional preselect source)
+  "Update candidates list in `helm-buffer' according to `helm-pattern'.
+Argument PRESELECT is a string or regexp used to move selection to a particular
+place once updating is done.  It should be used on single source because search
+is done on whole `helm-buffer' and not on current source."
+  (helm-log "Start updating")
+  (helm-kill-async-processes)
+  ;; When persistent action have been called
+  ;; we have two windows even with `helm-full-frame'.
+  ;; So go back to one window when updating if `helm-full-frame'
+  ;; is non--nil.
+  (with-helm-window
+    (when helm-onewindow-p (delete-other-windows)))
+  (with-current-buffer (helm-buffer-get)
+    (set (make-local-variable 'helm-input-local) helm-pattern)
+    (let (normal-sources
+          delayed-sources
+          matches)
+      (unwind-protect
+           (progn
+             ;; Iterate over all the sources
+             (cl-loop for source in (cl-remove-if-not
+                                     'helm-update-source-p (helm-get-sources))
+                   if (helm-delayed-source-p source)
+                   ;; Delayed sources just get collected for later
+                   ;; processing
+                   collect source into ds
+                   else
+                   ;; Collect the normal sources
+                   collect source into ns
+                   ;; Export the variables from cl-loop
+                   finally (setq delayed-sources ds
+                                 normal-sources ns))
+             ;; When no normal-sources erase buffer
+             ;; for the next possible delayed source
+             ;; or the already computed normal-source
+             ;; that is no more "updateable" (requires-pattern).
+             (unless normal-sources (erase-buffer))
+             ;; Compute matches without rendering the sources.
+             (helm-log "Matches: %S"
+                       (setq matches (helm--collect-matches normal-sources)))
+             ;; If computing matches finished and is not interrupted
+             ;; erase the helm-buffer and render results (Fix #1157).
+             (when matches
+               (erase-buffer)
+               (cl-loop for src in normal-sources
+                        for mtc in matches
+                        do (helm-render-source src mtc))))
+        (helm-log "Delayed sources = %S"
+                  (mapcar (lambda (s) (assoc-default 'name s))
+                          delayed-sources))
+        (cond ((and preselect delayed-sources normal-sources)
+               ;; Preselection run here when there is
+               ;; normal AND delayed sources.
+               (helm-log "Update preselect candidate %s" preselect)
+               (helm-preselect preselect source))
+              (delayed-sources ; Preselection and hooks will run later.
+               (helm-update-move-first-line 'without-hook))
+              (t              ; No delayed sources, run the hooks now.
+               (helm-update-move-first-line)
+               (unless (assoc 'candidates-process source)
+                 (helm-display-mode-line (helm-get-current-source))
+                 (helm-log-run-hook 'helm-after-update-hook))
+               (when preselect
+                 (helm-log "Update preselect candidate %s" preselect)
+                 (helm-preselect preselect source))
+               (setq helm-force-updating-p nil)))
+        (when delayed-sources
+          ;; Allow giving a value to `delayed' attr from inside source.
+          ;; Retain the biggest value (the slower) found in DELAYED-SOURCES.
+          (let ((helm-idle-delay (cl-loop with delay = helm-idle-delay
+                                       for s in delayed-sources
+                                       for d = (assoc-default 'delayed s)
+                                       when d do (setq delay (max delay d))
+                                       finally return delay)))
+            (run-with-idle-timer
+             ;; Be sure helm-idle-delay is >
+             ;; to helm-input-idle-delay
+             ;; otherwise use value of helm-input-idle-delay
+             ;; or 0.01 if == to 0.
+             (max helm-idle-delay helm-input-idle-delay 0.001) nil
+             'helm-process-delayed-sources delayed-sources preselect source)))
+        (helm-log "end update")))))
+
+;; Update keymap after updating.
+;; Now we run this in post-command-hook, it is
+;; probably no more needed in helm-after-update-hook.
+;; Leave it commented as a reminder for now.
+;; (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap)
+
+(defun helm-update-source-p (source)
+  "Whether SOURCE need updating or not."
+  (let ((len (string-width
+              (if (or (assoc 'matchplugin source)
+                      (null (assoc 'no-matchplugin source)))
+                  ;; Don't count spaces entered when using
+                  ;; multi-match.
+                  (replace-regexp-in-string " " "" helm-pattern)
+                helm-pattern))))
+    (and (or (not helm-source-filter)
+             (member (assoc-default 'name source) helm-source-filter))
+         (>= len
+             (helm-aif (assoc 'requires-pattern source) (or (cdr it) 1) 0))
+         ;; These incomplete regexps hang helm forever
+         ;; so defer update. Maybe replace spaces quoted when using
+         ;; multi-match.
+         (not (member (replace-regexp-in-string "\\s\\ " " " helm-pattern)
+                      helm-update-blacklist-regexps)))))
+
+(defun helm-delayed-source-p (source)
+  "Wheter SOURCE is a delayed source or not."
+  (or (assoc 'delayed source)
+      (and helm-quick-update
+           (> (length helm-sources) 1)
+           (< (window-height (get-buffer-window (current-buffer)))
+              (line-number-at-pos (point-max))))))
+
+(defun helm-update-move-first-line (&optional without-hook)
+  "Goto first line of `helm-buffer'."
+  (goto-char (point-min))
+  (unless without-hook
+    (save-excursion (helm-log-run-hook 'helm-update-hook)))
+  (helm-next-line))
+
+(defun helm-force-update (&optional preselect)
+  "Force recalculation and update of candidates.
+
+The difference with `helm-update' is this function is reevaling
+the `init' and `update' attributes functions when present
+before running `helm-update', also `helm-candidate-cache',
+if some (async candidates are not cached)
+is not reinitialized so that candidates are not recomputed
+unless pattern have changed.
+
+Selection is preserved to current candidate or moved to PRESELECT
+if specified."
+  (let ((source    (helm-get-current-source))
+        (selection (helm-get-selection nil t))
+        ;; `helm-goto-source' need to have all sources displayed
+        ;; So disable `helm-quick-update'.
+        helm-quick-update)
+    (setq helm-force-updating-p t)
+    (when source
+      (mapc 'helm-force-update--reinit
+            (helm-get-sources)))
+    (helm-update (or preselect selection) source)
+    (with-helm-window (recenter))))
+
+(defun helm-refresh ()
+  "Force recalculation and update of candidates."
+  (interactive)
+  (with-helm-alive-p
+    (helm-force-update)))
+(put 'helm-refresh 'helm-only t)
+
+(defun helm-force-update--reinit (source)
+  "Reinit SOURCE by calling his update and/or init functions."
+  (helm-aif (helm-funcall-with-source
+             source 'helm-candidate-buffer)
+      (kill-buffer it))
+  (cl-dolist (attr '(update init))
+    (helm-aif (assoc-default attr source)
+        (helm-funcall-with-source source it)))
+  (helm-remove-candidate-cache source))
+
+(defun helm-remove-candidate-cache (source)
+  "Remove SOURCE from `helm-candidate-cache'."
+  (remhash (assoc-default 'name source) helm-candidate-cache))
+
+(defun helm-insert-match (match insert-function source &optional num)
+  "Insert MATCH into `helm-buffer' with INSERT-FUNCTION for SOURCE.
+If MATCH is a list then insert the string intended to appear on the display
+and store the real value in a text property."
+  (let ((start     (point-at-bol (point)))
+        (dispvalue (helm-candidate-get-display match))
+        (realvalue (cdr-safe match)))
+    (when (and (stringp dispvalue)
+             (not (zerop (length dispvalue))))
+      (funcall insert-function dispvalue)
+      ;; Some sources with candidates-in-buffer have already added
+      ;; 'helm-realvalue property when creating candidate buffer.
+      (unless (get-text-property start 'helm-realvalue)
+        (and realvalue
+             (put-text-property start (point-at-eol)
+                                'helm-realvalue realvalue)))
+      (when num
+        (put-text-property start (point-at-eol) 'helm-cand-num num))
+      (when helm-source-in-each-line-flag
+        (put-text-property start (point-at-eol) 'helm-source source))
+      (funcall insert-function "\n"))))
+
+(defun helm-insert-header-from-source (source)
+  "Insert SOURCE name in `helm-buffer' header.
+Maybe insert by overlay additional info after source name if SOURCE have
+header-name attribute."
+  (let ((name (assoc-default 'name source)))
+    (helm-insert-header
+     name
+     (helm-aif (assoc-default 'header-name source)
+         (helm-funcall-with-source source it name)))))
+
+(defun helm-insert-header (name &optional display-string)
+  "Insert header of source NAME into the helm buffer.
+If DISPLAY-STRING is non--nil and a string, display this additional info
+after the source name by overlay."
+  (unless (bobp)
+    (let ((start (point)))
+      (insert "\n")
+      (put-text-property start (point) 'helm-header-separator t)))
+  (let ((start (point)))
+    (insert name)
+    (put-text-property (point-at-bol)
+                       (point-at-eol) 'helm-header t)
+    (when display-string
+      (overlay-put (make-overlay (point-at-bol) (point-at-eol))
+                   'display display-string))
+    (insert "\n")
+    (put-text-property start (point) 'face 'helm-source-header)))
+
+(defun helm-insert-candidate-separator ()
+  "Insert separator of candidates into the helm buffer."
+  (insert (propertize helm-candidate-separator 'face 'helm-separator))
+  (put-text-property (point-at-bol)
+                     (point-at-eol) 'helm-candidate-separator t)
+  (insert "\n"))
+
+\f
+;;; Core: async process
+;;
+(defun helm-output-filter (process output-string)
+  "The `process-filter' function for helm async sources."
+  (with-helm-quittable
+    (helm-output-filter-1 (assoc process helm-async-processes) output-string)))
+
+(defun helm-output-filter-1 (process-assoc output-string)
+  (helm-log "output-string = %S" output-string)
+  (with-current-buffer helm-buffer
+    (let ((source (cdr process-assoc)))
+      (save-excursion
+        (helm-aif (assoc-default 'insertion-marker source)
+            (goto-char it)
+          (goto-char (point-max))
+          (helm-insert-header-from-source source)
+          (setcdr process-assoc
+                  (append source `((insertion-marker . ,(point-marker))))))
+        (helm-output-filter--process-source
+         (car process-assoc) output-string source
+         (helm-candidate-number-limit source))))
+    (helm-output-filter--post-process)))
+
+(defun helm-output-filter--process-source (process output-string source limit)
+  (cl-dolist (candidate (helm-transform-candidates
+                         (helm-output-filter--collect-candidates
+                          (split-string output-string "\n")
+                          (assoc 'incomplete-line source))
+                         source t))
+    (setq candidate
+          (helm--maybe-process-filter-one-by-one-candidate candidate source))
+    (if (assq 'multiline source)
+        (let ((start (point)))
+          (helm-insert-candidate-separator)
+          (helm-insert-match candidate 'insert-before-markers source
+                             (1+ (cdr (assoc 'item-count source))))
+          (put-text-property start (point) 'helm-multiline t))
+        (helm-insert-match candidate 'insert-before-markers source
+                           (1+ (cdr (assoc 'item-count source)))))
+    (cl-incf (cdr (assoc 'item-count source)))
+    (when (>= (assoc-default 'item-count source) limit)
+      (helm-kill-async-process process)
+      (cl-return))))
+
+(defun helm-output-filter--collect-candidates (lines incomplete-line-info)
+  "Collect LINES maybe completing the truncated first and last lines."
+  ;; The output of process may come in chunks of any size,
+  ;; so the last line of LINES come truncated, this truncated line is
+  ;; stored in INCOMPLETE-LINE-INFO and will be concated with the first
+  ;; incomplete line of next chunk arriving.
+  ;; INCOMPLETE-LINE-INFO is an attribute of source which is created
+  ;; with an empty string when the source is computed => (incomplete-line . "")
+  (helm-log "incomplete-line-info = %S" (cdr incomplete-line-info))
+  (butlast
+   (cl-loop for line in lines
+            ;; On start `incomplete-line-info' value is empty string.
+            for newline = (helm-aif (cdr incomplete-line-info)
+                              (prog1
+                                  (concat it line)
+                                (setcdr incomplete-line-info nil))
+                            line)
+            collect newline
+            ;; Store last incomplete line (last chunk truncated)
+            ;; until new output arrives.
+            ;; Previously we were storing 'line' in incomplete-line-info
+            ;; assuming output is truncated in only two chunks,
+            ;; which may be wrong if output is very large and is truncated
+            ;; in more than two chunks, so store now 'newline' which
+            ;; contain the previous chunks (Issue #1187).
+            finally do (setcdr incomplete-line-info newline))))
+
+(defun helm-output-filter--post-process ()
+  (let ((src (helm-get-current-source)))
+    (helm-log-run-hook 'helm-update-hook)
+    (helm-aif (get-buffer-window helm-buffer 'visible)
+        (with-selected-window it
+          (helm-skip-noncandidate-line 'next)
+          (helm-mark-current-line)
+          (helm-display-mode-line src)
+          (helm-log-run-hook 'helm-after-update-hook)))))
+
+(defun helm-process-deferred-sentinel-hook (process event file)
+  "Defer remote processes in sentinels.
+Meant to be called at beginning of a sentinel process function."
+  (when (and (string= event "finished\n")
+             (or (file-remote-p file)
+                 ;; `helm-suspend-update-flag'
+                 ;; is non--nil here only during a
+                 ;; running process, this will never be called
+                 ;; when user set it explicitely with `C-!'.
+                 helm-suspend-update-flag))
+    (setq helm-suspend-update-flag t)
+    ;; Kill the process but don't delete entry in
+    ;; `helm-async-processes'.
+    (helm-kill-async-process process)
+    ;; When tramp tries to open the same connection twice in a
+    ;; short time frame (less than 5s) it throw 'suppress which
+    ;; call the real-handler on the main "Emacs", so we wait
+    ;; 5s before updating to avoid this [1], but allowing user to
+    ;; enter input during this delay.
+    ;; [1] On last Emacs versions, this is fixed and tramp return
+    ;; nil in this situation.
+    ;; Note: It is difficult to have a value < to 5 for
+    ;; `tramp-connection-min-time-diff', because the process die
+    ;; when calling too quickly same process.
+    (run-at-time (or (and (boundp 'tramp-connection-min-time-diff)
+                          tramp-connection-min-time-diff)
+                     5)
+                 nil (lambda ()
+                         (when helm-alive-p ; Don't run timer fn after quit.
+                           (setq helm-suspend-update-flag nil)
+                           (helm-check-minibuffer-input))))))
+
+(defun helm-kill-async-processes ()
+  "Kill all asynchronous processes registered in `helm-async-processes'."
+  (while helm-async-processes
+    (helm-kill-async-process (caar helm-async-processes))
+    (setq helm-async-processes (cdr helm-async-processes))))
+
+(defun helm-kill-async-process (process)
+  "Stop output from `helm-output-filter' and kill associated PROCESS."
+  (set-process-filter process nil)
+  (delete-process process))
+
+\f
+;;; Core: action
+;;
+(defun helm-execute-selection-action ()
+  "Execute current action and kill the action buffer if present."
+  (helm-log-run-hook 'helm-before-action-hook)
+  ;; Position can be different when `helm-current-buffer'
+  ;; is splitted, so jump to this position before executing action.
+  (helm-current-position 'restore)
+  (unwind-protect
+       (helm-execute-selection-action-1)
+    (helm-aif (get-buffer helm-action-buffer)
+        (kill-buffer it))
+    (helm-log-run-hook 'helm-after-action-hook)))
+
+(defun helm-execute-selection-action-1 (&optional
+                                          selection action
+                                          preserve-saved-action)
+  "Execute ACTION on current SELECTION.
+If PRESERVE-SAVED-ACTION is non--nil save action."
+  (helm-log "executing action")
+  (setq action (helm-get-default-action
+                (or action
+                    helm-saved-action
+                    (if (get-buffer helm-action-buffer)
+                        (helm-get-selection helm-action-buffer)
+                      (helm-get-actions-from-current-source)))))
+  (let ((source (or helm-saved-current-source
+                    (helm-get-current-source)))
+        non-essential)
+    (setq selection (helm-coerce-selection
+                     (or selection
+                         helm-saved-selection
+                         (helm-get-selection)
+                         (and (assoc 'accept-empty source) ""))
+                     source))
+    (unless preserve-saved-action (setq helm-saved-action nil))
+    (when (and selection action) (funcall action selection))))
+
+(defun helm-coerce-selection (selection source)
+  "Apply coerce attribute function to SELECTION in SOURCE.
+Coerce source with coerce function."
+  (helm-aif (assoc-default 'coerce source)
+      (helm-funcall-with-source source it selection)
+    selection))
+
+(defun helm-get-default-action (action)
+  "Get the first ACTION value of action list in source."
+  (if (and (listp action) (not (functionp action)))
+      (cdar action)
+    action))
+
+(defun helm-select-action ()
+  "Select an action for the currently selected candidate.
+If action buffer is selected, back to the helm buffer."
+  (interactive)
+  (with-helm-alive-p
+    (helm-log-run-hook 'helm-select-action-hook)
+    (setq helm-saved-selection (helm-get-selection))
+    (with-selected-frame (with-helm-window (selected-frame))
+      (prog1
+          (cond ((get-buffer-window helm-action-buffer 'visible)
+                 (set-window-buffer (get-buffer-window helm-action-buffer)
+                                    helm-buffer)
+                 (kill-buffer helm-action-buffer)
+                 (helm-set-pattern helm-input 'noupdate))
+                (helm-saved-selection
+                 (setq helm-saved-current-source (helm-get-current-source))
+                 (let ((actions (helm-get-actions-from-current-source)))
+                   (if (functionp actions)
+                       (message "Sole action: %s" actions)
+                       (helm-show-action-buffer actions)
+                       ;; Be sure the minibuffer is entirely deleted (#907).
+                       (helm--delete-minibuffer-contents-from "")
+                       ;; Make `helm-pattern' differs from the previous value.
+                       (setq helm-pattern 'dummy)
+                       (helm-check-minibuffer-input))))
+                (t (message "No Actions available")))
+        (helm-display-mode-line (helm-get-current-source))
+        (run-hooks 'helm-window-configuration-hook)))))
+(put 'helm-select-action 'helm-only t)
+
+(defun helm-show-action-buffer (actions)
+  (with-current-buffer (get-buffer-create helm-action-buffer)
+    (erase-buffer)
+    (buffer-disable-undo)
+    (set-window-buffer (get-buffer-window helm-buffer) helm-action-buffer)
+    (set (make-local-variable 'helm-sources)
+         (list
+          (helm-build-sync-source "Actions"
+            :volatile t
+            :nomark t
+            :keymap 'helm-map
+            :candidates actions
+            :mode-line '("Action(s)" "TAB:BackToCands RET/f1/f2/fn:NthAct")
+            :candidate-transformer
+             (lambda (candidates)
+               (cl-loop for (i . j) in candidates
+                        for count from 1
+                        collect
+                        (cons (concat (cond ((> count 12)
+                                             "      ")
+                                            ((< count 10)
+                                             (format "[f%s]  " count))
+                                            (t (format "[f%s] " count)))
+                                      (propertize i 'face 'helm-action))
+                              j)))
+            :candidate-number-limit nil)))
+    (set (make-local-variable 'helm-source-filter) nil)
+    (set (make-local-variable 'helm-selection-overlay) nil)
+    (helm-initialize-overlays helm-action-buffer)))
+
+\f
+;; Core: selection
+
+(defun helm-display-source-at-screen-top-maybe (unit)
+  "Display source at top of screen when UNIT value is 'source.
+With any other value of UNIT return nil."
+  (when (and helm-display-source-at-screen-top (eq unit 'source))
+    (set-window-start (selected-window)
+                      (save-excursion (forward-line -1) (point)))))
+
+(defun helm-skip-noncandidate-line (direction)
+  "Skip source header or candidates separator when going in DIRECTION.
+Possible value of DIRECTION are 'next or 'previous.
+Same as `helm-skip-header-and-separator-line' but ensure
+point is moved to the right place when at bop or eob."
+  (helm-skip-header-and-separator-line direction)
+  (and (bobp) (forward-line 1))     ; Skip first header.
+  (and (eobp) (forward-line -1)))   ; Avoid last empty line.
+
+(defun helm-skip-header-and-separator-line (direction)
+  "Skip source header or candidate separator when going to next/previous line.
+Possible value of DIRECTION are 'next or 'previous."
+  (let ((fn (cl-ecase direction
+              (next 'eobp)
+              (previous 'bobp))))
+  (while (and (not (funcall fn))
+              (or (helm-pos-header-line-p)
+                  (helm-pos-candidate-separator-p)))
+    (forward-line (if (and (eq direction 'previous)
+                           (not (eq (point-at-bol) (point-min))))
+                      -1 1)))))
+
+(defun helm-display-mode-line (source &optional force)
+  "Setup mode-line and header-line for `helm-buffer'."
+  (set (make-local-variable 'helm-mode-line-string)
+       (helm-interpret-value (or (and (listp source) ; Check if source is empty.
+                                      (assoc-default 'mode-line source))
+                                 (default-value 'helm-mode-line-string))
+                             source))
+  (let ((follow (and (eq (cdr (assq 'follow source)) 1) " (HF)"))
+        (marked (and helm-marked-candidates
+                     (cl-loop with cur-name = (assoc-default 'name source)
+                              for c in helm-marked-candidates
+                              for name = (assoc-default 'name (car c))
+                              when (string= name cur-name)
+                              collect c))))
+    ;; Setup mode-line.
+    (if helm-mode-line-string
+        (setq mode-line-format
+              `(" " mode-line-buffer-identification " "
+                    (:eval (format "L%-3d" (helm-candidate-number-at-point)))
+                    ,follow
+                    (:eval ,(and marked
+                                 (concat
+                                  " "
+                                  (propertize
+                                   (format "M%d" (length marked))
+                                   'face 'helm-visible-mark))))
+                    (:eval (when ,helm--mode-line-display-prefarg
+                             (let ((arg (prefix-numeric-value
+                                         (or prefix-arg current-prefix-arg))))
+                               (unless (= arg 1)
+                                 (propertize (format " [prefarg:%s]" arg)
+                                             'face 'helm-prefarg)))))
+                    " "
+                    (:eval (helm-show-candidate-number
+                            (car-safe helm-mode-line-string)))
+                    " " helm--mode-line-string-real " " mode-line-end-spaces)
+              helm--mode-line-string-real
+              (substitute-command-keys (if (listp helm-mode-line-string)
+                                           (cadr helm-mode-line-string)
+                                           helm-mode-line-string)))
+        (setq mode-line-format (default-value 'mode-line-format)))
+    ;; Setup header-line.
+    (cond (helm-echo-input-in-header-line
+           (setq force t)
+           (helm--set-header-line))
+          (helm-display-header-line
+           (let ((hlstr (helm-interpret-value
+                          (and (listp source)
+                               (assoc-default 'header-line source))
+                          source))
+                 (endstr (make-string (window-width) ? )))
+             (setq header-line-format
+                   (propertize (concat " " hlstr endstr)
+                               'face 'helm-header))))))
+  (when force (force-mode-line-update)))
+
+(defun helm--set-header-line (&optional update)
+  (with-selected-window (minibuffer-window)
+    (let* ((beg  (save-excursion (vertical-motion 0 (helm-window)) (point)))
+           (end  (save-excursion (end-of-visual-line) (point)))
+           ;; The visual line where the cursor is.
+           (cont (buffer-substring beg end))
+           (pref (propertize
+                  " "
+                  'display (if (string-match-p (regexp-quote helm--prompt) cont)
+                               '(space :width left-fringe)
+                               (propertize
+                                "->"
+                                'face 'helm-header-line-left-margin))))
+           (pos  (- (point) beg)))
+      (with-helm-buffer
+        (setq header-line-format (concat pref cont " "))
+        (put-text-property
+         ;; Increment pos to handle the space before prompt (i.e `pref').
+         (1+ pos) (+ 2 pos)
+         'face ;don't just use 'cursor; this can hide the current character
+         (list :inverse-video t
+               :foreground (face-background 'cursor)
+               :background (face-background 'default))
+         header-line-format)
+        (when update (force-mode-line-update))))))
+
+(defun helm--update-header-line ()
+  ;; This should be used in `post-command-hook',
+  ;; nowhere else.
+  (when (with-helm-buffer helm-echo-input-in-header-line)
+    (helm--set-header-line t)))
+
+(defun helm-hide-minibuffer-maybe ()
+  "Hide minibuffer contents in a Helm session.
+This function should normally go to `helm-minibuffer-set-up-hook'.
+It has no effect if `helm-echo-input-in-header-line' is nil."
+  (when (with-helm-buffer helm-echo-input-in-header-line)
+    (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
+      (overlay-put ov 'window (selected-window))
+      (overlay-put ov 'face (let ((bg-color (face-background 'default nil)))
+                              `(:background ,bg-color :foreground ,bg-color)))
+      (setq cursor-type nil))))
+
+(defun helm-show-candidate-number (&optional name)
+  "Used to display candidate number in mode-line.
+You can specify NAME of candidates e.g \"Buffers\" otherwise
+it is \"Candidate\(s\)\" by default."
+  (when helm-alive-p
+    (unless (helm-empty-source-p)
+      ;; Build a fixed width string when candidate-number < 1000
+      (let* ((cand-name (or name "Candidate(s)"))
+             (width (length (format "[999 %s]" cand-name))))
+        (propertize
+         (format (concat "%-" (number-to-string width) "s")
+                 (format "[%s %s]"
+                         (helm-get-candidate-number 'in-current-source)
+                         cand-name))
+         'face 'helm-candidate-number)))))
+
+(cl-defun helm-move-selection-common (&key where direction)
+  "Move the selection marker to a new position.
+Position is determined by WHERE and DIRECTION.
+Key arg WHERE can be one of:
+ - line
+ - page
+ - edge
+ - source
+Key arg DIRECTION can be one of:
+ - previous
+ - next
+ - A source or a source name when used with :WHERE 'source."
+  (let ((move-func (cl-case where
+                     (line (cl-ecase direction
+                             (previous 'helm-move--previous-line-fn)
+                             (next 'helm-move--next-line-fn)))
+                     (page (cl-ecase direction
+                             (previous 'helm-move--previous-page-fn)
+                             (next 'helm-move--next-page-fn)))
+                     (edge (cl-ecase direction
+                             (previous 'helm-move--beginning-of-buffer-fn)
+                             (next 'helm-move--end-of-buffer-fn)))
+                     (source (cl-case direction
+                               (previous 'helm-move--previous-source-fn)
+                               (next 'helm-move--next-source-fn)
+                               (t (lambda () ; A source is passed as DIRECTION arg.
+                                    (helm-move--goto-source-fn direction))))))))
+    (unless (or (helm-empty-buffer-p (helm-buffer-get))
+                (not (helm-window)))
+      (with-helm-window
+        (helm-log-run-hook 'helm-move-selection-before-hook)
+        (funcall move-func)
+        (and (memq direction '(next previous))
+             (helm-skip-noncandidate-line direction))
+        (when (helm-pos-multiline-p)
+          (helm-move--beginning-of-multiline-candidate))
+        (helm-display-source-at-screen-top-maybe where)
+        (when (helm-get-previous-header-pos)
+          (helm-mark-current-line))
+        (helm-display-mode-line (helm-get-current-source))
+        (helm-log-run-hook 'helm-move-selection-after-hook)))))
+
+(defun helm-move--beginning-of-multiline-candidate ()
+  (let ((header-pos (helm-get-previous-header-pos))
+        (separator-pos (helm-get-previous-candidate-separator-pos)))
+    (when header-pos
+      (goto-char (if (or (null separator-pos)
+                         (< separator-pos header-pos))
+                     header-pos
+                     separator-pos))
+      (forward-line 1))))
+
+(defun helm-move--previous-multi-line-fn ()
+  (forward-line -1)
+  (unless (helm-pos-header-line-p)
+    (helm-skip-header-and-separator-line 'previous)
+    (helm-move--beginning-of-multiline-candidate)))
+
+(defun helm-move--previous-line-fn ()
+  (if (not (helm-pos-multiline-p))
+      (forward-line -1)
+    (helm-move--previous-multi-line-fn))
+  (when (and helm-move-to-line-cycle-in-source
+             (helm-pos-header-line-p))
+    (forward-line 1)
+    (helm-move--end-of-source)
+    ;; We are at end of helm-buffer
+    ;; check if last candidate is a multiline candidate
+    ;; and jump to it
+    (when (and (eobp)
+               (save-excursion (forward-line -1) (helm-pos-multiline-p)))
+      (helm-move--previous-multi-line-fn))))
+
+(defun helm-move--next-multi-line-fn ()
+  (let ((header-pos (helm-get-next-header-pos))
+        (separator-pos (helm-get-next-candidate-separator-pos)))
+    (cond ((and separator-pos
+                (or (null header-pos) (< separator-pos header-pos)))
+           (goto-char separator-pos))
+          (header-pos
+           (goto-char header-pos)))))
+
+(defun helm-move--next-line-fn ()
+  (if (not (helm-pos-multiline-p))
+      (forward-line 1)
+    (helm-move--next-multi-line-fn))
+  (when (and helm-move-to-line-cycle-in-source
+             (or (save-excursion (and (helm-pos-multiline-p)
+                                      (goto-char (overlay-end
+                                                  helm-selection-overlay))
+                                      (helm-end-of-source-p t)))
+                 (helm-end-of-source-p t)))
+    (helm-move--beginning-of-source)))
+
+(defun helm-move--previous-page-fn ()
+  (condition-case nil
+      (scroll-down)
+    (beginning-of-buffer (goto-char (point-min)))))
+
+(defun helm-move--next-page-fn ()
+  (condition-case nil
+      (scroll-up)
+    (end-of-buffer (goto-char (point-max)))))
+
+(defun helm-move--beginning-of-buffer-fn ()
+  (goto-char (point-min)))
+
+(defun helm-move--end-of-buffer-fn ()
+  (goto-char (point-max)))
+
+(defun helm-move--end-of-source ()
+  (goto-char (or (helm-get-next-header-pos) (point-max)))
+  (when (helm-pos-header-line-p) (forward-line -2)))
+
+(defun helm-move--beginning-of-source ()
+  (goto-char (helm-get-previous-header-pos))
+  (forward-line 1))
+
+(defun helm-move--previous-source-fn ()
+  (forward-line -1)
+  (if (bobp)
+      (goto-char (point-max))
+    (helm-skip-header-and-separator-line 'previous))
+  (goto-char (helm-get-previous-header-pos))
+  (forward-line 1))
+
+(defun helm-move--next-source-fn ()
+  (goto-char (or (and (not (save-excursion
+                             (forward-line 1) (eobp)))
+                      ;; Empty source at eob are just
+                      ;; not displayed unless they are dummy.
+                      ;; Issue #1117.
+                      (helm-get-next-header-pos))
+                 (point-min))))
+
+(defun helm-move--goto-source-fn (source-or-name)
+  (goto-char (point-min))
+  (let ((name (if (stringp source-or-name) source-or-name
+                (assoc-default 'name source-or-name))))
+    (condition-case err
+        (while (not (string= name (helm-current-line-contents)))
+          (goto-char (helm-get-next-header-pos)))
+      (error (helm-log "%S" err)))))
+
+(defun helm-candidate-number-at-point ()
+  (with-helm-buffer
+    (or (get-text-property (point) 'helm-cand-num) 1)))
+
+(defun helm--next-or-previous-line (direction &optional arg)
+  ;; Be sure to not use this in non--interactives calls.
+  (let ((helm-move-to-line-cycle-in-source
+         (and helm-move-to-line-cycle-in-source arg)))
+    (if (and arg (> arg 1))
+        (cl-loop with pos = (helm-candidate-number-at-point)
+                 with cand-num = (helm-get-candidate-number t)
+                 with iter = (min arg (if (eq direction 'next)
+                                          (- cand-num pos)
+                                          (min arg (1- pos))))
+                 for count from 1
+                 while (<= count iter)
+                 do
+                 (helm-move-selection-common :where 'line :direction direction))
+        (helm-move-selection-common :where 'line :direction direction))))
+
+(defun helm-previous-line (&optional arg)
+  "Move selection to the ARG previous line(s).
+Same behavior than `helm-next-line' when called with a numeric prefix arg."
+  (interactive "p")
+  (with-helm-alive-p
+    (helm--next-or-previous-line 'previous arg)))
+(put 'helm-previous-line 'helm-only t)
+
+(defun helm-next-line (&optional arg)
+  "Move selection to the next ARG line(s).
+When a numeric prefix arg is given and this numeric arg
+is > to the number of candidates, move to last candidate of
+current source (i.e don't move to next source if some)."
+  (interactive "p")
+  (with-helm-alive-p
+    (helm--next-or-previous-line 'next arg)))
+(put 'helm-next-line 'helm-only t)
+
+(defun helm-previous-page ()
+  "Move selection back with a pageful."
+  (interactive)
+  (with-helm-alive-p
+    (helm-move-selection-common :where 'page :direction 'previous)))
+(put 'helm-previous-page 'helm-only t)
+
+(defun helm-next-page ()
+  "Move selection forward with a pageful."
+  (interactive)
+  (with-helm-alive-p
+    (helm-move-selection-common :where 'page :direction 'next)))
+(put 'helm-next-page 'helm-only t)
+
+(defun helm-beginning-of-buffer ()
+  "Move selection at the top."
+  (interactive)
+  (with-helm-alive-p
+    (helm-move-selection-common :where 'edge :direction 'previous)))
+(put 'helm-beginning-of-buffer 'helm-only t)
+
+(defun helm-end-of-buffer ()
+  "Move selection at the bottom."
+  (interactive)
+  (with-helm-alive-p
+    (helm-move-selection-common :where 'edge :direction 'next)))
+(put 'helm-end-of-buffer 'helm-only t)
+
+(defun helm-previous-source ()
+  "Move selection to the previous source."
+  (interactive)
+  (with-helm-alive-p
+    (helm-move-selection-common :where 'source :direction 'previous)))
+(put 'helm-previous-source 'helm-only t)
+
+(defun helm-next-source ()
+  "Move selection to the next source."
+  (interactive)
+  (with-helm-alive-p
+    (helm-move-selection-common :where 'source :direction 'next)))
+(put 'helm-next-source 'helm-only t)
+
+(defun helm-goto-source (source-or-name)
+  "Move the selection to the source SOURCE-OR-NAME."
+  (helm-move-selection-common :where 'source :direction source-or-name))
+
+(defun helm--follow-action (arg)
+  (let ((helm--temp-follow-flag t))
+    (when (or (eq last-command 'helm-follow-action-forward)
+              (eq last-command 'helm-follow-action-backward)
+              (eq last-command 'helm-execute-persistent-action))
+      (if (> arg 0)
+          (helm-next-line 1)
+        (helm-previous-line 1)))
+    (helm-execute-persistent-action)))
+
+(defun helm-follow-action-forward ()
+  "Go to next line and execute persistent action."
+  (interactive)
+  (with-helm-alive-p (helm--follow-action 1)))
+(put 'helm-follow-action-forward 'helm-only t)
+
+(defun helm-follow-action-backward ()
+  "Go to previous line and execute persistent action."
+  (interactive)
+  (with-helm-alive-p (helm--follow-action -1)))
+(put 'helm-follow-action-backward 'helm-only t)
+
+(defun helm-mark-current-line (&optional resumep)
+  "Move `helm-selection-overlay' to current line.
+Note that this is not related with visibles marks, which are used
+to mark candidates."
+  (with-helm-window
+    (when resumep
+      (goto-char helm-selection-point))
+    (move-overlay
+     helm-selection-overlay (point-at-bol)
+     (if (helm-pos-multiline-p)
+         (let ((header-pos (helm-get-next-header-pos))
+               (separator-pos (helm-get-next-candidate-separator-pos)))
+           (or (and (null header-pos) separator-pos)
+               (and header-pos separator-pos
+                    (< separator-pos header-pos)
+                    separator-pos)
+               header-pos
+               (point-max)))
+       (1+ (point-at-eol))))
+    (setq helm-selection-point (overlay-start helm-selection-overlay)))
+  (helm-follow-execute-persistent-action-maybe))
+
+(defun helm-confirm-and-exit-minibuffer ()
+  "Maybe ask for confirmation when exiting helm.
+It is similar to `minibuffer-complete-and-exit' adapted to helm.
+If `minibuffer-completion-confirm' value is 'confirm,
+send in minibuffer confirm message and exit on next hit.
+If `minibuffer-completion-confirm' value is t,
+don't exit and send message 'no match'."
+  (interactive)
+  (with-helm-alive-p
+    (if (and (helm--updating-p)
+             (null helm--reading-passwd-or-string))
+        (progn (message "[Display not ready]")
+               (sit-for 0.5) (message nil))
+        (let* ((empty-buffer-p (with-current-buffer helm-buffer
+                                 (eq (point-min) (point-max))))
+               (sel (helm-get-selection))
+               (unknown (and (not empty-buffer-p)
+                             (string= (get-text-property
+                                       0 'display
+                                       (helm-get-selection nil 'withprop))
+                                      "[?]"))))
+          (cond ((and (or empty-buffer-p unknown)
+                      (eq minibuffer-completion-confirm 'confirm))
+                 (setq helm-minibuffer-confirm-state
+                       'confirm)
+                 (setq minibuffer-completion-confirm nil)
+                 (minibuffer-message " [confirm]"))
+                ((and (or empty-buffer-p
+                          (unless (if minibuffer-completing-file-name
+                                      (and minibuffer-completion-predicate
+                                           (funcall minibuffer-completion-predicate sel))
+                                      (and (stringp sel)
+                                           ;; SEL may be a cons cell when helm-comp-read
+                                           ;; is called directly with a collection composed
+                                           ;; of (display . real) and real is a cons cell.
+                                           (try-completion sel minibuffer-completion-table
+                                                           minibuffer-completion-predicate)))
+                            unknown))
+                      (eq minibuffer-completion-confirm t))
+                 (minibuffer-message " [No match]"))
+                (t
+                 (setq helm-minibuffer-confirm-state nil)
+                 (helm-exit-minibuffer)))))))
+(put 'helm-confirm-and-exit-minibuffer 'helm-only t)
+
+(add-hook 'helm-after-update-hook 'helm-confirm-and-exit-hook)
+
+(defun helm-confirm-and-exit-hook ()
+  "Restore `minibuffer-completion-confirm' when helm update."
+  (unless (or (eq minibuffer-completion-confirm t)
+              (not helm-minibuffer-confirm-state))
+    (setq minibuffer-completion-confirm
+          helm-minibuffer-confirm-state)))
+
+(defun helm-read-string (prompt &optional initial-input history
+                                  default-value inherit-input-method)
+  "Same as `read-string' but for reading string from a helm session."
+  (let ((helm--reading-passwd-or-string t))
+    (read-string
+     prompt initial-input history default-value inherit-input-method)))
+
+(defun helm--updating-p ()
+  ;; helm timer is between two cycles.
+  ;; IOW `helm-check-minibuffer-input' haven't yet compared input
+  ;; and `helm-pattern'.
+  (or (not (equal (minibuffer-contents) helm-pattern))
+      ;; `helm-check-minibuffer-input' have launched `helm-update'.
+      helm--in-update))
+
+(defun helm-maybe-exit-minibuffer ()
+  (interactive)
+  (with-helm-alive-p
+    (if (and (helm--updating-p)
+             (null helm--reading-passwd-or-string))
+        (progn (message "[Display not ready]")
+               (sit-for 0.5) (message nil))
+        (helm-exit-minibuffer))))
+(put 'helm-maybe-exit-minibuffer 'helm-only t)
+
+(defun helm-exit-minibuffer ()
+  "Select the current candidate by exiting the minibuffer."
+  (unless helm-current-prefix-arg
+    (setq helm-current-prefix-arg current-prefix-arg))
+  (setq helm-exit-status 0)
+  (helm-log-run-hook 'helm-exit-minibuffer-hook)
+  (exit-minibuffer))
+
+(defun helm-keyboard-quit ()
+  "Quit minibuffer in helm.
+If action buffer is displayed, kill it."
+  (interactive)
+  (with-helm-alive-p
+    (when (get-buffer-window helm-action-buffer 'visible)
+      (kill-buffer helm-action-buffer))
+    (setq helm-exit-status 1)
+    (abort-recursive-edit)))
+(put 'helm-keyboard-quit 'helm-only t)
+
+(defun helm-get-next-header-pos ()
+  "Return the position of the next header from point."
+  (next-single-property-change (point) 'helm-header))
+
+(defun helm-get-previous-header-pos ()
+  "Return the position of the previous header from point."
+  (previous-single-property-change (point) 'helm-header))
+
+(defun helm-pos-multiline-p ()
+  "Return non-nil if the current position is in the multiline source region."
+  (get-text-property (point) 'helm-multiline))
+
+(defun helm-get-next-candidate-separator-pos ()
+  "Return the position of the next candidate separator from point."
+  (let ((hp (helm-get-next-header-pos)))
+    (helm-aif (next-single-property-change (point) 'helm-candidate-separator)
+        (or
+         ;; Be sure we don't catch
+         ;; the separator of next source.
+         (and hp (< it hp) it)
+         ;; The separator found is in next source
+         ;; we are at last cand, so use the header pos.
+         (and hp (< hp it) hp)
+         ;; A single source, just try next separator.
+         it))))
+
+(defun helm-get-previous-candidate-separator-pos ()
+  "Return the position of the previous candidate separator from point."
+  (previous-single-property-change (point) 'helm-candidate-separator))
+
+(defun helm-pos-header-line-p ()
+  "Return t if the current line is a header line."
+  (or (get-text-property (point-at-bol) 'helm-header)
+      (get-text-property (point-at-bol) 'helm-header-separator)))
+
+(defun helm-pos-candidate-separator-p ()
+  "Return t if the current line is a candidate separator."
+  (get-text-property (point-at-bol) 'helm-candidate-separator))
+
+\f
+;;; Debugging
+;;
+;;
+(defun helm-debug-output ()
+  "Show all helm-related variables at this time."
+  (interactive)
+  (with-helm-alive-p
+    (helm-help-internal " *Helm Debug*" 'helm-debug-output-function)))
+(put 'helm-debug-output 'helm-only t)
+
+(defun helm-debug-output-function (&optional vars)
+  (message "Calculating all helm-related values...")
+  (insert "If you debug some variables or forms, set `helm-debug-variables'
+to a list of forms.\n\n")
+  (cl-dolist (v (or vars
+                    helm-debug-variables
+                    (apropos-internal "^helm-" 'boundp)))
+    (insert "** "
+            (pp-to-string v) "\n"
+            (pp-to-string (with-current-buffer helm-buffer (eval v))) "\n"))
+  (message "Calculating all helm-related values...Done"))
+
+;;;###autoload
+(defun helm-debug-toggle ()
+  "Enable/disable helm debug from outside of helm session."
+  (interactive)
+  (setq helm-debug (not helm-debug))
+  (message "Helm Debug is now %s"
+           (if helm-debug "Enabled" "Disabled")))
+
+(defun helm-enable-or-switch-to-debug ()
+  "First hit enable helm debugging, second hit switch to debug buffer."
+  (interactive)
+  (with-helm-alive-p
+    (if helm-debug
+        (helm-run-after-exit
+         #'helm-debug-open-last-log)
+        (setq helm-debug t)
+        (message "Debugging enabled"))))
+(put 'helm-enable-or-switch-to-debug 'helm-only t)
+
+\f
+;; Core: misc
+(defun helm-kill-buffer-hook ()
+  "Remove tick entry from `helm-tick-hash' and remove buffer from
+`helm-buffers' when killing a buffer."
+  (cl-loop for key being the hash-keys in helm-tick-hash
+        if (string-match (format "^%s/" (regexp-quote (buffer-name))) key)
+        do (remhash key helm-tick-hash))
+  (setq helm-buffers (remove (buffer-name) helm-buffers)))
+(add-hook 'kill-buffer-hook 'helm-kill-buffer-hook)
+
+(defun helm-preselect (candidate-or-regexp &optional source)
+  "Move `helm-selection-overlay' to CANDIDATE-OR-REGEXP on startup.
+Arg CANDIDATE-OR-REGEXP can be a string or a cons cell of two strings.
+When it is a cons cell helm will try to jump first to first element of cons cell
+and then to second, allowing a finer preselection when possible duplicates are
+before the candidate we want to preselect."
+  (with-helm-window
+    (when candidate-or-regexp
+      (if (and helm-force-updating-p source)
+          (helm-goto-source source)
+        (goto-char (point-min))
+        (forward-line 1))
+      (let ((start (point)))
+        (or
+         (if (consp candidate-or-regexp)
+             (and (re-search-forward (car candidate-or-regexp) nil t)
+                  (re-search-forward (cdr candidate-or-regexp) nil t))
+             (re-search-forward candidate-or-regexp nil t))
+         (goto-char start))))
+    (forward-line 0) ; Avoid scrolling right on long lines.
+    (when (helm-pos-multiline-p)
+      (helm-move--beginning-of-multiline-candidate))
+    (when (helm-pos-header-line-p) (forward-line 1))
+    (helm-mark-current-line)
+    (helm-display-mode-line (helm-get-current-source))
+    (helm-log-run-hook 'helm-after-preselection-hook)))
+
+(defun helm-delete-current-selection ()
+  "Delete the currently selected item."
+  (with-helm-window
+    (cond ((helm-pos-multiline-p)
+           (helm-aif (helm-get-next-candidate-separator-pos)
+               (delete-region (point-at-bol)
+                              (1+ (progn (goto-char it) (point-at-eol))))
+             ;; last candidate
+             (goto-char (helm-get-previous-candidate-separator-pos))
+             (delete-region (point-at-bol) (point-max)))
+           (when (helm-end-of-source-p)
+             (goto-char (or (helm-get-previous-candidate-separator-pos)
+                            (point-min)))
+             (forward-line 1)))
+          (t
+           (delete-region (point-at-bol) (1+ (point-at-eol)))
+           (when (helm-end-of-source-p t)
+             (let ((headp (save-excursion
+                            (forward-line -1)
+                            (not (helm-pos-header-line-p)))))
+               (and headp (forward-line -1))))))
+    (unless (helm-end-of-source-p t)
+      (helm-mark-current-line))))
+
+(defun helm-end-of-source-p (&optional at-point)
+  "Return non--nil if we are at eob or end of source."
+  (save-excursion
+    (if (and (helm-pos-multiline-p) (null at-point))
+        (null (helm-get-next-candidate-separator-pos))
+      (forward-line (if at-point 0 1))
+      (or (eq (point-at-bol) (point-at-eol))
+          (helm-pos-header-line-p)
+          (eobp)))))
+
+(defun helm-beginning-of-source-p (&optional at-point)
+  "Return non--nil if we are at bob or beginning of source."
+  (save-excursion
+    (if (and (helm-pos-multiline-p) (null at-point))
+        (null (helm-get-previous-candidate-separator-pos))
+      (forward-line (if at-point 0 -1))
+      (or (eq (point-at-bol) (point-at-eol))
+          (helm-pos-header-line-p)
+          (bobp)))))
+
+(defun helm-edit-current-selection-internal (func)
+  (with-helm-window
+    (forward-line 0)
+    (let ((realvalue (get-text-property (point) 'helm-realvalue))
+          (multiline (get-text-property (point) 'helm-multiline)))
+      (funcall func)
+      (forward-line 0)
+      (and realvalue
+           (put-text-property (point) (point-at-eol)
+                              'helm-realvalue realvalue))
+      (and multiline
+           (put-text-property (point) (point-at-eol)
+                              'helm-multiline multiline))
+      (helm-mark-current-line))))
+
+(defmacro helm-edit-current-selection (&rest forms)
+  "Evaluate FORMS at current selection in the helm buffer.
+Used generally to modify current selection."
+  (declare (indent 0) (debug t))
+  `(helm-edit-current-selection-internal
+    (lambda () ,@forms)))
+
+(defun helm--delete-minibuffer-contents-from (from-str)
+  ;; Giving an empty string value to FROM-STR delete all.
+  (let ((input (minibuffer-contents)))
+    (helm-reset-yank-point)
+    (if (> (length input) 0)
+        ;; minibuffer is not empty, delete contents from end
+        ;; of FROM-STR and update.
+        (helm-set-pattern from-str)
+        ;; minibuffer is already empty, force update.
+        (helm-force-update))))
+
+(defun helm-delete-minibuffer-contents (&optional arg)
+  "Delete minibuffer contents.
+When `helm-delete-minibuffer-contents-from-point' is non--nil,
+delete minibuffer contents from point instead of deleting all.
+Giving a prefix arg reverse this behavior.
+When at end of minibuffer delete all."
+  (interactive "P")
+  (let ((str (if helm-delete-minibuffer-contents-from-point
+                 (if (or arg (eobp))
+                     "" (helm-minibuffer-completion-contents))
+                 (if (and arg (not (eobp)))
+                     (helm-minibuffer-completion-contents) ""))))
+    (helm--delete-minibuffer-contents-from str)))
+
+\f
+;;; Plugins (Deprecated in favor of helm-types)
+;;
+;; i.e Inherit instead of helm-type-* classes in your own classes.
+
+;; [DEPRECATED] Enable multi-match by default in old sources.
+;; This is deprecated and will not run in sources
+;; created by helm-source.
+;; Keep it for backward compatibility with old sources.
+(defun helm-compile-source--multi-match (source)
+  (if (assoc 'no-matchplugin source)
+      source
+    (let* ((searchers        helm-mm-default-search-functions)
+           (defmatch         (helm-aif (assoc-default 'match source)
+                                 (helm-mklist it)))
+           (defmatch-strict  (helm-aif (assoc-default 'match-strict source)
+                                 (helm-mklist it)))
+           (defsearch        (helm-aif (assoc-default 'search source)
+                                 (helm-mklist it)))
+           (defsearch-strict (helm-aif (assoc-default 'search-strict source)
+                                 (helm-mklist it)))
+           (matchfns         (cond (defmatch-strict)
+                                   (defmatch
+                                    (append helm-mm-default-match-functions defmatch))
+                                   (t helm-mm-default-match-functions)))
+           (searchfns        (cond (defsearch-strict)
+                                   (defsearch
+                                    (append searchers defsearch))
+                                   (t searchers))))
+      `(,(if (assoc 'candidates-in-buffer source)
+             `(search ,@searchfns) `(match ,@matchfns))
+         ,@source))))
+
+(add-to-list 'helm-compile-source-functions 'helm-compile-source--multi-match)
+
+(defun helm-compile-source--type (source)
+  (helm-aif (assoc-default 'type source)
+      (append source (assoc-default it helm-type-attributes) nil)
+    source))
+
+(defun define-helm-type-attribute (type definition &optional doc)
+  "Register type attribute of TYPE as DEFINITION with DOC.
+DOC is displayed in `helm-type-attributes' docstring.
+
+Use this function is better than setting `helm-type-attributes' directly."
+  (cl-loop for i in definition do
+        ;; without `ignore-errors', error at emacs22
+        (ignore-errors (setf i (delete nil i))))
+  (helm-add-type-attribute type definition)
+  (and doc (helm-document-type-attribute type doc))
+  nil)
+
+(defun helm-document-attribute (attribute short-doc &optional long-doc)
+  "Register ATTRIBUTE documentation introduced by plug-in.
+SHORT-DOC is displayed beside attribute name.
+LONG-DOC is displayed below attribute name and short documentation."
+  (declare (indent 2))
+  (if long-doc
+      (setq short-doc (concat "(" short-doc ")"))
+    (setq long-doc short-doc
+          short-doc ""))
+  (add-to-list 'helm-attributes attribute t)
+  (put attribute 'helm-attrdoc
+       (concat "- " (symbol-name attribute)
+               " " short-doc "\n\n" long-doc "\n")))
+
+(defun helm-add-type-attribute (type definition)
+  (helm-aif (assq type helm-type-attributes)
+      (setq helm-type-attributes (delete it helm-type-attributes)))
+  (push (cons type definition) helm-type-attributes))
+
+(defun helm-document-type-attribute (type doc)
+  (add-to-list 'helm-types type t)
+  (put type 'helm-typeattrdoc
+       (concat "- " (symbol-name type) "\n\n" doc "\n")))
+
+;; Built-in plug-in: dummy
+(defun helm-dummy-candidate (_candidate _source)
+  "Use `helm-pattern' as CANDIDATE in SOURCE."
+  ;; `source' is defined in filtered-candidate-transformer
+  (list helm-pattern))
+
+(defun helm-compile-source--dummy (source)
+  (if (assoc 'dummy source)
+      (progn
+        (unless (helm-attr-defined
+                 'filtered-candidate-transformer source)
+          (helm-attrset 'filtered-candidate-transformer
+                        'helm-dummy-candidate source))
+        (append source
+                '((candidates "dummy")
+                  (accept-empty)
+                  (match identity)
+                  (volatile))))
+    source))
+
+;; Built-in plug-in: candidates-in-buffer
+(defun helm-candidates-in-buffer (&optional source)
+  "The top level function used to store candidates in `helm-source-in-buffer'.
+
+Candidates are stored in a buffer generated internally by the function
+`helm-candidate-buffer'.  Each candidate must be placed in one line.
+This function is meant to be used in candidates-in-buffer or candidates
+attribute of an helm source.  Especially fast for many (1000+) candidates.
+
+The buffer is created and feeded in the init attribute function of helm.
+
+e.g:
+
+     (helm-build-in-buffer-source \"test\"
+       :init (lambda ()
+               (helm-init-candidates-in-buffer
+                   'global '(foo foa fob bar baz))))
+
+A shortcut can be used to simplify:
+
+     (helm-build-in-buffer-source \"test\"
+       :data '(foo foa fob bar baz))
+
+The usage of the `candidates-in-buffer' is deprecated in favor
+of `helm-source-in-buffer' class.
+
+It is anyway described below and provided for backward compatibility.
+
+By default, `helm' makes candidates by evaluating the
+candidates function, then narrows them by `string-match' for each
+candidate.
+
+But this way is very slow for many candidates. The new way is
+storing all candidates in a buffer and narrowing them by
+`re-search-forward'. Search function is customizable by search
+attribute. The important point is that buffer processing is MUCH
+FASTER than string list processing and is the Emacs way.
+
+The init function writes all candidates to a newly-created
+candidate buffer.  The candidates buffer is created or specified
+by `helm-candidate-buffer'.  Candidates are stored in a line.
+
+The candidates function narrows all candidates, IOW creates a
+subset of candidates dynamically. It is the task of
+`helm-candidates-in-buffer'.  As long as
+`helm-candidate-buffer' is used,`(candidates-in-buffer)' is
+sufficient in most cases.
+
+Note that `(candidates-in-buffer)' is shortcut of three attributes:
+  (candidates . helm-candidates-in-buffer)
+  (volatile)
+  (match identity)
+And `(candidates-in-buffer . func)' is shortcut of three attributes:
+  (candidates . func)
+  (volatile)
+  (match identity)
+The expansion is performed in `helm-get-sources'.
+
+The `candidates-in-buffer' attribute implies the volatile attribute.
+The volatile attribute is needed because `helm-candidates-in-buffer'
+creates candidates dynamically and need to be called everytime
+`helm-pattern' changes.
+
+Because `helm-candidates-in-buffer' plays the role of `match' attribute
+function, specifying `(match identity)' makes the source slightly faster.
+
+However if source contain `match-part' attribute, match is computed only
+on part of candidate returned by the call of function provided by this attribute.
+The function should have one arg, candidate, and return only
+a specific part of candidate.
+
+To customize `helm-candidates-in-buffer' behavior, use `search',
+`get-line' and `match-part' attributes."
+  (let ((src (or source (helm-get-current-source))))
+    (helm-candidates-in-buffer-1
+     (helm-candidate-buffer)
+     helm-pattern
+     (or (assoc-default 'get-line src)
+         #'buffer-substring-no-properties)
+     (or (assoc-default 'search src)
+         '(helm-candidates-in-buffer-search-default-fn))
+     (helm-candidate-number-limit src)
+     (helm-attr 'match-part)
+     src)))
+
+(defun helm-candidates-in-buffer-search-default-fn (pattern)
+  "Search PATTERN with `re-search-forward' with bound and noerror args."
+  (condition-case _err
+      (re-search-forward pattern nil t)
+    (invalid-regexp nil)))
+
+(defun helm-candidates-in-buffer-1 (buffer pattern get-line-fn
+                                    search-fns limit
+                                    match-part-fn source)
+  "Return the list of candidates inserted in BUFFER matching PATTERN."
+  ;; buffer == nil when candidates buffer does not exist.
+  (when buffer
+    (with-current-buffer buffer
+      (let ((inhibit-point-motion-hooks t)
+            (start-point (1- (point-min))))
+        (goto-char start-point)
+        (if (string= pattern "")
+            (helm-initial-candidates-from-candidate-buffer
+             get-line-fn limit)
+          (helm-search-from-candidate-buffer
+           pattern get-line-fn search-fns limit
+           start-point match-part-fn source))))))
+
+
+(defun helm-search-from-candidate-buffer (pattern get-line-fn search-fns
+                                          limit start-point match-part-fn source)
+  (let (buffer-read-only)
+    (helm--search-from-candidate-buffer-1
+     (lambda ()
+       (cl-loop with hash = (make-hash-table :test 'equal)
+                with allow-dups = (assq 'allow-dups source)
+                with case-fold-search = (helm-set-case-fold-search)
+                with count = 0
+                for iter from 1
+                for searcher in search-fns
+                do (progn
+                     (goto-char start-point)
+                     ;; The character at start-point is a newline,
+                     ;; if pattern match it that's mean we are
+                     ;; searching for newline in buffer, in this
+                     ;; case skip this false line.
+                     ;; See comment >>>[1] in
+                     ;; `helm--search-from-candidate-buffer-1'.
+                     (and (looking-at pattern) (forward-line 1)))
+                nconc
+                (cl-loop with pos-lst
+                         while (and (setq pos-lst (funcall searcher pattern))
+                                    (not (eobp))
+                                    (< count limit))
+                         for cand = (apply get-line-fn
+                                           (if (and pos-lst (listp pos-lst))
+                                               pos-lst
+                                               (list (point-at-bol) (point-at-eol))))
+                         for dup = (gethash cand hash)
+                         when (and (or (and allow-dups dup (= dup iter))
+                                       (null dup))
+                                   (or
+                                    ;; Always collect when cand is matched
+                                    ;; by searcher funcs and match-part attr
+                                    ;; is not present.
+                                    (and (not match-part-fn)
+                                         (not (consp pos-lst)))
+                                    ;; If match-part attr is present, or if SEARCHER fn
+                                    ;; returns a cons cell, collect PATTERN only if it
+                                    ;; match the part of CAND specified by
+                                    ;; the match-part func.
+                                    (helm-search-match-part
+                                     cand pattern (or match-part-fn #'identity))))
+                         do (progn
+                              (puthash cand iter hash)
+                              (helm--maybe-process-filter-one-by-one-candidate cand source)
+                              (cl-incf count))
+                         and collect cand))))))
+
+(defun helm-search-match-part (candidate pattern match-part-fn)
+  "Match PATTERN only on part of CANDIDATE returned by MATCH-PART-FN.
+Because `helm-search-match-part' maybe called even if unspecified
+in source (negation), MATCH-PART-FN default to `identity'
+to match whole candidate.
+When using fuzzy matching and negation (i.e \"!\"),
+this function is always called."
+  (let ((part (funcall match-part-fn candidate))
+        (fuzzy-regexp (cadr (gethash 'helm-pattern helm--fuzzy-regexp-cache)))
+        (matchfn (if helm-migemo-mode
+                     'helm-mm-migemo-string-match 'string-match)))
+    (if (string-match " " pattern)
+        (cl-loop for i in (split-string pattern) always
+                 (if (string-match "\\`!" i)
+                     (not (funcall matchfn (substring i 1) part))
+                     (funcall matchfn i part)))
+        (if (string-match "\\`!" pattern)
+            (if helm--in-fuzzy
+                ;; Fuzzy regexp have already been
+                ;; computed with substring 1.
+                (not (string-match fuzzy-regexp part))
+                (not (funcall matchfn (substring pattern 1) part)))
+            (funcall matchfn (if helm--in-fuzzy fuzzy-regexp pattern) part)))))
+
+(defun helm-initial-candidates-from-candidate-buffer (get-line-fn limit)
+  (delq nil (cl-loop for i from 1 to limit
+                     until (eobp)
+                     collect (funcall get-line-fn
+                                      (point-at-bol) (point-at-eol))
+                     do (forward-line 1))))
+
+(defun helm--search-from-candidate-buffer-1 (search-fn)
+  ;; We are adding a newline at bob and at eol
+  ;; and removing these newlines afterward.
+  ;; This is a bad hack that should be removed.
+  ;; To avoid matching the empty line at first line
+  ;; when searching with e.g occur and "^$" just
+  ;; forward-line before searching (See >>>[1] above).
+  (goto-char (point-min))
+  (insert "\n")
+  (goto-char (point-max))
+  (insert "\n")
+  (unwind-protect
+       (funcall search-fn)
+    (goto-char (point-min))
+    (delete-char 1)
+    (goto-char (1- (point-max)))
+    (delete-char 1)
+    (set-buffer-modified-p nil)))
+
+(defun helm-candidate-buffer (&optional create-or-buffer)
+  "Register and return a buffer containing candidates of current source.
+`helm-candidate-buffer' searches buffer-local candidates buffer first,
+then global candidates buffer.
+
+Acceptable values of CREATE-OR-BUFFER:
+
+- nil (omit)
+  Only return the candidates buffer.
+- a buffer
+  Register a buffer as a candidates buffer.
+- 'global
+  Create a new global candidates buffer,
+  named \" *helm candidates:SOURCE*\".
+- other non-nil value
+  Create a new local candidates buffer,
+  named \" *helm candidates:SOURCE*HELM-CURRENT-BUFFER\"."
+  (let* ((global-bname (format " *helm candidates:%s*"
+                               helm-source-name))
+         (local-bname (format " *helm candidates:%s*%s"
+                              helm-source-name
+                              (buffer-name helm-current-buffer)))
+         (register-func
+          (lambda ()
+            (setq helm-candidate-buffer-alist
+                  (cons (cons helm-source-name create-or-buffer)
+                        (delete (assoc helm-source-name
+                                       helm-candidate-buffer-alist)
+                                helm-candidate-buffer-alist)))))
+         (kill-buffers-func
+          (lambda ()
+            (cl-loop for b in (buffer-list)
+                     if (string-match (format "^%s" (regexp-quote global-bname))
+                                      (buffer-name b))
+                     do (kill-buffer b))))
+         (create-func
+          (lambda ()
+            (with-current-buffer
+                (get-buffer-create (if (eq create-or-buffer 'global)
+                                       global-bname
+                                       local-bname))
+              (set (make-local-variable 'inhibit-read-only) t) ; Fix (#1176)
+              (buffer-disable-undo)
+              (erase-buffer)
+              (font-lock-mode -1))))
+         (return-func
+          (lambda ()
+            (or (get-buffer local-bname)
+                (get-buffer global-bname)
+                (helm-aif (assoc-default helm-source-name
+                                         helm-candidate-buffer-alist)
+                    (and (buffer-live-p it) it))))))
+    (when create-or-buffer
+      (funcall register-func)
+      (unless (bufferp create-or-buffer)
+        (and (eq create-or-buffer 'global) (funcall kill-buffers-func))
+        (funcall create-func)))
+    (funcall return-func)))
+
+(defun helm-init-candidates-in-buffer (buffer data)
+  "Register BUFFER with DATA for a helm candidates-in-buffer session.
+Arg BUFFER can be a string, a buffer object (bufferp), or a symbol,
+either 'local or 'global which is passed to `helm-candidate-buffer'.
+Arg DATA can be either a list or a plain string.
+Returns the resulting buffer."
+  (declare (indent 1))
+  (let ((buf (helm-candidate-buffer
+              (if (or (stringp buffer)
+                      (bufferp buffer))
+                  (get-buffer-create buffer)
+                buffer)))) ; a symbol.
+    (with-current-buffer buf
+      (erase-buffer)
+      (if (listp data)
+          (insert (mapconcat (lambda (i)
+                               (cond ((symbolp i) (symbol-name i))
+                                     ((numberp i) (number-to-string i))
+                                     (t i)))
+                             data "\n"))
+        (and (stringp data) (insert data))))
+    buf))
+
+(defun helm-compile-source--candidates-in-buffer (source)
+  (helm-aif (assoc 'candidates-in-buffer source)
+      (append source
+              `((candidates . ,(or (cdr it)
+                                   (lambda ()
+                                     (helm-candidates-in-buffer source))))
+                (volatile) (match identity)))
+    source))
+
+\f
+;;; Resplit helm window
+;;
+;;
+(defun helm-toggle-resplit-window ()
+  "Toggle resplit helm window, vertically or horizontally."
+  (interactive)
+  (with-helm-alive-p
+    (when helm-prevent-escaping-from-minibuffer
+      (helm-prevent-switching-other-window :enabled nil))
+    (unwind-protect
+         (with-helm-window
+           (if (or helm-full-frame (one-window-p t))
+               (message "Error: Attempt to resplit a single window")
+               (let ((before-height (window-height)))
+                 (delete-window)
+                 (set-window-buffer
+                  (select-window
+                   (if (= (window-height) before-height) ; initial split was horizontal.
+                       ;; Split window vertically with `helm-buffer' placed
+                       ;; on the good side according to actual value of
+                       ;; `helm-split-window-default-side'.
+                       (prog1
+                           (cond ((or (eq helm-split-window-default-side 'above)
+                                      (eq helm-split-window-default-side 'left))
+                                  (split-window
+                                   (selected-window) nil 'above))
+                                 (t (split-window-vertically)))
+                         (setq helm-split-window-state 'vertical))
+                       ;; Split window vertically, same comment as above.
+                       (setq helm-split-window-state 'horizontal)
+                       (cond ((or (eq helm-split-window-default-side 'left)
+                                  (eq helm-split-window-default-side 'above))
+                              (split-window (selected-window) nil 'left))
+                             (t (split-window-horizontally)))))
+                  helm-buffer)))
+           (setq helm--window-side-state (helm--get-window-side-state)))
+      (when helm-prevent-escaping-from-minibuffer
+        (helm-prevent-switching-other-window :enabled t)))))
+(put 'helm-toggle-resplit-window 'helm-only t)
+
+;; Utility: Resize helm window.
+(defun helm-enlarge-window-1 (n)
+  "Enlarge or narrow helm window.
+If N is positive enlarge, if negative narrow."
+  (unless helm-full-frame
+    (let ((horizontal-p (eq helm-split-window-state 'horizontal)))
+      (with-helm-window
+        (enlarge-window n horizontal-p)))))
+
+(defun helm-narrow-window ()
+  "Narrow helm window."
+  (interactive)
+  (with-helm-alive-p
+    (helm-enlarge-window-1 -1)))
+(put 'helm-narrow-window 'helm-only t)
+
+(defun helm-enlarge-window ()
+  "Enlarge helm window."
+  (interactive)
+  (with-helm-alive-p
+    (helm-enlarge-window-1 1)))
+(put 'helm-enlarge-window 'helm-only t)
+
+(defun helm-swap-windows ()
+  "Swap window holding `helm-buffer' with other window."
+  (interactive)
+  (with-helm-alive-p
+    (if (and helm-full-frame (one-window-p t))
+        (error "Error: Can't swap windows in a single window")
+        (let* ((w1          (helm-window))
+               (split-state (eq helm-split-window-state 'horizontal))
+               (w1size      (window-total-size w1 split-state))
+               (b1          (window-buffer w1)) ; helm-buffer
+               (s1          (window-start w1))
+               (cur-frame   (window-frame w1))
+               (w2          (with-selected-window (helm-window)
+                              ;; Don't try to display helm-buffer
+                              ;; in a dedicated window.
+                              (get-window-with-predicate
+                               (lambda (w) (not (window-dedicated-p w)))
+                               1 cur-frame)))
+               (w2size      (window-total-size w2 split-state))
+               (b2          (window-buffer w2)) ; probably helm-current-buffer
+               (s2          (window-start w2))
+               resize)
+          (with-selected-frame (window-frame w1)
+            (helm-replace-buffer-in-window w1 b1 b2)
+            (helm-replace-buffer-in-window w2 b2 b1)
+            (setq resize
+                  (cond ( ;; helm-window is smaller than other window.
+                         (< w1size w2size)
+                         (- (- (max w2size w1size)
+                               (min w2size w1size))))
+                        ( ;; helm-window is larger than other window.
+                         (> w1size w2size)
+                         (- (max w2size w1size)
+                            (min w2size w1size)))
+                        ( ;; windows have probably same size.
+                         t nil)))
+            ;; Maybe resize the window holding helm-buffer.
+            (and resize (window-resize w2 resize split-state))
+            (set-window-start w1 s2 t)
+            (set-window-start w2 s1 t))
+          (setq helm--window-side-state (helm--get-window-side-state))))))
+(put 'helm-swap-windows 'helm-only t)
+
+(defun helm--get-window-side-state ()
+  "Return the position of `helm-window' from `helm-current-buffer'.
+Possible values are 'left 'right 'below or 'above."
+  (let ((side-list '(left right below above)))
+    (cl-loop for side in side-list
+          thereis (and (equal (helm-window)
+                              (window-in-direction
+                               side (get-buffer-window helm-current-buffer t)
+                               t))
+                       side))))
+
+(defun helm-replace-buffer-in-window (window buffer1 buffer2)
+  "Replace BUFFER1 by BUFFER2 in WINDOW registering BUFFER1."
+  (when (get-buffer-window buffer1)
+    (unrecord-window-buffer window buffer1)
+    (set-window-buffer window buffer2)))
+
+;; Utility: select another action by key
+(defun helm-select-nth-action (n)
+  "Select the N nth action for the currently selected candidate."
+  (setq helm-saved-selection (helm-get-selection))
+  (unless helm-saved-selection
+    (error "Nothing is selected"))
+  (setq helm-saved-action
+        (helm-get-nth-action
+         n
+         (if (get-buffer-window helm-action-buffer 'visible)
+             (assoc-default 'candidates (helm-get-current-source))
+             (helm-get-actions-from-current-source))))
+  (helm-maybe-exit-minibuffer))
+
+(defun helm-get-nth-action (n action)
+  (cond ((and (zerop n) (functionp action))
+         action)
+        ((listp action)
+         (or (cdr (elt action n))
+             (error "No such action")))
+        ((and (functionp action) (< 0 n))
+         (error "Sole action"))
+        (t
+         (error "Error in `helm-select-nth-action'"))))
+
+(defun helm-execute-selection-action-at-nth (linum)
+  "Allow to execute default action on candidate at LINUM."
+  (let ((prefarg current-prefix-arg))
+    (if (>= linum 0)
+        (helm-next-line linum)
+        (helm-previous-line (lognot (1- linum))))
+    (setq current-prefix-arg prefarg)
+    (helm-exit-minibuffer)))
+
+;; Utility: Persistent Action
+(defmacro with-helm-display-same-window (&rest body)
+  "Execute BODY in the window used for persistent action.
+Make `pop-to-buffer' and `display-buffer' display in the same window."
+  (declare (indent 0) (debug t))
+  `(let ((display-buffer-function 'helm-persistent-action-display-buffer))
+     ,@body))
+
+(defun helm-initialize-persistent-action ()
+  (set (make-local-variable 'helm-persistent-action-display-window) nil))
+
+(cl-defun helm-execute-persistent-action
+    (&optional (attr 'persistent-action) split-onewindow)
+  "Perform the associated action ATTR without quitting helm.
+ATTR default is 'persistent-action', but it can be anything else.
+In this case you have to add this new attribute to your source.
+
+When `helm-full-frame' or SPLIT-ONEWINDOW are non--nil,
+and `helm-buffer' is displayed in only one window,
+the helm window is splitted to display
+`helm-select-persistent-action-window' in other window
+and keep its visibility."
+  (interactive)
+  (with-helm-alive-p
+    (helm-log "executing persistent-action")
+    (let* ((attr-val (assoc-default attr (helm-get-current-source)))
+           ;; If attr value is a cons, use its car as persistent function
+           ;; and its car to decide if helm window should be splitted.
+           (fn       (if (and (consp attr-val)
+                              ;; maybe a lambda.
+                              (not (functionp attr-val)))
+                         (car attr-val) attr-val))
+           (no-split (and (consp attr-val)
+                          (not (functionp attr-val))
+                          (cdr attr-val))))
+      (with-helm-window
+        (save-selected-window
+          (if no-split
+              (helm-select-persistent-action-window)
+              (helm-select-persistent-action-window
+               (or split-onewindow helm-onewindow-p)))
+          (helm-log "current-buffer = %S" (current-buffer))
+          (let ((helm-in-persistent-action t))
+            (with-helm-display-same-window
+              (helm-execute-selection-action-1
+               nil (or fn (helm-get-actions-from-current-source)) t)
+              (helm-log-run-hook 'helm-after-persistent-action-hook))
+            ;; A typical case is when a persistent action delete
+            ;; the buffer already displayed in
+            ;; `helm-persistent-action-display-window' and `helm-full-frame'
+            ;; is enabled, we end up with the `helm-buffer'
+            ;; displayed in two windows.
+            (when (and helm-onewindow-p
+                       (> (length (window-list)) 1)
+                       (equal (buffer-name
+                               (window-buffer
+                                helm-persistent-action-display-window))
+                              (helm-buffer-get)))
+              (delete-other-windows))))))))
+(put 'helm-execute-persistent-action 'helm-only t)
+
+(defun helm-persistent-action-display-window (&optional split-onewindow)
+  "Return the window that will be used for persistent action.
+If SPLIT-ONEWINDOW is non--nil window will be splitted in persistent action."
+  (with-helm-window
+    (setq helm-persistent-action-display-window
+          (cond ((and (window-live-p helm-persistent-action-display-window)
+                      (not (member helm-persistent-action-display-window
+                                   (get-buffer-window-list helm-buffer))))
+                 helm-persistent-action-display-window)
+                (split-onewindow (split-window))
+                ((get-buffer-window helm-current-buffer))
+                (t (next-window (selected-window) 1))))))
+
+(defun helm-select-persistent-action-window (&optional split-onewindow)
+  "Select the window that will be used for persistent action.
+See `helm-persistent-action-display-window' for how to use SPLIT-ONEWINDOW."
+  (select-window (get-buffer-window (helm-buffer-get)))
+  (select-window
+   (setq minibuffer-scroll-window
+         (helm-persistent-action-display-window split-onewindow))))
+
+(defun helm-persistent-action-display-buffer (buf &optional  action)
+  "Make `pop-to-buffer' and `display-buffer' display in the same window.
+If `helm-persistent-action-use-special-display' is non-nil and
+BUF is to be displayed by `special-display-function', use it.
+Otherwise ignores `special-display-buffer-names' and `special-display-regexps'.
+Argument ACTION if present will be used as second argument of `display-buffer'."
+  (let* ((name (buffer-name buf))
+         display-buffer-function pop-up-windows pop-up-frames
+         ;; Disable `special-display-regexps' and `special-display-buffer-names'
+         ;; unless `helm-persistent-action-use-special-display' is non--nil.
+         (special-display-buffer-names
+          (and helm-persistent-action-use-special-display
+               special-display-buffer-names))
+         (special-display-regexps
+          (and helm-persistent-action-use-special-display
+               special-display-regexps))
+         (same-window-regexps
+          (unless (and helm-persistent-action-use-special-display
+                       (or (member name
+                                   (mapcar (lambda (x) (or (car-safe x) x))
+                                           special-display-buffer-names))
+                           (cl-loop for x in special-display-regexps
+                                 thereis (string-match (or (car-safe x) x)
+                                                       name))))
+            '("."))))
+    ;; Don't loose minibuffer when displaying persistent window in
+    ;; another frame.
+    ;; This happen when the displayed persistent buffer-name is one of
+    ;; `special-display-buffer-names' or match `special-display-regexps'
+    ;; and `helm-persistent-action-use-special-display' is enabled.
+    (with-selected-window (if (or special-display-regexps
+                                  special-display-buffer-names)
+                              (minibuffer-window)
+                            (selected-window))
+      ;; Be sure window of BUF is not dedicated.
+      (set-window-dedicated-p (get-buffer-window buf) nil)
+      (display-buffer buf action))))
+
+;; scroll-other-window(-down)? for persistent-action
+(defun helm-other-window-base (command &optional scroll-amount)
+  (setq scroll-amount (unless (eq scroll-amount 'noscroll)
+                        helm-scroll-amount))
+  (with-selected-window (helm-persistent-action-display-window)
+    (funcall command scroll-amount)))
+
+(defun helm-scroll-other-window ()
+  "Scroll other window (not *Helm* window) upward."
+  (interactive)
+  (with-helm-alive-p (helm-other-window-base 'scroll-up)))
+(put 'helm-scroll-other-window 'helm-only t)
+
+(defun helm-scroll-other-window-down ()
+  "Scroll other window (not *Helm* window) downward."
+  (interactive)
+  (with-helm-alive-p (helm-other-window-base 'scroll-down)))
+(put 'helm-scroll-other-window-down 'helm-only t)
+
+(defun helm-recenter-top-bottom-other-window ()
+  "`recenter-top-bottom' in other window (not *Helm* window)."
+  (interactive)
+  (with-helm-alive-p (helm-other-window-base 'recenter-top-bottom 'noscroll)))
+(put 'helm-recenter-top-bottom-other-window 'helm-only t)
+
+(defun helm-reposition-window-other-window ()
+  "`helm-reposition-window' in other window (not *Helm* window)."
+  (interactive)
+  (with-helm-alive-p (helm-other-window-base 'reposition-window 'noscroll)))
+(put 'helm-reposition-window-other-window 'helm-only t)
+
+
+\f
+;; Utility: Visible Mark
+
+(defun helm-clear-visible-mark ()
+  (with-current-buffer (helm-buffer-get)
+    (mapc 'delete-overlay helm-visible-mark-overlays)
+    (set (make-local-variable 'helm-visible-mark-overlays) nil)))
+
+(defun helm-this-visible-mark ()
+  (cl-loop for o in helm-visible-mark-overlays
+        when (equal (point-at-bol) (overlay-start o))
+        return o))
+
+(defun helm-delete-visible-mark (overlay)
+  (setq helm-marked-candidates
+        (remove
+         (cons (helm-get-current-source) (helm-get-selection))
+         helm-marked-candidates))
+  (delete-overlay overlay)
+  (setq helm-visible-mark-overlays
+        (delq overlay helm-visible-mark-overlays)))
+
+(defun helm-make-visible-mark ()
+  (let ((o (make-overlay (point-at-bol)
+                          (if (helm-pos-multiline-p)
+                              (or (helm-get-next-candidate-separator-pos)
+                                  (point-max))
+                            (1+ (point-at-eol))))))
+    (overlay-put o 'priority 0)
+    (overlay-put o 'face   'helm-visible-mark)
+    (overlay-put o 'source (assoc-default 'name (helm-get-current-source)))
+    (overlay-put o 'string (buffer-substring (overlay-start o) (overlay-end o)))
+    (overlay-put o 'real   (helm-get-selection))
+    (add-to-list 'helm-visible-mark-overlays o))
+  (push (cons (helm-get-current-source) (helm-get-selection))
+        helm-marked-candidates))
+
+(defun helm-toggle-visible-mark ()
+  "Toggle helm visible mark at point."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-window
+      (let ((nomark (assq 'nomark (helm-get-current-source))))
+        (if nomark
+            (message "Marking not allowed in this source")
+            (helm-aif (helm-this-visible-mark)
+                (helm-delete-visible-mark it)
+              (helm-make-visible-mark))
+            (if (helm-end-of-source-p)
+                (helm-display-mode-line (helm-get-current-source))
+                (helm-next-line)))))))
+(put 'helm-toggle-visible-mark 'helm-only t)
+
+(defun helm-file-completion-source-p ()
+  "Return non--nil if current source is a file completion source."
+  (or minibuffer-completing-file-name
+      (let ((cur-source (cdr (assoc 'name (helm-get-current-source)))))
+        (cl-loop for i in helm--file-completion-sources
+              thereis (string= cur-source i)))))
+
+(defun helm-mark-all ()
+  "Mark all visible unmarked candidates in current source."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-window
+      (let ((nomark (assq 'nomark (helm-get-current-source)))
+            (follow (if helm-follow-mode 1 -1)))
+        (helm-follow-mode -1)
+        (unwind-protect
+             (if nomark
+                 (message "Marking not allowed in this source")
+                 (save-excursion
+                   (goto-char (helm-get-previous-header-pos))
+                   (helm-next-line)
+                   (let* ((next-head (helm-get-next-header-pos))
+                          (end       (and next-head
+                                          (save-excursion
+                                            (goto-char next-head)
+                                            (forward-line -1)
+                                            (point))))
+                          (maxpoint  (or end (point-max))))
+                     (while (< (point) maxpoint)
+                       (helm-mark-current-line)
+                       (let* ((prefix (get-text-property (point-at-bol) 'display))
+                              (cand   (helm-get-selection))
+                              (bn     (and (helm-file-completion-source-p)
+                                           (helm-basename cand)))
+                              (src-name    (assoc-default 'name
+                                                          (helm-get-current-source))))
+                         (when (and (not (helm-this-visible-mark))
+                                    (not (or (string= prefix "[?]")
+                                             (string= prefix "[@]"))))
+                           ;; Don't mark possibles directories ending with . or ..
+                           ;; autosave files/links and non--existent file.
+                           (unless
+                               (and (or (helm-file-completion-source-p)
+                                        (string=
+                                         src-name "Files from Current Directory"))
+                                    (or (string-match
+                                         "^[.]?#.*#?$\\|[^#]*[.]\\{1,2\\}$" bn)
+                                        ;; We need to test here when not using
+                                        ;; a transformer that tag prefix
+                                        ;; (i.e on tramp).
+                                        (not (file-exists-p cand))))
+                             (helm-make-visible-mark))))
+                       (if (helm-pos-multiline-p)
+                           (progn
+                             (goto-char
+                              (or (helm-get-next-candidate-separator-pos)
+                                  (point-max)))
+                             (forward-line 1))
+                           (forward-line 1))
+                       (end-of-line))))
+                 (helm-mark-current-line))
+          (helm-follow-mode follow) (message nil))))))
+(put 'helm-mark-all 'helm-only t)
+
+(defun helm-unmark-all ()
+  "Unmark all candidates in all sources of current helm session."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-window
+      (save-excursion
+        (helm-clear-visible-mark))
+      (setq helm-marked-candidates nil)
+      (helm-mark-current-line)
+      (helm-display-mode-line (helm-get-current-source)))))
+(put 'helm-unmark-all 'helm-only t)
+
+(defun helm-toggle-all-marks ()
+  "Toggle all marks.
+Mark all visible candidates of current source or unmark all candidates
+visible or invisible in all sources of current helm session"
+  (interactive)
+  (with-helm-alive-p
+    (let ((marked (helm-marked-candidates)))
+      (if (and (>= (length marked) 1)
+               (with-helm-window helm-visible-mark-overlays))
+          (helm-unmark-all)
+          (helm-mark-all)))))
+(put 'helm-toggle-all-marks 'helm-only t)
+
+(defun helm--compute-marked (real source wildcard)
+  (let* ((coerced (helm-coerce-selection real source))
+         (wilds   (and wildcard
+                       (condition-case nil
+                           (helm-file-expand-wildcards coerced t)
+                         (error nil)))))
+    ;; Avoid returning a not expanded wilcard fname.
+    ;; e.g assuming "/tmp" doesn't contain "*.el"
+    ;; return nil when coerced is "/tmp/*.el".
+    (unless (or wilds (null wildcard)
+                (string-match-p helm--url-regexp coerced)
+                (file-exists-p coerced)
+                (and (stringp coerced)
+                     (null (string-match-p "[[*?]" coerced))))
+      (setq coerced nil))
+    (or wilds (and coerced (list coerced)))))
+
+(cl-defun helm-marked-candidates (&key with-wildcard)
+  "Return marked candidates of current source if any.
+Otherwise one element list of current selection.
+When key WITH-WILDCARD is specified try to expand a wilcard if some."
+  (with-current-buffer helm-buffer
+    (let ((candidates
+           (cl-loop with current-src = (helm-get-current-source)
+                    for (source . real) in (reverse helm-marked-candidates)
+                    when (equal (assq 'name source) (assq 'name current-src))
+                    append (helm--compute-marked real source with-wildcard)
+                    into cands
+                    finally return (or cands
+                                       (append
+                                        (helm--compute-marked
+                                         (helm-get-selection) current-src
+                                         with-wildcard)
+                                        cands)))))
+      (helm-log "Marked candidates = %S" candidates)
+      candidates)))
+
+(defun helm-current-source-name= (name)
+  (save-excursion
+    (goto-char (helm-get-previous-header-pos))
+    (equal name (helm-current-line-contents))))
+
+(defun helm-revive-visible-mark ()
+  "Restore marked candidates when helm update display."
+  (with-current-buffer helm-buffer
+    (save-excursion
+      (cl-dolist (o helm-visible-mark-overlays)
+        (let ((o-src-str (overlay-get o 'source))
+              (o-str (overlay-get o 'string))
+              beg end)
+          ;; Move point to end of source header line.
+          (goto-char (point-min))
+          (search-forward o-src-str nil t)
+          (while (and (search-forward o-str nil t)
+                      (not (overlays-at (point-at-bol 0)))
+                      (helm-current-source-name= o-src-str))
+            (setq beg (match-beginning 0)
+                  end (match-end 0))
+            ;; Calculate real value of candidate.
+            ;; It can be nil if candidate have only a display value.
+            (let ((real (get-text-property (point-at-bol 0) 'helm-realvalue)))
+              (if real
+                  ;; Check if real value of current candidate is the same
+                  ;; than the one stored in overlay.
+                  ;; This is needed when some cands have same display names.
+                  ;; Using equal allow testing any type of value for real cand.
+                  ;; Issue (#706).
+                  (and (equal (overlay-get o 'real) real)
+                       (move-overlay o beg end))
+                  (and (equal o-str (buffer-substring beg end))
+                       (move-overlay o beg end))))))))))
+(add-hook 'helm-update-hook 'helm-revive-visible-mark)
+
+(defun helm-next-point-in-list (curpos points &optional prev)
+  (cond
+    ;; rule out special cases.
+    ((null points) curpos)
+    ((and prev (<= curpos (car points)))
+     (nth (1- (length points)) points))
+    ((< (car (last points)) curpos)
+     (if prev (car (last points)) (nth 0 points)))
+    ((and (not prev) (>= curpos (car (last points))))
+     (nth 0 points))
+    (t
+     (nth (if prev
+              (cl-loop for pt in points
+                    for i from 0
+                    if (<= curpos pt) return (1- i))
+            (cl-loop for pt in points
+                  for i from 0
+                  if (< curpos pt) return i))
+          points))))
+
+(defun helm-next-visible-mark (&optional prev)
+  "Move next helm visible mark.
+If PREV is non-nil move to precedent."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-window
+      (ignore-errors
+        (goto-char (helm-next-point-in-list
+                    (point)
+                    (sort (mapcar 'overlay-start helm-visible-mark-overlays) '<)
+                    prev)))
+      (helm-mark-current-line))))
+(put 'helm-next-visible-mark 'helm-only t)
+
+(defun helm-prev-visible-mark ()
+  "Move previous helm visible mark."
+  (interactive)
+  (with-helm-alive-p
+    (helm-next-visible-mark t)))
+(put 'helm-prev-visible-mark 'helm-only t)
+
+;;; Utility: Selection Paste
+;;
+(defun helm-yank-selection (arg)
+  "Set minibuffer contents to current display selection.
+With a prefix arg set to real value of current selection."
+  (interactive "P")
+  (with-helm-alive-p
+    (let ((str (helm-get-selection nil (not arg))))
+      (kill-new str)
+      (helm-set-pattern str))))
+(put 'helm-yank-selection 'helm-only t)
+
+(defun helm-kill-selection-and-quit (arg)
+  "Store display value of current selection to kill ring.
+With a prefix arg set to real value of current selection.
+Display value is what you see in `helm-buffer' and real value
+is what is used to perform actions."
+  (interactive "P")
+  (with-helm-alive-p
+    (helm-run-after-exit
+     (lambda (sel)
+       (kill-new sel)
+       ;; Return nil to force `helm-mode--keyboard-quit'
+       ;; in `helm-comp-read' otherwise the value "Saved to kill-ring: foo"
+       ;; is used as exit value for `helm-comp-read'.
+       (prog1 nil (message "Saved to kill-ring: %s" sel) (sit-for 1)))
+     (helm-get-selection nil (not arg)))))
+(put 'helm-kill-selection-and-quit 'helm-only t)
+
+(defun helm-copy-to-buffer ()
+  "Copy selection or marked candidates to `helm-current-buffer'."
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-buffer
+      (cl-loop for cand in (helm-marked-candidates)
+               do (with-helm-current-buffer
+                    (insert (format "%s\n" cand)))))))
+(put 'helm-copy-to-buffer 'helm-only t)
+
+\f
+;;; Follow-mode: Automatical execution of persistent-action
+;;
+;;
+(defun helm-follow-mode (&optional arg)
+  "Execute persistent action everytime the cursor is moved when enabled.
+The mode is enabled for the current source only, you will have to turn it
+on again when you go to next source if you want it there also.
+This mode can be enabled or disabled interactively at anytime during
+helm session or enabled specifically by source by adding the `follow'
+attribute to this source.
+Even when the attribute `follow' exists in source, it is still possible
+to disable/enable this mode interactively.
+Note that when you disable it interactively and `follow' attribute exists,
+`helm-follow-mode' will be disabled on next helm session even if `follow'
+attribute is specified in source. To avoid this set your `follow' attribute
+in source in `helm-before-initialize-hook'.
+
+e.g:
+
+\(add-hook 'helm-before-initialize-hook
+          (lambda () (helm-attrset 'follow 1 helm-source-buffers-list)))
+
+This will enable `helm-follow-mode' automatically in `helm-source-buffers-list'."
+  (interactive "p")
+  (with-helm-alive-p
+    (with-current-buffer helm-buffer
+      (let* ((src      (helm-get-current-source))
+             (name     (assoc-default 'name src))
+             (sym      (cl-loop for s in helm-sources
+                                for sname = (and (symbolp s)
+                                                 (assoc-default
+                                                  'name (symbol-value s)))
+                                thereis (and sname (string= sname name) s)))
+             (fol-attr (assq 'follow src))
+             (enabled  (or
+                        ;; If `helm-follow-mode' is called with a negative
+                        ;; ARG, assume follow is already enabled.
+                        ;; i.e turn it off now.
+                        (< arg 0)
+                        (eq (cdr fol-attr) 1)
+                        helm-follow-mode)))
+        (if src
+            (progn
+              (if (eq (cdr fol-attr) 'never)
+                  (message "helm-follow-mode not allowed in this source")
+                  ;; Make follow attr persistent for this emacs session.
+                  (helm-attrset 'follow (if enabled -1 1) src)
+                  (setq helm-follow-mode (not enabled))
+                  (message "helm-follow-mode is %s"
+                           (if helm-follow-mode
+                               "enabled" "disabled"))
+                  (helm-display-mode-line src t))
+              (unless helm-follow-mode-persistent
+                (and sym (set sym (remove (assq 'follow src) src)))))
+            (message "Not enough candidates for helm-follow-mode"))))))
+(put 'helm-follow-mode 'helm-only t)
+
+(defvar helm-follow-input-idle-delay nil
+  "`helm-follow-mode' will execute its persistent action after this delay.
+Note that if the `follow-delay' attr is present in source,
+it will take precedence on this.")
+(defun helm-follow-execute-persistent-action-maybe ()
+  "Execute persistent action in mode `helm-follow-mode'.
+This happen after `helm-input-idle-delay' secs."
+  (let ((src (helm-get-current-source)))
+    (and (not (get-buffer-window helm-action-buffer 'visible))
+         (eq (assoc-default 'follow src) 1)
+         (sit-for (or (assoc-default 'follow-delay src)
+                      helm-follow-input-idle-delay
+                      (and helm-input-idle-delay
+                           (max helm-input-idle-delay 0.01))))
+         (helm-window)
+         (helm-get-selection)
+         (save-excursion
+           (helm-execute-persistent-action)))))
+
+\f
+;;; Auto-resize mode
+;;
+(defun helm--autoresize-hook (&optional max-height min-height)
+  (with-helm-window
+    (fit-window-to-buffer nil
+                          (/ (* (frame-height)
+                                (or max-height helm-autoresize-max-height))
+                             100)
+                          (/ (* (frame-height)
+                                (or min-height helm-autoresize-min-height))
+                             100))))
+
+(define-minor-mode helm-autoresize-mode
+    "Auto resize helm window when enabled.
+Helm window is resized according to values of `helm-autoresize-max-height'
+and `helm-autoresize-min-height'.
+Note that when this mode is enabled, helm behave like when
+`helm-always-two-windows' is enabled.
+
+See `fit-window-to-buffer' for more infos."
+  :group 'helm
+  :global t
+  (if helm-autoresize-mode
+      (progn (add-hook 'helm-after-update-hook 'helm--autoresize-hook)
+             (add-hook 'helm-window-configuration-hook 'helm--autoresize-hook))
+      (remove-hook 'helm-after-update-hook 'helm--autoresize-hook)
+      (remove-hook 'helm-window-configuration-hook 'helm--autoresize-hook)))
+
+(defun helm-help ()
+  "Help of `helm'."
+  (interactive)
+  (with-helm-alive-p
+    (save-selected-window
+      (helm-help-internal
+       "*Helm Help*"
+       (lambda ()
+         (helm-aif (assoc-default 'help-message (helm-get-current-source))
+             (insert (substitute-command-keys
+                      (helm-interpret-value it)))
+           (insert "* No specific help for this source at this time.\n
+It may appear after first results popup in helm buffer."))
+         (insert "\n\n"
+                 (substitute-command-keys
+                  (helm-interpret-value helm-help-message))))))))
+(put 'helm-help 'helm-only t)
+
+(defun helm-toggle-truncate-line ()
+  "Toggle `truncate-lines' value in `helm-buffer'"
+  (interactive)
+  (with-helm-alive-p
+    (with-helm-buffer
+      (setq truncate-lines (not truncate-lines))
+      (helm-update (regexp-quote (helm-get-selection nil t))))))
+(put 'helm-toggle-truncate-line 'helm-only t)
+
+(provide 'helm)
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions obsolete)
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; End:
+
+;;; helm.el ends here
diff --git a/elpa/helm-descbinds-20160108.1947/helm-descbinds-autoloads.el b/elpa/helm-descbinds-20160108.1947/helm-descbinds-autoloads.el
new file mode 100644 (file)
index 0000000..36088bb
--- /dev/null
@@ -0,0 +1,64 @@
+;;; helm-descbinds-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-descbinds" "helm-descbinds.el" (22215
+;;;;;;  7793 0 0))
+;;; Generated autoloads from helm-descbinds.el
+
+(defvar helm-descbinds-mode nil "\
+Non-nil if Helm-Descbinds mode is enabled.
+See the command `helm-descbinds-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `helm-descbinds-mode'.")
+
+(custom-autoload 'helm-descbinds-mode "helm-descbinds" nil)
+
+(autoload 'helm-descbinds-mode "helm-descbinds" "\
+Use `helm' for `describe-bindings'.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'helm-descbinds-install "helm-descbinds" "\
+Use `helm-descbinds' as a replacement of `describe-bindings'.
+
+\(fn)" t nil)
+
+(autoload 'helm-descbinds-uninstall "helm-descbinds" "\
+Restore original `describe-bindings'.
+
+\(fn)" t nil)
+
+(autoload 'helm-descbinds "helm-descbinds" "\
+A convenient helm version of `describe-bindings'.
+
+Turning on `helm-descbinds-mode' is the recommended way to
+install this command to replace `describe-bindings'.
+
+You complete against a list of keys + command pairs presented in
+a similar way as `describe-bindings' does, split into sections
+defined by the types of the key bindings (minor and major modes,
+global bindings, etc).
+
+The default action executes a command as if the binding had been
+entered, or narrows the commands according to a prefix key,
+respectively.
+
+The persistent action pops up a help buffer for the selected
+command without quitting.
+
+For key translation maps, the default actions are not very
+useful, yet they are listed for completeness.
+
+\(fn &optional PREFIX BUFFER)" t nil)
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-descbinds-autoloads.el ends here
diff --git a/elpa/helm-descbinds-20160108.1947/helm-descbinds-pkg.el b/elpa/helm-descbinds-20160108.1947/helm-descbinds-pkg.el
new file mode 100644 (file)
index 0000000..a58f1c3
--- /dev/null
@@ -0,0 +1 @@
+(define-package "helm-descbinds" "20160108.1947" "A convenient `describe-bindings' with `helm'" '((helm "1.5")) :url "https://github.com/emacs-helm/helm-descbinds" :keywords '("helm" "help"))
diff --git a/elpa/helm-descbinds-20160108.1947/helm-descbinds.el b/elpa/helm-descbinds-20160108.1947/helm-descbinds.el
new file mode 100644 (file)
index 0000000..e045648
--- /dev/null
@@ -0,0 +1,297 @@
+;;; helm-descbinds.el --- A convenient `describe-bindings' with `helm'   -*- lexical-binding: t -*-
+
+;; Copyright (C) 2008, 2009, 2010  Taiki SUGAWARA <buzz.taikiNOSPAMgmail.com>
+;; Copyright (C) 2012, 2013  Michael Markert <markert.michaelNOSPAMgooglemail.com>
+;; Copyright (C) 2013 Daniel Hackney <danNOSPAMhaxney.org>
+;; Copyright (C) 2015 Michael Heerdegen <michael_heerdegenNOSPAMweb.de>
+
+;; Author: Taiki SUGAWARA <buzz.taikiNOSPAMgmail.com>
+;; URL: https://github.com/emacs-helm/helm-descbinds
+;; Package-Version: 20160108.1947
+;; Keywords: helm, help
+;; Version: 1.10
+;; Package-Requires: ((helm "1.5"))
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+
+;;; Commentary:
+;; This package is a replacement of `describe-bindings' for Helm.
+
+;; Usage:
+;; 
+;; You can use this package independently from Helm - in particular,
+;; you don't need to turn on `helm-mode' to be able to use this.  Helm
+;; just needs to be installed.
+;;
+;; Add followings on your .emacs.
+;;
+;;   (require 'helm-descbinds)
+;;   (helm-descbinds-mode)
+;;
+;; or use customize to set `helm-descbinds-mode' to t.
+;;
+;; Now, `describe-bindings' is replaced with `helm-descbinds'. As
+;; usual, type `C-h b', or any incomplete key sequence plus C-h , to
+;; run `helm-descbinds'.  The bindings are presented in a similar way
+;; as `describe-bindings ' does, but you can use completion to find
+;; the command you searched for and execute it, or view it's
+;; documentation.
+;;
+;; In the Helm completions buffer, you match key bindings with the
+;; Helm interface:
+;;
+;;  - When you type RET, the selected candidate command is executed.
+;;
+;;  - When you hit RET on a prefix key, the candidates are narrowed to
+;;    this prefix
+;;
+;;  - When you type TAB, you can select "Execute", "Describe" or "Find
+;;    Function" by the menu (i.e. these are the available "actions"
+;;    and are of course also available via their usual shortcuts).
+;;
+;;  - When you type C-z (aka "persistent action"), the selected
+;;    command is described without quitting Helm.
+
+
+
+;;; Code:
+
+(eval-when-compile (require 'cl-lib)) ;cl-loop
+(require 'helm)
+
+(defgroup helm-descbinds nil
+  "A convenient `describe-bindings' with `helm'."
+  :prefix "helm-descbinds-"
+  :group 'helm)
+
+(defcustom helm-descbinds-actions
+  '(("Execute" . helm-descbinds-action:execute)
+    ("Describe" . helm-descbinds-action:describe)
+    ("Find Function" . helm-descbinds-action:find-func))
+  "Actions of selected candidate."
+  :type '(repeat
+         (cons
+          :tag "Action"
+          (string :tag "Name")
+          (function :tag "Function"))))
+
+(defcustom helm-descbinds-candidate-formatter
+  #'helm-descbinds-default-candidate-formatter
+  "Candidate formatter function.
+This function will be called with two arguments KEY and BINDING."
+  :type 'function)
+
+(defcustom helm-descbinds-window-style 'one-window
+  "Window splitting style."
+  :type '(choice
+         (const :tag "One Window" one-window)
+         (const :tag "Same Window" same-window)
+         (const :tag "Split Window" split-window)))
+
+(defcustom helm-descbinds-section-order
+  '("Major Mode Bindings" "Minor Mode Bindings" "Global Bindings")
+  "A list of section order by name regexp."
+  :type '(repeat (regexp :tag "Regexp")))
+
+(defcustom helm-descbinds-source-template
+  `((candidate-transformer . helm-descbinds-transform-candidates)
+    (filtered-candidate-transformer . helm-fuzzy-highlight-matches)
+    (persistent-action . helm-descbinds-action:describe)
+    (action-transformer . helm-descbinds-action-transformer)
+    (action . ,helm-descbinds-actions))
+  "A template of `helm-descbinds' source."
+  :type 'sexp)
+
+(defvar helm-descbinds-Orig-describe-bindings (symbol-function 'describe-bindings))
+(defvar helm-descbind--initial-full-frame helm-full-frame)
+
+;;;###autoload
+(define-minor-mode helm-descbinds-mode
+  "Use `helm' for `describe-bindings'."
+  :group 'helm-descbinds
+  :global t
+  (if helm-descbinds-mode
+      (fset 'describe-bindings #'helm-descbinds) ;FIXME: why don't we just use an :override advice?
+    (fset 'describe-bindings helm-descbinds-Orig-describe-bindings)))
+
+;;;###autoload
+(defun helm-descbinds-install ()
+  "Use `helm-descbinds' as a replacement of `describe-bindings'."
+  (interactive)
+  (helm-descbinds-mode 1))
+(make-obsolete 'helm-descbinds-install 'helm-descbinds-mode "1.08")
+
+;;;###autoload
+(defun helm-descbinds-uninstall ()
+  "Restore original `describe-bindings'."
+  (interactive)
+  (helm-descbinds-mode -1))
+(make-obsolete 'helm-descbinds-uninstall 'helm-descbinds-mode "1.08")
+
+(defun helm-descbinds-all-sections (buffer &optional prefix menus)
+  (with-temp-buffer
+    (let ((indent-tabs-mode t))
+      (describe-buffer-bindings buffer prefix menus))
+    (goto-char (point-min))
+    (let ((header-p (not (= (char-after) ?\f)))
+         sections header section)
+      (while (not (eobp))
+       (cond
+        (header-p
+         (setq header (buffer-substring-no-properties
+                       (point)
+                       (line-end-position)))
+         (setq header-p nil)
+         (forward-line 3))
+        ((= (char-after) ?\f)
+         (push (cons header (nreverse section)) sections)
+         (setq section nil)
+         (setq header-p t))
+        ((looking-at "^[ \t]*$")
+         ;; ignore
+         )
+        (t
+         (let ((binding-start (save-excursion
+                                (and (re-search-forward "\t+" nil t)
+                                     (match-end 0))))
+               key binding)
+           (when binding-start
+             (setq key (buffer-substring-no-properties (point) binding-start)
+                   key (replace-regexp-in-string"^[ \t\n]+" "" key)
+                   key (replace-regexp-in-string"[ \t\n]+$" "" key))
+             (goto-char binding-start)
+             (setq binding (buffer-substring-no-properties
+                            binding-start
+                            (line-end-position)))
+             (unless (member binding '("self-insert-command"))
+               (push (cons key binding) section))))))
+       (forward-line))
+      (push (cons header (nreverse section)) sections)
+      (nreverse sections))))
+
+(defun helm-descbinds-action:execute (candidate)
+  "An action that execute selected CANDIDATE command."
+  (let ((x (cdr candidate))
+        (helm-full-frame helm-descbind--initial-full-frame))
+    (cond
+     ((equal x "Keyboard Macro")
+      (command-execute (kbd (car candidate))))
+     ((stringp x)
+      (insert x))
+     ((commandp x)
+      (run-at-time 0.01 nil (lambda (command) (call-interactively command)) x)))))
+
+(defun helm-descbinds-action:describe (candidate)
+  "An action that describe selected CANDIDATE function."
+  (let ((name (cdr candidate)))
+    (if (equal name "Keyboard Macro")
+        (describe-key (kbd (car candidate)))
+      (describe-function name))))
+
+(defun helm-descbinds-action:find-func (candidate)
+  "An action that find selected CANDIDATE function."
+  (find-function (cdr candidate)))
+
+(defun helm-descbinds-default-candidate-formatter (key binding)
+  "Default candidate formatter."
+  (format "%-10s\t%s" key binding))
+
+(defun helm-descbinds-order-section (section)
+  (cl-loop for n = 0 then (1+ n)
+           for regexp in helm-descbinds-section-order
+           if (and (car section) (string-match regexp (car section)))
+           return n
+           finally
+           return n))
+
+(defun helm-descbinds-transform-candidates (candidates)
+  (mapcar
+   (lambda (pair)
+     (let ((key (car pair))
+           (command (cdr pair)))
+       (cons (funcall helm-descbinds-candidate-formatter key command)
+             (cons key (or (intern-soft command) command)))))
+   candidates))
+
+(defun helm-descbinds-action-transformer (actions cand)
+  "Default action transformer for `helm-descbinds'.
+Provide a useful behavior for prefix commands."
+  (if (equal (cdr-safe cand) "Prefix Command")
+      `(("helm-descbinds this prefix" . ,(lambda (cand) (interactive)
+                                           (run-with-timer
+                                            0 nil
+                                            #'describe-bindings (kbd (car cand))))))
+    actions))
+
+(defun helm-descbinds-sources (buffer &optional prefix menus)
+  (mapcar
+   (lambda (section)
+     (helm-descbinds-source (car section) (cdr section)))
+   (sort
+    (helm-descbinds-all-sections buffer prefix menus)
+    (lambda (a b)
+      (< (helm-descbinds-order-section a)
+         (helm-descbinds-order-section b))))))
+
+(defun helm-descbinds-source (name candidates)
+  `((name . ,name)
+    (candidates . ,candidates)
+    ,@helm-descbinds-source-template))
+
+;;;###autoload
+(defun helm-descbinds (&optional prefix buffer)
+  "A convenient helm version of `describe-bindings'.
+
+Turning on `helm-descbinds-mode' is the recommended way to
+install this command to replace `describe-bindings'.
+
+You complete against a list of keys + command pairs presented in
+a similar way as `describe-bindings' does, split into sections
+defined by the types of the key bindings (minor and major modes,
+global bindings, etc).
+
+The default action executes a command as if the binding had been
+entered, or narrows the commands according to a prefix key,
+respectively.
+
+The persistent action pops up a help buffer for the selected
+command without quitting.
+
+For key translation maps, the default actions are not very
+useful, yet they are listed for completeness."
+  (interactive)
+  (let ((old-helm-full-frame helm-full-frame)
+        (helm-full-frame (and (not (minibufferp))
+                              (memq helm-descbinds-window-style
+                                    '(same-window one-window))))
+        (helm-before-initialize-hook (if (and (not (minibufferp))
+                                              (eq helm-descbinds-window-style
+                                                  'one-window))
+                                         (cons 'delete-other-windows
+                                               helm-before-initialize-hook)
+                                       helm-before-initialize-hook))
+        (enable-recursive-minibuffers t))
+    (setq helm-descbind--initial-full-frame old-helm-full-frame)
+    (helm :sources (helm-descbinds-sources
+                    (or buffer (current-buffer)) prefix)
+          :buffer "*helm-descbinds*"
+          :resume 'noresume
+          :allow-nest t)))
+
+(provide 'helm-descbinds)
+
+;;; helm-descbinds.el ends here
index 2c489faaae0f160eab21ea69eda19910ef541976..fd1b9df98a27cf46b07b44347b87910c41cc7751 100644 (file)
@@ -1 +1,36 @@
-This package is a replacement of `describe-bindings'.
+This package is a replacement of `describe-bindings' for Helm.
+
+Usage:
+
+You can use this package independently from Helm - in particular,
+you don't need to turn on `helm-mode' to be able to use this.  Helm
+just needs to be installed.
+
+Add followings on your .emacs.
+
+  (require 'helm-descbinds)
+  (helm-descbinds-mode)
+
+or use customize to set `helm-descbinds-mode' to t.
+
+Now, `describe-bindings' is replaced with `helm-descbinds'. As
+usual, type `C-h b', or any incomplete key sequence plus C-h , to
+run `helm-descbinds'.  The bindings are presented in a similar way
+as `describe-bindings ' does, but you can use completion to find
+the command you searched for and execute it, or view it's
+documentation.
+
+In the Helm completions buffer, you match key bindings with the
+Helm interface:
+
+ - When you type RET, the selected candidate command is executed.
+
+ - When you hit RET on a prefix key, the candidates are narrowed to
+   this prefix
+
+ - When you type TAB, you can select "Execute", "Describe" or "Find
+   Function" by the menu (i.e. these are the available "actions"
+   and are of course also available via their usual shortcuts).
+
+ - When you type C-z (aka "persistent action"), the selected
+   command is described without quitting Helm.
diff --git a/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el b/elpa/helm-projectile-20150621.1322/helm-projectile-autoloads.el
deleted file mode 100644 (file)
index 2b2d9fe..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-;;; helm-projectile-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-
-\f
-;;;### (autoloads (helm-projectile helm-projectile-ag helm-projectile-ack
-;;;;;;  helm-projectile-grep helm-projectile-off helm-projectile-on
-;;;;;;  helm-projectile-find-other-file helm-projectile-find-file-dwim
-;;;;;;  helm-projectile-fuzzy-match) "helm-projectile" "helm-projectile.el"
-;;;;;;  (21906 14465 0 0))
-;;; Generated autoloads from helm-projectile.el
-
-(defvar helm-projectile-fuzzy-match t "\
-Enable fuzzy matching for Helm Projectile commands.
-This needs to be set before loading helm-projectile.")
-
-(custom-autoload 'helm-projectile-fuzzy-match "helm-projectile" t)
-
-(autoload 'helm-projectile-find-file-dwim "helm-projectile" "\
-Find file at point based on context.
-
-\(fn)" t nil)
-
-(autoload 'helm-projectile-find-other-file "helm-projectile" "\
-Switch between files with the same name but different extensions using Helm.
-With FLEX-MATCHING, match any file that contains the base name of current file.
-Other file extensions can be customized with the variable `projectile-other-file-alist'.
-
-\(fn &optional FLEX-MATCHING)" t nil)
-
-(autoload 'helm-projectile-on "helm-projectile" "\
-Turn on helm-projectile key bindings.
-
-\(fn)" t nil)
-
-(autoload 'helm-projectile-off "helm-projectile" "\
-Turn off helm-projectile key bindings.
-
-\(fn)" t nil)
-
-(autoload 'helm-projectile-grep "helm-projectile" "\
-Helm version of projectile-grep.
-
-\(fn)" t nil)
-
-(autoload 'helm-projectile-ack "helm-projectile" "\
-Helm version of projectile-ack.
-
-\(fn)" t nil)
-
-(autoload 'helm-projectile-ag "helm-projectile" "\
-Helm version of projectile-ag.
-
-\(fn &optional OPTIONS)" t nil)
-
-(autoload 'helm-projectile "helm-projectile" "\
-Use projectile with Helm instead of ido.
-
-With a prefix ARG invalidates the cache first.
-If invoked outside of a project, displays a list of known projects to jump.
-
-\(fn &optional ARG)" t nil)
-
-(eval-after-load 'projectile '(progn (define-key projectile-command-map (kbd "h") 'helm-projectile)))
-
-;;;***
-\f
-;;;### (autoloads nil nil ("helm-projectile-pkg.el") (21906 14465
-;;;;;;  971196 0))
-
-;;;***
-\f
-(provide 'helm-projectile-autoloads)
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; coding: utf-8
-;; End:
-;;; helm-projectile-autoloads.el ends here
diff --git a/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el b/elpa/helm-projectile-20150621.1322/helm-projectile-pkg.el
deleted file mode 100644 (file)
index 70b771d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-(define-package "helm-projectile" "20150621.1322" "Helm integration for Projectile" (quote ((helm "1.4.0") (projectile "0.12.0") (dash "1.5.0") (cl-lib "0.3"))))
diff --git a/elpa/helm-projectile-20150621.1322/helm-projectile.el b/elpa/helm-projectile-20150621.1322/helm-projectile.el
deleted file mode 100644 (file)
index fb51fce..0000000
+++ /dev/null
@@ -1,841 +0,0 @@
-;;; helm-projectile.el --- Helm integration for Projectile
-
-;; Copyright (C) 2011-2015 Bozhidar Batsov
-
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/projectile
-;; Package-Version: 20150621.1322
-;; Created: 2011-31-07
-;; Keywords: project, convenience
-;; Version: 0.12.0
-;; Package-Requires: ((helm "1.4.0") (projectile "0.12.0") (dash "1.5.0") (cl-lib "0.3"))
-
-;; This file is NOT part of GNU Emacs.
-
-;;; License:
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Commentary:
-;;
-;; This library provides easy project management and navigation.  The
-;; concept of a project is pretty basic - just a folder containing
-;; special file.  Currently git, mercurial and bazaar repos are
-;; considered projects by default.  If you want to mark a folder
-;; manually as a project just create an empty .projectile file in
-;; it.  See the README for more details.
-;;
-;;; Code:
-
-(require 'projectile)
-(require 'helm-locate)
-(require 'helm-buffers)
-(require 'helm-files)
-(require 'cl-lib)
-
-(declare-function eshell "eshell")
-(declare-function helm-do-ag "helm-ag")
-(defvar helm-ag-base-command)
-
-(defgroup helm-projectile nil
-  "Helm support for projectile."
-  :prefix "helm-projectile-"
-  :group 'projectile
-  :link `(url-link :tag "helm-projectile homepage" "https://github.com/bbatsov/projectile"))
-
-(defvar helm-projectile-current-project-root)
-
-;;;###autoload
-(defcustom helm-projectile-fuzzy-match t
-  "Enable fuzzy matching for Helm Projectile commands.
-This needs to be set before loading helm-projectile."
-  :group 'helm-projectile
-  :type 'boolean)
-
-(defun helm-projectile-coerce-file (candidate)
-  (with-current-buffer (helm-candidate-buffer)
-    (expand-file-name candidate (projectile-project-root))))
-
-(defmacro helm-projectile-define-key (keymap key def &rest bindings)
-  "In KEYMAP, define key sequence KEY1 as DEF1, KEY2 as DEF2 ..."
-  (declare (indent defun))
-  (let ((ret '(progn)))
-    (while key
-      (push
-       `(define-key ,keymap ,key
-          (lambda ()
-            (interactive)
-            (helm-quit-and-execute-action ,def)))
-       ret)
-      (setq key (pop bindings)
-            def (pop bindings)))
-    (reverse ret)))
-
-(defun helm-projectile-hack-actions (actions &rest prescription)
-  "Given a Helm action list and a prescription, return a hacked
-Helm action list, after applying the PRESCRIPTION.
-
-The Helm action list ACTIONS is of the form:
-
-\(\(DESCRIPTION1 . FUNCTION1\)
- \(DESCRIPTION2 . FUNCTION2\)
- ...
- \(DESCRIPTIONn . FUNCTIONn\)\)
-
-PRESCRIPTION is in the form:
-
-\(INSTRUCTION1 INSTRUCTION2 ... INSTRUCTIONn\)
-
-If an INSTRUCTION is a symbol, the action with function name
-INSTRUCTION is deleted.
-
-If an INSTRUCTION is of the form \(FUNCTION1 . FUNCTION2\), the
-action with function name FUNCTION1 will change it's function to
-FUNCTION2.
-
-If an INSTRUCTION is of the form \(FUNCTION . DESCRIPTION\), and
-if an action with function name FUNCTION exists in the original
-Helm action list, the action in the Helm action list, with
-function name FUNCTION will change it's description to
-DESCRIPTION. Otherwise, (FUNCTION . DESCRIPTION) will be added to
-the action list.
-
-Please check out how `helm-projectile-file-actions' is defined
-for an example of how this function is being used."
-  (let* ((to-delete (cl-remove-if (lambda (entry) (listp entry)) prescription))
-         (actions (cl-delete-if (lambda (action) (memq (cdr action) to-delete))
-                                (copy-alist actions)))
-         new)
-    (cl-dolist (action actions)
-      (when (setq new (cdr (assq (cdr action) prescription)))
-        (if (stringp new)
-            (setcar action new)
-          (setcdr action new))))
-    ;; Add new actions from PRESCRIPTION
-    (setq new nil)
-    (cl-dolist (instruction prescription)
-      (when (and (listp instruction)
-                 (null (rassq (car instruction) actions))
-                 (symbolp (car instruction)) (stringp (cdr instruction)))
-        (push (cons (cdr instruction) (car instruction)) new)))
-    (append actions (nreverse new))))
-
-(defun helm-projectile-vc (dir)
-  "A Helm action for jumping to project root using `vc-dir' or Magit.
-DIR is a directory to be switched"
-  (let ((projectile-require-project-root nil))
-    (projectile-vc dir)))
-
-(defun helm-projectile-compile-project (dir)
-  "A Helm action for compile a project.
-DIR is the project root."
-  (let ((helm--reading-passwd-or-string t)
-        (default-directory dir))
-    (projectile-compile-project helm-current-prefix-arg dir)))
-
-(defun helm-projectile-remove-known-project (_ignore)
-  "Delete selected projects.
-_IGNORE means the argument does not matter.
-It is there because Helm requires it."
-  (let* ((projects (helm-marked-candidates :with-wildcard t))
-         (len (length projects)))
-    (with-helm-display-marked-candidates
-      helm-marked-buffer-name
-      projects
-      (if (not (y-or-n-p (format "Delete *%s projects(s)" len)))
-          (message "(No deletion performed)")
-        (progn
-          (mapc (lambda (p)
-                  (delete p projectile-known-projects))
-                projects)
-          (projectile-save-known-projects))
-        (message "%s projects(s) deleted" len)))))
-
-(defvar helm-source-projectile-projects
-  (helm-build-in-buffer-source "Projectile projects"
-    :data (lambda ()
-            (if (projectile-project-p)
-                (cons (abbreviate-file-name (projectile-project-root))
-                      (projectile-relevant-known-projects))
-              projectile-known-projects))
-    :fuzzy-match helm-projectile-fuzzy-match
-    :keymap (let ((map (make-sparse-keymap)))
-              (set-keymap-parent map helm-map)
-              (helm-projectile-define-key map
-                (kbd "C-d") 'dired
-                (kbd "M-g") 'helm-projectile-vc
-                (kbd "M-e") 'helm-projectile-switch-to-eshell
-                (kbd "C-s") 'helm-find-files-grep
-                (kbd "M-c") 'helm-projectile-compile-project
-                (kbd "M-D") 'helm-projectile-remove-known-project)
-              map)
-    :mode-line helm-ff-mode-line-string
-    :action '(("Switch to project" .
-               (lambda (project)
-                 (let ((projectile-completion-system 'helm))
-                   (projectile-switch-project-by-name project))))
-              ("Open Dired in project's directory `C-d'" . dired)
-              ("Open project root in vc-dir or magit `M-g'" . helm-projectile-vc)
-              ("Switch to Eshell `M-e'" . helm-projectile-switch-to-eshell)
-              ("Grep in projects `C-s'.  With C-u, recurse" . helm-find-files-grep)
-              ("Compile project `M-c'. With C-u, new compile command"
-               . helm-projectile-compile-project)
-              ("Remove project(s) `M-D'" . helm-projectile-remove-known-project)))
-  "Helm source for known projectile projects.")
-
-(define-key helm-etags-map (kbd "C-c p f") (lambda ()
-                                             (interactive)
-                                             (helm-run-after-quit 'helm-projectile-find-file nil)))
-
-(defun helm-projectile-find-files-eshell-command-on-file-action (_candidate)
-  (interactive)
-  (let* ((helm-ff-default-directory (file-name-directory _candidate)))
-    (helm-find-files-eshell-command-on-file _candidate)))
-
-(defun helm-projectile-ff-etags-select-action (_candidate)
-  (interactive)
-  (let* ((helm-ff-default-directory (file-name-directory _candidate)))
-    (helm-ff-etags-select _candidate)))
-
-(defun helm-projectile-switch-to-eshell (dir)
-  (interactive)
-  (let* ((projectile-require-project-root nil)
-         (helm-ff-default-directory (file-name-directory (projectile-expand-root dir))))
-    (helm-ff-switch-to-eshell dir)))
-
-(defun helm-projectile-files-in-current-dired-buffer ()
-  "Return a list of files (only) in the current dired buffer."
-  (let (flist)
-    (cl-flet ((fpush (fname) (push fname flist)))
-      (save-excursion
-        (let (file buffer-read-only)
-          (goto-char (point-min))
-          (while (not (eobp))
-            (save-excursion
-              (and (not (eolp))
-                   (setq file (dired-get-filename t t)) ; nil on non-file
-                   (progn (end-of-line)
-                          (funcall #'fpush file))))
-            (forward-line 1)))))
-    (mapcar 'file-truename (nreverse flist))))
-
-(defun helm-projectile-all-dired-buffers ()
-  "Get all current Dired buffers."
-  (mapcar (lambda (b)
-            (with-current-buffer b (buffer-name)))
-          (-filter (lambda (b)
-                     (with-current-buffer b
-                       (and (eq major-mode 'dired-mode)
-                            (buffer-name))))
-                   (buffer-list))))
-
-(defvar helm-projectile-virtual-dired-remote-enable nil
-  "Enable virtual Dired manager in remote host. Disabled by default.")
-
-(defun helm-projectile-dired-files-new-action (candidate)
-  "Create a Dired buffer from chosen files.
-CANDIDATE is the selected file, but choose the marked files if available."
-  (if (and (file-remote-p (projectile-project-root))
-           (not helm-projectile-virtual-dired-remote-enable))
-      (message "Virtual Dired manager is disabled in remote host. Enable with %s."
-               (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face))
-    (let ((new-name (completing-read "Select or enter a new buffer name: "
-                                     (helm-projectile-all-dired-buffers)))
-          (helm--reading-passwd-or-string t)
-          (files (-filter (lambda (f)
-                            (not (string= f "")))
-                          (mapcar (lambda (file)
-                                    (replace-regexp-in-string (projectile-project-root) "" file))
-                                  (helm-marked-candidates :with-wildcard t))))
-          (default-directory (projectile-project-root)))
-      ;; create a unique buffer that is unique to any directory in default-directory
-      ;; or opened buffer; when Dired is passed with a non-existence directory name,
-      ;; it only creates a buffer and insert everything. If a new name user supplied
-      ;; exists as default-directory, Dired throws error when insert anything that
-      ;; does not exist in current directory.
-      (with-current-buffer (dired (cons (make-temp-name new-name)
-                                        (if files
-                                            files
-                                          (list candidate))))
-        (when (get-buffer new-name)
-          (kill-buffer new-name))
-        (rename-buffer new-name)))))
-
-(defun helm-projectile-dired-files-add-action (candidate)
-  "Add files to a Dired buffer.
-CANDIDATE is the selected file.  Used when no file is explicitly marked."
-  (if (and (file-remote-p (projectile-project-root))
-           (not helm-projectile-virtual-dired-remote-enable))
-      (message "Virtual Dired manager is disabled in remote host. Enable with %s."
-               (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face))
-    (if (eq (with-helm-current-buffer major-mode) 'dired-mode)
-        (let* ((helm--reading-passwd-or-string t)
-               (root (projectile-project-root)) ; store root for later use
-               (dired-buffer-name (or (and (eq major-mode 'dired-mode) (buffer-name))
-                                      (completing-read "Select a Dired buffer:"
-                                                       (helm-projectile-all-dired-buffers))))
-               (dired-files (with-current-buffer dired-buffer-name
-                              (helm-projectile-files-in-current-dired-buffer)))
-               (marked-files (helm-marked-candidates :with-wildcard t))
-               (files (sort (mapcar (lambda (file)
-                                      (replace-regexp-in-string (projectile-project-root) "" file))
-                                    (cl-nunion (if marked-files
-                                                   marked-files
-                                                 (list candidate))
-                                               dired-files
-                                               :test #'string-equal))
-                            'string-lessp)))
-          (kill-buffer dired-buffer-name)
-          ;; Rebind default-directory because after killing a buffer, we
-          ;; could be in any buffer and default-directory is set to that
-          ;; random buffer
-          ;;
-          ;; Also use saved root directory, because after killing a buffer,
-          ;; we could be outside of current project
-          (let ((default-directory root))
-            (with-current-buffer (dired (cons (make-temp-name dired-buffer-name)
-                                              (if files
-                                                  (mapcar (lambda (file)
-                                                            (replace-regexp-in-string root "" file))
-                                                          files)
-                                                (list candidate))))
-              (rename-buffer dired-buffer-name))))
-      (error "You're not in a Dired buffer to add."))))
-
-(defun helm-projectile-dired-files-delete-action (candidate)
-  "Delete selected entries from a Dired buffer.
-CANDIDATE is the selected file.  Used when no file is explicitly marked."
-  (if (and (file-remote-p (projectile-project-root))
-           (not helm-projectile-virtual-dired-remote-enable))
-      (message "Virtual Dired manager is disabled in remote host. Enable with %s."
-               (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face))
-    (let* ((helm--reading-passwd-or-string t)
-           (root (projectile-project-root))
-           (dired-buffer-name (with-helm-current-buffer (buffer-name)))
-           (dired-files (with-current-buffer dired-buffer-name
-                          (helm-projectile-files-in-current-dired-buffer)))
-           (files (sort (cl-set-exclusive-or (helm-marked-candidates :with-wildcard t)
-                                             dired-files
-                                             :test #'string-equal) #'string-lessp)))
-      (kill-buffer dired-buffer-name)
-      ;; similar reason to `helm-projectile-dired-files-add-action'
-      (let ((default-directory root))
-        (with-current-buffer (dired (cons (make-temp-name dired-buffer-name)
-                                          (if files
-                                              (mapcar (lambda (file)
-                                                        (replace-regexp-in-string root "" file))
-                                                      files)
-                                            (list candidate))))
-          (rename-buffer dired-buffer-name))))))
-
-(defvar helm-projectile-find-file-map
-  (let ((map (copy-keymap helm-find-files-map)))
-    (helm-projectile-define-key map
-      (kbd "C-c f") 'helm-projectile-dired-files-new-action
-      (kbd "C-c a") 'helm-projectile-dired-files-add-action
-      (kbd "M-e") 'helm-projectile-switch-to-eshell
-      (kbd "M-.") 'helm-projectile-ff-etags-select-action
-      (kbd "M-!") 'helm-projectile-find-files-eshell-command-on-file-action)
-    (define-key map (kbd "<left>") 'helm-previous-source)
-    (define-key map (kbd "<right>") 'helm-next-source)
-    map)
-  "Mapping for file commands in Helm Projectile.")
-
-(defvar helm-projectile-file-actions
-  (helm-projectile-hack-actions
-   (cdr (assq 'action (or helm-source-find-files
-                          (helm-make-source "Find files" 'helm-source-ffiles))))
-   ;; Delete these actions
-   'helm-ff-browse-project
-   'helm-insert-file-name-completion-at-point
-   'helm-ff-find-sh-command
-   'helm-ff-cache-add-file
-   ;; Substitute these actions
-   '(helm-ff-switch-to-eshell . helm-projectile-switch-to-eshell)
-   '(helm-ff-etags-select     . helm-projectile-ff-etags-select-action)
-   '(helm-find-files-eshell-command-on-file
-     . helm-projectile-find-files-eshell-command-on-file-action)
-   ;; Change action descriptions
-   '(helm-find-file-as-root . "Find file as root `C-c r'")
-   ;; New actions
-   '(helm-projectile-dired-files-new-action
-     . "Create Dired buffer from files `C-c f'")
-   '(helm-projectile-dired-files-add-action
-     . "Add files to Dired buffer `C-c a'"))
-  "Action for files.")
-
-(defun helm-projectile-build-dwim-source (candidates)
-  "Dynamically build a Helm source definition for Projectile files based on context with CANDIDATES."
-  ""
-  (helm-build-in-buffer-source "Projectile files"
-    :data candidates
-    :fuzzy-match helm-projectile-fuzzy-match
-    :coerce 'helm-projectile-coerce-file
-    :action-transformer 'helm-find-files-action-transformer
-    :keymap helm-projectile-find-file-map
-    :help-message helm-ff-help-message
-    :mode-line helm-ff-mode-line-string
-    :action helm-projectile-file-actions))
-
-(defvar helm-source-projectile-files-list
-  (helm-build-in-buffer-source "Projectile files"
-    :data (lambda ()
-            (condition-case nil
-                (projectile-current-project-files)
-              (error nil)))
-    :fuzzy-match helm-projectile-fuzzy-match
-    :coerce 'helm-projectile-coerce-file
-    :keymap helm-projectile-find-file-map
-    :help-message 'helm-ff-help-message
-    :mode-line helm-ff-mode-line-string
-    :action helm-projectile-file-actions
-    )
-  "Helm source definition for Projectile files.")
-
-(defvar helm-source-projectile-files-in-all-projects-list
-  (helm-build-in-buffer-source "Projectile files in all Projects"
-    :data (lambda ()
-            (condition-case nil
-                (let ((projectile-require-project-root nil))
-                  (projectile-all-project-files))
-              (error nil)))
-    :coerce 'helm-projectile-coerce-file
-    :keymap helm-find-files-map
-    :help-message 'helm-ff-help-message
-    :mode-line helm-ff-mode-line-string
-    :action helm-projectile-file-actions
-    )
-  "Helm source definition for all Projectile files in all projects.")
-
-(defvar helm-projectile-dired-file-actions
-  (helm-projectile-hack-actions
-   helm-projectile-file-actions
-   ;; New actions
-   '(helm-projectile-dired-files-delete-action . "Remove entry(s) from Dired buffer `C-c d'")))
-
-(defvar helm-source-projectile-dired-files-list
-  (helm-build-in-buffer-source "Projectile files in current Dired buffer"
-    :data (lambda ()
-            (condition-case nil
-                (if (and (file-remote-p (projectile-project-root))
-                         (not helm-projectile-virtual-dired-remote-enable))
-                    nil
-                  (let ((default-directory (projectile-project-root)))
-                    (when (eq major-mode 'dired-mode)
-                      (mapcar (lambda (file)
-                                (replace-regexp-in-string default-directory "" file))
-                              (helm-projectile-files-in-current-dired-buffer)))))
-              (error nil)))
-    :coerce 'helm-projectile-coerce-file
-    :filter-one-by-one (lambda (file)
-                         (let ((default-directory (projectile-project-root)))
-                           (helm-ff-filter-candidate-one-by-one file)))
-    :action-transformer 'helm-find-files-action-transformer
-    :keymap (let ((map (copy-keymap helm-projectile-find-file-map)))
-              (helm-projectile-define-key map
-                (kbd "C-c d") 'helm-projectile-dired-files-delete-action)
-              map)
-    :help-message 'helm-ff-help-message
-    :mode-line helm-ff-mode-line-string
-    :action helm-projectile-dired-file-actions)
-  "Helm source definition for Projectile delete files.")
-
-(defun helm-projectile-dired-find-dir (dir)
-  "Jump to a selected directory DIR from helm-projectile."
-  (dired (expand-file-name dir (projectile-project-root)))
-  (run-hooks 'projectile-find-dir-hook))
-
-(defun helm-projectile-dired-find-dir-other-window (dir)
-  "Jump to a selected directory DIR from helm-projectile."
-  (dired-other-window (expand-file-name dir (projectile-project-root)))
-  (run-hooks 'projectile-find-dir-hook))
-
-(defvar helm-source-projectile-directories-list
-  (helm-build-in-buffer-source "Projectile directories"
-    :data (lambda ()
-            (condition-case nil
-                (if projectile-find-dir-includes-top-level
-                    (append '("./") (projectile-current-project-dirs))
-                  (projectile-current-project-dirs))
-              (error nil)))
-    :fuzzy-match helm-projectile-fuzzy-match
-    :coerce 'helm-projectile-coerce-file
-    :action-transformer 'helm-find-files-action-transformer
-    :keymap (let ((map (make-sparse-keymap)))
-              (set-keymap-parent map helm-map)
-              (helm-projectile-define-key map
-                (kbd "<left>") 'helm-previous-source
-                (kbd "<right>") 'helm-next-source
-                (kbd "C-c o") 'helm-projectile-dired-find-dir-other-window
-                (kbd "M-e")   'helm-projectile-switch-to-eshell
-                (kbd "C-c f") 'helm-projectile-dired-files-new-action
-                (kbd "C-c a") 'helm-projectile-dired-files-add-action
-                (kbd "C-s")   'helm-find-files-grep)
-              map)
-    :help-message 'helm-ff-help-message
-    :mode-line helm-ff-mode-line-string
-    :action '(("Open Dired" . helm-projectile-dired-find-dir)
-              ("Open Dired in other window `C-c o'" . helm-projectile-dired-find-dir)
-              ("Switch to Eshell `M-e'" . helm-projectile-switch-to-eshell)
-              ("Grep in projects `C-s C-u Recurse'" . helm-find-files-grep)
-              ("Create Dired buffer from files `C-c f'" . helm-projectile-dired-files-new-action)
-              ("Add files to Dired buffer `C-c a'" . helm-projectile-dired-files-add-action)))
-  "Helm source for listing project directories.")
-
-(defvar helm-projectile-buffers-list-cache nil)
-
-(defclass helm-source-projectile-buffer (helm-source-sync helm-type-buffer)
-  ((init :initform (lambda ()
-                     ;; Issue #51 Create the list before `helm-buffer' creation.
-                     (setq helm-projectile-buffers-list-cache (condition-case nil
-                                                                  (cdr (projectile-project-buffer-names))
-                                                                (error nil)))
-                     (let ((result (cl-loop for b in helm-projectile-buffers-list-cache
-                                            maximize (length b) into len-buf
-                                            maximize (length (with-current-buffer b
-                                                               (symbol-name major-mode)))
-                                            into len-mode
-                                            finally return (cons len-buf len-mode))))
-                       (unless helm-buffer-max-length
-                         (setq helm-buffer-max-length (car result)))
-                       (unless helm-buffer-max-len-mode
-                         ;; If a new buffer is longer that this value
-                         ;; this value will be updated
-                         (setq helm-buffer-max-len-mode (cdr result))))))
-   (candidates :initform helm-projectile-buffers-list-cache)
-   (matchplugin :initform nil)
-   (match :initform 'helm-buffers-match-function)
-   (persistent-action :initform 'helm-buffers-list-persistent-action)
-   (keymap :initform helm-buffer-map)
-   (volatile :initform t)
-   (mode-line :initform helm-buffer-mode-line-string)
-   (persistent-help
-    :initform
-    "Show this buffer / C-u \\[helm-execute-persistent-action]: Kill this buffer")))
-
-(defvar helm-source-projectile-buffers-list (helm-make-source "Project buffers" 'helm-source-projectile-buffer))
-
-(defvar helm-source-projectile-recentf-list
-  (helm-build-in-buffer-source "Projectile recent files"
-    :data (lambda ()
-            (condition-case nil
-                (projectile-recentf-files)
-              (error nil)))
-    :fuzzy-match helm-projectile-fuzzy-match
-    :coerce 'helm-projectile-coerce-file
-    :keymap helm-projectile-find-file-map
-    :help-message 'helm-ff-help-message
-    :mode-line helm-ff-mode-line-string
-    :action helm-projectile-file-actions
-    )
-  "Helm source definition for recent files in current project.")
-
-(defvar helm-source-projectile-files-and-dired-list
-  '(helm-source-projectile-dired-files-list
-    helm-source-projectile-files-list))
-
-(defvar helm-source-projectile-directories-and-dired-list
-  '(helm-source-projectile-dired-files-list
-    helm-source-projectile-directories-list))
-
-(defcustom helm-projectile-sources-list
-  '(helm-source-projectile-buffers-list
-    helm-source-projectile-files-list
-    helm-source-projectile-projects
-    )
-  "Default sources for `helm-projectile'."
-  :group 'helm-projectile)
-
-(defmacro helm-projectile-command (command source prompt &optional not-require-root)
-  "Template for generic helm-projectile commands.
-COMMAND is a command name to be appended with \"helm-projectile\" prefix.
-SOURCE is a Helm source that should be Projectile specific.
-PROMPT is a string for displaying as a prompt.
-NOT-REQUIRE-ROOT specifies the command doesn't need to be used in a
-project root."
-  `(defun ,(intern (concat "helm-projectile-" command)) (&optional arg)
-     "Use projectile with Helm for finding files in project
-
-With a prefix ARG invalidates the cache first."
-     (interactive "P")
-     (if (projectile-project-p)
-         (projectile-maybe-invalidate-cache arg)
-       (unless ,not-require-root
-         (error "You're not in a project")))
-     (let ((helm-ff-transformer-show-only-basename nil)
-           ;; for consistency, we should just let Projectile take care of ignored files
-           (helm-boring-file-regexp-list nil))
-       (helm :sources ,source
-             :buffer "*helm projectile*"
-             :prompt (projectile-prepend-project-name ,prompt)))))
-
-(helm-projectile-command "switch-project" 'helm-source-projectile-projects "Switch to project: " t)
-(helm-projectile-command "find-file" helm-source-projectile-files-and-dired-list "Find file: ")
-(helm-projectile-command "find-file-in-known-projects" 'helm-source-projectile-files-in-all-projects-list "Find file in projects: ")
-(helm-projectile-command "find-dir" helm-source-projectile-directories-and-dired-list "Find dir: ")
-(helm-projectile-command "recentf" 'helm-source-projectile-recentf-list "Recently visited file: ")
-(helm-projectile-command "switch-to-buffer" 'helm-source-projectile-buffers-list "Switch to buffer: ")
-
-;;;###autoload
-(defun helm-projectile-find-file-dwim ()
-  "Find file at point based on context."
-  (interactive)
-  (let* ((project-files (projectile-current-project-files))
-         (files (projectile-select-files project-files)))
-    (if (= (length files) 1)
-        (find-file (expand-file-name (car files) (projectile-project-root)))
-      (helm :sources (helm-projectile-build-dwim-source (if (> (length files) 1)
-                                                            files
-                                                          project-files))
-            :buffer "*helm projectile*"
-            :prompt (projectile-prepend-project-name "Find file: ")))))
-
-;;;###autoload
-(defun helm-projectile-find-other-file (&optional flex-matching)
-  "Switch between files with the same name but different extensions using Helm.
-With FLEX-MATCHING, match any file that contains the base name of current file.
-Other file extensions can be customized with the variable `projectile-other-file-alist'."
-  (interactive "P")
-  (-if-let (other-files (projectile-get-other-files (buffer-file-name)
-                                                    (projectile-current-project-files)
-                                                    flex-matching))
-      (if (= (length other-files) 1)
-          (find-file (expand-file-name (car other-files) (projectile-project-root)))
-        (progn
-          (let* ((helm-ff-transformer-show-only-basename nil))
-            (helm :sources (helm-build-in-buffer-source "Projectile other files"
-                             :data other-files
-                             :coerce 'helm-projectile-coerce-file
-                             :keymap (let ((map (copy-keymap helm-find-files-map)))
-                                       (define-key map (kbd "<left>") 'helm-previous-source)
-                                       (define-key map (kbd "<right>") 'helm-next-source)
-                                       map)
-                             :help-message helm-ff-help-message
-                             :mode-line helm-ff-mode-line-string
-                             :action helm-projectile-file-actions)
-                  :buffer "*helm projectile*"
-                  :prompt (projectile-prepend-project-name "Find other file: ")))))
-    (error "No other file found")))
-
-(defun helm-projectile-grep-or-ack (&optional use-ack-p ack-ignored-pattern ack-executable)
-  "Perform helm-grep at project root.
-USE-ACK-P indicates whether to use ack or not.
-ACK-IGNORED-PATTERN is a file regex to exclude from searching.
-ACK-EXECUTABLE is the actual ack binary name.
-It is usually \"ack\" or \"ack-grep\".
-If it is nil, or ack/ack-grep not found then use default grep command."
-  (let* ((default-directory (projectile-project-root))
-         (helm-ff-default-directory (projectile-project-root))
-         (follow (and helm-follow-mode-persistent
-                      (assoc-default 'follow helm-source-grep)))
-         (helm-grep-in-recurse t)
-         (grep-find-ignored-files (-union (projectile-ignored-files-rel)  grep-find-ignored-files))
-         (grep-find-ignored-directories (-union (projectile-ignored-directories-rel) grep-find-ignored-directories))
-         (helm-grep-default-command (if use-ack-p
-                                        (concat ack-executable " -H --no-group --no-color " ack-ignored-pattern " %p %f")
-                                      "grep -a -r %e -n%cH -e %p %f ."))
-         (helm-grep-default-recurse-command helm-grep-default-command)
-         (helm-source-grep
-          (helm-build-async-source
-              (capitalize (helm-grep-command t))
-            :header-name (lambda (name)
-                           (let ((name (if use-ack-p
-                                           "Helm Projectile Ack"
-                                         "Helm Projectile Grep")))
-                             (concat name " " "(C-c ? Help)")))
-            :candidates-process 'helm-grep-collect-candidates
-            :filter-one-by-one 'helm-grep-filter-one-by-one
-            :candidate-number-limit 9999
-            :nohighlight t
-            :mode-line helm-grep-mode-line-string
-            ;; We need to specify keymap here and as :keymap arg [1]
-            ;; to make it available in further resuming.
-            :keymap helm-grep-map
-            :history 'helm-grep-history
-            :action (helm-make-actions
-                     "Find file" 'helm-grep-action
-                     "Find file other frame" 'helm-grep-other-frame
-                     (lambda () (and (locate-library "elscreen")
-                                     "Find file in Elscreen"))
-                     'helm-grep-jump-elscreen
-                     "Save results in grep buffer" 'helm-grep-save-results
-                     "Find file other window" 'helm-grep-other-window)
-            :persistent-action 'helm-grep-persistent-action
-            :persistent-help "Jump to line (`C-u' Record in mark ring)"
-            :requires-pattern 2)))
-    (helm
-     :sources 'helm-source-grep
-     :input (if (region-active-p)
-                (buffer-substring-no-properties (region-beginning) (region-end))
-              (thing-at-point 'symbol))
-     :buffer (format "*helm %s*" (if use-ack-p
-                                     "ack"
-                                   "grep"))
-     :default-directory (projectile-project-root)
-     :keymap helm-grep-map
-     :history 'helm-grep-history
-     :truncate-lines t)))
-
-;;;###autoload
-(defun helm-projectile-on ()
-  "Turn on helm-projectile key bindings."
-  (interactive)
-  (message "Turn on helm-projectile key bindings")
-  (helm-projectile-toggle 1))
-
-;;;###autoload
-(defun helm-projectile-off ()
-  "Turn off helm-projectile key bindings."
-  (interactive)
-  (message "Turn off helm-projectile key bindings")
-  (helm-projectile-toggle -1))
-
-;;;###autoload
-(defun helm-projectile-grep ()
-  "Helm version of projectile-grep."
-  (interactive)
-  (if (projectile-project-p)
-      (funcall'run-with-timer 0.01 nil
-                              #'helm-projectile-grep-or-ack nil)
-    (error "You're not in a project")))
-
-;;;###autoload
-(defun helm-projectile-ack ()
-  "Helm version of projectile-ack."
-  (interactive)
-  (if (projectile-project-p)
-      (let ((ack-ignored (mapconcat
-                          'identity
-                          (-union (-map (lambda (path)
-                                          (concat "--ignore-dir=" (file-name-nondirectory (directory-file-name path))))
-                                        (projectile-ignored-directories))
-                                  (-map (lambda (path)
-                                          (concat "--ignore-file=match:" (shell-quote-argument path)))
-                                        (projectile-ignored-files))) " "))
-            (helm-ack-grep-executable (cond
-                                       ((executable-find "ack") "ack")
-                                       ((executable-find "ack-grep") "ack-grep")
-                                       (t (error "ack or ack-grep is not available.")))))
-        (funcall 'run-with-timer 0.01 nil
-                 #'helm-projectile-grep-or-ack t ack-ignored helm-ack-grep-executable))
-    (error "You're not in a project")))
-
-;;;###autoload
-(defun helm-projectile-ag (&optional options)
-  "Helm version of projectile-ag."
-  (interactive (if current-prefix-arg (list (read-string "option: " "" 'helm-ag-command-history))))
-  (if (require 'helm-ag nil  'noerror)
-      (if (projectile-project-p)
-          (let* ((grep-find-ignored-files (-union (projectile-ignored-files-rel)  grep-find-ignored-files))
-                 (grep-find-ignored-directories (-union (projectile-ignored-directories-rel) grep-find-ignored-directories))
-                 (ignored (mapconcat (lambda (i)
-                                       (concat "--ignore " i))
-                                     (append grep-find-ignored-files grep-find-ignored-directories)
-                                     " "))
-                 (helm-ag-command-option options)
-                 (helm-ag-base-command (concat helm-ag-base-command " " ignored)))
-            (helm-do-ag (projectile-project-root)))
-        (error "You're not in a project"))
-    (error "helm-ag not available")))
-
-(defun helm-projectile-commander-bindings ()
-  (def-projectile-commander-method ?a
-    "Run ack on project."
-    (call-interactively 'helm-projectile-ack))
-
-  (def-projectile-commander-method ?A
-    "Find ag on project."
-    (call-interactively 'helm-projectile-ag))
-
-  (def-projectile-commander-method ?f
-    "Find file in project."
-    (helm-projectile-find-file))
-
-  (def-projectile-commander-method ?b
-    "Switch to project buffer."
-    (helm-projectile-switch-to-buffer))
-
-  (def-projectile-commander-method ?d
-    "Find directory in project."
-    (helm-projectile-find-dir))
-
-  (def-projectile-commander-method ?g
-    "Run grep on project."
-    (helm-projectile-grep))
-
-  (def-projectile-commander-method ?s
-    "Switch project."
-    (helm-projectile-switch-project))
-
-  (def-projectile-commander-method ?e
-    "Find recently visited file in project."
-    (helm-projectile-recentf)))
-
-(defun helm-projectile-toggle (toggle)
-  "Toggle Helm version of Projectile commands."
-  (if (> toggle 0)
-      (progn
-        (setq projectile-switch-project-action 'helm-projectile-find-file)
-        (define-key projectile-command-map (kbd "a") 'helm-projectile-find-other-file)
-        (define-key projectile-command-map (kbd "f") 'helm-projectile-find-file)
-        (define-key projectile-command-map (kbd "F") 'helm-projectile-find-file-in-known-projects)
-        (define-key projectile-command-map (kbd "g") 'helm-projectile-find-file-dwim)
-        (define-key projectile-command-map (kbd "d") 'helm-projectile-find-dir)
-        (define-key projectile-command-map (kbd "p") 'helm-projectile-switch-project)
-        (define-key projectile-command-map (kbd "e") 'helm-projectile-recentf)
-        (define-key projectile-command-map (kbd "b") 'helm-projectile-switch-to-buffer)
-        (define-key projectile-command-map (kbd "s g") 'helm-projectile-grep)
-        (define-key projectile-command-map (kbd "s a") 'helm-projectile-ack)
-        (define-key projectile-command-map (kbd "s s") 'helm-projectile-ag)
-        (helm-projectile-commander-bindings))
-    (progn
-      (setq projectile-switch-project-action 'projectile-find-file)
-      (define-key projectile-command-map (kbd "a") 'projectile-find-other-file)
-      (define-key projectile-command-map (kbd "f") 'projectile-find-file)
-      (define-key projectile-command-map (kbd "F") 'projectile-find-file-in-known-projects)
-      (define-key projectile-command-map (kbd "g") 'helm-projectile-find-file-dwim)
-      (define-key projectile-command-map (kbd "d") 'projectile-find-dir)
-      (define-key projectile-command-map (kbd "p") 'projectile-switch-project)
-      (define-key projectile-command-map (kbd "e") 'projectile-recentf)
-      (define-key projectile-command-map (kbd "b") 'projectile-switch-to-buffer)
-      (define-key projectile-command-map (kbd "s g") 'projectile-grep)
-      (define-key projectile-command-map (kbd "s s") 'projectile-ag)
-      (projectile-commander-bindings))))
-
-;;;###autoload
-(defun helm-projectile (&optional arg)
-  "Use projectile with Helm instead of ido.
-
-With a prefix ARG invalidates the cache first.
-If invoked outside of a project, displays a list of known projects to jump."
-  (interactive "P")
-  (if (projectile-project-p)
-      (projectile-maybe-invalidate-cache arg))
-  (let ((helm-ff-transformer-show-only-basename nil))
-    (helm :sources helm-projectile-sources-list
-          :buffer "*helm projectile*"
-          :prompt (projectile-prepend-project-name (if (projectile-project-p)
-                                                       "pattern: "
-                                                     "Switch to project: ")))))
-
-;;;###autoload
-(eval-after-load 'projectile
-  '(progn
-     (define-key projectile-command-map (kbd "h") 'helm-projectile)))
-
-(provide 'helm-projectile)
-
-;;; helm-projectile.el ends here
diff --git a/elpa/helm-projectile-20151220.221/helm-projectile-autoloads.el b/elpa/helm-projectile-20151220.221/helm-projectile-autoloads.el
new file mode 100644 (file)
index 0000000..4532059
--- /dev/null
@@ -0,0 +1,71 @@
+;;; helm-projectile-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-projectile" "helm-projectile.el" (22215
+;;;;;;  7828 0 0))
+;;; Generated autoloads from helm-projectile.el
+
+(defvar helm-projectile-fuzzy-match t "\
+Enable fuzzy matching for Helm Projectile commands.
+This needs to be set before loading helm-projectile.")
+
+(custom-autoload 'helm-projectile-fuzzy-match "helm-projectile" t)
+
+(autoload 'helm-projectile-find-file-dwim "helm-projectile" "\
+Find file at point based on context.
+
+\(fn)" t nil)
+
+(autoload 'helm-projectile-find-other-file "helm-projectile" "\
+Switch between files with the same name but different extensions using Helm.
+With FLEX-MATCHING, match any file that contains the base name of current file.
+Other file extensions can be customized with the variable `projectile-other-file-alist'.
+
+\(fn &optional FLEX-MATCHING)" t nil)
+
+(autoload 'helm-projectile-on "helm-projectile" "\
+Turn on helm-projectile key bindings.
+
+\(fn)" t nil)
+
+(autoload 'helm-projectile-off "helm-projectile" "\
+Turn off helm-projectile key bindings.
+
+\(fn)" t nil)
+
+(autoload 'helm-projectile-grep "helm-projectile" "\
+Helm version of `projectile-grep'.
+DIR is the project root, if not set then current directory is used
+
+\(fn &optional DIR)" t nil)
+
+(autoload 'helm-projectile-ack "helm-projectile" "\
+Helm version of projectile-ack.
+
+\(fn &optional DIR)" t nil)
+
+(autoload 'helm-projectile-ag "helm-projectile" "\
+Helm version of projectile-ag.
+
+\(fn &optional OPTIONS)" t nil)
+
+(autoload 'helm-projectile "helm-projectile" "\
+Use projectile with Helm instead of ido.
+
+With a prefix ARG invalidates the cache first.
+If invoked outside of a project, displays a list of known projects to jump.
+
+\(fn &optional ARG)" t nil)
+
+(eval-after-load 'projectile '(progn (define-key projectile-command-map (kbd "h") #'helm-projectile)))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-projectile-autoloads.el ends here
diff --git a/elpa/helm-projectile-20151220.221/helm-projectile-pkg.el b/elpa/helm-projectile-20151220.221/helm-projectile-pkg.el
new file mode 100644 (file)
index 0000000..633bf7c
--- /dev/null
@@ -0,0 +1 @@
+(define-package "helm-projectile" "20151220.221" "Helm integration for Projectile" '((helm "1.7.7") (projectile "0.13.0") (dash "1.5.0") (cl-lib "0.3")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience"))
diff --git a/elpa/helm-projectile-20151220.221/helm-projectile.el b/elpa/helm-projectile-20151220.221/helm-projectile.el
new file mode 100644 (file)
index 0000000..e44b871
--- /dev/null
@@ -0,0 +1,868 @@
+;;; helm-projectile.el --- Helm integration for Projectile
+
+;; Copyright (C) 2011-2015 Bozhidar Batsov
+
+;; Author: Bozhidar Batsov
+;; URL: https://github.com/bbatsov/projectile
+;; Package-Version: 20151220.221
+;; Created: 2011-31-07
+;; Keywords: project, convenience
+;; Version: 0.13.0
+;; Package-Requires: ((helm "1.7.7") (projectile "0.13.0") (dash "1.5.0") (cl-lib "0.3"))
+
+;; This file is NOT part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; This library provides easy project management and navigation.  The
+;; concept of a project is pretty basic - just a folder containing
+;; special file.  Currently git, mercurial and bazaar repos are
+;; considered projects by default.  If you want to mark a folder
+;; manually as a project just create an empty .projectile file in
+;; it.  See the README for more details.
+;;
+;;; Code:
+
+(require 'projectile)
+(require 'cl-lib)
+(require 'grep)
+(require 'helm)
+(require 'helm-types)
+(require 'helm-locate)
+(require 'helm-buffers)
+(require 'helm-files)
+
+(declare-function eshell "eshell")
+(declare-function helm-do-ag "helm-ag")
+(defvar helm-ag-base-command)
+
+(defvar grep-find-ignored-directories)
+(defvar grep-find-ignored-files)
+
+(defgroup helm-projectile nil
+  "Helm support for projectile."
+  :prefix "helm-projectile-"
+  :group 'projectile
+  :link `(url-link :tag "helm-projectile homepage" "https://github.com/bbatsov/projectile"))
+
+(defvar helm-projectile-current-project-root)
+
+;;;###autoload
+(defcustom helm-projectile-fuzzy-match t
+  "Enable fuzzy matching for Helm Projectile commands.
+This needs to be set before loading helm-projectile."
+  :group 'helm-projectile
+  :type 'boolean)
+
+(defun helm-projectile-coerce-file (candidate)
+  (with-current-buffer (helm-candidate-buffer)
+    (expand-file-name candidate (projectile-project-root))))
+
+(defmacro helm-projectile-define-key (keymap key def &rest bindings)
+  "In KEYMAP, define key sequence KEY1 as DEF1, KEY2 as DEF2 ..."
+  (declare (indent defun))
+  (let ((ret '(progn)))
+    (while key
+      (push
+       `(define-key ,keymap ,key
+          (lambda ()
+            (interactive)
+            (helm-exit-and-execute-action ,def)))
+       ret)
+      (setq key (pop bindings)
+            def (pop bindings)))
+    (reverse ret)))
+
+(defun helm-projectile-hack-actions (actions &rest prescription)
+  "Given a Helm action list and a prescription, return a hacked
+Helm action list, after applying the PRESCRIPTION.
+
+The Helm action list ACTIONS is of the form:
+
+\(\(DESCRIPTION1 . FUNCTION1\)
+ \(DESCRIPTION2 . FUNCTION2\)
+ ...
+ \(DESCRIPTIONn . FUNCTIONn\)\)
+
+PRESCRIPTION is in the form:
+
+\(INSTRUCTION1 INSTRUCTION2 ... INSTRUCTIONn\)
+
+If an INSTRUCTION is a symbol, the action with function name
+INSTRUCTION is deleted.
+
+If an INSTRUCTION is of the form \(FUNCTION1 . FUNCTION2\), the
+action with function name FUNCTION1 will change it's function to
+FUNCTION2.
+
+If an INSTRUCTION is of the form \(FUNCTION . DESCRIPTION\), and
+if an action with function name FUNCTION exists in the original
+Helm action list, the action in the Helm action list, with
+function name FUNCTION will change it's description to
+DESCRIPTION. Otherwise, (FUNCTION . DESCRIPTION) will be added to
+the action list.
+
+Please check out how `helm-projectile-file-actions' is defined
+for an example of how this function is being used."
+  (let* ((to-delete (cl-remove-if (lambda (entry) (listp entry)) prescription))
+         (actions (cl-delete-if (lambda (action) (memq (cdr action) to-delete))
+                                (copy-alist actions)))
+         new)
+    (cl-dolist (action actions)
+      (when (setq new (cdr (assq (cdr action) prescription)))
+        (if (stringp new)
+            (setcar action new)
+          (setcdr action new))))
+    ;; Add new actions from PRESCRIPTION
+    (setq new nil)
+    (cl-dolist (instruction prescription)
+      (when (and (listp instruction)
+                 (null (rassq (car instruction) actions))
+                 (symbolp (car instruction)) (stringp (cdr instruction)))
+        (push (cons (cdr instruction) (car instruction)) new)))
+    (append actions (nreverse new))))
+
+(defun helm-projectile-vc (dir)
+  "A Helm action for jumping to project root using `vc-dir' or Magit.
+DIR is a directory to be switched"
+  (let ((projectile-require-project-root nil))
+    (projectile-vc dir)))
+
+(defun helm-projectile-compile-project (dir)
+  "A Helm action for compile a project.
+DIR is the project root."
+  (let ((helm--reading-passwd-or-string t)
+        (default-directory dir))
+    (projectile-compile-project helm-current-prefix-arg dir)))
+
+(defun helm-projectile-test-project (dir)
+  "A Helm action for test a project.
+DIR is the project root."
+  (let ((helm--reading-passwd-or-string t)
+        (default-directory dir))
+    (projectile-test-project helm-current-prefix-arg)))
+
+(defun helm-projectile-run-project (dir)
+  "A Helm action for run a project.
+DIR is the project root."
+  (let ((helm--reading-passwd-or-string t)
+        (default-directory dir))
+    (projectile-run-project helm-current-prefix-arg)))
+
+(defun helm-projectile-remove-known-project (_ignore)
+  "Delete selected projects.
+_IGNORE means the argument does not matter.
+It is there because Helm requires it."
+  (let* ((projects (helm-marked-candidates :with-wildcard t))
+         (len (length projects)))
+    (with-helm-display-marked-candidates
+      helm-marked-buffer-name
+      projects
+      (if (not (y-or-n-p (format "Delete *%s projects(s)? " len)))
+          (message "(No deletion performed)")
+        (progn
+          (mapc (lambda (p)
+                  (delete p projectile-known-projects))
+                projects)
+          (projectile-save-known-projects))
+        (message "%s projects(s) deleted" len)))))
+
+(defvar helm-projectile-projects-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map helm-map)
+    (helm-projectile-define-key map
+      (kbd "C-d") #'dired
+      (kbd "M-g") #'helm-projectile-vc
+      (kbd "M-e") #'helm-projectile-switch-to-eshell
+      (kbd "C-s") #'helm-projectile-grep
+      (kbd "M-c") #'helm-projectile-compile-project
+      (kbd "M-t") #'helm-projectile-test-project
+      (kbd "M-r") #'helm-projectile-run-project
+      (kbd "M-D") #'helm-projectile-remove-known-project)
+    map)
+  "Mapping for known projectile projects.")
+
+(defvar helm-source-projectile-projects
+  (helm-build-in-buffer-source "Projectile projects"
+    :data (lambda ()
+            (if (projectile-project-p)
+                (cons (abbreviate-file-name (projectile-project-root))
+                      (projectile-relevant-known-projects))
+              projectile-known-projects))
+    :fuzzy-match helm-projectile-fuzzy-match
+    :keymap helm-projectile-projects-map
+    :mode-line helm-read-file-name-mode-line-string
+    :action '(("Switch to project" .
+               (lambda (project)
+                 (let ((projectile-completion-system 'helm))
+                   (projectile-switch-project-by-name project))))
+              ("Open Dired in project's directory `C-d'" . dired)
+              ("Open project root in vc-dir or magit `M-g'" . helm-projectile-vc)
+              ("Switch to Eshell `M-e'" . helm-projectile-switch-to-eshell)
+              ("Grep in projects `C-s'" . helm-projectile-grep)
+              ("Compile project `M-c'. With C-u, new compile command"
+               . helm-projectile-compile-project)
+              ("Remove project(s) `M-D'" . helm-projectile-remove-known-project)))
+  "Helm source for known projectile projects.")
+
+(define-key helm-etags-map (kbd "C-c p f")
+  (lambda ()
+    (interactive)
+    (helm-run-after-exit 'helm-projectile-find-file nil)))
+
+(defun helm-projectile-find-files-eshell-command-on-file-action (_candidate)
+  (interactive)
+  (let* ((helm-ff-default-directory (file-name-directory _candidate)))
+    (helm-find-files-eshell-command-on-file _candidate)))
+
+(defun helm-projectile-ff-etags-select-action (_candidate)
+  (interactive)
+  (let* ((helm-ff-default-directory (file-name-directory _candidate)))
+    (helm-ff-etags-select _candidate)))
+
+(defun helm-projectile-switch-to-eshell (dir)
+  (interactive)
+  (let* ((projectile-require-project-root nil)
+         (helm-ff-default-directory (file-name-directory (projectile-expand-root dir))))
+    (helm-ff-switch-to-eshell dir)))
+
+(defun helm-projectile-files-in-current-dired-buffer ()
+  "Return a list of files (only) in the current dired buffer."
+  (let (flist)
+    (cl-flet ((fpush (fname) (push fname flist)))
+      (save-excursion
+        (let (file buffer-read-only)
+          (goto-char (point-min))
+          (while (not (eobp))
+            (save-excursion
+              (and (not (eolp))
+                   (setq file (dired-get-filename t t)) ; nil on non-file
+                   (progn (end-of-line)
+                          (funcall #'fpush file))))
+            (forward-line 1)))))
+    (mapcar 'file-truename (nreverse flist))))
+
+(defun helm-projectile-all-dired-buffers ()
+  "Get all current Dired buffers."
+  (mapcar (lambda (b)
+            (with-current-buffer b (buffer-name)))
+          (-filter (lambda (b)
+                     (with-current-buffer b
+                       (and (eq major-mode 'dired-mode)
+                            (buffer-name))))
+                   (buffer-list))))
+
+(defvar helm-projectile-virtual-dired-remote-enable nil
+  "Enable virtual Dired manager on remote host.
+Disabled by default.")
+
+(defun helm-projectile-dired-files-new-action (candidate)
+  "Create a Dired buffer from chosen files.
+CANDIDATE is the selected file, but choose the marked files if available."
+  (if (and (file-remote-p (projectile-project-root))
+           (not helm-projectile-virtual-dired-remote-enable))
+      (message "Virtual Dired manager is disabled in remote host. Enable with %s."
+               (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face))
+    (let ((files (-filter (lambda (f)
+                            (not (string= f "")))
+                          (mapcar (lambda (file)
+                                    (replace-regexp-in-string (projectile-project-root) "" file))
+                                  (helm-marked-candidates :with-wildcard t))))
+          (new-name (completing-read "Select or enter a new buffer name: "
+                                     (helm-projectile-all-dired-buffers)))
+          (helm--reading-passwd-or-string t)
+          (default-directory (projectile-project-root)))
+      ;; create a unique buffer that is unique to any directory in default-directory
+      ;; or opened buffer; when Dired is passed with a non-existence directory name,
+      ;; it only creates a buffer and insert everything. If a new name user supplied
+      ;; exists as default-directory, Dired throws error when insert anything that
+      ;; does not exist in current directory.
+      (with-current-buffer (dired (cons (make-temp-name new-name)
+                                        (if files
+                                            files
+                                          (list candidate))))
+        (when (get-buffer new-name)
+          (kill-buffer new-name))
+        (rename-buffer new-name)))))
+
+(defun helm-projectile-dired-files-add-action (candidate)
+  "Add files to a Dired buffer.
+CANDIDATE is the selected file.  Used when no file is explicitly marked."
+  (if (and (file-remote-p (projectile-project-root))
+           (not helm-projectile-virtual-dired-remote-enable))
+      (message "Virtual Dired manager is disabled in remote host. Enable with %s."
+               (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face))
+    (if (eq (with-helm-current-buffer major-mode) 'dired-mode)
+        (let* ((marked-files (helm-marked-candidates :with-wildcard t))
+               (helm--reading-passwd-or-string t)
+               (root (projectile-project-root)) ; store root for later use
+               (dired-buffer-name (or (and (eq major-mode 'dired-mode) (buffer-name))
+                                      (completing-read "Select a Dired buffer:"
+                                                       (helm-projectile-all-dired-buffers))))
+               (dired-files (with-current-buffer dired-buffer-name
+                              (helm-projectile-files-in-current-dired-buffer)))
+               (files (sort (mapcar (lambda (file)
+                                      (replace-regexp-in-string (projectile-project-root) "" file))
+                                    (cl-nunion (if marked-files
+                                                   marked-files
+                                                 (list candidate))
+                                               dired-files
+                                               :test #'string-equal))
+                            'string-lessp)))
+          (kill-buffer dired-buffer-name)
+          ;; Rebind default-directory because after killing a buffer, we
+          ;; could be in any buffer and default-directory is set to that
+          ;; random buffer
+          ;;
+          ;; Also use saved root directory, because after killing a buffer,
+          ;; we could be outside of current project
+          (let ((default-directory root))
+            (with-current-buffer (dired (cons (make-temp-name dired-buffer-name)
+                                              (if files
+                                                  (mapcar (lambda (file)
+                                                            (replace-regexp-in-string root "" file))
+                                                          files)
+                                                (list candidate))))
+              (rename-buffer dired-buffer-name))))
+      (error "You're not in a Dired buffer to add"))))
+
+(defun helm-projectile-dired-files-delete-action (candidate)
+  "Delete selected entries from a Dired buffer.
+CANDIDATE is the selected file.  Used when no file is explicitly marked."
+  (if (and (file-remote-p (projectile-project-root))
+           (not helm-projectile-virtual-dired-remote-enable))
+      (message "Virtual Dired manager is disabled in remote host. Enable with %s."
+               (propertize "helm-projectile-virtual-dired-remote-enable" 'face 'font-lock-keyword-face))
+    (let* ((helm--reading-passwd-or-string t)
+           (root (projectile-project-root))
+           (dired-buffer-name (with-helm-current-buffer (buffer-name)))
+           (dired-files (with-current-buffer dired-buffer-name
+                          (helm-projectile-files-in-current-dired-buffer)))
+           (files (sort (cl-set-exclusive-or (helm-marked-candidates :with-wildcard t)
+                                             dired-files
+                                             :test #'string-equal) #'string-lessp)))
+      (kill-buffer dired-buffer-name)
+      ;; similar reason to `helm-projectile-dired-files-add-action'
+      (let ((default-directory root))
+        (with-current-buffer (dired (cons (make-temp-name dired-buffer-name)
+                                          (if files
+                                              (mapcar (lambda (file)
+                                                        (replace-regexp-in-string root "" file))
+                                                      files)
+                                            (list candidate))))
+          (rename-buffer dired-buffer-name))))))
+
+(defvar helm-projectile-find-file-map
+  (let ((map (copy-keymap helm-find-files-map)))
+    (helm-projectile-define-key map
+      (kbd "C-c f") #'helm-projectile-dired-files-new-action
+      (kbd "C-c a") #'helm-projectile-dired-files-add-action
+      (kbd "M-e") #'helm-projectile-switch-to-eshell
+      (kbd "M-.") #'helm-projectile-ff-etags-select-action
+      (kbd "M-!") #'helm-projectile-find-files-eshell-command-on-file-action)
+    (define-key map (kbd "<left>") #'helm-previous-source)
+    (define-key map (kbd "<right>") #'helm-next-source)
+    map)
+  "Mapping for file commands in Helm Projectile.")
+
+(defvar helm-projectile-file-actions
+  (helm-projectile-hack-actions
+   helm-find-files-actions
+   ;; Delete these actions
+   'helm-ff-browse-project
+   'helm-insert-file-name-completion-at-point
+   'helm-ff-find-sh-command
+   'helm-ff-cache-add-file
+   ;; Substitute these actions
+   '(helm-ff-switch-to-eshell . helm-projectile-switch-to-eshell)
+   '(helm-ff-etags-select     . helm-projectile-ff-etags-select-action)
+   '(helm-find-files-eshell-command-on-file
+     . helm-projectile-find-files-eshell-command-on-file-action)
+   ;; Change action descriptions
+   '(helm-find-file-as-root . "Find file as root `C-c r'")
+   ;; New actions
+   '(helm-projectile-dired-files-new-action
+     . "Create Dired buffer from files `C-c f'")
+   '(helm-projectile-dired-files-add-action
+     . "Add files to Dired buffer `C-c a'"))
+  "Action for files.")
+
+(defun helm-projectile-build-dwim-source (candidates)
+  "Dynamically build a Helm source definition for Projectile files based on context with CANDIDATES."
+  ""
+  (helm-build-in-buffer-source "Projectile files"
+    :data candidates
+    :fuzzy-match helm-projectile-fuzzy-match
+    :coerce 'helm-projectile-coerce-file
+    :action-transformer 'helm-find-files-action-transformer
+    :keymap helm-projectile-find-file-map
+    :help-message helm-ff-help-message
+    :mode-line helm-read-file-name-mode-line-string
+    :action helm-projectile-file-actions))
+
+(defvar helm-source-projectile-files-list
+  (helm-build-in-buffer-source "Projectile files"
+    :data (lambda ()
+            (condition-case nil
+                (projectile-current-project-files)
+              (error nil)))
+    :fuzzy-match helm-projectile-fuzzy-match
+    :coerce 'helm-projectile-coerce-file
+    :keymap helm-projectile-find-file-map
+    :help-message 'helm-ff-help-message
+    :mode-line helm-read-file-name-mode-line-string
+    :action helm-projectile-file-actions
+    )
+  "Helm source definition for Projectile files.")
+
+(defvar helm-source-projectile-files-in-all-projects-list
+  (helm-build-in-buffer-source "Projectile files in all Projects"
+    :data (lambda ()
+            (condition-case nil
+                (let ((projectile-require-project-root nil))
+                  (projectile-all-project-files))
+              (error nil)))
+    :keymap helm-find-files-map
+    :help-message 'helm-ff-help-message
+    :mode-line helm-read-file-name-mode-line-string
+    :action helm-projectile-file-actions
+    )
+  "Helm source definition for all Projectile files in all projects.")
+
+(defvar helm-projectile-dired-file-actions
+  (helm-projectile-hack-actions
+   helm-projectile-file-actions
+   ;; New actions
+   '(helm-projectile-dired-files-delete-action . "Remove entry(s) from Dired buffer `C-c d'")))
+
+(defvar helm-source-projectile-dired-files-list
+  (helm-build-in-buffer-source "Projectile files in current Dired buffer"
+    :data (lambda ()
+            (condition-case nil
+                (if (and (file-remote-p (projectile-project-root))
+                         (not helm-projectile-virtual-dired-remote-enable))
+                    nil
+                  (let ((default-directory (projectile-project-root)))
+                    (when (eq major-mode 'dired-mode)
+                      (mapcar (lambda (file)
+                                (replace-regexp-in-string default-directory "" file))
+                              (helm-projectile-files-in-current-dired-buffer)))))
+              (error nil)))
+    :coerce 'helm-projectile-coerce-file
+    :filter-one-by-one (lambda (file)
+                         (let ((default-directory (projectile-project-root)))
+                           (helm-ff-filter-candidate-one-by-one file)))
+    :action-transformer 'helm-find-files-action-transformer
+    :keymap (let ((map (copy-keymap helm-projectile-find-file-map)))
+              (helm-projectile-define-key map
+                (kbd "C-c d") 'helm-projectile-dired-files-delete-action)
+              map)
+    :help-message 'helm-ff-help-message
+    :mode-line helm-read-file-name-mode-line-string
+    :action helm-projectile-dired-file-actions)
+  "Helm source definition for Projectile delete files.")
+
+(defun helm-projectile-dired-find-dir (dir)
+  "Jump to a selected directory DIR from helm-projectile."
+  (dired (expand-file-name dir (projectile-project-root)))
+  (run-hooks 'projectile-find-dir-hook))
+
+(defun helm-projectile-dired-find-dir-other-window (dir)
+  "Jump to a selected directory DIR from helm-projectile."
+  (dired-other-window (expand-file-name dir (projectile-project-root)))
+  (run-hooks 'projectile-find-dir-hook))
+
+(defvar helm-source-projectile-directories-list
+  (helm-build-in-buffer-source "Projectile directories"
+    :data (lambda ()
+            (condition-case nil
+                (if projectile-find-dir-includes-top-level
+                    (append '("./") (projectile-current-project-dirs))
+                  (projectile-current-project-dirs))
+              (error nil)))
+    :fuzzy-match helm-projectile-fuzzy-match
+    :coerce 'helm-projectile-coerce-file
+    :action-transformer 'helm-find-files-action-transformer
+    :keymap (let ((map (make-sparse-keymap)))
+              (set-keymap-parent map helm-map)
+              (helm-projectile-define-key map
+                (kbd "<left>") #'helm-previous-source
+                (kbd "<right>") #'helm-next-source
+                (kbd "C-c o") #'helm-projectile-dired-find-dir-other-window
+                (kbd "M-e")   #'helm-projectile-switch-to-eshell
+                (kbd "C-c f") #'helm-projectile-dired-files-new-action
+                (kbd "C-c a") #'helm-projectile-dired-files-add-action
+                (kbd "C-s")   #'helm-projectile-grep)
+              map)
+    :help-message 'helm-ff-help-message
+    :mode-line helm-read-file-name-mode-line-string
+    :action '(("Open Dired" . helm-projectile-dired-find-dir)
+              ("Open Dired in other window `C-c o'" . helm-projectile-dired-find-dir)
+              ("Switch to Eshell `M-e'" . helm-projectile-switch-to-eshell)
+              ("Grep in projects `C-s'" . helm-projectile-grep)
+              ("Create Dired buffer from files `C-c f'" . helm-projectile-dired-files-new-action)
+              ("Add files to Dired buffer `C-c a'" . helm-projectile-dired-files-add-action)))
+  "Helm source for listing project directories.")
+
+(defvar helm-projectile-buffers-list-cache nil)
+
+(defclass helm-source-projectile-buffer (helm-source-sync helm-type-buffer)
+  ((init :initform (lambda ()
+                     ;; Issue #51 Create the list before `helm-buffer' creation.
+                     (setq helm-projectile-buffers-list-cache (condition-case nil
+                                                                  (cdr (projectile-project-buffer-names))
+                                                                (error nil)))
+                     (let ((result (cl-loop for b in helm-projectile-buffers-list-cache
+                                            maximize (length b) into len-buf
+                                            maximize (length (with-current-buffer b
+                                                               (symbol-name major-mode)))
+                                            into len-mode
+                                            finally return (cons len-buf len-mode))))
+                       (unless helm-buffer-max-length
+                         (setq helm-buffer-max-length (car result)))
+                       (unless helm-buffer-max-len-mode
+                         ;; If a new buffer is longer that this value
+                         ;; this value will be updated
+                         (setq helm-buffer-max-len-mode (cdr result))))))
+   (candidates :initform helm-projectile-buffers-list-cache)
+   (matchplugin :initform nil)
+   (match :initform 'helm-buffers-match-function)
+   (persistent-action :initform 'helm-buffers-list-persistent-action)
+   (keymap :initform helm-buffer-map)
+   (volatile :initform t)
+   (persistent-help
+    :initform
+    "Show this buffer / C-u \\[helm-execute-persistent-action]: Kill this buffer")))
+
+(defvar helm-source-projectile-buffers-list (helm-make-source "Project buffers" 'helm-source-projectile-buffer))
+
+(defvar helm-source-projectile-recentf-list
+  (helm-build-in-buffer-source "Projectile recent files"
+    :data (lambda ()
+            (condition-case nil
+                (projectile-recentf-files)
+              (error nil)))
+    :fuzzy-match helm-projectile-fuzzy-match
+    :coerce 'helm-projectile-coerce-file
+    :keymap helm-projectile-find-file-map
+    :help-message 'helm-ff-help-message
+    :mode-line helm-read-file-name-mode-line-string
+    :action helm-projectile-file-actions
+    )
+  "Helm source definition for recent files in current project.")
+
+(defvar helm-source-projectile-files-and-dired-list
+  '(helm-source-projectile-dired-files-list
+    helm-source-projectile-files-list))
+
+(defvar helm-source-projectile-directories-and-dired-list
+  '(helm-source-projectile-dired-files-list
+    helm-source-projectile-directories-list))
+
+(defcustom helm-projectile-sources-list
+  '(helm-source-projectile-buffers-list
+    helm-source-projectile-files-list
+    helm-source-projectile-projects
+    )
+  "Default sources for `helm-projectile'."
+  :group 'helm-projectile)
+
+(defmacro helm-projectile-command (command source prompt &optional not-require-root)
+  "Template for generic helm-projectile commands.
+COMMAND is a command name to be appended with \"helm-projectile\" prefix.
+SOURCE is a Helm source that should be Projectile specific.
+PROMPT is a string for displaying as a prompt.
+NOT-REQUIRE-ROOT specifies the command doesn't need to be used in a
+project root."
+  `(defun ,(intern (concat "helm-projectile-" command)) (&optional arg)
+     "Use projectile with Helm for finding files in project
+
+With a prefix ARG invalidates the cache first."
+     (interactive "P")
+     (if (projectile-project-p)
+         (projectile-maybe-invalidate-cache arg)
+       (unless ,not-require-root
+         (error "You're not in a project")))
+     (let ((helm-ff-transformer-show-only-basename nil)
+           ;; for consistency, we should just let Projectile take care of ignored files
+           (helm-boring-file-regexp-list nil))
+       (helm :sources ,source
+             :buffer "*helm projectile*"
+             :prompt (projectile-prepend-project-name ,prompt)))))
+
+(helm-projectile-command "switch-project" 'helm-source-projectile-projects "Switch to project: " t)
+(helm-projectile-command "find-file" helm-source-projectile-files-and-dired-list "Find file: ")
+(helm-projectile-command "find-file-in-known-projects" 'helm-source-projectile-files-in-all-projects-list "Find file in projects: " t)
+(helm-projectile-command "find-dir" helm-source-projectile-directories-and-dired-list "Find dir: ")
+(helm-projectile-command "recentf" 'helm-source-projectile-recentf-list "Recently visited file: ")
+(helm-projectile-command "switch-to-buffer" 'helm-source-projectile-buffers-list "Switch to buffer: ")
+
+;;;###autoload
+(defun helm-projectile-find-file-dwim ()
+  "Find file at point based on context."
+  (interactive)
+  (let* ((project-files (projectile-current-project-files))
+         (files (projectile-select-files project-files)))
+    (if (= (length files) 1)
+        (find-file (expand-file-name (car files) (projectile-project-root)))
+      (helm :sources (helm-projectile-build-dwim-source (if (> (length files) 1)
+                                                            files
+                                                          project-files))
+            :buffer "*helm projectile*"
+            :prompt (projectile-prepend-project-name "Find file: ")))))
+
+;;;###autoload
+(defun helm-projectile-find-other-file (&optional flex-matching)
+  "Switch between files with the same name but different extensions using Helm.
+With FLEX-MATCHING, match any file that contains the base name of current file.
+Other file extensions can be customized with the variable `projectile-other-file-alist'."
+  (interactive "P")
+  (-if-let (other-files (projectile-get-other-files (buffer-file-name)
+                                                    (projectile-current-project-files)
+                                                    flex-matching))
+      (if (= (length other-files) 1)
+          (find-file (expand-file-name (car other-files) (projectile-project-root)))
+        (progn
+          (let* ((helm-ff-transformer-show-only-basename nil))
+            (helm :sources (helm-build-in-buffer-source "Projectile other files"
+                             :data other-files
+                             :coerce 'helm-projectile-coerce-file
+                             :keymap (let ((map (copy-keymap helm-find-files-map)))
+                                       (define-key map (kbd "<left>") 'helm-previous-source)
+                                       (define-key map (kbd "<right>") 'helm-next-source)
+                                       map)
+                             :help-message helm-ff-help-message
+                             :mode-line helm-read-file-name-mode-line-string
+                             :action helm-projectile-file-actions)
+                  :buffer "*helm projectile*"
+                  :prompt (projectile-prepend-project-name "Find other file: ")))))
+    (error "No other file found")))
+
+(defun helm-projectile-grep-or-ack (&optional dir use-ack-p ack-ignored-pattern ack-executable)
+  "Perform helm-grep at project root.
+DIR directory where to search
+USE-ACK-P indicates whether to use ack or not.
+ACK-IGNORED-PATTERN is a file regex to exclude from searching.
+ACK-EXECUTABLE is the actual ack binary name.
+It is usually \"ack\" or \"ack-grep\".
+If it is nil, or ack/ack-grep not found then use default grep command."
+  (let* ((default-directory (or dir (projectile-project-root)))
+         (helm-ff-default-directory default-directory)
+         (follow (and helm-follow-mode-persistent
+                      (assoc-default 'follow helm-source-grep)))
+         (helm-grep-in-recurse t)
+         (helm-grep-ignored-files (-union (projectile-ignored-files-rel)  grep-find-ignored-files))
+         (helm-grep-ignored-directories (-union (projectile-ignored-directories-rel) grep-find-ignored-directories))
+         (helm-grep-default-command (if use-ack-p
+                                        (concat ack-executable " -H --no-group --no-color " ack-ignored-pattern " %p %f")
+                                      (if (and projectile-use-git-grep (eq (projectile-project-vcs) 'git))
+                                          "git --no-pager grep --no-color -n -e %p -- %f"
+                                        "grep -a -r %e -n%cH -e %p %f .")))
+         (helm-grep-default-recurse-command helm-grep-default-command)
+         (helm-source-grep
+          (helm-build-async-source
+              (capitalize (helm-grep-command t))
+            :header-name (lambda (name)
+                           (let ((name (if use-ack-p
+                                           "Helm Projectile Ack"
+                                         "Helm Projectile Grep")))
+                             (concat name " " "(C-c ? Help)")))
+            :candidates-process 'helm-grep-collect-candidates
+            :filter-one-by-one 'helm-grep-filter-one-by-one
+            :candidate-number-limit 9999
+            :nohighlight t
+            ;; We need to specify keymap here and as :keymap arg [1]
+            ;; to make it available in further resuming.
+            :keymap helm-grep-map
+            :history 'helm-grep-history
+            :action (helm-make-actions
+                     "Find file" 'helm-grep-action
+                     "Find file other frame" 'helm-grep-other-frame
+                     (lambda () (and (locate-library "elscreen")
+                                     "Find file in Elscreen"))
+                     'helm-grep-jump-elscreen
+                     "Save results in grep buffer" 'helm-grep-save-results
+                     "Find file other window" 'helm-grep-other-window)
+            :persistent-action 'helm-grep-persistent-action
+            :persistent-help "Jump to line (`C-u' Record in mark ring)"
+            :requires-pattern 2)))
+    (helm
+     :sources 'helm-source-grep
+     :input (if (region-active-p)
+                (buffer-substring-no-properties (region-beginning) (region-end))
+              (thing-at-point 'symbol))
+     :buffer (format "*helm %s*" (if use-ack-p
+                                     "ack"
+                                   "grep"))
+     :default-directory default-directory
+     :keymap helm-grep-map
+     :history 'helm-grep-history
+     :truncate-lines t)))
+
+;;;###autoload
+(defun helm-projectile-on ()
+  "Turn on helm-projectile key bindings."
+  (interactive)
+  (message "Turn on helm-projectile key bindings")
+  (helm-projectile-toggle 1))
+
+;;;###autoload
+(defun helm-projectile-off ()
+  "Turn off helm-projectile key bindings."
+  (interactive)
+  (message "Turn off helm-projectile key bindings")
+  (helm-projectile-toggle -1))
+
+;;;###autoload
+(defun helm-projectile-grep (&optional dir)
+  "Helm version of `projectile-grep'.
+DIR is the project root, if not set then current directory is used"
+  (interactive)
+  (let ((project-root (or dir (projectile-project-root) (error "You're not in a project"))))
+    (funcall'run-with-timer 0.01 nil
+                              #'helm-projectile-grep-or-ack project-root nil)))
+
+;;;###autoload
+(defun helm-projectile-ack (&optional dir)
+  "Helm version of projectile-ack."
+  (interactive)
+  (let ((project-root (or dir (projectile-project-root) (error "You're not in a project"))))
+    (let ((ack-ignored (mapconcat
+                        'identity
+                        (-union (-map (lambda (path)
+                                        (concat "--ignore-dir=" (file-name-nondirectory (directory-file-name path))))
+                                      (projectile-ignored-directories))
+                                (-map (lambda (path)
+                                        (concat "--ignore-file=match:" (shell-quote-argument path)))
+                                      (projectile-ignored-files))) " "))
+          (helm-ack-grep-executable (cond
+                                     ((executable-find "ack") "ack")
+                                     ((executable-find "ack-grep") "ack-grep")
+                                     (t (error "ack or ack-grep is not available.")))))
+      (funcall 'run-with-timer 0.01 nil
+               #'helm-projectile-grep-or-ack project-root t ack-ignored helm-ack-grep-executable))))
+
+;;;###autoload
+(defun helm-projectile-ag (&optional options)
+  "Helm version of projectile-ag."
+  (interactive (if current-prefix-arg (list (read-string "option: " "" 'helm-ag--extra-options-history))))
+  (if (require 'helm-ag nil  'noerror)
+      (if (projectile-project-p)
+          (let* ((grep-find-ignored-files (-union (projectile-ignored-files-rel) grep-find-ignored-files))
+                 (grep-find-ignored-directories (-union (projectile-ignored-directories-rel) grep-find-ignored-directories))
+                 (ignored (mapconcat (lambda (i)
+                                       (concat "--ignore " i))
+                                     (append grep-find-ignored-files grep-find-ignored-directories)
+                                     " "))
+                 (helm-ag-command-option options)
+                 (helm-ag-base-command (concat helm-ag-base-command " " ignored))
+                 (current-prefix-arg nil))
+            (helm-do-ag (projectile-project-root)))
+        (error "You're not in a project"))
+    (error "helm-ag not available")))
+
+(defun helm-projectile-commander-bindings ()
+  (def-projectile-commander-method ?a
+    "Run ack on project."
+    (call-interactively 'helm-projectile-ack))
+
+  (def-projectile-commander-method ?A
+    "Find ag on project."
+    (call-interactively 'helm-projectile-ag))
+
+  (def-projectile-commander-method ?f
+    "Find file in project."
+    (helm-projectile-find-file))
+
+  (def-projectile-commander-method ?b
+    "Switch to project buffer."
+    (helm-projectile-switch-to-buffer))
+
+  (def-projectile-commander-method ?d
+    "Find directory in project."
+    (helm-projectile-find-dir))
+
+  (def-projectile-commander-method ?g
+    "Run grep on project."
+    (helm-projectile-grep))
+
+  (def-projectile-commander-method ?s
+    "Switch project."
+    (helm-projectile-switch-project))
+
+  (def-projectile-commander-method ?e
+    "Find recently visited file in project."
+    (helm-projectile-recentf)))
+
+(defun helm-projectile-toggle (toggle)
+  "Toggle Helm version of Projectile commands."
+  (if (> toggle 0)
+      (progn
+        (setq projectile-switch-project-action #'helm-projectile-find-file)
+        (define-key projectile-command-map (kbd "a") #'helm-projectile-find-other-file)
+        (define-key projectile-command-map (kbd "f") #'helm-projectile-find-file)
+        (define-key projectile-command-map (kbd "F") #'helm-projectile-find-file-in-known-projects)
+        (define-key projectile-command-map (kbd "g") #'helm-projectile-find-file-dwim)
+        (define-key projectile-command-map (kbd "d") #'helm-projectile-find-dir)
+        (define-key projectile-command-map (kbd "p") #'helm-projectile-switch-project)
+        (define-key projectile-command-map (kbd "e") #'helm-projectile-recentf)
+        (define-key projectile-command-map (kbd "b") #'helm-projectile-switch-to-buffer)
+        (define-key projectile-command-map (kbd "s g") #'helm-projectile-grep)
+        (define-key projectile-command-map (kbd "s a") #'helm-projectile-ack)
+        (define-key projectile-command-map (kbd "s s") #'helm-projectile-ag)
+        (helm-projectile-commander-bindings))
+    (progn
+      (setq projectile-switch-project-action #'projectile-find-file)
+      (define-key projectile-command-map (kbd "a") #'projectile-find-other-file)
+      (define-key projectile-command-map (kbd "f") #'projectile-find-file)
+      (define-key projectile-command-map (kbd "F") #'projectile-find-file-in-known-projects)
+      (define-key projectile-command-map (kbd "g") #'helm-projectile-find-file-dwim)
+      (define-key projectile-command-map (kbd "d") #'projectile-find-dir)
+      (define-key projectile-command-map (kbd "p") #'projectile-switch-project)
+      (define-key projectile-command-map (kbd "e") #'projectile-recentf)
+      (define-key projectile-command-map (kbd "b") #'projectile-switch-to-buffer)
+      (define-key projectile-command-map (kbd "s g") #'projectile-grep)
+      (define-key projectile-command-map (kbd "s s") #'projectile-ag)
+      (projectile-commander-bindings))))
+
+;;;###autoload
+(defun helm-projectile (&optional arg)
+  "Use projectile with Helm instead of ido.
+
+With a prefix ARG invalidates the cache first.
+If invoked outside of a project, displays a list of known projects to jump."
+  (interactive "P")
+  (if (projectile-project-p)
+      (projectile-maybe-invalidate-cache arg))
+  (let ((helm-ff-transformer-show-only-basename nil))
+    (helm :sources helm-projectile-sources-list
+          :buffer "*helm projectile*"
+          :prompt (projectile-prepend-project-name (if (projectile-project-p)
+                                                       "pattern: "
+                                                     "Switch to project: ")))))
+
+;;;###autoload
+(eval-after-load 'projectile
+  '(progn
+     (define-key projectile-command-map (kbd "h") #'helm-projectile)))
+
+(provide 'helm-projectile)
+
+;;; helm-projectile.el ends here
diff --git a/elpa/helm-swoop-20150704.839/helm-swoop-autoloads.el b/elpa/helm-swoop-20150704.839/helm-swoop-autoloads.el
deleted file mode 100644 (file)
index f45cedc..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-;;; helm-swoop-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
-\f
-;;;### (autoloads nil "helm-swoop" "helm-swoop.el" (21913 4100 0
-;;;;;;  0))
-;;; Generated autoloads from helm-swoop.el
-
-(autoload 'helm-swoop-back-to-last-point "helm-swoop" "\
-Go back to last position where `helm-swoop' was called
-
-\(fn &optional $CANCEL)" t nil)
-
-(autoload 'helm-swoop "helm-swoop" "\
-List the all lines to another buffer, which is able to squeeze by
- any words you input. At the same time, the original buffer's cursor
- is jumping line to line according to moving up and down the list.
-
-\(fn &key $QUERY $SOURCE ($multiline current-prefix-arg))" t nil)
-
-(autoload 'helm-swoop-from-isearch "helm-swoop" "\
-Invoke `helm-swoop' from isearch.
-
-\(fn)" t nil)
-
-(autoload 'helm-multi-swoop "helm-swoop" "\
-Usage:
-M-x helm-multi-swoop
-1. Select any buffers by [C-SPC] or [M-SPC]
-2. Press [RET] to start helm-multi-swoop
-
-C-u M-x helm-multi-swoop
-If you have done helm-multi-swoop before, you can skip select buffers step.
-Last selected buffers will be applied to helm-multi-swoop.
-
-\(fn &optional $QUERY $BUFLIST)" t nil)
-
-(autoload 'helm-multi-swoop-all "helm-swoop" "\
-Apply all buffers to helm-multi-swoop
-
-\(fn &optional $QUERY)" t nil)
-
-(autoload 'helm-multi-swoop-org "helm-swoop" "\
-Applies all org-mode buffers to helm-multi-swoop
-
-\(fn &optional $QUERY)" t nil)
-
-(autoload 'helm-multi-swoop-current-mode "helm-swoop" "\
-Applies all buffers of the same mode as the current buffer to helm-multi-swoop
-
-\(fn &optional $QUERY)" t nil)
-
-(autoload 'helm-multi-swoop-edit "helm-swoop" "\
-
-
-\(fn)" t nil)
-
-;;;***
-\f
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; helm-swoop-autoloads.el ends here
diff --git a/elpa/helm-swoop-20150704.839/helm-swoop-pkg.el b/elpa/helm-swoop-20150704.839/helm-swoop-pkg.el
deleted file mode 100644 (file)
index 3e373b7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-(define-package "helm-swoop" "20150704.839" "Efficiently hopping squeezed lines powered by helm interface" '((helm "1.0") (emacs "24")) :url "https://github.com/ShingoFukuyama/helm-swoop" :keywords '("helm" "swoop" "inner" "buffer" "search"))
diff --git a/elpa/helm-swoop-20150704.839/helm-swoop.el b/elpa/helm-swoop-20150704.839/helm-swoop.el
deleted file mode 100644 (file)
index 381560e..0000000
+++ /dev/null
@@ -1,1557 +0,0 @@
-;;; helm-swoop.el --- Efficiently hopping squeezed lines powered by helm interface -*- coding: utf-8; lexical-binding: t -*-
-
-;; Copyright (C) 2013 by Shingo Fukuyama
-
-;; Version: 1.6.0
-;; Package-Version: 20150704.839
-;; Author: Shingo Fukuyama - http://fukuyama.co
-;; URL: https://github.com/ShingoFukuyama/helm-swoop
-;; Created: Oct 24 2013
-;; Keywords: helm swoop inner buffer search
-;; Package-Requires: ((helm "1.0") (emacs "24"))
-
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2 of
-;; the License, or (at your option) any later version.
-
-;; This program is distributed in the hope that it will be
-;; useful, but WITHOUT ANY WARRANTY; without even the implied
-;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-;; PURPOSE.  See the GNU General Public License for more details.
-
-;;; Commentary:
-
-;; List the all lines to another buffer, which is able to squeeze
-;; by any words you input. At the same time, the original buffer's
-;; cursor is jumping line to line according to moving up and down
-;; the list.
-
-;; Example config
-;; ----------------------------------------------------------------
-;; ;; helm from https://github.com/emacs-helm/helm
-;; (require 'helm)
-
-;; ;; Locate the helm-swoop folder to your path
-;; ;; This line is unnecessary if you get this program from MELPA
-;; (add-to-list 'load-path "~/.emacs.d/elisp/helm-swoop")
-
-;; (require 'helm-swoop)
-
-;; ;; Change keybinds to whatever you like :)
-;; (global-set-key (kbd "M-i") 'helm-swoop)
-;; (global-set-key (kbd "M-I") 'helm-swoop-back-to-last-point)
-;; (global-set-key (kbd "C-c M-i") 'helm-multi-swoop)
-;; (global-set-key (kbd "C-x M-i") 'helm-multi-swoop-all)
-
-;; ;; When doing isearch, hand the word over to helm-swoop
-;; (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
-;; (define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
-
-;; ;; Save buffer when helm-multi-swoop-edit complete
-;; (setq helm-multi-swoop-edit-save t)
-
-;; ;; If this value is t, split window inside the current window
-;; (setq helm-swoop-split-with-multiple-windows nil)
-
-;; ;; Split direction. 'split-window-vertically or 'split-window-horizontally
-;; (setq helm-swoop-split-direction 'split-window-vertically)
-
-;; ;; If nil, you can slightly boost invoke speed in exchange for text color
-;; (setq helm-swoop-speed-or-color nil)
-
-;; ;; Go to the opposite side of line from the end or beginning of line
-;; (setq helm-swoop-move-to-line-cycle t)
-
-;; ;; Optional face for line numbers
-;; ;; Face name is `helm-swoop-line-number-face`
-;; (setq helm-swoop-use-line-number-face t)
-
-;; ----------------------------------------------------------------
-
-;; * `M-x helm-swoop` when region active
-;; * `M-x helm-swoop` when the cursor is at any symbol
-;; * `M-x helm-swoop` when the cursor is not at any symbol
-;; * `M-3 M-x helm-swoop` or `C-u 5 M-x helm-swoop` multi separated line culling
-;; * `M-x helm-multi-swoop` multi-occur like feature
-;; * `M-x helm-multi-swoop-all` apply all buffers
-;; * `C-u M-x helm-multi-swoop` apply last selected buffers from the second time
-;; * `M-x helm-swoop-same-face-at-point` list lines have the same face at the cursor is on
-;; * During isearch `M-i` to hand the word over to helm-swoop
-;; * During helm-swoop `M-i` to hand the word over to helm-multi-swoop-all
-;; * While doing `helm-swoop` press `C-c C-e` to edit mode, apply changes to original buffer by `C-x C-s`
-
-;; Helm Swoop Edit
-;; While doing helm-swoop, press keybind [C-c C-e] to move to edit buffer.
-;; Edit the list and apply by [C-x C-s]. If you'd like to cancel, [C-c C-g]
-
-;;; Code:
-
-(require 'cl-lib)
-(require 'helm)
-(require 'helm-utils)
-
-(declare-function migemo-search-pattern-get "migemo")
-
-;;; @ helm-swoop ----------------------------------------------
-
-(defgroup helm-swoop nil
-  "Open helm-swoop."
-  :prefix "helm-swoop-" :group 'helm)
-
-(defface helm-swoop-target-line-face
-  '((t (:background "#e3e300" :foreground "#222222")))
-  "Face for helm-swoop target line"
-  :group 'helm-swoop)
-(defface helm-swoop-target-line-block-face
-  '((t (:background "#cccc00" :foreground "#222222")))
-  "Face for target line"
-  :group 'helm-swoop)
-(defface helm-swoop-target-word-face
-  '((t (:background "#7700ff" :foreground "#ffffff")))
-  "Face for target word"
-  :group 'helm-swoop)
-(defface helm-swoop-line-number-face
-  '((t (:foreground "#999999")))
-  "Face for line numbers"
-  :group 'helm-swoop)
-
-(defcustom helm-swoop-speed-or-color nil
- "If nil, you can slightly boost invoke speed in exchange for text color"
- :group 'helm-swoop :type 'boolean)
-(defcustom helm-swoop-use-line-number-face nil
-  "Use face to line numbers on helm-swoop buffer"
-  :group 'helm-swoop :type 'boolean)
-(defcustom helm-swoop-split-with-multiple-windows nil
- "Split window when having multiple windows open"
- :group 'helm-swoop :type 'boolean)
-(defcustom helm-swoop-move-to-line-cycle t
- "Return to the opposite side of line"
- :group 'helm-swoop :type 'boolean)
-(defcustom helm-swoop-split-direction 'split-window-vertically
- "Split direction"
- :type '(choice (const :tag "vertically"   split-window-vertically)
-                (const :tag "horizontally" split-window-horizontally))
- :group 'helm-swoop)
-
-(defvar helm-swoop-split-window-function
-  (lambda ($buf)
-   (if helm-swoop-split-with-multiple-windows
-       (funcall helm-swoop-split-direction)
-       (when (one-window-p)
-        (funcall helm-swoop-split-direction)))
-    (other-window 1)
-    (switch-to-buffer $buf))
-  "Change the way to split window only when `helm-swoop' is calling")
-
-(defvar helm-swoop-candidate-number-limit 19999)
-(defvar helm-swoop-buffer "*Helm Swoop*")
-(defvar helm-swoop-prompt "Swoop: ")
-(defvar helm-swoop-last-point nil)
-(defvar helm-swoop-invisible-targets nil)
-(defvar helm-swoop-last-line-info nil)
-
-;; Buffer local variables
-(defvar helm-swoop-cache)
-(defvar helm-swoop-list-cache)
-(defvar helm-swoop-pattern)            ; Keep helm-pattern value
-(defvar helm-swoop-last-query)         ; Last search query for resume
-(defvar helm-swoop-last-prefix-number) ; For multiline highlight
-
-;; Global variables
-(defvar helm-swoop-synchronizing-window nil
-  "Window object where `helm-swoop' called from")
-(defvar helm-swoop-target-buffer nil
-  "Buffer object where `helm-swoop' called from")
-(defvar helm-swoop-line-overlay nil
-  "Overlay object to indicate other window's line")
-
-(defvar helm-swoop-map
-  (let (($map (make-sparse-keymap)))
-    (set-keymap-parent $map helm-map)
-    (define-key $map (kbd "C-c C-e") 'helm-swoop-edit)
-    (define-key $map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
-    (define-key $map (kbd "C-w") 'helm-swoop-yank-thing-at-point)
-    (delq nil $map))
-  "Keymap for helm-swoop")
-
-(defvar helm-multi-swoop-map
-  (let (($map (make-sparse-keymap)))
-    (set-keymap-parent $map helm-map)
-    (define-key $map (kbd "C-c C-e") 'helm-multi-swoop-edit)
-    (delq nil $map)))
-
-(defcustom helm-swoop-pre-input-function
-  (lambda () (thing-at-point 'symbol))
-  "This function can pre-input keywords when helm-swoop invoked"
-  :group 'helm-swoop :type 'function)
-
-(defun helm-swoop-pre-input-optimize ($query)
-  (when $query
-    (let (($regexp (list '("\+" . "\\\\+")
-                         '("\*" . "\\\\*")
-                         '("\#" . "\\\\#"))))
-      (mapc (lambda ($r)
-              (setq $query (replace-regexp-in-string (car $r) (cdr $r) $query)))
-            $regexp)
-      $query)))
-
-(defsubst helm-swoop--goto-line ($line)
-  (goto-char (point-min))
-  (forward-line (1- $line)))
-
-(defsubst helm-swoop--recenter ()
-  (recenter (/ (window-height) 2)))
-
-(defsubst helm-swoop--delete-overlay ($identity &optional $beg $end)
-  (or $beg (setq $beg (point-min)))
-  (or $end (setq $end (point-max)))
-  (overlay-recenter $end)
-  (mapc (lambda ($o)
-          (if (overlay-get $o $identity)
-              (delete-overlay $o)))
-        (overlays-in $beg $end)))
-
-(defsubst helm-swoop--get-string-at-line ()
-  (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
-
-(defsubst helm-swoop--buffer-substring ($point-min $point-max)
-  (if helm-swoop-speed-or-color
-      (let (($content (buffer-substring $point-min $point-max)))
-        (with-temp-buffer
-          (let ((inhibit-read-only t))
-            (insert $content)
-            (remove-text-properties (point-min) (point-max) '(read-only t))
-            (setq $content (buffer-substring (point-min) (point-max)))))
-        $content)
-    (buffer-substring-no-properties $point-min $point-max)))
-
-;;;###autoload
-(defun helm-swoop-back-to-last-point (&optional $cancel)
-  "Go back to last position where `helm-swoop' was called"
-  (interactive)
-  (if helm-swoop-last-point
-      (let (($po (point)))
-        (switch-to-buffer (cdr helm-swoop-last-point))
-        (goto-char (car helm-swoop-last-point))
-        (unless $cancel
-          (setq helm-swoop-last-point
-                (cons $po (buffer-name (current-buffer))))))))
-
-(defun helm-swoop--split-lines-by ($string $regexp $step)
-  "split-string by $step for multiline"
-  (or $step (setq $step 1))
-  (let (($from1 0) ;; last match point
-        ($from2 0) ;; last substring point
-        $list
-        ($i 1)) ;; from line 1
-    (while (string-match $regexp $string $from1)
-      (setq $i (1+ $i))
-      (if (eq 0 (% $i $step))
-          (progn
-            (setq $list (cons (substring $string $from2 (match-beginning 0))
-                              $list))
-            (setq $from2 (match-end 0))
-            (setq $from1 (match-end 0)))
-        (setq $from1 (match-end 0))))
-    (setq $list (cons (substring $string $from2) $list))
-    (nreverse $list)))
-
-(defun helm-swoop--target-line-overlay-move ()
-  "Add color to the target line"
-  (move-overlay
-   helm-swoop-line-overlay
-   (progn
-     (search-backward
-      "\n" nil t (% (line-number-at-pos) helm-swoop-last-prefix-number))
-     (goto-char (point-at-bol)))
-   ;; For multiline highlight
-   (save-excursion
-     (goto-char (point-at-bol))
-     (or (re-search-forward "\n" nil t helm-swoop-last-prefix-number)
-         ;; For the end of buffer error
-         (point-max))))
-  (helm-swoop--unveil-invisible-overlay))
-
-(defun helm-swoop--validate-regexp (regexp)
-  (condition-case nil
-      (progn
-        (string-match-p regexp "")
-        t)
-    (invalid-regexp nil)))
-
-(defun helm-swoop--target-word-overlay ($identity &optional $threshold)
-  (interactive)
-  (or $threshold (setq $threshold 2))
-  (save-excursion
-    (let (($pat (split-string helm-pattern " "))
-          $o)
-      (mapc (lambda ($wd)
-              (when (and (helm-swoop--validate-regexp $wd) (< $threshold (length $wd)))
-                (goto-char (point-min))
-                ;; Optional require migemo.el & helm-migemo.el
-                (if (and (featurep 'migemo) (featurep 'helm-migemo))
-                    (setq $wd (migemo-search-pattern-get $wd)))
-                ;; For caret begging match
-                (if (string-match "^\\^\\[0\\-9\\]\\+\\.\\(.+\\)" $wd)
-                    (setq $wd (concat "^" (match-string 1 $wd))))
-                (overlay-recenter (point-max))
-                (let (finish)
-                  (while (and (not finish) (re-search-forward $wd nil t))
-                    (if (= (match-beginning 0) (match-end 0))
-                        (forward-char 1)
-                      (setq $o (make-overlay (match-beginning 0) (match-end 0)))
-                      (overlay-put $o 'face 'helm-swoop-target-word-face)
-                      (overlay-put $o $identity t))
-                    (when (eobp)
-                      (setq finish t))))))
-            $pat))))
-
-(defun helm-swoop--restore-unveiled-overlay ()
-  (when helm-swoop-invisible-targets
-    (mapc (lambda ($ov) (overlay-put (car $ov) 'invisible (cdr $ov)))
-          helm-swoop-invisible-targets)
-    (setq helm-swoop-invisible-targets nil)))
-
-(defun helm-swoop--unveil-invisible-overlay ()
-  "Show hidden text temporarily to view it during helm-swoop.
-This function needs to call after latest helm-swoop-line-overlay set."
-  (helm-swoop--restore-unveiled-overlay)
-  (mapc (lambda ($ov)
-          (let (($type (overlay-get $ov 'invisible)))
-            (when $type
-              (overlay-put $ov 'invisible nil)
-              (setq helm-swoop-invisible-targets
-                    (cons (cons $ov $type) helm-swoop-invisible-targets)))))
-        (overlays-in (overlay-start helm-swoop-line-overlay)
-                     (overlay-end helm-swoop-line-overlay))))
-
-;; helm action ------------------------------------------------
-
-(defadvice helm-next-line (around helm-swoop-next-line disable)
-  (let ((helm-move-to-line-cycle-in-source t))
-    ad-do-it
-    (when (called-interactively-p 'any)
-      (helm-swoop--move-line-action))))
-
-(defadvice helm-previous-line (around helm-swoop-previous-line disable)
-  (let ((helm-move-to-line-cycle-in-source t))
-    ad-do-it
-    (when (called-interactively-p 'any)
-      (helm-swoop--move-line-action))))
-
-(defadvice helm-toggle-visible-mark (around helm-swoop-toggle-visible-mark disable)
-  (let ((helm-move-to-line-cycle-in-source t))
-    ad-do-it
-    (when (called-interactively-p 'any)
-      (helm-swoop--move-line-action))))
-
-(defun helm-swoop--move-line-action ()
-  (with-helm-window
-    (let* (($key (helm-swoop--get-string-at-line))
-           ($num (when (string-match "^[0-9]+" $key)
-                   (string-to-number (match-string 0 $key)))))
-      ;; Synchronizing line position
-      (when (and $key $num)
-        (with-selected-window helm-swoop-synchronizing-window
-          (progn
-            (helm-swoop--goto-line $num)
-            (with-current-buffer helm-swoop-target-buffer
-              (delete-overlay helm-swoop-line-overlay)
-              (helm-swoop--target-line-overlay-move))
-            (helm-swoop--recenter)))
-        (setq helm-swoop-last-line-info
-              (cons helm-swoop-target-buffer $num))))))
-
-(defun helm-swoop--nearest-line ($target $list)
-  "Return the nearest number of $target out of $list."
-  (when (and $target $list)
-    (let ($result)
-      (cl-labels ((filter ($fn $elem $list)
-                          (let ($r)
-                            (mapc (lambda ($e)
-                                    (if (funcall $fn $elem $e)
-                                        (setq $r (cons $e $r))))
-                                  $list) $r)))
-        (if (eq 1 (length $list))
-            (setq $result (car $list))
-          (let* (($lts (filter '> $target $list))
-                 ($gts (filter '< $target $list))
-                 ($lt (if $lts (apply 'max $lts)))
-                 ($gt (if $gts (apply 'min $gts)))
-                 ($ltg (if $lt (- $target $lt)))
-                 ($gtg (if $gt (- $gt $target))))
-            (setq $result
-                  (cond ((memq $target $list) $target)
-                        ((and (not $lt) (not $gt)) nil)
-                        ((not $gtg) $lt)
-                        ((not $ltg) $gt)
-                        ((eq $ltg $gtg) $gt)
-                        ((< $ltg $gtg) $lt)
-                        ((> $ltg $gtg) $gt)
-                        (t 1))))))
-      $result)))
-
-(defun helm-swoop--keep-nearest-position ()
-  (with-helm-window
-    (let (($p (point-min)) $list $bound
-          $nearest-line $target-point
-          ($buf (rx-to-string (buffer-name (car helm-swoop-last-line-info)) t)))
-      (save-excursion
-        (goto-char $p)
-        (while (if $p (setq $p (re-search-forward (concat "^" $buf "$") nil t)))
-          (when (get-text-property (point-at-bol) 'helm-header)
-            (forward-char 1)
-            (setq $bound (next-single-property-change (point) 'helm-header))
-            (while (re-search-forward "^[0-9]+" $bound t)
-              (setq $list (cons
-                           (string-to-number (match-string 0))
-                           $list)))
-            (setq $nearest-line (helm-swoop--nearest-line
-                            (cdr helm-swoop-last-line-info)
-                            $list))
-            (goto-char $p)
-            (re-search-forward (concat "^"
-                                       (number-to-string $nearest-line)
-                                       "\\s-") $bound t)
-            (setq $target-point (point))
-            (setq $p nil))))
-      (when $target-point
-        (goto-char $target-point)
-        (helm-mark-current-line)
-        (if (equal helm-swoop-buffer (buffer-name (current-buffer)))
-            (helm-swoop--move-line-action)
-          (helm-multi-swoop--move-line-action))))))
-
-(defun helm-swoop--pattern-match ()
-  "Overlay target words"
-  (with-helm-window
-    (setq helm-swoop-pattern helm-pattern)
-    (when (< 2 (length helm-pattern))
-      (helm-swoop--delete-overlay 'target-buffer)
-      (helm-swoop--target-word-overlay 'target-buffer)
-      (with-selected-window helm-swoop-synchronizing-window
-        (helm-swoop--delete-overlay 'target-buffer)
-        (helm-swoop--target-word-overlay 'target-buffer)))))
-
-;; core ------------------------------------------------
-
-(defun helm-swoop--get-content (&optional $linum)
-  "Get the whole content in buffer and add line number at the head.
-If $linum is number, lines are separated by $linum"
-  (let (($bufstr (helm-swoop--buffer-substring (point-min) (point-max)))
-        $return)
-    (with-temp-buffer
-      (insert $bufstr)
-      (goto-char (point-min))
-      (let (($i 1))
-        (insert (format "%s " $i))
-        (while (re-search-forward "\n" nil t)
-          (cl-incf $i)
-          (if helm-swoop-use-line-number-face
-              (insert (propertize (format "%s" $i) 'font-lock-face 'helm-swoop-line-number-face) " ")
-            (insert (format "%s " $i))))
-        ;; Delete empty lines
-        (unless $linum
-          (goto-char (point-min))
-          (while (re-search-forward "^[0-9]+\\s-*$" nil t)
-            (replace-match ""))))
-      (setq $return (helm-swoop--buffer-substring (point-min) (point-max))))
-    $return))
-
-(defun helm-c-source-swoop ()
-  `((name . ,(buffer-name (current-buffer)))
-    (init . (lambda ()
-              (unless helm-swoop-cache
-                (with-current-buffer (helm-candidate-buffer 'local)
-                  (insert ,(helm-swoop--get-content)))
-                (setq helm-swoop-cache t))))
-    (candidates-in-buffer)
-    (get-line . ,(if helm-swoop-speed-or-color
-                     'helm-swoop--buffer-substring
-                   'buffer-substring-no-properties))
-    (keymap . ,helm-swoop-map)
-    (header-line . "[C-c C-e] Edit mode, [M-i] apply all buffers")
-    (action . (lambda ($line)
-                (helm-swoop--goto-line
-                 (when (string-match "^[0-9]+" $line)
-                   (string-to-number (match-string 0 $line))))
-                (let (($regex (mapconcat 'identity
-                                         (split-string helm-pattern " ")
-                                         "\\|")))
-                  (when (or (and (and (featurep 'migemo) (featurep 'helm-migemo))
-                                 (migemo-forward $regex nil t))
-                            (re-search-forward $regex nil t))
-                    (goto-char (match-beginning 0))))
-                (helm-swoop--recenter)))
-    (migemo) ;;? in exchange for those matches ^ $ [0-9] .*
-    ))
-
-(defun helm-c-source-multi-swoop ($buf $func $action)
-  `((name . ,$buf)
-    (candidates . ,(funcall $func))
-    (action . ,$action)
-    (header-line . ,(concat $buf "    [C-c C-e] Edit mode"))
-    (keymap . ,helm-multi-swoop-map)
-    (requires-pattern . 2)
-    (migemo)))
-
-(defun helm-c-source-swoop-multiline ($linum)
-  `((name . ,(buffer-name (current-buffer)))
-
-    (candidates . ,(if helm-swoop-list-cache
-                       (progn
-                         (helm-swoop--split-lines-by
-                          helm-swoop-list-cache "\n" $linum))
-                     (helm-swoop--split-lines-by
-                      (setq helm-swoop-list-cache
-                            (helm-swoop--get-content t))
-                      "\n" $linum)))
-    (keymap . ,helm-swoop-map)
-    (action . (lambda ($line)
-                (helm-swoop--goto-line
-                 (when (string-match "^[0-9]+" $line)
-                   (string-to-number (match-string 0 $line))))
-                (when (re-search-forward
-                       (mapconcat 'identity
-                                  (split-string helm-pattern " ") "\\|")
-                       nil t)
-                  (goto-char (match-beginning 0)))
-                (helm-swoop--recenter)))
-    (multiline)
-    (migemo)))
-
-(defun helm-swoop--set-prefix (&optional $multiline)
-  ;; Enable scrolling margin
-  (if (boundp 'helm-swoop-last-prefix-number)
-      (setq helm-swoop-last-prefix-number
-            (or $multiline 1)) ;; $multiline is for resume
-    (set (make-local-variable 'helm-swoop-last-prefix-number)
-         (or $multiline 1))))
-(helm-swoop--set-prefix) ;; Silence error "Warning: reference to free variable"
-
-;; Delete cache when modified file is saved
-(defun helm-swoop--clear-cache ()
-  (if (boundp 'helm-swoop-cache) (setq helm-swoop-cache nil))
-  (if (boundp 'helm-swoop-list-cache) (setq helm-swoop-list-cache nil)))
-(add-hook 'after-save-hook 'helm-swoop--clear-cache)
-
-(defadvice narrow-to-region (around helm-swoop-advice-narrow-to-region activate)
-  (helm-swoop--clear-cache)
-  ad-do-it)
-
-(defadvice widen (around helm-swoop-advice-widen activate)
-  (helm-swoop--clear-cache)
-  ad-do-it)
-
-(defun helm-swoop--restore ()
-  (when (= 1 helm-exit-status)
-    (helm-swoop-back-to-last-point t)
-    (helm-swoop--restore-unveiled-overlay))
-  (setq helm-swoop-invisible-targets nil)
-  (ad-disable-advice 'helm-next-line 'around 'helm-swoop-next-line)
-  (ad-activate 'helm-next-line)
-  (ad-disable-advice 'helm-previous-line 'around 'helm-swoop-previous-line)
-  (ad-activate 'helm-previous-line)
-  (ad-disable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark)
-  (ad-activate 'helm-toggle-visible-mark)
-  (ad-disable-advice 'helm-move--next-line-fn 'around
-                     'helm-multi-swoop-next-line-cycle)
-  (ad-activate 'helm-move--next-line-fn)
-  (ad-disable-advice 'helm-move--previous-line-fn 'around
-                     'helm-multi-swoop-previous-line-cycle)
-  (ad-activate 'helm-move--previous-line-fn)
-  (remove-hook 'helm-update-hook 'helm-swoop--pattern-match)
-  (remove-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position)
-  (setq helm-swoop-last-query helm-swoop-pattern)
-  (mapc (lambda ($ov)
-          (when (or (eq 'helm-swoop-target-line-face (overlay-get $ov 'face))
-                    (eq 'helm-swoop-target-line-block-face
-                        (overlay-get $ov 'face)))
-            (delete-overlay $ov)))
-        (overlays-in (point-min) (point-max)))
-  (helm-swoop--delete-overlay 'target-buffer)
-  (deactivate-mark t))
-
-;;;###autoload
-(cl-defun helm-swoop (&key $query $source ($multiline current-prefix-arg))
-  "List the all lines to another buffer, which is able to squeeze by
- any words you input. At the same time, the original buffer's cursor
- is jumping line to line according to moving up and down the list."
-  (interactive)
-  (setq helm-swoop-synchronizing-window (selected-window))
-  (setq helm-swoop-last-point (cons (point) (buffer-name (current-buffer))))
-  (setq helm-swoop-last-line-info
-        (cons (current-buffer) (line-number-at-pos)))
-  (unless (boundp 'helm-swoop-last-query)
-    (set (make-local-variable 'helm-swoop-last-query) ""))
-  (setq helm-swoop-target-buffer (current-buffer))
-  (helm-swoop--set-prefix (prefix-numeric-value $multiline))
-  ;; Overlay
-  (setq helm-swoop-line-overlay (make-overlay (point) (point)))
-  (overlay-put helm-swoop-line-overlay
-               'face (if (< 1 helm-swoop-last-prefix-number)
-                         'helm-swoop-target-line-block-face
-                       'helm-swoop-target-line-face))
-  ;; Cache
-  (cond ((not (boundp 'helm-swoop-cache))
-         ;; first time of a buffer
-         (set (make-local-variable 'helm-swoop-cache) nil))
-        ((buffer-modified-p)
-         (setq helm-swoop-cache nil)))
-  ;; Cache for multiline
-  (cond ((not (boundp 'helm-swoop-list-cache))
-         (set (make-local-variable 'helm-swoop-list-cache) nil))
-        ((buffer-modified-p)
-         (setq helm-swoop-list-cache nil)))
-  (unwind-protect
-      (progn
-        ;; For synchronizing line position
-        (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line)
-        (ad-activate 'helm-next-line)
-        (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line)
-        (ad-activate 'helm-previous-line)
-        (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark)
-        (ad-activate 'helm-toggle-visible-mark)
-        (ad-enable-advice 'helm-move--next-line-fn 'around
-                          'helm-multi-swoop-next-line-cycle)
-        (ad-activate 'helm-move--next-line-fn)
-        (ad-enable-advice 'helm-move--previous-line-fn 'around
-                          'helm-multi-swoop-previous-line-cycle)
-        (ad-activate 'helm-move--previous-line-fn)
-        (add-hook 'helm-update-hook 'helm-swoop--pattern-match)
-        (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t)
-        (cond ($query
-               (if (string-match
-                    "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query)
-                   $query ;; NEED FIX #1 to appear as a "^"
-                 $query))
-              (mark-active
-               (let (($st (buffer-substring-no-properties
-                           (region-beginning) (region-end))))
-                 (if (string-match "\n" $st)
-                     (message "Multi line region is not allowed")
-                   (setq $query (helm-swoop-pre-input-optimize $st)))))
-              ((setq $query (helm-swoop-pre-input-optimize
-                             (funcall helm-swoop-pre-input-function))))
-              (t (setq $query "")))
-        ;; First behavior
-        (helm-swoop--recenter)
-        (move-beginning-of-line 1)
-        (helm-swoop--target-line-overlay-move)
-        ;; Execute helm
-        (let ((helm-display-function helm-swoop-split-window-function)
-              (helm-display-source-at-screen-top nil)
-              (helm-completion-window-scroll-margin 5))
-          (helm :sources
-                (or $source
-                    (if (> helm-swoop-last-prefix-number 1)
-                        (helm-c-source-swoop-multiline helm-swoop-last-prefix-number)
-                      (helm-c-source-swoop)))
-                :buffer helm-swoop-buffer
-                :input $query
-                :prompt helm-swoop-prompt
-                :preselect
-                ;; Get current line has content or else near one
-                (if (string-match "^[\t\n\s]*$" (helm-swoop--get-string-at-line))
-                    (save-excursion
-                      (if (re-search-forward "[^\t\n\s]" nil t)
-                          (format "^%s\s" (line-number-at-pos))
-                        (re-search-backward "[^\t\n\s]" nil t)
-                        (format "^%s\s" (line-number-at-pos))))
-                  (format "^%s\s" (line-number-at-pos)))
-                :candidate-number-limit helm-swoop-candidate-number-limit)))
-    ;; Restore helm's hook and window function etc
-    (helm-swoop--restore)))
-
-;; Receive word from isearch ---------------
-;;;###autoload
-(defun helm-swoop-from-isearch ()
-  "Invoke `helm-swoop' from isearch."
-  (interactive)
-  (let (($query (if isearch-regexp
-                    isearch-string
-                  (regexp-quote isearch-string))))
-    (isearch-exit)
-    (helm-swoop :$query $query)))
-;; When doing isearch, hand the word over to helm-swoop
-(define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
-
-;; Receive word from evil search ---------------
-(defun helm-swoop-from-evil-search ()
-  "Invoke `helm-swoop' from evil isearch"
-  (interactive)
-  (if (string-match "\\(isearch-\\|evil.*search\\)" (symbol-name real-last-command))
-      (helm-swoop :$query (if isearch-regexp
-                              isearch-string
-                            (regexp-quote isearch-string)))
-    (helm-swoop)))
-;; When doing evil-search, hand the word over to helm-swoop
-;; (define-key evil-motion-state-map (kbd "M-i") 'helm-swoop-from-evil-search)
-
-;; Receive word from evil search ---------------
-(defun helm-swoop-yank-thing-at-point ()
-  "Insert string at which the point helm-swoop started."
-  (interactive)
-  (let ($amend)
-    (with-selected-window helm-swoop-synchronizing-window
-      (with-current-buffer (get-buffer (cdr helm-swoop-last-point))
-        (save-excursion
-          (goto-char (car helm-swoop-last-point))
-          (setq $amend (thing-at-point 'symbol)))))
-    (when $amend
-      (with-selected-window (minibuffer-window)
-        (insert $amend)))))
-
-;; For helm-resume ------------------------
-(defadvice helm-resume-select-buffer
-  (around helm-swoop-if-selected-as-resume activate)
-  "Resume if *Helm Swoop* buffer selected as a resume
- when helm-resume with prefix"
-  (if (boundp 'helm-swoop-last-query)
-      ad-do-it
-    ;; If the buffer hasn't called helm-swoop, just hide from options
-    (let ((helm-buffers (delete helm-swoop-buffer helm-buffers)))
-      ad-do-it))
-  (when (and (equal ad-return-value helm-swoop-buffer)
-             (boundp 'helm-swoop-last-query))
-    (helm-swoop :$query helm-swoop-last-query
-                :$multiline helm-swoop-last-prefix-number)
-    (setq ad-return-value nil)))
-
-(defadvice helm-resume (around helm-swoop-resume activate)
-  "Resume if the last used helm buffer is helm-swoop-buffer"
-  (if (equal helm-last-buffer helm-swoop-buffer)
-      (if (boundp 'helm-swoop-last-query)
-          (if (not (ad-get-arg 0))
-              (helm-swoop :$query helm-swoop-last-query
-                          :$multiline helm-swoop-last-prefix-number))
-        ;; Temporary apply second last buffer
-        (let ((helm-last-buffer (cadr helm-buffers))) ad-do-it))
-    ad-do-it))
-
-;; For caret beginning-match -----------------------------
-(defun helm-swoop--caret-match-delete ($o $aft $beg $end &optional $len)
-  (if $aft
-      (- $end $beg $len) ;; Unused argument? To avoid byte compile error
-    (delete-region (overlay-start $o) (1- (overlay-end $o)))))
-
-(defun helm-swoop-caret-match (&optional _$resume)
-  (interactive)
-  (let* (($prompt helm-swoop-prompt) ;; Accept change of the variable
-         ($line-number-regexp "^[0-9]+.")
-         ($prompt-regexp
-          (funcall `(lambda ()
-                      (rx bol ,$prompt))))
-         ($prompt-regexp-with-line-number
-          (funcall `(lambda ()
-                      (rx bol ,$prompt (group ,$line-number-regexp)))))
-         ($disguise-caret
-          (lambda ()
-            (save-excursion
-              (re-search-backward $prompt-regexp-with-line-number nil t)
-              (let (($o (make-overlay (match-beginning 1) (match-end 1))))
-                (overlay-put $o 'face 'helm-swoop-target-word-face)
-                (overlay-put $o 'modification-hooks '(helm-swoop--caret-match-delete))
-                (overlay-put $o 'display "^")
-                (overlay-put $o 'evaporate t))))))
-    (if (and (minibufferp)
-             (string-match $prompt-regexp
-                           (buffer-substring-no-properties
-                            (point-min) (point-max)))
-             (eq (point) (+ 1 (length helm-swoop-prompt))))
-        (progn
-          (insert $line-number-regexp)
-          (funcall $disguise-caret))
-      (insert "^"))))
-
-(unless (featurep 'helm-migemo)
-  (define-key helm-map (kbd "^") 'helm-swoop-caret-match))
-
-;;; @ helm-swoop-edit -----------------------------------------
-
-(defvar helm-swoop-edit-target-buffer)
-(defvar helm-swoop-edit-buffer "*Helm Swoop Edit*")
-(defvar helm-swoop-edit-map
-  (let (($map (make-sparse-keymap)))
-    (define-key $map (kbd "C-x C-s") 'helm-swoop--edit-complete)
-    (define-key $map (kbd "C-c C-g") 'helm-swoop--edit-cancel)
-    $map))
-
-(defun helm-swoop--clear-edit-buffer ($prop)
-  (let ((inhibit-read-only t))
-    (mapc (lambda ($ov)
-            (when (overlay-get $ov $prop)
-              (delete-overlay $ov)))
-          (overlays-in (point-min) (point-max)))
-    (set-text-properties (point-min) (point-max) nil)
-    (goto-char (point-min))
-    (erase-buffer)))
-
-(defun helm-swoop--collect-edited-lines ()
-  "Create a list of edited lines with each its own line number"
-  (interactive)
-  (let ($list)
-    (goto-char (point-min))
-    (while (re-search-forward "^\\([0-9]+\\)\s" nil t)
-      (setq $list
-            (cons (cons (string-to-number (match-string 1))
-                        (buffer-substring-no-properties
-                         (point)
-                         (save-excursion
-                           (if (re-search-forward
-                                "^\\([0-9]+\\)\s\\|^\\(\\-+\\)" nil t)
-                               (1- (match-beginning 0))
-                             (goto-char (point-max))
-                             (re-search-backward "\n" nil t)))))
-                  $list)))
-    $list))
-
-(defun helm-swoop--edit ($candidate)
-  "This function will only be called from `helm-swoop-edit'"
-  (interactive)
-  (setq helm-swoop-edit-target-buffer helm-swoop-target-buffer)
-  (delete-overlay helm-swoop-line-overlay)
-  (helm-swoop--delete-overlay 'target-buffer)
-  (with-current-buffer (get-buffer-create helm-swoop-edit-buffer)
-
-    (helm-swoop--clear-edit-buffer 'helm-swoop-edit)
-    (let (($bufstr ""))
-      ;; Get target line number to edit
-      (with-current-buffer helm-swoop-buffer
-        ;; Use selected line by [C-SPC] or [M-SPC]
-        (mapc (lambda ($ov)
-                (when (eq 'helm-visible-mark (overlay-get $ov 'face))
-                  (setq $bufstr (concat (buffer-substring-no-properties
-                                         (overlay-start $ov) (overlay-end $ov))
-                                        $bufstr))))
-              (overlays-in (point-min) (point-max)))
-        (if (equal "" $bufstr)
-            ;; Not found selected line
-            (setq $bufstr (buffer-substring-no-properties
-                           (point-min) (point-max)))
-          ;; Attach title
-          (setq $bufstr (concat "Helm Swoop\n" $bufstr))))
-
-      ;; Set for edit buffer
-      (insert $bufstr)
-      (add-text-properties (point-min) (point-max)
-                           '(read-only t rear-nonsticky t front-sticky t))
-
-      ;; Set for editable context
-      (let ((inhibit-read-only t))
-        ;; Title and explanation
-        (goto-char (point-min))
-        (let (($o (make-overlay (point) (point-at-eol))))
-          (overlay-put $o 'helm-swoop-edit t)
-          (overlay-put $o 'face 'font-lock-function-name-face)
-          (overlay-put $o 'after-string
-                       (propertize " [C-x C-s] Complete, [C-c C-g] Cancel"
-                                   'face 'helm-bookmark-addressbook)))
-        ;; Line number and editable area
-        (while (re-search-forward "^\\([0-9]+\s\\)\\(.*\\)$" nil t)
-          (let* (($bol1 (match-beginning 1))
-                 ($eol1 (match-end 1))
-                 ($bol2 (match-beginning 2))
-                 ($eol2 (match-end 2)))
-            ;; Line number
-            (add-text-properties $bol1 $eol1
-                                 '(face font-lock-function-name-face
-                                   intangible t))
-            ;; Editable area
-            (remove-text-properties $bol2 $eol2 '(read-only t))
-            ;; For line tail
-            (set-text-properties $eol2 (or (1+ $eol2) (point-max))
-                                 '(read-only t rear-nonsticky t))))
-        (helm-swoop--target-word-overlay 'edit-buffer 0))))
-
-  (other-window 1)
-  (switch-to-buffer helm-swoop-edit-buffer)
-  (goto-char (point-min))
-  (if (string-match "^[0-9]+" $candidate)
-      (re-search-forward
-       (concat "^" (match-string 0 $candidate)) nil t))
-  (use-local-map helm-swoop-edit-map))
-
-(defun helm-swoop--edit-complete ()
-  "Apply changes and kill temporary edit buffer"
-  (interactive)
-  (let (($list (helm-swoop--collect-edited-lines)))
-    (with-current-buffer helm-swoop-edit-target-buffer
-      ;; Replace from the end of buffer
-      (save-excursion
-      (cl-loop for ($k . $v) in $list
-            do (progn
-                 (goto-char (point-min))
-                 (delete-region (point-at-bol $k) (point-at-eol $k))
-                 (goto-char (point-at-bol $k))
-                 (insert $v)))))
-    (select-window helm-swoop-synchronizing-window)
-    (kill-buffer (get-buffer helm-swoop-edit-buffer)))
-  (message "Successfully helm-swoop-edit applied to original buffer"))
-
-(defun helm-swoop--edit-cancel ()
-  "Cancel edit and kill temporary buffer"
-  (interactive)
-  (select-window helm-swoop-synchronizing-window)
-  (kill-buffer (get-buffer helm-swoop-edit-buffer))
-  (message "helm-swoop-edit canceled"))
-
-(defun helm-swoop-edit ()
-  (interactive)
-  (helm-quit-and-execute-action 'helm-swoop--edit))
-
-;;; @ helm-multi-swoop ----------------------------------------
-(defvar helm-multi-swoop-buffer-list "*helm-multi-swoop buffers list*"
-  "Buffer name")
-(defvar helm-multi-swoop-ignore-buffers-match "^\\*"
-  "Regexp to eliminate buffers you don't want to see")
-(defvar helm-multi-swoop-candidate-number-limit 250)
-(defvar helm-multi-swoop-last-selected-buffers nil)
-(defvar helm-multi-swoop-last-query nil)
-(defvar helm-multi-swoop-query nil)
-(defvar helm-multi-swoop-buffer "*Helm Multi Swoop*")
-(defvar helm-multi-swoop-all-from-helm-swoop-last-point nil
-  "For the last position, when helm-multi-swoop-all-from-helm-swoop canceled")
-(defvar helm-multi-swoop-move-line-action-last-buffer nil)
-
-(defvar helm-multi-swoop-buffers-map
-  (let (($map (make-sparse-keymap)))
-    (set-keymap-parent $map helm-map)
-    (define-key $map (kbd "RET")
-      (lambda () (interactive)
-        (helm-quit-and-execute-action 'helm-multi-swoop--exec)))
-    (delq nil $map)))
-
-;; action -----------------------------------------------------
-
-(defadvice helm-next-line (around helm-multi-swoop-next-line disable)
-  (let ((helm-move-to-line-cycle-in-source nil))
-    ad-do-it
-    (when (called-interactively-p 'any)
-      (helm-multi-swoop--move-line-action))))
-
-(defadvice helm-previous-line (around helm-multi-swoop-previous-line disable)
-  (let ((helm-move-to-line-cycle-in-source nil))
-    ad-do-it
-    (when (called-interactively-p 'any)
-      (helm-multi-swoop--move-line-action))))
-
-(defadvice helm-toggle-visible-mark (around helm-multi-swoop-toggle-visible-mark disable)
-  (let ((helm-move-to-line-cycle-in-source nil))
-    ad-do-it
-    (when (called-interactively-p 'any)
-      (helm-multi-swoop--move-line-action))))
-
-(defadvice helm-move--next-line-fn (around helm-multi-swoop-next-line-cycle disable)
-  (if (not (helm-pos-multiline-p))
-      (if (eq (point-max) (save-excursion (forward-line 1) (point)))
-          (when helm-swoop-move-to-line-cycle
-            (helm-beginning-of-buffer)
-            (helm-swoop--recenter))
-        (forward-line 1))
-    (let ((line-num (line-number-at-pos)))
-      (helm-move--next-multi-line-fn)
-      (when (and helm-swoop-move-to-line-cycle
-                 (eq line-num (line-number-at-pos)))
-        (helm-beginning-of-buffer)))))
-
-(defadvice helm-move--previous-line-fn (around helm-multi-swoop-previous-line-cycle disable)
-  (if (not (helm-pos-multiline-p))
-      (forward-line -1)
-    (helm-move--previous-multi-line-fn))
-  (when (and (helm-pos-header-line-p)
-             (eq (point) (save-excursion (forward-line -1) (point))))
-    (when helm-swoop-move-to-line-cycle
-      (helm-end-of-buffer))
-    (when (helm-pos-multiline-p)
-      (helm-move--previous-multi-line-fn))))
-
-(defun helm-multi-swoop--overlay-move (&optional $buf)
-  (move-overlay
-   helm-swoop-line-overlay
-   (goto-char (point-at-bol))
-   (save-excursion
-     (goto-char (point-at-bol))
-     (or (re-search-forward "\n" nil t) (point-max)))
-   $buf)
-  (helm-swoop--unveil-invisible-overlay))
-
-(defun helm-multi-swoop--move-line-action ()
-  (with-helm-window
-    (let* (($key (buffer-substring (point-at-bol) (point-at-eol)))
-           ($num (when (string-match "^[0-9]+" $key)
-                   (string-to-number (match-string 0 $key))))
-           ($source (helm-get-current-source))
-           ($buf (get-buffer (assoc-default 'name $source))))
-      ;; Synchronizing line position
-      (with-selected-window helm-swoop-synchronizing-window
-        (with-current-buffer $buf
-          (when (not (eq $buf helm-multi-swoop-move-line-action-last-buffer))
-            (set-window-buffer nil $buf)
-            (helm-swoop--pattern-match))
-          (helm-swoop--goto-line $num)
-          (helm-multi-swoop--overlay-move $buf)
-          (helm-swoop--recenter))
-        (setq helm-multi-swoop-move-line-action-last-buffer $buf))
-      (setq helm-swoop-last-line-info (cons $buf $num)))))
-
-(defun helm-multi-swoop--get-marked-buffers ()
-  (let ($list)
-    (with-current-buffer helm-multi-swoop-buffer-list
-      (mapc (lambda ($ov)
-              (when (eq 'helm-visible-mark (overlay-get $ov 'face))
-                (setq $list (cons
-                             (let (($word (buffer-substring-no-properties
-                                           (overlay-start $ov) (overlay-end $ov))))
-                               (mapc (lambda ($r)
-                                       (setq $word (replace-regexp-in-string
-                                                    (car $r) (cdr $r) $word)))
-                                     (list '("\\`[ \t\n\r]+" . "")
-                                           '("[ \t\n\r]+\\'" . "")))
-                               $word)
-                             $list))))
-            (overlays-in (point-min) (point-max))))
-    (delete "" $list)))
-
-;; core --------------------------------------------------------
-
-(cl-defun helm-multi-swoop--exec (ignored &key $query $buflist $func $action)
-  (interactive)
-  (setq helm-swoop-synchronizing-window (selected-window))
-  (setq helm-swoop-last-point
-        (or helm-multi-swoop-all-from-helm-swoop-last-point
-            (cons (point) (buffer-name (current-buffer)))))
-  (setq helm-swoop-last-line-info
-        (cons (current-buffer) (line-number-at-pos)))
-  (let (($buffs (or $buflist (helm-multi-swoop--get-marked-buffers)
-                    (error "No buffer selected")))
-        $contents
-        $preserve-position)
-    (setq helm-multi-swoop-last-selected-buffers $buffs)
-    ;; Create buffer sources
-    (mapc (lambda ($buf)
-            (with-current-buffer $buf
-              (let* (($func
-                      (or $func
-                          (lambda () (split-string (helm-swoop--get-content) "\n"))))
-                     ($action
-                      (or $action
-                          (lambda ($line)
-                            (switch-to-buffer $buf)
-                            (helm-swoop--goto-line
-                             (when (string-match "^[0-9]+" $line)
-                               (string-to-number
-                                (match-string 0 $line))))
-                            (when (re-search-forward
-                                   (mapconcat 'identity
-                                              (split-string
-                                               helm-pattern " ") "\\|")
-                                   nil t)
-                              (goto-char (match-beginning 0)))
-                            (helm-swoop--recenter)))))
-                (setq $preserve-position
-                      (cons (cons $buf (point)) $preserve-position))
-                (setq
-                 $contents
-                 (cons
-                  (helm-c-source-multi-swoop $buf $func $action)
-                  $contents)))))
-          $buffs)
-    (unwind-protect
-        (progn
-          (ad-enable-advice 'helm-next-line 'around
-                            'helm-multi-swoop-next-line)
-          (ad-activate 'helm-next-line)
-          (ad-enable-advice 'helm-previous-line 'around
-                            'helm-multi-swoop-previous-line)
-          (ad-activate 'helm-previous-line)
-          (ad-enable-advice 'helm-toggle-visible-mark 'around
-                            'helm-multi-swoop-toggle-visible-mark)
-          (ad-activate 'helm-toggle-visible-mark)
-          (ad-enable-advice 'helm-move--next-line-fn 'around
-                            'helm-multi-swoop-next-line-cycle)
-          (ad-activate 'helm-move--next-line-fn)
-          (ad-enable-advice 'helm-move--previous-line-fn 'around
-                            'helm-multi-swoop-previous-line-cycle)
-          (ad-activate 'helm-move--previous-line-fn)
-          (add-hook 'helm-update-hook 'helm-swoop--pattern-match)
-          (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t)
-          (setq helm-swoop-line-overlay
-                (make-overlay (point) (point)))
-          (overlay-put helm-swoop-line-overlay
-                       'face 'helm-swoop-target-line-face)
-          (helm-multi-swoop--overlay-move)
-          ;; Execute helm
-          (let ((helm-display-function helm-swoop-split-window-function)
-                (helm-display-source-at-screen-top nil)
-                (helm-completion-window-scroll-margin 5))
-            (helm :sources $contents
-                  :buffer helm-multi-swoop-buffer
-                  :input (or $query helm-multi-swoop-query "")
-                  :prompt helm-swoop-prompt
-                  :candidate-number-limit
-                  helm-multi-swoop-candidate-number-limit
-                  :preselect
-                  (format "%s %s" (line-number-at-pos)
-                          (helm-swoop--get-string-at-line)))))
-      ;; Restore
-      (progn
-        (when (= 1 helm-exit-status)
-          (helm-swoop-back-to-last-point t)
-          (helm-swoop--restore-unveiled-overlay))
-        (setq helm-swoop-invisible-targets nil)
-        (ad-disable-advice 'helm-next-line 'around
-                           'helm-multi-swoop-next-line)
-        (ad-activate 'helm-next-line)
-        (ad-disable-advice 'helm-previous-line 'around
-                           'helm-multi-swoop-previous-line)
-        (ad-activate 'helm-previous-line)
-        (ad-disable-advice 'helm-toggle-visible-mark 'around
-                           'helm-multi-swoop-toggle-visible-mark)
-        (ad-activate 'helm-toggle-visible-mark)
-        (ad-disable-advice 'helm-move--next-line-fn 'around
-                           'helm-multi-swoop-next-line-cycle)
-        (ad-activate 'helm-move--next-line-fn)
-        (ad-disable-advice 'helm-move--previous-line-fn 'around
-                           'helm-multi-swoop-previous-line-cycle)
-        (ad-activate 'helm-move--previous-line-fn)
-        (remove-hook 'helm-update-hook 'helm-swoop--pattern-match)
-        (remove-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position)
-        (setq helm-multi-swoop-last-query helm-swoop-pattern)
-        (helm-swoop--restore-unveiled-overlay)
-        (setq helm-multi-swoop-query nil)
-        (setq helm-multi-swoop-all-from-helm-swoop-last-point nil)
-        (mapc (lambda ($buf)
-                (let (($current-buffer (buffer-name (current-buffer))))
-                  (with-current-buffer (car $buf)
-                    ;; Delete overlay
-                    (delete-overlay helm-swoop-line-overlay)
-                    (helm-swoop--delete-overlay 'target-buffer)
-                    ;; Restore each buffer's position
-                    (unless (equal (car $buf) $current-buffer)
-                      (goto-char (cdr $buf))))))
-              $preserve-position)))))
-
-(defun helm-multi-swoop--get-buffer-list ()
-  (let ($buflist1 $buflist2)
-    ;; eliminate buffers start with whitespace and dired buffers
-    (mapc (lambda ($buf)
-            (setq $buf (buffer-name $buf))
-            (unless (string-match "^\\s-" $buf)
-              (unless (eq 'dired-mode (with-current-buffer $buf major-mode))
-                (setq $buflist1 (cons $buf $buflist1)))))
-          (buffer-list))
-    ;; eliminate buffers match pattern
-    (mapc (lambda ($buf)
-            (unless (string-match
-                     helm-multi-swoop-ignore-buffers-match
-                     $buf)
-              (setq $buflist2 (cons $buf $buflist2))))
-          $buflist1)
-    $buflist2))
-
-(defun helm-c-source-helm-multi-swoop-buffers ()
-  "Show buffer list to select"
-  `((name . "helm-multi-swoop select buffers")
-    (candidates . helm-multi-swoop--get-buffer-list)
-    (header-line . "[C-SPC]/[M-SPC] select, [RET] next step")
-    (keymap . ,helm-multi-swoop-buffers-map)))
-
-;;;###autoload
-(defun helm-multi-swoop (&optional $query $buflist)
-  "\
-Usage:
-M-x helm-multi-swoop
-1. Select any buffers by [C-SPC] or [M-SPC]
-2. Press [RET] to start helm-multi-swoop
-
-C-u M-x helm-multi-swoop
-If you have done helm-multi-swoop before, you can skip select buffers step.
-Last selected buffers will be applied to helm-multi-swoop.
-"
-  (interactive)
-  (cond ($query
-         (setq helm-multi-swoop-query $query))
-        (mark-active
-         (let (($st (buffer-substring-no-properties
-                     (region-beginning) (region-end))))
-           (if (string-match "\n" $st)
-               (message "Multi line region is not allowed")
-             (setq helm-multi-swoop-query
-                   (helm-swoop-pre-input-optimize $st)))))
-        ((setq helm-multi-swoop-query
-               (helm-swoop-pre-input-optimize
-                (funcall helm-swoop-pre-input-function))))
-        (t (setq helm-multi-swoop-query "")))
-  (if (equal current-prefix-arg '(4))
-      (helm-multi-swoop--exec nil
-                              :$query helm-multi-swoop-query
-                              :$buflist $buflist)
-    (if $buflist
-        (helm-multi-swoop--exec nil
-                                :$query $query
-                                :$buflist $buflist)
-      (helm :sources (helm-c-source-helm-multi-swoop-buffers)
-            :buffer helm-multi-swoop-buffer-list
-            :prompt "Mark any buffers by [C-SPC] or [M-SPC]: "))))
-
-;;;###autoload
-(defun helm-multi-swoop-all (&optional $query)
-  "Apply all buffers to helm-multi-swoop"
-  (interactive)
-  (cond ($query
-         (setq helm-multi-swoop-query $query))
-        (mark-active
-         (let (($st (buffer-substring-no-properties
-                     (region-beginning) (region-end))))
-           (if (string-match "\n" $st)
-               (message "Multi line region is not allowed")
-             (setq helm-multi-swoop-query
-                   (helm-swoop-pre-input-optimize $st)))))
-        ((setq helm-multi-swoop-query
-               (helm-swoop-pre-input-optimize
-                (funcall helm-swoop-pre-input-function))))
-        (t (setq helm-multi-swoop-query "")))
-  (helm-multi-swoop--exec nil
-                          :$query helm-multi-swoop-query
-                          :$buflist (helm-multi-swoop--get-buffer-list)))
-
-(defun get-buffers-matching-mode ($mode)
-  "Returns a list of buffers where their major-mode is equal to MODE"
-  (let ($buffer-mode-matches)
-    (mapc (lambda ($buffer)
-            (with-current-buffer $buffer
-              (if (eq $mode major-mode)
-                  (add-to-list '$buffer-mode-matches (buffer-name $buffer)))))
-          (buffer-list))
-    $buffer-mode-matches))
-
-(defun helm-multi-swoop-by-mode ($mode &optional $query)
-  "Apply all buffers whose mode is MODE to helm-multi-swoop"
-  (cond ($query
-         (setq helm-multi-swoop-query $query))
-        (mark-active
-         (let (($st (buffer-substring-no-properties
-                     (region-beginning) (region-end))))
-           (if (string-match "\n" $st)
-               (message "Multi line region is not allowed")
-             (setq helm-multi-swoop-query
-                   (helm-swoop-pre-input-optimize $st)))))
-        ((setq helm-multi-swoop-query
-               (helm-swoop-pre-input-optimize
-                (funcall helm-swoop-pre-input-function))))
-        (t (setq helm-multi-swoop-query "")))
-  (if (get-buffers-matching-mode $mode)
-      (helm-multi-swoop--exec nil
-                              :$query helm-multi-swoop-query
-                              :$buflist (get-buffers-matching-mode $mode))
-    (message "there are no buffers in that mode right now")))
-
-;;;###autoload
-(defun helm-multi-swoop-org (&optional $query)
-  "Applies all org-mode buffers to helm-multi-swoop"
-  (interactive)
-  (helm-multi-swoop-by-mode 'org-mode $query))
-
-;;;###autoload
-(defun helm-multi-swoop-current-mode (&optional $query)
-  "Applies all buffers of the same mode as the current buffer to helm-multi-swoop"
-  (interactive)
-  (helm-multi-swoop-by-mode major-mode $query))
-
-
-;; option -------------------------------------------------------
-
-(defun helm-multi-swoop-all-from-isearch ()
-  "Invoke `helm-multi-swoop-all' from isearch."
-  (interactive)
-  (let (($query (if isearch-regexp
-                    isearch-string
-                  (regexp-quote isearch-string))))
-    (isearch-exit)
-    (helm-multi-swoop-all $query)))
-;; When doing isearch, hand the word over to helm-swoop
-;; (define-key isearch-mode-map (kbd "C-x M-i") 'helm-multi-swoop-all-from-isearch)
-
-(defun helm-multi-swoop-all-from-helm-swoop ()
-  "Invoke `helm-multi-swoop-all' from helm-swoop."
-  (interactive)
-  (helm-swoop--restore)
-  (delete-overlay helm-swoop-line-overlay)
-  (setq helm-multi-swoop-all-from-helm-swoop-last-point helm-swoop-last-point)
-  (let (($query helm-pattern))
-    (run-with-timer 0 nil (lambda () (helm-multi-swoop-all $query))))
-  (helm-exit-minibuffer))
-
-(defun helm-multi-swoop-current-mode-from-helm-swoop ()
-  "Invoke `helm-multi-swoop-all' from helm-swoop."
-  (interactive)
-  (helm-swoop--restore)
-  (delete-overlay helm-swoop-line-overlay)
-  (setq helm-multi-swoop-all-from-helm-swoop-last-point helm-swoop-last-point)
-  (let (($query helm-pattern))
-    (run-with-timer 0 nil (lambda () (helm-multi-swoop-current-mode $query))))
-  (helm-exit-minibuffer))
-;; (define-key helm-swoop-map (kbd "M-m") 'helm-multi-swoop-current-mode-from-helm-swoop)
-
-(defadvice helm-resume (around helm-multi-swoop-resume activate)
-  "Resume if the last used helm buffer is *Helm Swoop*"
-  (if (equal helm-last-buffer helm-multi-swoop-buffer)
-
-      (if (boundp 'helm-multi-swoop-last-query)
-          (if (not (ad-get-arg 0))
-              (helm-multi-swoop helm-multi-swoop-last-query
-                                helm-multi-swoop-last-selected-buffers))
-        ;; Temporary apply second last buffer
-        (let ((helm-last-buffer (cadr helm-buffers))) ad-do-it))
-    ad-do-it))
-
-;;; @ helm-multi-swoop-edit -----------------------------------
-(defvar helm-multi-swoop-edit-save t
-  "Save each buffer you edit when editing is complete")
-(defvar helm-multi-swoop-edit-buffer "*Helm Multi Swoop Edit*")
-
-(defvar helm-multi-swoop-edit-map
-  (let (($map (make-sparse-keymap)))
-    (define-key $map (kbd "C-x C-s") 'helm-multi-swoop--edit-complete)
-    (define-key $map (kbd "C-c C-g") 'helm-multi-swoop--edit-cancel)
-    $map))
-
-(defun helm-multi-swoop--edit ($candidate)
-  "This function will only be called from `helm-swoop-edit'"
-  (interactive)
-  (delete-overlay helm-swoop-line-overlay)
-  (helm-swoop--delete-overlay 'target-buffer)
-  (with-current-buffer (get-buffer-create helm-multi-swoop-edit-buffer)
-    (helm-swoop--clear-edit-buffer 'helm-multi-swoop-edit)
-    (let (($bufstr "") ($mark nil))
-      ;; Get target line number to edit
-      (with-current-buffer helm-multi-swoop-buffer
-        ;; Set overlay to helm-source-header for editing marked lines
-        (save-excursion
-          (goto-char (point-min))
-          (let (($beg (point)) $end)
-            (overlay-recenter (point-max))
-            (while (setq $beg (text-property-any $beg (point-max)
-                                              'face 'helm-source-header))
-              (setq $end (next-single-property-change $beg 'face))
-              (overlay-put (make-overlay $beg $end) 'source-header t)
-              (setq $beg $end)
-              (goto-char $end))))
-        ;; Use selected line by [C-SPC] or [M-SPC]
-        (mapc (lambda ($ov)
-                (when (overlay-get $ov 'source-header)
-                  (setq $bufstr (concat (buffer-substring
-                                         (overlay-start $ov) (overlay-end $ov))
-                                        $bufstr)))
-                (when (eq 'helm-visible-mark (overlay-get $ov 'face))
-                  (let (($str (buffer-substring (overlay-start $ov) (overlay-end $ov))))
-                    (unless (equal "" $str) (setq $mark t))
-                    (setq $bufstr (concat (buffer-substring
-                                           (overlay-start $ov) (overlay-end $ov))
-                                          $bufstr)))))
-              (overlays-in (point-min) (point-max)))
-        (if $mark
-            (progn (setq $bufstr (concat "Helm Multi Swoop\n" $bufstr))
-                   (setq $mark nil))
-          (setq $bufstr (concat "Helm Multi Swoop\n"
-                                (buffer-substring
-                                 (point-min) (point-max))))))
-
-      ;; Set for edit buffer
-      (insert $bufstr)
-      (add-text-properties (point-min) (point-max)
-                           '(read-only t rear-nonsticky t front-sticky t))
-
-      ;; Set for editable context
-      (let ((inhibit-read-only t))
-        ;; Title and explanation
-        (goto-char (point-min))
-        (let (($o (make-overlay (point) (point-at-eol))))
-          (overlay-put $o 'helm-multi-swoop-edit t)
-          (overlay-put $o 'face 'font-lock-function-name-face)
-          (overlay-put $o 'after-string
-                       (propertize " [C-x C-s] Complete, [C-c C-g] Cancel"
-                                   'face 'helm-bookmark-addressbook)))
-        ;; Line number and editable area
-        (while (re-search-forward "^\\([0-9]+\s\\)\\(.*\\)$" nil t)
-          (let* (($bol1 (match-beginning 1))
-                 ($eol1 (match-end 1))
-                 ($bol2 (match-beginning 2))
-                 ($eol2 (match-end 2)))
-
-            ;; Line number
-            (add-text-properties $bol1 $eol1
-                                 '(face font-lock-function-name-face
-                                   intangible t))
-            ;; Editable area
-            (remove-text-properties $bol2 $eol2 '(read-only t))
-            ;; (add-text-properties $bol2 $eol2 '(font-lock-face helm-match))
-
-            ;; For line tail
-            (set-text-properties $eol2 (or (1+ $eol2) (point-max))
-                                 '(read-only t rear-nonsticky t))))
-        (helm-swoop--target-word-overlay 'edit-buffer 0))))
-
-  (other-window 1)
-  (switch-to-buffer helm-multi-swoop-edit-buffer)
-  (goto-char (point-min))
-  (if (string-match "^[0-9]+" $candidate)
-      (re-search-forward
-       (concat "^" (match-string 0 $candidate)) nil t))
-  (use-local-map helm-multi-swoop-edit-map))
-
-(defun helm-multi-swoop--separate-text-property-into-list ($property)
-  (interactive)
-  (let ($list $end)
-    (save-excursion
-      (goto-char (point-min))
-      (while (setq $end (next-single-property-change (point) $property))
-        ;; Must eliminate last return because of unexpected edit result
-        (setq $list (cons
-                     (let (($str (buffer-substring-no-properties (point) $end)))
-                       (if (string-match "\n\n\\'" $str)
-                           (replace-regexp-in-string "\n\\'" "" $str)
-                         $str))
-                     $list))
-        (goto-char $end))
-      (setq $list (cons (buffer-substring-no-properties (point) (point-max))
-                        $list)))
-    (nreverse $list)))
-
-(defun helm-multi-swoop--collect-edited-lines ()
-  "Create a list of edited lines with each its own line number"
-  (interactive)
-  (let* (($list
-          (helm-multi-swoop--separate-text-property-into-list 'helm-header))
-         ($length (length $list))
-         ($i 1) ;; 0th $list is header
-         $pairs)
-    (while (<= $i $length)
-      (let ($contents)
-        ;; Make ((number . line) (number . line) (number . line) ...)
-        (with-temp-buffer
-         (insert (format "%s" (nth (1+ $i) $list)))
-         (goto-char (point-min))
-         (while (re-search-forward "^\\([0-9]+\\)\s" nil t)
-           (setq $contents
-                 (cons (cons (string-to-number (match-string 1))
-                             (buffer-substring-no-properties
-                              (point)
-                              (save-excursion
-                                (if (re-search-forward
-                                     "^\\([0-9]+\\)\s\\|^\\(\\-+\\)" nil t)
-                                    (1- (match-beginning 0))
-                                  (goto-char (point-max))
-                                  (re-search-backward "\n" nil t)))))
-                       $contents))))
-        ;; Make ((buffer-name (number . line) (number . line) ...)
-        ;;       (buffer-name (number . line) (number . line) ...) ...)
-        (setq $pairs (cons (cons (nth $i $list) $contents) $pairs)))
-      (setq $i (+ $i 2)))
-    (delete '(nil) $pairs)))
-
-(defun helm-multi-swoop--edit-complete ()
-  "Apply changes to buffers and kill temporary edit buffer"
-  (interactive)
-  (let (($list (helm-multi-swoop--collect-edited-lines))
-        $read-only)
-    (mapc (lambda ($x)
-            (with-current-buffer (car $x)
-              (unless buffer-read-only
-                (save-excursion
-                  (cl-loop for ($k . $v) in (cdr $x)
-                        do (progn
-                             (goto-char (point-min))
-                             (delete-region (point-at-bol $k) (point-at-eol $k))
-                             (goto-char (point-at-bol $k))
-                             (insert $v)))))
-              (if helm-multi-swoop-edit-save
-                  (if buffer-read-only
-                      (setq $read-only t)
-                    (save-buffer)))))
-          $list)
-    (select-window helm-swoop-synchronizing-window)
-    (kill-buffer (get-buffer helm-multi-swoop-edit-buffer))
-    (if $read-only
-        (message "Couldn't save some buffers because of read-only")
-      (message "Successfully helm-multi-swoop-edit applied to original buffer"))))
-
-(defun helm-multi-swoop--edit-cancel ()
-  "Cancel edit and kill temporary buffer"
-  (interactive)
-  (select-window helm-swoop-synchronizing-window)
-  (kill-buffer (get-buffer helm-multi-swoop-edit-buffer))
-  (message "helm-multi-swoop-edit canceled"))
-
-;;;###autoload
-(defun helm-multi-swoop-edit ()
-  (interactive)
-  (helm-quit-and-execute-action 'helm-multi-swoop--edit))
-
-;;; @ helm-swoop-same-face-at-point -----------------------------------
-
-(defsubst helm-swoop--get-at-face (&optional $point)
-  (or $point (setq $point (point)))
-  (let (($face (or (get-char-property $point 'read-face-name)
-                   (get-char-property $point 'face))))
-      $face))
-
-(defun helm-swoop--cull-face-include-line ($face)
-  (let (($list) ($po (point-min)))
-    (save-excursion
-      (while (setq $po (next-single-property-change $po 'face))
-        (when (equal $face (helm-swoop--get-at-face $po))
-          (goto-char $po)
-          (setq $list (cons (format "%s %s"
-                                    (line-number-at-pos $po)
-                                    (buffer-substring (point-at-bol) (point-at-eol)))
-                            $list))
-          (let (($ov (make-overlay $po (or (next-single-property-change $po 'face)
-                                           (point-max)))))
-            (overlay-put $ov 'face 'helm-swoop-target-word-face)
-            (overlay-put $ov 'target-buffer 'helm-swoop-target-word-face)))))
-      (nreverse (delete-dups $list))))
-
-(defun helm-swoop-same-face-at-point (&optional $face)
-  (interactive)
-  (or $face (setq $face (helm-swoop--get-at-face)))
-  (helm-swoop :$query ""
-              :$source
-              `((name . "helm-swoop-same-face-at-point")
-                (candidates . ,(helm-swoop--cull-face-include-line $face))
-                (header-line . ,(format "%s" $face))
-                (action . (lambda ($line)
-                            (helm-swoop--goto-line
-                             (when (string-match "^[0-9]+" $line)
-                               (string-to-number (match-string 0 $line))))
-                            (let (($po (point))
-                                  ($poe (point-at-eol)))
-                              (while (<= (setq $po (next-single-property-change $po 'face)) $poe)
-                                (when (eq 'helm-swoop-target-word-face (helm-swoop--get-at-face $po))
-                                  (goto-char $po))))
-                            (helm-swoop--recenter))))))
-
-(defun helm-multi-swoop-same-face-at-point (&optional $face)
-  (interactive)
-  (or $face (setq $face (helm-swoop--get-at-face)))
-  (helm-multi-swoop--exec
-   nil
-   :$query ""
-   :$func (lambda () (helm-swoop--cull-face-include-line $face))
-   :$action (lambda ($line)
-              (switch-to-buffer (assoc-default 'name (helm-get-current-source)))
-              (helm-swoop--goto-line
-               (when (string-match "^[0-9]+" $line)
-                 (string-to-number (match-string 0 $line))))
-              (let (($po (point))
-                    ($poe (point-at-eol)))
-                (while (<= (setq $po (next-single-property-change $po 'face)) $poe)
-                  (when (eq 'helm-swoop-target-word-face (helm-swoop--get-at-face $po))
-                    (goto-char $po))))
-              (helm-swoop--recenter))
-   :$buflist (helm-multi-swoop--get-buffer-list)))
-
-(provide 'helm-swoop)
-;;; helm-swoop.el ends here
diff --git a/elpa/helm-swoop-20160131.533/helm-swoop-autoloads.el b/elpa/helm-swoop-20160131.533/helm-swoop-autoloads.el
new file mode 100644 (file)
index 0000000..1a55a9e
--- /dev/null
@@ -0,0 +1,76 @@
+;;; helm-swoop-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-swoop" "helm-swoop.el" (22215 7848 0
+;;;;;;  0))
+;;; Generated autoloads from helm-swoop.el
+
+(autoload 'helm-swoop-back-to-last-point "helm-swoop" "\
+Go back to last position where `helm-swoop' was called
+
+\(fn &optional $CANCEL)" t nil)
+
+(autoload 'helm-swoop "helm-swoop" "\
+List the all lines to another buffer, which is able to squeeze by
+ any words you input. At the same time, the original buffer's cursor
+ is jumping line to line according to moving up and down the list.
+
+\(fn &key $QUERY $SOURCE ($multiline current-prefix-arg))" t nil)
+
+(autoload 'helm-swoop-from-isearch "helm-swoop" "\
+Invoke `helm-swoop' from isearch.
+
+\(fn)" t nil)
+
+(autoload 'helm-multi-swoop "helm-swoop" "\
+Usage:
+M-x helm-multi-swoop
+1. Select any buffers by [C-SPC] or [M-SPC]
+2. Press [RET] to start helm-multi-swoop
+
+C-u M-x helm-multi-swoop
+If you have done helm-multi-swoop before, you can skip select buffers step.
+Last selected buffers will be applied to helm-multi-swoop.
+
+\(fn &optional $QUERY $BUFLIST)" t nil)
+
+(autoload 'helm-multi-swoop-all "helm-swoop" "\
+Apply all buffers to helm-multi-swoop
+
+\(fn &optional $QUERY)" t nil)
+
+(autoload 'helm-multi-swoop-org "helm-swoop" "\
+Applies all org-mode buffers to helm-multi-swoop
+
+\(fn &optional $QUERY)" t nil)
+
+(autoload 'helm-multi-swoop-current-mode "helm-swoop" "\
+Applies all buffers of the same mode as the current buffer to helm-multi-swoop
+
+\(fn &optional $QUERY)" t nil)
+
+(autoload 'helm-swoop-without-pre-input "helm-swoop" "\
+Start helm-swoop without pre input query.
+
+\(fn)" t nil)
+
+(autoload 'helm-swoop-symble-pre-input "helm-swoop" "\
+Start helm-swoop without pre input query.
+
+\(fn)" t nil)
+
+(autoload 'helm-multi-swoop-edit "helm-swoop" "\
+
+
+\(fn)" t nil)
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-swoop-autoloads.el ends here
diff --git a/elpa/helm-swoop-20160131.533/helm-swoop-pkg.el b/elpa/helm-swoop-20160131.533/helm-swoop-pkg.el
new file mode 100644 (file)
index 0000000..1e0e627
--- /dev/null
@@ -0,0 +1 @@
+(define-package "helm-swoop" "20160131.533" "Efficiently hopping squeezed lines powered by helm interface" '((helm "1.0") (emacs "24")) :url "https://github.com/ShingoFukuyama/helm-swoop" :keywords '("helm" "swoop" "inner" "buffer" "search"))
diff --git a/elpa/helm-swoop-20160131.533/helm-swoop.el b/elpa/helm-swoop-20160131.533/helm-swoop.el
new file mode 100644 (file)
index 0000000..53fb5d3
--- /dev/null
@@ -0,0 +1,1681 @@
+;;; helm-swoop.el --- Efficiently hopping squeezed lines powered by helm interface -*- coding: utf-8; lexical-binding: t -*-
+
+;; Copyright (C) 2013 by Shingo Fukuyama
+
+;; Version: 1.7.1
+;; Package-Version: 20160131.533
+;; Author: Shingo Fukuyama - http://fukuyama.co
+;; URL: https://github.com/ShingoFukuyama/helm-swoop
+;; Created: Oct 24 2013
+;; Keywords: helm swoop inner buffer search
+;; Package-Requires: ((helm "1.0") (emacs "24"))
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of
+;; the License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be
+;; useful, but WITHOUT ANY WARRANTY; without even the implied
+;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+;; PURPOSE.  See the GNU General Public License for more details.
+
+;;; Commentary:
+
+;; List the all lines to another buffer, which is able to squeeze
+;; by any words you input. At the same time, the original buffer's
+;; cursor is jumping line to line according to moving up and down
+;; the list.
+
+;; Example config
+;; ----------------------------------------------------------------
+;; ;; helm from https://github.com/emacs-helm/helm
+;; (require 'helm)
+
+;; ;; Locate the helm-swoop folder to your path
+;; ;; This line is unnecessary if you get this program from MELPA
+;; (add-to-list 'load-path "~/.emacs.d/elisp/helm-swoop")
+
+;; (require 'helm-swoop)
+
+;; ;; Change keybinds to whatever you like :)
+;; (global-set-key (kbd "M-i") 'helm-swoop)
+;; (global-set-key (kbd "M-I") 'helm-swoop-back-to-last-point)
+;; (global-set-key (kbd "C-c M-i") 'helm-multi-swoop)
+;; (global-set-key (kbd "C-x M-i") 'helm-multi-swoop-all)
+
+;; ;; When doing isearch, hand the word over to helm-swoop
+;; (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
+;; (define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
+
+;; ;; Save buffer when helm-multi-swoop-edit complete
+;; (setq helm-multi-swoop-edit-save t)
+
+;; ;; If this value is t, split window inside the current window
+;; (setq helm-swoop-split-with-multiple-windows nil)
+
+;; ;; Split direction. 'split-window-vertically or 'split-window-horizontally
+;; (setq helm-swoop-split-direction 'split-window-vertically)
+
+;; ;; If nil, you can slightly boost invoke speed in exchange for text color
+;; (setq helm-swoop-speed-or-color nil)
+
+;; ;; Go to the opposite side of line from the end or beginning of line
+;; (setq helm-swoop-move-to-line-cycle t)
+
+;; ;; Optional face for line numbers
+;; ;; Face name is `helm-swoop-line-number-face`
+;; (setq helm-swoop-use-line-number-face t)
+
+;; ----------------------------------------------------------------
+
+;; * `M-x helm-swoop` when region active
+;; * `M-x helm-swoop` when the cursor is at any symbol
+;; * `M-x helm-swoop` when the cursor is not at any symbol
+;; * `M-3 M-x helm-swoop` or `C-u 5 M-x helm-swoop` multi separated line culling
+;; * `M-x helm-multi-swoop` multi-occur like feature
+;; * `M-x helm-multi-swoop-all` apply all buffers
+;; * `C-u M-x helm-multi-swoop` apply last selected buffers from the second time
+;; * `M-x helm-swoop-same-face-at-point` list lines have the same face at the cursor is on
+;; * During isearch `M-i` to hand the word over to helm-swoop
+;; * During helm-swoop `M-i` to hand the word over to helm-multi-swoop-all
+;; * While doing `helm-swoop` press `C-c C-e` to edit mode, apply changes to original buffer by `C-x C-s`
+
+;; Helm Swoop Edit
+;; While doing helm-swoop, press keybind [C-c C-e] to move to edit buffer.
+;; Edit the list and apply by [C-x C-s]. If you'd like to cancel, [C-c C-g]
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+(require 'helm-utils)
+(require 'helm-grep)
+
+(declare-function migemo-search-pattern-get "migemo")
+
+;;; @ helm-swoop ----------------------------------------------
+
+(defgroup helm-swoop nil
+  "Open helm-swoop."
+  :prefix "helm-swoop-" :group 'helm)
+
+(defface helm-swoop-target-line-face
+  '((t (:background "#e3e300" :foreground "#222222")))
+  "Face for helm-swoop target line"
+  :group 'helm-swoop)
+(defface helm-swoop-target-line-block-face
+  '((t (:background "#cccc00" :foreground "#222222")))
+  "Face for target line"
+  :group 'helm-swoop)
+(defface helm-swoop-target-word-face
+  '((t (:background "#7700ff" :foreground "#ffffff")))
+  "Face for target word"
+  :group 'helm-swoop)
+(defface helm-swoop-line-number-face
+  '((t (:foreground "#999999")))
+  "Face for line numbers"
+  :group 'helm-swoop)
+
+(defcustom helm-swoop-speed-or-color nil
+ "If nil, you can slightly boost invoke speed in exchange for text color"
+ :group 'helm-swoop :type 'boolean)
+(defcustom helm-swoop-use-line-number-face nil
+  "Use face to line numbers on helm-swoop buffer"
+  :group 'helm-swoop :type 'boolean)
+(defcustom helm-swoop-split-with-multiple-windows nil
+ "Split window when having multiple windows open"
+ :group 'helm-swoop :type 'boolean)
+(defcustom helm-swoop-move-to-line-cycle t
+ "Return to the opposite side of line"
+ :group 'helm-swoop :type 'boolean)
+(defcustom helm-swoop-split-direction 'split-window-vertically
+ "Split direction"
+ :type '(choice (const :tag "vertically"   split-window-vertically)
+                (const :tag "horizontally" split-window-horizontally))
+ :group 'helm-swoop)
+(defcustom helm-swoop-use-fuzzy-match nil
+  "If t, use fuzzy matching functions as well as exact matches."
+  :group 'helm-swoop :type 'boolean)
+
+(defvar helm-swoop-split-window-function
+  (lambda ($buf)
+   (if helm-swoop-split-with-multiple-windows
+       (funcall helm-swoop-split-direction)
+       (when (one-window-p)
+        (funcall helm-swoop-split-direction)))
+    (other-window 1)
+    (switch-to-buffer $buf))
+  "Change the way to split window only when `helm-swoop' is calling")
+
+(defvar helm-swoop-candidate-number-limit 19999)
+(defvar helm-swoop-buffer "*Helm Swoop*")
+(defvar helm-swoop-prompt "Swoop: ")
+(defvar helm-swoop-last-point nil)
+(defvar helm-swoop-invisible-targets nil)
+(defvar helm-swoop-last-line-info nil)
+
+;; Buffer local variables
+(defvar helm-swoop-list-cache)
+(defvar helm-swoop-pattern)            ; Keep helm-pattern value
+(defvar helm-swoop-last-query)         ; Last search query for resume
+(defvar helm-swoop-last-prefix-number) ; For multiline highlight
+
+;; Global variables
+(defvar helm-swoop-synchronizing-window nil
+  "Window object where `helm-swoop' called from")
+(defvar helm-swoop-target-buffer nil
+  "Buffer object where `helm-swoop' called from")
+(defvar helm-swoop-line-overlay nil
+  "Overlay object to indicate other window's line")
+
+(defvar helm-swoop-map
+  (let (($map (make-sparse-keymap)))
+    (set-keymap-parent $map helm-map)
+    (define-key $map (kbd "C-c C-e") 'helm-swoop-edit)
+    (define-key $map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
+    (define-key $map (kbd "C-w") 'helm-swoop-yank-thing-at-point)
+    (define-key $map (kbd "^") 'helm-swoop-caret-match)
+    (delq nil $map))
+  "Keymap for helm-swoop")
+
+(defvar helm-multi-swoop-map
+  (let (($map (make-sparse-keymap)))
+    (set-keymap-parent $map helm-map)
+    (define-key $map (kbd "C-c C-e") 'helm-multi-swoop-edit)
+    (delq nil $map)))
+
+(defvar helm-c-source-swoop-match-functions
+  '(helm-mm-exact-match
+    helm-mm-match
+    helm-mm-3-migemo-match))
+
+(defvar helm-c-source-swoop-search-functions
+   '(helm-mm-exact-search
+     helm-mm-search
+     helm-candidates-in-buffer-search-default-fn
+     helm-mm-3-migemo-search))
+
+(defun helm-swoop-match-functions ()
+  (if helm-swoop-use-fuzzy-match
+      (append helm-c-source-swoop-match-functions '(helm-fuzzy-match))
+    helm-c-source-swoop-match-functions))
+
+(defun helm-swoop-search-functions ()
+  (if helm-swoop-use-fuzzy-match
+      (append helm-c-source-swoop-search-functions '(helm-fuzzy-search))
+    helm-c-source-swoop-search-functions))
+
+(defcustom helm-swoop-pre-input-function
+  (lambda () (thing-at-point 'symbol))
+  "This function can pre-input keywords when helm-swoop invoked"
+  :group 'helm-swoop :type 'function)
+
+(defun helm-swoop-pre-input-optimize ($query)
+  (when $query
+    (let (($regexp (list '("\+" . "\\\\+")
+                         '("\*" . "\\\\*")
+                         '("\#" . "\\\\#"))))
+      (mapc (lambda ($r)
+              (setq $query (replace-regexp-in-string (car $r) (cdr $r) $query)))
+            $regexp)
+      $query)))
+
+(defsubst helm-swoop--goto-line ($line)
+  (goto-char (point-min))
+  (forward-line (1- $line)))
+
+(defsubst helm-swoop--recenter ()
+  (recenter (/ (window-height) 2)))
+
+(defsubst helm-swoop--key-of-function ($function &optional $mode-map)
+  (edmacro-format-keys (car (where-is-internal $function $mode-map))))
+
+(defsubst helm-swoop--delete-overlay ($identity &optional $beg $end)
+  (or $beg (setq $beg (point-min)))
+  (or $end (setq $end (point-max)))
+  (overlay-recenter $end)
+  (mapc (lambda ($o)
+          (if (overlay-get $o $identity)
+              (delete-overlay $o)))
+        (overlays-in $beg $end)))
+
+(defsubst helm-swoop--get-string-at-line ()
+  (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
+
+(defsubst helm-swoop--buffer-substring ($point-min $point-max)
+  (if helm-swoop-speed-or-color
+      (let (($content (buffer-substring $point-min $point-max)))
+        (with-temp-buffer
+          (let ((inhibit-read-only t))
+            (insert $content)
+            (remove-text-properties (point-min) (point-max) '(read-only t))
+            (setq $content (buffer-substring (point-min) (point-max)))))
+        $content)
+    (buffer-substring-no-properties $point-min $point-max)))
+
+;;;###autoload
+(defun helm-swoop-back-to-last-point (&optional $cancel)
+  "Go back to last position where `helm-swoop' was called"
+  (interactive)
+  (if helm-swoop-last-point
+      (let (($po (point)))
+        (switch-to-buffer (cdr helm-swoop-last-point))
+        (goto-char (car helm-swoop-last-point))
+        (unless $cancel
+          (setq helm-swoop-last-point
+                (cons $po (buffer-name (current-buffer))))))))
+
+(defun helm-swoop--split-lines-by ($string $regexp $step)
+  "split-string by $step for multiline"
+  (or $step (setq $step 1))
+  (let (($from1 0) ;; last match point
+        ($from2 0) ;; last substring point
+        $list
+        ($i 1)) ;; from line 1
+    (while (string-match $regexp $string $from1)
+      (setq $i (1+ $i))
+      (if (eq 0 (% $i $step))
+          (progn
+            (setq $list (cons (substring $string $from2 (match-beginning 0))
+                              $list))
+            (setq $from2 (match-end 0))
+            (setq $from1 (match-end 0)))
+        (setq $from1 (match-end 0))))
+    (setq $list (cons (substring $string $from2) $list))
+    (nreverse $list)))
+
+(defun helm-swoop--target-line-overlay-move (&optional $buf)
+  "Add color to the target line"
+  (move-overlay
+   helm-swoop-line-overlay
+   (progn
+     (search-backward
+      "\n" nil t (% (line-number-at-pos) helm-swoop-last-prefix-number))
+     (goto-char (point-at-bol)))
+   ;; For multiline highlight
+   (save-excursion
+     (goto-char (point-at-bol))
+     (or (re-search-forward "\n" nil t helm-swoop-last-prefix-number)
+         ;; For the end of buffer error
+         (point-max)))
+   $buf)
+  (helm-swoop--unveil-invisible-overlay))
+
+(defun helm-swoop--validate-regexp (regexp)
+  (condition-case nil
+      (progn
+        (string-match-p regexp "")
+        t)
+    (invalid-regexp nil)))
+
+(defun helm-swoop--target-word-overlay ($identity &optional $threshold)
+  (interactive)
+  (or $threshold (setq $threshold 2))
+  (save-excursion
+    (let (($pat (split-string helm-pattern " "))
+          $o)
+      (mapc (lambda ($wd)
+              (when (and (helm-swoop--validate-regexp $wd) (< $threshold (length $wd)))
+                (goto-char (point-min))
+                ;; Optional require migemo.el
+                (if (and (featurep 'migemo) helm-migemo-mode)
+                    (setq $wd (migemo-search-pattern-get $wd)))
+                ;; For caret begging match
+                (if (string-match "^\\^\\[0\\-9\\]\\+\\.\\(.+\\)" $wd)
+                    (setq $wd (concat "^" (match-string 1 $wd))))
+                (overlay-recenter (point-max))
+                (let (finish)
+                  (while (and (not finish) (re-search-forward $wd nil t))
+                    (if (= (match-beginning 0) (match-end 0))
+                        (forward-char 1)
+                      (setq $o (make-overlay (match-beginning 0) (match-end 0)))
+                      (overlay-put $o 'face 'helm-swoop-target-word-face)
+                      (overlay-put $o $identity t))
+                    (when (eobp)
+                      (setq finish t))))))
+            $pat))))
+
+(defun helm-swoop--restore-unveiled-overlay ()
+  (when helm-swoop-invisible-targets
+    (mapc (lambda ($ov) (overlay-put (car $ov) 'invisible (cdr $ov)))
+          helm-swoop-invisible-targets)
+    (setq helm-swoop-invisible-targets nil)))
+
+(defun helm-swoop--unveil-invisible-overlay ()
+  "Show hidden text temporarily to view it during helm-swoop.
+This function needs to call after latest helm-swoop-line-overlay set."
+  (helm-swoop--restore-unveiled-overlay)
+  (mapc (lambda ($ov)
+          (let (($type (overlay-get $ov 'invisible)))
+            (when $type
+              (overlay-put $ov 'invisible nil)
+              (setq helm-swoop-invisible-targets
+                    (cons (cons $ov $type) helm-swoop-invisible-targets)))))
+        (overlays-in (overlay-start helm-swoop-line-overlay)
+                     (overlay-end helm-swoop-line-overlay))))
+
+;; helm action ------------------------------------------------
+
+(defadvice helm-next-line (around helm-swoop-next-line disable)
+  (let ((helm-move-to-line-cycle-in-source t))
+    ad-do-it
+    (when (called-interactively-p 'any)
+      (helm-swoop--move-line-action))))
+
+(defadvice helm-previous-line (around helm-swoop-previous-line disable)
+  (let ((helm-move-to-line-cycle-in-source t))
+    ad-do-it
+    (when (called-interactively-p 'any)
+      (helm-swoop--move-line-action))))
+
+(defadvice helm-toggle-visible-mark (around helm-swoop-toggle-visible-mark disable)
+  (let ((helm-move-to-line-cycle-in-source t))
+    ad-do-it
+    (when (called-interactively-p 'any)
+      (helm-swoop--move-line-action))))
+
+(defun helm-swoop--move-line-action ()
+  (with-helm-window
+    (let* (($key (helm-swoop--get-string-at-line))
+           ($num (when (string-match "^[0-9]+" $key)
+                   (string-to-number (match-string 0 $key)))))
+      ;; Synchronizing line position
+      (when (and $key $num)
+        (with-selected-window helm-swoop-synchronizing-window
+          (progn
+            (helm-swoop--goto-line $num)
+            (with-current-buffer helm-swoop-target-buffer
+              (delete-overlay helm-swoop-line-overlay)
+              (helm-swoop--target-line-overlay-move))
+            (helm-swoop--recenter)))
+        (setq helm-swoop-last-line-info
+              (cons helm-swoop-target-buffer $num))))))
+
+(defun helm-swoop--nearest-line ($target $list)
+  "Return the nearest number of $target out of $list."
+  (when (and $target $list)
+    (let ($result)
+      (cl-labels ((filter ($fn $elem $list)
+                          (let ($r)
+                            (mapc (lambda ($e)
+                                    (if (funcall $fn $elem $e)
+                                        (setq $r (cons $e $r))))
+                                  $list) $r)))
+        (if (eq 1 (length $list))
+            (setq $result (car $list))
+          (let* (($lts (filter '> $target $list))
+                 ($gts (filter '< $target $list))
+                 ($lt (if $lts (apply 'max $lts)))
+                 ($gt (if $gts (apply 'min $gts)))
+                 ($ltg (if $lt (- $target $lt)))
+                 ($gtg (if $gt (- $gt $target))))
+            (setq $result
+                  (cond ((memq $target $list) $target)
+                        ((and (not $lt) (not $gt)) nil)
+                        ((not $gtg) $lt)
+                        ((not $ltg) $gt)
+                        ((eq $ltg $gtg) $gt)
+                        ((< $ltg $gtg) $lt)
+                        ((> $ltg $gtg) $gt)
+                        (t 1))))))
+      $result)))
+
+(defun helm-swoop--keep-nearest-position ()
+  (with-helm-window
+    (let (($p (point-min)) $list $bound
+          $nearest-line $target-point
+          ($buf (rx-to-string (buffer-name (car helm-swoop-last-line-info)) t)))
+      (save-excursion
+        (goto-char $p)
+        (while (if $p (setq $p (re-search-forward (concat "^" $buf "$") nil t)))
+          (when (get-text-property (point-at-bol) 'helm-header)
+            (forward-char 1)
+            (setq $bound (next-single-property-change (point) 'helm-header))
+            (while (re-search-forward "^[0-9]+" $bound t)
+              (setq $list (cons
+                           (string-to-number (match-string 0))
+                           $list)))
+            (setq $nearest-line (helm-swoop--nearest-line
+                            (cdr helm-swoop-last-line-info)
+                            $list))
+            (goto-char $p)
+            (re-search-forward (concat "^"
+                                       (number-to-string $nearest-line)
+                                       "\\s-") $bound t)
+            (setq $target-point (point))
+            (setq $p nil))))
+      (when $target-point
+        (goto-char $target-point)
+        (helm-mark-current-line)
+        (if (equal helm-swoop-buffer (buffer-name (current-buffer)))
+            (helm-swoop--move-line-action)
+          (helm-multi-swoop--move-line-action))))))
+
+(defun helm-swoop--pattern-match ()
+  "Overlay target words"
+  (with-helm-window
+    (setq helm-swoop-pattern helm-pattern)
+    (when (< 2 (length helm-pattern))
+      (helm-swoop--delete-overlay 'target-buffer)
+      (helm-swoop--target-word-overlay 'target-buffer)
+      (with-selected-window helm-swoop-synchronizing-window
+        (helm-swoop--delete-overlay 'target-buffer)
+        (helm-swoop--target-word-overlay 'target-buffer)))))
+
+(defun helm-swoop-flash-word ($match-beg $match-end)
+  (interactive)
+  (unwind-protect
+      (let (($o (make-overlay $match-beg $match-end)))
+        (when $o
+          (overlay-put $o 'face 'helm-swoop-target-word-face)
+          (overlay-put $o 'helm-swoop-overlay-word-frash t)))
+    (run-with-idle-timer
+     0.6 nil (lambda () (helm-swoop--delete-overlay 'helm-swoop-overlay-word-frash)))))
+
+;; core ------------------------------------------------
+
+(defun helm-swoop--get-content ($buffer &optional $linum)
+  "Get the whole content in buffer and add line number at the head.
+If $linum is number, lines are separated by $linum"
+  (let (($buf (get-buffer $buffer)))
+    (when $buf
+      (with-current-buffer $buf
+        (let (($bufstr (helm-swoop--buffer-substring (point-min) (point-max)))
+              $return)
+          (with-temp-buffer
+            (insert $bufstr)
+            (goto-char (point-min))
+            (let (($i 1))
+              (insert (format "%s " $i))
+              (while (re-search-forward "\n" nil t)
+                (cl-incf $i)
+                (if helm-swoop-use-line-number-face
+                    (insert (propertize (format "%s" $i) 'font-lock-face 'helm-swoop-line-number-face) " ")
+                  (insert (format "%s " $i))))
+              ;; Delete empty lines
+              (unless $linum
+                (goto-char (point-min))
+                (while (re-search-forward "^[0-9]+\\s-*$" nil t)
+                  (replace-match ""))))
+            (setq $return (helm-swoop--buffer-substring (point-min) (point-max))))
+          $return)))))
+
+(defun helm-c-source-swoop ()
+  `((name . ,(buffer-name helm-swoop-target-buffer))
+    (candidates . ,(if helm-swoop-list-cache
+                       (progn
+                         (helm-swoop--split-lines-by
+                          helm-swoop-list-cache "\n" helm-swoop-last-prefix-number))
+                     (helm-swoop--split-lines-by
+                      (setq helm-swoop-list-cache
+                            (helm-swoop--get-content helm-swoop-target-buffer t))
+                      "\n" helm-swoop-last-prefix-number)))
+    (get-line . ,(if helm-swoop-speed-or-color
+                     'helm-swoop--buffer-substring
+                   'buffer-substring-no-properties))
+    (keymap . ,helm-swoop-map)
+    (header-line . "[C-c C-e] Edit mode, [M-i] apply all buffers")
+    (action . (("Go to Line"
+                . (lambda ($line)
+                    (helm-swoop--goto-line
+                     (when (string-match "^[0-9]+" $line)
+                       (string-to-number (match-string 0 $line))))
+                    (let (($regex
+                           (mapconcat 'identity
+                                      (split-string helm-pattern " ")
+                                      "\\|")))
+                      (when (or (and (and (featurep 'migemo) helm-migemo-mode)
+                                     (migemo-forward $regex nil t))
+                                (re-search-forward $regex nil t))
+                        (helm-swoop-flash-word (match-beginning 0) (match-end 0))
+                        (goto-char (match-beginning 0))))
+                    (helm-swoop--recenter)))))
+    ,(if (and helm-swoop-last-prefix-number
+              (> helm-swoop-last-prefix-number 1))
+         '(multiline))
+    (match . ,(helm-swoop-match-functions))
+    (search . ,(helm-swoop-search-functions))))
+
+(defun helm-c-source-multi-swoop ($buf $func $action $multiline)
+  `((name . ,$buf)
+    (candidates . ,(funcall $func))
+    (action . ,$action)
+    (header-line . ,(concat $buf "    [C-c C-e] Edit mode"))
+    (keymap . ,helm-multi-swoop-map)
+    (requires-pattern . 2)
+    ,(if (and $multiline
+              (> $multiline 1))
+         '(multiline))
+    (match . ,(helm-swoop-match-functions))
+    (search . ,(helm-swoop-search-functions))))
+
+(defun helm-swoop--set-prefix (&optional $multiline)
+  ;; Enable scrolling margin
+  (if (boundp 'helm-swoop-last-prefix-number)
+      (setq helm-swoop-last-prefix-number
+            (or $multiline 1)) ;; $multiline is for resume
+    (set (make-local-variable 'helm-swoop-last-prefix-number)
+         (or $multiline 1))))
+(helm-swoop--set-prefix) ;; Silence error "Warning: reference to free variable"
+
+;; Delete cache when modified file is saved
+(defun helm-swoop--clear-cache ()
+  (if (boundp 'helm-swoop-list-cache) (setq helm-swoop-list-cache nil)))
+(add-hook 'after-save-hook 'helm-swoop--clear-cache)
+
+(defadvice narrow-to-region (around helm-swoop-advice-narrow-to-region activate)
+  (helm-swoop--clear-cache)
+  ad-do-it)
+(defadvice narrow-to-defun (around helm-swoop-advice-narrow-to-defun activate)
+  (helm-swoop--clear-cache)
+  ad-do-it)
+(defadvice narrow-to-page (around helm-swoop-advice-narrow-to-page activate)
+  (helm-swoop--clear-cache)
+  ad-do-it)
+(defadvice widen (around helm-swoop-advice-widen activate)
+  (helm-swoop--clear-cache)
+  ad-do-it)
+
+(defun helm-swoop--restore ()
+  (when (= 1 helm-exit-status)
+    (helm-swoop-back-to-last-point t)
+    (helm-swoop--restore-unveiled-overlay))
+  (setq helm-swoop-invisible-targets nil)
+  (ad-disable-advice 'helm-next-line 'around 'helm-swoop-next-line)
+  (ad-activate 'helm-next-line)
+  (ad-disable-advice 'helm-previous-line 'around 'helm-swoop-previous-line)
+  (ad-activate 'helm-previous-line)
+  (ad-disable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark)
+  (ad-activate 'helm-toggle-visible-mark)
+  (ad-disable-advice 'helm-move--next-line-fn 'around
+                     'helm-multi-swoop-next-line-cycle)
+  (ad-activate 'helm-move--next-line-fn)
+  (ad-disable-advice 'helm-move--previous-line-fn 'around
+                     'helm-multi-swoop-previous-line-cycle)
+  (ad-activate 'helm-move--previous-line-fn)
+  (remove-hook 'helm-update-hook 'helm-swoop--pattern-match)
+  (remove-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position)
+  (setq helm-swoop-last-query helm-swoop-pattern)
+  (mapc (lambda ($ov)
+          (when (or (eq 'helm-swoop-target-line-face (overlay-get $ov 'face))
+                    (eq 'helm-swoop-target-line-block-face
+                        (overlay-get $ov 'face)))
+            (delete-overlay $ov)))
+        (overlays-in (point-min) (point-max)))
+  (helm-swoop--delete-overlay 'target-buffer)
+  (deactivate-mark t))
+
+;;;###autoload
+(cl-defun helm-swoop (&key $query $source ($multiline current-prefix-arg))
+  "List the all lines to another buffer, which is able to squeeze by
+ any words you input. At the same time, the original buffer's cursor
+ is jumping line to line according to moving up and down the list."
+  (interactive)
+  (setq helm-swoop-synchronizing-window (selected-window))
+  (setq helm-swoop-last-point (cons (point) (buffer-name (current-buffer))))
+  (setq helm-swoop-last-line-info
+        (cons (current-buffer) (line-number-at-pos)))
+  (unless (boundp 'helm-swoop-last-query)
+    (set (make-local-variable 'helm-swoop-last-query) ""))
+  (setq helm-swoop-target-buffer (current-buffer))
+  (helm-swoop--set-prefix (prefix-numeric-value $multiline))
+  ;; Overlay
+  (setq helm-swoop-line-overlay (make-overlay (point) (point)))
+  (overlay-put helm-swoop-line-overlay
+               'face (if (< 1 helm-swoop-last-prefix-number)
+                         'helm-swoop-target-line-block-face
+                       'helm-swoop-target-line-face))
+  ;; Cache
+  (cond ((not (boundp 'helm-swoop-list-cache))
+         (set (make-local-variable 'helm-swoop-list-cache) nil))
+        ((buffer-modified-p)
+         (setq helm-swoop-list-cache nil)))
+  (unwind-protect
+      (progn
+        ;; For synchronizing line position
+        (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line)
+        (ad-activate 'helm-next-line)
+        (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line)
+        (ad-activate 'helm-previous-line)
+        (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark)
+        (ad-activate 'helm-toggle-visible-mark)
+        (ad-enable-advice 'helm-move--next-line-fn 'around
+                          'helm-multi-swoop-next-line-cycle)
+        (ad-activate 'helm-move--next-line-fn)
+        (ad-enable-advice 'helm-move--previous-line-fn 'around
+                          'helm-multi-swoop-previous-line-cycle)
+        (ad-activate 'helm-move--previous-line-fn)
+        (add-hook 'helm-update-hook 'helm-swoop--pattern-match)
+        (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t)
+        (cond ($query
+               (if (string-match
+                    "\\(\\^\\[0\\-9\\]\\+\\.\\)\\(.*\\)" $query)
+                   $query ;; NEED FIX #1 to appear as a "^"
+                 $query))
+              (mark-active
+               (let (($st (buffer-substring-no-properties
+                           (region-beginning) (region-end))))
+                 (if (string-match "\n" $st)
+                     (message "Multi line region is not allowed")
+                   (setq $query (helm-swoop-pre-input-optimize $st)))))
+              ((setq $query (helm-swoop-pre-input-optimize
+                             (funcall helm-swoop-pre-input-function))))
+              (t (setq $query "")))
+        ;; First behavior
+        (helm-swoop--recenter)
+        (move-beginning-of-line 1)
+        (helm-swoop--target-line-overlay-move)
+        ;; Execute helm
+        (let ((helm-display-function helm-swoop-split-window-function)
+              (helm-display-source-at-screen-top nil)
+              (helm-completion-window-scroll-margin 5))
+          (helm :sources
+                (or $source
+                    (helm-c-source-swoop))
+                :buffer helm-swoop-buffer
+                :input $query
+                :prompt helm-swoop-prompt
+                :preselect
+                ;; Get current line has content or else near one
+                (if (string-match "^[\t\n\s]*$" (helm-swoop--get-string-at-line))
+                    (save-excursion
+                      (if (re-search-forward "[^\t\n\s]" nil t)
+                          (format "^%s\s" (line-number-at-pos))
+                        (re-search-backward "[^\t\n\s]" nil t)
+                        (format "^%s\s" (line-number-at-pos))))
+                  (format "^%s\s" (line-number-at-pos)))
+                :candidate-number-limit helm-swoop-candidate-number-limit)))
+    ;; Restore helm's hook and window function etc
+    (helm-swoop--restore)))
+
+;; Receive word from isearch ---------------
+;;;###autoload
+(defun helm-swoop-from-isearch ()
+  "Invoke `helm-swoop' from isearch."
+  (interactive)
+  (let (($query (if isearch-regexp
+                    isearch-string
+                  (regexp-quote isearch-string))))
+    (let (search-nonincremental-instead)
+      (isearch-exit))
+    (helm-swoop :$query $query)))
+;; When doing isearch, hand the word over to helm-swoop
+(define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
+
+;; Receive word from evil search ---------------
+(defun helm-swoop-from-evil-search ()
+  "Invoke `helm-swoop' from evil isearch"
+  (interactive)
+  (if (string-match "\\(isearch-\\|evil.*search\\)" (symbol-name real-last-command))
+      (helm-swoop :$query (if isearch-regexp
+                              isearch-string
+                            (regexp-quote isearch-string)))
+    (helm-swoop)))
+;; When doing evil-search, hand the word over to helm-swoop
+;; (define-key evil-motion-state-map (kbd "M-i") 'helm-swoop-from-evil-search)
+
+;; Receive word from evil search ---------------
+(defun helm-swoop-yank-thing-at-point ()
+  "Insert string at which the point helm-swoop started."
+  (interactive)
+  (let ($amend $buf)
+    (with-selected-window helm-swoop-synchronizing-window
+      (setq $buf (get-buffer (cdr helm-swoop-last-point)))
+      (when $buf
+        (with-current-buffer $buf
+          (save-excursion
+            (goto-char (car helm-swoop-last-point))
+            (setq $amend (thing-at-point 'symbol))))))
+    (when $amend
+      (with-selected-window (minibuffer-window)
+        (insert $amend)))))
+
+;; For helm-resume ------------------------
+(defadvice helm-resume-select-buffer
+  (around helm-swoop-if-selected-as-resume activate)
+  "Resume if *Helm Swoop* buffer selected as a resume
+ when helm-resume with prefix"
+  (if (boundp 'helm-swoop-last-query)
+      ad-do-it
+    ;; If the buffer hasn't called helm-swoop, just hide from options
+    (let ((helm-buffers (delete helm-swoop-buffer helm-buffers)))
+      ad-do-it))
+  (when (and (equal ad-return-value helm-swoop-buffer)
+             (boundp 'helm-swoop-last-query))
+    (helm-swoop :$query helm-swoop-last-query
+                :$multiline helm-swoop-last-prefix-number)
+    (setq ad-return-value nil)))
+
+(defadvice helm-resume (around helm-swoop-resume activate)
+  "Resume if the last used helm buffer is helm-swoop-buffer"
+  (if (equal helm-last-buffer helm-swoop-buffer)
+      (if (boundp 'helm-swoop-last-query)
+          (if (not (ad-get-arg 0))
+              (helm-swoop :$query helm-swoop-last-query
+                          :$multiline helm-swoop-last-prefix-number))
+        ;; Temporary apply second last buffer
+        (let ((helm-last-buffer (cadr helm-buffers))) ad-do-it))
+    ad-do-it))
+
+;; For caret beginning-match -----------------------------
+(defun helm-swoop--caret-match-delete ($o $aft $beg $end &optional $len)
+  (if $aft
+      (- $end $beg $len) ;; Unused argument? To avoid byte compile error
+    (delete-region (overlay-start $o) (1- (overlay-end $o)))))
+
+(defun helm-swoop-caret-match (&optional _$resume)
+  (interactive)
+  (let* (($prompt helm-swoop-prompt) ;; Accept change of the variable
+         ($line-number-regexp "^[0-9]+.")
+         ($prompt-regexp
+          (funcall `(lambda ()
+                      (rx bol ,$prompt))))
+         ($prompt-regexp-with-line-number
+          (funcall `(lambda ()
+                      (rx bol ,$prompt (group ,$line-number-regexp)))))
+         ($disguise-caret
+          (lambda ()
+            (save-excursion
+              (re-search-backward $prompt-regexp-with-line-number nil t)
+              (let (($o (make-overlay (match-beginning 1) (match-end 1))))
+                (overlay-put $o 'face 'helm-swoop-target-word-face)
+                (overlay-put $o 'modification-hooks '(helm-swoop--caret-match-delete))
+                (overlay-put $o 'display "^")
+                (overlay-put $o 'evaporate t))))))
+    (if (and (minibufferp)
+             (string-match $prompt-regexp
+                           (buffer-substring-no-properties
+                            (point-min) (point-max)))
+             (eq (point) (+ 1 (length helm-swoop-prompt))))
+        (progn
+          (insert $line-number-regexp)
+          (funcall $disguise-caret))
+      (insert "^"))))
+
+;;; @ helm-swoop-edit -----------------------------------------
+
+(defvar helm-swoop-edit-target-buffer)
+(defvar helm-swoop-edit-buffer "*Helm Swoop Edit*")
+(defvar helm-swoop-edit-map
+  (let (($map (make-sparse-keymap)))
+    (define-key $map (kbd "C-x C-s") 'helm-swoop--edit-complete)
+    (define-key $map (kbd "C-c C-g") 'helm-swoop--edit-cancel)
+    (define-key $map (kbd "C-c C-q C-k") 'helm-swoop--edit-delete-all-lines)
+    $map))
+
+(defun helm-swoop--clear-edit-buffer ($prop)
+  (let ((inhibit-read-only t))
+    (mapc (lambda ($ov)
+            (when (overlay-get $ov $prop)
+              (delete-overlay $ov)))
+          (overlays-in (point-min) (point-max)))
+    (set-text-properties (point-min) (point-max) nil)
+    (goto-char (point-min))
+    (erase-buffer)))
+
+(defun helm-swoop--collect-edited-lines ()
+  "Create a list of edited lines with each its own line number"
+  (interactive)
+  (let ($list)
+    (goto-char (point-min))
+    (while (re-search-forward "^\\([0-9]+\\)\s" nil t)
+      (setq $list
+            (cons (cons (string-to-number (match-string 1))
+                        (buffer-substring-no-properties
+                         (point)
+                         (save-excursion
+                           (if (re-search-forward
+                                "^\\([0-9]+\\)\s\\|^\\(\\-+\\)" nil t)
+                               (1- (match-beginning 0))
+                             (goto-char (point-max))
+                             (re-search-backward "\n" nil t)))))
+                  $list)))
+    $list))
+
+(defun helm-swoop--edit ($candidate)
+  "This function will only be called from `helm-swoop-edit'"
+  (interactive)
+  (setq helm-swoop-edit-target-buffer helm-swoop-target-buffer)
+  (delete-overlay helm-swoop-line-overlay)
+  (helm-swoop--delete-overlay 'target-buffer)
+  (with-current-buffer (get-buffer-create helm-swoop-edit-buffer)
+
+    (helm-swoop--clear-edit-buffer 'helm-swoop-edit)
+    (let (($bufstr ""))
+      ;; Get target line number to edit
+      (with-current-buffer helm-swoop-buffer
+        ;; Use selected line by [C-SPC] or [M-SPC]
+        (mapc (lambda ($ov)
+                (when (eq 'helm-visible-mark (overlay-get $ov 'face))
+                  (setq $bufstr (concat (buffer-substring-no-properties
+                                         (overlay-start $ov) (overlay-end $ov))
+                                        $bufstr))))
+              (overlays-in (point-min) (point-max)))
+        (if (equal "" $bufstr)
+            ;; Not found selected line
+            (setq $bufstr (buffer-substring-no-properties
+                           (point-min) (point-max)))
+          ;; Attach title
+          (setq $bufstr (concat "Helm Swoop\n" $bufstr))))
+
+      ;; Set for edit buffer
+      (insert $bufstr)
+      (add-text-properties (point-min) (point-max)
+                           '(read-only t rear-nonsticky t front-sticky t))
+
+      ;; Set for editable context
+      (let ((inhibit-read-only t))
+        ;; Title and explanation
+        (goto-char (point-min))
+        (let (($o (make-overlay (point) (point-at-eol))))
+          (overlay-put $o 'helm-swoop-edit t)
+          (overlay-put $o 'face 'font-lock-function-name-face)
+          (overlay-put $o 'after-string
+                       (propertize
+                        (format " [%s] Complete, [%s] Cancel, [%s] Delete All"
+                                (helm-swoop--key-of-function 'helm-swoop--edit-complete helm-swoop-edit-map)
+                                (helm-swoop--key-of-function 'helm-swoop--edit-cancel helm-swoop-edit-map)
+                                (helm-swoop--key-of-function 'helm-swoop--edit-delete-all-lines helm-swoop-edit-map))
+                        'face 'helm-bookmark-addressbook)))
+        ;; Line number and editable area
+        (while (re-search-forward "^\\([0-9]+\s\\)\\(.*\\)$" nil t)
+          (let* (($bol1 (match-beginning 1))
+                 ($eol1 (match-end 1))
+                 ($bol2 (match-beginning 2))
+                 ($eol2 (match-end 2)))
+            ;; Line number
+            (add-text-properties $bol1 $eol1
+                                 '(face font-lock-function-name-face
+                                   intangible t))
+            ;; Editable area
+            (remove-text-properties $bol2 $eol2 '(read-only t))
+            ;; For line tail
+            (set-text-properties $eol2 (or (1+ $eol2) (point-max))
+                                 '(read-only t rear-nonsticky t))))
+        (helm-swoop--target-word-overlay 'edit-buffer 0))))
+
+  (other-window 1)
+  (switch-to-buffer helm-swoop-edit-buffer)
+  (goto-char (point-min))
+  (if (string-match "^[0-9]+" $candidate)
+      (re-search-forward
+       (concat "^" (match-string 0 $candidate)) nil t))
+  (use-local-map helm-swoop-edit-map))
+
+(defun helm-swoop--edit-complete ()
+  "Apply changes and kill temporary edit buffer"
+  (interactive)
+  (let (($list (helm-swoop--collect-edited-lines)))
+    (with-current-buffer helm-swoop-edit-target-buffer
+      ;; Replace from the end of buffer
+      (save-excursion
+        (mapc (lambda ($cell)
+                (let (($k (car $cell))
+                      ($v (cdr $cell)))
+                  (goto-char (point-min))
+                  (delete-region (point-at-bol $k) (point-at-eol $k))
+                  (goto-char (point-at-bol $k))
+                  (insert $v)))
+              $list)))
+    (select-window helm-swoop-synchronizing-window)
+    (kill-buffer (get-buffer helm-swoop-edit-buffer)))
+  (message "Successfully helm-swoop-edit applied to original buffer"))
+
+(defun helm-swoop--edit-delete-all-lines ()
+  "Apply changes and kill temporary edit buffer"
+  (interactive)
+  (let (($list (helm-swoop--collect-edited-lines)))
+    (with-current-buffer helm-swoop-edit-target-buffer
+      ;; Replace from the end of buffer
+      (save-excursion
+        (mapc (lambda ($cell)
+                (let (($k (car $cell)))
+                  (goto-char (point-min))
+                  (delete-region (point-at-bol $k)
+                                 (if (eq (point-at-eol $k) (point-max))
+                                     (point-at-eol $k)
+                                   (1+ (point-at-eol $k))))))
+              $list)))
+    (select-window helm-swoop-synchronizing-window)
+    (kill-buffer (get-buffer helm-swoop-edit-buffer)))
+  (message "Successfully helm-swoop-edit applied to original buffer"))
+
+(defun helm-swoop--edit-cancel ()
+  "Cancel edit and kill temporary buffer"
+  (interactive)
+  (select-window helm-swoop-synchronizing-window)
+  (kill-buffer (get-buffer helm-swoop-edit-buffer))
+  (message "helm-swoop-edit canceled"))
+
+(defun helm-swoop-edit ()
+  (interactive)
+  (helm-exit-and-execute-action 'helm-swoop--edit))
+
+;;; @ helm-multi-swoop ----------------------------------------
+(defvar helm-multi-swoop-buffer-list "*helm-multi-swoop buffers list*"
+  "Buffer name")
+(defvar helm-multi-swoop-ignore-buffers-match "^\\*"
+  "Regexp to eliminate buffers you don't want to see")
+(defvar helm-multi-swoop-candidate-number-limit 250)
+(defvar helm-multi-swoop-last-selected-buffers nil)
+(defvar helm-multi-swoop-last-query nil)
+(defvar helm-multi-swoop-query nil)
+(defvar helm-multi-swoop-buffer "*Helm Multi Swoop*")
+(defvar helm-multi-swoop-all-from-helm-swoop-last-point nil
+  "For the last position, when helm-multi-swoop-all-from-helm-swoop canceled")
+(defvar helm-multi-swoop-move-line-action-last-buffer nil)
+
+(defvar helm-multi-swoop-buffers-map
+  (let (($map (make-sparse-keymap)))
+    (set-keymap-parent $map helm-map)
+    (define-key $map (kbd "RET")
+      (lambda () (interactive)
+        (helm-exit-and-execute-action 'helm-multi-swoop--exec)))
+    (delq nil $map)))
+
+;; action -----------------------------------------------------
+
+(defadvice helm-next-line (around helm-multi-swoop-next-line disable)
+  (let ((helm-move-to-line-cycle-in-source nil))
+    ad-do-it
+    (when (called-interactively-p 'any)
+      (helm-multi-swoop--move-line-action))))
+
+(defadvice helm-previous-line (around helm-multi-swoop-previous-line disable)
+  (let ((helm-move-to-line-cycle-in-source nil))
+    ad-do-it
+    (when (called-interactively-p 'any)
+      (helm-multi-swoop--move-line-action))))
+
+(defadvice helm-toggle-visible-mark (around helm-multi-swoop-toggle-visible-mark disable)
+  (let ((helm-move-to-line-cycle-in-source nil))
+    ad-do-it
+    (when (called-interactively-p 'any)
+      (helm-multi-swoop--move-line-action))))
+
+(defadvice helm-move--next-line-fn (around helm-multi-swoop-next-line-cycle disable)
+  (if (not (helm-pos-multiline-p))
+      (if (eq (point-max) (save-excursion (forward-line 1) (point)))
+          (when helm-swoop-move-to-line-cycle
+            (helm-beginning-of-buffer)
+            (helm-swoop--recenter))
+        (forward-line 1))
+    (let ((line-num (line-number-at-pos)))
+      (helm-move--next-multi-line-fn)
+      (when (and helm-swoop-move-to-line-cycle
+                 (eq line-num (line-number-at-pos)))
+        (helm-beginning-of-buffer)))))
+
+(defadvice helm-move--previous-line-fn (around helm-multi-swoop-previous-line-cycle disable)
+  (if (not (helm-pos-multiline-p))
+      (forward-line -1)
+    (helm-move--previous-multi-line-fn))
+  (when (and (helm-pos-header-line-p)
+             (eq (point) (save-excursion (forward-line -1) (point))))
+    (when helm-swoop-move-to-line-cycle
+      (helm-end-of-buffer))
+    (when (helm-pos-multiline-p)
+      (helm-move--previous-multi-line-fn))))
+
+(defun helm-multi-swoop--move-line-action ()
+  (with-helm-window
+    (let* (($key (buffer-substring (point-at-bol) (point-at-eol)))
+           ($num (when (string-match "^[0-9]+" $key)
+                   (string-to-number (match-string 0 $key))))
+           ($source (helm-get-current-source))
+           ($buf (let (($name (assoc-default 'name $source)))
+                   (when $name (get-buffer $name)))))
+      (when $buf
+        ;; Synchronizing line position
+        (with-selected-window helm-swoop-synchronizing-window
+          (with-current-buffer $buf
+            (when (not (eq $buf helm-multi-swoop-move-line-action-last-buffer))
+              (set-window-buffer nil $buf)
+              (helm-swoop--pattern-match))
+            (helm-swoop--goto-line $num)
+            (helm-swoop--target-line-overlay-move $buf)
+            (helm-swoop--recenter))
+          (setq helm-multi-swoop-move-line-action-last-buffer $buf))
+        (setq helm-swoop-last-line-info (cons $buf $num))))))
+
+(defun helm-multi-swoop--get-marked-buffers ()
+  (let ($list
+        ($buf (get-buffer helm-multi-swoop-buffer-list)))
+    (when $buf
+      (with-current-buffer (get-buffer helm-multi-swoop-buffer-list)
+        (mapc (lambda ($ov)
+                (when (eq 'helm-visible-mark (overlay-get $ov 'face))
+                  (setq $list (cons
+                               (let (($word (buffer-substring-no-properties
+                                             (overlay-start $ov) (overlay-end $ov))))
+                                 (mapc (lambda ($r)
+                                         (setq $word (replace-regexp-in-string
+                                                      (car $r) (cdr $r) $word)))
+                                       (list '("\\`[ \t\n\r]+" . "")
+                                             '("[ \t\n\r]+\\'" . "")))
+                                 $word)
+                               $list))))
+              (overlays-in (point-min) (point-max))))
+      (delete "" $list))))
+
+;; core --------------------------------------------------------
+
+(cl-defun helm-multi-swoop--exec (ignored &key $query $buflist $func $action)
+  (interactive)
+  (setq helm-swoop-synchronizing-window (selected-window))
+  (setq helm-swoop-last-point
+        (or helm-multi-swoop-all-from-helm-swoop-last-point
+            (cons (point) (buffer-name (current-buffer)))))
+  (setq helm-swoop-last-line-info
+        (cons (current-buffer) (line-number-at-pos)))
+  (unless (get-buffer helm-multi-swoop-buffer-list)
+    (get-buffer-create helm-multi-swoop-buffer-list))
+  (helm-swoop--set-prefix (prefix-numeric-value current-prefix-arg))
+  (let (($buffs (or $buflist
+                    (helm-multi-swoop--get-marked-buffers)
+                    `(,(buffer-name helm-swoop-target-buffer))
+                    (error "No buffer selected")))
+        $contents
+        $preserve-position
+        ($prefix-arg (prefix-numeric-value
+                      (or current-prefix-arg helm-swoop-last-prefix-number 1))))
+    (helm-swoop--set-prefix $prefix-arg)
+    (setq helm-multi-swoop-last-selected-buffers $buffs)
+    ;; Create buffer sources
+    (mapc (lambda ($buf)
+            (when (get-buffer $buf)
+              (with-current-buffer (get-buffer $buf)
+                (let* (($func
+                        (or $func
+                            (lambda ()
+                              (helm-swoop--split-lines-by
+                               (helm-swoop--get-content $buf t)
+                               "\n" $prefix-arg))))
+                       ($action
+                        (or $action
+                            `(("Go to Line"
+                               . (lambda ($line)
+                                   (switch-to-buffer ,$buf)
+                                   (helm-swoop--goto-line
+                                    (when (string-match "^[0-9]+" $line)
+                                      (string-to-number
+                                       (match-string 0 $line))))
+                                   (when (re-search-forward
+                                          (mapconcat 'identity
+                                                     (split-string
+                                                      helm-pattern " ") "\\|")
+                                          nil t)
+                                     (helm-swoop-flash-word (match-beginning 0) (match-end 0))
+                                     (goto-char (match-beginning 0)))
+                                   (helm-swoop--recenter)))))))
+                  (setq $preserve-position
+                        (cons (cons $buf (point)) $preserve-position))
+                  (setq
+                   $contents
+                   (cons
+                    (helm-c-source-multi-swoop $buf $func $action $prefix-arg)
+                    $contents))))))
+          $buffs)
+    (unwind-protect
+        (progn
+          (ad-enable-advice 'helm-next-line 'around
+                            'helm-multi-swoop-next-line)
+          (ad-activate 'helm-next-line)
+          (ad-enable-advice 'helm-previous-line 'around
+                            'helm-multi-swoop-previous-line)
+          (ad-activate 'helm-previous-line)
+          (ad-enable-advice 'helm-toggle-visible-mark 'around
+                            'helm-multi-swoop-toggle-visible-mark)
+          (ad-activate 'helm-toggle-visible-mark)
+          (ad-enable-advice 'helm-move--next-line-fn 'around
+                            'helm-multi-swoop-next-line-cycle)
+          (ad-activate 'helm-move--next-line-fn)
+          (ad-enable-advice 'helm-move--previous-line-fn 'around
+                            'helm-multi-swoop-previous-line-cycle)
+          (ad-activate 'helm-move--previous-line-fn)
+          (add-hook 'helm-update-hook 'helm-swoop--pattern-match)
+          (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t)
+          (setq helm-swoop-line-overlay
+                (make-overlay (point) (point)))
+          (overlay-put helm-swoop-line-overlay
+                       'face 'helm-swoop-target-line-face)
+          (helm-swoop--target-line-overlay-move)
+          ;; Execute helm
+          (let ((helm-display-function helm-swoop-split-window-function)
+                (helm-display-source-at-screen-top nil)
+                (helm-completion-window-scroll-margin 5))
+            (helm :sources $contents
+                  :buffer helm-multi-swoop-buffer
+                  :input (or $query helm-multi-swoop-query "")
+                  :prompt helm-swoop-prompt
+                  :candidate-number-limit
+                  helm-multi-swoop-candidate-number-limit
+                  :preselect
+                  (format "%s %s" (line-number-at-pos)
+                          (helm-swoop--get-string-at-line)))))
+      ;; Restore
+      (progn
+        (when (= 1 helm-exit-status)
+          (helm-swoop-back-to-last-point t)
+          (helm-swoop--restore-unveiled-overlay))
+        (setq helm-swoop-invisible-targets nil)
+        (ad-disable-advice 'helm-next-line 'around
+                           'helm-multi-swoop-next-line)
+        (ad-activate 'helm-next-line)
+        (ad-disable-advice 'helm-previous-line 'around
+                           'helm-multi-swoop-previous-line)
+        (ad-activate 'helm-previous-line)
+        (ad-disable-advice 'helm-toggle-visible-mark 'around
+                           'helm-multi-swoop-toggle-visible-mark)
+        (ad-activate 'helm-toggle-visible-mark)
+        (ad-disable-advice 'helm-move--next-line-fn 'around
+                           'helm-multi-swoop-next-line-cycle)
+        (ad-activate 'helm-move--next-line-fn)
+        (ad-disable-advice 'helm-move--previous-line-fn 'around
+                           'helm-multi-swoop-previous-line-cycle)
+        (ad-activate 'helm-move--previous-line-fn)
+        (remove-hook 'helm-update-hook 'helm-swoop--pattern-match)
+        (remove-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position)
+        (setq helm-multi-swoop-last-query helm-swoop-pattern)
+        (helm-swoop--restore-unveiled-overlay)
+        (setq helm-multi-swoop-query nil)
+        (setq helm-multi-swoop-all-from-helm-swoop-last-point nil)
+        (mapc (lambda ($buf)
+                (let (($current-buffer (buffer-name (current-buffer))))
+                  (with-current-buffer (car $buf)
+                    ;; Delete overlay
+                    (delete-overlay helm-swoop-line-overlay)
+                    (helm-swoop--delete-overlay 'target-buffer)
+                    ;; Restore each buffer's position
+                    (unless (equal (car $buf) $current-buffer)
+                      (goto-char (cdr $buf))))))
+              $preserve-position)))))
+
+(defun helm-multi-swoop--get-buffer-list ()
+  (let ($buflist1 $buflist2)
+    ;; eliminate buffers start with whitespace and dired buffers
+    (mapc (lambda ($buf)
+            (setq $buf (buffer-name $buf))
+            (unless (string-match "^\\s-" $buf)
+              (unless (eq 'dired-mode (with-current-buffer $buf major-mode))
+                (setq $buflist1 (cons $buf $buflist1)))))
+          (buffer-list))
+    ;; eliminate buffers match pattern
+    (mapc (lambda ($buf)
+            (unless (string-match
+                     helm-multi-swoop-ignore-buffers-match
+                     $buf)
+              (setq $buflist2 (cons $buf $buflist2))))
+          $buflist1)
+    $buflist2))
+
+(defun helm-c-source-helm-multi-swoop-buffers ()
+  "Show buffer list to select"
+  `((name . "helm-multi-swoop select buffers")
+    (candidates . helm-multi-swoop--get-buffer-list)
+    (header-line . "[C-SPC]/[M-SPC] select, [RET] next step")
+    (keymap . ,helm-multi-swoop-buffers-map)
+    (match . ,(helm-swoop-match-functions))
+    (search . ,(helm-swoop-search-functions))))
+
+;;;###autoload
+(defun helm-multi-swoop (&optional $query $buflist)
+  "\
+Usage:
+M-x helm-multi-swoop
+1. Select any buffers by [C-SPC] or [M-SPC]
+2. Press [RET] to start helm-multi-swoop
+
+C-u M-x helm-multi-swoop
+If you have done helm-multi-swoop before, you can skip select buffers step.
+Last selected buffers will be applied to helm-multi-swoop.
+"
+  (interactive)
+  (cond ($query
+         (setq helm-multi-swoop-query $query))
+        (mark-active
+         (let (($st (buffer-substring-no-properties
+                     (region-beginning) (region-end))))
+           (if (string-match "\n" $st)
+               (message "Multi line region is not allowed")
+             (setq helm-multi-swoop-query
+                   (helm-swoop-pre-input-optimize $st)))))
+        ((setq helm-multi-swoop-query
+               (helm-swoop-pre-input-optimize
+                (funcall helm-swoop-pre-input-function))))
+        (t (setq helm-multi-swoop-query "")))
+  (if (equal current-prefix-arg '(4))
+      (helm-multi-swoop--exec nil
+                              :$query helm-multi-swoop-query
+                              :$buflist $buflist)
+    (if $buflist
+        (helm-multi-swoop--exec nil
+                                :$query $query
+                                :$buflist $buflist)
+      (helm :sources (helm-c-source-helm-multi-swoop-buffers)
+            :buffer helm-multi-swoop-buffer-list
+            :prompt "Mark any buffers by [C-SPC] or [M-SPC]: "))))
+
+;;;###autoload
+(defun helm-multi-swoop-all (&optional $query)
+  "Apply all buffers to helm-multi-swoop"
+  (interactive)
+  (cond ($query
+         (setq helm-multi-swoop-query $query))
+        (mark-active
+         (let (($st (buffer-substring-no-properties
+                     (region-beginning) (region-end))))
+           (if (string-match "\n" $st)
+               (message "Multi line region is not allowed")
+             (setq helm-multi-swoop-query
+                   (helm-swoop-pre-input-optimize $st)))))
+        ((setq helm-multi-swoop-query
+               (helm-swoop-pre-input-optimize
+                (funcall helm-swoop-pre-input-function))))
+        (t (setq helm-multi-swoop-query "")))
+  (helm-multi-swoop--exec nil
+                          :$query helm-multi-swoop-query
+                          :$buflist (helm-multi-swoop--get-buffer-list)))
+
+(defun get-buffers-matching-mode ($mode)
+  "Returns a list of buffers where their major-mode is equal to MODE"
+  (let ($buffer-mode-matches)
+    (mapc (lambda ($buf)
+            (when (get-buffer $buf)
+              (with-current-buffer (get-buffer $buf)
+                (if (eq $mode major-mode)
+                    (add-to-list '$buffer-mode-matches (buffer-name $buf))))))
+          (buffer-list))
+    $buffer-mode-matches))
+
+(defun helm-multi-swoop-by-mode ($mode &optional $query)
+  "Apply all buffers whose mode is MODE to helm-multi-swoop"
+  (cond ($query
+         (setq helm-multi-swoop-query $query))
+        (mark-active
+         (let (($st (buffer-substring-no-properties
+                     (region-beginning) (region-end))))
+           (if (string-match "\n" $st)
+               (message "Multi line region is not allowed")
+             (setq helm-multi-swoop-query
+                   (helm-swoop-pre-input-optimize $st)))))
+        ((setq helm-multi-swoop-query
+               (helm-swoop-pre-input-optimize
+                (funcall helm-swoop-pre-input-function))))
+        (t (setq helm-multi-swoop-query "")))
+  (if (get-buffers-matching-mode $mode)
+      (helm-multi-swoop--exec nil
+                              :$query helm-multi-swoop-query
+                              :$buflist (get-buffers-matching-mode $mode))
+    (message "there are no buffers in that mode right now")))
+
+;;;###autoload
+(defun helm-multi-swoop-org (&optional $query)
+  "Applies all org-mode buffers to helm-multi-swoop"
+  (interactive)
+  (helm-multi-swoop-by-mode 'org-mode $query))
+
+;;;###autoload
+(defun helm-multi-swoop-current-mode (&optional $query)
+  "Applies all buffers of the same mode as the current buffer to helm-multi-swoop"
+  (interactive)
+  (helm-multi-swoop-by-mode major-mode $query))
+
+(defun helm-swoop--wrap-function-with-pre-input-function ($target-func $pre-input-func)
+  (let (($restore helm-swoop-pre-input-function))
+    (unwind-protect
+        (progn
+          (setq helm-swoop-pre-input-function $pre-input-func)
+          (funcall $target-func))
+      (setq helm-swoop-pre-input-function $restore))))
+
+;;;###autoload
+(defun helm-swoop-without-pre-input ()
+  "Start helm-swoop without pre input query."
+  (interactive)
+  (helm-swoop--wrap-function-with-pre-input-function
+   'helm-swoop (lambda () nil)))
+
+;;;###autoload
+(defun helm-swoop-symble-pre-input ()
+  "Start helm-swoop without pre input query."
+  (interactive)
+  (helm-swoop--wrap-function-with-pre-input-function
+   'helm-swoop (lambda () (format "\\_<%s\\_> " (thing-at-point 'symbol)))))
+
+;; option -------------------------------------------------------
+
+(defun helm-multi-swoop-all-from-isearch ()
+  "Invoke `helm-multi-swoop-all' from isearch."
+  (interactive)
+  (let (($query (if isearch-regexp
+                    isearch-string
+                  (regexp-quote isearch-string))))
+    (let (search-nonincremental-instead)
+      (isearch-exit))
+    (helm-multi-swoop-all $query)))
+;; When doing isearch, hand the word over to helm-swoop
+;; (define-key isearch-mode-map (kbd "C-x M-i") 'helm-multi-swoop-all-from-isearch)
+
+(defun helm-multi-swoop-all-from-helm-swoop ()
+  "Invoke `helm-multi-swoop-all' from helm-swoop."
+  (interactive)
+  (helm-swoop--restore)
+  (delete-overlay helm-swoop-line-overlay)
+  (setq helm-multi-swoop-all-from-helm-swoop-last-point helm-swoop-last-point)
+  (let (($query helm-pattern))
+    (run-with-timer 0 nil (lambda () (helm-multi-swoop-all $query))))
+  (helm-exit-minibuffer))
+
+(defun helm-multi-swoop-current-mode-from-helm-swoop ()
+  "Invoke `helm-multi-swoop-all' from helm-swoop."
+  (interactive)
+  (helm-swoop--restore)
+  (delete-overlay helm-swoop-line-overlay)
+  (setq helm-multi-swoop-all-from-helm-swoop-last-point helm-swoop-last-point)
+  (let (($query helm-pattern))
+    (run-with-timer 0 nil (lambda () (helm-multi-swoop-current-mode $query))))
+  (helm-exit-minibuffer))
+;; (define-key helm-swoop-map (kbd "M-m") 'helm-multi-swoop-current-mode-from-helm-swoop)
+
+(defadvice helm-resume (around helm-multi-swoop-resume activate)
+  "Resume if the last used helm buffer is *Helm Swoop*"
+  (if (equal helm-last-buffer helm-multi-swoop-buffer)
+
+      (if (boundp 'helm-multi-swoop-last-query)
+          (if (not (ad-get-arg 0))
+              (helm-multi-swoop helm-multi-swoop-last-query
+                                helm-multi-swoop-last-selected-buffers))
+        ;; Temporary apply second last buffer
+        (let ((helm-last-buffer (cadr helm-buffers))) ad-do-it))
+    ad-do-it))
+
+;;; @ helm-multi-swoop-edit -----------------------------------
+(defvar helm-multi-swoop-edit-save t
+  "Save each buffer you edit when editing is complete")
+(defvar helm-multi-swoop-edit-buffer "*Helm Multi Swoop Edit*")
+
+(defvar helm-multi-swoop-edit-map
+  (let (($map (make-sparse-keymap)))
+    (define-key $map (kbd "C-x C-s") 'helm-multi-swoop--edit-complete)
+    (define-key $map (kbd "C-c C-g") 'helm-multi-swoop--edit-cancel)
+    (define-key $map (kbd "C-c C-q C-k") 'helm-multi-swoop--edit-delete-all-lines)
+    $map))
+
+(defun helm-multi-swoop--edit ($candidate)
+  "This function will only be called from `helm-swoop-edit'"
+  (interactive)
+  (delete-overlay helm-swoop-line-overlay)
+  (helm-swoop--delete-overlay 'target-buffer)
+  (with-current-buffer (get-buffer-create helm-multi-swoop-edit-buffer)
+    (helm-swoop--clear-edit-buffer 'helm-multi-swoop-edit)
+    (let (($bufstr "")
+          ($mark nil)
+          ($buf (get-buffer helm-multi-swoop-buffer)))
+      ;; Get target line number to edit
+      (when $buf
+        (with-current-buffer $buf
+          ;; Set overlay to helm-source-header for editing marked lines
+          (save-excursion
+            (goto-char (point-min))
+            (let (($beg (point)) $end)
+              (overlay-recenter (point-max))
+              (while (setq $beg (text-property-any $beg (point-max)
+                                                   'face 'helm-source-header))
+                (setq $end (next-single-property-change $beg 'face))
+                (overlay-put (make-overlay $beg $end) 'source-header t)
+                (setq $beg $end)
+                (goto-char $end))))
+          ;; Use selected line by [C-SPC] or [M-SPC]
+          (mapc (lambda ($ov)
+                  (when (overlay-get $ov 'source-header)
+                    (setq $bufstr (concat (buffer-substring
+                                           (overlay-start $ov) (overlay-end $ov))
+                                          $bufstr)))
+                  (when (eq 'helm-visible-mark (overlay-get $ov 'face))
+                    (let (($str (buffer-substring (overlay-start $ov) (overlay-end $ov))))
+                      (unless (equal "" $str) (setq $mark t))
+                      (setq $bufstr (concat (buffer-substring
+                                             (overlay-start $ov) (overlay-end $ov))
+                                            $bufstr)))))
+                (overlays-in (point-min) (point-max)))
+          (if $mark
+              (progn (setq $bufstr (concat "Helm Multi Swoop\n" $bufstr))
+                     (setq $mark nil))
+            (setq $bufstr (concat "Helm Multi Swoop\n"
+                                  (buffer-substring
+                                   (point-min) (point-max)))))))
+
+      ;; Set for edit buffer
+      (insert $bufstr)
+      (add-text-properties (point-min) (point-max)
+                           '(read-only t rear-nonsticky t front-sticky t))
+
+      ;; Set for editable context
+      (let ((inhibit-read-only t))
+        ;; Title and explanation
+        (goto-char (point-min))
+        (let (($o (make-overlay (point) (point-at-eol))))
+          (overlay-put $o 'helm-multi-swoop-edit t)
+          (overlay-put $o 'face 'font-lock-function-name-face)
+          (overlay-put $o 'after-string
+                       (propertize
+                        (format " [%s] Complete, [%s] Cancel, [%s] Delete All"
+                                (helm-swoop--key-of-function 'helm-swoop--edit-complete helm-swoop-edit-map)
+                                (helm-swoop--key-of-function 'helm-swoop--edit-cancel helm-swoop-edit-map)
+                                (helm-swoop--key-of-function 'helm-swoop--edit-delete-all-lines helm-swoop-edit-map))
+                        'face 'helm-bookmark-addressbook)))
+        ;; Line number and editable area
+        (while (re-search-forward "^\\([0-9]+\s\\)\\(.*\\)$" nil t)
+          (let* (($bol1 (match-beginning 1))
+                 ($eol1 (match-end 1))
+                 ($bol2 (match-beginning 2))
+                 ($eol2 (match-end 2)))
+
+            ;; Line number
+            (add-text-properties $bol1 $eol1
+                                 '(face font-lock-function-name-face
+                                   intangible t))
+            ;; Editable area
+            (remove-text-properties $bol2 $eol2 '(read-only t))
+            ;; (add-text-properties $bol2 $eol2 '(font-lock-face helm-match))
+
+            ;; For line tail
+            (set-text-properties $eol2 (or (1+ $eol2) (point-max))
+                                 '(read-only t rear-nonsticky t))))
+        (helm-swoop--target-word-overlay 'edit-buffer 0))))
+
+  (other-window 1)
+  (switch-to-buffer helm-multi-swoop-edit-buffer)
+  (goto-char (point-min))
+  (if (string-match "^[0-9]+" $candidate)
+      (re-search-forward
+       (concat "^" (match-string 0 $candidate)) nil t))
+  (use-local-map helm-multi-swoop-edit-map))
+
+(defun helm-multi-swoop--separate-text-property-into-list ($property)
+  (interactive)
+  (let ($list $end)
+    (save-excursion
+      (goto-char (point-min))
+      (while (setq $end (next-single-property-change (point) $property))
+        ;; Must eliminate last return because of unexpected edit result
+        (setq $list (cons
+                     (let (($str (buffer-substring-no-properties (point) $end)))
+                       (if (string-match "\n\n\\'" $str)
+                           (replace-regexp-in-string "\n\\'" "" $str)
+                         $str))
+                     $list))
+        (goto-char $end))
+      (setq $list (cons (buffer-substring-no-properties (point) (point-max))
+                        $list)))
+    (nreverse $list)))
+
+(defun helm-multi-swoop--collect-edited-lines ()
+  "Create a list of edited lines with each its own line number"
+  (interactive)
+  (let* (($list
+          (helm-multi-swoop--separate-text-property-into-list 'helm-header))
+         ($length (length $list))
+         ($i 1) ;; 0th $list is header
+         $pairs)
+    (while (<= $i $length)
+      (let ($contents)
+        ;; Make ((number . line) (number . line) (number . line) ...)
+        (with-temp-buffer
+         (insert (format "%s" (nth (1+ $i) $list)))
+         (goto-char (point-min))
+         (while (re-search-forward "^\\([0-9]+\\)\s" nil t)
+           (setq $contents
+                 (cons (cons (string-to-number (match-string 1))
+                             (buffer-substring-no-properties
+                              (point)
+                              (save-excursion
+                                (if (re-search-forward
+                                     "^\\([0-9]+\\)\s\\|^\\(\\-+\\)" nil t)
+                                    (1- (match-beginning 0))
+                                  (goto-char (point-max))
+                                  (re-search-backward "\n" nil t)))))
+                       $contents))))
+        ;; Make ((buffer-name (number . line) (number . line) ...)
+        ;;       (buffer-name (number . line) (number . line) ...) ...)
+        (setq $pairs (cons (cons (nth $i $list) $contents) $pairs)))
+      (setq $i (+ $i 2)))
+    (delete '(nil) $pairs)))
+
+(defun helm-multi-swoop--edit-complete ()
+  "Delete all extracted lines, and apply changes to buffers and kill temporary edit buffer"
+  (interactive)
+  (let (($list (helm-multi-swoop--collect-edited-lines))
+        $read-only)
+    (mapc (lambda ($x)
+            (with-current-buffer (car $x)
+              (unless buffer-read-only
+                (save-excursion
+                  (mapc (lambda ($cell)
+                          (let (($k (car $cell))
+                                ($v (cdr $cell)))
+                            (goto-char (point-min))
+                            (delete-region (point-at-bol $k) (point-at-eol $k))
+                            (goto-char (point-at-bol $k))
+                            (insert $v)))
+                        (cdr $x))))
+              (if helm-multi-swoop-edit-save
+                  (if buffer-read-only
+                      (setq $read-only t)
+                    (save-buffer)))))
+          $list)
+    (select-window helm-swoop-synchronizing-window)
+    (kill-buffer (get-buffer helm-multi-swoop-edit-buffer))
+    (if $read-only
+        (message "Couldn't save some buffers because of read-only")
+      (message "Successfully helm-multi-swoop-edit applied to original buffer"))))
+
+(defun helm-multi-swoop--edit-delete-all-lines ()
+  "Delete all extracted lines, and apply changes to buffers and kill temporary edit buffer"
+  (interactive)
+  (let (($list (helm-multi-swoop--collect-edited-lines))
+        $read-only)
+    (mapc (lambda ($x)
+            (with-current-buffer (car $x)
+              (unless buffer-read-only
+                (save-excursion
+                  (mapc (lambda ($cell)
+                          (let (($k (car $cell)))
+                            (goto-char (point-min))
+                            (delete-region (point-at-bol $k)
+                                           (if (eq (point-at-eol $k) (point-max))
+                                               (point-at-eol $k)
+                                             (1+ (point-at-eol $k))))))
+                        (cdr $x))))
+              (if helm-multi-swoop-edit-save
+                  (if buffer-read-only
+                      (setq $read-only t)
+                    (save-buffer)))))
+          $list)
+    (select-window helm-swoop-synchronizing-window)
+    (kill-buffer (get-buffer helm-multi-swoop-edit-buffer))
+    (if $read-only
+        (message "Couldn't save some buffers because of read-only")
+      (message "Successfully helm-multi-swoop-edit applied to original buffer"))))
+
+(defun helm-multi-swoop--edit-cancel ()
+  "Cancel edit and kill temporary buffer"
+  (interactive)
+  (select-window helm-swoop-synchronizing-window)
+  (kill-buffer (get-buffer helm-multi-swoop-edit-buffer))
+  (message "helm-multi-swoop-edit canceled"))
+
+;;;###autoload
+(defun helm-multi-swoop-edit ()
+  (interactive)
+  (helm-exit-and-execute-action 'helm-multi-swoop--edit))
+
+;;; @ helm-swoop-same-face-at-point -----------------------------------
+
+(defsubst helm-swoop--get-at-face (&optional $point)
+  (or $point (setq $point (point)))
+  (let (($face (or (get-char-property $point 'read-face-name)
+                   (get-char-property $point 'face))))
+      $face))
+
+(defun helm-swoop--cull-face-include-line ($face)
+  (let (($list) ($po (point-min)))
+    (save-excursion
+      (while (setq $po (next-single-property-change $po 'face))
+        (when (equal $face (helm-swoop--get-at-face $po))
+          (goto-char $po)
+          (setq $list (cons (format "%s %s"
+                                    (line-number-at-pos $po)
+                                    (buffer-substring (point-at-bol) (point-at-eol)))
+                            $list))
+          (let (($ov (make-overlay $po (or (next-single-property-change $po 'face)
+                                           (point-max)))))
+            (overlay-put $ov 'face 'helm-swoop-target-word-face)
+            (overlay-put $ov 'target-buffer 'helm-swoop-target-word-face)))))
+      (nreverse (delete-dups $list))))
+
+(defun helm-swoop-same-face-at-point (&optional $face)
+  (interactive)
+  (or $face (setq $face (helm-swoop--get-at-face)))
+  (helm-swoop :$query ""
+              :$source
+              `((name . "helm-swoop-same-face-at-point")
+                (candidates . ,(helm-swoop--cull-face-include-line $face))
+                (header-line . ,(format "%s" $face))
+                (action
+                 . (("Go to Line"
+                     . (lambda ($line)
+                         (helm-swoop--goto-line
+                          (when (string-match "^[0-9]+" $line)
+                            (string-to-number (match-string 0 $line))))
+                         (let (($po (point))
+                               ($poe (point-at-eol)))
+                           (while (<= (setq $po (next-single-property-change $po 'face)) $poe)
+                             (when (eq 'helm-swoop-target-word-face (helm-swoop--get-at-face $po))
+                               (goto-char $po))))
+                         (helm-swoop--recenter))))))))
+
+(defun helm-multi-swoop-same-face-at-point (&optional $face)
+  (interactive)
+  (or $face (setq $face (helm-swoop--get-at-face)))
+  (helm-multi-swoop--exec
+   nil
+   :$query ""
+   :$func (lambda () (helm-swoop--cull-face-include-line $face))
+   :$action (lambda ($line)
+              (switch-to-buffer (assoc-default 'name (helm-get-current-source)))
+              (helm-swoop--goto-line
+               (when (string-match "^[0-9]+" $line)
+                 (string-to-number (match-string 0 $line))))
+              (let (($po (point))
+                    ($poe (point-at-eol)))
+                (while (<= (setq $po (next-single-property-change $po 'face)) $poe)
+                  (when (eq 'helm-swoop-target-word-face (helm-swoop--get-at-face $po))
+                    (goto-char $po))))
+              (helm-swoop--recenter))
+   :$buflist (helm-multi-swoop--get-buffer-list)))
+
+(provide 'helm-swoop)
+;;; helm-swoop.el ends here