From 9566347ef293ba43b0e1a810054711efd62c1629 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 1 Feb 2020 13:37:42 +0100 Subject: [PATCH] Revert "update helm" This reverts commit bd80d1582795b7991b6fb8821d65a0000c3cdc85. --- .../emacs-helm.sh | 0 .../helm-adaptive.el | 0 .../helm-autoloads.el | 35 +- .../helm-bookmark.el | 0 .../helm-buffers.el | 38 +- .../helm-color.el | 0 .../helm-comint.el | 18 +- .../helm-command.el | 238 +++--- .../helm-config.el | 18 +- elpa/helm-20191101.641/helm-dabbrev.el | 388 +++++++++ .../helm-easymenu.el | 0 .../helm-elisp-package.el | 11 +- .../helm-elisp.el | 65 +- .../helm-eshell.el | 118 ++- .../helm-eval.el | 0 .../helm-external.el | 0 .../helm-files.el | 94 +- .../helm-find.el | 0 .../helm-font.el | 0 .../helm-for-files.el | 0 .../helm-grep.el | 0 .../helm-help.el | 36 +- .../helm-id-utils.el | 0 .../helm-imenu.el | 46 +- .../helm-info.el | 0 .../helm-locate.el | 14 +- .../helm-man.el | 0 .../helm-misc.el | 2 +- .../helm-mode.el | 806 +++++++----------- .../helm-net.el | 0 .../helm-occur.el | 14 +- elpa/helm-20191101.641/helm-pkg.el | 9 + .../helm-regexp.el | 0 .../helm-ring.el | 0 .../helm-semantic.el | 0 .../helm-shell.el | 0 .../helm-sys.el | 0 .../helm-tags.el | 0 .../helm-types.el | 18 +- .../helm-utils.el | 27 +- .../helm-x-files.el | 0 elpa/helm-20200128.1831/helm-dabbrev.el | 394 --------- elpa/helm-20200128.1831/helm-pkg.el | 9 - 43 files changed, 1022 insertions(+), 1376 deletions(-) rename elpa/{helm-20200128.1831 => helm-20191101.641}/emacs-helm.sh (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-adaptive.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-autoloads.el (97%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-bookmark.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-buffers.el (97%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-color.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-comint.el (90%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-command.el (57%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-config.el (93%) create mode 100644 elpa/helm-20191101.641/helm-dabbrev.el rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-easymenu.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-elisp-package.el (97%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-elisp.el (95%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-eshell.el (89%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-eval.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-external.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-files.el (98%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-find.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-font.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-for-files.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-grep.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-help.el (97%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-id-utils.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-imenu.el (91%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-info.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-locate.el (97%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-man.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-misc.el (99%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-mode.el (71%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-net.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-occur.el (98%) create mode 100644 elpa/helm-20191101.641/helm-pkg.el rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-regexp.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-ring.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-semantic.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-shell.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-sys.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-tags.el (100%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-types.el (95%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-utils.el (98%) rename elpa/{helm-20200128.1831 => helm-20191101.641}/helm-x-files.el (100%) delete mode 100644 elpa/helm-20200128.1831/helm-dabbrev.el delete mode 100644 elpa/helm-20200128.1831/helm-pkg.el diff --git a/elpa/helm-20200128.1831/emacs-helm.sh b/elpa/helm-20191101.641/emacs-helm.sh similarity index 100% rename from elpa/helm-20200128.1831/emacs-helm.sh rename to elpa/helm-20191101.641/emacs-helm.sh diff --git a/elpa/helm-20200128.1831/helm-adaptive.el b/elpa/helm-20191101.641/helm-adaptive.el similarity index 100% rename from elpa/helm-20200128.1831/helm-adaptive.el rename to elpa/helm-20191101.641/helm-adaptive.el diff --git a/elpa/helm-20200128.1831/helm-autoloads.el b/elpa/helm-20191101.641/helm-autoloads.el similarity index 97% rename from elpa/helm-20200128.1831/helm-autoloads.el rename to elpa/helm-20191101.641/helm-autoloads.el index 6c0ce713..200a923b 100644 --- a/elpa/helm-20200128.1831/helm-autoloads.el +++ b/elpa/helm-20191101.641/helm-autoloads.el @@ -118,7 +118,7 @@ while in `helm-M-x' session will disable it. You can get help on each command by persistent action. -\(fn ARG)" t nil) +\(fn ARG &optional COMMAND-NAME)" t nil) (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-command" '("helm-"))) @@ -702,8 +702,6 @@ Keys description: - MULTILINE: See multiline in `helm-source'. -- COERCE: See coerce in `helm-source'. - - GROUP: See group in `helm-source'. Any prefix args passed during `helm-comp-read' invocation will be recorded @@ -712,7 +710,7 @@ in `helm-current-prefix-arg', otherwise if prefix args were given before 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. -\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (BUFFER \"*Helm Completions*\") MUST-MATCH FUZZY REVERSE-HISTORY (REQUIRES-PATTERN 0) HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (DEL-INPUT t) (PERSISTENT-ACTION nil) (PERSISTENT-HELP \"DoNothing\") (MODE-LINE helm-comp-read-mode-line) HELP-MESSAGE (KEYMAP helm-comp-read-map) (NAME \"Helm Completions\") HEADER-NAME CANDIDATES-IN-BUFFER MATCH-PART MATCH-DYNAMIC EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (VOLATILE t) SORT FC-TRANSFORMER HIST-FC-TRANSFORMER MARKED-CANDIDATES NOMARK (ALISTP t) (CANDIDATE-NUMBER-LIMIT helm-candidate-number-limit) MULTILINE ALLOW-NEST COERCE (GROUP \\='helm))" nil nil) +\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (BUFFER \"*Helm Completions*\") MUST-MATCH FUZZY REVERSE-HISTORY (REQUIRES-PATTERN 0) HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (DEL-INPUT t) (PERSISTENT-ACTION nil) (PERSISTENT-HELP \"DoNothing\") (MODE-LINE helm-comp-read-mode-line) HELP-MESSAGE (KEYMAP helm-comp-read-map) (NAME \"Helm Completions\") HEADER-NAME CANDIDATES-IN-BUFFER MATCH-PART MATCH-DYNAMIC EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (VOLATILE t) SORT FC-TRANSFORMER HIST-FC-TRANSFORMER MARKED-CANDIDATES NOMARK (ALISTP t) (CANDIDATE-NUMBER-LIMIT helm-candidate-number-limit) MULTILINE ALLOW-NEST (GROUP \\='helm))" nil nil) (autoload 'helm-read-file-name "helm-mode" "\ Read a file name with helm completion. @@ -770,20 +768,29 @@ or call the function `helm-mode'.") (autoload 'helm-mode "helm-mode" "\ Toggle generic helm completion. -All functions in Emacs that use `completing-read', -`read-file-name', `completion-in-region' and friends will use helm -interface when this mode is turned on. +All functions in Emacs that use `completing-read' +or `read-file-name' and friends will use helm interface +when this mode is turned on. However you can modify this behavior for functions of your choice with `helm-completing-read-handlers-alist'. +Also commands using `completion-in-region' will be helmized when +`helm-mode-handle-completion-in-region' is non nil, you can modify +this behavior with `helm-mode-no-completion-in-region-in-modes'. + Called with a positive arg, turn on unconditionally, with a negative arg turn off. -You can toggle it with M-x `helm-mode'. +You can turn it on with `helm-mode'. + +Some crap emacs functions may not be supported, +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': -DO NOT enable `ido-everywhere' when using `helm-mode' and instead of -using `ido-mode', add the commands where you want to use ido to +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. @@ -868,6 +875,14 @@ engine beeing completely different and also much faster. \(fn)" t nil) +(autoload 'helm-occur-mode "helm-occur" "\ +Major mode to provide actions in helm moccur saved buffer. + +Special commands: +\\{helm-occur-mode-map} + +\(fn)" t nil) + (autoload 'helm-occur-from-isearch "helm-occur" "\ Invoke `helm-occur' from isearch. diff --git a/elpa/helm-20200128.1831/helm-bookmark.el b/elpa/helm-20191101.641/helm-bookmark.el similarity index 100% rename from elpa/helm-20200128.1831/helm-bookmark.el rename to elpa/helm-20191101.641/helm-bookmark.el diff --git a/elpa/helm-20200128.1831/helm-buffers.el b/elpa/helm-20191101.641/helm-buffers.el similarity index 97% rename from elpa/helm-20200128.1831/helm-buffers.el rename to elpa/helm-20191101.641/helm-buffers.el index 8faa60ff..1fa450e1 100644 --- a/elpa/helm-20200128.1831/helm-buffers.el +++ b/elpa/helm-20191101.641/helm-buffers.el @@ -699,25 +699,18 @@ i.e same color." (defun helm-buffers--match-from-inside (candidate) (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate)) (buf (get-buffer cand)) - (pattern (cl-loop with pat = helm-pattern - for p in (helm-mm-split-pattern pat) - when (string-match "\\`@\\(.*\\)" p) - collect (match-string 1 p) into lst - finally return (mapconcat 'identity lst " "))) - (patterns (helm-mm-3-get-patterns pattern))) - (if (and buf patterns) + (regexp (cl-loop with pattern = helm-pattern + for p in (helm-mm-split-pattern pattern) + when (string-match "\\`@\\(.*\\)" p) + return (match-string 1 p)))) + (if (and buf regexp) (with-current-buffer buf (save-excursion (goto-char (point-min)) - (cl-loop for (pred . regexp) in patterns - always - (save-excursion - (funcall - pred - (if helm-migemo-mode - (helm-mm-migemo-forward regexp nil t) - (re-search-forward regexp nil t))))))) - t))) + (if helm-migemo-mode + (helm-mm-migemo-forward regexp nil t) + (re-search-forward regexp nil t)))) + t))) (defun helm-buffers--match-from-directory (candidate) (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate)) @@ -1021,18 +1014,17 @@ If a prefix arg is given split windows vertically." (defun helm-ediff-marked-buffers (_candidate &optional merge) "Ediff 2 marked buffers or CANDIDATE and `helm-current-buffer'. With optional arg MERGE call `ediff-merge-buffers'." - (let* ((mkd (helm-marked-candidates)) - (lg-lst (length mkd)) - buf1 buf2) + (let ((lg-lst (length (helm-marked-candidates))) + buf1 buf2) (cl-case lg-lst (0 (error "Error:You have to mark at least 1 buffer")) (1 (setq buf1 helm-current-buffer - buf2 (cl-first mkd))) + buf2 (cl-first (helm-marked-candidates)))) (2 - (setq buf1 (cl-first mkd) - buf2 (cl-second mkd))) + (setq buf1 (cl-first (helm-marked-candidates)) + buf2 (cl-second (helm-marked-candidates)))) (t (error "Error:Too many buffers marked!"))) (if merge @@ -1057,7 +1049,7 @@ Can be used by any source that list buffers." (get-buffer helm-buffer)) helm-pattern) " " t) - thereis (and (string-match "\\`@\\([^!]*\\)" i) + thereis (and (string-match "\\`@\\(.*\\)" i) (match-string 1 i))))) (helm-multi-occur-1 buffers input))) diff --git a/elpa/helm-20200128.1831/helm-color.el b/elpa/helm-20191101.641/helm-color.el similarity index 100% rename from elpa/helm-20200128.1831/helm-color.el rename to elpa/helm-20191101.641/helm-color.el diff --git a/elpa/helm-20200128.1831/helm-comint.el b/elpa/helm-20191101.641/helm-comint.el similarity index 90% rename from elpa/helm-20200128.1831/helm-comint.el rename to elpa/helm-20191101.641/helm-comint.el index 2cfdbe63..953d8a76 100644 --- a/elpa/helm-20200128.1831/helm-comint.el +++ b/elpa/helm-20191101.641/helm-comint.el @@ -47,23 +47,12 @@ :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) "Supported modes for prompt navigation. Derived modes (e.g. Geiser's REPL) are automatically supported." :group 'helm-comint :type '(repeat (choice symbol))) -(defcustom helm-comint-next-prompt-function '((sly-mrepl-mode . (lambda () - (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. - The function must return the point after the prompt. - Otherwise (comint-next-prompt 1) will be used." - :group 'helm-comint - :type '(alist :key-type symbol :value-type function)) - (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. @@ -95,10 +84,7 @@ If BUFFER is nil, use current buffer." (goto-char (point-min)) (let (result (count 1)) (save-mark-and-excursion - (helm-awhile (and (not (eobp)) - (helm-aif (alist-get major-mode helm-comint-next-prompt-function) - (funcall it) - (comint-next-prompt 1))) + (helm-awhile (and (not (eobp)) (comint-next-prompt 1)) (push (list (buffer-substring-no-properties it (point-at-eol)) it (buffer-name) count) diff --git a/elpa/helm-20200128.1831/helm-command.el b/elpa/helm-20191101.641/helm-command.el similarity index 57% rename from elpa/helm-20200128.1831/helm-command.el rename to elpa/helm-20191101.641/helm-command.el index 634d899a..54aae483 100644 --- a/elpa/helm-20200128.1831/helm-command.el +++ b/elpa/helm-20191101.641/helm-command.el @@ -28,6 +28,12 @@ "Emacs command related Applications and libraries for Helm." :group 'helm) +(defcustom helm-M-x-requires-pattern 0 + "Value of requires-pattern for `helm-M-x'. +Show all candidates on startup when 0 (default)." + :group 'helm-command + :type 'boolean) + (defcustom helm-M-x-always-save-history nil "`helm-M-x' Save command in `extended-command-history' even when it fail." :group 'helm-command @@ -38,6 +44,19 @@ :group 'helm-command :type 'boolean) +(defcustom helm-M-x-fuzzy-match nil + "Enable fuzzy matching in `helm-M-x' when non--nil." + :group 'helm-command + :type 'boolean) + +(defcustom helm-M-x-default-sort-fn #'helm-M-x-fuzzy-sort-candidates + "Default sort function for `helm-M-x'. + +It should sort against REAL value of candidates. + +It is used only when `helm-M-x-fuzzy-match' is enabled." + :group 'helm-command + :type 'function) ;;; Faces ;; @@ -120,10 +139,9 @@ fuzzy matching is running its own sort function with a different algorithm." (defun helm-M-x-transformer (candidates _source) "Transformer function for `helm-M-x' candidates." - ;; Generic sort function is handling helm-flex. (helm-M-x-transformer-1 candidates (null helm--in-fuzzy))) -(defun helm-M-x-transformer-no-sort (candidates _source) +(defun helm-M-x-transformer-hist (candidates _source) "Transformer function for `helm-M-x' candidates." (helm-M-x-transformer-1 candidates)) @@ -172,131 +190,76 @@ fuzzy matching is running its own sort function with a different algorithm." (universal-argument--mode))) (put 'helm-M-x-universal-argument 'helm-only t) -(defun helm-M-x-persistent-action (candidate) - (helm-elisp--persistent-help - candidate 'helm-describe-function)) - -(defun helm-M-x--move-selection-after-hook () - (setq current-prefix-arg nil)) - -(defun helm-M-x--before-action-hook () - (remove-hook 'helm-move-selection-after-hook - 'helm-M-x--move-selection-after-hook)) - -(defclass helm-M-x-class (helm-source-sync helm-type-command) - ((match-dynamic :initform t) - (requires-pattern :initform 0) - (must-match :initform t) - (filtered-candidate-transformer :initform 'helm-M-x-transformer-no-sort) - (persistent-help :initform "Describe this command") - (help-message :initform 'helm-M-x-help-message) - (nomark :initform t) - (keymap :initform helm-M-x-map))) - -(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. - -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'." - (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) - '(metadata (display-sort-function - . - (lambda (candidates) - (sort candidates #'helm-generic-sort-fn)))))) - (sources `(,(helm-make-source "Emacs Commands history" 'helm-M-x-class - :candidates (helm-dynamic-completion - ;; A list of strings. - (or history extended-command-history) - (lambda (str) (funcall pred (intern-soft str))) - nil 'nosort t)) - ,(helm-make-source "Emacs Commands" 'helm-M-x-class - :candidates (helm-dynamic-completion - collection pred - nil metadata t)))) - (prompt (concat (cond - ((eq helm-M-x-prefix-argument '-) "- ") - ((and (consp helm-M-x-prefix-argument) - (eq (car helm-M-x-prefix-argument) 4)) "C-u ") - ((and (consp helm-M-x-prefix-argument) - (integerp (car helm-M-x-prefix-argument))) - (format "%d " (car helm-M-x-prefix-argument))) - ((integerp helm-M-x-prefix-argument) - (format "%d " helm-M-x-prefix-argument))) - "M-x "))) - ;; 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 - 'helm-M-x--move-selection-after-hook) - (add-hook 'helm-before-action-hook - 'helm-M-x--before-action-hook) - (when (and sources helm-M-x-reverse-history) - (setq sources (nreverse sources))) - (unwind-protect - (progn - (setq current-prefix-arg nil) - (helm :sources sources - :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)))) - -(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'." - (when command - ;; Avoid having `this-command' set to *exit-minibuffer. - (setq this-command command - ;; Handle C-x z (repeat) Issue #322 - real-this-command command) - ;; If helm-M-x is called with regular emacs completion (kmacro) - ;; 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)))))))) - -(defun helm-M-x--vanilla-M-x () - (helm-M-x-execute-command - (intern-soft - (if helm-mode +(defun helm-M-x-fuzzy-sort-candidates (candidates _source) + (helm-fuzzy-matching-default-sort-fn-1 candidates t)) + +(defun helm-M-x-read-extended-command (&optional collection history) + "Read command name to invoke in `helm-M-x'. +Helm completion is not provided when executing or defining +kbd macros. +Optional arg COLLECTION is to allow using another COLLECTION +than the default which is OBARRAY." + (if (or defining-kbd-macro executing-kbd-macro) + (if helm-mode + (unwind-protect + (progn + (helm-mode -1) + (read-extended-command)) + (helm-mode 1)) + (read-extended-command)) + (let* ((helm-fuzzy-sort-fn helm-M-x-default-sort-fn) + (helm--mode-line-display-prefarg t) + (tm (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg)) + (helm-move-selection-after-hook + (cons (lambda () (setq current-prefix-arg nil)) + helm-move-selection-after-hook))) + (setq extended-command-history + (cl-loop for c in extended-command-history + when (and c (commandp (intern c))) + do (set-text-properties 0 (length c) nil c) + and collect c)) (unwind-protect - (progn - (helm-mode -1) - (read-extended-command)) - (helm-mode 1)) - (read-extended-command))))) + (progn + (setq current-prefix-arg nil) + (helm-comp-read + (concat (cond + ((eq helm-M-x-prefix-argument '-) "- ") + ((and (consp helm-M-x-prefix-argument) + (eq (car helm-M-x-prefix-argument) 4)) "C-u ") + ((and (consp helm-M-x-prefix-argument) + (integerp (car helm-M-x-prefix-argument))) + (format "%d " (car helm-M-x-prefix-argument))) + ((integerp helm-M-x-prefix-argument) + (format "%d " helm-M-x-prefix-argument))) + "M-x ") + (or collection obarray) + :test 'commandp + :requires-pattern helm-M-x-requires-pattern + :name "Emacs Commands" + :buffer "*helm M-x*" + :persistent-action (lambda (candidate) + (helm-elisp--persistent-help + candidate 'helm-describe-function)) + :persistent-help "Describe this command" + :history (or history extended-command-history) + :reverse-history helm-M-x-reverse-history + :input-history 'helm-M-x-input-history + :del-input nil + :help-message 'helm-M-x-help-message + :group 'helm-command + :keymap helm-M-x-map + :must-match t + :match-part (lambda (c) (car (split-string c))) + :fuzzy helm-M-x-fuzzy-match + :nomark t + :candidates-in-buffer t + :fc-transformer 'helm-M-x-transformer + :hist-fc-transformer 'helm-M-x-transformer-hist)) + (cancel-timer tm) + (setq helm--mode-line-display-prefarg nil))))) ;;;###autoload -(defun helm-M-x (_arg) +(defun helm-M-x (_arg &optional command-name) "Preconfigured `helm' for Emacs commands. It is `helm' replacement of regular `M-x' `execute-extended-command'. @@ -309,10 +272,29 @@ You can get help on each command by persistent action." (interactive (progn (setq helm-M-x-prefix-argument current-prefix-arg) - (list current-prefix-arg))) - (if (or defining-kbd-macro executing-kbd-macro) - (helm-M-x--vanilla-M-x) - (helm-M-x-read-extended-command obarray))) + (list current-prefix-arg (helm-M-x-read-extended-command)))) + (when (stringp command-name) + (unless (string= command-name "") + (let ((sym-com (and (stringp command-name) (intern-soft command-name)))) + (when sym-com + ;; Avoid having `this-command' set to *exit-minibuffer. + (setq this-command sym-com + ;; Handle C-x z (repeat) Issue #322 + real-this-command sym-com) + ;; If helm-M-x is called with regular emacs completion (kmacro) + ;; use the value of arg otherwise use helm-current-prefix-arg. + (let ((prefix-arg (or helm-current-prefix-arg helm-M-x-prefix-argument))) + (cl-flet ((save-hist (command) + (setq extended-command-history + (cons command (delete command extended-command-history))))) + (condition-case-unless-debug err + (progn + (command-execute sym-com 'record) + (save-hist command-name)) + (error + (when helm-M-x-always-save-history + (save-hist command-name)) + (signal (car err) (cdr err))))))))))) (put 'helm-M-x 'interactive-only 'command-execute) (provide 'helm-command) diff --git a/elpa/helm-20200128.1831/helm-config.el b/elpa/helm-20191101.641/helm-config.el similarity index 93% rename from elpa/helm-20200128.1831/helm-config.el rename to elpa/helm-20191101.641/helm-config.el index e5b465ff..36107538 100644 --- a/elpa/helm-20200128.1831/helm-config.el +++ b/elpa/helm-20191101.641/helm-config.el @@ -59,17 +59,13 @@ minibuffer-local-must-match-filename-map ; Older Emacsen minibuffer-local-must-match-map minibuffer-local-ns-map)) - (let ((vmap (symbol-value map))) - (when (and (boundp map) (keymapp vmap)) - (let ((val (and (boundp var) (symbol-value var)))) - (when val - (define-key vmap - (if (stringp val) (read-kbd-macro val) val) - nil))) - (when key - (define-key (symbol-value map) - (if (stringp key) (read-kbd-macro key) key) - 'helm-minibuffer-history))))) + (when (and (boundp map) (keymapp (symbol-value map))) + (when (and (boundp var) (symbol-value var)) + (define-key (symbol-value map) + (read-kbd-macro (symbol-value var)) nil)) + (when key + (define-key (symbol-value map) + (read-kbd-macro key) 'helm-minibuffer-history)))) (set var key))) ;;; Command Keymap diff --git a/elpa/helm-20191101.641/helm-dabbrev.el b/elpa/helm-20191101.641/helm-dabbrev.el new file mode 100644 index 00000000..6adce190 --- /dev/null +++ b/elpa/helm-20191101.641/helm-dabbrev.el @@ -0,0 +1,388 @@ +;;; helm-dabbrev.el --- Helm implementation of dabbrev. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(require 'helm) +(require 'helm-lib) +(require 'helm-help) +(require 'helm-elisp) ; For show-completion. + +(defgroup helm-dabbrev nil + "Dabbrev related Applications and libraries for Helm." + :group 'helm) + +(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 +`helm-dabbrev-max-length-result'." + :group 'helm-dabbrev + :type 'boolean) + +(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'." + :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." + :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'. +The function take one arg, the buffer which is current, look at +`helm-dabbrev--same-major-mode-p' for example. + +When nil all buffers are considered related to `current-buffer'." + :group 'helm-dabbrev + :type 'function) + +(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." + :type '(alist :key-type symbol :value-type symbol) + :group 'helm-dabbrev) + +(defcustom helm-dabbrev-lineno-around 30 + "Search first in this number of lines before an after point." + :group 'helm-dabbrev + :type 'integer) + +(defcustom helm-dabbrev-cycle-threshold 5 + "Number of time helm-dabbrev cycle before displaying helm completion. +When nil or 0 disable cycling." + :group 'helm-dabbrev + :type '(choice (const :tag "Cycling disabled" nil) integer)) + +(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)." + :group 'helm-dabbrev + :type '(choice (const :tag "Ignore case" t) + (const :tag "Respect case" nil) + (other :tag "Smart" 'smart))) + +(defcustom helm-dabbrev-use-thread nil + "[EXPERIMENTAL] Compute candidates asynchronously (partially) when non nil. + +The idea is to compute candidates while cycling the first ones, so +this is available only if `helm-dabbrev-cycle-threshold' is not 0 or +nil, also it is available only on emacs-26+ (needs threads). + +This is reasonably working when you don't have to complete a huge list +of candidates, otherwise you will have a small delay after the first cycle +because thread is released unexpectedly when helm-dabbrev exit after +first insertion. + +IOW keep `helm-dabbrev-candidates-number-limit' to a reasonable +value (I don't!) and give enough prefix before completing e.g. for +completing \"helm-dabbrev\" use \"helm-d\" and not \"he\" if you want +to use this." + :group 'helm-dabbrev + :type 'boolean) + +(defvaralias 'helm-dabbrev--regexp 'helm-dabbrev-separator-regexp) +(make-obsolete-variable 'helm-dabbrev--regexp + 'helm-dabbrev-separator-regexp "2.8.3") +;; Check for beginning of line should happen last (^\n\\|^). +(defvar helm-dabbrev-separator-regexp + "\\s-\\|\t\\|[(\\[\\{\"'`=<$;,@.#+]\\|\\s\\\\|^\n\\|^" + "Regexp matching the start of a dabbrev candidate.") + + +(defvar helm-dabbrev-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-/") 'helm-next-line) + (define-key map (kbd "M-:") 'helm-previous-line) + map)) + +;; Internal +(defvar helm-dabbrev--cache nil) +(defvar helm-dabbrev--data nil) +(cl-defstruct helm-dabbrev-info dabbrev limits iterator) +(defvar helm-dabbrev--already-tried nil) +(defvar helm-dabbrev--current-thread nil) + + +(defun helm-dabbrev--buffer-list () + (cl-loop for buf in (buffer-list) + unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps + thereis (string-match r (buffer-name buf))) + collect buf)) + +(defun helm-dabbrev--same-major-mode-p (start-buffer) + "Decide if current-buffer is related to START-BUFFER." + (helm-same-major-mode-p start-buffer helm-dabbrev-major-mode-assoc)) + +(defun helm-dabbrev--collect (str limit ignore-case all) + (let* ((case-fold-search ignore-case) + (buffer1 (current-buffer)) ; start buffer. + (minibuf (minibufferp buffer1)) + result pos-before pos-after + (search-and-store + (lambda (pattern direction) + (while (and (<= (length result) limit) + (cl-case direction + (1 (search-forward pattern nil t)) + (-1 (search-backward pattern nil t)) + (2 (let ((pos + (save-excursion + (forward-line + helm-dabbrev-lineno-around) + (point)))) + (setq pos-after pos) + (search-forward pattern pos t))) + (-2 (let ((pos + (save-excursion + (forward-line + (- helm-dabbrev-lineno-around)) + (point)))) + (setq pos-before pos) + (search-backward pattern pos t))))) + (let* ((pbeg (match-beginning 0)) + (replace-regexp (concat "\\(" helm-dabbrev-separator-regexp + "\\)\\'")) + (match-word (helm-dabbrev--search + pattern pbeg replace-regexp))) + (when (and match-word (not (member match-word result))) + (push match-word result))))))) + (catch 'break + (dolist (buf (if all (helm-dabbrev--buffer-list) + (list (current-buffer)))) + (with-current-buffer buf + (when (or minibuf ; check against all buffers when in minibuffer. + (if helm-dabbrev-related-buffer-fn + (funcall helm-dabbrev-related-buffer-fn buffer1) + t)) + (save-excursion + ;; Start searching before thing before point. + (goto-char (- (point) (length str))) + ;; Search the last 30 lines before point. + (funcall search-and-store str -2)) ; store pos [1] + (save-excursion + ;; Search the next 30 lines after point. + (funcall search-and-store str 2)) ; store pos [2] + (save-excursion + ;; Search all before point. + ;; If limit is reached in previous call of + ;; search-and-store pos-before is never set and + ;; goto-char will fail, so check it. + (when pos-before + (goto-char pos-before) ; start from [1] + (funcall search-and-store str -1))) + (save-excursion + ;; Search all after point. + ;; Same comment as above for pos-after. + (when pos-after + (goto-char pos-after) ; start from [2] + (funcall search-and-store str 1))))) + (when (>= (length result) limit) (throw 'break nil)))) + (nreverse result))) + +(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. +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." + (let ((eol (point-at-eol))) + (save-excursion + (goto-char (1- beg)) + (when (re-search-forward + (concat "\\(" + helm-dabbrev-separator-regexp + "\\)" + "\\(?99:\\(" + (regexp-quote pattern) + "\\(\\sw\\|\\s_\\)+\\)\\)") + eol t) + (replace-regexp-in-string + sep-regexp "" + (match-string-no-properties 99)))))) + +(defun helm-dabbrev--get-candidates (dabbrev &optional limit) + (cl-assert dabbrev nil "[No Match]") + (helm-dabbrev--collect + dabbrev (or limit helm-dabbrev-candidates-number-limit) + (cl-case helm-dabbrev-case-fold-search + (smart (helm-set-case-fold-search-1 dabbrev)) + (t helm-dabbrev-case-fold-search)) + helm-dabbrev-always-search-all)) + +(defun helm-dabbrev-default-action (candidate) + (with-helm-current-buffer + (let* ((limits (helm-bounds-of-thing-before-point + helm-dabbrev-separator-regexp)) + (beg (car limits)) + (end (point))) + (run-with-timer + 0.01 nil + 'helm-insert-completion-at-point + beg end candidate)))) + +;;;###autoload +(cl-defun helm-dabbrev () + "Preconfigured helm for dynamic abbreviations." + (interactive) + (let ((dabbrev (helm-thing-before-point + nil helm-dabbrev-separator-regexp)) + (limits (helm-bounds-of-thing-before-point + helm-dabbrev-separator-regexp)) + (enable-recursive-minibuffers t) + (cycling-disabled-p (or (null helm-dabbrev-cycle-threshold) + (zerop helm-dabbrev-cycle-threshold))) + (helm-execute-action-at-once-if-one t) + (helm-quit-if-no-candidate + (lambda () + (message "[Helm-dabbrev: No expansion found]")))) + (cl-assert (and (stringp dabbrev) (not (string= dabbrev ""))) + nil "[Helm-dabbrev: Nothing found before point]") + (when (and + ;; have been called at least once. + (helm-dabbrev-info-p helm-dabbrev--data) + ;; But user have moved with some other command + ;; in the meaning time. + (not (eq last-command 'helm-dabbrev))) + (setq helm-dabbrev--data nil)) + ;; When candidates are requested in helm directly without cycling, + ;; we need them right now before running helm, so no need to use a + ;; thread here. + (when cycling-disabled-p + (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev))) + (unless (or cycling-disabled-p + (helm-dabbrev-info-p helm-dabbrev--data)) + (setq helm-dabbrev--data + (make-helm-dabbrev-info + :dabbrev dabbrev + :limits limits + :iterator + (helm-iter-list + (cl-loop for i in (helm-dabbrev--get-candidates + dabbrev helm-dabbrev-cycle-threshold) + when (string-match-p + (concat "^" (regexp-quote dabbrev)) i) + collect i)))) + ;; Thread is released as soon as helm-dabbrev exits after first + ;; insertion so this is unusable for now, keep it like this for + ;; now hooping the situation with threads will be improved in + ;; emacs. The idea is to compute whole list of candidates in + ;; background while cycling with the first + ;; helm-dabbrev-cycle-threshold ones. + (when (and (fboundp 'make-thread) helm-dabbrev-use-thread) + (setq helm-dabbrev--current-thread + (make-thread + (lambda () + (setq helm-dabbrev--cache + (helm-dabbrev--get-candidates dabbrev))))))) + (let ((iter (and (helm-dabbrev-info-p helm-dabbrev--data) + (helm-dabbrev-info-iterator helm-dabbrev--data))) + deactivate-mark) + ;; Cycle until iterator is consumed. + (helm-aif (and iter (helm-iter-next iter)) + (progn + (helm-insert-completion-at-point + (car (helm-dabbrev-info-limits helm-dabbrev--data)) + ;; END is the end of the previous inserted string, not + ;; the end (apart for first insertion) of the initial string. + (cdr limits) it) + ;; Move already tried candidates to end of list. + (push it helm-dabbrev--already-tried)) + ;; Iterator is now empty, reset dabbrev to initial value + ;; and start helm completion. + (let* ((old-dabbrev (if (helm-dabbrev-info-p helm-dabbrev--data) + (helm-dabbrev-info-dabbrev helm-dabbrev--data) + dabbrev)) + (only-one (null (cdr (all-completions + old-dabbrev + helm-dabbrev--already-tried))))) + (unless helm-dabbrev-use-thread + (message "Waiting for helm-dabbrev candidates...") + (setq helm-dabbrev--cache + (helm-dabbrev--get-candidates old-dabbrev))) + ;; If the length of candidates is only one when computed + ;; that's mean the unique matched item have already been + ;; inserted by the iterator, so no need to reinsert the old dabbrev, + ;; just let helm exiting with "No expansion found". + (unless (or only-one cycling-disabled-p) + (setq dabbrev old-dabbrev + limits (helm-dabbrev-info-limits helm-dabbrev--data)) + (setq helm-dabbrev--data nil) + (delete-region (car limits) (point)) + (insert dabbrev)) + ;; Cycling is finished, block until helm-dabbrev--cache have + ;; finished to complete. + (when (and (fboundp 'thread-join) + helm-dabbrev-use-thread + (thread-alive-p helm-dabbrev--current-thread)) + (thread-join helm-dabbrev--current-thread)) + (when (and (null cycling-disabled-p) only-one) + (cl-return-from helm-dabbrev + (message "[Helm-dabbrev: No expansion found]"))) + (with-helm-show-completion (car limits) (cdr limits) + (unwind-protect + (helm :sources + (helm-build-in-buffer-source "Dabbrev Expand" + :data + (cl-loop for cand in helm-dabbrev--cache + unless + (member cand helm-dabbrev--already-tried) + collect cand into lst + finally return + (append lst helm-dabbrev--already-tried)) + :persistent-action 'ignore + :persistent-help "DoNothing" + :keymap helm-dabbrev-map + :action 'helm-dabbrev-default-action + :group 'helm-dabbrev) + :buffer "*helm dabbrev*" + :input (concat "^" dabbrev " ") + :resume 'noresume + :allow-nest t) + (setq helm-dabbrev--already-tried nil)))))))) + +(provide 'helm-dabbrev) + +;; Local Variables: +;; byte-compile-warnings: (not obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-dabbrev.el ends here diff --git a/elpa/helm-20200128.1831/helm-easymenu.el b/elpa/helm-20191101.641/helm-easymenu.el similarity index 100% rename from elpa/helm-20200128.1831/helm-easymenu.el rename to elpa/helm-20191101.641/helm-easymenu.el diff --git a/elpa/helm-20200128.1831/helm-elisp-package.el b/elpa/helm-20191101.641/helm-elisp-package.el similarity index 97% rename from elpa/helm-20200128.1831/helm-elisp-package.el rename to elpa/helm-20191101.641/helm-elisp-package.el index b3ee3272..77f2c763 100644 --- a/elpa/helm-20200128.1831/helm-elisp-package.el +++ b/elpa/helm-20191101.641/helm-elisp-package.el @@ -51,11 +51,6 @@ (declare-function async-byte-recompile-directory "ext:async-bytecomp.el") (defun helm-el-package--init () - ;; In emacs-27 package-show-package-list returns an empty buffer - ;; until package-initialize have been called. - (unless (or package--initialized - (null (boundp 'package-quickstart))) - (package-initialize)) (let (package-menu-async (inhibit-read-only t)) (when (null package-alist) @@ -255,10 +250,8 @@ (defun helm-el-package-upgrade-all () (if helm-el-package--upgrades (with-helm-display-marked-candidates - helm-marked-buffer-name (helm-fast-remove-dups - (mapcar (lambda (x) (symbol-name (car x))) - helm-el-package--upgrades) - :test 'equal) + helm-marked-buffer-name (mapcar (lambda (x) (symbol-name (car x))) + helm-el-package--upgrades) (when (y-or-n-p "Upgrade all packages? ") (helm-el-package-upgrade-1 helm-el-package--tabulated-list))) (message "No packages to upgrade actually!"))) diff --git a/elpa/helm-20200128.1831/helm-elisp.el b/elpa/helm-20191101.641/helm-elisp.el similarity index 95% rename from elpa/helm-20200128.1831/helm-elisp.el rename to elpa/helm-20191101.641/helm-elisp.el index 77b9011e..78a5a3ce 100644 --- a/elpa/helm-20200128.1831/helm-elisp.el +++ b/elpa/helm-20191101.641/helm-elisp.el @@ -718,7 +718,7 @@ Filename completion happen if string start after or between a double quote." (list (helm-info-lookup-fallback-source c))) :resume 'noresume :buffer "*helm lookup*" - :input (helm-stringify c)))) + :input c))) (defun helm-info-lookup-symbol (candidate) ;; ???:Running an idle-timer allows not catching RET when exiting @@ -904,29 +904,46 @@ i.e the `symbol-name' of any existing symbol." ;;; Complex command history ;; ;; - -(defvar helm-sexp--last-sexp nil) -;; This wont work compiled. -(defun helm-sexp-eval-1 () - (interactive) - (unwind-protect - (progn - ;; Trick called-interactively-p into thinking that `cand' is - ;; an interactive call, See `repeat-complex-command'. - (add-hook 'called-interactively-p-functions - #'helm-complex-command-history--called-interactively-skip) - (eval (read helm-sexp--last-sexp))) - (remove-hook 'called-interactively-p-functions - #'helm-complex-command-history--called-interactively-skip))) - -(defun helm-complex-command-history--called-interactively-skip (i _frame1 frame2) - (and (eq 'eval (cadr frame2)) - (eq 'helm-sexp-eval-1 - (cadr (backtrace-frame (+ i 2) #'called-interactively-p))) - 1)) - -(defun helm-sexp-eval (_candidate) - (call-interactively #'helm-sexp-eval-1)) +(defun helm-btf--usable-p () + "Return t if current version of `backtrace-frame' accept 2 arguments." + (condition-case nil + (progn (backtrace-frame 1 'condition-case) t) + (wrong-number-of-arguments nil))) + +(if (helm-btf--usable-p) ; Check if BTF accept more than one arg. + ;; Emacs 24.4. + (dont-compile + (defvar helm-sexp--last-sexp nil) + ;; This wont work compiled. + (defun helm-sexp-eval-1 () + (interactive) + (unwind-protect + (progn + ;; Trick called-interactively-p into thinking that `cand' is + ;; an interactive call, See `repeat-complex-command'. + (add-hook 'called-interactively-p-functions + #'helm-complex-command-history--called-interactively-skip) + (eval (read helm-sexp--last-sexp))) + (remove-hook 'called-interactively-p-functions + #'helm-complex-command-history--called-interactively-skip))) + + (defun helm-complex-command-history--called-interactively-skip (i _frame1 frame2) + (and (eq 'eval (cadr frame2)) + (eq 'helm-sexp-eval-1 + (cadr (backtrace-frame (+ i 2) #'called-interactively-p))) + 1)) + + (defun helm-sexp-eval (_candidate) + (call-interactively #'helm-sexp-eval-1))) + ;; Emacs 24.3 + (defun helm-sexp-eval (cand) + (let ((sexp (read cand))) + (condition-case err + (if (> (length (remove nil sexp)) 1) + (eval sexp) + (apply 'call-interactively sexp)) + (error (message "Evaluating gave an error: %S" err) + nil))))) (defvar helm-source-complex-command-history (helm-build-sync-source "Complex Command History" diff --git a/elpa/helm-20200128.1831/helm-eshell.el b/elpa/helm-20191101.641/helm-eshell.el similarity index 89% rename from elpa/helm-20200128.1831/helm-eshell.el rename to elpa/helm-20191101.641/helm-eshell.el index 837c70ed..ac7c9003 100644 --- a/elpa/helm-20200128.1831/helm-eshell.el +++ b/elpa/helm-20191101.641/helm-eshell.el @@ -71,6 +71,33 @@ (defvar helm-eshell--quit-flag nil) +(defclass helm-esh-source (helm-source-sync) + ((init :initform (lambda () + (setq pcomplete-current-completions nil + pcomplete-last-completion-raw nil) + ;; Eshell-command add this hook in all minibuffers + ;; Remove it for the helm one. (Fixed in Emacs24) + (remove-hook 'minibuffer-setup-hook 'eshell-mode))) + (candidates :initform 'helm-esh-get-candidates) + ;(nomark :initform t) + (persistent-action :initform 'ignore) + (nohighlight :initform t) + (filtered-candidate-transformer + :initform + (lambda (candidates _sources) + (cl-loop + for i in candidates + collect + (cond ((string-match "\\`~/?" helm-ec-target) + (abbreviate-file-name i)) + ((string-match "\\`/" helm-ec-target) i) + (t + (file-relative-name i))) + into lst + finally return (sort lst 'helm-generic-sort-fn)))) + (action :initform 'helm-ec-insert)) + "Helm class to define source for Eshell completion.") + ;; Internal. (defvar helm-ec-target "") (defun helm-ec-insert (_candidate) @@ -105,33 +132,6 @@ The function that call this should set `helm-ec-target' to thing at point." "") " "))))) -(defun helm-esh-transformer (candidates _sources) - (cl-loop - for i in candidates - collect - (cond ((string-match "\\`~/?" helm-ec-target) - (abbreviate-file-name i)) - ((string-match "\\`/" helm-ec-target) i) - (t - (file-relative-name i))) - into lst - finally return (sort lst 'helm-generic-sort-fn))) - -(defclass helm-esh-source (helm-source-sync) - ((init :initform (lambda () - (setq pcomplete-current-completions nil - pcomplete-last-completion-raw nil) - ;; Eshell-command add this hook in all minibuffers - ;; Remove it for the helm one. (Fixed in Emacs24) - (remove-hook 'minibuffer-setup-hook 'eshell-mode))) - (candidates :initform 'helm-esh-get-candidates) - ;(nomark :initform t) - (persistent-action :initform 'ignore) - (nohighlight :initform t) - (filtered-candidate-transformer :initform #'helm-esh-transformer) - (action :initform 'helm-ec-insert)) - "Helm class to define source for Eshell completion.") - (defun helm-esh-get-candidates () "Get candidates for eshell completion using `pcomplete'." (catch 'pcompleted @@ -214,41 +214,6 @@ The function that call this should set `helm-ec-target' to thing at point." "Helm class to define source for Eshell history.") -(defun helm-esh-pcomplete-input (target users-comp last) - (if (and (stringp last) - (not (string= last "")) - (not users-comp) - ;; Fix completion on "../" see #1832. - (or (file-exists-p last) - (helm-aand - (file-name-directory last) - (file-directory-p it)))) - (if (and (file-directory-p last) - (string-match "\\`[~.]*.*/[.]\\'" target)) - ;; Fix completion on "~/.", "~/[...]/.", and "../." - (expand-file-name - (concat (helm-basedir (file-name-as-directory last)) - (regexp-quote (helm-basename target)))) - (expand-file-name last)) - ;; Don't add "~" to input to provide completion on all users instead of only - ;; on current $HOME (#1832). - (unless users-comp last))) - -(defun helm-esh-pcomplete-default-source () - "Make and return the default source for Eshell completion." - (helm-make-source "Eshell completions" 'helm-esh-source - :fuzzy-match helm-eshell-fuzzy-match)) - -(defvar helm-esh-pcomplete-build-source-fn #'helm-esh-pcomplete-default-source - "Function that builds a source or a list of sources.") - -(defun helm-esh-pcomplete--make-helm (&optional input) - (helm :sources (funcall helm-esh-pcomplete-build-source-fn) - :buffer "*helm pcomplete*" - :keymap helm-esh-completion-map - :resume 'noresume - :input input)) - ;;;###autoload (defun helm-esh-pcomplete () "Preconfigured helm to provide helm completion in eshell." @@ -300,8 +265,33 @@ The function that call this should set `helm-ec-target' to thing at point." (add-hook 'helm-quit-hook 'helm-eshell--quit-hook-fn) (with-helm-show-completion beg end (unwind-protect - (or (helm-esh-pcomplete--make-helm - (helm-esh-pcomplete-input target users-comp last)) + (or (helm :sources (helm-make-source "Eshell completions" 'helm-esh-source + :fuzzy-match helm-eshell-fuzzy-match) + :buffer "*helm pcomplete*" + :keymap helm-esh-completion-map + :resume 'noresume + :input (if (and (stringp last) + (not (string= last "")) + (not users-comp) + ;; Fix completion on + ;; "../" see #1832. + (or (file-exists-p last) + (helm-aand + (file-name-directory last) + (file-directory-p it)))) + (if (and (file-directory-p last) + (string-match "\\`[~.]*.*/[.]\\'" target)) + ;; Fix completion on + ;; "~/.", "~/[...]/.", and "../." + (expand-file-name + (concat (helm-basedir (file-name-as-directory last)) + (regexp-quote (helm-basename target)))) + (expand-file-name last)) + ;; Don't add "~" to input to + ;; provide completion on all + ;; users instead of only on + ;; current $HOME (#1832). + (unless users-comp last))) ;; Delete removed dot on quit (and del-dot (prog1 t (insert "."))) ;; A space is needed to have completion, remove diff --git a/elpa/helm-20200128.1831/helm-eval.el b/elpa/helm-20191101.641/helm-eval.el similarity index 100% rename from elpa/helm-20200128.1831/helm-eval.el rename to elpa/helm-20191101.641/helm-eval.el diff --git a/elpa/helm-20200128.1831/helm-external.el b/elpa/helm-20191101.641/helm-external.el similarity index 100% rename from elpa/helm-20200128.1831/helm-external.el rename to elpa/helm-20191101.641/helm-external.el diff --git a/elpa/helm-20200128.1831/helm-files.el b/elpa/helm-20191101.641/helm-files.el similarity index 98% rename from elpa/helm-20200128.1831/helm-files.el rename to elpa/helm-20191101.641/helm-files.el index 21ef4c1d..4263ae77 100644 --- a/elpa/helm-20200128.1831/helm-files.el +++ b/elpa/helm-20191101.641/helm-files.el @@ -2137,7 +2137,10 @@ or when `helm-pattern' is equal to \"~/\"." (with-helm-buffer (let* ((history-p (string= (assoc-default 'name src) "Read File Name History")) - (pat (helm-ff-set-pattern helm-pattern)) + (pat (if (string-match helm-tramp-file-name-regexp + helm-pattern) + (helm-ff--create-tramp-name helm-pattern) + helm-pattern)) (completed-p (string= (file-name-as-directory (expand-file-name (substitute-in-file-name pat))) @@ -2237,12 +2240,7 @@ or when `helm-pattern' is equal to \"~/\"." (file-name-directory input)))) (with-helm-window (helm-set-pattern input) - (helm-check-minibuffer-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-check-minibuffer-input))))))) (defun helm-ff--expand-file-name-no-dot (name &optional directory) "Prevent expanding \"/home/user/.\" to \"/home/user\"." @@ -2258,15 +2256,12 @@ or when `helm-pattern' is equal to \"~/\"." ;; so use the root of current Drive. (i.e "C:/") (let* ((directory (and (memq system-type '(windows-nt ms-dos)) (getenv "SystemDrive"))) - (subst (helm-substitute-in-filename pattern)) ;; On Windows use a simple call to `expand-file-name' to ;; avoid Issue #2004. (expand-fn (if directory #'expand-file-name #'helm-ff--expand-file-name-no-dot))) - ;; Fix issue #2223 with tilde in directory names e.g. "~/tmp/~test/". - (funcall expand-fn (if (string-match-p "\\`~[^/]" subst) - pattern subst) + (funcall expand-fn (helm-substitute-in-filename pattern) ;; directory is nil on Nix. directory))) @@ -2403,10 +2398,7 @@ purpose." (comps (cl-loop for (f . h) in (tramp-get-completion-function method) append (cl-loop for e in (funcall f (car h)) for host = (and (consp e) (cadr e)) - ;; On emacs-27 host may be - ;; ("root" t) in sudo method. - when (and (stringp host) - (not (member host all-methods))) + when (and host (not (member host all-methods))) collect (concat (or (car mh-method) "/") method ":" host))))) (helm-fast-remove-dups @@ -2451,8 +2443,6 @@ purpose." (postfixed (helm-ff--tramp-postfixed-p pattern)) (reg "\\`/\\([^[/:]+\\|[^/]+]\\):.*:") cur-method tramp-name) - (when (string-match "\\`/\\(-\\):" pattern) - (setq pattern (replace-match tramp-default-method t t pattern 1))) ;; In some rare cases tramp can return a nil input, ;; so be sure pattern is a string for safety (Issue #476). (unless pattern (setq pattern "")) @@ -2797,7 +2787,7 @@ If PATTERN is a valid directory name,return PATTERN unchanged." ((or (not (helm-ff-fuzzy-matching-p)) (string-match "\\s-" bn)) ; Fall back to multi-match. (concat (regexp-quote bd) bn)) - ((or (string-match "[*][.]?.*" bn) ; Allow entering wildcard. + ((or (string-match "[*][.]?.*" bn) ; Allow entering wilcard. (string-match "/$" pattern) ; Allow mkdir. (string-match helm-ff-url-regexp pattern) (and (string= helm-ff-default-directory "/") tramp-p)) @@ -3218,9 +3208,8 @@ Return candidates prefixed with basename of `helm-input' first." . helm-find-files-byte-compile) ("Load File(s) `M-L'" . helm-find-files-load-files)) 2)) - ((string-match (concat (regexp-opt load-suffixes) "\\'") - (helm-aif (helm-marked-candidates) - (car it) candidate)) + ((string-match "\\.elc?\\'" (helm-aif (helm-marked-candidates) + (car it) candidate)) (helm-append-at-nth actions '(("Load File(s) `M-L'" . helm-find-files-load-files)) @@ -3678,13 +3667,7 @@ prefix arg, one prefix arg or two prefix arg." (tap (helm-ffap-guesser)) (guess (and (stringp tap) (substring-no-properties tap))) - (beg (helm-aif (and guess - (save-excursion - (when (re-search-backward - (regexp-quote guess) - (point-at-bol) t) - (point)))) - it (point))) + (beg (if guess (- (point) (length guess)) (point))) (full-path-p (and (stringp guess) (or (string-match-p (concat "^" (getenv "HOME")) @@ -3692,40 +3675,34 @@ prefix arg, one prefix arg or two prefix arg." (string-match-p "\\`\\(/\\|[[:lower:][:upper:]]:/\\)" guess)))) - (escape-fn (if (memq major-mode - helm-modes-using-escaped-strings) - #'shell-quote-argument #'identity))) - (when (and beg end) - (delete-region beg end)) + (escape-fn (with-helm-current-buffer + (if (memq major-mode + helm-modes-using-escaped-strings) + #'shell-quote-argument #'identity)))) (insert - (funcall - escape-fn - (helm-ff--format-fname-to-insert - candidate beg end full-path-p guess - helm-current-prefix-arg)) + (funcall escape-fn (helm-ff--insert-fname + candidate beg end full-path-p guess)) (if (cdr mkds) " " "") (mapconcat escape-fn (cl-loop for f in (cdr mkds) - collect (helm-ff--format-fname-to-insert - f nil nil nil nil - helm-current-prefix-arg)) + collect (helm-ff--insert-fname f)) " ")))))) -(defun helm-ff--format-fname-to-insert (candidate - &optional beg end full-path guess prefarg) +(defun helm-ff--insert-fname (candidate &optional beg end full-path guess) (set-text-properties 0 (length candidate) nil candidate) (if (and beg end guess (not (string= guess "")) - (null prefarg) (or (string-match "^\\(~/\\|/\\|[[:lower:][:upper:]]:/\\)" guess) (file-exists-p candidate))) - (cond (full-path - (expand-file-name candidate)) - ((string= (match-string 1 guess) "~/") - (abbreviate-file-name candidate)) - (t (file-relative-name candidate))) - (helm-acase prefarg + (prog1 + (cond (full-path + (expand-file-name candidate)) + ((string= (match-string 1 guess) "~/") + (abbreviate-file-name candidate)) + (t (file-relative-name candidate))) + (delete-region beg end)) + (helm-acase helm-current-prefix-arg ('(4) (abbreviate-file-name candidate)) ('(16) (file-relative-name candidate)) ('(64) (helm-basename candidate)) @@ -4510,8 +4487,7 @@ Don't use it in your own code unless you know what you are doing.") (defvar helm-file-name-history-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "C-c d") 'helm-file-name-history-show-or-hide-deleted) - (define-key map (kbd "C-x C-f") 'helm-ff-file-name-history-run-ff) + (define-key map (kbd "C-c d") 'helm-file-name-history-show-or-hide-deleted) map)) (defun helm-file-name-history-transformer (candidates _source) @@ -4526,16 +4502,6 @@ Don't use it in your own code unless you know what you are doing.") (cons (propertize c 'face 'helm-history-deleted) c)))) collect it)) -(defun helm-ff-file-name-history-ff (candidate) - (helm-set-pattern - (expand-file-name candidate))) - -(defun helm-ff-file-name-history-run-ff () - "Switch back to current HFF session with selection as preselect." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-file-name-history-ff))) - (defun helm-ff-file-name-history () "Switch to `file-name-history' without quitting `helm-find-files'." (interactive) @@ -4562,7 +4528,9 @@ Don't use it in your own code unless you know what you are doing.") (helm-set-pattern (expand-file-name candidate)) (with-helm-after-update-hook (helm-exit-minibuffer))) - "Find file in helm" 'helm-ff-file-name-history-ff) + "Find file in helm" (lambda (candidate) + (helm-set-pattern + (expand-file-name candidate)))) :keymap helm-file-name-history-map))) (with-helm-alive-p (helm :sources 'helm-source--ff-file-name-history diff --git a/elpa/helm-20200128.1831/helm-find.el b/elpa/helm-20191101.641/helm-find.el similarity index 100% rename from elpa/helm-20200128.1831/helm-find.el rename to elpa/helm-20191101.641/helm-find.el diff --git a/elpa/helm-20200128.1831/helm-font.el b/elpa/helm-20191101.641/helm-font.el similarity index 100% rename from elpa/helm-20200128.1831/helm-font.el rename to elpa/helm-20191101.641/helm-font.el diff --git a/elpa/helm-20200128.1831/helm-for-files.el b/elpa/helm-20191101.641/helm-for-files.el similarity index 100% rename from elpa/helm-20200128.1831/helm-for-files.el rename to elpa/helm-20191101.641/helm-for-files.el diff --git a/elpa/helm-20200128.1831/helm-grep.el b/elpa/helm-20191101.641/helm-grep.el similarity index 100% rename from elpa/helm-20200128.1831/helm-grep.el rename to elpa/helm-20191101.641/helm-grep.el diff --git a/elpa/helm-20200128.1831/helm-help.el b/elpa/helm-20191101.641/helm-help.el similarity index 97% rename from elpa/helm-20200128.1831/helm-help.el rename to elpa/helm-20191101.641/helm-help.el index b27c17c3..f86ae90e 100644 --- a/elpa/helm-20200128.1831/helm-help.el +++ b/elpa/helm-20191101.641/helm-help.el @@ -101,16 +101,7 @@ pattern. **** Search inside buffers If you enter a space and a pattern prefixed by \"@\", Helm searches for text -matching this pattern *inside* the buffer (i.e. not in the name of the buffer). - -Negation are supported i.e. \"!\". - -When you specify more than one of such patterns, it will match -buffers with contents matching each of these patterns i.e. AND, -not OR. That's mean that if you specify \"@foo @bar\" the -contents of buffer will have to be matched by foo AND bar. If -you specify \"@foo @!bar\" it means the contents of buffer have -to be matched by foo but NOT bar. +matching this pattern \*inside* the buffer (i.e. not in the name of the buffer). If you enter a pattern prefixed with an escaped \"@\", Helm searches for a buffer matching \"@pattern\" but does not search inside. @@ -502,7 +493,7 @@ On completion: *** Use the wildcard to select multiple files -Use of wildcard is supported to run an action over a set of files. +Use of wilcard is supported to run an action over a set of files. Example: You can copy all the files with \".el\" extension by using \"*.el\" and then run copy action. @@ -525,7 +516,7 @@ When using an action that involves an external backend (e.g. grep), using \"**\" is not recommended (even thought it works fine) because it will be slower to select all the files. You are better off leaving the backend to do it, it will be faster. However, if you know you have not many files it is reasonable to use -this, also using not recursive wildcard (e.g. \"*.el\") is perfectly fine for +this, also using not recursive wilcard (e.g. \"*.el\") is perfectly fine for this. The \"**\" feature is active by default in the option `helm-file-globstar'. It @@ -1072,7 +1063,7 @@ You can toggle the view of deleted files, see commands below. "* Helm `%s' read file name completion This is `%s' read file name completion that have been \"helmized\" -because you have enabled [[Helm mode][helm-mode]]. +because you have enabled [[Helm mode][helm-mode]]'. Don't confuse this with `helm-find-files' which is a native helm command, see [[Helm functions vs helmized Emacs functions]]. @@ -1636,28 +1627,15 @@ marking it (`C-c u' or `RET') . ** Tips -*** You can get help on any command with persistent action (\\\\[helm-execute-persistent-action]) +*** You can get help on any command with persistent action (\\[helm-execute-persistent-action]) *** Prefix arguments -You can pass prefix arguments *after* starting `helm-M-x'. A mode-line +You must pass prefix arguments \*after* starting `helm-M-x'. A mode-line counter will display the number of given prefix arguments. If you pass prefix arguments before running `helm-M-x', it will be displayed in the prompt. -The first `\\[universal-argument]' after `helm-M-x' clears those prefix arguments. - -NOTE: When you specify prefix arguments once `helm-M-x' is -started, the prefix argument apply on the next command, so if you -hit RET, it will apply on the selected command, but if you type a -new character at prompt to narrow down further candidates, the -prefix arg will apply to `self-insert-command' (e.g. if you type -`C-u e' \"eeee\" will be inserted in prompt) so select the -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]].") +The first `\\[universal-argument]' after `helm-M-x' clears those prefix arguments.") ;;; Helm imenu ;; diff --git a/elpa/helm-20200128.1831/helm-id-utils.el b/elpa/helm-20191101.641/helm-id-utils.el similarity index 100% rename from elpa/helm-20200128.1831/helm-id-utils.el rename to elpa/helm-20191101.641/helm-id-utils.el diff --git a/elpa/helm-20200128.1831/helm-imenu.el b/elpa/helm-20191101.641/helm-imenu.el similarity index 91% rename from elpa/helm-20200128.1831/helm-imenu.el rename to elpa/helm-20191101.641/helm-imenu.el index d680c35e..2ff19723 100644 --- a/elpa/helm-20200128.1831/helm-imenu.el +++ b/elpa/helm-20191101.641/helm-imenu.el @@ -24,8 +24,6 @@ (require 'helm-utils) (require 'helm-help) -(declare-function which-function "which-func") - (defgroup helm-imenu nil "Imenu related libraries and applications for helm." @@ -312,21 +310,17 @@ Each car is a regexp match pattern of the imenu type string." (defun helm-imenu () "Preconfigured `helm' for `imenu'." (interactive) - (require 'which-func) (unless helm-source-imenu (setq helm-source-imenu (helm-make-source "Imenu" 'helm-imenu-source :fuzzy-match helm-imenu-fuzzy-match))) - (let* ((imenu-auto-rescan t) - (str (thing-at-point 'symbol)) - (init-reg (and str (concat "\\_<" (regexp-quote str) "\\_>"))) - (helm-execute-action-at-once-if-one - helm-imenu-execute-action-at-once-if-one)) + (let ((imenu-auto-rescan t) + (str (thing-at-point 'symbol)) + (helm-execute-action-at-once-if-one + helm-imenu-execute-action-at-once-if-one)) (helm :sources 'helm-source-imenu - :default (and str (list init-reg str)) - :preselect (helm-aif (which-function) - (concat "\\_<" (regexp-quote it) "\\_>") - init-reg) + :default (list (concat "\\_<" (and str (regexp-quote str)) "\\_>") str) + :preselect str :buffer "*helm imenu*"))) ;;;###autoload @@ -335,7 +329,6 @@ Each car is a regexp match pattern of the imenu type string." 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 (unless helm-source-imenu-all (setq helm-source-imenu-all @@ -348,22 +341,19 @@ or it have an association in `helm-imenu-all-buffer-assoc'." (helm-imenu-candidates-in-all-buffers))) :candidates 'helm-imenu--in-all-buffers-cache :fuzzy-match helm-imenu-fuzzy-match)))) - (let* ((imenu-auto-rescan t) - (str (thing-at-point 'symbol)) - (init-reg (and str (concat "\\_<" (regexp-quote str) "\\_>"))) - (helm-execute-action-at-once-if-one - helm-imenu-execute-action-at-once-if-one) - (helm--maybe-use-default-as-input - (not (null (memq 'helm-source-imenu-all - helm-sources-using-default-as-input)))) - (sources (if helm-imenu-in-all-buffers-separate-sources - (helm-imenu-candidates-in-all-buffers 'build-sources) - '(helm-source-imenu-all)))) + (let ((imenu-auto-rescan t) + (str (thing-at-point 'symbol)) + (helm-execute-action-at-once-if-one + helm-imenu-execute-action-at-once-if-one) + (helm--maybe-use-default-as-input + (not (null (memq 'helm-source-imenu-all + helm-sources-using-default-as-input)))) + (sources (if helm-imenu-in-all-buffers-separate-sources + (helm-imenu-candidates-in-all-buffers 'build-sources) + '(helm-source-imenu-all)))) (helm :sources sources - :default (and str (list init-reg str)) - :preselect (helm-aif (which-function) - (concat "\\_<" (regexp-quote it) "\\_>") - init-reg) + :default (list (concat "\\_<" (and str (regexp-quote str)) "\\_>") str) + :preselect (unless helm--maybe-use-default-as-input str) :buffer "*helm imenu all*"))) (provide 'helm-imenu) diff --git a/elpa/helm-20200128.1831/helm-info.el b/elpa/helm-20191101.641/helm-info.el similarity index 100% rename from elpa/helm-20200128.1831/helm-info.el rename to elpa/helm-20191101.641/helm-info.el diff --git a/elpa/helm-20200128.1831/helm-locate.el b/elpa/helm-20191101.641/helm-locate.el similarity index 97% rename from elpa/helm-20200128.1831/helm-locate.el rename to elpa/helm-20191101.641/helm-locate.el index 0642c911..ecba5cd5 100644 --- a/elpa/helm-20200128.1831/helm-locate.el +++ b/elpa/helm-20191101.641/helm-locate.el @@ -294,14 +294,12 @@ See also `helm-locate'." (t (if helm-locate-case-fold-search ignore-case-flag case-sensitive-flag))) - (helm-aif (cdr args) - (concat - ;; The pattern itself. - (shell-quote-argument (car args)) " " - ;; Possible locate args added - ;; after pattern, don't quote them. - (mapconcat 'identity it " ")) - (shell-quote-argument (car args))))) + (concat + ;; The pattern itself. + (shell-quote-argument (car args)) " " + ;; Possible locate args added + ;; after pattern, don't quote them. + (mapconcat 'identity (cdr args) " ")))) (default-directory (if (file-directory-p default-directory) default-directory "/"))) (helm-log "Starting helm-locate process") diff --git a/elpa/helm-20200128.1831/helm-man.el b/elpa/helm-20191101.641/helm-man.el similarity index 100% rename from elpa/helm-20200128.1831/helm-man.el rename to elpa/helm-20191101.641/helm-man.el diff --git a/elpa/helm-20200128.1831/helm-misc.el b/elpa/helm-20191101.641/helm-misc.el similarity index 99% rename from elpa/helm-20200128.1831/helm-misc.el rename to elpa/helm-20191101.641/helm-misc.el index a0a54c27..7843f0fb 100644 --- a/elpa/helm-20200128.1831/helm-misc.el +++ b/elpa/helm-20191101.641/helm-misc.el @@ -295,7 +295,7 @@ Default action change TZ environment variable locally to emacs." (let* ((enable-recursive-minibuffers t) (query-replace-p (or (eq last-command 'query-replace) (eq last-command 'query-replace-regexp))) - (elm (helm-comp-read "Next element matching (regexp): " + (elm (helm-comp-read "pattern: " (cl-loop for i in (symbol-value minibuffer-history-variable) unless (string= "" i) collect i into history diff --git a/elpa/helm-20200128.1831/helm-mode.el b/elpa/helm-20191101.641/helm-mode.el similarity index 71% rename from elpa/helm-20200128.1831/helm-mode.el rename to elpa/helm-20191101.641/helm-mode.el index 94af9571..d2f746c6 100644 --- a/elpa/helm-20200128.1831/helm-mode.el +++ b/elpa/helm-20191101.641/helm-mode.el @@ -24,8 +24,6 @@ (defvar crm-separator) (defvar ido-everywhere) -(defvar completion-flex-nospace) - (declare-function ido-mode "ido.el") (defgroup helm-mode nil @@ -33,12 +31,23 @@ :group 'helm) (defcustom helm-completing-read-handlers-alist - '((find-tag . helm-completing-read-default-find-tag) + '((describe-function . helm-completing-read-symbols) + (describe-variable . helm-completing-read-symbols) + (describe-symbol . helm-completing-read-symbols) + (debug-on-entry . helm-completing-read-symbols) + (find-function . helm-completing-read-symbols) + (disassemble . helm-completing-read-symbols) + (trace-function . helm-completing-read-symbols) + (trace-function-foreground . helm-completing-read-symbols) + (trace-function-background . helm-completing-read-symbols) + (find-tag . helm-completing-read-default-find-tag) (xref-find-definitions . helm-completing-read-default-find-tag) (xref-find-references . helm-completing-read-default-find-tag) - (ggtags-find-tag-dwim . helm-completing-read-default-find-tag) + (ffap-alternate-file . nil) (tmm-menubar . nil) (find-file . nil) + (find-file-at-point . helm-completing-read-sync-default-handler) + (ffap . helm-completing-read-sync-default-handler) (execute-extended-command . nil) (dired-do-rename . helm-read-file-name-handler-1) (dired-do-copy . helm-read-file-name-handler-1) @@ -141,15 +150,13 @@ when non--nil." :group 'helm-mode :type 'boolean) -(defcustom helm-mode-no-completion-in-region-in-modes nil - "A list of modes that do not want helm for `completion-in-region'." +(defcustom helm-mode-reverse-history t + "Display history source after current source in `helm-mode' handled commands." :group 'helm-mode :type 'boolean) -(defcustom helm-mode-reverse-history t - "Display history source after current source when non nil. - -Apply only in `helm-mode' handled commands." +(defcustom helm-mode-no-completion-in-region-in-modes nil + "A list of modes that do not want helm for `completion-in-region'." :group 'helm-mode :type 'boolean) @@ -168,25 +175,37 @@ will be used." (defcustom helm-mode-fuzzy-match nil "Enable fuzzy matching in `helm-mode' globally. - -This is deprecated, use instead helm-fuzzy as `helm-completion-style' or -even better 'emacs as `helm-completion-style' and add 'flex to -`completion-styles' (emacs-27) or 'helm-flex if 'flex is not available -in `completion-styles-alist' (emacs-26)." +Note that this will slow down completion and modify sorting +which is unwanted in many places. +This affect only the functions with completing-read helmized by helm-mode. +To fuzzy match `completion-at-point' and friends see +`helm-completion-style'." :group 'helm-mode :type 'boolean) -(make-obsolete-variable 'helm-mode-fuzzy-match 'helm-completion-style "3.6.0") -(defcustom helm-completion-mark-suffix t - "Push mark at end of suffix when non nil." +(defcustom 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 +and all functions belonging in this list from `minibuffer-setup-hook'." :group 'helm-mode - :type 'boolean) + :type '(repeat (choice symbol))) -(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 -and all functions belonging in this list from `minibuffer-setup-hook'. -This is mainly needed to prevent \"*Completions*\" buffers to popup.") +(defcustom helm-completing-read-dynamic-complete nil + "Use dynamic completion in `completing-read' when non-nil. + +The default is to not use this because it is most of the time unneeded +in `completing-read' and thus it is much more slower. +If you feel one emacs function need this you have better time to tell +`helm-mode' to use a dynamic completion for this function only by using +`helm-completing-read-handlers-alist' with an entry like this: + + (my-function . helm-completing-read-sync-default-handler) + +So you should not change the default setting of this variable unless you +know what you are doing." + :group 'helm-mode + :type 'boolean) (defface helm-mode-prefix '((t (:background "red" :foreground "black"))) @@ -235,34 +254,20 @@ letting user starting a new completion with a new prefix." (defcustom helm-completion-style 'emacs "Style of completion to use in `completion-in-region'. -This affect only `completion-at-point' and friends, and -the `completing-read' using the default handler -i.e. `helm-completing-read-default-handler'. +This affect only `completion-at-point' and friends, NOT +`completing-read' nor other helm commands. NB: This have nothing to do with `completion-styles', it is independent to -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'. +helm. There is three possible value to use: - - helm, use multi match regular helm completion. - - 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 - aside `helm' style (see `completion-styles-alist'). When `flex' style - is not available (Emacs<27) helm provide `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 -`completion-styles' to '(flex) if you are using emacs-27 or to -\'(helm-flex) if you are using emacs-26 and keep 'emacs as default -value for `helm-completion-style'. Advanced users can also have a -look to `completion-category-overrides' to set styles according to category. + `completion-styles', note that even in this style, helm allow using + multi match. Emacs-27 provide a style called flex that can be used + along this helm style (see `completion-styles-alist'). Please use custom interface or `customize-set-variable' to set this, NOT `setq'." @@ -276,41 +281,14 @@ NOT `setq'." (define-key helm-comp-read-map (kbd "DEL") 'helm-mode-delete-char-backward-maybe) (define-key helm-comp-read-map (kbd "DEL") 'delete-backward-char)))) -(defconst helm-completion--all-styles - (let ((flex (if (assq 'flex completion-styles-alist) - 'flex 'helm-flex))) - (helm-fast-remove-dups - (append (list 'helm flex) - (mapcar 'car completion-styles-alist))))) - -(defconst helm-completion--styles-type - `(repeat :tag "with other completion styles" - (choice ,@(mapcar (lambda (x) (list 'const x)) - helm-completion--all-styles)))) - -(defcustom helm-completion-styles-alist '((gud-mode . helm)) +(defcustom helm-completion-styles-alist '((eshell-mode . helm)) "Allow configuring `helm-completion-style' per mode. Each entry is a cons cell like (mode . style) where style must be a -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 -completions happening in buffers and not minibuffer completions, -i.e. completing-read's." +suitable value for `helm-completion-style'." :group 'helm-mode - :type - `(alist :key-type (symbol :tag "Major Mode") - :value-type - (choice :tag "Use helm style or completion styles" - (radio :tag "Helm Style" - (const helm) - (const helm-fuzzy) - (const emacs)) - (cons :tag "Completion Styles" - (const :tag "Using Helm `emacs' style" emacs) - ,helm-completion--styles-type)))) + :type '(alist :key-type (symbol :tag "Mode") + :value-type (symbol :tag "Style"))) ;;; helm-comp-read ;; @@ -409,12 +387,8 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." ;; but special cases like `find-file-at-point' do it. ;; Handle here specially such cases. ((and (functionp collection) (not (string= input "")) - (or minibuffer-completing-file-name - (eq (completion-metadata-get - (completion-metadata input collection test) - 'category) - 'file))) - (cl-loop for f in (funcall collection input test t) + minibuffer-completing-file-name) + (cl-loop for f in (funcall collection input test) unless (member f '("./" "../")) if (string-match helm--url-regexp input) collect f @@ -482,11 +456,9 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (defun helm-cr-default (default cands) (delq nil - (cond ((and (stringp default) - (not (string= default "")) - (string= helm-pattern "")) + (cond ((and (stringp default) (not (string= default ""))) (cons default (delete default cands))) - ((and (consp default) (string= helm-pattern "")) + ((consp default) (append (cl-loop for d in default ;; Don't convert ;; nil to "nil" (i.e the string) @@ -533,7 +505,6 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (candidate-number-limit helm-candidate-number-limit) multiline allow-nest - coerce (group 'helm)) "Read a string in the minibuffer, with helm completion. @@ -632,8 +603,6 @@ Keys description: - MULTILINE: See multiline in `helm-source'. -- COERCE: See coerce in `helm-source'. - - GROUP: See group in `helm-source'. Any prefix args passed during `helm-comp-read' invocation will be recorded @@ -649,7 +618,20 @@ that use `helm-comp-read' See `helm-M-x' for example." (if ,marked-candidates (helm-marked-candidates) (identity candidate))))))) + ;; Assume completion have been already required, + ;; so always use 'confirm. + (when (eq must-match 'confirm-after-completion) + (setq must-match 'confirm)) (let* ((minibuffer-completion-confirm must-match) + (must-match-map (when must-match + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") + 'helm-confirm-and-exit-minibuffer) + map))) + (loc-map (if must-match-map + (make-composed-keymap + must-match-map (or keymap helm-map)) + (or keymap helm-map))) (minibuffer-completion-predicate test) (minibuffer-completion-table collection) (helm-read-file-name-mode-line-string @@ -691,10 +673,8 @@ that use `helm-comp-read' See `helm-M-x' for example." (and hist-fc-transformer (helm-mklist hist-fc-transformer))) :persistent-action persistent-action :persistent-help persistent-help - :keymap keymap - :must-match must-match + :keymap loc-map :group group - :coerce coerce :mode-line mode-line :help-message help-message :action action-fn)) @@ -712,10 +692,8 @@ that use `helm-comp-read' See `helm-M-x' for example." :persistent-action persistent-action :persistent-help persistent-help :fuzzy-match fuzzy - :keymap keymap - :must-match must-match + :keymap loc-map :group group - :coerce coerce :mode-line mode-line :match-dynamic match-dynamic :help-message help-message @@ -732,10 +710,8 @@ that use `helm-comp-read' See `helm-M-x' for example." :requires-pattern requires-pattern :persistent-action persistent-action :fuzzy-match fuzzy - :keymap keymap - :must-match must-match + :keymap loc-map :group group - :coerce coerce :persistent-help persistent-help :mode-line mode-line :help-message help-message @@ -760,7 +736,7 @@ that use `helm-comp-read' See `helm-M-x' for example." :preselect preselect :prompt prompt :resume 'noresume - :keymap keymap ;; Needed with empty collection. + :keymap loc-map ;; Needed with empty collection. :allow-nest allow-nest :candidate-number-limit candidate-number-limit :case-fold-search case-fold @@ -879,105 +855,6 @@ It should be used when candidate list don't need to rebuild dynamically." ;; helm-comp-read. :initial-input initial-input))) -(defun helm-completing-read-default-2 - (prompt collection predicate require-match - 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'. - -This handler use dynamic matching which allow honouring `completion-styles'." - (let* ((history (or (car-safe hist) hist)) - (input (pcase init - ((pred (stringp)) init) - ;; INIT is a cons cell. - (`(,l . ,_ll) l))) - (completion-flex-nospace t) - (completion-styles - (helm--prepare-completion-styles 'nomode)) - (metadata (or (completion-metadata (or input "") collection predicate) - '(metadata))) - (afun (or (plist-get completion-extra-properties :annotation-function) - (completion-metadata-get metadata 'annotation-function))) - (file-comp-p (eq (completion-metadata-get metadata 'category) 'file)) - (compfn (lambda (str _predicate _action) - (let* ((completion-ignore-case (helm-set-case-fold-search)) - (comps - (completion-all-completions - str ; This is helm-pattern - collection - predicate - (length str) - metadata)) - (last-data (last comps)) - ;; Helm syle sort fn is added to - ;; metadata only in emacs-27, so in - ;; emacs-26 use helm-generic-sort-fn - ;; which handle both helm and - ;; helm-flex styles. When - ;; helm-completion-style is helm or - ;; helm-fuzzy, sorting will be done - ;; later in FCT. - (sort-fn - (and (eq helm-completion-style 'emacs) - (or - ;; Emacs-27 - (completion-metadata-get - metadata 'display-sort-function) - ;; Emacs-26 - (lambda (candidates) - (sort candidates #'helm-generic-sort-fn))))) - all) - (when (cdr last-data) - ;; Remove the last element of - ;; comps by side-effect. - (setcdr last-data nil)) - (setq helm-completion--sorting-done (and sort-fn t)) - (setq all (copy-sequence comps)) - ;; Default is passed here only with helm - ;; h-c-styles, otherwise with emacs style it is - ;; passed with the :default arg of helm-comp-read - ;; and computed in its get-candidates function. - (append (and default - (memq helm-completion-style '(helm helm-fuzzy)) - (list default)) - (helm-completion-in-region--initial-filter - (if (and sort-fn (> (length str) 0)) - (funcall sort-fn all) - all) - afun file-comp-p))))) - (data (if (memq helm-completion-style '(helm helm-fuzzy)) - (funcall compfn (or input "") nil nil) - compfn)) - (helm-completion-in-region-default-sort-fn - (lambda (candidates _source) - (if (or helm-completion--sorting-done - (string= helm-pattern "")) - candidates - (sort candidates 'helm-generic-sort-fn))))) - (unwind-protect - (helm-comp-read - ;; Completion-at-point and friends have no prompt. - prompt - data - :name name - :initial-input input - :buffer buffer - :history history - :reverse-history helm-mode-reverse-history - ;; In helm h-c-styles default is passed directly in - ;; candidates. - :default (and (eq helm-completion-style 'emacs) default) - :fc-transformer - ;; Ensure sort fn is at the end. - (append '(helm-cr-default-transformer) - (and helm-completion-in-region-default-sort-fn - (list helm-completion-in-region-default-sort-fn))) - :match-dynamic (eq helm-completion-style 'emacs) - :fuzzy (eq helm-completion-style 'helm-fuzzy) - :exec-when-only-one exec-when-only-one - :must-match require-match) - (setq helm-completion--sorting-done nil)))) - (defun helm-completing-read-default-find-tag (prompt collection test require-match init hist default inherit-input-method @@ -1002,29 +879,15 @@ This handler use dynamic matching which allow honouring `completion-styles'." init hist default inherit-input-method name buffer)) -(defun helm-completing-read-inbuffer-default-handler - (prompt collection test require-match - init hist default inherit-input-method - name buffer) - "`helm-mode' handler using inbuffer source as backend." - (helm-completing-read-default-1 prompt collection test require-match - init hist default inherit-input-method - name buffer t)) - (defun helm-completing-read-default-handler (prompt collection test require-match init hist default inherit-input-method name buffer) "Default `helm-mode' handler for all `completing-read'." - (let* ((standard (memq helm-completion-style '(helm helm-fuzzy))) - (fn (if standard - #'helm-completing-read-default-1 - #'helm-completing-read-default-2)) - (helm-mode-fuzzy-match (eq helm-completion-style 'helm-fuzzy))) - (apply fn - prompt collection test require-match - init hist default inherit-input-method - name buffer standard))) + (helm-completing-read-default-1 prompt collection test require-match + init hist default inherit-input-method + name buffer + (null helm-completing-read-dynamic-complete))) (defun helm--generic-read-buffer (prompt &optional default require-match predicate) "The `read-buffer-function' for `helm-mode'. @@ -1080,10 +943,14 @@ See documentation of `completing-read' and `all-completions' for details." ;; i.e (push ?\t unread-command-events). unread-command-events (default-handler - ;; If nothing is found in - ;; helm-completing-read-handlers-alist use default - ;; handler. - #'helm-completing-read-default-handler)) + ;; Typically when COLLECTION is a function, we can assume + ;; the intention is completing dynamically according to + ;; input; If one want to use in-buffer handler for specific + ;; usage with a function as collection he can specify it in + ;; helm-completing-read-handlers-alist. + (if (functionp collection) + #'helm-completing-read-sync-default-handler + #'helm-completing-read-default-handler))) (when (eq def-com 'ido) (setq def-com 'ido-completing-read)) (unless (or (not entry) def-com) ;; An entry in *read-handlers-alist exists but have @@ -1199,6 +1066,10 @@ Keys description: (require 'tramp) (when (get-buffer helm-action-buffer) (kill-buffer helm-action-buffer)) + ;; Assume completion have been already required, + ;; so always use 'confirm. + (when (eq must-match 'confirm-after-completion) + (setq must-match 'confirm)) (mapc (lambda (hook) (add-hook 'helm-after-update-hook hook)) '(helm-ff-move-to-first-real-candidate @@ -1221,6 +1092,19 @@ Keys description: history nil nil alistp))) (minibuffer-completion-confirm must-match) (helm-ff--RET-disabled noret) + (must-match-map (when must-match + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") + (let ((fn (lookup-key helm-read-file-map (kbd "RET")))) + (if (and (eq fn 'helm-ff-RET) + (null helm-ff--RET-disabled)) + #'helm-ff-RET-must-match + #'helm-confirm-and-exit-minibuffer))) + map))) + (cmap (if must-match-map + (make-composed-keymap + must-match-map helm-read-file-map) + helm-read-file-map)) (minibuffer-completion-predicate test) (minibuffer-completing-file-name t) (helm--completing-file-name t) @@ -1241,8 +1125,7 @@ Keys description: :fuzzy-match fuzzy :persistent-action-if persistent-action-if :persistent-help persistent-help - :keymap helm-read-file-map - :must-match must-match + :keymap cmap :nomark nomark :action action-fn) ;; Other source. @@ -1276,8 +1159,7 @@ Keys description: :persistent-action-if persistent-action-if :persistent-help persistent-help :volatile t - :keymap helm-read-file-map - :must-match must-match + :keymap cmap :cleanup 'helm-find-files-cleanup :nomark nomark :action action-fn))) @@ -1469,6 +1351,45 @@ The `helm-find-files' history `helm-ff-history' is used here." (propertize str 'read-only t 'face 'helm-mode-prefix 'rear-nonsticky t) str)) +(defun helm-completion-try-completion (string table pred point) + "The try completion function for `completing-styles-alist'. +Actually do nothing." + ;; AFAIU the try completion function is here to handle single + ;; element completion, in this case it throw this element without + ;; popping up *completions* buffer. If that's the case we don't need + ;; this because helm already handle this with + ;; `helm-execute-action-at-once-if-one', so returning unconditionaly + ;; nil should be fine. + (ignore string table pred point)) + +(defun helm-completion-all-completions (string table pred point) + "The all completions function for `completing-styles-alist'." + ;; FIXME: No need to bind all these value. + (cl-multiple-value-bind (all _pattern prefix _suffix _carbounds) + (helm-completion--multi-all-completions string table pred point) + (when all (nconc all (length prefix))))) + +(defun helm-completion--multi-all-completions-1 (string collection &optional predicate) + "Allow `all-completions' multi matching on its candidates." + (all-completions "" collection (lambda (x) + (if predicate + (and (funcall predicate x) + (helm-mm-match (helm-stringify x) string)) + (helm-mm-match (helm-stringify x) string))))) + +(defun helm-completion--multi-all-completions (string table pred point) + "Collect completions from TABLE for helm completion style." + (let* ((beforepoint (substring string 0 point)) + (afterpoint (substring string point)) + (bounds (completion-boundaries beforepoint table pred afterpoint)) + (prefix (substring beforepoint 0 (car bounds))) + (suffix (substring afterpoint (cdr bounds))) + (all (if (or (string-match-p " " string) + (string-match-p "\\`!" string)) + (helm-completion--multi-all-completions-1 string table pred) + (all-completions string table pred)))) + (list all string prefix suffix point))) + (defun helm-completion-in-region--initial-filter (comps afun file-comp-p) "Add annotations at end of candidates and filter out dot files." (if file-comp-p @@ -1496,209 +1417,65 @@ The `helm-find-files' history `helm-ff-history' is used here." comps) comps))) -;; Helm multi matching style - -(defun helm-completion-try-completion (string table pred point) - "The try completion function for `completing-styles-alist'. -Actually do 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 - ;; apart sending STRING in a minibuffer like helm does. Perhaps - ;; minibuffer-complete should benefit of this but for now just do - ;; nothing as this is used nowhere. It is anyway not clear what the - ;; try-completions functions do in emacs so just do nothing for now. - (ignore string table pred point)) - -(defun helm-completion-all-completions (string table pred point) - "The all completions function for `completing-styles-alist'." - ;; FIXME: No need to bind all these value. - (cl-multiple-value-bind (all _pattern prefix _suffix _carbounds) - (helm-completion--multi-all-completions string table pred point) - (when all (nconc all (length prefix))))) - -(defun helm-completion--multi-all-completions-1 (string collection &optional predicate) - "Allow `all-completions' multi matching on its candidates." - ;; Doing an initial call of all-completions on the first element of - ;; STRING speedup completion and fix file completion when CAPF - ;; returns relative paths to initial pattern (eshell and shell). - (let* ((split (helm-mm-split-pattern string)) - (fpat (or (car split) "")) - (file-comp-p (or minibuffer-completing-file-name - (eq - (completion-metadata-get - (completion-metadata string collection predicate) - 'category) - 'file))) - (all (and file-comp-p - (or (cdr split) - (and (not (cdr split)) - ;; Kickin when STRING is a simple string. - ;; Handle as well "foo " (space at end). - (not (string= fpat ""))) - (string= string "")) - (not (string-match "\\`!" fpat)) - ;; all-completions should return nil if FPAT is a - ;; regexp, it is what we expect. - (all-completions fpat collection - (lambda (x &optional _y) - (let ((elm (if (listp x) (car x) x))) - (funcall (or predicate #'identity) elm)))))) - (pattern (helm-aand all (string-match " " string) - ;; Returns the part of STRING after space - ;; e.g. "foo bar baz" => "bar baz". - (substring string (1+ it))))) - (if (or (and all (not (cdr split))) - (equal pattern "")) ; e.g. STRING == "foo ". - all - (all-completions "" (or all collection) - (lambda (x &optional _y) - ;; Second arg _y is needed when - ;; COLLECTION is a hash-table issue - ;; #2231 (C-x 8 RET). - ;; Elements of COLLECTION may be - ;; lists or alists, in this case consider the - ;; car of element (issue #2219 org-refile). - (let ((elm (if (listp x) (car x) x))) - ;; PREDICATE have been already called in - ;; initial all-completions, no need to call - ;; it a second time, thus ALL is now a list - ;; of strings maybe not supported by - ;; PREDICATE (e.g. symbols vs strings). - (if (and predicate (null all)) - (and (funcall predicate elm) - ;; ALL is nil so use whole STRING - ;; against COLLECTION. - (helm-mm-match (helm-stringify elm) string)) - (helm-mm-match (helm-stringify elm) - (or (and all pattern) string))))))))) - -(defun helm-completion--multi-all-completions (string table pred point) - "Collect completions from TABLE for helm completion style." - (let* ((beforepoint (substring string 0 point)) - (afterpoint (substring string point)) - (bounds (completion-boundaries beforepoint table pred afterpoint)) - (prefix (substring beforepoint 0 (car bounds))) - (suffix (substring afterpoint (cdr bounds))) - (all (helm-completion--multi-all-completions-1 string table pred))) - (list all string prefix suffix point))) +;; Setup completion styles for helm-mode +(defun helm-mode--setup-completion-styles () + (cl-pushnew '(helm helm-completion-try-completion + helm-completion-all-completions + "helm completion style.") + completion-styles-alist + :test 'equal)) + +(defun helm-mode--disable-completion-styles () + (setq completion-styles-alist + (delete (assq 'helm completion-styles-alist) + completion-styles-alist))) + +(defun helm-completion-in-region--fix-completion-styles () + "Add helm style to `completion-styles' and filter out invalid styles." + (if (memq helm-completion-style '(helm helm-fuzzy)) + '(basic partial-completion emacs22) + (cl-loop with all-styles = (mapcar 'car completion-styles-alist) + for style in (cons 'helm completion-styles) + when (and (memq style all-styles) + (not (memq style styles))) + collect style into styles + finally return styles))) -;; The adjust-metadata functions run only in emacs-27, they are NOT -;; used otherwise. (defun helm-completion--adjust-metadata (metadata) (if (memq helm-completion-style '(helm helm-fuzzy)) metadata - (let ((compose-helm-sort-fn - (lambda (candidates) - (sort candidates #'helm-generic-sort-fn)))) - `(metadata - (display-sort-function - . ,compose-helm-sort-fn) - (cycle-sort-function - . ,compose-helm-sort-fn) - ,@(cdr metadata))))) + (cl-flet ((compose-helm-sort-fn + (_existing-sort-fn) + (lambda (candidates) + (let ((res candidates)) + (sort res #'helm-generic-sort-fn))))) + (let ((alist (cdr metadata))) + (helm-aif (assq 'display-sort-function alist) + (setq alist (remove it alist))) + `(metadata . ,(cons + (cons 'display-sort-function + (compose-helm-sort-fn + (alist-get 'display-sort-function alist))) + alist)))))) (put 'helm 'completion--adjust-metadata 'helm-completion--adjust-metadata) -;; Helm-flex style. -;; This is more or less the same as emacs-27 flex style. -(defun helm-flex-completion-try-completion (string table pred point) - "The try completion function for `completing-styles-alist'." - ;; It is needed here to make minibuffer-complete work in emacs-26, - ;; e.g. with regular M-x. - (unless (string-match-p " " string) - (cl-multiple-value-bind (all pattern prefix suffix _carbounds) - (helm-completion--flex-all-completions string table pred point) - (when minibuffer-completing-file-name - (setq all (completion-pcm--filename-try-filter all))) - (completion-pcm--merge-try pattern all prefix suffix)))) - -(defun helm-flex-completion-all-completions (string table pred point) - "The all completions function for `completing-styles-alist'." - ;; FIXME: No need to bind all these value. - (unless (string-match-p " " string) - (cl-multiple-value-bind (all pattern prefix _suffix _carbounds) - (helm-completion--flex-all-completions - string table pred point - #'helm-completion--flex-transform-pattern) - (let ((regexp (completion-pcm--pattern->regex pattern 'group))) - (when all (nconc (helm-flex-add-score-as-prop all regexp) - (length prefix))))))) - -(defun helm-flex-add-score-as-prop (candidates regexp) - (cl-loop with case-fold-search = (helm-set-case-fold-search) - for cand in candidates - collect (helm-flex--style-score cand regexp))) - -(defun helm-completion--flex-transform-pattern (pattern) - ;; "fob" => '(prefix "f" any "o" any "b" any point) - (cl-loop for p in pattern - if (stringp p) nconc - (cl-loop for str across p - nconc (list (string str) 'any)) - else nconc (list p))) - -;; Same as emacs-27 completion-substring--all-completions. -(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." - (let* ((beforepoint (substring string 0 point)) - (afterpoint (substring string point)) - (bounds (completion-boundaries beforepoint table pred afterpoint)) - (suffix (substring afterpoint (cdr bounds))) - (prefix (substring beforepoint 0 (car bounds))) - (basic-pattern (completion-basic--pattern - beforepoint afterpoint bounds)) - (pattern (if (not (stringp (car basic-pattern))) - basic-pattern - (cons 'prefix basic-pattern))) - (pattern (if transform-pattern-fn - (funcall transform-pattern-fn pattern) - pattern)) - (all (completion-pcm--all-completions prefix pattern table pred))) - (list all pattern prefix suffix (car bounds)))) - -(defun helm-completion-in-region--selection () - (with-helm-buffer - (setq helm-saved-selection (helm-get-selection nil 'withprop)))) - -;; Completion-in-region-function - -(defun helm--completion-in-region (origfun start end collection &optional predicate) +(defun helm--completion-in-region (start end collection &optional predicate) "Helm replacement of `completion--in-region'. - -Can be used for `completion-in-region-function' by advicing it with an -:around advice to allow passing the old -`completion-in-region-function' value in ORIGFUN." +Can be used as value for `completion-in-region-function'." (cl-declare (special require-match prompt)) (if (memq major-mode helm-mode-no-completion-in-region-in-modes) - (funcall origfun start end collection predicate) + (funcall helm--old-completion-in-region-function + start end collection predicate) (advice-add 'lisp--local-variables :around #'helm-mode--advice-lisp--local-variables) - (let ((old--helm-completion-style helm-completion-style) - string) + (let ((old--helm-completion-style helm-completion-style)) (helm-aif (cdr (assq major-mode helm-completion-styles-alist)) - (customize-set-variable 'helm-completion-style - (if (cdr-safe it) (car it) it))) - ;; This hook force usage of the display part of candidate with - ;; its properties, this is needed for lsp-mode in its - ;; :exit-function see issue #2265. - (add-hook 'helm-before-action-hook 'helm-completion-in-region--selection) + (customize-set-variable 'helm-completion-style it)) (unwind-protect (let* ((enable-recursive-minibuffers t) - (completion-flex-nospace t) - (completion-styles (helm--prepare-completion-styles)) - (input (buffer-substring-no-properties start end)) - ;; Always start with prefix to allow completing without - ;; the need of inserting a space after cursor or - ;; relaying on crap old completion-styles emacs22 which - ;; add suffix after prefix. e.g. def|else. - (initial-input (buffer-substring-no-properties start (point))) - (prefix (and (eq helm-completion-style 'emacs) initial-input)) - (point (point)) + (completion-styles (helm-completion-in-region--fix-completion-styles)) + (input (buffer-substring start end)) (current-command (or (helm-this-command) this-command)) (crm (eq current-command 'crm-complete)) (str-command (helm-symbol-name current-command)) @@ -1710,14 +1487,15 @@ Can be used for `completion-in-region-function' by advicing it with an ;; completion-at-point or friend, so use a non--nil ;; value for require-match. (not (boundp 'prompt)))) - (metadata (completion-metadata input collection predicate)) ;; `completion-extra-properties' is let-bounded in `completion-at-point'. ;; `afun' is a closure to call against each string in `data'. ;; it provide the annotation info for each string. ;; e.g "foo" => "foo " where foo is a function. ;; See Issue #407. - (afun (or (plist-get completion-extra-properties :annotation-function) - (completion-metadata-get metadata 'annotation-function))) + (afun (plist-get completion-extra-properties :annotation-function)) + (metadata (completion-metadata + (buffer-substring start (point)) + collection predicate)) (init-space-suffix (unless (or (memq helm-completion-style '(helm-fuzzy emacs)) (string-suffix-p " " input) (string= input "")) @@ -1731,58 +1509,39 @@ Can be used for `completion-in-region-function' by advicing it with an ;; so data looks like this: '(a b c d . 0) and (last data) == (d . 0). base-size (compfn (lambda (str _predicate _action) - (let* ((completion-ignore-case (helm-set-case-fold-search)) - (comps + (let* ((comps (completion-all-completions - str ; This is helm-pattern + ;; `helm-comp-read-get-candidates' + ;; set input to `helm-pattern' + ;; so no need to pass + ;; `helm-pattern' directly here. + str collection predicate - ;; Use prefix length at first call to - ;; allow styles matching - ;; "prefix*suffix" to kick in. - (length (or prefix str)) + (length str) metadata)) (last-data (last comps)) - (bs (helm-aif (cdr last-data) - (prog1 it - ;; Remove the last element of - ;; comps by side-effect. - (setcdr last-data nil)) - 0)) - ;; Helm syle sort fn is added to - ;; metadata only in emacs-27, so in - ;; emacs-26 use helm-generic-sort-fn - ;; which handle both helm and - ;; helm-flex styles. When - ;; helm-completion-style is helm or - ;; helm-fuzzy, sorting will be done - ;; later in FCT. - (sort-fn - (and (eq helm-completion-style 'emacs) - (or - ;; Emacs-27 - (completion-metadata-get - metadata 'display-sort-function) - ;; Emacs-26 - (lambda (candidates) - (sort candidates #'helm-generic-sort-fn))))) + (sort-fn (and (eq helm-completion-style 'emacs) + (completion-metadata-get + metadata 'display-sort-function))) all) - ;; Reset prefix to allow using length of - ;; helm-pattern on next calls (this avoid - ;; args-out-of-range error). - (and prefix (setq prefix nil)) - ;; base-size needs to be set only once at - ;; first call. - (unless base-size (setq base-size bs)) + (setq base-size + (helm-aif (cdr last-data) + (prog1 (or base-size it) + (setcdr last-data nil)) + 0)) (setq helm-completion--sorting-done (and sort-fn t)) (setq all (copy-sequence comps)) + ;; Fall back to string-lessp sorting when + ;; str is too small as specialized + ;; sorting may be too slow (flex). + (when (and sort-fn (<= (length str) 1)) + (setq sort-fn (lambda (all) (sort all #'string-lessp)))) (helm-completion-in-region--initial-filter - (if (and sort-fn (> (length str) 0)) - (funcall sort-fn all) - all) + (if sort-fn (funcall sort-fn all) all) afun file-comp-p)))) (data (if (memq helm-completion-style '(helm helm-fuzzy)) - (funcall compfn input nil nil) + (funcall compfn (buffer-substring start end) nil nil) compfn)) (result (if (stringp data) data @@ -1795,18 +1554,15 @@ Can be used for `completion-in-region-function' by advicing it with an :marked-candidates crm :initial-input (cond ((and file-comp-p - (not (string-match "/\\'" initial-input))) + (not (string-match "/\\'" input))) (concat (helm-mode--completion-in-region-initial-input - (if (memq helm-completion-style '(helm helm-fuzzy)) - (helm-basename initial-input) - initial-input)) + (helm-basename input)) init-space-suffix)) - ((string-match "/\\'" initial-input) - (and (eq helm-completion-style 'emacs) initial-input)) + ((string-match "/\\'" input) nil) ((or (null require-match) (stringp require-match)) - (helm-mode--completion-in-region-initial-input initial-input)) - (t (concat (helm-mode--completion-in-region-initial-input initial-input) + (helm-mode--completion-in-region-initial-input input)) + (t (concat (helm-mode--completion-in-region-initial-input input) init-space-suffix))) :buffer buf-name :fc-transformer @@ -1826,33 +1582,18 @@ Can be used for `completion-in-region-function' by advicing it with an (message "[No matches]"))) t) ; exit minibuffer immediately. :must-match require-match)))) - ;; `helm-completion-in-region--insert-result' is stripping - ;; out properties on RESULT and by side-effect (perhaps - ;; `choose-completion-string'?) modify STRING so make a copy. - (setq string (copy-sequence result)) - (helm-completion-in-region--insert-result result start point end base-size)) - ;; Allow running extra property :exit-function (Issue #2265) - (when (stringp string) - (completion--done string 'exact)) - (remove-hook 'helm-before-action-hook 'helm-completion-in-region--selection) + (helm-completion-in-region--insert-result result start end base-size)) (customize-set-variable 'helm-completion-style old--helm-completion-style) (setq helm-completion--sorting-done nil) (advice-remove 'lisp--local-variables #'helm-mode--advice-lisp--local-variables))))) -(defun helm-completion-in-region--insert-result (result start point end base-size) +(defun helm-completion-in-region--insert-result (result start end base-size) (cond ((stringp result) (choose-completion-string result (current-buffer) - (list (+ start base-size) point) - completion-list-insert-choice-function) - (when helm-completion-mark-suffix - (run-with-idle-timer 0.01 nil - (lambda () - (helm-aand - (+ (- (point) point) end) - (and (> it (point)) it) - (push-mark it t t)))))) + (list (+ start base-size) end) + completion-list-insert-choice-function)) ((consp result) ; crm. (let ((beg (+ start base-size)) (sep ",")) @@ -1869,6 +1610,9 @@ Can be used for `completion-in-region-function' by advicing it with an (with-helm-current-buffer (run-hook-with-args-until-success 'file-name-at-point-functions))) +(when (boundp 'completion-in-region-function) + (defconst helm--old-completion-in-region-function completion-in-region-function)) + (defun helm-mode--disable-ido-maybe (&optional from-hook) (when (and (boundp 'ido-everywhere) ido-everywhere) (remove-function read-file-name-function #'ido-read-file-name) @@ -1888,20 +1632,29 @@ Can be used for `completion-in-region-function' by advicing it with an (define-minor-mode helm-mode "Toggle generic helm completion. -All functions in Emacs that use `completing-read', -`read-file-name', `completion-in-region' and friends will use helm -interface when this mode is turned on. +All functions in Emacs that use `completing-read' +or `read-file-name' and friends will use helm interface +when this mode is turned on. However you can modify this behavior for functions of your choice with `helm-completing-read-handlers-alist'. +Also commands using `completion-in-region' will be helmized when +`helm-mode-handle-completion-in-region' is non nil, you can modify +this behavior with `helm-mode-no-completion-in-region-in-modes'. + Called with a positive arg, turn on unconditionally, with a negative arg turn off. -You can toggle it with M-x `helm-mode'. +You can turn it on with `helm-mode'. + +Some crap emacs functions may not be supported, +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': -DO NOT enable `ido-everywhere' when using `helm-mode' and instead of -using `ido-mode', add the commands where you want to use ido to +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." @@ -1911,37 +1664,52 @@ Note: This mode is incompatible with Emacs23." (cl-assert (boundp 'completing-read-function) nil "`helm-mode' not available, upgrade to Emacs-24") (if helm-mode - (progn - (add-function :override completing-read-function - #'helm--completing-read-default) - (add-function :override read-file-name-function - #'helm--generic-read-file-name) - (add-function :override read-buffer-function - #'helm--generic-read-buffer) - (when helm-mode-handle-completion-in-region - (add-function :around completion-in-region-function - #'helm--completion-in-region)) - ;; If user have enabled ido-everywhere BEFORE enabling - ;; helm-mode disable it and warn user about its - ;; incompatibility with helm-mode (issue #2085). - (helm-mode--disable-ido-maybe) - ;; If ido-everywhere is not enabled yet anticipate and - ;; disable it if user attempt to enable it while helm-mode - ;; is running (issue #2085). - (add-hook 'ido-everywhere-hook #'helm-mode--ido-everywhere-hook) - (when (fboundp 'ffap-read-file-or-url-internal) - ;; `ffap-read-file-or-url-internal' have been removed in - ;; emacs-27 and `ffap-read-file-or-url' is fixed, so no need - ;; to advice it. - (advice-add 'ffap-read-file-or-url :override #'helm-advice--ffap-read-file-or-url))) - (progn - (remove-function completing-read-function #'helm--completing-read-default) - (remove-function read-file-name-function #'helm--generic-read-file-name) - (remove-function read-buffer-function #'helm--generic-read-buffer) - (remove-function completion-in-region-function #'helm--completion-in-region) - (remove-hook 'ido-everywhere-hook #'helm-mode--ido-everywhere-hook) - (when (fboundp 'ffap-read-file-or-url-internal) - (advice-remove 'ffap-read-file-or-url #'helm-advice--ffap-read-file-or-url))))) + (if (fboundp 'add-function) + (progn + (add-function :override completing-read-function + #'helm--completing-read-default) + (add-function :override read-file-name-function + #'helm--generic-read-file-name) + (add-function :override read-buffer-function + #'helm--generic-read-buffer) + (when helm-mode-handle-completion-in-region + (add-function :override completion-in-region-function + #'helm--completion-in-region) + (helm-mode--setup-completion-styles)) + ;; If user have enabled ido-everywhere BEFORE enabling + ;; helm-mode disable it and warn user about its + ;; incompatibility with helm-mode (issue #2085). + (helm-mode--disable-ido-maybe) + ;; If ido-everywhere is not enabled yet anticipate and + ;; disable it if user attempt to enable it while helm-mode + ;; is running (issue #2085). + (add-hook 'ido-everywhere-hook #'helm-mode--ido-everywhere-hook)) + (setq completing-read-function 'helm--completing-read-default + read-file-name-function 'helm--generic-read-file-name + read-buffer-function 'helm--generic-read-buffer) + (when (and (boundp 'completion-in-region-function) + helm-mode-handle-completion-in-region) + (setq completion-in-region-function #'helm--completion-in-region) + (helm-mode--setup-completion-styles)) + (message helm-completion-mode-start-message)) + (if (fboundp 'remove-function) + (progn + (remove-function completing-read-function #'helm--completing-read-default) + (remove-function read-file-name-function #'helm--generic-read-file-name) + (remove-function read-buffer-function #'helm--generic-read-buffer) + (remove-function completion-in-region-function #'helm--completion-in-region) + (helm-mode--disable-completion-styles) + (remove-hook 'ido-everywhere-hook #'helm-mode--ido-everywhere-hook)) + (setq completing-read-function (and (fboundp 'completing-read-default) + 'completing-read-default) + read-file-name-function (and (fboundp 'read-file-name-default) + 'read-file-name-default) + read-buffer-function (and (fboundp 'read-buffer) 'read-buffer)) + (when (and (boundp 'completion-in-region-function) + (boundp 'helm--old-completion-in-region-function)) + (setq completion-in-region-function helm--old-completion-in-region-function) + (helm-mode--disable-completion-styles)) + (message helm-completion-mode-quit-message)))) (provide 'helm-mode) diff --git a/elpa/helm-20200128.1831/helm-net.el b/elpa/helm-20191101.641/helm-net.el similarity index 100% rename from elpa/helm-20200128.1831/helm-net.el rename to elpa/helm-20191101.641/helm-net.el diff --git a/elpa/helm-20200128.1831/helm-occur.el b/elpa/helm-20191101.641/helm-occur.el similarity index 98% rename from elpa/helm-20200128.1831/helm-occur.el rename to elpa/helm-20191101.641/helm-occur.el index fbf81c2e..72fc70ad 100644 --- a/elpa/helm-20200128.1831/helm-occur.el +++ b/elpa/helm-20191101.641/helm-occur.el @@ -152,10 +152,7 @@ engine beeing completely different and also much faster." 'helm-occur--buffer-tick (list (buffer-chars-modified-tick (current-buffer)))) (save-restriction - (let ((helm-sources-using-default-as-input - (unless (> (buffer-size) 2000000) - helm-sources-using-default-as-input)) - def pos) + (let (def pos) (when (use-region-p) ;; When user mark defun with `mark-defun' with intention of ;; using helm-occur on this region, it is relevant to use the @@ -230,7 +227,7 @@ engine beeing completely different and also much faster." #'buffer-substring-no-properties)) (contents (funcall bsfn (point-min) (point-max)))) (helm-attrset 'get-line bsfn) - (with-current-buffer (helm-candidate-buffer 'global) + (with-current-buffer (helm-candidate-buffer 'local) (insert contents) (goto-char (point-min)) (let ((linum 1)) @@ -260,12 +257,6 @@ Each buffer's result is displayed in a separated source." (bufs (if helm-occur-always-search-in-current (cons curbuf (remove curbuf buffers)) buffers)) - (helm-sources-using-default-as-input - (unless (cl-loop with total_size = 0 - for b in bufs - do (setq total_size (buffer-size b)) - finally return (> total_size 2000000)) - helm-sources-using-default-as-input)) (sources (helm-occur-build-sources bufs)) (helm--maybe-use-default-as-input (not (null (memq 'helm-source-moccur @@ -585,6 +576,7 @@ numbered. The property 'buffer-name is added to the whole string." (helm-grep-highlight-match str t)) candidate))) +;;;###autoload (define-derived-mode helm-occur-mode special-mode "helm-moccur" "Major mode to provide actions in helm moccur saved buffer. diff --git a/elpa/helm-20191101.641/helm-pkg.el b/elpa/helm-20191101.641/helm-pkg.el new file mode 100644 index 00000000..d9a664cc --- /dev/null +++ b/elpa/helm-20191101.641/helm-pkg.el @@ -0,0 +1,9 @@ +(define-package "helm" "20191101.641" "Helm is an Emacs incremental and narrowing framework" + '((emacs "24.4") + (async "1.9.3") + (popup "0.5.3") + (helm-core "3.0")) + :url "https://emacs-helm.github.io/helm/") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-20200128.1831/helm-regexp.el b/elpa/helm-20191101.641/helm-regexp.el similarity index 100% rename from elpa/helm-20200128.1831/helm-regexp.el rename to elpa/helm-20191101.641/helm-regexp.el diff --git a/elpa/helm-20200128.1831/helm-ring.el b/elpa/helm-20191101.641/helm-ring.el similarity index 100% rename from elpa/helm-20200128.1831/helm-ring.el rename to elpa/helm-20191101.641/helm-ring.el diff --git a/elpa/helm-20200128.1831/helm-semantic.el b/elpa/helm-20191101.641/helm-semantic.el similarity index 100% rename from elpa/helm-20200128.1831/helm-semantic.el rename to elpa/helm-20191101.641/helm-semantic.el diff --git a/elpa/helm-20200128.1831/helm-shell.el b/elpa/helm-20191101.641/helm-shell.el similarity index 100% rename from elpa/helm-20200128.1831/helm-shell.el rename to elpa/helm-20191101.641/helm-shell.el diff --git a/elpa/helm-20200128.1831/helm-sys.el b/elpa/helm-20191101.641/helm-sys.el similarity index 100% rename from elpa/helm-20200128.1831/helm-sys.el rename to elpa/helm-20191101.641/helm-sys.el diff --git a/elpa/helm-20200128.1831/helm-tags.el b/elpa/helm-20191101.641/helm-tags.el similarity index 100% rename from elpa/helm-20200128.1831/helm-tags.el rename to elpa/helm-20191101.641/helm-tags.el diff --git a/elpa/helm-20200128.1831/helm-types.el b/elpa/helm-20191101.641/helm-types.el similarity index 95% rename from elpa/helm-20200128.1831/helm-types.el rename to elpa/helm-20191101.641/helm-types.el index 02d5107c..868e7974 100644 --- a/elpa/helm-20200128.1831/helm-types.el +++ b/elpa/helm-20191101.641/helm-types.el @@ -215,9 +215,9 @@ (defcustom helm-type-function-actions (helm-make-actions - "Describe command" 'helm-describe-function + "Describe command" 'describe-function + "Add command to kill ring" 'helm-kill-new "Go to command's definition" 'find-function - "Info lookup" 'helm-info-lookup-symbol "Debug on entry" 'debug-on-entry "Cancel debug on entry" 'cancel-debug-on-entry "Trace function" 'trace-function @@ -225,9 +225,7 @@ "Untrace function" 'untrace-function) "Default actions for type functions." :group 'helm-elisp - ;; Use symbol as value type because some functions may not be - ;; autoloaded (like untrace-function). - :type '(alist :key-type string :value-type symbol)) + :type '(alist :key-type string :value-type function)) (defmethod helm-source-get-action-from-type ((object helm-type-function)) (slot-value object 'action)) @@ -259,20 +257,18 @@ (defcustom helm-type-command-actions (append (helm-make-actions - "Execute command" 'helm-M-x-execute-command) - (symbol-value - (helm-actions-from-type-function))) + "Call interactively" 'helm-call-interactively) + (helm-actions-from-type-function)) "Default actions for type command." :group 'helm-command - :type '(alist :key-type string :value-type symbol)) + :type '(alist :key-type string :value-type function)) (defmethod helm--setup-source :primary ((_source helm-type-command))) (defmethod helm--setup-source :before ((source helm-type-command)) (setf (slot-value source 'action) 'helm-type-command-actions) (setf (slot-value source 'coerce) 'helm-symbolify) - (setf (slot-value source 'persistent-action) 'helm-M-x-persistent-action) - (setf (slot-value source 'persistent-help) "Describe this command") + (setf (slot-value source 'persistent-action) 'describe-function) (setf (slot-value source 'group) 'helm-command)) ;; Timers diff --git a/elpa/helm-20200128.1831/helm-utils.el b/elpa/helm-20191101.641/helm-utils.el similarity index 98% rename from elpa/helm-20200128.1831/helm-utils.el rename to elpa/helm-20191101.641/helm-utils.el index a7e26bf5..f246dd51 100644 --- a/elpa/helm-20200128.1831/helm-utils.el +++ b/elpa/helm-20191101.641/helm-utils.el @@ -272,24 +272,19 @@ If a prefix arg is given split windows vertically." (funcall initial-ow-fn (car buffers)) (helm-buffers-switch-to-buffer-or-tab (car buffers)))))) -(defvar tab-bar-tab-name-function) -(declare-function tab-bar-switch-to-tab "tab-bar.el") -(declare-function tab-bar-tab-name-all "tab-bar.el") - (defun helm-buffers-switch-to-buffer-or-tab (buffer) "Switch to BUFFER in its tab if some." (if (and (fboundp 'tab-bar-mode) helm-buffers-maybe-switch-to-tab) - (let* ((tab-bar-tab-name-function #'tab-bar-tab-name-all) - (tabs (tab-bar-tabs)) + (let* ((tabs (tab-bar-tabs)) (tab-names (mapcar (lambda (tab) (cdr (assq 'name tab))) - tabs)) + (tab-bar-tabs))) (bname (buffer-name (get-buffer buffer))) (tab (helm-buffers--get-tab-from-name bname tabs))) (if (helm-buffers--buffer-in-tab-p bname tab-names) (progn - (tab-bar-switch-to-tab (alist-get 'name tab)) + (tab-bar-select-tab tab) (select-window (get-buffer-window bname))) (switch-to-buffer buffer))) (switch-to-buffer buffer))) @@ -646,18 +641,14 @@ that is sorting is done against real value of candidate." ((string-match r2 str) 2) ((string-match r3 str) 1) (t 0))))) - (sc1 (get-text-property 0 'completion-score str1)) - (sc2 (get-text-property 0 'completion-score str2)) - (sc3 (if sc1 0 (funcall score str1 reg1 reg2 reg3 split))) - (sc4 (if sc2 0 (funcall score str2 reg1 reg2 reg3 split)))) - (cond ((and sc1 sc2) ; helm-flex style. - (> sc1 sc2)) - ((or (zerop (string-width qpattern)) - (and (zerop sc3) (zerop sc4))) + (sc1 (funcall score str1 reg1 reg2 reg3 split)) + (sc2 (funcall score str2 reg1 reg2 reg3 split))) + (cond ((or (zerop (string-width qpattern)) + (and (zerop sc1) (zerop sc2))) (string-lessp str1 str2)) - ((= sc3 sc4) + ((= sc1 sc2) (< (length str1) (length str2))) - (t (> sc3 sc4))))) + (t (> sc1 sc2))))) (cl-defun helm-file-human-size (size &optional (kbsize helm-default-kbsize)) "Return a string showing SIZE of a file in human readable form. diff --git a/elpa/helm-20200128.1831/helm-x-files.el b/elpa/helm-20191101.641/helm-x-files.el similarity index 100% rename from elpa/helm-20200128.1831/helm-x-files.el rename to elpa/helm-20191101.641/helm-x-files.el diff --git a/elpa/helm-20200128.1831/helm-dabbrev.el b/elpa/helm-20200128.1831/helm-dabbrev.el deleted file mode 100644 index e6e2fb8c..00000000 --- a/elpa/helm-20200128.1831/helm-dabbrev.el +++ /dev/null @@ -1,394 +0,0 @@ -;;; helm-dabbrev.el --- Helm implementation of dabbrev. -*- lexical-binding: t -*- - -;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Code: - -(require 'helm) -(require 'helm-lib) -(require 'helm-help) -(require 'helm-elisp) ; For show-completion. - -(defgroup helm-dabbrev nil - "Dabbrev related Applications and libraries for Helm." - :group 'helm) - -(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 -`helm-dabbrev-max-length-result'." - :group 'helm-dabbrev - :type 'boolean) - -(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." - :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." - :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'. -The function take one arg, the buffer which is current, look at -`helm-dabbrev--same-major-mode-p' for example. - -When nil all buffers are considered related to `current-buffer'." - :group 'helm-dabbrev - :type 'function) - -(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." - :type '(alist :key-type symbol :value-type symbol) - :group 'helm-dabbrev) - -(defcustom helm-dabbrev-lineno-around 30 - "Search first in this number of lines before and after point." - :group 'helm-dabbrev - :type 'integer) - -(defcustom helm-dabbrev-cycle-threshold 5 - "Number of time helm-dabbrev cycle before displaying helm completion. -When nil or 0 disable cycling." - :group 'helm-dabbrev - :type '(choice (const :tag "Cycling disabled" nil) integer)) - -(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)." - :group 'helm-dabbrev - :type '(choice (const :tag "Ignore case" t) - (const :tag "Respect case" nil) - (other :tag "Smart" 'smart))) - -(defvaralias 'helm-dabbrev--regexp 'helm-dabbrev-separator-regexp) -(make-obsolete-variable 'helm-dabbrev--regexp - 'helm-dabbrev-separator-regexp "2.8.3") -;; Check for beginning of line should happen last (^\n\\|^). -(defvar helm-dabbrev-separator-regexp - "\\s-\\|\t\\|[(\\[\\{\"'`=<$;,@.#+]\\|\\s\\\\|^\n\\|^" - "Regexp matching the start of a dabbrev candidate.") - - -(defvar helm-dabbrev-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "M-/") 'helm-next-line) - (define-key map (kbd "M-:") 'helm-previous-line) - map)) - -;; Internal -(defvar helm-dabbrev--cache nil) -(defvar helm-dabbrev--data nil) -(cl-defstruct helm-dabbrev-info dabbrev limits iterator) -(defvar helm-dabbrev--already-tried nil) -(defvar helm-dabbrev--computing-cache nil - "[INTERNAL] Flag to notify helm-dabbrev is blocked. -Do nothing when non nil.") - -(defun helm-dabbrev--buffer-list () - (cl-loop for buf in (buffer-list) - unless (cl-loop for r in helm-dabbrev-ignored-buffers-regexps - thereis (string-match r (buffer-name buf))) - collect buf)) - -(defun helm-dabbrev--same-major-mode-p (start-buffer) - "Decide if current-buffer is related to START-BUFFER." - (helm-same-major-mode-p start-buffer helm-dabbrev-major-mode-assoc)) - -(defun helm-dabbrev--collect (str limit ignore-case all) - (let* ((case-fold-search ignore-case) - (buffer1 (current-buffer)) ; start buffer. - (minibuf (minibufferp buffer1)) - results pos-before pos-after) - (catch 'break - (dolist (buf (if all (helm-dabbrev--buffer-list) - (list (current-buffer)))) - (with-current-buffer buf - (when (or minibuf ; check against all buffers when in minibuffer. - (if helm-dabbrev-related-buffer-fn - (funcall helm-dabbrev-related-buffer-fn buffer1) - t)) - (save-excursion - ;; Start searching before thing before point. - (goto-char (- (point) (length str))) - ;; Search the last 30 lines before point. - (cl-multiple-value-bind (res pa pb) - (helm-dabbrev--search-and-store str -2 limit results) - (setq results res - pos-before pb - pos-after pa))) - (save-excursion - ;; Search the next 30 lines after point. - (cl-multiple-value-bind (res pa pb) - (helm-dabbrev--search-and-store str 2 limit results) - (setq results res - pos-before pb - pos-after pa))) - (save-excursion - ;; Search all before point. - ;; If limit is reached in previous call of - ;; search-and-store pos-before is never set and - ;; goto-char will fail, so check it. - (when pos-before - (goto-char pos-before) - (cl-multiple-value-bind (res pa pb) - (helm-dabbrev--search-and-store str -1 limit results) - (setq results res - pos-before pb - pos-after pa)))) - (save-excursion - ;; Search all after point. - ;; Same comment as above for pos-after. - (when pos-after - (goto-char pos-after) - (cl-multiple-value-bind (res pa pb) - (helm-dabbrev--search-and-store str 1 limit results) - (setq results res - pos-before pb - pos-after pa)))))) - (when (>= (length results) limit) (throw 'break nil)))) - (nreverse results))) - -(defun helm-dabbrev--search-and-store (pattern direction limit results) - "Search words or symbols matching PATTERN in DIRECTION up to LIMIT. -Finally returns all matched candidates appended to RESULTS. -Argument DIRECTION can be: - - (1): Search forward from point. - - (-1): Search backward from point. - - (2): Search forward from the - `helm-dabbrev-lineno-around' - lines after point. - - (2): Search backward from the - `helm-dabbrev-lineno-around' - lines before point." - (let ((res results) - after before) - (while (and (<= (length res) limit) - (cl-case direction - (1 (search-forward pattern nil t)) - (-1 (search-backward pattern nil t)) - (2 (let ((pos - (save-excursion - (forward-line - helm-dabbrev-lineno-around) - (point)))) - (setq after pos) - (search-forward pattern pos t))) - (-2 (let ((pos - (save-excursion - (forward-line - (- helm-dabbrev-lineno-around)) - (point)))) - (setq before pos) - (search-backward pattern pos t))))) - (let* ((mb (match-beginning 0)) - (replace-regexp (concat "\\(" helm-dabbrev-separator-regexp - "\\)\\'")) - (match-word (helm-dabbrev--search - pattern mb replace-regexp))) - (when (and match-word (not (member match-word res))) - (push match-word res)))) - (list res after before))) - -(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. -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." - (let ((eol (point-at-eol))) - (save-excursion - (goto-char (1- beg)) - (when (re-search-forward - (concat "\\(" - helm-dabbrev-separator-regexp - "\\)" - "\\(?99:\\(" - (regexp-quote pattern) - "\\(\\sw\\|\\s_\\)+\\)\\)") - eol t) - (replace-regexp-in-string - sep-regexp "" - (match-string-no-properties 99)))))) - -(defun helm-dabbrev--get-candidates (dabbrev &optional limit) - (cl-assert dabbrev nil "[No Match]") - (helm-dabbrev--collect - dabbrev (or limit helm-dabbrev-candidates-number-limit) - (cl-case helm-dabbrev-case-fold-search - (smart (helm-set-case-fold-search-1 dabbrev)) - (t helm-dabbrev-case-fold-search)) - helm-dabbrev-always-search-all)) - -(defun helm-dabbrev-default-action (candidate) - (with-helm-current-buffer - (let* ((limits (helm-bounds-of-thing-before-point - helm-dabbrev-separator-regexp)) - (beg (car limits)) - (end (point))) - (run-with-timer - 0.01 nil - 'helm-insert-completion-at-point - beg end candidate)))) - -;;;###autoload -(cl-defun helm-dabbrev () - "Preconfigured helm for dynamic abbreviations." - (interactive) - (unless helm-dabbrev--computing-cache - (let ((dabbrev (helm-thing-before-point - nil helm-dabbrev-separator-regexp)) - (limits (helm-bounds-of-thing-before-point - helm-dabbrev-separator-regexp)) - (enable-recursive-minibuffers t) - (cycling-disabled-p (or (null helm-dabbrev-cycle-threshold) - (zerop helm-dabbrev-cycle-threshold))) - (helm-execute-action-at-once-if-one t) - (helm-quit-if-no-candidate - (lambda () - (message "[Helm-dabbrev: No expansion found]")))) - (cl-assert (and (stringp dabbrev) (not (string= dabbrev ""))) - nil "[Helm-dabbrev: Nothing found before point]") - (when (and - ;; have been called at least once. - (helm-dabbrev-info-p helm-dabbrev--data) - ;; But user have moved with some other command - ;; in the meaning time. - (not (eq last-command 'helm-dabbrev))) - (setq helm-dabbrev--data nil)) - ;; When candidates are requested in helm directly without cycling, - ;; we need them right now before running helm. - (when cycling-disabled-p - (message "Waiting for helm-dabbrev candidates...") - (setq helm-dabbrev--cache (helm-dabbrev--get-candidates dabbrev))) - (unless (or cycling-disabled-p - (helm-dabbrev-info-p helm-dabbrev--data)) - (setq helm-dabbrev--data - (make-helm-dabbrev-info - :dabbrev dabbrev - :limits limits - :iterator - (helm-iter-list - (cl-loop for i in (helm-dabbrev--get-candidates - dabbrev helm-dabbrev-cycle-threshold) - when (string-match-p - (concat "^" (regexp-quote dabbrev)) i) - collect i))))) - (let ((iter (and (helm-dabbrev-info-p helm-dabbrev--data) - (helm-dabbrev-info-iterator helm-dabbrev--data))) - deactivate-mark) - ;; Cycle until iterator is consumed. - (helm-aif (and iter (helm-iter-next iter)) - (progn - (helm-insert-completion-at-point - (car (helm-dabbrev-info-limits helm-dabbrev--data)) - ;; END is the end of the previous inserted string, not - ;; the end (apart for first insertion) of the initial string. - (cdr limits) it) - ;; Move already tried candidates to end of list. - (push it helm-dabbrev--already-tried)) - ;; Iterator is now empty, or cycling was disabled, maybe - ;; reset dabbrev to initial value and start helm completion. - (let* ((old-dabbrev (if (helm-dabbrev-info-p helm-dabbrev--data) - (helm-dabbrev-info-dabbrev helm-dabbrev--data) - dabbrev)) - (only-one (eq (length helm-dabbrev--already-tried) 1))) - (unless helm-dabbrev--cache ; Already computed when - ; cycling is disabled. - (message "Waiting for helm-dabbrev candidates...") - (setq helm-dabbrev--computing-cache t) - (setq helm-dabbrev--cache - (helm-dabbrev--get-candidates old-dabbrev)) - ;; If user continues typing M-/ while display is blocked by - ;; helm-dabbrev--get-candidates delete these events. - (setq unread-command-events nil)) - ;; If the length of candidates is only one when computed - ;; that's mean the unique matched item have already been - ;; inserted by the iterator, so no need to reinsert the old dabbrev, - ;; just let helm exiting with "No expansion found". - (unless (or only-one cycling-disabled-p) - (setq dabbrev old-dabbrev - limits (helm-dabbrev-info-limits helm-dabbrev--data)) - (setq helm-dabbrev--data nil) - (delete-region (car limits) (point)) - (insert dabbrev)) - (when (and (null cycling-disabled-p) only-one) - (setq helm-dabbrev--cache nil - helm-dabbrev--already-tried nil - helm-dabbrev--computing-cache nil) - (cl-return-from helm-dabbrev - (message "[Helm-dabbrev: No expansion found]"))) - (with-helm-show-completion (car limits) (cdr limits) - (unwind-protect - (helm :sources - (helm-build-in-buffer-source "Dabbrev Expand" - :data - (append - (cl-loop with lst = helm-dabbrev--cache - for cand in helm-dabbrev--already-tried - do (setq lst (delete cand lst)) - finally return lst) - helm-dabbrev--already-tried) - :persistent-action 'ignore - :persistent-help "DoNothing" - :keymap helm-dabbrev-map - :action 'helm-dabbrev-default-action - :group 'helm-dabbrev) - :buffer "*helm dabbrev*" - :input (concat "^" dabbrev " ") - :resume 'noresume - :allow-nest t) - (setq helm-dabbrev--computing-cache nil - helm-dabbrev--already-tried nil - helm-dabbrev--cache nil))))))))) - -(provide 'helm-dabbrev) - -;; Local Variables: -;; byte-compile-warnings: (not obsolete) -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: - -;;; helm-dabbrev.el ends here diff --git a/elpa/helm-20200128.1831/helm-pkg.el b/elpa/helm-20200128.1831/helm-pkg.el deleted file mode 100644 index 173d4925..00000000 --- a/elpa/helm-20200128.1831/helm-pkg.el +++ /dev/null @@ -1,9 +0,0 @@ -(define-package "helm" "20200128.1831" "Helm is an Emacs incremental and narrowing framework" - '((emacs "24.4") - (async "1.9.4") - (popup "0.5.3") - (helm-core "3.6.0")) - :url "https://emacs-helm.github.io/helm/") -;; Local Variables: -;; no-byte-compile: t -;; End: -- 2.47.3