Permalink
Browse files

* helm-elisp.el (helm-lisp-completion-at-point-or-indent): removed, u…

…se *define-multi-key now.

(helm-lisp-indent): new.
* helm.el (helm-define-multi-key): Don't use kbd here.
  • Loading branch information...
1 parent a96c12e commit e82588cd12f6c3fbaa804c835a52570d7d26c3ed @thierryvolpiatto thierryvolpiatto committed Dec 18, 2012
Showing with 10 additions and 35 deletions.
  1. +6 −32 helm-elisp.el
  2. +4 −3 helm.el
View
@@ -46,13 +46,6 @@ This is used in macro `with-helm-show-completion'."
:group 'helm-elisp
:type 'integer)
-(defcustom helm-lisp-completion-or-indent-delay 0.6
- "After this delay `helm-lisp-completion-counter' is reset to 0.
-This allow to indent again without completing lisp symbol after this delay.
-Default is 0.6 seconds."
- :group 'helm-elisp
- :type 'number)
-
;;; Faces
;;
@@ -243,34 +236,15 @@ If SYM is not documented, return \"Not documented\"."
(abbreviate-file-name completion)
completion)))))
-;; Internal
-(defvar helm-lisp-completion-counter 0)
;;;###autoload
-(defun helm-lisp-completion-at-point-or-indent (arg)
- "First call indent and second call complete lisp symbol.
-The second call should happen before `helm-lisp-completion-or-indent-delay',
-after this delay, next call will indent again.
-After completion, next call is always indent.
-See that like click and double mouse click.
-One hit indent, two quick hits maybe indent and complete."
- (interactive "P")
- ;; Be sure `indent-for-tab-command' will not try
- ;; to use `completion-at-point'.
+(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)))
- (incf helm-lisp-completion-counter)
- (unwind-protect
- (if (> helm-lisp-completion-counter 1)
- (helm-lisp-completion-or-file-name-at-point)
- (indent-for-tab-command arg))
- ;; After `helm-lisp-completion-or-indent-delay' seconds
- ;; reset to 0.
- (run-with-timer helm-lisp-completion-or-indent-delay nil
- #'(lambda ()
- (setq helm-lisp-completion-counter 0)))
- ;; Always reset to 0 at second hit.
- (when (eq helm-lisp-completion-counter 2)
- (setq helm-lisp-completion-counter 0)))))
+ (indent-for-tab-command current-prefix-arg)))
;;;###autoload
(defun helm-lisp-completion-or-file-name-at-point ()
View
@@ -39,6 +39,7 @@
Each function run sequentialy 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\"))
@@ -55,7 +56,7 @@ More than 2 seconds, next hit will run again the first function and so on."
(iter (gensym "helm-iter-key"))
(timeout delay))
(eval (list 'defvar iter nil))
- (define-key keymap (kbd key) #'(lambda ()
+ (define-key keymap key #'(lambda ()
(interactive)
(helm-run-multi-key-command
funs iter timeout)))))
@@ -147,8 +148,8 @@ More than 2 seconds, next hit will run again the first function and so on."
;; Disable `file-cache-minibuffer-complete'.
(define-key map (kbd "<C-tab>") 'undefined)
;; Multi keys
- (helm-define-multi-key map "C-t" '(helm-toggle-resplit-window
- helm-swap-windows) 0.5)
+ (helm-define-multi-key map (kbd "C-t") '(helm-toggle-resplit-window
+ helm-swap-windows) 0.5)
;; Debugging command
(define-key map "\C-c\C-x\C-d" 'helm-debug-output)
(define-key map "\C-c\C-x\C-m" 'helm-display-all-visible-marks)

0 comments on commit e82588c

Please sign in to comment.