summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/issue_template.md11
-rw-r--r--Makefile15
-rw-r--r--README.md9
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/0003-decruft-README.patch6
-rw-r--r--debian/patches/0004-patch-emacs-helm-sh.patch34
-rwxr-xr-xemacs-helm.sh56
-rw-r--r--helm-adaptive.el18
-rw-r--r--helm-bookmark.el45
-rw-r--r--helm-buffers.el192
-rw-r--r--helm-color.el8
-rw-r--r--helm-comint.el29
-rw-r--r--helm-command.el106
-rw-r--r--helm-config.el2
-rw-r--r--helm-core-pkg.el4
-rw-r--r--helm-dabbrev.el66
-rw-r--r--helm-elisp-package.el11
-rw-r--r--helm-elisp.el68
-rw-r--r--helm-eshell.el21
-rw-r--r--helm-eval.el6
-rw-r--r--helm-external.el30
-rw-r--r--helm-files.el1669
-rw-r--r--helm-find.el5
-rw-r--r--helm-font.el15
-rw-r--r--helm-for-files.el13
-rw-r--r--helm-grep.el336
-rw-r--r--helm-help.el196
-rw-r--r--helm-id-utils.el10
-rw-r--r--helm-imenu.el33
-rw-r--r--helm-info.el21
-rw-r--r--helm-lib.el263
-rw-r--r--helm-locate.el66
-rw-r--r--helm-man.el6
-rw-r--r--helm-misc.el8
-rw-r--r--helm-mode.el151
-rw-r--r--helm-multi-match.el32
-rw-r--r--helm-net.el43
-rw-r--r--helm-occur.el34
-rw-r--r--helm-pkg.el6
-rw-r--r--helm-regexp.el4
-rw-r--r--helm-ring.el14
-rw-r--r--helm-semantic.el2
-rw-r--r--helm-source.el26
-rw-r--r--helm-sys.el47
-rw-r--r--helm-tags.el13
-rw-r--r--helm-utils.el75
-rw-r--r--helm.el1857
47 files changed, 3512 insertions, 2176 deletions
diff --git a/.github/issue_template.md b/.github/issue_template.md
index 0e84055a..0d5e3af2 100644
--- a/.github/issue_template.md
+++ b/.github/issue_template.md
@@ -20,7 +20,14 @@ environment: no other packages and only minimal settings.
When possible, use it to reproduce your Helm issue to ensure no other package is
interfering.
-To run it, simply switch to the directory where Helm is installed and call `./emacs-helm.sh`.
-If necessary you can specify emacs executable path on command line with "-P" option.
+To run it, simply switch to the directory where Helm is installed and
+call `./emacs-helm.sh`. If necessary you can specify emacs executable
+path on command line with "-P" option. For people using straight to
+manage their packages you have to specify the path to you emacs-async
+installation:
+
+cd ~/.emacs.d/straight/repos/helm
+EMACSLOADPATH="../emacs-async:" ./emacs-helm.sh
+
Thanks.
diff --git a/Makefile b/Makefile
index 1d3a53c8..accc8baf 100644
--- a/Makefile
+++ b/Makefile
@@ -36,8 +36,13 @@ PKGDIR := .
LOADPATH := -L $(PKGDIR)
# Prefer emacs config folder in XDG_CONFIG_HOME to ~/.emacs.d
+# Assume emacs-user-directory is ~/.emacs.d
+# Try to find ELPA directory or STRAIGHT directory.
XDG_ELPA_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME)/emacs/elpa, $(HOME)/.config/emacs/elpa)
-ELPA_DIR := $(if $(shell test -d $(XDG_ELPA_DIR)), $(HOME)/.emacs.d/elpa, $(XDG_ELPA_DIR))
+ELPA_DIR := $(if $(shell test -d $(XDG_ELPA_DIR)), $(XDG_ELPA_DIR), $(HOME)/.emacs.d/elpa)
+
+XDG_STRAIGHT_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME)/emacs/straight/build, $(HOME)/.config/emacs/straight/build)
+STRAIGHT_DIR := $(if $(shell test -d $(XDG_STRAIGHT_DIR)), $(XDG_STRAIGHT_DIR), $(HOME)/.emacs.d/straight/build)
ASYNC_ELPA_DIR = $(shell \
test -d $(ELPA_DIR) && \
@@ -47,6 +52,14 @@ ifneq "$(ASYNC_ELPA_DIR)" ""
LOADPATH += -L $(ASYNC_ELPA_DIR)
endif
+ASYNC_STRAIGHT_DIR = $(shell \
+ test -d $(STRAIGHT_DIR) && \
+ find -L $(STRAIGHT_DIR) -maxdepth 1 -regex '.*/async' 2> /dev/null | \
+ sort | tail -n 1)
+ifneq "$(ASYNC_STRAIGHT_DIR)" ""
+ LOADPATH += -L $(ASYNC_STRAIGHT_DIR)
+endif
+
# Files to compile
EL := $(sort $(wildcard helm*.el))
diff --git a/README.md b/README.md
index c4f54935..f3e1acb3 100644
--- a/README.md
+++ b/README.md
@@ -22,15 +22,8 @@
<p align="center">
Maintaining Helm requires a <a href="https://github.com/emacs-helm/helm/commits?author=thierryvolpiatto"><b>lot of work</b></a>,
- which I have done voluntarily since 2011.<br>
- As it demands lots of my time it gets increasingly difficult<br>
- maintaining it without financial help.<br>
Thanks to all the people that are helping or have helped Helm development,<br>
- but they are actually too few to continue serenely.<br>
- By the way, after the release of version 3.0 I will have to stop<br>
- developing Helm seriously until I get enough financial support,<br>
- only providing a minimal bugfix maintenance.<br>
- Thanks for your understanding<br>
+ but they are actually too few.<br>
If you feel Helm is making your daily work easier,<br>
<b>please consider making a donation.</b><br>
diff --git a/debian/changelog b/debian/changelog
index 7cd06c76..04fc131b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+helm (3.6.4-1) unstable; urgency=medium
+
+ * Update to new upstream version 3.6.4.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Mon, 27 Jul 2020 09:18:16 -0700
+
helm (3.6.1-1) unstable; urgency=medium
* Update to new upstream version 3.6.1.
diff --git a/debian/patches/0003-decruft-README.patch b/debian/patches/0003-decruft-README.patch
index 4c22ef6e..ddf1fbd8 100644
--- a/debian/patches/0003-decruft-README.patch
+++ b/debian/patches/0003-decruft-README.patch
@@ -7,7 +7,7 @@ Subject: decruft README for Debian
1 file changed, 4 insertions(+), 28 deletions(-)
diff --git a/README.md b/README.md
-index 8a9c71b..c4f5493 100644
+index dc20065..f3e1acb 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,5 @@
@@ -37,7 +37,7 @@ index 8a9c71b..c4f5493 100644
<a href="https://github.com/emacs-helm/helm/wiki"><b>Helm wiki</b></a> |
<a href="https://github.com/emacs-helm/helm/wiki/FAQ"><b>FAQ</b></a>
</p>
-@@ -55,17 +41,11 @@
+@@ -48,17 +34,11 @@
</p>
<div align="center">
@@ -58,7 +58,7 @@ index 8a9c71b..c4f5493 100644
&nbsp;&nbsp;
</div>
-@@ -75,8 +55,4 @@
+@@ -68,8 +48,4 @@
Helm in action searching with <a href="https://github.com/ggreer/the_silver_searcher"<b>Grep Ag</b></a>
</p>
diff --git a/debian/patches/0004-patch-emacs-helm-sh.patch b/debian/patches/0004-patch-emacs-helm-sh.patch
index 2b128603..06cd1e07 100644
--- a/debian/patches/0004-patch-emacs-helm-sh.patch
+++ b/debian/patches/0004-patch-emacs-helm-sh.patch
@@ -7,7 +7,7 @@ Subject: patch emacs-helm.sh for Debian
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/emacs-helm.sh b/emacs-helm.sh
-index 568048b..0e12193 100755
+index 61204ab..5120658 100755
--- a/emacs-helm.sh
+++ b/emacs-helm.sh
@@ -135,22 +135,6 @@ done
@@ -33,26 +33,26 @@ index 568048b..0e12193 100755
cat > $CONF_FILE <<EOF
(setq initial-scratch-message (concat initial-scratch-message
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\
-@@ -176,13 +160,6 @@ cat > $CONF_FILE <<EOF
+@@ -204,13 +188,6 @@ cat > $CONF_FILE <<EOF
- (setq load-path (quote $LOAD_PATH))
- (require 'package)
--;; User may be using a non standard \`package-user-dir'.
--;; Modify \`package-directory-list' instead of \`package-user-dir'
--;; in case the user starts Helm from a non-ELPA installation.
--(unless (file-equal-p package-user-dir (locate-user-emacs-file "elpa"))
-- (add-to-list 'package-directory-list (directory-file-name
-- (file-name-directory
-- (directory-file-name default-directory)))))
+ (unless (eq default-package-manager 'straight)
+ (require 'package)
+- ;; User may be using a non standard \`package-user-dir'.
+- ;; Modify \`package-directory-list' instead of \`package-user-dir'
+- ;; in case the user starts Helm from a non-ELPA installation.
+- (unless (file-equal-p package-user-dir (locate-user-emacs-file "elpa"))
+- (add-to-list 'package-directory-list (directory-file-name
+- (file-name-directory
+- (directory-file-name default-directory)))))
- (let* ((str-lst "$LOAD_PACKAGES")
- (load-packages (and str-lst
-@@ -195,7 +172,7 @@ cat > $CONF_FILE <<EOF
- (mapcar (lambda (p) (list (intern p) t)) load-packages)))))
+ (let* ((str-lst "$LOAD_PACKAGES")
+ (load-packages (and str-lst
+@@ -224,7 +201,7 @@ cat > $CONF_FILE <<EOF
+
+ (package-initialize))
- (package-initialize)
-(add-to-list 'load-path (file-name-directory (file-truename "$0")))
+(add-to-list 'package-directory-list "/usr/share/emacs/site-lisp/elpa-src")
+
(unless (> $TOOLBARS 0)
(setq default-frame-alist '((vertical-scroll-bars . nil)
- (tool-bar-lines . 0)
diff --git a/emacs-helm.sh b/emacs-helm.sh
index 0e121935..51206585 100755
--- a/emacs-helm.sh
+++ b/emacs-helm.sh
@@ -159,20 +159,50 @@ cat > $CONF_FILE <<EOF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\\n"))
(setq load-path (quote $LOAD_PATH))
-(require 'package)
-
-(let* ((str-lst "$LOAD_PACKAGES")
- (load-packages (and str-lst
- (not (string= str-lst ""))
- (split-string str-lst ","))))
- (setq package-load-list
- (if (equal load-packages '("all"))
- '(all)
- (append '((helm-core t) (helm t) (async t) (popup t))
- (mapcar (lambda (p) (list (intern p) t)) load-packages)))))
-
-(package-initialize)
+
+(defvar default-package-manager nil)
+(defvar bootstrap-version)
+(let* ((packages "$LOAD_PACKAGES")
+ (pkg-list (and packages
+ (not (equal packages ""))
+ (split-string packages ",")))
+ (straight-path (expand-file-name "straight/build/" user-emacs-directory))
+ (async-path (expand-file-name "straight/build/async" user-emacs-directory))
+ (bootstrap-file
+ (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
+ (bootstrap-version 5))
+ (when (file-exists-p bootstrap-file)
+ (setq default-package-manager 'straight)
+ (load bootstrap-file nil 'nomessage)
+ (add-to-list 'load-path async-path)
+ (when pkg-list
+ (dolist (pkg pkg-list)
+ (let* ((pkg-path (expand-file-name pkg straight-path))
+ (autoload-file (expand-file-name
+ (format "%s-autoloads.el" pkg)
+ pkg-path)))
+ (add-to-list 'load-path pkg-path)
+ (if (file-exists-p autoload-file)
+ (load autoload-file nil 'nomessage)
+ (straight-use-package (intern pkg))))))))
+
+(unless (eq default-package-manager 'straight)
+ (require 'package)
+
+ (let* ((str-lst "$LOAD_PACKAGES")
+ (load-packages (and str-lst
+ (not (string= str-lst ""))
+ (split-string str-lst ","))))
+ (setq package-load-list
+ (if (equal load-packages '("all"))
+ '(all)
+ (append '((helm-core t) (helm t) (async t) (popup t))
+ (mapcar (lambda (p) (list (intern p) t)) load-packages)))))
+
+ (package-initialize))
+
(add-to-list 'package-directory-list "/usr/share/emacs/site-lisp/elpa-src")
+
(unless (> $TOOLBARS 0)
(setq default-frame-alist '((vertical-scroll-bars . nil)
(tool-bar-lines . 0)
diff --git a/helm-adaptive.el b/helm-adaptive.el
index 5be22283..56383a3c 100644
--- a/helm-adaptive.el
+++ b/helm-adaptive.el
@@ -31,9 +31,9 @@
(defcustom helm-adaptive-history-file
(locate-user-emacs-file "helm-adaptive-history")
"Path of file where history information is stored.
-When nil history is not saved nor restored after emacs restart unless
-you save/restore `helm-adaptive-history' with something else like
-psession or desktop."
+When nil history is not saved nor restored after Emacs restart
+unless you save/restore `helm-adaptive-history' with something
+else like psession or desktop."
:type 'string
:group 'helm-adapt)
@@ -48,8 +48,8 @@ psession or desktop."
When nil sort on frequency usage only.
Only frequency:
-When candidate have low frequency, you have to hit on it many times to
-make it going up on top.
+When candidate have low frequency, you have to hit on it many
+times to make it going up on top.
Frequency+recent:
Even with a low frequency, candidate go up on top. If a candidate
@@ -172,7 +172,7 @@ Returns nil if `helm-adaptive-history-file' doesn't exist."
(load-file helm-adaptive-history-file)))
(defun helm-adaptive-save-history (&optional arg)
- "Save history information to file given by `helm-adaptive-history-file'."
+ "Save history information to the file given by `helm-adaptive-history-file'."
(interactive "p")
(when helm-adaptive-history-file
(with-temp-buffer
@@ -253,7 +253,8 @@ you should reinitialize it with `helm-reset-adaptive-history'"
;;;###autoload
(defun helm-reset-adaptive-history ()
"Delete all `helm-adaptive-history' and his file.
-Useful when you have a old or corrupted `helm-adaptive-history-file'."
+Useful when you have a old or corrupted
+`helm-adaptive-history-file'."
(interactive)
(when (y-or-n-p "Really delete all your `helm-adaptive-history'? ")
(setq helm-adaptive-history nil)
@@ -262,7 +263,8 @@ Useful when you have a old or corrupted `helm-adaptive-history-file'."
(defun helm-adaptive-compare (x y)
"Compare display parts if some of candidates X and Y.
-Arguments X and Y are cons cell in (DISPLAY . REAL) format or atoms."
+Arguments X and Y are cons cell in (DISPLAY . REAL) format or
+atoms."
(equal (if (listp x) (car x) x)
(if (listp y) (car y) y)))
diff --git a/helm-bookmark.el b/helm-bookmark.el
index 66f49cbb..6954f256 100644
--- a/helm-bookmark.el
+++ b/helm-bookmark.el
@@ -56,42 +56,50 @@
(defface helm-bookmark-info
- '((t (:foreground "green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "green"))
"Face used for W3m Emacs bookmarks (not w3m bookmarks)."
:group 'helm-bookmark)
(defface helm-bookmark-w3m
- '((t (:foreground "yellow")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "yellow"))
"Face used for W3m Emacs bookmarks (not w3m bookmarks)."
:group 'helm-bookmark)
(defface helm-bookmark-gnus
- '((t (:foreground "magenta")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "magenta"))
"Face used for Gnus bookmarks."
:group 'helm-bookmark)
(defface helm-bookmark-man
- '((t (:foreground "Orange4")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Orange4"))
"Face used for Woman/man bookmarks."
:group 'helm-bookmark)
(defface helm-bookmark-file
- '((t (:foreground "Deepskyblue2")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Deepskyblue2"))
"Face used for file bookmarks."
:group 'helm-bookmark)
(defface helm-bookmark-file-not-found
- '((t (:foreground "Slategray4")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Slategray4"))
"Face used for file bookmarks."
:group 'helm-bookmark)
(defface helm-bookmark-directory
- '((t (:inherit helm-ff-directory)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit helm-ff-directory))
"Face used for file bookmarks."
:group 'helm-bookmark)
(defface helm-bookmark-addressbook
- '((t (:foreground "tomato")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "tomato"))
"Face used for addressbook bookmarks."
:group 'helm-bookmark)
@@ -105,7 +113,7 @@
(define-key map (kbd "C-]") 'helm-bookmark-toggle-filename)
(define-key map (kbd "M-e") 'helm-bookmark-run-edit)
map)
- "Generic Keymap for emacs bookmark sources.")
+ "Generic Keymap for Emacs bookmark sources.")
(defclass helm-source-basic-bookmarks (helm-source-in-buffer helm-type-bookmark)
((init :initform (lambda ()
@@ -292,8 +300,8 @@ BOOKMARK is a bookmark name or a bookmark record."
(defvar w3m-async-exec)
(defun helm-bookmark-jump-w3m (bookmark)
"Jump to W3m bookmark BOOKMARK, setting a new tab.
-If `browse-url-browser-function' is set to something else
-than `w3m-browse-url' use it."
+If `browse-url-browser-function' is set to something else than
+`w3m-browse-url' use it."
(require 'helm-net)
(let* ((file (or (bookmark-prop-get bookmark 'filename)
(bookmark-prop-get bookmark 'url)))
@@ -596,7 +604,8 @@ than `w3m-browse-url' use it."
;;
(defun helm-bookmark-edit-bookmark (bookmark-name)
"Edit bookmark's name and file name, and maybe save them.
-BOOKMARK-NAME is the current (old) name of the bookmark to be renamed."
+BOOKMARK-NAME is the current (old) name of the bookmark to be
+renamed."
(let ((bmk (helm-bookmark-get-bookmark-from-name bookmark-name))
(handler (bookmark-prop-get bookmark-name 'handler)))
(if (eq handler 'addressbook-bookmark-jump)
@@ -644,8 +653,8 @@ If NEW is nil, then prompt for its string value.
If BATCH is non-nil, then do not rebuild the menu list.
-While the user enters the new name, repeated `C-w' inserts consecutive
-words from the buffer into the new bookmark name."
+While the user enters the new name, repeated `C-w' inserts
+consecutive words from the buffer into the new bookmark name."
(interactive (list (bookmark-completing-read "Old bookmark name")))
(bookmark-maybe-historicize-string old)
(bookmark-maybe-load-default-file)
@@ -694,7 +703,7 @@ words from the buffer into the new bookmark name."
(defun helm-bookmark-get-bookmark-from-name (bmk)
"Return bookmark name even if it is a bookmark with annotation.
-e.g prepended with *."
+E.g. prepended with *."
(let ((bookmark (replace-regexp-in-string "\\`\\*" "" bmk)))
(if (assoc bookmark bookmark-alist) bookmark bmk)))
@@ -716,9 +725,9 @@ e.g prepended with *."
;;;###autoload
(defun helm-filtered-bookmarks ()
- "Preconfigured helm for bookmarks (filtered by category).
-Optional source `helm-source-bookmark-addressbook' is loaded
-only if external addressbook-bookmark package is installed."
+ "Preconfigured `helm' for bookmarks (filtered by category).
+Optional source `helm-source-bookmark-addressbook' is loaded only
+if external addressbook-bookmark package is installed."
(interactive)
(helm :sources helm-bookmark-default-filtered-sources
:prompt "Search Bookmark: "
diff --git a/helm-buffers.el b/helm-buffers.el
index 8faa60ff..a4dd38fc 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -26,8 +26,6 @@
(require 'helm-help)
(require 'helm-occur)
-(declare-function ido-make-buffer-list "ido" (default))
-(declare-function ido-add-virtual-buffers-to-list "ido")
(declare-function helm-comp-read "helm-mode")
(declare-function helm-browse-project "helm-files")
@@ -62,18 +60,18 @@ These buffers will be displayed even if they match one of
(defcustom helm-buffer-max-length 20
"Max length of buffer names before truncate.
-When disabled (nil) use the longest buffer-name length found."
+When disabled (nil) use the longest `buffer-name' length found."
:group 'helm-buffers
:type '(choice (const :tag "Disabled" nil)
(integer :tag "Length before truncate")))
(defcustom helm-buffer-details-flag t
- "Always show details in buffer list when non--nil."
+ "Always show details in buffer list when non-nil."
:group 'helm-buffers
:type 'boolean)
(defcustom helm-buffers-fuzzy-matching nil
- "Fuzzy matching buffer names when non--nil.
+ "Fuzzy matching buffer names when non-nil.
Only buffer names are fuzzy matched when this is enabled,
`major-mode' matching is not affected by this."
:group 'helm-buffers
@@ -85,7 +83,7 @@ Only buffer names are fuzzy matched when this is enabled,
:type 'boolean)
(defcustom helm-buffers-truncate-lines t
- "Truncate lines in `helm-buffers-list' when non--nil."
+ "Truncate lines in `helm-buffers-list' when non-nil."
:group 'helm-buffers
:type 'boolean)
@@ -99,8 +97,8 @@ Only buffer names are fuzzy matched when this is enabled,
helm-source-buffer-not-found)
"Default sources list used in `helm-mini'.
-When adding a source here it is up to you to ensure the library of
-this source is accessible and properly loaded."
+When adding a source here it is up to you to ensure the library
+of this source is accessible and properly loaded."
:group 'helm-buffers
:type '(repeat (choice symbol)))
@@ -117,21 +115,41 @@ this source is accessible and properly loaded."
(defcustom helm-buffer--pretty-names '((dired-mode . "Dired")
(lisp-interaction-mode . "Lisp Inter"))
"An alist specifying pretty names for modes.
-Most of the time buffer's `mode-name' is a string so no need to add it
-here as there is no need to compute it, but sometimes it may be a
-mode-line specification which may be costly to compute, in this case
-add here the pretty name as a string to avoid this costly computation.
-Also if some pretty names are too long you can add your own
-abbreviation here."
+Most of the time buffer's `mode-name' is a string so no need to
+add it here as there is no need to compute it, but sometimes it
+may be a mode-line specification which may be costly to compute,
+in this case add here the pretty name as a string to avoid this
+costly computation. Also if some pretty names are too long you
+can add your own abbreviation here."
:type '(alist :key-type symbol :value-type string)
:group 'helm-buffers)
(defcustom helm-buffers-maybe-switch-to-tab nil
"Switch to buffer in its tab when non nil.
-This have no effect when `tab-bar-mode' is not available."
+This has no effect when `tab-bar-mode' is not available."
:group 'helm-buffers
:type 'boolean)
+(defcustom helm-buffer-list-reorder-fn #'helm-buffers-reorder-buffer-list
+ "A function in charge of ordering the initial buffer list.
+It takes two arguments VISIBLES buffers and OTHERS buffers.
+Arg VISIBLES handles the buffers visibles in this frame.
+Arg OTHERS handles all the other buffers.
+You can write a function that reorder VISIBLES and OTHERS as you
+want.
+Default function returns OTHERS buffers on top and VISIBLES
+buffer at the end. See `helm-buffers-reorder-buffer-list'."
+ :group 'helm-buffers
+ :type 'function)
+
+(defcustom helm-buffers-sort-fn helm-fuzzy-sort-fn
+ "The sort function to use in `helm-buffers-list'.
+
+Default to `helm-fuzzy-sort-fn' you can use
+`helm-fuzzy-matching-sort-fn-preserve-ties-order' as alternative if
+you want to keep the recentest order when narrowing candidates."
+ :type 'function
+ :group 'helm-buffers)
;;; Faces
;;
@@ -143,57 +161,69 @@ This have no effect when `tab-bar-mode' is not available."
:group 'helm-faces)
(defface helm-buffer-saved-out
- '((t (:foreground "red" :background "black")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "red" :background "black"))
"Face used for buffer files modified outside of emacs."
:group 'helm-buffers-faces)
(defface helm-buffer-not-saved
- '((t (:foreground "Indianred2")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Indianred2"))
"Face used for buffer files not already saved on disk."
:group 'helm-buffers-faces)
(defface helm-buffer-modified
- '((t :inherit font-lock-comment-face))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-comment-face))
"Face used for modified buffers."
:group 'helm-buffers-faces)
(defface helm-buffer-size
- '((((background dark)) :foreground "RosyBrown")
- (((background light)) :foreground "SlateGray"))
+ `((((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "RosyBrown")
+ (((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "SlateGray"))
"Face used for buffer size."
:group 'helm-buffers-faces)
(defface helm-buffer-process
- '((t (:foreground "Sienna3")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Sienna3"))
"Face used for process status in buffer."
:group 'helm-buffers-faces)
(defface helm-buffer-directory
- '((t (:foreground "DarkRed" :background "LightGray")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "DarkRed" :background "LightGray"))
"Face used for directories in `helm-buffers-list'."
:group 'helm-buffers-faces)
(defface helm-buffer-file
- '((t :inherit font-lock-builtin-face))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-builtin-face))
"Face for buffer file names in `helm-buffers-list'."
:group 'helm-buffers-faces)
(defface helm-buffer-archive
- '((t (:foreground "Gold")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Gold"))
"Face for archive file names in `helm-buffers-list'."
:group 'helm-buffers-faces)
(defface helm-non-file-buffer
- '((t (:inherit italic)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit italic))
"Face used for non-file buffers in `helm-buffers-list'."
:group 'helm-buffers-faces)
(defvar helm-buffers-tick-counter nil
"Allows recording local changes to a non-file buffer.
-Typical usage of this var is for modes that want to see if
-their buffers have changed since last visit.
-Such programs may want to record tick counter after visiting their
-buffers like this:
+Typical usage of this var is for modes that want to see if their
+buffers have changed since last visit.
+Such programs may want to record tick counter after visiting
+their buffers like this:
(setq helm-buffers-tick-counter (buffer-modified-tick))
@@ -235,17 +265,6 @@ Note that this variable is buffer-local.")
map)
"Keymap for buffer sources in helm.")
-(defvar helm-buffers-ido-virtual-map
- (let ((map (make-sparse-keymap)))
- (set-keymap-parent map helm-map)
- (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window)
- (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame)
- (define-key map (kbd "M-g s") 'helm-ff-run-grep)
- (define-key map (kbd "M-g z") 'helm-ff-run-zgrep)
- (define-key map (kbd "M-D") 'helm-ff-run-delete-file)
- (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally)
- map))
-
(defvar helm-buffer-max-len-mode nil)
(defvar helm-buffers-in-project-p nil)
@@ -353,48 +372,36 @@ Note that this variable is buffer-local.")
#'helm-buffers-create-new-buffer-of)
:keymap helm-buffer-not-found-map))
-(defvar ido-temp-list)
-(defvar ido-ignored-list)
-(defvar ido-process-ignore-lists)
-(defvar ido-use-virtual-buffers)
-(defvar ido-virtual-buffers)
-
-(defvar helm-source-ido-virtual-buffers
- (helm-build-sync-source "Ido virtual buffers"
- :candidates (lambda ()
- (let (ido-temp-list
- ido-ignored-list
- (ido-process-ignore-lists t))
- (when ido-use-virtual-buffers
- (ido-add-virtual-buffers-to-list)
- ido-virtual-buffers)))
- :fuzzy-match helm-buffers-fuzzy-matching
- :keymap helm-buffers-ido-virtual-map
- :help-message 'helm-buffers-ido-virtual-help-message
- :action '(("Find file" . helm-find-many-files)
- ("Find file other window" . find-file-other-window)
- ("Find file other frame" . find-file-other-frame)
- ("Find file as root" . helm-find-file-as-root)
- ("Grep File(s) `C-u recurse'" . helm-find-files-grep)
- ("Zgrep File(s) `C-u Recurse'" . helm-ff-zgrep)
- ("View file" . view-file)
- ("Delete file(s)" . helm-delete-marked-files)
- ("Open file externally (C-u to choose)"
- . helm-open-file-externally))))
-
-(defvar ido-use-virtual-buffers)
-(defvar ido-ignore-buffers)
+(defun helm-buffers-get-visible-buffers ()
+ "Returns buffers visibles on current frame."
+ (let (result)
+ (walk-windows
+ (lambda (x)
+ (push (buffer-name (window-buffer x)) result))
+ nil 'visible)
+ result))
+
+(defun helm-buffer-list-1 (&optional visibles)
+ (cl-loop for b in (buffer-list)
+ for bn = (buffer-name b)
+ unless (member bn visibles)
+ collect bn))
+
+(defun helm-buffers-reorder-buffer-list (visibles others)
+ "Default function to reorder buffer-list.
+Arg VISIBLES handles the buffers visibles in this frame.
+Arg OTHERS handles all the other buffers.
+This function returns OTHERS buffers on top and VISIBLES buffer
+at the end."
+ (nconc others visibles))
+
(defun helm-buffer-list ()
"Return the current list of buffers.
-Currently visible buffers are put at the end of the list.
-See `ido-make-buffer-list' for more infos."
- (require 'ido)
- (let ((ido-process-ignore-lists t)
- ido-ignored-list
- ido-ignore-buffers
- ido-use-virtual-buffers)
- (ido-make-buffer-list nil)))
+The list is reordered with `helm-buffer-list-reorder-fn'."
+ (let* ((visibles (helm-buffers-get-visible-buffers))
+ (others (helm-buffer-list-1 visibles)))
+ (funcall helm-buffer-list-reorder-fn visibles others)))
(defun helm-buffer-size (buffer)
"Return size of BUFFER."
@@ -504,7 +511,8 @@ See `ido-make-buffer-list' for more infos."
(defun helm-highlight-buffers (buffers _source)
"Transformer function to highlight BUFFERS list.
-Should be called after others transformers i.e (boring buffers)."
+Should be called after others transformers i.e. (boring
+buffers)."
(cl-loop for i in buffers
for (name size mode meta) = (if helm-buffer-details-flag
(helm-buffer--details i 'details)
@@ -585,12 +593,8 @@ Should be called after others transformers i.e (boring buffers)."
(defun helm-buffers-sort-transformer (candidates source)
(if (string= helm-pattern "")
candidates
- (if helm-buffers-fuzzy-matching
- (let ((helm-pattern (helm-buffers--pattern-sans-filters)))
- (funcall helm-fuzzy-sort-fn candidates source))
- (sort candidates
- (lambda (s1 s2)
- (< (string-width s1) (string-width s2)))))))
+ (let ((helm-pattern (helm-buffers--pattern-sans-filters)))
+ (funcall helm-buffers-sort-fn candidates source))))
(defun helm-buffers-mark-similar-buffers-1 (&optional type)
(with-helm-window
@@ -622,7 +626,7 @@ Should be called after others transformers i.e (boring buffers)."
(defun helm-buffers-mark-similar-buffers ()
"Mark All buffers that have same property `type' than current.
-i.e same color."
+I.e. same color."
(interactive)
(with-helm-alive-p
(let ((marked (helm-marked-candidates)))
@@ -830,7 +834,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
(helm-buffer-save-and-update nil))
(defun helm-buffer-run-save-some-buffers ()
- "Save unsaved file buffers without quitting helm."
+ "Save unsaved file buffers without quitting Helm."
(interactive)
(with-helm-alive-p
(helm-attrset 'save-some-action '(helm-buffer-save-some-buffers . never-split))
@@ -838,7 +842,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
(put 'helm-buffer-run-save-some-buffers 'helm-only t)
(defun helm-buffer-save-persistent ()
- "Save buffer without quitting helm."
+ "Save buffer without quitting Helm."
(interactive)
(with-helm-alive-p
(helm-attrset 'save-action '(helm-buffer-save-and-update . never-split))
@@ -857,7 +861,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
(put 'helm-buffer-run-rename-buffer 'helm-only t)
(defun helm-buffer-run-kill-persistent ()
- "Kill buffer without quitting helm."
+ "Kill buffer without quitting Helm."
(interactive)
(with-helm-alive-p
(helm-attrset 'kill-action '(helm-buffers-persistent-kill . never-split))
@@ -933,8 +937,9 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
(defun helm-buffer-switch-buffers (_candidate)
"Switch to buffer candidates and replace current buffer.
-If more than one buffer marked switch to these buffers in separate windows.
-If a prefix arg is given split windows vertically."
+If more than one buffer marked switch to these buffers in
+separate windows. If a prefix arg is given split windows
+vertically."
(let ((buffers (helm-marked-candidates)))
(helm-window-show-buffers buffers)))
@@ -1088,7 +1093,7 @@ Can be used by any source that list buffers."
(put 'helm-buffers-toggle-show-hidden-buffers 'helm-only t)
(defun helm-buffers-browse-project (buf)
- "Browse project from buffer."
+ "Browse project from buffer BUF."
(with-current-buffer buf
(helm-browse-project helm-current-prefix-arg)))
@@ -1122,7 +1127,6 @@ displayed with the `file-name-shadow' face if available."
(setq helm-source-buffers-list
(helm-make-source "Buffers" 'helm-source-buffers)))
(helm :sources '(helm-source-buffers-list
- helm-source-ido-virtual-buffers
helm-source-buffer-not-found)
:buffer "*helm buffers*"
:keymap helm-buffer-map
diff --git a/helm-color.el b/helm-color.el
index a962796a..aee871dd 100644
--- a/helm-color.el
+++ b/helm-color.el
@@ -84,25 +84,25 @@
(kill-new (helm-colors-get-rgb candidate)))
(defun helm-color-run-insert-name ()
- "Insert name of color from `helm-source-colors'"
+ "Insert name of color from `helm-source-colors'."
(interactive)
(with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-name)))
(put 'helm-color-run-insert-name 'helm-only t)
(defun helm-color-run-kill-name ()
- "Kill name of color from `helm-source-colors'"
+ "Kill name of color from `helm-source-colors'."
(interactive)
(with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-name)))
(put 'helm-color-run-kill-name 'helm-only t)
(defun helm-color-run-insert-rgb ()
- "Insert RGB of color from `helm-source-colors'"
+ "Insert RGB of color from `helm-source-colors'."
(interactive)
(with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-rgb)))
(put 'helm-color-run-insert-rgb 'helm-only t)
(defun helm-color-run-kill-rgb ()
- "Kill RGB of color from `helm-source-colors'"
+ "Kill RGB of color from `helm-source-colors'."
(interactive)
(with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-rgb)))
(put 'helm-color-run-kill-rgb 'helm-only t)
diff --git a/helm-comint.el b/helm-comint.el
index 2cfdbe63..7e7f10b2 100644
--- a/helm-comint.el
+++ b/helm-comint.el
@@ -33,12 +33,14 @@
;;; Comint prompts
;;
(defface helm-comint-prompts-promptidx
- '((t (:foreground "cyan")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:foreground "cyan")))
"Face used to highlight comint prompt index."
:group 'helm-comint-faces)
(defface helm-comint-prompts-buffer-name
- '((t (:foreground "green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:foreground "green")))
"Face used to highlight comint buffer name."
:group 'helm-comint-faces)
@@ -47,9 +49,9 @@
:group 'helm-comint
:type 'boolean)
-(defcustom helm-comint-mode-list '(comint-mode slime-repl-mode sly-mrepl-mode)
+(defcustom helm-comint-mode-list '(comint-mode slime-repl-mode sly-mrepl-mode sql-interactive-mode)
"Supported modes for prompt navigation.
-Derived modes (e.g. Geiser's REPL) are automatically supported."
+Derived modes (e.g., Geiser's REPL) are automatically supported."
:group 'helm-comint
:type '(repeat (choice symbol)))
@@ -57,8 +59,8 @@ Derived modes (e.g. Geiser's REPL) are automatically supported."
(sly-mrepl-next-prompt)
(point))))
"Alist of (MODE . NEXT-PROMPT-FUNCTION) to use.
- If the current major mode is a key in this list, the associated function will be
- used to navigate the prompts.
+ If the current major mode is a key in this list, the associated
+ function will be used to navigate the prompts.
The function must return the point after the prompt.
Otherwise (comint-next-prompt 1) will be used."
:group 'helm-comint
@@ -66,11 +68,11 @@ Derived modes (e.g. Geiser's REPL) are automatically supported."
(defcustom helm-comint-max-offset 400
"Max number of chars displayed per candidate in comint-input-ring browser.
-When `t', don't truncate candidate, show all.
-By default it is approximatively the number of bits contained in five lines
-of 80 chars each i.e 80*5.
-Note that if you set this to nil multiline will be disabled, i.e you
-will not have anymore separators between candidates."
+When t, don't truncate candidate, show all.
+By default it is approximatively the number of bits contained in
+five lines of 80 chars each i.e 80*5.
+Note that if you set this to nil multiline will be disabled, i.e
+you will not have anymore separators between candidates."
:type '(choice (const :tag "Disabled" t)
(integer :tag "Max candidate offset"))
:group 'helm-misc)
@@ -87,7 +89,7 @@ will not have anymore separators between candidates."
"List the prompts in BUFFER in mode MODE.
Return a list of (\"prompt\" (point) (buffer-name) prompt-index))
-e.g. (\"ls\" 162 \"*shell*\" 3).
+E.g. (\"ls\" 162 \"*shell*\" 3).
If BUFFER is nil, use current buffer."
(with-current-buffer (or buffer (current-buffer))
(when (derived-mode-p mode)
@@ -216,7 +218,8 @@ See `helm-comint-prompts-list'."
(defun helm-comint-input-ring ()
"Preconfigured `helm' that provide completion of `comint' history."
(interactive)
- (when (derived-mode-p 'comint-mode)
+ (when (or (derived-mode-p 'comint-mode)
+ (member major-mode helm-comint-mode-list))
(helm :sources 'helm-source-comint-input-ring
:input (buffer-substring-no-properties (comint-line-beginning-position)
(point-at-eol))
diff --git a/helm-command.el b/helm-command.el
index 634d899a..1b7cf1e4 100644
--- a/helm-command.el
+++ b/helm-command.el
@@ -29,12 +29,12 @@
:group 'helm)
(defcustom helm-M-x-always-save-history nil
- "`helm-M-x' Save command in `extended-command-history' even when it fail."
+ "`helm-M-x' save command in `extended-command-history' even when it fails."
:group 'helm-command
:type 'boolean)
(defcustom helm-M-x-reverse-history nil
- "The history source of `helm-M-x' appear in second position when non--nil."
+ "The history source of `helm-M-x' appear in second position when non-nil."
:group 'helm-command
:type 'boolean)
@@ -48,7 +48,9 @@
:group 'helm-command
:group 'helm-faces)
-(defface helm-M-x-key '((t (:foreground "orange" :underline t)))
+(defface helm-M-x-key
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "orange" :underline t))
"Face used in helm-M-x to show keybinding."
:group 'helm-command-faces)
@@ -56,7 +58,8 @@
(defvar helm-M-x-input-history nil)
(defvar helm-M-x-prefix-argument nil
"Prefix argument before calling `helm-M-x'.")
-
+(defvar helm-M-x--timer nil)
+(defvar helm-M-x--unwind-forms-done nil)
(defun helm-M-x-get-major-mode-command-alist (mode-map)
"Return alist of MODE-MAP."
@@ -68,8 +71,8 @@
(defun helm-get-mode-map-from-mode (mode)
"Guess the mode-map name according to MODE.
-Some modes don't use conventional mode-map name
-so we need to guess mode-map name. e.g python-mode ==> py-mode-map.
+Some modes don't use conventional mode-map name so we need to
+guess mode-map name. E.g. `python-mode' ==> py-mode-map.
Return nil if no mode-map found."
(cl-loop ;; Start with a conventional mode-map name.
with mode-map = (intern-soft (format "%s-map" mode))
@@ -92,10 +95,12 @@ Return nil if no mode-map found."
(defun helm-M-x-transformer-1 (candidates &optional sort)
"Transformer function to show bindings in emacs commands.
-Show global bindings and local bindings according to current `major-mode'.
+Show global bindings and local bindings according to current
+`major-mode'.
If SORT is non nil sort list with `helm-generic-sort-fn'.
Note that SORT should not be used when fuzzy matching because
-fuzzy matching is running its own sort function with a different algorithm."
+fuzzy matching is running its own sort function with a different
+algorithm."
(with-helm-current-buffer
(cl-loop with local-map = (helm-M-x-current-mode-map-alist)
for cand in candidates
@@ -196,18 +201,18 @@ fuzzy matching is running its own sort function with a different algorithm."
(defun helm-M-x-read-extended-command (collection &optional predicate history)
"Read or execute action on command name in COLLECTION or HISTORY.
-When `helm-M-x-use-completion-styles' is used, several actions as of
-`helm-type-command' are used and executed from here, otherwise this
-function returns the command as a symbol.
+When `helm-M-x-use-completion-styles' is used, several actions as
+of `helm-type-command' are used and executed from here, otherwise
+this function returns the command as a symbol.
-Helm completion is not provided when executing or defining kbd macros.
+Helm completion is not provided when executing or defining kbd
+macros.
-Arg COLLECTION should be an `obarray' but can be any object suitable
-for `try-completion'. Arg PREDICATE is a function that default to
-`commandp' see also `try-completion'.
-Arg HISTORY default to `extended-command-history'."
+Arg COLLECTION should be an `obarray' but can be any object
+suitable for `try-completion'. Arg PREDICATE is a function that
+default to `commandp' see also `try-completion'. Arg HISTORY
+default to `extended-command-history'."
(let* ((helm--mode-line-display-prefarg t)
- (tm (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg))
(minibuffer-completion-confirm t)
(pred (or predicate #'commandp))
(metadata (unless (assq 'flex completion-styles-alist)
@@ -235,6 +240,7 @@ Arg HISTORY default to `extended-command-history'."
((integerp helm-M-x-prefix-argument)
(format "%d " helm-M-x-prefix-argument)))
"M-x ")))
+ (setq helm-M-x--timer (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg))
;; Fix Issue #2250, add `helm-move-selection-after-hook' which
;; reset prefix arg to nil only for this helm session.
(add-hook 'helm-move-selection-after-hook
@@ -250,18 +256,36 @@ Arg HISTORY default to `extended-command-history'."
:prompt prompt
:buffer "*helm M-x*"
:history 'helm-M-x-input-history))
- (cancel-timer tm)
- (setq helm--mode-line-display-prefarg nil)
- ;; Be sure to remove it here as well in case of quit.
- (remove-hook 'helm-move-selection-after-hook
- 'helm-M-x--move-selection-after-hook)
- (remove-hook 'helm-before-action-hook
- 'helm-M-x--before-action-hook))))
+ (helm-M-x--unwind-forms))))
+
+;; When running a command involving again helm from helm-M-x, the
+;; unwind-protect UNWINDS forms are executed only once this helm
+;; command exit leaving the helm-M-x timer running and other variables
+;; and hooks not unset, so the timer is now in a global var and all
+;; the forms that should normally run in unwind-protect are running as
+;; well as soon as helm-M-x-execute-command is called.
+(defun helm-M-x--unwind-forms (&optional done)
+ ;; helm-M-x--unwind-forms-done is non nil when it have been called
+ ;; once from helm-M-x-execute-command.
+ (unless helm-M-x--unwind-forms-done
+ (when (timerp helm-M-x--timer)
+ (cancel-timer helm-M-x--timer)
+ (setq helm-M-x--timer nil))
+ (setq helm--mode-line-display-prefarg nil)
+ ;; Be sure to remove it here as well in case of quit.
+ (remove-hook 'helm-move-selection-after-hook
+ 'helm-M-x--move-selection-after-hook)
+ (remove-hook 'helm-before-action-hook
+ 'helm-M-x--before-action-hook))
+ ;; Reset helm-M-x--unwind-forms-done to nil when DONE is
+ ;; unspecified.
+ (setq helm-M-x--unwind-forms-done done))
(defun helm-M-x-execute-command (command)
"Execute COMMAND as an editor command.
COMMAND must be a symbol that satisfies the `commandp' predicate.
Save COMMAND to `extended-command-history'."
+ (helm-M-x--unwind-forms t)
(when command
;; Avoid having `this-command' set to *exit-minibuffer.
(setq this-command command
@@ -271,18 +295,14 @@ Save COMMAND to `extended-command-history'."
;; use the value of arg otherwise use helm-current-prefix-arg.
(let ((prefix-arg (or helm-current-prefix-arg helm-M-x-prefix-argument))
(command-name (symbol-name command)))
- (cl-flet ((save-hist
- (name)
- (setq extended-command-history
- (cons name (delete name extended-command-history)))))
- (condition-case-unless-debug err
- (progn
- (command-execute command 'record)
- (save-hist command-name))
- (error
- (when helm-M-x-always-save-history
- (save-hist command-name))
- (signal (car err) (cdr err))))))))
+ (condition-case-unless-debug err
+ (progn
+ (command-execute command 'record)
+ (add-to-history 'extended-command-history command-name))
+ (error
+ (when helm-M-x-always-save-history
+ (add-to-history 'extended-command-history command-name))
+ (signal (car err) (cdr err)))))))
(defun helm-M-x--vanilla-M-x ()
(helm-M-x-execute-command
@@ -298,12 +318,14 @@ Save COMMAND to `extended-command-history'."
;;;###autoload
(defun helm-M-x (_arg)
"Preconfigured `helm' for Emacs commands.
-It is `helm' replacement of regular `M-x' `execute-extended-command'.
-
-Unlike regular `M-x' emacs vanilla `execute-extended-command' command,
-the prefix args if needed, can be passed AFTER starting `helm-M-x'.
-When a prefix arg is passed BEFORE starting `helm-M-x', the first `C-u'
-while in `helm-M-x' session will disable it.
+It is `helm' replacement of regular `M-x'
+`execute-extended-command'.
+
+Unlike regular `M-x' Emacs vanilla `execute-extended-command'
+command, the prefix args if needed, can be passed AFTER starting
+`helm-M-x'. When a prefix arg is passed BEFORE starting
+`helm-M-x', the first `C-u' while in `helm-M-x' session will
+disable it.
You can get help on each command by persistent action."
(interactive
diff --git a/helm-config.el b/helm-config.el
index e5b465ff..59d82128 100644
--- a/helm-config.el
+++ b/helm-config.el
@@ -131,7 +131,7 @@
;;;###autoload
(defun helm-configuration ()
- "Customize `helm'."
+ "Customize Helm."
(interactive)
(customize-group "helm"))
diff --git a/helm-core-pkg.el b/helm-core-pkg.el
index 0d2925d8..83b1772f 100644
--- a/helm-core-pkg.el
+++ b/helm-core-pkg.el
@@ -1,8 +1,8 @@
;;; helm-core-pkg.el --- define helm-core for package.el
-(define-package "helm-core" "3.6.0"
+(define-package "helm-core" "3.6.2"
"Development files for Helm"
- '((emacs "24.4")
+ '((emacs "25.1")
(async "1.9.4"))
:url "https://emacs-helm.github.io/helm/")
diff --git a/helm-dabbrev.el b/helm-dabbrev.el
index 67a5722c..07096333 100644
--- a/helm-dabbrev.el
+++ b/helm-dabbrev.el
@@ -28,8 +28,8 @@
(defcustom helm-dabbrev-always-search-all t
"Always search in all buffers when non--nil.
-Note that even if nil, a search in all buffers
-will occur if the length of candidates is <= than
+Note that even if nil, a search in all buffers will occur if the
+length of candidates is <= than
`helm-dabbrev-max-length-result'."
:group 'helm-dabbrev
:type 'boolean)
@@ -37,27 +37,31 @@ will occur if the length of candidates is <= than
(defcustom helm-dabbrev-candidates-number-limit 1000
"Maximum number of candidates to collect.
-Higher this number is, slower the computation of candidates will be.
-You can use safely a higher value with emacs-26+.
-Note that this have nothing to do with `helm-candidate-number-limit',
-this mean that computation of candidates stop when this value is
-reached but only `helm-candidate-number-limit' candidates are
-displayed in helm buffer."
+The higher this number is, the slower the computation of
+candidates will be. You can use safely a higher value with
+emacs-26+.
+Note that this have nothing to do with
+`helm-candidate-number-limit', this means that computation of
+candidates stop when this value is reached but only
+`helm-candidate-number-limit' candidates are displayed in the
+Helm buffer."
:group 'helm-dabbrev
:type 'integer)
(defcustom helm-dabbrev-ignored-buffers-regexps
'("\\*helm" "\\*Messages" "\\*Echo Area" "\\*Buffer List")
- "List of regexps matching names of buffers that helm-dabbrev should not check."
+ "List of regexps matching names of buffers that `helm-dabbrev' should not check."
:group 'helm-dabbrev
:type '(repeat regexp))
(defcustom helm-dabbrev-related-buffer-fn #'helm-dabbrev--same-major-mode-p
- "A function that decide if a buffer to search in is related to `current-buffer'.
-This is actually determined by comparing `major-mode' of the buffer to search
-and the `current-buffer'.
+ "A function that decide if a buffer to search in its related to `current-buffer'.
+
+This is actually determined by comparing `major-mode' of the
+buffer to search and the `current-buffer'.
+
The function take one arg, the buffer which is current, look at
-`helm-dabbrev--same-major-mode-p' for example.
+`helm-dabbrev--same-major-mode-p' for an example.
When nil all buffers are considered related to `current-buffer'."
:group 'helm-dabbrev
@@ -65,16 +69,21 @@ When nil all buffers are considered related to `current-buffer'."
(defcustom helm-dabbrev-major-mode-assoc nil
"Major mode association alist.
-This allow helm-dabbrev searching in buffers with the associated `major-mode'.
-e.g \(emacs-lisp-mode . lisp-interaction-mode\)
-will allow searching in the lisp-interaction-mode buffer when `current-buffer'
-is an `emacs-lisp-mode' buffer and vice versa i.e
-no need to provide \(lisp-interaction-mode . emacs-lisp-mode\) association.
-
-When nil check is the searched buffer have same `major-mode'
-than the `current-buffer'.
-This have no effect when `helm-dabbrev-related-buffer-fn' is nil or of course
-bound to a function that doesn't handle this var."
+
+This allow helm-dabbrev searching in buffers with the associated
+`major-mode'.
+E.g. \(emacs-lisp-mode . lisp-interaction-mode\)
+
+will allow searching in the lisp-interaction-mode buffer when
+`current-buffer' is an `emacs-lisp-mode' buffer and vice versa
+i.e. no need to provide \(lisp-interaction-mode .
+emacs-lisp-mode\) association.
+
+When nil check is the searched buffer has same `major-mode' than
+the `current-buffer'.
+
+This has no effect when `helm-dabbrev-related-buffer-fn' is nil
+or of course bound to a function that doesn't handle this var."
:type '(alist :key-type symbol :value-type symbol)
:group 'helm-dabbrev)
@@ -92,8 +101,8 @@ When nil or 0 disable cycling."
(defcustom helm-dabbrev-case-fold-search 'smart
"Set `case-fold-search' in `helm-dabbrev'.
Same as `helm-case-fold-search' but for `helm-dabbrev'.
-Note that this is not affecting searching in helm buffer,
-but the initial search for all candidates in buffer(s)."
+Note that this is not affecting searching in Helm buffer, but the
+initial search for all candidates in buffer(s)."
:group 'helm-dabbrev
:type '(choice (const :tag "Ignore case" t)
(const :tag "Respect case" nil)
@@ -229,12 +238,13 @@ Argument DIRECTION can be:
(defun helm-dabbrev--search (pattern beg sep-regexp)
"Search word or symbol at point matching PATTERN.
-Argument BEG is corresponding to the previous match-beginning search.
+Argument BEG is corresponding to the previous `match-beginning'
+search.
The search starts at (1- BEG) with a regexp starting with
`helm-dabbrev-separator-regexp' followed by PATTERN followed by a
regexp matching syntactically any word or symbol.
-The possible false positives matching SEP-REGEXP at end are finally
-removed."
+The possible false positives matching SEP-REGEXP at end are
+finally removed."
(let ((eol (point-at-eol)))
(save-excursion
(goto-char (1- beg))
diff --git a/helm-elisp-package.el b/helm-elisp-package.el
index bfb9bf83..01a851f0 100644
--- a/helm-elisp-package.el
+++ b/helm-elisp-package.el
@@ -35,7 +35,7 @@
(const :tag "Show upgradable packages" upgrade)))
(defcustom helm-el-truncate-lines t
- "Truncate lines in helm-buffer when non--nil."
+ "Truncate lines in `helm-buffer' when non-nil."
:group 'helm-el-package
:type 'boolean)
@@ -461,7 +461,7 @@ See `package-autoremove'."
;;;###autoload
(defun helm-list-elisp-packages (arg)
- "Preconfigured helm for listing and handling emacs packages."
+ "Preconfigured `helm' for listing and handling Emacs packages."
(interactive "P")
(when arg (setq helm-el-package--initialized-p nil))
(unless helm-source-list-el-package
@@ -474,10 +474,11 @@ See `package-autoremove'."
;;;###autoload
(defun helm-list-elisp-packages-no-fetch (arg)
- "Preconfigured helm for emacs packages.
+ "Preconfigured Helm for Emacs packages.
-Same as `helm-list-elisp-packages' but don't fetch packages on remote.
-Called with a prefix ARG always fetch packages on remote."
+Same as `helm-list-elisp-packages' but don't fetch packages on
+remote. Called with a prefix ARG always fetch packages on
+remote."
(interactive "P")
(let ((helm-el-package--initialized-p (null arg)))
(helm-list-elisp-packages nil)))
diff --git a/helm-elisp.el b/helm-elisp.el
index 77b9011e..caa6358c 100644
--- a/helm-elisp.el
+++ b/helm-elisp.el
@@ -53,14 +53,14 @@ This is used in macro `with-helm-show-completion'."
callf callf2 cl-callf cl-callf2 fset
fboundp fmakunbound symbol-function)
"List of function where quoted function completion happen.
-e.g give only function names after \(funcall '."
+E.g. give only function names after \(funcall '."
:group 'helm-elisp
:type '(repeat (choice symbol)))
(defcustom helm-lisp-unquoted-function-list
'(function defadvice)
"List of function where unquoted function completion happen.
-e.g give only function names after \(function ."
+E.g. give only function names after \(function ."
:group 'helm-elisp
:type '(repeat (choice symbol)))
@@ -71,9 +71,9 @@ e.g give only function names after \(function ."
(defcustom helm-lisp-fuzzy-completion nil
"Enable fuzzy matching in emacs-lisp completion when non-nil.
-NOTE: This enable fuzzy matching in helm native implementation of
-elisp completion, but not on helmized elisp completion, i.e
-fuzzy completion is not available in `completion-at-point'."
+NOTE: This enables fuzzy matching in Helm native implementation of
+elisp completion, but not on helmized elisp completion, i.e. fuzzy
+completion is not available in `completion-at-point'."
:group 'helm-elisp
:type 'boolean)
@@ -119,12 +119,14 @@ display."
:group 'helm-faces)
(defface helm-lisp-show-completion
- '((t (:background "DarkSlateGray")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "DarkSlateGray"))
"Face used for showing candidates in `helm-lisp-completion'."
:group 'helm-elisp-faces)
(defface helm-lisp-completion-info
- '((t (:foreground "red")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "red"))
"Face used for showing info in `helm-lisp-completion'."
:group 'helm-elisp-faces)
@@ -162,7 +164,7 @@ display."
'face 'helm-lisp-show-completion))
(defun helm-show-completion-default-display-function (buffer &rest _args)
- "A special resized helm window is used depending on position in BUFFER."
+ "A special resized Helm window is used depending on position in BUFFER."
(with-selected-window (selected-window)
(if (window-dedicated-p)
(helm-default-display-buffer buffer)
@@ -181,10 +183,10 @@ display."
buffer)))))
(defmacro with-helm-show-completion (beg end &rest body)
- "Show helm candidate in an overlay at point.
-BEG and END are the beginning and end position of the current completion
-in `helm-current-buffer'.
-BODY is an helm call where we want to enable show completion.
+ "Show Helm candidate in an overlay at point.
+BEG and END are the beginning and end position of the current
+completion in `helm-current-buffer'.
+BODY is an Helm call where we want to enable show completion.
If `helm-turn-on-show-completion' is nil do nothing."
(declare (indent 2) (debug t))
`(unwind-protect
@@ -291,7 +293,7 @@ Return a cons \(beg . end\)."
(defvar helm-lgst-len nil)
;;;###autoload
(defun helm-lisp-completion-at-point ()
- "Preconfigured helm for lisp symbol completion at point."
+ "Preconfigured Helm for Lisp symbol completion at point."
(interactive)
(setq helm-lgst-len 0)
(let* ((target (helm-thing-before-point))
@@ -343,8 +345,9 @@ Return a cons \(beg . end\)."
(defun helm-lisp-completion-persistent-action (candidate &optional name)
"Show documentation for the function.
-Documentation is shown briefly in mode-line or completely
-in other window according to the value of `helm-elisp-help-function'."
+Documentation is shown briefly in mode-line or completely in
+other window according to the value of
+`helm-elisp-help-function'."
(funcall helm-elisp-help-function candidate name))
(defun helm-lisp-completion-persistent-help ()
@@ -368,15 +371,15 @@ in other window according to the value of `helm-elisp-help-function'."
(defun helm-elisp-show-help (candidate &optional name)
"Show full help for the function CANDIDATE.
-Arg NAME specify the name of the top level function
-calling helm generic completion (e.g \"describe-function\")
-which allow calling the right function when CANDIDATE symbol
-refers at the same time to variable and a function."
+Arg NAME specifies the name of the top level function calling
+Helm generic completion (e.g., \"describe-function\") which
+allows calling the right function when CANDIDATE symbol refers at
+the same time to variable and a function."
(helm-elisp--persistent-help
candidate 'helm-elisp--show-help-1 name))
(defun helm-elisp-show-doc-modeline (candidate &optional name)
- "Show brief documentation for the function in modeline."
+ "Show brief documentation for the function in the mode-line."
(let ((cursor-in-echo-area t)
mode-line-in-non-selected-windows)
(helm-show-info-in-mode-line
@@ -386,7 +389,7 @@ refers at the same time to variable and a function."
'face 'helm-lisp-completion-info))))
(defun helm-lisp-completion-transformer (candidates _source)
- "Helm candidates transformer for lisp completion."
+ "Helm candidates transformer for Lisp completion."
(cl-loop for c in candidates
for sym = (intern c)
for annot = (cl-typecase sym
@@ -426,7 +429,7 @@ If SYM is not documented, return \"Not documented\"."
;;;###autoload
(defun helm-complete-file-name-at-point (&optional force)
- "Preconfigured helm to complete file name at point."
+ "Preconfigured Helm to complete file name at point."
(interactive)
(require 'helm-mode)
(let* ((tap (thing-at-point 'filename))
@@ -464,8 +467,9 @@ If SYM is not documented, return \"Not documented\"."
;;;###autoload
(defun helm-lisp-completion-or-file-name-at-point ()
- "Preconfigured helm to complete lisp symbol or filename at point.
-Filename completion happen if string start after or between a double quote."
+ "Preconfigured Helm to complete Lisp symbol or filename at point.
+Filename completion happens if string start after or between a
+double quote."
(interactive)
(let* ((tap (thing-at-point 'filename)))
(if (and tap (save-excursion
@@ -728,9 +732,9 @@ Filename completion happen if string start after or between a double quote."
;;;###autoload
(defun helm-apropos (default)
- "Preconfigured helm to describe commands, functions, variables and faces.
-In non interactives calls DEFAULT argument should be provided as a string,
-i.e the `symbol-name' of any existing symbol."
+ "Preconfigured Helm to describe commands, functions, variables and faces.
+In non interactives calls DEFAULT argument should be provided as
+a string, i.e. the `symbol-name' of any existing symbol."
(interactive (list (thing-at-point 'symbol)))
(helm :sources
(mapcar (lambda (func)
@@ -744,6 +748,14 @@ i.e the `symbol-name' of any existing symbol."
;;; Advices
;;
;;
+(defvar ad-advised-functions)
+(defvar ad-advice-classes)
+(declare-function ad-make-single-advice-docstring "advice")
+(declare-function ad-get-advice-info-field "advice")
+(declare-function ad-advice-set-enabled "advice")
+(declare-function ad-advice-set-enabled "advice")
+(declare-function ad-advice-enabled "advice")
+
(defvar helm-source-advice
(helm-build-sync-source "Function Advice"
:init (lambda () (require 'advice))
@@ -951,7 +963,7 @@ i.e the `symbol-name' of any existing symbol."
;;;###autoload
(defun helm-complex-command-history ()
- "Preconfigured helm for complex command history."
+ "Preconfigured `helm' for complex command history."
(interactive)
(helm :sources 'helm-source-complex-command-history
:buffer "*helm complex commands*"))
diff --git a/helm-eshell.el b/helm-eshell.el
index 837c70ed..adbd8b4c 100644
--- a/helm-eshell.el
+++ b/helm-eshell.el
@@ -44,12 +44,12 @@
(defgroup helm-eshell nil
- "Helm eshell completion and history."
+ "Helm completion and history for Eshell."
:group 'helm)
(defcustom helm-eshell-fuzzy-match nil
- "Enable fuzzy matching in `helm-esh-pcomplete' when non--nil."
+ "Enable fuzzy matching in `helm-esh-pcomplete' when non-nil."
:group 'helm-eshell
:type 'boolean)
@@ -75,7 +75,8 @@
(defvar helm-ec-target "")
(defun helm-ec-insert (_candidate)
"Replace text at point with CANDIDATE.
-The function that call this should set `helm-ec-target' to thing at point."
+The function that call this should set `helm-ec-target' to thing
+at point."
(set (make-local-variable 'comint-file-name-quote-list)
eshell-special-chars-outside-quoting)
(let ((pt (point)))
@@ -133,7 +134,7 @@ The function that call this should set `helm-ec-target' to thing at point."
"Helm class to define source for Eshell completion.")
(defun helm-esh-get-candidates ()
- "Get candidates for eshell completion using `pcomplete'."
+ "Get candidates for Eshell completion using `pcomplete'."
(catch 'pcompleted
(with-helm-current-buffer
(let* ((pcomplete-stub)
@@ -251,7 +252,7 @@ The function that call this should set `helm-ec-target' to thing at point."
;;;###autoload
(defun helm-esh-pcomplete ()
- "Preconfigured helm to provide helm completion in eshell."
+ "Preconfigured `helm' to provide Helm completion in Eshell."
(interactive)
(let* ((helm-quit-if-no-candidate t)
(helm-execute-action-at-once-if-one t)
@@ -332,7 +333,7 @@ The function that call this should set `helm-ec-target' to thing at point."
;;;###autoload
(defun helm-eshell-history ()
- "Preconfigured helm for eshell history."
+ "Preconfigured Helm for Eshell history."
(interactive)
(let* ((end (point))
(beg (save-excursion (eshell-bol) (point)))
@@ -358,12 +359,14 @@ The function that call this should set `helm-ec-target' to thing at point."
;;; Eshell prompts
;;
(defface helm-eshell-prompts-promptidx
- '((t (:foreground "cyan")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "cyan"))
"Face used to highlight Eshell prompt index."
:group 'helm-eshell-faces)
(defface helm-eshell-prompts-buffer-name
- '((t (:foreground "green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "green"))
"Face used to highlight Eshell buffer name."
:group 'helm-eshell-faces)
@@ -387,7 +390,7 @@ The function that call this should set `helm-ec-target' to thing at point."
"List the prompts in Eshell BUFFER.
Return a list of (\"prompt\" (point) (buffer-name) prompt-index))
-e.g. (\"ls\" 162 \"*eshell*\" 3).
+E.g. (\"ls\" 162 \"*eshell*\" 3).
If BUFFER is nil, use current buffer."
(with-current-buffer (or buffer (current-buffer))
(when (eq major-mode 'eshell-mode)
diff --git a/helm-eval.el b/helm-eval.el
index caa31020..382c663f 100644
--- a/helm-eval.el
+++ b/helm-eval.el
@@ -162,7 +162,7 @@ Should take one arg: the string to display."
;;;###autoload
(defun helm-eval-expression (arg)
- "Preconfigured helm for `helm-source-evaluation-result'."
+ "Preconfigured `helm' for `helm-source-evaluation-result'."
(interactive "P")
(helm :sources (helm-build-evaluation-result-source)
:input (when arg (thing-at-point 'sexp))
@@ -173,7 +173,7 @@ Should take one arg: the string to display."
(defvar eldoc-idle-delay)
;;;###autoload
(defun helm-eval-expression-with-eldoc ()
- "Preconfigured helm for `helm-source-evaluation-result' with `eldoc' support."
+ "Preconfigured `helm' for `helm-source-evaluation-result' with `eldoc' support."
(interactive)
(let ((timer (run-with-idle-timer
eldoc-idle-delay 'repeat
@@ -188,7 +188,7 @@ Should take one arg: the string to display."
;;;###autoload
(defun helm-calcul-expression ()
- "Preconfigured helm for `helm-source-calculation-result'."
+ "Preconfigured `helm' for `helm-source-calculation-result'."
(interactive)
(helm :sources 'helm-source-calculation-result
:buffer "*helm calcul*"))
diff --git a/helm-external.el b/helm-external.el
index e539cde4..71328bb6 100644
--- a/helm-external.el
+++ b/helm-external.el
@@ -37,16 +37,16 @@ This will be use with `format', so use something like \"wmctrl -xa %s\"."
(defcustom helm-external-programs-associations nil
"Alist to store externals programs associated with file extension.
This variable overhide setting in .mailcap file.
-e.g : '\(\(\"jpg\" . \"gqview\"\) (\"pdf\" . \"xpdf\"\)\) "
+E.g.: '\(\(\"jpg\" . \"gqview\"\) (\"pdf\" . \"xpdf\"\)\) "
:type '(alist :key-type string :value-type string)
:group 'helm-external)
(defcustom helm-default-external-file-browser "nautilus"
"Default external file browser for your system.
-Directories will be opened externally with it when
-opening file externally in `helm-find-files'.
-Set to nil if you do not have external file browser
-or do not want to use it.
+Directories will be opened externally with it when opening file
+externally in `helm-find-files'.
+Set to nil if you do not have an external file browser or do not
+want to use it.
Windows users should set that to \"explorer.exe\"."
:group 'helm-external
:type 'string)
@@ -61,9 +61,9 @@ automatically.")
(defun helm-external-commands-list-1 (&optional sort)
"Returns a list of all external commands the user can execute.
-If `helm-external-commands-list' is non-nil it will
-return its contents. Else it calculates all external commands
-and sets `helm-external-commands-list'."
+If `helm-external-commands-list' is non-nil it will return its
+contents. Else it calculates all external commands and sets
+`helm-external-commands-list'."
(helm-aif helm-external-commands-list
it
(setq helm-external-commands-list
@@ -82,8 +82,8 @@ and sets `helm-external-commands-list'."
(defun helm-run-or-raise (exe &optional file)
"Run asynchronously EXE or jump to the application window.
-If EXE is already running just jump to his window if `helm-raise-command'
-is non--nil.
+If EXE is already running just jump to his window if
+`helm-raise-command' is non-nil.
When FILE argument is provided run EXE with FILE."
(let* ((real-com (car (split-string exe)))
(proc (if file (concat real-com " " file) real-com))
@@ -127,8 +127,8 @@ When FILE argument is provided run EXE with FILE."
(defun helm-get-default-program-for-file (filename)
"Try to find a default program to open FILENAME.
-Try first in `helm-external-programs-associations' and then in mailcap file
-if nothing found return nil."
+Try first in `helm-external-programs-associations' and then in
+mailcap file. If nothing found return nil."
(let* ((ext (file-name-extension filename))
(def-prog (assoc-default ext helm-external-programs-associations)))
(cond ((and def-prog (not (string= def-prog ""))) def-prog)
@@ -138,8 +138,10 @@ if nothing found return nil."
(defun helm-open-file-externally (file)
"Open FILE with an external program.
-Try to guess which program to use with `helm-get-default-program-for-file'.
-If not found or a prefix arg is given query the user which tool to use."
+Try to guess which program to use with
+`helm-get-default-program-for-file'.
+If not found or a prefix arg is given query the user which tool
+to use."
(let* ((fname (expand-file-name file))
(collection (helm-external-commands-list-1 'sort))
(def-prog (helm-get-default-program-for-file fname))
diff --git a/helm-files.el b/helm-files.el
index 0bf50e71..a1149309 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -46,36 +46,47 @@
(declare-function eshell-reset "esh-mode.el")
(declare-function eshell/cd "em-dirs.el")
(declare-function eshell-next-prompt "em-prompt.el")
-(declare-function eshell-quote-argument "esh-arg.el")
+(declare-function eshell-resume-eval "esh-cmd")
(declare-function helm-ls-git-ls "ext:helm-ls-git")
(declare-function helm-hg-find-files-in-project "ext:helm-ls-hg")
(declare-function helm-gid "helm-id-utils.el")
(declare-function helm-find-1 "helm-find")
(declare-function helm-get-default-program-for-file "helm-external")
(declare-function helm-open-file-externally "helm-external")
-
+(declare-function term-line-mode "term")
+(declare-function term-char-mode "term")
+(declare-function term-send-input "term")
+(declare-function term-next-prompt "term")
+(declare-function term-process-mark "term")
+
+(defvar term-char-mode-point-at-process-mark)
+(defvar term-char-mode-buffer-read-only)
(defvar recentf-list)
(defvar helm-mm-matching-method)
(defvar dired-async-mode)
(defvar org-directory)
+(defvar eshell-current-command)
+(defvar eshell-debug-command)
+(defvar eshell-current-command)
+
(defgroup helm-files nil
"Files applications and libraries for Helm."
:group 'helm)
(defcustom helm-tramp-verbose 0
- "Just like `tramp-verbose' but specific to helm.
-When set to 0 don't show tramp messages in helm.
+ "Just like `tramp-verbose' but specific to Helm.
+When set to 0 don't show tramp messages in Helm.
If you want to have the default tramp messages set it to 3."
:type 'integer
:group 'helm-files)
(defcustom helm-ff-auto-update-initial-value nil
"Auto update when only one candidate directory is matched.
-Default value when starting `helm-find-files' is nil to not confuse
-new users.
-For a better experience with `helm-find-files' set this to non--nil
-and use C-<backspace> to toggle it."
+Default value when starting `helm-find-files' is nil to not
+confuse new users.
+For a better experience with `helm-find-files' set this to
+non-nil and use C-<backspace> to toggle it."
:group 'helm-files
:type 'boolean)
@@ -108,8 +119,8 @@ This set `ffap-newfile-prompt'."
(defcustom helm-ff-avfs-directory "~/.avfs"
"The default avfs directory, usually '~/.avfs'.
-When this is set you will be able to expand archive filenames with `C-j'
-inside an avfs directory mounted with mountavfs.
+When this is set you will be able to expand archive filenames
+with `C-j' inside an avfs directory mounted with mountavfs.
See <http://sourceforge.net/projects/avf/>."
:type 'string
:group 'helm-files)
@@ -121,10 +132,11 @@ See <http://sourceforge.net/projects/avf/>."
(defcustom helm-ff-printer-list nil
"A list of available printers on your system.
-When non--nil let you choose a printer to print file.
+When non-nil let you choose a printer to print file.
Otherwise when nil the variable `printer-name' will be used.
-On Unix based systems (lpstat command needed) you don't need to set this,
-`helm-ff-find-printers' will find a list of available printers for you."
+On Unix based systems (lpstat command needed) you don't need to
+set this, `helm-ff-find-printers' will find a list of available
+printers for you."
:type '(repeat (choice string))
:group 'helm-files)
@@ -136,9 +148,10 @@ This can be toggled at anytime from `helm-find-files' with \
:group 'helm-files)
(defcustom helm-ff-signal-error-on-dot-files t
- "Signal error when file is `.' or `..' on file deletion when non--nil.
-Default is non--nil.
-WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree."
+ "Signal error when file is `.' or `..' on file deletion when non-nil.
+Default is non-nil.
+WARNING: Setting this to nil is unsafe and can cause deletion of
+a whole tree."
:group 'helm-files
:type 'boolean)
@@ -158,44 +171,45 @@ WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree."
:type 'boolean)
(defcustom helm-ff-skip-boring-files nil
- "Non--nil to skip boring files.
-
+ "Non-nil to skip boring files.
I.e. the files matching regexps in `helm-boring-file-regexp-list'.
-This take effect in `helm-find-files' and file completion used by `helm-mode'
-i.e `helm-read-file-name'.
+This takes effect in `helm-find-files' and file completion used by
+`helm-mode' i.e. `helm-read-file-name'.
Note that when non-nil this will slow down slightly `helm-find-files'."
:group 'helm-files
:type 'boolean)
(defcustom helm-ff-skip-git-ignored-files nil
- "Non--nil to skip git ignored files.
-
+ "Non-nil to skip git ignored files.
This take effect only in `helm-find-files'.
Check is not done on remote files.
-Note that when non-nil this will slow down slightly `helm-find-files'."
+Note that when non-nil this will slow down slightly
+`helm-find-files'."
:group 'helm-files
:type 'boolean)
(defcustom helm-ff-candidate-number-limit 5000
"The `helm-candidate-number-limit' for `helm-find-files' and friends.
-Note that when going one level up with `\\<helm-find-files-map>\\[helm-find-files-up-one-level]'
-The length of directory will be used instead if it is higher than this
-value, this to avoid failing to preselect the previous directory/file if
-this one is situated lower than `helm-ff-candidate-number-limit' num
-candidate."
+Note that when going one level up with
+`\\<helm-find-files-map>\\[helm-find-files-up-one-level]' the
+length of directory will be used instead if it is higher than
+this value. This is to avoid failing to preselect the previous
+directory/file if this one is situated lower than
+`helm-ff-candidate-number-limit' num candidate."
:group 'helm-files
:type 'integer)
(defcustom helm-ff-up-one-level-preselect t
"Always preselect previous directory when going one level up.
-When non nil `candidate-number-limit' source value is modified
+When non-nil `candidate-number-limit' source value is modified
dynamically when going one level up if the position of previous
-candidate in its directory is > to `helm-ff-candidate-number-limit'.
+candidate in its directory is > to
+`helm-ff-candidate-number-limit'.
-This can be helpful to disable this and reduce
-`helm-ff-candidate-number-limit' if you often navigate across very
-large directories."
+It can be helpful to disable this and reduce
+`helm-ff-candidate-number-limit' if you often navigate across
+very large directories."
:group 'helm-files
:type 'boolean)
@@ -230,14 +244,15 @@ This doesn't disable url or mail at point, see
(defcustom helm-ff-guess-ffap-urls t
"Use ffap to guess local urls at point in `helm-find-files'.
-This doesn't disable guessing filenames at point,
-see `helm-ff-guess-ffap-filenames' for this.
-See also `ffap-url-unwrap-remote' that may override this variable."
+This doesn't disable guessing filenames at point, see
+`helm-ff-guess-ffap-filenames' for this.
+See also `ffap-url-unwrap-remote' that may override this
+variable."
:group 'helm-files
:type 'boolean)
(defcustom helm-ff-no-preselect nil
- "When non--nil `helm-find-files' starts at root of current directory."
+ "When non-nil `helm-find-files' starts at root of current directory."
:group 'helm-files
:type 'boolean)
@@ -248,9 +263,9 @@ See also `ffap-url-unwrap-remote' that may override this variable."
(defcustom helm-find-files-ignore-thing-at-point nil
"Use only `default-directory' as default input in `helm-find-files'.
-I.e text under cursor in `current-buffer' is ignored.
-Note that when non-nil you will be unable to complete filename at point
-in `current-buffer'."
+I.e. text under cursor in `current-buffer' is ignored.
+Note that when non-nil you will be unable to complete filename at
+point in `current-buffer'."
:group 'helm-files
:type 'boolean)
@@ -267,8 +282,8 @@ in `current-buffer'."
(defcustom helm-mounted-network-directories nil
"A list of directories used for mounting remotes filesystem.
-When nil `helm-file-on-mounted-network-p' always return nil otherwise
-it checks if a file is in one of these directories.
+When nil `helm-file-on-mounted-network-p' always return nil
+otherwise check if a file is in one of these directories.
Remote filesystem are generally mounted with sshfs."
:group 'helm-files
@@ -290,21 +305,22 @@ A function that takes a directory name as only arg."
#'helm-ff-kill-or-find-buffer-fname
"Default function used to expand non-directory filenames in `helm-find-files'.
-This variable will take effect only in `helm-find-files', it affects
-the behavior of persistent-action on filenames and non-existing
-filenames.
+This variable will take effect only in `helm-find-files'. It
+affects the behavior of persistent-action on filenames and
+non-existing filenames.
The default is to expand filename on first hit on
-\\<helm-map>\\[helm-execute-persistent-action], pop buffer in other
-window on second hit and finally kill this buffer on third hit, this
-is very handy to create several new buffers, or when navigating, show
-quickly the buffer of file to see its contents briefly before killing
-it and continue navigating.
+\\<helm-map>\\[helm-execute-persistent-action], pop buffer in
+other window on second hit and finally kill this buffer on third
+hit. This is very handy to create several new buffers, or when
+navigating, show quickly the buffer of file to see its contents
+briefly before killing it and continue navigating.
-However some users may not want this, so to disable this behavior just
-set this to `ignore' function.
+However some users may not want this, so to disable this behaviour
+just set this to `ignore' function.
-Of course you can also write your own function to do something else."
+Of course you can also write your own function to do something
+else."
:group 'helm-files
:type 'function)
@@ -315,11 +331,11 @@ Of course you can also write your own function to do something else."
:type '(repeat symbol))
(defcustom helm-ff-allow-recursive-deletes nil
- "when 'always don't prompt for recursive deletion of directories.
+ "When 'always don't prompt for recursive deletion of directories.
When nil, will ask for recursive deletion.
-Note that when deleting multiple directories you can answer ! when
-prompted to avoid beeing asked for next directories, so it is probably
-better to not modify this variable."
+Note that when deleting multiple directories you can answer !
+when prompted to avoid being asked for next directories, so it
+is probably better to not modify this variable."
:group 'helm-files
:type '(choice
(const :tag "Delete non-empty directories" t)
@@ -328,15 +344,16 @@ better to not modify this variable."
(defcustom helm-ff-delete-files-function #'helm-delete-marked-files
"The function to use by default to delete files.
-Default is to delete files synchronously, other choice is to delete
-files asynchronously.
+Default is to delete files synchronously, other choice is to
+delete files asynchronously.
BE AWARE that when deleting async you will not be warned about
-recursive deletion of directories, IOW non empty directories will be
-deleted with no warnings in background!!!
+recursive deletion of directories, IOW non-empty directories will
+be deleted with no warnings in background!!!
-It is the function that will be used when using `\\<helm-find-files-map>\\[helm-ff-run-delete-file]'
-from `helm-find-files'."
+It is the function that will be used when using
+`\\<helm-find-files-map>\\[helm-ff-run-delete-file]' from
+`helm-find-files'."
:group 'helm-files
:type '(choice (function :tag "Delete files synchronously."
helm-delete-marked-files)
@@ -346,17 +363,18 @@ from `helm-find-files'."
(defcustom helm-trash-remote-files nil
"Allow trashing remote files when non-nil.
-Trashing remote files with tramp doesn't work out of the box unless
-'trash-cli' package is installed, it is why trashing remote files from
-helm is disabled by default.
+Trashing remote files with tramp doesn't work out of the box
+unless the 'trash-cli' package is installed. This is why trashing
+remote files from Helm is disabled by default.
Tramp is using external 'trash' command in its `delete-file' and
-`delete-directory' handlers when using `delete-by-moving-to-trash',
-which is documented nowhere in Emacs.
+`delete-directory' handlers when using
+`delete-by-moving-to-trash', which is documented nowhere in
+Emacs.
-If you want to enable this you will have to install the 'trash' command
-on remote (and/or locally if you want to trash as root), on Ubuntu
-based distribution it is 'trash-cli'."
+If you want to enable this you will have to install the 'trash'
+command on remote (and/or locally if you want to trash as root).
+On Ubuntu-based distributions it is 'trash-cli'."
:group 'helm-files
:type 'boolean)
@@ -368,29 +386,29 @@ based distribution it is 'trash-cli'."
(t #'helm-list-dir-lisp))
"The function used in `helm-find-files' to list remote directories.
-Actually helm provides two functions to do this: `helm-list-dir-lisp'
-and `helm-list-dir-external'.
-
-Using `helm-list-dir-external' will provides a similar display to what
-provided with local files i.e. colorized symlinks, executables files
-etc... whereas using `helm-list-dir-lisp' will allow colorizing only
-directories but is more portable.
-
-NOTE: `helm-list-dir-external' needs ls and awk as dependencies.
-Also the ls version installed on the remote side should support the
-same arguments as the GNU/ls version that are -A -1 -F -b and -Q.
-So even if you are using a GNU/ls version locally and you want to
-connect e.g. on a Freebsd server you may have failures due to the
-incompatible ls version installed on remote server.
-In such case use `helm-list-dir-lisp' which work everywhere but is
+Actually Helm provides two functions to do this:
+`helm-list-dir-lisp' and `helm-list-dir-external'.
+
+Using `helm-list-dir-external' will provide a similar display to
+what is provided with local files i.e. colorized symlinks,
+executables files etc., whereas using `helm-list-dir-lisp' will
+allow colorizing only directories but it is more portable.
+
+NOTE: `helm-list-dir-external' needs ls and awk as dependencies.
+Also the ls version installed on the remote side should support
+the same arguments as the GNU/ls version, which are -A -1 -F -b
+and -Q. So even if you are using a GNU/ls version locally and you
+want to connect e.g. on a Freebsd server, you may have failures
+due to the incompatible ls version installed on remote server. In
+such case use `helm-list-dir-lisp' which works everywhere but is
slower and less featured (only directories colorized)."
:type 'function
:group 'helm-files)
(defcustom helm-ff-initial-sort-method nil
"Sort method to use when initially listing a directory.
-Note that this doesn't affect the listing when matching inside the
-directory (i.e. filenames)."
+Note that this doesn't affect the listing when matching inside
+the directory (i.e. filenames)."
:group 'helm-files
:type '(choice
(const :tag "alphabetically" nil)
@@ -407,11 +425,41 @@ directory (i.e. filenames)."
(defcustom helm-ff-rotate-image-switch '("-i")
"Options used with `helm-ff-rotate-image-program'.
-If you are using Mogrify or Jpegtran mandatory option is \"-rotate\",
-with Exiftran mandatory option is \"-i\"."
+If you are using Mogrify or Jpegtran mandatory option is
+\"-rotate\", with Exiftran mandatory option is \"-i\"."
:group 'helm-files
:type '(repeat string))
+(defcustom helm-ff-preferred-shell-mode 'eshell-mode
+ "Shell to use to switch to a shell buffer from `helm-find-files'.
+Possible values are `shell-mode', `eshell-mode' and `term-mode'.
+This affects `\\<helm-find-files-map>\\[helm-ff-run-switch-to-shell]' keybinding."
+ :group 'helm-files
+ :type '(choice
+ (const :tag "Use Eshell" eshell-mode)
+ (const :tag "Use Shell" shell-mode)
+ (const :tag "Use Shell" term-mode)))
+
+(defcustom helm-rsync-no-mode-line-update nil
+ "When non nil don't update mode-line when rsync is running.
+This is useful if you display the progress bar somewhere else,
+e.g. with minibuffer-line in minibuffer, in this case updating
+mode-line may create flickering in other frame's mode-line."
+ :type 'boolean
+ :group 'helm-files)
+
+(defcustom helm-rsync-switches '("-a" "-z" "-h" "-s" "--info=all2")
+ "Rsync options to use with HFF Rsync action.
+Note: Using \"--info=all2\" allows having the name of the file
+currently transfered in an help-echo in mode-line, if you use
+\"--info=progress2\" you will not have this information."
+ :type '(repeat string)
+ :group 'helm-files)
+
+(defcustom helm-rsync-percent-sign "ï¼…"
+ "Percentage unicode sign to use in Rsync reporter."
+ :type 'string
+ :group 'helm-files)
;;; Faces
;;
@@ -423,89 +471,124 @@ with Exiftran mandatory option is \"-i\"."
:group 'helm-faces)
(defface helm-ff-prefix
- '((t (:background "yellow" :foreground "black")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "yellow" :foreground "black"))
"Face used to prefix new file or url paths in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-executable
- '((t (:foreground "green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "green"))
"Face used for executable files in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-suid
- '((t (:background "red" :foreground "white")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "red" :foreground "white"))
"Face used for suid files in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-directory
- '((t (:foreground "DarkRed" :background "LightGray")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "DarkRed" :background "LightGray"))
"Face used for directories in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-dotted-directory
- '((t (:foreground "black" :background "DimGray")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "black" :background "DimGray"))
"Face used for dotted directories in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-dotted-symlink-directory
- '((t (:foreground "DarkOrange" :background "DimGray")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "DarkOrange" :background "DimGray"))
"Face used for dotted symlinked directories in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-symlink
- '((t :inherit font-lock-comment-face))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-comment-face))
"Face used for symlinks in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-invalid-symlink
- '((t (:foreground "black" :background "red")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "black" :background "red"))
"Face used for invalid symlinks in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-denied
- '((t (:foreground "red" :background "black")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "red" :background "black"))
"Face used for non accessible files in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-file
- '((t (:inherit font-lock-builtin-face)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-builtin-face))
"Face used for file names in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-truename
- '((t (:inherit font-lock-string-face)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-string-face))
"Face used for symlink truenames in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-dirs
- '((t (:inherit font-lock-function-name-face)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-function-name-face))
"Face used for file names in recursive dirs completion in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-socket
- '((t (:foreground "DeepPink")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "DeepPink"))
"Face used for socket files in `helm-find-files'."
:group 'helm-files-faces)
(defface helm-ff-pipe
- '((t (:foreground "yellow" :background "black")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "yellow" :background "black"))
"Face used for named pipes and character device files in `helm-find-files'."
:group 'helm-files-faces)
+(defface helm-ff-file-extension
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "magenta"))
+ "Face used for file extensions in `helm-find-files'."
+ :group 'helm-files-faces)
+
+(defface helm-ff-backup-file
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "DimGray"))
+ "Face used for backup files in `helm-find-files'."
+ :group 'helm-files-faces)
+
(defface helm-history-deleted
- '((t (:inherit helm-ff-invalid-symlink)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit helm-ff-invalid-symlink))
"Face used for deleted files in `file-name-history'."
:group 'helm-files-faces)
(defface helm-history-remote
- '((t (:foreground "Indianred1")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Indianred1"))
"Face used for remote files in `file-name-history'."
:group 'helm-files-faces)
(defface helm-delete-async-message
- '((t (:foreground "yellow")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "yellow"))
"Face used for mode-line message."
:group 'helm-files-faces)
+
+(defface helm-ff-rsync-progress
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-warning-face))
+ "Face used for rsync mode-line indicator."
+ :group 'helm-files-faces)
;;; Helm-find-files - The helm file browser.
;;
@@ -531,6 +614,8 @@ with Exiftran mandatory option is \"-i\"."
(define-key map (kbd "M-.") 'helm-ff-run-etags)
(define-key map (kbd "M-R") 'helm-ff-run-rename-file)
(define-key map (kbd "M-C") 'helm-ff-run-copy-file)
+ (when (executable-find "rsync")
+ (define-key map (kbd "M-V") 'helm-ff-run-rsync-file))
(define-key map (kbd "M-B") 'helm-ff-run-byte-compile-file)
(define-key map (kbd "M-L") 'helm-ff-run-load-file)
(define-key map (kbd "M-S") 'helm-ff-run-symlink-file)
@@ -540,7 +625,7 @@ with Exiftran mandatory option is \"-i\"."
(define-key map (kbd "M-K") 'helm-ff-run-kill-buffer-persistent)
(define-key map (kbd "M-T") 'helm-ff-run-touch-files)
(define-key map (kbd "C-c d") 'helm-ff-persistent-delete)
- (define-key map (kbd "M-e") 'helm-ff-run-switch-to-eshell)
+ (define-key map (kbd "M-e") 'helm-ff-run-switch-to-shell)
(define-key map (kbd "C-c i") 'helm-ff-run-complete-fn-at-point)
(define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window)
(define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame)
@@ -567,6 +652,7 @@ with Exiftran mandatory option is \"-i\"."
(define-key map (kbd "M-l") 'helm-ff-rotate-left-persistent)
(define-key map (kbd "M-r") 'helm-ff-rotate-right-persistent)
(define-key map (kbd "C-l") 'helm-find-files-up-one-level)
+ (define-key map (kbd "C-_") 'helm-ff-undo)
(define-key map (kbd "C-r") 'helm-find-files-down-last-level)
(define-key map (kbd "C-c r") 'helm-ff-run-find-file-as-root)
(define-key map (kbd "C-x C-v") 'helm-ff-run-find-alternate-file)
@@ -591,10 +677,12 @@ with Exiftran mandatory option is \"-i\"."
(define-key map (kbd "C-]") 'helm-ff-run-toggle-basename)
(define-key map (kbd "C-.") 'helm-find-files-up-one-level)
(define-key map (kbd "C-l") 'helm-find-files-up-one-level)
+ (define-key map (kbd "C-_") 'helm-ff-undo)
(define-key map (kbd "C-r") 'helm-find-files-down-last-level)
(define-key map (kbd "C-c h") 'helm-ff-file-name-history)
(define-key map (kbd "C-<backspace>") 'helm-ff-run-toggle-auto-update)
(define-key map (kbd "C-c <DEL>") 'helm-ff-run-toggle-auto-update)
+ (define-key map (kbd "RET") 'helm-ff-RET)
(helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward
'((C-backspace . helm-ff-run-toggle-auto-update)
([C-c DEL] . helm-ff-run-toggle-auto-update))
@@ -602,10 +690,10 @@ with Exiftran mandatory option is \"-i\"."
map)
"Keymap for `helm-read-file-name'.")
-(defcustom helm-ff-lynx-style-map nil
+(defcustom helm-ff-lynx-style-map t
"Use arrow keys to navigate with `helm-find-files'.
-Note that if you define this variable with `setq' your change will
-have no effect, use customize instead."
+Note that if you define this variable with `setq' your change
+will have no effect, use customize instead."
:group 'helm-files
:type 'boolean
:set (lambda (var val)
@@ -624,8 +712,8 @@ have no effect, use customize instead."
(defcustom helm-ff-DEL-up-one-level-maybe nil
"Use DEL to maybe go up one level when non nil.
-Going up one level works only when pattern is a directory endings with
-\"/\", otherwise this command delete char backward.
+Going up one level works only when pattern is a directory endings
+with \"/\", otherwise this command deletes char backward.
When nil always delete char backward."
:group 'helm-files
@@ -659,6 +747,11 @@ Don't set it directly, use instead `helm-ff-auto-update-initial-value'.")
(defvar helm-ff--tramp-methods nil)
(defvar helm-ff--directory-files-hash (make-hash-table :test 'equal))
(defvar helm-ff-history-buffer-name "*helm-find-files history*")
+(defvar helm-rsync-command-history nil)
+(defvar helm-rsync--last-progress-bar-alist nil
+ "Used to store last valid rsync progress bar.")
+(defvar helm-rsync-process-buffer "*helm-rsync*")
+(defvar helm-rsync-progress-str-alist nil)
;;; Helm-find-files
;;
@@ -688,8 +781,9 @@ Don't set it directly, use instead `helm-ff-auto-update-initial-value'.")
"Grep current directory with AG `M-g a, C-u select type'" 'helm-find-files-ag
"Git grep `M-g g, C-u from root'" 'helm-ff-git-grep
"Zgrep File(s) `M-g z, C-u Recurse'" 'helm-ff-zgrep
+ "Pdf Grep File(s)" 'helm-ff-pdfgrep
"Gid `M-g i'" 'helm-ff-gid
- "Switch to Eshell `M-e'" 'helm-ff-switch-to-eshell
+ "Switch to Eshell `M-e'" 'helm-ff-switch-to-shell
"Etags `M-., C-u reload tag file'" 'helm-ff-etags-select
"Eshell command on file(s) `M-!, C-u take all marked as arguments.'"
'helm-find-files-eshell-command-on-file
@@ -704,6 +798,10 @@ Don't set it directly, use instead `helm-ff-auto-update-initial-value'.")
'helm-ff-delete-files
"Touch File(s) `M-T'" 'helm-ff-touch-files
"Copy file(s) `M-C, C-u to follow'" 'helm-find-files-copy
+ (lambda ()
+ (and (executable-find "rsync")
+ "Rsync file(s) `M-V' (C-u edit command)"))
+ 'helm-find-files-rsync
"Rename file(s) `M-R, C-u to follow'" 'helm-find-files-rename
"Backup files" 'helm-find-files-backup
"Symlink files(s) `M-S, C-u to follow'" 'helm-find-files-symlink
@@ -739,11 +837,12 @@ Should not be used among other sources.")
#'helm-ff-make-bookmark-record)
(require 'helm-external)))
(candidates :initform 'helm-find-files-get-candidates)
+ (update :initform (lambda ()
+ (remhash helm-ff-default-directory
+ helm-ff--list-directory-cache)))
+ (match-on-real :initform t)
(filtered-candidate-transformer
- :initform '((lambda (candidates _source)
- (cl-loop for f in candidates
- for ff = (helm-ff-filter-candidate-one-by-one f)
- when ff collect ff))
+ :initform '(helm-ff-fct
helm-ff-sort-candidates))
(persistent-action-if :initform 'helm-find-files-persistent-action-if)
(persistent-help :initform "Hit1 Expand Candidate, Hit2 or (C-u) Find file")
@@ -798,8 +897,8 @@ Should not be used among other sources.")
(defcustom helm-dwim-target nil
"Default target directory for file actions.
-Define the directory where you want to start navigating for the target
-directory when copying, renaming etc... You can use the
+Define the directory where you want to start navigating for the
+target directory when copying, renaming, etc.. You can use the
`default-directory' of `next-window', the current
`default-directory' or have completion on all the directories
belonging to each window."
@@ -854,15 +953,27 @@ belonging to each window."
(defun helm-find-files-do-action (action)
"Generic function for creating actions from `helm-source-find-files'.
-ACTION must be an action supported by `helm-dired-action'."
+ACTION can be `rsync' or any action supported by `helm-dired-action'."
(require 'dired-async)
- (let* ((ifiles (mapcar 'expand-file-name ; Allow modify '/foo/.' -> '/foo'
+ (when (eq action 'rsync)
+ (cl-assert (executable-find "rsync") nil "No command named rsync"))
+ (let* ((rsync-switches
+ (when (and (eq action 'rsync)
+ helm-current-prefix-arg)
+ (cdr (split-string
+ (read-string "Run rsync like this: "
+ (mapconcat
+ 'identity
+ (cons "rsync" helm-rsync-switches) " ")
+ 'helm-rsync-command-history)))))
+ (ifiles (mapcar 'expand-file-name ; Allow modify '/foo/.' -> '/foo'
(helm-marked-candidates :with-wildcard t)))
(cand (helm-get-selection)) ; Target
(prefarg helm-current-prefix-arg)
(prompt (format "%s %s file(s) %s: "
(if (and (and (fboundp 'dired-async-mode)
dired-async-mode)
+ (not (eq action 'rsync))
(null prefarg))
(concat "Async " (symbol-name action))
(capitalize (symbol-name action)))
@@ -897,8 +1008,186 @@ ACTION must be an action supported by `helm-dired-action'."
(unless (or dest-dir-p (file-directory-p dest-dir))
(when (y-or-n-p (format "Create directory `%s'? " dest-dir))
(make-directory dest-dir t)))
- (helm-dired-action
- dest :files ifiles :action action :follow prefarg)))
+ (if (eq action 'rsync)
+ (helm-rsync-copy-files ifiles dest rsync-switches)
+ (helm-dired-action
+ dest :files ifiles :action action :follow prefarg))))
+
+;; Rsync
+;;
+(defun helm-rsync-remote2rsync (file)
+ (if (file-remote-p file)
+ (let ((localname (directory-file-name
+ (expand-file-name (file-remote-p file 'localname))))
+ (user (file-remote-p file 'user))
+ ;; Tramp name may contain port e.g. /ssh:host#2222:/foo.
+ (host (replace-regexp-in-string
+ "#[0-9]+" "" (file-remote-p file 'host))))
+ (if user
+ (format "%s@%s:%s" user host (shell-quote-argument localname))
+ (format "%s:%s" host (shell-quote-argument localname))))
+ (shell-quote-argument
+ (directory-file-name
+ (expand-file-name file)))))
+
+(defun helm-rsync-format-mode-line-str (proc)
+ (helm-aif (and (process-live-p proc)
+ (assoc-default proc helm-rsync-progress-str-alist))
+ (progn
+ ;; When rsync progress bar stop for some reason (e.g. rsync
+ ;; takes time to finalize writing file to disk), no output is
+ ;; coming from filter process, as a result the progress bar
+ ;; disapear for a while giving no information to user while
+ ;; the rsync process continues, so keep printing the last valid
+ ;; progress bar (stored in `helm-rsync--last-progress-bar-alist')
+ ;; instead of sending empty string.
+ (unless (equal it "")
+ (push (cons proc it) helm-rsync--last-progress-bar-alist))
+ (format " [%s]" (propertize
+ (assoc-default proc helm-rsync--last-progress-bar-alist)
+ 'face 'helm-ff-rsync-progress)))))
+
+(defun helm-rsync-mode-line (proc)
+ "Add Rsync progress to the mode line."
+ (or global-mode-string (setq global-mode-string '("")))
+ (unless (member `(:eval (helm-rsync-format-mode-line-str ,proc))
+ global-mode-string)
+ (setq global-mode-string
+ (append global-mode-string
+ `((:eval (helm-rsync-format-mode-line-str ,proc)))))))
+
+(defun helm-rsync-restore-mode-line (proc)
+ "Restore the mode line when Rsync finishes."
+ (setq global-mode-string
+ (remove `(:eval (helm-rsync-format-mode-line-str ,proc))
+ global-mode-string))
+ (setq helm-rsync--last-progress-bar-alist nil)
+ (force-mode-line-update))
+
+(defun helm-rsync-copy-files (files dest &optional switches)
+ "Send FILES to DEST using Rsync with SWITCHES as arguments.
+
+DEST must be a directory. SWITCHES when unspecified default to
+`helm-rsync-switches'."
+ (cl-assert (file-directory-p dest) t)
+ (setq files (cl-loop for f in files
+ collect (helm-rsync-remote2rsync f))
+ dest (helm-rsync-remote2rsync dest))
+ (let* ((buf (generate-new-buffer-name helm-rsync-process-buffer))
+ (port (when (helm-aand (file-remote-p dest 'host)
+ (string-match "#\\([0-9]+\\)" it))
+ (match-string 1)))
+ (proc (start-process-shell-command
+ "rsync" buf
+ (format "rsync %s"
+ (mapconcat
+ 'identity
+ (append (or switches helm-rsync-switches)
+ (and port
+ ;; Add automatically port
+ ;; specified in tramp name
+ ;; unless user already specified
+ ;; it himself with the -e option
+ ;; by editing command.
+ (and switches
+ (cl-loop for arg in switches never
+ (string-match-p
+ "\\`-e" arg)))
+ (list (format "-e 'ssh -p %s'"
+ port)))
+ files (list dest))
+ " ")))))
+ (helm-rsync-mode-line proc)
+ (set-process-sentinel
+ proc `(lambda (process event)
+ (cond ((string= event "finished\n")
+ (message "%s copied %s files"
+ (capitalize (process-name process))
+ ,(length files)))
+ (t (error "Process %s %s with code %s"
+ (process-name process)
+ (process-status process)
+ (process-exit-status process))))
+ (setq helm-rsync-progress-str-alist
+ (delete (assoc process helm-rsync-progress-str-alist)
+ helm-rsync-progress-str-alist))
+ (helm-rsync-restore-mode-line process)
+ (force-mode-line-update)))
+ (set-process-filter proc #'helm-rsync-process-filter)))
+
+(defun helm-rsync-process-filter (proc output)
+ "Filter process function used by `helm-rsync-copy-files'."
+ (let ((inhibit-read-only t)
+ fname progbar)
+ (with-current-buffer (process-buffer proc)
+ (when (string-match comint-password-prompt-regexp output)
+ ;; FIXME: Fully not tested and
+ ;; use an agent or auth-source
+ ;; or whatever to get password if
+ ;; available.
+ (process-send-string
+ proc (concat (read-passwd (match-string 0 output)) "\n")))
+ ;; Extract the progress bar.
+ (with-temp-buffer
+ (insert output)
+ (when (re-search-backward "[[:cntrl:]]" nil t)
+ (setq progbar (buffer-substring-no-properties
+ (match-end 0) (point-max)))))
+ ;; Insert the text, advancing the process marker.
+ (save-excursion
+ (goto-char (process-mark proc))
+ (insert output)
+ (set-marker (process-mark proc) (point)))
+ (goto-char (process-mark proc))
+ ;; Extract the file name currently
+ ;; copied (Imply --info=all2 or all1).
+ (save-excursion
+ (when (re-search-backward "^[^[:cntrl:]]" nil t)
+ (setq fname (helm-basename
+ (buffer-substring-no-properties
+ (point) (point-at-eol))))))
+ ;; Now format the string for the mode-line.
+ (let ((ml-str (mapconcat 'identity
+ (split-string
+ (replace-regexp-in-string
+ "%" helm-rsync-percent-sign
+ progbar)
+ " " t)
+ " ")))
+ (setq ml-str (propertize ml-str 'help-echo
+ (format "%s->%s" (process-name proc) fname)))
+ ;; Now associate the formatted
+ ;; progress-bar string with process.
+ (helm-aif (assoc proc helm-rsync-progress-str-alist)
+ (setcdr it ml-str)
+ (setq helm-rsync-progress-str-alist
+ (push (cons proc ml-str) helm-rsync-progress-str-alist)))))
+ ;; Finally update mode-line.
+ (unless helm-rsync-no-mode-line-update
+ (force-mode-line-update))))
+
+(defun helm-ff-kill-rsync-process (process)
+ "Kill rsync process PROCESS.
+
+When called interactively prompt user with completion when more than
+one process."
+ (interactive (list (get-process
+ (helm-comp-read
+ "Kill rsync process: "
+ (mapcar (lambda (x)
+ (process-name (car x)))
+ helm-rsync-progress-str-alist)
+ :exec-when-only-one t))))
+ (with-current-buffer (process-buffer process)
+ (delete-process process)
+ (kill-buffer))
+ (setq helm-rsync-progress-str-alist
+ (delete (assoc process helm-rsync-progress-str-alist)
+ helm-rsync-progress-str-alist)))
+
+(defun helm-find-files-rsync (_candidate)
+ "Rsync files from `helm-find-files'."
+ (helm-find-files-do-action 'rsync))
(defun helm-find-files-copy (_candidate)
"Copy files from `helm-find-files'."
@@ -929,8 +1218,8 @@ This reproduce the behavior of \"cp --backup=numbered from to\"."
(defun helm-find-files-other-window (_candidate)
"Keep current-buffer and open files in separate windows.
-When a prefix arg is detected files are opened in a vertical windows
-layout."
+When a prefix arg is detected files are opened in a vertical
+windows layout."
(let* ((files (helm-marked-candidates))
(buffers (mapcar 'find-file-noselect files)))
(helm-window-show-buffers buffers t)))
@@ -1019,18 +1308,18 @@ layout."
(defvar helm-eshell-command-on-file-input-history nil)
(cl-defun helm-find-files-eshell-command-on-file-1 (&optional map)
"Run `eshell-command' on CANDIDATE or marked candidates.
-This is done possibly with an eshell alias, if no alias found, you can type in
-an eshell command.
+This is done possibly with an Eshell alias. If no alias found,
+you can type in an Eshell command.
-Only aliases accepting a file as argument at the end of command line
-are collected, i.e aliases ending with \"$1\" or \"$*\".
+Only aliases accepting a file as argument at the end of command
+line are collected, i.e. aliases ending with \"$1\" or \"$*\".
Basename of CANDIDATE can be a wild-card.
-e.g you can do \"eshell-command command *.el\"
+E.g. you can do \"eshell-command command *.el\"
Where \"*.el\" is the CANDIDATE.
-It is possible to do eshell-command command <CANDIDATE> <some more args>
-like this: \"command %s some more args\".
+It is possible to do eshell-command command <CANDIDATE> <some
+more args> like this: \"command %s some more args\".
If MAP is given run `eshell-command' on all marked files at once,
Otherwise, run `eshell-command' on each marked files.
@@ -1046,10 +1335,11 @@ otherwise do
\"eshell-command command baz\"
Note:
-You have to setup some aliases in eshell with the `alias' command or
-by editing yourself the file `eshell-aliases-file' to make this
-working."
+You have to setup some aliases in Eshell with the `alias' command
+or by editing yourself the file `eshell-aliases-file' to make
+this working."
(require 'em-alias) (eshell-read-aliases-list)
+ (advice-add 'eshell-eval-command :override #'helm--advice-eshell-eval-command)
(when (or eshell-command-aliases-list
(y-or-n-p "No eshell aliases found, run eshell-command without alias anyway? "))
(let* ((cand-list (helm-marked-candidates :with-wildcard t))
@@ -1070,7 +1360,7 @@ working."
(cl-loop for (a c) in (eshell-read-aliases-list)
;; Positional arguments may be double
;; quoted (Issue #1881).
- when (string-match "[\"]?.*\\(\\$1\\|\\$\\*\\)[\"]?\\'" c)
+ when (string-match "[\"]?.*\\(\\$1\\|\\$\\*\\)[\"]?\\s-*&?\\'" c)
collect (propertize a 'help-echo c) into ls
finally return (sort ls 'string<))
:buffer "*helm eshell on file*"
@@ -1088,9 +1378,9 @@ working."
;; Two time C-u from `helm-comp-read' mean print to current-buffer.
;; i.e `eshell-command' will use this value.
(setq current-prefix-arg '(16))
- ;; Else reset the value of `current-prefix-arg'
- ;; to avoid printing in current-buffer.
- (setq current-prefix-arg nil))
+ ;; Else reset the value of `current-prefix-arg'
+ ;; to avoid printing in current-buffer.
+ (setq current-prefix-arg nil))
(if (and (or
;; One prefix-arg have been passed before `helm-comp-read'.
;; If map have been set with C-u C-u (value == '(16))
@@ -1108,75 +1398,183 @@ working."
;; Run eshell-command with ALL marked files as arguments.
;; This wont work on remote files, because tramp handlers depends
;; on `default-directory' (limitation).
- (let ((mapfiles (mapconcat 'eshell-quote-argument cand-list " ")))
+ (let ((mapfiles (mapconcat 'shell-quote-argument cand-list " ")))
(if (string-match "%s" command)
(setq cmd-line (format command mapfiles)) ; See [1]
(setq cmd-line (format "%s %s" command mapfiles)))
(eshell-command cmd-line))
-
- ;; Run eshell-command on EACH marked files.
- ;; To work with tramp handler we have to call
- ;; COMMAND on basename of each file, using
- ;; its basedir as `default-directory'.
- (cl-loop for f in cand-list
- for n from 1
- for dir = (and (not (string-match helm--url-regexp f))
- (helm-basedir f))
- ;; We can use basename here as the command will run
- ;; under default-directory.
- ;; This allow running e.g. "tar czvf test.tar.gz
- ;; %s/*" without creating an archive expanding from /home.
- for file = (eshell-quote-argument (helm-basename f))
- ;; \@ => placeholder for file without extension.
- ;; \# => placeholder for incremental number.
- for fcmd = (replace-regexp-in-string
- "\\\\@" (regexp-quote (file-name-sans-extension file))
- (replace-regexp-in-string
- "\\\\#" (format "%03d" n) command))
- for com = (if (string-match "%s" fcmd)
- ;; [1] This allow to enter other args AFTER filename
- ;; i.e <command %s some_more_args>
- (format fcmd file)
- (format "%s %s" fcmd file))
- do (let ((default-directory (or dir default-directory)))
- (eshell-command com)))))))
+ (unwind-protect
+ (progn
+ ;; Run eshell-command on EACH marked files.
+ ;; To work with tramp handler we have to call
+ ;; COMMAND on basename of each file, using
+ ;; its basedir as `default-directory'.
+ (cl-loop for f in cand-list
+ for n from 1
+ for dir = (and (not (string-match helm--url-regexp f))
+ (helm-basedir f))
+ ;; We can use basename here as the command will run
+ ;; under default-directory.
+ ;; This allow running e.g. "tar czvf test.tar.gz
+ ;; %s/*" without creating an archive expanding from /home.
+ for file = (shell-quote-argument (helm-basename f))
+ ;; \@ => placeholder for file without extension.
+ ;; \# => placeholder for incremental number.
+ for fcmd = (replace-regexp-in-string
+ "\\\\@" (regexp-quote (file-name-sans-extension file))
+ (replace-regexp-in-string
+ "\\\\#" (format "%03d" n) command))
+ for com = (if (string-match "%s" fcmd)
+ ;; [1] This allow to enter other args AFTER filename
+ ;; i.e <command %s some_more_args>
+ (format fcmd file)
+ (format "%s %s" fcmd file))
+ do (let ((default-directory (or dir default-directory)))
+ (eshell-command com))))
+ ;; Async process continue running but don't need anymore
+ ;; the advice at this point (see the `eshell-eval-command'
+ ;; call in `eshell-command'.) .
+ (advice-remove 'eshell-eval-command #'helm--advice-eshell-eval-command))))))
+
+(defun helm--advice-eshell-eval-command (command &optional input)
+ "Fix return value when command ends with \"&\"."
+ ;; Fix this emacs commit which is plain wrong as it returns
+ ;; either nil or an error (double because format spec doesn't
+ ;; always match specifier) whereas it should return either a
+ ;; single element (CAR DELIM) or DELIM itself if the car of
+ ;; DELIM is a process.
+ ;;
+ ;; 6b6f91b357f6fe2f1e0d72f046a1b8d8a2d6d8c3
+ ;; Author: John Wiegley <johnw@newartisans.com>
+ ;; AuthorDate: Fri May 27 02:57:18 2005 +0000
+ ;; Commit: John Wiegley <johnw@newartisans.com>
+ ;; CommitDate: Fri May 27 02:57:18 2005 +0000
+ (if eshell-current-command
+ ;; we can just stick the new command at the end of the current
+ ;; one, and everything will happen as it should
+ (setcdr (last (cdr eshell-current-command))
+ (list `(let ((here (and (eobp) (point))))
+ ,(and input
+ `(insert-and-inherit ,(concat input "\n")))
+ (if here
+ (eshell-update-markers here))
+ (eshell-do-eval ',command))))
+ (and eshell-debug-command
+ (with-current-buffer (get-buffer-create "*eshell last cmd*")
+ (erase-buffer)
+ (insert "command: \"" input "\"\n")))
+ (setq eshell-current-command command)
+ (let* ((delim (catch 'eshell-incomplete
+ (eshell-resume-eval)))
+ (val (car delim)))
+ ;; If the return value of `eshell-resume-eval' is wrapped in a
+ ;; list, it indicates that the command was run asynchronously.
+ ;; In that case, unwrap the value before checking the delimiter
+ ;; value.
+ (if (and val
+ (not (processp val))
+ (not (eq val t)))
+ (error "Unmatched delimiter: %S" val)
+ ;; Eshell-command expect a list like (<process>) to know if the
+ ;; command should be async or not.
+ (or (and (processp val) delim) val)))))
(defun helm-find-files-eshell-command-on-file (_candidate)
"Run `eshell-command' on CANDIDATE or marked candidates.
See `helm-find-files-eshell-command-on-file-1' for more info."
(helm-find-files-eshell-command-on-file-1 helm-current-prefix-arg))
-(defun helm-ff-switch-to-eshell (_candidate)
- "Switch to eshell and cd to `helm-ff-default-directory'.
-
-With a numeric prefix arg switch to numbered eshell buffer, if no
-prefix arg provided and more than one eshell buffer exists, provide
-completions on those buffers. If only one eshell buffer exists,
-switch to this one, if no eshell buffer exists or if the numeric
-prefix arg eshell buffer doesn't exists, create it and switch to it."
- (let ((cd-eshell (lambda ()
+(defun helm-ff--shell-interactive-buffer-p (buffer &optional mode)
+ (with-current-buffer buffer
+ (when (eq major-mode (or mode 'eshell-mode))
+ (let ((next-prompt-fn (cl-case major-mode
+ (shell-mode #'comint-next-prompt)
+ (eshell-mode #'eshell-next-prompt)
+ (term-mode #'term-next-prompt))))
+ (save-excursion
+ (goto-char (point-min))
+ (funcall next-prompt-fn 1)
+ (null (eql (point) (point-min))))))))
+
+(defun helm-ff-switch-to-shell (_candidate)
+ "Switch to a shell buffer and cd to `helm-ff-default-directory'.
+Set your preferred shell mode in `helm-ff-preferred-shell-mode'.
+
+With a numeric prefix arg switch to numbered shell buffer, if no
+prefix arg provided and more than one shell buffer exists, provide
+completions on those buffers. If only one shell buffer exists,
+switch to this one, if no shell buffer exists or if the numeric
+prefix arg shell buffer doesn't exists, create it and switch to it."
+ ;; Reproduce the Emacs-25 behavior to be able to edit and send
+ ;; command in term buffer.
+ (let (term-char-mode-buffer-read-only ; Emacs-25 behavior.
+ term-char-mode-point-at-process-mark ; Emacs-25 behavior.
+ (cd-eshell (lambda ()
(eshell/cd helm-ff-default-directory)
(eshell-reset)))
+ (cd-shell
+ (lambda ()
+ (goto-char (point-max))
+ (when (eq helm-ff-preferred-shell-mode 'shell-mode)
+ (comint-delete-input))
+ (insert (format "cd %s"
+ (shell-quote-argument
+ (or (file-remote-p
+ helm-ff-default-directory 'localname)
+ helm-ff-default-directory))))
+ (cl-case helm-ff-preferred-shell-mode
+ (shell-mode (comint-send-input))
+ (term-mode (progn (term-char-mode) (term-send-input))))))
(bufs (cl-loop for b in (mapcar 'buffer-name (buffer-list))
- when (helm-ff--eshell-interactive-buffer-p b)
+ when (helm-ff--shell-interactive-buffer-p
+ b helm-ff-preferred-shell-mode)
collect b)))
- (helm-aif (and (null helm-current-prefix-arg)
+ ;; Jump to a shell buffer or open a new session.
+ (helm-aif (and (not helm-current-prefix-arg)
(if (cdr bufs)
- (helm-comp-read "Switch to eshell buffer: " bufs
+ (helm-comp-read "Switch to shell buffer: " bufs
:must-match t)
(car bufs)))
(switch-to-buffer it)
- (eshell helm-current-prefix-arg))
- (unless (get-buffer-process (current-buffer))
- (funcall cd-eshell))))
-
-(defun helm-ff--eshell-interactive-buffer-p (buffer)
- (with-current-buffer buffer
- (and (eq major-mode 'eshell-mode)
- (save-excursion
- (goto-char (point-min))
- (eshell-next-prompt 1)
- (null (eql (point) (point-min)))))))
+ (cl-case helm-ff-preferred-shell-mode
+ (eshell-mode
+ (eshell helm-current-prefix-arg))
+ (shell-mode
+ (shell (helm-aif (and helm-current-prefix-arg
+ (prefix-numeric-value
+ helm-current-prefix-arg))
+ (format "*shell<%s>*" it))))
+ (term-mode
+ (progn
+ (ansi-term (getenv "SHELL")
+ (helm-aif (and helm-current-prefix-arg
+ (prefix-numeric-value
+ helm-current-prefix-arg))
+ (format "*ansi-term<%s>*" it)))
+ (term-line-mode)))))
+ ;; Now cd into directory.
+ (helm-aif (and (memq major-mode '(shell-mode term-mode))
+ (get-buffer-process (current-buffer)))
+ (accept-process-output it 0.1))
+ (unless (helm-ff-shell-alive-p major-mode)
+ (funcall
+ (if (eq major-mode 'eshell-mode) cd-eshell cd-shell)))))
+
+(defun helm-ff-shell-alive-p (mode)
+ "Returns non nil when a process is running inside `shell-mode' buffer."
+ (cl-ecase mode
+ (shell-mode
+ (save-excursion
+ (comint-goto-process-mark)
+ (or (null comint-last-prompt)
+ (not (eql (point)
+ (marker-position (cdr comint-last-prompt)))))))
+ (eshell-mode
+ (get-buffer-process (current-buffer)))
+ (term-mode
+ (save-excursion
+ (goto-char (term-process-mark))
+ (not (looking-back "\\$ " (- (point) 2)))))))
(defun helm-ff-touch-files (_candidate)
"The touch files action for helm-find-files."
@@ -1229,7 +1627,7 @@ prefix arg eshell buffer doesn't exists, create it and switch to it."
(interactive)
(unless (eq helm-ff-initial-sort-method 'size)
(setq helm-ff-initial-sort-method 'size)
- (helm-update (helm-get-selection nil helm-ff-transformer-show-only-basename)))
+ (helm-force-update (helm-get-selection nil helm-ff-transformer-show-only-basename)))
(message "Sorting by size"))
(put 'helm-ff-sort-by-size 'helm-only t)
@@ -1237,7 +1635,7 @@ prefix arg eshell buffer doesn't exists, create it and switch to it."
(interactive)
(unless (eq helm-ff-initial-sort-method 'newest)
(setq helm-ff-initial-sort-method 'newest)
- (helm-update (helm-get-selection nil helm-ff-transformer-show-only-basename)))
+ (helm-force-update (helm-get-selection nil helm-ff-transformer-show-only-basename)))
(message "Sorting by newest"))
(put 'helm-ff-sort-by-newest 'helm-only t)
@@ -1245,7 +1643,7 @@ prefix arg eshell buffer doesn't exists, create it and switch to it."
(interactive)
(unless (eq helm-ff-initial-sort-method nil)
(setq helm-ff-initial-sort-method nil)
- (helm-update (helm-get-selection nil helm-ff-transformer-show-only-basename)))
+ (helm-force-update (helm-get-selection nil helm-ff-transformer-show-only-basename)))
(message "Sorting alphabetically"))
(put 'helm-ff-sort-alpha 'helm-only t)
@@ -1296,13 +1694,13 @@ See `helm-ff-serial-rename-1'."
(cl-defun helm-ff-serial-rename-1
(directory collection new-name start-at-num extension &key (method 'rename))
- "rename files in COLLECTION to DIRECTORY with the prefix name NEW-NAME.
+ "Rename files in COLLECTION to DIRECTORY with the prefix name NEW-NAME.
Rename start at number START-AT-NUM - ex: prefixname-01.jpg.
-EXTENSION is the file extension to use, in empty prompt,
-reuse the original extension of file.
+EXTENSION is the file extension to use. In empty prompt, reuse
+the original extension of file.
METHOD can be one of rename, copy or symlink.
-Files will be renamed if they are files of current directory, otherwise they
-will be treated with METHOD.
+Files will be renamed if they are files of current directory,
+otherwise they will be treated with METHOD.
Default METHOD is rename."
;; Maybe remove directories selected by error in collection.
(setq collection (cl-remove-if 'file-directory-p collection))
@@ -1351,8 +1749,8 @@ See `helm-ff-serial-rename-1'."
(defun helm-ff-serial-rename-by-symlink (_candidate)
"Serial rename all marked files to `helm-ff-default-directory'.
-Rename only file of current directory, and symlink files coming from
-other directories.
+Rename only file of current directory, and symlink files coming
+from other directories.
See `helm-ff-serial-rename-1'."
(helm-ff-serial-rename-action 'symlink))
@@ -1484,6 +1882,8 @@ This doesn't replace inside the files, only modify filenames."
(rename-file old new)
(cl-incf count)))
finally (message "%d Files renamed" count))))
+ (unless helm-ff-cache-mode
+ (helm-ff-refresh-cache))
;; This fix the emacs bug where "Emacs-Lisp:" is sent
;; in minibuffer (not the echo area).
(sit-for 0.1)
@@ -1566,11 +1966,12 @@ This doesn't replace inside the files, only modify filenames."
(defun helm-ff-delete-char-backward ()
"Go up one level or disable HFF auto update and delete char backward.
-Going up one level works only when pattern is a directory endings with
-\"/\", otherwise this command delete char backward.
+Going up one level works only when pattern is a directory endings
+with \"/\", otherwise this command deletes char backward.
-Going up one level can be disabled if necessary by deleting \"/\" at
-end of pattern using \\<helm-map>\\[backward-char] and \\[helm-delete-minibuffer-contents]."
+Going up one level can be disabled if necessary by deleting \"/\"
+at end of pattern using \\<helm-map>\\[backward-char] and
+\\[helm-delete-minibuffer-contents]."
(interactive)
(with-helm-alive-p
(if (and helm-ff-DEL-up-one-level-maybe
@@ -1595,14 +1996,21 @@ end of pattern using \\<helm-map>\\[backward-char] and \\[helm-delete-minibuffer
See `helm-ff-RET' for details.
If MUST-MATCH is specified exit with
`helm-confirm-and-exit-minibuffer' which handle must-match mechanism."
- (let ((sel (helm-get-selection)))
+ (let ((sel (helm-get-selection))
+ ;; Ensure `file-directory-p' works on remote files.
+ non-essential)
(cl-assert sel nil "Trying to exit with no candidates")
- (if (and (file-directory-p sel)
+ (if (and (or (file-directory-p sel)
+ (helm-ff--invalid-tramp-name-p sel))
;; Allows exiting with default action when a prefix arg
;; is specified.
(null current-prefix-arg)
(null helm-ff--RET-disabled)
- (not (string= "." (helm-basename sel))))
+ (or (and (file-remote-p sel)
+ (string= "." (helm-basename sel))
+ (string-match-p "\\`[/].*:.*:\\'"
+ helm-pattern))
+ (not (string= "." (helm-basename sel)))))
(helm-execute-persistent-action)
(if must-match
(helm-confirm-and-exit-minibuffer)
@@ -1611,7 +2019,7 @@ If MUST-MATCH is specified exit with
(defun helm-ff-RET ()
"Default action for RET in `helm-find-files'.
-Behave differently depending of `helm-selection':
+Behave differently depending on `helm-selection':
- candidate basename is \".\" => open it in dired.
- candidate is a directory => expand it.
@@ -1632,7 +2040,7 @@ Behave differently depending of `helm-selection':
(defun helm-ff-TAB (arg)
"Default action for TAB in `helm-find-files'.
-Behave differently depending of `helm-selection':
+Behave differently depending on `helm-selection':
- candidate basename is \".\" => open the action menu.
- candidate is a directory => expand it.
@@ -1689,6 +2097,13 @@ Called with a prefix arg open menu unconditionally."
(helm-exit-and-execute-action 'helm-find-files-copy)))
(put 'helm-ff-run-copy-file 'helm-only t)
+(defun helm-ff-run-rsync-file ()
+ "Run Rsync file action from `helm-source-find-files'."
+ (interactive)
+ (with-helm-alive-p
+ (helm-exit-and-execute-action 'helm-find-files-rsync)))
+(put 'helm-ff-run-rsync-file 'helm-only t)
+
(defun helm-ff-run-rename-file ()
"Run Rename file action from `helm-source-find-files'."
(interactive)
@@ -1773,12 +2188,12 @@ Called with a prefix arg open menu unconditionally."
'helm-insert-file-name-completion-at-point)))
(put 'helm-ff-run-complete-fn-at-point 'helm-only t)
-(defun helm-ff-run-switch-to-eshell ()
+(defun helm-ff-run-switch-to-shell ()
"Run switch to eshell action from `helm-source-find-files'."
(interactive)
(with-helm-alive-p
- (helm-exit-and-execute-action 'helm-ff-switch-to-eshell)))
-(put 'helm-ff-run-switch-to-eshell 'helm-only t)
+ (helm-exit-and-execute-action 'helm-ff-switch-to-shell)))
+(put 'helm-ff-run-switch-to-shell 'helm-only t)
(defun helm-ff-run-switch-other-window ()
"Run switch to other window action from `helm-source-find-files'.
@@ -1873,15 +2288,14 @@ When a prefix arg is provided, split is done vertically."
(defun helm-ff-print (_candidate)
"Print marked files.
-You may to set in order
-variables `lpr-command',`lpr-switches' and/or `printer-name',
-but with no settings helm should detect your printer(s) and
-print with the default `lpr' settings.
+You may to set in order variables `lpr-command',`lpr-switches'
+and/or `printer-name', but with no settings Helm should detect
+your printer(s) and print with the default `lpr' settings.
-NOTE: DO NOT set the \"-P\" flag in `lpr-switches', if you really
+NOTE: DO NOT set the \"-P\" flag in `lpr-switches'. If you really
have to modify this, do it in `lpr-printer-switch'.
-Same as `dired-do-print' but for helm."
+Same as `dired-do-print' but for Helm."
(require 'lpr)
(when (or helm-current-prefix-arg
(not helm-ff-printer-list))
@@ -1894,10 +2308,10 @@ Same as `dired-do-print' but for helm."
"Printer: " helm-ff-printer-list)
printer-name))
(lpr-switches
- (if (and (stringp printer-name)
- (string< "" printer-name))
- (cons (concat lpr-printer-switch printer-name)
- lpr-switches)
+ (if (and (stringp printer-name)
+ (string< "" printer-name))
+ (cons (concat lpr-printer-switch printer-name)
+ lpr-switches)
lpr-switches))
(command (helm-read-string
(format "Print *%s File(s):\n%s with: "
@@ -1929,11 +2343,11 @@ Same as `dired-do-print' but for helm."
(defun helm-ff-checksum (file)
"Calculate the checksum of FILE.
-The checksum is copied to kill-ring.
-Checksum is calculated with the md5sum, sha1sum, sha224sum, sha256sum,
-sha384sum and sha512sum when available, otherwise the emacs function
-`secure-hash' is used but it is slow and may crash Emacs and even the
-whole system as it eats all memory."
+The checksum is copied to `kill-ring'.
+Checksum is calculated with the md5sum, sha1sum, sha224sum,
+sha256sum, sha384sum and sha512sum when available, otherwise the
+Emacs function `secure-hash' is used but it is slow and may crash
+Emacs and even the whole system as it eats all memory."
(cl-assert (file-regular-p file)
nil "`%s' is not a regular file" file)
(let* ((algo (intern (helm-comp-read
@@ -2084,8 +2498,8 @@ If prefix numeric arg is given go ARG level up."
(defun helm-ff-retrieve-last-expanded ()
"Move overlay to last visited directory `helm-ff-last-expanded'.
-This happen after using `helm-find-files-up-one-level',
-or hitting C-j on \"..\"."
+This happen after using `helm-find-files-up-one-level', or
+hitting C-j on \"..\"."
(when helm-ff-last-expanded
(let ((presel (if helm-ff-transformer-show-only-basename
(helm-basename
@@ -2119,6 +2533,20 @@ or hitting C-j on \"..\"."
(file-exists-p it))
(helm-next-line)))))
+(defun helm-ff-undo ()
+ "Undo minibuffer in `helm-find-files'.
+Ensure disabling `helm-ff-auto-update-flag' before undoing."
+ (interactive)
+ (let ((old--flag helm-ff-auto-update-flag))
+ (setq helm-ff-auto-update-flag nil)
+ (setq helm-ff--auto-update-state nil)
+ (unwind-protect
+ (progn
+ (undo)
+ (helm-check-minibuffer-input))
+ (setq helm-ff-auto-update-flag old--flag)
+ (setq helm-ff--auto-update-state helm-ff-auto-update-flag))))
+
;;; Auto-update - helm-find-files auto expansion of directories.
;;
;;
@@ -2126,8 +2554,8 @@ or hitting C-j on \"..\"."
"Expand to directory when sole completion.
When only one candidate is remaining and it is a directory,
expand to this directory.
-This happen only when `helm-ff-auto-update-flag' is non--nil
-or when `helm-pattern' is equal to \"~/\"."
+This happen only when `helm-ff-auto-update-flag' is non-nil or
+when `helm-pattern' is equal to \"~/\"."
(let ((src (helm-get-current-source)))
(when (and (helm-file-completion-source-p src)
(not (get-buffer-window helm-action-buffer 'visible))
@@ -2191,7 +2619,8 @@ or when `helm-pattern' is equal to \"~/\"."
;; is not one of "." or ".." [1]
;; and only one candidate is remaining [2],
;; assume candidate is a new directory to expand, and do it.
- (helm-set-pattern (file-name-as-directory cur-cand))
+ (helm-set-pattern (file-name-as-directory
+ (substring-no-properties cur-cand)))
;; The candidate is one of "." or ".."
;; that mean we have entered the last letter of the directory name
;; in prompt, so expansion is already done, just add the "/" at end
@@ -2201,6 +2630,16 @@ or when `helm-pattern' is equal to \"~/\"."
(helm-set-pattern
;; Need to expand-file-name to avoid e.g /ssh:host:./ in prompt.
(expand-file-name (file-name-as-directory helm-pattern)))))
+ ;; When typing pattern in minibuffer, helm
+ ;; expand very fast to a directory matching pattern and
+ ;; don't let undo the time to set a boundary, the result
+ ;; is when e.g. going to root with "//" and undoing, undo
+ ;; doesn't undo to previous input. One fix for this is to
+ ;; advice `undo-auto--boundary-ensure-timer' so that it is
+ ;; possible to modify its delay (use a value of 1s for
+ ;; helm), a second fix is to run directly here `undo-boundary'
+ ;; inside a timer.
+ (run-at-time helm-input-idle-delay nil #'undo-boundary)
(helm-check-minibuffer-input)))))))
(defun helm-ff-auto-expand-to-home-or-root ()
@@ -2211,13 +2650,13 @@ or when `helm-pattern' is equal to \"~/\"."
(cond ((and (not (file-remote-p helm-pattern))
(null (file-exists-p helm-pattern))
(string-match-p
- "\\`\\([.]\\|\\s-\\)\\{2\\}[^/]+"
+ "\\`\\([.]\\)\\{2\\}[^/]+"
(helm-basename helm-pattern))
(string-match-p "/\\'" helm-pattern))
(helm-ff-recursive-dirs helm-pattern)
- (with-helm-window (helm-check-minibuffer-input)))
+ (helm-ff--maybe-set-pattern-and-update))
((string-match
- "\\(?:\\`~/\\)\\|/?\\$.*/\\|/\\./\\|/\\.\\./\\|/~.*/\\|//\\|\\(/[[:alpha:]]:/\\|\\s\\+\\)"
+ "\\(?:\\`~/\\)\\|/?\\$.*/\\|/\\./\\|/\\.\\./\\|/~.*/\\|//\\|\\(/[[:alpha:]]:/\\)"
helm-pattern)
(let* ((match (match-string 0 helm-pattern))
(input (cond ((string= match "/./")
@@ -2235,14 +2674,15 @@ or when `helm-pattern' is equal to \"~/\"."
(setq input (file-name-as-directory input)))
(setq helm-ff-default-directory (file-name-as-directory
(file-name-directory input))))
- (with-helm-window
- (helm-set-pattern input)
- (helm-check-minibuffer-input))))
+ (helm-ff--maybe-set-pattern-and-update input)))
((string-match "\\`/\\(-\\):.*" helm-pattern)
- (with-helm-window
- (helm-set-pattern
- (replace-match tramp-default-method t t helm-pattern 1))
- (helm-check-minibuffer-input))))))
+ (helm-ff--maybe-set-pattern-and-update
+ (replace-match tramp-default-method t t helm-pattern 1))))))
+
+(defun helm-ff--maybe-set-pattern-and-update (&optional str)
+ (with-helm-window
+ (when str (helm-set-pattern str))
+ (helm-check-minibuffer-input)))
(defun helm-ff--expand-file-name-no-dot (name &optional directory)
"Prevent expanding \"/home/user/.\" to \"/home/user\"."
@@ -2351,7 +2791,7 @@ With a prefix arg toggle dired buffer to wdired mode."
((and vec (pred vectorp)) vec)))
(defun helm-ff--get-tramp-methods ()
- "Returns a list of the car of `tramp-methods'."
+ "Return a list of the car of `tramp-methods'."
(or helm-ff--tramp-methods
(setq helm-ff--tramp-methods (mapcar 'car tramp-methods))))
@@ -2390,8 +2830,8 @@ Return nil on valid file name remote or not."
(cl-defun helm-ff--tramp-hostnames (&optional (pattern helm-pattern))
"Get a list of hosts for tramp method found in `helm-pattern'.
-Argument PATTERN default to `helm-pattern', it is here only for debugging
-purpose."
+Argument PATTERN default to `helm-pattern'. It is here only for
+debugging purpose."
(when (string-match helm-tramp-file-name-regexp pattern)
(let* ((mh-method (helm-ff--previous-mh-tramp-method pattern))
(method (or (cadr mh-method) (match-string 1 pattern)))
@@ -2407,14 +2847,18 @@ purpose."
;; ("root" t) in sudo method.
when (and (stringp host)
(not (member host all-methods)))
- collect (concat (or (car mh-method) "/")
- method ":" host)))))
+ collect (helm-ff-filter-candidate-one-by-one
+ (concat (or (car mh-method) "/")
+ method ":" host))))))
(helm-fast-remove-dups
- (delq nil (cons current-mh-host comps))
+ (append (and current-mh-host
+ (list (helm-ff-filter-candidate-one-by-one
+ current-mh-host)))
+ comps)
:test 'equal))))
(defun helm-ff-before-action-hook-fn ()
- "Exit helm when user try to execute action on an invalid tramp fname."
+ "Exit Helm when user try to execute action on an invalid tramp fname."
(let* ((src (helm-get-current-source))
(cand (helm-get-selection nil nil src)))
(when (and (helm-file-completion-source-p src)
@@ -2425,9 +2869,9 @@ purpose."
(add-hook 'helm-before-action-hook 'helm-ff-before-action-hook-fn)
(cl-defun helm-ff--invalid-tramp-name-p (&optional (pattern helm-pattern))
- "Return non--nil when PATTERN is an invalid tramp filename."
+ "Return non-nil when PATTERN is an invalid tramp filename."
(string= (helm-ff-set-pattern pattern)
- "Invalid tramp file name"))
+ "@@TRAMP@@"))
(defun helm-ff--tramp-postfixed-p (str)
(let ((methods (helm-ff--get-tramp-methods))
@@ -2503,7 +2947,8 @@ purpose."
((and (null postfixed)
(string-match helm-tramp-file-name-regexp pattern)
(member (match-string 1 pattern) methods))
- "Invalid tramp file name") ; Write in helm-buffer.
+ ;; A flag to notify tramp name is incomplete.
+ "@@TRAMP@@")
;; Return PATTERN unchanged.
(t pattern))))
@@ -2522,7 +2967,7 @@ purpose."
;; Issue #118 allow creation of newdir+newfile.
(unless (or
;; A tramp file name not completed.
- (string= path "Invalid tramp file name")
+ (string= path "@@TRAMP@@")
;; An empty pattern
(string= path "")
(and (string-match-p ":\\'" path)
@@ -2536,10 +2981,10 @@ purpose."
;; to write a non--existing path in minibuffer
;; probably to create a 'new_dir' or a 'new_dir+new_file'.
(setq invalid-basedir t))
- ;; Don't set now `helm-pattern' if `path' == "Invalid tramp file name"
+ ;; Don't set now `helm-pattern' if `path' == "@@TRAMP@@"
;; like that the actual value (e.g /ssh:) is passed to
;; `helm-ff--tramp-hostnames'.
- (unless (or (string= path "Invalid tramp file name")
+ (unless (or (string= path "@@TRAMP@@")
invalid-basedir) ; Leave helm-pattern unchanged.
(setq helm-ff-auto-update-flag ; [1]
;; Unless auto update is disabled start auto updating only
@@ -2575,18 +3020,8 @@ purpose."
(when (and (string-match ":\\'" path)
(file-remote-p basedir nil t))
(setq helm-pattern basedir))
- (cond ((string= path "Invalid tramp file name")
- (or (helm-ff--tramp-hostnames) ; Hostnames completion.
- (prog2
- ;; `helm-pattern' have not been modified yet.
- ;; Set it here to the value of `path' that should be now
- ;; "Invalid tramp file name" and set the candidates list
- ;; to ("Invalid tramp file name") to make `helm-pattern'
- ;; match single candidate "Invalid tramp file name".
- (setq helm-pattern path)
- ;; "Invalid tramp file name" is now printed
- ;; in `helm-buffer'.
- (list path))))
+ (cond ((string= path "@@TRAMP@@")
+ (helm-ff--tramp-hostnames)) ; Hostnames completion.
((or (and (file-regular-p path)
(eq last-repeatable-command 'helm-execute-persistent-action))
;; `ffap-url-regexp' don't match until url is complete.
@@ -2594,16 +3029,18 @@ purpose."
invalid-basedir
(and (not (file-exists-p path)) (string-match "/$" path))
(and helm--url-regexp (string-match helm--url-regexp path)))
- (list path))
+ ;; Do NOT filter boring files here (issue #2330).
+ (list (helm-ff-filter-candidate-one-by-one path nil t)))
((string= path "") (helm-ff-directory-files "/"))
;; Check here if directory is accessible (not working on Windows).
((and (file-directory-p path) (not (file-readable-p path)))
- (list (format "file-error: Opening directory permission denied `%s'" path)))
+ (list (cons (format "file-error: Opening directory permission denied `%s'" path)
+ path)))
;; A fast expansion of PATH is made only if `helm-ff-auto-update-flag'
;; is enabled.
((and dir-p helm-ff-auto-update-flag)
(helm-ff-directory-files path))
- (t (append (unless (or require-match
+ (t (append (unless (or (eq require-match t)
;; Check here if path is an existing
;; file before adding it to
;; candidates, it was previously done
@@ -2624,14 +3061,15 @@ purpose."
;; disabled, whe don't want PATH to be added on top
;; if it is a directory.
dir-p)
- (list path))
+ ;; Do NOT filter boring files here (issue #2330).
+ (list (helm-ff-filter-candidate-one-by-one path nil t)))
(helm-ff-directory-files basedir))))))
(defun helm-list-directory (directory)
"List directory DIRECTORY.
-If DIRECTORY is remote use `helm-list-directory-function' otherwise use
-`directory-files'."
+If DIRECTORY is remote use `helm-list-directory-function',
+otherwise use `directory-files'."
(let* ((remote (file-remote-p directory 'method))
(helm-list-directory-function
(if (and remote (not (string= remote "ftp")))
@@ -2681,9 +3119,9 @@ Add a `helm-ff-dir' property on each fname ending with \"/\"."
(defun helm-list-dir-external (dir &optional sort-method)
"List directory DIR with external shell command as backend.
-This function is fast enough to be used for remote files and save the
-type of files at the same time in a property for using it later in the
-transformer."
+This function is fast enough to be used for remote files and save
+the type of files at the same time in a property for using it
+later in the transformer."
(let ((default-directory (file-name-as-directory
(expand-file-name dir))))
(with-temp-buffer
@@ -2722,33 +3160,228 @@ transformer."
(add-text-properties (point-min) (point-max) '(helm-ff-file t))
(split-string (buffer-string) "\n" t)))))
-(defun helm-ff-directory-files (directory)
+(defvar helm-ff--list-directory-cache (make-hash-table :test 'equal))
+(defun helm-ff-directory-files (directory &optional force-update)
"List contents of DIRECTORY.
Argument FULL mean absolute path.
-It is same as `directory-files' but always returns the
-dotted filename '.' and '..' even on root directories in Windows
-systems."
+It is same as `directory-files' but always returns the dotted
+filename '.' and '..' even on root directories in Windows
+systems.
+When FORCE-UPDATE is non nil recompute candidates even if DIRECTORY is
+in cache."
(setq directory (file-name-as-directory
(expand-file-name directory)))
- (let* (file-error
- (ls (condition-case err
- (helm-list-directory directory)
- ;; Handle file-error from here for Windows
- ;; because predicates like `file-readable-p' and friends
- ;; seem broken on emacs for Windows systems (always returns t).
- ;; This should never be called on GNU/Linux/Unix
- ;; as the error is properly intercepted in
- ;; `helm-find-files-get-candidates' by `file-readable-p'.
- (file-error
- (prog1
- (list (format "%s:%s"
- (car err)
- (mapconcat 'identity (cdr err) " ")))
- (setq file-error t)))))
- (dot (concat directory "."))
- (dot2 (concat directory "..")))
- (puthash directory (+ (length ls) 2) helm-ff--directory-files-hash)
- (append (and (not file-error) (list dot dot2)) ls)))
+ (or (and (not force-update)
+ (gethash directory helm-ff--list-directory-cache))
+ (let* (file-error
+ (ls (condition-case err
+ (helm-list-directory directory)
+ ;; Handle file-error from here for Windows
+ ;; because predicates like `file-readable-p' and friends
+ ;; seem broken on emacs for Windows systems (always returns t).
+ ;; This should never be called on GNU/Linux/Unix
+ ;; as the error is properly intercepted in
+ ;; `helm-find-files-get-candidates' by `file-readable-p'.
+ (file-error
+ (prog1
+ (list (format "%s:%s"
+ (car err)
+ (mapconcat 'identity (cdr err) " ")))
+ (setq file-error t)))))
+ (dot (concat directory "."))
+ (dot2 (concat directory ".."))
+ (candidates (append (and (not file-error) (list dot dot2)) ls)))
+ (puthash directory (+ (length ls) 2) helm-ff--directory-files-hash)
+ (puthash directory
+ (cl-loop for f in candidates
+ for ff = (helm-ff-filter-candidate-one-by-one f)
+ when ff collect ff)
+ helm-ff--list-directory-cache))))
+
+(defun helm-ff-refresh-cache ()
+ "Refresh `helm-ff--list-directory-cache'."
+ (maphash (lambda (k _v)
+ (unless (file-remote-p k)
+ (helm-ff-directory-files k t)))
+ helm-ff--list-directory-cache))
+
+;;; `helm-ff-cache-mode'
+;; A mode to auto refresh helm-find-files cache.
+;;
+(defvar helm-ff--refresh-cache-timer nil)
+(defvar helm-ff--cache-mode-lighter-face 'helm-ff-cache-stopped)
+(defvar helm-ff--refresh-cache-done nil)
+
+(defcustom helm-ff-cache-mode-post-delay 0.5
+ "Wait this delay seconds before restarting when emacs stops beeing idle.
+
+Minimum value accepted is 0.3s."
+ :type 'float
+ :group 'helm-files)
+
+(defcustom helm-ff-refresh-cache-delay 0.5
+ "`helm-ff-cache-mode' timer starts after this many seconds.
+
+Minimum value accepted is 0.3s."
+ :type 'float
+ :group 'helm-files)
+
+(defcustom helm-ff-cache-mode-max-idle-time 6
+ "`helm-ff-cache-mode' timer stops updating after this many seconds."
+ :type 'integer
+ :group 'helm-files)
+
+(defcustom helm-ff-cache-mode-lighter " 💡"
+ "A string for `helm-ff-cache-mode' lighter."
+ :type 'string
+ :group 'helm-files)
+
+(defface helm-ff-cache-updating
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-type-face))
+ "Face used for `helm-ff-cache-mode' lighter."
+ :group 'helm-files-faces)
+
+(defface helm-ff-cache-stopped
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-variable-name-face))
+ "Face used for `helm-ff-cache-mode' lighter."
+ :group 'helm-files-faces)
+
+(defun helm-ff--cache-mode-refresh (&optional no-update delay)
+ (when helm-ff--refresh-cache-timer
+ (cancel-timer helm-ff--refresh-cache-timer))
+ (if (or helm-alive-p (input-pending-p) no-update)
+ (setq helm-ff--cache-mode-lighter-face 'helm-ff-cache-stopped)
+ (helm-ff--cache-mode-refresh-1))
+ ;; When `helm-ff-keep-cached-candidates' becomes nil don't restart
+ ;; timer and set mode to nil to disable it.
+ (if helm-ff-keep-cached-candidates
+ (setq helm-ff--refresh-cache-timer
+ (run-with-idle-timer
+ (helm-aif (current-idle-time)
+ (time-add
+ it (seconds-to-time (helm-ff--refresh-cache-delay)))
+ (or delay helm-ff-refresh-cache-delay))
+ nil
+ #'helm-ff--cache-mode-refresh))
+ (setq helm-ff-cache-mode nil)))
+
+(defun helm-ff--cache-mode-refresh-1 ()
+ (if (and helm-ff-keep-cached-candidates
+ (> (hash-table-count helm-ff--list-directory-cache) 0)
+ ;; Stop updating when Emacs is idle more than
+ ;; helm-ff-cache-mode-max-idle-time.
+ (time-less-p (current-idle-time)
+ (seconds-to-time (helm-ff--cache-mode-max-idle-time)))
+ (null helm-ff--refresh-cache-done))
+ (progn
+ (setq helm-ff--cache-mode-lighter-face 'helm-ff-cache-updating)
+ (while-no-input
+ (helm-ff-refresh-cache)
+ (setq helm-ff--refresh-cache-done t)))
+ (setq helm-ff--cache-mode-lighter-face 'helm-ff-cache-stopped))
+ (force-mode-line-update))
+
+(defun helm-ff--cache-mode-reset-timer ()
+ ;; The goal is to run a timer all the x seconds when Emacs is idle.
+ ;; When Emacs is idle during say 20s (current-idle-time)
+ ;; the idle timer will run in
+ ;; 20+<helm-ff-refresh-cache-delay>+<helm-ff--cache-mode-post-delay>
+ ;; s. Say for example it is 20+1.5.
+ ;; This is fine when Emacs stays idle, because the next timer
+ ;; will run at 21.5+1.5 etc... so the display will be updated
+ ;; at every 1.5 seconds.
+ ;; But as soon as emacs looses its idleness
+ ;; i.e. (current-idle-time)==nil, the next update
+ ;; will occur at say 21+1.5 s, so we have to reinitialize
+ ;; the timer at 0+1.5. To do this we run the timer fn with 'noupdate
+ ;; and an explicit delay in post-command-hook and in focus-in-hook.
+ (helm-ff--cache-mode-refresh
+ 'no-update (+ (helm-ff--refresh-cache-delay)
+ (helm-ff--cache-mode-post-delay)))
+ (setq helm-ff--refresh-cache-done nil))
+
+(defun helm-ff--refresh-cache-delay ()
+ "Prevent user using less than 0.5s for `helm-ff-refresh-cache-delay'."
+ (max 0.3 helm-ff-refresh-cache-delay))
+
+(defun helm-ff--cache-mode-post-delay ()
+ "Prevent user using less than 0.5s for `helm-ff-cache-mode-post-delay'."
+ (max 0.3 helm-ff-cache-mode-post-delay))
+
+(defun helm-ff--cache-mode-max-idle-time ()
+ "Prevent user using too small value for `helm-ff-cache-mode-max-idle-time'."
+ (max (+ helm-ff-cache-mode-post-delay
+ helm-ff-refresh-cache-delay
+ 1)
+ helm-ff-cache-mode-max-idle-time))
+
+(defun helm-ff-cache-mode-add-hooks ()
+ (add-hook 'post-command-hook 'helm-ff--cache-mode-reset-timer)
+ (add-hook 'focus-in-hook 'helm-ff--cache-mode-reset-timer))
+
+(defun helm-ff-cache-mode-remove-hooks ()
+ (remove-hook 'post-command-hook 'helm-ff--cache-mode-reset-timer)
+ (remove-hook 'focus-in-hook 'helm-ff--cache-mode-reset-timer))
+
+;;;###autoload
+(define-minor-mode helm-ff-cache-mode
+ "Auto refresh `helm-find-files' cache when emacs is idle.
+
+You will probably don't want to start this mode directly but instead
+customize `helm-ff-keep-cached-candidates' to a non nil value to
+enable it.
+With `helm-ff-keep-cached-candidates' set to a nil value the mode will
+disable itself.
+
+When Emacs is idle, refresh the cache all the
+`helm-ff-refresh-cache-delay' seconds then stop when done or after
+`helm-ff-cache-mode-max-idle-time' if emacs is still idle."
+ :group 'helm-files
+ :global t
+ :lighter (:eval (propertize helm-ff-cache-mode-lighter
+ 'face helm-ff--cache-mode-lighter-face))
+ (unless (or helm-ff-keep-cached-candidates
+ (null helm-ff-cache-mode))
+ ;; When helm-ff-keep-cached-candidates have been set to nil with
+ ;; setq, the mode will start but with no effect and die by itself
+ ;; i.e. the timer will not restart on itself and mode will be set
+ ;; to nil.
+ (display-warning
+ '(helm-ff-cached-mode)
+ "`helm-ff-keep-cached-candidates' should be set to a non nil value"))
+ (if helm-ff-cache-mode
+ (helm-ff-cache-mode-add-hooks)
+ (helm-ff-cache-mode-remove-hooks)
+ (and helm-ff--refresh-cache-timer
+ (cancel-timer helm-ff--refresh-cache-timer))
+ (setq helm-ff--refresh-cache-timer nil)))
+
+(defcustom helm-ff-keep-cached-candidates 'all
+ "When non nil do not delete the HFF cache after each session.
+
+Possible values are:
+- `all' or `t' : Keep all.
+- `remote': Keep only remote.
+- `local': Keep only locals.
+- `nil' (default) : Delete all.
+
+Starts `helm-ff-cache-mode' when non nil.
+
+Please use customize interface or `customize-set-variable' to
+configure this i.e. NOT `setq'."
+ :type '(choice
+ (const :tag "Keep all" 'all)
+ (const :tag "Keep only remote" 'remote)
+ (const :tag "Keep only locals" 'local)
+ (const :tag "Delete all" nil))
+ :group 'helm-files
+ :set (lambda (var val)
+ (set var val)
+ (if val
+ (helm-ff-cache-mode 1)
+ (helm-ff-cache-mode -1))))
(defun helm-ff-handle-backslash (fname)
;; Allow creation of filenames containing a backslash.
@@ -2763,13 +3396,13 @@ systems."
(defun helm-ff--transform-pattern-for-completion (pattern)
"Maybe return PATTERN with it's basename modified as a regexp.
-This happen only when `helm-ff-fuzzy-matching' is enabled.
-This provide a similar behavior as `ido-enable-flex-matching'.
+This happens only when `helm-ff-fuzzy-matching' is enabled.
+This provides a similar behavior as `ido-enable-flex-matching'.
See also `helm--mapconcat-pattern'.
-If PATTERN is an url returns it unmodified.
-When PATTERN contain a space fallback to multi-match.
-If basename contain one or more space fallback to multi-match.
-If PATTERN is a valid directory name,return PATTERN unchanged."
+If PATTERN is an url return it unmodified.
+When PATTERN contains a space fallback to multi-match.
+If basename contains one or more space fallback to multi-match.
+If PATTERN is a valid directory name, return PATTERN unchanged."
;; handle bad filenames containing a backslash (no more needed in
;; emacs-26, also prevent regexp matching with e.g. "\|").
;; (setq pattern (helm-ff-handle-backslash pattern))
@@ -2803,9 +3436,14 @@ If PATTERN is a valid directory name,return PATTERN unchanged."
(string-match helm-ff-url-regexp pattern)
(and (string= helm-ff-default-directory "/") tramp-p))
;; Don't treat wildcards ("*") as regexp char.
- ;; (e.g ./foo/*.el => ./foo/[*].el)
+ ;; (e.g ./foo/*.el => ./foo/\\*\\.el) or ./foo/*.[ch] =>
+ ;; ./foo/\\*\\.\\[ch]
(concat (regexp-quote bd)
- (replace-regexp-in-string "[*]" "[*]" bn)))
+ ;; We were previously using
+ ;; (replace-regexp-in-string "[*]" "[*]" bn) but this
+ ;; doesn't handle wilcards like *.[ch], so regexp-quote
+ ;; bn as well.
+ (regexp-quote bn)))
(t (concat (regexp-quote bd)
(if (>= (length bn) 2) ; wait 2nd char before concating.
(helm--mapconcat-pattern bn)
@@ -2895,7 +3533,7 @@ Note that only existing directories are saved here."
(format "Type: %s: %s\n" type mode-type)
(when (string= type "symlink")
(format "True name: '%s'\n"
- (cond ((string-match "^\.#" (helm-basename candidate))
+ (cond ((string-match "^\\.#" (helm-basename candidate))
"Autosave symlink")
((helm-ff-valid-symlink-p candidate)
(file-truename candidate))
@@ -2904,10 +3542,13 @@ Note that only existing directories are saved here."
(format "Group: %s: %s\n" group group-right)
(format "Others: %s\n" other-right)
(format "Size: %s\n" size)
+ (when (string= type "directory")
+ (format "Size used in directory: %s\n"
+ (helm-directory-size candidate nil t)))
(format "Modified: %s\n" modif)
(format "Accessed: %s\n" access)
(and (stringp trash)
- (format "Trash: %s\n"
+ (format "Trash: %s\n"
(abbreviate-file-name trash)))))
(message dired-line) (sit-for 5)))
(message "Permission denied, file not readable")))
@@ -2942,7 +3583,7 @@ Note that only existing directories are saved here."
(t (message "No buffer to kill")))))
(defun helm-ff-kill-or-find-buffer-fname (candidate)
- "Find file CANDIDATE or kill it's buffer if it is visible.
+ "Find file CANDIDATE or kill its buffer if it is visible.
Never kill `helm-current-buffer'.
Never kill buffer modified.
This is called normally on third hit of \
@@ -2990,11 +3631,13 @@ in `helm-find-files-persistent-action-if'."
(put 'helm-ff-run-preview-file-externally 'helm-only t)
(defun helm-ff-prefix-filename (fname &optional file-or-symlinkp new-file)
- "Return filename FNAME maybe prefixed with [?] or [@].
-If FILE-OR-SYMLINKP is non--nil this mean we assume FNAME is an
-existing filename or valid symlink and there is no need to test it.
-NEW-FILE when non--nil mean FNAME is a non existing file and
-return FNAME prefixed with [?]."
+ "Add display property to FNAME.
+Display property presents a string maybe prefixed with [?] or [@].
+If FILE-OR-SYMLINKP is non-nil this means we assume FNAME is an
+existing filename or valid symlink and there is no need to test
+it.
+NEW-FILE when non-nil means FNAME is a non existing file and
+return FNAME with display property prefixed with [?]."
(let* ((prefix-new (propertize
" " 'display
(propertize "[?]" 'face 'helm-ff-prefix)))
@@ -3053,6 +3696,7 @@ Return candidates prefixed with basename of `helm-input' first."
(helm-ff-sort-candidates-1 candidates helm-input))
(defun helm-ff-boring-file-p (file)
+ "Returns non nil when FILE is matching boring regexps."
;; Prevent user doing silly thing like
;; adding the dotted files to boring regexps (#924).
(and helm-ff-skip-boring-files
@@ -3061,126 +3705,160 @@ Return candidates prefixed with basename of `helm-input' first."
(defvar helm-ff--git-found-p nil)
(defun helm-ff-git-ignored-p (file)
+ "Returns non nil when FILE is matched in \".gitignore\" file."
(and helm-ff-skip-git-ignored-files
(not (file-remote-p file))
(or helm-ff--git-found-p
(setq helm-ff--git-found-p (executable-find "git")))
(zerop (call-process "git" nil nil nil "check-ignore" "-q" file))))
-(defun helm-ff-filter-candidate-one-by-one (file)
- "`filter-one-by-one' Transformer function for `helm-source-find-files'."
- ;; Handle boring files
- (let ((basename (helm-basename file))
- dot)
- (unless (or (helm-ff-boring-file-p basename)
- (helm-ff-git-ignored-p file))
-
+(defun helm-ff-fct (candidates _source)
+ "Filter in charge of displaying basename or full path in HFF.
+Because CANDIDATES are directly stored as (basename . full_path), when
+`helm-ff-transformer-show-only-basename' is non nil do nothing and
+return directly CANDIDATES."
+ (if (null helm-ff-transformer-show-only-basename)
+ (cl-loop for (_disp . real) in candidates
+ for fc = (helm-ff-filter-candidate-one-by-one real 'reverse)
+ when fc collect fc)
+ candidates))
+
+(defsubst helm-ff-file-extension (file)
+ "Returns FILE extension if it is not a number."
+ (helm-aif (file-name-extension file)
+ (and (not (string-match "\\`0+\\'" it))
+ (zerop (string-to-number it))
+ it)))
+
+(defun helm-ff-filter-candidate-one-by-one (file &optional reverse skip-boring-check)
+ "Transform file in a cons cell like (DISPLAY . REAL).
+DISPLAY is shown as basename of FILE and REAL as full path of FILE.
+If REVERSE is non nil DISPLAY is shown as full path.
+If SKIP-BORING-CHECK is non nil don't filter boring files."
+ (let* ((basename (helm-basename file))
+ (dot (helm-ff-dot-file-p file))
+ (urlp (string-match-p helm-ff-url-regexp file))
+ ;; Filename with cntrl chars e.g. foo^J
+ (disp (or (helm-ff--get-host-from-tramp-invalid-fname file)
+ (replace-regexp-in-string
+ "[[:cntrl:]]" "?"
+ (if (or reverse urlp) file basename))))
+ (len (length disp))
+ (backup (backup-file-name-p disp)))
+ ;; We want to filter boring files only on the files coming
+ ;; from the output of helm-ff-directory-files not on single
+ ;; candidate (issue #2330).
+ (unless (and (not skip-boring-check)
+ (or (helm-ff-boring-file-p basename)
+ (helm-ff-git-ignored-p file)))
+ ;; Highlight extensions.
+ (helm-aif (and (not backup)
+ (not urlp)
+ (helm-ff-file-extension disp))
+ (when (condition-case _err
+ (string-match (format "\\.\\(%s\\)\\'" it) disp)
+ (invalid-regexp nil))
+ (add-face-text-property
+ (match-beginning 1) (match-end 1)
+ 'helm-ff-file-extension t disp)))
;; Handle tramp files with minimal highlighting.
(if (and (or (string-match-p helm-tramp-file-name-regexp helm-pattern)
(helm-file-on-mounted-network-p helm-pattern)))
- (let* (hostp
- (disp (if (and helm-ff-transformer-show-only-basename
- (not (setq dot (helm-dir-is-dot file))))
- (or (setq hostp
- (helm-ff--get-host-from-tramp-invalid-fname
- file))
- basename)
- file)))
- ;; Filename with cntrl chars e.g. foo^J
- ;; This will not work as long as most tramp file handlers doesn't
- ;; handle such case, e.g. file-name-all-completions,
- ;; directory-files, file-name-nondirectory etc...
- ;; Keep it though in case they fix this upstream...
- (setq disp (replace-regexp-in-string "[[:cntrl:]]" "?" disp))
+ (let* ((hostp (helm-ff--get-host-from-tramp-invalid-fname file)))
(cond (;; Dot directories . and ..
- dot (propertize file 'face 'helm-ff-dotted-directory))
+ dot
+ (cons (propertize file 'face 'helm-ff-dotted-directory) file))
;; Directories.
((get-text-property 1 'helm-ff-dir file)
(cons (propertize disp 'face 'helm-ff-directory) file))
+ ;; Backup files.
+ (backup
+ (cons (propertize disp 'face 'helm-ff-backup-file) file))
;; Executable files.
((get-text-property 1 'helm-ff-exe file)
- (cons (propertize disp 'face 'helm-ff-executable) file))
+ (add-face-text-property 0 len 'helm-ff-executable t disp)
+ (cons disp file))
;; Symlinks.
((get-text-property 1 'helm-ff-sym file)
- (cons (propertize disp 'face 'helm-ff-symlink) file))
+ (add-face-text-property 0 len 'helm-ff-symlink t disp)
+ (cons disp file))
;; Regular files.
((get-text-property 1 'helm-ff-file file)
- (cons (propertize disp 'face 'helm-ff-file) file))
+ (add-face-text-property 0 len 'helm-ff-file t disp)
+ (cons disp file))
;; non existing files.
- (t (cons (helm-ff-prefix-filename
- (propertize disp 'face 'helm-ff-file)
+ (t
+ (add-face-text-property 0 len 'helm-ff-file t disp)
+ (cons (helm-ff-prefix-filename
+ disp
hostp (unless hostp 'new-file))
file))))
;; Highlight local files showing everything, symlinks, exe,
;; dirs etc...
- (let* ((disp (if (and helm-ff-transformer-show-only-basename
- (not (setq dot (helm-dir-is-dot file)))
- (not (and helm--url-regexp
- (string-match helm--url-regexp file)))
- (not (string-match helm-ff-url-regexp file)))
- (or (helm-ff--get-host-from-tramp-invalid-fname file)
- basename)
- file))
- (attr (file-attributes file))
+ (let* ((attr (file-attributes file))
(type (car attr))
x-bit)
- ;; Filename cntrl chars e.g. foo^J
- (setq disp (replace-regexp-in-string "[[:cntrl:]]" "?" disp))
(cond ((string-match "file-error" file) file)
(;; A dead symlink.
(and (stringp type)
(not (helm-ff-valid-symlink-p file))
(not (string-match "^\\.#" basename)))
- (cons (propertize disp 'face 'helm-ff-invalid-symlink)
- file))
+ (add-face-text-property 0 len 'helm-ff-invalid-symlink t disp)
+ (cons disp file))
;; A dotted directory symlinked.
((and dot (stringp type))
- (cons (propertize disp 'face 'helm-ff-dotted-symlink-directory)
- file))
+ (cons (propertize file 'face 'helm-ff-dotted-symlink-directory) file))
;; A dotted directory.
- ((helm-ff-dot-file-p file)
- (cons (propertize disp 'face 'helm-ff-dotted-directory)
- file))
+ (dot
+ (cons (propertize file 'face 'helm-ff-dotted-directory) file))
+ ;; Backup files.
+ (backup
+ (cons (propertize disp 'face 'helm-ff-backup-file) file))
;; A symlink.
((stringp type)
- (cons (propertize disp 'display
- (concat (propertize disp 'face 'helm-ff-symlink)
- " -> "
- (propertize (abbreviate-file-name type)
- 'face 'helm-ff-truename)))
- file))
+ (let* ((abbrev (abbreviate-file-name type))
+ (len-abbrev (length abbrev)))
+ (helm-aif (helm-ff-file-extension abbrev)
+ (when (string-match (format "\\.\\(%s\\)\\'" it) abbrev)
+ (add-face-text-property
+ (match-beginning 1) (match-end 1)
+ 'helm-ff-file-extension t abbrev)))
+ (add-face-text-property 0 len-abbrev 'helm-ff-truename t abbrev)
+ ;; Colorize extension only on truename.
+ (add-face-text-property 0 len 'helm-ff-symlink nil disp)
+ (cons (propertize disp 'display (concat disp " -> " abbrev))
+ file)))
;; A directory.
((eq t type)
- (cons (propertize disp 'face 'helm-ff-directory)
- file))
+ (cons (propertize disp 'face 'helm-ff-directory) file))
;; A character device file.
((and attr (string-match
"\\`[cp]" (setq x-bit (substring (nth 8 attr) 0 4))))
- (cons (propertize disp 'face 'helm-ff-pipe)
- file))
+ (add-face-text-property 0 len 'helm-ff-pipe t disp)
+ (cons disp file))
;; A socket file.
((and attr (string-match "\\`[s]" x-bit))
- (cons (propertize disp 'face 'helm-ff-socket)
- file))
+ (add-face-text-property 0 len 'helm-ff-socket t disp)
+ (cons disp file))
;; An executable file.
- ((and attr
- (string-match
- "x\\'" x-bit))
- (cons (propertize disp 'face 'helm-ff-executable)
- file))
+ ((and attr (string-match "x\\'" x-bit))
+ (add-face-text-property 0 len 'helm-ff-executable t disp)
+ (cons disp file))
;; An executable file with suid
((and attr (string-match "s\\'" x-bit))
- (cons (propertize disp 'face 'helm-ff-suid)
- file))
+ (add-face-text-property 0 len 'helm-ff-suid t disp)
+ (cons disp file))
;; A file.
((and attr (null type))
- (cons (propertize disp 'face 'helm-ff-file)
- file))
+ (add-face-text-property 0 len 'helm-ff-file t disp)
+ (cons disp file))
;; A non--existing file.
- (t (cons (helm-ff-prefix-filename
- (propertize disp 'face 'helm-ff-file) nil 'new-file)
- file))))))))
+ (t
+ (add-face-text-property 0 len 'helm-ff-file t disp)
+ (cons (helm-ff-prefix-filename
+ disp nil 'new-file)
+ file))))))))
(defun helm-find-files-action-transformer (actions candidate)
"Action transformer for `helm-source-find-files'."
@@ -3230,17 +3908,15 @@ Return candidates prefixed with basename of `helm-input' first."
(file-exists-p candidate))
(helm-append-at-nth
actions '(("Browse url file" . browse-url-of-file)) 2))
- ((or (string= (file-name-extension candidate) "pdf")
- (string= (file-name-extension candidate) "PDF"))
- (helm-append-at-nth
- actions '(("Pdfgrep File(s)" . helm-ff-pdfgrep)) 4))
(t actions))))
(defun helm-ff-trash-action (fn names &rest args)
"Execute a trash action FN on marked files.
-Arg NAMES is a list of strings to pass to messages
-e.g. '(\"delete\" \"deleting\"), ARGS are other args to be passed to FN."
+Arg NAMES is a list of strings to pass to messages.
+E.g. '(\"delete\" \"deleting\")
+
+ARGS are other arguments to be passed to FN."
(let ((mkd (helm-marked-candidates))
errors)
(with-helm-display-marked-candidates
@@ -3276,9 +3952,9 @@ e.g. '(\"delete\" \"deleting\"), ARGS are other args to be passed to FN."
"Delete marked-files from a Trash directory.
The Trash directory should be a directory compliant with
-<http://freedesktop.org/wiki/Specifications/trash-spec> and each file
-should have its '*.trashinfo' correspondent file in Trash/info
-directory."
+<http://freedesktop.org/wiki/Specifications/trash-spec> and each
+file should have its '*.trashinfo' correspondent file in
+Trash/info directory."
(helm-ff-trash-action 'helm-ff-trash-rm-1 '("delete" "deleting")))
(defun helm-ff-trash-rm-1 (file)
@@ -3300,24 +3976,26 @@ directory."
"Restore marked-files from a Trash directory.
The Trash directory should be a directory compliant with
-<http://freedesktop.org/wiki/Specifications/trash-spec> and each file
-should have its '*.trashinfo' correspondent file in Trash/info
-directory."
+<http://freedesktop.org/wiki/Specifications/trash-spec> and each
+file should have its '*.trashinfo' correspondent file in
+Trash/info directory."
(let* ((default-directory (file-name-as-directory
helm-ff-default-directory))
(trashed-files (helm-ff-trash-list)))
(helm-ff-trash-action 'helm-restore-file-from-trash-1
'("restore" "restoring")
- trashed-files)))
+ trashed-files)
+ (unless helm-ff-cache-mode
+ (helm-ff-refresh-cache))))
(defun helm-restore-file-from-trash-1 (file trashed-files)
"Restore FILE from a trash directory.
-Arg TRASHED-FILES is an alist of (fname_in_trash . dest) obtained with
-`helm-ff-trash-list'."
+Arg TRASHED-FILES is an alist of (fname_in_trash . dest) obtained
+with `helm-ff-trash-list'."
;; Emacs trash duplicate files with a unique name + .trashinfo in
;; the filename which is wrong, only files in info directory should
;; end with .trashinfo, so fix the filename before looking for dest name.
- (let* ((fname (replace-regexp-in-string "\\.trashinfo\\'" "" file))
+ (let* ((fname (replace-regexp-in-string "\\.trashinfo\\'" "" file))
(info-file (concat (helm-reduce-file-name fname 2)
"info/"
(helm-basename fname)
@@ -3327,11 +4005,13 @@ Arg TRASHED-FILES is an alist of (fname_in_trash . dest) obtained with
(cl-assert (not (file-exists-p dest-file)) nil
(format "File `%s' already exists" dest-file))
(cl-assert dest-file nil "No such file in trash")
+ (message "Restoring %s to %s..." (helm-basename file) (helm-basedir dest-file))
(rename-file file dest-file)
+ (message "Restoring %s to %s done" (helm-basename file) (helm-basedir dest-file))
(delete-file info-file)))
(defun helm-ff-trash-file-p (file)
- "Return `t' when file is a trashed file."
+ "Return t when FILE is a trashed file."
(and (file-exists-p file)
(string-match "Trash/files/?\\'" (helm-basedir file))
(not (member (helm-basename file) '("." "..")))))
@@ -3358,8 +4038,8 @@ Arg TRASHED-FILES is an alist of (fname_in_trash . dest) obtained with
(defun helm-ff-goto-linum (candidate)
"Find file CANDIDATE and maybe jump to line number found in fname at point.
-line number should be added at end of fname preceded with \":\".
-e.g \"foo:12\"."
+Line number should be added at end of fname preceded with \":\".
+E.g. \"foo:12\"."
(let ((linum (with-helm-current-buffer
(let ((str (buffer-substring-no-properties
(point-at-bol) (point-at-eol))))
@@ -3424,12 +4104,12 @@ e.g \"foo:12\"."
(defun helm-ff-rotate-image-left (candidate)
"Rotate image file CANDIDATE left.
-This affect directly file CANDIDATE."
+This affects directly file CANDIDATE."
(helm-ff-rotate-current-image-1 candidate 270))
(defun helm-ff-rotate-image-right (candidate)
"Rotate image file CANDIDATE right.
-This affect directly file CANDIDATE."
+This affects directly file CANDIDATE."
(helm-ff-rotate-current-image-1 candidate 90))
(defun helm-ff-rotate-left-persistent ()
@@ -3463,9 +4143,10 @@ This affect directly file CANDIDATE."
"Open subtree CANDIDATE without quitting helm.
If CANDIDATE is not a directory expand CANDIDATE filename.
If CANDIDATE is alone, open file CANDIDATE filename.
-That's mean:
-First hit on C-j expand CANDIDATE second hit open file.
-If a prefix arg is given or `helm-follow-mode' is on open file."
+That means:
+First hit on C-j expands CANDIDATE, second hit opens file.
+If a prefix arg is given or `helm-follow-mode' is on, then open
+file."
(let* ((follow (or (helm-follow-mode-p)
helm--temp-follow-flag))
(image-cand (string-match-p (image-file-name-regexp) candidate))
@@ -3511,7 +4192,8 @@ If a prefix arg is given or `helm-follow-mode' is on open file."
(when (string= (helm-basename candidate) "..")
(setq helm-ff-last-expanded helm-ff-default-directory))
(funcall insert-in-minibuffer (file-name-as-directory
- (expand-file-name candidate))))
+ (expand-file-name candidate)))
+ (with-helm-after-update-hook (helm-ff-retrieve-last-expanded)))
'never-split))
;; A symlink file, expand to it's true name. (first hit)
((and (file-symlink-p candidate) (not current-prefix-arg) (not follow))
@@ -3603,7 +4285,7 @@ If a prefix arg is given or `helm-follow-mode' is on open file."
;;; Recursive dirs completion
;;
(defun helm-find-files-recursive-dirs (directory &optional input)
- (when (string-match "\\(\\s-+\\|[.]\\)\\{2\\}" input)
+ (when (string-match "\\([.]\\)\\{2\\}" input)
(setq input (replace-match "" nil t input)))
(message "Recursively searching %s from %s ..."
input (abbreviate-file-name directory))
@@ -3666,10 +4348,11 @@ If a prefix arg is given or `helm-follow-mode' is on open file."
"Insert file name completion at point.
When completing i.e. there is already something at point, insert
-filename abbreviated, relative or full according to initial input,
-whereas when inserting i.e. there is nothing at point, insert filename
-full, abbreviated or relative according to prefix arg, respectively no
-prefix arg, one prefix arg or two prefix arg."
+filename abbreviated, relative or full according to initial
+input, whereas when inserting i.e. there is nothing at point,
+insert filename full, abbreviated or relative according to prefix
+arg, respectively no prefix arg, one prefix arg or two prefix
+arg."
(with-helm-current-buffer
(if buffer-read-only
(error "Error: Buffer `%s' is read-only" (buffer-name))
@@ -3766,7 +4449,7 @@ Show the first `helm-ff-history-max-length' elements of
(defun helm-find-files-1 (fname &optional preselect)
"Find FNAME filename with PRESELECT filename preselected.
-Use it for non--interactive calls of `helm-find-files'."
+Use it for non-interactive calls of `helm-find-files'."
(require 'tramp)
;; Resolve FNAME now outside of helm.
;; [FIXME] When `helm-find-files-1' is used directly from lisp
@@ -3809,8 +4492,8 @@ Use it for non--interactive calls of `helm-find-files'."
(defun helm-ff--update-resume-after-hook (sources &optional nohook)
"Meant to be used in `helm-resume-after-hook'.
-When NOHOOK is non nil run inconditionally, otherwise only when source
-is helm-source-find-files."
+When NOHOOK is non-nil run inconditionally, otherwise only when
+source is `helm-source-find-files'."
(when (or nohook (string= "Find Files"
(assoc-default 'name (car sources))))
(helm-attrset 'resume `(lambda ()
@@ -3834,7 +4517,22 @@ is helm-source-find-files."
helm-ff-auto-expand-to-home-or-root))
(add-hook 'helm-after-update-hook hook)))
+(defun helm-ff--cleanup-cache ()
+ "Remove entries from cache according to `helm-ff-keep-cached-candidates'."
+ (cl-ecase helm-ff-keep-cached-candidates
+ ((all t) (ignore))
+ (local (maphash (lambda (k _v)
+ (when (file-remote-p k)
+ (remhash k helm-ff--list-directory-cache)))
+ helm-ff--list-directory-cache))
+ (remote (maphash (lambda (k _v)
+ (unless (file-remote-p k)
+ (remhash k helm-ff--list-directory-cache)))
+ helm-ff--list-directory-cache))
+ ((nil) (clrhash helm-ff--list-directory-cache))))
+
(defun helm-find-files-cleanup ()
+ (helm-ff--cleanup-cache)
(mapc (lambda (hook)
(remove-hook 'helm-after-update-hook hook))
'(helm-ff-auto-expand-to-home-or-root
@@ -4005,8 +4703,8 @@ Find inside `require' and `declare-function' sexp."
"Execute ACTION on FILES to CANDIDATE.
Where ACTION is a symbol that can be one of:
'copy, 'rename, 'symlink,'relsymlink, 'hardlink or 'backup.
-Argument FOLLOW when non--nil specify to follow FILES to destination for the actions
-copy and rename."
+Argument FOLLOW when non-nil specifies to follow FILES to
+destination for the actions copy and rename."
(require 'dired-async)
(require 'dired-x) ; For dired-keep-marker-relsymlink
(when (get-buffer dired-log-buffer) (kill-buffer dired-log-buffer))
@@ -4064,6 +4762,10 @@ copy and rename."
(setq helm-ff-cand-to-mark
(helm-get-dest-fnames-from-list files candidate dirflag))
(with-helm-after-update-hook (helm-ff-maybe-mark-candidates))
+ ;; Refresh directory even if helm-ff-cache-mode is
+ ;; enabled, it will not have the time to update
+ ;; destination directory.
+ (helm-ff-directory-files candidate t)
(if (and dirflag (eq action 'rename))
(helm-find-files-1 (file-name-directory target)
(if helm-ff-transformer-show-only-basename
@@ -4074,8 +4776,8 @@ copy and rename."
(defun helm-get-dest-fnames-from-list (flist dest-cand rename-dir-flag)
"Transform filenames of FLIST to abs of DEST-CAND.
-If RENAME-DIR-FLAG is non--nil collect the `directory-file-name' of transformed
-members of FLIST."
+If RENAME-DIR-FLAG is non-nil collect the `directory-file-name'
+of transformed members of FLIST."
;; At this point files have been renamed/copied at destination.
;; That's mean DEST-CAND exists.
(cl-loop
@@ -4092,8 +4794,8 @@ members of FLIST."
(defun helm-ff-maybe-mark-candidates ()
"Mark all candidates of list `helm-ff-cand-to-mark'.
-This is used when copying/renaming/symlinking etc... and
-following files to destination."
+This is used when copying/renaming/symlinking etc. and following
+files to destination."
(when (and (string= (assoc-default 'name (helm-get-current-source))
(assoc-default 'name helm-source-find-files))
helm-ff-cand-to-mark)
@@ -4113,7 +4815,7 @@ following files to destination."
;;
;;
(defun helm-file-buffers (filename)
- "Returns a list of buffer names corresponding to FILENAME."
+ "Return a list of buffer names corresponding to FILENAME."
(cl-loop with name = (expand-file-name filename)
for buf in (buffer-list)
for bfn = (buffer-file-name buf)
@@ -4122,7 +4824,7 @@ following files to destination."
(defun helm-ff--delete-by-moving-to-trash (file)
"Decide to trash or delete FILE.
-Returns non-nil when FILE needs to be trashed."
+Return non-nil when FILE needs to be trashed."
(let ((remote (file-remote-p file)))
(or
(and delete-by-moving-to-trash
@@ -4139,8 +4841,8 @@ Returns non-nil when FILE needs to be trashed."
(defun helm-ff-quick-delete (_candidate)
"Delete file CANDIDATE without quitting.
-When a prefix arg is given, meaning of `delete-by-moving-to-trash' is
-inversed."
+When a prefix arg is given, meaning of
+`delete-by-moving-to-trash' is the opposite."
(with-helm-window
(let ((marked (helm-marked-candidates)))
(unwind-protect
@@ -4172,11 +4874,11 @@ inversed."
(defun helm-delete-file (file &optional error-if-dot-file-p synchro trash)
"Delete FILE after querying the user.
-When a prefix arg is given, meaning of `delete-by-moving-to-trash' is
-inversed.
+When a prefix arg is given, meaning of
+`delete-by-moving-to-trash' is the opposite.
-Return error when ERROR-IF-DOT-FILE-P is non nil and user tries to
-delete a dotted file i.e. \".\" or \"..\".
+Return error when ERROR-IF-DOT-FILE-P is non-nil and user tries
+to delete a dotted file i.e. \".\" or \"..\".
Ask user when directory are not empty to allow recursive deletion
unless `helm-ff-allow-recursive-deletes' is non nil.
@@ -4235,8 +4937,8 @@ is nil."
(defun helm-delete-marked-files (_ignore)
"Delete marked files with `helm-delete-file'.
-When a prefix arg is given, meaning of `delete-by-moving-to-trash' is
-inversed."
+When a prefix arg is given, meaning of
+`delete-by-moving-to-trash' is the opposite."
(let* ((files (helm-marked-candidates :with-wildcard t))
(len 0)
(trash (helm-ff--delete-by-moving-to-trash (car files)))
@@ -4258,6 +4960,8 @@ inversed."
(sleep-for 1))
(cl-incf len))))
(setq helm-ff-allow-recursive-deletes old--allow-recursive-deletes)))
+ (unless helm-ff-cache-mode
+ (helm-ff-refresh-cache))
(message "%s File(s) %s" len (if trash "trashed" "deleted"))))))
;;; Delete files async
@@ -4265,7 +4969,7 @@ inversed."
;;
(defvar helm-ff-delete-log-file
(locate-user-emacs-file "helm-delete-file.log")
- "The file use to communicate with emacs child when deleting files async.")
+ "The file use to communicate with Emacs child when deleting files async.")
(defvar helm-ff--trash-flag nil)
@@ -4286,7 +4990,7 @@ inversed."
(setq helm-ff--trash-flag nil)))
(defun helm-delete-async-mode-line-message (text face &rest args)
- "Notify end of async operation in `mode-line'."
+ "Notify end of async operation in mode-line."
(message nil)
(let ((mode-line-format (concat
" " (propertize
@@ -4301,12 +5005,12 @@ inversed."
(defun helm-delete-marked-files-async (_ignore)
"Same as `helm-delete-marked-files' but async.
-When a prefix arg is given, meaning of `delete-by-moving-to-trash' is
-inversed.
+When a prefix arg is given, meaning of
+`delete-by-moving-to-trash' is the opposite.
-This function is not using `helm-delete-file' and BTW not asking user
-for recursive deletion of directory, be warned that directories are
-always deleted with no warnings."
+This function is not using `helm-delete-file' and BTW not asking
+user for recursive deletion of directory, be warned that
+directories are always deleted with no warnings."
(let* ((files (helm-marked-candidates :with-wildcard t))
(trash (helm-ff--delete-by-moving-to-trash (car files)))
(prmt (if trash "Trash" "Delete"))
@@ -4331,6 +5035,8 @@ always deleted with no warnings."
(let ((last-nonmenu-event t))
(when (y-or-n-p (format "Kill buffer %s, too? " buf))
(kill-buffer buf)))))
+ (unless helm-ff-cache-mode
+ (helm-ff-refresh-cache))
(run-with-timer
0.1 nil
(lambda ()
@@ -4374,7 +5080,8 @@ always deleted with no warnings."
"Open file CANDIDATE or open helm marked files in separate windows.
Called with one prefix arg open files in separate windows in a
vertical split.
-Called with two prefix arg open files in background without selecting them."
+Called with two prefix arg open files in background without
+selecting them."
(let ((marked (helm-marked-candidates :with-wildcard t))
(url-p (and helm--url-regexp ; we should have only one candidate.
(string-match helm--url-regexp candidate)))
@@ -4415,35 +5122,48 @@ Called with two prefix arg open files in background without selecting them."
(helm-exit-and-execute-action 'find-file-other-tab)))
(put 'helm-ff-find-file-other-tab 'helm-only t)
+(defun helm-ff--new-dirs-to-update (path)
+ "Collect directories to update when creating new directory PATH."
+ (let ((result (list path)))
+ (helm-awhile (helm-reduce-file-name path 1)
+ (if (not (file-directory-p it))
+ (progn (push it result) (setq path it))
+ (push it result)
+ (cl-return)))
+ result))
+
(defun helm-ff--mkdir (dir &optional helm-ff)
(when (or (not confirm-nonexistent-file-or-buffer)
(y-or-n-p (format "Create directory `%s'? "
(abbreviate-file-name
(expand-file-name dir)))))
- (let ((dirfname (directory-file-name dir)))
+ (let ((dirfname (directory-file-name dir))
+ (to-update (and helm-ff (helm-ff--new-dirs-to-update dir))))
(if (file-exists-p dirfname)
(error
"Mkdir: Unable to create directory `%s': file exists."
(helm-basename dirfname))
- (make-directory dir 'parent)))
- (when helm-ff
- ;; Allow having this new dir in history
- ;; to be able to retrieve it immediately
- ;; if we want to e.g copy a file from somewhere in it.
- (setq helm-ff-default-directory
- (file-name-as-directory (expand-file-name dir)))
- (push helm-ff-default-directory helm-ff-history))
- (or (and helm-ff (helm-find-files-1 dir)) t)))
+ (make-directory dir 'parent))
+ (when helm-ff
+ ;; Refresh cache.
+ (mapc (lambda (x) (helm-ff-directory-files x t)) to-update)
+ ;; Allow having this new dir in history
+ ;; to be able to retrieve it immediately
+ ;; if we want to e.g copy a file from somewhere in it.
+ (setq helm-ff-default-directory
+ (file-name-as-directory (expand-file-name dir)))
+ (push helm-ff-default-directory helm-ff-history))
+ (or (and helm-ff (helm-find-files-1 dir)) t))))
(defun helm-transform-file-load-el (actions candidate)
- "Add action to load the file CANDIDATE if it is an emacs lisp
+ "Add action to load the file CANDIDATE if it is an Emacs Lisp
file. Else return ACTIONS unmodified."
(if (member (file-name-extension candidate) '("el" "elc"))
(append actions '(("Load Emacs Lisp File" . load-file)))
actions))
(defun helm-transform-file-browse-url (actions candidate)
- "Add an action to browse the file CANDIDATE if it is a html file or URL.
+ "Add an action to browse the file CANDIDATE if it is a HTML file or URL.
Else return ACTIONS unmodified."
(let ((browse-action '("Browse with Browser" . browse-url)))
(cond ((string-match "^http\\|^ftp" candidate)
@@ -4453,9 +5173,10 @@ Else return ACTIONS unmodified."
(t actions))))
(defun helm-file-on-mounted-network-p (file)
- "Returns non-nil when FILE is part of a mounted remote directory.
+ "Return non-nil when FILE is part of a mounted remote directory.
-This function is checking `helm-mounted-network-directories' list."
+This function is checking `helm-mounted-network-directories'
+list."
(when helm-mounted-network-directories
(cl-loop for dir in helm-mounted-network-directories
thereis (file-in-directory-p file dir))))
@@ -4496,8 +5217,9 @@ This function is checking `helm-mounted-network-directories' list."
:action 'helm-type-file-actions))
(defvar helm-source--ff-file-name-history nil
- "[Internal] This source is build to be used with `helm-find-files'.
-Don't use it in your own code unless you know what you are doing.")
+ "[INTERNAL] This source is build to be used with `helm-find-files'.
+Don't use it in your own code unless you know what you are
+doing.")
(defvar helm--file-name-history-hide-deleted nil)
@@ -4585,7 +5307,7 @@ Don't use it in your own code unless you know what you are doing.")
(set-keymap-parent map helm-generic-files-map)
(define-key map (kbd "M-g a") 'helm-browse-project-run-ag)
map))
-
+
(defun helm-browse-project-get-buffers (root-directory)
(cl-loop for b in (helm-buffer-list)
;; FIXME: Why default-directory is root-directory
@@ -4635,12 +5357,12 @@ Use RG as backend."
(helm-browse-project-find-files-1 directory 'rg))
(defun helm-browse-project-ag (_candidate)
- "helm-grep AG action for helm-browse-project."
+ "A `helm-grep' AG action for `helm-browse-project'."
(let ((dir (with-helm-buffer (helm-attr 'root-dir))))
(helm-grep-ag dir helm-current-prefix-arg)))
(defun helm-browse-project-run-ag ()
- "Runs helm-grep AG from helm-browse-project."
+ "Run `helm-grep' AG from `helm-browse-project'."
(interactive)
(with-helm-alive-p
(helm-exit-and-execute-action 'helm-browse-project-ag)))
@@ -4666,8 +5388,8 @@ Use RG as backend."
'face 'helm-ff-file)
c)
(propertize c 'face 'helm-ff-file)))))
- "Class to define a source in helm-browse-project handling non VC
-handled directories.")
+ "Class to define a source in `helm-browse-project' handling non
+VC handled directories.")
(defmethod helm--setup-source :after ((source helm-browse-project-override-inheritor))
(let ((actions (slot-value source 'action)))
@@ -4715,15 +5437,16 @@ handled directories.")
;;;###autoload
(defun helm-browse-project (arg)
"Preconfigured helm to browse projects.
-Browse files and see status of project with its vcs.
+Browse files and see status of project with its VCS.
Only HG and GIT are supported for now.
-Fall back to `helm-browse-project-find-files'
-if current directory is not under control of one of those vcs.
+Fall back to `helm-browse-project-find-files' if current
+directory is not under control of one of those VCS.
With a prefix ARG browse files recursively, with two prefix ARG
rebuild the cache.
If the current directory is found in the cache, start
`helm-browse-project-find-files' even with no prefix ARG.
-NOTE: The prefix ARG have no effect on the VCS controlled directories.
+NOTE: The prefix ARG have no effect on the VCS controlled
+directories.
Needed dependencies for VCS:
<https://github.com/emacs-helm/helm-ls-git>
@@ -4806,7 +5529,8 @@ See `helm-browse-project'."
"Preconfigured `helm' for helm implementation of `find-file'.
Called with a prefix arg show history if some.
Don't call it from programs, use `helm-find-files-1' instead.
-This is the starting point for nearly all actions you can do on files."
+This is the starting point for nearly all actions you can do on
+files."
(interactive "P")
(let* ((hist (and arg helm-ff-history (helm-find-files-history nil)))
(smart-input (or hist (helm-find-files-initial-input)))
@@ -4856,10 +5580,11 @@ This is the starting point for nearly all actions you can do on files."
(defun helm-delete-tramp-connection ()
"Allow deleting tramp connection or marked tramp connections at once.
-This replace `tramp-cleanup-connection' which is partially broken in
-emacs < to 25.1.50.1 (See Emacs Bug#24432).
+This replace `tramp-cleanup-connection' which is partially broken
+in Emacs < to 25.1.50.1 (See Emacs Bug#24432).
-It allows additionally to delete more than one connection at once."
+It allows additionally to delete more than one connection at
+once."
(interactive)
(let ((helm-quit-if-no-candidate
(lambda ()
diff --git a/helm-find.el b/helm-find.el
index 9c1ab0ca..67b0d40a 100644
--- a/helm-find.el
+++ b/helm-find.el
@@ -26,8 +26,9 @@
:type 'boolean)
(defcustom helm-findutils-search-full-path nil
- "Search in full path with shell command find when non--nil.
-I.e use the -path/ipath arguments of find instead of -name/iname."
+ "Search in full path with shell command find when non-nil.
+I.e. use the -path/ipath arguments of find instead of
+-name/iname."
:group 'helm-files
:type 'boolean)
diff --git a/helm-font.el b/helm-font.el
index d0a37a4a..af5a3c35 100644
--- a/helm-font.el
+++ b/helm-font.el
@@ -23,7 +23,7 @@
(defgroup helm-font nil
- "Related applications to display fonts in helm."
+ "Related applications to display fonts in Helm."
:group 'helm)
(defcustom helm-ucs-recent-size 10
@@ -53,7 +53,9 @@
"Keymap for `helm-ucs'.")
(defface helm-ucs-char
- '((((class color) (background dark)) (:foreground "Gold")))
+ `((((class color) (background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Gold"))
"Face used to display ucs characters."
:group 'helm-font)
@@ -111,7 +113,7 @@
finally return (cons code char)))
(defun helm-calculate-ucs-max-len ()
- "Calculate the length of longest `ucs-names' candidate."
+ "Calculate the length of the longest `ucs-names' candidate."
(let ((ucs-struct (ucs-names)))
(if (hash-table-p ucs-struct)
(helm-calculate-ucs-hash-table-max-len ucs-struct)
@@ -172,7 +174,7 @@ either be an alist or a hash-table."
(helm-ucs-collect-symbols-alist ucs-struct)))
(defun helm-ucs-init ()
- "Initialize an helm buffer with ucs symbols.
+ "Initialize a Helm buffer with ucs symbols.
Only math* symbols are collected."
(unless helm-ucs--max-len
(setq helm-ucs--max-len
@@ -185,7 +187,8 @@ Only math* symbols are collected."
(defun helm-ucs-match (candidate n)
"Return the N part of an ucs CANDIDATE.
-Where N=1 is the ucs code, N=2 the ucs char and N=3 the ucs name."
+Where N=1 is the ucs code, N=2 the ucs char and N=3 the ucs
+name."
(when (string-match
"^(\\(#x[a-f0-9]+\\)): *\\(.\\) *\\([^:]+\\)+"
candidate)
@@ -310,7 +313,7 @@ Where N=1 is the ucs code, N=2 the ucs char and N=3 the ucs name."
;;;###autoload
(defun helm-ucs (arg)
- "Preconfigured helm for `ucs-names'.
+ "Preconfigured `helm' for `ucs-names'.
Called with a prefix arg force reloading cache."
(interactive "P")
diff --git a/helm-for-files.el b/helm-for-files.el
index e875c56e..fd090f95 100644
--- a/helm-for-files.el
+++ b/helm-for-files.el
@@ -35,8 +35,8 @@
helm-source-locate)
"Your preferred sources for `helm-for-files' and `helm-multi-files'.
-When adding a source here it is up to you to ensure the library of
-this source is accessible and properly loaded."
+When adding a source here it is up to you to ensure the library
+of this source is accessible and properly loaded."
:type '(repeat (choice symbol))
:group 'helm-files)
@@ -138,10 +138,11 @@ Be aware that a nil value will make tramp display very slow."
(defvar helm-source-recentf nil
"See (info \"(emacs)File Conveniences\").
-Set `recentf-max-saved-items' to a bigger value if default is too small.")
+Set `recentf-max-saved-items' to a bigger value if default is too
+small.")
(defcustom helm-recentf-fuzzy-match nil
- "Enable fuzzy matching in `helm-source-recentf' when non--nil."
+ "Enable fuzzy matching in `helm-source-recentf' when non-nil."
:group 'helm-files
:type 'boolean
:set (lambda (var val)
@@ -253,8 +254,8 @@ Run all sources defined in `helm-for-files-preferred-list'."
Allow toggling back and forth from locate to others sources with
`helm-multi-files-toggle-locate-binding' key.
-This avoid launching needlessly locate when what you search is already
-found."
+This avoids launching locate needlessly when what you are
+searching for is already found."
(interactive)
(require 'helm-x-files)
(unless helm-source-buffers-list
diff --git a/helm-grep.el b/helm-grep.el
index 43b491e3..3c3b4fcb 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -63,16 +63,17 @@ Where:
If your grep version doesn't support the --exclude/include args
don't specify the '%e' format spec.
-Helm also support ack-grep and git-grep ,
-here a default command example for ack-grep:
+Helm also support ack-grep and git-grep. The following is a
+default command example for ack-grep:
\(setq helm-grep-default-command \"ack-grep -Hn --color --smart-case --no-group %e %p %f\"
helm-grep-default-recurse-command \"ack-grep -H --color --smart-case --no-group %e %p %f\")
-You can ommit the %e spec if you don't want to be prompted for types.
+You can ommit the %e spec if you don't want to be prompted for
+types.
NOTE: Helm for ack-grep support ANSI sequences, so you can remove
-the \"--no-color\" option safely (recommended)
+the \"--no-color\" option safely (recommended).
However you should specify --color to enable multi matches highlighting
because ack disable it when output is piped.
@@ -87,24 +88,26 @@ you will have to setup this in your .gitconfig:
[color \"grep\"]
match = black yellow
-where \"black\" is the foreground and \"yellow\" the background.
+Where \"black\" is the foreground and \"yellow\" the background.
See the git documentation for more infos.
-`helm-grep-default-command' and `helm-grep-default-recurse-command'are
-independents, so you can enable `helm-grep-default-command' with ack-grep
-and `helm-grep-default-recurse-command' with grep if you want to be faster
-on recursive grep.
+`helm-grep-default-command' and
+`helm-grep-default-recurse-command' are independent, so you can
+enable `helm-grep-default-command' with ack-grep and
+`helm-grep-default-recurse-command' with grep if you want to be
+faster on recursive grep.
-NOTE: Remote grepping is not available with ack-grep,
- and badly supported with grep because tramp handle badly
- repeated remote processes in a short delay (< to 5s)."
+NOTE: Remote grepping is not available with ack-grep, and badly
+ supported with grep because tramp handles badly repeated
+ remote processes in a short delay (< to 5s)."
:group 'helm-grep
:type 'string)
(defcustom helm-grep-default-recurse-command
"grep --color=always -a -d recurse %e -n%cH -e %p %f"
"Default recursive grep format command for `helm-do-grep-1'.
-See `helm-grep-default-command' for format specs and infos about ack-grep."
+See `helm-grep-default-command' for format specs and infos about
+ack-grep."
:group 'helm-grep
:type 'string)
@@ -112,37 +115,39 @@ See `helm-grep-default-command' for format specs and infos about ack-grep."
"zgrep --color=always -a -n%cH -e %p %f"
"Default command for Zgrep.
See `helm-grep-default-command' for infos on format specs.
-Option --color=always is supported and can be used safely
-to replace the helm internal match highlighting,
-see `helm-grep-default-command' for more infos."
+Option --color=always is supported and can be used safely to
+replace the Helm internal match highlighting. See
+`helm-grep-default-command' for more infos."
:group 'helm-grep
:type 'string)
(defcustom helm-pdfgrep-default-command
"pdfgrep --color always -niH %s %s"
"Default command for pdfgrep.
-Option \"--color always\" is supported starting helm version 1.7.8,
-when used matchs will be highlighted according to GREP_COLORS env var."
+Option \"--color always\" is supported starting Helm version
+1.7.8. When used matches will be highlighted according to
+GREP_COLORS env var."
:group 'helm-grep
:type 'string)
(defcustom helm-pdfgrep-default-recurse-command
"pdfgrep --color always -rniH %s %s"
"Default recurse command for pdfgrep.
-Option \"--color always\" is supported starting helm version 1.7.8,
-when used matchs will be highlighted according to GREP_COLORS env var."
+Option \"--color always\" is supported starting Helm version
+1.7.8. When used matches will be highlighted according to
+GREP_COLORS env var."
:group 'helm-grep
:type 'string)
(defcustom helm-pdfgrep-default-read-command nil
"Default command to read pdf files from pdfgrep.
Where '%f' format spec is filename and '%p' is page number.
-e.g In Ubuntu you can set it to:
+E.g. In Ubuntu you can set it to:
\"evince --page-label=%p '%f'\"
-If set to nil either `doc-view-mode' or `pdf-view-mode' will be used
-instead of an external command."
+If set to nil either `doc-view-mode' or `pdf-view-mode' will be
+used instead of an external command."
:group 'helm-grep
:type 'string)
@@ -163,7 +168,7 @@ instead of an external command."
:type 'string)
(defcustom helm-grep-save-buffer-name-no-confirm nil
- "when *hgrep* already exists,auto append suffix."
+ "When *hgrep* already exists, auto append suffix."
:group 'helm-grep
:type 'boolean)
@@ -210,32 +215,35 @@ Possible value are:
(defcustom helm-grep-pipe-cmd-switches nil
"A list of additional parameters to pass to grep pipe command.
-This will be used for pipe command for multiple pattern matching
+This will be used to pipe command for multiple pattern matching
for grep, zgrep ack-grep and git-grep backends.
-If you add extra args for ack-grep, use ack-grep options,
-for others (grep, zgrep and git-grep) use grep options.
+If you add extra args for ack-grep, use ack-grep options, for
+others (grep, zgrep and git-grep) use grep options.
Here are the commands where you may want to add switches:
grep --color=always
ack-grep --smart-case --color
-You probably don't need to use this unless you know what you are doing."
+You probably don't need to use this unless you know what you are
+doing."
:group 'helm-grep
:type '(repeat string))
(defcustom helm-grep-ag-pipe-cmd-switches nil
"A list of additional parameters to pass to grep-ag pipe command.
Use parameters compatibles with the backend you are using
-\(i.e AG for AG, PT for PT or RG for RG)
+\(i.e. AG for AG, PT for PT or RG for RG)
-You probably don't need to use this unless you know what you are doing."
+You probably don't need to use this unless you know what you are
+doing."
:group 'helm-grep
:type '(repeat string))
-(defcustom helm-grep-input-idle-delay 0.6
- "Same as `helm-input-idle-delay' but for grep commands.
-It have a higher value than `helm-input-idle-delay' to avoid
-flickering when updating."
+(defcustom helm-grep-input-idle-delay 0.1
+ "Idle time before updating, specified in seconds.
+A lower value (default) means Helm will display the results
+faster. Increasing it to a higher value (e.g. 0.6) prevents the
+buffer from flickering when updating."
:group 'helm-grep
:type 'float)
@@ -249,30 +257,38 @@ flickering when updating."
:group 'helm-faces)
(defface helm-grep-match
- '((((background light)) :foreground "#b00000")
- (((background dark)) :foreground "gold1"))
+ `((((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "#b00000")
+ (((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "gold1"))
"Face used to highlight grep matches.
Have no effect when grep backend use \"--color=\"."
:group 'helm-grep-faces)
(defface helm-grep-file
- '((t (:foreground "BlueViolet"
- :underline t)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "BlueViolet"
+ :underline t))
"Face used to highlight grep results filenames."
:group 'helm-grep-faces)
(defface helm-grep-lineno
- '((t (:foreground "Darkorange1")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Darkorange1"))
"Face used to highlight grep number lines."
:group 'helm-grep-faces)
(defface helm-grep-finish
- '((t (:foreground "Green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Green"))
"Face used in mode line when grep is finish."
:group 'helm-grep-faces)
(defface helm-grep-cmd-line
- '((t (:inherit font-lock-type-face)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit font-lock-type-face))
"Face used to highlight grep command line when no results."
:group 'helm-grep-faces)
@@ -294,8 +310,8 @@ Have no effect when grep backend use \"--color=\"."
(defcustom helm-grep-use-ioccur-style-keys t
"Use Arrow keys to jump to occurences.
-Note that if you define this variable with `setq' your change will
-have no effect, use customize instead."
+Note that if you define this variable with `setq' your change
+will have no effect, use customize instead."
:group 'helm-grep
:type 'boolean
:set (lambda (var val)
@@ -512,7 +528,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.")
(cons ?m pipes))))))
(defun helm-grep-init (cmd-line)
- "Start an asynchronous grep process with CMD-LINE using ZGREP if non--nil."
+ "Start an asynchronous grep process with CMD-LINE using ZGREP if non-nil."
(let* ((default-directory (or helm-ff-default-directory
(helm-default-directory)
default-directory))
@@ -607,7 +623,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.")
;;
(defun helm-grep-action (candidate &optional where)
"Define a default action for `helm-do-grep-1' on CANDIDATE.
-WHERE can be one of other-window, other-frame."
+WHERE can be `other-window' or `other-frame'."
(let* ((split (helm-grep-split-line candidate))
(split-pat (helm-mm-split-pattern helm-input))
(lineno (string-to-number (nth 1 split)))
@@ -615,15 +631,15 @@ WHERE can be one of other-window, other-frame."
(if (eq major-mode 'helm-grep-mode)
(current-buffer)
helm-buffer)
- (get-text-property (point-at-bol) 'helm-grep-fname))
+ (get-text-property (point-at-bol)
+ 'helm-grep-fname))
(car split)))
- (tramp-method (file-remote-p (or helm-ff-default-directory
- default-directory) 'method))
- (tramp-host (file-remote-p (or helm-ff-default-directory
- default-directory) 'host))
- (tramp-prefix (concat "/" tramp-method ":" tramp-host ":"))
- (fname (if tramp-host
- (concat tramp-prefix loc-fname) loc-fname)))
+ (tramp-fname (file-remote-p (or helm-ff-default-directory
+ default-directory)))
+ (fname (if tramp-fname
+ (concat tramp-fname loc-fname)
+ loc-fname)))
+ (helm-log "helm-grep-action fname: %s" fname )
(cl-case where
(other-window (helm-window-show-buffers
(list (find-file-noselect fname)) t))
@@ -631,9 +647,10 @@ WHERE can be one of other-window, other-frame."
(grep (helm-grep-save-results-1))
(pdf (if helm-pdfgrep-default-read-command
(helm-pdfgrep-action-1 split lineno (car split))
- (find-file (car split)) (if (derived-mode-p 'pdf-view-mode)
- (pdf-view-goto-page lineno)
- (doc-view-goto-page lineno))))
+ (find-file (car split))
+ (if (derived-mode-p 'pdf-view-mode)
+ (pdf-view-goto-page lineno)
+ (doc-view-goto-page lineno))))
(t (find-file fname)))
(unless (or (eq where 'grep) (eq where 'pdf))
(helm-goto-line lineno))
@@ -719,7 +736,7 @@ If N is positive go forward otherwise go backward."
;;;###autoload
(defun helm-goto-precedent-file ()
- "Go to precedent file in helm grep/etags buffers."
+ "Go to previous file in Helm grep/etags buffers."
(interactive)
(with-helm-alive-p
(with-helm-window
@@ -728,7 +745,7 @@ If N is positive go forward otherwise go backward."
;;;###autoload
(defun helm-goto-next-file ()
- "Go to precedent file in helm grep/etags buffers."
+ "Go to previous file in Helm grep/etags buffers."
(interactive)
(with-helm-window
(helm-goto-next-or-prec-file 1)))
@@ -768,28 +785,31 @@ If N is positive go forward otherwise go backward."
(defun helm-grep-save-results (candidate)
(helm-grep-action candidate 'grep))
+(defvar helm-grep-mode-use-pcre nil)
(defun helm-grep-save-results-1 ()
- "Save helm grep result in a `helm-grep-mode' buffer."
- (let ((buf "*hgrep*")
- new-buf
- (pattern (with-helm-buffer helm-input-local))
- (src-name (assoc-default 'name (helm-get-current-source))))
+ "Save Helm grep result in a `helm-grep-mode' buffer."
+ (let* ((buf "*hgrep*")
+ new-buf
+ (pattern (with-helm-buffer helm-input-local))
+ (src (helm-get-current-source))
+ (src-name (assoc-default 'name src)))
(when (get-buffer buf)
(if helm-grep-save-buffer-name-no-confirm
(setq new-buf (format "*hgrep|%s|-%s" pattern
(format-time-string "%H-%M-%S*")))
- (setq new-buf (helm-read-string "GrepBufferName: " buf))
- (cl-loop for b in (helm-buffer-list)
- when (and (string= new-buf b)
- (not (y-or-n-p
- (format "Buffer `%s' already exists overwrite? "
- new-buf))))
- do (setq new-buf (helm-read-string "GrepBufferName: " "*hgrep "))))
+ (setq new-buf (helm-read-string "GrepBufferName: " buf))
+ (cl-loop for b in (helm-buffer-list)
+ when (and (string= new-buf b)
+ (not (y-or-n-p
+ (format "Buffer `%s' already exists overwrite? "
+ new-buf))))
+ do (setq new-buf (helm-read-string "GrepBufferName: " "*hgrep "))))
(setq buf new-buf))
(with-current-buffer (get-buffer-create buf)
(setq default-directory (or helm-ff-default-directory
(helm-default-directory)
default-directory))
+ (setq-local helm-grep-mode-use-pcre (helm-attr 'pcre src))
(setq buffer-read-only t)
(let ((inhibit-read-only t)
(map (make-sparse-keymap)))
@@ -865,7 +885,8 @@ Special commands:
(helm--ansi-color-apply l) l)
when (string-match helm-grep-split-line-regexp line)
do (insert (propertize
- (car (helm-grep-filter-one-by-one line))
+ (car (helm-grep-filter-one-by-one
+ line helm-grep-mode-use-pcre))
;; needed for wgrep.
'helm-realvalue line)
"\n"))))
@@ -969,7 +990,8 @@ Special commands:
;;
(defun helm-grep-guess-extensions (files)
"Try to guess file extensions in FILES list when using grep recurse.
-These extensions will be added to command line with --include arg of grep."
+These extensions will be added to command line with --include arg
+of grep."
(cl-loop with ext-list = (list helm-grep-preferred-ext "*")
with lst = (if (file-directory-p (car files))
(directory-files
@@ -1010,18 +1032,18 @@ These extensions will be added to command line with --include arg of grep."
;;
;;
(defvar helm-grep-before-init-hook nil
- "Hook that runs before initialization of the helm buffer.")
+ "Hook that runs before initialization of the Helm buffer.")
(defvar helm-grep-after-init-hook nil
- "Hook that runs after initialization of the helm buffer.")
+ "Hook that runs after initialization of the Helm buffer.")
(defclass helm-grep-class (helm-source-async)
((candidates-process :initform 'helm-grep-collect-candidates)
- (filter-one-by-one :initform 'helm-grep-filter-one-by-one)
+ (filtered-candidate-transformer :initform #'helm-grep-fc-transformer)
(keymap :initform helm-grep-map)
(pcre :initarg :pcre :initform nil
:documentation
- " Backend is using pcre regexp engine when non--nil.")
+ " Backend is using pcre regexp engine when non-nil.")
(nohighlight :initform t)
(nomark :initform t)
(backend :initarg :backend
@@ -1029,7 +1051,7 @@ These extensions will be added to command line with --include arg of grep."
:documentation
" The grep backend that will be used.
It is actually used only as an internal flag
- and don't set the backend by itself.
+ and doesn't set the backend by itself.
You probably don't want to modify this.")
(candidate-number-limit :initform 9999)
(help-message :initform 'helm-grep-help-message)
@@ -1058,24 +1080,26 @@ These extensions will be added to command line with --include arg of grep."
"Launch helm using backend BACKEND on a list of TARGETS files.
When RECURSE is given and BACKEND is 'grep' use -r option of
-BACKEND and prompt user for EXTS to set the --include args of BACKEND.
-Interactively you can give more than one arg separated by space at prompt.
-e.g
+BACKEND and prompt user for EXTS to set the --include args of
+BACKEND.
+Interactively you can give more than one arg separated by space
+at prompt.
+E.g.:
$Pattern: *.el *.py *.tex
-From lisp use the EXTS argument as a list of extensions as above.
+From Lisp use the EXTS argument as a list of extensions as above.
If you are using ack-grep, you will be prompted for --type
-instead and EXTS will be ignored.
-If prompt is empty `helm-grep-ignored-files' are added to --exclude.
+instead and EXTS will be ignored. If prompt is empty
+`helm-grep-ignored-files' are added to --exclude.
-Argument DEFAULT-INPUT is use as `default' arg of `helm' and INPUT
-is used as `input' arg of `helm', See `helm' docstring.
+Argument DEFAULT-INPUT is use as `default' arg of `helm' and
+INPUT is used as `input' arg of `helm'. See `helm' docstring.
-Arg BACKEND when non--nil specify which backend to use
+Arg BACKEND when non-nil specifies which backend to use.
It is used actually to specify 'zgrep' or 'git'.
-When BACKEND 'zgrep' is used don't prompt for a choice
-in recurse, and ignore EXTS, search being made recursively on files matching
-`helm-zgrep-file-extension-regexp' only."
+When BACKEND 'zgrep' is used don't prompt for a choice in
+recurse, and ignore EXTS, search being made recursively on files
+matching `helm-zgrep-file-extension-regexp' only."
(let* (non-essential
(ack-rec-p (helm-grep-use-ack-p :where 'recursive))
(exts (and recurse
@@ -1177,7 +1201,7 @@ in recurse, and ignore EXTS, search being made recursively on files matching
;; may contain a ":".
(cl-loop for n from 1 to 3 collect (match-string n line))))
-(defun helm-grep--filter-candidate-1 (candidate &optional dir)
+(defun helm-grep--filter-candidate-1 (candidate &optional dir pcre)
(let* ((root (or dir (and helm-grep-default-directory-fn
(funcall helm-grep-default-directory-fn))))
(ansi-p (string-match-p helm--ansi-color-regexp candidate))
@@ -1207,11 +1231,11 @@ in recurse, and ignore EXTS, search being made recursively on files matching
":"
(propertize lineno 'face 'helm-grep-lineno)
":"
- (if ansi-p str (helm-grep-highlight-match str t)))
+ (if ansi-p str (helm-grep-highlight-match str pcre)))
line)
"")))
-(defun helm-grep-filter-one-by-one (candidate)
+(defun helm-grep-filter-one-by-one (candidate &optional pcre)
"`filter-one-by-one' transformer function for `helm-do-grep-1'."
(let ((helm-grep-default-directory-fn
(or helm-grep-default-directory-fn
@@ -1223,9 +1247,20 @@ in recurse, and ignore EXTS, search being made recursively on files matching
;; Already computed do nothing (default as input).
candidate
(and (stringp candidate)
- (helm-grep--filter-candidate-1 candidate)))))
+ (helm-grep--filter-candidate-1 candidate nil pcre)))))
-(defun helm-grep-highlight-match (str &optional multi-match)
+(defun helm-grep-fc-transformer (candidates source)
+ (let ((helm-grep-default-directory-fn
+ (or helm-grep-default-directory-fn
+ (lambda () (or helm-ff-default-directory
+ (and (null (eq major-mode 'helm-grep-mode))
+ (helm-default-directory))
+ default-directory))))
+ (pcre (helm-attr 'pcre source)))
+ (cl-loop for c in candidates
+ collect (helm-grep--filter-candidate-1 c nil pcre))))
+
+(defun helm-grep-highlight-match (str &optional pcre)
"Highlight in string STR all occurences matching `helm-pattern'."
(let (beg end)
(condition-case-unless-debug nil
@@ -1233,21 +1268,22 @@ in recurse, and ignore EXTS, search being made recursively on files matching
(insert (propertize str 'read-only nil)) ; Fix (#1176)
(goto-char (point-min))
(cl-loop for reg in
- (if multi-match
- ;; (m)occur.
- (cl-loop for r in (helm-mm-split-pattern
- helm-pattern)
- unless (string-match "\\`!" r)
- collect
- (helm-aif (and helm-migemo-mode
- (assoc r helm-mm--previous-migemo-info))
- (cdr it) r))
- ;; async sources (grep, gid etc...)
- (list helm-input))
+ (cl-loop for r in (helm-mm-split-pattern
+ helm-input)
+ unless (string-match "\\`!" r)
+ collect
+ (helm-aif (and helm-migemo-mode
+ (assoc r helm-mm--previous-migemo-info))
+ (cdr it) r))
do
- (while (and (re-search-forward reg nil t)
+ (while (and (re-search-forward
+ (if pcre
+ (helm--translate-pcre-to-elisp reg)
+ reg)
+ nil t)
(> (- (setq end (match-end 0))
- (setq beg (match-beginning 0))) 0))
+ (setq beg (match-beginning 0)))
+ 0))
(helm-add-face-text-properties beg end 'helm-grep-match))
do (goto-char (point-min)))
(buffer-string))
@@ -1258,12 +1294,13 @@ in recurse, and ignore EXTS, search being made recursively on files matching
;;
;;
(defun helm-grep-buffers-1 (candidate &optional zgrep)
- "Run grep on all file--buffers or CANDIDATE if it is a file--buffer.
-If one of selected buffers is not a file--buffer,
-it is ignored and grep will run on all others file--buffers.
-If only one candidate is selected and it is not a file--buffer,
+ "Run grep on all file buffers or CANDIDATE if it is a file buffer.
+If one of selected buffers is not a file buffer, it is ignored
+and grep will run on all others file-buffers.
+If only one candidate is selected and it is not a file buffer,
switch to this buffer and run `helm-occur'.
-If a prefix arg is given run grep on all buffers ignoring non--file-buffers."
+If a prefix arg is given run grep on all buffers ignoring
+non-file buffers."
(let* ((prefarg (or current-prefix-arg helm-current-prefix-arg))
(helm-ff-default-directory
(if (and helm-ff-default-directory
@@ -1400,34 +1437,53 @@ If a prefix arg is given run grep on all buffers ignoring non--file-buffers."
;; https://github.com/BurntSushi/ripgrep
(defcustom helm-grep-ag-command
- "ag --line-numbers -S --hidden --color --nogroup %s %s %s"
+ "ag --line-numbers -S --color --nogroup %s %s %s"
"The default command for AG, PT or RG.
-Takes three format specs, the first for type(s), the second for pattern
-and the third for directory.
+Takes three format specs, the first for type(s), the second for
+pattern and the third for directory.
+
+You can use safely \"--color\" (used by default) with AG RG and
+PT.
-You can use safely \"--color\" (used by default) with AG RG and PT.
+NOTE: Usage of \"--color=never\" is discouraged as it uses Elisp
+to colorize matched items which is slower than using the native
+colorization of backend, however it is still supported.
For ripgrep here is the command line to use:
rg --color=always --smart-case --no-heading --line-number %s %s %s
-NOTE: Old versions of ripgrep was not supporting colors in emacs and a
-workaround had to be used (i.e prefixing command line with
-\"TERM=eterm-color\"), this is no more needed.
-See issue <https://github.com/BurntSushi/ripgrep/issues/182> for more infos.
+And to customize colors (always for ripgrep) use something like this:
+
+ rg --color=always --colors 'match:bg:yellow' --colors 'match:fg:black'
+\--smart-case --no-heading --line-number %s %s %s
+
+This will change color for matched items from foreground red (the
+default) to a yellow background with a black foreground. Note
+that your color settings for RG will not work properly with
+multiples pattern if you have configured colors in rg config file
+instead of command line. For more enhanced settings of ansi
+colors see https://github.com/emacs-helm/helm/issues/2313
You must use an output format that fit with helm grep, that is:
\"filename:line-number:string\"
The option \"--nogroup\" allow this.
-The option \"--line-numbers\" is also mandatory except with PT (not supported).
-For RG the options \"--no-heading\" and \"--line-number\" are the ones to use.
-
-When modifying the default colors of matches with e.g \"--color-match\" option of AG
-you may want to modify as well `helm-grep-ag-pipe-cmd-switches' to have all matches
-colorized with same color in multi match."
+The option \"--line-numbers\" is also mandatory except with
+PT (not supported).
+For RG the options \"--no-heading\" and \"--line-number\" are the
+ones to use.
+
+When modifying the default colors of matches with e.g.
+\"--color-match\" option of AG or \"--colors\" option of ripgrep
+you may want to modify as well `helm-grep-ag-pipe-cmd-switches'
+to have all matches colorized with the same color in multi
+match.
+
+Of course you can use several other options, see the man page of the
+backend you are using."
:group 'helm-grep
:type 'string)
@@ -1455,15 +1511,18 @@ Ripgrep (rg) types are also supported if this backend is used."
(defun helm-grep-ag-prepare-cmd-line (pattern directory &optional type)
"Prepare AG command line to search PATTERN in DIRECTORY.
-When TYPE is specified it is one of what returns `helm-grep-ag-get-types'
-if available with current AG version."
+When TYPE is specified it is one of what `helm-grep-ag-get-types'
+returns if available with current AG version."
(let* ((patterns (helm-mm-split-pattern pattern t))
(pipe-switches (mapconcat 'identity helm-grep-ag-pipe-cmd-switches " "))
(pipe-cmd (helm-acase (helm-grep--ag-command)
(("ag" "pt")
(format "%s -S --color%s" it (concat " " pipe-switches)))
- ("rg" (format "rg -N -S --color=always%s"
- (concat " " pipe-switches)))))
+ ("rg" (format "rg -N -S --color=%s%s"
+ (when (string-match "--color=\\([a-z]+\\) "
+ helm-grep-ag-command)
+ (match-string 1 helm-grep-ag-command))
+ (concat " " pipe-switches)))))
(cmd (format helm-grep-ag-command
(mapconcat 'identity type " ")
(shell-quote-argument (car patterns))
@@ -1545,7 +1604,7 @@ if available with current AG version."
(keymap :initform helm-grep-map)
(history :initform 'helm-grep-ag-history)
(help-message :initform 'helm-grep-help-message)
- (filter-one-by-one :initform 'helm-grep-filter-one-by-one)
+ (filtered-candidate-transformer :initform #'helm-grep-fc-transformer)
(persistent-action :initform 'helm-grep-persistent-action)
(persistent-help :initform "Jump to line (`C-u' Record in mark ring)")
(candidate-number-limit :initform 99999)
@@ -1606,8 +1665,8 @@ The color of matched items can be customized in your .gitconfig
See `helm-grep-default-command' for more infos.
The \"--exclude-standard\" and \"--no-index\" switches allow
-skipping unwanted files specified in ~/.gitignore_global
-and searching files not already staged (not enabled by default).
+skipping unwanted files specified in ~/.gitignore_global and
+searching files not already staged (not enabled by default).
You have also to enable this in global \".gitconfig\" with
\"git config --global core.excludesfile ~/.gitignore_global\"."
@@ -1617,8 +1676,8 @@ You have also to enable this in global \".gitconfig\" with
(defun helm-grep-git-1 (directory &optional all default input)
"Run git-grep on DIRECTORY.
If DIRECTORY is not inside or part of a git repo exit with error.
-If optional arg ALL is non-nil grep the whole repo otherwise start
-at DIRECTORY.
+If optional arg ALL is non-nil grep the whole repo otherwise
+start at DIRECTORY.
Arg DEFAULT is what you will have with `next-history-element',
arg INPUT is what you will have by default at prompt on startup."
(require 'vc)
@@ -1635,15 +1694,16 @@ arg INPUT is what you will have by default at prompt on startup."
;;;###autoload
(defun helm-do-grep-ag (arg)
- "Preconfigured helm for grepping with AG in `default-directory'.
-With prefix-arg prompt for type if available with your AG version."
+ "Preconfigured `helm' for grepping with AG in `default-directory'.
+With prefix arg prompt for type if available with your AG
+version."
(interactive "P")
(require 'helm-files)
(helm-grep-ag (expand-file-name default-directory) arg))
;;;###autoload
(defun helm-grep-do-git-grep (arg)
- "Preconfigured helm for git-grepping `default-directory'.
+ "Preconfigured `helm' for git-grepping `default-directory'.
With a prefix arg ARG git-grep the whole repository."
(interactive "P")
(require 'helm-files)
diff --git a/helm-help.el b/helm-help.el
index 722671e0..8813acc2 100644
--- a/helm-help.el
+++ b/helm-help.el
@@ -24,7 +24,8 @@
:group 'helm)
(defface helm-helper
- '((t :inherit helm-header))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit helm-header))
"Face for Helm help string in minibuffer."
:group 'helm-help)
@@ -55,7 +56,7 @@
;;;###autoload
(defun helm-documentation ()
- "Preconfigured Helm for Helm documentation.
+ "Preconfigured `helm' for Helm documentation.
With a prefix arg refresh the documentation.
Find here the documentation of all documented sources."
@@ -245,9 +246,8 @@ enabled by default to not confuse new users.
**** Navigate with arrow keys
-You can use <right> and <left> arrows to go down or up one level, to enable
+You can use <right> and <left> arrows to go down or up one level, to disable
this customize `helm-ff-lynx-style-map'.
-This is disabled by default.
Note that using `setq' will NOT work.
**** Use `\\<helm-find-files-map>\\[helm-execute-persistent-action]' (persistent action) on a directory to go down one level
@@ -260,16 +260,16 @@ On a symlinked directory a prefix argument expands to its true name.
`DEL' by default is deleting char backward.
-But when `helm-ff-DEL-up-one-level-maybe' is non nil `DEL' behave
-differently depending of helm-pattern contents, it go up one
-level if pattern is a directory endings with \"/\" or disable HFF
-auto update and delete char backward if pattern is a filename or
-refer to a non existing path. Going up one level can be disabled
-if necessary by deleting \"/\" at end of pattern using
+But when `helm-ff-DEL-up-one-level-maybe' is non nil `DEL' behaves
+differently depending on the contents of helm-pattern. It goes up one
+level if the pattern is a directory ending with \"/\" or disables HFF
+auto update and delete char backward if the pattern is a filename or
+refers to a non existing path. Going up one level can be disabled
+if necessary by deleting \"/\" at the end of the pattern using
\\<helm-map>\\[backward-char] and \\[helm-delete-minibuffer-contents].
Note that when deleting char backward, helm takes care of
-disabling update letting you the time to edit your pattern for
+disabling update giving you the opportunity to edit your pattern for
e.g. renaming a file or creating a new file or directory.
When `helm-ff-auto-update-initial-value' is non nil you may want to
disable it temporarily, see [[Toggle auto-completion with `C-c DEL'][Toggle auto-completion with `C-c DEL']] for this.
@@ -298,13 +298,6 @@ with `f1'.
Note that when copying, renaming, etc. from `helm-find-files' the
destination file is selected with `helm-read-file-name'.
-To avoid confusion when using `read-file-name' or `read-directory-name', `RET'
-follows its standard Emacs behaviour, i.e. it exits the minibuffer as soon as
-you press `RET'. If you want the same behavior as in `helm-find-files', bind
-`helm-ff-RET' to the `helm-read-file-map':
-
- (define-key helm-read-file-map (kbd \"RET\") 'helm-ff-RET)
-
**** `TAB' behavior
Normally `TAB' is bound to `helm-select-action' in helm-map which
@@ -470,6 +463,9 @@ session by default. Hitting `\\[next-history-element]' should just kick in the
locate search with this pattern. If you want Helm to automatically do this, add
`helm-source-locate' to `helm-sources-using-default-as-input'.
+NOTE: On Windows use Everything with its command line ~es~ as a replacement of locate.
+See [[https://github.com/emacs-helm/helm/wiki/Locate#windows][Locate on Windows]]
+
**** Recursive completion on subdirectories
Starting from the directory you are currently browsing, it is possible to have
@@ -479,8 +475,6 @@ you want to go to \"/home/you/foo/bar/baz/somewhere/else\", simply type
the final \"/\". Helm will then list all possible directories under \"foo\"
matching \"else\".
-Entering two spaces before \"else\" instead of two dots also works.
-
Note: Completion on subdirectories uses \"locate\" as backend, you can configure
the command with `helm-locate-recursive-dirs-command'. Because this completion
uses an index, the directory tree displayed may be out-of-date and not reflect
@@ -545,6 +539,19 @@ a named extension recursively you would write \"**.el\" whereas in Bash it would
be \"**/*.el\". Directory selection with \"**/\" like Bash \"shopt globstar\"
option is not supported yet.
+Helm supports different styles of wildcards:
+
+- `sh' style, the ones supported by `file-expand-wildcards'.
+e.g. \"*.el\", \"*.[ch]\" which match respectively all \".el\"
+files or all \".c\" and \".h\" files.
+
+- `bash' style (partially) In addition to what allowed in `sh'
+style you can specify file extensions that have more than one
+character like this: \"*.{sh,py}\" which match \".sh\" and
+\".py\" files.
+
+Of course in both styles you can specify one or two \"*\".
+
*** Query replace regexp on filenames
Replace different parts of a file basename with something else.
@@ -588,8 +595,7 @@ are available as`%u', `%d' and `%c' respectively.
Use the `helm-file-globstar' feature described in [[Use the wildcard to select multiple files][recursive globbing]]
by entering \"**.JPG\" at the end of the Helm-find-files pattern, then hit
-\\<helm-map>\\[helm-ff-query-replace-on-filenames]: First \"JPG\", then \"jpg\"
-and hit `RET'.
+\\<helm-find-files-map>\\[helm-ff-run-query-replace-fnames-on-marked] and enter \"JPG\" on first prompt, then \"jpg\" on second prompt and hit `RET'.
Alternatively you can enter \".%\" at the first prompt, then \"jpg\" and hit
`RET'. Note that when using this instead of using \"JPG\" at the first prompt,
@@ -715,6 +721,18 @@ You can customize `helm-dwim-target' to behave differently depending on the
windows open in the current frame. Default is to provide completion on all
directories associated to each window.
+*** Copying/Renaming from or to remote directories
+
+Never use ssh tramp method to copy/rename large files, use
+instead its scp method if you want to avoid out of memory
+problems and crash Emacs or the whole system. Moreover when using
+scp method, you will hit a bug when copying more than 3 files at
+the time, see [[https://github.com/emacs-helm/helm/issues/1945][bug#1945]].
+The best way actually is using Rsync to copy files from or to
+remote, see [[Use Rsync to copy files][Use Rsync to copy files]].
+Also if you often work on remote you may consider using SSHFS
+instead of relying on tramp.
+
*** Copying and renaming asynchronously
If you have the async library installed (if you got Helm from MELPA you do), you
@@ -728,6 +746,38 @@ When `dired-async-mode' is enabled, an additional action named \"Backup files\"
will be available. (Such command is not natively available in Emacs).
See [[Use the wildcard to select multiple files]] for details.
+*** Use Rsync to copy files
+
+If Rsync is available, you can use it to copy/sync files or directories
+with some restrictions though:
+
+- Copying from/to tramp sudo method may not work (permissions).
+- Copying from remote to remote is not supported (rsync restriction).
+
+This command is mostly useful when copying large files as it is
+fast, asynchronous and provide a progress bar in mode-line. Each
+rsync process have its own progress bar, so you can run several
+rsync jobs, they are independents. If rsync fails you can
+consult the \"*helm-rsync<n>*\" buffer to see rsync errors. An
+help-echo (move mouse over progress bar) is provided to see which
+file is in transfer. Note that when copying directories, no
+trailing slashes are added to directory names, which mean that
+directory is created on destination if it doesn't already exists,
+see rsync documentation for more infos on rsync behavior. To
+synchronize a directory, mark all in the directory and rsync all
+marked to the destination directory or rsync the directory itself
+to its parent, e.g. remote:/home/you/music => /home/you.
+
+The options are configurable through `helm-rsync-switches', but
+you can modify them on the fly when needed by using a prefix arg,
+in this case you will be prompted for modifications.
+
+NOTE: When selecting a remote file, if you use the tramp syntax
+for specifying a port, i.e. host#2222, helm will add
+automatically \"-e 'ssh -p 2222'\" to the rsync command line
+unless you have specified yourself the \"-e\" option by editing
+rsync command line with a prefix arg (see above).
+
*** Bookmark the `helm-find-files' session
You can bookmark the `helm-find-files' session with `\\[helm-ff-bookmark-set]'.
@@ -765,6 +815,11 @@ To toggle suspend-update, use `\\<helm-map>\\[helm-toggle-suspend-update]'.
Setting up aliases in Eshell allows you to set up powerful customized commands.
+Your aliases for using eshell command on file should allow
+specifying one or more files, use e.g. \"alias foo $1\" or
+\"alias foo $*\", if you want your command to be asynchronous add
+at end \"&\", e.g. \"alias foo $* &\".
+
Adding Eshell aliases to your `eshell-aliases-file' or using the
`alias' command from Eshell allows you to create personalized
commands not available in `helm-find-files' actions and use them
@@ -998,6 +1053,20 @@ Helm-find-files can ignore files matching
`helm-boring-file-regexp-list' or files that are git ignored, you
can set this with `helm-ff-skip-boring-files' or
`helm-ff-skip-git-ignored-files'.
+NOTE: This will slow down helm, be warned.
+
+*** Helm-find-files is using a cache
+
+Helm is caching each directory files list in a hash table for
+faster search. What is kept in the cache is defined by
+`helm-ff-keep-cached-candidates' variable. By default HFF keep
+all in the cache between its sessions but you can customize
+`helm-ff-keep-cached-candidates', do not use setq for this. When
+`helm-ff-keep-cached-candidates' is non nil HFF refreshes the
+cache automatically between its sessions when Emacs is idle, you
+should see a little icon brievly changing color when the cache is
+refreshed. You can also refresh a directory at anytime during
+your HFF sessions by hitting \\<helm-map>\\[helm-refresh].
** Commands
\\<helm-find-files-map>
@@ -1014,6 +1083,7 @@ can set this with `helm-ff-skip-boring-files' or
\\[helm-ff-run-rename-file]\t\tRename Files (`\\[universal-argument]' to follow).
\\[helm-ff-run-query-replace-fnames-on-marked]\t\tQuery replace on marked files.
\\[helm-ff-run-copy-file]\t\tCopy Files (`\\[universal-argument]' to follow).
+\\[helm-ff-run-rsync-file]\t\tRsync Files (`\\[universal-argument]' to edit command).
\\[helm-ff-run-byte-compile-file]\t\tByte Compile Files (`\\[universal-argument]' to load).
\\[helm-ff-run-load-file]\t\tLoad Files.
\\[helm-ff-run-symlink-file]\t\tSymlink Files.
@@ -1190,9 +1260,12 @@ search will be performed on basename only for efficiency (so don't add \"-b\" at
prompt). As soon as you separate the patterns with spaces, fuzzy matching will
be disabled and search will be done on the full filename. Note that in
multi-match, fuzzy is completely disabled, which means that each pattern is a
-match regexp (i.e. \"helm\" will match \"helm\" but \"hlm\" will \*not* match
+match regexp (i.e. \"helm\" will match \"helm\" but \"hlm\" will *not* match
\"helm\").
+NOTE: On Windows use Everything with its command line ~es~ as a replacement of locate.
+See [[https://github.com/emacs-helm/helm/wiki/Locate#windows][Locate on Windows]]
+
*** Browse project
When the current directory is not under version control, don't forget to refresh
@@ -1243,21 +1316,42 @@ than 1 megabyte:
** Tips
-*** Use a prefix argument to grep recursively
+With Helm supporting Git-grep and AG/RG, you are better off using
+one of them for recursive searches, keeping grep or ack-grep to
+grep individual or marked files. See [[Helm AG][Helm AG]].
-With Helm supporting git-grep and AG however, you are better off using one of
-them for recursive searches.
+*** Meaning of the prefix argument
+**** With grep or ack-grep
+
+Grep recursively, in this case you are
+prompted for types (ack-grep) or for wild cards (grep).
+
+**** With AG or RG
+
+the prefix arg allows you to specify a type of file to search in.
*** You can use wild cards when selecting files (e.g. \"*.el\")
-*** You can grep in many different directories by marking files or using wild cards
+Note that a way to grep specific files recursively is to use
+e.g. \"**.el\" to select files, the variable `helm-file-globstar'
+controls this (it is non nil by default), however it is much
+slower than using grep recusively (see helm-find-files
+documentation about this feature).
+
+*** Grep hidden files
+
+You may want to customize your command line for grepping hidden
+files, for AG/RG use \"--hidden\", see man page
+of your backend for more infos.
+
+*** You can grep in different directories by marking files or using wild cards
*** You can save the result in a `helm-grep-mode' buffer
See [[Commands][commands]] below.
-Once in that buffer you can use \"emacs-wgrep\" (external package not bundled with Helm)
-to edit your changes.
+Once in that buffer you can use [[https://github.com/mhayashi1120/Emacs-wgrep][emacs-wgrep]] (external package not bundled with Helm)
+to edit your changes, for Helm the package name is `wgrep-helm', it is hightly recommended.
*** Helm-grep supports multi-matching
@@ -1265,10 +1359,15 @@ to edit your changes.
Simply add a space between each pattern as for most Helm commands.
+NOTE: Depending the regexp you use it may match as well the
+filename, this because we pipe the first grep command which send
+the filename in output.
+
*** See full path of selected candidate
-Add (helm-popup-tip-mode 1) in your init file or enable it interactively with
-M-x helm-popup-tip-mode.
+Add (helm-popup-tip-mode 1) in your init file or enable it
+interactively with M-x helm-popup-tip-mode, however it is
+generally enough to just put your mouse cursor over candidate.
*** Open file in other window
@@ -1291,6 +1390,9 @@ SSHFS.
* Helm GID
+Still supported, but mostly deprecated, using AG/RG or Git-grep
+is much more efficient, also `id-utils' seems no more maintained.
+
** Tips
Helm-GID reads the database created with the `mkid' command from id-utils.
@@ -1308,11 +1410,15 @@ highlighted since there is no ~--color~-like option in GID itself.
** Tips
-Helm-AG is different from grep or ack-grep in that it works on a directory and
-not on a list of files.
+Helm-AG is different from grep or ack-grep in that it works on a
+directory recursively and not on a list of files. It is called
+helm-AG but it support several backend, namely AG, RG and PT.
+Nowaday the best backend is Ripgrep aka RG, it is the fastest and
+is actively maintained, see `helm-grep-ag-command' and
+`helm-grep-ag-pipe-cmd-switches' to configure it.
You can ignore files and directories with a \".agignore\" file, local to a
-directory or global when placed in the home directory. \(See the AG man page for
+directory or global when placed in the home directory. (See the AG man page for
more details.) That file follows the same syntax as `helm-grep-ignored-files'
and `helm-grep-ignored-directories'.
@@ -1321,7 +1427,8 @@ As always you can access Helm AG from `helm-find-files'.
Starting with version 0.30, AG accepts one or more TYPE arguments on its command
line. Helm provides completion on these TYPE arguments when available with your
AG version. Use a prefix argument when starting a Helm-AG session to enable this
-completion.
+completion. See RG and AG man pages on how to add new types.
+
Note: You can mark several types to match in the AG query. The first AG
versions providing this feature allowed only one type, so in this case only the
@@ -1329,7 +1436,7 @@ last mark will be used.
* Helm git-grep
-Helm-git-grep searches the current directory, i.e the default directory or the
+Helm-git-grep searches the current directory, i.e. the default directory or the
directory in Helm-find-files. If this current directory is a subdirectory of a
project and you want to also match parent directories (i.e the whole project),
use a prefix argument.
@@ -1471,6 +1578,16 @@ the command is called once for each file like this:
<command> file2
...
+*** Run eshell commands asynchronously
+
+You can run your commands asynchronously by adding \"&\" at end
+of any commands, e.g. \"foo %s &\". You can also directly setup
+your alias in the eshell alias file with e.g. \"alias foo $1 &\".
+
+NOTE: If you use \"&\" in a command with marked files and your
+command accept many files as argument don't forget to pass the
+prefix arg to ensure you run only one command on all marked async.
+
** Commands
\\<helm-esh-on-file-map>")
@@ -1668,7 +1785,12 @@ command you want to execute before specifying prefix arg.
*** Completion styles in helm-M-x
By default helm-M-x use 'helm completion style, if you want to enable fuzzy matching aka flex,
-see [[Completion-styles][Completion-styles]].")
+see [[Completion-styles][Completion-styles]].
+
+*** Duplicate entries in helm-M-x history
+
+helm-M-x history obey to history variables, if you have
+duplicates in your helm-M-x history set `history-delete-duplicates' to non nil.")
;;; Helm imenu
;;
diff --git a/helm-id-utils.el b/helm-id-utils.el
index 8752fd55..cdd79766 100644
--- a/helm-id-utils.el
+++ b/helm-id-utils.el
@@ -28,7 +28,7 @@
"Name of gid command (usually `gid').
For Mac OS X users, if you install GNU coreutils, the name `gid'
might be occupied by `id' from GNU coreutils, and you should set
-it to correct name (or absolute path), for example, if using
+it to correct name (or absolute path). For example, if using
MacPorts to install id-utils, it should be `gid32'."
:group 'helm-id-utils
:type 'file)
@@ -101,10 +101,10 @@ MacPorts to install id-utils, it should be `gid32'."
;;;###autoload
(defun helm-gid ()
- "Preconfigured helm for `gid' command line of `ID-Utils'.
-Need A database created with the command `mkid'
-above `default-directory'.
-Need id-utils as dependency which provide `mkid', `gid' etc...
+ "Preconfigured `helm' for `gid' command line of `ID-Utils'.
+Need A database created with the command `mkid' above
+`default-directory'.
+Need id-utils as dependency which provide `mkid', `gid' etc..
See <https://www.gnu.org/software/idutils/>."
(interactive)
(let* ((db (locate-dominating-file
diff --git a/helm-imenu.el b/helm-imenu.el
index d680c35e..ba1b9cef 100644
--- a/helm-imenu.el
+++ b/helm-imenu.el
@@ -28,11 +28,11 @@
(defgroup helm-imenu nil
- "Imenu related libraries and applications for helm."
+ "Imenu related libraries and applications for Helm."
:group 'helm)
(defcustom helm-imenu-delimiter " / "
- "Delimit types of candidates and his value in `helm-buffer'."
+ "Delimit types of candidates and their value in `helm-buffer'."
:group 'helm-imenu
:type 'string)
@@ -44,9 +44,9 @@
(defcustom helm-imenu-all-buffer-assoc nil
"Major mode association alist for `helm-imenu-in-all-buffers'.
-Allow `helm-imenu-in-all-buffers' searching in these associated buffers
-even if they are not derived from each other.
-The alist is bidirectional, i.e no need to add '((foo . bar) (bar . foo))
+Allow `helm-imenu-in-all-buffers' searching in these associated
+buffers even if they are not derived from each other. The alist
+is bidirectional, i.e. no need to add '((foo . bar) (bar . foo)),
only '((foo . bar)) is needed."
:type '(alist :key-type symbol :value-type symbol)
:group 'helm-imenu)
@@ -58,9 +58,10 @@ When nil all candidates are displayed in a single source.
NOTE: Each source will have as name \"Imenu <buffer-name>\".
`helm-source-imenu-all' will not be set, however it will continue
-to be used as a flag for using default as input, if you do not want
-this behavior, remove it from `helm-sources-using-default-as-input'
-even if not using a single source to display imenu in all buffers."
+to be used as a flag for using default as input. If you do not
+want this behavior, remove it from
+`helm-sources-using-default-as-input' even if not using a single
+source to display imenu in all buffers."
:type 'boolean
:group 'helm-imenu)
@@ -69,9 +70,10 @@ even if not using a single source to display imenu in all buffers."
("^\\(Function\\|Functions\\|Defuns\\)$" . font-lock-function-name-face)
("^\\(Types\\|Provides\\|Requires\\|Classes\\|Class\\|Includes\\|Imports\\|Misc\\|Code\\)$" . font-lock-type-face))
"Faces for showing type in helm-imenu.
-This is a list of cons cells. The cdr of each cell is a face to be used,
-and it can also just be like \\='(:foreground \"yellow\").
-Each car is a regexp match pattern of the imenu type string."
+This is a list of cons cells. The cdr of each cell is a face to
+be used, and it can also just be like \\='(:foreground
+\"yellow\"). Each car is a regexp match pattern of the imenu type
+string."
:group 'helm-faces
:type '(repeat
(cons
@@ -79,7 +81,7 @@ Each car is a regexp match pattern of the imenu type string."
(sexp :tag "Face"))))
(defcustom helm-imenu-extra-modes nil
- "Extra modes where helm-imenu-in-all-buffers should look into."
+ "Extra modes where `helm-imenu-in-all-buffers' should look into."
:group 'helm-imenu
:type '(repeat symbol))
@@ -331,9 +333,10 @@ Each car is a regexp match pattern of the imenu type string."
;;;###autoload
(defun helm-imenu-in-all-buffers ()
- "Preconfigured helm for fetching imenu entries in all buffers with similar mode as current.
-A mode is similar as current if it is the same, it is derived i.e `derived-mode-p'
-or it have an association in `helm-imenu-all-buffer-assoc'."
+ "Preconfigured `helm' for fetching imenu entries in all buffers with similar mode as current.
+A mode is similar as current if it is the same, it is derived
+i.e. `derived-mode-p' or it have an association in
+`helm-imenu-all-buffer-assoc'."
(interactive)
(require 'which-func)
(unless helm-imenu-in-all-buffers-separate-sources
diff --git a/helm-info.el b/helm-info.el
index c484ab6c..03082ad3 100644
--- a/helm-info.el
+++ b/helm-info.el
@@ -106,7 +106,7 @@ files with `helm-info-at-point'."
:info-file ,fname ,@args))
(defun helm-build-info-index-command (name doc source buffer)
- "Define a helm command NAME with documentation DOC.
+ "Define a Helm command NAME with documentation DOC.
Arg SOURCE will be an existing helm source named
`helm-source-info-<NAME>' and BUFFER a string buffer name."
(defalias (intern (concat "helm-info-" name))
@@ -118,9 +118,11 @@ Arg SOURCE will be an existing helm source named
doc))
(defun helm-define-info-index-sources (var-value &optional commands)
- "Define helm sources named helm-source-info-<NAME>.
-Sources are generated for all entries of `helm-default-info-index-list'.
-If COMMANDS arg is non-nil, also build commands named `helm-info-<NAME>'.
+ "Define Helm sources named helm-source-info-<NAME>.
+Sources are generated for all entries of
+`helm-default-info-index-list'.
+If COMMANDS arg is non-nil, also build commands named
+`helm-info-<NAME>'.
Where NAME is an element of `helm-default-info-index-list'."
(cl-loop for str in var-value
for sym = (intern (concat "helm-source-info-" str))
@@ -146,7 +148,7 @@ Where NAME is an element of `helm-default-info-index-list'."
"Return list of Info files to use for `helm-info'.
Elements of the list are strings of Info file names without
-extensions (e.g. \"emacs\" for file \"emacs.info.gz\"). Info
+extensions (e.g., \"emacs\" for file \"emacs.info.gz\"). Info
files are found by searching directories in
`Info-directory-list'."
(info-initialize) ; Build Info-directory-list from INFOPATH (Issue #2118)
@@ -176,7 +178,7 @@ helm-info-<CANDIDATE>."
(ring-insert helm-info-searched candidate))))
(defun helm-def-source--info-files ()
- "Return a `helm' source for Info files."
+ "Return a Helm source for Info files."
(helm-build-sync-source "Helm Info"
:candidates
(lambda () (copy-sequence helm-default-info-index-list))
@@ -191,12 +193,13 @@ helm-info-<CANDIDATE>."
(defun helm-info (&optional refresh)
"Preconfigured `helm' for searching Info files' indices.
-With a prefix argument \\[universal-argument], set REFRESH to non-nil.
+With a prefix argument \\[universal-argument], set REFRESH to
+non-nil.
-Optional parameter REFRESH, when non-nil, reevaluates
+Optional parameter REFRESH, when non-nil, re-evaluates
`helm-default-info-index-list'. If the variable has been
customized, set it to its saved value. If not, set it to its
-standard value. See `custom-reevaluate-setting' for more.
+standard value. See `custom-reevaluate-setting' for more.
REFRESH is useful when new Info files are installed. If
`helm-default-info-index-list' has not been customized, the new
diff --git a/helm-lib.el b/helm-lib.el
index 2c55e2c3..a89fea3e 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -63,7 +63,8 @@
;;
(defcustom helm-file-globstar t
"Same as globstar bash shopt option.
-When non--nil a pattern beginning with two stars will expand recursively.
+When non-nil a pattern beginning with two stars will expand
+recursively.
Directories expansion is not supported yet."
:group 'helm
:type 'boolean)
@@ -72,8 +73,8 @@ Directories expansion is not supported yet."
"The function used to forward point with `helm-yank-text-at-point'.
With a nil value, fallback to default `forward-word'.
The function should take one arg, an integer like `forward-word'.
-NOTE: Using `forward-symbol' here is not very useful as it is already
-provided by \\<helm-map>\\[next-history-element]."
+NOTE: Using `forward-symbol' here is not very useful as it is
+already provided by \\<helm-map>\\[next-history-element]."
:type 'function
:group 'helm)
@@ -89,9 +90,9 @@ If you prefer scrolling line by line, set this value to 1."
(defcustom helm-help-full-frame t
"Display help window in full frame when non nil.
-Even when `nil' probably the same result (full frame)
-can be reach by tweaking `display-buffer-alist' but it is
-much more convenient to use a simple boolean value here."
+Even when nil probably the same result (full frame) can be
+reached by tweaking `display-buffer-alist', but it is much more
+convenient to use a simple boolean value here."
:type 'boolean
:group 'helm-help)
@@ -120,15 +121,16 @@ much more convenient to use a simple boolean value here."
"A list of regexps matching boring files.
This list is build by default on `completion-ignored-extensions'.
-The directory names should end with \"/?\" e.g. \"\\.git/?\" and the
-file names should end with \"$\" e.g. \"\\.o$\".
+The directory names should end with \"/?\" e.g. \"\\.git/?\" and
+the file names should end with \"$\" e.g. \"\\.o$\".
-These regexps may be used to match the entire path, not just the file
-name, so for example to ignore files with a prefix \".bak.\", use
-\"\\.bak\\..*$\" as the regexp.
+These regexps may be used to match the entire path, not just the
+file name, so for example to ignore files with a prefix
+\".bak.\", use \"\\.bak\\..*$\" as the regexp.
-NOTE: When modifying this, be sure to use customize interface or the
-customize functions e.g. `customize-set-variable' and NOT `setq'."
+NOTE: When modifying this, be sure to use customize interface or
+the customize functions e.g. `customize-set-variable' and NOT
+`setq'."
:group 'helm-files
:type '(repeat (choice regexp))
:set 'helm-ff--setup-boring-regex)
@@ -162,9 +164,10 @@ customize functions e.g. `customize-set-variable' and NOT `setq'."
;;
(defun helm-add-face-text-properties (beg end face &optional append object)
"Add the face property to the text from START to END.
-It is a compatibility function which behave exactly like
-`add-face-text-property' if available otherwise like `add-text-properties'.
-When only `add-text-properties' is available APPEND is ignored."
+It is a compatibility function which behaves exactly like
+`add-face-text-property' if available, otherwise like
+`add-text-properties'. When only `add-text-properties' is
+available APPEND is ignored."
(if (fboundp 'add-face-text-property)
(add-face-text-property beg end face append object)
(add-text-properties beg end `(face ,face) object)))
@@ -331,7 +334,7 @@ When only `add-text-properties' is available APPEND is ignored."
nil)
(defcustom helm-advice-push-mark t
- "Override `push-mark' with a version avoiding duplicates when non nil."
+ "Override `push-mark' with a version avoiding duplicates when non-nil."
:group 'helm
:type 'boolean
:set (lambda (var val)
@@ -368,9 +371,9 @@ When only `add-text-properties' is available APPEND is ignored."
;;; Command loop helper
;;
(defun helm-this-command ()
- "Returns the actual command in action.
-Like `this-command' but return the real command,
-and not `exit-minibuffer' or other unwanted functions."
+ "Return the actual command in action.
+Like `this-command' but return the real command, and not
+`exit-minibuffer' or other unwanted functions."
(cl-loop with bl = '(helm-maybe-exit-minibuffer
helm-confirm-and-exit-minibuffer
helm-exit-minibuffer
@@ -400,7 +403,7 @@ and not `exit-minibuffer' or other unwanted functions."
Returns ITEM first occurence position found in SEQ.
When SEQ is a string, ITEM have to be specified as a char.
Argument TEST when unspecified default to `eq'.
-When argument ALL is non--nil return a list of all ITEM positions
+When argument ALL is non-nil return a list of all ITEM positions
found in SEQ."
(let ((key (if (stringp seq) 'across 'in)))
`(cl-loop with deftest = 'eq
@@ -444,18 +447,19 @@ found in SEQ."
;;
(defmacro helm-aif (test-form then-form &rest else-forms)
"Anaphoric version of `if'.
-Like `if' but set the result of TEST-FORM in a temporary variable called `it'.
-THEN-FORM and ELSE-FORMS are then excuted just like in `if'."
+Like `if' but set the result of TEST-FORM in a temporary variable
+called `it'. THEN-FORM and ELSE-FORMS are then excuted just like
+in `if'."
(declare (indent 2) (debug t))
`(let ((it ,test-form))
(if it ,then-form ,@else-forms)))
(defmacro helm-awhile (sexp &rest body)
"Anaphoric version of `while'.
-Same usage as `while' except that SEXP is bound to
-a temporary variable called `it' at each turn.
-An implicit nil block is bound to the loop so usage
-of `cl-return' is possible to exit the loop."
+Same usage as `while' except that SEXP is bound to a temporary
+variable called `it' at each turn.
+An implicit nil block is bound to the loop so usage of
+`cl-return' is possible to exit the loop."
(declare (indent 1) (debug t))
(helm-with-gensyms (flag)
`(let ((,flag t))
@@ -467,10 +471,10 @@ of `cl-return' is possible to exit the loop."
(defmacro helm-acond (&rest clauses)
"Anaphoric version of `cond'.
-In each clause of CLAUSES, the result of the car of clause
-is stored in a temporary variable called `it' and usable in the cdr
-of this same clause. Each `it' variable is independent of its clause.
-The usage is the same as `cond'."
+In each clause of CLAUSES, the result of the car of clause is
+stored in a temporary variable called `it' and usable in the cdr
+of this same clause. Each `it' variable is independent of its
+clause. The usage is the same as `cond'."
(declare (debug cond))
(unless (null clauses)
(helm-with-gensyms (sym)
@@ -484,8 +488,8 @@ The usage is the same as `cond'."
(defmacro helm-aand (&rest conditions)
"Anaphoric version of `and'.
-Each condition is bound to a temporary variable called `it' which is
-usable in next condition."
+Each condition is bound to a temporary variable called `it' which
+is usable in next condition."
(declare (debug (&rest form)))
(cond ((null conditions) t)
((null (cdr conditions)) (car conditions))
@@ -494,8 +498,8 @@ usable in next condition."
(defmacro helm-acase (expr &rest clauses)
"A simple anaphoric `cl-case' implementation handling strings.
-EXPR is bound to a temporary variable called `it' which is usable in
-CLAUSES to refer to EXPR.
+EXPR is bound to a temporary variable called `it' which is usable
+in CLAUSES to refer to EXPR.
NOTE: Duplicate keys in CLAUSES are deliberately not handled.
\(fn EXPR (KEYLIST BODY...)...)"
@@ -514,10 +518,10 @@ NOTE: Duplicate keys in CLAUSES are deliberately not handled.
;;
(defsubst helm--mapconcat-pattern (pattern)
"Transform string PATTERN in regexp for further fuzzy matching.
-e.g helm.el$
- => \"[^h]*h[^e]*e[^l]*l[^m]*m[^.]*[.][^e]*e[^l]*l$\"
- ^helm.el$
- => \"helm[.]el$\"."
+E.g.: helm.el$
+ => \"[^h]*h[^e]*e[^l]*l[^m]*m[^.]*[.][^e]*e[^l]*l$\"
+ ^helm.el$
+ => \"helm[.]el$\"."
(let ((ls (split-string-and-unquote pattern "")))
(if (string= "^" (car ls))
;; Exact match.
@@ -541,13 +545,13 @@ e.g helm.el$
;;; Help routines.
;;
(defvar helm-help-mode-before-hook nil
- "A hook that run before helm-help starts.")
+ "A hook that runs before helm-help starts.")
(defvar helm-help-mode-after-hook nil
- "A hook that run when helm-help exits.")
+ "A hook that runs when helm-help exits.")
(defun helm-help-internal (bufname insert-content-fn)
- "Show long message during `helm' session in BUFNAME.
-INSERT-CONTENT-FN is the function that insert
-text to be displayed in BUFNAME."
+ "Show long message during Helm session in BUFNAME.
+INSERT-CONTENT-FN is the function that inserts text to be
+displayed in BUFNAME."
(let ((winconf (current-frame-configuration))
(hframe (selected-frame)))
(helm-log-run-hook 'helm-help-mode-before-hook)
@@ -646,10 +650,13 @@ text to be displayed in BUFNAME."
(defun helm-multiline-transformer (candidates _source)
(cl-loop with offset = (helm-interpret-value
(assoc-default 'multiline (helm-get-current-source)))
- for i in candidates
+ for cand in candidates
+ for disp = (or (car-safe cand) cand)
+ for real = (or (cdr-safe cand) cand)
if (numberp offset)
- collect (cons (helm--multiline-get-truncated-candidate i offset) i)
- else collect i))
+ collect (cons (helm--multiline-get-truncated-candidate disp offset)
+ real)
+ else collect (cons disp real)))
(defun helm--multiline-get-truncated-candidate (candidate offset)
"Truncate CANDIDATE when its length is > than OFFSET."
@@ -704,12 +711,13 @@ This is same as `remove-duplicates' but with memoisation.
It is much faster, especially in large lists.
A test function can be provided with TEST argument key.
Default is `eq'.
-NOTE: Comparison of special elisp objects (e.g. markers etc...) fails
-because their printed representations which are stored in hash-table
-can't be compared with with the real object in SEQ.
-This is a bug in `puthash' which store the printable representation of
-object instead of storing the object itself, this to provide at the
-end a printable representation of hashtable itself."
+NOTE: Comparison of special Elisp objects (e.g., markers etc.)
+fails because their printed representations which are stored in
+hash-table can't be compared with with the real object in SEQ.
+This is a bug in `puthash' which store the printable
+representation of object instead of storing the object itself,
+this to provide at the end a printable representation of
+hashtable itself."
(cl-loop with cont = (make-hash-table :test test)
for elm in seq
unless (gethash elm cont)
@@ -726,7 +734,7 @@ end a printable representation of hashtable itself."
"\\`\\'")) ; Match nothing
(defun helm-skip-entries (seq black-regexp-list &optional white-regexp-list)
- "Remove entries which matches one of REGEXP-LIST from SEQ."
+ "Remove entries which match one of REGEXP-LIST from SEQ."
(let ((black-regexp (helm--concat-regexps black-regexp-list))
(white-regexp (helm--concat-regexps white-regexp-list)))
(cl-loop for i in seq
@@ -737,10 +745,13 @@ end a printable representation of hashtable itself."
collect i)))
(defun helm-boring-directory-p (directory black-list)
- "Check if one regexp in BLACK-LIST match DIRECTORY."
+ "Check if one regexp in BLACK-LIST matches DIRECTORY."
(helm-awhile (helm-basedir (directory-file-name
(expand-file-name directory)))
- (when (string= it "/") (cl-return nil))
+ ;; Break at root to avoid infloop, root is / or on Windows
+ ;; C:/ i.e. <volume>:/ (issue #2308).
+ (when (string-match-p "\\`[A-Za-z]?:?/\\'" it)
+ (cl-return nil))
(when (cl-loop for r in black-list
thereis (string-match-p
r (directory-file-name directory)))
@@ -816,8 +827,8 @@ It is used for narrowing list of candidates to the
(defun helm-source-by-name (name &optional sources)
"Get a Helm source in SOURCES by NAME.
-Optional argument SOURCES is a list of Helm sources which default to
-`helm-sources'."
+Optional argument SOURCES is a list of Helm sources which default
+to `helm-sources'."
(cl-loop with src-list = (if sources
(cl-loop for src in sources
collect (if (listp src)
@@ -829,8 +840,8 @@ Optional argument SOURCES is a list of Helm sources which default to
(defun helm-make-actions (&rest args)
"Build an alist with (NAME . ACTION) elements with each pairs in ARGS.
-Where NAME is a string or a function returning a string or nil and ACTION
-a function.
+Where NAME is a string or a function returning a string or nil
+and ACTION a function.
If NAME returns nil the pair is skipped.
\(fn NAME ACTION ...)"
@@ -863,7 +874,8 @@ Handle multibyte characters by moving by columns."
"Truncate string STR to end at column WIDTH.
Similar to `truncate-string-to-width'.
Add ENDSTR at end of truncated STR.
-Add spaces at end if needed to reach WIDTH when STR is shorter than WIDTH."
+Add spaces at end if needed to reach WIDTH when STR is shorter
+than WIDTH."
(cl-loop for ini-str = str
then (substring ini-str 0 (1- (length ini-str)))
for sw = (string-width ini-str)
@@ -911,7 +923,7 @@ Add spaces at end if needed to reach WIDTH when STR is shorter than WIDTH."
Same as `replace-regexp-in-string' but handle properly REP as
function with SUBEXP specified.
-e.g
+E.g.:
(helm--replace-regexp-in-buffer-string \"e\\\\(m\\\\)acs\" 'upcase \"emacs\" t nil 1)
=> \"eMacs\"
@@ -919,10 +931,10 @@ e.g
(replace-regexp-in-string \"e\\\\(m\\\\)acs\" 'upcase \"emacs\" t nil 1)
=> \"eEMACSacs\"
-Also START argument behave as expected unlike
+Also START argument behaves as expected unlike
`replace-regexp-in-string'.
-e.g
+E.g.:
(helm--replace-regexp-in-buffer-string \"f\" \"r\" \"foofoo\" t nil nil 3)
=> \"fooroo\"
@@ -931,14 +943,14 @@ e.g
=> \"roo\"
Unlike `replace-regexp-in-string' this function is buffer-based
-implemented i.e replacement is computed inside a temp buffer, so
+implemented i.e. replacement is computed inside a temp buffer, so
REGEXP should be used differently than with
`replace-regexp-in-string'.
NOTE: This function is used internally for
`helm-ff-query-replace-on-filenames' and builded for this.
-You should use `replace-regexp-in-string' instead unless the behavior
-of this function is really needed."
+You should use `replace-regexp-in-string' instead unless the
+behaviour of this function is really needed."
(with-temp-buffer
(insert str)
(goto-char (or start (point-min)))
@@ -969,7 +981,7 @@ of this function is really needed."
"Prompt user for an answer.
Arg PROMPT is the prompt to present user the different possible
answers, ANSWER-LIST is a list of strings.
-If user enter an answer which is one of ANSWER-LIST return this
+If user enters an answer which is one of ANSWER-LIST return this
answer, otherwise keep prompting for a valid answer.
Note that answer should be a single char, only short answer are
accepted.
@@ -986,12 +998,12 @@ Example:
(\"q\" \"quit\")))
"
- (helm-awhile (string
- (read-key (propertize prompt 'face 'minibuffer-prompt)))
- (if (member it answer-list)
- (cl-return it)
- (message "Please answer by %s" (mapconcat 'identity answer-list ", "))
- (sit-for 1))))
+ (helm-awhile (read-key (propertize prompt 'face 'minibuffer-prompt))
+ (let ((str (and (characterp it) (string it))))
+ (if (and str (member str answer-list))
+ (cl-return str)
+ (message "Please answer by %s" (mapconcat 'identity answer-list ", "))
+ (sit-for 1)))))
;;; Symbols routines
;;
@@ -1036,8 +1048,9 @@ Example:
(defun helm-elisp--persistent-help (candidate fun &optional name)
"Used to build persistent actions describing CANDIDATE with FUN.
-Argument NAME is used internally to know which command to use when
-symbol CANDIDATE refers at the same time to variable and a function.
+Argument NAME is used internally to know which command to use
+when symbol CANDIDATE refers at the same time to a variable and a
+function.
See `helm-elisp-show-help'."
(let ((hbuf (get-buffer (help-buffer))))
(cond ((helm-follow-mode-p)
@@ -1142,12 +1155,12 @@ Argument ALIST is an alist of associated major modes."
it)))
(defun helm-basename (fname &optional ext)
- "Print FNAME with any leading directory components removed.
+ "Print FNAME with any leading directory components removed.
If specified, also remove filename extension EXT.
-Arg EXT can be specified as a string with or without dot,
-in this case it should match file-name-extension.
-It can also be non-nil (`t') in this case no checking
-of file-name-extension is done and the extension is removed
+Arg EXT can be specified as a string with or without dot, in this
+case it should match `file-name-extension'.
+It can also be non-nil (t) in this case no checking of
+`file-name-extension' is done and the extension is removed
unconditionally."
(let ((non-essential t))
(if (and ext (or (string= (file-name-extension fname) ext)
@@ -1227,20 +1240,22 @@ other candidate transformers."
noerror)
"Walk through DIRECTORY tree.
-Argument PATH can be one of basename, relative, full, or a function
-called on file name, default to basename.
+Argument PATH can be one of basename, relative, full, or a
+function called on file name, default to basename.
-Argument DIRECTORIES when `t' return also directories names,
+Argument DIRECTORIES when t return also directories names,
otherwise skip directories names, with a value of `only' returns
-only subdirectories, i.e files are skipped.
+only subdirectories, i.e. files are skipped.
Argument MATCH is a regexp matching files or directories.
-Argument SKIP-SUBDIRS when `t' will skip `helm-walk-ignore-directories'
-otherwise if it is given as a list of directories, this list will be used
-instead of `helm-walk-ignore-directories'.
+Argument SKIP-SUBDIRS when t will skip
+`helm-walk-ignore-directories', otherwise if it is given as a
+list of directories, this list will be used instead of
+`helm-walk-ignore-directories'.
-Argument NOERROR when `t' will skip directories which are not accessible."
+Argument NOERROR when t will skip directories which are not
+accessible."
(let ((fn (cl-case path
(basename 'file-name-nondirectory)
(relative 'file-relative-name)
@@ -1278,7 +1293,7 @@ Argument NOERROR when `t' will skip directories which are not accessible."
(defun helm-file-expand-wildcards (pattern &optional full)
"Same as `file-expand-wildcards' but allow recursion.
-Recursion happen when PATTERN starts with two stars.
+Recursion happens when PATTERN starts with two stars.
Directories expansion is not supported."
(let ((bn (helm-basename pattern))
(case-fold-search nil))
@@ -1291,15 +1306,25 @@ Directories expansion is not supported."
((basename nil) 'basename)
(t 'full))
:directories nil
- :match (wildcard-to-regexp bn)
+ :match (or (helm-wildcard-to-regexp bn)
+ (wildcard-to-regexp bn))
:skip-subdirs t)
- (file-expand-wildcards pattern full))))
+ (helm-aif (helm-wildcard-to-regexp bn)
+ (directory-files (helm-basedir pattern) full it)
+ (file-expand-wildcards pattern full)))))
+
+(defun helm-wildcard-to-regexp (wc)
+ "Transform wilcard WC like \"**.{jpg,jpeg}\" in REGEXP."
+ (when (string-match ".*\\(\\*\\{1,2\\}\\)\\.[{]\\(.*\\)[}]\\'" wc)
+ (format ".*\\.\\(%s\\)$"
+ (replace-regexp-in-string
+ "," "\\\\|" (match-string 2 wc)))))
;;; helm internals
;;
(defun helm-set-pattern (pattern &optional noupdate)
"Set minibuffer contents to PATTERN.
-if optional NOUPDATE is non-nil, helm buffer is not changed."
+If optional NOUPDATE is non-nil, the Helm buffer is not changed."
(with-selected-window (or (active-minibuffer-window) (minibuffer-window))
(delete-minibuffer-contents)
(insert pattern))
@@ -1375,16 +1400,17 @@ I.e. when using `helm-next-line' and friends in BODY."
(defun helm--prepare-completion-styles (&optional nomode styles)
"Return a suitable list of styles for `completion-styles'.
-When `helm-completion-style' is not `emacs' the Emacs vanilla default
-`completion-styles' is used except for `helm-dynamic-completion' which
-use inconditionally `emacs' as value for `helm-completion-style'.
+When `helm-completion-style' is not `emacs' the Emacs vanilla
+default `completion-styles' is used except for
+`helm-dynamic-completion' which uses inconditionally `emacs' as
+value for `helm-completion-style'.
If styles are specified in `helm-completion-styles-alist' for a
particular mode, use these styles unless NOMODE is non nil.
If STYLES is specified as a list of styles suitable for
`completion-styles' these styles are used in the given order.
-Otherwise helm style is added to `completion-styles' always after flex
-or helm-flex completion style if present."
+Otherwise helm style is added to `completion-styles' always after
+flex or helm-flex completion style if present."
;; For `helm-completion-style' and `helm-completion-styles-alist'.
(require 'helm-mode)
(if (memq helm-completion-style '(helm helm-fuzzy))
@@ -1418,15 +1444,19 @@ or helm-flex completion style if present."
"Build a function listing the possible completions of `helm-pattern' in COLLECTION.
Only the elements of COLLECTION that satisfy PREDICATE are considered.
-Argument POINT is same as in `completion-all-completions' and is
-meaningful only when using some kind of `completion-at-point'.
-The return value is a list of completions that may be sorted by the
-sort function provided by the completion-style in use (emacs-27 only),
-otherwise (emacs-26) the sort function have to be provided if needed
-either with a FCT function in source or by passing the sort function
-with METADATA e.g. (metadata (display-sort-function . foo)).
-If you don't want the sort fn provided by style to kick in (emacs-27)
-you can use as metadata value the symbol `nosort'.
+
+Argument POINT is the same as in `completion-all-completions' and
+is meaningful only when using some kind of `completion-at-point'.
+
+The return value is a list of completions that may be sorted by
+the sort function provided by the completion-style in
+use (emacs-27 only), otherwise (emacs-26) the sort function has
+to be provided if needed either with an FCT function in source or
+by passing the sort function with METADATA
+E.g.: (metadata (display-sort-function . foo)).
+
+If you don't want the sort fn provided by style to kick
+in (emacs-27) you can use as metadata value the symbol `nosort'.
Example:
@@ -1439,10 +1469,12 @@ Example:
When argument NOMODE is non nil don't use `completion-styles' as
specified in `helm-completion-styles-alist' for specific modes.
+
When STYLES is specified use these `completion-styles', see
`helm--prepare-completion-styles'.
-Also `helm-completion-style' settings have no effect here, `emacs'
-being used inconditionally as value."
+
+Also `helm-completion-style' settings have no effect here,
+`emacs' being used inconditionally as value."
(lambda ()
(let* (;; Force usage of emacs style otherwise
;; helm--prepare-completion-styles will reset
@@ -1535,14 +1567,15 @@ being used inconditionally as value."
(defun helm--ansi-color-apply (string)
"A version of `ansi-color-apply' immune to upstream changes.
-Similar to the emacs-24.5 version without support to `ansi-color-context'
-which is buggy in emacs.
+Similar to the emacs-24.5 version without support to
+`ansi-color-context' which is buggy in Emacs.
-Modify also `ansi-color-regexp' by using own variable `helm--ansi-color-regexp'
-that match whole STRING.
+Modify also `ansi-color-regexp' by using own variable
+`helm--ansi-color-regexp' that matches whole STRING.
-This is needed to provide compatibility for both emacs-25 and emacs-24.5
-as emacs-25 version of `ansi-color-apply' is partially broken."
+This is needed to provide compatibility for both emacs-25 and
+emacs-24.5 as emacs-25 version of `ansi-color-apply' is partially
+broken."
(require 'ansi-color)
(let ((start 0)
codes end escape-sequence
diff --git a/helm-locate.el b/helm-locate.el
index 0642c911..1f69820f 100644
--- a/helm-locate.el
+++ b/helm-locate.el
@@ -39,19 +39,21 @@ If nil Search in all files."
(defcustom helm-ff-locate-db-filename "locate.db"
"The basename of the locatedb file you use locally in your directories.
-When this is set and `helm' find such a file in the directory from
-where you launch locate, it will use this file and will not prompt you
-for a db file.
-Note that this happen only when locate is launched with a prefix arg."
+When this is set and Helm finds such a file in the directory from
+where you launch locate, it will use this file and will not
+prompt you for a db file.
+Note that this happen only when locate is launched with a prefix
+arg."
:group 'helm-locate
:type 'string)
(defcustom helm-locate-command nil
"A list of arguments for locate program.
-Helm will calculate a default value for your system on startup unless
-`helm-locate-command' is non-nil, here the default values it will use
-according to your system:
+Helm will calculate a default value for your system on startup
+unless `helm-locate-command' is non-nil.
+
+Here are the default values it will use according to your system:
Gnu/linux: \"locate %s -e -A --regex %s\"
berkeley-unix: \"locate %s %s\"
@@ -60,19 +62,20 @@ Others: \"locate %s %s\"
This string will be passed to format so it should end with `%s'.
The first format spec is used for the \"-i\" value of locate/es,
-So don't set it directly but use `helm-locate-case-fold-search'
+so don't set it directly but use `helm-locate-case-fold-search'
for this.
-The last option must be the one preceding pattern i.e \"-r\" or \"--regex\".
+The last option must be the one preceding pattern i.e \"-r\" or
+\"--regex\".
You will be able to pass other options such as \"-b\" or \"l\"
-during helm invocation after entering pattern only when multi matching,
-not when fuzzy matching.
+during Helm invocation after entering pattern only when multi
+matching, not when fuzzy matching.
-Note that the \"-b\" option is added automatically by helm when
+Note that the \"-b\" option is added automatically by Helm when
var `helm-locate-fuzzy-match' is non-nil and switching back from
-multimatch to fuzzy matching (this is done automatically when a space
-is detected in pattern)."
+multimatch to fuzzy matching (this is done automatically when a
+space is detected in pattern)."
:type 'string
:group 'helm-locate)
@@ -86,8 +89,8 @@ is detected in pattern)."
"It have the same meaning as `helm-case-fold-search'.
The -i option of locate will be used depending of value of
`helm-pattern' when this is set to 'smart.
-When nil \"-i\" will not be used at all.
-and when non--nil it will always be used.
+When nil \"-i\" will not be used at all and when non-nil it will
+always be used.
NOTE: the -i option of the \"es\" command used on windows does
the opposite of \"locate\" command."
:group 'helm-locate
@@ -107,8 +110,8 @@ Note that when this is enabled searching is done on basename."
(defcustom helm-locate-project-list nil
"A list of directories, your projects.
-When set, allow browsing recursively files in all
-directories of this list with `helm-projects-find-files'."
+When set, allow browsing recursively files in all directories of
+this list with `helm-projects-find-files'."
:group 'helm-locate
:type '(repeat string))
@@ -120,9 +123,9 @@ For Windows and `es' use something like \"es -r ^%s.*%s.*$\"
The two format specs are mandatory.
If for some reasons you can't use locate because your filesystem
-doesn't have a data base, you can use find command from findutils but
-be aware that it will be much slower, see `helm-find-files' embebded
-help for more infos."
+doesn't have a database, you can use find command from findutils
+but be aware that it will be much slower. See `helm-find-files'
+embedded help for more infos."
:type 'string
:group 'helm-files)
@@ -134,15 +137,16 @@ help for more infos."
map))
(defface helm-locate-finish
- '((t (:foreground "Green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Green"))
"Face used in mode line when locate process is finish."
:group 'helm-locate)
(defun helm-ff-find-locatedb (&optional from-ff)
"Try to find if a local locatedb file is available.
-The search is done in `helm-ff-default-directory' or
-fall back to `default-directory' if FROM-FF is nil."
+The search is done in `helm-ff-default-directory' or falls back to
+`default-directory' if FROM-FF is nil."
(helm-aif (and helm-ff-locate-db-filename
(locate-dominating-file
(or (and from-ff
@@ -166,11 +170,11 @@ It should receive the same arguments as
(defun helm-locate-1 (&optional localdb init from-ff default)
"Generic function to run Locate.
-Prefix arg LOCALDB when (4) search and use a local locate db file when it
-exists or create it, when (16) force update of existing db file
-even if exists.
-It have no effect when locate command is 'es'.
-INIT is a string to use as initial input in prompt.
+Prefix arg LOCALDB when (4) search and use a local locate db file
+when it exists or create it, when (16) force update of existing
+db file even if exists.
+It has no effect when locate command is 'es'. INIT is a string
+to use as initial input in prompt.
See `helm-locate-with-db' and `helm-locate'."
(require 'helm-mode)
(helm-locate-set-command)
@@ -443,8 +447,8 @@ Note: you can add locate options after entering pattern.
See 'man locate' for valid options and also `helm-locate-command'.
You can specify a local database with prefix argument ARG.
-With two prefix arg, refresh the current local db or create it
-if it doesn't exists.
+With two prefix arg, refresh the current local db or create it if
+it doesn't exists.
To create a user specific db, use
\"updatedb -l 0 -o db_path -U directory\".
diff --git a/helm-man.el b/helm-man.el
index 26f8135f..a14a3400 100644
--- a/helm-man.el
+++ b/helm-man.el
@@ -33,7 +33,7 @@
(declare-function helm-generic-sort-fn "helm-utils.el" (S1 S2))
(defgroup helm-man nil
- "Man and Woman applications for helm."
+ "Man and Woman applications for Helm."
:group 'helm)
(defcustom helm-man-or-woman-function 'Man-getpage-in-background
@@ -54,11 +54,11 @@ Arguments are passed to `manual-entry' with `format.'"
;; Internal
(defvar helm-man--pages nil
"All man pages on system.
-Will be calculated the first time you invoke helm with this
+Will be calculated the first time you invoke Helm with this
source.")
(defun helm-man-default-action (candidate)
- "Default action for jumping to a woman or man page from helm."
+ "Default action for jumping to a woman or man page from Helm."
(let ((wfiles (mapcar #'car (woman-file-name-all-completions candidate))))
(condition-case nil
(let ((file (if (cdr wfiles)
diff --git a/helm-misc.el b/helm-misc.el
index a0a54c27..3893f11c 100644
--- a/helm-misc.el
+++ b/helm-misc.el
@@ -33,7 +33,7 @@
:group 'helm)
(defcustom helm-time-zone-home-location "Paris"
- "The time zone of your home"
+ "The time zone of your home."
:group 'helm-misc
:type 'string)
@@ -45,12 +45,14 @@
:type '(alist :key-type string :value-type function))
(defface helm-time-zone-current
- '((t (:foreground "green")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "green"))
"Face used to colorize current time in `helm-world-time'."
:group 'helm-misc)
(defface helm-time-zone-home
- '((t (:foreground "red")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "red"))
"Face used to colorize home time in `helm-world-time'."
:group 'helm-misc)
diff --git a/helm-mode.el b/helm-mode.el
index 5b6b1fbb..18062375 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -53,7 +53,7 @@
By default `helm-mode' use `helm-completing-read-default-handler' to
provide helm completion in each `completing-read' or `read-file-name'
found, but other functions can be specified here for specific
-commands. This also allow disabling helm completion for some commands
+commands. This also allows disabling helm completion for some commands
when needed.
Each entry is a cons cell like (EMACS_COMMAND . COMPLETING-READ_HANDLER)
@@ -65,7 +65,7 @@ Each value maybe a helm function that takes same arguments as
`completing-read' plus NAME and BUFFER, where NAME is the name of the new
helm source and BUFFER the name of the buffer we will use, but it can
be also a function not using helm, in this case the function should
-take same args as `completing-read' and not be prefixed by \"helm-\".
+take the same args as `completing-read' and not be prefixed by \"helm-\".
`helm' will use the name of the command calling `completing-read' as
NAME and BUFFER will be computed as well with NAME but prefixed with
@@ -73,7 +73,7 @@ NAME and BUFFER will be computed as well with NAME but prefixed with
This function prefix name must start by \"helm-\" when it uses helm,
otherwise `helm' assumes the function is not a helm function and
-expects same args as `completing-read', this allow you to define a
+expects the same args as `completing-read', this allows you to define a
handler not using helm completion.
Example:
@@ -96,16 +96,16 @@ Example:
We want here to make the regular `completing-read' in `foo/test'
-returns a list of candidate(s) instead of a single candidate.
+return a list of candidate(s) instead of a single candidate.
Note that this function will be reused for ALL the `completing-read'
-of this command, so it should handle all cases, e.g
-If first `completing-read' complete against symbols and
+of this command, so it should handle all cases. E.g.,
+if first `completing-read' completes against symbols and
second `completing-read' should handle only buffer,
-your specialized function should handle the both.
+your specialized function should handle both.
If the value of an entry is nil completion will fall back to
-emacs vanilla behavior.
+Emacs vanilla behaviour.
Example:
If you want to disable helm completion for `describe-function', use:
@@ -136,7 +136,7 @@ See `helm-case-fold-search' for more info."
(defcustom helm-mode-handle-completion-in-region t
"Whether to replace or not `completion-in-region-function'.
-This enable support for `completing-read-multiple' and `completion-at-point'
+This enables support for `completing-read-multiple' and `completion-at-point'
when non--nil."
:group 'helm-mode
:type 'boolean)
@@ -160,7 +160,7 @@ Apply only in `helm-mode' handled commands."
When nil no sorting is done.
The function is a `filtered-candidate-transformer' function which takes
two args CANDIDATES and SOURCE.
-It will be used only when `helm-completion-style' is either emacs or
+It will be used only when `helm-completion-style' is either Emacs or
helm, otherwise when helm-fuzzy style is used, the fuzzy sort function
will be used."
:group 'helm-mode
@@ -184,12 +184,13 @@ in `completion-styles-alist' (emacs-26)."
(defvar helm-mode-minibuffer-setup-hook-black-list '(minibuffer-completion-help)
"Incompatible `minibuffer-setup-hook' functions go here.
-A list of symbols. Helm-mode is rejecting all lambda's, byte-code fns
+A list of symbols. `helm-mode' is rejecting all lambda's, byte-code fns
and all functions belonging in this list from `minibuffer-setup-hook'.
This is mainly needed to prevent \"*Completions*\" buffers to popup.")
(defface helm-mode-prefix
- '((t (:background "red" :foreground "black")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:background "red" :foreground "black")))
"Face used for prefix completion."
:group 'helm-mode)
@@ -227,35 +228,35 @@ This is mainly needed to prevent \"*Completions*\" buffers to popup.")
(helm-multi-key-defun helm-mode-delete-char-backward-maybe
"Delete char backward when text is not the prefix helm is completing against.
-First call warn user about deleting prefix completion.
-Second call delete backward char in current-buffer and quit helm completion,
-letting user starting a new completion with a new prefix."
+First call warns user about deleting prefix completion.
+Second call deletes backward char in current-buffer and quits helm completion,
+letting the user start a new completion with a new prefix."
'(helm-mode-delete-char-backward-1 helm-mode-delete-char-backward-2) 1)
(defcustom helm-completion-style 'emacs
"Style of completion to use in `completion-in-region'.
-This affect only `completion-at-point' and friends, and
+This affects only `completion-at-point' and friends, and
the `completing-read' using the default handler
i.e. `helm-completing-read-default-handler'.
-NB: This have nothing to do with `completion-styles', it is independent to
-helm, but when using emacs as helm-completion-style helm
+NB: This has nothing to do with `completion-styles', it is independent from
+helm, but when using 'emacs as helm-completion-style helm
will use the `completion-styles' for its completions.
Up to the user to configure `completion-styles'.
-There is three possible value to use:
+There are three possible values to use:
- helm, use multi match regular helm completion.
-- helm-fuzzy, use fuzzy matching, note that as usual when
+- helm-fuzzy, use fuzzy matching. Note that as usual when
entering a space helm switch to multi matching mode.
-- emacs, use regular emacs completion according to
- `completion-styles', note that even in this style, helm allows using
- multi match. Emacs-27 provide a style called `flex' that can be used
+- emacs, use regular Emacs completion according to
+ `completion-styles'. Note that even in this style, helm allows using
+ multi match. Emacs-27 provides a style called `flex' that can be used
aside `helm' style (see `completion-styles-alist'). When `flex' style
- is not available (Emacs<27) helm provide `helm-flex' style which is similar to
+ is not available (Emacs<27) helm provides `helm-flex' style which is similar to
`flex' and helm fuzzy matching.
For a better experience, if you don't know what to use, set
@@ -296,7 +297,7 @@ suitable value for `helm-completion-style'.
When specifying emacs as style for a mode, `completion-styles' can be
specified by using a cons cell specifying completion-styles to use
with helm emacs style, e.g. (foo-mode . (emacs helm flex)) will set
-`completion-styles' to '(helm flex) for foo-mode, this affect only
+`completion-styles' to '(helm flex) for foo-mode. This affects only
completions happening in buffers and not minibuffer completions,
i.e. completing-read's."
:group 'helm-mode
@@ -365,7 +366,7 @@ INPUT is the string you want to complete against, defaulting to
`helm-pattern' which is the value of what you enter in minibuffer.
Note that when using a function as COLLECTION this value will be
available with the input argument of the function only when using a
-sync source from `helm-comp-read', i.e not using
+sync source from `helm-comp-read', i.e. not using
`:candidates-in-buffer', otherwise the function is called only once
with an empty string as value for `helm-pattern' because
`helm-pattern' is not yet computed, which is what we want otherwise
@@ -443,6 +444,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'."
unknown-pattern)
(unless (or (eq must-match t)
(string= helm-pattern "")
+ ;; Check if pattern is already member of candidates.
(helm-cr--pattern-in-candidates-p candidates))
(setq candidates (append (list
;; Unquote helm-pattern
@@ -477,7 +479,8 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'."
(defun helm-comp-read--move-to-first-real-candidate ()
(helm-aif (helm-get-selection nil 'withprop)
- (when (string= (get-text-property 0 'display it) "[?]")
+ ;; Avoid error with candidates with an image as display (#2296).
+ (when (equal (get-text-property 0 'display it) "[?]")
(helm-next-line))))
(defun helm-cr-default (default cands)
@@ -571,7 +574,7 @@ Keys description:
When it is non--nil, all elements of HISTORY are displayed in
a special source before COLLECTION.
-- INPUT-HISTORY: A symbol. the minibuffer input history will be
+- INPUT-HISTORY: A symbol. The minibuffer input history will be
stored there, if nil or not provided, `minibuffer-history'
will be used instead.
@@ -600,7 +603,7 @@ Keys description:
- VOLATILE: Use volatile attribute.
- SORT: A predicate to give to `sort' e.g `string-lessp'
- Use this only on small data as it is ineficient.
+ Use this only on small data as it is inefficient.
If you want to sort faster add a sort function to
FC-TRANSFORMER.
Note that FUZZY when enabled is already providing a sort function.
@@ -625,7 +628,7 @@ Keys description:
See match-part documentation in `helm-source'.
- MATCH-DYNAMIC: See match-dynamic in `helm-source-sync'
- It have no effect when used with CANDIDATES-IN-BUFFER.
+ It has no effect when used with CANDIDATES-IN-BUFFER.
- ALLOW-NEST: Allow nesting this `helm-comp-read' in a helm session.
See `helm'.
@@ -639,8 +642,8 @@ Keys description:
Any prefix args passed during `helm-comp-read' invocation will be recorded
in `helm-current-prefix-arg', otherwise if prefix args were given before
`helm-comp-read' invocation, the value of `current-prefix-arg' will be used.
-That's mean you can pass prefix args before or after calling a command
-that use `helm-comp-read' See `helm-M-x' for example."
+That means you can pass prefix args before or after calling a command
+that use `helm-comp-read'. See `helm-M-x' for example."
(when (get-buffer helm-action-buffer)
(kill-buffer helm-action-buffer))
@@ -649,8 +652,7 @@ that use `helm-comp-read' See `helm-M-x' for example."
(if ,marked-candidates
(helm-marked-candidates)
(identity candidate)))))))
- (let* ((minibuffer-completion-confirm must-match)
- (minibuffer-completion-predicate test)
+ (let* ((minibuffer-completion-predicate test)
(minibuffer-completion-table collection)
(helm-read-file-name-mode-line-string
(replace-regexp-in-string "helm-maybe-exit-minibuffer"
@@ -741,9 +743,8 @@ that use `helm-comp-read' See `helm-M-x' for example."
:help-message help-message
:action action-fn))
(src-list (list src-hist
- (cons (cons 'must-match must-match)
- (if candidates-in-buffer
- src-1 src))))
+ (if candidates-in-buffer
+ src-1 src)))
(helm-execute-action-at-once-if-one exec-when-only-one)
(helm-quit-if-no-candidate quit-when-no-cand)
result)
@@ -841,9 +842,9 @@ that use `helm-comp-read' See `helm-M-x' for example."
init hist default _inherit-input-method
name buffer &optional cands-in-buffer exec-when-only-one)
"Call `helm-comp-read' with same args as `completing-read'.
-Extra optional arg CANDS-IN-BUFFER mean use `candidates-in-buffer'
+Extra optional arg CANDS-IN-BUFFER means use `candidates-in-buffer'
method which is faster.
-It should be used when candidate list don't need to rebuild dynamically."
+It should be used when candidate list doesn't need to be rebuilt dynamically."
(let ((history (or (car-safe hist) hist))
(initial-input (helm-aif (pcase init
((pred (stringp)) init)
@@ -886,7 +887,7 @@ It should be used when candidate list don't need to rebuild dynamically."
name buffer &optional _cands-in-buffer exec-when-only-one)
"Call `helm-comp-read' with same args as `completing-read'.
-This handler use dynamic matching which allow honouring `completion-styles'."
+This handler uses dynamic matching which allows honouring `completion-styles'."
(let* ((history (or (car-safe hist) hist))
(input (pcase init
((pred (stringp)) init)
@@ -1057,7 +1058,7 @@ See documentation of `completing-read' and `all-completions' for details."
initial-input hist def inherit-input-method))
;; Append the two extra args needed to set the buffer and source name
;; in helm specialized functions.
- (any-args (append def-args (list str-command buf-name)))
+ (others-args (append def-args (list str-command buf-name)))
helm-completion-mode-start-message ; Be quiet
helm-completion-mode-quit-message
;; Be sure this pesty *completion* buffer doesn't popup.
@@ -1108,7 +1109,7 @@ See documentation of `completing-read' and `all-completions' for details."
(unwind-protect
(cond (;; An helm specialized function exists, run it.
(and def-com helm-mode)
- (apply def-com any-args))
+ (apply def-com others-args))
(;; Try to handle `ido-completing-read' everywhere.
(and def-com (eq def-com 'ido-completing-read))
(setcar (memq collection def-args)
@@ -1168,9 +1169,9 @@ Keys description:
- NAME: Source name, default to \"Read File Name\".
-- INITIAL-INPUT: Where to start read file name, default to `default-directory'.
+- INITIAL-INPUT: Where to start reading file name, default to `default-directory'.
-- BUFFER: `helm-buffer' name default to \"*Helm Completions*\".
+- BUFFER: `helm-buffer' name, defaults to \"*Helm Completions*\".
- TEST: A predicate called with one arg 'candidate'.
@@ -1221,7 +1222,6 @@ Keys description:
(not (memq helm-mm-matching-method '(multi1 multi3p)))))
(hist (and history (helm-comp-read-get-candidates
history nil nil alistp)))
- (minibuffer-completion-confirm must-match)
(helm-ff--RET-disabled noret)
(minibuffer-completion-predicate test)
(minibuffer-completing-file-name t)
@@ -1262,19 +1262,26 @@ Keys description:
:nohighlight t
:candidates
(lambda ()
- (append (and (not (file-exists-p helm-pattern))
- (not (helm-ff--invalid-tramp-name-p helm-pattern))
- (list helm-pattern))
- (if test
+ (if test
+ (append (and (not (file-exists-p helm-pattern))
+ (not (helm-ff--invalid-tramp-name-p helm-pattern))
+ (list (helm-ff-filter-candidate-one-by-one
+ helm-pattern nil t)))
(cl-loop with hn = (helm-ff--tramp-hostnames)
- for i in (helm-find-files-get-candidates
- must-match)
- when (or (member i hn) ; A tramp host
- (funcall test i)) ; Test ok
- collect i)
- (helm-find-files-get-candidates must-match))))
- :filtered-candidate-transformer 'helm-ff-sort-candidates
- :filter-one-by-one 'helm-ff-filter-candidate-one-by-one
+ ;; helm-find-files-get-candidates is
+ ;; returning a list of cons cells.
+ for (d . r) in (helm-find-files-get-candidates
+ must-match)
+ when (or (member r hn) ; A tramp host
+ (funcall test r)) ; Test ok
+ collect (cons d r)))
+ (helm-find-files-get-candidates must-match)))
+ :update (lambda ()
+ (remhash helm-ff-default-directory
+ helm-ff--list-directory-cache))
+ :match-on-real t
+ :filtered-candidate-transformer '(helm-ff-fct
+ helm-ff-sort-candidates)
:persistent-action-if persistent-action-if
:persistent-help persistent-help
:volatile t
@@ -1344,7 +1351,7 @@ Don't use it directly, use instead `helm-read-file-name' in your programs."
(def-args (list prompt dir default-filename mustmatch initial predicate))
;; Append the two extra args needed to set the buffer and source name
;; in helm specialized functions.
- (any-args (append def-args (list str-command buf-name)))
+ (others-args (append def-args (list str-command buf-name)))
(reading-directory (eq predicate 'file-directory-p))
helm-completion-mode-start-message ; Be quiet
helm-completion-mode-quit-message ; Same here
@@ -1389,7 +1396,7 @@ Don't use it directly, use instead `helm-read-file-name' in your programs."
(and def-com helm-mode
(not (eq def-com 'ido-read-file-name))
(not (eq def-com 'incompatible)))
- (apply def-com any-args))
+ (apply def-com others-args))
(;; Def-com value is `ido-read-file-name'
;; run it with default args.
(and def-com (eq def-com 'ido-read-file-name))
@@ -1458,7 +1465,7 @@ The `helm-find-files' history `helm-ff-history' is used here."
(apply old--fn args)))
(defvar helm-completion--sorting-done nil
- "Flag that notify the FCT if sorting have been done in completion function.")
+ "Flag that notifies the FCT if sorting has been done in completion function.")
(defun helm-completion-in-region-sort-fn (candidates _source)
"Default sort function for completion-in-region."
(if helm-completion--sorting-done
@@ -1502,7 +1509,7 @@ The `helm-find-files' history `helm-ff-history' is used here."
(defun helm-completion-try-completion (string table pred point)
"The try completion function for `completing-styles-alist'.
-Actually do nothing."
+Actually does nothing."
;; AFAIU the try-completions style functions
;; are here to check if what is at point is suitable for TABLE but
;; there is no way to pass a multiple pattern from what is at point
@@ -1643,9 +1650,9 @@ Actually do nothing."
(defun helm-completion--flex-all-completions
(string table pred point &optional transform-pattern-fn)
"Match the presumed substring STRING to the entries in TABLE.
-Respect PRED and POINT. The pattern used is a PCM-style
-substring pattern, but it be massaged by TRANSFORM-PATTERN-FN, if
-that is non-nil."
+Respect PRED and POINT. The pattern used is a PCM-style substring
+pattern, but it will be massaged by TRANSFORM-PATTERN-FN, if that
+is non-nil."
(let* ((beforepoint (substring string 0 point))
(afterpoint (substring string point))
(bounds (completion-boundaries beforepoint table pred afterpoint))
@@ -1857,14 +1864,22 @@ Can be used for `completion-in-region-function' by advicing it with an
(push-mark it t t))))))
((consp result) ; crm.
(let ((beg (+ start base-size))
- (sep ","))
- ;; Try to find a default separator.
+ (sep (or (and
+ ;; If `crm-separator' is a string of length 1
+ ;; assume it can be used as separator (#2298),
+ ;; otherwise it is a regexp and use the value
+ ;; it matches or default to "," if no match.
+ (eq (length crm-separator) 1)
+ crm-separator)
+ ",")))
+ ;; Try to find a default separator. If `crm-separator' is a
+ ;; regexp use the string the regexp is matching.
(save-excursion
(goto-char beg)
(when (looking-back crm-separator (1- (point)))
(setq sep (match-string 0))))
(funcall completion-list-insert-choice-function
- beg end (mapconcat 'identity result sep))))
+ beg end (mapconcat 'identity (append result '("")) sep))))
(t nil)))
(defun helm-mode--in-file-completion-p ()
@@ -1902,7 +1917,7 @@ negative arg turn off.
You can toggle it with M-x `helm-mode'.
About `ido-mode':
-DO NOT enable `ido-everywhere' when using `helm-mode' and instead of
+DO NOT enable `ido-everywhere' when using `helm-mode'. Instead of
using `ido-mode', add the commands where you want to use ido to
`helm-completing-read-handlers-alist' with `ido' as value.
diff --git a/helm-multi-match.el b/helm-multi-match.el
index 591a1e94..8ad5d2b1 100644
--- a/helm-multi-match.el
+++ b/helm-multi-match.el
@@ -67,7 +67,7 @@ when these options are used."
"Regexp to represent space itself in multiple regexp match.")
(defun helm-mm-split-pattern (pattern &optional grep-space)
- "Split PATTERN if it contain spaces and return resulting list.
+ "Split PATTERN if it contains spaces and return resulting list.
If spaces in PATTERN are escaped, don't split at this place.
i.e \"foo bar baz\"=> (\"foo\" \"bar\" \"baz\")
but \"foo\\ bar baz\"=> (\"foo\\s-bar\" \"baz\").
@@ -187,9 +187,9 @@ If GREP-SPACE is used translate escaped space to \"\\s\" instead of \"\\s-\"."
(defvar helm-mm--3-pattern-list nil)
(defun helm-mm-3-get-patterns (pattern)
- "Returns a list of predicate/regexp cons cells.
-e.g. ((identity . \"foo\") (not . \"bar\")).
-If PATTERN is inchanged, don't recompute PATTERN and return the
+ "Return a list of predicate/regexp cons cells.
+E.g., ((identity . \"foo\") (not . \"bar\")).
+If PATTERN is unchanged, don't recompute PATTERN and return the
previous value stored in `helm-mm--3-pattern-list'."
(unless (equal pattern helm-mm--3-pattern-str)
(setq helm-mm--3-pattern-str pattern
@@ -199,7 +199,7 @@ previous value stored in `helm-mm--3-pattern-list'."
(defun helm-mm-3-get-patterns-internal (pattern)
"Return a list of predicate/regexp cons cells.
-e.g. ((identity . \"foo\") (not . \"bar\"))."
+E.g., ((identity . \"foo\") (not . \"bar\"))."
(unless (string= pattern "")
(cl-loop for pat in (helm-mm-split-pattern pattern)
collect (if (string= "!" (substring pat 0 1))
@@ -208,15 +208,15 @@ e.g. ((identity . \"foo\") (not . \"bar\"))."
(cl-defun helm-mm-3-match (candidate &optional (pattern helm-pattern))
"Check if PATTERN match CANDIDATE.
-When PATTERN contain a space, it is splitted and matching is done
-with the several resulting regexps against CANDIDATE.
-e.g \"bar foo\" will match \"foobar\" and \"barfoo\".
-Argument PATTERN, a string, is transformed in a list of
-cons cell with `helm-mm-3-get-patterns' if it contain a space.
-e.g \"foo bar\"=>((identity . \"foo\") (identity . \"bar\")).
-Then each predicate of cons cell(s) is called with regexp of same
-cons cell against CANDIDATE.
-i.e (identity (string-match \"foo\" \"foo bar\")) => t."
+When PATTERN contains a space, it is splitted and matching is
+done with the several resulting regexps against CANDIDATE.
+E.g., \"bar foo\" will match \"foobar\" and \"barfoo\".
+Argument PATTERN, a string, is transformed in a list of cons cell
+with `helm-mm-3-get-patterns' if it contains a space.
+E.g., \"foo bar\"=>((identity . \"foo\") (identity . \"bar\")).
+Then each predicate of cons cell(s) is called with the regexp of
+the same cons cell against CANDIDATE.
+I.e. (identity (string-match \"foo\" \"foo bar\")) => t."
(let ((pat (helm-mm-3-get-patterns pattern)))
(cl-loop for (predicate . regexp) in pat
always (funcall predicate
@@ -273,7 +273,7 @@ i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t."
(define-minor-mode helm-migemo-mode
"Enable migemo in helm.
It will be available in the sources handling it,
-i.e the sources which have the slot :migemo with non--nil value."
+i.e. the sources which have the slot :migemo with non--nil value."
:lighter " Hmio"
:group 'helm
:global t
@@ -328,7 +328,7 @@ i.e the sources which have the slot :migemo with non--nil value."
"Check if PATTERN match CANDIDATE.
Same as `helm-mm-3-match' but only for the cdr of patterns, the car of
patterns must always match CANDIDATE prefix.
-e.g \"bar foo baz\" will match \"barfoobaz\" or \"barbazfoo\" but not
+E.g. \"bar foo baz\" will match \"barfoobaz\" or \"barbazfoo\" but not
\"foobarbaz\" whereas `helm-mm-3-match' would match all."
(let* ((pat (helm-mm-3-get-patterns (or pattern helm-pattern)))
(first (car pat)))
diff --git a/helm-net.el b/helm-net.el
index 59687009..6d011997 100644
--- a/helm-net.el
+++ b/helm-net.el
@@ -30,7 +30,7 @@
:group 'helm)
(defcustom helm-google-suggest-default-browser-function nil
- "The browse url function you prefer to use with google suggest.
+ "The browse url function you prefer to use with Google suggest.
When nil, use the first browser function available
See `helm-browse-url-default-browser-alist'."
:group 'helm-net
@@ -72,7 +72,7 @@ Otherwise `url-retrieve-synchronously' is used."
(defcustom helm-surfraw-duckduckgo-url
"https://duckduckgo.com/lite/?q=%s&kp=1"
- "The duckduckgo url.
+ "The Duckduckgo url.
This is a format string, don't forget the `%s'.
If you have personal settings saved on duckduckgo you should have
a personal url, see your settings on duckduckgo."
@@ -157,7 +157,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
;;
;;
;; Internal
-
+(defvar helm-net-curl-log-file (expand-file-name "helm-curl.log" user-emacs-directory))
(defun helm-search-suggest-perform-additional-action (url query)
"Perform the search via URL using QUERY as input."
(browse-url (format url (url-hexify-string query))))
@@ -166,7 +166,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
(if helm-net-prefer-curl
(with-temp-buffer
(apply #'call-process "curl"
- nil t nil request helm-net-curl-switches)
+ nil `(t ,helm-net-curl-log-file) nil request helm-net-curl-switches)
(funcall parser))
(with-current-buffer (url-retrieve-synchronously request)
(funcall parser))))
@@ -192,7 +192,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
request #'helm-google-suggest-parser)))
(defun helm-google-suggest-set-candidates (&optional request-prefix)
- "Set candidates with result and number of google results found."
+ "Set candidates with result and number of Google results found."
(let ((suggestions (helm-google-suggest-fetch
(or (and request-prefix
(concat request-prefix
@@ -223,7 +223,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
"?"))
(defun helm-google-suggest-action (candidate)
- "Default action to jump to a google suggested candidate."
+ "Default action to jump to a Google suggested candidate."
(let ((arg (format helm-google-suggest-search-url
(url-hexify-string candidate))))
(helm-aif helm-google-suggest-default-browser-function
@@ -232,7 +232,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
(defvar helm-google-suggest-default-function
'helm-google-suggest-set-candidates
- "Default function to use in helm google suggest.")
+ "Default function to use in `helm-google-suggest'.")
(defvar helm-source-google-suggest
(helm-build-sync-source "Google Suggest"
@@ -244,7 +244,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
:requires-pattern 3))
(defun helm-google-suggest-emacs-lisp ()
- "Try to emacs lisp complete with google suggestions."
+ "Try to emacs lisp complete with Google suggestions."
(helm-google-suggest-set-candidates "emacs lisp"))
@@ -257,6 +257,7 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
(defvar helm-browse-url-chromium-program "chromium-browser")
(defvar helm-browse-url-uzbl-program "uzbl-browser")
+(defvar helm-browse-url-next-program "next")
(defvar helm-browse-url-conkeror-program "conkeror")
(defvar helm-browse-url-opera-program "opera")
(defvar helm-browse-url-default-browser-alist
@@ -291,12 +292,12 @@ Can be \"-new-tab\" (default) or \"-new-window\"."
;;;###autoload
(defun helm-browse-url-firefox (url &optional _ignore)
- "Same as `browse-url-firefox' but detach from emacs.
+ "Same as `browse-url-firefox' but detach from Emacs.
-So when you quit emacs you can keep your firefox session open
-and not be prompted to kill firefox process.
+So when you quit Emacs you can keep your Firefox session open and
+not be prompted to kill the Firefox process.
-NOTE: Probably not supported on some systems (e.g Windows)."
+NOTE: Probably not supported on some systems (e.g., Windows)."
(interactive (list (read-string "URL: " (browse-url-url-at-point))
nil))
(setq url (browse-url-encode-url url))
@@ -309,12 +310,12 @@ NOTE: Probably not supported on some systems (e.g Windows)."
;;;###autoload
(defun helm-browse-url-opera (url &optional _ignore)
- "Browse URL with opera browser and detach from emacs.
+ "Browse URL with Opera browser and detach from Emacs.
-So when you quit emacs you can keep your opera session open
-and not be prompted to kill opera process.
+So when you quit Emacs you can keep your Opera session open and
+not be prompted to kill the Opera process.
-NOTE: Probably not supported on some systems (e.g Windows)."
+NOTE: Probably not supported on some systems (e.g., Windows)."
(interactive (list (read-string "URL: " (browse-url-url-at-point))
nil))
(setq url (browse-url-encode-url url))
@@ -325,7 +326,7 @@ NOTE: Probably not supported on some systems (e.g Windows)."
;;;###autoload
(defun helm-browse-url-chromium (url &optional _ignore)
- "Browse URL with google chrome browser."
+ "Browse URL with Google Chrome browser."
(interactive "sURL: ")
(helm-generic-browser
url helm-browse-url-chromium-program))
@@ -342,6 +343,12 @@ NOTE: Probably not supported on some systems (e.g Windows)."
(interactive "sURL: ")
(helm-generic-browser url helm-browse-url-conkeror-program))
+;;;###autoload
+(defun helm-browse-url-next (url &optional _ignore)
+ "Browse URL with next browser."
+ (interactive "sURL: ")
+ (helm-generic-browser url helm-browse-url-next-program))
+
(defun helm-browse-url-default-browser (url &rest args)
"Find the first available browser and ask it to load URL."
(let ((default-browser-fn
@@ -416,7 +423,7 @@ NOTE: Probably not supported on some systems (e.g Windows)."
;;;###autoload
(defun helm-google-suggest ()
- "Preconfigured `helm' for google search with google suggest."
+ "Preconfigured `helm' for Google search with Google suggest."
(interactive)
(helm-other-buffer 'helm-source-google-suggest "*helm google*"))
diff --git a/helm-occur.el b/helm-occur.el
index fbf81c2e..1303a063 100644
--- a/helm-occur.el
+++ b/helm-occur.el
@@ -23,6 +23,8 @@
(require 'helm-help)
(require 'helm-utils)
+(declare-function 'helm-buffers-get-visible-buffers "helm-buffers.el")
+
;;; Internals
;;
(defvar helm-source-occur nil)
@@ -118,12 +120,14 @@ Note that when using `buffer-substring' initialization will be slower."
(defface helm-moccur-buffer
- '((t (:foreground "DarkTurquoise" :underline t)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:foreground "DarkTurquoise" :underline t)))
"Face used to highlight occur buffer names."
:group 'helm-occur)
(defface helm-resume-need-update
- '((t (:background "red")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ (:background "red")))
"Face used to flash occur buffer when it needs update."
:group 'helm-occur)
@@ -143,7 +147,7 @@ buffers (i.e. a helm command using `helm-source-buffers-list' like
`helm-mini') and use the multi occur buffers action.
This is the helm implementation that collect lines matching pattern
-like vanilla emacs `occur' but have nothing to do with it, the search
+like vanilla Emacs `occur' but have nothing to do with it, the search
engine beeing completely different and also much faster."
(interactive)
(setq helm-source-occur
@@ -178,8 +182,18 @@ engine beeing completely different and also much faster."
:truncate-lines helm-occur-truncate-lines)
(deactivate-mark t)))))
+;;;###autoload
+(defun helm-occur-visible-buffers ()
+ "Run helm-occur on all visible buffers in frame."
+ (interactive)
+ (require 'helm-buffers)
+ (if (or (one-window-p) (region-active-p))
+ (call-interactively #'helm-occur)
+ (let ((buffers (helm-buffers-get-visible-buffers)))
+ (helm-multi-occur-1 (mapcar 'get-buffer buffers)))))
+
(defun helm-occur-transformer (candidates source)
- "Returns CANDIDATES prefixed with line number."
+ "Return CANDIDATES prefixed with line number."
(cl-loop with buf = (helm-attr 'buffer-name source)
for c in candidates collect
(when (string-match helm-occur--search-buffer-regexp c)
@@ -200,7 +214,7 @@ engine beeing completely different and also much faster."
:initform nil)))
(defun helm-occur-build-sources (buffers &optional source-name)
- "Build sources for helm-occur for each buffer in BUFFERS list."
+ "Build sources for `helm-occur' for each buffer in BUFFERS list."
(cl-loop for buf in buffers
collect
(helm-make-source (or source-name
@@ -254,7 +268,7 @@ engine beeing completely different and also much faster."
:moccur-buffers buffers)))
(defun helm-multi-occur-1 (buffers &optional input)
- "Runs helm-occur on a list of buffers.
+ "Run `helm-occur' on a list of buffers.
Each buffer's result is displayed in a separated source."
(let* ((curbuf (current-buffer))
(bufs (if helm-occur-always-search-in-current
@@ -287,7 +301,7 @@ Each buffer's result is displayed in a separated source."
(cl-defun helm-occur-action (lineno
&optional (method (quote buffer)))
"Jump to line number LINENO with METHOD.
-arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
+METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(require 'helm-grep)
(let ((buf (if (eq major-mode 'helm-occur-mode)
(get-text-property (point) 'buffer-name)
@@ -355,7 +369,7 @@ Same as `helm-occur-goto-line' but go in new frame."
(put 'helm-moccur-run-save-buffer 'helm-only t)
(defun helm-occur-right ()
- "helm-occur action for right arrow.
+ "`helm-occur' action for right arrow.
This is used when `helm-occur-use-ioccur-style-keys' is enabled.
If follow is enabled (default) go to next source, otherwise execute
persistent action."
@@ -494,7 +508,7 @@ persistent action."
(helm-multi-occur-1 helm-occur--buffer-list helm-occur-mode--last-pattern))
(defun helm-occur-buffer-substring-with-linums ()
- "Returns current-buffer contents as a string with all lines
+ "Return current-buffer contents as a string with all lines
numbered. The property 'buffer-name is added to the whole string."
(let ((bufstr (buffer-substring-no-properties (point-min) (point-max)))
(bufname (buffer-name)))
@@ -582,7 +596,7 @@ numbered. The property 'buffer-name is added to the whole string."
":"
(propertize lineno 'face 'helm-grep-lineno)
":"
- (helm-grep-highlight-match str t))
+ (helm-grep-highlight-match str))
candidate)))
(define-derived-mode helm-occur-mode
diff --git a/helm-pkg.el b/helm-pkg.el
index f9b40edf..dd9293ef 100644
--- a/helm-pkg.el
+++ b/helm-pkg.el
@@ -1,11 +1,11 @@
;;; helm-pkg.el --- define helm for package.el
-(define-package "helm" "3.6.0"
+(define-package "helm" "3.6.2"
"Helm is an Emacs incremental and narrowing framework"
- '((emacs "24.4")
+ '((emacs "25.1")
(async "1.9.4")
(popup "0.5.3")
- (helm-core "3.6.0"))
+ (helm-core "3.6.2"))
:url "https://emacs-helm.github.io/helm/")
;; Local Variables:
diff --git a/helm-regexp.el b/helm-regexp.el
index 8c2e2b3e..1d9bdcf3 100644
--- a/helm-regexp.el
+++ b/helm-regexp.el
@@ -37,7 +37,7 @@
(defun helm-query-replace-regexp (_candidate)
"Query replace regexp from `helm-regexp'.
With a prefix arg replace only matches surrounded by word boundaries,
-i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
+i.e. don't replace inside a word, regexp is surrounded with \\bregexp\\b."
(let ((regexp helm-input))
(apply 'query-replace-regexp
(helm-query-replace-args regexp))))
@@ -52,7 +52,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
(helm-regexp-kill-new helm-input))
(defun helm-query-replace-args (regexp)
- "create arguments of `query-replace-regexp' action in `helm-regexp'."
+ "Create arguments of `query-replace-regexp' action in `helm-regexp'."
(let ((region-only (helm-region-active-p)))
(list
regexp
diff --git a/helm-ring.el b/helm-ring.el
index f4504d53..4aae4294 100644
--- a/helm-ring.el
+++ b/helm-ring.el
@@ -39,9 +39,9 @@
"Max number of chars displayed per candidate in kill-ring browser.
When `t', don't truncate candidate, show all.
By default it is approximatively the number of bits contained in five lines
-of 80 chars each i.e 80*5.
-Note that if you set this to nil multiline will be disabled, i.e you
-will not have anymore separators between candidates."
+of 80 chars each, i.e. 80*5.
+Note that if you set this to nil multiline will be disabled, i.e. you
+will not have separators between candidates any more."
:type '(choice (const :tag "Disabled" t)
(integer :tag "Max candidate offset"))
:group 'helm-ring)
@@ -163,10 +163,10 @@ use `helm-kill-ring-separator' as default."
(defun helm-kill-ring-action-yank-1 (str)
"Insert STR in `kill-ring' and set STR to the head.
-When called with a prefix arg, point and mark are exchanged without
-activating region.
-If this action is executed just after `yank',
-replace with STR as yanked string."
+When called with a prefix arg, point and mark are exchanged
+without activating region.
+If this action is executed just after `yank', replace with STR as
+yanked string."
(let ((yank-fn (lambda (&optional before yank-pop)
(insert-for-yank str)
;; Set the window start back where it was in
diff --git a/helm-semantic.el b/helm-semantic.el
index f5691244..eb37c053 100644
--- a/helm-semantic.el
+++ b/helm-semantic.el
@@ -165,7 +165,7 @@ you have completion on these functions with `C-M i' in the customize interface."
;;;###autoload
(defun helm-semantic (arg)
"Preconfigured `helm' for `semantic'.
-If ARG is supplied, pre-select symbol at point instead of current"
+If ARG is supplied, pre-select symbol at point instead of current."
(interactive "P")
(let ((tag (helm-aif (car (semantic-current-tag-parent))
(let ((curtag (car (semantic-current-tag))))
diff --git a/helm-source.el b/helm-source.el
index 2cd949ca..aff457f0 100644
--- a/helm-source.el
+++ b/helm-source.el
@@ -48,7 +48,7 @@
"Advice for `cl--print-table' to make readable class slots docstrings."
(let ((format "%s\n\n Initform=%s\n\n%s"))
(dolist (row rows)
- (setcar row (propertize (car row) 'face 'italic))
+ (setcar row (propertize (car row) 'face 'bold))
(setcdr row (nthcdr 1 (cdr row)))
(insert "\n* " (apply #'format format row) "\n"))))
@@ -458,6 +458,13 @@
Note that FUZZY-MATCH slot will overhide value of this slot.")
+ (match-on-real
+ :initarg :match-on-real
+ :initform nil
+ :custom boolean
+ :documentation
+ " Match the real value of candidates when non nil.")
+
(fuzzy-match
:initarg :fuzzy-match
:initform nil
@@ -652,11 +659,16 @@
:initform nil
:custom symbol
:documentation
- " Prevent exiting with empty helm buffer.
- For this to work `minibuffer-completion-confirm' must be let-bounded
- around the helm call.
- Same as `completing-read' require-match arg, possible values are `t'
- or `confirm'.")
+ " Same as `completing-read' require-match arg.
+ Possible values are:
+ - `t' which prevent exiting with an empty helm-buffer i.e. no matches.
+ - `confirm' which ask for confirmation i.e. need to press a second
+ time RET.
+ - `nil' is the default and is doing nothing i.e. returns nil when
+ pressing RET with an empty helm-buffer.
+ - Any other non nil values e.g. `ignore' allow exiting with
+ minibuffer contents as candidate value (in this case helm-buffer
+ is empty).")
(group
:initarg :group
@@ -906,7 +918,7 @@ Where OBJECT is an instance of an eieio class."
(cl-loop for s in (object-slots object)
for slot-val = (slot-value object s)
when slot-val
- collect (cons s (unless (eq t slot-val) slot-val))))
+ collect (cons s slot-val)))
(defun helm-make-source (name class &rest args)
"Build a `helm' source named NAME with ARGS for CLASS.
diff --git a/helm-sys.el b/helm-sys.el
index cfe015ec..4d31d62a 100644
--- a/helm-sys.el
+++ b/helm-sys.el
@@ -28,7 +28,8 @@
:group 'helm)
(defface helm-top-columns
- '((t :inherit helm-header))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit helm-header))
"Face for helm help string in minibuffer."
:group 'helm-sys)
@@ -40,20 +41,22 @@
"Top command used to display output of top.
A format string where %s will be replaced with `frame-width'.
-To use 'top' command, a version supporting batch mode (-b option) is needed.
-On Mac OSX 'top' command doesn't support this, so ps command
-is used instead by default.
-Normally 'top' command output have 12 columns, but in some versions you may
-have less than this, so you can either customize top to use 12 columns with the
-interactives 'f' and 'W' commands of top, or modify
-`helm-top-sort-columns-alist' to fit with the number of columns
-your 'top' command is using.
-
-If you modify 'ps' command be sure that 'pid' comes in first
-and \"env COLUMNS=%s\" is specified at beginning of command.
-Ensure also that no elements contain spaces (e.g use start_time and not start).
-Same as for 'top' you can customize `helm-top-sort-columns-alist' to make sort commands
-working properly according to your settings."
+To use 'top' command, a version supporting batch mode (-b option)
+is needed. On Mac OSX 'top' command doesn't support this, so the
+'ps' command is used instead by default.
+
+Normally 'top' command output have 12 columns, but in some
+versions you may have less than this, so you can either customize
+top to use 12 columns with the interactives 'f' and 'W' commands
+of top, or modify `helm-top-sort-columns-alist' to fit with the
+number of columns your 'top' command is using.
+
+If you modify 'ps' command be sure that 'pid' comes in first and
+\"env COLUMNS=%s\" is specified at beginning of command. Ensure
+also that no elements contain spaces (e.g., use start_time and
+not start). Same as for 'top': you can customize
+`helm-top-sort-columns-alist' to make sort commands working
+properly according to your settings."
:group 'helm-sys
:type 'string)
@@ -64,7 +67,7 @@ working properly according to your settings."
"Allow defining which column to use when sorting output of top/ps command.
Only com, mem, cpu and user are sorted, so no need to put something else there,
it will have no effect.
-Note that column numbers are counted from zero, i.e column 1 is the nth 0 column."
+Note that column numbers are counted from zero, i.e. column 1 is the nth 0 column."
:group 'helm-sys
:type '(alist :key-type symbol :value-type (integer :tag "Column number")))
@@ -76,15 +79,15 @@ The minimal delay allowed is 1.5, if less than this helm-top will use 1.5."
(defcustom helm-top-poll-delay-post-command 1.0
"Helm top stop polling during this delay.
-This delay is additioned to `helm-top-poll-delay' after emacs stop
+This delay is added to `helm-top-poll-delay' after Emacs stops
being idle."
:group 'helm-sys
:type 'float)
(defcustom helm-top-poll-preselection 'linum
- "Stay on same line or follow candidate when `helm-top-poll' update display.
+ "Stay on same line or follow candidate when `helm-top-poll' updates display.
Possible values are 'candidate or 'linum.
-This affect also sorting functions in the same way."
+This affects also sorting functions in the same way."
:group'helm-sys
:type '(radio :tag "Preferred preselection action for helm-top"
(const :tag "Follow candidate" candidate)
@@ -143,9 +146,9 @@ This affect also sorting functions in the same way."
helm-top-poll-delay-post-command)))
(defun helm-top-initialize-poll-hooks ()
- ;; When emacs is idle during say 20s
+ ;; When Emacs is idle during say 20s
;; the idle timer will run in 20+1.5 s.
- ;; This is fine when emacs stays idle, because the next timer
+ ;; This is fine when Emacs stays idle, because the next timer
;; will run at 21.5+1.5 etc... so the display will be updated
;; at every 1.5 seconds.
;; But as soon as emacs looses its idleness, the next update
@@ -437,7 +440,7 @@ Show actions only on line starting by a PID."
;;;###autoload
(defun helm-list-emacs-process ()
- "Preconfigured `helm' for emacs process."
+ "Preconfigured `helm' for Emacs process."
(interactive)
(helm-other-buffer 'helm-source-emacs-process "*helm process*"))
diff --git a/helm-tags.el b/helm-tags.el
index 782e87b4..dd98f6a4 100644
--- a/helm-tags.el
+++ b/helm-tags.el
@@ -64,8 +64,9 @@ one match."
:group 'helm-faces)
(defface helm-etags-file
- '((t (:foreground "Lightgoldenrod4"
- :underline t)))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "Lightgoldenrod4"
+ :underline t))
"Face used to highlight etags filenames."
:group 'helm-tags-faces)
@@ -107,8 +108,8 @@ one match."
"Cache content of etags files used here for faster access.")
(defun helm-etags-get-tag-file (&optional directory)
- "Return the path of etags file if found.
-Lookes recursively in parents directorys for a
+ "Return the path of etags file if found in DIRECTORY.
+Look recursively in parents directorys for a
`helm-etags-tag-file-name' file."
;; Get tag file from `default-directory' or upper directory.
(let ((current-dir (helm-etags-find-tag-file-directory
@@ -118,7 +119,7 @@ Lookes recursively in parents directorys for a
(expand-file-name helm-etags-tag-file-name current-dir))))
(defun helm-etags-all-tag-files ()
- "Return files from the following sources;
+ "Return files from the following sources:
1) An automatically located file in the parent directories, by `helm-etags-get-tag-file'.
2) `tags-file-name', which is commonly set by `find-tag' command.
3) `tags-table-list' which is commonly set by `visit-tags-table' command."
@@ -186,7 +187,7 @@ If not found in CURRENT-DIR search in upper directory."
(defun helm-etags-init ()
"Feed `helm-buffer' using `helm-etags-cache' or tag file.
-If no entry in cache, create one."
+If there is no entry in cache, create one."
(let ((tagfiles (helm-etags-all-tag-files)))
(when tagfiles
(with-current-buffer (helm-candidate-buffer 'global)
diff --git a/helm-utils.el b/helm-utils.el
index a7e26bf5..1bc67727 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -76,11 +76,11 @@ It is a float, usually 1024.0 but could be 1000.0 on some systems."
:type '(repeat (choice string)))
(defcustom helm-html-decode-entities-function #'helm-html-decode-entities-string
- "Function used to decode html entities in html bookmarks.
+ "Function used to decode HTML entities in HTML bookmarks.
Helm comes by default with `helm-html-decode-entities-string', if you need something
more sophisticated you can use `w3m-decode-entities-string' if available.
-In emacs itself org-entities seems broken and `xml-substitute-numeric-entities'
+In Emacs itself org-entities seem broken and `xml-substitute-numeric-entities'
supports only numeric entities."
:group 'helm-utils
:type 'function)
@@ -88,17 +88,17 @@ supports only numeric entities."
(defvar helm-goto-line-before-hook '(helm-save-current-pos-to-mark-ring)
"Run before jumping to line.
-This hook run when jumping from `helm-goto-line', `helm-etags-default-action',
+This hook runs when jumping from `helm-goto-line', `helm-etags-default-action',
and `helm-imenu-default-action'.
-This allow you to retrieve a previous position after using the different helm
+This allows you to retrieve a previous position after using the different helm
tools for searching (etags, grep, gid, (m)occur etc...).
-By default positions are added to `mark-ring' you can also add to register
-by using instead (or adding) `helm-save-pos-to-register-before-jump'.
-In this case last position is added to the register
-`helm-save-pos-before-jump-register'.")
+By default positions are added to `mark-ring'.
+You can also add to register by using (or adding)
+`helm-save-pos-to-register-before-jump' instead. In this case
+last position is added to the register `helm-save-pos-before-jump-register'.")
(defvar helm-save-pos-before-jump-register ?_
- "The register where `helm-save-pos-to-register-before-jump' save position.")
+ "The register where `helm-save-pos-to-register-before-jump' saves position.")
(defconst helm-html-entities-alist
'(("&quot;" . 34) ;; "
@@ -206,18 +206,20 @@ In this case last position is added to the register
"Table of html character entities and values.")
(defvar helm-find-many-files-after-hook nil
- "Hook that run at end of `helm-find-many-files'.")
+ "Hook that runs at end of `helm-find-many-files'.")
;;; Faces.
;;
(defface helm-selection-line
- '((t (:inherit highlight :distant-foreground "black")))
- "Face used in the `helm-current-buffer' when jumping to candidate."
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit highlight :distant-foreground "black"))
+ "Face used in the `helm-current-buffer' when jumping to a candidate."
:group 'helm-faces)
(defface helm-match-item
- '((t (:inherit isearch)))
- "Face used to highlight item matched in a selected line."
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit isearch))
+ "Face used to highlight the item matched in a selected line."
:group 'helm-faces)
@@ -236,7 +238,7 @@ according to the setting of `split-width-threshold' and the size of
the window from where splitting is done.
Note that when using `decide' and `split-width-threshold' is nil, the
-behavior is the same that with a nil value."
+behavior is the same as with a nil value."
:group 'helm-utils
:type '(choice
(const :tag "Split window vertically" t)
@@ -258,8 +260,8 @@ It is typically used to rearrange windows."
(defun helm-window-show-buffers (buffers &optional other-window)
"Show BUFFERS.
-If more than one buffer marked switch to these buffers in separate windows.
-If OTHER-WINDOW is non-nil, keep current buffer and switch to others buffers
+With more than one buffer marked switch to these buffers in separate windows.
+If OTHER-WINDOW is non-nil, keep current buffer and switch to other buffers
in separate windows.
If a prefix arg is given split windows vertically."
(let ((initial-ow-fn (if (cdr (window-list))
@@ -494,7 +496,7 @@ To use this add it to `helm-goto-line-before-hook'."
(defun helm-show-all-candidates-in-source (arg)
"Toggle all or only candidate-number-limit cands in current source.
With a numeric prefix arg show only the ARG number of candidates.
-The prefix arg have no effect when toggling to only
+The prefix arg has no effect when toggling to only
candidate-number-limit."
(interactive "p")
(with-helm-alive-p
@@ -543,6 +545,7 @@ from its directory."
(with-helm-alive-p
(require 'helm-grep)
(require 'helm-elisp)
+ (require 'bookmark) ; For bookmark-alist
(helm-run-after-exit
(lambda (f)
;; Ensure specifics `helm-execute-action-at-once-if-one'
@@ -661,7 +664,7 @@ that is sorting is done against real value of candidate."
(cl-defun helm-file-human-size (size &optional (kbsize helm-default-kbsize))
"Return a string showing SIZE of a file in human readable form.
-SIZE can be an integer or a float depending it's value.
+SIZE can be an integer or a float depending on it's value.
`file-attributes' will take care of that to avoid overflow error.
KBSIZE is a floating point number, defaulting to `helm-default-kbsize'."
(cl-loop with result = (cons "B" size)
@@ -673,6 +676,24 @@ KBSIZE is a floating point number, defaulting to `helm-default-kbsize'."
("B" (format "%s" size))
(t (format "%.1f%s" (cdr result) it)))))
+(defun helm-directory-size (directory &optional recursive human)
+ "Return the resulting size of the sum of all files in DIRECTORY.
+
+If RECURSIVE is non nil return the size of all files in DIRECTORY and
+its subdirectories. With arg HUMAN format the size in a human
+readable format,see `helm-file-human-size'."
+ (cl-loop with files = (if recursive
+ (helm-walk-directory
+ directory
+ :path 'full
+ :directories t)
+ (directory-files directory t))
+ for file in files
+ sum (nth 7 (file-attributes file)) into total
+ finally return (if human
+ (helm-file-human-size total)
+ total)))
+
(cl-defun helm-file-attributes
(file &key type links uid gid access-time modif-time
status size mode gid-change inode device-num dired human-size
@@ -790,8 +811,9 @@ Inlined here for compatibility."
(defmacro with-helm-display-marked-candidates (buffer-or-name candidates &rest body)
(declare (indent 0) (debug t))
- (helm-with-gensyms (buffer window)
+ (helm-with-gensyms (buffer window winconf)
`(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name))
+ (,winconf helm-last-frame-or-window-configuration)
(helm-always-two-windows t)
(helm-split-window-default-side
(if (eq helm-split-window-default-side 'same)
@@ -808,7 +830,8 @@ Inlined here for compatibility."
'(display-buffer-below-selected
(window-height . fit-window-to-buffer))))
(progn ,@body))
- (quit-window 'kill ,window)))))
+ (quit-window 'kill ,window)
+ (and ,winconf (set-window-configuration ,winconf))))))
;;; Persistent Action Helpers
;;
@@ -983,8 +1006,8 @@ Assume regexp is a pcre based regexp."
file))))
(defun helm-open-dired (file)
- "Opens a dired buffer in FILE's directory. If FILE is a
-directory, open this directory."
+ "Open a dired buffer in FILE's directory.
+If FILE is a directory, open this directory."
(if (file-directory-p file)
(dired file)
(dired (file-name-directory file))
@@ -1013,7 +1036,7 @@ directory, open this directory."
(defun helm-find-many-files (_ignore)
"Simple action that run `find-file' on marked candidates.
-Run `helm-find-many-files-after-hook' at end"
+Run `helm-find-many-files-after-hook' at end."
(let ((helm--reading-passwd-or-string t))
(mapc 'find-file (helm-marked-candidates))
(helm-log-run-hook 'helm-find-many-files-after-hook)))
@@ -1030,7 +1053,7 @@ If COUNT is non--nil add a number after each prompt."
finally return (remove "" lis)))
(defun helm-html-bookmarks-to-alist (file url-regexp bmk-regexp)
- "Parse html bookmark FILE and return an alist with (title . url) as elements."
+ "Parse HTML bookmark FILE and return an alist with (title . url) as elements."
(let (bookmarks-alist url title)
(with-temp-buffer
(insert-file-contents file)
@@ -1048,7 +1071,7 @@ If COUNT is non--nil add a number after each prompt."
(nreverse bookmarks-alist)))
(defun helm-html-entity-to-string (entity)
- "Replace an html ENTITY by its string value.
+ "Replace an HTML ENTITY with its string value.
When unable to decode ENTITY returns nil."
(helm-aif (assoc entity helm-html-entities-alist)
(string (cdr it))
diff --git a/helm.el b/helm.el
index 5c448abf..2d77dbfe 100644
--- a/helm.el
+++ b/helm.el
@@ -1,6 +1,6 @@
;;; helm.el --- Emacs incremental and narrowing framework -*- lexical-binding: t -*-
-;; Version: 3.5.6
+;; Version: 3.6.2
;; URL: https://github.com/emacs-helm/helm
;; Copyright (C) 2007 Tamas Patrovics
@@ -53,7 +53,7 @@ Each function runs sequentially for each KEY press.
If DELAY is specified, switch back to initial function of FUNCTIONS list
after DELAY seconds.
The functions in FUNCTIONS list take no args.
-e.g
+E.g.
(defun foo ()
(interactive)
(message \"Run foo\"))
@@ -66,9 +66,9 @@ e.g
\(helm-define-multi-key global-map (kbd \"<f5> q\") '(foo bar baz) 2)
-Each time \"<f5> q\" is pressed, the next function is executed. Waiting
-more than 2 seconds between key presses switches back to executing the first
-function on the next hit."
+Each time \"<f5> q\" is pressed, the next function is executed.
+Waiting more than 2 seconds between key presses switches back to
+executing the first function on the next hit."
(define-key keymap key (helm-make-multi-command functions delay)))
;;;###autoload
@@ -113,7 +113,7 @@ Run each function in the FUNCTIONS list in turn when called within DELAY seconds
(set iterator nil))))))
(helm-multi-key-defun helm-toggle-resplit-and-swap-windows
- "Multi key command to re-split and swap helm window.
+ "Multi key command to re-split and swap Helm window.
First call runs `helm-toggle-resplit-window',
and second call within 1s runs `helm-swap-windows'."
'(helm-toggle-resplit-window helm-swap-windows) 1)
@@ -122,35 +122,34 @@ and second call within 1s runs `helm-swap-windows'."
;;;###autoload
(defun helm-define-key-with-subkeys (map key subkey command
&optional other-subkeys prompt exit-fn)
- "Defines in MAP a KEY and SUBKEY to COMMAND.
+ "Define in MAP a KEY and SUBKEY to COMMAND.
This allows typing KEY to call COMMAND the first time and
type only SUBKEY on subsequent calls.
-Arg MAP is the keymap to use, SUBKEY is the initial short key-binding to
-call COMMAND.
+Arg MAP is the keymap to use, SUBKEY is the initial short
+key binding to call COMMAND.
-Arg OTHER-SUBKEYS is an alist specifying other short key-bindings
-to use once started e.g:
+Arg OTHER-SUBKEYS is an alist specifying other short key bindings
+to use once started, e.g.:
(helm-define-key-with-subkeys global-map
(kbd \"C-x v n\") ?n 'git-gutter:next-hunk
'((?p . git-gutter:previous-hunk))\)
-
In this example, `C-x v n' will run `git-gutter:next-hunk'
-subsequent \"n\"'s run this command again
-and subsequent \"p\"'s run `git-gutter:previous-hunk'.
+subsequent \"n\" will run this command again and subsequent \"p\"
+will run `git-gutter:previous-hunk'.
-If specified PROMPT can be displayed in minibuffer to
-describe SUBKEY and OTHER-SUBKEYS.
-Arg EXIT-FN specifies a function to run on exit.
+If specified PROMPT can be displayed in minibuffer to describe
+SUBKEY and OTHER-SUBKEYS. Arg EXIT-FN specifies a function to run
+on exit.
-For any other keys pressed, run their assigned command as defined
+For any other key pressed, run their assigned command as defined
in MAP and then exit the loop running EXIT-FN, if specified.
-NOTE: SUBKEY and OTHER-SUBKEYS bindings support only char syntax and
-vectors, so don't use strings to define them."
+NOTE: SUBKEY and OTHER-SUBKEYS bindings support only char syntax
+and vectors, so don't use strings to define them."
(declare (indent 1))
(define-key map key
(lambda ()
@@ -202,6 +201,8 @@ vectors, so don't use strings to define them."
(define-key map (kbd "C-j") 'helm-execute-persistent-action)
(define-key map (kbd "C-o") 'helm-next-source)
(define-key map (kbd "M-o") 'helm-previous-source)
+ (define-key map (kbd "<right>") 'helm-next-source)
+ (define-key map (kbd "<left>") 'helm-previous-source)
(define-key map (kbd "C-l") 'helm-recenter-top-bottom-other-window)
(define-key map (kbd "M-C-l") 'helm-reposition-window-other-window)
(define-key map (kbd "C-M-v") 'helm-scroll-other-window)
@@ -286,7 +287,7 @@ vectors, so don't use strings to define them."
(defun helm-customize-group ()
"Jump to customization group of current source.
-Default to `helm' when group is not defined in source."
+Default to Helm group when group is not defined in source."
(interactive)
(helm-run-after-exit 'helm-customize-group-1 (helm-attr 'group)))
(put 'helm-customize-group 'helm-only t)
@@ -316,8 +317,8 @@ Default to `helm' when group is not defined in source."
This is a format spec where %d will be replaced by the candidate
number.
-NOTE: `setq' have no effect until you restart emacs, use customize for
-immediate effect."
+NOTE: `setq' have no effect until you restart Emacs, use
+customize for immediate effect."
:group 'helm
:type 'string
:set #'helm--action-at-nth-set-fn-)
@@ -328,22 +329,22 @@ immediate effect."
This is a format spec where %d will be replaced by the candidate
number.
-NOTE: `setq' have no effect until you restart emacs, use customize for
-immediate effect."
+NOTE: `setq' have no effect until you restart Emacs, use
+customize for immediate effect."
:group 'helm
:type 'string
:set #'helm--action-at-nth-set-fn+)
(defgroup helm nil
- "Open helm."
+ "Open Helm."
:prefix "helm-" :group 'convenience)
(defcustom helm-completion-window-scroll-margin 5
- " `scroll-margin' to use for helm completion window.
+ "`scroll-margin' to use for Helm completion window.
Set to 0 to disable.
NOTE: This has no effect when `helm-display-source-at-screen-top'
-id is non-`nil'."
+id is non-nil."
:group 'helm
:type 'integer)
@@ -355,7 +356,8 @@ id is non-`nil'."
(defcustom helm-display-source-at-screen-top t
"Display candidates at the top of screen.
This happens with `helm-next-source' and `helm-previous-source'.
-NOTE: When non-`nil' (default), disable `helm-completion-window-scroll-margin'."
+NOTE: When non-nil (default), disable
+`helm-completion-window-scroll-margin'."
:group 'helm
:type 'boolean)
@@ -363,7 +365,7 @@ NOTE: When non-`nil' (default), disable `helm-completion-window-scroll-margin'."
"Global limit for number of candidates displayed.
When the pattern is empty, the number of candidates shown will be
as set here instead of the entire list, which may be hundreds or
-thousands. Since narrowing and filtering rapidly reduces
+thousands. Since narrowing and filtering rapidly reduces
available candidates, having a small list will keep the interface
responsive.
@@ -377,8 +379,8 @@ Set this value to nil for no limit."
:type 'float)
(defcustom helm-exit-idle-delay 0
- "Idle time before exiting minibuffer while helm is updating.
-Has no affect when helm-buffer is up to date \(i.e exit without
+ "Idle time before exiting minibuffer while Helm is updating.
+Has no affect when helm-buffer is up to date \(i.e. exit without
delay in this condition\)."
:group 'helm
:type 'float)
@@ -387,7 +389,7 @@ delay in this condition\)."
(make-obsolete-variable 'helm-samewindow 'helm-full-frame "1.4.8.1")
(defcustom helm-full-frame nil
"Use current window for showing candidates.
-If t, then Helm does not pop-up new window."
+If t, then Helm does not pop-up a new window."
:group 'helm
:type 'boolean)
@@ -402,14 +404,14 @@ If t, then Helm does not pop-up new window."
(defcustom helm-save-configuration-functions
'(set-window-configuration . current-window-configuration)
"Functions used to restore or save configurations for frames and windows.
-Specified as a pair of functions, where car is the restore function and cdr
-is the save function.
+Specified as a pair of functions, where car is the restore
+function and cdr is the save function.
To save and restore frame configuration, set this variable to
'\(set-frame-configuration . current-frame-configuration\)
NOTE: This may not work properly with own-frame minibuffer
-settings. Older versions saves/restores frame configuration, but
+settings. Older versions saves/restores frame configuration, but
the default has changed now to avoid flickering."
:group 'helm
:type 'sexp)
@@ -418,15 +420,15 @@ the default has changed now to avoid flickering."
"Function used to display `helm-buffer'.
Local value in `helm-buffer' will take precedence on this default
-value. Commands that are in `helm-commands-using-frame' will have
+value. Commands that are in `helm-commands-using-frame' will have
`helm-buffer' displayed in frame, `helm-display-function' being
ignored.
-If no local value found and current command is not one of
+If no local value is found and current command is not one of
`helm-commands-using-frame' use this default value.
-Function in charge of deciding which value use is
+The function in charge of deciding which value use is
`helm-resolve-display-function'.
-To set it locally to `helm-buffer' in helm sources use
+To set it locally to `helm-buffer' in Helm sources use
`helm-set-local-variable' in init function or use
:display-function slot in `helm' call."
:group 'helm
@@ -443,7 +445,7 @@ Use nil or t to turn off smart behavior and use
Default is smart.
NOTE: Case fold search has no effect when searching asynchronous
-sources, which rely on customized features implemented directly
+sources, which relies on customized features implemented directly
into their execution process. See helm-grep.el for an example."
:group 'helm
:type '(choice (const :tag "Ignore case" t)
@@ -479,19 +481,21 @@ the same window scheme as the previous session unless
Must be one acceptable arg for `split-window' SIDE,
that is `below', `above', `left' or `right'.
-Other acceptable values are `same' which always display
-`helm-buffer' in current window and `other' that display
+Other acceptable values are `same' which always displays
+`helm-buffer' in current window and `other' that displays
`helm-buffer' below if only one window or in
`other-window-for-scrolling' when available.
-A nil value has same effect as `below'.
-If `helm-full-frame' is non-`nil', it take precedence over this setting.
+A nil value has same effect as `below'. If `helm-full-frame' is
+non-nil, it take precedence over this setting.
-See also `helm-split-window-inside-p' and `helm-always-two-windows' that
-take precedence over this.
+See also `helm-split-window-inside-p' and
+`helm-always-two-windows' that take precedence over this.
-NOTE: this has no effect if `helm-split-window-preferred-function' is not
-`helm-split-window-default-fn' unless this new function can handle this."
+NOTE: this has no effect if
+`helm-split-window-preferred-function' is not
+`helm-split-window-default-fn' unless this new function can
+handle this."
:group 'helm
:type 'symbol)
@@ -502,40 +506,43 @@ the current frame only has one window. Possible values
are acceptable args for `split-window' SIDE, that is `below',
`above', `left' or `right'.
-If `helm-full-frame' is non-`nil', it take precedence over this setting.
+If `helm-full-frame' is non-nil, it takes precedence over this
+setting.
See also `helm-split-window-inside-p' and `helm-always-two-windows' that
-take precedence over this.
+takes precedence over this.
-NOTE: this has no effect if `helm-split-window-preferred-function' is not
-`helm-split-window-default-fn' unless this new function can handle this."
+NOTE: this has no effect if
+`helm-split-window-preferred-function' is not
+`helm-split-window-default-fn' unless this new function can
+handle this."
:group 'helm
:type 'symbol)
(defcustom helm-display-buffer-default-height nil
"Initial height of `helm-buffer', specified as an integer or a function.
-The function should take one arg and the responsibility for
-re-sizing the window; function's return value is ignored.
-Note that this have no effect when the split is vertical.
-See `display-buffer' for more info."
+The function should take one arg and be responsible for re-sizing
+the window; function's return value is ignored. Note that this
+has no effect when the split is vertical. See `display-buffer'
+for more info."
:group 'helm
:type '(choice integer function))
(defcustom helm-display-buffer-default-width nil
"Initial width of `helm-buffer', specified as an integer or a function.
-The function should take one arg and the responsibility for
-re-sizing the window; function's return value is ignored.
-Note that this have no effect when the split is horizontal.
-See `display-buffer' for more info."
+The function should take one arg and be responsible for re-sizing
+the window; function's return value is ignored. Note that this
+have no effect when the split is horizontal. See `display-buffer'
+for more info."
:group 'helm
:type '(choice integer function))
(defvaralias 'helm-split-window-in-side-p 'helm-split-window-inside-p)
(make-obsolete-variable 'helm-split-window-in-side-p 'helm-split-window-inside-p "2.8.6")
(defcustom helm-split-window-inside-p nil
- "Forces split inside selected window when non-`nil'.
+ "Force split inside selected window when non-nil.
See also `helm-split-window-default-side'.
NOTE: this has no effect if
@@ -546,19 +553,20 @@ handle this."
:type 'boolean)
(defcustom helm-always-two-windows nil
- "When non-`nil' helm uses two windows in this frame.
+ "When non-nil Helm uses two windows in this frame.
I.e. `helm-buffer' in one window and `helm-current-buffer'
in the other.
-Note: this has no effect when `helm-split-window-inside-p' is non-`nil',
-or when `helm-split-window-default-side' is set to 'same.
+Note: this has no effect when `helm-split-window-inside-p' is
+non-nil, or when `helm-split-window-default-side' is set to
+'same.
When `helm-autoresize-mode' is enabled, setting this to nil
will have no effect.
-Also when non-`nil' it overrides the effect of `helm-split-window-default-side'
-set to `other'."
+Also when non-nil it overrides the effect of
+`helm-split-window-default-side' set to `other'."
:group 'helm
:type 'boolean)
@@ -576,8 +584,8 @@ set to `other'."
"Action functions to pass to `display-buffer'.
See (info \"(elisp) Action Functions for Buffer Display\").
-Have no effect when `helm-always-two-windows' is non-nil and may
-override other settings like `helm-split-window-inside-p'."
+It has no effect when `helm-always-two-windows' is non-nil and
+may override other settings like `helm-split-window-inside-p'."
:group 'helm
:type '(repeat symbol))
@@ -585,8 +593,8 @@ override other settings like `helm-split-window-inside-p'."
"Additional alist to pass to `display-buffer' action.
See (info \"(elisp) Action Alists for Buffer Display\").
-Have no effect when `helm-always-two-windows' is non-nil and may
-override other settings like `helm-split-window-inside-p'.
+It has no effect when `helm-always-two-windows' is non-nil and
+may override other settings like `helm-split-window-inside-p'.
Note that window-height and window-width have to be configured in
`helm-display-buffer-height' and `helm-display-buffer-width'."
:group 'helm
@@ -602,27 +610,29 @@ Note that window-height and window-width have to be configured in
helm-source-grep-ag
helm-source-grep-git
helm-source-grep)
- "List of helm sources that need to use `helm--maybe-use-default-as-input'.
+ "List of Helm sources that need to use `helm--maybe-use-default-as-input'.
When a source is a member of this list, default `thing-at-point'
will be used as input."
:group 'helm
:type '(repeat (choice symbol)))
(defcustom helm-delete-minibuffer-contents-from-point t
- "When non-`nil', `helm-delete-minibuffer-contents' delete region from `point'.
-Otherwise delete `minibuffer-contents'.
-See documentation for `helm-delete-minibuffer-contents'."
+ "When non-nil, `helm-delete-minibuffer-contents' deletes region from `point'.
+Otherwise it deletes `minibuffer-contents'.
+See documentation for `helm-delete-minibuffer-contents'."
:group 'helm
:type 'boolean)
(defcustom helm-follow-mode-persistent nil
- "When non-`nil', save last state of `helm-follow-mode' for the next emacs sessions.
+ "When non-nil, save last state of `helm-follow-mode' for the next Emacs sessions.
-Each time you turn on or off `helm-follow-mode', the current source name will be stored
-or removed from `helm-source-names-using-follow'.
+Each time you turn on or off `helm-follow-mode', the current
+source name will be stored or removed from
+`helm-source-names-using-follow'.
-Note that this may be disabled in some places where it is unsafe to use
-because persistent action is changing according to context."
+Note that this may be disabled in some places where it is unsafe
+to use because persistent action is changing according to
+context."
:group 'helm
:type 'boolean)
@@ -631,25 +641,25 @@ because persistent action is changing according to context."
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 and
-know what you are doing, instead just set
-`helm-follow-mode-persistent' to non-nil and as soon you turn on or
-off `helm-follow-mode' (C-c C-f) in a source, helm will save or remove
-source name in this variable."
+You don't have to customize this yourself unless you really want
+and know what you are doing, instead just set
+`helm-follow-mode-persistent' to non-nil and as soon as you turn
+on or off `helm-follow-mode' (C-c C-f) in a source, Helm will
+save or remove source name in this variable."
:group 'helm
:type '(repeat (choice string)))
(defcustom helm-prevent-escaping-from-minibuffer t
- "Prevent escaping from minibuffer with `other-window' during the helm session."
+ "Prevent escaping from minibuffer with `other-window' during the Helm session."
:group 'helm
:type 'boolean)
(defcustom helm-allow-mouse nil
- "Allow mouse usage during the helm session when non-nil.
+ "Allow mouse usage during the Helm session when non-nil.
-Note that this also allow moving out of minibuffer when clicking
-outside of `helm-buffer', up to you to get back to helm by clicking
-back in `helm-buffer' or minibuffer."
+Note that this also allows moving out of minibuffer when clicking
+outside of `helm-buffer', so it is up to you to get back to Helm
+by clicking back in `helm-buffer' or minibuffer."
:group 'helm
:type 'boolean)
@@ -682,14 +692,14 @@ When nil, no highlighting is done."
:type 'function)
(defcustom helm-autoresize-max-height 40
- "Specifies maximum height and defaults to percent of helm window's frame height.
+ "Specify maximum height and defaults to percent of Helm window's frame height.
See `fit-window-to-buffer' for more infos."
:group 'helm
:type 'integer)
(defcustom helm-autoresize-min-height 10
- "Specifies minimum height and defaults to percent of helm window's frame height.
+ "Specify minimum height and defaults to percent of Helm window's frame height.
If nil, `window-min-height' is used.
See `fit-window-to-buffer' for details."
@@ -697,12 +707,14 @@ See `fit-window-to-buffer' for details."
:type 'integer)
(defcustom helm-input-method-verbose-flag nil
- "The default value for `input-method-verbose-flag' used in helm minibuffer.
+ "The default value for `input-method-verbose-flag' used in Helm minibuffer.
It is nil by default, which does not turn off input method. Helm
-updates and exits without interruption -- necessary for complex methods.
+updates and exits without interruption -- necessary for complex
+methods.
If set to any other value as per `input-method-verbose-flag',
-then use `C-\\' to disable the `current-input-method' to exit or update helm"
+then use `C-\\' to disable the `current-input-method' to exit or
+update Helm."
:group 'helm
:type '(radio :tag "A flag to control extra guidance for input methods in helm."
(const :tag "Never provide guidance" nil)
@@ -715,26 +727,28 @@ then use `C-\\' to disable the `current-input-method' to exit or update helm"
:type 'boolean)
(defcustom helm-inherit-input-method t
- "Inherit `current-input-method' from `current-buffer' when non-`nil'.
+ "Inherit `current-input-method' from `current-buffer' when non-nil.
The default is to enable this by default and then toggle
`toggle-input-method'."
:group 'helm
:type 'boolean)
(defcustom helm-echo-input-in-header-line nil
- "Send current input in header-line when non-nil."
+ "Send current input to header-line when non-nil."
:group 'helm
:type 'boolean)
(defcustom helm-header-line-space-before-prompt 'left-fringe
"Specify the space before prompt in header-line.
-This will be used when `helm-echo-input-in-header-line' is non-nil.
+This will be used when `helm-echo-input-in-header-line' is
+non-nil.
-Value can be one of the symbols 'left-fringe or 'left-margin or an
-integer specifying the number of spaces before prompt.
-Note that on input longer that `window-width' the continuation string
-will be shown on left side of window without taking care of this."
+Value can be one of the symbols 'left-fringe or 'left-margin or
+an integer specifying the number of spaces before prompt. Note
+that on input longer that `window-width' the continuation string
+will be shown on left side of window without taking care of
+this."
:group 'helm
:type '(choice
(symbol
@@ -743,22 +757,25 @@ will be shown on left side of window without taking care of this."
integer))
(defcustom helm-tramp-connection-min-time-diff 5
- "Value of `tramp-connection-min-time-diff' for helm remote processes.
-If set to zero helm remote processes are not delayed.
-Setting this to a value less than 5 or disabling it with a zero value
-is risky, however on emacs versions starting at 24.5 it seems
-it is now possible to disable it.
-Anyway at any time in helm you can suspend your processes while typing
-by hitting \\<helm-map> `\\[helm-toggle-suspend-update]'.
+ "Value of `tramp-connection-min-time-diff' for Helm remote processes.
+If set to zero Helm remote processes are not delayed.
+
+Setting this to a value less than 5 or disabling it with a zero
+value is risky, however on Emacs versions starting at 24.5 it
+seems it is now possible to disable it.
+
+Anyway at any time in Helm you can suspend your processes while
+typing by hitting \\<helm-map> `\\[helm-toggle-suspend-update]'.
+
Only async sources than use a sentinel calling
`helm-process-deferred-sentinel-hook' are affected by this."
:type 'integer
:group 'helm)
(defcustom helm-debug-root-directory nil
- "When non-`nil', saves helm log messages to a file in this directory.
-When `nil' log messages are saved to a buffer instead.
-Log message are saved only when `helm-debug' is non-nil, so setting this
+ "When non-nil, save Helm log messages to a file in this directory.
+When nil log messages are saved to a buffer instead. Log message
+are saved only when `helm-debug' is non-nil, so setting this
doesn't enable debugging by itself.
See `helm-log-save-maybe' for more info."
@@ -773,8 +790,9 @@ in same window.
If left display the action buffer at the left of helm-buffer.
If right or any other value, split at right.
-Note that this may not fit well with some helm window configurations,
-so it have only effect when `helm-always-two-windows' is non-nil."
+Note that this may not fit well with some Helm window
+configurations, so it have only effect when
+`helm-always-two-windows' is non-nil."
:group 'helm
:type '(choice
(const :tag "Split at left" left)
@@ -787,11 +805,13 @@ so it have only effect when `helm-always-two-windows' is non-nil."
:group 'helm)
(defcustom helm-display-buffer-reuse-frame nil
- "When non nil helm frame is not deleted and reused in next sessions.
+ "When non nil Helm frame is not deleted and reused in next sessions.
-This was used to workaround a bug in emacs where frames where
-popping up slowly, now that the bug have been fixed upstream probably
-you don't want to use this anymore."
+This was used to workaround a bug in Emacs where frames where
+popping up slowly, now that the bug have been fixed upstream
+\(emacs-27) probably you don't want to use this any more. On
+emacs-26 set `x-wait-for-event-timeout' to nil to have your
+frames popping up fast."
:group 'helm
:type 'boolean)
@@ -801,42 +821,42 @@ you don't want to use this anymore."
:type '(repeat symbol))
(defcustom helm-actions-inherit-frame-settings t
- "Actions inherit helm frame settings of initial command when non nil."
+ "Actions inherit Helm frame settings of initial command when non nil."
:group 'helm
:type 'boolean)
(defcustom helm-use-undecorated-frame-option t
- "Display helm frame undecorated when non nil.
+ "Display Helm frame undecorated when non nil.
-This option have no effect with emacs versions lower than 26."
+This option has no effect with Emacs versions lower than 26."
:group 'helm
:type 'boolean)
(defcustom helm-frame-background-color nil
- "Background color for helm frames, a string.
+ "Background color for Helm frames, a string.
Fallback to default face background when nil."
:group 'helm
:type 'string)
(defcustom helm-frame-foreground-color nil
- "Foreground color for helm frames, a string.
+ "Foreground color for Helm frames, a string.
Fallback to default face foreground when nil"
:group 'helm
:type 'string)
(defcustom helm-frame-alpha nil
- "Alpha parameter for helm frames, an integer.
+ "Alpha parameter for Helm frames, an integer.
Fallback to 100 when nil."
:group 'helm
:type 'integer)
(defcustom helm-use-frame-when-more-than-two-windows nil
- "Display helm buffer in frame when more than two windows."
+ "Display Helm buffer in frame when more than two windows."
:group 'helm
:type 'boolean)
(defcustom helm-use-frame-when-dedicated-window nil
- "Display helm buffer in frame when helm is started from a dedicated window."
+ "Display Helm buffer in frame when Helm is started from a dedicated window."
:group 'helm
:type 'boolean)
@@ -847,8 +867,9 @@ Fallback to 100 when nil."
:type 'function)
(defcustom helm-truncate-lines nil
- "The value of `truncate-lines' when helm startup.
-You can toggle later `truncate-lines' with \\<helm-map>\\[helm-toggle-truncate-line]."
+ "The value of `truncate-lines' when Helm starts.
+You can toggle later `truncate-lines' with
+\\<helm-map>\\[helm-toggle-truncate-line]."
:group 'helm
:type 'boolean)
@@ -856,95 +877,131 @@ You can toggle later `truncate-lines' with \\<helm-map>\\[helm-toggle-truncate-l
;;
;;
(defgroup helm-faces nil
- "Customize the appearance of helm."
+ "Customize the appearance of Helm."
:prefix "helm-"
:group 'faces
:group 'helm)
(defface helm-source-header
- '((((background dark))
+ `((((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
:background "#22083397778B"
:foreground "white"
:weight bold :height 1.3 :family "Sans Serif")
(((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
:background "#abd7f0"
:foreground "black"
:weight bold :height 1.3 :family "Sans Serif"))
- "Face for source header in the helm buffer."
+ "Face for source header in the Helm buffer."
:group 'helm-faces)
(defface helm-visible-mark
- '((((min-colors 88) (background dark))
- (:background "green1" :foreground "black"))
+ `((((min-colors 88) (background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "green1"
+ :foreground "black")
(((background dark))
- (:background "green" :foreground "black"))
- (((background light)) :background "#d1f5ea")
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "green"
+ :foreground "black")
+ (((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "#d1f5ea")
(((min-colors 88))
- (:background "green1"))
- (t (:background "green")))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "green1")
+ (t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "green"))
"Face for visible mark."
:group 'helm-faces)
(defface helm-header
- '((t (:inherit header-line)))
- "Face for header lines in the helm buffer."
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit header-line))
+ "Face for header lines in the Helm buffer."
:group 'helm-faces)
(defface helm-candidate-number
- '((((background dark)) :background "Yellow" :foreground "black")
- (((background light)) :background "#faffb5" :foreground "black"))
+ `((((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "Yellow" :foreground "black")
+ (((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "#faffb5" :foreground "black"))
"Face for candidate number in mode-line."
:group 'helm-faces)
(defface helm-candidate-number-suspended
- '((t (:inherit helm-candidate-number :inverse-video t)))
- "Face for candidate number in mode-line when helm is suspended."
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit helm-candidate-number :inverse-video t))
+ "Face for candidate number in mode-line when Helm is suspended."
:group 'helm-faces)
(defface helm-selection
- '((((background dark)) :background "ForestGreen"
+ `((((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "ForestGreen"
:distant-foreground "black")
- (((background light)) :background "#b5ffd1"
+ (((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :background "#b5ffd1"
:distant-foreground "black"))
- "Face for currently selected item in the helm buffer."
+ "Face for currently selected item in the Helm buffer."
:group 'helm-faces)
(defface helm-separator
- '((((background dark)) :foreground "red")
- (((background light)) :foreground "#ffbfb5"))
+ `((((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "red")
+ (((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "#ffbfb5"))
"Face for multiline source separator."
:group 'helm-faces)
(defface helm-action
- '((t (:underline t)))
- "Face for action lines in the helm action buffer."
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :underline t))
+ "Face for action lines in the Helm action buffer."
:group 'helm-faces)
(defface helm-prefarg
- '((((background dark)) :foreground "green")
- (((background light)) :foreground "red"))
+ `((((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "green")
+ (((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "red"))
"Face for showing prefix arg in mode-line."
:group 'helm-faces)
(defface helm-match
- '((((background light)) :foreground "#b00000")
- (((background dark)) :foreground "gold1"))
+ `((((background light))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "#b00000")
+ (((background dark))
+ ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "gold1"))
"Face used to highlight matches."
:group 'helm-faces)
(defface helm-header-line-left-margin
- '((t (:foreground "black" :background "yellow")))
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :foreground "black" :background "yellow"))
"Face used to highlight helm-header sign in left-margin."
:group 'helm-faces)
(defface helm-minibuffer-prompt
- '((t (:inherit minibuffer-prompt)))
- "Face used for the minibuffer/headline prompt (such as Pattern:) in helm."
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit minibuffer-prompt))
+ "Face used for the minibuffer/headline prompt (such as Pattern:) in Helm."
:group 'helm-faces)
(defface helm-eob-line
- '((t (:inherit default)))
- "Face for empty line at end of sources in the helm buffer.
+ `((t ,@(and (>= emacs-major-version 27) '(:extend t))
+ :inherit default))
+ "Face for empty line at end of sources in the Helm buffer.
Allow specifying the height of this line."
:group 'helm-faces)
@@ -955,34 +1012,35 @@ Allow specifying the height of this line."
"Overlay used to highlight the currently selected item.")
(defvar helm-async-processes nil
- "List of information about asynchronous processes managed by helm.")
+ "List of information about asynchronous processes managed by Helm.")
(defvar helm-before-initialize-hook nil
- "Runs before helm initialization.
+ "Runs before Helm initialization.
This hook runs before init functions in `helm-sources', which is
-before creation of `helm-buffer'. Set local variables for
+before creation of `helm-buffer'. Set local variables for
`helm-buffer' that need a value from `current-buffer' with
`helm-set-local-variable'.")
(defvar helm-after-initialize-hook nil
- "Runs after helm initialization.
+ "Runs after Helm initialization.
This hook runs after `helm-buffer' is created but not from
-`helm-buffer'. The hook needs to specify in which buffer to run.")
+`helm-buffer'. The hook needs to specify in which buffer to
+run.")
(defvaralias 'helm-update-hook 'helm-after-update-hook)
(make-obsolete-variable 'helm-update-hook 'helm-after-update-hook "1.9.9")
(defvar helm-after-update-hook nil
- "Runs after updating the helm buffer with the new input pattern.")
+ "Runs after updating the Helm buffer with the new input pattern.")
(defvar helm-before-update-hook nil
- "Runs before updating the helm buffer with the new input pattern.")
+ "Runs before updating the Helm buffer with the new input pattern.")
(defvar helm-cleanup-hook nil
"Runs after exiting the minibuffer and before performing an
action.
-This hook runs even if helm exits the minibuffer abnormally (e.g.
+This hook runs even if Helm exits the minibuffer abnormally (e.g.
via `helm-keyboard-quit').")
(defvar helm-select-action-hook nil
@@ -990,7 +1048,7 @@ via `helm-keyboard-quit').")
(defvar helm-before-action-hook nil
"Runs before executing action.
-Unlike `helm-cleanup-hook', this hook runs before helm closes the
+Unlike `helm-cleanup-hook', this hook runs before Helm closes the
minibuffer and also before performing an action.")
(defvar helm-after-action-hook nil
@@ -999,8 +1057,8 @@ minibuffer and also before performing an action.")
(defvar helm-exit-minibuffer-hook nil
"Runs just before exiting the minibuffer.
-This hook runs when helm exits the minibuffer normally (e.g. via
-candidate selection), but does NOT run if helm exits the
+This hook runs when Helm exits the minibuffer normally (e.g., via
+candidate selection), but does NOT run if Helm exits the
minibuffer abnormally (e.g. via `helm-keyboard-quit').")
(defvar helm-after-persistent-action-hook nil
@@ -1019,26 +1077,26 @@ minibuffer abnormally (e.g. via `helm-keyboard-quit').")
"Runs when switching to and from the action buffer.")
(defvar helm-execute-action-at-once-if-one nil
- "When non--nil executes the default action and then exits if only one candidate.
-If symbol 'current-source is given as value exit if only one candidate
-in current source.
-This variable accepts a function with no args that should returns a boolean
-value or 'current-source.")
+ "When non-nil execute the default action and then exit if only one candidate.
+If symbol 'current-source is given as value exit if only one
+candidate in current source. This variable accepts a function
+with no args that should returns a boolean value or
+'current-source.")
(defvar helm-quit-if-no-candidate nil
- "When non-`nil', quits if there are no candidates.
+ "When non-nil, quit if there are no candidates.
This variable accepts a function.")
(defvar helm-debug-variables nil
- "A list of helm variables that `helm-debug-output' displays.
-If `nil', `helm-debug-output' includes only variables with
-`helm-' prefixes.")
+ "A list of Helm variables that `helm-debug-output' displays.
+If nil, `helm-debug-output' includes only variables with `helm-'
+prefixes.")
(defvar helm-debug-buffer "*Debug Helm Log*")
(defvar helm-debug nil
- "If non-`nil', write log message to `helm-debug-buffer'.
-Default is `nil', which disables writing log messages because the
+ "If non-nil, write log message to `helm-debug-buffer'.
+Default is nil, which disables writing log messages because the
size of `helm-debug-buffer' grows quickly.")
(defvar helm-mode-line-string "\
@@ -1049,14 +1107,14 @@ size of `helm-debug-buffer' grows quickly.")
f1/f2/f-n:NthAct \
\\[helm-toggle-suspend-update]:Tog.suspend \
\\[helm-customize-group]:Conf"
- "Help string displayed by helm in the mode-line.
+ "Help string displayed by Helm in the mode-line.
It is either a string or a list of two string arguments where the
first string is the name and the second string is displayed in
-the mode-line. When `nil', uses default `mode-line-format'.")
+the mode-line. When nil, it defaults to `mode-line-format'.")
(defvar helm-minibuffer-set-up-hook nil
"Hook that runs at minibuffer initialization.
-A hook useful for modifying minibuffer settings in helm.
+A hook useful for modifying minibuffer settings in Helm.
An example that hides the minibuffer when using
`helm-echo-input-in-header-line':
@@ -1064,7 +1122,7 @@ An example that hides the minibuffer when using
(add-hook 'helm-minibuffer-set-up-hook #'helm-hide-minibuffer-maybe)
Note that we check `helm-echo-input-in-header-line' value
-from `helm-buffer' which allow detecting possible local
+from `helm-buffer' which allows detecting possible local
value of this var.")
(defvar helm-help-message
@@ -1073,54 +1131,65 @@ value of this var.")
To navigate in this Help buffer see [[Helm help][here]].
-Helm narrows down the list of candidates as you type a filter pattern see [[Matching in Helm][Matching in Helm]].
+Helm narrows down the list of candidates as you type a filter
+pattern. See [[Matching in Helm][Matching in Helm]].
-Helm accepts multiple space-separated patterns, each pattern can be negated with \"!\".
+Helm accepts multiple space-separated patterns, each pattern can
+be negated with \"!\".
-Helm also supports fuzzy matching in some places when specified, you will find
-several variables to enable fuzzy matching in diverse [[Helm sources][sources]],
-see [[https://github.com/emacs-helm/helm/wiki/Fuzzy-matching][fuzzy-matching]] in helm-wiki for more infos.
+Helm also supports fuzzy matching in some places when specified,
+you will find several variables to enable fuzzy matching in
+diverse [[Helm sources][sources]], see
+[[https://github.com/emacs-helm/helm/wiki/Fuzzy-matching][fuzzy-matching]]
+in helm-wiki for more infos.
Helm generally uses familiar Emacs keys to navigate the list.
Here follow some of the less obvious bindings:
-- `\\<helm-map>\\[helm-maybe-exit-minibuffer]' selects the candidate from the list, executes the default action
-upon exiting the Helm session.
+- `\\<helm-map>\\[helm-maybe-exit-minibuffer]' selects the
+candidate from the list, executes the default action upon exiting
+the Helm session.
-- `\\<helm-map>\\[helm-execute-persistent-action]' executes the default action but without exiting the Helm session.
-Not all sources support this.
+- `\\<helm-map>\\[helm-execute-persistent-action]' executes the
+default action but without exiting the Helm session. Not all
+sources support this.
-- `\\<helm-map>\\[helm-select-action]' displays a list of actions available on current candidate or all marked candidates.
-The default binding <tab> is ordinarily used for completion, but that would be
-redundant since Helm completes upon every character entered in the prompt.
-See [[https://github.com/emacs-helm/helm/wiki#helm-completion-vs-emacs-completion][Helm wiki]].
+- `\\<helm-map>\\[helm-select-action]' displays a list of actions
+available on current candidate or all marked candidates. The
+default binding <tab> is ordinarily used for completion, but that
+would be redundant since Helm completes upon every character
+entered in the prompt. See
+[[https://github.com/emacs-helm/helm/wiki#helm-completion-vs-emacs-completion][Helm
+wiki]].
-Note: In addition to the default actions list, additional actions appear
-depending of the type of the selected candidate(s). They are called filtered
-actions.
+Note: In addition to the default actions list, additional actions
+appear depending on the type of the selected candidate(s). They
+are called filtered actions.
** Helm sources
-Helm uses what's called sources to provide different kinds of completions, each helm session
-can handle one or more source.
-A source is an alist object which is build from various classes, see [[Writing your own Helm sources][here]]
-and [[https://github.com/emacs-helm/helm/wiki/Developing#creating-a-source][Helm wiki]] for more infos.
+Helm uses what's called sources to provide different kinds of
+completions. Each Helm session can handle one or more source. A
+source is an alist object which is build from various classes,
+see [[Writing your own Helm sources][here]] and
+[[https://github.com/emacs-helm/helm/wiki/Developing#creating-a-source][Helm
+wiki]] for more infos.
*** Configure sources
-You will find in helm sources already built and bound to a
-variable called generally `helm-source-<something>', in this case
+You will find in Helm sources already built and bound to a
+variable called generally `helm-source-<something>'. In this case
it is an alist and you can change the attributes (keys) values
-using `helm-attrset' function in your config, of course you have
-to ensure before calling `helm-attrset' that the file containing
-source is loaded with e.g. `with-eval-after-load'. Of course you
-can also completely redefine the source but this is generally not
-elegant as it duplicate for its most part code already defined in
-Helm.
+using `helm-attrset' function in your configuration. Of course
+you have to ensure before calling `helm-attrset' that the file
+containing source is loaded, e.g. with `with-eval-after-load'. Of
+course you can also completely redefine the source but this is
+generally not elegant as it duplicate for its most part code
+already defined in Helm.
You will find also sources that are not built and even not bound
-to any variables because they are rebuilded at each start of helm
-session. In this case you can add a defmethod called
+to any variables because they are rebuilded at each start of a
+Helm session. In this case you can add a defmethod called
`helm-setup-user-source' to your config:
#+begin_src elisp
@@ -1130,46 +1199,53 @@ session. In this case you can add a defmethod called
#+end_src
-See [[https://github.com/emacs-helm/helm/wiki/FAQ#why-is-a-customizable-helm-source-nil][here]] for more infos,
-and for more complex examples of configuration [[https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init-helm.el#L340][here]].
+See
+[[https://github.com/emacs-helm/helm/wiki/FAQ#why-is-a-customizable-helm-source-nil][here]]
+for more infos, and for more complex examples of configuration
+[[https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init-helm.el#L340][here]].
** Modify keybindings in Helm
Helm main keymap is `helm-map', all keys bound in this map apply
-to all helm sources. However, most sources have their own
-keymap, with each binding overriding its counterpart in
-`helm-map', you can see all bindings in effect in the [[Commands][Commands]]
-section (available only if the source have its own keymap and documentation of course).
+to all Helm sources. However, most sources have their own keymap,
+with each binding overriding its counterpart in `helm-map', you
+can see all bindings in effect in the [[Commands][Commands]]
+section (available only if the source has its own keymap and
+documentation of course).
** Matching in Helm
-All what you write in minibuffer is interpreted as a regexp or
+All that you write in minibuffer is interpreted as a regexp or
multiple regexps if separated by a space. This is true for most
-sources unless developer of source have disabled it or have choosen to
-use fuzzy matching. Even if a source have fuzzy matching enabled,
-helm will switch to multi match as soon as it detect a space in
-pattern, it may also switch to multi match as well if pattern starts
-with a \"^\" beginning of line sign, in those cases each pattern
-separated with space should be a regexp and not a fuzzy pattern. When
-using multi match patterns, each pattern starting with \"!\" is
-interpreted as a negation i.e. match everything but this.
+sources unless the developer of the source has disabled it or
+have choosen to use fuzzy matching. Even if a source has fuzzy
+matching enabled, Helm will switch to multi match as soon as it
+detects a space in the pattern. It may also switch to multi match
+as well if pattern starts with a \"^\" beginning of line sign. In
+those cases each pattern separated with space should be a regexp
+and not a fuzzy pattern. When using multi match patterns, each
+pattern starting with \"!\" is interpreted as a negation i.e.
+match everything but this.
*** Completion-styles
-Helm generally fetch its candidates with the :candidates function
-up to `helm-candidate-number-limit' and then apply match functions
-to these candidates according to `helm-pattern'.
+Helm generally fetches its candidates with the :candidates
+function up to `helm-candidate-number-limit' and then applies
+match functions to these candidates according to `helm-pattern'.
But Helm allows matching candidates directly from the :candidates
function using its own `completion-styles'.
-Helm provides 'helm completion style but also 'helm-flex completion style
-for Emacs<27 that don't have 'flex completion style, otherwise (emacs-27)
-'flex completion style is used to provide fuzzy aka flex completion.
-By default, like in Emacs vanilla, all completion commands
-\(e.g. `completion-at-point') using `completion-in-region' or
+Helm provides 'helm completion style but also 'helm-flex
+completion style for Emacs<27 that don't have 'flex completion
+style, otherwise (emacs-27) 'flex completion style is used to
+provide fuzzy aka flex completion.
+By default, like in Emacs vanilla, all completion commands \(e.g.,
+`completion-at-point') using `completion-in-region' or
`completing-read' use `completion-styles'.
-Some Helm native commands like `helm-M-x' do use `completion-styles'.
-Any helm sources can use `completion-styles' by using :match-dynamic slot
-and building their :candidates function with `helm-dynamic-completion'.
+Some Helm native commands like `helm-M-x' do use
+`completion-styles'. Any Helm sources can use `completion-styles'
+by using :match-dynamic slot and building their :candidates
+function with `helm-dynamic-completion'.
+
Example:
#+begin_src elisp
@@ -1183,95 +1259,106 @@ Example:
#+end_src
-By default Helm setup `completion-styles' and always add 'helm to it, however
-the flex completion styles are not added, this is up to the user if she want to
-have such completion to enable this.
-As specified above use 'flex for emacs-27 and 'helm-flex for emacs-26.
-Anyway, 'helm-flex is not provided in `completion-styles-alist' if 'flex is present.
-
-Finally Helm provide two user variables to control `completion-styles' usage:
-`helm-completion-style' and `helm-completion-syles-alist'.
-Both variables are customizable.
-The former allows retrieving previous Helm behavior if needed, by setting it to
-`helm' or `helm-fuzzy', default being `emacs' which allows dynamic completion
-and usage of `completion-styles', the second allows setting `helm-completion-style'
-per mode and also specify `completion-styles' per mode (see its docstring).
-Note that these two variables take effect only in helm-mode i.e. in all what use
-`completion-read' or `completion-in-region', IOW all helmized commands.
-File completion in `read-file-name' family doesn't obey completion-styles and have their
-own file completion implementation.
-Native helm commands using `completion-styles' doesn't obey `helm-completion-style' and
-`helm-completion-syles-alist' (e.g. helm-M-x).
-
-Also for a better control of styles in native helm sources (not helmized by helm-mode)
-using :match-dynamic, `helm-dynamic-completion' provides a STYLES argument that allows
+By default Helm sets up `completion-styles' and always adds 'helm
+to it. However the flex completion styles are not added. This is
+up to the user if she wants to have such completion to enable
+this.
+As specified above use 'flex for emacs-27 and 'helm-flex for
+emacs-26. Anyway, 'helm-flex is not provided in
+`completion-styles-alist' if 'flex is present.
+
+Finally Helm provides two user variables to control
+`completion-styles' usage: `helm-completion-style' and
+`helm-completion-syles-alist'. Both variables are customizable.
+The former allows retrieving previous Helm behavior if needed, by
+setting it to `helm' or `helm-fuzzy', default being `emacs' which
+allows dynamic completion and usage of `completion-styles'. The
+second allows setting `helm-completion-style' per mode and also
+specifying `completion-styles' per mode (see its docstring). Note
+that these two variables take effect only in helm-mode i.e. in
+all that uses `completion-read' or `completion-in-region', IOW all
+helmized commands. File completion in `read-file-name' family
+doesn't obey completion-styles and has its own file completion
+implementation. Native Helm commands using `completion-styles'
+doesn't obey `helm-completion-style' and
+`helm-completion-syles-alist' (e.g., helm-M-x).
+
+Also for a better control of styles in native Helm sources (not
+helmized by helm-mode) using :match-dynamic,
+`helm-dynamic-completion' provides a STYLES argument that allows
specifying explicitely styles for this source.
-NOTE: Some old completion styles are not working fine with helm
+NOTE: Some old completion styles are not working fine with Helm
and are disabled by default in
-`helm-blacklist-completion-styles', they are anyway not useful in
-helm because 'helm style supersed these styles.
+`helm-blacklist-completion-styles'. They are anyway not useful in
+Helm because 'helm style supersedes these styles.
** Helm mode
-`helm-mode' toggles Helm completion in native Emacs functions,
-so when you turn `helm-mode' on, commands like `switch-to-buffer' will use
-Helm completion instead of the usual Emacs completion buffer.
+`helm-mode' toggles Helm completion in native Emacs functions, so
+when you turn `helm-mode' on, commands like `switch-to-buffer'
+will use Helm completion instead of the usual Emacs completion
+buffer.
*** What gets or does not get \"helmized\" when `helm-mode' is enabled?
-Helm provides generic completion on all Emacs functions using `completing-read',
-`completion-in-region' and their derivatives, e.g. `read-file-name'. Helm
-exposes a user variable to control which function to use for a specific Emacs
-command: `helm-completing-read-handlers-alist'. If the function for a specific
-command is nil, it turns off Helm completion. See the variable documentation
-for more infos.
+Helm provides generic completion on all Emacs functions using
+`completing-read', `completion-in-region' and their derivatives,
+e.g. `read-file-name'. Helm exposes a user variable to control
+which function to use for a specific Emacs command:
+`helm-completing-read-handlers-alist'. If the function for a
+specific command is nil, it turns off Helm completion. See the
+variable documentation for more infos.
*** Helm functions vs helmized Emacs functions
-While there are Helm functions that perform the same completion as other
-helmized Emacs functions, e.g. `switch-to-buffer' and `helm-buffers-list', the
-native Helm functions like `helm-buffers-list' can receive new features, the
-allow marking candidates, they have several actions, etc. Whereas the helmized
-Emacs functions only have Helm completion, one action and no more then Emacs can
-provide for this function. This is the intended behavior.
+While there are Helm functions that perform the same completion
+as other helmized Emacs functions, e.g. `switch-to-buffer' and
+`helm-buffers-list', the native Helm functions like
+`helm-buffers-list' can receive new features that allow marking
+candidates, have several actions, etc. Whereas the helmized Emacs
+functions only have Helm completion, Emacs can provide no more
+than one action for this function. This is the intended behavior.
-Generally you are better off using the native Helm command
-than the helmized Emacs equivalent.
+Generally you are better off using the native Helm command than
+the helmized Emacs equivalent.
*** Completion behavior with Helm and completion-at-point
-Helm is NOT completing dynamically, that's mean that when you are
+Helm is NOT completing dynamically. That means that when you are
completing some text at point, completion is done against this
-text and subsequent characters you add AFTER this text, this
-allow you to use matching methods provided by Helm, that is multi
-matching or fuzzy matching (see [[Matching in Helm][Matching in Helm]]).
+text and subsequent characters you add AFTER this text. This
+allows you to use matching methods provided by Helm, that is multi
+matching or fuzzy matching (see [[Matching in Helm][Matching in
+Helm]]).
Completion is not done dynamically (against `helm-pattern')
because backend functions (i.e. `competion-at-point-functions')
-are not aware of the Helm matching methods.
+are not aware of Helm matching methods.
By behaving like this, the benefit is that you can fully use Helm
matching methods but you can't start a full completion against a
-prefix different than the initial text you have at point, Helm
-warn you against this by colorizing the initial input and send an
-user-error message when trying to delete backward text beyond
-this limit at first hit on DEL and on second hit on DEL within a
-short delay (1s) quit Helm and delete-backward char in
+prefix different than the initial text you have at point. Helm
+warns you against this by colorizing the initial input and sends
+a user-error message when trying to delete backward text beyond
+this limit at first hit on DEL. A second hit on DEL within a
+short delay (1s) quits Helm and delete-backward char in
current-buffer.
** Helm help
-\\[helm-documentation]: Show all helm documentations concatenated in one org file.
+\\[helm-documentation]: Show all Helm documentations concatenated
+in one org file.
-From a Helm session, just hit \\<helm-map>\\[helm-help] to have the
-documentation for the current source followed by the global Helm documentation.
+From a Helm session, just hit \\<helm-map>\\[helm-help] to have
+the documentation for the current source followed by the global
+Helm documentation.
-While in the help buffer, most of the Emacs regular keybindings
+While in the help buffer, most of the Emacs regular key bindings
are available; the most important ones are shown in minibuffer.
-However due to the implementation restrictions, no regular Emacs
-keymap is used (it runs in a loop when reading the help buffer)
-they are hardcoded and not modifiable.
+However, due to implementation restrictions, no regular Emacs
+keymap is used (it runs in a loop when reading the help buffer).
+They are hardcoded and not modifiable.
The hard-coded documentation bindings are:
@@ -1305,20 +1392,25 @@ The hard-coded documentation bindings are:
** Customize Helm
Helm provides a lot of user variables for extensive customization.
-From any Helm session, type \\<helm-map>\\[helm-customize-group] to jump to the current source `custom' group.
-Helm also has a special group for faces you can access via `M-x customize-group RET helm-faces'.
+From any Helm session, type \\<helm-map>\\[helm-customize-group]
+to jump to the current source `custom' group. Helm also has a
+special group for faces you can access via `M-x customize-group
+RET helm-faces'.
-Note: Some sources may not have their group set and default to the `helm' group.
+Note: Some sources may not have their group set and default to
+the `helm' group.
** Display Helm in windows and frames
-You can display the helm completion buffer in many differents
+You can display the Helm completion buffer in many different
window configurations, see the custom interface to discover the
-different windows configurations available (See [[Customize Helm][Customize Helm]] to jump to custom interface).
-When using Emacs in a graphic display (i.e. not in a terminal) you can as
-well display your helm buffers in separated frames globally for
-all helm commands or separately for specific helm commands.
-See [[https://github.com/emacs-helm/helm/wiki/frame][helm wiki]] for more infos.
+different windows configurations available (See [[Customize
+Helm][Customize Helm]] to jump to custom interface). When using
+Emacs in a graphic display (i.e. not in a terminal) you can as
+well display your Helm buffers in separated frames globally for
+all Helm commands or separately for specific Helm commands. See
+[[https://github.com/emacs-helm/helm/wiki/frame][helm wiki]] for
+more infos.
** Helm's basic operations and default key bindings
@@ -1334,8 +1426,8 @@ See [[https://github.com/emacs-helm/helm/wiki/frame][helm wiki]] for more infos.
| C-M-S-v | M-prior, C-M-y | Previous page (other-window) |
| C-M-v | M-next | Next page (other-window) |
| Tab | C-i | Show action list |
-| M-o | | Previous source |
-| C-o | | Next source |
+| M-o | left | Previous source |
+| C-o | right | Next source |
| C-k | | Delete pattern (with prefix arg delete from point to end or all [2]) |
| C-j | | Persistent action (Execute and keep Helm session) |
@@ -1344,11 +1436,16 @@ See [[https://github.com/emacs-helm/helm/wiki/frame][helm wiki]] for more infos.
\[2] Delete from point to end or all depending on the value of
`helm-delete-minibuffer-contents-from-point'.
+NOTE: Any of these bindings are from `helm-map' and may be
+overriten by the map specific to the current source in use (each
+source can have its own keymap).
+
** Action transformers
-You may be surprized to see you actions list changing depending of context, this
-happen when a source have an action transformer function which check the current
-candidate selectioned and add specific actions for this candidate.
+You may be surprized to see your actions list changing depending
+on the context. This happen when a source has an action
+transformer function which checks the current selected candidate
+and adds specific actions for this candidate.
** Shortcuts for n-th first actions
@@ -1356,80 +1453,97 @@ f1-f12: Execute n-th action where n is 1 to 12.
** Shortcuts for executing the default action on the n-th candidate
-Helm does not display line numbers by default, with Emacs-26+
-you can enable it permanently in all helm buffers with:
+Helm does not display line numbers by default, with Emacs-26+ you
+can enable it permanently in all helm buffers with:
(add-hook 'helm-after-initialize-hook 'helm-init-relative-display-line-numbers)
-You can also toggle line numbers with \\<helm-map>\\[helm-display-line-numbers-mode] in current helm buffer.
+You can also toggle line numbers with
+\\<helm-map>\\[helm-display-line-numbers-mode] in current Helm
+buffer.
-Of course when enabling `global-display-line-numbers-mode' helm buffers will have line numbers as well.
-\(don't forget to customize `display-line-numbers-type' to relative).
+Of course when enabling `global-display-line-numbers-mode' Helm
+buffers will have line numbers as well. \(Don't forget to
+customize `display-line-numbers-type' to relative).
-In Emacs versions < to 26 you will have to use [[https://github.com/coldnew/linum-relative][linum-relative]] package
-and `helm-linum-relative-mode'.
+In Emacs versions < to 26 you will have to use
+[[https://github.com/coldnew/linum-relative][linum-relative]]
+package and `helm-linum-relative-mode'.
Then when line numbers are enabled with one of the methods above
the following keys are available([1]):
-C-x <n>: Execute default action on the n-th candidate before currently selected candidate.
+C-x <n>: Execute default action on the n-th candidate before
+currently selected candidate.
-C-c <n>: Execute default action on the n-th candidate after current selected candidate.
+C-c <n>: Execute default action on the n-th candidate after
+current selected candidate.
-\"n\" is limited to 1-9. For larger jumps use other navigation keys.
+\"n\" is limited to 1-9. For larger jumps use other navigation
+keys.
-\[1] Note that the keybindings are always available even if line numbers are not displayed,
-they are just useless in this case.
+\[1] Note that the key bindings are always available even if line
+numbers are not displayed. They are just useless in this case.
** Mouse control in Helm
-A basic support for the mouse is provided when the user sets `helm-allow-mouse' to non-nil.
+A basic support for the mouse is provided when the user sets
+`helm-allow-mouse' to non-nil.
- mouse-1 selects the candidate.
- mouse-2 executes the default action on selected candidate.
- mouse-3 pops up the action menu.
-Note: When mouse control is enabled in Helm, it also lets you click around and lose
-the minibuffer focus: you'll have to click on the Helm buffer or the minibuffer
-to retrieve control of your Helm session.
+Note: When mouse control is enabled in Helm, it also lets you
+click around and lose the minibuffer focus: you'll have to click
+on the Helm buffer or the minibuffer to retrieve control of your
+Helm session.
** Marked candidates
-You can mark candidates to execute an action on all of them instead of the
-current selected candidate only. (See bindings below.) Most Helm actions
-operate on marked candidates unless candidate-marking is explicitely forbidden
-for a specific source.
+You can mark candidates to execute an action on all of them
+instead of the current selected candidate only. (See bindings
+below.) Most Helm actions operate on marked candidates unless
+candidate-marking is explicitely forbidden for a specific source.
-- To mark/unmark a candidate, use \\[helm-toggle-visible-mark]. (See bindings below.)
-With a numeric prefix arg mark ARG candidates forward, if ARG is negative
-mark ARG candidates backward.
+- To mark/unmark a candidate, use
+\\[helm-toggle-visible-mark]. (See bindings below.) With a
+numeric prefix arg mark ARG candidates forward, if ARG is
+negative mark ARG candidates backward.
-- To mark all visible unmarked candidates at once in current source use \\[helm-mark-all].
-With a prefix argument, mark all candidates in all sources.
+- To mark all visible unmarked candidates at once in current
+source use \\[helm-mark-all]. With a prefix argument, mark all
+candidates in all sources.
-- To unmark all visible marked candidates at once use \\[helm-unmark-all].
+- To unmark all visible marked candidates at once use
+ \\[helm-unmark-all].
-- To mark/unmark all candidates at once use \\[helm-toggle-all-marks].
-With a prefix argument, mark/unmark all candidates in all sources.
+- To mark/unmark all candidates at once use
+\\[helm-toggle-all-marks]. With a prefix argument, mark/unmark
+all candidates in all sources.
-Note: When multiple candidates are selected across different sources, only the
-candidates of the current source will be used when executing most actions (as
-different sources can have different actions). Some actions support
-multi-source marking however.
+Note: When multiple candidates are selected across different
+sources, only the candidates of the current source will be used
+when executing most actions (as different sources can have
+different actions). Some actions support multi-source marking
+however.
** Follow candidates
-When `helm-follow-mode' is on (\\<helm-map>\\[helm-follow-mode] to toggle it),
-moving up and down the Helm session or updating the list of candidates will
-automatically execute the persistent-action as specified for the current source.
+When `helm-follow-mode' is on (\\<helm-map>\\[helm-follow-mode]
+to toggle it), moving up and down Helm session or updating the
+list of candidates will automatically execute the
+persistent-action as specified for the current source.
-If `helm-follow-mode-persistent' is non-nil, the state of the mode will be
-restored for the following Helm sessions.
+If `helm-follow-mode-persistent' is non-nil, the state of the
+mode will be restored for the following Helm sessions.
-If you just want to follow candidates occasionally without enabling
-`helm-follow-mode', you can use \\<helm-map>\\[helm-follow-action-forward] or \\[helm-follow-action-backward] instead.
-Conversely, when `helm-follow-mode' is enabled, those commands
-go to previous/next line without executing the persistent action.
+If you just want to follow candidates occasionally without
+enabling `helm-follow-mode', you can use
+\\<helm-map>\\[helm-follow-action-forward] or
+\\[helm-follow-action-backward] instead. Conversely, when
+`helm-follow-mode' is enabled, those commands go to previous/next
+line without executing the persistent action.
** Frequently Used Commands
@@ -1447,86 +1561,103 @@ go to previous/next line without executing the persistent action.
** Special yes, no or yes for all answers
-You may be prompted in the minibuffer to answer by [y,n,!,q] in some places
-for confirmation.
+You may be prompted in the minibuffer to answer by [y,n,!,q] in
+some places for confirmation.
- y mean yes
- no mean no
- ! mean yes for all
- q mean quit or abort current operation.
-When using ! you will not be prompted anymore for the same thing in current operation
-e.g. file deletion, file copy etc...
+When using ! you will not be prompted for the same thing in
+current operation any more, e.g. file deletion, file copy etc...
** Moving in `helm-buffer'
-You can move in `helm-buffer' with the usual commands used in Emacs:
-\(\\<helm-map>\\[helm-next-line], \\<helm-map>\\[helm-previous-line], etc. See above basic commands.
-When `helm-buffer' contains more than one source, change source with \\<helm-map>\\[helm-next-source] and \\[helm-previous-source].
+You can move in `helm-buffer' with the usual commands used in
+Emacs: \(\\<helm-map>\\[helm-next-line],
+\\<helm-map>\\[helm-previous-line], etc. See above basic
+commands. When `helm-buffer' contains more than one source,
+change source with \\<helm-map>\\[helm-next-source] and
+\\[helm-previous-source].
-Note: When reaching the end of a source, \\<helm-map>\\[helm-next-line] will *not* go to the next source when
-variable `helm-move-to-line-cycle-in-source' is non-nil, so you will have to use \\<helm-map>\\[helm-next-source]
-and \\[helm-previous-source].
+Note: When reaching the end of a source,
+\\<helm-map>\\[helm-next-line] will *not* go to the next source
+when variable `helm-move-to-line-cycle-in-source' is non-nil, so
+you will have to use \\<helm-map>\\[helm-next-source] and
+\\[helm-previous-source].
** Resume previous session from current Helm session
-You can use `C-c n' (`helm-run-cycle-resume') to cycle in resumables sources.
-`C-c n' is a special key set with `helm-define-key-with-subkeys' which, after pressing it, allows you
-to keep cycling with further `n'.
+You can use `C-c n' (`helm-run-cycle-resume') to cycle in
+resumables sources. `C-c n' is a special key set with
+`helm-define-key-with-subkeys' which, after pressing it, allows
+you to keep cycling with further `n'.
-Tip: You can bound the same key in `global-map' to `helm-cycle-resume'
- with `helm-define-key-with-subkeys' to let you transparently cycle
- sessions, Helm fired up or not.
- You can also bind the cycling commands to single key presses (e.g. `S-<f1>') this time
- with a simple `define-key'. (Note that `S-<f1>' is not available in terminals.)
+Tip: You can bound the same key in `global-map' to
+ `helm-cycle-resume' with `helm-define-key-with-subkeys' to
+ let you transparently cycle sessions, Helm fired up or not.
+ You can also bind the cycling commands to single key
+ presses (e.g., `S-<f1>') this time with a simple
+ `define-key'. (Note that `S-<f1>' is not available in
+ terminals.)
-Note: `helm-define-key-with-subkeys' is available only once Helm is loaded.
+Note: `helm-define-key-with-subkeys' is available only once Helm
+is loaded.
-You can also use \\<helm-map>\\[helm-resume-previous-session-after-quit] to resume
-the previous session, or \\<helm-map>\\[helm-resume-list-buffers-after-quit]
-to have completion on all resumable buffers.
+You can also use
+\\<helm-map>\\[helm-resume-previous-session-after-quit] to resume
+the previous session, or
+\\<helm-map>\\[helm-resume-list-buffers-after-quit] to have
+completion on all resumable buffers.
** Global commands
*** Resume Helm session from outside Helm
-\\<global-map>\\[helm-resume] revives the last `helm' session. Binding a key to
-this command will greatly improve `helm' interactivity, e.g. when quitting Helm
-accidentally.
+\\<global-map>\\[helm-resume] revives the last Helm session.
+Binding a key to this command will greatly improve Helm
+interactivity, e.g. when quitting Helm accidentally.
-You can call \\<global-map>\\[helm-resume] with a prefix argument to choose
-\(with completion!) which session you'd like to resume. You can also cycle in
-these sources with `helm-cycle-resume' (see above).
+You can call \\<global-map>\\[helm-resume] with a prefix argument
+to choose \(with completion!) which session you'd like to resume.
+You can also cycle in these sources with `helm-cycle-resume' (see
+above).
** Debugging Helm
-Helm exposes the special variable `helm-debug': setting it to non-nil
-will enable Helm logging in a special outline-mode buffer.
-Helm resets the variable to nil at the end of each session.
+Helm exposes the special variable `helm-debug': setting it to
+non-nil will enable Helm logging in a special outline-mode
+buffer. Helm resets the variable to nil at the end of each
+session.
For convenience, \\<helm-map>\\[helm-enable-or-switch-to-debug]
-allows you to turn on debugging for this session only.
-To avoid accumulating log entries while you are typing patterns, you can use
-\\<helm-map>\\[helm-toggle-suspend-update] to turn off updating. When you
-are ready turn it on again to resume logging.
+allows you to turn on debugging for this session only. To avoid
+accumulating log entries while you are typing patterns, you can
+use \\<helm-map>\\[helm-toggle-suspend-update] to turn off
+updating. When you are ready turn it on again to resume logging.
-Once you exit your Helm session you can access the debug buffer with
-`helm-debug-open-last-log'. It is possible to save logs to dated files when
-`helm-debug-root-directory' is set to a valid directory.
+Once you exit your Helm session you can access the debug buffer
+with `helm-debug-open-last-log'. It is possible to save logs to
+dated files when `helm-debug-root-directory' is set to a valid
+directory.
-Note: Be aware that Helm log buffers grow really fast, so use `helm-debug' only
-when needed.
+Note: Be aware that Helm log buffers grow really fast, so use
+`helm-debug' only when needed.
** Writing your own Helm sources
-Writing simple sources for your own usage is easy. When calling the `helm'
-function, the sources are added the :sources slot which can be a symbol or a
-list of sources. Sources can be built with different EIEIO classes depending
-what you want to do. To simplify this, several `helm-build-*' macros are
-provided. Below, simple examples to start with.
+Writing simple sources for your own usage is easy. When calling
+the `helm' function, the sources are added the :sources slot
+which can be a symbol or a list of sources. Sources can be built
+with different EIEIO classes depending on what you want to do. To
+simplify this, several `helm-build-*' macros are provided. Below
+there are simple examples to start with.
-We will not go further here, see [[https://github.com/emacs-helm/helm/wiki/Developing][Helm wiki]] and the source
-code for more information and more complex examples.
+We will not go further here, see
+[[https://github.com/emacs-helm/helm/wiki/Developing][Helm wiki]]
+and the source code for more information and more complex
+examples.
#+begin_src elisp
@@ -1554,15 +1685,18 @@ It also accepts function or variable symbol.")
(defvar helm-autoresize-mode) ;; Undefined in `helm-default-display-buffer'.
(defvar helm-async-outer-limit-hook nil
- "A hook that run in async sources when process output comes out of `candidate-number-limit'.
+ "A hook that runs in async sources when process output comes out of `candidate-number-limit'.
Should be set locally to `helm-buffer' with `helm-set-local-variable'.")
(defvar helm-quit-hook nil
- "A hook that run when quitting helm.")
+ "A hook that runs when quitting Helm.")
(defvar helm-resume-after-hook nil
- "A hook that run after resuming a helm session.
-The hook should take one arg SOURCES.")
+ "A hook that runs after resuming a Helm session.
+The hook should takes one arg SOURCES.")
+
+(defvar helm-help-buffer-name "*Helm Help*"
+ "The name of helm help buffer.")
;;; Internal Variables
;;
@@ -1571,8 +1705,8 @@ The hook should take one arg SOURCES.")
"A list of source names to be displayed.
Other sources won't appear in the search results.
If nil, no filtering is done.
-Don't set this directly, use `helm-set-source-filter' during helm session
-to modify it.")
+Don't set this directly, use `helm-set-source-filter' during a
+Helm session to modify it.")
(defvar helm-current-prefix-arg nil
"Record `current-prefix-arg' when exiting minibuffer.")
(defvar helm-saved-action nil
@@ -1582,17 +1716,17 @@ to modify it.")
(defvar helm-in-persistent-action nil
"Flag whether in persistent-action or not.")
(defvar helm-last-buffer nil
- "`helm-buffer' of previously `helm' session.")
+ "`helm-buffer' of a previous Helm session.")
(defvar helm-saved-selection nil
"Value of the currently selected object when the action list is shown.")
(defvar helm-sources nil
"[INTERNAL] Value of current sources in use, a list of alists.
-The list of sources (symbols or alists) is normalized to alists in
-`helm-initialize'.")
+The list of sources (symbols or alists) is normalized to alists
+in `helm-initialize'.")
(defvar helm-buffer-file-name nil
- "Variable `buffer-file-name' when `helm' is invoked.")
+ "Variable `buffer-file-name' when Helm is invoked.")
(defvar helm-candidate-cache (make-hash-table :test 'equal)
- "Holds the available candidate within a single helm invocation.")
+ "Holds the available candidate within a single Helm invocation.")
(defvar helm--candidate-buffer-alist nil)
(defvar helm-input ""
"The input typed in the candidates panel.")
@@ -1603,7 +1737,7 @@ The list of sources (symbols or alists) is normalized to alists in
(defvar helm-tick-hash (make-hash-table :test 'equal))
(defvar helm-issued-errors nil)
(defvar helm--last-log-file nil
- "The name of the log file of the last helm session.")
+ "The name of the log file of the last Helm session.")
(defvar helm--local-variables nil)
(defvar helm-split-window-state nil)
(defvar helm--window-side-state nil)
@@ -1617,22 +1751,22 @@ The list of sources (symbols or alists) is normalized to alists in
(defvar helm--force-updating-p nil
"[INTERNAL] Don't use this in your programs.")
(defvar helm-exit-status 0
- "Flag to inform if helm did exit or quit.
-0 means helm did exit when executing an action.
-1 means helm did quit with \\[keyboard-quit]
-Knowing this exit-status could help restore a window config when helm aborts
-in some special circumstances.
-See `helm-exit-minibuffer' and `helm-keyboard-quit'.")
+ "Flag to inform if Helm did exit or quit.
+0 means Helm did exit when executing an action.
+1 means Helm did quit with \\[keyboard-quit]
+Knowing this exit-status could help restore a window config when
+Helm aborts in some special circumstances. See
+`helm-exit-minibuffer' and `helm-keyboard-quit'.")
(defvar helm-minibuffer-confirm-state nil)
(defvar helm-quit nil)
(defvar helm-buffers nil
"Helm buffers listed in order of most recently used.")
(defvar helm-current-position nil
- "Cons of \(point . window-start\) when `helm' is invoked.
+ "Cons of \(point . window-start\) when Helm is invoked.
`helm-current-buffer' uses this to restore position after
`helm-keyboard-quit'")
(defvar helm-last-frame-or-window-configuration nil
- "Used to store window or frame configuration at helm start.")
+ "Used to store window or frame configuration at Helm start.")
(defvar helm-onewindow-p nil)
(defvar helm-types nil)
(defvar helm--mode-line-string-real nil) ; The string to display in mode-line.
@@ -1660,27 +1794,28 @@ precedence on :default.")
Sources generated by `helm-mode' don't need to be added here
because they are automatically added.
-You should not modify this yourself unless you know what you are doing.")
+You should not modify this yourself unless you know what you are
+doing.")
(defvar helm--completing-file-name nil
"Non nil when `helm-read-file-name' is running.
Used for `helm-file-completion-source-p'.")
;; Same as `ffap-url-regexp' but keep it here to ensure `ffap-url-regexp' is not nil.
(defvar helm--url-regexp "\\`\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)")
(defvar helm--ignore-errors nil
- "Flag to prevent helm popping up errors in candidates functions.
-Should be set in candidates functions if needed, will be restored
-at end of session.")
+ "Flag to prevent Helm popping up errors in candidates functions.
+Should be set in candidates functions if needed, and will be
+restored at end of session.")
(defvar helm--action-prompt "Select action: ")
(defvar helm--cycle-resume-iterator nil)
(defvar helm--buffer-in-new-frame-p nil)
(defvar helm-initial-frame nil
- "[INTERNAL] The selected frame before starting helm.
+ "[INTERNAL] The selected frame before starting Helm.
Helm use this internally to know in which frame it started, don't
modify this yourself.")
(defvar helm-popup-frame nil
- "The frame where helm is displayed.
+ "The frame where Helm is displayed.
-This is only used when helm is using
+This is only used when Helm is using
`helm-display-buffer-in-own-frame' as `helm-display-function' and
`helm-display-buffer-reuse-frame' is non nil.")
(defvar helm--nested nil)
@@ -1695,9 +1830,9 @@ This is only used when helm is using
Local to `helm-buffer'.")
(defvar helm--executing-helm-action nil
"Non nil when action is triggering a new helm-session.
-This may be let bounded in other places to notify the display function
-to reuse the same frame parameters as the previous helm session just
-like resume would do.")
+This may be let bounded in other places to notify the display
+function to reuse the same frame parameters as the previous Helm
+session just like resume would do.")
(defvar helm--current-buffer-narrowed nil)
(defvar helm--suspend-update-interactive-flag nil)
(defvar helm-persistent-action-window-buffer nil
@@ -1708,7 +1843,7 @@ window handling a buffer, it is this one we store.")
;; Utility: logging
(defun helm-log (format-string &rest args)
- "Log message `helm-debug' is non-`nil'.
+ "Log message `helm-debug' is non-nil.
Messages are written to the `helm-debug-buffer' buffer.
Argument FORMAT-STRING is a string to use with `format'.
@@ -1729,7 +1864,7 @@ Use optional arguments ARGS like in `format'."
(apply #'format (cons format-string args)))))))))
(defun helm-log-run-hook (hook)
- "Run HOOK like `run-hooks' but write these actions to helm log buffer."
+ "Run HOOK like `run-hooks' but write these actions to Helm log buffer."
(helm-log "Executing %s with value = %S" hook (symbol-value hook))
(helm-log "Executing %s with global value = %S" hook (default-value hook))
(run-hooks hook)
@@ -1756,7 +1891,7 @@ Use optional arguments ARGS like in `format'."
(defun helm-log-error (&rest args)
"Accumulate error messages into `helm-issued-errors'.
ARGS are args given to `format'.
-e.g (helm-log-error \"Error %s: %s\" (car err) (cdr err))."
+E.g. (helm-log-error \"Error %s: %s\" (car err) (cdr err))."
(apply 'helm-log (concat "ERROR: " (car args)) (cdr args))
(let ((msg (apply 'format args)))
(unless (member msg helm-issued-errors)
@@ -1765,7 +1900,8 @@ e.g (helm-log-error \"Error %s: %s\" (car err) (cdr err))."
(defun helm-log-save-maybe ()
"Save log buffer when `helm-debug-root-directory' is non nil.
Create `helm-debug-root-directory' directory if necessary.
-Messages are logged to a file named with todays date and time in this directory."
+Messages are logged to a file named with today's date and time in
+this directory."
(when (and (stringp helm-debug-root-directory)
(not (file-directory-p helm-debug-root-directory)))
(make-directory helm-debug-root-directory t))
@@ -1793,7 +1929,7 @@ End:")
;;;###autoload
(defun helm-debug-open-last-log ()
- "Open helm log file or buffer of last helm session."
+ "Open Helm log file or buffer of last Helm session."
(interactive)
(if helm--last-log-file
(progn
@@ -1856,7 +1992,7 @@ End:")
`(with-helm-temp-hook 'helm-after-update-hook ,@body))
(defmacro with-helm-alive-p (&rest body)
- "Return error when BODY run outside helm context."
+ "Return error when BODY run outside Helm context."
(declare (indent 0) (debug t))
`(progn
(if helm-alive-p
@@ -1864,7 +2000,7 @@ End:")
(error "Running helm command outside of context"))))
(defmacro with-helm-in-frame (&rest body)
- "Execute helm function in BODY displaying `helm-buffer' in separate frame."
+ "Execute Helm function in BODY displaying `helm-buffer' in separate frame."
(declare (debug t) (indent 0))
`(progn
(helm-set-local-variable
@@ -1879,14 +2015,15 @@ End:")
If SRC is omitted, use current source.
If COMPUTE is non-`nil' compute value of ATTRIBUTE-NAME with
-`helm-interpret-value'. COMPUTE can have also 'ignorefn as value, in
-this case `helm-interpret-value' will return a function as value
-unchanged, but will eval a symbol which is bound.
-
-You can use `setf' to modify value of ATTRIBUTE-NAME unless COMPUTE is
-specified, if attribute ATTRIBUTE-NAME is not found in SOURCE `setf'
-will create new attribute ATTRIBUTE-NAME with specified value.
-You can also use `helm-attrset' to modify ATTRIBUTE-NAME."
+`helm-interpret-value'. COMPUTE can have also 'ignorefn as value,
+in this case `helm-interpret-value' will return a function as
+value unchanged, but will eval a symbol which is bound.
+
+You can use `setf' to modify value of ATTRIBUTE-NAME unless
+COMPUTE is specified, if attribute ATTRIBUTE-NAME is not found in
+SOURCE `setf' will create new attribute ATTRIBUTE-NAME with
+specified value. You can also use `helm-attrset' to modify
+ATTRIBUTE-NAME."
(declare (gv-setter
(lambda (val)
`(let* ((src (or ,source (helm-get-current-source)))
@@ -1905,23 +2042,34 @@ You can also use `helm-attrset' to modify ATTRIBUTE-NAME."
(helm-interpret-value (cdr it) src compute)
(cdr it)))))
+;; (helm-aif (assq attribute-name src)
+;; (let* ((val (cdr it))
+;; When attr exists but have no cdr it is equal to `t'.
+;; (attrval (or val t)))
+;; Attributes with a boolean value have no cdr, so no need
+;; to compute a value == to t.
+;; (if (and compute val)
+;; (helm-interpret-value val src compute)
+;; attrval)))))
+
(cl-defun helm-attrset (attribute-name value
&optional
(src (helm-get-current-source)))
"Set the value of ATTRIBUTE-NAME of source SRC to VALUE.
-If ATTRIBUTE-NAME doesn't exists in source it is created with value VALUE..
-If SRC is omitted, use current source.
-If operation succeed, return value, otherwise nil.
+If ATTRIBUTE-NAME doesn't exists in source it is created with
+value VALUE. If SRC is omitted, use current source. If operation
+succeed, return value, otherwise nil.
-Note that `setf' on `helm-attr' can be used instead of this function."
+Note that `setf' on `helm-attr' can be used instead of this
+function."
(setf (helm-attr attribute-name src) value))
(defun helm-add-action-to-source (name fn source &optional index)
"Add new action NAME linked to function FN to SOURCE.
-Function FN should be a valid function that takes one arg i.e candidate,
-argument NAME is a string that will appear in action menu
-and SOURCE should be an existing helm source already loaded.
+Function FN should be a valid function that takes one arg i.e.
+candidate, argument NAME is a string that will appear in action
+menu and SOURCE should be an existing helm source already loaded.
If INDEX is specified, action is added to the action list at INDEX,
otherwise added at end.
This allows users to add specific actions to an existing source
@@ -1938,8 +2086,8 @@ without modifying source code."
(defun helm-delete-action-from-source (action-or-name source)
"Delete ACTION-OR-NAME from SOURCE.
-ACTION-OR-NAME can either be the name of action or the symbol function
-associated to name."
+ACTION-OR-NAME can either be the name of action or the symbol
+function associated to name."
(let* ((actions (helm-attr 'action source 'ignorefn))
(del-action (if (symbolp action-or-name)
(rassoc action-or-name actions)
@@ -1949,21 +2097,24 @@ associated to name."
(cl-defun helm-add-action-to-source-if (name fn source predicate
&optional (index 4) test-only)
"Add new action NAME linked to function FN to SOURCE.
-Action NAME will be available when the current candidate matches PREDICATE.
+Action NAME will be available when the current candidate matches
+PREDICATE.
This function adds an entry in the `action-transformer' attribute
of SOURCE (or creates one if not found).
Function PREDICATE must take one candidate as arg.
-Function FN should be a valid function that takes one arg i.e. candidate,
-argument NAME is a string that will appear in action menu
-and SOURCE should be an existing helm source already loaded.
+Function FN should be a valid function that takes one arg i.e.
+candidate, argument NAME is a string that will appear in action
+menu and SOURCE should be an existing Helm source already loaded.
If INDEX is specified, action is added in action list at INDEX.
-Value of INDEX should be always >=1, default to 4.
-This allow user to add a specific `action-transformer'
-to an existing source without modifying source code.
-E.g
-Add the action \"Byte compile file async\" linked to
-function 'async-byte-compile-file to source `helm-source-find-files'
-only when predicate helm-ff-candidates-lisp-p return non-`nil':
+Value of INDEX should be always >=1, default to 4. This allows
+user to add a specific `action-transformer' to an existing source
+without modifying source code.
+
+E.g.
+
+Add the action \"Byte compile file async\" linked to function
+'async-byte-compile-file to source `helm-source-find-files' only
+when predicate helm-ff-candidates-lisp-p returns non-nil:
\(helm-add-action-to-source-if \"Byte compile file async\"
'async-byte-compile-file
@@ -1995,12 +2146,12 @@ only when predicate helm-ff-candidates-lisp-p return non-`nil':
(defun helm-set-source-filter (sources)
"Set the value of `helm-source-filter' to SOURCES and update.
-This function sets a filter for helm sources and it may be
-called while helm is running. It can be used to toggle
-displaying of sources dynamically. For example, additional keys
-can be bound into `helm-map' to display only the file-related
-results if there are too many matches from other sources and
-you're after files only:
+This function sets a filter for Helm sources and it may be called
+while Helm is running. It can be used to toggle displaying of
+sources dynamically. For example, additional keys can be bound
+into `helm-map' to display only the file-related results if there
+are too many matches from other sources and you're after files
+only:
Shift+F shows only file results from some sources:
@@ -2039,8 +2190,8 @@ existing Helm function names."
(defun helm-set-sources (sources &optional no-init no-update)
"Set SOURCES during `helm' invocation.
-If NO-INIT is non-`nil', skip executing init functions of SOURCES.
-If NO-UPDATE is non-`nil', skip executing `helm-update'."
+If NO-INIT is non-nil, skip executing init functions of SOURCES.
+If NO-UPDATE is non-nil, skip executing `helm-update'."
(with-current-buffer helm-buffer
(setq helm-sources (helm-get-sources sources))
(helm-log "helm-sources = %S" helm-sources))
@@ -2050,8 +2201,8 @@ If NO-UPDATE is non-`nil', skip executing `helm-update'."
(defun helm-get-selection (&optional buffer force-display-part source)
"Return the currently selected item or nil.
-if BUFFER is nil or unspecified, use helm-buffer as default value.
-If FORCE-DISPLAY-PART is non-`nil', return the display string.
+If BUFFER is nil or unspecified, use `helm-buffer' as default value.
+If FORCE-DISPLAY-PART is non-nil, return the display string.
If FORCE-DISPLAY-PART value is `withprop' the display string is returned
with its properties."
(setq buffer (or buffer helm-buffer))
@@ -2133,7 +2284,7 @@ Return nil when `helm-buffer' is empty."
source)))))))))
(defun helm-buffer-is-modified (buffer)
- "Return non-`nil' when BUFFER is modified since `helm' was invoked."
+ "Return non-nil when BUFFER is modified since Helm was invoked."
(let* ((buf (get-buffer buffer))
(key (concat (buffer-name buf) "/" (helm-attr 'name)))
(source-tick (or (gethash key helm-tick-hash) 0))
@@ -2145,18 +2296,18 @@ Return nil when `helm-buffer' is empty."
modifiedp))
(defun helm-current-buffer-is-modified ()
- "Check if `helm-current-buffer' is modified since `helm' was invoked."
+ "Check if `helm-current-buffer' is modified since Helm was invoked."
(helm-buffer-is-modified helm-current-buffer))
(defun helm-run-after-exit (function &rest args)
- "Execute FUNCTION with ARGS after exiting `helm'.
+ "Execute FUNCTION with ARGS after exiting Helm.
The action is to call FUNCTION with arguments ARGS.
Unlike `helm-exit-and-execute-action', this can be used
-to call non--actions functions with any ARGS or no ARGS at all.
+to call non-actions functions with any ARGS or no ARGS at all.
-Use this on commands invoked from key-bindings, but not
-on action functions invoked as action from the action menu,
-i.e. functions called with RET."
+Use this on commands invoked from key bindings, but not on action
+functions invoked as action from the action menu, i.e. functions
+called with RET."
(helm-kill-async-processes)
(helm-log "function = %S" function)
(helm-log "args = %S" args)
@@ -2165,13 +2316,13 @@ i.e. functions called with RET."
(apply function args))))
(defun helm-exit-and-execute-action (action)
- "Exit current helm session and execute ACTION.
-Argument ACTION is a function called with one arg (candidate)
-and part of the actions of current source.
+ "Exit current Helm session and execute ACTION.
+Argument ACTION is a function called with one arg (candidate) and
+part of the actions of current source.
-Use this on commands invoked from key-bindings, but not
+Use this on commands invoked from key bindings, but not
on action functions invoked as action from the action menu,
-i.e functions called with RET."
+i.e. functions called with RET."
;; If ACTION is not an action available in source 'action attribute,
;; return an error. This allow to remove unneeded actions from
;; source that inherit actions from type, note that ACTION have to
@@ -2249,7 +2400,7 @@ Otherwise, return VALUE itself."
Use this to set local vars before calling helm.
When used from an init or update function
-(i.e when `helm-force-update' is running) the variables are set
+\(i.e. when `helm-force-update' is running) the variables are set
using `make-local-variable' within the `helm-buffer'.
Usage: helm-set-local-variable ([VAR VALUE]...)
@@ -2310,19 +2461,20 @@ was deleted and the candidates list not updated."
(defun helm-apply-functions-from-source (source functions &rest args)
"From SOURCE apply FUNCTIONS on ARGS.
-This function is used to process filter functions, when filter is a
-\`filtered-candidate-transformer', we pass to ARGS candidates+source
-whereas when the filter is `candidate-transformer' we pass to ARGS
-candidates only.
-This function is used also to process functions called with no args,
-e.g. init functions, in this case it is called without ARGS.
+This function is used to process filter functions. When filter is
+a \`filtered-candidate-transformer', we pass to ARGS
+candidates+source whereas when the filter is
+`candidate-transformer' we pass to ARGS candidates only.
+This function is also used to process functions called with no
+args, e.g. init functions. In this case it is called without
+ARGS.
See `helm-process-filtered-candidate-transformer'
\`helm-compute-attr-in-sources' and
\`helm-process-candidate-transformer'.
-Arg FUNCTIONS is either a symbol or a list of functions, each function being
-applied on ARGS and called on the result of the precedent function.
-Return the result of last function call."
+Arg FUNCTIONS is either a symbol or a list of functions, each
+function being applied on ARGS and called on the result of the
+precedent function. Return the result of last function call."
(let ((helm--source-name (assoc-default 'name source))
(helm-current-source source)
(funs (if (functionp functions) (list functions) functions)))
@@ -2367,8 +2519,8 @@ Return the result of last function call."
(defun helm-get-candidate-number (&optional in-current-source)
"Return candidates number in `helm-buffer'.
-If IN-CURRENT-SOURCE is provided return number of candidates of current source
-only."
+If IN-CURRENT-SOURCE is provided return the number of candidates
+of current source only."
(with-helm-buffer
(if (or (helm-empty-buffer-p)
(helm-empty-source-p))
@@ -2508,7 +2660,7 @@ the list items, starting with the first.
If nil, `thing-at-point' is used.
-If `helm--maybe-use-default-as-input' is non-`nil', display is
+If `helm--maybe-use-default-as-input' is non-nil, display is
updated using this value, unless :input is specified, in which
case that value is used instead.
@@ -2532,7 +2684,7 @@ session. The `helm-' prefix can be omitted. For example,
:buffer \"*helm buffers*\"
:candidate-number-limit 10\)
-starts a Helm session with the variable
+Starts a Helm session with the variable
`helm-candidate-number-limit' set to 10.
** Backward compatibility
@@ -2580,9 +2732,9 @@ However, the use of non-keyword args is deprecated.
(apply fn plist))))) ; [1] fn == helm-internal.
(defun helm--alive-p ()
- "[Internal] Check if `helm' is alive.
-An `helm' session is considered alive if `helm-alive-p' value is
-non-`nil', the `helm-buffer' is visible, and cursor is in the
+ "[INTERNAL] Check if `helm' is alive.
+An Helm session is considered alive if `helm-alive-p' value is
+non-nil, the `helm-buffer' is visible, and cursor is in the
minibuffer."
(and helm-alive-p
(get-buffer-window (helm-buffer-get) 'visible)
@@ -2592,11 +2744,11 @@ minibuffer."
(defun helm-parse-keys (keys)
"Parse the KEYS arguments of `helm'.
Return only those keys not in `helm-argument-keys', prefix them
-with \"helm\", and then convert them to an alist. This allows
+with \"helm\", and then convert them to an alist. This allows
adding arguments that are not part of `helm-argument-keys', but
-are valid helm variables nevertheless. For
-example, :candidate-number-limit is bound to
-`helm-candidate-number-limit' in the source.
+are valid helm variables nevertheless. For example,
+:candidate-number-limit is bound to `helm-candidate-number-limit'
+in the source.
(helm-parse-keys '(:sources ((name . \"test\")
(candidates . (a b c)))
@@ -2614,17 +2766,17 @@ example, :candidate-number-limit is bound to
;;; Entry point helper
(defun helm-internal (&optional
- any-sources any-input
- any-prompt any-resume
- any-preselect any-buffer
- any-keymap any-default any-history)
- "The internal helm function called by `helm'.
-For ANY-SOURCES ANY-INPUT ANY-PROMPT ANY-RESUME ANY-PRESELECT ANY-BUFFER and
-ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
- (cl-assert (or (stringp any-input)
- (null any-input))
+ sources input
+ prompt resume
+ preselect buffer
+ keymap default history)
+ "The internal Helm function called by `helm'.
+For SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT and
+HISTORY args see `helm'."
+ (cl-assert (or (stringp input)
+ (null input))
nil "Error in %S buffer: Initial input should be a string or nil"
- any-buffer)
+ buffer)
(unless helm--nested (setq helm-initial-frame (selected-frame)))
;; Activate the advices.
;; Advices will be available only in >=emacs-24.4, but
@@ -2638,24 +2790,25 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
;; performances (Issue #1894).
(advice-add 'linum-on :override #'helm--advice-linum-on '((depth . 100))))
(helm-log (concat "[Start session] " (make-string 41 ?+)))
- (helm-log "any-prompt = %S" any-prompt)
- (helm-log "any-preselect = %S" any-preselect)
- (helm-log "any-buffer = %S" any-buffer)
- (helm-log "any-keymap = %S" any-keymap)
- (helm-log "any-default = %S" any-default)
- (helm-log "any-history = %S" any-history)
- (setq helm--prompt (or any-prompt "pattern: "))
+ (helm-log "prompt = %S" prompt)
+ (helm-log "preselect = %S" preselect)
+ (helm-log "buffer = %S" buffer)
+ (helm-log "keymap = %S" keymap)
+ (helm-log "default = %S" default)
+ (helm-log "history = %S" history)
+ (setq helm--prompt (or prompt "pattern: "))
(let ((non-essential t)
;; Prevent mouse jumping to the upper-right
;; hand corner of the frame (#1538).
mouse-autoselect-window
focus-follows-mouse
mode-line-in-non-selected-windows
+ minibuffer-completion-confirm
(input-method-verbose-flag helm-input-method-verbose-flag)
(helm--maybe-use-default-as-input
- (and (null any-input)
+ (and (null input)
(or helm--maybe-use-default-as-input ; it is let-bounded so use it.
- (cl-loop for s in (helm-normalize-sources any-sources)
+ (cl-loop for s in (helm-normalize-sources sources)
thereis (memq s helm-sources-using-default-as-input))))))
(unwind-protect
(condition-case-unless-debug _v
@@ -2665,9 +2818,9 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
helm-current-source
helm-in-persistent-action
helm-quit
- (helm-buffer (or any-buffer helm-buffer)))
+ (helm-buffer (or buffer helm-buffer)))
(helm-initialize
- any-resume any-input any-default any-sources)
+ resume input default sources)
;; We don't display helm-buffer here to avoid popping
;; up a window or a frame when exiting immediately when
;; only one candidate (this avoid having the helm frame
@@ -2675,7 +2828,7 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
;; than one display helm-buffer (this is done later in
;; helm-read-pattern-maybe).
(unless helm-execute-action-at-once-if-one
- (helm-display-buffer helm-buffer any-resume)
+ (helm-display-buffer helm-buffer resume)
(select-window (helm-window)))
;; We are now in helm-buffer.
(unless helm-allow-mouse
@@ -2688,8 +2841,8 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
(helm-log "show prompt")
(unwind-protect
(helm-read-pattern-maybe
- any-prompt any-input any-preselect
- any-resume any-keymap any-default any-history)
+ prompt input preselect
+ resume keymap default history)
(helm-cleanup))
(prog1
(unless helm-quit (helm-execute-selection-action))
@@ -2727,38 +2880,38 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
;;
;;
(defun helm-resume (arg)
- "Resume a previous `helm' session.
-Call with a prefix arg to choose among existing helm
-buffers (sessions). When calling from lisp, specify a buffer-name
-as a string with ARG."
+ "Resume a previous Helm session.
+Call with a prefix arg to choose among existing Helm
+buffers (sessions). When calling from Lisp, specify a
+`buffer-name' as a string with ARG."
(interactive "P")
- (let (any-buffer
+ (let (buffer
cur-dir
narrow-pos
(helm-full-frame (default-value 'helm-full-frame))
sources)
(if arg
(if (and (stringp arg) (bufferp (get-buffer arg)))
- (setq any-buffer arg)
- (setq any-buffer (helm-resume-select-buffer)))
- (setq any-buffer helm-last-buffer))
- (cl-assert any-buffer nil
+ (setq buffer arg)
+ (setq buffer (helm-resume-select-buffer)))
+ (setq buffer helm-last-buffer))
+ (cl-assert buffer nil
"helm-resume: No helm buffers found to resume")
(setq sources (buffer-local-value
- 'helm-sources (get-buffer any-buffer)))
+ 'helm-sources (get-buffer buffer)))
;; Reset `cursor-type' to nil as it have been set to t
;; when quitting previous session.
- (with-current-buffer any-buffer (setq cursor-type nil))
+ (with-current-buffer buffer (setq cursor-type nil))
(setq helm-full-frame (buffer-local-value
- 'helm-full-frame (get-buffer any-buffer)))
+ 'helm-full-frame (get-buffer buffer)))
(setq cur-dir (buffer-local-value
- 'default-directory (get-buffer any-buffer)))
+ 'default-directory (get-buffer buffer)))
(setq helm-saved-selection nil
helm-saved-action nil)
(unless (buffer-live-p helm-current-buffer)
;; `helm-current-buffer' may have been killed.
(setq helm-current-buffer (current-buffer)))
- (helm-aif (with-current-buffer any-buffer
+ (helm-aif (with-current-buffer buffer
helm--current-buffer-narrowed)
(progn
(set-buffer (car it))
@@ -2774,14 +2927,14 @@ as a string with ARG."
(unwind-protect
(helm
:sources sources
- :input (buffer-local-value 'helm-input-local (get-buffer any-buffer))
- :prompt (buffer-local-value 'helm--prompt (get-buffer any-buffer))
+ :input (buffer-local-value 'helm-input-local (get-buffer buffer))
+ :prompt (buffer-local-value 'helm--prompt (get-buffer buffer))
:resume t
- :buffer any-buffer)
+ :buffer buffer)
(run-hook-with-args 'helm-resume-after-hook sources))))))
(defun helm-resume-previous-session-after-quit ()
- "Resume previous helm session within a running helm."
+ "Resume previous Helm session within a running Helm."
(interactive)
(with-helm-alive-p
(let ((arg (if (null (member helm-buffer helm-buffers)) 0 1)))
@@ -2791,7 +2944,7 @@ as a string with ARG."
(put 'helm-resume-previous-session-after-quit 'helm-only t)
(defun helm-resume-list-buffers-after-quit ()
- "List resumable helm buffers within running helm."
+ "List Helm buffers that can be resumed within a running Helm."
(interactive)
(with-helm-alive-p
(if (> (length helm-buffers) 0)
@@ -2799,9 +2952,9 @@ as a string with ARG."
(message "No previous helm sessions available for resuming!"))))
(put 'helm-resume-list-buffers-after-quit 'helm-only t)
-(defun helm-resume-p (any-resume)
- "Whether current helm session is resumed or not."
- (eq any-resume t))
+(defun helm-resume-p (resume)
+ "Whether current Helm session is resumed or not."
+ (eq resume t))
(defun helm-resume-select-buffer ()
"Select an `helm-buffer' in `helm-buffers' list to resume a helm session.
@@ -2843,7 +2996,7 @@ Return nil if no `helm-buffer' found."
(helm-iter-next helm--cycle-resume-iterator))))))
(defun helm-run-cycle-resume ()
- "Same as `helm-cycle-resume' but intended to be called only from helm."
+ "Same as `helm-cycle-resume' but intended to be called only from Helm."
(interactive)
(when (cdr helm-buffers) ; only one session registered.
;; Setup a new iterator only on first hit on
@@ -2862,16 +3015,16 @@ Return nil if no `helm-buffer' found."
;;;###autoload
-(defun helm-other-buffer (any-sources any-buffer)
- "Simplified `helm' interface with other `helm-buffer'.
-Call `helm' only with ANY-SOURCES and ANY-BUFFER as args."
- (helm :sources any-sources :buffer any-buffer))
+(defun helm-other-buffer (sources buffer)
+ "Simplified Helm interface with other `helm-buffer'.
+Call `helm' only with SOURCES and BUFFER as args."
+ (helm :sources sources :buffer buffer))
;;; Nested sessions
;;
;;
(defun helm--nest (&rest same-as-helm)
- "[internal]Allows calling `helm' within a running helm session.
+ "[INTERNAL] Allow calling `helm' within a running Helm session.
Arguments SAME-AS-HELM are the same as `helm'.
@@ -3006,11 +3159,13 @@ frame configuration as per `helm-save-configuration-functions'."
"Default function to split windows before displaying `helm-buffer'.
It is used as default value for
-`helm-split-window-preferred-function' which is then the let-bounded
-value of `split-window-preferred-function' in `helm-display-buffer'.
-When `helm-display-function' which default to
-`helm-default-display-buffer' is called from `helm-display-buffer' the
-value of `split-window-preferred-function' will be used by `display-buffer'."
+`helm-split-window-preferred-function' which is then the
+let-bounded value of `split-window-preferred-function' in
+`helm-display-buffer'. When `helm-display-function' which default
+to `helm-default-display-buffer' is called from
+`helm-display-buffer' the value of
+`split-window-preferred-function' will be used by
+`display-buffer'."
(let* (split-width-threshold
(win (if (and (fboundp 'window-in-direction)
;; Don't try to split when starting in a minibuffer
@@ -3047,7 +3202,7 @@ value of `split-window-preferred-function' will be used by `display-buffer'."
(defun helm-window-in-direction (direction)
"Same as `window-in-direction' but check if window is dedicated.
-Returns nil when window is dedicated."
+Return nil when window is dedicated."
(helm-aif (window-in-direction direction)
(and (not (window-dedicated-p it)) it)))
@@ -3062,14 +3217,15 @@ Returns nil when window is dedicated."
;;
;;
(defun helm-resolve-display-function (com)
- "Decide which display function use according to `helm-commands-using-frame'.
+ "Decide which display function to use according to `helm-commands-using-frame'.
-The `helm-display-function' buffer local value takes precedence on
-`helm-commands-using-frame'.
+The `helm-display-function' buffer local value takes precedence
+on `helm-commands-using-frame'.
If `helm-initial-frame' has no minibuffer, use
`helm-display-buffer-in-own-frame' function.
Fallback to global value of `helm-display-function' when no local
-value found and current command is not in `helm-commands-using-frame'."
+value found and current command is not in
+`helm-commands-using-frame'."
(or (with-helm-buffer helm-display-function)
(and (or (memq com helm-commands-using-frame)
(and helm-use-frame-when-dedicated-window
@@ -3086,7 +3242,7 @@ value found and current command is not in `helm-commands-using-frame'."
"Display BUFFER.
The function used to display `helm-buffer' by calling
-`helm-display-function' which split window with
+`helm-display-function' which splits window with
`helm-split-window-preferred-function'."
(let ((split-window-preferred-function
helm-split-window-preferred-function)
@@ -3124,7 +3280,7 @@ Arg ENABLE is the value of `no-other-window' window property."
(defun helm-default-display-buffer (buffer &optional _resume)
"Default function to display `helm-buffer' BUFFER.
-It is the default value of `helm-display-function'
+It is the default value of `helm-display-function'.
It uses `switch-to-buffer' or `display-buffer' depending on the
value of `helm-full-frame' or `helm-split-window-default-side'."
(let (pop-up-frames
@@ -3156,14 +3312,14 @@ value of `helm-full-frame' or `helm-split-window-default-side'."
(defvar tab-bar-mode)
(defun helm-display-buffer-in-own-frame (buffer &optional resume)
- "Display helm buffer BUFFER in a separate frame.
+ "Display Helm buffer BUFFER in a separate frame.
Function suitable for `helm-display-function',
-`helm-completion-in-region-display-function'
-and/or `helm-show-completion-default-display-function'.
+`helm-completion-in-region-display-function' and/or
+`helm-show-completion-default-display-function'.
-See `helm-display-buffer-height' and `helm-display-buffer-width' to
-configure frame size.
+See `helm-display-buffer-height' and `helm-display-buffer-width'
+to configure frame size.
Note that this feature is available only with emacs-25+."
(cl-assert (and (fboundp 'window-absolute-pixel-edges)
@@ -3245,12 +3401,16 @@ Note that this feature is available only with emacs-25+."
(defun helm-display-buffer-popup-frame (buffer frame-alist)
(if helm-display-buffer-reuse-frame
(let* ((x (cdr (assoc 'left frame-alist)))
- (y (cdr (assoc 'top frame-alist))))
+ (y (cdr (assoc 'top frame-alist)))
+ (width (cdr (assoc 'width frame-alist)))
+ (height (cdr (assoc 'height frame-alist))))
(unless (and helm-popup-frame
(frame-live-p helm-popup-frame))
(setq helm-popup-frame (make-frame frame-alist)))
(select-frame helm-popup-frame)
(set-frame-position helm-popup-frame x y)
+ (set-frame-width helm-popup-frame width)
+ (set-frame-height helm-popup-frame height)
(switch-to-buffer buffer)
(select-frame-set-input-focus helm-popup-frame t))
;; If user have changed `helm-display-buffer-reuse-frame' to nil
@@ -3274,51 +3434,51 @@ Note that this feature is available only with emacs-25+."
;;
(defun helm-get-sources (sources)
"Transform each element of SOURCES in alist.
-Returns the resulting list."
+Return the resulting list."
(when sources
(mapcar (lambda (source)
(if (listp source)
source (symbol-value source)))
(helm-normalize-sources sources))))
-(defun helm-initialize (any-resume any-input any-default any-sources)
- "Start initialization of `helm' session.
-For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'."
- (helm-log "start initialization: any-resume=%S any-input=%S"
- any-resume any-input)
+(defun helm-initialize (resume input default sources)
+ "Start initialization of Helm session.
+For RESUME INPUT DEFAULT and SOURCES see `helm'."
+ (helm-log "start initialization: resume=%S input=%S"
+ resume input)
(helm-frame-or-window-configuration 'save)
- (let ((sources (helm-get-sources any-sources)))
+ (let ((sources-list (helm-get-sources sources)))
(setq helm--in-fuzzy
- (cl-loop for s in sources
+ (cl-loop for s in sources-list
for matchfns = (helm-match-functions s)
for searchfns = (helm-search-functions s)
when (or (memq 'helm-fuzzy-match matchfns)
(memq 'helm-fuzzy-search searchfns))
return t))
- (helm-log "sources = %S" sources)
- (helm-set-local-variable 'helm-sources sources)
+ (helm-log "sources-list = %S" sources-list)
+ (helm-set-local-variable 'helm-sources sources-list)
;; Once `helm-buffer' is created `helm-sources' will be a local
;; variable which value is a list of alists.
(helm-current-position 'save)
- (if (helm-resume-p any-resume)
+ (if (helm-resume-p resume)
(helm-initialize-overlays (helm-buffer-get))
- (helm-initial-setup any-default sources))
+ (helm-initial-setup default sources-list))
(setq helm-alive-p t)
- (unless (eq any-resume 'noresume)
+ (unless (eq resume 'noresume)
(helm--push-and-remove-dups helm-buffer 'helm-buffers)
(setq helm-last-buffer helm-buffer))
- (when any-input
- (setq helm-input any-input
- helm-pattern any-input)
+ (when input
+ (setq helm-input input
+ helm-pattern input)
(helm--fuzzy-match-maybe-set-pattern))
;; If a `resume' attribute is present `helm-compute-attr-in-sources'
;; will run its function.
- (when (helm-resume-p any-resume)
+ (when (helm-resume-p resume)
(helm-compute-attr-in-sources 'resume))
(helm-log "end initialization")))
(defun helm-initialize-overlays (buffer)
- "Initialize helm overlays in BUFFER."
+ "Initialize Helm overlays in BUFFER."
(helm-log "overlay setup")
(if helm-selection-overlay
;; make sure the overlay belongs to the helm buffer if
@@ -3340,10 +3500,10 @@ For ANY-RESUME ANY-INPUT ANY-DEFAULT and ANY-SOURCES See `helm'."
(set sym (cons elm (delete elm (symbol-value sym)))))
(defun helm--current-buffer ()
- "[internal] Return `current-buffer' BEFORE `helm-buffer' is initialized.
-Note that it returns the minibuffer in use after helm has started
-and is intended for `helm-initial-setup'. To get the buffer where
-helm was started, use `helm-current-buffer' instead."
+ "[INTERNAL] Return `current-buffer' BEFORE `helm-buffer' is initialized.
+Note that it returns the minibuffer in use after Helm has started
+and is intended for `helm-initial-setup'. To get the buffer where
+Helm was started, use `helm-current-buffer' instead."
(if (minibuffer-window-active-p (minibuffer-window))
;; If minibuffer is active be sure to use it's buffer
;; as `helm-current-buffer', this allow to use helm
@@ -3372,8 +3532,8 @@ See :after-init-hook and :before-init-hook in `helm-source'."
and do (helm-log-run-hook h)
else do (helm-log-run-hook hv)))
-(defun helm-initial-setup (any-default sources)
- "Initialize helm settings and set up the helm buffer."
+(defun helm-initial-setup (default sources)
+ "Initialize Helm settings and set up the Helm buffer."
;; Run global hook.
(helm-log-run-hook 'helm-before-initialize-hook)
;; Run local source hook.
@@ -3411,8 +3571,8 @@ See :after-init-hook and :before-init-hook in `helm-source'."
;; Call the init function for sources where appropriate
(helm-compute-attr-in-sources 'init sources)
(setq helm-pattern (or (and helm--maybe-use-default-as-input
- (or (if (listp any-default)
- (car any-default) any-default)
+ (or (if (listp default)
+ (car default) default)
(with-helm-current-buffer
(thing-at-point 'symbol))))
""))
@@ -3427,8 +3587,8 @@ See :after-init-hook and :before-init-hook in `helm-source'."
(define-derived-mode helm-major-mode
fundamental-mode "Hmm"
- "[Internal] Provide major-mode name in helm buffers.
-Unuseful when used outside helm, don't use it.")
+ "[INTERNAL] Provide major-mode name in Helm buffers.
+Unuseful when used outside Helm, don't use it.")
(put 'helm-major-mode 'mode-class 'special)
(put 'helm-major-mode 'helm-only t)
@@ -3466,9 +3626,9 @@ Unuseful when used outside helm, don't use it.")
(get-buffer helm-buffer)))
(define-minor-mode helm--minor-mode
- "[INTERNAL] Enable keymap in helm minibuffer.
-Since this mode has no effect when run outside of helm context,
-please don't use it outside helm.
+ "[INTERNAL] Enable keymap in Helm minibuffer.
+Since this mode has no effect when run outside of Helm context,
+please don't use it outside of Helm.
\\{helm-map}"
:group 'helm
@@ -3480,21 +3640,21 @@ please don't use it outside helm.
(setq helm-pattern "")
(setq helm--maybe-use-default-as-input nil))
-(defun helm-read-pattern-maybe (any-prompt any-input
- any-preselect any-resume any-keymap
- any-default any-history)
- "Read pattern with prompt ANY-PROMPT and initial input ANY-INPUT.
-For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
+(defun helm-read-pattern-maybe (prompt
+ input preselect resume
+ keymap default history)
+ "Read pattern with prompt PROMPT and initial input INPUT.
+For PRESELECT RESUME KEYMAP DEFAULT HISTORY, see `helm'."
(with-helm-buffer
- (if (and (helm-resume-p any-resume)
+ (if (and (helm-resume-p resume)
;; When no source, helm-buffer is empty
;; or contain non--candidate lines (e.g grep exit status)
(helm-get-current-source))
(helm-mark-current-line t)
- (helm-update any-preselect))
+ (helm-update preselect))
(let* ((src (helm-get-current-source))
(src-keymap (assoc-default 'keymap src))
- (hist (or (and any-history (symbolp any-history) any-history)
+ (hist (or (and history (symbolp history) history)
;; Needed for resuming.
(assoc-default 'history src)))
(timer nil)
@@ -3509,7 +3669,7 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
(helm-log "helm-execute-action-at-once-if-one = %S"
helm-execute-action-at-once-if-one)
(helm-log "helm-quit-if-no-candidate = %S" helm-quit-if-no-candidate)
- (when (and src (helm-resume-p any-resume))
+ (when (and src (helm-resume-p resume))
(helm-display-mode-line src))
;; Reset `helm-pattern' and update
;; display if no result found with precedent value of `helm-pattern'
@@ -3548,11 +3708,11 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
(and (functionp helm-quit-if-no-candidate)
(funcall helm-quit-if-no-candidate)))
(t ; Enter now minibuffer and wait for input.
- (let ((tap (or any-default
+ (let ((tap (or default
(with-helm-current-buffer
(thing-at-point 'symbol)))))
(when helm-execute-action-at-once-if-one
- (helm-display-buffer helm-buffer any-resume)
+ (helm-display-buffer helm-buffer resume)
(select-window (helm-window)))
(unwind-protect
(minibuffer-with-setup-hook
@@ -3562,10 +3722,10 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
;; Now override the global value of `helm-map' with
;; the local one which is in this order:
;; - The keymap of current source.
- ;; - The value passed in ANY-KEYMAP
+ ;; - The value passed in KEYMAP
;; - Or fallback to the global value of helm-map.
(helm--maybe-update-keymap
- (or src-keymap any-keymap helm-map))
+ (or src-keymap keymap helm-map))
(helm-log-run-hook 'helm-minibuffer-set-up-hook)
(setq timer
(run-with-idle-timer
@@ -3583,17 +3743,17 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
(helm-print-error-messages))))))
;; minibuffer has already been filled here.
(helm--update-header-line))
- (read-from-minibuffer (propertize (or any-prompt "pattern: ")
+ (read-from-minibuffer (propertize (or prompt "pattern: ")
'face 'helm-minibuffer-prompt)
- any-input helm-map
+ input helm-map
nil hist tap
helm-inherit-input-method))
(when timer (cancel-timer timer) (setq timer nil)))))))))
(defun helm-toggle-suspend-update ()
"Enable or disable display update in helm.
-This can be useful for example for quietly writing a complex regexp
-without helm constantly updating."
+This can be useful for example for quietly writing a complex
+regexp without Helm constantly updating."
(interactive)
(helm-suspend-update (not helm-suspend-update-flag) t)
(setq helm--suspend-update-interactive-flag
@@ -3637,9 +3797,9 @@ Update is reenabled when idle 1s."
(put 'helm-delete-backward-no-update 'helm-only t)
(defun helm--suspend-read-passwd (old--fn &rest args)
- "Suspend helm while reading password.
-This is used to advice `tramp-read-passwd', `ange-ftp-get-passwd' and
-`epa-passphrase-callback-function'."
+ "Suspend Helm while reading password.
+This is used to advice `tramp-read-passwd', `ange-ftp-get-passwd'
+and `epa-passphrase-callback-function'."
;; Suspend update when prompting for a tramp password.
(setq helm-suspend-update-flag t)
(setq overriding-terminal-local-map nil)
@@ -3654,7 +3814,7 @@ This is used to advice `tramp-read-passwd', `ange-ftp-get-passwd' and
(defun helm--maybe-update-keymap (&optional map)
"Handle different keymaps in multiples sources.
-Overrides `helm-map' with the local map of current source. If no
+Overrides `helm-map' with the local map of current source. If no
map is found in current source, does nothing (keeps previous
map)."
(with-helm-buffer
@@ -3687,7 +3847,7 @@ map)."
"[INTERNAL] Prevent escaping helm minibuffer with mouse clicks.
Do nothing when used outside of helm context.
-WARNING: Do not use this mode yourself, it is internal to helm."
+WARNING: Do not use this mode yourself, it is internal to Helm."
:group 'helm
:global t
:keymap helm--remap-mouse-mode-map
@@ -3698,7 +3858,7 @@ WARNING: Do not use this mode yourself, it is internal to helm."
;; Clean up
(defun helm-cleanup ()
- "Clean up the mess when helm exit or quit."
+ "Clean up the mess when Helm exit or quit."
(helm-log "start cleanup")
(with-current-buffer helm-buffer
(let ((frame (selected-frame)))
@@ -3904,7 +4064,7 @@ Cache the candidates if there is no cached value yet."
,candidate))
(defun helm--initialize-one-by-one-candidates (candidates source)
- "Process the CANDIDATES with the `filter-one-by-one' function in SOURCE.
+ "Process CANDIDATES with the `filter-one-by-one' function in SOURCE.
Return CANDIDATES unchanged when pattern is not empty."
(helm-aif (and (string= helm-pattern "")
(assoc-default 'filter-one-by-one source))
@@ -3915,8 +4075,9 @@ Return CANDIDATES unchanged when pattern is not empty."
(defun helm-process-filtered-candidate-transformer-maybe
(candidates source process-p)
"Execute `filtered-candidate-transformer' function(s) on CANDIDATES in SOURCE.
-When PROCESS-P is non-`nil' execute `filtered-candidate-transformer'
-functions if some, otherwise return CANDIDATES."
+When PROCESS-P is non-nil execute
+`filtered-candidate-transformer' functions if some, otherwise
+return CANDIDATES."
(if process-p
;; When no filter return CANDIDATES unmodified.
(helm-process-filtered-candidate-transformer candidates source)
@@ -3938,7 +4099,7 @@ functions if some, otherwise return CANDIDATES."
(defun helm-transform-candidates (candidates source &optional process-p)
"Transform CANDIDATES from SOURCE according to candidate transformers.
-When PROCESS-P is non-`nil' executes the
+When PROCESS-P is non-nil executes the
`filtered-candidate-transformer' functions, otherwise processes
`candidate-transformer' functions only,
`filtered-candidate-transformer' functions being processed later,
@@ -3959,7 +4120,7 @@ maybe filtered CANDIDATES."
"Apply candidate-number-limit attribute value.
This overrides `helm-candidate-number-limit' variable.
-e.g:
+E.g.:
If \(candidate-number-limit\) is in SOURCE, show all candidates in SOURCE.
If \(candidate-number-limit . 123\) is in SOURCE limit candidate to 123."
(helm-aif (assq 'candidate-number-limit source)
@@ -4071,7 +4232,7 @@ This function is used with sources built with `helm-source-sync'."
Score is calculated for contiguous matches found with PATTERN.
Score is 100 (maximum) if PATTERN is fully matched in CANDIDATE.
One point bonus is added to score when PATTERN prefix matches
-CANDIDATE. Contiguous matches get a coefficient of 2."
+CANDIDATE. Contiguous matches get a coefficient of 2."
(let* ((cand (if (stringp candidate)
candidate (helm-stringify candidate)))
(pat-lookup (helm--collect-pairs-in-string pattern))
@@ -4108,8 +4269,8 @@ CANDIDATE. Contiguous matches get a coefficient of 2."
"The transformer for sorting candidates in fuzzy matching.
It sorts on the display part by default.
-Sorts CANDIDATES by their scores as calculated by
-`helm-score-candidate-for-pattern'. Set USE-REAL to non-`nil' to
+It sorts CANDIDATES by their scores as calculated by
+`helm-score-candidate-for-pattern'. Set USE-REAL to non-nil to
sort on the real part. If BASENAME is non-nil assume we are
completing filenames and sort on basename of candidates. If
PRESERVE-TIE-ORDER is nil, ties in scores are sorted by length of
@@ -4163,7 +4324,7 @@ The default function, `helm-fuzzy-matching-default-sort-fn',
sorts ties by length, shortest first. This function may be more
useful when the order of the candidates is meaningful, e.g. with
`recentf-list'."
- (helm-fuzzy-matching-default-sort-fn-1 candidates nil t))
+ (helm-fuzzy-matching-default-sort-fn-1 candidates nil nil t))
(defun helm--maybe-get-migemo-pattern (pattern)
(or (and helm-migemo-mode
@@ -4317,8 +4478,12 @@ emacs-27 to provide such scoring in emacs<27."
when (< count limit) nconc
(cl-loop for c in cands
for dup = (gethash c hash)
+ for disp = (helm-candidate-get-display c)
while (< count limit)
- for target = (helm-candidate-get-display c)
+ for target = (if (helm-attr 'match-on-real source)
+ (or (cdr-safe c)
+ (get-text-property 0 'helm-realvalue disp))
+ disp)
for prop-part = (get-text-property 0 'match-part target)
for part = (and match-part-fn
(or prop-part
@@ -4427,13 +4592,14 @@ emacs-27 to provide such scoring in emacs<27."
(helm-while-no-input ,@body))))
(defun helm--collect-matches (src-list)
- "Returns a list of matches for each source in SRC-LIST.
-
-The resulting value is a list of lists, e.g ((a b c) (c d) (e f)) or
-\(nil nil nil) for three sources when no matches found, however this
-function can be interrupted by new input and in this case returns a
-plain `nil' i.e not (nil), in this case `helm-update' is not rendering
-the source, keeping previous candidates in display."
+ "Return a list of matches for each source in SRC-LIST.
+
+The resulting value is a list of lists, e.g. ((a b c) (c d) (e
+f)) or \(nil nil nil) for three sources when no matches found,
+however this function can be interrupted by new input and in this
+case returns a plain nil i.e. not (nil), in this case
+`helm-update' is not rendering the source, keeping previous
+candidates in display."
(let ((matches (helm--maybe-use-while-no-input
(cl-loop for src in src-list
collect (helm-compute-matches src)))))
@@ -4444,7 +4610,7 @@ the source, keeping previous candidates in display."
;;
;;
(cl-defun helm-set-case-fold-search (&optional (pattern helm-pattern))
- "Used to set the value of `case-fold-search' in helm.
+ "Used to set the value of `case-fold-search' in Helm.
Return t or nil depending on the value of `helm-case-fold-search'
and `helm-pattern'."
(if helm-alive-p
@@ -4584,8 +4750,8 @@ pattern has changed.
Selection is preserved to current candidate if it still exists after
update or moved to PRESELECT, if specified.
-The helm-window is recentered at the end when RECENTER is `t'
-which is the default, RECENTER can be also a number in this case it is
+The helm-window is re-centered at the end when RECENTER is t which
+is the default. RECENTER can be also a number in this case it is
passed as argument to `recenter'."
(with-helm-buffer
(let* ((source (helm-get-current-source))
@@ -4622,19 +4788,21 @@ passed as argument to `recenter'."
(defun helm-redisplay-buffer ()
"Redisplay candidates in `helm-buffer'.
-Candidates are not recomputed, only redisplayed after modifying the
-whole list of candidates in each source with functions found in
-`redisplay' attribute of current source. Note that candidates are
-redisplayed with their display part with all properties included only.
-This function is used in async sources to transform the whole list of
-candidates from the sentinel functions (i.e when all candidates have
-been computed) because other filters like `candidate-transformer' are
-modifying only each chunk of candidates from process-filter as they
-come in and not the whole list. Use this for e.g sorting the whole
-list of async candidates once computed.
-Note: To ensure redisplay is done in async sources after helm
-reached `candidate-number-limit' you will have also to redisplay your
-candidates from `helm-async-outer-limit-hook'."
+Candidates are not recomputed, only redisplayed after modifying
+the whole list of candidates in each source with functions found
+in `redisplay' attribute of current source. Note that candidates
+are redisplayed with their display part with all properties
+included only. This function is used in async sources to
+transform the whole list of candidates from the sentinel
+functions (i.e. when all candidates have been computed) because
+other filters like `candidate-transformer' are modifying only
+each chunk of candidates from `process-filter' as they come in
+and not the whole list. Use this for e.g. sorting the whole list
+of async candidates once computed.
+
+Note: To ensure redisplay is done in async sources after Helm
+reached `candidate-number-limit' you will have also to redisplay
+your candidates from `helm-async-outer-limit-hook'."
(with-helm-buffer
(let ((get-cands (lambda (source)
(let ((fns (assoc-default 'redisplay source))
@@ -4681,10 +4849,10 @@ candidates from `helm-async-outer-limit-hook'."
(defun helm-insert-match (match insert-function &optional num source)
"Insert MATCH into `helm-buffer' with INSERT-FUNCTION.
-If MATCH is a cons cell then insert the car as display with
-the cdr stored as real value in a `helm-realvalue' text property.
-Args NUM and SOURCE are also stored as text property when specified as
-respectively `helm-cand-num' and `helm-cur-source'."
+If MATCH is a cons cell then insert the car as display with the
+cdr stored as real value in a `helm-realvalue' text property.
+Args NUM and SOURCE are also stored as text property when
+specified as respectively `helm-cand-num' and `helm-cur-source'."
(let ((start (point-at-bol (point)))
(dispvalue (helm-candidate-get-display match))
(realvalue (cdr-safe match))
@@ -4782,8 +4950,8 @@ if SOURCE has header-name attribute."
(defun helm-insert-header (name &optional display-string)
"Insert header of source NAME into the helm buffer.
-If DISPLAY-STRING is non-`nil' and a string value then display
-this additional info after the source name by overlay."
+If DISPLAY-STRING is non-nil and a string value then display this
+additional info after the source name by overlay."
(unless (bobp)
(let ((start (point)))
(insert (propertize "\n" 'face 'helm-eob-line))
@@ -4802,23 +4970,23 @@ this additional info after the source name by overlay."
display-line-numbers-disable t))))
(defun helm-insert-candidate-separator ()
- "Insert separator of candidates into the helm buffer."
+ "Insert separator of candidates into the Helm buffer."
(insert (propertize helm-candidate-separator 'face 'helm-separator))
(put-text-property (point-at-bol)
(point-at-eol) 'helm-candidate-separator t)
(insert "\n"))
(defun helm-init-relative-display-line-numbers ()
- "Enable `display-line-numbers' for helm buffers.
+ "Enable `display-line-numbers' for Helm buffers.
This is intended to be added to `helm-after-initialize-hook'.
-This will work only in Emacs-26+, i.e. Emacs
-versions that have `display-line-numbers-mode'."
+This will work only in Emacs-26+, i.e. Emacs versions that have
+`display-line-numbers-mode'."
(when (boundp 'display-line-numbers)
(with-helm-buffer
(setq display-line-numbers 'relative))))
(define-minor-mode helm-display-line-numbers-mode
- "Toggle display of line numbers in current helm buffer."
+ "Toggle display of line numbers in current Helm buffer."
:group 'helm
(with-helm-alive-p
(cl-assert (boundp 'display-line-numbers) nil
@@ -4835,7 +5003,7 @@ versions that have `display-line-numbers-mode'."
;;; Async process
;;
(defun helm-output-filter (process output-string)
- "The `process-filter' function for helm async sources."
+ "The `process-filter' function for Helm async sources."
(with-helm-quittable
(helm-output-filter-1 (assoc process helm-async-processes) output-string)))
@@ -4974,7 +5142,7 @@ function."
selection action
preserve-saved-action)
"Execute ACTION on current SELECTION.
-If PRESERVE-SAVED-ACTION is non-`nil', then save the action."
+If PRESERVE-SAVED-ACTION is non-nil, then save the action."
(helm-log "executing action")
(setq action (helm-get-default-action
(or action
@@ -5018,7 +5186,7 @@ Coerce source with coerce function."
(defun helm-select-action ()
"Select an action for the currently selected candidate.
-If action buffer is selected, back to the helm buffer."
+If action buffer is selected, back to the Helm buffer."
(interactive)
(with-helm-alive-p
(let ((src (helm-get-current-source)))
@@ -5129,7 +5297,7 @@ If action buffer is selected, back to the helm buffer."
(defun helm-display-source-at-screen-top-maybe (unit)
"Display source at the top of screen when UNIT value is 'source.
-Returns nil for any other value of UNIT."
+Return nil for any other value of UNIT."
(when (and helm-display-source-at-screen-top (eq unit 'source))
(set-window-start (selected-window)
(save-excursion (forward-line -1) (point)))))
@@ -5137,8 +5305,8 @@ Returns nil for any other value of UNIT."
(defun helm-skip-noncandidate-line (direction)
"Skip source header or candidates separator when going in DIRECTION.
DIRECTION is either 'next or 'previous.
-Same as `helm-skip-header-and-separator-line' but ensure
-point is moved to the right place when at bob or eob."
+Same as `helm-skip-header-and-separator-line' but ensure point is
+moved to the right place when at bob or eob."
(helm-skip-header-and-separator-line direction)
(and (bobp) (forward-line 1)) ; Skip first header.
(and (eobp) (forward-line -1))) ; Avoid last empty line.
@@ -5157,7 +5325,7 @@ DIRECTION is either 'next or 'previous."
-1 1)))))
(defun helm-display-mode-line (source &optional force)
- "Set up mode line and header line for `helm-buffer'.
+ "Set up mode-line and header-line for `helm-buffer'.
SOURCE is a Helm source object.
@@ -5277,7 +5445,7 @@ mode and header lines."
header-line-format))
(defun helm-exchange-minibuffer-and-header-line ()
- "Display minibuffer in header-line and vice versa for current helm session.
+ "Display minibuffer in header-line and vice versa for current Helm session.
This is a toggle command."
(interactive)
@@ -5323,8 +5491,8 @@ It has no effect if `helm-echo-input-in-header-line' is nil."
(defun helm-show-candidate-number (&optional name)
"Used to display candidate number in mode-line.
-You can specify NAME of candidates e.g \"Buffers\" otherwise
-it is \"Candidate\(s\)\" by default."
+You can specify NAME of candidates e.g. \"Buffers\" otherwise it
+is \"Candidate\(s\)\" by default."
(when helm-alive-p
(unless (helm-empty-source-p)
;; Build a fixed width string when candidate-number < 1000
@@ -5365,7 +5533,8 @@ Key arg DIRECTION can be one of:
(previous 'helm-move--previous-source-fn)
(next 'helm-move--next-source-fn)
(t (lambda () ; A source is passed as DIRECTION arg.
- (helm-move--goto-source-fn direction))))))))
+ (helm-move--goto-source-fn direction)))))))
+ source)
(unless (or (helm-empty-buffer-p (helm-buffer-get))
(not (helm-window)))
(with-helm-window
@@ -5381,8 +5550,9 @@ Key arg DIRECTION can be one of:
(helm-mark-current-line)
(when follow
(helm-follow-execute-persistent-action-maybe))
- (helm-display-mode-line (helm-get-current-source))
- (helm-log-run-hook 'helm-move-selection-after-hook)))))
+ (helm-display-mode-line (setq source (helm-get-current-source)))
+ (helm-log-run-hook 'helm-move-selection-after-hook)
+ (helm--set-minibuffer-completion-confirm source)))))
(defun helm-move--beginning-of-multiline-candidate ()
(let ((header-pos (helm-get-previous-header-pos))
@@ -5516,7 +5686,8 @@ Key arg DIRECTION can be one of:
(defun helm-previous-line (&optional arg)
"Move selection to the ARG previous line(s).
-Same behavior as `helm-next-line' when called with a numeric prefix arg."
+Same behavior as `helm-next-line' when called with a numeric
+prefix arg."
(interactive "p")
(with-helm-alive-p
(helm--next-or-previous-line 'previous arg)))
@@ -5577,8 +5748,8 @@ next source)."
(defun helm-goto-source (&optional source-or-name)
"Move the selection to the source named SOURCE-OR-NAME.
-If SOURCE-OR-NAME is empty string or nil go to the first candidate of
-first source."
+If SOURCE-OR-NAME is empty string or nil go to the first
+candidate of first source."
(helm-move-selection-common :where 'source :direction source-or-name))
(defun helm--follow-action (arg)
@@ -5617,8 +5788,8 @@ first source."
When RESUMEP is non nil move overlay to `helm-selection-point'.
When NOMOUSE is specified do not set mouse bindings.
-Note that selection is unrelated to visible marks used for marking
-candidates."
+Note that selection is unrelated to visible marks used for
+marking candidates."
(with-helm-buffer
(when resumep
(goto-char helm-selection-point))
@@ -5640,11 +5811,11 @@ candidates."
(defun helm-confirm-and-exit-minibuffer ()
"Maybe ask for confirmation when exiting helm.
-It is similar to `minibuffer-complete-and-exit' adapted to helm.
-If `minibuffer-completion-confirm' value is 'confirm,
-send minibuffer confirm message and exit on next hit.
-If `minibuffer-completion-confirm' value is t,
-don't exit and send message 'no match'."
+It is similar to `minibuffer-complete-and-exit' adapted to Helm.
+If `minibuffer-completion-confirm' value is 'confirm, send
+minibuffer confirm message and exit on next hit. If
+`minibuffer-completion-confirm' value is t, don't exit and send
+message 'no match'."
(interactive)
(with-helm-alive-p
(if (and (helm--updating-p)
@@ -5656,10 +5827,11 @@ don't exit and send message 'no match'."
(empty-buffer-p (with-current-buffer helm-buffer
(eq (point-min) (point-max))))
(unknown (and (not empty-buffer-p)
- (string= (get-text-property
- 0 'display
- (helm-get-selection nil 'withprop src))
- "[?]"))))
+ (helm-aif (get-text-property
+ 0 'display
+ (helm-get-selection nil 'withprop src))
+ (when (stringp it)
+ (string-match-p "\\`\\[\\?\\]" it))))))
(cond ((and (or empty-buffer-p unknown)
(memq minibuffer-completion-confirm
'(confirm confirm-after-completion)))
@@ -5691,14 +5863,18 @@ don't exit and send message 'no match'."
(helm-exit-minibuffer)))))))
(put 'helm-confirm-and-exit-minibuffer 'helm-only t)
-(add-hook 'helm-after-update-hook 'helm-confirm-and-exit-hook)
-
(defun helm-confirm-and-exit-hook ()
"Restore `minibuffer-completion-confirm' when helm update."
(unless (or (eq minibuffer-completion-confirm t)
(not helm-minibuffer-confirm-state))
(setq minibuffer-completion-confirm
helm-minibuffer-confirm-state)))
+(add-hook 'helm-after-update-hook 'helm-confirm-and-exit-hook)
+
+(defun helm--set-minibuffer-completion-confirm (src)
+ (with-helm-buffer
+ (helm-aif (helm-attr 'must-match src)
+ (setq minibuffer-completion-confirm it))))
(defun helm-read-string (prompt &optional initial-input history
default-value inherit-input-method)
@@ -5790,7 +5966,7 @@ If action buffer is displayed, kill it."
;;
;;
(defun helm-debug-output ()
- "Show all helm-related variables at this time."
+ "Show all Helm-related variables at this time."
(interactive)
(with-helm-alive-p
(helm-help-internal " *Helm Debug*" 'helm-debug-output-function)))
@@ -5841,7 +6017,7 @@ CANDIDATE-OR-REGEXP can be a:
- Nullary function, which moves to a candidate
When CANDIDATE-OR-REGEXP is a cons cell, tries moving to first
-element of the cons cell, then the second, and so on. This allows
+element of the cons cell, then the second, and so on. This allows
selection of duplicate candidates after the first.
Optional argument SOURCE is a Helm source object."
@@ -5906,11 +6082,11 @@ Optional argument SOURCE is a Helm source object."
(if (< n 0) (bobp) (eobp))))))
(defun helm-end-of-source-p (&optional at-point)
- "Return non-`nil' if we are at eob or end of source."
+ "Return non-nil if we are at EOB or end of source."
(helm-end-of-source-1 1 at-point))
(defun helm-beginning-of-source-p (&optional at-point)
- "Return non-`nil' if we are at bob or beginning of source."
+ "Return non-nil if we are at BOB or beginning of source."
(helm-end-of-source-1 -1 at-point))
(defun helm--edit-current-selection-internal (func)
@@ -5950,10 +6126,10 @@ Used generally to modify current selection."
(defun helm-delete-minibuffer-contents (&optional arg)
"Delete minibuffer contents.
-When `helm-delete-minibuffer-contents-from-point' is non-`nil',
+When `helm-delete-minibuffer-contents-from-point' is non-nil,
delete minibuffer contents from point instead of deleting all.
-Giving a prefix arg reverses this behavior.
-When at the end of minibuffer, deletes all."
+With a prefix arg reverse this behaviour. When at the end of
+minibuffer, delete all."
(interactive "P")
(let ((str (if helm-delete-minibuffer-contents-from-point
(if (or arg (eobp))
@@ -5968,13 +6144,14 @@ When at the end of minibuffer, deletes all."
(defun helm-candidates-in-buffer (&optional source)
"The top level function used to store candidates with `helm-source-in-buffer'.
-Candidates are stored in a buffer generated internally
-by `helm-candidate-buffer' function.
-Each candidate must be placed in one line.
+Candidates are stored in a buffer generated internally by
+`helm-candidate-buffer' function. Each candidate must be placed
+in one line.
-The buffer is created and fed in the init attribute function of helm.
+The buffer is created and fed in the init attribute function of
+Helm.
-e.g:
+E.g.:
(helm-build-in-buffer-source \"test\"
:init (lambda ()
@@ -5986,14 +6163,13 @@ A shortcut can be used to simplify:
(helm-build-in-buffer-source \"test\"
:data '(foo foa fob bar baz))
-By default, `helm' makes candidates by evaluating the
-candidates function, then narrows them by `string-match' for each
-candidate.
+By default, Helm makes candidates by evaluating the candidates
+function, then narrows them by `string-match' for each candidate.
-But this is slow for large number of candidates. The new way is
-to store all candidates in a buffer and then narrow
-with `re-search-forward'. Search function is customizable by search
-attribute. The important point is that buffer processing is MUCH
+But this is slow for large number of candidates. The new way is
+to store all candidates in a buffer and then narrow with
+`re-search-forward'. Search function is customizable by search
+attribute. The important point is that buffer processing is MUCH
FASTER than string list processing and is the Emacs way.
The init function writes all candidates to a newly-created
@@ -6009,20 +6185,21 @@ Class `helm-source-in-buffer' is implemented with three attributes:
(volatile)
(match identity)
-The volatile attribute is needed because `helm-candidates-in-buffer'
-creates candidates dynamically and need to be called every
-time `helm-pattern' changes.
+The volatile attribute is needed because
+`helm-candidates-in-buffer' creates candidates dynamically and
+need to be called every time `helm-pattern' changes.
-Because `helm-candidates-in-buffer' plays the role of `match' attribute
-function, specifying `(match identity)' makes the source slightly faster.
+Because `helm-candidates-in-buffer' plays the role of `match'
+attribute function, specifying `(match identity)' makes the
+source slightly faster.
-However if source contains `match-part' attribute, match is computed only
-on part of candidate returned by the call of function provided by this attribute.
-The function should have one arg, candidate, and return only
-a specific part of candidate.
+However if source contains `match-part' attribute, match is
+computed only on part of candidate returned by the call of
+function provided by this attribute. The function should have one
+arg, candidate, and return only a specific part of candidate.
-To customize `helm-candidates-in-buffer' behavior,
-use `search', `get-line' and `match-part' attributes."
+To customize `helm-candidates-in-buffer' behaviour, use `search',
+`get-line' and `match-part' attributes."
(let ((src (or source (helm-get-current-source))))
(helm-candidates-in-buffer-1
(helm-candidate-buffer)
@@ -6126,10 +6303,10 @@ use `search', `get-line' and `match-part' attributes."
(defun helm-search-match-part (candidate pattern)
"Match PATTERN only on match-part property value of CANDIDATE.
-Because `helm-search-match-part' maybe called even if unspecified
-in source (negation or fuzzy), the part to match fallback to the whole
-candidate even if match-part haven't been computed by match-part-fn
-and stored in the match-part property."
+Because `helm-search-match-part' may be called even if
+unspecified in source (negation or fuzzy), the part to match
+falls back to the whole candidate even if match-part hasn't been
+computed by match-part-fn and stored in the match-part property."
(let ((part (or (get-text-property 0 'match-part candidate)
candidate))
(fuzzy-regexp (cadr (gethash 'helm-pattern helm--fuzzy-regexp-cache)))
@@ -6179,17 +6356,17 @@ and stored in the match-part property."
This is used to initialize a buffer for storing candidates for a
candidates-in-buffer source, candidates will be searched in this
-buffer and displayed in `helm-buffer'.
-This should be used only in init functions, don't relay on this in
-other places unless you know what you are doing.
+buffer and displayed in `helm-buffer'. This should be used only
+in init functions, don't relay on this in other places unless you
+know what you are doing.
-This function is still in public API only for backward compatibility,
-you should use instead `helm-init-candidates-in-buffer' for
-initializing your sources.
+This function is still in public API only for backward
+compatibility, you should use instead
+`helm-init-candidates-in-buffer' for initializing your sources.
-Internally, this function is called without argument and returns the
-buffer corresponding to current source i.e `helm--source-name' which
-is available in only some places.
+Internally, this function is called without argument and returns
+the buffer corresponding to current source i.e.
+`helm--source-name' which is available in only some places.
Acceptable values of BUFFER-SPEC:
@@ -6198,15 +6375,18 @@ Acceptable values of BUFFER-SPEC:
named \" *helm candidates:SOURCE*\".
This is used by `helm-init-candidates-in-buffer' and it is
the most common usage of BUFFER-SPEC.
- The buffer will be killed and recreated at each new helm-session.
+ The buffer will be killed and recreated at each new
+ helm-session.
- local (a symbol)
Create a new local candidates buffer,
named \" *helm candidates:SOURCE*HELM-CURRENT-BUFFER\".
- You may want to use this when you want to have a different buffer
- each time source is used from a different `helm-current-buffer'.
- The buffer is erased and refilled at each new session but not killed.
- You probably don't want to use this value for BUFFER-SPEC.
+ You may want to use this when you want to have a different
+ buffer each time source is used from a different
+ `helm-current-buffer'.
+ The buffer is erased and refilled at each new session but not
+ killed. You probably don't want to use this value for
+ BUFFER-SPEC.
- nil (omit)
Only return the candidates buffer of current source if found.
@@ -6214,18 +6394,18 @@ Acceptable values of BUFFER-SPEC:
- A buffer
Register a buffer as a candidates buffer.
The buffer needs to exists, it is not created.
- This allow you to use the buffer as a cache, it is faster because
- the buffer is already drawn, but be careful when using this as you
- may mangle your buffer depending what you write in your init(s)
- function, IOW don't modify the contents of the buffer in init(s)
- function but in a transformer.
+ This allow you to use the buffer as a cache, it is faster
+ because the buffer is already drawn, but be careful when using
+ this as you may mangle your buffer depending on what you write
+ in your init(s) function, IOW don't modify the contents of the
+ buffer in init(s) function but in a transformer.
The buffer is not erased nor deleted.
Generally it is safer to use a copy of buffer inserted
in a global or local buffer.
-If for some reasons a global buffer and a local buffer exist and are
-belonging to the same source, the local buffer takes precedence on the
-global one and is used instead.
+If for some reasons a global buffer and a local buffer exist and
+are belonging to the same source, the local buffer takes
+precedence on the global one and is used instead.
When forcing update only the global and local buffers are killed
before running again the init function."
@@ -6276,17 +6456,17 @@ before running again the init function."
(defun helm-init-candidates-in-buffer (buffer-spec data)
"Register BUFFER-SPEC with DATA for a helm candidates-in-buffer session.
-Arg BUFFER-SPEC can be a buffer-name (stringp), a buffer-spec object
-\(bufferp), or a symbol, either 'local or 'global which is passed to
-`helm-candidate-buffer'.
+Arg BUFFER-SPEC can be a `buffer-name' (stringp), a buffer-spec
+object \(bufferp), or a symbol, either 'local or 'global which is
+passed to `helm-candidate-buffer'.
The most common usage of BUFFER-SPEC is 'global.
Arg DATA can be either a list or a plain string.
Returns the resulting buffer.
Use this in your init function to register a buffer for a
-`helm-source-in-buffer' session and feed it with DATA.
-You probably don't want to bother with this and use the :data slot
+`helm-source-in-buffer' session and feed it with DATA. You
+probably don't want to bother with this and use the :data slot
when initializing a source with `helm-source-in-buffer' class."
(declare (indent 1))
(let ((caching (and (or (stringp buffer-spec)
@@ -6382,7 +6562,7 @@ If N is positive enlarge, if negative narrow."
(put 'helm-enlarge-window 'helm-only t)
(defun helm-toggle-full-frame (&optional arg)
- "Toggle helm-buffer full-frame view."
+ "Toggle `helm-buffer' full-frame view."
(interactive "p")
(cl-assert (null (helm-action-window))
nil "Unable to toggle full frame from action window")
@@ -6513,18 +6693,18 @@ Possible values are 'left 'right 'below or 'above."
(cl-defun helm-execute-persistent-action (&optional attr split)
"Perform the associated action ATTR without quitting helm.
-Arg ATTR default will be `persistent-action' or `persistent-action-if'
-if unspecified depending on what's found in source, but it can be
-anything else.
+Arg ATTR default will be `persistent-action' or
+`persistent-action-if' if unspecified depending on what's found
+in source, but it can be anything else.
In this case you have to add this new attribute to your source.
-See `persistent-action' and `persistent-action-if' slot documentation
-in `helm-source'.
-
-When `helm-full-frame' is non-`nil', and
-`helm-buffer' is displayed in only one window, the helm window is
-split to display `helm-select-persistent-action-window' in other
-window to maintain visibility. The argument SPLIT can be used to
-force splitting inconditionally, it is unused actually."
+See `persistent-action' and `persistent-action-if' slot
+documentation in `helm-source'.
+
+When `helm-full-frame' is non-nil, and `helm-buffer' is displayed
+in only one window, the helm window is split to display
+`helm-select-persistent-action-window' in other window to
+maintain visibility. The argument SPLIT can be used to force
+splitting inconditionally, it is unused actually."
(interactive)
(with-helm-alive-p
(let ((source (helm-get-current-source)))
@@ -6585,10 +6765,10 @@ force splitting inconditionally, it is unused actually."
(cl-defun helm-persistent-action-display-window (&key split)
"Return the window that will be used for persistent action.
-If SPLIT is `t' window is split in persistent action, if it has the
-special symbol `never' don't split, if it is `nil' normally don't
-split but this may happen in case of dedicated-windows or unsuitable
-window to display persistent action buffer."
+If SPLIT is t window is split in persistent action, if it has the
+special symbol `never' don't split, if it is nil normally don't
+split but this may happen in case of dedicated-windows or
+unsuitable window to display persistent action buffer."
(with-helm-window
(let (prev-win cur-win)
(setq helm-persistent-action-display-window
@@ -6716,7 +6896,7 @@ Meaning of prefix ARG is the same as in `reposition-window'."
(push (cons source sel) helm-marked-candidates)))
(defun helm-toggle-visible-mark (arg)
- "Toggle helm visible mark at point ARG times.
+ "Toggle Helm visible mark at point ARG times.
If ARG is negative toggle backward."
(interactive "p")
(with-helm-alive-p
@@ -6749,7 +6929,7 @@ If ARG is negative toggle backward."
(helm-toggle-visible-mark -1))
(defun helm-file-completion-source-p (&optional source)
- "Return non-`nil' if current source is a file completion source."
+ "Return non-nil if current source is a file completion source."
(or helm--completing-file-name ; helm-read-file-name
(let ((cur-source (cdr (assq 'name
(or source (helm-get-current-source))))))
@@ -6759,7 +6939,8 @@ If ARG is negative toggle backward."
(defun helm-mark-all (&optional all)
"Mark all visible unmarked candidates in current source.
-With a prefix arg mark all visible unmarked candidates in all sources."
+With a prefix arg mark all visible unmarked candidates in all
+sources."
(interactive "P")
(with-helm-alive-p
(with-helm-window ; Using `with-helm-buffer' for some unknow reasons infloop.
@@ -6783,22 +6964,21 @@ With a prefix arg mark all visible unmarked candidates in all sources."
(defun helm-mark-all-1 (&optional ensure-beg-of-source)
"Mark all visible unmarked candidates in current source.
Need to be wrapped in `with-helm-window'.
-Arg ENSURE-BEG-OF-SOURCE ensure we are at beginning of source when
-starting to mark candidates, if handled elsewhere before starting it
-is not needed."
+Arg ENSURE-BEG-OF-SOURCE ensure we are at beginning of source
+when starting to mark candidates, if handled elsewhere before
+starting it is not needed."
(let* ((src (helm-get-current-source))
(follow (if (helm-follow-mode-p src) 1 -1))
(nomark (assq 'nomark src))
(src-name (assoc-default 'name src))
(filecomp-p (or (helm-file-completion-source-p src)
- (string= src-name "Files from Current Directory")))
- (remote-p (and filecomp-p (file-remote-p helm-pattern))))
+ (string= src-name "Files from Current Directory"))))
;; Note that `cl-letf' prevents edebug working properly.
(cl-letf (((symbol-function 'message) #'ignore))
(helm-follow-mode -1)
(unwind-protect
(if nomark
- (message "Marking not allowed in this source")
+ (user-error "Marking not allowed in this source")
(save-excursion
(when ensure-beg-of-source
(goto-char (helm-get-previous-header-pos))
@@ -6821,18 +7001,17 @@ is not needed."
;; autosave files/links and non--existent files.
(unless
(or (helm-this-visible-mark)
- (string= prefix "[?]") ; doesn't match
+ ;; Non existing files in HFF and
+ ;; RFN. Display may be an image. See
+ ;; https://github.com/yyoncho/helm-treemacs-icons/issues/5
+ ;; and also issue #2296.
+ (equal prefix "[?]")
(and filecomp-p
(or
;; autosave files
- (string-match-p "^[.]?#.*#?$" bn)
+ (string-match-p "\\`[.]?#.*#?\\'" bn)
;; dot files
- (member bn '("." ".."))
- ;; We need to test here when not using
- ;; a transformer that put a prefix tag
- ;; before candidate.
- ;; (i.e no [?] prefix on tramp).
- (and remote-p (not (file-exists-p cand))))))
+ (member bn '("." "..")))))
(helm-make-visible-mark src cand)))
(when (helm-pos-multiline-p)
(goto-char
@@ -6857,8 +7036,9 @@ is not needed."
(defun helm-toggle-all-marks (&optional all)
"Toggle all marks.
-Mark all visible candidates of current source or unmark all candidates
-visible or invisible in all sources of current helm session.
+Mark all visible candidates of current source or unmark all
+candidates visible or invisible in all sources of current Helm
+session.
With a prefix argument mark all candidates in all sources."
(interactive "P")
@@ -6892,8 +7072,8 @@ With a prefix argument mark all candidates in all sources."
"Return marked candidates of current source, if any.
Otherwise return one element list consisting of the current
-selection. When key WITH-WILDCARD is specified, expand it.
-When ALL-SOURCES key value is non-nil returns marked candidates of all
+selection. When key WITH-WILDCARD is specified, expand it. When
+ALL-SOURCES key value is non-nil returns marked candidates of all
sources."
(with-current-buffer helm-buffer
(let* ((current-src (helm-get-current-source))
@@ -6984,8 +7164,8 @@ sources."
points))))
(defun helm-next-visible-mark (&optional prev)
- "Move next helm visible mark.
-If PREV is non-`nil' move to precedent."
+ "Move next Helm visible mark.
+If PREV is non-nil move to precedent."
(interactive)
(with-helm-alive-p
(with-helm-window
@@ -7019,8 +7199,8 @@ With a prefix arg set to real value of current selection."
(defun helm-kill-selection-and-quit (arg)
"Store display value of current selection to kill ring.
With a prefix arg use real value of current selection.
-Display value is shown in `helm-buffer' and real value
-is used to perform actions."
+Display value is shown in `helm-buffer' and real value is used to
+perform actions."
(interactive "P")
(with-helm-alive-p
(helm-run-after-exit
@@ -7054,30 +7234,36 @@ display values."
;;
(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.")
+Note that if the `follow-delay' attr is present in source, it
+will take precedence over this.")
(defun helm-follow-mode (&optional arg)
"Execute persistent action every time the cursor is moved.
-This mode is source local, i.e It apply on current source only.
+This mode is source local, i.e. It applies on current source only.
\\<helm-map>
This mode can be enabled or disabled interactively at anytime during
a helm session with \\[helm-follow-mode].
-When enabling interactively `helm-follow-mode' in a source, you can keep it enabled
-for next emacs sessions by setting `helm-follow-mode-persistent' to a non-nil value.
+When enabling interactively `helm-follow-mode' in a source, you
+can keep it enabled for next Emacs sessions by setting
+`helm-follow-mode-persistent' to a non-nil value.
-When `helm-follow-mode' is called with a prefix arg and `helm-follow-mode-persistent'
-is non-nil `helm-follow-mode' will be persistent only for this emacs session,
-but not for next emacs sessions, i.e the current source will not be saved
-to `helm-source-names-using-follow'.
-A prefix arg with `helm-follow-mode' already enabled will have no effect.
+When `helm-follow-mode' is called with a prefix arg and
+`helm-follow-mode-persistent' is non-nil `helm-follow-mode' will
+be persistent only for this Emacs session, but not for the next
+Emacs sessions, i.e. the current source will not be saved to
+`helm-source-names-using-follow'.
-Note that you can use instead of this mode the commands `helm-follow-action-forward'
-and `helm-follow-action-backward' at anytime in all helm sessions.
+A prefix arg with `helm-follow-mode' already enabled will have no
+effect.
-They are bound by default to \\[helm-follow-action-forward] and \\[helm-follow-action-backward]."
+Note that you can use instead of this mode the commands
+`helm-follow-action-forward' and `helm-follow-action-backward' at
+anytime in all Helm sessions.
+
+They are bound by default to \\[helm-follow-action-forward] and
+\\[helm-follow-action-backward]."
(interactive (list (helm-aif (and current-prefix-arg
(prefix-numeric-value current-prefix-arg))
(unless (helm-follow-mode-p) it))))
@@ -7125,8 +7311,9 @@ They are bound by default to \\[helm-follow-action-forward] and \\[helm-follow-a
(defun helm-follow-execute-persistent-action-maybe (&optional delay)
"Execute persistent action in mode `helm-follow-mode'.
-This happen after: DELAY or the 'follow-attr value of current source
-or `helm-follow-input-idle-delay' or `helm-input-idle-delay' secs."
+This happen after: DELAY or the 'follow-attr value of current
+source or `helm-follow-input-idle-delay' or
+`helm-input-idle-delay' secs."
(let* ((src (helm-get-current-source))
(at (or delay
(assoc-default 'follow-delay src)
@@ -7171,9 +7358,8 @@ or `helm-follow-input-idle-delay' or `helm-input-idle-delay' secs."
(define-minor-mode helm-autoresize-mode
"Auto resize helm window when enabled.
Helm window is re-sized according to `helm-autoresize-max-height'
-and `helm-autoresize-min-height'. Note that when this mode is
-enabled, helm behaves as if `helm-always-two-windows' is
-enabled.
+and `helm-autoresize-min-height'. Note that when this mode is
+enabled, Helm behaves as if `helm-always-two-windows' is enabled.
See `fit-window-to-buffer' for more infos."
:group 'helm
@@ -7185,13 +7371,14 @@ See `fit-window-to-buffer' for more infos."
(remove-hook 'helm-window-configuration-hook 'helm--autoresize-hook)))
(defun helm-help ()
- "Generate helm's help according to `help-message' attribute.
-
-If `helm-buffer' is empty, provide completions on `helm-sources' to
-choose its local documentation.
-If source doesn't have any `help-message' attribute, a generic message
-explaining this is added instead.
-The global `helm-help-message' is always added after this local help."
+ "Generate Helm's help according to `help-message' attribute.
+
+If `helm-buffer' is empty, provide completions on `helm-sources'
+to choose its local documentation.
+If source doesn't have any `help-message' attribute, a generic
+message explaining this is added instead.
+The global `helm-help-message' is always added after this local
+help."
(interactive)
(require 'helm-mode) ; for helm-comp-read.
(with-helm-alive-p
@@ -7205,7 +7392,7 @@ The global `helm-help-message' is always added after this local help."
:exec-when-only-one t))))
(save-selected-window
(helm-help-internal
- "*Helm Help*"
+ helm-help-buffer-name
(lambda ()
(helm-aif (assoc-default 'help-message source)
(insert (substitute-command-keys