diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2016-09-04 06:19:27 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2016-09-04 06:35:38 +0200 |
commit | 603befd98f5d89d97c7d27ee52bd5f2907ab31e7 (patch) | |
tree | 549b41ef227116c9874d87badd25fbffc9f8fe2e | |
parent | 6e27e2821c25deff10c807c2c52bbebb59c024dc (diff) |
Remove obsolete variable helm-follow-mode.
* helm-buffers.el (helm-buffers-list-persistent-action):
Use helm-follow-mode-p.
* helm-elisp.el (helm-elisp--persistent-help): Use helm-follow-mode-p.
* helm-files.el (helm-find-files-up-one-level): Use helm-follow-mode-p.
* helm.el (helm-follow-mode): Stop using obsolete helm-follow-mode local variable
as helm-follow-mode is always local to source.
(helm-create-helm-buffer): Remove local setting of helm-follow-mode.
(helm-display-mode-line): Use helm-follow-mode-p.
(helm-mark-all): Use helm-follow-mode-p.
(helm-follow-input-idle-delay): Moved on top of section.
(helm-source-names-using-follow): Same.
(helm-follow-execute-persistent-action-maybe): Setup follow-mode locally to source.
(helm-follow-mode-p): New.
(helm-follow-mode-set-source): New.
-rw-r--r-- | helm-buffers.el | 2 | ||||
-rw-r--r-- | helm-elisp.el | 2 | ||||
-rw-r--r-- | helm-files.el | 2 | ||||
-rw-r--r-- | helm.el | 65 |
4 files changed, 37 insertions, 34 deletions
diff --git a/helm-buffers.el b/helm-buffers.el index 2ede017b..35f4df8c 100644 --- a/helm-buffers.el +++ b/helm-buffers.el @@ -782,7 +782,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (defun helm-buffers-list-persistent-action (candidate) (let ((current (window-buffer helm-persistent-action-display-window))) - (if (or (with-helm-buffer helm-follow-mode) + (if (or (helm-follow-mode-p) (eql current (get-buffer helm-current-buffer)) (not (eql current (get-buffer candidate)))) (switch-to-buffer candidate) diff --git a/helm-elisp.el b/helm-elisp.el index 806d62aa..4766112e 100644 --- a/helm-elisp.el +++ b/helm-elisp.el @@ -672,7 +672,7 @@ Filename completion happen if string start after or between a double quote." (defun helm-elisp--persistent-help (candidate fun &optional name) (let ((hbuf (get-buffer (help-buffer)))) - (cond ((with-helm-buffer helm-follow-mode) + (cond ((helm-follow-mode-p) (if name (funcall fun candidate name) (funcall fun candidate))) diff --git a/helm-files.el b/helm-files.el index e321d6a9..73904905 100644 --- a/helm-files.el +++ b/helm-files.el @@ -1437,7 +1437,7 @@ If prefix numeric arg is given go ARG level up." (when (and (helm-file-completion-source-p) (not (helm-ff-invalid-tramp-name-p))) (with-helm-window - (when helm-follow-mode + (when (helm-follow-mode-p) (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 @@ -960,7 +960,6 @@ It also accepts function or variable symbol.") (defvar helm-issued-errors nil) (defvar helm--last-log-file nil "The name of the log file of the last helm session.") -(defvar helm-follow-mode nil) (defvar helm--local-variables nil) (defvar helm-split-window-state nil) (defvar helm--window-side-state nil) @@ -2370,7 +2369,6 @@ Unuseful when used outside helm, don't use it.") (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) @@ -3666,7 +3664,7 @@ DIRECTION is either 'next or 'previous." (assoc-default 'mode-line source)) (default-value 'helm-mode-line-string)) source)) - (let ((follow (and (or (eq (cdr (assq 'follow source)) 1) + (let ((follow (and (or (helm-follow-mode-p source) (and helm-follow-mode-persistent (member (assoc-default 'name source) helm-source-names-using-follow))) @@ -5014,8 +5012,8 @@ See `helm-persistent-action-display-window' for how to use SPLIT-ONEWINDOW." (interactive) (with-helm-alive-p (with-helm-window - (let* ((follow (if helm-follow-mode 1 -1)) - (src (helm-get-current-source)) + (let* ((src (helm-get-current-source)) + (follow (if (helm-follow-mode-p src) 1 -1)) (nomark (assq 'nomark src)) helm-follow-mode-persistent (src-name (assoc-default 'name src)) @@ -5261,6 +5259,25 @@ display values." ;;; Follow-mode: Automatic execution of persistent-action ;; ;; +(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 over this.") + +(defcustom helm-source-names-using-follow nil + "A list of source names to have follow enabled. +This list of source names will be used only +when `helm-follow-mode-persistent' is non-nil. + +You don't have to customize this yourself unless you really want, +instead just set `helm-follow-mode-persistent' to non-nil and as soon +you enable `helm-follow-mode' (C-c C-f) in a source, helm will save source name +in this variable. +If you turn off `helm-follow-mode' in a source and `helm-follow-mode-persistent' is non-nil +the source name will be removed from this variable and saved." + :group 'helm + :type '(repeat (choice string))) + (defun helm-follow-mode (&optional arg) "Execute persistent action every time the cursor is moved. @@ -5292,8 +5309,7 @@ They are bound by default to \\[helm-follow-action-forward] and \\[helm-follow-a ;; ARG, assume follow is already enabled. ;; i.e turn it off now. (< arg 0) - (eq (cdr fol-attr) 1) - helm-follow-mode + (helm-follow-mode-p src) (and helm-follow-mode-persistent (member (assoc-default 'name src) helm-source-names-using-follow))))) @@ -5302,7 +5318,7 @@ They are bound by default to \\[helm-follow-action-forward] and \\[helm-follow-a (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) + (helm-follow-mode-set-source (if enabled -1 1) src) (when helm-follow-mode-persistent (if (null enabled) (unless (member name helm-source-names-using-follow) @@ -5313,9 +5329,8 @@ They are bound by default to \\[helm-follow-action-forward] and \\[helm-follow-a (delete name helm-source-names-using-follow)) (customize-save-variable 'helm-source-names-using-follow helm-source-names-using-follow))) - (setq helm-follow-mode (not enabled)) (message "helm-follow-mode is %s" - (if helm-follow-mode + (if (helm-follow-mode-p src) "enabled" "disabled")) (helm-display-mode-line src t)) (unless helm-follow-mode-persistent @@ -5323,25 +5338,6 @@ They are bound by default to \\[helm-follow-action-forward] and \\[helm-follow-a (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 over this.") - -(defcustom helm-source-names-using-follow nil - "A list of source names to have follow enabled. -This list of source names will be used only -when `helm-follow-mode-persistent' is non-nil. - -You don't have to customize this yourself unless you really want, -instead just set `helm-follow-mode-persistent' to non-nil and as soon -you enable `helm-follow-mode' (C-c C-f) in a source, helm will save source name -in this variable. -If you turn off `helm-follow-mode' in a source and `helm-follow-mode-persistent' is non-nil -the source name will be removed from this variable and saved." - :group 'helm - :type '(repeat (choice string))) - (defun helm-follow-execute-persistent-action-maybe (&optional delay) "Execute persistent action in mode `helm-follow-mode'. @@ -5356,16 +5352,23 @@ or `helm-follow-input-idle-delay' or `helm-input-idle-delay' secs." 0.01)))) (when (and (not (get-buffer-window helm-action-buffer 'visible)) (not (helm-pos-header-line-p)) - (or (eq (assoc-default 'follow src) 1) + (or (helm-follow-mode-p src) (and helm-follow-mode-persistent (member (assoc-default 'name src) helm-source-names-using-follow))) (null (eq (assoc-default 'follow src) 'never)) (helm-window) (helm-get-selection)) - (setq helm-follow-mode t) + (helm-follow-mode-set-source 1 src) (run-with-idle-timer at nil #'helm-execute-persistent-action)))) +(defun helm-follow-mode-p (&optional source) + (with-helm-buffer + (eq (helm-attr 'follow (or source (helm-get-current-source))) 1))) + +(defun helm-follow-mode-set-source (value &optional source) + (with-helm-buffer + (helm-attrset 'follow value (or source (helm-get-current-source))))) ;;; Auto-resize mode ;; |