summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile15
-rw-r--r--debian/changelog9
-rw-r--r--debian/patches/0004-patch-emacs-helm-sh.patch2
-rwxr-xr-xdebian/rules5
-rwxr-xr-xemacs-helm.sh34
-rw-r--r--helm-buffers.el39
-rw-r--r--helm-core-pkg.el2
-rw-r--r--helm-files.el104
-rw-r--r--helm-grep.el2
-rw-r--r--helm-help.el7
-rw-r--r--helm-lib.el17
-rw-r--r--helm-locate.el14
-rw-r--r--helm-mode.el75
-rw-r--r--helm-pkg.el4
-rw-r--r--helm-ring.el7
-rw-r--r--helm-source.el7
-rw-r--r--helm-types.el1
-rw-r--r--helm.el262
18 files changed, 427 insertions, 179 deletions
diff --git a/Makefile b/Makefile
index 24872e9c..63fd6d86 100644
--- a/Makefile
+++ b/Makefile
@@ -72,3 +72,18 @@ clean:
autoloads:
$(EVAL) "(let ((generated-autoload-file (expand-file-name \"helm-autoloads.el\" \"$(PKGDIR)\")) \
(backup-inhibited t)) (update-directory-autoloads \"$(PKGDIR)\"))"
+
+PREFIX=/usr/local/
+BIN=${PREFIX}bin/
+DESTDIR=${PREFIX}share/emacs/site-lisp/helm/
+install:
+ test -d ${DESTDIR} || mkdir ${DESTDIR}
+ cp -vf *.elc $(DESTDIR)
+ cp -vf helm-autoloads.el $(DESTDIR)
+ cp -vf emacs-helm.sh $(DESTDIR)
+ ln -s ${DESTDIR}emacs-helm.sh ${BIN}helm
+uninstall:
+ rm -vf ${DESTDIR}*.elc
+ rm -vf ${DESTDIR}*.el
+ rm -vf ${DESTDIR}emacs-helm.sh
+ rm -vf ${BIN}helm
diff --git a/debian/changelog b/debian/changelog
index 320f6905..de1e4aaa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+helm (2.9.0-1) unstable; urgency=medium
+
+ * New upstream release.
+ - Override dh_auto_install to do nothing.
+ * Refresh 0004-patch-emacs-helm-sh.patch.
+ * Drop --parallel from d/rules.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Mon, 12 Mar 2018 18:13:44 -0700
+
helm (2.8.8-1) unstable; urgency=medium
* New upstream release.
diff --git a/debian/patches/0004-patch-emacs-helm-sh.patch b/debian/patches/0004-patch-emacs-helm-sh.patch
index 4143e600..6afa86fd 100644
--- a/debian/patches/0004-patch-emacs-helm-sh.patch
+++ b/debian/patches/0004-patch-emacs-helm-sh.patch
@@ -30,7 +30,7 @@ Subject: patch-emacs-helm-sh
-
cat > $CONF_FILE <<EOF
(setq initial-scratch-message (concat initial-scratch-message
- ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\
+ ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\
@@ -79,17 +63,10 @@ cat > $CONF_FILE <<EOF
(setq load-path (quote $LOAD_PATH))
diff --git a/debian/rules b/debian/rules
index 2d7ab517..ca47f8c9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,8 @@
#!/usr/bin/make -f
%:
- dh $@ --parallel --with elpa
+ dh $@ --with elpa
override_dh_auto_build:
- /bin/true
+
+override_dh_auto_install:
diff --git a/emacs-helm.sh b/emacs-helm.sh
index 860e741a..84b3c12a 100755
--- a/emacs-helm.sh
+++ b/emacs-helm.sh
@@ -43,23 +43,23 @@ LOAD_PATH=$($EMACS -q -batch --eval "(prin1 load-path)")
cat > $CONF_FILE <<EOF
(setq initial-scratch-message (concat initial-scratch-message
-";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\
-;; This Emacs is Powered by \`HELM' using\n\
-;; emacs program \"$EMACS\".\n\
-;; This is a minimal \`helm' configuration to discover \`helm' or debug it.\n\
-;; You can retrieve this minimal configuration in \"$CONF_FILE\".\n\
-;; Some original Emacs commands are replaced by their \`helm' counterparts:\n\n\
-;; - \`find-file'(C-x C-f) =>\`helm-find-files'\n\
-;; - \`occur'(M-s o) =>\`helm-occur'\n\
-;; - \`list-buffers'(C-x C-b) =>\`helm-buffers-list'\n\
-;; - \`completion-at-point'(M-tab) =>\`helm-lisp-completion-at-point'[1]\n\
-;; - \`dabbrev-expand'(M-/) =>\`helm-dabbrev'\n\n\
-;; - \`execute-extended-command'(M-x) =>\`helm-M-x'\n\n
-;; Some other Emacs commands are \"helmized\" by \`helm-mode'.\n\
-;; [1] Coming with emacs-24.4, \`completion-at-point' is \"helmized\" by \`helm-mode'\n\
-;; which provides Helm completion in many places like \`shell-mode'.\n\
-;; Find context help for most Helm commands with \`C-h m'.\n\
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))
+";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\
+;; This Emacs is Powered by \`HELM' using\\n\
+;; emacs program \"$EMACS\".\\n\
+;; This is a minimal \`helm' configuration to discover \`helm' or debug it.\\n\
+;; You can retrieve this minimal configuration in \"$CONF_FILE\".\\n\
+;; Some original Emacs commands are replaced by their \`helm' counterparts:\\n\\n\
+;; - \`find-file'(C-x C-f) =>\`helm-find-files'\\n\
+;; - \`occur'(M-s o) =>\`helm-occur'\\n\
+;; - \`list-buffers'(C-x C-b) =>\`helm-buffers-list'\\n\
+;; - \`completion-at-point'(M-tab) =>\`helm-lisp-completion-at-point'[1]\\n\
+;; - \`dabbrev-expand'(M-/) =>\`helm-dabbrev'\\n\\n\
+;; - \`execute-extended-command'(M-x) =>\`helm-M-x'\\n\\n
+;; Some other Emacs commands are \"helmized\" by \`helm-mode'.\\n\
+;; [1] Coming with emacs-24.4, \`completion-at-point' is \"helmized\" by \`helm-mode'\\n\
+;; which provides Helm completion in many places like \`shell-mode'.\\n\
+;; Find context help for most Helm commands with \`C-h m'.\\n\
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\\n"))
(setq load-path (quote $LOAD_PATH))
(require 'package)
diff --git a/helm-buffers.el b/helm-buffers.el
index be93fc2f..81c671b7 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -103,6 +103,10 @@ this source is accessible and properly loaded."
:type 'string
:group 'helm-buffers)
+(defcustom helm-buffers-column-separator " "
+ "Separator for columns in buffer listing."
+ :type 'string
+ :group 'helm-buffers)
;;; Faces
;;
@@ -189,6 +193,7 @@ Note that this variable is buffer-local.")
(define-key map (kbd "C-x C-s") 'helm-buffer-save-persistent)
(define-key map (kbd "C-M-%") 'helm-buffer-run-query-replace-regexp)
(define-key map (kbd "M-%") 'helm-buffer-run-query-replace)
+ (define-key map (kbd "M-R") 'helm-buffer-run-rename-buffer)
(define-key map (kbd "M-m") 'helm-toggle-all-marks)
(define-key map (kbd "M-a") 'helm-mark-all)
(define-key map (kbd "C-]") 'helm-toggle-buffers-details)
@@ -211,6 +216,7 @@ Note that this variable is buffer-local.")
(defvar helm-buffer-max-len-mode nil)
(defvar helm-buffers-in-project-p nil)
+(defvar helm-source-buffers-list nil)
(defun helm-buffers-list--init ()
(require 'dired)
@@ -221,7 +227,15 @@ Note that this variable is buffer-local.")
;; reused in each source (issue #1907), now 'candidates attr is set
;; directly so that each list of candidates is local to source.
(helm-attrset 'candidates (funcall (helm-attr 'buffer-list)))
- (let ((result (cl-loop for b in (helm-attr 'candidates)
+ (let ((result (cl-loop with allbufs = (memq 'helm-shadow-boring-buffers
+ (helm-attr
+ 'filtered-candidate-transformer
+ helm-source-buffers-list))
+ for b in (if allbufs
+ (helm-attr 'candidates)
+ (helm-skip-boring-buffers
+ (helm-attr 'candidates)
+ helm-source-buffers-list))
maximize (length b) into len-buf
maximize (length (with-current-buffer b
(format-mode-line mode-name)))
@@ -250,8 +264,6 @@ Note that this variable is buffer-local.")
(resume :initform (lambda () (setq helm-buffers-in-project-p nil)))
(help-message :initform 'helm-buffer-help-message)))
-(defvar helm-source-buffers-list nil)
-
(defvar helm-source-buffer-not-found
(helm-build-dummy-source
"Create buffer"
@@ -433,8 +445,12 @@ Should be called after others transformers i.e (boring buffers)."
(concat
(funcall helm-fuzzy-matching-highlight-fn
truncbuf)
- "\t" formatted-size
- " " fmode " " meta)
+ helm-buffers-column-separator
+ formatted-size
+ helm-buffers-column-separator
+ fmode
+ helm-buffers-column-separator
+ meta)
(funcall helm-fuzzy-matching-highlight-fn name))
(get-buffer i)))))
@@ -709,6 +725,17 @@ If REGEXP-FLAG is given use `query-replace-regexp'."
(helm-execute-persistent-action 'save-action)))
(put 'helm-buffer-save-persistent 'helm-only t)
+(defun helm-buffers-rename-buffer (candidate)
+ (with-current-buffer candidate
+ (rename-buffer (helm-read-string "New name: " (buffer-name)) t)))
+
+(defun helm-buffer-run-rename-buffer ()
+ "Run rename buffer action from `helm-source-buffers-list'."
+ (interactive)
+ (with-helm-alive-p
+ (helm-exit-and-execute-action 'helm-buffers-rename-buffer)))
+(put 'helm-buffer-run-rename-buffer 'helm-only t)
+
(defun helm-buffer-run-kill-persistent ()
"Kill buffer without quitting helm."
(interactive)
@@ -868,7 +895,7 @@ With optional arg MERGE call `ediff-merge-buffers'."
(setq buf1 (cl-first (helm-marked-candidates))
buf2 (cl-second (helm-marked-candidates))))
(t
- (error "Error:To much buffers marked!")))
+ (error "Error:Too many buffers marked!")))
(if merge
(ediff-merge-buffers buf1 buf2)
(ediff-buffers buf1 buf2))))
diff --git a/helm-core-pkg.el b/helm-core-pkg.el
index 4f6fbc87..f15931e9 100644
--- a/helm-core-pkg.el
+++ b/helm-core-pkg.el
@@ -1,6 +1,6 @@
;;; helm-core-pkg.el --- define helm-core for package.el
-(define-package "helm-core" "2.8.8"
+(define-package "helm-core" "2.9.0"
"Development files for Helm"
'((emacs "24.4")
(async "1.9.2"))
diff --git a/helm-files.el b/helm-files.el
index 61adac92..6fefb820 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -190,6 +190,19 @@ 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
+dynamically when going one level up if the position of previous
+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."
+ :group 'helm-files
+ :type 'boolean)
+
(defcustom helm-files-save-history-extra-sources
'("Find" "Locate" "Recentf"
"Files from Current Directory" "File Cache")
@@ -402,7 +415,7 @@ Of course you can also write your own function to do something else."
(define-key map (kbd "C-M-%") 'helm-ff-run-query-replace-regexp)
(define-key map (kbd "C-c =") 'helm-ff-run-ediff-file)
(define-key map (kbd "M-=") 'helm-ff-run-ediff-merge-file)
- (define-key map (kbd "M-p") 'helm-ff-run-switch-to-history)
+ (define-key map (kbd "M-p") 'helm-find-files-history)
(define-key map (kbd "C-c h") 'helm-ff-file-name-history)
(define-key map (kbd "M-i") 'helm-ff-properties-persistent)
(define-key map (kbd "C-}") 'helm-narrow-window)
@@ -525,7 +538,6 @@ Don't set it directly, use instead `helm-ff-auto-update-initial-value'.")
"Relsymlink file(s) `C-u to follow'" 'helm-find-files-relsymlink
"Hardlink file(s) `M-H, C-u to follow'" 'helm-find-files-hardlink
"Find file other window `C-c o'" 'helm-find-files-other-window
- "Switch to history `M-p'" 'helm-find-files-switch-to-hist
"Find file other frame `C-c C-o'" 'find-file-other-frame
"Print File `C-c p, C-u to refresh'" 'helm-ff-print
"Locate `C-x C-f, C-u to specify locate db'" 'helm-ff-locate)
@@ -701,7 +713,7 @@ ACTION must be an action supported by `helm-dired-action'."
(if helm-ff-transformer-show-only-basename
(helm-basename cand) cand))))
:initial-input (helm-dwim-target-directory)
- :history (helm-find-files-history :comp-read nil)))))
+ :history (helm-find-files-history nil :comp-read nil)))))
(dest-dir-p (file-directory-p dest))
(dest-dir (helm-basedir dest)))
(unless (or dest-dir-p (file-directory-p dest-dir))
@@ -825,10 +837,6 @@ layout."
(file-name-directory candidate))))
(helm-etags-select helm-current-prefix-arg)))
-(defun helm-find-files-switch-to-hist (_candidate)
- "Switch to helm-find-files history."
- (helm-find-files t))
-
(defvar eshell-command-aliases-list nil)
(defvar helm-eshell-command-on-file-input-history nil)
(defun helm-find-files-eshell-command-on-file-1 (&optional map)
@@ -1336,15 +1344,6 @@ Behave differently depending of `helm-selection':
(interactive)
(helm-ff-RET-1 t))
-(defun helm-ff-run-switch-to-history ()
- "Run Switch to history action from `helm-source-find-files'."
- (interactive)
- (with-helm-alive-p
- (when (helm-file-completion-source-p)
- (let ((helm-actions-inherit-frame-settings t))
- (helm-exit-and-execute-action 'helm-find-files-switch-to-hist)))))
-(put 'helm-ff-run-switch-to-history 'helm-only t)
-
(defun helm-ff-run-grep ()
"Run Grep action from `helm-source-find-files'."
(interactive)
@@ -1683,9 +1682,12 @@ If prefix numeric arg is given go ARG level up."
(new-pattern (helm-reduce-file-name helm-pattern arg)))
;; Ensure visibility on all candidates for preselection.
(helm-attrset 'candidate-number-limit
- (max (gethash new-pattern helm-ff--directory-files-hash
- helm-ff-candidate-number-limit)
- helm-ff-candidate-number-limit))
+ (if helm-ff-up-one-level-preselect
+ (max (gethash new-pattern
+ helm-ff--directory-files-hash
+ helm-ff-candidate-number-limit)
+ helm-ff-candidate-number-limit)
+ helm-ff-candidate-number-limit))
(cond ((file-directory-p helm-pattern)
(setq helm-ff-last-expanded helm-ff-default-directory))
((file-exists-p helm-pattern)
@@ -2843,8 +2845,8 @@ If a prefix arg is given or `helm-follow-mode' is on open file."
(unless (file-directory-p image-dired-dir)
(make-directory image-dired-dir))
(switch-to-buffer image-dired-display-image-buffer)
- (image-dired-display-image candidate)
- (message nil)
+ (cl-letf (((symbol-function 'message) #'ignore))
+ (image-dired-display-image candidate))
(with-current-buffer image-dired-display-image-buffer
(let ((exif-data (helm-ff-exif-data candidate)))
(setq default-directory helm-ff-default-directory)
@@ -3000,10 +3002,11 @@ If a prefix arg is given or `helm-follow-mode' is on open file."
(file-relative-name candidate))
(t candidate))))
-(cl-defun helm-find-files-history (&key (comp-read t))
+(cl-defun helm-find-files-history (arg &key (comp-read t))
"The `helm-find-files' history.
Show the first `helm-ff-history-max-length' elements of
`helm-ff-history' in an `helm-comp-read'."
+ (interactive "p")
(let ((history (when helm-ff-history
(helm-fast-remove-dups helm-ff-history
:test 'equal))))
@@ -3013,24 +3016,35 @@ Show the first `helm-ff-history-max-length' elements of
(cl-subseq history 0 helm-ff-history-max-length)
history))
(if comp-read
- (helm-comp-read
- "Switch to Directory: "
- helm-ff-history
- :name "Helm Find Files History"
- :must-match t
- :fuzzy (helm-ff-fuzzy-matching-p)
- :buffer helm-ff-history-buffer-name)
+ (let ((src (helm-build-sync-source "Helm Find Files History"
+ :candidates helm-ff-history
+ :fuzzy-match (helm-ff-fuzzy-matching-p)
+ :persistent-action 'ignore
+ :migemo t
+ :action (lambda (candidate)
+ (if arg
+ (helm-set-pattern
+ (expand-file-name candidate))
+ (identity candidate))))))
+ (helm :sources src
+ :buffer helm-ff-history-buffer-name
+ :allow-nest t))
helm-ff-history))))
+(put 'helm-find-files-history 'helm-only t)
(defun helm-find-files-1 (fname &optional preselect)
- "Find FNAME with `helm' completion.
-
-Even if it works with an abbreviated path FNAME should be an absolute
-path path to avoid multiples calls to helm-update to resolve the
-abbreviated path.
+ "Find FNAME filename with PRESELECT filename preselected.
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
+ ;; and FNAME is an abbreviated path, for some reasons
+ ;; `helm-update' is called many times before resolving
+ ;; the abbreviated path (Issue #1939) so be sure to pass a
+ ;; full path to helm-find-files-1.
+ (unless (string-match-p helm-ff-url-regexp fname)
+ (setq fname (expand-file-name (substitute-in-file-name fname))))
(when (get-buffer helm-action-buffer)
(kill-buffer helm-action-buffer))
(setq helm-find-files--toggle-bookmark nil)
@@ -3048,14 +3062,6 @@ Use it for non--interactive calls of `helm-find-files'."
(helm-ff-setup-update-hook)
(unwind-protect
(helm :sources 'helm-source-find-files
- ;; When `helm-find-files-1' is used directly from lisp
- ;; and FNAME is an abbreviated path, for some reasons
- ;; `helm-update' is called many times before resolving
- ;; the abbreviated (Issue #1939) so be sure to pass a
- ;; full path to helm-find-files-1. Also when expanding
- ;; here, it is done twice as helm-find-files and
- ;; friends are already passing an expanded path to
- ;; helm-find-files-1.
:input fname
:case-fold-search helm-file-name-case-fold-search
:preselect preselect
@@ -3751,7 +3757,7 @@ 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."
(interactive "P")
- (let* ((hist (and arg helm-ff-history (helm-find-files-history)))
+ (let* ((hist (and arg helm-ff-history (helm-find-files-history nil)))
(smart-input (or hist (helm-find-files-initial-input)))
(default-input (expand-file-name (helm-current-directory)))
(input (cond (helm-find-files-ignore-thing-at-point
@@ -3781,11 +3787,17 @@ This is the starting point for nearly all actions you can do on files."
(when (and hist (buffer-live-p (get-buffer helm-ff-history-buffer-name)))
(helm-set-local-variable 'helm-display-function
(with-current-buffer helm-ff-history-buffer-name
- helm-display-function)))
+ helm-display-function)
+ 'helm--last-frame-parameters
+ (with-current-buffer helm-ff-history-buffer-name
+ helm--last-frame-parameters)))
(set-text-properties 0 (length input) nil input)
(setq current-prefix-arg nil)
- (helm-find-files-1 input (and presel (null helm-ff-no-preselect)
- (concat "^" (regexp-quote presel))))))
+ ;; Allow next helm session to reuse helm--last-frame-parameters as
+ ;; resume would do.
+ (let ((helm--executing-helm-action (not (null hist))))
+ (helm-find-files-1 input (and presel (null helm-ff-no-preselect)
+ (concat "^" (regexp-quote presel)))))))
;;;###autoload
(defun helm-delete-tramp-connection ()
diff --git a/helm-grep.el b/helm-grep.el
index 14d9215d..37e0731d 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -673,6 +673,8 @@ If N is positive go forward otherwise go backward."
;; Exit when current-fname is not matched or in `helm-grep-mode'
;; the line is not a grep line i.e 'fname:num:tag'.
(setq sel (buffer-substring (point-at-bol) (point-at-eol)))
+ (when helm-allow-mouse
+ (helm--mouse-reset-selection-help-echo))
(unless (or (string= current-fname
(car (helm-grep-split-line sel)))
(and (eq major-mode 'helm-grep-mode)
diff --git a/helm-help.el b/helm-help.el
index d0681334..bd491948 100644
--- a/helm-help.el
+++ b/helm-help.el
@@ -211,6 +211,7 @@ Italic => A non-file buffer.
\\[helm-buffer-save-persistent]\t\tSave buffer without leaving Helm.
\\[helm-buffer-run-kill-buffers]\t\tDelete marked buffers and leave Helm.
\\[helm-buffer-run-kill-persistent]\t\tDelete buffer without leaving Helm.
+\\[helm-buffer-run-rename-buffer]\t\tRename buffer.
\\[helm-toggle-all-marks]\t\tToggle all marks.
\\[helm-mark-all]\t\tMark all.
\\[helm-toggle-buffers-details]\t\tToggle details.
@@ -621,8 +622,8 @@ You can open a dired buffer containing only marked files with `\\<helm-find-file
With a prefix argument you can open this same dired buffer in wdired mode for
editing. Note that wildcards are supported as well, so you can use e.g.
\"*.txt\" to select all \".txt\" files in the current directory or \"**.txt\" to
-select all files recursively from the current directory. See [[Using wildcard to
-select multiple files]] section above.
+select all files recursively from the current directory.
+See [[Use the wildcard to select multiple files]] section above.
*** Defining default target directory for copying, renaming, etc
@@ -820,7 +821,7 @@ buffer is kept and files are displayed next to it.
\\[helm-ff-rotate-left-persistent]\t\tRotate image left.
\\[helm-ff-rotate-right-persistent]\t\tRotate image right.
\\[helm-find-files-up-one-level]\t\tGo to parent directory.
-\\[helm-ff-run-switch-to-history]\t\tSwitch to the vistied-directory history.
+\\[helm-find-files-history]\t\tSwitch to the visited-directory history.
\\[helm-ff-file-name-history]\t\tSwitch to file name history.
\\[helm-ff-properties-persistent]\t\tShow file properties in a tooltip.
\\[helm-mark-all]\t\tMark all visible candidates.
diff --git a/helm-lib.el b/helm-lib.el
index 89340ce4..fe82dd6d 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -101,7 +101,14 @@ much more convenient to use a simple boolean value here."
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$\"."
+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.
+
+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)
@@ -631,8 +638,12 @@ 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 fails because their printed
-representation which is stored in hash-tables can't be compared."
+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)
diff --git a/helm-locate.el b/helm-locate.el
index 195f38ed..0e69f055 100644
--- a/helm-locate.el
+++ b/helm-locate.el
@@ -77,7 +77,7 @@ is detected in pattern)."
:group 'helm-locate)
(defcustom helm-locate-create-db-command
- "updatedb -l 0 -o %s -U %s"
+ "updatedb -l 0 -o '%s' -U '%s'"
"Command used to create a locale locate db file."
:type 'string
:group 'helm-locate)
@@ -180,7 +180,8 @@ fall back to `default-directory' if FROM-FF is nil."
"Default function used to create a locale locate db file.
Argument DB-NAME name of the db file.
Argument DIRECTORY root of file system subtree to scan."
- (format helm-locate-create-db-command db-name directory))
+ (format helm-locate-create-db-command
+ db-name (expand-file-name directory)))
(defvar helm-locate-create-db-function
#'helm-locate-create-db-default-function
@@ -260,13 +261,18 @@ See also `helm-locate'."
(replace-regexp-in-string
"locate"
(format (if helm-locate-fuzzy-match
- "locate -b -d %s" "locate -d %s")
+ "locate -b -d '%s'" "locate -d '%s'")
(mapconcat 'identity
;; Remove eventually
;; marked directories by error.
(cl-loop for i in db
unless (file-directory-p i)
- collect i) ":"))
+ ;; expand-file-name to resolve
+ ;; abbreviated fnames not
+ ;; expanding inside single
+ ;; quotes i.e. '%s'.
+ collect (expand-file-name i))
+ ":"))
helm-locate-command)
(if (and helm-locate-fuzzy-match
(not (string-match-p "\\`locate -b" helm-locate-command)))
diff --git a/helm-mode.el b/helm-mode.el
index 3e6daa31..c9d5ba9d 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -48,19 +48,56 @@
(find-file-at-point . helm-completing-read-sync-default-handler)
(ffap . helm-completing-read-sync-default-handler)
(execute-extended-command . nil))
- "Alist of handlers to replace `completing-read', `read-file-name' in `helm-mode'.
-Each entry is a cons cell like \(emacs_command . completing-read_handler\)
+ "Completing read functions for specific Emacs commands.
+
+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
+when needed.
+
+Each entry is a cons cell like (EMACS_COMMAND . COMPLETING-READ_HANDLER)
where key and value are symbols.
Each key is an Emacs command that use originaly `completing-read'.
-Each value maybe an helm function that take same arguments as
+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.
-This function prefix name must start by \"helm\".
+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-\".
-See `helm-completing-read-symbols' for example.
+`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
+\"*helm-mode-\".
+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
+handler not using helm completion.
+
+Example:
+
+ (defun foo/test ()
+ (interactive)
+ (message \"%S\" (completing-read \"test: \" '(a b c d e))))
+
+ (defun helm-foo/test-completing-read-handler (prompt collection
+ predicate require-match
+ initial-input hist def
+ inherit-input-method
+ name buffer)
+ (helm-comp-read prompt collection :marked-candidates t
+ :name name
+ :buffer buffer))
+
+ (add-to-list 'helm-completing-read-handlers-alist
+ '(foo/test . helm-foo/test-completing-read-handler))
+
+
+We want here to make the regular `completing-read' in `foo/test'
+returns 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
@@ -69,16 +106,25 @@ your specialized function should handle the both.
If the value of an entry is nil completion will fall back to
emacs vanilla behavior.
-e.g If you want to disable helm completion for `describe-function':
-\(describe-function . nil\).
+Example:
+
+If you want to disable helm completion for `describe-function', use:
+
+ (describe-function . nil)
Ido is also supported, you can use `ido-completing-read' and
`ido-read-file-name' as value of an entry or just 'ido.
-e.g ido completion for `find-file':
-\(find-file . ido\)
+Example:
+Enable ido completion for `find-file':
+
+ (find-file . ido)
+
same as
-\(find-file . ido-read-file-name\)
-Note that you don't need to enable `ido-mode' for this to work."
+
+ (find-file . ido-read-file-name)
+
+Note that you don't need to enable `ido-mode' for this to work, see
+`helm-mode' documentation."
:group 'helm-mode
:type '(alist :key-type symbol :value-type symbol))
@@ -1309,6 +1355,11 @@ e.g `ffap-alternate-file' and maybe others
You can add such functions to `helm-completing-read-handlers-alist'
with a nil value.
+About `ido-mode':
+When you are using `helm-mode', DO NOT use `ido-mode', instead if you
+want some commands use `ido' add these commands to
+`helm-completing-read-handlers-alist' with ido as value.
+
Note: This mode is incompatible with Emacs23."
:group 'helm-mode
:global t
diff --git a/helm-pkg.el b/helm-pkg.el
index 1dd277c0..d54894ef 100644
--- a/helm-pkg.el
+++ b/helm-pkg.el
@@ -1,11 +1,11 @@
;;; helm-pkg.el --- define helm for package.el
-(define-package "helm" "2.8.8"
+(define-package "helm" "2.9.0"
"Helm is an Emacs incremental and narrowing framework"
'((emacs "24.4")
(async "1.9.2")
(popup "0.5.3")
- (helm-core "2.8.8"))
+ (helm-core "2.9.0"))
:url "https://emacs-helm.github.io/helm/")
;; Local Variables:
diff --git a/helm-ring.el b/helm-ring.el
index 7fd9dbc6..9e136637 100644
--- a/helm-ring.el
+++ b/helm-ring.el
@@ -523,7 +523,12 @@ This command is useful when used with persistent action."
(setq last-kbd-macro
(mapconcat 'identity
(cl-loop for km in mkd
- collect (car km))
+ if (vectorp km)
+ append (cl-loop for k across km collect
+ (key-description (vector k)))
+ into result
+ else collect (car km) into result
+ finally return result)
"")))))
(defun helm-kbd-macro-delete-macro (_candidate)
diff --git a/helm-source.el b/helm-source.el
index 9ff9b7a9..05d8389a 100644
--- a/helm-source.el
+++ b/helm-source.el
@@ -222,8 +222,8 @@
:documentation
" A string to explain persistent-action of this source. It also
accepts a function or a variable name.
- It will be displayed in `header-line'.
- Have no effect when `helm-echo-input-in-header-line' is non--nil.")
+ It will be displayed in `header-line' or in `minibuffer' depending
+ of value of `helm-echo-input-in-header-line' and `helm-display-header-line'.")
(help-message
:initarg :help-message
@@ -525,7 +525,8 @@
:custom (choice string function)
:documentation
" Source local `header-line-format'.
- Have no effect when `helm-echo-input-in-header-line' is non--nil.
+ It will be displayed in `header-line' or in `minibuffer' depending
+ of value of `helm-echo-input-in-header-line' and `helm-display-header-line'.
It accepts also variable/function name.")
(resume
diff --git a/helm-types.el b/helm-types.el
index b53aa164..badb7b30 100644
--- a/helm-types.el
+++ b/helm-types.el
@@ -141,6 +141,7 @@
"Query replace `M-%'" 'helm-buffer-query-replace
"View buffer" 'view-buffer
"Display buffer" 'display-buffer
+ "Rename buffer" 'helm-buffers-rename-buffer
"Grep buffers `M-g s' (C-u grep all buffers)"
'helm-zgrep-buffers
"Multi occur buffer(s) `C-s'" 'helm-multi-occur-as-action
diff --git a/helm.el b/helm.el
index f65ff619..bf8ea60b 100644
--- a/helm.el
+++ b/helm.el
@@ -225,6 +225,7 @@ vectors, so don't use strings to define them."
(define-key map (kbd "C-{") 'helm-enlarge-window)
(define-key map (kbd "C-c -") 'helm-swap-windows)
(define-key map (kbd "C-c _") 'helm-toggle-full-frame)
+ (define-key map (kbd "C-c %") 'helm-exchange-minibuffer-and-header-line)
(define-key map (kbd "C-c C-y") 'helm-yank-selection)
(define-key map (kbd "C-c C-k") 'helm-kill-selection-and-quit)
(define-key map (kbd "C-c C-i") 'helm-copy-to-buffer)
@@ -738,12 +739,8 @@ regression)."
:group 'helm
:type '(repeat symbol))
-(defcustom helm-actions-inherit-frame-settings nil
- "Actions inherit frame settings of initial command when non nil.
-
-The actions running from commands that are in
-`helm-commands-using-frame' that are themselves running helm will have
-a frame to display their `helm-buffer' when non nil."
+(defcustom helm-actions-inherit-frame-settings t
+ "Actions inherit helm frame settings of initial command when non nil."
:group 'helm
:type 'boolean)
@@ -1371,7 +1368,9 @@ at end of session.")
(defvar helm--cycle-resume-iterator nil)
(defvar helm--buffer-in-new-frame-p nil)
(defvar helm-initial-frame nil
- "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.
@@ -1379,7 +1378,19 @@ 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)
-(defvar helm--last-frame-position nil)
+(defconst helm--frame-default-attributes
+ '(width height tool-bar-lines left top
+ title undecorated vertical-scroll-bars
+ visibility fullscreen menu-bar-lines undecorated)
+ "Frame parameters to save in `helm--last-frame-parameters'.")
+(defvar helm--last-frame-parameters nil
+ "Frame parameters to save for later resuming.
+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.")
;; Utility: logging
(defun helm-log (format-string &rest args)
@@ -1726,12 +1737,14 @@ 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 FORCE-DISPLAY-PART value is 'withprop the display string is returned
+If FORCE-DISPLAY-PART value is `withprop' the display string is returned
with its properties."
(setq buffer (or buffer helm-buffer))
- (unless (helm-empty-buffer-p buffer)
+ (unless (or (helm-empty-buffer-p buffer)
+ (helm-pos-header-line-p))
(with-current-buffer buffer
(let* ((disp-fn (if (eq force-display-part 'withprop)
'buffer-substring
@@ -1843,13 +1856,35 @@ on action functions invoked as action from the action menu,
i.e functions called with RET."
(setq helm-saved-action action)
(setq helm-saved-selection (or (helm-get-selection) ""))
- ;; Ensure action use same display function as initial helm-buffer when
+ (setq helm--executing-helm-action t)
+ ;; When toggling minibuffer and header-line, we want next action
+ ;; inherit this setting.
+ (helm-set-local-variable 'helm-echo-input-in-header-line
+ (with-helm-buffer helm-echo-input-in-header-line))
+ ;; Ensure next action use same display function as initial helm-buffer when
;; helm-actions-inherit-frame-settings is non nil.
- (when helm-actions-inherit-frame-settings
+ (when (and helm-actions-inherit-frame-settings
+ helm--buffer-in-new-frame-p)
(helm-set-local-variable 'helm-display-function
- (with-helm-buffer helm-display-function)))
+ (with-helm-buffer helm-display-function)
+ 'helm--last-frame-parameters
+ (with-helm-buffer
+ (helm--get-frame-parameters)))
+ ;; The helm-buffer keeps `helm-display-function' and
+ ;; `helm--get-frame-parameters' values during 0.5 seconds, just
+ ;; the time to execute the possible helm action with those values.
+ ;; If no helm based action run within 0.5 seconds, the next helm
+ ;; session will have to resolve again those variable values.
+ (run-with-idle-timer 0.5 nil
+ (lambda () (helm-set-local-variable 'helm-display-function nil
+ 'helm--last-frame-parameters nil))))
(helm-exit-minibuffer))
+(defun helm--get-frame-parameters (&optional frame)
+ (cl-loop with params = (frame-parameters frame)
+ for p in helm--frame-default-attributes
+ when (assq p params) collect it))
+
(defalias 'helm-run-after-quit 'helm-run-after-exit)
(make-obsolete 'helm-run-after-quit 'helm-run-after-exit "1.7.7")
(defalias 'helm-quit-and-execute-action 'helm-exit-and-execute-action)
@@ -1898,6 +1933,22 @@ IOW Don't use VALUE of previous VAR to set the VALUE of next VAR.
collect (cons (car i) (cadr i)))
helm--local-variables))))
+(defun helm--set-local-variables-internal ()
+ (cl-loop for (var . val) in helm--local-variables
+ ;; If `helm-set-local-variable' is called twice or more
+ ;; on same variable use the last value entered which is
+ ;; the first on stack e.g.
+ ;; (helm-set-local-variable 'helm-foo 1)
+ ;; (helm-set-local-variable 'helm-foo 2)
+ ;; helm--local-variables =>
+ ;; '((helm-foo . 2) (helm-foo. 1))
+ ;; (helm-foo . 2) is retained and (helm-foo . 1)
+ ;; ignored.
+ unless (memq var computed)
+ do (set (make-local-variable var) val)
+ collect var into computed
+ finally (setq helm--local-variables nil)))
+
;; API helper
(cl-defun helm-empty-buffer-p (&optional (buffer helm-buffer))
@@ -2262,8 +2313,15 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
(helm-buffer (or any-buffer helm-buffer)))
(helm-initialize
any-resume any-input any-default any-sources)
- (helm-display-buffer helm-buffer any-resume)
- (select-window (helm-window))
+ ;; 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
+ ;; flashing), lets first compute candidates and if more
+ ;; 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)
+ (select-window (helm-window)))
;; We are now in helm-buffer.
(unless helm-allow-mouse
(helm--remap-mouse-mode 1)) ; Disable mouse bindings.
@@ -2649,7 +2707,9 @@ The function used to display `helm-buffer' by calling
(if helm-actions-inherit-frame-settings
(helm-this-command) this-command)))))
(prog1
- (funcall disp-fn buffer (helm-resume-p resume))
+ (funcall disp-fn buffer (or (helm-resume-p resume)
+ (and helm-actions-inherit-frame-settings
+ helm--executing-helm-action)))
(with-helm-buffer (setq-local helm-display-function disp-fn))
(setq helm-onewindow-p (one-window-p t))
;; Don't allow other-window and friends switching out of minibuffer.
@@ -2710,29 +2770,25 @@ Note that this feature is available only with emacs-25+."
(half-screen-size (/ (display-pixel-height x-display-name) 2))
(frame-info (frame-geometry))
(prmt-size (length helm--prompt))
- (lastpos (buffer-local-value
- 'helm--last-frame-position
- (get-buffer buffer)))
(line-height (frame-char-height))
(default-frame-alist
- `((width . ,helm-display-buffer-width)
- (height . ,helm-display-buffer-height)
- (tool-bar-lines . 0)
- (left . ,(if (and lastpos resume)
- (car lastpos)
- (- (car pos)
+ (if resume
+ (buffer-local-value 'helm--last-frame-parameters
+ (get-buffer buffer))
+ `((width . ,helm-display-buffer-width)
+ (height . ,helm-display-buffer-height)
+ (tool-bar-lines . 0)
+ (left . ,(- (car pos)
(* (frame-char-width)
(if (< (- (point) (point-at-bol)) prmt-size)
(- (point) (point-at-bol))
- prmt-size)))))
- ;; Try to put frame at the best possible place.
- ;; Frame should be below point if enough
- ;; place, otherwise above point and
- ;; current line should not be hidden
- ;; by helm frame.
- (top . ,(if (and lastpos resume)
- (cdr lastpos)
- (if (> (cdr pos) half-screen-size)
+ prmt-size))))
+ ;; Try to put frame at the best possible place.
+ ;; Frame should be below point if enough
+ ;; place, otherwise above point and
+ ;; current line should not be hidden
+ ;; by helm frame.
+ (top . ,(if (> (cdr pos) half-screen-size)
;; Above point
(- (cdr pos)
;; add 2 lines to make sure there is always a gap
@@ -2740,23 +2796,37 @@ Note that this feature is available only with emacs-25+."
;; account for title bar height too
(cddr (assq 'title-bar-size frame-info)))
;; Below point
- (+ (cdr pos) line-height))))
- (title . "Helm")
- (undecorated . ,helm-use-undecorated-frame-option)
- (vertical-scroll-bars . nil)
- (menu-bar-lines . 0)
- (fullscreen . nil)
- (visible . ,(null helm-display-buffer-reuse-frame))
- (minibuffer . t)))
+ (+ (cdr pos) line-height)))
+ (title . "Helm")
+ (undecorated . ,helm-use-undecorated-frame-option)
+ (vertical-scroll-bars . nil)
+ (menu-bar-lines . 0)
+ (fullscreen . nil)
+ (visibility . ,(null helm-display-buffer-reuse-frame))
+ (minibuffer . t))))
display-buffer-alist)
- ;; Add the hook inconditionally, if
- ;; helm-echo-input-in-header-line is nil helm-hide-minibuffer-maybe
- ;; will have anyway no effect so no need to remove the hook.
- (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
- (with-helm-buffer
- (setq-local helm-echo-input-in-header-line
- (not (> (cdr pos) half-screen-size))))
- (helm-display-buffer-popup-frame buffer default-frame-alist))
+ ;; Display minibuffer above or below only in initial session,
+ ;; not on a session triggered by action, this way if user have
+ ;; toggled minibuffer and header-line manually she keeps this
+ ;; setting in next action.
+ (unless (or helm--executing-helm-action resume)
+ ;; Add the hook inconditionally, if
+ ;; helm-echo-input-in-header-line is nil helm-hide-minibuffer-maybe
+ ;; will have anyway no effect so no need to remove the hook.
+ (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
+ (with-helm-buffer
+ (setq-local helm-echo-input-in-header-line
+ (not (> (cdr pos) half-screen-size)))))
+ (helm-display-buffer-popup-frame buffer default-frame-alist)
+ ;; When frame size have been modified manually by user restore
+ ;; it to default value unless resuming or not using
+ ;; `helm-display-buffer-reuse-frame'.
+ ;; This have to be done AFTER raising the frame otherwise
+ ;; minibuffer visibility is lost until next session.
+ (unless (or resume (not helm-display-buffer-reuse-frame))
+ (set-frame-size helm-popup-frame
+ helm-display-buffer-width
+ helm-display-buffer-height)))
(helm-log-run-hook 'helm-window-configuration-hook)))
(defun helm-display-buffer-popup-frame (buffer frame-alist)
@@ -2961,9 +3031,7 @@ Unuseful when used outside helm, don't use it.")
(helm-initialize-persistent-action)
(helm-log "helm-display-function = %S" helm-display-function)
(helm-log "helm--local-variables = %S" helm--local-variables)
- (cl-loop for (var . val) in helm--local-variables
- do (set (make-local-variable var) val)
- finally (setq helm--local-variables nil))
+ (helm--set-local-variables-internal)
(setq truncate-lines helm-truncate-lines) ; already local.
(setq cursor-type nil))
(helm-initialize-overlays helm-buffer)
@@ -2985,17 +3053,17 @@ please don't use it outside helm.
(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)
+ 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'."
- (if (and (helm-resume-p any-resume)
+ (with-helm-buffer
+ (if (and (helm-resume-p any-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))
- (with-helm-buffer
(let* ((src (helm-get-current-source))
(src-keymap (assoc-default 'keymap src))
(hist (or (and any-history (symbolp any-history) any-history)
@@ -3046,7 +3114,8 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
(funcall helm-execute-action-at-once-if-one)
helm-execute-action-at-once-if-one)
(= (helm-get-candidate-number
- (eq helm-execute-action-at-once-if-one 'current-source)) 1))
+ (eq helm-execute-action-at-once-if-one 'current-source))
+ 1))
(ignore)) ; Don't enter the minibuffer loop.
((and helm-quit-if-no-candidate
(= (helm-get-candidate-number) 0))
@@ -3057,6 +3126,9 @@ For ANY-PRESELECT ANY-RESUME ANY-KEYMAP ANY-DEFAULT ANY-HISTORY, See `helm'."
(let ((tap (or any-default
(with-helm-current-buffer
(thing-at-point 'symbol)))))
+ (when helm-execute-action-at-once-if-one
+ (helm-display-buffer helm-buffer any-resume)
+ (select-window (helm-window)))
(unwind-protect
(minibuffer-with-setup-hook
(lambda ()
@@ -3199,7 +3271,8 @@ WARNING: Do not use this mode yourself, it is internal to helm."
(helm-funcall-foreach 'cleanup)
(when (and helm--buffer-in-new-frame-p (null helm--nested))
(with-helm-buffer
- (setq-local helm--last-frame-position (frame-position)))
+ (setq-local helm--last-frame-parameters
+ (helm--get-frame-parameters)))
(if helm-display-buffer-reuse-frame
(make-frame-invisible) (delete-frame))))
(helm-kill-async-processes)
@@ -3901,10 +3974,14 @@ without recomputing them, it should be a list of lists."
;; we have two windows even with `helm-full-frame'.
;; So go back to one window when updating if `helm-full-frame'
;; is non-`nil'.
- (with-helm-window
- (when (and helm-onewindow-p
- (not (helm-action-window)))
- (delete-other-windows)))
+ (when (with-helm-buffer
+ (and helm-onewindow-p
+ ;; We are not displaying helm-buffer in a frame and
+ ;; helm-window is already displayed.
+ (not helm--buffer-in-new-frame-p)
+ (helm-window)
+ (not (helm-action-window))))
+ (with-helm-window (delete-other-windows)))
(with-current-buffer (helm-buffer-get)
(set (make-local-variable 'helm-input-local) helm-pattern)
(unwind-protect
@@ -3947,12 +4024,14 @@ without recomputing them, it should be a list of lists."
(helm-log-run-hook 'helm-after-update-hook)))
(when preselect
(helm-log "Update preselect candidate %s" preselect)
- (helm-preselect preselect source))
+ (if (helm-window)
+ (with-helm-window (helm-preselect preselect source))
+ (helm-preselect preselect source)))
(setq helm--force-updating-p nil))
(helm-log "end update")))
(defun helm-update-source-p (source)
- "Whether SOURCE need updating or not."
+ "Whether SOURCE needs updating or not."
(let ((len (string-width
(if (assq 'multimatch source)
;; Don't count spaces entered when using
@@ -3976,9 +4055,13 @@ without recomputing them, it should be a list of lists."
(defun helm--update-move-first-line ()
"Goto first line of `helm-buffer'."
(goto-char (point-min))
- (helm-move-selection-common :where 'line
- :direction 'next
- :follow t))
+ (if (helm-window)
+ (helm-move-selection-common :where 'line
+ :direction 'next
+ :follow t)
+ (forward-line 1)
+ (helm-mark-current-line)
+ (helm-follow-execute-persistent-action-maybe)))
(cl-defun helm-force-update (&optional preselect (recenter t))
"Force recalculation and update of candidates.
@@ -3993,14 +4076,16 @@ 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
passed as argument to `recenter'."
- (with-helm-window
+ (with-helm-buffer
(let* ((source (helm-get-current-source))
(selection (helm-aif (helm-get-selection nil t source)
(regexp-quote it))))
(setq helm--force-updating-p t)
(mapc 'helm-force-update--reinit (helm-get-sources))
(helm-update (or preselect selection) source)
- (and recenter (recenter (and (numberp recenter) recenter))))))
+ (when (and (helm-window) recenter)
+ (with-helm-window
+ (recenter (and (numberp recenter) recenter)))))))
(defun helm-refresh ()
"Force recalculation and update of candidates."
@@ -4343,8 +4428,10 @@ function."
;; Position can be change when `helm-current-buffer'
;; is split, so jump to this position before executing action.
(helm-current-position 'restore)
- (prog1 (helm-execute-selection-action-1)
- (helm-log-run-hook 'helm-after-action-hook)))
+ (unwind-protect
+ (prog1 (helm-execute-selection-action-1)
+ (helm-log-run-hook 'helm-after-action-hook))
+ (setq helm--executing-helm-action nil)))
(defun helm-execute-selection-action-1 (&optional
selection action
@@ -4490,7 +4577,7 @@ Returns nil for any other value of UNIT."
"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 bop or eob."
+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.
@@ -4621,6 +4708,23 @@ mode and header lines."
header-line-format)
(when update (force-mode-line-update))))))
+(defun helm-exchange-minibuffer-and-header-line ()
+ "Display minibuffer in header-line and vice versa for current helm session.
+
+This is a toggle command."
+ (interactive)
+ (with-helm-window
+ (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
+ (setq-local helm-echo-input-in-header-line
+ (not helm-echo-input-in-header-line))
+ (with-selected-window (minibuffer-window)
+ (if (with-helm-buffer helm-echo-input-in-header-line)
+ (helm-hide-minibuffer-maybe)
+ (remove-overlays)
+ (setq cursor-type t)))
+ (helm-display-mode-line (helm-get-current-source) t)))
+(put 'helm-exchange-minibuffer-and-header-line 'helm-only t)
+
(defun helm--update-header-line ()
;; This should be used in `post-command-hook',
;; nowhere else.
@@ -4941,9 +5045,12 @@ first source."
(defun helm-mark-current-line (&optional resumep nomouse)
"Move `helm-selection-overlay' to current line.
-Note that this is unrelated to visible marks used for marking
+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."
- (with-helm-window
+ (with-helm-buffer
(when resumep
(goto-char helm-selection-point))
(move-overlay
@@ -5162,7 +5269,7 @@ 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."
- (with-helm-window
+ (with-helm-buffer
(when candidate-or-regexp
(if source
(helm-goto-source source)
@@ -6426,7 +6533,6 @@ or `helm-follow-input-idle-delay' or `helm-input-idle-delay' secs."
(member (assoc-default 'name src)
helm-source-names-using-follow)))
(null (eq (assoc-default 'follow src) 'never))
- (helm-window)
(helm-get-selection nil nil src))
(helm-follow-mode-set-source 1 src)
(run-with-idle-timer at nil (lambda ()
@@ -6444,7 +6550,7 @@ or `helm-follow-input-idle-delay' or `helm-input-idle-delay' secs."
;;; Auto-resize mode
;;
(defun helm--autoresize-hook (&optional max-height min-height)
- (with-helm-window
+ (with-helm-buffer
(fit-window-to-buffer nil
(/ (* (frame-height)
(or max-height helm-autoresize-max-height))