Skip to content

Commit

Permalink
Update sources for new helm API
Browse files Browse the repository at this point in the history
  • Loading branch information
vjohansen committed Jan 30, 2016
1 parent e4b3656 commit 1473ebd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
33 changes: 20 additions & 13 deletions helm-vps.el
Expand Up @@ -17,19 +17,26 @@
(require 'helm-grep)
(require 'vps)

(defun helm-source-vps-files-candidates ()
(with-current-buffer (helm-candidate-buffer 'local)
(when (and vps-project-name
(file-exists-p (vps-filelist-filename)))
(insert-file-contents (vps-filelist-filename))
(split-string (buffer-string) "\n"))))

(defvar helm-source-vps-files
'((name . "Project Files")
(candidates . helm-source-vps-files-candidates)
(requires-pattern . 3)
(candidate-number-limit . 999)
(type . file)))
;; (defun helm-source-vps-files-candidates ()
;; (with-current-buffer (helm-candidate-buffer 'local)
;; (when (and vps-project-name
;; (file-exists-p (vps-filelist-filename)))
;; (insert-file-contents (vps-filelist-filename))
;; (split-string (buffer-string) "\n"))))

;; (defvar helm-source-vps-files
;; '((name . "Project Files")
;; (candidates . helm-source-vps-files-candidates)
;; (requires-pattern . 3)
;; (candidate-number-limit . 999)
;; (type . file)))

(defclass vj-helm-vps (helm-source-in-file helm-type-file)
((candidates-file :initform (vps-filelist-filename))))

;; (helm :sources (helm-make-source "vps" 'vj-helm-vps) :buffer "*VPS*")
(defvar helm-source-vps-files (helm-make-source "Projects" 'vj-helm-vps))


;; Supports spaces in the pattern. First word is prefix and the remaining are
;; substrings
Expand Down
33 changes: 20 additions & 13 deletions vj-helm.el
Expand Up @@ -20,26 +20,33 @@
;; Added to helm-locate.el
;; (define-key map (kbd "M-]") 'helm-ff-run-toggle-basename)
(if (eq system-type 'windows-nt)
(setq helm-c-locate-command "c:/tools/Locate32/Locate.exe %s %s"))
(setq helm-locate-command "c:/tools/Locate32/Locate.exe %s %s"))
(setq helm-ff-transformer-show-only-basename nil)

(global-set-key (kbd "C-å") 'vj-helm)
(global-set-key (kbd "C-x b") 'helm-mini)


(defvar vj-fav-fn "~/.fav")
(defvar vj-fav-list
(with-temp-buffer
(when (and vj-fav-fn (file-exists-p vj-fav-fn))
(insert-file-contents vj-fav-fn)
(mapcar 'expand-file-name (split-string (buffer-string))))))

(defvar vj-helm-source-fav
'((name . "Favorites")
(candidates . (lambda () vj-fav-list))
(type . file)
(requires-pattern . 3))
"Source for favorites.")
;; (defvar vj-fav-list
;; (with-temp-buffer
;; (when (and vj-fav-fn (file-exists-p vj-fav-fn))
;; (insert-file-contents vj-fav-fn)
;; (mapcar 'expand-file-name (split-string (buffer-string))))))

;; (defvar vj-helm-source-fav
;; '((name . "Favorites")
;; (candidates . (lambda () vj-fav-list))
;; (type . file)
;; (requires-pattern . 3))
;; "Source for favorites.")

(defun vj-fav-fn2 () vj-fav-fn)
(defclass helm-test-fav (helm-source-in-file helm-type-file)
((candidates-file :initform (vj-fav-fn2))))

;; (helm :sources (helm-make-source "test" 'helm-test-fav) :buffer "*helm test*")
(defvar vj-helm-source-fav (helm-make-source "Favorites2" 'helm-test-fav))

(defvar vj-helm-list '(
helm-source-recentf
Expand Down

0 comments on commit 1473ebd

Please sign in to comment.