Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* helm.el (helm-update): Allow giving an in-source value to delayed a…

…ttr.

* helm-regexp.el (helm-m-occur-idle-delay): New user var.
(helm-c-source-moccur): Delay source by helm-m-occur-idle-delay time.
  • Loading branch information...
commit fb3195d7f3805c88617e85c0ad5a875d6f94d81b 1 parent e98e82f
@thierryvolpiatto thierryvolpiatto authored
Showing with 34 additions and 17 deletions.
  1. +3 −1 helm-help.el
  2. +10 −2 helm-regexp.el
  3. +21 −14 helm.el
View
4 helm-help.el
@@ -842,7 +842,9 @@ HELM-ATTRIBUTE should be a symbol."
(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.")
+ 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,
View
12 helm-regexp.el
@@ -54,6 +54,12 @@ to a specific `major-mode'."
:group 'helm-regexp
:type 'boolean)
+(defcustom helm-m-occur-idle-delay 0.6
+ "Delay before updating display in `helm-c-source-moccur'.
+It is similar to `helm-idle-delay' but local to `helm-c-source-moccur'."
+ :group 'helm-regexp
+ :type 'float)
+
(defface helm-moccur-buffer
'((t (:foreground "DarkTurquoise" :underline t)))
@@ -205,7 +211,8 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
(recenter)
(mode-line . helm-occur-mode-line)
(keymap . ,helm-occur-map)
- (requires-pattern . 3)))
+ (requires-pattern . 3)
+ (delayed)))
;;; Multi occur
@@ -270,7 +277,8 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(candidate-number-limit . 9999)
(mode-line . helm-moccur-mode-line)
(keymap . ,helm-c-moccur-map)
- (requires-pattern . 3))
+ (requires-pattern . 3)
+ (delayed . ,helm-m-occur-idle-delay))
"Helm source for multi occur.")
(defun helm-m-occur-transformer (candidates source)
View
35 helm.el
@@ -1932,15 +1932,22 @@ is done on whole `helm-buffer' and not on current source."
(helm-log "Update preselect candidate %s" preselect)
(helm-preselect preselect))))
(when delayed-sources
- (helm-new-timer
- 'helm-process-delayed-sources-timer
- (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.1 if == to 0.
- (max helm-idle-delay helm-input-idle-delay 0.1) nil
- 'helm-process-delayed-sources delayed-sources preselect)))
+ ;; Allow giving a value to `delayed' attr from inside source.
+ ;; Retain the biggest value (the slower) found in DELAYED-SOURCES.
+ (let ((helm-idle-delay (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)))
+ (helm-new-timer
+ 'helm-process-delayed-sources-timer
+ (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.1 if == to 0.
+ (max helm-idle-delay helm-input-idle-delay 0.1) nil
+ 'helm-process-delayed-sources delayed-sources preselect))))
(helm-log "end update")))))
(defun helm-update-source-p (source)
@@ -2844,11 +2851,11 @@ See also `helm-sources' docstring."
(defun helm-search-match-part (candidate pattern match-part-fn)
"Match PATTERN only on part of CANDIDATE returned by MATCH-PART-FN."
- (if (string-match " " pattern)
- (loop with part = (funcall match-part-fn candidate)
- for i in (split-string pattern " " t)
- always (string-match i part))
- (string-match pattern (funcall match-part-fn candidate))))
+ (let ((part (funcall match-part-fn candidate)))
+ (if (string-match " " pattern)
+ (loop for i in (split-string pattern " " t)
+ always (string-match i part))
+ (string-match pattern part))))
(defun helm-initial-candidates-from-candidate-buffer (endp
get-line-fn
Please sign in to comment.
Something went wrong with that request. Please try again.