Skip to content

Commit

Permalink
Merge branch 'exp'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Volpiatto committed Jan 5, 2013
2 parents 28968da + 89b9ebd commit ad3acb1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
8 changes: 4 additions & 4 deletions helm-adaptative.el
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) ..
(remove-hook 'helm-before-action-hook 'helm-c-adaptive-store-selection)
(remove-hook 'helm-select-action-hook 'helm-c-adaptive-store-selection)))

(defun helm-c-source-use-adaptative-p (&optional source-name)
(defun helm-adapt-use-adaptative-p (&optional source-name)
"Return current source only if it use adaptative history, nil otherwise."
(when helm-adaptative-mode
(let* ((source (or source-name (helm-get-current-source)))
Expand All @@ -82,14 +82,14 @@ Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) ..
(assoc-default 'filtered-candidate-transformer source)
(assoc-default 'candidate-transformer source))))
(if (listp adapt-source)
(when (member 'helm-c-adaptive-sort adapt-source) source)
(when (eq adapt-source 'helm-c-adaptive-sort) source)))))
(and (member 'helm-c-adaptive-sort adapt-source) source)
(and (eq adapt-source 'helm-c-adaptive-sort) source)))))

(defun helm-c-adaptive-store-selection ()
"Store history information for the selected candidate."
(unless helm-c-adaptive-done
(setq helm-c-adaptive-done t)
(let ((source (helm-c-source-use-adaptative-p)))
(let ((source (helm-adapt-use-adaptative-p)))
(when source
(let* ((source-name (or (assoc-default 'type source)
(assoc-default 'name source)))
Expand Down
25 changes: 14 additions & 11 deletions helm-elisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ Filename completion happen if string start after or between a double quote."
;;
(defun helm-c-apropos-init (test default)
"Init candidates buffer for `helm-c-apropos' sources."
(require 'helm-help)
(with-current-buffer (helm-candidate-buffer 'global)
(goto-char (point-min))
(when (and default (stringp default)
Expand All @@ -278,18 +279,20 @@ Filename completion happen if string start after or between a double quote."
(insert (concat default "\n")))
(loop with all = (all-completions "" obarray test)
for sym in all
unless (and default (string= sym default))
for s = (intern sym)
unless (or (and default (string= sym default))
(keywordp s))
do (insert (concat sym "\n")))))

(defun helm-c-source-emacs-variables (&optional default)
(defun helm-def-source--emacs-variables (&optional default)
`((name . "Variables")
(init . (lambda ()
(helm-c-apropos-init 'boundp ,default)))
(candidates-in-buffer)
(action . (("Describe Variable" . helm-c-describe-variable)
("Find Variable" . helm-c-find-variable)))))

(defun helm-c-source-emacs-faces (&optional default)
(defun helm-def-source--emacs-faces (&optional default)
`((name . "Faces")
(init . (lambda ()
(helm-c-apropos-init 'facep ,default)))
Expand All @@ -300,7 +303,7 @@ Filename completion happen if string start after or between a double quote."
(action . (lambda (candidate)
(describe-face (intern candidate))))))

(defun helm-c-source-helm-attributes (&optional default)
(defun helm-def-source--helm-attributes (&optional default)
`((name . "Helm attributes")
(candidates . (lambda ()
(mapcar 'symbol-name helm-additional-attributes)))
Expand All @@ -311,15 +314,15 @@ Filename completion happen if string start after or between a double quote."
(with-output-to-temp-buffer "*Help*"
(princ (get (intern candidate) 'helm-attrdoc))))))))

(defun helm-c-source-emacs-commands (&optional default)
(defun helm-def-source--emacs-commands (&optional default)
`((name . "Commands")
(init . (lambda ()
(helm-c-apropos-init 'commandp ,default)))
(candidates-in-buffer)
(action . (("Describe Function" . helm-c-describe-function)
("Find Function" . helm-c-find-function)))))

(defun helm-c-source-emacs-functions (&optional default)
(defun helm-def-source--emacs-functions (&optional default)
`((name . "Functions")
(init . (lambda ()
(helm-c-apropos-init #'(lambda (x) (and (fboundp x)
Expand All @@ -337,11 +340,11 @@ Filename completion happen if string start after or between a double quote."
(helm :sources
(mapcar (lambda (func)
(funcall func default))
'(helm-c-source-emacs-commands
helm-c-source-emacs-functions
helm-c-source-emacs-variables
helm-c-source-emacs-faces
helm-c-source-helm-attributes))
'(helm-def-source--emacs-commands
helm-def-source--emacs-functions
helm-def-source--emacs-variables
helm-def-source--emacs-faces
helm-def-source--helm-attributes))
:buffer "*helm apropos*"
:preselect (and default (concat "\\_<" (regexp-quote default) "\\_>")))))

Expand Down
6 changes: 4 additions & 2 deletions helm-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,11 @@ that use `helm-comp-read' See `helm-M-x' for example."
(not (string= default "nil"))
(not (string= default "")))
(insert (concat default "\n")))
(loop with all = (all-completions "" collection test)
(loop with all = (all-completions "" obarray test)
for sym in all
unless (and default (eq sym default))
for s = (intern sym)
unless (or (and default (string= sym default))
(keywordp s))
do (insert (concat sym "\n"))))))
(persistent-action . helm-lisp-completion-persistent-action)
(persistent-help . "Show brief doc in mode-line")
Expand Down
8 changes: 4 additions & 4 deletions helm-tags.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Don't search tag file deeply if outside this value."
makefile-mode pascal-mode perl-mode cperl-mode php-mode python-mode
scheme-mode sh-mode slang-mode sql-mode tcl-mode ))

(defun helm-c-source-ctags-init ()
(defun helm-ctags-init ()
(when (and buffer-file-name
(memq major-mode helm-c-ctags-modes)
(helm-current-buffer-is-modified))
Expand Down Expand Up @@ -84,7 +84,7 @@ Don't search tag file deeply if outside this value."

(defvar helm-c-source-ctags
'((name . "Exuberant ctags")
(init . helm-c-source-ctags-init)
(init . helm-ctags-init)
(candidates-in-buffer)
(adjust)
(type . line))
Expand Down Expand Up @@ -135,7 +135,7 @@ If not found in CURRENT-DIR search in upper directory."
(setq current-dir (expand-file-name (concat current-dir "../")))
finally return current-dir)))

(defun helm-c-source-etags-header-name (x)
(defun helm-etags-get-header-name (x)
"Create header name for this helm etags session."
(concat "Etags in "
(with-helm-current-buffer
Expand Down Expand Up @@ -190,7 +190,7 @@ If no entry in cache, create one."

(defvar helm-c-source-etags-select
`((name . "Etags")
(header-name . helm-c-source-etags-header-name)
(header-name . helm-etags-get-header-name)
(init . helm-c-etags-init)
(candidates-in-buffer)
(match-part . (lambda (candidate)
Expand Down

0 comments on commit ad3acb1

Please sign in to comment.