From d19b318eecdf5f0556dd9a0e4c5cde0712f2a320 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 23 Nov 2023 19:22:17 +0100 Subject: [PATCH] update helm Signed-off-by: Andreas Gerler --- elpa/helm-20220616.1004/helm-config.el | 32 - elpa/helm-20220616.1004/helm-pkg.el | 11 - .../.dir-locals.el | 5 +- .../emacs-helm.sh | 34 +- .../helm-adaptive.el | 29 +- .../helm-autoloads.el | 446 +--- .../helm-bookmark.el | 347 +-- .../helm-buffers.el | 350 +-- .../helm-color.el | 34 +- .../helm-comint.el | 32 +- .../helm-command.el | 53 +- .../helm-dabbrev.el | 22 +- .../helm-easymenu.el | 0 .../helm-elisp-package.el | 83 +- .../helm-elisp.el | 246 +- .../helm-epa.el | 8 +- .../helm-eshell.el | 42 +- .../helm-eval.el | 85 +- .../helm-external.el | 9 +- .../helm-fd.el | 49 +- .../helm-files.el | 2354 +++++++++-------- .../helm-find.el | 6 +- .../helm-font.el | 2 +- .../helm-for-files.el | 6 +- .../helm-global-bindings.el | 31 +- .../helm-grep.el | 464 ++-- .../helm-help.el | 155 +- .../helm-id-utils.el | 2 +- .../helm-imenu.el | 30 +- .../helm-info.el | 61 +- .../helm-locate.el | 28 +- .../helm-man.el | 2 +- .../helm-misc.el | 6 +- .../helm-mode.el | 422 ++- .../helm-net.el | 2 +- .../helm-occur.el | 315 ++- elpa/helm-20230806.1956/helm-pkg.el | 14 + .../helm-regexp.el | 2 +- .../helm-ring.el | 86 +- .../helm-semantic.el | 9 +- .../helm-shell.el | 0 .../helm-sys.el | 35 +- .../helm-tags.el | 61 +- .../helm-types.el | 5 +- .../helm-utils.el | 213 +- .../helm-x-files.el | 2 +- .../helm.el | 19 +- .../bibtex-completion.el | 1507 ----------- .../helm-bibtex-pkg.el | 15 - .../helm-bibtex-autoloads.el | 30 +- .../helm-bibtex-pkg.el | 15 + .../helm-bibtex.el | 66 +- .../helm-c-yasnippet-pkg.el | 2 - .../helm-c-yasnippet-autoloads.el | 16 +- .../helm-c-yasnippet-pkg.el | 15 + .../helm-c-yasnippet.el | 26 +- elpa/helm-core-20220607.1243/helm-core-pkg.el | 11 - .../helm-core-autoloads.el | 79 +- elpa/helm-core-20230806.1956/helm-core-pkg.el | 13 + .../helm-core.el | 1501 ++++++----- .../helm-lib.el | 515 ++-- .../helm-multi-match.el | 20 +- .../helm-source.el | 52 +- .../helm-gtags-20170116.529/helm-gtags-pkg.el | 2 - .../helm-gtags-autoloads.el | 97 +- .../helm-gtags-pkg.el | 13 + .../helm-gtags.el | 392 ++- elpa/helm-org-20200311.633/helm-org-pkg.el | 2 - .../helm-org-autoloads.el | 8 +- elpa/helm-org-20210324.1927/helm-org-pkg.el | 13 + .../helm-org.el | 10 +- .../helm-projectile-pkg.el | 2 - .../helm-projectile-autoloads.el | 13 +- .../helm-projectile-pkg.el | 16 + .../helm-projectile.el | 52 +- .../helm-swoop-20200814.448/helm-swoop-pkg.el | 2 - .../helm-swoop-autoloads.el | 8 +- .../helm-swoop-20210426.547/helm-swoop-pkg.el | 15 + .../helm-swoop.el | 4 +- 79 files changed, 5226 insertions(+), 5555 deletions(-) delete mode 100644 elpa/helm-20220616.1004/helm-config.el delete mode 100644 elpa/helm-20220616.1004/helm-pkg.el rename elpa/{helm-20220616.1004 => helm-20230806.1956}/.dir-locals.el (67%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/emacs-helm.sh (89%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-adaptive.el (93%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-autoloads.el (77%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-bookmark.el (74%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-buffers.el (82%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-color.el (81%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-comint.el (90%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-command.el (93%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-dabbrev.el (97%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-easymenu.el (100%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-elisp-package.el (90%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-elisp.el (83%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-epa.el (97%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-eshell.el (94%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-eval.el (73%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-external.el (96%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-fd.el (71%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-files.el (84%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-find.el (97%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-font.el (99%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-for-files.el (98%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-global-bindings.el (81%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-grep.el (94%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-help.el (94%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-id-utils.el (98%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-imenu.el (97%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-info.el (86%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-locate.el (97%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-man.el (98%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-misc.el (98%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-mode.el (84%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-net.el (99%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-occur.el (76%) create mode 100644 elpa/helm-20230806.1956/helm-pkg.el rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-regexp.el (98%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-ring.el (90%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-semantic.el (97%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-shell.el (100%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-sys.el (93%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-tags.el (89%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-types.el (98%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-utils.el (87%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm-x-files.el (99%) rename elpa/{helm-20220616.1004 => helm-20230806.1956}/helm.el (64%) delete mode 100644 elpa/helm-bibtex-20191028.1313/bibtex-completion.el delete mode 100644 elpa/helm-bibtex-20191028.1313/helm-bibtex-pkg.el rename elpa/{helm-bibtex-20191028.1313 => helm-bibtex-20221114.1204}/helm-bibtex-autoloads.el (59%) create mode 100644 elpa/helm-bibtex-20221114.1204/helm-bibtex-pkg.el rename elpa/{helm-bibtex-20191028.1313 => helm-bibtex-20221114.1204}/helm-bibtex.el (82%) delete mode 100644 elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-pkg.el rename elpa/{helm-c-yasnippet-20170128.1542 => helm-c-yasnippet-20210330.16}/helm-c-yasnippet-autoloads.el (73%) create mode 100644 elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-pkg.el rename elpa/{helm-c-yasnippet-20170128.1542 => helm-c-yasnippet-20210330.16}/helm-c-yasnippet.el (93%) delete mode 100644 elpa/helm-core-20220607.1243/helm-core-pkg.el rename elpa/{helm-core-20220607.1243 => helm-core-20230806.1956}/helm-core-autoloads.el (80%) create mode 100644 elpa/helm-core-20230806.1956/helm-core-pkg.el rename elpa/{helm-core-20220607.1243 => helm-core-20230806.1956}/helm-core.el (89%) rename elpa/{helm-core-20220607.1243 => helm-core-20230806.1956}/helm-lib.el (85%) rename elpa/{helm-core-20220607.1243 => helm-core-20230806.1956}/helm-multi-match.el (96%) rename elpa/{helm-core-20220607.1243 => helm-core-20230806.1956}/helm-source.el (95%) delete mode 100644 elpa/helm-gtags-20170116.529/helm-gtags-pkg.el rename elpa/{helm-gtags-20170116.529 => helm-gtags-20200602.1610}/helm-gtags-autoloads.el (63%) create mode 100644 elpa/helm-gtags-20200602.1610/helm-gtags-pkg.el rename elpa/{helm-gtags-20170116.529 => helm-gtags-20200602.1610}/helm-gtags.el (82%) delete mode 100644 elpa/helm-org-20200311.633/helm-org-pkg.el rename elpa/{helm-org-20200311.633 => helm-org-20210324.1927}/helm-org-autoloads.el (88%) create mode 100644 elpa/helm-org-20210324.1927/helm-org-pkg.el rename elpa/{helm-org-20200311.633 => helm-org-20210324.1927}/helm-org.el (98%) delete mode 100644 elpa/helm-projectile-20201217.908/helm-projectile-pkg.el rename elpa/{helm-projectile-20201217.908 => helm-projectile-20221215.613}/helm-projectile-autoloads.el (88%) create mode 100644 elpa/helm-projectile-20221215.613/helm-projectile-pkg.el rename elpa/{helm-projectile-20201217.908 => helm-projectile-20221215.613}/helm-projectile.el (96%) delete mode 100644 elpa/helm-swoop-20200814.448/helm-swoop-pkg.el rename elpa/{helm-swoop-20200814.448 => helm-swoop-20210426.547}/helm-swoop-autoloads.el (93%) create mode 100644 elpa/helm-swoop-20210426.547/helm-swoop-pkg.el rename elpa/{helm-swoop-20200814.448 => helm-swoop-20210426.547}/helm-swoop.el (99%) diff --git a/elpa/helm-20220616.1004/helm-config.el b/elpa/helm-20220616.1004/helm-config.el deleted file mode 100644 index 9a83a30b..00000000 --- a/elpa/helm-20220616.1004/helm-config.el +++ /dev/null @@ -1,32 +0,0 @@ -;;; helm-config.el --- Applications library for `helm.el' -*- lexical-binding: t -*- - -;; Copyright (C) 2012 ~ 2021 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 . - -;;; Commentary: -;; -;; Requiring this file is not needed when using a package manager to -;; install helm as this one will take care of creating and loading the -;; autoload file. - -;;; Code: - -;;; Load the autoload file generated by the make file. - -(load "helm-autoloads" nil t) - -(provide 'helm-config) - -;;; helm-config.el ends here diff --git a/elpa/helm-20220616.1004/helm-pkg.el b/elpa/helm-20220616.1004/helm-pkg.el deleted file mode 100644 index 30e2092b..00000000 --- a/elpa/helm-20220616.1004/helm-pkg.el +++ /dev/null @@ -1,11 +0,0 @@ -(define-package "helm" "20220616.1004" "Helm is an Emacs incremental and narrowing framework" - '((helm-core "3.8.4") - (popup "0.5.3")) - :commit "a6df31a7cff0c64b8b999a85cbf5b4cc253a104f" :authors - '(("Thierry Volpiatto ")) - :maintainer - '("Thierry Volpiatto ") - :url "https://emacs-helm.github.io/helm/") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/helm-20220616.1004/.dir-locals.el b/elpa/helm-20230806.1956/.dir-locals.el similarity index 67% rename from elpa/helm-20220616.1004/.dir-locals.el rename to elpa/helm-20230806.1956/.dir-locals.el index 5ed84320..ded5c004 100644 --- a/elpa/helm-20220616.1004/.dir-locals.el +++ b/elpa/helm-20230806.1956/.dir-locals.el @@ -3,6 +3,7 @@ ((nil . ((bug-reference-bug-regexp . "\\(\\b\\(?:[Ii]ssue ?#?\\|[Bb]ug ?#?\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z+-]+/\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)\\)") (bug-reference-url-format . "https://github.com/emacs-helm/helm/issues/%s") - (byte-compile-warnings . (not obsolete not docstrings)))) + (byte-compile-warnings . (not obsolete docstrings docstrings-non-ascii-quotes)))) (emacs-lisp-mode . ((mode . bug-reference-prog) - (indent-tabs-mode . nil)))) + (indent-tabs-mode . nil) + (fill-column . 80)))) diff --git a/elpa/helm-20220616.1004/emacs-helm.sh b/elpa/helm-20230806.1956/emacs-helm.sh similarity index 89% rename from elpa/helm-20220616.1004/emacs-helm.sh rename to elpa/helm-20230806.1956/emacs-helm.sh index c3020ea8..de65e44a 100755 --- a/elpa/helm-20220616.1004/emacs-helm.sh +++ b/elpa/helm-20230806.1956/emacs-helm.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh -## Copyright (C) 2012 ~ 2021 Thierry Volpiatto +## Copyright (C) 2012 ~ 2023 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 @@ -25,6 +25,7 @@ test -z "$TEMP" && TEMP="/tmp" CONF_FILE="$TEMP/helm-cfg.el" EMACS=emacs +QUICK=-Q TOOLBARS=-1 LOAD_PACKAGES= @@ -126,6 +127,9 @@ for a in "$@"; do LOAD_PACKAGES="$1" shift 1 ;; + -Q | -q) + QUICK="$a" + ;; -h) usage exit 1 @@ -139,8 +143,8 @@ cd "${0%/*}" || exit 1 # Check if autoload file exists. # It may be in a different directory if emacs-helm.sh is a symlink. -TRUENAME=$(ls -l "$0" | awk '{print $11}') -if [ ! -z "$TRUENAME" ]; then +TRUENAME=$(find "${0%/*}" -path "$0" -printf "%l") +if [ -n "$TRUENAME" ]; then AUTO_FILE="${TRUENAME%/*}/helm-autoloads.el" else AUTO_FILE="helm-autoloads.el" @@ -177,15 +181,22 @@ cat > $CONF_FILE < $CONF_FILE < $CONF_FILE < $TOOLBARS 0) (setq default-frame-alist '((vertical-scroll-bars . nil) @@ -232,7 +246,7 @@ cat > $CONF_FILE < $CONF_FILE < (length (cdr selection-info)) helm-adaptive-history-length) (setcdr selection-info - (cl-subseq (cdr selection-info) 0 helm-adaptive-history-length)))))))) + (helm-take (cdr selection-info) helm-adaptive-history-length)))))))) (defun helm-adaptive-maybe-load-history () "Load `helm-adaptive-history-file' which contain `helm-adaptive-history'. diff --git a/elpa/helm-20220616.1004/helm-autoloads.el b/elpa/helm-20230806.1956/helm-autoloads.el similarity index 77% rename from elpa/helm-20220616.1004/helm-autoloads.el rename to elpa/helm-20230806.1956/helm-autoloads.el index 4ddafa20..a098c604 100644 --- a/elpa/helm-20220616.1004/helm-autoloads.el +++ b/elpa/helm-20230806.1956/helm-autoloads.el @@ -1,12 +1,14 @@ -;;; helm-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; helm-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "helm-adaptive" "helm-adaptive.el" (0 0 0 0)) ;;; Generated autoloads from helm-adaptive.el (defvar helm-adaptive-mode nil "\ @@ -16,13 +18,11 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-adaptive-mode'.") - (custom-autoload 'helm-adaptive-mode "helm-adaptive" nil) - (autoload 'helm-adaptive-mode "helm-adaptive" "\ Toggle adaptive sorting in all sources. -This is a minor mode. If called interactively, toggle the +This is a global minor mode. If called interactively, toggle the `Helm-Adaptive mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. @@ -36,72 +36,52 @@ evaluate `(default-value \\='helm-adaptive-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) (autoload 'helm-reset-adaptive-history "helm-adaptive" "\ Delete all `helm-adaptive-history' and his file. Useful when you have a old or corrupted -`helm-adaptive-history-file'." t nil) - +`helm-adaptive-history-file'." t) (register-definition-prefixes "helm-adaptive" '("helm-adapt")) -;;;*** -;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (0 0 0 0)) ;;; Generated autoloads from helm-bookmark.el (autoload 'helm-bookmarks "helm-bookmark" "\ -Preconfigured `helm' for bookmarks." t nil) - +Preconfigured `helm' for bookmarks." t) (autoload 'helm-filtered-bookmarks "helm-bookmark" "\ Preconfigured `helm' for bookmarks (filtered by category). Optional source `helm-source-bookmark-addressbook' is loaded only -if external addressbook-bookmark package is installed." t nil) - +if external addressbook-bookmark package is installed." t) (register-definition-prefixes "helm-bookmark" '("bmkext-jump-" "bookmark" "helm-")) -;;;*** -;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (0 0 0 0)) ;;; Generated autoloads from helm-buffers.el (autoload 'helm-buffers-list "helm-buffers" "\ -Preconfigured `helm' to list buffers." t nil) - +Preconfigured `helm' to list buffers." t) (autoload 'helm-mini "helm-buffers" "\ -Preconfigured `helm' displaying `helm-mini-default-sources'." t nil) - +Preconfigured `helm' displaying `helm-mini-default-sources'." t) (register-definition-prefixes "helm-buffers" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-color" "helm-color.el" (0 0 0 0)) ;;; Generated autoloads from helm-color.el (autoload 'helm-colors "helm-color" "\ -Preconfigured `helm' for color." t nil) - +Preconfigured `helm' for color." t) (register-definition-prefixes "helm-color" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-comint" "helm-comint.el" (0 0 0 0)) ;;; Generated autoloads from helm-comint.el (autoload 'helm-comint-prompts "helm-comint" "\ -Pre-configured `helm' to browse the prompts of the current comint buffer." t nil) - +Pre-configured `helm' to browse the prompts of the current comint buffer." t) (autoload 'helm-comint-prompts-all "helm-comint" "\ -Pre-configured `helm' to browse the prompts of all comint sessions." t nil) - +Pre-configured `helm' to browse the prompts of all comint sessions." t) (autoload 'helm-comint-input-ring "helm-comint" "\ -Preconfigured `helm' that provide completion of `comint' history." t nil) - +Preconfigured `helm' that provide completion of `comint' history." t) (register-definition-prefixes "helm-comint" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-command" "helm-command.el" (0 0 0 0)) ;;; Generated autoloads from helm-command.el (autoload 'helm-M-x "helm-command" "\ @@ -117,72 +97,60 @@ disable it. You can get help on each command by persistent action. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-command" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (0 0 0 0)) ;;; Generated autoloads from helm-dabbrev.el (autoload 'helm-dabbrev "helm-dabbrev" "\ -Preconfigured helm for dynamic abbreviations." t nil) - +Preconfigured helm for dynamic abbreviations." t) (register-definition-prefixes "helm-dabbrev" '("helm-dabbrev-")) -;;;*** -;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (0 0 0 0)) ;;; Generated autoloads from helm-elisp.el (autoload 'helm-lisp-completion-at-point "helm-elisp" "\ -Preconfigured Helm for Lisp symbol completion at point." t nil) - +Preconfigured Helm for Lisp symbol completion at point." t) +(autoload 'helm-get-first-line-documentation "helm-elisp" "\ +Return first line documentation of symbol SYM truncated at END-COLUMN. +If SYM is not documented, return \"Not documented\". +Argument NAME allows specifiying what function to use to display +documentation when SYM name is the same for function and variable. + +(fn SYM &optional (NAME \"describe-function\") (END-COLUMN 72))") (autoload 'helm-complete-file-name-at-point "helm-elisp" "\ Preconfigured Helm to complete file name at point. -\(fn &optional FORCE)" t nil) - -(autoload 'helm-lisp-indent "helm-elisp" nil t nil) - +(fn &optional FORCE)" t) +(autoload 'helm-lisp-indent "helm-elisp" nil t) (autoload 'helm-lisp-completion-or-file-name-at-point "helm-elisp" "\ Preconfigured Helm to complete Lisp symbol or filename at point. Filename completion happens if string start after or between a -double quote." t nil) - +double quote." t) (autoload 'helm-apropos "helm-elisp" "\ Preconfigured Helm to describe commands, functions, variables and faces. In non interactives calls DEFAULT argument should be provided as a string, i.e. the `symbol-name' of any existing symbol. -\(fn DEFAULT)" t nil) - +(fn DEFAULT)" t) (autoload 'helm-manage-advice "helm-elisp" "\ -Preconfigured `helm' to disable/enable function advices." t nil) - +Preconfigured `helm' to disable/enable function advices." t) (autoload 'helm-locate-library "helm-elisp" "\ -Preconfigured helm to locate elisp libraries." t nil) - +Preconfigured helm to locate elisp libraries." t) (autoload 'helm-timers "helm-elisp" "\ -Preconfigured `helm' for timers." t nil) - +Preconfigured `helm' for timers." t) (autoload 'helm-complex-command-history "helm-elisp" "\ -Preconfigured `helm' for complex command history." t nil) - +Preconfigured `helm' for complex command history." t) (register-definition-prefixes "helm-elisp" '("helm-" "with-helm-show-completion")) -;;;*** -;;;### (autoloads nil "helm-elisp-package" "helm-elisp-package.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from helm-elisp-package.el (autoload 'helm-list-elisp-packages "helm-elisp-package" "\ Preconfigured `helm' for listing and handling Emacs packages. -\(fn ARG)" t nil) - +(fn ARG)" t) (autoload 'helm-list-elisp-packages-no-fetch "helm-elisp-package" "\ Preconfigured Helm for Emacs packages. @@ -190,13 +158,10 @@ Same as `helm-list-elisp-packages' but don't fetch packages on remote. Called with a prefix ARG always fetch packages on remote. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-elisp-package" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-epa" "helm-epa.el" (0 0 0 0)) ;;; Generated autoloads from helm-epa.el (defvar helm-epa-mode nil "\ @@ -206,13 +171,11 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-epa-mode'.") - (custom-autoload 'helm-epa-mode "helm-epa" nil) - (autoload 'helm-epa-mode "helm-epa" "\ Enable helm completion on gpg keys in epa functions. -This is a minor mode. If called interactively, toggle the +This is a global minor mode. If called interactively, toggle the `Helm-Epa mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. @@ -226,74 +189,54 @@ evaluate `(default-value \\='helm-epa-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) (autoload 'helm-epa-list-keys "helm-epa" "\ List all gpg keys. -This is the helm interface for `epa-list-keys'." t nil) - +This is the helm interface for `epa-list-keys'." t) (register-definition-prefixes "helm-epa" '("helm-epa")) -;;;*** -;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (0 0 0 0)) ;;; Generated autoloads from helm-eshell.el (autoload 'helm-esh-pcomplete "helm-eshell" "\ -Preconfigured `helm' to provide Helm completion in Eshell." t nil) - +Preconfigured `helm' to provide Helm completion in Eshell." t) (autoload 'helm-eshell-history "helm-eshell" "\ -Preconfigured Helm for Eshell history." t nil) - +Preconfigured Helm for Eshell history." t) (autoload 'helm-eshell-prompts "helm-eshell" "\ -Pre-configured `helm' to browse the prompts of the current Eshell." t nil) - +Pre-configured `helm' to browse the prompts of the current Eshell." t) (autoload 'helm-eshell-prompts-all "helm-eshell" "\ -Pre-configured `helm' to browse the prompts of all Eshell sessions." t nil) - +Pre-configured `helm' to browse the prompts of all Eshell sessions." t) (register-definition-prefixes "helm-eshell" '("helm-e")) -;;;*** -;;;### (autoloads nil "helm-eval" "helm-eval.el" (0 0 0 0)) ;;; Generated autoloads from helm-eval.el (autoload 'helm-eval-expression "helm-eval" "\ Preconfigured `helm' for `helm-source-evaluation-result'. -\(fn ARG)" t nil) - +(fn ARG)" t) (autoload 'helm-eval-expression-with-eldoc "helm-eval" "\ -Preconfigured `helm' for `helm-source-evaluation-result' with `eldoc' support." t nil) - +Preconfigured `helm' for `helm-source-evaluation-result' with `eldoc' support." t) (autoload 'helm-calcul-expression "helm-eval" "\ -Preconfigured `helm' for `helm-source-calculation-result'." t nil) - +Preconfigured `helm' for `helm-source-calculation-result'." t) (register-definition-prefixes "helm-eval" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-external" "helm-external.el" (0 0 0 0)) ;;; Generated autoloads from helm-external.el (autoload 'helm-run-external-command "helm-external" "\ Preconfigured `helm' to run External PROGRAM asyncronously from Emacs. If program is already running try to run `helm-raise-command' if defined otherwise exit with error. You can set your own list of -commands with `helm-external-commands-list'." t nil) - +commands with `helm-external-commands-list'." t) (register-definition-prefixes "helm-external" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-fd" "helm-fd.el" (0 0 0 0)) ;;; Generated autoloads from helm-fd.el (register-definition-prefixes "helm-fd" '("helm-fd-")) -;;;*** -;;;### (autoloads nil "helm-files" "helm-files.el" (0 0 0 0)) ;;; Generated autoloads from helm-files.el (defvar helm-ff-icon-mode nil "\ @@ -303,13 +246,11 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-ff-icon-mode'.") - (custom-autoload 'helm-ff-icon-mode "helm-files" nil) - (autoload 'helm-ff-icon-mode "helm-files" "\ Display icons from `all-the-icons' package in HFF when enabled. -This is a minor mode. If called interactively, toggle the +This is a global minor mode. If called interactively, toggle the `Helm-Ff-Icon mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. @@ -323,22 +264,20 @@ evaluate `(default-value \\='helm-ff-icon-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -NOTE: This mode is building `helm-source-find-files', so if you enable -it from your init file, ensure to call it _after_ your defmethod's -`helm-setup-user-source' definitions (if some) to ensure they are called. - -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) +(autoload 'helm-ff-clear-image-dired-thumbnails-cache "helm-files" "\ +Clear `helm-ff-image-dired-thumbnails-cache'. +You may want to do this after customizing +`image-dired-thumbnail-storage' which may change the place where +thumbnail files are stored." t) (autoload 'helm-ff-cleanup-image-dired-dir-and-cache "helm-files" "\ Cleanup `image-dired-dir' directory. Delete all thumb files that are no more associated with an existing -image file in `helm-ff-image-dired-thumbnails-cache'." t nil) - +image file in `helm-ff-image-dired-thumbnails-cache'." t) (autoload 'helm-projects-history "helm-files" "\ -\(fn ARG)" t nil) - +(fn ARG)" t) (autoload 'helm-browse-project "helm-files" "\ Preconfigured helm to browse projects. Browse files and see status of project with its VCS. @@ -357,8 +296,7 @@ Needed dependencies for VCS: and . -\(fn ARG)" t nil) - +(fn ARG)" t) (autoload 'helm-find-files "helm-files" "\ Preconfigured `helm' for helm implementation of `find-file'. Called with a prefix arg show history if some. @@ -366,22 +304,10 @@ Don't call it from programs, use `helm-find-files-1' instead. This is the starting point for nearly all actions you can do on files. -\(fn ARG)" t nil) - -(autoload 'helm-delete-tramp-connection "helm-files" "\ -Allow deleting tramp connection or marked tramp connections at once. - -This replace `tramp-cleanup-connection' which is partially broken -in Emacs < to 25.1.50.1 (See Emacs bug http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24432). - -It allows additionally to delete more than one connection at -once." t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-files" '("eshell-command-aliases-list" "helm-")) -;;;*** -;;;### (autoloads nil "helm-find" "helm-find.el" (0 0 0 0)) ;;; Generated autoloads from helm-find.el (autoload 'helm-find "helm-find" "\ @@ -402,114 +328,85 @@ The (possibly empty) list of globbing PATTERNs can be followed by the separator \"*\" plus any number of additional arguments that are passed to \"find\" literally. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-find" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-font" "helm-font.el" (0 0 0 0)) ;;; Generated autoloads from helm-font.el (autoload 'helm-select-xfont "helm-font" "\ -Preconfigured `helm' to select Xfont." t nil) - +Preconfigured `helm' to select Xfont." t) (autoload 'helm-ucs "helm-font" "\ Preconfigured `helm' for `ucs-names'. Called with a prefix arg force reloading cache. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-font" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-for-files" "helm-for-files.el" (0 0 0 -;;;;;; 0)) ;;; Generated autoloads from helm-for-files.el (autoload 'helm-for-files "helm-for-files" "\ Preconfigured `helm' for opening files. -Run all sources defined in `helm-for-files-preferred-list'." t nil) - +Run all sources defined in `helm-for-files-preferred-list'." t) (autoload 'helm-multi-files "helm-for-files" "\ Preconfigured helm like `helm-for-files' but running locate only on demand. Allow toggling back and forth from locate to others sources with `helm-multi-files-toggle-locate-binding' key. This avoids launching locate needlessly when what you are -searching for is already found." t nil) - +searching for is already found." t) (autoload 'helm-recentf "helm-for-files" "\ -Preconfigured `helm' for `recentf'." t nil) - +Preconfigured `helm' for `recentf'." t) (register-definition-prefixes "helm-for-files" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-global-bindings" "helm-global-bindings.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from helm-global-bindings.el (register-definition-prefixes "helm-global-bindings" '("helm-command-")) -;;;*** -;;;### (autoloads nil "helm-grep" "helm-grep.el" (0 0 0 0)) ;;; Generated autoloads from helm-grep.el (autoload 'helm-goto-precedent-file "helm-grep" "\ -Go to previous file in Helm grep/etags buffers." t nil) - +Go to previous file in Helm grep/etags buffers." t) (autoload 'helm-goto-next-file "helm-grep" "\ -Go to previous file in Helm grep/etags buffers." t nil) - +Go to previous file in Helm grep/etags buffers." t) (autoload 'helm-revert-next-error-last-buffer "helm-grep" "\ Revert last `next-error' buffer from `current-buffer'. Accept to revert only `helm-grep-mode' or `helm-occur-mode' buffers. Use this when you want to revert the `next-error' buffer after -modifications in `current-buffer'." t nil) - +modifications in `current-buffer'." t) (autoload 'helm-do-grep-ag "helm-grep" "\ Preconfigured `helm' for grepping with AG in `default-directory'. With prefix arg prompt for type if available with your AG version. -\(fn ARG)" t nil) - +(fn ARG)" t) (autoload 'helm-grep-do-git-grep "helm-grep" "\ Preconfigured `helm' for git-grepping `default-directory'. With a prefix arg ARG git-grep the whole repository. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-grep" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-help" "helm-help.el" (0 0 0 0)) ;;; Generated autoloads from helm-help.el (autoload 'helm-documentation "helm-help" "\ Preconfigured `helm' for Helm documentation. With a prefix arg refresh the documentation. -Find here the documentation of all documented sources." t nil) - +Find here the documentation of all documented sources." t) (defvar helm-comp-read-mode-line "\\C/\\[helm-cr-empty-string]:Empty \\\\[helm-help]:Help \\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend \\[helm-customize-group]:Conf") - (defvar helm-read-file-name-mode-line-string "\\\\[helm-help]:Help C/\\[helm-cr-empty-string]:Empty \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend \\[helm-customize-group]:Conf" "\ String displayed in mode-line in `helm-source-find-files'.") - (defvar helm-top-mode-line "\\\\[helm-help]:Help \\\\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend \\[helm-customize-group]:Conf") - (register-definition-prefixes "helm-help" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-id-utils" "helm-id-utils.el" (0 0 0 0)) ;;; Generated autoloads from helm-id-utils.el (autoload 'helm-gid "helm-id-utils" "\ @@ -517,29 +414,22 @@ Preconfigured `helm' for `gid' command line of `ID-Utils'. Need A database created with the command `mkid' above `default-directory'. Need id-utils as dependency which provide `mkid', `gid' etc.. -See ." t nil) - +See ." t) (register-definition-prefixes "helm-id-utils" '("helm-gid-")) -;;;*** -;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (0 0 0 0)) ;;; Generated autoloads from helm-imenu.el (autoload 'helm-imenu "helm-imenu" "\ -Preconfigured `helm' for `imenu'." t nil) - +Preconfigured `helm' for `imenu'." t) (autoload 'helm-imenu-in-all-buffers "helm-imenu" "\ Fetch Imenu entries in all buffers with similar mode as current. A mode is similar as current if it is the same, it is derived i.e. `derived-mode-p' or it have an association in -`helm-imenu-all-buffer-assoc'." t nil) - +`helm-imenu-all-buffer-assoc'." t) (register-definition-prefixes "helm-imenu" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-info" "helm-info.el" (0 0 0 0)) ;;; Generated autoloads from helm-info.el (autoload 'helm-info "helm-info" "\ @@ -557,24 +447,19 @@ REFRESH is useful when new Info files are installed. If `helm-default-info-index-list' has not been customized, the new Info files are made available. -\(fn &optional REFRESH)" t nil) - +(fn &optional REFRESH)" t) (autoload 'helm-info-at-point "helm-info" "\ -Preconfigured `helm' for searching info at point." t nil) - +Preconfigured `helm' for searching info at point." t) (register-definition-prefixes "helm-info" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-locate" "helm-locate.el" (0 0 0 0)) ;;; Generated autoloads from helm-locate.el (autoload 'helm-projects-find-files "helm-locate" "\ Find files with locate in `helm-locate-project-list'. With a prefix arg refresh the database in each project. -\(fn UPDATE)" t nil) - +(fn UPDATE)" t) (autoload 'helm-locate "helm-locate" "\ Preconfigured `helm' for Locate. Note: you can add locate options after entering pattern. @@ -589,26 +474,20 @@ To create a user specific db, use Where db_path is a filename matched by `helm-locate-db-file-regexp'. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-locate" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-man" "helm-man.el" (0 0 0 0)) ;;; Generated autoloads from helm-man.el (autoload 'helm-man-woman "helm-man" "\ Preconfigured `helm' for Man and Woman pages. With a prefix arg reinitialize the cache. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-man" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-misc" "helm-misc.el" (0 0 0 0)) ;;; Generated autoloads from helm-misc.el (defvar helm-minibuffer-history-mode nil "\ @@ -618,14 +497,13 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-minibuffer-history-mode'.") - (custom-autoload 'helm-minibuffer-history-mode "helm-misc" nil) - (autoload 'helm-minibuffer-history-mode "helm-misc" "\ Bind `helm-minibuffer-history-key' in al minibuffer maps. + This mode is enabled by `helm-mode', so there is no need to enable it directly. -This is a minor mode. If called interactively, toggle the +This is a global minor mode. If called interactively, toggle the `Helm-Minibuffer-History mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. @@ -640,29 +518,21 @@ evaluate `(default-value \\='helm-minibuffer-history-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) (autoload 'helm-world-time "helm-misc" "\ Preconfigured `helm' to show world time. -Default action change TZ environment variable locally to emacs." t nil) - +Default action change TZ environment variable locally to emacs." t) (autoload 'helm-insert-latex-math "helm-misc" "\ -Preconfigured helm for latex math symbols completion." t nil) - +Preconfigured helm for latex math symbols completion." t) (autoload 'helm-ratpoison-commands "helm-misc" "\ -Preconfigured `helm' to execute ratpoison commands." t nil) - +Preconfigured `helm' to execute ratpoison commands." t) (autoload 'helm-stumpwm-commands "helm-misc" "\ -Preconfigured helm for stumpwm commands." t nil) - +Preconfigured helm for stumpwm commands." t) (autoload 'helm-minibuffer-history "helm-misc" "\ -Preconfigured `helm' for `minibuffer-history'." t nil) - +Preconfigured `helm' for `minibuffer-history'." t) (register-definition-prefixes "helm-misc" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-mode" "helm-mode.el" (0 0 0 0)) ;;; Generated autoloads from helm-mode.el (autoload 'helm-comp-read "helm-mode" "\ @@ -771,6 +641,9 @@ Keys description: `helm-source-in-buffer' which is much faster. Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil. +- GET-LINE: Specify the :get-line slot of `helm-source-in-buffer', has no effect + when CANDIDATES-IN-BUFFER is nil. + - MATCH-PART: Allow matching only one part of candidate. See match-part documentation in `helm-source'. @@ -792,8 +665,7 @@ in `helm-current-prefix-arg', otherwise if prefix args were given before That means 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 nil SHISTORY) RAW-HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (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 DIACRITICS MATCH-PART MATCH-DYNAMIC EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (VOLATILE t) SORT FC-TRANSFORMER HIST-FC-TRANSFORMER (MARKED-CANDIDATES helm-comp-read-use-marked) 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 nil SHISTORY) RAW-HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (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 GET-LINE DIACRITICS MATCH-PART MATCH-DYNAMIC EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (VOLATILE t) SORT FC-TRANSFORMER HIST-FC-TRANSFORMER (MARKED-CANDIDATES helm-comp-read-use-marked) NOMARK (ALISTP t) (CANDIDATE-NUMBER-LIMIT helm-candidate-number-limit) MULTILINE ALLOW-NEST COERCE (GROUP \\='helm))") (autoload 'helm-read-file-name "helm-mode" "\ Read a file name with helm completion. @@ -839,8 +711,7 @@ Keys description: - MODE-LINE: A mode line message, default is `helm-read-file-name-mode-line-string'. -\(fn PROMPT &key (NAME \"Read File Name\") INITIAL-INPUT (BUFFER \"*Helm file completions*\") TEST NORET (CASE-FOLD helm-file-name-case-fold-search) PRESELECT HISTORY MUST-MATCH (FUZZY t) DEFAULT MARKED-CANDIDATES (CANDIDATE-NUMBER-LIMIT helm-ff-candidate-number-limit) NOMARK (ALISTP t) (PERSISTENT-ACTION-IF \\='helm-find-files-persistent-action-if) (PERSISTENT-HELP \"Hit1 Expand Candidate, Hit2 or (C-u) Find file\") (MODE-LINE helm-read-file-name-mode-line-string))" nil nil) - +(fn PROMPT &key (NAME \"Read File Name\") INITIAL-INPUT (BUFFER \"*Helm file completions*\") TEST NORET (CASE-FOLD helm-file-name-case-fold-search) PRESELECT HISTORY MUST-MATCH (FUZZY t) DEFAULT MARKED-CANDIDATES (CANDIDATE-NUMBER-LIMIT helm-ff-candidate-number-limit) NOMARK (ALISTP t) (PERSISTENT-ACTION-IF \\='helm-find-files-persistent-action-if) (PERSISTENT-HELP \"Hit1 Expand Candidate, Hit2 or (C-u) Find file\") (MODE-LINE helm-read-file-name-mode-line-string))") (defvar helm-mode nil "\ Non-nil if Helm mode is enabled. See the `helm-mode' command @@ -848,9 +719,7 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-mode'.") - (custom-autoload 'helm-mode "helm-mode" nil) - (autoload 'helm-mode "helm-mode" "\ Toggle generic helm completion. @@ -872,13 +741,10 @@ using `ido-mode', add the commands where you want to use ido to Note: This mode is incompatible with Emacs23. -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) (register-definition-prefixes "helm-mode" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-net" "helm-net.el" (0 0 0 0)) ;;; Generated autoloads from helm-net.el (autoload 'helm-browse-url-firefox "helm-net" "\ @@ -889,8 +755,7 @@ not be prompted to kill the Firefox process. NOTE: Probably not supported on some systems (e.g., Windows). -\(fn URL &optional IGNORE)" t nil) - +(fn URL &optional IGNORE)" t) (autoload 'helm-browse-url-opera "helm-net" "\ Browse URL with Opera browser and detach from Emacs. @@ -899,41 +764,32 @@ not be prompted to kill the Opera process. NOTE: Probably not supported on some systems (e.g., Windows). -\(fn URL &optional IGNORE)" t nil) - +(fn URL &optional IGNORE)" t) (autoload 'helm-browse-url-chromium "helm-net" "\ Browse URL with Google Chrome browser. -\(fn URL &optional IGNORE)" t nil) - +(fn URL &optional IGNORE)" t) (autoload 'helm-browse-url-uzbl "helm-net" "\ Browse URL with uzbl browser. -\(fn URL &optional IGNORE)" t nil) - +(fn URL &optional IGNORE)" t) (autoload 'helm-browse-url-conkeror "helm-net" "\ Browse URL with conkeror browser. -\(fn URL &optional IGNORE)" t nil) - +(fn URL &optional IGNORE)" t) (autoload 'helm-browse-url-nyxt "helm-net" "\ Browse URL with nyxt browser. -\(fn URL &optional IGNORE)" t nil) - +(fn URL &optional IGNORE)" t) (autoload 'helm-surfraw "helm-net" "\ Preconfigured `helm' to search PATTERN with search ENGINE. -\(fn PATTERN ENGINE)" t nil) - +(fn PATTERN ENGINE)" t) (autoload 'helm-google-suggest "helm-net" "\ -Preconfigured `helm' for Google search with Google suggest." t nil) - +Preconfigured `helm' for Google search with Google suggest." t) (register-definition-prefixes "helm-net" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-occur" "helm-occur.el" (0 0 0 0)) ;;; Generated autoloads from helm-occur.el (autoload 'helm-occur "helm-occur" "\ @@ -951,16 +807,13 @@ buffers (i.e. a helm command using `helm-source-buffers-list' like This is the helm implementation that collect lines matching pattern like vanilla Emacs `occur' but have nothing to do with it, the search -engine beeing completely different and also much faster." t nil) - +engine beeing completely different and also much faster." t) (autoload 'helm-occur-visible-buffers "helm-occur" "\ -Run helm-occur on all visible buffers in frame." t nil) - +Run helm-occur on all visible buffers in frame." t) (autoload 'helm-occur-from-isearch "helm-occur" "\ Invoke `helm-occur' from isearch. -To use this bind it to a key in `isearch-mode-map'." t nil) - +To use this bind it to a key in `isearch-mode-map'." t) (autoload 'helm-multi-occur-from-isearch "helm-occur" "\ Invoke `helm-multi-occur' from isearch. @@ -969,65 +822,49 @@ With a prefix arg, reverse the behavior of The prefix arg can be set before calling `helm-multi-occur-from-isearch' or during the buffer selection. -To use this bind it to a key in `isearch-mode-map'." t nil) - +To use this bind it to a key in `isearch-mode-map'." t) (register-definition-prefixes "helm-occur" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (0 0 0 0)) ;;; Generated autoloads from helm-regexp.el (autoload 'helm-regexp "helm-regexp" "\ Preconfigured helm to build regexps. -`query-replace-regexp' can be run from there against found regexp." t nil) - +`query-replace-regexp' can be run from there against found regexp." t) (register-definition-prefixes "helm-regexp" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-ring" "helm-ring.el" (0 0 0 0)) ;;; Generated autoloads from helm-ring.el (autoload 'helm-mark-ring "helm-ring" "\ -Preconfigured `helm' for `helm-source-mark-ring'." t nil) - +Preconfigured `helm' for `helm-source-mark-ring'." t) (autoload 'helm-global-mark-ring "helm-ring" "\ -Preconfigured `helm' for `helm-source-global-mark-ring'." t nil) - +Preconfigured `helm' for `helm-source-global-mark-ring'." t) (autoload 'helm-all-mark-rings "helm-ring" "\ Preconfigured `helm' for mark rings. Source used are `helm-source-global-mark-ring' and -`helm-source-mark-ring'." t nil) - +`helm-source-mark-ring'." t) (autoload 'helm-register "helm-ring" "\ -Preconfigured `helm' for Emacs registers." t nil) - +Preconfigured `helm' for Emacs registers." t) (autoload 'helm-show-kill-ring "helm-ring" "\ Preconfigured `helm' for `kill-ring'. It is drop-in replacement of `yank-pop'. -First call open the kill-ring browser, next calls move to next line." t nil) - +First call open the kill-ring browser, next calls move to next line." t) (autoload 'helm-execute-kmacro "helm-ring" "\ Preconfigured helm for keyboard macros. Define your macros with `f3' and `f4'. -See (info \"(emacs) Keyboard Macros\") for detailed infos. -This command is useful when used with persistent action." t nil) - +See (info \"(emacs) Keyboard Macros\") for detailed infos." t) (register-definition-prefixes "helm-ring" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (0 0 0 0)) ;;; Generated autoloads from helm-semantic.el (autoload 'helm-semantic "helm-semantic" "\ Preconfigured `helm' for `semantic'. If ARG is supplied, pre-select symbol at point instead of current. -\(fn ARG)" t nil) - +(fn ARG)" t) (autoload 'helm-semantic-or-imenu "helm-semantic" "\ Preconfigured helm for `semantic' or `imenu'. If ARG is supplied, pre-select symbol at point instead of current @@ -1037,22 +874,16 @@ If `semantic-mode' is active in the current buffer, then use semantic for generating tags, otherwise fall back to `imenu'. Fill in the symbol at point by default. -\(fn ARG)" t nil) - +(fn ARG)" t) (register-definition-prefixes "helm-semantic" '("helm-s")) -;;;*** -;;;### (autoloads nil "helm-shell" "helm-shell.el" (0 0 0 0)) ;;; Generated autoloads from helm-shell.el (defalias 'helm-shell-prompts 'helm-comint-prompts) - (defalias 'helm-shell-prompts-all 'helm-comint-prompts-all) -;;;*** -;;;### (autoloads nil "helm-sys" "helm-sys.el" (0 0 0 0)) ;;; Generated autoloads from helm-sys.el (defvar helm-top-poll-mode nil "\ @@ -1062,13 +893,11 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-top-poll-mode'.") - (custom-autoload 'helm-top-poll-mode "helm-sys" nil) - (autoload 'helm-top-poll-mode "helm-sys" "\ Refresh automatically helm top buffer once enabled. -This is a minor mode. If called interactively, toggle the +This is a global minor mode. If called interactively, toggle the `Helm-Top-Poll mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. @@ -1082,22 +911,16 @@ evaluate `(default-value \\='helm-top-poll-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) (autoload 'helm-top "helm-sys" "\ -Preconfigured `helm' for top command." t nil) - +Preconfigured `helm' for top command." t) (autoload 'helm-list-emacs-process "helm-sys" "\ -Preconfigured `helm' for Emacs process." t nil) - +Preconfigured `helm' for Emacs process." t) (autoload 'helm-xrandr-set "helm-sys" "\ -Preconfigured helm for xrandr." t nil) - +Preconfigured helm for xrandr." t) (register-definition-prefixes "helm-sys" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-tags" "helm-tags.el" (0 0 0 0)) ;;; Generated autoloads from helm-tags.el (autoload 'helm-etags-select "helm-tags" "\ @@ -1112,20 +935,15 @@ This function aggregates three sources of tag files: 2) `tags-file-name', which is commonly set by `find-tag' command. 3) `tags-table-list' which is commonly set by `visit-tags-table' command. -\(fn REINIT)" t nil) - +(fn REINIT)" t) (register-definition-prefixes "helm-tags" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-types" "helm-types.el" (0 0 0 0)) ;;; Generated autoloads from helm-types.el (register-definition-prefixes "helm-types" '("helm-")) -;;;*** -;;;### (autoloads nil "helm-utils" "helm-utils.el" (0 0 0 0)) ;;; Generated autoloads from helm-utils.el (defvar helm-popup-tip-mode nil "\ @@ -1135,13 +953,11 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `helm-popup-tip-mode'.") - (custom-autoload 'helm-popup-tip-mode "helm-utils" nil) - (autoload 'helm-popup-tip-mode "helm-utils" "\ Show help-echo informations in a popup tip at end of line. -This is a minor mode. If called interactively, toggle the +This is a global minor mode. If called interactively, toggle the `Helm-Popup-Tip mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. @@ -1155,28 +971,24 @@ evaluate `(default-value \\='helm-popup-tip-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. -\(fn &optional ARG)" t nil) - +(fn &optional ARG)" t) (register-definition-prefixes "helm-utils" '("helm-" "with-helm-display-marked-candidates")) -;;;*** -;;;### (autoloads nil "helm-x-files" "helm-x-files.el" (0 0 0 0)) ;;; Generated autoloads from helm-x-files.el (register-definition-prefixes "helm-x-files" '("helm-")) - -;;;*** -;;;### (autoloads nil nil ("helm-config.el" "helm-easymenu.el" "helm-pkg.el" -;;;;;; "helm.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'helm-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; helm-autoloads.el ends here diff --git a/elpa/helm-20220616.1004/helm-bookmark.el b/elpa/helm-20230806.1956/helm-bookmark.el similarity index 74% rename from elpa/helm-20220616.1004/helm-bookmark.el rename to elpa/helm-20230806.1956/helm-bookmark.el index 1fad3a51..848da91a 100644 --- a/elpa/helm-20220616.1004/helm-bookmark.el +++ b/elpa/helm-20230806.1956/helm-bookmark.el @@ -1,6 +1,6 @@ ;;; helm-bookmark.el --- Helm for Emacs regular Bookmarks. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -32,6 +32,9 @@ (declare-function all-the-icons-fileicon "ext:all-the-icons.el") (declare-function all-the-icons-icon-for-file"ext:all-the-icons.el") (declare-function all-the-icons-octicon "ext:all-the-icons.el") +(declare-function all-the-icons-match-to-alist "ext:all-the-icons.el") + +(defvar all-the-icons-dir-icon-alist) (defgroup helm-bookmark nil @@ -40,7 +43,6 @@ (defcustom helm-bookmark-show-location nil "Show location of bookmark on display." - :group 'helm-bookmark :type 'boolean) (defcustom helm-bookmark-default-filtered-sources @@ -56,72 +58,101 @@ (list 'helm-source-bookmark-uncategorized 'helm-source-bookmark-set)) "List of sources to use in `helm-filtered-bookmarks'." - :group 'helm-bookmark :type '(repeat (choice symbol))) (defcustom helm-bookmark-use-icon nil - "Display candidates with an icon with `all-the-icons' when non nil." + "Display candidates with an icon with `all-the-icons' when non nil. +Don't use `setq' to set this." :type 'boolean - :group 'helm-bookmark) - + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) + +(defcustom helm-bookmark-default-sort-method 'adaptive + "Sort method for `helm-filtered-bookmarks'. + +Value can be either \\='native' or \\='adaptive'. + +Once you use \\='native' the bookmark variable `bookmark-sort-flag' +will be honored." + :type '(choice + (symbol :tag "Helm adaptive sort method" adaptive) + (symbol :tag "Native bookmark sort method" native)) + ;; Don't use the :set function until functions and variables below + ;; are not loaded i.e. use set-default only for now. + :initialize 'custom-initialize-changed + :set (lambda (var val) + (set var val) + (cl-loop for s in (remove 'helm-source-bookmark-set + helm-bookmark-default-filtered-sources) + for fn = (intern (format "%s-builder" s)) + do (set s (funcall fn))))) +(defgroup helm-bookmark-faces nil + "Customize the appearance of helm-bookmark." + :prefix "helm-" + :group 'helm-bookmark + :group 'helm-faces) + (defface helm-bookmark-info `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "green")) "Face used for W3m Emacs bookmarks (not w3m bookmarks)." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-w3m `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "yellow")) "Face used for W3m Emacs bookmarks (not w3m bookmarks)." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-gnus `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "magenta")) "Face used for Gnus bookmarks." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-man `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "Orange4")) "Face used for Woman/man bookmarks." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-file `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "Deepskyblue2")) "Face used for file bookmarks." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-file-not-found `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "Slategray4")) "Face used for file bookmarks." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-directory `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :inherit helm-ff-directory)) "Face used for file bookmarks." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defface helm-bookmark-addressbook `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "tomato")) "Face used for addressbook bookmarks." - :group 'helm-bookmark) + :group 'helm-bookmark-faces) (defvar helm-bookmark-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "C-c o") 'helm-bookmark-run-jump-other-window) - (define-key map (kbd "C-c C-o") 'helm-bookmark-run-jump-other-frame) - (define-key map (kbd "C-d") 'helm-bookmark-run-delete) - (define-key map (kbd "C-]") 'helm-bookmark-toggle-filename) - (define-key map (kbd "M-e") 'helm-bookmark-run-edit) + (define-key map (kbd "C-c o") #'helm-bookmark-run-jump-other-window) + (define-key map (kbd "C-c C-o") #'helm-bookmark-run-jump-other-frame) + (define-key map (kbd "C-c C-t") #'helm-bookmark-run-jump-other-tab) + (define-key map (kbd "C-d") #'helm-bookmark-run-delete) + (define-key map (kbd "C-]") #'helm-bookmark-toggle-filename) + (define-key map (kbd "M-e") #'helm-bookmark-run-edit) map) "Generic Keymap for Emacs bookmark sources.") @@ -130,7 +161,11 @@ (bookmark-maybe-load-default-file) (helm-init-candidates-in-buffer 'global - (bookmark-all-names)))) + (if (and (fboundp 'bookmark-maybe-sort-alist) + (fboundp 'bookmark-name-from-full-record)) + (mapcar 'bookmark-name-from-full-record + (bookmark-maybe-sort-alist)) + (bookmark-all-names))))) (filtered-candidate-transformer :initform 'helm-bookmark-transformer) (find-file-target :initform #'helm-bookmarks-quit-an-find-file-fn))) @@ -162,32 +197,32 @@ (regexp-quote trunc) (regexp-quote real))))) -(defun helm-bookmark-toggle-filename () +(helm-make-persistent-command-from-action helm-bookmark-toggle-filename "Toggle bookmark location visibility." - (interactive) - (with-helm-alive-p - (helm-set-attr 'toggle-filename - '(helm-bookmark-toggle-filename-1 . never-split)) - (helm-execute-persistent-action 'toggle-filename))) -(put 'helm-bookmark-toggle-filename 'helm-only t) + 'toggle-filename 'helm-bookmark-toggle-filename-1) + +(defun helm-bookmark-jump-1 (candidate &optional fn) + (let (;; FIXME Why is prefarg necessary here? + (current-prefix-arg helm-current-prefix-arg) + non-essential) + (bookmark-jump candidate fn))) (defun helm-bookmark-jump (candidate) "Jump to bookmark action." - (let ((current-prefix-arg helm-current-prefix-arg) - non-essential) - (bookmark-jump candidate))) + (helm-bookmark-jump-1 candidate)) (defun helm-bookmark-jump-other-frame (candidate) "Jump to bookmark in other frame action." - (let ((current-prefix-arg helm-current-prefix-arg) - non-essential) - (bookmark-jump candidate 'switch-to-buffer-other-frame))) + (helm-bookmark-jump-1 candidate #'switch-to-buffer-other-frame)) (defun helm-bookmark-jump-other-window (candidate) "Jump to bookmark in other window action." - (let (non-essential) - (bookmark-jump-other-window candidate))) + (helm-bookmark-jump-1 candidate #'switch-to-buffer-other-window)) +(defun helm-bookmark-jump-other-tab (candidate) + "Jump to bookmark action." + (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available") + (helm-bookmark-jump-1 candidate #'switch-to-buffer-other-tab)) ;;; bookmark-set ;; @@ -220,7 +255,8 @@ BOOKMARK is a bookmark name or a bookmark record." (defun helm-bookmark-mu4e-bookmark-p (bookmark) "Return non nil if BOOKMARK is a mu4e bookmark. BOOKMARK is a bookmark name or a bookmark record." - (eq (bookmark-get-handler bookmark) 'mu4e-bookmark-jump)) + (memq (bookmark-get-handler bookmark) + '(mu4e-bookmark-jump mu4e--jump-to-bookmark))) (defun helm-bookmark-w3m-bookmark-p (bookmark) "Return non-nil if BOOKMARK is a W3m bookmark. @@ -303,7 +339,10 @@ BOOKMARK is a bookmark name or a bookmark record." (defun helm-bookmark-filter-setup-alist (fn) "Return a filtered `bookmark-alist' sorted alphabetically." - (cl-loop for b in bookmark-alist + (cl-loop for b in (if (and (fboundp 'bookmark-maybe-sort-alist) + (eq helm-bookmark-default-sort-method 'native)) + (bookmark-maybe-sort-alist) + bookmark-alist) for name = (car b) when (funcall fn b) collect (propertize name 'location (bookmark-location name)))) @@ -337,18 +376,18 @@ If `browse-url-browser-function' is set to something else than ;; (`bookmark-w3m-bookmark-jump') will use our handler which open ;; the bookmark in a new tab or in an external browser depending ;; on `browse-url-browser-function'. -(defalias 'bookmark-w3m-bookmark-jump 'helm-bookmark-jump-w3m) +(defalias 'bookmark-w3m-bookmark-jump #'helm-bookmark-jump-w3m) ;; Provide compatibility with old handlers provided in external ;; packages bookmark-extensions.el and bookmark+. -(defalias 'bmkext-jump-woman 'woman-bookmark-jump) -(defalias 'bmkext-jump-man 'Man-bookmark-jump) -(defalias 'bmkext-jump-w3m 'helm-bookmark-jump-w3m) -(defalias 'bmkext-jump-gnus 'gnus-summary-bookmark-jump) -(defalias 'bookmarkp-jump-gnus 'gnus-summary-bookmark-jump) -(defalias 'bookmarkp-jump-w3m 'helm-bookmark-jump-w3m) -(defalias 'bookmarkp-jump-woman 'woman-bookmark-jump) -(defalias 'bookmarkp-jump-man 'Man-bookmark-jump) +(defalias 'bmkext-jump-woman #'woman-bookmark-jump) +(defalias 'bmkext-jump-man #'Man-bookmark-jump) +(defalias 'bmkext-jump-w3m #'helm-bookmark-jump-w3m) +(defalias 'bmkext-jump-gnus #'gnus-summary-bookmark-jump) +(defalias 'bookmarkp-jump-gnus #'gnus-summary-bookmark-jump) +(defalias 'bookmarkp-jump-w3m #'helm-bookmark-jump-w3m) +(defalias 'bookmarkp-jump-woman #'woman-bookmark-jump) +(defalias 'bookmarkp-jump-man #'Man-bookmark-jump) ;;;; Filtered bookmark sources @@ -356,8 +395,10 @@ If `browse-url-browser-function' is set to something else than ;; (defclass helm-source-filtered-bookmarks (helm-source-in-buffer helm-type-bookmark) ((filtered-candidate-transformer - :initform '(helm-adaptive-sort - helm-highlight-bookmark)) + :initform (delq nil + `(,(and (eq helm-bookmark-default-sort-method 'adaptive) + 'helm-adaptive-sort) + helm-highlight-bookmark))) (find-file-target :initform #'helm-bookmarks-quit-an-find-file-fn))) (defun helm-bookmarks-quit-an-find-file-fn (source) @@ -370,18 +411,25 @@ If `browse-url-browser-function' is set to something else than it (expand-file-name it)) (expand-file-name default-directory)))) +(defun helm-bookmark-build-source (name buildfn &optional class &rest args) + (apply #'helm-make-source name + (or class 'helm-source-filtered-bookmarks) + :init (lambda () + (bookmark-maybe-load-default-file) + (helm-init-candidates-in-buffer + 'global (funcall buildfn))) + args)) + ;;; W3m bookmarks. ;; (defun helm-bookmark-w3m-setup-alist () "Specialized filter function for bookmarks w3m." (helm-bookmark-filter-setup-alist 'helm-bookmark-w3m-bookmark-p)) -(defvar helm-source-bookmark-w3m - (helm-make-source "Bookmark W3m" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-w3m-setup-alist))))) +(defun helm-source-bookmark-w3m-builder () + (helm-bookmark-build-source "Bookmark W3m" #'helm-bookmark-w3m-setup-alist)) + +(defvar helm-source-bookmark-w3m (helm-source-bookmark-w3m-builder)) ;;; Images ;; @@ -389,12 +437,10 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for images bookmarks." (helm-bookmark-filter-setup-alist 'helm-bookmark-image-bookmark-p)) -(defvar helm-source-bookmark-images - (helm-make-source "Bookmark Images" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-images-setup-alist))))) +(defun helm-source-bookmark-images-builder () + (helm-bookmark-build-source "Bookmark Images" #'helm-bookmark-images-setup-alist)) + +(defvar helm-source-bookmark-images (helm-source-bookmark-images-builder)) ;;; Woman Man ;; @@ -402,12 +448,10 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for bookmarks w3m." (helm-bookmark-filter-setup-alist 'helm-bookmark-woman-man-bookmark-p)) -(defvar helm-source-bookmark-man - (helm-make-source "Bookmark Woman&Man" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-man-setup-alist))))) +(defun helm-source-bookmark-man-builder () + (helm-bookmark-build-source "Bookmark Woman&Man" #'helm-bookmark-man-setup-alist)) + +(defvar helm-source-bookmark-man (helm-source-bookmark-man-builder)) ;;; Org files ;; @@ -415,12 +459,10 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for Org file bookmarks." (helm-bookmark-filter-setup-alist 'helm-bookmark-org-file-p)) -(defvar helm-source-bookmark-org - (helm-make-source " Bookmarked Org files" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-org-setup-alist))))) +(defun helm-source-bookmark-org-builder () + (helm-bookmark-build-source "Bookmark Org files" #'helm-bookmark-org-setup-alist)) + +(defvar helm-source-bookmark-org (helm-source-bookmark-org-builder)) ;;; Gnus ;; @@ -428,24 +470,20 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for bookmarks gnus." (helm-bookmark-filter-setup-alist 'helm-bookmark-gnus-bookmark-p)) -(defvar helm-source-bookmark-gnus - (helm-make-source "Bookmark Gnus" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-gnus-setup-alist))))) +(defun helm-source-bookmark-gnus-builder () + (helm-bookmark-build-source "Bookmark Gnus" #'helm-bookmark-gnus-setup-alist)) + +(defvar helm-source-bookmark-gnus (helm-source-bookmark-gnus-builder)) ;;; Mu4e ;; (defun helm-bookmark-mu4e-setup-alist () (helm-bookmark-filter-setup-alist 'helm-bookmark-mu4e-bookmark-p)) -(defvar helm-source-bookmark-mu4e - (helm-make-source "Bookmark Mu4e" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-mu4e-setup-alist))))) +(defun helm-source-bookmark-mu4e-builder () + (helm-bookmark-build-source "Bookmark Mu4e" #'helm-bookmark-mu4e-setup-alist)) + +(defvar helm-source-bookmark-mu4e (helm-source-bookmark-mu4e-builder)) ;;; Info ;; @@ -453,12 +491,10 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for bookmarks info." (helm-bookmark-filter-setup-alist 'helm-bookmark-info-bookmark-p)) -(defvar helm-source-bookmark-info - (helm-make-source "Bookmark Info" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-info-setup-alist))))) +(defun helm-source-bookmark-info-builder () + (helm-bookmark-build-source "Bookmark Info" #'helm-bookmark-info-setup-alist)) + +(defvar helm-source-bookmark-info (helm-source-bookmark-info-builder)) ;;; Files and directories ;; @@ -466,12 +502,12 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for bookmarks locals files." (helm-bookmark-filter-setup-alist 'helm-bookmark-file-p)) +(defun helm-source-bookmark-files&dirs-builder () + (helm-bookmark-build-source + "Bookmark Files&Directories" #'helm-bookmark-local-files-setup-alist)) + (defvar helm-source-bookmark-files&dirs - (helm-make-source "Bookmark Files&Directories" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-local-files-setup-alist))))) + (helm-source-bookmark-files&dirs-builder)) ;;; Helm find files sessions. ;; @@ -485,19 +521,18 @@ If `browse-url-browser-function' is set to something else than (bookmark-get-filename candidate) (helm-browse-project nil))) -(defun helm-bookmark-run-browse-project () +(helm-make-command-from-action helm-bookmark-run-browse-project "Run `helm-bookmark-browse-project' from keyboard." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-bookmark-browse-project))) -(put 'helm-bookmark-run-browse-project 'helm-only t) + 'helm-bookmark-browse-project) (defvar helm-bookmark-find-files-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-bookmark-map) - (define-key map (kbd "C-x C-d") 'helm-bookmark-run-browse-project) + (define-key map (kbd "C-x C-d") #'helm-bookmark-run-browse-project) map)) +;; Same as `helm-source-filtered-bookmarks' but override actions and keymap +;; specifically for helm-find-files bookmarks. (defclass helm-bookmark-override-inheritor (helm-source) ()) (cl-defmethod helm--setup-source ((source helm-bookmark-override-inheritor)) @@ -506,8 +541,10 @@ If `browse-url-browser-function' is set to something else than (setf (slot-value source 'action) (helm-append-at-nth (cl-loop for (name . action) in helm-type-bookmark-actions + ;; We don't want those actions in helm-find-files bookmarks. unless (memq action '(helm-bookmark-jump-other-frame - helm-bookmark-jump-other-window)) + helm-bookmark-jump-other-window + helm-bookmark-jump-other-tab)) collect (cons name action)) '(("Browse project" . helm-bookmark-browse-project)) 1)) (setf (slot-value source 'keymap) helm-bookmark-find-files-map)) @@ -516,14 +553,16 @@ If `browse-url-browser-function' is set to something else than helm-bookmark-override-inheritor) ()) +(defun helm-source-bookmark-helm-find-files-builder () + (helm-bookmark-build-source + "Bookmark helm-find-files sessions" + #'helm-bookmark-helm-find-files-setup-alist + 'helm-bookmark-find-files-class + :persistent-action (lambda (_candidate) (ignore)) + :persistent-help "Do nothing")) + (defvar helm-source-bookmark-helm-find-files - (helm-make-source "Bookmark helm-find-files sessions" 'helm-bookmark-find-files-class - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-helm-find-files-setup-alist))) - :persistent-action (lambda (_candidate) (ignore)) - :persistent-help "Do nothing")) + (helm-source-bookmark-helm-find-files-builder)) ;;; Uncategorized bookmarks ;; @@ -531,16 +570,16 @@ If `browse-url-browser-function' is set to something else than "Specialized filter function for uncategorized bookmarks." (helm-bookmark-filter-setup-alist 'helm-bookmark-uncategorized-bookmark-p)) +(defun helm-source-bookmark-uncategorized-builder () + (helm-bookmark-build-source + "Bookmark uncategorized" #'helm-bookmark-uncategorized-setup-alist)) + (defvar helm-source-bookmark-uncategorized - (helm-make-source "Bookmark uncategorized" 'helm-source-filtered-bookmarks - :init (lambda () - (bookmark-maybe-load-default-file) - (helm-init-candidates-in-buffer - 'global (helm-bookmark-uncategorized-setup-alist))))) + (helm-source-bookmark-uncategorized-builder)) + ;;; Transformer ;; - (defun helm-highlight-bookmark (bookmarks _source) "Used as `filtered-candidate-transformer' to colorize bookmarks." (let ((non-essential t)) @@ -572,7 +611,14 @@ If `browse-url-browser-function' is set to something else than i) for icon = (when helm-bookmark-use-icon (cond ((and isfile hff) - (all-the-icons-octicon "file-directory")) + (helm-aif (or (all-the-icons-match-to-alist + (helm-basename (helm-basedir isfile t)) + all-the-icons-dir-icon-alist) + (all-the-icons-match-to-alist + (helm-basename isfile) + all-the-icons-dir-icon-alist)) + (apply (car it) (cdr it)) + (all-the-icons-octicon "file-directory"))) ((and isfile isinfo) (all-the-icons-octicon "info")) (isfile (all-the-icons-icon-for-file isfile)) ((or iswoman isman) @@ -670,24 +716,30 @@ renamed." (let* ((helm--reading-passwd-or-string t) (bookmark-fname (bookmark-get-filename bookmark-name)) (bookmark-loc (bookmark-prop-get bookmark-name 'location)) + (message-id (bookmark-prop-get bookmark-name 'message-id)) (new-name (read-from-minibuffer "Name: " bookmark-name)) - (new-loc (read-from-minibuffer "FileName or Location: " - (or bookmark-fname - (if (consp bookmark-loc) - (car bookmark-loc) - bookmark-loc)))) - (docid (and (eq handler 'mu4e-bookmark-jump) - (read-number "Docid: " (cdr bookmark-loc))))) - (when docid - (setq new-loc (cons new-loc docid))) - (when (and (not (equal new-name "")) (not (equal new-loc "")) + (new-loc (and (or bookmark-fname bookmark-loc) + (read-from-minibuffer "FileName or Location: " + (or bookmark-fname + (if (consp bookmark-loc) + (car bookmark-loc) + bookmark-loc))))) + (new-message-id (and (memq handler '(mu4e--jump-to-bookmark + mu4e-bookmark-jump)) + (read-string "Message-id: " message-id)))) + (when (and (not (equal new-name "")) + (or (not (equal new-loc "")) + (not (equal new-message-id ""))) (y-or-n-p "Save changes? ")) (if bookmark-fname (progn (helm-bookmark-rename bookmark-name new-name 'batch) (bookmark-set-filename new-name new-loc)) (bookmark-prop-set - (bookmark-get-bookmark bookmark-name) 'location new-loc) + (bookmark-get-bookmark bookmark-name) + (cond (new-loc 'location) + (new-message-id 'message-id)) + (or new-loc new-message-id)) (helm-bookmark-rename bookmark-name new-name 'batch)) (helm-bookmark-maybe-save-bookmark) (list new-name new-loc)))) @@ -716,7 +768,7 @@ consecutive words from the buffer into the new bookmark name." (let ((newname (or new (read-from-minibuffer "New name: " nil (let ((now-map (copy-keymap minibuffer-local-map))) - (define-key now-map "\C-w" 'bookmark-yank-word) + (define-key now-map "\C-w" #'bookmark-yank-word) now-map) nil 'bookmark-history)))) (bookmark-set-name old newname) @@ -724,35 +776,26 @@ consecutive words from the buffer into the new bookmark name." (unless batch (bookmark-bmenu-surreptitiously-rebuild-list)) (helm-bookmark-maybe-save-bookmark) newname)) -(defun helm-bookmark-run-edit () +(helm-make-command-from-action helm-bookmark-run-edit "Run `helm-bookmark-edit-bookmark' from keyboard." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-bookmark-edit-bookmark))) -(put 'helm-bookmark-run-edit 'helm-only t) + 'helm-bookmark-edit-bookmark) -(defun helm-bookmark-run-jump-other-frame () +(helm-make-command-from-action helm-bookmark-run-jump-other-frame "Jump to bookmark other frame from keyboard." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-bookmark-jump-other-frame))) -(put 'helm-bookmark-run-jump-other-frame 'helm-only t) + 'helm-bookmark-jump-other-frame) -(defun helm-bookmark-run-jump-other-window () - "Jump to bookmark from keyboard." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-bookmark-jump-other-window))) -(put 'helm-bookmark-run-jump-other-window 'helm-only t) +(helm-make-command-from-action helm-bookmark-run-jump-other-window + "Jump to bookmark other window from keyboard." + 'helm-bookmark-jump-other-window) + +(helm-make-command-from-action helm-bookmark-run-jump-other-tab + "Jump to bookmark other tab from keyboard." + 'helm-bookmark-jump-other-tab) -(defun helm-bookmark-run-delete () +(helm-make-command-from-action helm-bookmark-run-delete "Delete bookmark from keyboard." - (interactive) - (with-helm-alive-p - (when (y-or-n-p "Delete bookmark(s)?") - (helm-exit-and-execute-action 'helm-delete-marked-bookmarks)))) -(put 'helm-bookmark-run-delete 'helm-only t) + 'helm-delete-marked-bookmarks) (defun helm-bookmark-get-bookmark-from-name (bmk) "Return bookmark name even if it is a bookmark with annotation. @@ -762,7 +805,7 @@ E.g. prepended with *." (defun helm-delete-marked-bookmarks (_ignore) "Delete this bookmark or all marked bookmarks." - (cl-dolist (i (helm-marked-candidates)) + (dolist (i (helm-marked-candidates)) (bookmark-delete (helm-bookmark-get-bookmark-from-name i) 'batch))) @@ -782,8 +825,6 @@ E.g. prepended with *." Optional source `helm-source-bookmark-addressbook' is loaded only if external addressbook-bookmark package is installed." (interactive) - (when helm-bookmark-use-icon - (require 'all-the-icons)) (helm :sources helm-bookmark-default-filtered-sources :prompt "Search Bookmark: " :buffer "*helm filtered bookmarks*" diff --git a/elpa/helm-20220616.1004/helm-buffers.el b/elpa/helm-20230806.1956/helm-buffers.el similarity index 82% rename from elpa/helm-20220616.1004/helm-buffers.el rename to elpa/helm-20230806.1956/helm-buffers.el index ce91161f..3493ad39 100644 --- a/elpa/helm-20220616.1004/helm-buffers.el +++ b/elpa/helm-20230806.1956/helm-buffers.el @@ -1,6 +1,6 @@ ;;; helm-buffers.el --- helm support for buffers. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -28,9 +28,14 @@ (declare-function helm-comp-read "helm-mode") (declare-function helm-browse-project "helm-files") +(declare-function helm-ff-switch-to-shell "helm-files") +(declare-function all-the-icons-icon-for-file "ext:all-the-icons.el") +(declare-function all-the-icons-octicon "ext:all-the-icons.el") +(defvar all-the-icons-mode-icon-alist) (defvar dired-buffers) (defvar org-directory) +(defvar helm-ff-default-directory) (defgroup helm-buffers nil @@ -43,56 +48,47 @@ Buffer candidates matching these regular expression will be filtered from the list of candidates if the `helm-skip-boring-buffers' candidate transformer is used." - :type '(repeat (choice regexp)) - :group 'helm-buffers) + :type '(repeat (choice regexp))) (defcustom helm-white-buffer-regexp-list nil "The regexp list of not boring buffers. These buffers will be displayed even if they match one of `helm-boring-buffer-regexp-list'." - :type '(repeat (choice regexp)) - :group 'helm-buffers) + :type '(repeat (choice regexp))) (defcustom helm-buffers-favorite-modes '(lisp-interaction-mode emacs-lisp-mode text-mode org-mode) "List of preferred mode to open new buffers with." - :type '(repeat (choice function)) - :group 'helm-buffers) + :type '(repeat (choice function))) (defcustom helm-buffer-max-length 20 "Max length of buffer names before truncate. When disabled (nil) use the longest `buffer-name' length found." - :group 'helm-buffers :type '(choice (const :tag "Disabled" nil) (integer :tag "Length before truncate"))) (defcustom helm-buffer-details-flag t "Always show details in buffer list when non-nil." - :group 'helm-buffers :type 'boolean) (defcustom helm-buffers-fuzzy-matching nil "Fuzzy matching buffer names when non-nil. Only buffer names are fuzzy matched when this is enabled, `major-mode' matching is not affected by this." - :group 'helm-buffers :type 'boolean) (defcustom helm-buffer-skip-remote-checking nil "Ignore checking for `file-exists-p' on remote files." - :group 'helm-buffers :type 'boolean) (defcustom helm-buffers-truncate-lines t "Truncate lines in `helm-buffers-list' when non-nil." - :group 'helm-buffers :type 'boolean) (defcustom helm-buffers-left-margin-width helm-left-margin-width "`left-margin-width' value for `helm-mini' and `helm-buffers-list'." - :group 'helm-buffers :type 'integer) (defcustom helm-mini-default-sources '(helm-source-buffers-list @@ -102,18 +98,15 @@ Only buffer names are fuzzy matched when this is enabled, When adding a source here it is up to you to ensure the library of this source is accessible and properly loaded." - :group 'helm-buffers :type '(repeat (choice symbol))) (defcustom helm-buffers-end-truncated-string "..." "The string to display at end of truncated buffer names." - :type 'string - :group 'helm-buffers) + :type 'string) (defcustom helm-buffers-column-separator " " "Separator for columns in buffer listing." - :type 'string - :group 'helm-buffers) + :type 'string) (defcustom helm-buffer--pretty-names '((dired-mode . "Dired") (lisp-interaction-mode . "Lisp Inter")) @@ -124,13 +117,11 @@ may be a mode-line specification which may be costly to compute, in this case add here the pretty name as a string to avoid this costly computation. Also if some pretty names are too long you can add your own abbreviation here." - :type '(alist :key-type symbol :value-type string) - :group 'helm-buffers) + :type '(alist :key-type symbol :value-type string)) (defcustom helm-buffers-maybe-switch-to-tab nil "Switch to buffer in its tab when non nil. This has no effect when `tab-bar-mode' is not available." - :group 'helm-buffers :type 'boolean) (defcustom helm-buffer-list-reorder-fn #'helm-buffers-reorder-buffer-list @@ -142,7 +133,6 @@ You can write a function that reorder VISIBLES and OTHERS as you want. Default function returns OTHERS buffers on top and VISIBLES buffer at the end. See `helm-buffers-reorder-buffer-list'." - :group 'helm-buffers :type 'function) (defcustom helm-buffers-sort-fn helm-fuzzy-sort-fn @@ -151,8 +141,17 @@ buffer at the end. See `helm-buffers-reorder-buffer-list'." Default to `helm-fuzzy-sort-fn' you can use `helm-fuzzy-matching-sort-fn-preserve-ties-order' as alternative if you want to keep the recentest order when narrowing candidates." - :type 'function - :group 'helm-buffers) + :type 'function) + +(defcustom helm-buffers-show-icons nil + "Prefix buffer names with an icon when non nil. +Don't use `setq' to set this." + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) + ;;; Faces ;; @@ -250,30 +249,29 @@ Note that this variable is buffer-local.") ;; No need to have separate command for grep and zgrep ;; as we don't use recursivity for buffers. ;; So use zgrep for both as it is capable to handle non--compressed files. - (define-key map (kbd "M-g s") 'helm-buffer-run-zgrep) - (define-key map (kbd "C-s") 'helm-buffers-run-occur) - (define-key map (kbd "C-x C-d") 'helm-buffers-run-browse-project) - (define-key map (kbd "C-c o") 'helm-buffer-switch-other-window) - (define-key map (kbd "C-c C-o") 'helm-buffer-switch-other-frame) - (define-key map (kbd "M-g M-g") 'helm-buffer-run-goto-line) - (define-key map (kbd "C-c =") 'helm-buffer-run-ediff) - (define-key map (kbd "M-=") 'helm-buffer-run-ediff-merge) - (define-key map (kbd "C-=") 'helm-buffer-diff-persistent) - (define-key map (kbd "M-G") 'helm-buffer-revert-persistent) - (define-key map (kbd "C-c d") 'helm-buffer-run-kill-persistent) - (define-key map (kbd "M-D") 'helm-buffer-run-kill-buffers) - (define-key map (kbd "C-x C-s") 'helm-buffer-save-persistent) - (define-key map (kbd "C-x s") 'helm-buffer-run-save-some-buffers) - (define-key map (kbd "C-M-%") 'helm-buffer-run-query-replace-regexp) - (define-key map (kbd "M-%") 'helm-buffer-run-query-replace) - (define-key map (kbd "M-R") 'helm-buffer-run-rename-buffer) - (define-key map (kbd "M-m") 'helm-toggle-all-marks) - (define-key map (kbd "M-a") 'helm-mark-all) - (define-key map (kbd "C-]") 'helm-toggle-buffers-details) - (define-key map (kbd "C-c a") 'helm-buffers-toggle-show-hidden-buffers) - (define-key map (kbd "C-M-SPC") 'helm-buffers-mark-similar-buffers) + (define-key map (kbd "M-g s") #'helm-buffer-run-zgrep) + (define-key map (kbd "C-s") #'helm-buffers-run-occur) + (define-key map (kbd "C-x C-d") #'helm-buffers-run-browse-project) + (define-key map (kbd "C-c o") #'helm-buffer-switch-other-window) + (define-key map (kbd "C-c C-o") #'helm-buffer-switch-other-frame) + (define-key map (kbd "M-g M-g") #'helm-buffer-run-goto-line) + (define-key map (kbd "C-c =") #'helm-buffer-run-ediff) + (define-key map (kbd "M-=") #'helm-buffer-run-ediff-merge) + (define-key map (kbd "C-=") #'helm-buffer-diff-persistent) + (define-key map (kbd "M-G") #'helm-buffer-revert-persistent) + (define-key map (kbd "C-c d") #'helm-buffer-run-kill-persistent) + (define-key map (kbd "M-D") #'helm-buffer-run-kill-buffers) + (define-key map (kbd "C-x C-s") #'helm-buffer-save-persistent) + (define-key map (kbd "C-x s") #'helm-buffer-run-save-some-buffers) + (define-key map (kbd "C-M-%") #'helm-buffer-run-query-replace-regexp) + (define-key map (kbd "M-%") #'helm-buffer-run-query-replace) + (define-key map (kbd "M-R") #'helm-buffer-run-rename-buffer) + (define-key map (kbd "M-e") #'helm-buffer-run-switch-to-shell) + (define-key map (kbd "C-]") #'helm-toggle-buffers-details) + (define-key map (kbd "C-c a") #'helm-buffers-toggle-show-hidden-buffers) + (define-key map (kbd "C-M-SPC") #'helm-buffers-mark-similar-buffers) (when (fboundp 'tab-bar-mode) - (define-key map (kbd "C-c C-t") 'helm-buffers-switch-to-buffer-new-tab)) + (define-key map (kbd "C-c C-t") #'helm-buffers-switch-to-buffer-new-tab)) map) "Keymap for buffer sources in helm.") @@ -348,28 +346,22 @@ Note that this variable is buffer-local.") (defun helm-buffers-create-new-buffer-ow (candidate) (helm-buffers-create-new-buffer-1 candidate 'switch-to-buffer-other-window)) -(defun helm-buffers-not-found-run-switch-ow () +(helm-make-command-from-action helm-buffers-not-found-run-switch-ow "Run create new buffer other window action from keymap." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffers-create-new-buffer-ow))) -(put 'helm-buffers-not-found-run-switch-ow 'helm-only t) + 'helm-buffers-create-new-buffer-ow) (defun helm-buffers-create-new-buffer-of (candidate) (helm-buffers-create-new-buffer-1 candidate 'switch-to-buffer-other-frame)) -(defun helm-buffers-not-found-run-switch-of () +(helm-make-command-from-action helm-buffers-not-found-run-switch-of "Run create new buffer other frame action from keymap." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffers-create-new-buffer-of))) -(put 'helm-buffers-not-found-run-switch-of 'helm-only t) + 'helm-buffers-create-new-buffer-of) (defvar helm-buffer-not-found-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "C-c o") 'helm-buffers-not-found-run-switch-ow) - (define-key map (kbd "C-c C-o") 'helm-buffers-not-found-run-switch-of) + (define-key map (kbd "C-c o") #'helm-buffers-not-found-run-switch-ow) + (define-key map (kbd "C-c C-o") #'helm-buffers-not-found-run-switch-of) map) "Keymap for `helm-source-buffer-not-found' source.") @@ -430,19 +422,29 @@ The list is reordered with `helm-buffer-list-reorder-fn'." proc details type) (append (list - (concat prefix - (let* ((buf-fname (buffer-file-name (get-buffer buf-name))) - (ext (if buf-fname (helm-file-name-extension buf-fname) "")) - (buf-name (propertize buf-name 'face face1 - 'help-echo help-echo - 'type type))) - (when (condition-case _err - (string-match (format "\\.\\(%s\\)" ext) buf-name) - (invalid-regexp nil)) - (add-face-text-property - (match-beginning 1) (match-end 1) - 'helm-ff-file-extension nil buf-name)) - buf-name))) + (let* ((buf-fname (buffer-file-name (get-buffer buf-name))) + (ext (if buf-fname (helm-file-name-extension buf-fname) "")) + (bmode (with-current-buffer buf-name major-mode)) + (icon (when helm-buffers-show-icons + (helm-aif (assq bmode all-the-icons-mode-icon-alist) + (apply (cadr it) (cddr it)) + (cond ((eq type 'dired) + (all-the-icons-octicon "file-directory")) + (buf-fname + (all-the-icons-icon-for-file buf-fname)) + (t (all-the-icons-octicon "star" :v-adjust 0.0)))))) + (buf-name (propertize buf-name 'face face1 + 'help-echo help-echo + 'type type))) + (when (condition-case _err + (string-match (format "\\.\\(%s\\)" ext) buf-name) + (invalid-regexp nil)) + (add-face-text-property + (match-beginning 1) (match-end 1) + 'helm-ff-file-extension nil buf-name)) + (if icon + (concat icon " " prefix buf-name) + (concat prefix buf-name)))) (and details (list size mode (propertize @@ -576,19 +578,22 @@ buffers)." (get-buffer i))))) (defun helm-buffer--get-preselection (buffer) - (let ((bufname (buffer-name buffer))) + (let* ((bufname (buffer-name buffer)) + (dispbuf (car (helm-buffer--details buffer))) + (len-dispbuf (string-width dispbuf)) + (len-prefix (- len-dispbuf (string-width bufname)))) (when (and bufname (file-remote-p (with-current-buffer bufname default-directory))) (setq bufname (concat "@ " (helm-url-unhex-string bufname)))) - (concat "^" + (concat "^[[:multibyte:] ]*" (if (and (null helm-buffer-details-flag) (numberp helm-buffer-max-length) - (> (string-width bufname) - helm-buffer-max-length)) + (> len-dispbuf helm-buffer-max-length)) (regexp-quote (helm-substring-by-width - bufname helm-buffer-max-length + bufname + (- helm-buffer-max-length len-prefix) helm-buffers-end-truncated-string)) (concat (regexp-quote bufname) (if helm-buffer-details-flag @@ -611,7 +616,7 @@ buffers)." (cl-loop for p in (helm-mm-split-pattern helm-pattern) unless (member (substring p 0 1) '("*" "/" "@" "!")) collect p into lst - finally return (mapconcat 'identity lst (or separator " ")))) + finally return (mapconcat #'identity lst (or separator " ")))) (defun helm-buffers-sort-transformer (candidates source) (cl-assert helm-buffers-sort-fn nil "Wrong type argument functionp: nil") @@ -623,26 +628,14 @@ buffers)." (defun helm-buffers-mark-similar-buffers-1 (&optional type) (with-helm-window (let* ((src (helm-get-current-source)) - (type (or type - (get-text-property - 0 'type (helm-get-selection nil 'withprop src))))) - (save-excursion - (goto-char (helm-get-previous-header-pos)) - (helm-next-line) - (let* ((next-head (helm-get-next-header-pos)) - (end (and next-head - (save-excursion - (goto-char next-head) - (forward-line -1) - (point)))) - (maxpoint (or end (point-max)))) - (while (< (point) maxpoint) - (helm-mark-current-line) - (let ((cand (helm-get-selection nil 'withprop src))) - (when (and (not (helm-this-visible-mark)) - (eq (get-text-property 0 'type cand) type)) - (helm-make-visible-mark))) - (forward-line 1) (end-of-line)))) + (sel (helm-get-selection nil 'withprop src)) + (type (or type (get-text-property + (min 2 (length sel)) 'type sel)))) + (helm-map-candidates-in-source src + (lambda (_cand) (helm-make-visible-mark)) + (lambda (cand) + (and (not (helm-this-visible-mark)) + (eq (get-text-property 2 'type cand) type)))) (helm-mark-current-line) (helm-display-mode-line src t) (when helm-marked-candidates @@ -732,7 +725,7 @@ I.e. same color." for p in (helm-mm-split-pattern pat) when (string-match "\\`@\\(.*\\)" p) collect (match-string 1 p) into lst - finally return (mapconcat 'identity lst " "))) + finally return (mapconcat #'identity lst " "))) (patterns (helm-mm-3-get-patterns pattern))) (if (and buf patterns) (with-current-buffer buf @@ -809,13 +802,9 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (user-error "Buffer `%s' is not associated to a file" (buffer-name buf)))))) -(defun helm-buffer-diff-persistent () +(helm-make-persistent-command-from-action helm-buffer-diff-persistent "Toggle diff buffer without quitting helm." - (interactive) - (with-helm-alive-p - (helm-set-attr 'diff-action 'helm-buffer-toggle-diff) - (helm-execute-persistent-action 'diff-action))) -(put 'helm-buffer-diff-persistent 'helm-only t) + 'diff-action 'helm-buffer-toggle-diff) (defun helm-revert-buffer (candidate) (with-current-buffer candidate @@ -823,7 +812,7 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (and (file-exists-p it) (revert-buffer t t))))) (defun helm-revert-marked-buffers (_ignore) - (mapc 'helm-revert-buffer (helm-marked-candidates))) + (mapc #'helm-revert-buffer (helm-marked-candidates))) (defun helm-buffer-revert-and-update (_candidate) (with-helm-buffer @@ -834,13 +823,9 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (when helm-marked-candidates (helm-unmark-all)) (helm-force-update preselect)))) -(defun helm-buffer-revert-persistent () +(helm-make-persistent-command-from-action helm-buffer-revert-persistent "Revert buffer without quitting helm." - (interactive) - (with-helm-alive-p - (helm-set-attr 'revert-action '(helm-buffer-revert-and-update . never-split)) - (helm-execute-persistent-action 'revert-action))) -(put 'helm-buffer-revert-persistent 'helm-only t) + 'revert-action 'helm-buffer-revert-and-update) (defun helm-buffer-save-and-update (_candidate) (with-helm-buffer @@ -858,32 +843,21 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (helm-buffers-mark-similar-buffers-1 'mod) (helm-buffer-save-and-update nil)) -(defun helm-buffer-run-save-some-buffers () +(helm-make-persistent-command-from-action helm-buffer-run-save-some-buffers "Save unsaved file buffers without quitting Helm." - (interactive) - (with-helm-alive-p - (helm-set-attr 'save-some-action '(helm-buffer-save-some-buffers . never-split)) - (helm-execute-persistent-action 'save-some-action))) -(put 'helm-buffer-run-save-some-buffers 'helm-only t) + 'save-some-action 'helm-buffer-save-some-buffers) -(defun helm-buffer-save-persistent () +(helm-make-persistent-command-from-action helm-buffer-save-persistent "Save buffer without quitting Helm." - (interactive) - (with-helm-alive-p - (helm-set-attr 'save-action '(helm-buffer-save-and-update . never-split)) - (helm-execute-persistent-action 'save-action))) -(put 'helm-buffer-save-persistent 'helm-only t) +'save-action 'helm-buffer-save-and-update) (defun helm-buffers-rename-buffer (candidate) (with-current-buffer candidate (rename-buffer (helm-read-string "New name: " (buffer-name)) t))) -(defun helm-buffer-run-rename-buffer () +(helm-make-command-from-action helm-buffer-run-rename-buffer "Run rename buffer action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffers-rename-buffer))) -(put 'helm-buffer-run-rename-buffer 'helm-only t) + 'helm-buffers-rename-buffer) (defun helm-switch-to-buffer-at-linum (candidate) (let ((linum (read-number @@ -894,20 +868,13 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (goto-char (point-min)) (forward-line (1- linum)))) -(defun helm-buffer-run-goto-line () +(helm-make-command-from-action helm-buffer-run-goto-line "Switch to buffer at line number." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-switch-to-buffer-at-linum))) -(put 'helm-buffer-run-goto-line 'helm-only t) + 'helm-switch-to-buffer-at-linum) -(defun helm-buffer-run-kill-persistent () +(helm-make-persistent-command-from-action helm-buffer-run-kill-persistent "Kill buffer without quitting Helm." - (interactive) - (with-helm-alive-p - (helm-set-attr 'kill-action '(helm-buffers-persistent-kill . never-split)) - (helm-execute-persistent-action 'kill-action))) -(put 'helm-buffer-run-kill-persistent 'helm-only t) + 'kill-action 'helm-buffers-persistent-kill) (defun helm-kill-marked-buffers (_ignore) (let* ((bufs (helm-marked-candidates)) @@ -918,47 +885,40 @@ If REGEXP-FLAG is given use `query-replace-regexp'." helm-visible-mark-overlays nil))) (message "Killed %s buffer(s)" killed-bufs))) -(defun helm-buffer-run-kill-buffers () +(helm-make-command-from-action helm-buffer-run-kill-buffers "Run kill buffer action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-kill-marked-buffers))) -(put 'helm-buffer-run-kill-buffers 'helm-only t) + 'helm-kill-marked-buffers) -(defun helm-buffer-run-grep () +(defun helm-buffer-switch-to-shell (candidate) + (require 'helm-files) + (let ((helm-ff-default-directory + (with-current-buffer candidate + default-directory))) + (helm-ff-switch-to-shell nil))) + +(helm-make-command-from-action helm-buffer-run-switch-to-shell + "Run switch to shell action from helm-buffers-list." + 'helm-buffer-switch-to-shell) + +(helm-make-command-from-action helm-buffer-run-grep "Run Grep action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-grep-buffers))) -(put 'helm-buffer-run-grep 'helm-only t) + 'helm-grep-buffers) -(defun helm-buffer-run-zgrep () +(helm-make-command-from-action helm-buffer-run-zgrep "Run Grep action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-zgrep-buffers))) -(put 'helm-buffer-run-zgrep 'helm-only t) + 'helm-zgrep-buffers) -(defun helm-buffer-run-query-replace-regexp () +(helm-make-command-from-action helm-buffer-run-query-replace-regexp "Run Query replace regexp action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffer-query-replace-regexp))) -(put 'helm-buffer-run-query-replace-regexp 'helm-only t) +'helm-buffer-query-replace-regexp) -(defun helm-buffer-run-query-replace () +(helm-make-command-from-action helm-buffer-run-query-replace "Run Query replace action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffer-query-replace))) -(put 'helm-buffer-run-query-replace 'helm-only t) +'helm-buffer-query-replace) -(defun helm-buffer-switch-other-window () +(helm-make-command-from-action helm-buffer-switch-other-window "Run switch to other window action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffer-switch-buffers-other-window))) -(put 'helm-buffer-switch-other-window 'helm-only t) + 'helm-buffer-switch-buffers-other-window) (defun helm-buffer-switch-to-buffer-other-frame (_candidate) "Display marked buffers in other frame." @@ -974,12 +934,9 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (with-selected-frame oframe (switch-to-buffer candidate)))) -(defun helm-buffer-switch-other-frame () +(helm-make-command-from-action helm-buffer-switch-other-frame "Run switch to other frame action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffer-switch-to-buffer-other-frame))) -(put 'helm-buffer-switch-other-frame 'helm-only t) + 'helm-buffer-switch-to-buffer-other-frame) (defun helm-buffers-switch-to-buffer-other-tab (_candidate) (when (fboundp 'switch-to-buffer-other-tab) @@ -987,13 +944,10 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (cl-loop for buf in bufs do (switch-to-buffer-other-tab buf))))) -(defun helm-buffers-switch-to-buffer-new-tab () +(helm-make-command-from-action helm-buffers-switch-to-buffer-new-tab "Run switch to buffer in other tab action from `helm-source-buffers-list'." - (interactive) - (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available") - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-buffers-switch-to-buffer-other-tab))) -(put 'helm-buffers-switch-to-buffer-new-tab 'helm-only t) + 'helm-buffers-switch-to-buffer-other-tab + (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available")) (defun helm-buffer-switch-buffers (_candidate) "Switch to buffer candidates and replace current buffer. @@ -1009,19 +963,13 @@ vertically." (let ((buffers (helm-marked-candidates))) (helm-window-show-buffers buffers t))) -(defun helm-buffer-run-ediff () +(helm-make-command-from-action helm-buffer-run-ediff "Run ediff action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ediff-marked-buffers))) -(put 'helm-buffer-run-ediff 'helm-only t) + 'helm-ediff-marked-buffers) -(defun helm-buffer-run-ediff-merge () +(helm-make-command-from-action helm-buffer-run-ediff-merge "Run ediff action from `helm-source-buffers-list'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ediff-marked-buffers-merge))) -(put 'helm-buffer-run-ediff-merge 'helm-only t) + 'helm-ediff-marked-buffers-merge) (defun helm-buffers-persistent-kill-1 (buffer-or-name) "Persistent action to kill buffer." @@ -1127,12 +1075,9 @@ Can be used by any source that list buffers." (match-string 1 i))))) (helm-multi-occur-1 buffers input))) -(defun helm-buffers-run-occur () +(helm-make-command-from-action helm-buffers-run-occur "Run `helm-multi-occur-as-action' by key." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-multi-occur-as-action))) -(put 'helm-buffers-run-occur 'helm-only t) + 'helm-multi-occur-as-action) (defun helm-buffers-toggle-show-hidden-buffers () (interactive) @@ -1159,13 +1104,11 @@ Can be used by any source that list buffers." (with-current-buffer buf (helm-browse-project helm-current-prefix-arg))) -(defun helm-buffers-run-browse-project () - "Run `helm-buffers-browse-project' from key." - (interactive) - (with-helm-alive-p - (if helm-buffers-in-project-p - (user-error "You are already browsing this project") - (helm-exit-and-execute-action 'helm-buffers-browse-project)))) +(helm-make-command-from-action helm-buffers-run-browse-project + "Run `helm-buffers-browse-project' from key." + 'helm-buffers-browse-project + (cl-assert (not helm-buffers-in-project-p) + nil "You are already browsing this project")) (defun helm-buffers-quit-and-find-file-fn (source) (let* ((sel (helm-get-selection nil nil source)) @@ -1208,7 +1151,6 @@ displayed with the `file-name-shadow' face if available." (helm :sources '(helm-source-buffers-list helm-source-buffer-not-found) :buffer "*helm buffers*" - :keymap helm-buffer-map :truncate-lines helm-buffers-truncate-lines :left-margin-width helm-buffers-left-margin-width)) diff --git a/elpa/helm-20220616.1004/helm-color.el b/elpa/helm-20230806.1956/helm-color.el similarity index 81% rename from elpa/helm-20220616.1004/helm-color.el rename to elpa/helm-20230806.1956/helm-color.el index 639c3ec7..f6369185 100644 --- a/elpa/helm-20220616.1004/helm-color.el +++ b/elpa/helm-20230806.1956/helm-color.el @@ -1,6 +1,6 @@ ;;; helm-color.el --- colors and faces -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -86,37 +86,29 @@ (defun helm-color-kill-rgb (candidate) (kill-new (helm-colors-get-rgb candidate))) -(defun helm-color-run-insert-name () +(helm-make-command-from-action helm-color-run-insert-name "Insert name of color from `helm-source-colors'." - (interactive) - (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-name))) -(put 'helm-color-run-insert-name 'helm-only t) + 'helm-color-insert-name) -(defun helm-color-run-kill-name () +(helm-make-command-from-action helm-color-run-kill-name "Kill name of color from `helm-source-colors'." - (interactive) - (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-name))) -(put 'helm-color-run-kill-name 'helm-only t) + 'helm-color-kill-name) -(defun helm-color-run-insert-rgb () +(helm-make-command-from-action helm-color-run-insert-rgb "Insert RGB of color from `helm-source-colors'." - (interactive) - (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-insert-rgb))) -(put 'helm-color-run-insert-rgb 'helm-only t) + 'helm-color-insert-rgb) -(defun helm-color-run-kill-rgb () +(helm-make-command-from-action helm-color-run-kill-rgb "Kill RGB of color from `helm-source-colors'." - (interactive) - (with-helm-alive-p (helm-exit-and-execute-action 'helm-color-kill-rgb))) -(put 'helm-color-run-kill-rgb 'helm-only t) + 'helm-color-kill-rgb) (defvar helm-color-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "C-c n") 'helm-color-run-insert-name) - (define-key map (kbd "C-c N") 'helm-color-run-kill-name) - (define-key map (kbd "C-c r") 'helm-color-run-insert-rgb) - (define-key map (kbd "C-c R") 'helm-color-run-kill-rgb) + (define-key map (kbd "C-c n") #'helm-color-run-insert-name) + (define-key map (kbd "C-c N") #'helm-color-run-kill-name) + (define-key map (kbd "C-c r") #'helm-color-run-insert-rgb) + (define-key map (kbd "C-c R") #'helm-color-run-kill-rgb) map)) (defvar helm-source-colors diff --git a/elpa/helm-20220616.1004/helm-comint.el b/elpa/helm-20230806.1956/helm-comint.el similarity index 90% rename from elpa/helm-20220616.1004/helm-comint.el rename to elpa/helm-20230806.1956/helm-comint.el index 6f85249b..ec5c1fc9 100644 --- a/elpa/helm-20220616.1004/helm-comint.el +++ b/elpa/helm-20230806.1956/helm-comint.el @@ -80,8 +80,8 @@ you will not have anymore separators between candidates." (defvar helm-comint-prompts-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "C-c o") 'helm-comint-prompts-other-window) - (define-key map (kbd "C-c C-o") 'helm-comint-prompts-other-frame) + (define-key map (kbd "C-c o") #'helm-comint-prompts-other-window) + (define-key map (kbd "C-c C-o") #'helm-comint-prompts-other-frame) map) "Keymap for `helm-comint-prompt-all'.") @@ -102,7 +102,7 @@ If BUFFER is nil, use current buffer." (funcall it) (comint-next-prompt 1))) (push (list (buffer-substring-no-properties - it (point-at-eol)) + it (pos-eol)) it (buffer-name) count) result) (setq count (1+ count)))) @@ -149,27 +149,23 @@ See `helm-comint-prompts-list'." (defun helm-comint-prompts-goto-other-frame (candidate) (helm-comint-prompts-goto candidate 'switch-to-buffer-other-frame)) -(defun helm-comint-prompts-other-window () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-comint-prompts-goto-other-window))) -(put 'helm-comint-prompts-other-window 'helm-only t) +(helm-make-command-from-action helm-comint-prompts-other-window + "Switch to comint prompt in other window." + 'helm-comint-prompts-goto-other-window) -(defun helm-comint-prompts-other-frame () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-comint-prompts-goto-other-frame))) -(put 'helm-comint-prompts-other-frame 'helm-only t) +(helm-make-command-from-action helm-comint-prompts-other-frame + "Switch to comint prompt in other frame." + 'helm-comint-prompts-goto-other-frame) ;;;###autoload (defun helm-comint-prompts () "Pre-configured `helm' to browse the prompts of the current comint buffer." (interactive) - (if (apply 'derived-mode-p helm-comint-mode-list) + (if (apply #'derived-mode-p helm-comint-mode-list) (helm :sources (helm-build-sync-source "Comint prompts" :candidates (helm-comint-prompts-list major-mode) - :candidate-transformer 'helm-comint-prompts-transformer + :candidate-transformer #'helm-comint-prompts-transformer :action '(("Go to prompt" . helm-comint-prompts-goto))) :buffer "*helm comint prompts*") (message "Current buffer is not a comint buffer"))) @@ -178,11 +174,11 @@ See `helm-comint-prompts-list'." (defun helm-comint-prompts-all () "Pre-configured `helm' to browse the prompts of all comint sessions." (interactive) - (if (apply 'derived-mode-p helm-comint-mode-list) + (if (apply #'derived-mode-p helm-comint-mode-list) (helm :sources (helm-build-sync-source "All comint prompts" :candidates (helm-comint-prompts-list-all major-mode) - :candidate-transformer 'helm-comint-prompts-all-transformer + :candidate-transformer #'helm-comint-prompts-all-transformer :action (quote (("Go to prompt" . helm-comint-prompts-goto) ("Go to prompt in other window `C-c o`" . helm-comint-prompts-goto-other-window) @@ -222,7 +218,7 @@ See `helm-comint-prompts-list'." (member major-mode helm-comint-mode-list)) (helm :sources 'helm-source-comint-input-ring :input (buffer-substring-no-properties (comint-line-beginning-position) - (point-at-eol)) + (pos-eol)) :buffer "*helm comint history*"))) (provide 'helm-comint) diff --git a/elpa/helm-20220616.1004/helm-command.el b/elpa/helm-20230806.1956/helm-command.el similarity index 93% rename from elpa/helm-20220616.1004/helm-command.el rename to elpa/helm-20230806.1956/helm-command.el index ef0c0643..f0e922f3 100644 --- a/elpa/helm-20220616.1004/helm-command.el +++ b/elpa/helm-20230806.1956/helm-command.el @@ -1,6 +1,6 @@ ;;; helm-command.el --- Helm execute-exended-command. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -23,6 +23,15 @@ (require 'helm-mode) (require 'helm-elisp) + +(defvar helm-M-x-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-comp-read-map) + (define-key map (kbd "C-u") nil) + (define-key map (kbd "C-u") #'helm-M-x-universal-argument) + (define-key map (kbd "C-]") #'helm-M-x-toggle-short-doc) + map)) + (defgroup helm-command nil "Emacs command related Applications and libraries for Helm." @@ -30,32 +39,20 @@ (defcustom helm-M-x-always-save-history nil "`helm-M-x' save command in `extended-command-history' even when it fails." - :group 'helm-command :type 'boolean) (defcustom helm-M-x-reverse-history nil "The history source of `helm-M-x' appear in second position when non-nil." - :group 'helm-command :type 'boolean) (defcustom helm-M-x-fuzzy-match t "Helm-M-x fuzzy matching when non nil." - :group 'helm-command :type 'boolean) -(defvar helm-M-x-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-comp-read-map) - (define-key map (kbd "C-u") nil) - (define-key map (kbd "C-u") 'helm-M-x-universal-argument) - (define-key map (kbd "C-]") 'helm-M-x-toggle-short-doc) - map)) - (defcustom helm-M-x-show-short-doc nil "Show short docstring of command when non nil. This value can be toggled with \\\\[helm-M-x-toggle-short-doc] while in helm-M-x session." - :group 'helm-command :type 'boolean) @@ -125,7 +122,7 @@ Return nil if no mode-map found." "Toggle short doc display in helm-M-x." (interactive) (setq helm-M-x-show-short-doc (not helm-M-x-show-short-doc)) - (helm-update (concat "^" (helm-get-selection)) (helm-get-current-source))) + (helm-force-update (concat "^" (helm-get-selection)) (helm-get-current-source))) (put 'helm-M-x-toggle-short-doc 'no-helm-mx t) (defun helm-M-x-transformer-1 (candidates &optional sort ignore-props) @@ -158,7 +155,7 @@ algorithm." (cons (cond ((and (string-match "^M-x" key) local-key) (format "%s%s%s %s" disp - (if doc (make-string (+ 4 (- max-len (length cand))) ? ) "") + (if doc (make-string (+ 1 (- max-len (length cand))) ? ) "") (if doc (propertize doc 'face 'helm-M-x-short-doc) "") (propertize " " 'display @@ -166,11 +163,11 @@ algorithm." ((string-match "^M-x" key) (format "%s%s%s" disp - (if doc (make-string (+ 4 (- max-len (length cand))) ? ) "") + (if doc (make-string (+ 1 (- max-len (length cand))) ? ) "") (if doc (propertize doc 'face 'helm-M-x-short-doc) ""))) (t (format "%s%s%s %s" disp - (if doc (make-string (+ 4 (- max-len (length cand))) ? ) "") + (if doc (make-string (+ 1 (- max-len (length cand))) ? ) "") (if doc (propertize doc 'face 'helm-M-x-short-doc) "") (propertize " " 'display @@ -203,7 +200,7 @@ algorithm." (save-excursion (beginning-of-defun) (cadr (split-string (buffer-substring-no-properties - (point-at-bol) (point-at-eol)))))) + (pos-bol) (pos-eol)))))) (defun helm-cmd--get-preconfigured-commands (&optional dir) (let* ((helm-dir (or dir (helm-basedir (locate-library "helm")))) @@ -240,7 +237,7 @@ algorithm." (defun helm-M-x--before-action-hook () (remove-hook 'helm-move-selection-after-hook - 'helm-M-x--move-selection-after-hook)) + #'helm-M-x--move-selection-after-hook)) (defclass helm-M-x-class (helm-source-in-buffer helm-type-command) ((requires-pattern :initform 0) @@ -257,7 +254,7 @@ algorithm." (when (and helm-M-x--timer (timerp helm-M-x--timer)) (cancel-timer helm-M-x--timer) (setq helm-M-x--timer nil)) - (setq helm-M-x--timer (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg)) + (setq helm-M-x--timer (run-at-time 1 0.1 #'helm-M-x--notify-prefix-arg)) (setq helm--mode-line-display-prefarg t) ;; Prevent displaying a wrong prefix arg when helm-resume is called ;; from prefix arg. @@ -304,20 +301,21 @@ default to `extended-command-history'." (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 ") + (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 "))) - (setq helm-M-x--timer (run-at-time 1 0.1 'helm-M-x--notify-prefix-arg)) + (setq helm-M-x--timer (run-at-time 1 0.1 #'helm-M-x--notify-prefix-arg)) ;; Fix Bug#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) + #'helm-M-x--move-selection-after-hook) (add-hook 'helm-before-action-hook - 'helm-M-x--before-action-hook) + #'helm-M-x--before-action-hook) (when (and sources helm-M-x-reverse-history) (setq sources (nreverse sources))) (unwind-protect @@ -326,7 +324,8 @@ default to `extended-command-history'." (helm :sources sources :prompt prompt :buffer "*helm M-x*" - :history 'helm-M-x-input-history)) + :history 'helm-M-x-input-history + :truncate-lines t)) (helm-M-x--unwind-forms)))) ;; When running a command involving again helm from helm-M-x, the @@ -346,9 +345,9 @@ default to `extended-command-history'." helm-fuzzy-sort-fn (default-toplevel-value 'helm-fuzzy-sort-fn)) ;; 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) + #'helm-M-x--move-selection-after-hook) (remove-hook 'helm-before-action-hook - 'helm-M-x--before-action-hook)) + #'helm-M-x--before-action-hook)) ;; Reset helm-M-x--unwind-forms-done to nil when DONE is ;; unspecified. (setq helm-M-x--unwind-forms-done done)) diff --git a/elpa/helm-20220616.1004/helm-dabbrev.el b/elpa/helm-20230806.1956/helm-dabbrev.el similarity index 97% rename from elpa/helm-20220616.1004/helm-dabbrev.el rename to elpa/helm-20230806.1956/helm-dabbrev.el index f214c50f..a36d7c8b 100644 --- a/elpa/helm-20220616.1004/helm-dabbrev.el +++ b/elpa/helm-20230806.1956/helm-dabbrev.el @@ -1,6 +1,6 @@ ;;; helm-dabbrev.el --- Helm implementation of dabbrev. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -31,7 +31,6 @@ 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 @@ -45,13 +44,11 @@ Note that this have nothing to do with candidates stop when this value is reached but only `helm-candidate-number-limit' candidates are displayed in the Helm buffer." - :group 'helm-dabbrev :type 'integer) (defcustom helm-dabbrev-ignored-buffers-regexps '("\\*helm" "\\*Messages" "\\*Echo Area" "\\*Buffer List") "List of regexps matching names of buffers that `helm-dabbrev' should not check." - :group 'helm-dabbrev :type '(repeat regexp)) (defcustom helm-dabbrev-related-buffer-fn #'helm-dabbrev--same-major-mode-p @@ -64,7 +61,6 @@ The function take one arg, the buffer which is current, look at `helm-dabbrev--same-major-mode-p' for an example. When nil all buffers are considered related to `current-buffer'." - :group 'helm-dabbrev :type 'function) (defcustom helm-dabbrev-major-mode-assoc nil @@ -84,18 +80,15 @@ the `current-buffer'. This has no effect when `helm-dabbrev-related-buffer-fn' is nil or of course bound to a function that doesn't handle this var." - :type '(alist :key-type symbol :value-type symbol) - :group 'helm-dabbrev) + :type '(alist :key-type symbol :value-type symbol)) (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 @@ -103,7 +96,6 @@ When nil or 0 disable cycling." 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))) @@ -113,15 +105,15 @@ initial search for all candidates in buffer(s)." '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\\|^" + "\\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) + (define-key map (kbd "M-/") #'helm-next-line) + (define-key map (kbd "M-:") #'helm-previous-line) map)) ;; Internal @@ -245,7 +237,7 @@ The search starts at (1- BEG) with a regexp starting with regexp matching syntactically any word or symbol. The possible false positives matching SEP-REGEXP at end are finally removed." - (let ((eol (point-at-eol))) + (let ((eol (pos-eol))) (save-excursion (goto-char (1- beg)) (when (re-search-forward @@ -277,7 +269,7 @@ finally removed." (end (point))) (run-with-timer 0.01 nil - 'helm-insert-completion-at-point + #'helm-insert-completion-at-point beg end candidate)))) ;;;###autoload diff --git a/elpa/helm-20220616.1004/helm-easymenu.el b/elpa/helm-20230806.1956/helm-easymenu.el similarity index 100% rename from elpa/helm-20220616.1004/helm-easymenu.el rename to elpa/helm-20230806.1956/helm-easymenu.el diff --git a/elpa/helm-20220616.1004/helm-elisp-package.el b/elpa/helm-20230806.1956/helm-elisp-package.el similarity index 90% rename from elpa/helm-20220616.1004/helm-elisp-package.el rename to elpa/helm-20230806.1956/helm-elisp-package.el index 258253a7..01f531ed 100644 --- a/elpa/helm-20220616.1004/helm-elisp-package.el +++ b/elpa/helm-20230806.1956/helm-elisp-package.el @@ -1,6 +1,6 @@ ;;; helm-elisp-package.el --- helm interface for package.el -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -27,7 +27,6 @@ (defcustom helm-el-package-initial-filter 'all "Show only installed, upgraded or all packages at startup." - :group 'helm-el-package :type '(radio :tag "Initial filter for elisp packages" (const :tag "Show all packages" all) (const :tag "Show installed packages" installed) @@ -36,19 +35,16 @@ (defcustom helm-el-truncate-lines t "Truncate lines in `helm-buffer' when non-nil." - :group 'helm-el-package :type 'boolean) (defcustom helm-el-package-upgrade-on-start nil "Show package upgrades on startup when non nil." - :group 'helm-el-package :type 'boolean) (defcustom helm-el-package-autoremove-on-start nil "Try to autoremove no more needed packages on startup. See `package-autoremove'." - :group 'helm-el-package :type 'boolean) ;; internals vars @@ -132,11 +128,9 @@ See `package-autoremove'." (propertize (symbol-name pkg) 'face 'font-lock-keyword-face))))) -(defun helm-el-run-visit-homepage () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-el-package-visit-homepage))) -(put 'helm-el-run-visit-homepage 'helm-only t) +(helm-make-command-from-action helm-el-run-visit-homepage + "Visit package homepage from helm elisp packages." + 'helm-el-package-visit-homepage) (defun helm-elisp-package--pkg-name (pkg) (if (package-desc-p pkg) @@ -164,11 +158,9 @@ See `package-autoremove'." (defun helm-el-package-install (_candidate) (helm-el-package-install-1 (helm-marked-candidates))) -(defun helm-el-run-package-install () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-el-package-install))) -(put 'helm-el-run-package-install 'helm-only t) +(helm-make-command-from-action helm-el-run-package-install + "Install package from helm elisp packages." + 'helm-el-package-install) (defun helm-el-package-uninstall-1 (pkg-list &optional force) (cl-loop with mkd = pkg-list @@ -193,11 +185,9 @@ See `package-autoremove'." (defun helm-el-package-uninstall (_candidate) (helm-el-package-uninstall-1 (helm-marked-candidates) helm-current-prefix-arg)) -(defun helm-el-run-package-uninstall () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-el-package-uninstall))) -(put 'helm-el-run-package-uninstall 'helm-only t) +(helm-make-command-from-action helm-el-run-package-uninstall + "Uninstall package from helm elisp packages." + 'helm-el-package-uninstall) (defun helm-el-package-menu--find-upgrades () (cl-loop for entry in helm-el-package--tabulated-list @@ -266,11 +256,9 @@ See `package-autoremove'." if (member (symbol-name (package-desc-name pkg)) pkgs) collect p))) -(defun helm-el-run-package-upgrade () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-el-package-upgrade))) -(put 'helm-el-run-package-upgrade 'helm-only t) +(helm-make-command-from-action helm-el-run-package-upgrade + "Uninstall package from helm elisp packages." + 'helm-el-package-upgrade) (defun helm-el-package-upgrade-all () (if helm-el-package--upgrades @@ -286,11 +274,9 @@ See `package-autoremove'." (defun helm-el-package-upgrade-all-action (_candidate) (helm-el-package-upgrade-all)) -(defun helm-el-run-package-upgrade-all () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-el-package-upgrade-all-action))) -(put 'helm-el-run-package-upgrade-all 'helm-only t) +(helm-make-command-from-action helm-el-run-package-upgrade-all + "Upgrade all packages from helm elisp packages." + 'helm-el-package-upgrade-all-action) (defun helm-el-package--transformer (candidates _source) (cl-loop for c in candidates @@ -298,10 +284,13 @@ See `package-autoremove'." for id = (get-text-property 0 'tabulated-list-id c) for name = (and id (package-desc-name id)) for desc = (package-desc-status id) + ;; 'source' means package installed with `package-vc-install' (only + ;; Emacs-29+). for built-in-p = (and (package-built-in-p name) (not (member desc '("available" "new" - "installed" "dependency")))) - for installed-p = (member desc '("installed" "dependency")) + "installed" "dependency" + "source")))) + for installed-p = (member desc '("installed" "dependency" "source")) for upgrade-p = (assq name helm-el-package--upgrades) for user-installed-p = (memq name package-selected-packages) do (when (and user-installed-p (not upgrade-p)) @@ -365,17 +354,17 @@ See `package-autoremove'." (defvar helm-el-package-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "M-I") 'helm-el-package-show-installed) - (define-key map (kbd "M-O") 'helm-el-package-show-uninstalled) - (define-key map (kbd "M-U") 'helm-el-package-show-upgrade) - (define-key map (kbd "M-B") 'helm-el-package-show-built-in) - (define-key map (kbd "M-A") 'helm-el-package-show-all) - (define-key map (kbd "C-c i") 'helm-el-run-package-install) - (define-key map (kbd "C-c r") 'helm-el-run-package-reinstall) - (define-key map (kbd "C-c d") 'helm-el-run-package-uninstall) - (define-key map (kbd "C-c u") 'helm-el-run-package-upgrade) - (define-key map (kbd "C-c U") 'helm-el-run-package-upgrade-all) - (define-key map (kbd "C-c @") 'helm-el-run-visit-homepage) + (define-key map (kbd "M-I") #'helm-el-package-show-installed) + (define-key map (kbd "M-O") #'helm-el-package-show-uninstalled) + (define-key map (kbd "M-U") #'helm-el-package-show-upgrade) + (define-key map (kbd "M-B") #'helm-el-package-show-built-in) + (define-key map (kbd "M-A") #'helm-el-package-show-all) + (define-key map (kbd "C-c i") #'helm-el-run-package-install) + (define-key map (kbd "C-c r") #'helm-el-run-package-reinstall) + (define-key map (kbd "C-c d") #'helm-el-run-package-uninstall) + (define-key map (kbd "C-c u") #'helm-el-run-package-upgrade) + (define-key map (kbd "C-c U") #'helm-el-run-package-upgrade-all) + (define-key map (kbd "C-c @") #'helm-el-run-visit-homepage) map)) (defvar helm-source-list-el-package nil) @@ -464,11 +453,9 @@ See `package-autoremove'." (package-install (cadr (assq name package-archive-contents)) t))) -(defun helm-el-run-package-reinstall () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-el-package-reinstall))) -(put 'helm-el-run-package-reinstall 'helm-only t) +(helm-make-command-from-action helm-el-run-package-reinstall + "Reinstall package from helm elisp packages." + 'helm-el-package-reinstall) ;;;###autoload (defun helm-list-elisp-packages (arg) diff --git a/elpa/helm-20220616.1004/helm-elisp.el b/elpa/helm-20230806.1956/helm-elisp.el similarity index 83% rename from elpa/helm-20220616.1004/helm-elisp.el rename to elpa/helm-20230806.1956/helm-elisp.el index 03a0d77e..1080ed39 100644 --- a/elpa/helm-20220616.1004/helm-elisp.el +++ b/elpa/helm-20230806.1956/helm-elisp.el @@ -1,6 +1,6 @@ ;;; helm-elisp.el --- Elisp symbols completion for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -223,7 +223,7 @@ If `helm-turn-on-show-completion' is nil do nothing." (or (and (eq (char-before) ?\ ) (save-excursion - (skip-syntax-backward " " (point-at-bol)) + (skip-syntax-backward " " (pos-bol)) (memq (symbol-at-point) helm-lisp-unquoted-function-list))) (and (eq (char-before) ?\') @@ -241,7 +241,7 @@ If `helm-turn-on-show-completion' is nil do nothing." (and (eq (char-before) ?\') (save-excursion (forward-char (if (funcall fn-sym-p) -2 -1)) - (skip-syntax-backward " " (point-at-bol)) + (skip-syntax-backward " " (pos-bol)) (memq (symbol-at-point) helm-lisp-quoted-function-list))) (eq (char-before) ?\())) ; no paren before str. @@ -263,7 +263,7 @@ of symbol before point." (save-excursion (let (beg (end (point)) - (boundary (field-beginning nil nil (point-at-bol)))) + (boundary (field-beginning nil nil (pos-bol)))) (if (re-search-backward (or regexp "\\_<") boundary t) (setq beg (match-end 0)) (setq beg boundary)) @@ -331,12 +331,12 @@ Return a cons (beg . end)." :fuzzy-match helm-lisp-fuzzy-completion :persistent-help (helm-lisp-completion-persistent-help) :filtered-candidate-transformer - 'helm-lisp-completion-transformer + #'helm-lisp-completion-transformer :action (lambda (candidate) (with-helm-current-buffer (run-with-timer 0.01 nil - 'helm-insert-completion-at-point + #'helm-insert-completion-at-point beg end candidate)))) :input (if helm-lisp-fuzzy-completion target (concat target " ")) @@ -406,6 +406,7 @@ the same time to variable and a function." collect (cons (concat c spaces annot) c) into lst finally return (sort lst #'helm-generic-sort-fn))) +;;;###autoload (cl-defun helm-get-first-line-documentation (sym &optional (name "describe-function") (end-column 72)) @@ -413,27 +414,34 @@ the same time to variable and a function." If SYM is not documented, return \"Not documented\". Argument NAME allows specifiying what function to use to display documentation when SYM name is the same for function and variable." - (let ((doc (pcase sym - ((and (pred fboundp) (pred boundp)) - (pcase name - ("describe-function" - (documentation sym t)) - ("describe-variable" - (documentation-property sym 'variable-documentation t)) - (_ (documentation sym t)))) - ((pred fboundp) (documentation sym t)) - ((pred boundp) (documentation-property - sym 'variable-documentation t)) - ((pred facep) (face-documentation sym))))) + (let ((doc (condition-case _err + (pcase sym + ((and (pred fboundp) (pred boundp)) + (pcase name + ("describe-function" + (documentation sym t)) + ("describe-variable" + (documentation-property sym 'variable-documentation t)) + (_ (documentation sym t)))) + ((pred fboundp) (documentation sym t)) + ((pred boundp) (documentation-property + sym 'variable-documentation t)) + ((pred facep) (face-documentation sym))) + (void-function "Void function -- Not documented")))) (if (and doc (not (string= doc "")) ;; `documentation' return "\n\n(args...)" ;; for CL-style functions. - (not (string-match-p "^\n\n" doc))) + (not (string-match-p "\\`\n\n" doc))) ;; Some commands specify key bindings in their first line. (truncate-string-to-width (substitute-command-keys (car (split-string doc "\n"))) end-column nil nil t) - "Not documented"))) + (if (or (symbol-function sym) (boundp sym) (facep sym)) + "Not documented" + ;; Symbol exist but has no definition yet e.g. + ;; (advice-add 'foo-test :override (lambda () (message "invalid + ;; function"))) and foo-test is not already defined. + "Not already defined")))) ;;; File completion. ;; @@ -450,7 +458,7 @@ documentation when SYM name is the same for function and variable." (or force (save-excursion (end-of-line) - (search-backward tap (point-at-bol) t) + (search-backward tap (pos-bol) t) (setq beg (point)) (looking-back "[^'`( ]" (1- (point))))) (expand-file-name @@ -486,7 +494,7 @@ double quote." (let* ((tap (thing-at-point 'filename))) (if (and tap (save-excursion (end-of-line) - (search-backward tap (point-at-bol) t) + (search-backward tap (pos-bol) t) (looking-back "[^'`( ]" (1- (point))))) (helm-complete-file-name-at-point) (helm-lisp-completion-at-point)))) @@ -507,6 +515,12 @@ from `helm-commands-using-frame'." :group 'helm-elisp :type 'boolean) +(defvar helm-apropos-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-]") #'helm-apropos-toggle-details) + map)) + (defun helm-apropos-init (test default &optional fn) "Setup `helm-candidate-buffer' for `helm-apropos' sources. A list of symbols fetched with FN is inserted in @@ -523,20 +537,22 @@ is only used to test DEFAULT." symbols)))) (defun helm-apropos-short-doc-transformer (candidates _source) - (cl-loop with max-len = (buffer-local-value 'helm-candidate-buffer-longest-len - (get-buffer (helm-candidate-buffer))) - for cand in candidates - for doc = (helm-get-first-line-documentation (intern-soft cand)) - collect (cons (format "%s%s%s" - cand - (if doc - (make-string (+ 4 (if (zerop max-len) - max-len - (- max-len (string-width cand)))) - ? ) - "") - (if doc (propertize doc 'face 'helm-M-x-short-doc) "")) - cand))) + (if helm-apropos-show-short-doc + (cl-loop with max-len = (buffer-local-value 'helm-candidate-buffer-longest-len + (get-buffer (helm-candidate-buffer))) + for cand in candidates + for doc = (helm-get-first-line-documentation (intern-soft cand)) + collect (cons (format "%s%s%s" + cand + (if doc + (make-string (+ 1 (if (zerop max-len) + max-len + (- max-len (string-width cand)))) + ? ) + "") + (if doc (propertize doc 'face 'helm-M-x-short-doc) "")) + cand)) + candidates)) (defun helm-apropos-default-sort-fn (candidates _source) (if (string= helm-pattern "") @@ -582,7 +598,7 @@ is only used to test DEFAULT." (cond ((custom-variable-p sym) (append actions - (let ((standard-value (eval (car (get sym 'standard-value))))) + (let ((standard-value (eval (car (get sym 'standard-value)) t))) (unless (equal standard-value (symbol-value sym)) `(("Reset Variable to default value" . ,(lambda (candidate) @@ -610,13 +626,13 @@ is only used to test DEFAULT." (delq nil (list (and (null helm-apropos-fuzzy-match) 'helm-apropos-default-sort-fn) (and (null (memq 'helm-apropos helm-commands-using-frame)) - helm-apropos-show-short-doc #'helm-apropos-short-doc-transformer))) :nomark t :persistent-action (lambda (candidate) (helm-elisp--persistent-help candidate 'helm-describe-variable)) :persistent-help "Toggle describe variable" + :keymap helm-apropos-map :action '(("Describe variable" . helm-describe-variable) ("Find variable" . helm-find-variable) ("Info lookup" . helm-info-lookup-symbol) @@ -637,12 +653,12 @@ is only used to test DEFAULT." (cl-loop for c in candidates collect (propertize c 'face (intern c)))) (and (null (memq 'helm-apropos helm-commands-using-frame)) - helm-apropos-show-short-doc #'helm-apropos-short-doc-transformer))) :persistent-action (lambda (candidate) (helm-elisp--persistent-help candidate 'helm-describe-face)) :persistent-help "Toggle describe face" + :keymap helm-apropos-map :action '(("Describe face" . helm-describe-face) ("Find face" . helm-find-face-definition) ("Customize face" . (lambda (candidate) @@ -664,6 +680,7 @@ is only used to test DEFAULT." (helm-elisp--persistent-help candidate 'helm-describe-function)) :persistent-help "Toggle describe command" + :keymap helm-apropos-map :action 'helm-type-function-actions)) (defun helm-def-source--emacs-functions (&optional default) @@ -680,13 +697,13 @@ is only used to test DEFAULT." (delq nil (list (and (null helm-apropos-fuzzy-match) 'helm-apropos-default-sort-fn) (and (null (memq 'helm-apropos helm-commands-using-frame)) - helm-apropos-show-short-doc #'helm-apropos-short-doc-transformer))) :display-to-real 'helm-symbolify :persistent-action (lambda (candidate) (helm-elisp--persistent-help candidate 'helm-describe-function)) :persistent-help "Toggle describe function" + :keymap helm-apropos-map :nomark t :action 'helm-type-function-actions)) @@ -701,15 +718,15 @@ is only used to test DEFAULT." (delq nil (list (and (null helm-apropos-fuzzy-match) 'helm-apropos-default-sort-fn) (and (null (memq 'helm-apropos helm-commands-using-frame)) - helm-apropos-show-short-doc #'helm-apropos-short-doc-transformer))) :nomark t :persistent-action (lambda (candidate) (helm-elisp--persistent-help candidate 'helm-describe-class)) :persistent-help "Toggle describe class" + :keymap helm-apropos-map :action '(("Describe Class" . helm-describe-class) - ("Find Class" . helm-find-function) + ("Find Class (C-u for source)" . helm-find-function) ("Info lookup" . helm-info-lookup-symbol)))) (defun helm-def-source--eieio-generic (&optional default) @@ -723,15 +740,15 @@ is only used to test DEFAULT." (delq nil (list (and (null helm-apropos-fuzzy-match) 'helm-apropos-default-sort-fn) (and (null (memq 'helm-apropos helm-commands-using-frame)) - helm-apropos-show-short-doc #'helm-apropos-short-doc-transformer))) :nomark t :persistent-action (lambda (candidate) (helm-elisp--persistent-help candidate 'helm-describe-function)) :persistent-help "Toggle describe generic function" + :keymap helm-apropos-map :action '(("Describe function" . helm-describe-function) - ("Find function" . helm-find-function) + ("Find function (C-u for source)" . helm-find-function) ("Info lookup" . helm-info-lookup-symbol)))) (defun helm-info-lookup-fallback-source (candidate) @@ -775,13 +792,26 @@ is only used to test DEFAULT." ;; (run-with-idle-timer 0.01 nil #'helm-info-lookup-symbol-1 candidate) (helm-info-lookup-symbol-1 candidate)) +(defun helm-apropos-toggle-details () + "Toggle details in `helm-apropos'." + (interactive) + (with-helm-buffer + (unless (memq 'helm-apropos helm-commands-using-frame) + (setq helm-M-x-show-short-doc (not helm-M-x-show-short-doc) + helm-apropos-show-short-doc (not helm-apropos-show-short-doc)) + (helm-force-update (concat "^" (helm-stringify (helm-get-selection))) + (helm-get-current-source))))) + +(defun helm-apropos-get-default () + (with-syntax-table emacs-lisp-mode-syntax-table + (symbol-name (intern-soft (thing-at-point 'symbol))))) + ;;;###autoload (defun helm-apropos (default) "Preconfigured Helm to describe commands, functions, variables and faces. In non interactives calls DEFAULT argument should be provided as a string, i.e. the `symbol-name' of any existing symbol." - (interactive (list (with-syntax-table emacs-lisp-mode-syntax-table - (thing-at-point 'symbol)))) + (interactive (list (helm-apropos-get-default))) (let ((helm-M-x-show-short-doc (and helm-apropos-show-short-doc (null (memq 'helm-apropos helm-commands-using-frame))))) @@ -791,7 +821,8 @@ a string, i.e. the `symbol-name' of any existing symbol." helm-apropos-function-list) :history 'helm-apropos-history :buffer "*helm apropos*" - :preselect (and default (concat "\\_<" (regexp-quote default) "\\_>"))))) + :preselect (and default (concat "^\\_<" (regexp-quote default) "\\_>")) + :truncate-lines t))) ;;; Advices @@ -900,18 +931,108 @@ a string, i.e. the `symbol-name' of any existing symbol." :action (helm-actions-from-type-file)) :ff-transformer-show-only-basename nil :buffer "*helm locate library*")) - + +;;; Modify variables from Helm +;; +;; (defun helm-set-variable (var) "Set VAR value interactively." - (let* ((sym (helm-symbolify var)) - (val (default-value sym))) - (set-default sym (eval-minibuffer - (format "Set `%s': " var) - (if (or (stringp val) - (memq val '(nil t)) - (numberp val)) - (prin1-to-string val) - (format "'%s" (prin1-to-string val))))))) + (let* ((sym (helm-symbolify var)) + (val (default-value sym)) + (strv (prin1-to-string val))) + (if (> (length strv) 25) + (helm-edit-variable var) + (set-default sym (eval-minibuffer + (format "Set `%s': " var) + (if (or (arrayp val) + (memq val '(nil t)) + (numberp val)) + strv + (format "'%s" strv))))))) + +(defvar helm-edit-variable-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-c") 'helm-set-variable-from-pp-buffer) + (define-key map (kbd "C-c C-k") 'helm-edit-variable-quit) + (define-key map (kbd "C-c =") 'helm-edit-variable-toggle-diff) + map)) + +(define-derived-mode helm-edit-variable-mode + emacs-lisp-mode "helm-edit-variable" + "A mode to edit variables values. + +Special commands: +\\{helm-edit-variable-mode-map}") + +(defvar helm-pretty-print-temp-file-name + (expand-file-name "helm-edit-variable.el" temporary-file-directory)) +(defvar helm-pretty-print-buffer-name "*pretty print output*") +(defvar helm-pretty-print-current-symbol nil) +(defun helm-edit-variable (var) + (let* ((sym (intern-soft var)) + (val (symbol-value sym)) + (pp (pp-to-string val)) + start) + (with-current-buffer (get-buffer-create helm-pretty-print-buffer-name) + (erase-buffer) + (helm-edit-variable-mode) + (setq start (point)) + ;; Any number of lines starting with ";;;" + one empty line. + (insert (format ";;; Edit variable `%s' and hit C-c C-c when done\n" sym) + ";;; Abort with C-c C-k\n\n") + (add-text-properties start (1- (point)) '(read-only t)) + (add-text-properties (1- (point)) (point) '(read-only t rear-nonsticky t)) + (set (make-local-variable 'helm-pretty-print-current-symbol) sym) + (add-hook 'kill-buffer-hook + (lambda () + (when (file-exists-p helm-pretty-print-temp-file-name) + (delete-file helm-pretty-print-temp-file-name))) + nil t) + (save-excursion (insert pp)) + (write-region + (point-min) (point-max) helm-pretty-print-temp-file-name nil 1) + (setq buffer-file-name helm-pretty-print-temp-file-name)) + (display-buffer helm-pretty-print-buffer-name))) + +(defun helm-edit-variable-toggle-diff () + "Show diff in edit variable buffer." + (interactive) + (if (get-buffer-window "*Diff*" 'visible) + (kill-buffer "*Diff*") + (diff-buffer-with-file))) + +(defun helm-set-variable-from-pp-buffer () + "Set variable associated with buffer to buffer contents. + +The associated variable is the local variable +`helm-pretty-print-current-symbol'." + (interactive) + (with-current-buffer helm-pretty-print-buffer-name + (goto-char (point-min)) + (when (re-search-forward "^$" nil t) + (forward-line 1)) + (let ((val (symbol-value helm-pretty-print-current-symbol))) + (save-excursion + (if (or (arrayp val) + (memq val '(nil t)) + (numberp val) + (looking-at "[`']")) + (set-default helm-pretty-print-current-symbol + (read (current-buffer))) + (set-default helm-pretty-print-current-symbol + `(,@(read (current-buffer)))))) + (if (equal val (symbol-value helm-pretty-print-current-symbol)) + (message "No changes done") + (message "`%s' value modified" helm-pretty-print-current-symbol)) + (helm-edit-variable-quit)))) + +(defun helm-edit-variable-quit () + "Quit edit variable buffer." + (interactive) + (set-buffer-modified-p nil) + (quit-window t) + (helm-aif (get-buffer-window "*Diff*" 'visible) + (quit-window t it))) ;;; Elisp Timers. @@ -947,13 +1068,14 @@ a string, i.e. the `symbol-name' of any existing symbol." (if (timer--idle-delay timer) (format "idle-for=[%s]" (format-seconds "%dd %hh %mmin %z%,3ss" - (time-convert time t))) + (time-to-seconds time))) (format-time-string "%m/%d %T" time))) (or (timer--repeat-delay timer) "nil") - (mapconcat 'identity (split-string + (mapconcat #'identity (split-string (prin1-to-string (timer--function timer)) - "\n") " ") - (mapconcat 'prin1-to-string (timer--args timer) " "))) + "\n") + " ") + (mapconcat #'prin1-to-string (timer--args timer) " "))) ;;;###autoload (defun helm-timers () @@ -978,7 +1100,7 @@ a string, i.e. the `symbol-name' of any existing symbol." ;; 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))) + (eval (read helm-sexp--last-sexp) t)) (remove-hook 'called-interactively-p-functions #'helm-complex-command-history--called-interactively-skip))) diff --git a/elpa/helm-20220616.1004/helm-epa.el b/elpa/helm-20230806.1956/helm-epa.el similarity index 97% rename from elpa/helm-20220616.1004/helm-epa.el rename to elpa/helm-20230806.1956/helm-epa.el index 073b188a..2358455d 100644 --- a/elpa/helm-20220616.1004/helm-epa.el +++ b/elpa/helm-20230806.1956/helm-epa.el @@ -1,6 +1,6 @@ -;;; helm-epa.el --- helm interface for epa/epg +;;; helm-epa.el --- helm interface for epa/epg -*- lexical-binding: t; -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -170,7 +170,7 @@ (signal (car error) (cdr error)))) (message "Deleting gpg keys done"))) -(defun helm-epa-encrypt-file (candidate) +(defun helm-epa-encrypt-file (_candidate) "Select a file to encrypt with key CANDIDATE." (let* ((file (helm-read-file-name "Encrypt file: ")) (cands (helm-marked-candidates)) @@ -216,7 +216,7 @@ (epa-sign-region start end candidate mode)) (message "Mail signed with key `%s %s'" key id))) -(defun helm-epa-mail-encrypt (candidate) +(defun helm-epa-mail-encrypt (_candidate) "Encrypt email with key CANDIDATE." (let ((cands (helm-marked-candidates)) start end) diff --git a/elpa/helm-20220616.1004/helm-eshell.el b/elpa/helm-20230806.1956/helm-eshell.el similarity index 94% rename from elpa/helm-20220616.1004/helm-eshell.el rename to elpa/helm-20230806.1956/helm-eshell.el index 1b666796..b85e5015 100644 --- a/elpa/helm-20220616.1004/helm-eshell.el +++ b/elpa/helm-20230806.1956/helm-eshell.el @@ -1,6 +1,6 @@ ;;; helm-eshell.el --- pcomplete and eshell completion for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -50,21 +50,20 @@ (defcustom helm-eshell-fuzzy-match nil "Enable fuzzy matching in `helm-esh-pcomplete' when non-nil." - :group 'helm-eshell :type 'boolean) (defvar helm-eshell-history-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "M-p") 'helm-next-line) + (define-key map (kbd "M-p") #'helm-next-line) map) "Keymap for `helm-eshell-history'.") (defvar helm-esh-completion-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "TAB") 'helm-next-line) + (define-key map (kbd "TAB") #'helm-next-line) map) "Keymap for `helm-esh-pcomplete'.") @@ -116,7 +115,7 @@ at point." (t (file-relative-name i))) into lst - finally return (sort lst 'helm-generic-sort-fn))) + finally return (sort lst #'helm-generic-sort-fn))) (defclass helm-esh-source (helm-source-sync) ((init :initform (lambda () @@ -305,7 +304,7 @@ at point." ;; Set helm-eshell--quit-flag to non-nil only on ;; quit, this tells to not add final suffix when quitting ;; helm. - (add-hook 'helm-quit-hook 'helm-eshell--quit-hook-fn) + (add-hook 'helm-quit-hook #'helm-eshell--quit-hook-fn) (with-helm-show-completion beg end (unwind-protect (or (helm-esh-pcomplete--make-helm @@ -332,7 +331,7 @@ at point." (when (and helm-eshell--quit-flag (string-match-p "[.]\\{2\\}\\'" last)) (insert "/")))) - (remove-hook 'helm-quit-hook 'helm-eshell--quit-hook-fn) + (remove-hook 'helm-quit-hook #'helm-eshell--quit-hook-fn) (setq helm-eshell--quit-flag nil))))))) (defun helm-eshell--quit-hook-fn () @@ -368,25 +367,22 @@ at point." (defface helm-eshell-prompts-promptidx `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "cyan")) - "Face used to highlight Eshell prompt index." - :group 'helm-eshell-faces) + "Face used to highlight Eshell prompt index.") (defface helm-eshell-prompts-buffer-name `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "green")) - "Face used to highlight Eshell buffer name." - :group 'helm-eshell-faces) + "Face used to highlight Eshell buffer name.") (defcustom helm-eshell-prompts-promptidx-p t "Show prompt number." - :group 'helm-eshell :type 'boolean) (defvar helm-eshell-prompts-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "C-c o") 'helm-eshell-prompts-other-window) - (define-key map (kbd "C-c C-o") 'helm-eshell-prompts-other-frame) + (define-key map (kbd "C-c o") #'helm-eshell-prompts-other-window) + (define-key map (kbd "C-c C-o") #'helm-eshell-prompts-other-frame) map) "Keymap for `helm-eshell-prompt-all'.") @@ -409,7 +405,7 @@ If BUFFER is nil, use current buffer." (get-text-property (match-beginning 0) 'read-only)) (null eshell-highlight-prompt)) (push (list (buffer-substring-no-properties - it (point-at-eol)) + it (pos-eol)) it (buffer-name) count) result) (setq count (1+ count)))) @@ -456,17 +452,13 @@ See `helm-eshell-prompts-list'." (defun helm-eshell-prompts-goto-other-frame (candidate) (helm-eshell-prompts-goto candidate 'switch-to-buffer-other-frame)) -(defun helm-eshell-prompts-other-window () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-eshell-prompts-goto-other-window))) -(put 'helm-eshell-prompts-other-window 'helm-only t) +(helm-make-command-from-action helm-eshell-prompts-other-window + "Switch to eshell prompt in other window." + 'helm-eshell-prompts-goto-other-window) -(defun helm-eshell-prompts-other-frame () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-eshell-prompts-goto-other-frame))) -(put 'helm-eshell-prompts-other-frame 'helm-only t) +(helm-make-command-from-action helm-eshell-prompts-other-frame + "Switch to eshell prompt in other frame." + 'helm-eshell-prompts-goto-other-frame) ;;;###autoload (defun helm-eshell-prompts () diff --git a/elpa/helm-20220616.1004/helm-eval.el b/elpa/helm-20230806.1956/helm-eval.el similarity index 73% rename from elpa/helm-20220616.1004/helm-eval.el rename to elpa/helm-20230806.1956/helm-eval.el index 9d261438..5495374a 100644 --- a/elpa/helm-20220616.1004/helm-eval.el +++ b/elpa/helm-20230806.1956/helm-eval.el @@ -1,6 +1,6 @@ ;;; helm-eval.el --- eval expressions from helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -22,6 +22,8 @@ (require 'eldoc) (require 'edebug) +(declare-function helm-lisp-completion-at-point "helm-elisp.el") + (defgroup helm-eval nil "Eval related Applications and libraries for Helm." @@ -70,31 +72,32 @@ Should take one arg: the string to display." (defvar helm-eval-expression-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "") 'helm-eval-new-line-and-indent) - (define-key map (kbd "") 'lisp-indent-line) - (define-key map (kbd "") 'helm-lisp-completion-at-point) - (define-key map (kbd "C-p") 'previous-line) - (define-key map (kbd "C-n") 'next-line) - (define-key map (kbd "") 'previous-line) - (define-key map (kbd "") 'next-line) - (define-key map (kbd "") 'forward-char) - (define-key map (kbd "") 'backward-char) + (define-key map (kbd "") #'helm-eval-new-line-and-indent) + (define-key map (kbd "") #'lisp-indent-line) + (define-key map (kbd "") #'helm-lisp-completion-at-point) + (define-key map (kbd "C-p") #'previous-line) + (define-key map (kbd "C-n") #'next-line) + (define-key map (kbd "") #'previous-line) + (define-key map (kbd "") #'next-line) + (define-key map (kbd "") #'forward-char) + (define-key map (kbd "") #'backward-char) map)) (defun helm-build-evaluation-result-source () (helm-build-dummy-source "Evaluation Result" :multiline t :mode-line "C-RET: nl-and-indent, M-tab: reindent, C-tab:complete, C-p/n: next/prec-line." - :filtered-candidate-transformer (lambda (_candidates _source) - (list - (condition-case nil - (with-helm-current-buffer - (pp-to-string - (if edebug-active - (edebug-eval-expression - (read helm-pattern)) - (eval (read helm-pattern))))) - (error "Error")))) + :filtered-candidate-transformer + (lambda (_candidates _source) + (list + (condition-case nil + (with-helm-current-buffer + (pp-to-string + (if edebug-active + (edebug-eval-expression + (read helm-pattern)) + (eval (read helm-pattern) t)))) + (error "Error")))) :nohighlight t :keymap helm-eval-expression-map :action '(("Copy result to kill-ring" . (lambda (candidate) @@ -115,27 +118,36 @@ Should take one arg: the string to display." (with-selected-window (minibuffer-window) (push (current-buffer) helm-eldoc-active-minibuffers-list))) +;; From emacs-28.1: As the eldoc API is nowaday a pain to use, try to +;; provide some eldoc in mode-line the best as possible (may break at +;; some point). (defun helm-eldoc-show-in-eval () "Return eldoc in mode-line for current minibuffer input." (let ((buf (window-buffer (active-minibuffer-window)))) (condition-case err (when (member buf helm-eldoc-active-minibuffers-list) (with-current-buffer buf - (let* ((sym (save-excursion - (unless (looking-back ")\\|\"" (1- (point))) - (forward-char -1)) - (eldoc-current-symbol))) - (info-fn (eldoc-fnsym-in-current-sexp)) - (doc (or (eldoc-get-var-docstring sym) + (let* ((info-fn (eldoc-fnsym-in-current-sexp)) + (vsym (eldoc-current-symbol)) + (sym (car info-fn)) + (vardoc (eldoc-get-var-docstring vsym)) + (doc (or vardoc (eldoc-get-fnsym-args-string - (car info-fn) (cadr info-fn))))) - (when doc (funcall helm-eldoc-in-minibuffer-show-fn doc))))) + sym (cadr info-fn)))) + (all (format "%s: %s" + (propertize + (symbol-name (if vardoc vsym sym)) + 'face (if vardoc + 'font-lock-variable-name-face + 'font-lock-function-name-face)) + doc))) + (when doc (funcall helm-eldoc-in-minibuffer-show-fn all))))) (error (message "Eldoc in minibuffer error: %S" err) nil)))) (defun helm-show-info-in-mode-line (str) "Display string STR in mode-line." (save-selected-window - (with-current-buffer helm-buffer + (with-helm-window (let ((mode-line-format (concat " " str))) (force-mode-line-update) (sit-for helm-show-info-in-mode-line-delay)) @@ -168,11 +180,12 @@ Should take one arg: the string to display." (defun helm-eval-expression (arg) "Preconfigured `helm' for `helm-source-evaluation-result'." (interactive "P") - (helm :sources (helm-build-evaluation-result-source) - :input (when arg (thing-at-point 'sexp)) - :buffer "*helm eval*" - :echo-input-in-header-line nil - :history 'read-expression-history)) + (let ((helm-elisp-help-function #'helm-elisp-show-doc-modeline)) + (helm :sources (helm-build-evaluation-result-source) + :input (when arg (thing-at-point 'sexp)) + :buffer "*helm eval*" + :echo-input-in-header-line nil + :history 'read-expression-history))) (defvar eldoc-idle-delay) ;;;###autoload @@ -181,10 +194,10 @@ Should take one arg: the string to display." (interactive) (let ((timer (run-with-idle-timer eldoc-idle-delay 'repeat - 'helm-eldoc-show-in-eval))) + #'helm-eldoc-show-in-eval))) (unwind-protect (minibuffer-with-setup-hook - 'helm-eldoc-store-minibuffer + #'helm-eldoc-store-minibuffer (call-interactively 'helm-eval-expression)) (and timer (cancel-timer timer)) (setq helm-eldoc-active-minibuffers-list diff --git a/elpa/helm-20220616.1004/helm-external.el b/elpa/helm-20230806.1956/helm-external.el similarity index 96% rename from elpa/helm-20220616.1004/helm-external.el rename to elpa/helm-20230806.1956/helm-external.el index b7808361..2ed77335 100644 --- a/elpa/helm-20220616.1004/helm-external.el +++ b/elpa/helm-20230806.1956/helm-external.el @@ -1,6 +1,6 @@ ;;; helm-external.el --- Run Externals commands within Emacs with helm completion. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -53,6 +53,11 @@ Windows users should set that to \"explorer.exe\"." :group 'helm-external :type 'string) +(defvar helm-open-file-externally-after-hook nil + "Hook that run after opening a file with external program.") + +(defvar helm-open-file-externally-after-finish-hook nil + "Hook that run after external program finish.") ;;; Internals (defvar helm-external-command-history nil) @@ -136,6 +141,7 @@ When argument DETACHED is non nil, detach process from Emacs." (when (and (string= event "finished\n") helm-raise-command (not (helm-get-pid-from-process-name proc-name))) + (run-hooks 'helm-open-file-externally-after-finish-hook) (shell-command (format helm-raise-command "emacs"))) (message "%s process...Finished." process)))) ;; Move command on top list. @@ -205,6 +211,7 @@ to use." (customize-save-variable 'helm-external-programs-associations helm-external-programs-associations))) (helm-run-or-raise program files) + (run-hooks 'helm-open-file-externally-after-hook) (setq helm-external-command-history (cl-loop for i in helm-external-command-history when (executable-find i) collect i)))) diff --git a/elpa/helm-20220616.1004/helm-fd.el b/elpa/helm-20230806.1956/helm-fd.el similarity index 71% rename from elpa/helm-20220616.1004/helm-fd.el rename to elpa/helm-20230806.1956/helm-fd.el index 69d1116a..2b427b19 100644 --- a/elpa/helm-20220616.1004/helm-fd.el +++ b/elpa/helm-20230806.1956/helm-fd.el @@ -1,6 +1,6 @@ ;;; helm-fd.el --- helm interface for fd command line tool. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -30,6 +30,11 @@ :type '(repeat string) :group 'helm-files) +(defcustom helm-fd-mode-line-function 'helm-fd-default-mode-line + "Function called when `fd' process is finished to format mode-line." + :type 'function + :group 'helm-files) + (defface helm-fd-finish `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "Green")) @@ -78,34 +83,44 @@ (defun helm-fd-process () "Initialize fd process in an helm async source." (let* (process-connection-type - (cmd (append helm-fd-switches (split-string helm-pattern " "))) + (cmd (append helm-fd-switches + (or (and (fboundp #'split-string-shell-command) + (split-string-shell-command helm-pattern)) + (split-string helm-pattern)))) (proc (apply #'start-process "fd" nil helm-fd-executable cmd)) (start-time (float-time)) (fd-version (replace-regexp-in-string "\n" "" - (shell-command-to-string (concat helm-fd-executable " --version"))))) - (helm-log "Fd command:\nfd %s" (mapconcat 'identity cmd " ")) - (helm-log "VERSION: %s" fd-version) + (shell-command-to-string + (concat helm-fd-executable " --version"))))) + (helm-log "helm-fd-process" "Fd command:\nfd %s" + (mapconcat 'identity cmd " ")) + (helm-log "helm-fd-process" "VERSION: %s" fd-version) (prog1 proc (set-process-sentinel proc (lambda (_process event) (if (string= event "finished\n") (with-helm-window - (setq mode-line-format - `(" " mode-line-buffer-identification " " - (:eval (format "L%s" (helm-candidate-number-at-point))) " " - (:eval (propertize - (format - "[%s process finished in %.2fs - (%s results)] " - ,fd-version - ,(- (float-time) start-time) - (helm-get-candidate-number)) - 'face 'helm-fd-finish)))) - (force-mode-line-update)) - (helm-log "Error: Fd %s" + (when helm-fd-mode-line-function + (funcall helm-fd-mode-line-function start-time fd-version) + (force-mode-line-update))) + (helm-log "helm-fd-process sentinel" "Error: Fd %s" (replace-regexp-in-string "\n" "" event)))))))) +(defun helm-fd-default-mode-line (start-time fd-version) + "Format mode-line with START-TIME and FD-VERSION, as well as `fd' results." + (setq mode-line-format + `(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format + "[%s process finished in %.2fs - (%s results)] " + ,fd-version + ,(- (float-time) start-time) + (helm-get-candidate-number)) + 'face 'helm-fd-finish))))) + (defun helm-fd-fct (candidates _source) "The filtered-candidate-transformer function for helm-fd." (cl-loop for i in candidates diff --git a/elpa/helm-20220616.1004/helm-files.el b/elpa/helm-20230806.1956/helm-files.el similarity index 84% rename from elpa/helm-20220616.1004/helm-files.el rename to elpa/helm-20230806.1956/helm-files.el index d61ccce5..c55ff06d 100644 --- a/elpa/helm-20220616.1004/helm-files.el +++ b/elpa/helm-20230806.1956/helm-files.el @@ -1,6 +1,6 @@ ;;; helm-files.el --- helm file browser and related. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -84,10 +84,14 @@ (declare-function tramp-make-tramp-file-name "tramp") (declare-function tramp-cleanup-connection "tramp-cmds") (declare-function dired-async-processes "ext:dired-async.el") +(declare-function dired-async-mode-line-message "ext:dired-async.el") +(declare-function dired-async--modeline-mode "ext:dired-async.el") (declare-function all-the-icons-icon-for-file "ext:all-the-icons.el") (declare-function all-the-icons-octicon "ext:all-the-icons.el") (declare-function all-the-icons-match-to-alist "ext:all-the-icons.el") +(declare-function all-the-icons-material "ext:all-the-icons.el") (declare-function helm-adaptive-sort "ext:helm-adaptive.el") +(declare-function wfnames-setup-buffer "ext:wfnames.el") (defvar all-the-icons-dir-icon-alist) (defvar term-char-mode-point-at-process-mark) @@ -100,8 +104,191 @@ (defvar eshell-debug-command) (defvar eshell-current-command) (defvar tramp-archive-enabled) +(defvar tramp-tolerate-tilde) (defvar password-cache) +(defvar helm-fd-executable) +(defvar wfnames-buffer) +;;; Internal vars +;; +(defvar helm-ff-last-expanded-candidate-regexp "^[[:multibyte:] ]*%s" + "Regexp that retrieve previous candidate when going up one level. +The default value matching a multibyte char at bol allows +prefixing candidate with an icon. The format part will be +replaced by the display part of the candidate regexp quoted. +This should be used for all preselection code for helm-find-files +to handle icons.") + +(defvar helm-find-files-doc-header " (\\\\[helm-find-files-up-one-level]: Go up one level)" + "*The doc that is inserted in the Name header of a find-files or dired source.") +(defvar helm-ff-auto-update-flag nil + "Internal, flag to turn on/off auto-update in `helm-find-files'. +Don't set it directly, use instead `helm-ff-auto-update-initial-value'.") +(defvar helm-ff-last-expanded nil + "Store last expanded directory or file.") +(defvar helm-ff-default-directory nil) +(defvar helm-ff-history nil) +(defvar helm-ff-url-regexp + "\\`\\(news\\(post\\)?:\\|nntp:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\):/?/?\\).*" + "Same as `ffap-url-regexp' but match earlier possible url.") +;; helm-tramp-file-name-regexp is based on old version of +;; tramp-file-name-regexp i.e. "\\`/\\([^[/:]+\\|[^/]+]\\):" but it +;; seems it is wrong and a simpler regexp is enough, let's try it and +;; watch out! +(defvar helm-tramp-file-name-regexp "\\`/\\([^/:|]+\\):") +(defvar helm-ff-tramp-method-regexp "[/|]:\\([^:]*\\)") +(defvar helm-marked-buffer-name "*helm marked*") +(defvar helm-ff--auto-update-state nil) +(defvar helm-ff--deleting-char-backward nil) +(defvar helm-multi-files--toggle-locate nil) +(defvar helm-ff--move-to-first-real-candidate t) +(defvar helm-find-files--toggle-bookmark nil) +(defvar helm-ff--tramp-methods nil) +(defvar helm-ff--directory-files-length (make-hash-table :test 'equal) + "Used to count number of candidates in directory. +candidate-number-limit is set to this value if this value is bigger +than `helm-candidate-number-limit'.") +(defvar helm-ff--list-directory-cache (make-hash-table :test 'equal) + "Cache for `helm-find-files' candidates.") +(defvar helm-ff--file-notify-watchers (make-hash-table :test 'equal) + "File-notify watchers for `helm-find-files' are stored here.") +(defvar helm-ff-history-buffer-name "*helm-find-files history*") +(defvar helm-rsync-command-history nil) +(defvar helm-rsync--last-progress-bar-alist nil + "Used to store last valid rsync progress bar.") +(defvar helm-rsync-process-buffer "*helm-rsync*") +(defvar helm-rsync-progress-str-alist nil) +(defvar helm-ff--trash-directory-regexp "\\.?Trash[/0-9]+files/?\\'") +(defvar helm-ff--show-directories-only nil) +(defvar helm-ff--show-files-only nil) +(defvar helm-ff--trashed-files nil + "[INTERNAL] Files already trashed are stored here during file deletion. +This is used only as a let binding.") +(defvar helm-ff--show-thumbnails nil) +(defvar helm-ff--thumbnailed-directories nil) + + +;;; Helm-find-files - The helm file browser. +;; +;; Keymaps + +(defvar helm-find-files-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "RET") 'helm-ff-RET) + (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) + (define-key map (kbd "C-x C-f") 'helm-ff-run-locate) + (define-key map (kbd "C-x C-d") 'helm-ff-run-browse-project) + (define-key map (kbd "C-x r m") 'helm-ff-bookmark-set) + (define-key map (kbd "C-x r b") 'helm-find-files-switch-to-bookmark) + (define-key map (kbd "C-x C-q") 'helm-ff-run-edit-marked-files) + (define-key map (kbd "C-s") 'helm-ff-run-grep) + (define-key map (kbd "M-g s") 'helm-ff-run-grep) + (define-key map (kbd "M-g p") 'helm-ff-run-pdfgrep) + (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) + (define-key map (kbd "M-g a") 'helm-ff-run-grep-ag) + (define-key map (kbd "M-g g") 'helm-ff-run-git-grep) + (define-key map (kbd "M-g i") 'helm-ff-run-gid) + (define-key map (kbd "M-.") 'helm-ff-run-etags) + (define-key map (kbd "M-R") 'helm-ff-run-rename-file) + (define-key map (kbd "M-C") 'helm-ff-run-copy-file) + (define-key map (kbd "M-k") 'helm-ff-run-kill-default-directory) + (when (executable-find "rsync") + (define-key map (kbd "M-V") 'helm-ff-run-rsync-file)) + (define-key map (kbd "C-M-SPC") 'helm-ff-mark-similar-files) + (define-key map (kbd "C-c C-SPC") 'helm-ff-mark-similar-files) + (define-key map (kbd "C-M-c") 'helm-ff-run-mcp) + (define-key map (kbd "M-B") 'helm-ff-run-byte-compile-file) + (define-key map (kbd "M-L") 'helm-ff-run-load-file) + (define-key map (kbd "M-S") 'helm-ff-run-symlink-file) + (define-key map (kbd "M-Y") 'helm-ff-run-relsymlink-file) + (define-key map (kbd "M-H") 'helm-ff-run-hardlink-file) + (define-key map (kbd "M-D") 'helm-ff-run-delete-file) + (define-key map (kbd "M-K") 'helm-ff-run-kill-buffer-persistent) + (define-key map (kbd "M-T") 'helm-ff-run-touch-files) + (define-key map (kbd "M-M") 'helm-ff-run-chmod) + (define-key map (kbd "C-c d") 'helm-ff-persistent-delete) + (define-key map (kbd "M-e") 'helm-ff-run-switch-to-shell) + (define-key map (kbd "C-c i") 'helm-ff-run-complete-fn-at-point) + (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) + (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame) + (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally) + (define-key map (kbd "C-c C-v") 'helm-ff-run-preview-file-externally) + (define-key map (kbd "C-c X") 'helm-ff-run-open-file-with-default-tool) + (define-key map (kbd "C-c t") 'helm-ff-toggle-thumbnails) + (define-key map (kbd "M-!") 'helm-ff-run-eshell-command-on-file) + (define-key map (kbd "M-@") 'helm-ff-run-query-replace-fnames-on-marked) + (define-key map (kbd "M-%") 'helm-ff-run-query-replace) + (define-key map (kbd "C-M-%") 'helm-ff-run-query-replace-regexp) + (define-key map (kbd "C-c =") 'helm-ff-run-ediff-file) + (define-key map (kbd "M-=") 'helm-ff-run-ediff-merge-file) + (define-key map (kbd "M-p") 'helm-find-files-history) + (define-key map (kbd "C-c h") 'helm-ff-file-name-history) + (define-key map (kbd "M-i") 'helm-ff-properties-persistent) + (define-key map (kbd "C-}") 'helm-narrow-window) + (define-key map (kbd "C-{") 'helm-enlarge-window) + (define-key map (kbd "C-") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c ") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c C-a") 'helm-ff-run-mail-attach-files) + (define-key map (kbd "C-c p") 'helm-ff-run-print-file) + (define-key map (kbd "C-c /") 'helm-ff-run-find-sh-command) + (define-key map (kbd "C-/") 'helm-ff-run-fd) + ;; Next 2 have no effect if candidate is not an image file. + (define-key map (kbd "M-l") 'helm-ff-rotate-left-persistent) + (define-key map (kbd "M-r") 'helm-ff-rotate-right-persistent) + (define-key map (kbd "M-+") 'helm-ff-increase-image-size-persistent) + (define-key map (kbd "M--") 'helm-ff-decrease-image-size-persistent) + (define-key map (kbd "C-l") 'helm-find-files-up-one-level) + (define-key map (kbd "C-:") 'helm-ff-complete-tramp-methods) + (define-key map (kbd "C-_") 'helm-ff-undo) + (define-key map (kbd "C-r") 'helm-find-files-down-last-level) + (define-key map (kbd "C-c r") 'helm-ff-run-find-file-as-root) + (define-key map (kbd "C-x C-v") 'helm-ff-run-find-alternate-file) + (define-key map (kbd "C-c @") 'helm-ff-run-insert-org-link) + (define-key map (kbd "S-") 'helm-ff-sort-alpha) + (define-key map (kbd "S-") 'helm-ff-sort-by-newest) + (define-key map (kbd "S-") 'helm-ff-sort-by-size) + (define-key map (kbd "S-") 'helm-ff-toggle-dirs-only) + (define-key map (kbd "S-") 'helm-ff-toggle-files-only) + (define-key map (kbd "S-") 'helm-ff-sort-by-ext) + (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward + '((C-backspace . helm-ff-run-toggle-auto-update) + ([C-c DEL] . helm-ff-run-toggle-auto-update)) + nil 'helm-ff-delete-char-backward--exit-fn) + (when (fboundp 'tab-bar-mode) + (define-key map (kbd "C-c C-t") 'helm-ff-find-file-other-tab)) + map) + "Keymap for `helm-find-files'.") + +(defvar helm-read-file-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "") 'helm-cr-empty-string) + (define-key map (kbd "M-RET") 'helm-cr-empty-string) + (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) + (define-key map (kbd "C-.") 'helm-find-files-up-one-level) + (define-key map (kbd "C-l") 'helm-find-files-up-one-level) + (define-key map (kbd "C-:") 'helm-ff-complete-tramp-methods) + (define-key map (kbd "C-_") 'helm-ff-undo) + (define-key map (kbd "C-r") 'helm-find-files-down-last-level) + (define-key map (kbd "C-c h") 'helm-ff-file-name-history) + (define-key map (kbd "C-") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c ") 'helm-ff-run-toggle-auto-update) + (define-key map (kbd "C-c t") 'helm-ff-toggle-thumbnails) + (define-key map (kbd "S-") 'helm-ff-sort-alpha) + (define-key map (kbd "S-") 'helm-ff-sort-by-newest) + (define-key map (kbd "S-") 'helm-ff-sort-by-size) + (define-key map (kbd "S-") 'helm-ff-sort-by-ext) + (define-key map (kbd "RET") 'helm-ff-RET) + (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward + '((C-backspace . helm-ff-run-toggle-auto-update) + ([C-c DEL] . helm-ff-run-toggle-auto-update)) + nil 'helm-ff-delete-char-backward--exit-fn) + map) + "Keymap for `helm-read-file-name'.") + +;;; User variables +;; (defgroup helm-files nil "Files applications and libraries for Helm." :group 'helm) @@ -110,8 +297,7 @@ "Just like `tramp-verbose' but specific to Helm. When set to 0 don't show tramp messages in Helm. If you want to have the default tramp messages set it to 3." - :type 'integer - :group 'helm-files) + :type 'integer) (defcustom helm-ff-auto-update-initial-value nil "Auto update when only one candidate directory is matched. @@ -119,48 +305,40 @@ Default value when starting `helm-find-files' is nil to not confuse new users. For a better experience with `helm-find-files' set this to non-nil and use C- to toggle it." - :group 'helm-files :type 'boolean) (defcustom helm-ff-history-max-length 100 "Number of elements shown in `helm-find-files' history." - :group 'helm-files :type 'integer) (defcustom helm-ff-fuzzy-matching t "Enable fuzzy matching for `helm-find-files' when non--nil. See `helm-ff--transform-pattern-for-completion' for more info." - :group 'helm-files :type 'boolean) (defcustom helm-ff-exif-data-program "exiftran" "Program used to extract exif data of an image file." - :group 'helm-files :type 'string) (defcustom helm-ff-exif-data-program-args "-d" "Arguments used for `helm-ff-exif-data-program'." - :group 'helm-files :type 'string) (defcustom helm-ff-newfile-prompt-p t "Whether Prompt or not when creating new file. This set `ffap-newfile-prompt'." - :type 'boolean - :group 'helm-files) + :type 'boolean) (defcustom helm-ff-avfs-directory "~/.avfs" "The default avfs directory, usually \\='~/.avfs'. When this is set you will be able to expand archive filenames with `C-j' inside an avfs directory mounted with mountavfs. See ." - :type 'string - :group 'helm-files) + :type 'string) (defcustom helm-ff-file-compressed-list '("gz" "bz2" "zip" "7z") "Minimal list of compressed files extension." - :type '(repeat (choice string)) - :group 'helm-files) + :type '(repeat (choice string))) (defcustom helm-ff-printer-list nil "A list of available printers on your system. @@ -169,37 +347,31 @@ Otherwise when nil the variable `printer-name' will be used. On Unix based systems (lpstat command needed) you don't need to set this, `helm-ff-find-printers' will find a list of available printers for you." - :type '(repeat (choice string)) - :group 'helm-files) + :type '(repeat (choice string))) (defcustom helm-ff-transformer-show-only-basename t "Show only basename of candidates in `helm-find-files'. This can be toggled at anytime from `helm-find-files' with \ \\\\[helm-ff-run-toggle-basename]." - :type 'boolean - :group 'helm-files) + :type 'boolean) (defcustom helm-ff-signal-error-on-dot-files t "Signal error when file is `.' or `..' on file deletion when non-nil. Default is non-nil. WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree." - :group 'helm-files :type 'boolean) (defcustom helm-ff-search-library-in-sexp nil "Search for library in `require' and `declare-function' sexp." - :group 'helm-files :type 'boolean) (defcustom helm-tooltip-hide-delay 25 "Hide tooltips automatically after this many seconds." - :group 'helm-files :type 'integer) (defcustom helm-ff-file-name-history-use-recentf nil "Use `recentf-list' instead of `file-name-history' in `helm-find-files'." - :group 'helm-files :type 'boolean) (defcustom helm-ff-skip-boring-files nil @@ -208,7 +380,6 @@ I.e. the files matching regexps in `helm-boring-file-regexp-list'. This takes effect in `helm-find-files' and file completion used by `helm-mode' i.e. `helm-read-file-name'. Note that when non-nil this will slow down slightly `helm-find-files'." - :group 'helm-files :type 'boolean) (defcustom helm-ff-skip-git-ignored-files nil @@ -217,7 +388,6 @@ This take effect only in `helm-find-files'. Check is not done on remote files. Note that when non-nil this will slow down slightly `helm-find-files'." - :group 'helm-files :type 'boolean) (defcustom helm-ff-candidate-number-limit 5000 @@ -228,9 +398,12 @@ length of directory will be used instead if it is higher than this value. This is to avoid failing to preselect the previous directory/file if this one is situated lower than `helm-ff-candidate-number-limit' num candidate." - :group 'helm-files :type 'integer) +(defcustom helm-ff-preselect-ignore-large-dirs nil + "Preselect directory belonging to current-buffer even if large." + :type 'boolean) + (defcustom helm-ff-up-one-level-preselect t "Always preselect previous directory when going one level up. @@ -242,36 +415,30 @@ candidate in its directory is > to It can be helpful to disable this and reduce `helm-ff-candidate-number-limit' if you often navigate across very large directories." - :group 'helm-files :type 'boolean) (defcustom helm-files-save-history-extra-sources '("Find" "Locate" "Recentf" "Files from Current Directory" "File Cache") "Extras source that save candidate to `file-name-history'." - :group 'helm-files :type '(repeat (choice string))) (defcustom helm-find-files-before-init-hook nil "Hook that run before initialization of `helm-find-files'." - :group 'helm-files :type 'hook) (defcustom helm-find-files-after-init-hook nil "Hook that run after initialization of `helm-find-files'." - :group 'helm-files :type 'hook) (defcustom helm-find-files-bookmark-prefix nil "bookmark name prefix of `helm-find-files' sessions." - :group 'helm-files :type 'string) (defcustom helm-ff-guess-ffap-filenames nil "Use ffap to guess local filenames at point in `helm-find-files'. This doesn't disable url or mail at point, see `helm-ff-guess-ffap-urls' for this." - :group 'helm-files :type 'boolean) (defcustom helm-ff-guess-ffap-urls t @@ -280,17 +447,14 @@ This doesn't disable guessing filenames at point, see `helm-ff-guess-ffap-filenames' for this. See also `ffap-url-unwrap-remote' that may override this variable." - :group 'helm-files :type 'boolean) (defcustom helm-ff-no-preselect nil "When non-nil `helm-find-files' starts at root of current directory." - :group 'helm-files :type 'boolean) (defcustom helm-ff-allow-non-existing-file-at-point nil "Use non existing file-at-point as initial input in `helm-find-files'." - :group 'helm-files :type 'boolean) (defcustom helm-find-files-ignore-thing-at-point nil @@ -298,17 +462,14 @@ variable." I.e. text under cursor in `current-buffer' is ignored. Note that when non-nil you will be unable to complete filename at point in `current-buffer'." - :group 'helm-files :type 'boolean) (defcustom helm-substitute-in-filename-stay-on-remote nil "Don't switch back to local filesystem when expanding pattern with / or ~/." - :group 'helm-files :type 'boolean) (defcustom helm-ff-goto-first-real-dired-exceptions '(dired-goto-file) "Dired commands that are allowed moving to first real candidate." - :group 'helm-files :type '(repeat (choice symbol))) (defcustom helm-mounted-network-directories nil @@ -318,11 +479,11 @@ When nil `helm-file-on-mounted-network-p' always return nil otherwise check if a file is in one of these directories. Remote filesystem are generally mounted with sshfs." - :group 'helm-files :type '(repeat string)) (defcustom helm-browse-project-default-find-files-fn - (cond ((executable-find "fd") + (cond ((or (executable-find "fd") + (executable-find "fdfind")) #'helm-browse-project-fd-find-files) ((executable-find "rg") #'helm-browse-project-rg-find-files) @@ -332,7 +493,6 @@ Remote filesystem are generally mounted with sshfs." "The default function to retrieve files in a non-vc directory. A function that takes a directory name as only arg." - :group 'helm-files :type 'function) (defcustom helm-ff-kill-or-find-buffer-fname-fn @@ -355,13 +515,11 @@ just set this to `ignore' function. Of course you can also write your own function to do something else." - :group 'helm-files :type 'function) (defcustom helm-modes-using-escaped-strings '(eshell-mode shell-mode term-mode) "Modes that requires string's insertion to be escaped." - :group 'helm-files :type '(repeat symbol)) (defcustom helm-ff-allow-recursive-deletes nil @@ -370,7 +528,6 @@ When nil, will ask for recursive deletion. Note that when deleting multiple directories you can answer ! when prompted to avoid being asked for next directories, so it is probably better to not modify this variable." - :group 'helm-files :type '(choice (const :tag "Delete non-empty directories" t) (const :tag "Confirm for each directory" nil))) @@ -388,7 +545,6 @@ be deleted with no warnings in background!!! It is the function that will be used when using `\\\\[helm-ff-run-delete-file]' from `helm-find-files'." - :group 'helm-files :type '(choice (function :tag "Delete files synchronously." helm-delete-marked-files) (function :tag "Delete files asynchronously." @@ -409,7 +565,6 @@ Emacs. If you want to enable this you will have to install the \\='trash' command on remote (and/or locally if you want to trash as root). On Ubuntu-based distributions it is \\='trash-cli'." - :group 'helm-files :type 'boolean) (defcustom helm-list-directory-function @@ -436,8 +591,7 @@ want to connect e.g. on a Freebsd server, you may have failures due to the incompatible ls version installed on remote server. In such case use `helm-list-dir-lisp' which works everywhere but is slower and less featured (only directories colorized)." - :type 'function - :group 'helm-files) + :type 'function) (defcustom helm-ff-initial-sort-method nil "Sort method to use when initially listing a directory. @@ -448,7 +602,6 @@ BTW is not provided on remote files (helm will fallback on nil in such case). Note that this have no effect as soon as you start narrowing directory i.e. filtering filenames inside directory." - :group 'helm-files :type '(choice (const :tag "alphabetically" nil) (const :tag "newest" newest) @@ -461,7 +614,6 @@ When nil and `helm-ff-display-image-native' is enabled, fallback to `image-rotate' without modification of exif data i.e. rotation is not persistent otherwise an error is returned when not using `helm-ff-display-image-native' i.e. using image-dired." - :group 'helm-files :type '(choice (const :tag "Mogrify" "mogrify") (const :tag "Exiftran" "exiftran") @@ -471,14 +623,12 @@ persistent otherwise an error is returned when not using "Options used with `helm-ff-rotate-image-program'. If you are using Mogrify or Jpegtran mandatory option is \"-rotate\", with Exiftran mandatory option is \"-i\"." - :group 'helm-files :type '(repeat string)) (defcustom helm-ff-preferred-shell-mode 'eshell-mode "Shell to use to switch to a shell buffer from `helm-find-files'. Possible values are `shell-mode', `eshell-mode' and `term-mode'. This affects `\\\\[helm-ff-run-switch-to-shell]' keybinding." - :group 'helm-files :type '(choice (const :tag "Use Eshell" eshell-mode) (const :tag "Use Shell" shell-mode) @@ -489,21 +639,39 @@ This affects `\\\\[helm-ff-run-switch-to-shell]' keybinding This is useful if you display the progress bar somewhere else, e.g. with minibuffer-line in minibuffer, in this case updating mode-line may create flickering in other frame's mode-line." - :type 'boolean - :group 'helm-files) + :type 'boolean) (defcustom helm-rsync-switches '("-a" "-z" "-h" "-s" "--info=all2") "Rsync options to use with HFF Rsync action. Note: Using \"--info=all2\" allows having the name of the file currently transfered in an help-echo in mode-line, if you use \"--info=progress2\" you will not have this information." - :type '(repeat string) - :group 'helm-files) + :type '(repeat string)) (defcustom helm-rsync-percent-sign "%" "Percentage unicode sign to use in Rsync reporter." - :type 'string - :group 'helm-files) + :type 'string) + +(defcustom helm-ff-rsync-progress-bar-style (if (display-graphic-p) 'bar 'text) + "Style of progress-bar for rsync action. +Value can be either bar or text. +Progress bar is inaccurate on non graphic displays, use text instead." + :type '(choice + (const :tag "Progress bar as a bar" bar) + (const :tag "Progress bar with text" text))) + +(defcustom helm-ff-rsync-progress-bar-info '(percent) + "Infos shown at end of Rsync progress bar. + +Valid value is a list containing one or more elements from +percent, size, speed and remain. When set to nil show nothing at end of +progress bar. +This Has no effect when `helm-ff-rsync-progress-bar-style' is text." + :type '(set :tag "Check zero or more items to show at end of Rsync progress bar" + (const :tag "Show the amount of data copied" size) + (const :tag "Show the percentage of data copied" percent) + (const :tag "Show the current speed of transfer" speed) + (const :tag "Show the time remaining" remain))) (defcustom helm-trash-default-directory nil "The default trash directory. @@ -513,32 +681,237 @@ Should be the directory file name i.e. don't add final slash. When nil helm will compute a default value according to freedesktop specs. It is generally \"~/.local/share/Trash\"." - :type 'string - :group 'helm-files) - -;;; Faces -;; -;; -(defgroup helm-files-faces nil - "Customize the appearance of helm-files." - :prefix "helm-" - :group 'helm-files - :group 'helm-faces) + :type 'string) -(defface helm-ff-prefix - `((t ,@(and (>= emacs-major-version 27) '(:extend t)) - :background "yellow" :foreground "black")) - "Face used to prefix new file or url paths in `helm-find-files'." - :group 'helm-files-faces) +(defcustom helm-ff-lynx-style-map t + "Use arrow keys to navigate with `helm-find-files'. +Note that if you define this variable with `setq' your change +will have no effect, use customize instead." + :type 'boolean + :set (lambda (var val) + (set var val) + (if val + (progn + (define-key helm-find-files-map (kbd "") 'helm-execute-persistent-action) + (define-key helm-find-files-map (kbd "") 'helm-find-files-up-one-level) + (define-key helm-read-file-map (kbd "") 'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "") 'helm-find-files-up-one-level)) + (define-key helm-find-files-map (kbd "") nil) + (define-key helm-find-files-map (kbd "") nil) + (define-key helm-read-file-map (kbd "") nil) + (define-key helm-read-file-map (kbd "") nil)))) -(defface helm-ff-executable - `((t ,@(and (>= emacs-major-version 27) '(:extend t)) - :foreground "green")) - "Face used for executable files in `helm-find-files'." - :group 'helm-files-faces) +(defcustom helm-ff-DEL-up-one-level-maybe nil + "Use DEL to maybe go up one level when non nil. -(defface helm-ff-suid - `((t ,@(and (>= emacs-major-version 27) '(:extend t)) +Going up one level works only when pattern is a directory endings +with \"/\", otherwise this command deletes char backward. + +When nil always delete char backward." + :type 'boolean) + +(defcustom helm-ff-display-image-native t + "Use native `image-mode' when non nil. + +You should use this only with Emacs>= 27 and `image-auto-resize' +enabled to have images resized properly. When this is enabled, +you have new commands to zoom in/out images. See +`image-transform-resize' and `image-auto-resize'. Otherwise, +when nil `image-dired' is used, using imagemagick as backend. +NOTE: On Emacs-29 `image-dired' is no more using external program +image-magick to display image, so this is used inconditionally even +when value is nil." + :type 'boolean) + +(defcustom helm-ff-reset-filters-on-update t + "Reset filter variables when changing directory. +When filtering directories/files only, switch back to a \"show all\" view +when moving out of directory when non nil." + :type 'boolean) + +(defcustom helm-ff-eshell-unwanted-aliases nil + "A list of eshell aliases to not display." + :type '(repeat string)) + +(defcustom helm-eshell-on-file-reverse-history t + "History source in *eshell-command-on-file appears on top when non nil." + :type 'boolean) + +(defcustom helm-find-files-actions + (helm-make-actions + "Find File" 'helm-find-file-or-marked + "Find file in Dired" 'helm-point-file-in-dired + "View file" 'view-file + "Query replace fnames on marked `M-@'" 'helm-ff-query-replace-fnames-on-marked + "Marked files in dired `C-x C-q'" 'helm-ff-edit-marked-files + "Query replace contents on marked `M-%'" 'helm-ff-query-replace + "Query replace regexp contents on marked `C-M-%'" 'helm-ff-query-replace-regexp + "Attach file(s) to mail buffer `C-c C-a'" 'helm-ff-mail-attach-files + "Serial rename files" 'helm-ff-serial-rename + "Serial rename by symlinking files" 'helm-ff-serial-rename-by-symlink + "Serial rename by copying files" 'helm-ff-serial-rename-by-copying + "Open file with default tool" 'helm-open-file-with-default-tool + "Find file in hex dump" 'hexl-find-file + "Browse project `C-x C-d'" 'helm-ff-browse-project + "Complete at point `C-c i'" 'helm-insert-file-name-completion-at-point + "Insert as org link `C-c @'" 'helm-files-insert-as-org-link + "Find shell command `C-c /'" 'helm-ff-find-sh-command + "Fd shell command (C-/)" 'helm-ff-fd + "Find files in file" 'helm-find-files-in-file + "Add marked files to file-cache" 'helm-ff-cache-add-file + "Open file externally `C-c C-x, C-u to choose'" 'helm-open-file-externally + "Grep File(s) `C-s, C-u Recurse'" 'helm-find-files-grep + "Grep current directory with AG `M-g a, C-u select type'" 'helm-find-files-ag + "Git grep `M-g g, C-u from root'" 'helm-ff-git-grep + "Zgrep File(s) `M-g z, C-u Recurse'" 'helm-ff-zgrep + "Pdf Grep File(s)" 'helm-ff-pdfgrep + "Gid `M-g i'" 'helm-ff-gid + "Switch to Eshell `M-e'" 'helm-ff-switch-to-shell + "Etags `M-., C-u reload tag file'" 'helm-ff-etags-select + "Eshell command on file(s) `M-!, C-u take all marked as arguments.'" + 'helm-find-files-eshell-command-on-file + "Find file as root `C-c r'" 'helm-find-file-as-root + "Find alternate file `C-x C-v'" 'find-alternate-file + "Ediff File `C-c ='" 'helm-find-files-ediff-files + "Ediff Merge File `M-='" 'helm-find-files-ediff-merge-files + (lambda () (format "Delete File(s)%s `M-D' (C-u reverse trash)" + (if (eq helm-ff-delete-files-function + 'helm-delete-marked-files-async) + " async" ""))) + 'helm-ff-delete-files + "Touch File(s) `M-T'" 'helm-ff-touch-files + "Copy file(s) `M-C, C-u to follow'" 'helm-find-files-copy + (lambda () + (and (executable-find "rsync") + "Rsync file(s) `M-V' (C-u edit command)")) + 'helm-find-files-rsync + "Rename file(s) `M-R, C-u to follow'" 'helm-find-files-rename + "Backup files" 'helm-find-files-backup + "Copy file to dir(s) `C-M-c'" 'helm-ff-mcp + "Symlink files(s) `M-S, C-u to follow'" 'helm-find-files-symlink + "Relsymlink file(s) `M-Y, C-u to follow'" 'helm-find-files-relsymlink + "Hardlink file(s) `M-H, C-u to follow'" 'helm-find-files-hardlink + "Change mode on file(s) `M-M'" 'helm-ff-chmod + "Find file other window `C-c o'" 'helm-find-files-other-window + "Find file other frame `C-c C-o'" 'find-file-other-frame + (lambda () (and (fboundp 'tab-bar-mode) + "Find file other tab `C-c C-t'")) + 'find-file-other-tab + "Print File `C-c p, C-u to refresh'" 'helm-ff-print + "Locate `C-x C-f, C-u to specify locate db'" 'helm-ff-locate) + "Actions for `helm-find-files'." + :type '(alist :key-type string :value-type function)) + +(defcustom helm-dwim-target nil + "Default target directory for file actions. + +Define the directory where you want to start navigating for the +target directory when copying, renaming, etc.. You can use the +`default-directory' of `next-window', the visited directory, the +current `default-directory' or have completion on all the +directories belonging to each visible windows." + :type '(radio :tag "Define default target directory for file actions." + (const :tag "Directory belonging to next window" + next-window) + (const :tag "Completion on directories belonging to each window" + completion) + (const :tag "Use initial directory or `default-directory'" + default-directory) + (const :tag "Use visited directory" + nil))) + +(defcustom helm-ff-use-notify t + "Watch directories visited with `helm-find-files' when non nil. +If your system have no file notification package available turn this +to nil to avoid error messages when using `helm-find-files'." + :type 'boolean + :set (lambda (var val) + (set-default var val) + (unless (symbol-value var) + (cl-loop for dir being the hash-keys of helm-ff--file-notify-watchers + do (remhash dir helm-ff--list-directory-cache))))) + +(defcustom helm-ff-inotify-unsupported-methods '("adb") + "Tramp methods unsupported by file-notify." + :type '(repeat string)) + +(defcustom helm-ff-image-cache-max-len 5 + "The last seen image number to keep in cache." + :type 'integer) + +(defcustom helm-ff-image-cache-max-len 5 + "The last seen image number to keep in cache." + :type 'integer) + +(defcustom helm-ff-slideshow-default-delay 3 + "Delay in seconds between each image in slideshow." + :type 'integer) + +(defcustom helm-file-name-history-hide-deleted nil + "Hide deleted files in file-name-history when non nil. + +This can be toggled at any time from `helm-ff-file-name-history' with \ +\\\\[helm-file-name-history-show-or-hide-deleted]." + :type 'boolean) + +(defcustom helm-file-name-history-max-length 72 + "Max length of candidates in helm file name history before truncating." + :type 'integer) + +(defcustom helm-ff-follow-blacklist-file-exts '("gpg" "doc" "docx" "mp3" "ogg") + "File extensions we don't want to follow when helm-follow-mode is enabled. +Note that image files are always followed even if their extensions is +present in this list." + :type '(repeat string)) + +(defcustom helm-ff-nohighlight-matches t + "Highlight matches in `helm-find-files' when nil." + :type 'boolean + :initialize 'custom-initialize-changed + :set (lambda (var val) + (set var val) + ;; Force rebuilding the source to remove the highlight match FCT. + (setq helm-source-find-files nil))) + +(defcustom helm-ff-edit-marked-files-fn #'helm-ff-wfnames + "A function to edit filenames in a special buffer. + +By default `wfnames' package is used to avoid wdired which doesn't +always work with all emacs versions and also is quite clumsy about +default-directory among other things. +If you still want to use it, helm is still providing `helm-marked-files-in-dired'." + :type '(choice (function :tag "Use Wfnames package to edit filenames." + helm-ff-wfnames) + (function :tag "Use Wdired package to edit filenames." + helm-marked-files-in-dired))) + +(defcustom helm-ff-ignore-following-on-directory nil + "In follow mode ignore silently directories when non nil." + :type 'boolean) + +;;; Faces +;; +;; +(defgroup helm-files-faces nil + "Customize the appearance of helm-files." + :prefix "helm-" + :group 'helm-files + :group 'helm-faces) + +(defface helm-ff-prefix + `((t ,@(and (>= emacs-major-version 27) '(:extend t)) + :background "yellow" :foreground "black")) + "Face used to prefix new file or url paths in `helm-find-files'." + :group 'helm-files-faces) + +(defface helm-ff-executable + `((t ,@(and (>= emacs-major-version 27) '(:extend t)) + :foreground "green")) + "Face used for executable files in `helm-find-files'." + :group 'helm-files-faces) + +(defface helm-ff-suid + `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :background "red" :foreground "white")) "Face used for suid files in `helm-find-files'." :group 'helm-files-faces) @@ -650,293 +1023,30 @@ It is generally \"~/.local/share/Trash\"." :inherit font-lock-warning-face)) "Face used for rsync mode-line indicator." :group 'helm-files-faces) - -;;; Helm-find-files - The helm file browser. -;; -;; Keymaps - -(defvar helm-find-files-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "RET") 'helm-ff-RET) - (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) - (define-key map (kbd "C-x C-f") 'helm-ff-run-locate) - (define-key map (kbd "C-x C-d") 'helm-ff-run-browse-project) - (define-key map (kbd "C-x r m") 'helm-ff-bookmark-set) - (define-key map (kbd "C-x r b") 'helm-find-files-switch-to-bookmark) - (define-key map (kbd "C-x C-q") 'helm-ff-run-marked-files-in-dired) - (define-key map (kbd "C-s") 'helm-ff-run-grep) - (define-key map (kbd "M-g s") 'helm-ff-run-grep) - (define-key map (kbd "M-g p") 'helm-ff-run-pdfgrep) - (define-key map (kbd "M-g z") 'helm-ff-run-zgrep) - (define-key map (kbd "M-g a") 'helm-ff-run-grep-ag) - (define-key map (kbd "M-g g") 'helm-ff-run-git-grep) - (define-key map (kbd "M-g i") 'helm-ff-run-gid) - (define-key map (kbd "M-.") 'helm-ff-run-etags) - (define-key map (kbd "M-R") 'helm-ff-run-rename-file) - (define-key map (kbd "M-C") 'helm-ff-run-copy-file) - (when (executable-find "rsync") - (define-key map (kbd "M-V") 'helm-ff-run-rsync-file)) - (define-key map (kbd "M-B") 'helm-ff-run-byte-compile-file) - (define-key map (kbd "M-L") 'helm-ff-run-load-file) - (define-key map (kbd "M-S") 'helm-ff-run-symlink-file) - (define-key map (kbd "M-Y") 'helm-ff-run-relsymlink-file) - (define-key map (kbd "M-H") 'helm-ff-run-hardlink-file) - (define-key map (kbd "M-D") 'helm-ff-run-delete-file) - (define-key map (kbd "M-K") 'helm-ff-run-kill-buffer-persistent) - (define-key map (kbd "M-T") 'helm-ff-run-touch-files) - (define-key map (kbd "C-c d") 'helm-ff-persistent-delete) - (define-key map (kbd "M-e") 'helm-ff-run-switch-to-shell) - (define-key map (kbd "C-c i") 'helm-ff-run-complete-fn-at-point) - (define-key map (kbd "C-c o") 'helm-ff-run-switch-other-window) - (define-key map (kbd "C-c C-o") 'helm-ff-run-switch-other-frame) - (define-key map (kbd "C-c C-x") 'helm-ff-run-open-file-externally) - (define-key map (kbd "C-c C-v") 'helm-ff-run-preview-file-externally) - (define-key map (kbd "C-c X") 'helm-ff-run-open-file-with-default-tool) - (define-key map (kbd "C-c t") 'helm-ff-toggle-thumbnails) - (define-key map (kbd "M-!") 'helm-ff-run-eshell-command-on-file) - (define-key map (kbd "M-@") 'helm-ff-run-query-replace-fnames-on-marked) - (define-key map (kbd "M-%") 'helm-ff-run-query-replace) - (define-key map (kbd "C-M-%") 'helm-ff-run-query-replace-regexp) - (define-key map (kbd "C-c =") 'helm-ff-run-ediff-file) - (define-key map (kbd "M-=") 'helm-ff-run-ediff-merge-file) - (define-key map (kbd "M-p") 'helm-find-files-history) - (define-key map (kbd "C-c h") 'helm-ff-file-name-history) - (define-key map (kbd "M-i") 'helm-ff-properties-persistent) - (define-key map (kbd "C-}") 'helm-narrow-window) - (define-key map (kbd "C-{") 'helm-enlarge-window) - (define-key map (kbd "C-") 'helm-ff-run-toggle-auto-update) - (define-key map (kbd "C-c ") 'helm-ff-run-toggle-auto-update) - (define-key map (kbd "C-c C-a") 'helm-ff-run-mail-attach-files) - (define-key map (kbd "C-c p") 'helm-ff-run-print-file) - (define-key map (kbd "C-c /") 'helm-ff-run-find-sh-command) - (define-key map (kbd "C-/") 'helm-ff-run-fd) - ;; Next 2 have no effect if candidate is not an image file. - (define-key map (kbd "M-l") 'helm-ff-rotate-left-persistent) - (define-key map (kbd "M-r") 'helm-ff-rotate-right-persistent) - (define-key map (kbd "M-+") 'helm-ff-increase-image-size-persistent) - (define-key map (kbd "M--") 'helm-ff-decrease-image-size-persistent) - (define-key map (kbd "C-l") 'helm-find-files-up-one-level) - (define-key map (kbd "C-:") 'helm-ff-complete-tramp-methods) - (define-key map (kbd "C-_") 'helm-ff-undo) - (define-key map (kbd "C-r") 'helm-find-files-down-last-level) - (define-key map (kbd "C-c r") 'helm-ff-run-find-file-as-root) - (define-key map (kbd "C-x C-v") 'helm-ff-run-find-alternate-file) - (define-key map (kbd "C-c @") 'helm-ff-run-insert-org-link) - (define-key map (kbd "S-") 'helm-ff-sort-alpha) - (define-key map (kbd "S-") 'helm-ff-sort-by-newest) - (define-key map (kbd "S-") 'helm-ff-sort-by-size) - (define-key map (kbd "S-") 'helm-ff-toggle-dirs-only) - (define-key map (kbd "S-") 'helm-ff-toggle-files-only) - (define-key map (kbd "S-") 'helm-ff-sort-by-ext) - (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward - '((C-backspace . helm-ff-run-toggle-auto-update) - ([C-c DEL] . helm-ff-run-toggle-auto-update)) - nil 'helm-ff-delete-char-backward--exit-fn) - (when (fboundp 'tab-bar-mode) - (define-key map (kbd "C-c C-t") 'helm-ff-find-file-other-tab)) - map) - "Keymap for `helm-find-files'.") - -(defvar helm-read-file-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "") 'helm-cr-empty-string) - (define-key map (kbd "M-RET") 'helm-cr-empty-string) - (define-key map (kbd "C-]") 'helm-ff-run-toggle-basename) - (define-key map (kbd "C-.") 'helm-find-files-up-one-level) - (define-key map (kbd "C-l") 'helm-find-files-up-one-level) - (define-key map (kbd "C-:") 'helm-ff-complete-tramp-methods) - (define-key map (kbd "C-_") 'helm-ff-undo) - (define-key map (kbd "C-r") 'helm-find-files-down-last-level) - (define-key map (kbd "C-c h") 'helm-ff-file-name-history) - (define-key map (kbd "C-") 'helm-ff-run-toggle-auto-update) - (define-key map (kbd "C-c ") 'helm-ff-run-toggle-auto-update) - (define-key map (kbd "RET") 'helm-ff-RET) - (helm-define-key-with-subkeys map (kbd "DEL") ?\d 'helm-ff-delete-char-backward - '((C-backspace . helm-ff-run-toggle-auto-update) - ([C-c DEL] . helm-ff-run-toggle-auto-update)) - nil 'helm-ff-delete-char-backward--exit-fn) - map) - "Keymap for `helm-read-file-name'.") - -(defcustom helm-ff-lynx-style-map t - "Use arrow keys to navigate with `helm-find-files'. -Note that if you define this variable with `setq' your change -will have no effect, use customize instead." - :group 'helm-files - :type 'boolean - :set (lambda (var val) - (set var val) - (if val - (progn - (define-key helm-find-files-map (kbd "") 'helm-execute-persistent-action) - (define-key helm-find-files-map (kbd "") 'helm-find-files-up-one-level) - (define-key helm-read-file-map (kbd "") 'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "") 'helm-find-files-up-one-level)) - (define-key helm-find-files-map (kbd "") nil) - (define-key helm-find-files-map (kbd "") nil) - (define-key helm-read-file-map (kbd "") nil) - (define-key helm-read-file-map (kbd "") nil)))) - -(defcustom helm-ff-DEL-up-one-level-maybe nil - "Use DEL to maybe go up one level when non nil. - -Going up one level works only when pattern is a directory endings -with \"/\", otherwise this command deletes char backward. - -When nil always delete char backward." - :group 'helm-files - :type 'boolean) - -(defcustom helm-ff-display-image-native t - "Use native `image-mode' when non nil. - -You should use this only with Emacs>= 27 and `image-auto-resize' -enabled to have images resized properly. When this is enabled, -you have new commands to zoom in/out images. See -`image-transform-resize' and `image-auto-resize'. Otherwise, -when nil `image-dired' is used, using imagemagick as backend. -NOTE: On Emacs-29 `image-dired' is no more using external program -image-magick to display image, so this is used inconditionally even -when value is nil." - :group 'helm-files - :type 'boolean) - -(defcustom helm-ff-reset-filters-on-update t - "Reset filter variables when changing directory. -When filtering directories/files only, switch back to a \"show all\" view -when moving out of directory when non nil." - :type 'boolean - :group 'helm-files) - -(defcustom helm-ff-eshell-unwanted-aliases nil - "A list of eshell aliases to not display." - :type '(repeat string) - :group 'helm-files) - -(defvar helm-ff-last-expanded-candidate-regexp "^[[:multibyte:] ]*%s$" - "Regexp that retrieve previous candidate when going up one level. -The default value matching a multibyte char at bol allows prefixing -candidate with an icon. The format part will be replaced by the -display part of the candidate regexp quoted.") - -;; Internal. -(defvar helm-find-files-doc-header " (\\\\[helm-find-files-up-one-level]: Go up one level)" - "*The doc that is inserted in the Name header of a find-files or dired source.") -(defvar helm-ff-auto-update-flag nil - "Internal, flag to turn on/off auto-update in `helm-find-files'. -Don't set it directly, use instead `helm-ff-auto-update-initial-value'.") -(defvar helm-ff-last-expanded nil - "Store last expanded directory or file.") -(defvar helm-ff-default-directory nil) -(defvar helm-ff-history nil) -(defvar helm-ff-url-regexp - "\\`\\(news\\(post\\)?:\\|nntp:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\):/?/?\\).*" - "Same as `ffap-url-regexp' but match earlier possible url.") -;; helm-tramp-file-name-regexp is based on old version of -;; tramp-file-name-regexp i.e. "\\`/\\([^[/:]+\\|[^/]+]\\):" but it -;; seems it is wrong and a simpler regexp is enough, let's try it and -;; watch out! -(defvar helm-tramp-file-name-regexp "\\`/\\([^/:|]+\\):") -(defvar helm-ff-tramp-method-regexp "[/|]:\\([^:]*\\)") -(defvar helm-marked-buffer-name "*helm marked*") -(defvar helm-ff--auto-update-state nil) -(defvar helm-ff--deleting-char-backward nil) -(defvar helm-multi-files--toggle-locate nil) -(defvar helm-ff--move-to-first-real-candidate t) -(defvar helm-find-files--toggle-bookmark nil) -(defvar helm-ff--tramp-methods nil) -(defvar helm-ff--directory-files-length (make-hash-table :test 'equal) - "Used to count number of candidates in directory. -candidate-number-limit is set to this value if this value is bigger -than `helm-candidate-number-limit'.") -(defvar helm-ff--list-directory-cache (make-hash-table :test 'equal) - "Cache for `helm-find-files' candidates.") -(defvar helm-ff--file-notify-watchers (make-hash-table :test 'equal) - "File-notify watchers for `helm-find-files' are stored here.") -(defvar helm-ff-history-buffer-name "*helm-find-files history*") -(defvar helm-rsync-command-history nil) -(defvar helm-rsync--last-progress-bar-alist nil - "Used to store last valid rsync progress bar.") -(defvar helm-rsync-process-buffer "*helm-rsync*") -(defvar helm-rsync-progress-str-alist nil) -(defvar helm-ff--trash-directory-regexp "\\.?Trash[/0-9]+files/?\\'") -(defvar helm-ff--show-directories-only nil) -(defvar helm-ff--show-files-only nil) -(defvar helm-ff--trashed-files nil - "[INTERNAL] Files already trashed are stored here during file deletion. -This is used only as a let binding.") -(defvar helm-ff--show-thumbnails nil) -(defvar helm-ff--thumbnailed-directories nil) + +(defface helm-ff-rsync-progress-1 + `((t ,@(and (>= emacs-major-version 27) '(:extend t)) + :background "CadetBlue" :foreground "black")) + "Face used for rsync progress bar percentage and proc name." + :group 'helm-files-faces) + +(defface helm-ff-rsync-progress-2 + `((t ,@(and (>= emacs-major-version 27) '(:extend t)) + :background "orange")) + "Face used for rsync progress bar progress." + :group 'helm-files-faces) + +(defface helm-ff-rsync-progress-3 + `((t ,@(and (>= emacs-major-version 27) '(:extend t)) + :background "white")) + "Face used for rsync progress bar background." + :group 'helm-files-faces) + + ;;; Helm-find-files ;; ;; -(defcustom helm-find-files-actions - (helm-make-actions - "Find File" 'helm-find-file-or-marked - "Find file in Dired" 'helm-point-file-in-dired - "View file" 'view-file - "Query replace fnames on marked `M-@'" 'helm-ff-query-replace-fnames-on-marked - "Marked files in dired `C-x C-q, C-u wdired'" 'helm-marked-files-in-dired - "Query replace contents on marked `M-%'" 'helm-ff-query-replace - "Query replace regexp contents on marked `C-M-%'" 'helm-ff-query-replace-regexp - "Attach file(s) to mail buffer `C-c C-a'" 'helm-ff-mail-attach-files - "Serial rename files" 'helm-ff-serial-rename - "Serial rename by symlinking files" 'helm-ff-serial-rename-by-symlink - "Serial rename by copying files" 'helm-ff-serial-rename-by-copying - "Open file with default tool" 'helm-open-file-with-default-tool - "Find file in hex dump" 'hexl-find-file - "Browse project `C-x C-d'" 'helm-ff-browse-project - "Complete at point `C-c i'" 'helm-insert-file-name-completion-at-point - "Insert as org link `C-c @'" 'helm-files-insert-as-org-link - "Find shell command `C-c /'" 'helm-ff-find-sh-command - "Fd shell command (C-/)" 'helm-ff-fd - "Find files in file" 'helm-find-files-in-file - "Add marked files to file-cache" 'helm-ff-cache-add-file - "Open file externally `C-c C-x, C-u to choose'" 'helm-open-file-externally - "Grep File(s) `C-s, C-u Recurse'" 'helm-find-files-grep - "Grep current directory with AG `M-g a, C-u select type'" 'helm-find-files-ag - "Git grep `M-g g, C-u from root'" 'helm-ff-git-grep - "Zgrep File(s) `M-g z, C-u Recurse'" 'helm-ff-zgrep - "Pdf Grep File(s)" 'helm-ff-pdfgrep - "Gid `M-g i'" 'helm-ff-gid - "Switch to Eshell `M-e'" 'helm-ff-switch-to-shell - "Etags `M-., C-u reload tag file'" 'helm-ff-etags-select - "Eshell command on file(s) `M-!, C-u take all marked as arguments.'" - 'helm-find-files-eshell-command-on-file - "Find file as root `C-c r'" 'helm-find-file-as-root - "Find alternate file `C-x C-v'" 'find-alternate-file - "Ediff File `C-c ='" 'helm-find-files-ediff-files - "Ediff Merge File `M-='" 'helm-find-files-ediff-merge-files - (lambda () (format "Delete File(s)%s `M-D' (C-u reverse trash)" - (if (eq helm-ff-delete-files-function - 'helm-delete-marked-files-async) - " async" ""))) - 'helm-ff-delete-files - "Touch File(s) `M-T'" 'helm-ff-touch-files - "Copy file(s) `M-C, C-u to follow'" 'helm-find-files-copy - (lambda () - (and (executable-find "rsync") - "Rsync file(s) `M-V' (C-u edit command)")) - 'helm-find-files-rsync - "Rename file(s) `M-R, C-u to follow'" 'helm-find-files-rename - "Backup files" 'helm-find-files-backup - "Symlink files(s) `M-S, C-u to follow'" 'helm-find-files-symlink - "Relsymlink file(s) `M-Y, C-u to follow'" 'helm-find-files-relsymlink - "Hardlink file(s) `M-H, C-u to follow'" 'helm-find-files-hardlink - "Find file other window `C-c o'" 'helm-find-files-other-window - "Find file other frame `C-c C-o'" 'find-file-other-frame - (lambda () (and (fboundp 'tab-bar-mode) - "Find file other tab `C-c C-t'")) - 'find-file-other-tab - "Print File `C-c p, C-u to refresh'" 'helm-ff-print - "Locate `C-x C-f, C-u to specify locate db'" 'helm-ff-locate) - "Actions for `helm-find-files'." - :group 'helm-files - :type '(alist :key-type string :value-type function)) - (defvar helm-source-find-files nil "The main source to browse files. Should not be used among other sources.") @@ -975,9 +1085,16 @@ Should not be used among other sources.") (volatile :initform t) (cleanup :initform 'helm-find-files-cleanup) (migemo :initform t) - (nohighlight :initform t) + (nohighlight :initform (progn helm-ff-nohighlight-matches)) (keymap :initform 'helm-find-files-map) (candidate-number-limit :initform 'helm-ff-candidate-number-limit) + (suspend-follow-in-update + :initarg :suspend-follow-in-update + :initform t + :documentation "Prevent following candidate when updating.") + (completing-file-name + :initarg :completing-file-name :initform t + :documentation "Flag to notify `helm-resume' we are completing filenames.") (action-transformer :initform 'helm-find-files-action-transformer) (action :initform 'helm-find-files-actions) @@ -1020,25 +1137,6 @@ Should not be used among other sources.") (message "Helm find files session bookmarked! "))) (put 'helm-ff-bookmark-set 'helm-only t) -(defcustom helm-dwim-target nil - "Default target directory for file actions. - -Define the directory where you want to start navigating for the -target directory when copying, renaming, etc.. You can use the -`default-directory' of `next-window', the visited directory, the -current `default-directory' or have completion on all the -directories belonging to each visible windows." - :group 'helm-files - :type '(radio :tag "Define default target directory for file actions." - (const :tag "Directory belonging to next window" - next-window) - (const :tag "Completion on directories belonging to each window" - completion) - (const :tag "Use initial directory or `default-directory'" - default-directory) - (const :tag "Use visited directory" - nil))) - (defun helm-dwim-target-directory () "Try to return a suitable directory according to `helm-dwim-target'." (with-selected-window (or @@ -1151,9 +1249,16 @@ ACTION can be `rsync' or any action supported by `helm-dired-action'." :initial-input (helm-dwim-target-directory) :history (helm-find-files-history nil :comp-read nil)))))) (dest-dir-p (file-directory-p dest)) - (dest-dir (helm-basedir dest))) - (unless (or dest-dir-p (file-directory-p dest-dir)) + (dest-dir (if dest-dir-p dest (helm-basedir dest)))) + ;; We still need to handle directory creation for Emacs version < 27.1 that + ;; doesn't have `dired-create-destination-dirs' and for rsync as well. + (unless (or (and (boundp 'dired-create-destination-dirs) + (null (eq action 'rsync))) + dest-dir-p + (file-directory-p dest-dir)) (when (y-or-n-p (format "Create directory `%s'? " dest-dir)) + ;; When saying No here with rsync, `helm-rsync-copy-files' will raise an + ;; error about dest not existing. (make-directory dest-dir t))) (if (eq action 'rsync) (helm-rsync-copy-files ifiles dest rsync-switches) @@ -1190,12 +1295,55 @@ ACTION can be `rsync' or any action supported by `helm-dired-action'." ;; instead of sending empty string. (unless (equal it "") (push (cons proc it) helm-rsync--last-progress-bar-alist)) - (format " [%s]" (propertize - (or (assoc-default proc helm-rsync--last-progress-bar-alist) - ;; Avoid (wrong-type-argument stringp - ;; nil) when process is not ready. - "") - 'face 'helm-ff-rsync-progress))))) + (if (eq helm-ff-rsync-progress-bar-style 'text) + (format " [%s]" (propertize + (or (assoc-default proc helm-rsync--last-progress-bar-alist) + ;; Avoid (wrong-type-argument stringp + ;; nil) when process is not ready. + "") + 'face 'helm-ff-rsync-progress)) + (format " %s" (or (assoc-default proc helm-rsync--last-progress-bar-alist) + ;; Avoid (wrong-type-argument stringp + ;; nil) when process is not ready. + "")))))) + +(defun helm-ff--rsync-progress-bar (progbar proc) + ;; progbar == " 2,83G 92% 98,65MB/s 0:00:02 " + (let ((infos (split-string + (replace-regexp-in-string + "%" helm-rsync-percent-sign + progbar) + " " t)) + percent info) + (if (eq helm-ff-rsync-progress-bar-style 'text) + (mapconcat 'identity infos " ") + (setq info + (mapconcat (lambda (x) + (pcase x + (`size (nth 0 infos)) + (`percent (nth 1 infos)) + (`speed (nth 2 infos)) + (`remain (nth 3 infos)))) + (helm-mklist helm-ff-rsync-progress-bar-info) + ", ")) + (setq percent (and (string-match "\\([0-9]+\\)%" progbar) + (setq percent (string-to-number + (match-string 1 progbar))))) + (if percent + (format "%s%s%s%s" + (propertize (capitalize (replace-regexp-in-string + "<\\([0-9]+\\)>" "(\\1)" + (process-name proc))) + 'display '(height 0.9) + 'face 'helm-ff-rsync-progress-1) + (propertize " " 'display `(space :width ,(list percent)) + 'face 'helm-ff-rsync-progress-2) + (propertize " " 'display `(space :width ,(list (- 100 percent))) + 'face 'helm-ff-rsync-progress-3) + (propertize info + 'display '(height 0.9) + 'face 'helm-ff-rsync-progress-1)) + "")))) (defun helm-rsync-mode-line (proc) "Add Rsync progress to the mode line." @@ -1224,9 +1372,9 @@ DEST must be a directory. SWITCHES when unspecified default to collect (helm-rsync-remote2rsync f)) dest (helm-rsync-remote2rsync dest)) (let* ((buf (generate-new-buffer-name helm-rsync-process-buffer)) - (port (when (helm-aand (file-remote-p dest 'host) - (string-match "#\\([0-9]+\\)" it)) - (match-string 1))) + (host (file-remote-p dest 'host)) + (port (when (and host (string-match "#\\([0-9]+\\)" host)) + (match-string 1 host))) (proc (start-process-shell-command "rsync" buf (format "rsync %s" @@ -1239,30 +1387,30 @@ DEST must be a directory. SWITCHES when unspecified default to ;; unless user already specified ;; it himself with the -e option ;; by editing command. - (and switches - (cl-loop for arg in switches never - (string-match-p - "\\`-e" arg))) + switches + (cl-loop for arg in switches never + (string-match-p + "\\`-e" arg)) (list (format "-e 'ssh -p %s'" port))) files (list dest)) " "))))) (helm-rsync-mode-line proc) (set-process-sentinel - proc `(lambda (process event) - (cond ((string= event "finished\n") - (message "%s copied %s files" - (capitalize (process-name process)) - ,(length files))) - (t (error "Process %s %s with code %s" - (process-name process) - (process-status process) - (process-exit-status process)))) - (setq helm-rsync-progress-str-alist - (delete (assoc process helm-rsync-progress-str-alist) - helm-rsync-progress-str-alist)) - (helm-rsync-restore-mode-line process) - (force-mode-line-update))) + proc (lambda (process event) + (cond ((string= event "finished\n") + (message "%s copied %s files" + (capitalize (process-name process)) + (length files))) + (t (error "Process %s %s with code %s" + (process-name process) + (process-status process) + (process-exit-status process)))) + (setq helm-rsync-progress-str-alist + (delete (assoc process helm-rsync-progress-str-alist) + helm-rsync-progress-str-alist)) + (helm-rsync-restore-mode-line process) + (force-mode-line-update))) (set-process-filter proc #'helm-rsync-process-filter))) (defun helm-rsync-process-filter (proc output) @@ -1295,15 +1443,9 @@ DEST must be a directory. SWITCHES when unspecified default to (when (re-search-backward "^[^[:cntrl:]]" nil t) (setq fname (helm-basename (buffer-substring-no-properties - (point) (point-at-eol)))))) + (point) (pos-eol)))))) ;; Now format the string for the mode-line. - (let ((ml-str (mapconcat 'identity - (split-string - (replace-regexp-in-string - "%" helm-rsync-percent-sign - progbar) - " " t) - " "))) + (let ((ml-str (helm-ff--rsync-progress-bar progbar proc))) (setq ml-str (propertize ml-str 'help-echo (format "%s->%s" (process-name proc) fname))) ;; Now associate the formatted @@ -1314,7 +1456,7 @@ DEST must be a directory. SWITCHES when unspecified default to (push (cons proc ml-str) helm-rsync-progress-str-alist))))) ;; Finally update mode-line. (unless helm-rsync-no-mode-line-update - (force-mode-line-update)))) + (force-mode-line-update t)))) (defun helm-ff-kill-rsync-process (process) "Kill rsync process PROCESS. @@ -1366,6 +1508,29 @@ This reproduce the behavior of \"cp --backup=numbered from to\"." "Hardlink files from `helm-find-files'." (helm-find-files-do-action 'hardlink)) +(defun helm-ff-chmod (_candidate) + "Set file mode on marked files. +If no mode is specified in prompt, default mode will be the mode of +the car of marked files i.e. the first marked file." + (let* ((mkd (helm-marked-candidates)) + (model (car mkd)) + (default (helm-file-attributes model :octal t)) + (mode (read-file-modes nil model)) + (smode (file-modes-number-to-symbolic mode)) + (candidates (if (string= default (format "%o" mode)) + (cdr mkd) mkd))) + (with-helm-display-marked-candidates + helm-marked-buffer-name + (helm-ff--count-and-collect-dups candidates) + (when (y-or-n-p (format "Change file mode to `%s'? " smode)) + (dolist (f candidates) + (unless (file-symlink-p f) + ;; For now don't use the FLAG arg 'nofollow of `set-file-modes' for + ;; Emacs-26 compatibility. + (set-file-modes f mode))) + (message "Changed file mode to `%s' on %s file(s)" + smode (length candidates)))))) + (defun helm-find-files-other-window (_candidate) "Keep current-buffer and open files in separate windows. When a prefix arg is detected files are opened in a vertical @@ -1547,6 +1712,7 @@ this working." :help-message 'helm-esh-help-message :history 'helm-eshell-command-on-file-history :raw-history t + :reverse-history helm-eshell-on-file-reverse-history :input-history 'helm-eshell-command-on-file-input-history)))) (alias-value (car (assoc-default command eshell-command-aliases-list))) @@ -1813,12 +1979,9 @@ prefix arg shell buffer doesn't exists, create it and switch to it." (length failures) (mapconcat (lambda (f) (format "- %s\n" f)) failures ""))))) -(defun helm-ff-run-touch-files () +(helm-make-command-from-action helm-ff-run-touch-files "Used to interactively run touch file action from keyboard." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-touch-files))) -(put 'helm-ff-run-touch-files 'helm-only t) + 'helm-ff-touch-files) (defun helm-ff-sort-by-size () (interactive) @@ -2174,35 +2337,29 @@ COUNT is used for incrementing new name if needed." (helm-ff-query-replace-on-filenames marked))) ;; The command for `helm-find-files-map'. -(defun helm-ff-run-query-replace-fnames-on-marked () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-query-replace-fnames-on-marked))) -(put 'helm-ff-run-query-replace-fnames-on-marked 'helm-only t) +(helm-make-command-from-action helm-ff-run-query-replace-fnames-on-marked + "Run query-replace on filenames from HFF." + 'helm-ff-query-replace-fnames-on-marked) (defun helm-ff-query-replace (_candidate) (let ((bufs (cl-loop for f in (helm-marked-candidates :with-wildcard t) collect (buffer-name (find-file-noselect f))))) (helm-buffer-query-replace-1 nil bufs))) +(helm-make-command-from-action helm-ff-run-query-replace + "Run query-replace from HFF." + 'helm-ff-query-replace) + (defun helm-ff-query-replace-regexp (_candidate) (let ((bufs (cl-loop for f in (helm-marked-candidates :with-wildcard t) collect (buffer-name (find-file-noselect f))))) (helm-buffer-query-replace-1 'regexp bufs))) -(defun helm-ff-run-query-replace () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-query-replace))) -(put 'helm-ff-run-query-replace 'helm-only t) - -(defun helm-ff-run-query-replace-regexp () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-query-replace-regexp))) -(put 'helm-ff-run-query-replace-regexp 'helm-only t) +(helm-make-command-from-action helm-ff-run-query-replace-regexp + "Run query-replace regexp from HFF." + 'helm-ff-query-replace-regexp) -(defun helm-ff-toggle-auto-update (_candidate) +(defun helm-ff-toggle-auto-update () (if helm-ff--deleting-char-backward (progn (message "[Auto expansion disabled]") @@ -2216,8 +2373,7 @@ COUNT is used for incrementing new name if needed." (defun helm-ff-run-toggle-auto-update () (interactive) (with-helm-alive-p - (helm-set-attr 'toggle-auto-update '(helm-ff-toggle-auto-update . never-split)) - (helm-execute-persistent-action 'toggle-auto-update))) + (helm-ff-toggle-auto-update))) (put 'helm-ff-run-toggle-auto-update 'helm-only t) (defun helm-ff-delete-char-backward () @@ -2313,173 +2469,106 @@ Called with a prefix arg open menu unconditionally." (interactive) (helm-ff-RET-1 t)) -(defun helm-ff-run-grep () - "Run Grep action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-grep))) -(put 'helm-ff-run-grep 'helm-only t) +(helm-make-command-from-action helm-ff-run-grep + "Run Grep action from `helm-source-find-files'." + 'helm-find-files-grep) -(defun helm-ff-run-git-grep () - "Run git-grep action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-git-grep))) -(put 'helm-ff-run-git-grep 'helm-only t) +(helm-make-command-from-action helm-ff-run-git-grep + "Run git-grep action from `helm-source-find-files'." + 'helm-ff-git-grep) -(defun helm-ff-run-grep-ag () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-ag))) -(put 'helm-ff-run-grep-ag 'helm-only t) +(helm-make-command-from-action helm-ff-run-grep-ag + "Run grep AG action from `helm-source-find-files'." + 'helm-find-files-ag) -(defun helm-ff-run-pdfgrep () - "Run Pdfgrep action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-pdfgrep))) -(put 'helm-ff-run-pdfgrep 'helm-only t) +(helm-make-command-from-action helm-ff-run-pdfgrep + "Run Pdfgrep action from `helm-source-find-files'." + 'helm-ff-pdfgrep) -(defun helm-ff-run-zgrep () - "Run Grep action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-zgrep))) -(put 'helm-ff-run-zgrep 'helm-only t) +(helm-make-command-from-action helm-ff-run-zgrep + "Run Grep action from `helm-source-find-files'." + 'helm-ff-zgrep) -(defun helm-ff-run-copy-file () - "Run Copy file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-copy))) -(put 'helm-ff-run-copy-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-copy-file + "Run Copy file action from `helm-source-find-files'." + 'helm-find-files-copy) -(defun helm-ff-run-rsync-file () - "Run Rsync file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-rsync))) -(put 'helm-ff-run-rsync-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-rsync-file + "Run Rsync file action from `helm-source-find-files'." + 'helm-find-files-rsync) -(defun helm-ff-run-rename-file () - "Run Rename file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-rename))) -(put 'helm-ff-run-rename-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-rename-file + "Run Rename file action from `helm-source-find-files'." + 'helm-find-files-rename) -(defun helm-ff-run-byte-compile-file () - "Run Byte compile file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-byte-compile))) -(put 'helm-ff-run-byte-compile-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-byte-compile-file + "Run Byte compile file action from `helm-source-find-files'." + 'helm-find-files-byte-compile) -(defun helm-ff-run-load-file () - "Run Load file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-load-files))) -(put 'helm-ff-run-load-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-load-file + "Run Load file action from `helm-source-find-files'." + 'helm-find-files-load-files) -(defun helm-ff-run-eshell-command-on-file () - "Run eshell command on file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action - 'helm-find-files-eshell-command-on-file))) -(put 'helm-ff-run-eshell-command-on-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-eshell-command-on-file + "Run eshell command on file action from `helm-source-find-files'." + 'helm-find-files-eshell-command-on-file) -(defun helm-ff-run-ediff-file () +(helm-make-command-from-action helm-ff-run-ediff-file "Run Ediff file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-ediff-files))) -(put 'helm-ff-run-ediff-file 'helm-only t) + 'helm-find-files-ediff-files) -(defun helm-ff-run-ediff-merge-file () - "Run Ediff merge file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action - 'helm-find-files-ediff-merge-files))) -(put 'helm-ff-run-ediff-merge-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-ediff-merge-file + "Run Ediff merge file action from `helm-source-find-files'." + 'helm-find-files-ediff-merge-files) -(defun helm-ff-run-symlink-file () - "Run Symlink file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-symlink))) -(put 'helm-ff-run-symlink-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-symlink-file + "Run Symlink file action from `helm-source-find-files'." + 'helm-find-files-symlink) -(defun helm-ff-run-relsymlink-file () - "Run Symlink file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-relsymlink))) -(put 'helm-ff-run-relsymlink-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-relsymlink-file + "Run Symlink file action from `helm-source-find-files'." + 'helm-find-files-relsymlink) -(defun helm-ff-run-hardlink-file () - "Run Hardlink file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-hardlink))) -(put 'helm-ff-run-hardlink-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-hardlink-file + "Run Hardlink file action from `helm-source-find-files'." + 'helm-find-files-hardlink) + +(helm-make-command-from-action helm-ff-run-chmod + "Run chmod action from `helm-source-find-files'." + 'helm-ff-chmod) (defun helm-ff-delete-files (candidate) "Delete files default action." (funcall helm-ff-delete-files-function candidate)) -(defun helm-ff-run-delete-file () - "Run Delete file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action #'helm-ff-delete-files))) -(put 'helm-ff-run-delete-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-delete-file + "Run Delete file action from `helm-source-find-files'." + 'helm-ff-delete-files) -(defun helm-ff-run-complete-fn-at-point () - "Run complete file name action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action - 'helm-insert-file-name-completion-at-point))) -(put 'helm-ff-run-complete-fn-at-point 'helm-only t) +(helm-make-command-from-action helm-ff-run-complete-fn-at-point + "Run complete file name action from `helm-source-find-files'." + 'helm-insert-file-name-completion-at-point) -(defun helm-ff-run-switch-to-shell () - "Run switch to eshell action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-switch-to-shell))) -(put 'helm-ff-run-switch-to-shell 'helm-only t) +(helm-make-command-from-action helm-ff-run-switch-to-shell + "Run switch to eshell action from `helm-source-find-files'." + 'helm-ff-switch-to-shell) -(defun helm-ff-run-switch-other-window () - "Run switch to other window action from `helm-source-find-files'. +(helm-make-command-from-action helm-ff-run-switch-other-window + "Run switch to other window action from `helm-source-find-files'. When a prefix arg is provided, split is done vertically." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-files-other-window))) -(put 'helm-ff-run-switch-other-window 'helm-only t) + 'helm-find-files-other-window) -(defun helm-ff-run-switch-other-frame () - "Run switch to other frame action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'find-file-other-frame))) -(put 'helm-ff-run-switch-other-frame 'helm-only t) +(helm-make-command-from-action helm-ff-run-switch-other-frame + "Run switch to other frame action from `helm-source-find-files'." + 'find-file-other-frame) -(defun helm-ff-run-open-file-externally () - "Run open file externally command action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-open-file-externally))) -(put 'helm-ff-run-open-file-externally 'helm-only t) +(helm-make-command-from-action helm-ff-run-open-file-externally + "Run open file externally command action from `helm-source-find-files'." + 'helm-open-file-externally) -(defun helm-ff-run-open-file-with-default-tool () - "Run open file externally command action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-open-file-with-default-tool))) -(put 'helm-ff-run-open-file-with-default-tool 'helm-only t) +(helm-make-command-from-action helm-ff-run-open-file-with-default-tool + "Run open file externally command action from `helm-source-find-files'." + 'helm-open-file-with-default-tool) (defun helm-ff-locate (candidate) "Locate action function for `helm-find-files'." @@ -2498,48 +2587,33 @@ When a prefix arg is provided, split is done vertically." " -b")))) (helm-locate-1 helm-current-prefix-arg nil 'from-ff default))) -(defun helm-ff-run-locate () - "Run locate action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-locate))) -(put 'helm-ff-run-locate 'helm-only t) +(helm-make-command-from-action helm-ff-run-locate + "Run locate action from `helm-source-find-files'." + 'helm-ff-locate) (defun helm-files-insert-as-org-link (candidate) (insert (format "[[%s][]]" candidate)) (goto-char (- (point) 2))) -(defun helm-ff-run-insert-org-link () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-files-insert-as-org-link))) -(put 'helm-ff-run-insert-org-link 'helm-only t) +(helm-make-command-from-action helm-ff-run-insert-org-link + "Run insert org link from HFF." + 'helm-files-insert-as-org-link) -(defun helm-ff-run-find-file-as-root () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-find-file-as-root))) -(put 'helm-ff-run-find-file-as-root 'helm-only t) +(helm-make-command-from-action helm-ff-run-find-file-as-root + "Run find file as root from HFF." + 'helm-find-file-as-root) -(defun helm-ff-run-find-alternate-file () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'find-alternate-file))) -(put 'helm-ff-run-find-alternate-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-find-alternate-file + "Run `find-alternate-file' from HFF." + 'find-alternate-file) -(defun helm-ff-run-mail-attach-files () - "Run mail attach files command action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-mail-attach-files))) -(put 'helm-ff-run-mail-attach-files 'helm-only t) +(helm-make-command-from-action helm-ff-run-mail-attach-files + "Run mail attach files command action from `helm-source-find-files'." + 'helm-ff-mail-attach-files) -(defun helm-ff-run-etags () - "Run Etags command action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-etags-select))) -(put 'helm-ff-run-etags 'helm-only t) +(helm-make-command-from-action helm-ff-run-etags + "Run Etags command action from `helm-source-find-files'." + 'helm-ff-etags-select) (defvar lpr-printer-switch) (defun helm-ff-print (_candidate) @@ -2590,12 +2664,9 @@ Same as `dired-do-print' but for Helm." (start-process-shell-command "helm-print" nil cmd-line) (error "Error: Please verify your printer settings in Emacs.")))) -(defun helm-ff-run-print-file () - "Run Print file action from `helm-source-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-print))) -(put 'helm-ff-run-print-file 'helm-only t) +(helm-make-command-from-action helm-ff-run-print-file + "Run Print file action from `helm-source-find-files'." + 'helm-ff-print) (defun helm-ff-checksum (file) "Calculate the checksum of FILE. @@ -2632,22 +2703,56 @@ Emacs and even the whole system as it eats all memory." (message "Calculating %s checksum for `%s' done and copied to kill-ring" algo bn))))) -(defun helm-ff-toggle-basename (_candidate) +(defun helm-ff-toggle-basename () (with-helm-buffer (setq helm-ff-transformer-show-only-basename (not helm-ff-transformer-show-only-basename)) - (let* ((cand (helm-get-selection nil t)) + (let* ((cand (helm-get-selection)) (target (if helm-ff-transformer-show-only-basename (helm-basename cand) cand))) - (helm-force-update (concat (regexp-quote target) "$"))))) + (helm-force-update + (format helm-ff-last-expanded-candidate-regexp + (regexp-quote target)))))) (defun helm-ff-run-toggle-basename () (interactive) (with-helm-alive-p (unless (helm-empty-source-p) - (helm-ff-toggle-basename nil)))) + (helm-ff-toggle-basename)))) (put 'helm-ff-run-toggle-basename 'helm-only t) +(defun helm-ff-mark-similar-files-1 () + "Mark similar files. +Files are considered similar if they have the same face and same +extension." + (with-helm-window + (let* ((src (helm-get-current-source)) + (file (helm-get-selection nil 'withprop src)) + (face (get-text-property (min 2 (length file)) 'face file)) + (ext (file-name-extension file))) + (helm-map-candidates-in-source src + (lambda (_cand) (helm-make-visible-mark)) + (lambda (cand) + (and (not (helm-this-visible-mark)) + (eq (get-text-property (min 2 (length cand)) 'face cand) face) + (equal ext (file-name-extension cand))))) + (helm-mark-current-line) + (helm-display-mode-line src t) + (when helm-marked-candidates + (message "%s candidates marked" (length helm-marked-candidates)) + (set-window-margins (selected-window) 1))))) + +(defun helm-ff-mark-similar-files () + "Mark all files similar to selection." + (interactive) + (with-helm-alive-p + (let ((marked (helm-marked-candidates))) + (if (and (>= (length marked) 1) + (with-helm-window helm-visible-mark-overlays)) + (helm-unmark-all) + (helm-ff-mark-similar-files-1))))) +(put 'helm-ff-mark-similar-files 'helm-only t) + (defun helm-reduce-file-name-1 (fname level) ;; This is the old version of helm-reduce-file-name, we still use it ;; with ftp fnames as expand-file-name is not working as expected @@ -2707,13 +2812,17 @@ If prefix numeric arg is given go ARG level up." (let ((cur-cand (helm-get-selection nil nil src)) (new-pattern (helm-reduce-file-name helm-pattern arg))) ;; Ensure visibility on all candidates for preselection. - (helm-set-attr 'candidate-number-limit - (if helm-ff-up-one-level-preselect - (max (gethash new-pattern - helm-ff--directory-files-length - helm-ff-candidate-number-limit) - helm-ff-candidate-number-limit) - helm-ff-candidate-number-limit)) + (unless (helm-empty-source-p) + ;; We may have an empty source in read-file-name when a + ;; predicate is used e.g. images and the default is a non + ;; file image. + (helm-set-attr 'candidate-number-limit + (if helm-ff-up-one-level-preselect + (max (gethash new-pattern + helm-ff--directory-files-length + helm-ff-candidate-number-limit) + helm-ff-candidate-number-limit) + helm-ff-candidate-number-limit))) (cond ((file-directory-p helm-pattern) (setq helm-ff-last-expanded helm-ff-default-directory)) ((file-exists-p helm-pattern) @@ -2832,10 +2941,14 @@ when `helm-pattern' is equal to \"~/\"." (let* ((history-p (string= (assoc-default 'name src) "Read File Name History")) (pat (helm-ff-set-pattern helm-pattern)) - (completed-p (string= (file-name-as-directory - (expand-file-name - (substitute-in-file-name pat))) - helm-ff-default-directory)) + ;; Try to shut up persistent tramp error with adb method when + ;; adding tilde to path. + (tramp-tolerate-tilde (equal (file-remote-p pat 'method) + tramp-adb-method)) + (completed-p (helm-aand (expand-file-name + (substitute-in-file-name pat)) + (string= (file-name-as-directory it) + helm-ff-default-directory))) (candnum (helm-get-candidate-number)) (lt2-p (and (<= candnum 2) (>= (string-width (helm-basename helm-pattern)) 2))) @@ -2878,7 +2991,7 @@ when `helm-pattern' is equal to \"~/\"." (not history-p) ; Don't try to auto complete in history. (stringp cur-cand) (file-accessible-directory-p cur-cand)) - (if (and (not (helm-dir-is-dot cur-cand)) ; [1] + (if (and (not (helm-ff-dot-file-p cur-cand)) ; [1] ;; Maybe we are here because completed-p is true ;; but check this again to be sure. (Windows fix) (<= candnum 2)) ; [2] @@ -3021,7 +3134,7 @@ and should be used carefully elsewhere, or not at all, using (string-match-p "/[[:alpha:]]:/" match)) (1+ (match-beginning 0)) (match-beginning 0))) - (buffer-substring-no-properties (point) (point-at-eol))) + (buffer-substring-no-properties (point) (pos-eol))) fname))))) (defun helm-point-file-in-dired (file) @@ -3035,9 +3148,10 @@ and should be used carefully elsewhere, or not at all, using (defun helm-marked-files-in-dired (_candidate) "Open a dired buffer with only marked files. -With a prefix arg toggle dired buffer to wdired mode." - (advice-add 'wdired-finish-edit :override #'helm--advice-wdired-finish-edit) - (advice-add 'wdired-get-filename :override #'helm--advice-wdired-get-filename) +With a prefix arg toggle dired buffer to wdired mode. + +Note: This function works only in Emacs-29+ because Wdired doesn't support +editing absolute fnames in previous Emacs versions." (let* ((marked (helm-marked-candidates :with-wildcard t)) (current (car marked))) (unless (and helm--url-regexp @@ -3048,12 +3162,20 @@ With a prefix arg toggle dired buffer to wdired mode." (when (or helm-current-prefix-arg current-prefix-arg) (call-interactively 'wdired-change-to-wdired-mode)))))) -(defun helm-ff-run-marked-files-in-dired () - "Execute `helm-marked-files-in-dired' interactively." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-marked-files-in-dired))) -(put 'helm-ff-run-marked-files-in-dired 'helm-only t) +(defun helm-ff-wfnames (_candidate) + "Edit marked fnames with `Wfnames' package." + (cl-assert (require 'wfnames nil t) nil "Wfnames package not found") + (let ((marked (helm-marked-candidates :with-wildcard t))) + (wfnames-setup-buffer + marked #'switch-to-buffer (buffer-live-p (get-buffer wfnames-buffer))))) + +(defun helm-ff-edit-marked-files (candidate) + "Edit marked files with `helm-ff-edit-marked-files-fn' fn." + (funcall helm-ff-edit-marked-files-fn candidate)) + +(helm-make-command-from-action helm-ff-run-edit-marked-files + "Execute `helm-ff-edit-marked-files' interactively." + 'helm-ff-edit-marked-files) (defun helm-ff--create-tramp-name (fname) "Build filename from `helm-pattern' like /su:: or /sudo::." @@ -3090,7 +3212,7 @@ With a prefix arg toggle dired buffer to wdired mode." "\\):") nil t) (list - (buffer-substring-no-properties (point-at-bol) (match-beginning 2)) + (buffer-substring-no-properties (pos-bol) (match-beginning 2)) (buffer-substring-no-properties (match-beginning 2) (match-end 2))))))) (defun helm-ff--get-host-from-tramp-invalid-fname (fname) @@ -3175,7 +3297,7 @@ debugging purpose." (or (looking-back "[/|]" (1- (point))) (looking-back (mapconcat (lambda (m) (format "[/|]%s" m)) methods "\\|") - (point-at-bol)))) + (pos-bol)))) (setq result nil) (setq result it))))) result)) @@ -3324,6 +3446,7 @@ debugging purpose." (or (>= (length (helm-basename path)) 3) dir-p))) ;; At this point the tramp connection is triggered. (helm-log + "helm-find-files-get-candidates" "Pattern=%S" (setq helm-pattern (if (string-match helm-ff-tramp-method-regexp path) ;; A tramp method, don't modify pattern. @@ -3528,35 +3651,28 @@ later in the transformer." (helm-acase (match-string 0) ("*" (replace-match "") (put-text-property - (point-at-bol) (point-at-eol) 'helm-ff-exe t)) + (pos-bol) (pos-eol) 'helm-ff-exe t)) ("@" (replace-match "") (put-text-property - (point-at-bol) (point-at-eol) 'helm-ff-sym t)) + (pos-bol) (pos-eol) 'helm-ff-sym t)) ("/" (replace-match "") (put-text-property - (point-at-bol) (point-at-eol) 'helm-ff-dir t)) + (pos-bol) (pos-eol) 'helm-ff-dir t)) (("=" "|" ">") (replace-match ""))))) (while (re-search-forward "[\"]" nil t) (replace-match "")) (add-text-properties (point-min) (point-max) '(helm-ff-file t)) (split-string (buffer-string) "\n" t))))) -(defcustom helm-ff-use-notify t - "Watch directories visited with `helm-find-files' when non nil. -If your system have no file notification package available turn this -to nil to avoid error messages when using `helm-find-files'." - :type 'boolean - :group 'helm-files - :set (lambda (var val) - (set-default var val) - (unless (symbol-value var) - (cl-loop for dir being the hash-keys of helm-ff--file-notify-watchers - do (remhash dir helm-ff--list-directory-cache))))) - -(defcustom helm-ff-inotify-unsupported-methods '("adb") - "Tramp methods unsupported by file-notify." - :type '(repeat string) - :group 'helm-files) +;; This is to fix issue with file-notify.el no more following symlinks +;; on emacs-29 (regression) with inotify backend at least. Also it +;; seems inotify is not configured to follow symlinks on other systems +;; (MacOS) so this should fix as well this issue on such systems see +;; bug#2542. +;; Store here associations of (truename . symlink) when opening a +;; symlinked directory, then add the watch to the truename; When the +;; watcher ring on the truename remove the symlinked directory from cache. +(defvar helm-ff--list-directory-links nil) (defun helm-ff-directory-files (directory &optional force-update) "List contents of DIRECTORY. @@ -3566,9 +3682,14 @@ filename \\='.' and \\='..' even on root directories in Windows systems. When FORCE-UPDATE is non nil recompute candidates even if DIRECTORY is in cache." - (let ((method (file-remote-p directory 'method))) + (let* ((method (file-remote-p directory 'method)) + (dfn (directory-file-name directory)) + (truename (and (file-symlink-p dfn) (file-truename dfn)))) (setq directory (file-name-as-directory (expand-file-name directory))) + (when truename + (cl-pushnew (cons truename directory) + helm-ff--list-directory-links :test 'equal)) (or (and (not force-update) (gethash directory helm-ff--list-directory-cache)) (let* (file-error @@ -3590,7 +3711,8 @@ in cache." (setq file-error t))))) (dot (concat directory ".")) (dot2 (concat directory "..")) - (candidates (append (and (not file-error) (list dot dot2)) ls))) + (candidates (append (and (not file-error) (list dot dot2)) ls)) + watcher) (puthash directory (+ (length ls) 2) helm-ff--directory-files-length) (prog1 (puthash directory @@ -3601,30 +3723,72 @@ in cache." ;; Put an inotify watcher to check directory modifications. (unless (or (null helm-ff-use-notify) (member method helm-ff-inotify-unsupported-methods) - (gethash directory helm-ff--file-notify-watchers)) + (helm-aand (setq watcher (gethash + directory + helm-ff--file-notify-watchers)) + ;; [1] If watcher is invalid enter + ;; next and delete it. + (file-notify-valid-p it))) (condition-case-unless-debug err - (puthash directory - (file-notify-add-watch - directory - '(change attribute-change) - (helm-ff--inotify-make-callback directory)) - helm-ff--file-notify-watchers) + (let ((to-watch (or truename directory))) + (when watcher + ;; If watcher is still in cache and we are here, + ;; that's mean test [1] above fails and watcher + ;; is invalid, so delete it. + (file-notify-rm-watch watcher) + (remhash directory helm-ff--file-notify-watchers)) + ;; Keep adding DIRECTORY to + ;; helm-ff--file-notify-watchers but watch on the + ;; truename and not the symlink as before bug#2542. + (puthash directory + (file-notify-add-watch + to-watch + '(change attribute-change) + (helm-ff--inotify-make-callback to-watch)) + helm-ff--file-notify-watchers)) (file-notify-error (user-error "Error: %S %S" (car err) (cdr err)))))))))) (defun helm-ff--inotify-make-callback (directory) "Return a callback for `file-notify-add-watch'." (lambda (event) - (let ((desc (cadr event))) + (let ((desc (cadr event)) + (target directory)) ; Either truename or directory. + (helm-log "Inotify callback" "Event %S called on %S" event directory) ;; `attribute-changed' means permissions have changed, not ;; file modifications like file changes, visit ;; etc... AFAIU the desc for this is `changed' and for our - ;; use case we don't care of this. + ;; use case we don't care of this. Elemnts of + ;; `helm-ff--list-directory-links' are of the form + ;; (truename . visited-symlink-directory) (when (memq desc '(created deleted renamed attribute-changed)) - ;; When DIRECTORY is modified remove it from cache. - (remhash directory helm-ff--list-directory-cache) - ;; Remove watch as well in case of rename or delete. - (file-notify-rm-watch (gethash directory helm-ff--file-notify-watchers)) - (remhash directory helm-ff--file-notify-watchers))))) + ;; Watched directory is the truename which is not in the + ;; cache, so remove its associated directory (the symlink) + ;; from the cache bug#2542. + (helm-aif (assoc directory helm-ff--list-directory-links) + (progn + (setq target (cdr it)) + (setq helm-ff--list-directory-links + (delete it helm-ff--list-directory-links)))) + ;; When TARGET is modified remove it from cache. + (helm-log "Inotify callback" + "Removing %S from `helm-ff--list-directory-cache'" target) + (remhash target helm-ff--list-directory-cache))))) + +(defun helm-ff-tramp-cleanup-hook (vec) + "Remove remote directories related to VEC in helm-ff* caches. +Remove as well all related file-notify watchers. + +This is meant to run in `tramp-cleanup-connection-hook'." + (cl-loop for key being the hash-keys in helm-ff--list-directory-cache + when (equal (file-remote-p key 'method) (cadr vec)) + do (remhash key helm-ff--list-directory-cache)) + (cl-loop for key being the hash-keys in helm-ff--file-notify-watchers + when (equal (file-remote-p key 'method) (cadr vec)) + do (progn + (file-notify-rm-watch + (gethash key helm-ff--file-notify-watchers)) + (remhash key helm-ff--file-notify-watchers)))) +(add-hook 'tramp-cleanup-connection-hook #'helm-ff-tramp-cleanup-hook) (defun helm-ff-handle-backslash (fname) ;; Allow creation of filenames containing a backslash. @@ -3692,8 +3856,8 @@ If PATTERN is a valid directory name, return PATTERN unchanged." (helm--mapconcat-pattern bn) (concat ".*" (regexp-quote bn)))))))) -(defun helm-dir-is-dot (dir) - (string-match "\\(?:/\\|\\`\\)\\.\\{1,2\\}\\'" dir)) +(defalias 'helm-dir-is-dot 'helm-ff-dot-file-p) +(make-obsolete 'helm-dir-is-dot 'helm-ff-dot-file-p "3.8.8") (defun helm-ff-save-history () "Store the last value of `helm-ff-default-directory' in `helm-ff-history'. @@ -3727,8 +3891,7 @@ to avoid an unnecessary call to `file-truename'." "Show file properties of CANDIDATE in a tooltip or message." (require 'helm-external) ; For `helm-get-default-program-for-file'. (helm-aif (helm-file-attributes candidate) - (let* ((dired-line (helm-file-attributes - candidate :dired t :human-size t)) + (let* ((dired-line (helm-file-attributes-dired-line it t)) (type (cl-getf it :type)) (mode-type (cl-getf it :mode-type)) (owner (cl-getf it :uid)) @@ -3736,6 +3899,7 @@ to avoid an unnecessary call to `file-truename'." (group (cl-getf it :gid)) (group-right (cl-getf it :group)) (other-right (cl-getf it :other)) + (octal (cl-getf it :octal)) (trash (and (helm-ff-trash-file-p candidate) (helm-ff--get-dest-file-from-trash (helm-ff-trash-list) @@ -3765,6 +3929,7 @@ to avoid an unnecessary call to `file-truename'." (format "Owner: %s: %s\n" owner owner-right) (format "Group: %s: %s\n" group group-right) (format "Others: %s\n" other-right) + (format "NumMode: %s\n" octal) (format "Size: %s\n" size) (when (string= type "directory") (format "Size used in directory: %s\n" @@ -3778,21 +3943,23 @@ to avoid an unnecessary call to `file-truename'." (message dired-line) (sit-for 5))) (message "Permission denied, file not readable"))) -(defun helm-ff-properties-persistent () - "Show properties without quitting helm." - (interactive) - (with-helm-alive-p - (helm-set-attr 'properties-action '(helm-ff-properties . never-split)) - (helm-execute-persistent-action 'properties-action))) -(put 'helm-ff-properties-persistent 'helm-only t) +(helm-make-persistent-command-from-action helm-ff-properties-persistent + "Show properties without quitting helm." + 'properties-action 'helm-ff-properties) -(defun helm-ff-persistent-delete () - "Delete current candidate without quitting." - (interactive) - (with-helm-alive-p - (helm-set-attr 'quick-delete '(helm-ff-quick-delete . never-split)) - (helm-execute-persistent-action 'quick-delete))) -(put 'helm-ff-persistent-delete 'helm-only t) +(helm-make-persistent-command-from-action helm-ff-persistent-delete + "Delete current candidate without quitting." + 'quick-delete 'helm-ff-quick-delete) + +(defun helm-ff-kill-default-directory (_candidate) + (with-helm-window + (kill-new helm-ff-default-directory) + (message "`%s' copied to kill-ring" helm-ff-default-directory))) + +(helm-make-persistent-command-from-action helm-ff-run-kill-default-directory + "Kill `helm-ff-default-directory'." + 'kill-default-directory + 'helm-ff-kill-default-directory) (defun helm-ff-dot-file-p (file) "Check if FILE is `.' or `..'." @@ -3817,8 +3984,11 @@ in `helm-find-files-persistent-action-if'." (let* ((buf (get-file-buffer candidate)) (buf-name (buffer-name buf)) (win (get-buffer-window buf)) - (helm--reading-passwd-or-string t)) - (cond ((and buf win (eq buf (get-buffer helm-current-buffer))) + (helm--reading-passwd-or-string t) + ;; Prevent tramp from asking yes-or-no-p for + ;; `tramp-allow-unsafe-temporary-files'. + auto-save-default) + (cond ((and buf win (eql buf (get-buffer helm-current-buffer))) (user-error "Can't kill `helm-current-buffer' without quitting session")) ((and buf win (buffer-modified-p buf)) @@ -3832,13 +4002,9 @@ in `helm-find-files-persistent-action-if'." (message "Buffer `%s' killed" buf-name)) (t (find-file candidate))))) -(defun helm-ff-run-kill-buffer-persistent () - "Execute `helm-ff-kill-buffer-fname' without quitting." - (interactive) - (with-helm-alive-p - (helm-set-attr 'kill-buffer-fname 'helm-ff-kill-buffer-fname) - (helm-execute-persistent-action 'kill-buffer-fname))) -(put 'helm-ff-run-kill-buffer-persistent 'helm-only t) +(helm-make-persistent-command-from-action helm-ff-run-kill-buffer-persistent + "Execute `helm-ff-kill-buffer-fname' without quitting." + 'kill-buffer-fname 'helm-ff-kill-buffer-fname) ;; Preview with external tool (defun helm-ff-persistent-open-file-externally (file) @@ -3848,42 +4014,58 @@ in `helm-find-files-persistent-action-if'." (message "Please configure an external program for `*%s' file in `helm-external-programs-associations'" (file-name-extension file t)))) -(defun helm-ff-run-preview-file-externally () - (interactive) - (with-helm-alive-p - (helm-set-attr 'open-file-externally '(helm-ff-persistent-open-file-externally . never-split)) - (helm-execute-persistent-action 'open-file-externally))) -(put 'helm-ff-run-preview-file-externally 'helm-only t) - -(defun helm-ff-prefix-filename (fname &optional file-or-symlinkp new-file) - "Add display property to FNAME. -Display property presents a string maybe prefixed with [?] or [@]. -If FILE-OR-SYMLINKP is non-nil this means we assume FNAME is an -existing filename or valid symlink and there is no need to test -it. -NEW-FILE when non-nil means FNAME is a non existing file and -return FNAME with display property prefixed with [?]." - (let* ((prefix-new (propertize - " " 'display - (propertize "[?]" 'face 'helm-ff-prefix))) - (prefix-url (propertize - " " 'display - (propertize "[@]" 'face 'helm-ff-prefix)))) - (cond (file-or-symlinkp fname) - ((or (string-match helm-ff-url-regexp fname) - (and helm--url-regexp (string-match helm--url-regexp fname))) - (concat prefix-url " " fname)) - (new-file (concat prefix-new " " fname))))) +(helm-make-persistent-command-from-action helm-ff-run-preview-file-externally + "Run open file externally without quitting helm." + 'open-file-externally 'helm-ff-persistent-open-file-externally) + +(defun helm-ff-prefix-filename (disp fname &optional new-file) + "Return DISP maybe prefixed with a string or an icon. + +Arg FNAME is the real filename whereas DISP is the display part of candidate. + +Icons are used when `helm-ff-icon-mode' is enabled. + +When NEW-FILE is non nil, returns a string prefixed with +[+] or [@] or a special icon, otherwise DISP is +returned prefixed with its icon or unchanged." + (let (prefix-new prefix-url) + (cond ((and new-file + (or (string-match helm-ff-url-regexp disp) + (and helm--url-regexp + (string-match helm--url-regexp disp)))) + (setq prefix-url + (if helm-ff-icon-mode + (helm-acase (match-string 1 disp) + ("mailto:" + (all-the-icons-octicon "mail")) + (t (all-the-icons-octicon "link-external"))) + (propertize + " " 'display + (propertize "[@]" 'face 'helm-ff-prefix)))) + (add-text-properties 0 1 '(helm-url t) prefix-url) + (concat prefix-url " " disp)) + (new-file + (setq prefix-new + (if helm-ff-icon-mode + (if (string-match "/\\'" disp) + (all-the-icons-material "create_new_folder") + (all-the-icons-material "note_add")) + (propertize + " " 'display + (propertize "[+]" 'face 'helm-ff-prefix)))) + (add-text-properties 0 1 '(helm-new-file t) prefix-new) + (concat prefix-new " " disp)) + (t (concat (helm-ff-get-icon disp fname) disp))))) (defun helm-ff-score-candidate-for-pattern (real disp pattern) - (if (or (member real '("." "..")) - ;; Incomplete filenames are prefixed with two spaces, the - ;; first one beeing propertized with a 'display prop - ;; i.e. "[?] foo". - (and (string-match-p "\\`\\s-\\{2\\}" disp) - (string= real (substring-no-properties disp 2)))) - 900000 - (helm-score-candidate-for-pattern real pattern))) + (cond ((member real '("." "..")) 900000) + ((and (string-match-p "\\`\\s-\\{2\\}" disp) + (string= real (substring-no-properties disp 2))) + ;; Incomplete filenames are prefixed with two spaces, the + ;; first one beeing propertized with a 'display prop + ;; i.e. "[+] foo". + 900001) + (t (helm-score-candidate-for-pattern real pattern)))) (defun helm-ff-sort-candidates-1 (candidates input) "Sort function for `helm-source-find-files'. @@ -3956,8 +4138,9 @@ If SKIP-BORING-CHECK is non nil don't filter boring files." (let* ((basename (helm-basename file)) (dot (helm-ff-dot-file-p file)) (urlp (string-match-p helm-ff-url-regexp file)) - ;; Filename with cntrl chars e.g. foo^J - (disp (or (helm-ff--get-host-from-tramp-invalid-fname file) + (tramp-invalid-fname (helm-ff--get-host-from-tramp-invalid-fname file)) + (disp (or tramp-invalid-fname + ;; Filename with cntrl chars e.g. foo^J (replace-regexp-in-string "[[:cntrl:]]" "?" (if (or reverse urlp) file basename)))) @@ -3985,47 +4168,58 @@ If SKIP-BORING-CHECK is non nil don't filter boring files." ;; Handle tramp files with minimal highlighting. (if (and (or (string-match-p helm-tramp-file-name-regexp helm-pattern) (helm-file-on-mounted-network-p helm-pattern))) - (let* ((hostp (helm-ff--get-host-from-tramp-invalid-fname file))) - (helm-acond (;; Dot directories . and .. - dot - (cons (propertize file 'face 'helm-ff-dotted-directory) file)) - ;; Directories. - ((get-text-property 1 'helm-ff-dir file) - (cons (propertize disp 'face 'helm-ff-directory) file)) - ;; Backup files. - (backup - (cons (propertize disp 'face 'helm-ff-backup-file) file)) - ;; Executable files. - ((get-text-property 1 'helm-ff-exe file) - (add-face-text-property 0 len 'helm-ff-executable t disp) - (cons disp file)) - ;; Symlinks. - ((get-text-property 1 'helm-ff-sym file) - (add-face-text-property 0 len 'helm-ff-symlink t disp) - (if (stringp it) ; adb method. - (progn - (add-face-text-property 0 (length it) 'helm-ff-truename nil it) - (cons (propertize disp 'display (concat disp " ->" it)) file)) - (cons disp file))) - ;; Regular files. - ((get-text-property 1 'helm-ff-file file) - (add-face-text-property 0 len 'helm-ff-file t disp) - (cons disp file)) - ;; Tramp methods. - ((string-match helm-ff-tramp-method-regexp file) - (let ((method (match-string 1 file)) - (mh (helm-ff--tramp-multihops-p helm-pattern))) - (cons (propertize (concat (if mh "" "/") method) 'face 'helm-ff-file) - (if mh - (concat (match-string 1 helm-pattern) ":" method) - (concat "/:" method))))) - ;; non existing files. - (t - (add-face-text-property 0 len 'helm-ff-file t disp) - (cons (helm-ff-prefix-filename - disp - hostp (unless hostp 'new-file)) - file)))) + (helm-acond (;; Dot directories . and .. + dot + (cons (helm-ff-prefix-filename + (propertize file 'face 'helm-ff-dotted-directory) + file) + file)) + ;; Directories. + ((get-text-property 1 'helm-ff-dir file) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-directory) + file) + file)) + ;; Backup files. + (backup + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-backup-file) + file) + file)) + ;; Executable files. + ((get-text-property 1 'helm-ff-exe file) + (add-face-text-property 0 len 'helm-ff-executable t disp) + (cons (helm-ff-prefix-filename disp file) file)) + ;; Symlinks. + ((get-text-property 1 'helm-ff-sym file) + (add-face-text-property 0 len 'helm-ff-symlink t disp) + (if (stringp it) ; adb method. + (progn + (add-face-text-property 0 (length it) 'helm-ff-truename nil it) + (cons (propertize disp 'display (concat disp " ->" it)) file)) + (cons (helm-ff-prefix-filename disp file) file))) + ;; Regular files. + ((get-text-property 1 'helm-ff-file file) + (add-face-text-property 0 len 'helm-ff-file t disp) + (cons (helm-ff-prefix-filename disp file) file)) + ;; Tramp methods. + ((string-match helm-ff-tramp-method-regexp file) + (let ((method (match-string 1 file)) + (mh (helm-ff--tramp-multihops-p helm-pattern))) + (cons (propertize (concat (if mh "" "/") method) 'face 'helm-ff-file) + (if mh + (concat (match-string 1 helm-pattern) ":" method) + (concat "/:" method))))) + ;; non existing files. + (t + (add-face-text-property 0 len 'helm-ff-file t disp) + (when tramp-invalid-fname + (add-text-properties 0 len `(host ,tramp-invalid-fname) disp)) + (cons (helm-ff-prefix-filename + disp + file + (unless tramp-invalid-fname 'new-file)) + file))) ;; Highlight local files showing everything, symlinks, exe, ;; dirs etc... @@ -4049,16 +4243,25 @@ If SKIP-BORING-CHECK is non nil don't filter boring files." (not (helm-ff-valid-symlink-p file)) (not (string-match "^\\.#" basename))) (add-face-text-property 0 len 'helm-ff-invalid-symlink t disp) - (cons disp file)) + (cons (helm-ff-prefix-filename disp file) file)) ;; A dotted directory symlinked. ((and dot (stringp type)) - (cons (propertize file 'face 'helm-ff-dotted-symlink-directory) file)) + (cons (helm-ff-prefix-filename + (propertize file 'face 'helm-ff-dotted-symlink-directory) + file) + file)) ;; A dotted directory. (dot - (cons (propertize file 'face 'helm-ff-dotted-directory) file)) + (cons (helm-ff-prefix-filename + (propertize file 'face 'helm-ff-dotted-directory) + file) + file)) ;; Backup files. (backup - (cons (propertize disp 'face 'helm-ff-backup-file) file)) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-backup-file) + file) + file)) ;; A symlink. ((stringp type) (let* ((abbrev (abbreviate-file-name type)) @@ -4071,32 +4274,37 @@ If SKIP-BORING-CHECK is non nil don't filter boring files." (add-face-text-property 0 len-abbrev 'helm-ff-truename t abbrev) ;; Colorize extension only on truename. (add-face-text-property 0 len 'helm-ff-symlink nil disp) - (cons (propertize disp 'display (concat disp " -> " abbrev)) + ;; As we use match-on-real we can use this safely, + ;; abbrev will not be matched. + (cons (concat (helm-ff-prefix-filename disp file) " -> " abbrev) file))) ;; A directory. ((eq t type) - (cons (propertize disp 'face 'helm-ff-directory) file)) + (cons (helm-ff-prefix-filename + (propertize disp 'face 'helm-ff-directory) + file) + file)) ;; A character device file. ((and attr (string-match "\\`[cp]" (setq x-bit (substring (nth 8 attr) 0 4)))) (add-face-text-property 0 len 'helm-ff-pipe t disp) - (cons disp file)) + (cons (helm-ff-prefix-filename disp file) file)) ;; A socket file. ((and attr (string-match "\\`[s]" x-bit)) (add-face-text-property 0 len 'helm-ff-socket t disp) - (cons disp file)) + (cons (helm-ff-prefix-filename disp file) file)) ;; An executable file. ((and attr (string-match "x\\'" x-bit)) (add-face-text-property 0 len 'helm-ff-executable t disp) - (cons disp file)) + (cons (helm-ff-prefix-filename disp file) file)) ;; An executable file with suid ((and attr (string-match "s\\'" x-bit)) (add-face-text-property 0 len 'helm-ff-suid t disp) - (cons disp file)) + (cons (helm-ff-prefix-filename disp file) file)) ;; A file. ((and attr (null type)) (add-face-text-property 0 len 'helm-ff-file t disp) - (cons disp file)) + (cons (helm-ff-prefix-filename disp file) file)) ;; A tramp method ;; At this point no need to handle multi hops syntax ;; which is considered remote and handled in first @@ -4108,48 +4316,43 @@ If SKIP-BORING-CHECK is non nil don't filter boring files." ;; A non--existing file. (t (add-face-text-property 0 len 'helm-ff-nofile t disp) - (cons (helm-ff-prefix-filename - disp nil 'new-file) + (cons (helm-ff-prefix-filename disp file 'new-file) file)))))))) -(defun helm-ff-icons-transformer (candidates _source) - "Transformer for HFF that prefix candidates with icons." - (cl-loop for (disp . fname) in candidates - for icon = (helm-ff-get-icon disp fname) - collect (cons (concat icon disp) fname))) - (defun helm-ff-get-icon (disp file) "Get icon from all-the-icons for FILE. -Arg DISP is the display part of the candidate." - (let ((icon (helm-acond (;; Non symlink directories. - (helm-ff--is-dir-from-disp disp) - (all-the-icons-octicon "file-directory")) - (;; All files, symlinks may be symlink directories. - (helm-ff--is-file-from-disp disp) - ;; Detect symlink directories. We must call - ;; `file-directory-p' here but it is - ;; limited to symlinks, so it should not - ;; degrade too much performances. - (if (and (memq it '(helm-ff-symlink - helm-ff-dotted-symlink-directory)) - (file-directory-p file)) - (let* ((icon (all-the-icons-match-to-alist - (helm-basename file) - all-the-icons-dir-icon-alist)) - (args (cdr icon))) - (apply #'all-the-icons-octicon - "file-symlink-directory" (cdr args))) - (all-the-icons-icon-for-file file)))))) - (when icon (concat icon " ")))) +Arg DISP is the display part of the candidate. +Arg FILE is the real part of candidate, a filename with no props." + (when helm-ff-icon-mode + (let ((icon (helm-acond (;; Non symlink directories. + (helm-ff--is-dir-from-disp disp) + (helm-aif (all-the-icons-match-to-alist + (helm-basename file) + all-the-icons-dir-icon-alist) + (apply (car it) (cdr it)) + (all-the-icons-octicon "file-directory"))) + (;; All files, symlinks may be symlink directories. + (helm-ff--is-file-from-disp disp) + ;; Detect symlink directories. We must call + ;; `file-directory-p' here but it is + ;; limited to symlinks, so it should not + ;; degrade too much performances. + (if (and (memq it '(helm-ff-symlink + helm-ff-dotted-symlink-directory)) + (file-directory-p file)) + (all-the-icons-octicon "file-symlink-directory") + (all-the-icons-icon-for-file file)))))) + (when icon (concat icon " "))))) (defun helm-ff--is-dir-from-disp (disp) "Return the face used for candidate when candidate is a directory." - (cl-loop for face in '(helm-ff-directory helm-ff-dotted-directory) - thereis (text-property-any 0 (length disp) 'face face disp))) + (cl-loop with faces = (helm-mklist (get-text-property 0 'face disp)) + for face in '(helm-ff-directory helm-ff-dotted-directory) + thereis (memq face faces))) (defun helm-ff--is-file-from-disp (disp) "Return the face used for file's candidate or dotted-symlink dirs." - (cl-loop with len = (length disp) + (cl-loop with faces = (helm-mklist (get-text-property 0 'face disp)) for face in '(helm-ff-file helm-ff-suid helm-ff-executable @@ -4158,43 +4361,25 @@ Arg DISP is the display part of the candidate." helm-ff-symlink helm-ff-dotted-symlink-directory helm-ff-backup-file) - when (text-property-any 0 len 'face face disp) + when (memq face faces) return face)) ;;;###autoload (define-minor-mode helm-ff-icon-mode - "Display icons from `all-the-icons' package in HFF when enabled. - -NOTE: This mode is building `helm-source-find-files', so if you enable -it from your init file, ensure to call it _after_ your defmethod's -`helm-setup-user-source' definitions (if some) to ensure they are called." + "Display icons from `all-the-icons' package in HFF when enabled." :global t - (require 'all-the-icons) - (if helm-ff-icon-mode - (progn - (unless helm-source-find-files - (setq helm-source-find-files - (helm-make-source - "Find Files" 'helm-source-ffiles))) - (let ((fct (helm-get-attr - 'filtered-candidate-transformer - helm-source-find-files))) - (unless (memq 'helm-ff-icons-transformer fct) - (helm-set-attr 'filtered-candidate-transformer - (append fct '(helm-ff-icons-transformer)) - helm-source-find-files)))) - (helm-set-attr 'filtered-candidate-transformer - (remove 'helm-ff-icons-transformer - (helm-get-attr - 'filtered-candidate-transformer - helm-source-find-files)) - helm-source-find-files))) + :group 'helm-files + (when helm-ff-icon-mode + (unless (require 'all-the-icons nil t) + (setq helm-ff-icon-mode nil) + (message "All The Icons package is not installed"))) + (clrhash helm-ff--list-directory-cache)) (defun helm-find-files-action-transformer (actions candidate) "Action transformer for `helm-source-find-files'." (let ((str-at-point (with-helm-current-buffer (buffer-substring-no-properties - (point-at-bol) (point-at-eol))))) + (pos-bol) (pos-eol))))) (when (file-regular-p candidate) (setq actions (helm-append-at-nth actions '(("Checksum File" . helm-ff-checksum)) 4))) @@ -4365,14 +4550,15 @@ with `helm-ff-trash-list'." (defun helm-ff--get-dest-file-from-trash (trashed-files file) (assoc-default (helm-basename file) trashed-files)) -(defun helm-ff-trash-list (&optional trash-dir) +(cl-defun helm-ff-trash-list (&optional (trash-dir nil strash-dir)) "Return an alist of trashed files basename and dest name. Assume the trash system in use is freedesktop compatible, see This function is intended to be used from a trash directory i.e. it use `helm-ff-default-directory', but it may be used elsewhere by specifying the trash directory with TRASH-DIR arg." - (unless (fboundp 'system-move-file-to-trash) + (unless (or (fboundp 'system-move-file-to-trash) + (and strash-dir (null trash-dir))) ;; Files owned by root are trashed in /root/.local/share/Trash. ;; Files owned by user and trashed by root are trashed in ;; /home/.Trash. @@ -4392,7 +4578,7 @@ specifying the trash directory with TRASH-DIR arg." (when (re-search-forward "^path=" nil t) (let ((path (helm-url-unhex-string (buffer-substring-no-properties - (point) (point-at-eol))))) + (point) (pos-eol))))) (if (string-match "\\`/" path) ;; path is absolute path @@ -4408,7 +4594,7 @@ Line number should be added at end of fname preceded with \":\". E.g. \"foo:12\"." (let ((linum (with-helm-current-buffer (let ((str (buffer-substring-no-properties - (point-at-bol) (point-at-eol)))) + (pos-bol) (pos-eol)))) (when (string-match ":\\([0-9]+:?\\)" str) (match-string 1 str)))))) (find-file candidate) @@ -4568,6 +4754,15 @@ This affects directly file CANDIDATE." (defvar helm-ff-sound-file-extensions '("wav" "au")) +(defun helm-ff--maybe-follow (candidate) + (let ((file (if helm-ff-ignore-following-on-directory + (file-exists-p candidate) + (file-regular-p candidate))) + (image (string-match-p (image-file-name-regexp) candidate)) + (ext (file-name-extension candidate))) + (and file + (or image (not (member ext helm-ff-follow-blacklist-file-exts)))))) + (cl-defun helm-find-files-persistent-action-if (candidate) "Open subtree CANDIDATE without quitting helm. If CANDIDATE is not a directory expand CANDIDATE filename. @@ -4591,13 +4786,13 @@ file." nil fname) (insert fname)))))) (helm-set-attr 'candidate-number-limit helm-ff-candidate-number-limit) - (unless image-cand + (unless (helm-ff--maybe-follow candidate) (when follow - (helm-follow-mode -1) + (helm-follow-mode -1) (message nil) (cl-return-from helm-find-files-persistent-action-if (prog1 #'ignore - (message "Helm-follow-mode allowed only on images, disabling"))))) + (user-error "Can't follow this kind of file"))))) (cond (;; Tramp methods completion. (string-match helm-ff-tramp-method-regexp candidate) (let ((method (match-string 1 candidate))) @@ -4735,11 +4930,6 @@ file." ;; (defvar helm-ff--image-cache nil) -(defcustom helm-ff-image-cache-max-len 5 - "The last seen image number to keep in cache." - :group 'helm-files - :type 'integer) - (defun helm-ff-display-image-native-p () "Use `helm-ff-display-image-native' when returns `t'." (or helm-ff-display-image-native @@ -4793,8 +4983,8 @@ file." (append helm-ff--image-cache (list (expand-file-name candidate))))) (with-current-buffer buf - (rename-buffer helm-ff-image-native-buffer) - (display-buffer buf)))) + (rename-buffer helm-ff-image-native-buffer)) + (display-buffer buf))) ;;; Slideshow action ;; @@ -4806,11 +4996,6 @@ file." `\\[helm-ff-slideshow-next]' for next, `\\[helm-ff-slideshow-previous]' for previous, \ `\\[helm-ff-slideshow-quit]' to quit") -(defcustom helm-ff-slideshow-default-delay 3 - "Delay in seconds between each image in slideshow." - :group 'helm-files - :type 'integer) - (defvar helm-slideshow-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map image-mode-map) @@ -4829,6 +5014,11 @@ Special commands: ") (put 'helm-slideshow-mode 'no-helm-mx t) +(defun helm-ff-slideshow-help-string (counter-string state) + (concat counter-string + (substitute-command-keys + (format helm-ff-slideshow-helper state)))) + (defun helm-ff-start-slideshow-on-marked (_candidate) "Start a slideshow on marked files." (let ((marked (helm-marked-candidates :with-wildcard t))) @@ -4839,9 +5029,8 @@ Special commands: (delete-other-windows (get-buffer-window helm-ff-image-native-buffer)) (cl-letf (((symbol-function 'message) #'ignore)) (helm-slideshow-mode)) - (message (concat (format "(1/%s) " (length marked)) - (substitute-command-keys - (format helm-ff-slideshow-helper "pause")))) + (setq mode-line-format (helm-ff-slideshow-help-string + (format "(1/%s) " (length marked)) "pause")) (helm-ff-slideshow-loop helm-ff--slideshow-iterator))) (defun helm-ff-slideshow-state () @@ -4855,26 +5044,30 @@ Special commands: (helm-reorganize-sequence-from-elm helm-ff--slideshow-sequence (buffer-file-name) reverse)) -(defun helm-ff-slideshow-loop (iterator) +(defun helm-ff-slideshow-loop (iterator &optional restart) (while (sit-for helm-ff-slideshow-default-delay) (helm-ff--display-image-native (helm-iter-next iterator)) (delete-other-windows (get-buffer-window helm-ff-image-native-buffer)) (cl-letf (((symbol-function 'message) #'ignore)) (helm-slideshow-mode)) - (message (concat (helm-ff-slideshow-state) - (substitute-command-keys - (format helm-ff-slideshow-helper "pause")))))) + (when restart + (message "Helm Slideshow started") + (sit-for 1) + (message nil) + (setq restart nil)) + (setq mode-line-format + (helm-ff-slideshow-help-string + (helm-ff-slideshow-state) "pause")))) (defun helm-ff-slideshow-pause-or-restart () (interactive) (setq helm-ff--slideshow-in-pause (not helm-ff--slideshow-in-pause)) (if helm-ff--slideshow-in-pause - (message (substitute-command-keys - (format helm-ff-slideshow-helper "restart"))) + (setq mode-line-format (helm-ff-slideshow-help-string nil "restart")) (message "Helm Slideshow restarting...") (setq helm-ff--slideshow-iterator (helm-iter-circular (helm-ff-slideshow-sequence-from-current))) - (helm-ff-slideshow-loop helm-ff--slideshow-iterator))) + (helm-ff-slideshow-loop helm-ff--slideshow-iterator 'restart))) (put 'helm-ff-slideshow-pause-or-restart 'no-helm-mx t) (defun helm-ff-slideshow-next () @@ -4923,23 +5116,30 @@ Special commands: (cl-pushnew helm-ff-default-directory helm-ff--thumbnailed-directories :test 'equal) (cl-loop for (disp . img) in candidates - for type = (helm-acase (file-name-extension img) - ("png" 'png) - (("jpg" "jpeg") 'jpeg)) + for imgtype = (helm-acase (file-name-extension img) + ("png" 'png) + (("jpg" "jpeg") 'jpeg)) + for type = (if (and imgtype + (memq image-dired-thumbnail-storage + '(standard standard-large))) + 'png + imgtype) if type collect (let ((thumbnail (plist-get (cdr (helm-ff--image-dired-get-thumbnail-image img)) :file))) - (cons (concat (propertize " " - 'display `(image - :type ,type - :margin 5 - :file ,thumbnail) - 'rear-nonsticky '(display)) - disp) - img)) - else collect (cons disp img))) - candidates)) + ;; When icons are displayed the leading space handling disp + ;; prop is already here, just replace icon with the thumbnail. + (unless helm-ff-icon-mode (setq disp (concat " " disp))) + (add-text-properties 0 1 `(display (image + :type ,type + :margin 5 + :file ,thumbnail) + rear-nonsticky '(display)) + disp) + (cons disp img)) + else collect (cons disp img))) + candidates)) ;; Same as `image-dired-get-thumbnail-image' but use ;; `helm-ff--image-dired-thumb-name' which cache thumbnails for further use. @@ -4948,11 +5148,11 @@ Special commands: (unless (string-match-p (image-file-name-regexp) file) (error "%s is not a valid image file" file)) (let* ((thumb-file (helm-ff--image-dired-thumb-name file)) - (thumb-attr (file-attributes thumb-file))) + (thumb-attr (file-attributes thumb-file))) (when (or (not thumb-attr) - (time-less-p (file-attribute-modification-time thumb-attr) - (file-attribute-modification-time - (file-attributes file)))) + (time-less-p (file-attribute-modification-time thumb-attr) + (file-attribute-modification-time + (file-attributes file)))) (image-dired-create-thumb file thumb-file)) (create-image thumb-file))) @@ -4969,15 +5169,30 @@ Special commands: (cl-assert (null (file-remote-p helm-ff-default-directory)) nil "Thumbnails show not supported on remote files") (setq helm-ff--show-thumbnails (not helm-ff--show-thumbnails)) + (when helm-ff--show-thumbnails + (message "Loading thumbnails...") + (with-helm-after-update-hook + (sit-for 1) + (message "Loading thumbnails done"))) (when (and (null helm-ff--show-thumbnails) (member helm-ff-default-directory helm-ff--thumbnailed-directories)) (setq helm-ff--thumbnailed-directories (delete helm-ff-default-directory helm-ff--thumbnailed-directories))) - (helm-update (regexp-quote (replace-regexp-in-string - "\\` *" "" (helm-get-selection nil t))))) + (helm-force-update (regexp-quote (replace-regexp-in-string + "\\`[[:multibyte:] ]*" "" + (helm-get-selection nil t))))) (put 'helm-ff-toggle-thumbnails 'no-helm-mx t) +;;;###autoload +(defun helm-ff-clear-image-dired-thumbnails-cache () + "Clear `helm-ff-image-dired-thumbnails-cache'. +You may want to do this after customizing +`image-dired-thumbnail-storage' which may change the place where +thumbnail files are stored." + (interactive) + (clrhash helm-ff-image-dired-thumbnails-cache)) + ;;;###autoload (defun helm-ff-cleanup-image-dired-dir-and-cache () "Cleanup `image-dired-dir' directory. @@ -5076,7 +5291,7 @@ arg." (save-excursion (when (re-search-backward (regexp-quote guess) - (point-at-bol) t) + (pos-bol) t) (point)))) it (point))) (full-path-p (and (stringp guess) @@ -5136,7 +5351,7 @@ Show the first `helm-ff-history-max-length' elements of (when history (setq helm-ff-history (if (>= (length history) helm-ff-history-max-length) - (cl-subseq history 0 helm-ff-history-max-length) + (helm-take history helm-ff-history-max-length) history)) (if comp-read (let ((src (helm-build-sync-source "Helm Find Files History" @@ -5239,7 +5454,8 @@ Use it for non-interactive calls of `helm-find-files'." (expand-file-name tap)))) ;; Ensure not being prompted for password each time we ;; navigate to a directory. - (password-cache t)) + (password-cache t) + (minibuffer-completing-file-name t)) (helm-set-local-variable 'helm-follow-mode-persistent nil 'helm-drag-mouse-1-fn 'helm-ff-drag-mouse-1-fn) (unless helm-source-find-files @@ -5247,6 +5463,19 @@ Use it for non-interactive calls of `helm-find-files'." "Find Files" 'helm-source-ffiles))) (when (helm-get-attr 'follow helm-source-find-files) (helm-set-attr 'follow -1 helm-source-find-files)) + ;; If preselected candidate is further than `helm-ff-candidate-number-limit' + ;; in the directory file list, we have to increase `candidate-number-limit' + ;; attr to have this candidate visible for preselection. NOTE: + ;; When HFF has yet not been launched in this directory the maximum length + ;; of this directory is unknown and candidate will NOT be selected until + ;; next time we call HFF on this same buffer. + (helm-aif (and preselect + (not helm-ff-preselect-ignore-large-dirs) + (gethash fname helm-ff--directory-files-length + helm-ff-candidate-number-limit)) + (helm-set-attr 'candidate-number-limit + (max it helm-ff-candidate-number-limit) + helm-source-find-files)) (helm-ff-setup-update-hook) (add-hook 'helm-resume-after-hook 'helm-ff--update-resume-after-hook) (unwind-protect @@ -5296,6 +5525,10 @@ source is `helm-source-find-files'." helm-ff-update-when-only-one-matched helm-ff-move-to-first-real-candidate helm-ff-clean-initial-input)) + (maphash (lambda (k _v) + (when (member k helm-ff--thumbnailed-directories) + (remhash k helm-ff--list-directory-cache))) + helm-ff--list-directory-cache) (setq helm-ff--show-directories-only nil helm-ff--show-files-only nil helm-ff--show-thumbnails nil @@ -5366,7 +5599,8 @@ source is `helm-source-find-files'." (end (and (use-region-p) (region-end))) (str (and beg end (buffer-substring-no-properties beg end))) (ffap (or (helm-aand helm-ff-guess-ffap-urls ffap-url-regexp - (ffap-fixup-url (ffap-url-at-point)) + (ffap-url-at-point) + (ffap-fixup-url it) (and (string-match ffap-url-regexp it) it)) (ffap-file-at-point)))) ;; Workaround emacs bugs: @@ -5432,7 +5666,7 @@ source is `helm-source-find-files'." "Try to find library path at point. Find inside `require' and `declare-function' sexp." (require 'find-func) - (let* ((beg-sexp (save-excursion (search-backward "(" (point-at-bol) t))) + (let* ((beg-sexp (save-excursion (search-backward "(" (pos-bol) t))) (end-sexp (save-excursion (ignore-errors (end-of-defun)) (point))) (sexp (and beg-sexp end-sexp (buffer-substring-no-properties @@ -5467,7 +5701,7 @@ Find inside `require' and `declare-function' sexp." &key action follow (files (dired-get-marked-files))) "Execute ACTION on FILES to DESTINATION. Where ACTION is a symbol that can be one of: -'copy, \\='rename, \\='symlink,'relsymlink, \\='hardlink or \\='backup. +\\='copy', \\='rename', \\='symlink', \\='relsymlink', \\='hardlink' or \\='backup'. Argument FOLLOW when non-nil specifies to follow FILES to DESTINATION for the actions copy and rename." (require 'dired-async) @@ -5497,7 +5731,10 @@ DESTINATION for the actions copy and rename." dired-async-mode) 1 -1))) (and follow (fboundp 'dired-async-mode) (dired-async-mode -1)) - (when (and (cdr files) (not (file-directory-p destination))) + ;; When dired-create-destination-dirs is available (emacs-27.1+) such error + ;; is handled later in dired-create-files. + (when (and (null (boundp 'dired-create-destination-dirs)) + (cdr files) (not (file-directory-p destination))) (error "%s: target `%s' is not a directory" action destination)) (unwind-protect (dired-create-files @@ -5607,22 +5844,26 @@ Return non-nil when FILE needs to be trashed." (defun helm-trash-directory () "Try to find a trash directory. -Return the files subdirectory of trash directory. +Return the \"files\" subdirectory of trash directory. When `helm-trash-default-directory' is set use it as trash directory." - (let ((xdg-data-dir - (or helm-trash-default-directory - (directory-file-name - (expand-file-name "Trash" - (or (getenv "XDG_DATA_HOME") - "~/.local/share")))))) - (expand-file-name "files" xdg-data-dir))) + (let* ((xdg-data-dir + (or helm-trash-default-directory + (directory-file-name + (expand-file-name "Trash" + (or (getenv "XDG_DATA_HOME") + "~/.local/share"))))) + (trash-files-dir (expand-file-name "files" xdg-data-dir))) + ;; Just return nil if the Trash directory is not yet created. It will be + ;; created later by `delete-directory'. + (and (file-exists-p trash-files-dir) trash-files-dir))) -(defun helm-ff-file-already-trashed (file &optional trash-alist) +(cl-defun helm-ff-file-already-trashed (file &optional (trash-alist nil strash-alist)) "Return FILE when it is already in trash. Optional arg TRASH-ALIST should be an alist as what `helm-ff-trash-list' returns." - (unless (fboundp 'system-move-file-to-trash) + (unless (or (fboundp 'system-move-file-to-trash) + (and strash-alist (null trash-alist))) (let ((trash-files-dir (helm-trash-directory))) (cl-loop for (_bn . fn) in (or trash-alist (helm-ff-trash-list trash-files-dir)) @@ -5740,7 +5981,7 @@ is nil." (delete-directory file nil trash)) (t (delete-file file trash))) (when buffers - (cl-dolist (buf buffers) + (dolist (buf buffers) (when (y-or-n-p (format "Kill buffer %s, too? " buf)) (kill-buffer buf))))))) @@ -5763,7 +6004,7 @@ When a prefix arg is given, meaning of (message "(No deletions performed)") (catch 'helm-abort-delete-file (unwind-protect - (cl-dolist (i files) + (dolist (i files) (set-text-properties 0 (length i) nil i) (let ((res (helm-delete-file i helm-ff-signal-error-on-dot-files nil trash))) @@ -5833,10 +6074,23 @@ directories are always deleted with no warnings." (let* ((files (helm-marked-candidates :with-wildcard t)) (trash (helm-ff--delete-by-moving-to-trash (car files))) (prmt (if trash "Trash" "Delete")) - (buffers (cl-loop for file in files - for buf = (helm-file-buffers file) - when buf append buf)) - (callback (lambda (result) + buffers callback already-trashed + ;; Workaround emacs-26 bug with tramp see + ;; https://github.com/jwiegley/emacs-async/issues/80. + (async-quiet-switch "-q")) + (cl-loop with trash-alist = (and trash (helm-ff-trash-list (helm-trash-directory))) + for f in files + for buf = (helm-file-buffers f) + for trashed = (helm-ff-file-already-trashed f trash-alist) + for dot-file-p = (helm-ff-dot-file-p f) + when (and helm-ff-signal-error-on-dot-files + dot-file-p) + do (cl-return (error "Error: Cannot operate on `.' or `..'")) + when buf + do (setq buffers (nconc buf buffers)) + when trashed + do (push trashed already-trashed)) + (setq callback (lambda (result) (helm-ff--delete-async-modeline-mode -1) (when (file-exists-p helm-ff-delete-log-file) (display-warning 'helm @@ -5850,10 +6104,9 @@ directories are always deleted with no warnings." "*helm delete files*")) (delete-file helm-ff-delete-log-file)) (when buffers - (dolist (buf buffers) - (let ((last-nonmenu-event t)) - (when (y-or-n-p (format "Kill buffer %s, too? " buf)) - (kill-buffer buf))))) + (helm-read-answer-dolist-with-action + "Kill buffer `%s', too? " + buffers #'kill-buffer)) (run-with-timer 0.1 nil (lambda () @@ -5862,15 +6115,6 @@ directories are always deleted with no warnings." 'helm-delete-async-message (if trash "Trashing" "Deleting") result (length files)))))) - ;; Workaround emacs-26 bug with tramp see - ;; https://github.com/jwiegley/emacs-async/issues/80. - (async-quiet-switch "-q") - (trash-alist (and trash (helm-ff-trash-list (helm-trash-directory)))) - (already-trashed - (and trash - (cl-loop for f in files - when (helm-ff-file-already-trashed f trash-alist) - collect f)))) (setq helm-ff--trash-flag trash) (with-helm-display-marked-candidates helm-marked-buffer-name @@ -5918,7 +6162,7 @@ selecting them." (helm--reading-passwd-or-string t)) (if (cdr marked) (if (equal helm-current-prefix-arg '(16)) - (mapcar 'find-file-noselect marked) + (mapc 'find-file-noselect marked) ;; If helm-current-prefix-arg is detected split is done ;; vertically. (helm-window-show-buffers (mapcar 'find-file-noselect marked))) @@ -5942,13 +6186,10 @@ selecting them." ;; unspecified e.g user hit C-k foo RET. (t (find-file candidate))))))) -(defun helm-ff-find-file-other-tab () - "Run find file in other tab action from `helm-source-buffers-list'." - (interactive) - (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available") - (with-helm-alive-p - (helm-exit-and-execute-action 'find-file-other-tab))) -(put 'helm-ff-find-file-other-tab 'helm-only t) +(helm-make-command-from-action helm-ff-find-file-other-tab + "Run find file in other tab action from `helm-source-buffers-list'." + 'find-file-other-tab + (cl-assert (fboundp 'tab-bar-mode) nil "Tab-bar-mode not available")) (defun helm-ff--new-dirs-to-update (path) "Collect directories to update when creating new directory PATH." @@ -6063,12 +6304,90 @@ list." (message "No files found in file(s)")) :buffer "*helm find files in files*"))) - +(cl-defun helm-ff-mcp (_candidate) + "Copy the car of marked candidates to the remaining marked candidates. + +The car of marked should be a regular file and the rest of marked (cdr) should +be directories." + (let* ((mkd (helm-marked-candidates)) + (file (car mkd)) + (targets (cdr mkd)) + (skipped 0) + operations) + (cl-assert (file-regular-p file) nil (format "ERROR: Not a regular file `%s'" file)) + (cl-assert targets nil (format "ERROR: No destination specified for file `%s'" file)) + (cl-assert (cl-loop for f in targets always (file-directory-p f)) nil + "ERROR: Destinations must be directories") + (when targets + (cl-loop with yes-for-all + for dest in targets + for dest-file = (expand-file-name (helm-basename file) dest) + for dir-ok = (file-accessible-directory-p dest) + for exists = (and dir-ok + (file-exists-p + (expand-file-name + (helm-basename file) dest))) + for overwrite = (or (null exists) + yes-for-all + (pcase (helm-read-answer + (format + "File `%s' already-exists, overwrite (y,n,!,q) ? " + dest-file) + '("y" "n" "!" "q")) + ("y" t) + ("n" nil) + ("!" (prog1 t + (setq yes-for-all t))) + ("q" (cl-return-from helm-ff-mcp + (message "Operation aborted"))))) + if dir-ok + do (if overwrite + (push (list file (file-name-as-directory dest) overwrite) operations) + (cl-incf skipped)) + else do (cl-incf skipped)) + (when operations + (with-helm-display-marked-candidates + helm-marked-buffer-name + (mapcar #'abbreviate-file-name targets) + (if (y-or-n-p (format "Copy `%s' to directories?" (helm-basename file))) + (progn + (process-put + (async-start + `(lambda () + (require 'cl-lib) + (cl-loop with copies = 0 + with skipped = ,skipped + for (file dest overwrite) in ',operations + do (condition-case _err + (progn + (copy-file file dest overwrite) + (cl-incf copies)) + (file-error (cl-incf skipped))) + finally return (list file copies skipped))) + (lambda (result) + (let ((copied (nth 1 result))) + (dired-async--modeline-mode -1) + (run-with-idle-timer + 0.1 nil + (lambda () + (dired-async-mode-line-message + "Mcp done, %s %s of %s done, %s files skipped" + 'dired-async-message + copied + (if (> copied 1) + "copies" "copy") + (helm-basename (nth 0 result)) + (nth 2 result))))))) + 'dired-async-process t) + (dired-async--modeline-mode 1)) + (message "Operation aborted"))))))) + +(helm-make-command-from-action helm-ff-run-mcp + "Copy the car of marked candidates to the remaining marked candidates." + 'helm-ff-mcp) ;;; File name history ;; ;; -(defvar helm--file-name-history-hide-deleted nil) - (defun helm-files-save-file-name-history (&optional force) "Save marked files to `file-name-history'." (let* ((src (helm-get-current-source)) @@ -6107,8 +6426,8 @@ list." (defun helm-file-name-history-show-or-hide-deleted () (interactive) - (setq helm--file-name-history-hide-deleted - (not helm--file-name-history-hide-deleted)) + (setq helm-file-name-history-hide-deleted + (not helm-file-name-history-hide-deleted)) (helm-update)) (put 'helm-file-name-history-show-or-hide-deleted 'helm-only t) @@ -6120,21 +6439,23 @@ list." map)) (defun helm-file-name-history-transformer (candidates _source) - (cl-loop with lgst = (cl-loop for c in candidates maximize (length c)) - for c in candidates - for last-access = (format-time-string "%d/%m/%Y %X" - (nth 4 (file-attributes c))) - for disp = (cond ((or (file-remote-p c) + (cl-loop with lgst = helm-file-name-history-max-length + for elm in candidates + for c = (truncate-string-to-width + elm helm-file-name-history-max-length nil nil t) + for disp = (cond ((or (file-remote-p elm) (and (fboundp 'tramp-archive-file-name-p) (tramp-archive-file-name-p c))) (propertize c 'face 'helm-history-remote)) - ((file-exists-p c) - (propertize - c 'display - (concat (propertize c 'face 'helm-ff-file) - (make-string (1+ (- lgst (length c))) ? ) - last-access))) - (t (unless helm--file-name-history-hide-deleted + ((file-exists-p elm) + (let ((last-access (format-time-string "%d/%m/%Y %X" + (nth 4 (file-attributes elm))))) + (propertize + elm 'display + (concat (propertize c 'face 'helm-ff-file) + (make-string (1+ (- lgst (length c))) ? ) + last-access)))) + (t (unless helm-file-name-history-hide-deleted (propertize c 'face 'helm-history-deleted)))) when disp collect (cons (if helm-ff-icon-mode @@ -6146,11 +6467,9 @@ list." (helm-set-pattern (expand-file-name candidate))) -(defun helm-ff-file-name-history-run-ff () +(helm-make-command-from-action 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))) + 'helm-ff-file-name-history-ff) (defun helm-ff-file-name-history-delete-item (_candidate) (let ((files (helm-marked-candidates))) @@ -6171,6 +6490,9 @@ list." (when helm-ff-file-name-history-use-recentf (require 'recentf) (or recentf-mode (recentf-mode 1))))) + :candidate-number-limit (helm-aand (or (get 'file-name-history 'history-length) + history-length) + (and (numberp it) it)) :candidates (lambda () (if helm-ff-file-name-history-use-recentf recentf-list @@ -6237,10 +6559,14 @@ list." (defun helm-browse-project-find-files-1 (directory program) "List files in DIRECTORY recursively with external PROGRAM." - (let ((cmd (cl-ecase program - (ag "ag --hidden -g '.*' %s") - (rg "rg --files --hidden -g '*' %s") - (fd "fd --hidden --type f --glob '*' %s")))) + (require 'helm-fd) + (let* ((fd-exe (or helm-fd-executable + (executable-find "fdfind") + (executable-find "fd"))) + (cmd (cl-ecase program + (ag "ag --hidden -g '.*' %s") + (rg "rg --files --hidden -g '*' %s") + (fd (concat fd-exe " --hidden --type f --glob '*' %s"))))) (with-temp-buffer (call-process-shell-command (format cmd directory) @@ -6268,12 +6594,9 @@ Use FD as backend." (let ((dir (with-helm-buffer (helm-get-attr 'root-dir)))) (helm-grep-ag dir helm-current-prefix-arg))) -(defun helm-browse-project-run-ag () +(helm-make-command-from-action helm-browse-project-run-ag "Run `helm-grep' AG from `helm-browse-project'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-browse-project-ag))) -(put 'helm-browse-project-run-ag 'helm-only t) + 'helm-browse-project-ag) (defclass helm-browse-project-override-inheritor (helm-type-file) ()) @@ -6401,11 +6724,9 @@ See `helm-browse-project'." (with-helm-default-directory helm-ff-default-directory (helm-browse-project helm-current-prefix-arg))) -(defun helm-ff-run-browse-project () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-browse-project))) -(put 'helm-ff-run-browse-project 'helm-only t) +(helm-make-command-from-action helm-ff-run-browse-project + "Run browse project." + 'helm-ff-browse-project) ;;; Actions calling helm and main interactive functions. ;; @@ -6414,11 +6735,9 @@ See `helm-browse-project'." (with-helm-default-directory helm-ff-default-directory (helm-gid))) -(defun helm-ff-run-gid () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-gid))) -(put 'helm-ff-run-gid 'helm-only t) +(helm-make-command-from-action helm-ff-run-gid + "Run gid from HFF." + 'helm-ff-gid) ;; helm-find bindings for helm-find-files. (defun helm-ff-find-sh-command (_candidate) @@ -6426,12 +6745,9 @@ See `helm-browse-project'." (require 'helm-find) (helm-find-1 helm-ff-default-directory)) -(defun helm-ff-run-find-sh-command () - "Run find shell command action with key from `helm-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-find-sh-command))) -(put 'helm-ff-run-find-sh-command 'helm-only t) +(helm-make-command-from-action helm-ff-run-find-sh-command + "Run find shell command action with key from `helm-find-files'." + 'helm-ff-find-sh-command) ;; helm-hd bindings for hff (defun helm-ff-fd (_candidate) @@ -6439,12 +6755,9 @@ See `helm-browse-project'." (require 'helm-fd) (helm-fd-1 helm-ff-default-directory)) -(defun helm-ff-run-fd () - "Run fd shell command action with key from `helm-find-files'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-ff-fd))) -(put 'helm-ff-run-fd 'helm-only t) +(helm-make-command-from-action helm-ff-run-fd + "Run fd shell command action with key from `helm-find-files'." + 'helm-ff-fd) ;;;###autoload (defun helm-find-files (arg) @@ -6481,7 +6794,8 @@ files." (if (and helm-ff-transformer-show-only-basename (null hist) (not (string-match-p "[.]\\{1,2\\}\\'" it))) - (helm-basename it) it)))) + (helm-basename it) + it)))) ;; Continue using the same display function as history which used ;; probably itself the same display function as inner HFF call, ;; i.e. if history was using frame use a frame otherwise use a window. @@ -6501,36 +6815,6 @@ files." (format helm-ff-last-expanded-candidate-regexp (regexp-quote presel))))))) -;;;###autoload -(defun helm-delete-tramp-connection () - "Allow deleting tramp connection or marked tramp connections at once. - -This replace `tramp-cleanup-connection' which is partially broken -in Emacs < to 25.1.50.1 (See Emacs bug http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24432). - -It allows additionally to delete more than one connection at -once." - (interactive) - (let ((helm-quit-if-no-candidate - (lambda () - (message "No Tramp connection found")))) - (helm :sources (helm-build-sync-source "Tramp connections" - :candidates (tramp-list-connections) - :candidate-transformer (lambda (candidates) - (cl-loop for v in candidates - for name = (apply #'tramp-make-tramp-file-name - (cl-loop with v = (helm-ff--tramp-cons-or-vector v) - for i across v collect i)) - when (or (processp (tramp-get-connection-process v)) - (buffer-live-p (get-buffer (tramp-buffer-name v)))) - collect (cons name v))) - :action (lambda (_vec) - (let ((vecs (helm-marked-candidates))) - (cl-loop for v in vecs - do (progn - (tramp-cleanup-connection v) - (remhash v tramp-cache-data)))))) - :buffer "*helm tramp connections*"))) (provide 'helm-files) diff --git a/elpa/helm-20220616.1004/helm-find.el b/elpa/helm-20230806.1956/helm-find.el similarity index 97% rename from elpa/helm-20220616.1004/helm-find.el rename to elpa/helm-20230806.1956/helm-find.el index 7626639b..bdf6d8ac 100644 --- a/elpa/helm-20220616.1004/helm-find.el +++ b/elpa/helm-20230806.1956/helm-find.el @@ -1,6 +1,6 @@ ;;; helm-find.el --- helm interface for find command. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -116,7 +116,7 @@ separator." (cmd (concat (helm-find--build-cmd-line) (if helm-find-noerrors "2> /dev/null" ""))) (proc (start-file-process-shell-command "hfind" helm-buffer cmd))) - (helm-log "Find command:\n%s" cmd) + (helm-log "helm-find-shell-command-fn" "Find command:\n%s" cmd) (prog1 proc (set-process-sentinel proc @@ -125,7 +125,7 @@ separator." process event (helm-default-directory)) (if (string= event "finished\n") (helm-locate-update-mode-line "Find") - (helm-log "Error: Find %s" + (helm-log "helm-find-shell-command-fn sentinel" "Error: Find %s" (replace-regexp-in-string "\n" "" event)))))))) (defun helm-find-1 (dir) diff --git a/elpa/helm-20220616.1004/helm-font.el b/elpa/helm-20230806.1956/helm-font.el similarity index 99% rename from elpa/helm-20220616.1004/helm-font.el rename to elpa/helm-20230806.1956/helm-font.el index f3d45114..9d43ffae 100644 --- a/elpa/helm-20220616.1004/helm-font.el +++ b/elpa/helm-20230806.1956/helm-font.el @@ -1,6 +1,6 @@ ;;; helm-font --- Font and ucs selection for Helm -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 diff --git a/elpa/helm-20220616.1004/helm-for-files.el b/elpa/helm-20230806.1956/helm-for-files.el similarity index 98% rename from elpa/helm-20220616.1004/helm-for-files.el rename to elpa/helm-20230806.1956/helm-for-files.el index 6b36fb8e..0d55db92 100644 --- a/elpa/helm-20220616.1004/helm-for-files.el +++ b/elpa/helm-20230806.1956/helm-for-files.el @@ -1,6 +1,6 @@ ;;; helm-for-files.el --- helm-for-files and related. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -150,7 +150,7 @@ small.") (let ((helm-fuzzy-sort-fn 'helm-fuzzy-matching-sort-fn-preserve-ties-order)) (setq helm-source-recentf (helm-make-source "Recentf" 'helm-recentf-source - :fuzzy-match helm-recentf-fuzzy-match))))) + :fuzzy-match val))))) ;;; Files in current dir @@ -164,7 +164,7 @@ Colorize only symlinks, directories and files." 'identity) for i in files for disp = (if (and helm-ff-transformer-show-only-basename - (not (helm-dir-is-dot i)) + (not (helm-ff-dot-file-p i)) (not (and helm--url-regexp (string-match helm--url-regexp i))) (not (string-match helm-ff-url-regexp i))) diff --git a/elpa/helm-20220616.1004/helm-global-bindings.el b/elpa/helm-20230806.1956/helm-global-bindings.el similarity index 81% rename from elpa/helm-20220616.1004/helm-global-bindings.el rename to elpa/helm-20230806.1956/helm-global-bindings.el index 896df8b6..c52a9029 100644 --- a/elpa/helm-20220616.1004/helm-global-bindings.el +++ b/elpa/helm-20230806.1956/helm-global-bindings.el @@ -1,6 +1,6 @@ ;;; helm-global-bindings.el --- Bind global helm commands -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -23,20 +23,26 @@ ;;; Command Keymap ;; ;; +(defgroup helm-global-bindings nil + "Global bindings for Helm." + :group 'helm) + (defcustom helm-command-prefix-key (helm-aif (car (where-is-internal 'Control-X-prefix (list global-map))) (concat it [?c])) - "The key `helm-command-prefix' is bound to in the global map." + "The prefix key used to call Helm commands from the `global-map'. + +Its default value is `C-x c'. +This key is bound to the function `helm-command-prefix' in the global map. +The definition of `helm-command-prefix' is the keymap `helm-command-map'. +Using `setq' to modify this variable will have no effect." :type '(choice (string :tag "Key") (const :tag "no binding")) - :group 'helm-config :set (lambda (var key) - (when (and (boundp var) (symbol-value var)) - (define-key (current-global-map) - (read-kbd-macro (symbol-value var)) nil)) + (helm-aif (and (boundp var) (symbol-value var)) + (global-unset-key (read-kbd-macro it))) (when key - (define-key (current-global-map) - (read-kbd-macro key) 'helm-command-prefix)) + (global-set-key (read-kbd-macro key) 'helm-command-prefix)) (set var key))) (defvar helm-command-map @@ -78,14 +84,11 @@ (define-key map (kbd "b") 'helm-resume) (define-key map (kbd "M-g i") 'helm-gid) (define-key map (kbd "@") 'helm-list-elisp-packages) - map)) + map) + "Default keymap for \\[helm-command-prefix] commands. +The normal global definition of the character \\[helm-command-prefix] indirects to this keymap.") -;; Don't override the keymap we just defined with an empty -;; keymap. This also protect bindings changed by the user. -(defvar helm-command-prefix) -(define-prefix-command 'helm-command-prefix) (fset 'helm-command-prefix helm-command-map) -(setq helm-command-prefix helm-command-map) ;;; Menu diff --git a/elpa/helm-20220616.1004/helm-grep.el b/elpa/helm-20230806.1956/helm-grep.el similarity index 94% rename from elpa/helm-20220616.1004/helm-grep.el rename to elpa/helm-20230806.1956/helm-grep.el index 135f8017..8aabe812 100644 --- a/elpa/helm-20220616.1004/helm-grep.el +++ b/elpa/helm-20230806.1956/helm-grep.el @@ -1,6 +1,6 @@ ;;; helm-grep.el --- Helm Incremental Grep. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -41,6 +41,65 @@ (defvar helm-grep-git-grep-command) (defvar helm-source-grep-git) (defvar tramp-verbose) +(defvar helm-current-error) + +;;; Internals vars +;; +;; +(defvar helm-rzgrep-cache (make-hash-table :test 'equal)) +(defvar helm-grep-default-function 'helm-grep-init) +(defvar helm-zgrep-recurse-flag nil) +(defvar helm-grep-history nil) +(defvar helm-grep-ag-history nil) +(defvar helm-grep-last-targets nil) +(defvar helm-grep-include-files nil) +(defvar helm-grep-in-recurse nil) +(defvar helm-grep-use-zgrep nil) +(defvar helm-grep-default-directory-fn nil + "A function that should return a directory to expand candidate to. +It is intended to use as a let-bound variable, DON'T set this globaly.") +(defvar helm-pdfgrep-targets nil) +(defvar helm-grep-last-cmd-line nil) +(defvar helm-grep-split-line-regexp "^\\([[:lower:][:upper:]]?:?.*?\\):\\([0-9]+\\):\\(.*\\)") + + +;;; Keymaps +;; +;; +(defvar helm-grep-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-") 'helm-goto-next-file) + (define-key map (kbd "M-") 'helm-goto-precedent-file) + (define-key map (kbd "C-c o") 'helm-grep-run-other-window-action) + (define-key map (kbd "C-c C-o") 'helm-grep-run-other-frame-action) + (define-key map (kbd "C-x C-s") 'helm-grep-run-save-buffer) + (define-key map (kbd "DEL") 'helm-delete-backward-no-update) + map) + "Keymap used in Grep sources.") + +(defvar helm-pdfgrep-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "M-") 'helm-goto-next-file) + (define-key map (kbd "M-") 'helm-goto-precedent-file) + (define-key map (kbd "DEL") 'helm-delete-backward-no-update) + map) + "Keymap used in pdfgrep.") + +(defvar helm-grep-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") 'helm-grep-mode-jump) + (define-key map (kbd "C-o") 'helm-grep-mode-jump-other-window) + (define-key map (kbd "") 'helm-grep-mode-jump-other-window-forward) + (define-key map (kbd "") 'helm-grep-mode-jump-other-window-backward) + (define-key map (kbd "") 'helm-gm-next-file) + (define-key map (kbd "") 'helm-gm-precedent-file) + (define-key map (kbd "M-n") 'helm-grep-mode-jump-other-window-forward) + (define-key map (kbd "M-p") 'helm-grep-mode-jump-other-window-backward) + (define-key map (kbd "M-N") 'helm-gm-next-file) + (define-key map (kbd "M-P") 'helm-gm-precedent-file) + map)) (defgroup helm-grep nil @@ -112,7 +171,6 @@ faster on recursive grep. NOTE: Remote grepping is not available with ack-grep, and badly supported with grep because tramp handles badly repeated remote processes in a short delay (< to 5s)." - :group 'helm-grep :type 'string) (defcustom helm-grep-default-recurse-command @@ -120,7 +178,6 @@ NOTE: Remote grepping is not available with ack-grep, and badly "Default recursive grep format command for `helm-do-grep-1'. See `helm-grep-default-command' for format specs and infos about ack-grep." - :group 'helm-grep :type 'string) (defcustom helm-default-zgrep-command @@ -130,7 +187,6 @@ See `helm-grep-default-command' for infos on format specs. Option --color=always is supported and can be used safely to replace the Helm internal match highlighting. See `helm-grep-default-command' for more infos." - :group 'helm-grep :type 'string) (defcustom helm-pdfgrep-default-command @@ -139,7 +195,6 @@ replace the Helm internal match highlighting. See Option \"--color always\" is supported starting Helm version 1.7.8. When used matches will be highlighted according to GREP_COLORS env var." - :group 'helm-grep :type 'string) (defcustom helm-pdfgrep-default-recurse-command @@ -148,7 +203,6 @@ GREP_COLORS env var." Option \"--color always\" is supported starting Helm version 1.7.8. When used matches will be highlighted according to GREP_COLORS env var." - :group 'helm-grep :type 'string) (defcustom helm-pdfgrep-default-read-command nil @@ -160,28 +214,23 @@ E.g. In Ubuntu you can set it to: If set to nil either `doc-view-mode' or `pdf-view-mode' will be used instead of an external command." - :group 'helm-grep :type 'string) (defcustom helm-grep-max-length-history 100 "Max number of elements to save in `helm-grep-history'." - :group 'helm-grep :type 'integer) (defcustom helm-zgrep-file-extension-regexp ".*\\(\\.gz\\|\\.bz\\|\\.xz\\|\\.lzma\\)$" "Default file extensions zgrep will search in." - :group 'helm-grep :type 'string) (defcustom helm-grep-preferred-ext nil "This file extension will be preselected for grep." - :group 'helm-grep :type 'string) (defcustom helm-grep-save-buffer-name-no-confirm nil "When *hgrep* already exists, auto append suffix." - :group 'helm-grep :type 'boolean) (defcustom helm-grep-ignored-files @@ -190,18 +239,15 @@ used instead of an external command." (concat "*" s))) completion-ignored-extensions))) "List of file names which `helm-grep' shall exclude." - :group 'helm-grep :type '(repeat string)) (defcustom helm-grep-ignored-directories helm-walk-ignore-directories "List of names of sub-directories which `helm-grep' shall not recurse into." - :group 'helm-grep :type '(repeat string)) (defcustom helm-grep-truncate-lines t "When nil the grep line that appears will not be truncated." - :group 'helm-grep :type 'boolean) (defcustom helm-grep-file-path-style 'basename @@ -210,7 +256,6 @@ Possible value are: basename: displays only the filename, none of the directory path absolute: displays absolute path relative: displays relative path from root grep directory." - :group 'helm-grep :type '(choice (const :tag "Basename" basename) (const :tag "Absolute" absolute) (const :tag "Relative" relative))) @@ -222,7 +267,6 @@ Possible value are: "Save results in grep buffer" 'helm-grep-save-results "Find file other window (C-u vertically)" 'helm-grep-other-window) "Actions for helm grep." - :group 'helm-grep :type '(alist :key-type string :value-type function)) (defcustom helm-grep-pipe-cmd-switches nil @@ -238,7 +282,6 @@ Here are the commands where you may want to add switches: You probably don't need to use this unless you know what you are doing." - :group 'helm-grep :type '(repeat string)) (defcustom helm-grep-ag-pipe-cmd-switches nil @@ -258,7 +301,6 @@ need to add it here. You probably don't need to use this unless you know what you are doing." - :group 'helm-grep :type '(repeat string)) (defcustom helm-grep-input-idle-delay 0.1 @@ -266,8 +308,95 @@ doing." A lower value (default) means Helm will display the results faster. Increasing it to a higher value (e.g. 0.6) prevents the buffer from flickering when updating." - :group 'helm-grep :type 'float) + +(defcustom helm-grep-use-ioccur-style-keys t + "Use Arrow keys to jump to occurences. +Note that if you define this variable with `setq' your change +will have no effect, use customize instead." + :type 'boolean + :set (lambda (var val) + (set var val) + (if val + (progn + (define-key helm-grep-map (kbd "") 'helm-execute-persistent-action) + (define-key helm-grep-map (kbd "") 'helm-grep-run-default-action)) + (define-key helm-grep-map (kbd "") nil) + (define-key helm-grep-map (kbd "") nil)))) + +(defcustom helm-grep-ag-command + (cond ((executable-find "rg") + "rg --color=always --smart-case --search-zip --no-heading --line-number %s -- %s %s") + ((executable-find "ag") + "ag --line-numbers -S --color --nogroup %s -- %s %s")) + "The default command for RG or AG. + +Prefer RG by default if available. + +Update: PT is still mentionned in this documentation but it seems it +doesn't exists anymore, or at least it is no more maintained. + +Takes three format specs, the first for type(s), the second for +pattern and the third for directory. + +You can use safely \"--color\" (used by default) with AG RG and +PT. + +NOTE: Usage of \"--color=never\" is discouraged as it uses Elisp +to colorize matched items which is slower than using the native +colorization of backend, however it is still supported. + +For ripgrep here is the command line to use: + + rg --color=always --smart-case --no-heading --line-number %s -- %s %s + +And to customize colors (always for ripgrep) use something like this: + + rg --color=always --colors \\='match:bg:yellow' --colors \\='match:fg:black' +\--smart-case --no-heading --line-number %s -- %s %s + +This will change color for matched items from foreground red (the +default) to a yellow background with a black foreground. Note +that your color settings for RG will not work properly with +multiples pattern if you have configured colors in rg config file +instead of command line. For more enhanced settings of ansi +colors see https://github.com/emacs-helm/helm/issues/2313 + +You must use an output format that fit with helm grep, that is: + + \"filename:line-number:string\" + +The option \"--nogroup\" allow this. +The option \"--line-numbers\" is also mandatory except with +PT (not supported). +For RG the options \"--no-heading\" and \"--line-number\" are the +ones to use. + +When modifying the default colors of matches with e.g. +\"--color-match\" option of AG or \"--colors\" option of ripgrep +you may want to modify as well `helm-grep-ag-pipe-cmd-switches' +to have all matches colorized with the same color in multi +match. + +Of course you can use several other options, see the man page of the +backend you are using." + :type 'string) + +(defcustom helm-grep-git-grep-command + "git --no-pager grep -n%cH --color=always --full-name -e %p -- %f" + "The git grep default command line. +The option \"--color=always\" can be used safely. +The color of matched items can be customized in your .gitconfig +See `helm-grep-default-command' for more infos. + +The \"--exclude-standard\" and \"--no-index\" switches allow +skipping unwanted files specified in ~/.gitignore_global and +searching files not already staged (not enabled by default). + +You have also to enable this in global \".gitconfig\" with + \"git config --global core.excludesfile ~/.gitignore_global\"." + :type 'string) + ;;; Faces ;; @@ -314,80 +443,6 @@ Have no effect when grep backend use \"--color=\"." "Face used to highlight grep command line when no results." :group 'helm-grep-faces) - -;;; Keymaps -;; -;; -(defvar helm-grep-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "M-") 'helm-goto-next-file) - (define-key map (kbd "M-") 'helm-goto-precedent-file) - (define-key map (kbd "C-c o") 'helm-grep-run-other-window-action) - (define-key map (kbd "C-c C-o") 'helm-grep-run-other-frame-action) - (define-key map (kbd "C-x C-s") 'helm-grep-run-save-buffer) - (define-key map (kbd "DEL") 'helm-delete-backward-no-update) - map) - "Keymap used in Grep sources.") - -(defcustom helm-grep-use-ioccur-style-keys t - "Use Arrow keys to jump to occurences. -Note that if you define this variable with `setq' your change -will have no effect, use customize instead." - :group 'helm-grep - :type 'boolean - :set (lambda (var val) - (set var val) - (if val - (progn - (define-key helm-grep-map (kbd "") 'helm-execute-persistent-action) - (define-key helm-grep-map (kbd "") 'helm-grep-run-default-action)) - (define-key helm-grep-map (kbd "") nil) - (define-key helm-grep-map (kbd "") nil)))) - -(defvar helm-pdfgrep-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "M-") 'helm-goto-next-file) - (define-key map (kbd "M-") 'helm-goto-precedent-file) - (define-key map (kbd "DEL") 'helm-delete-backward-no-update) - map) - "Keymap used in pdfgrep.") - -(defvar helm-grep-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'helm-grep-mode-jump) - (define-key map (kbd "C-o") 'helm-grep-mode-jump-other-window) - (define-key map (kbd "") 'helm-grep-mode-jump-other-window-forward) - (define-key map (kbd "") 'helm-grep-mode-jump-other-window-backward) - (define-key map (kbd "") 'helm-gm-next-file) - (define-key map (kbd "") 'helm-gm-precedent-file) - (define-key map (kbd "M-n") 'helm-grep-mode-jump-other-window-forward) - (define-key map (kbd "M-p") 'helm-grep-mode-jump-other-window-backward) - (define-key map (kbd "M-N") 'helm-gm-next-file) - (define-key map (kbd "M-P") 'helm-gm-precedent-file) - map)) - - -;;; Internals vars -;; -;; -(defvar helm-rzgrep-cache (make-hash-table :test 'equal)) -(defvar helm-grep-default-function 'helm-grep-init) -(defvar helm-zgrep-recurse-flag nil) -(defvar helm-grep-history nil) -(defvar helm-grep-ag-history nil) -(defvar helm-grep-last-targets nil) -(defvar helm-grep-include-files nil) -(defvar helm-grep-in-recurse nil) -(defvar helm-grep-use-zgrep nil) -(defvar helm-grep-default-directory-fn nil - "A function that should return a directory to expand candidate to. -It is intended to use as a let-bound variable, DON'T set this globaly.") -(defvar helm-pdfgrep-targets nil) -(defvar helm-grep-last-cmd-line nil) -(defvar helm-grep-split-line-regexp "^\\([[:lower:][:upper:]]?:?.*?\\):\\([0-9]+\\):\\(.*\\)") - ;;; Init ;; @@ -570,8 +625,8 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") (helm-grep-command))))) non-essential) ;; Start grep process. - (helm-log "Starting Grep process in directory `%s'" default-directory) - (helm-log "Command line used was:\n\n%s" + (helm-log "helm-grep-init" "Starting Grep process in directory `%s'" default-directory) + (helm-log "helm-grep-init" "Command line used was:\n\n%s" (concat ">>> " (propertize cmd-line 'face 'helm-grep-cmd-line) "\n\n")) (prog1 ; This function should return the process first. (start-file-process-shell-command @@ -609,7 +664,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") ;; that exit with code 1 ;; after a certain amount of results. (with-helm-buffer (not (helm-empty-buffer-p))))) - (helm-log "%s process finished with %s results in %fs" + (helm-log "helm-grep-init" "%s process finished with %s results in %fs" proc-name (helm-get-candidate-number) (- (float-time) start-time)) @@ -630,6 +685,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") (helm--bind-mouse-for-selection helm-selection-point)))) ;; Catch error output in log. (t (helm-log + "helm-grep-init" "Error: %s %s" proc-name (replace-regexp-in-string "\n" "" event)))))))))) @@ -656,7 +712,7 @@ WHERE can be `other-window' or `other-frame'." (if (eq major-mode 'helm-grep-mode) (current-buffer) helm-buffer) - (get-text-property (point-at-bol) + (get-text-property (pos-bol) 'helm-grep-fname)) (car split))) (tramp-fname (file-remote-p (or helm-ff-default-directory @@ -664,7 +720,7 @@ WHERE can be `other-window' or `other-frame'." (fname (if tramp-fname (concat tramp-fname loc-fname) loc-fname))) - (helm-log "helm-grep-action fname: %s" fname ) + (helm-log "helm-grep-action" "helm-grep-action fname: %s" fname ) (cl-case where (other-window (helm-window-show-buffers (list (find-file-noselect fname)) t)) @@ -678,29 +734,29 @@ WHERE can be `other-window' or `other-frame'." (doc-view-goto-page lineno)))) (t (find-file fname))) (unless (or (eq where 'grep) (eq where 'pdf)) - (helm-goto-line lineno)) - ;; Move point to the nearest matching regexp from bol. - (cl-loop for reg in split-pat - when (save-excursion - (condition-case _err - (if helm-migemo-mode - (helm-mm-migemo-forward reg (point-at-eol) t) - (re-search-forward reg (point-at-eol) t)) - (invalid-regexp nil))) - collect (match-beginning 0) into pos-ls - finally (when pos-ls (goto-char (apply #'min pos-ls)))) - ;; Save history - (unless (or helm-in-persistent-action - (eq major-mode 'helm-grep-mode) - (string= helm-pattern "")) - (setq helm-grep-history - (cons helm-pattern - (delete helm-pattern helm-grep-history))) - (when (> (length helm-grep-history) - helm-grep-max-length-history) + (helm-goto-line lineno) + ;; Move point to the nearest matching regexp from bol. + (cl-loop for reg in split-pat + when (save-excursion + (condition-case _err + (if helm-migemo-mode + (helm-mm-migemo-forward reg (pos-eol) t) + (re-search-forward reg (pos-eol) t)) + (invalid-regexp nil))) + collect (match-beginning 0) into pos-ls + finally (when pos-ls (goto-char (apply #'min pos-ls)))) + ;; Save history + (unless (or helm-in-persistent-action + (eq major-mode 'helm-grep-mode) + (string= helm-pattern "")) (setq helm-grep-history - (delete (car (last helm-grep-history)) - helm-grep-history)))))) + (cons helm-pattern + (delete helm-pattern helm-grep-history))) + (when (> (length helm-grep-history) + helm-grep-max-length-history) + (setq helm-grep-history + (delete (car (last helm-grep-history)) + helm-grep-history))))))) (defun helm-grep-persistent-action (candidate) "Persistent action for `helm-do-grep-1'. @@ -723,7 +779,7 @@ If N is positive go forward otherwise go backward." (eq major-mode 'helm-moccur-mode) (eq major-mode 'helm-occur-mode))) (sel (if allow-mode - (buffer-substring (point-at-bol) (point-at-eol)) + (buffer-substring (pos-bol) (pos-eol)) (helm-get-selection nil t))) (current-line-list (helm-grep-split-line sel)) (current-fname (nth 0 current-line-list)) @@ -737,13 +793,13 @@ If N is positive go forward otherwise go backward." (forward-line n) ; Go forward or backward depending of n value. ;; Exit when current-fname is not matched or in `helm-grep-mode' ;; the line is not a grep line i.e 'fname:num:tag'. - (setq sel (buffer-substring (point-at-bol) (point-at-eol))) + (setq sel (buffer-substring (pos-bol) (pos-eol))) (when helm-allow-mouse (helm--mouse-reset-selection-help-echo)) (unless (or (string= current-fname (car (helm-grep-split-line sel))) (and (eq major-mode 'helm-grep-mode) - (not (get-text-property (point-at-bol) 'helm-grep-fname)))) + (not (get-text-property (pos-bol) 'helm-grep-fname)))) (funcall mark-maybe) (throw 'break nil)))) (cond ((and (> n 0) (eobp)) @@ -751,13 +807,13 @@ If N is positive go forward otherwise go backward." (forward-line 0) (funcall mark-maybe)) ((and (< n 0) (bobp)) - (helm-aif (next-single-property-change (point-at-bol) 'helm-grep-fname) + (helm-aif (next-single-property-change (pos-bol) 'helm-grep-fname) (goto-char it) (forward-line 1)) (funcall mark-maybe))) (unless allow-mode (helm-follow-execute-persistent-action-maybe) - (helm-log-run-hook 'helm-move-selection-after-hook)))) + (helm-log-run-hook "helm-goto-next-or-prec-file" 'helm-move-selection-after-hook)))) ;;;###autoload (defun helm-goto-precedent-file () @@ -775,33 +831,21 @@ If N is positive go forward otherwise go backward." (with-helm-window (helm-goto-next-or-prec-file 1))) -(defun helm-grep-run-default-action () +(helm-make-command-from-action helm-grep-run-default-action "Run grep default action from `helm-do-grep-1'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-grep-action))) -(put 'helm-grep-run-default-action 'helm-only t) + 'helm-grep-action) -(defun helm-grep-run-other-window-action () +(helm-make-command-from-action helm-grep-run-other-window-action "Run grep goto other window action from `helm-do-grep-1'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-grep-other-window))) -(put 'helm-grep-run-other-window-action 'helm-only t) + 'helm-grep-other-window) -(defun helm-grep-run-other-frame-action () +(helm-make-command-from-action helm-grep-run-other-frame-action "Run grep goto other frame action from `helm-do-grep-1'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-grep-other-frame))) -(put 'helm-grep-run-other-frame-action 'helm-only t) + 'helm-grep-other-frame) -(defun helm-grep-run-save-buffer () +(helm-make-command-from-action helm-grep-run-save-buffer "Run grep save results action from `helm-do-grep-1'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-grep-save-results))) -(put 'helm-grep-run-save-buffer 'helm-only t) + 'helm-grep-save-results) (defun helm-grep-quit-an-find-file-fn (source) (let* ((sel (helm-get-selection nil nil source)) @@ -854,7 +898,7 @@ If N is positive go forward otherwise go backward." (buffer-substring (point) (point-max))))) (save-excursion (while (not (eobp)) - (add-text-properties (point-at-bol) (point-at-eol) + (add-text-properties (pos-bol) (pos-eol) `(keymap ,map help-echo ,(concat (get-text-property @@ -867,6 +911,7 @@ If N is positive go forward otherwise go backward." (forward-line 1)))) (helm-grep-mode)) (pop-to-buffer buf) + (setq next-error-last-buffer (get-buffer buf)) (message "Helm %s Results saved in `%s' buffer" src-name buf))) (defun helm-grep-mode-mouse-jump (event) @@ -885,14 +930,20 @@ RESET non-nil means rewind to the first match. This is the `next-error-function' for `helm-grep-mode'." (interactive "p") (goto-char (cond (reset (point-min)) - ((< argp 0) (line-beginning-position)) - ((> argp 0) (line-end-position)) + ((and (< argp 0) helm-current-error) + (line-beginning-position)) + ((and (> argp 0) helm-current-error) + (line-end-position)) ((point)))) (let ((fun (if (> argp 0) #'next-single-property-change #'previous-single-property-change))) (helm-aif (funcall fun (point) 'helm-grep-fname) - (progn (goto-char it) (helm-grep-mode-jump)) + (progn + (goto-char it) + ;; `helm-current-error' is set in + ;; `helm-grep-mode-jump'. + (helm-grep-mode-jump)) (user-error "No more matches")))) (put 'helm-grep-next-error 'helm-only t) @@ -930,7 +981,8 @@ Special commands: (set (make-local-variable 'revert-buffer-function) #'helm-grep-mode--revert-buffer-function) (set (make-local-variable 'next-error-function) - #'helm-grep-next-error)) + #'helm-grep-next-error) + (set (make-local-variable 'helm-current-error) nil)) (put 'helm-grep-mode 'helm-only t) (defun helm-grep-mode--revert-buffer-function (&optional _ignore-auto _noconfirm) @@ -973,7 +1025,8 @@ Special commands: (linum (line-number-at-pos))) (with-current-buffer (next-error-find-buffer) (helm-grep-goto-closest-from-linum linum bufname)))) - (message "Reverting buffer done"))) + (message "Reverting buffer done") + (when executing-kbd-macro (sit-for 1)))) (defun helm-grep-goto-closest-from-linum (linum bufname) (goto-char (point-min)) @@ -994,8 +1047,10 @@ Special commands: (defun helm-grep-mode-jump () (interactive) + (setq next-error-last-buffer (current-buffer)) + (setq-local helm-current-error (point-marker)) (helm-grep-action - (buffer-substring (point-at-bol) (point-at-eol))) + (buffer-substring (pos-bol) (pos-eol))) (helm-match-line-cleanup-pulse)) (defun helm-grep-mode-jump-other-window-1 (arg) @@ -1005,7 +1060,7 @@ Special commands: (eq last-command 'helm-grep-mode-jump-other-window-backward)) (forward-line arg)) (save-selected-window - (helm-grep-action (buffer-substring (point-at-bol) (point-at-eol)) + (helm-grep-action (buffer-substring (pos-bol) (pos-eol)) 'other-window) (helm-match-line-cleanup-pulse) (recenter))) @@ -1021,7 +1076,9 @@ Special commands: (defun helm-grep-mode-jump-other-window () (interactive) - (let ((candidate (buffer-substring (point-at-bol) (point-at-eol)))) + (setq next-error-last-buffer (current-buffer)) + (setq-local helm-current-error (point-marker)) + (let ((candidate (buffer-substring (pos-bol) (pos-eol)))) (condition-case nil (progn (helm-grep-action candidate 'other-window) (helm-match-line-cleanup-pulse)) @@ -1451,8 +1508,8 @@ non-file buffers." fnargs)) process-connection-type) ;; Start pdf grep process. - (helm-log "Starting Pdf Grep process in directory `%s'" default-directory) - (helm-log "Command line used was:\n\n%s" + (helm-log "helm-pdfgrep-init" "Starting Pdf Grep process in directory `%s'" default-directory) + (helm-log "helm-pdfgrep-init" "Command line used was:\n\n%s" (concat ">>> " (propertize cmd-line 'face 'helm-grep-cmd-line) "\n\n")) (prog1 (start-file-process-shell-command @@ -1474,7 +1531,7 @@ non-file buffers." (force-mode-line-update) (when helm-allow-mouse (helm--bind-mouse-for-selection helm-selection-point))) - (helm-log "Error: Pdf grep %s" + (helm-log "helm-pdfgrep-init" "Error: Pdf grep %s" (replace-regexp-in-string "\n" "" event)))))))) (defun helm-do-pdfgrep-1 (only &optional recurse) @@ -1526,57 +1583,6 @@ non-file buffers." ;; https://github.com/monochromegane/the_platinum_searcher ;; https://github.com/BurntSushi/ripgrep -(defcustom helm-grep-ag-command - "ag --line-numbers -S --color --nogroup %s -- %s %s" - "The default command for AG, PT or RG. - -Takes three format specs, the first for type(s), the second for -pattern and the third for directory. - -You can use safely \"--color\" (used by default) with AG RG and -PT. - -NOTE: Usage of \"--color=never\" is discouraged as it uses Elisp -to colorize matched items which is slower than using the native -colorization of backend, however it is still supported. - -For ripgrep here is the command line to use: - - rg --color=always --smart-case --no-heading --line-number %s -- %s %s - -And to customize colors (always for ripgrep) use something like this: - - rg --color=always --colors \\='match:bg:yellow' --colors \\='match:fg:black' -\--smart-case --no-heading --line-number %s -- %s %s - -This will change color for matched items from foreground red (the -default) to a yellow background with a black foreground. Note -that your color settings for RG will not work properly with -multiples pattern if you have configured colors in rg config file -instead of command line. For more enhanced settings of ansi -colors see https://github.com/emacs-helm/helm/issues/2313 - -You must use an output format that fit with helm grep, that is: - - \"filename:line-number:string\" - -The option \"--nogroup\" allow this. -The option \"--line-numbers\" is also mandatory except with -PT (not supported). -For RG the options \"--no-heading\" and \"--line-number\" are the -ones to use. - -When modifying the default colors of matches with e.g. -\"--color-match\" option of AG or \"--colors\" option of ripgrep -you may want to modify as well `helm-grep-ag-pipe-cmd-switches' -to have all matches colorized with the same color in multi -match. - -Of course you can use several other options, see the man page of the -backend you are using." - :group 'helm-grep - :type 'string) - (defun helm-grep--ag-command () (car (helm-remove-if-match "\\`[A-Z]*=" (split-string helm-grep-ag-command)))) @@ -1635,9 +1641,9 @@ returns if available with current AG version." (start-time (float-time)) (proc-name (helm-grep--ag-command))) (set (make-local-variable 'helm-grep-last-cmd-line) cmd-line) - (helm-log "Starting %s process in directory `%s'" + (helm-log "helm-grep-ag-init" "Starting %s process in directory `%s'" proc-name directory) - (helm-log "Command line used was:\n\n%s" + (helm-log "helm-grep-ag-init" "Command line used was:\n\n%s" (concat ">>> " cmd-line "\n\n")) (prog1 (start-file-process-shell-command @@ -1662,7 +1668,7 @@ returns if available with current AG version." ,(upcase proc-name)) 'face 'helm-grep-finish)))))) ((string= event "finished\n") - (helm-log "%s process finished with %s results in %fs" + (helm-log "helm-grep-ag-init" "%s process finished with %s results in %fs" proc-name (helm-get-candidate-number) (- (float-time) start-time)) @@ -1682,6 +1688,7 @@ returns if available with current AG version." (when helm-allow-mouse (helm--bind-mouse-for-selection helm-selection-point)))) (t (helm-log + "helm-grep-ag-init" "Error: %s %s" proc-name (replace-regexp-in-string "\n" "" event)))))))))) @@ -1735,37 +1742,22 @@ If INPUT is provided, use it as the search string." "Start grep AG in DIRECTORY. When WITH-TYPES is non-nil provide completion on AG types." (require 'helm-adaptive) - (helm-grep-ag-1 directory - (helm-aif (and with-types - (helm-grep-ag-get-types)) - (helm-comp-read - "Ag type: " it - :must-match t - :marked-candidates t - :fc-transformer 'helm-adaptive-sort - :buffer "*helm ag types*")))) + (let ((com (capitalize (helm-grep--ag-command)))) + (helm-grep-ag-1 directory + (helm-aif (and with-types + (helm-grep-ag-get-types)) + (helm-comp-read + (format "%s type: " com) it + :must-match t + :marked-candidates t + :fc-transformer 'helm-adaptive-sort + :buffer (format "*helm %s types*" com)))))) ;;; Git grep ;; ;; (defvar helm-source-grep-git nil) -(defcustom helm-grep-git-grep-command - "git --no-pager grep -n%cH --color=always --full-name -e %p -- %f" - "The git grep default command line. -The option \"--color=always\" can be used safely. -The color of matched items can be customized in your .gitconfig -See `helm-grep-default-command' for more infos. - -The \"--exclude-standard\" and \"--no-index\" switches allow -skipping unwanted files specified in ~/.gitignore_global and -searching files not already staged (not enabled by default). - -You have also to enable this in global \".gitconfig\" with - \"git config --global core.excludesfile ~/.gitignore_global\"." - :group 'helm-grep - :type 'string) - (defun helm-grep-git-1 (directory &optional all default input) "Run git-grep on DIRECTORY. If DIRECTORY is not inside or part of a git repo exit with error. diff --git a/elpa/helm-20220616.1004/helm-help.el b/elpa/helm-20230806.1956/helm-help.el similarity index 94% rename from elpa/helm-20220616.1004/helm-help.el rename to elpa/helm-20230806.1956/helm-help.el index cafdddc6..d0e3cda9 100644 --- a/elpa/helm-20220616.1004/helm-help.el +++ b/elpa/helm-20230806.1956/helm-help.el @@ -1,6 +1,6 @@ ;;; helm-help.el --- Help messages for Helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -392,8 +392,8 @@ the cursor to the top instead of remaining on the previous subdir name. **** Enter `..name/' at end of pattern to start a recursive search -It searches directories matching \"name\" under the current directory, see the -\"Recursive completion on subdirectories\" section below for more details. +It searches directories matching \"name\" under the current directory, +see the [[Recursive completion on subdirectories][Recursive completion on subdirectories]] section below for more details. **** Any environment variable (e.g. `$HOME') at end of pattern gets expanded @@ -447,8 +447,12 @@ toggle the thumbnail view with \\`\\[helm-ff-toggle-thumbna **** Launch a slideshow from marked files -Helm provides an action from `helm-find-files' that allows running a slideshow on marked files. -Just mark image files and launch slideshow from action menu, bindings are self documented. +Helm provides an action from `helm-find-files' that allows +running a slideshow on marked files. Just mark image files and +launch slideshow from action menu, bindings are self documented +in mode-line. NOTE: When hitting any other keys than the ones +mentionned in mode-line, slideshow will come in pause, to restart +it you will have to press twice SPACE. *** Open files externally @@ -495,7 +499,7 @@ Simply write the path in the prompt and press `RET', e.g. *** To create a new file, enter a filename not ending with \"/\" -Note that when you enter a new name, this one is prefixed with [?]. +Note that when you enter a new name, this one is prefixed with [+]. *** Recursive search from Helm-find-files @@ -568,14 +572,14 @@ You can use also a glob based search, in this case use the --glob option: *** Insert filename at point or complete filename at point -On insertion (not on completion, i.e. there is nothing at point): +On insertion (i.e. there is nothing at point): - `\\[helm-ff-run-complete-fn-at-point]': insert absolute file name. - `\\[universal-argument] \\[helm-ff-run-complete-fn-at-point]': insert abbreviated file name. - `\\[universal-argument] \\[universal-argument] \\[helm-ff-run-complete-fn-at-point]': insert relative file name. - `\\[universal-argument] \\[universal-argument] \\[universal-argument] \\[helm-ff-run-complete-fn-at-point]': insert basename. -On completion: +On completion (\\[helm-ff-run-complete-fn-at-point]): - Target starts with \"~/\": insert abbreviate file name. - target starts with \"/\" or \"[a-z]:/\": insert full path. @@ -822,6 +826,15 @@ When `dired-async-mode' is enabled, an additional action named \"Backup files\" will be available. (Such command is not natively available in Emacs). See [[Use the wildcard to select multiple files]] for details. +*** Multiple copies of a file + +The command \\\\[helm-ff-run-mcp] allows +copying a single file to multiple directories. To use it, mark +the file you want to copy first and then mark the directories +where you want to copy file. For example if you run +\\[helm-ff-run-mcp] on the marked candidates '(\"foo.txt\" \"bar/\" \"baz\"), +\"foo.txt\" will be copied to directories \"bar/\" and \"baz/\". + *** Use Rsync to copy files If Rsync is available, you can use it to copy/sync files or directories @@ -1047,17 +1060,23 @@ When using two prefix args, files are opened in background without beeing displa *** Expand archives as directories in a avfs directory -If you have mounted your filesystem with mountavfs, +If you have mounted your filesystem with 'mountavfs' command, you can expand archives in the \"~/.avfs\" directory with \\\\[helm-execute-persistent-action]. +To umount Avfs, use ~fusermount -u ~/.avfs~ + +NOTE: You need the package 'avfs', on debian like distros use ~apt-get install avfs~. + *** Tramp archive support (emacs-27+ only) -If your emacs have library tramp-archive.el, you can browse the -content of archives with emacs and BTW helm-find-files. However this beeing -experimental and not very fast, helm doesn't provide an automatic -expansion and detection of archives, you will have to add the final / -manually and may have to force update (\\\\[helm-refresh]) -or remove and add again the final / until tramp finish decompressing archive. +As Tramp archive often crash Helm and Emacs, Helm does its best +to disable it, however it is hard to do so as Tramp Archive is +enabled inconditionally in Emacs. Here I build my Emacs +without-dbus to ensure Tramp archive wont kickin unexpectedly. + +If you want to browse archives please use [[Expand archives as +directories in a avfs directory][Avfs]] which is much better and +stable. *** Touch files @@ -1071,6 +1090,18 @@ To touch more than one new file, separate you filenames with a comma (\",\"). If one wants to create (touch) a new file with comma inside the name use a prefix arg, this will prevent splitting the name and create multiple files. +*** Change mode on files (chmod) + +When running `\\\\[helm-ff-run-chmod]' on +marked files, you can enter the new mode in prompt but you can +also use the first marked file as model to use it as default. +For example you can mark a file with mode 777 and mark other +files with mode 664, press 'RET' and answer 'y', all marked files +will be changed to 777. + +NOTE: Another way to change modes on files in helm-find-files is +running `\\\\[helm-ff-run-switch-to-shell]' and use 'chmod' directly. + *** Delete files You can delete files without quitting helm with @@ -1082,7 +1113,7 @@ make this command asynchronous by customizing _WARNING_: When deleting files asynchronously you will NOT be WARNED if directories are not empty, that's mean non empty directories will -be deleted in background without asking. +be deleted recursively in background without asking. A good compromise is to trash your files when using asynchronous method (see [[Trashing files][Trashing files]]). @@ -1120,16 +1151,8 @@ Tip: Navigate to your Trash/files directories with `helm-find-files' and set a b there with \\\\[helm-ff-bookmark-set] for fast access to Trash. NOTE: Restoring files from trash is working only on system using -the [[http://freedesktop.org/wiki/Specifications/trash-spec][freedesktop trash specifications]]. - -_WARNING:_ - -If you have an ENV var XDG_DATA_HOME in your .profile or .bash_profile -and this var is set to something like $HOME/.local/share (like preconized) -`move-file-to-trash' may try to create $HOME/.local/share/Trash (literally) -and its subdirs in the directory where you are actually trying to trash files. -because `move-file-to-trash' is interpreting XDG_DATA_HOME literally instead -of evaling its value (with `substitute-in-file-name'). +the +[[http://freedesktop.org/wiki/Specifications/trash-spec][freedesktop trash specifications]]. ***** Trashing remote files with tramp @@ -1140,15 +1163,15 @@ The package on most GNU/Linux based distributions is trash-cli, it is available NOTE: When deleting your files with sudo method, your trashed files will not be listed -with trash-list until you log in as root. +with trash-list command line until you log in as root. *** Checksum file Checksum is calculated with the md5sum, sha1sum, sha224sum, -sha256sum, sha384sum and sha512sum when available, otherwise the +sha256sum, sha384sum and sha512sum commands when available, otherwise the Emacs function `secure-hash' is used but it is slow and may crash Emacs and even the whole system as it eats all memory. So if -your system doesn't have the md5 and sha command line tools be +your system doesn't have the md5sum and sha*sum command line tools be careful when checking sum of larges files e.g. isos. *** Ignored or boring files @@ -1196,12 +1219,14 @@ If `all-the-icons' package is installed, turning on |\\[helm-ff-run-rename-file]|Rename Files (`\\[universal-argument]' to follow). |\\[helm-ff-run-query-replace-fnames-on-marked]|Query replace on marked files. |\\[helm-ff-run-copy-file]|Copy Files (`\\[universal-argument]' to follow). +|\\[helm-ff-run-mcp]|Copy car of marked to remaining directories. |\\[helm-ff-run-rsync-file]|Rsync Files (`\\[universal-argument]' to edit command). |\\[helm-ff-run-byte-compile-file]|Byte Compile Files (`\\[universal-argument]' to load). |\\[helm-ff-run-load-file]|Load Files. |\\[helm-ff-run-symlink-file]|Symlink Files. |\\[helm-ff-run-hardlink-file]|Hardlink files. |\\[helm-ff-run-relsymlink-file]|Relative symlink Files. +|\\[helm-ff-run-chmod]|Change mode on Files. |\\[helm-ff-run-delete-file]|Delete Files. |\\[helm-ff-run-touch-files]|Touch files. |\\[helm-ff-run-kill-buffer-persistent]|Kill buffer candidate without leaving Helm. @@ -1344,7 +1369,7 @@ a directory \(e.g `list-directory'). *** Exiting minibuffer with empty string -You can exit minibuffer with empty string with \\\\[helm-cr-empty-string]. +You can exit minibuffer with empty string with \\\\[helm-cr-empty-string]. It is useful when some commands are prompting continuously until you enter an empty prompt. ** Commands @@ -1853,10 +1878,11 @@ Nowaday the best backend is Ripgrep aka RG, it is the fastest and is actively maintained, see `helm-grep-ag-command' and `helm-grep-ag-pipe-cmd-switches' to configure it. -You can ignore files and directories with a \".agignore\" file, local to a -directory or global when placed in the home directory. (See the AG man page for -more details.) That file follows the same syntax as `helm-grep-ignored-files' -and `helm-grep-ignored-directories'. +You can ignore files and directories with a \".agignore\" or +\".rgignore\" file, local to a directory or global when placed in +the home directory. (See the AG/RG man pages for more details.) +Note that `helm-grep-ignored-files'and +`helm-grep-ignored-directories' have no effect in helm-AG/RG. As always you can access Helm AG from `helm-find-files'. @@ -2089,6 +2115,51 @@ Matching empty lines is supported with the regexp \"^$\", you then get the results displayed as the buffer-name and the line number only. You can save and edit these results, i.e. add text to the empty line. +**** Matching shorthands symbols in Elisp code + +Helm-occur have a basic support of [[info:elisp#Shorthands][read-symbol-shorthands]]. +You can enable this by customizing =helm-occur-match-shorthands=. + +The main usage is when you are in a given buffer with cursor on a +symbol and you want to see where the definition is or where it is +used in another buffer or other buffers. Of course matching is +working on both versions of the definition, the short one and the +long one. Here an example reusing the sample files used in the +Manual: + +Here snu.el file with cursor on snu-lines definition: + +#+begin_src elisp + (defun snu-split (separator s &optional omit-nulls) + \"A match-data saving variation on `split-string'.\" + (save-match-data (split-string s separator omit-nulls))) + + (defun snu-lines (s) + \"Split string S into a list of strings on newline characters.\" + (snu-split \"\\\\(\\r\\n\\\\|[\\n\\r]\\\\)\" s)) + + ;; Local Variables: + ;; read-symbol-shorthands: ((\"snu-\" . \"some-nice-string-utils-\")) + ;; End: +#+end_src + +And here the my-tricks.el file reusing snu-lines but under another name: + +#+begin_src elisp + (defun t-reverse-lines (s) + (string-join (reverse (sns-lines s)) \"\\n\")) + + ;; Local Variables: + ;; read-symbol-shorthands: ((\"t-\" . \"my-tricks-\") + ;; (\"sns-\" . \"some-nice-string-utils-\")) + ;; End: + +#+end_src + +You want to know where the definition currently at point ('snu-lines') is used in the my-tricks.el buffer. +You launch for example helm-mini and start helm-occur on my-tricks.el, helm occur will match immediately +'sns-lines'. + *** Automatically match symbol at point Helm can automatically match the symbol at point while keeping @@ -2308,7 +2379,14 @@ 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.") +command you want to execute before specifying prefix arg. + +** Commands +\\ +|Keys|Description +|-----------+------------| +|\\[helm-M-x-universal-argument]|Universal argument for selected command +|\\[helm-M-x-toggle-short-doc]|Toggle details on commands") ;;; Helm imenu @@ -2360,12 +2438,15 @@ command you want to execute before specifying prefix arg.") - End the kmacro recording with `f4'. - Run `helm-execute-kmacro' to list all your kmacros. -Use persistent action to run your kmacro as many times as needed. -You can browse the kmacros with `helm-next-line' and `helm-previous-line'. +When you press RET, your macro goes on top of ring and become the +current macro, hit `f4' for further executions. +Use `helm-execute-kmacro' again to change eventually your macro to execute. Note: You can't record keys running Helm commands except `helm-M-x', under the condition that you don't choose a command using Helm completion. +See [[info:emacs#Keyboard Macros][Keyboard Macros]] for further infos on macros. + ** Commands \\") diff --git a/elpa/helm-20220616.1004/helm-id-utils.el b/elpa/helm-20230806.1956/helm-id-utils.el similarity index 98% rename from elpa/helm-20220616.1004/helm-id-utils.el rename to elpa/helm-20230806.1956/helm-id-utils.el index 0ff71e52..215092b6 100644 --- a/elpa/helm-20220616.1004/helm-id-utils.el +++ b/elpa/helm-20230806.1956/helm-id-utils.el @@ -67,7 +67,7 @@ MacPorts to install id-utils, it should be `gid32'." 0)) 'face 'helm-locate-finish)))) (force-mode-line-update)) - (helm-log "Error: Gid %s" + (helm-log "helm-gid-candidates-process" "Error: Gid %s" (replace-regexp-in-string "\n" "" event)))))))) (defun helm-gid-filtered-candidate-transformer (candidates _source) diff --git a/elpa/helm-20220616.1004/helm-imenu.el b/elpa/helm-20230806.1956/helm-imenu.el similarity index 97% rename from elpa/helm-20220616.1004/helm-imenu.el rename to elpa/helm-20230806.1956/helm-imenu.el index 36aa9780..ed9955cb 100644 --- a/elpa/helm-20220616.1004/helm-imenu.el +++ b/elpa/helm-20230806.1956/helm-imenu.el @@ -1,6 +1,6 @@ ;;; helm-imenu.el --- Helm interface for Imenu -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -95,14 +95,25 @@ string." (defcustom helm-imenu-hide-item-type-name nil "Hide display name of imenu item type along with the icon when non nil. -This value can be toggled with \\\\[helm-imenu-toggle-type-view]." +This value can be toggled with \\\\[helm-imenu-toggle-type-view]. +Don't use `setq' to set this." :group 'helm-imenu - :type 'boolean) + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) (defcustom helm-imenu-use-icon nil - "Display an icon from all-the-icons package when non nil." + "Display an icon from all-the-icons package when non nil. + +Don't use `setq' to set this." :group 'helm-imenu - :type 'boolean) + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) (defcustom helm-imenu-icon-type-alist '(("Array" . (all-the-icons-material "crop" :face font-lock-builtin-face)) @@ -230,7 +241,7 @@ The sexp should be an `all-the-icons' function with its args." (with-helm-window (let* ((fn (lambda () (let ((str (buffer-substring - (point-at-bol) (point-at-eol)))) + (pos-bol) (pos-eol)))) (if helm-imenu-hide-item-type-name (get-text-property 1 'type-name str) (car (split-string str helm-imenu-delimiter)))))) @@ -300,7 +311,7 @@ The sexp should be an `all-the-icons' function with its args." (let ((cur (helm-get-selection)) (mb (with-helm-current-buffer (save-excursion - (goto-char (point-at-bol)) + (goto-char (pos-bol)) (point-marker))))) ;; Happen when cursor is on the line where a definition is. This ;; prevent jumping to the definition where we are already, instead @@ -309,7 +320,7 @@ The sexp should be an `all-the-icons' function with its args." (if (equal (cdr cur) mb) (prog1 nil (helm-set-pattern "") - (helm-force-update)) + (helm-force-update (concat "\\_<" (car cur) "\\_>"))) t))) (defun helm-imenu-quit-and-find-file-fn (source) @@ -319,7 +330,7 @@ The sexp should be an `all-the-icons' function with its args." (defun helm-imenu-action (candidate) "Default action for `helm-source-imenu'." - (helm-log-run-hook 'helm-goto-line-before-hook) + (helm-log-run-hook "helm-imenu-action" 'helm-goto-line-before-hook) (helm-imenu--maybe-switch-to-buffer candidate) (imenu candidate) ;; If semantic is supported in this buffer @@ -420,7 +431,6 @@ The sexp should be an `all-the-icons' function with its args." "Return an icon for type TYPE. The icon is found in `helm-imenu-icon-type-alist', if not `helm-imenu-default-type-sexp' is evaled to provide a default icon." - (require 'all-the-icons) (let ((all-the-icons-scale-factor 1.0) (all-the-icons-default-adjust 0.0)) (or (helm-aand (assoc-default diff --git a/elpa/helm-20220616.1004/helm-info.el b/elpa/helm-20230806.1956/helm-info.el similarity index 86% rename from elpa/helm-20220616.1004/helm-info.el rename to elpa/helm-20230806.1956/helm-info.el index e996c096..9155f3ae 100644 --- a/elpa/helm-20220616.1004/helm-info.el +++ b/elpa/helm-20230806.1956/helm-info.el @@ -1,6 +1,6 @@ ;;; helm-info.el --- Browse info index with helm -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -18,10 +18,13 @@ ;;; Code: (require 'cl-lib) +(require 'info) +;; helm-utils is requiring helm which is requiring helm-lib, but let's require +;; them explicitely anyway to make it clear what we need. helm-core is needed to +;; build all the helm-info-* commands and sources. (require 'helm) (require 'helm-lib) -(require 'helm-utils) -(require 'info) +(require 'helm-utils) ; for `helm-goto-line'. (declare-function Info-index-nodes "info" (&optional file)) (declare-function Info-goto-node "info" (&optional fork)) @@ -31,6 +34,11 @@ (declare-function ring-ref "ring") (defvar Info-history) (defvar Info-directory-list) +;; `Info-minibuf-history' is not declared in Emacs, see emacs bug/58786. +(when (and (> emacs-major-version 28) + (not (boundp 'Info-minibuf-history))) + (defvar Info-minibuf-history nil)) + ;;; Customize @@ -59,12 +67,12 @@ found in each node, otherwise scan only the current info buffer." (helm-candidate-buffer)) (kill-buffer it)) (unless (helm-candidate-buffer) - (save-selected-window + (save-window-excursion (info file " *helm info temp buffer*") (let ((tobuf (helm-candidate-buffer 'global)) Info-history) (helm-aif (Info-index-nodes) - (cl-dolist (node it) + (dolist (node it) (Info-goto-node node) (helm-info-scan-current-buffer tobuf)) (helm-info-scan-current-buffer tobuf)) @@ -76,16 +84,16 @@ Argument TOBUF is the `helm-candidate-buffer'." (let (start end line) (goto-char (point-min)) (while (search-forward "\n* " nil t) - (unless (search-forward "Menu:\n" (1+ (point-at-eol)) t) - (setq start (point-at-bol) + (unless (search-forward "Menu:\n" (1+ (pos-eol)) t) + (setq start (pos-bol) ;; Fix Bug#1503 by getting the invisible ;; info displayed on next line in long strings. ;; e.g "* Foo.\n (line 12)" instead of ;; "* Foo.(line 12)" end (or (save-excursion - (goto-char (point-at-bol)) + (goto-char (pos-bol)) (re-search-forward "(line +[0-9]+)" nil t)) - (point-at-eol)) + (pos-eol)) ;; Long string have a new line inserted before the ;; invisible spec, remove it. line (replace-regexp-in-string @@ -96,11 +104,14 @@ Argument TOBUF is the `helm-candidate-buffer'." (defun helm-info-goto (node-line) "The helm-info action to jump to NODE-LINE." - (Info-goto-node (car node-line)) - (helm-goto-line (cdr node-line))) + (require 'helm-utils) + (let ((alive (buffer-live-p (get-buffer "*info*")))) + (Info-goto-node (car node-line)) + (when alive (revert-buffer nil t)) + (helm-goto-line (cdr node-line)))) (defvar helm-info--node-regexp - "^\\* +\\(.+\\):[ \\t]+\\(.*\\)\\(?:[ \\t]*\\)(line +\\([0-9]+\\))" + "^\\* +\\(.+\\):[[:space:]]+\\(.*\\)\\(?:[[:space:]]*\\)(line +\\([0-9]+\\))" "A regexp that should match file name, node name and line number in a line like this: @@ -109,17 +120,18 @@ a line like this: (defun helm-info-display-to-real (line) "Transform LINE to an acceptable argument for `info'. If line have a node use the node, otherwise use directly first name found." - (let (nodename linum) + (let ((info-file (helm-get-attr 'info-file)) + nodename linum) (when (string-match helm-info--node-regexp line) (setq nodename (match-string 2 line) linum (match-string 3 line))) (if nodename (cons (format "(%s)%s" - (helm-get-attr 'info-file) + info-file (replace-regexp-in-string ":\\'" "" nodename)) (string-to-number (or linum "1"))) (cons (format "(%s)%s" - (helm-get-attr 'info-file) + info-file (helm-aand (replace-regexp-in-string "^* " "" line) (replace-regexp-in-string "::?.*\\'" "" it))) 1)))) @@ -149,14 +161,17 @@ Arg SOURCE will be an existing helm source named :candidate-number-limit 1000)) doc)) -(defun helm-define-info-index-sources (var-value &optional commands) - "Define Helm sources named helm-source-info-. -Sources are generated for all entries of -`helm-default-info-index-list'. -If COMMANDS arg is non-nil, also build commands named -`helm-info-'. -Where NAME is an element of `helm-default-info-index-list'." - (cl-loop for str in var-value +(defun helm-define-info-index-sources (info-list &optional commands) + "Define Helm info sources for all entries in INFO-LIST. + +Sources will be named named helm-source-info- where NAME is an element of +INFO-LIST. + +Sources are generated for all entries of `helm-default-info-index-list' which is +generated by `helm-get-info-files'. + +If COMMANDS arg is non-nil, also build commands named `helm-info-'." + (cl-loop for str in info-list for sym = (intern (concat "helm-source-info-" str)) do (set sym (helm-build-info-source str)) when commands diff --git a/elpa/helm-20220616.1004/helm-locate.el b/elpa/helm-20230806.1956/helm-locate.el similarity index 97% rename from elpa/helm-20220616.1004/helm-locate.el rename to elpa/helm-20230806.1956/helm-locate.el index 222b5e05..11c66c7d 100644 --- a/elpa/helm-20220616.1004/helm-locate.el +++ b/elpa/helm-20230806.1956/helm-locate.el @@ -1,6 +1,6 @@ ;;; helm-locate.el --- helm interface for locate. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -37,8 +37,7 @@ (defcustom helm-locate-db-file-regexp "m?locate\\.db$" "Default regexp to match locate database. If nil Search in all files." - :type 'string - :group 'helm-locate) + :type 'string) (defcustom helm-ff-locate-db-filename "locate.db" "The basename of the locatedb file you use locally in your directories. @@ -47,7 +46,6 @@ where you launch locate, it will use this file and will not prompt you for a db file. Note that this happen only when locate is launched with a prefix arg." - :group 'helm-locate :type 'string) (defcustom helm-locate-command nil @@ -79,14 +77,12 @@ Note that the \"-b\" option is added automatically by Helm when var `helm-locate-fuzzy-match' is non-nil and switching back from multimatch to fuzzy matching (this is done automatically when a space is detected in pattern)." - :type 'string - :group 'helm-locate) + :type 'string) (defcustom helm-locate-create-db-command "updatedb -l 0 -o '%s' -U '%s'" "Command used to create a locale locate db file." - :type 'string - :group 'helm-locate) + :type 'string) (defcustom helm-locate-case-fold-search helm-case-fold-search "It have the same meaning as `helm-case-fold-search'. @@ -96,26 +92,22 @@ When nil \"-i\" will not be used at all and when non-nil it will always be used. NOTE: the -i option of the \"es\" command used on windows does the opposite of \"locate\" command." - :group 'helm-locate :type 'symbol) (defcustom helm-locate-fuzzy-match nil "Enable fuzzy matching in `helm-locate'. Note that when this is enabled searching is done on basename." - :group 'helm-locate :type 'boolean) (defcustom helm-locate-fuzzy-sort-fn #'helm-locate-default-fuzzy-sort-fn "Default fuzzy matching sort function for locate." - :group 'helm-locate :type 'boolean) (defcustom helm-locate-project-list nil "A list of directories, your projects. When set, allow browsing recursively files in all directories of this list with `helm-projects-find-files'." - :group 'helm-locate :type '(repeat string)) (defcustom helm-locate-recursive-dirs-command "locate -i -e -A --regex '^%s' '%s.*$'" @@ -325,8 +317,8 @@ See also `helm-locate'." (shell-quote-argument (car args))))) (default-directory (if (file-directory-p default-directory) default-directory "/"))) - (helm-log "Starting helm-locate process") - (helm-log "Command line used was:\n\n%s" + (helm-log "helm-locat-init" "Starting helm-locate process") + (helm-log "helm-locat-init" "Command line used was:\n\n%s" (concat ">>> " (propertize cmd 'face 'font-lock-comment-face) "\n\n")) (prog1 (start-process-shell-command @@ -349,7 +341,7 @@ See also `helm-locate'." (helm-redisplay-buffer)) (helm-locate-update-mode-line "Locate")) (t - (helm-log "Error: Locate %s" + (helm-log "helm-locat-init" "Error: Locate %s" (replace-regexp-in-string "\n" "" event)))))))))) (defun helm-locate-default-fuzzy-sort-fn (candidates) @@ -366,12 +358,12 @@ Sort is done on basename of CANDIDATES." (history :initform 'helm-file-name-history) (persistent-action :initform 'helm-ff-kill-or-find-buffer-fname) (candidate-number-limit :initform 9999) - (redisplay :initform (progn helm-locate-fuzzy-sort-fn)) - (group :initform 'helm-locate))) + (redisplay :initform (progn helm-locate-fuzzy-sort-fn)))) ;; Override helm-type-file class keymap. (cl-defmethod helm--setup-source :after ((source helm-locate-override-inheritor)) - (setf (slot-value source 'keymap) helm-locate-map)) + (setf (slot-value source 'keymap) helm-locate-map) + (setf (slot-value source 'group) 'helm-locate)) (defvar helm-source-locate (helm-make-source "Locate" 'helm-locate-source diff --git a/elpa/helm-20220616.1004/helm-man.el b/elpa/helm-20230806.1956/helm-man.el similarity index 98% rename from elpa/helm-20220616.1004/helm-man.el rename to elpa/helm-20230806.1956/helm-man.el index 010b06da..32170516 100644 --- a/elpa/helm-20220616.1004/helm-man.el +++ b/elpa/helm-20230806.1956/helm-man.el @@ -1,6 +1,6 @@ ;;; helm-man.el --- Man and woman UI -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 diff --git a/elpa/helm-20220616.1004/helm-misc.el b/elpa/helm-20230806.1956/helm-misc.el similarity index 98% rename from elpa/helm-20220616.1004/helm-misc.el rename to elpa/helm-20230806.1956/helm-misc.el index fee7a440..104c9e41 100644 --- a/elpa/helm-20220616.1004/helm-misc.el +++ b/elpa/helm-20230806.1956/helm-misc.el @@ -1,6 +1,6 @@ ;;; helm-misc.el --- Various functions for helm -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -230,7 +230,7 @@ This mode is enabled by `helm-mode', so there is no need to enable it directly." :global t (if helm-minibuffer-history-mode (let ((key helm-minibuffer-history-key)) - (cl-dolist (map '(minibuffer-local-completion-map + (dolist (map '(minibuffer-local-completion-map minibuffer-local-filename-completion-map minibuffer-local-filename-must-match-map ; Emacs 23.1.+ minibuffer-local-isearch-map @@ -250,7 +250,7 @@ This mode is enabled by `helm-mode', so there is no need to enable it directly." (define-key (symbol-value map) (if (stringp key) (read-kbd-macro key) key) 'helm-minibuffer-history)))))) - (cl-dolist (map '(minibuffer-local-completion-map + (dolist (map '(minibuffer-local-completion-map minibuffer-local-filename-completion-map minibuffer-local-filename-must-match-map minibuffer-local-isearch-map diff --git a/elpa/helm-20220616.1004/helm-mode.el b/elpa/helm-20230806.1956/helm-mode.el similarity index 84% rename from elpa/helm-20220616.1004/helm-mode.el rename to elpa/helm-20230806.1956/helm-mode.el index 6f5bb0e8..b72831b5 100644 --- a/elpa/helm-20220616.1004/helm-mode.el +++ b/elpa/helm-20230806.1956/helm-mode.el @@ -1,6 +1,6 @@ ;;; helm-mode.el --- Enable helm completion everywhere. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -38,6 +38,7 @@ (declare-function helm-lisp-completion-persistent-action "helm-elisp") (declare-function helm-lisp-completion-persistent-help "helm-elisp") (declare-function help--symbol-class "help-fns.el") +(declare-function helm-get-first-line-documentation "helm-elisp") (defgroup helm-mode nil "Enable helm completion." @@ -58,7 +59,8 @@ (dired-do-hardlink . helm-read-file-name-handler-1) (basic-save-buffer . helm-read-file-name-handler-1) (write-file . (default helm-read-file-name-handler-1)) - (write-region . (default helm-read-file-name-handler-1))) + (write-region . (default helm-read-file-name-handler-1)) + (all-the-icons-insert . helm-mode-all-the-icons-handler)) "Completing read functions for specific Emacs commands. By default `helm-mode' use `helm-completing-read-default-handler' to @@ -149,7 +151,16 @@ same as Note that you don't need to enable `ido-mode' for this to work, see `helm-mode' documentation." :group 'helm-mode - :type '(alist :key-type symbol :value-type symbol)) + :type '(alist + :key-type symbol + :value-type (choice + function + (list :tag "Specify the completing-read and read-file-name handlers" + (choice + (const :tag "Use default helm completing-read handler" default) + (function :tag "Use this helm completing-read function")) + (function :tag "Use this helm read file name function")) + (other :tag "Disabled" nil)))) (defcustom helm-comp-read-case-fold-search helm-case-fold-search "Default Local setting of `helm-case-fold-search' for `helm-comp-read'. @@ -228,6 +239,11 @@ This is mainly needed to prevent \"*Completions*\" buffers to popup.") (:background "red" :foreground "black"))) "Face used for prefix completion." :group 'helm-mode) + +(defface helm-completion-invalid + '((t :inherit font-lock-property-name-face)) + "Face used to highlight invalid functions." + :group 'helm-mode) (defvar helm-comp-read-map (let ((map (make-sparse-keymap))) @@ -332,16 +348,18 @@ NOT `setq'." (defcustom helm-completion-styles-alist '((gud-mode . helm) ;; See https://github.com/djcb/mu/issues/2181. (mu4e-compose-mode . emacs)) - "Allow configuring `helm-completion-style' per mode. + "Allow configuring `helm-completion-style' per mode or command. + +NOTE: Use a mode for a completion that will be used in a buffer +i.e. completion-in-region, whereas you have to specify instead a command to +affect the completing-read trigerred by this command. 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 +When specifying emacs as style for a mode or a command, `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 affects only -completions happening in buffers and not minibuffer completions, -i.e. completing-read's." +`completion-styles' to \\='(helm flex) for foo-mode." :group 'helm-mode :type `(alist :key-type (symbol :tag "Major Mode") @@ -490,6 +508,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (cl-defun helm-cr--pattern-in-candidates-p (candidates &optional (pattern helm-pattern)) (or (assoc pattern candidates) + (assoc (concat " " pattern) candidates) (assq (intern pattern) candidates) (member pattern candidates) (member (downcase pattern) candidates) @@ -498,6 +517,11 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (defun helm-cr-default-transformer (candidates source) "Default filter candidate function for `helm-comp-read'." (let ((must-match (helm-get-attr 'must-match source))) + ;; Annotation and affixation are already handled in completion-in-region and + ;; in helm-completing-read-default-2 when emacs style is in use. + ;; For helm-completing-read-default-1 we handle them in an extra FCT; This + ;; allows extracting annotation and affixation from metadata which is not + ;; accessible from here. (cl-loop for c in candidates for cand = (let ((elm (if (stringp c) (replace-regexp-in-string "\\s\\" "" c) @@ -515,28 +539,21 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (eq must-match t) (helm-cr--pattern-in-candidates-p lst pat)) lst - (append (list (cons (concat (propertize - " " 'display - (propertize "[?]" - 'face 'helm-ff-prefix - 'unknown t)) - pat) + (append (list (cons (helm-aand (propertize "[?]" 'face 'helm-ff-prefix) + (propertize " " 'display it 'unknown t) + (concat it pat)) pat)) lst)))))) (defun helm-comp-read--move-to-first-real-candidate () (helm-aif (helm-get-selection nil 'withprop) ;; Avoid error with candidates with an image as display (Bug#2296). - (when (equal (get-text-property 0 'display it) "[?]") + (when (get-text-property 0 'helm-new-file it) (helm-next-line)))) (defun helm-cr-default (default cands) (delq nil - (cond ((and (stringp default) - (not (string= default "")) - (string= helm-pattern "")) - (cons default (delete default cands))) - ((and (consp default) (string= helm-pattern "")) + (cond ((and (consp default) (string= helm-pattern "")) (append (cl-loop for d in default ;; Don't convert ;; nil to "nil" (i.e the string) @@ -546,6 +563,10 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." do (setq cands (delete d cands)) when str collect str) cands)) + ((and (not (equal default "")) + (string= helm-pattern "")) + (cons default (delete (helm-stringify default) + cands))) (t cands)))) ;;;###autoload @@ -572,6 +593,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (name "Helm Completions") header-name candidates-in-buffer + get-line diacritics match-part match-dynamic @@ -694,6 +716,9 @@ Keys description: `helm-source-in-buffer' which is much faster. Argument VOLATILE have no effect when CANDIDATES-IN-BUFFER is non--nil. +- GET-LINE: Specify the :get-line slot of `helm-source-in-buffer', has no effect + when CANDIDATES-IN-BUFFER is nil. + - MATCH-PART: Allow matching only one part of candidate. See match-part documentation in `helm-source'. @@ -737,13 +762,18 @@ that use `helm-comp-read'. See `helm-M-x' for example." nil "Error: History should be specified as a symbol") (when (get-buffer helm-action-buffer) (kill-buffer helm-action-buffer)) + (unless (memq must-match '(confirm confirm-after-completion t nil)) + ;; Fix completing-read's using something else than `t' e.g. 1 or + ;; whatever (bug #2527). + (setq must-match t)) (let ((action-fn `(("Sole action (Identity)" . (lambda (candidate) (if ,marked-candidates (helm-marked-candidates) (identity candidate))))))) (let* ((minibuffer-completion-predicate test) - (minibuffer-completion-table collection) + (minibuffer-completion-table + (or minibuffer-completion-table collection)) (helm-read-file-name-mode-line-string (replace-regexp-in-string "helm-maybe-exit-minibuffer" "helm-confirm-and-exit-minibuffer" @@ -819,6 +849,7 @@ that use `helm-comp-read'. See `helm-M-x' for example." (src-1 (helm-build-in-buffer-source name :data get-candidates :match-part match-part + :get-line get-line :multiline multiline :header-name header-name :filtered-candidate-transformer @@ -862,8 +893,8 @@ that use `helm-comp-read'. See `helm-M-x' for example." :history (and (symbolp input-history) input-history) :buffer buffer)) (remove-hook 'helm-after-update-hook 'helm-comp-read--move-to-first-real-candidate)) - ;; If `history' is a symbol save it. - (when (and result history (symbolp history)) + ;; If `history' is a symbol save it, except when it is t. + (when (and result history (symbolp history) (not (eq history t))) (set history ;; RESULT may be a a string or a list of strings bug #2461. (delete-dups (append (mapcar #'substring-no-properties (helm-mklist result)) @@ -930,17 +961,44 @@ that use `helm-comp-read'. See `helm-M-x' for example." (defun helm-completing-read-default-1 (prompt collection test 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'. + name buffer &optional cands-in-buffer exec-when-only-one alistp get-line) + "Helm `completing-read' handler not rebuilding its candidates dynamically. + +It is used usually with helm or helm-fuzzy `helm-completion-style'. +Call `helm-comp-read' with same args as `completing-read'. + Extra optional arg CANDS-IN-BUFFER means use `candidates-in-buffer' method which is faster. -It should be used when candidate list doesn't need to be rebuilt dynamically." - (let ((history (or (car-safe hist) hist)) - (initial-input (helm-aif (pcase init - ((pred (stringp)) init) - ;; INIT is a cons cell. - (`(,l . ,_ll) l)) - it))) + +EXEC-WHEN-ONLY-ONE allow exiting when COLLECTION contains only one candidate. + +ALISTP is same as `helm-comp-read' :alistp slot. + +When using CANDS-IN-BUFFER, GET-LINE can be specified to exit with candidate +handling properties, see `helm-comp-read'. + +This handler should be used when candidate list doesn't need to be rebuilt +dynamically otherwise use `helm-completing-read-default-2'." + (let* ((history (or (car-safe hist) hist)) + (initial-input (helm-aif (pcase init + ((pred (stringp)) init) + ;; INIT is a cons cell. + (`(,l . ,_ll) l)) + it)) + (minibuffer-completion-table collection) + (metadata (or (completion-metadata (or initial-input "") collection test) + '(metadata))) + (afun (or (plist-get completion-extra-properties :annotation-function) + (completion-metadata-get metadata 'annotation-function))) + (afix (or (plist-get completion-extra-properties :affixation-function) + (completion-metadata-get metadata 'affixation-function))) + (file-comp-p (eq (completion-metadata-get metadata 'category) 'file)) + (sort-fn (unless (eq helm-completion-style 'helm-fuzzy) + (or + (completion-metadata-get + metadata 'display-sort-function) + (lambda (candidates) + (sort candidates #'helm-generic-sort-fn)))))) (helm-comp-read prompt collection :test test @@ -948,19 +1006,27 @@ It should be used when candidate list doesn't need to be rebuilt dynamically." :reverse-history helm-mode-reverse-history :input-history history :must-match require-match - :alistp nil + :alistp alistp :diacritics helm-mode-ignore-diacritics :help-message #'helm-comp-read-help-message :name name :requires-pattern (if (and (stringp default) (string= default "") - (or (eq require-match 'confirm) - (eq require-match - 'confirm-after-completion))) + (memq require-match + '(confirm confirm-after-completion))) 1 0) + :fc-transformer (append (and (or afix afun file-comp-p sort-fn) + (list (lambda (candidates _source) + (helm-completion--initial-filter + (if (and sort-fn (> (length helm-pattern) 0)) + (funcall sort-fn candidates) + candidates) + afun afix file-comp-p)))) + '(helm-cr-default-transformer)) :quit-when-no-cand (eq require-match t) :nomark (null helm-comp-read-use-marked) :candidates-in-buffer cands-in-buffer + :get-line get-line :exec-when-only-one exec-when-only-one :fuzzy (eq helm-completion-style 'helm-fuzzy) :buffer buffer @@ -977,8 +1043,10 @@ It should be used when candidate list doesn't need to be rebuilt dynamically." (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'. + "Helm `completing-read' handler with dynamic matching. +Call `helm-comp-read' with same args as `completing-read'. +For the meaning of optional args see `helm-completing-read-default-1'. This handler uses dynamic matching which allows honouring `completion-styles'." (let* ((history (or (car-safe hist) hist)) (input (pcase init @@ -986,8 +1054,9 @@ This handler uses dynamic matching which allows honouring `completion-styles'." ;; INIT is a cons cell. (`(,l . ,_ll) l))) (completion-flex-nospace t) - (completion-styles - (helm--prepare-completion-styles 'nomode)) + (minibuffer-completion-table collection) + ;; (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) @@ -1036,10 +1105,10 @@ This handler uses dynamic matching which allows honouring `completion-styles'." (append (and default (memq helm-completion-style '(helm helm-fuzzy)) (list default)) - (helm-completion-in-region--initial-filter - (pcase-let ((lst (if (and sort-fn (> (length str) 0)) - (funcall sort-fn all) - all))) + (helm-completion--initial-filter + (let ((lst (if (and sort-fn (> (length str) 0)) + (funcall sort-fn all) + all))) (if (and default afix) (prog1 (append (list default) (delete default lst)) @@ -1082,11 +1151,52 @@ This handler uses dynamic matching which allows honouring `completion-styles'." :must-match require-match) (setq helm-completion--sorting-done nil)))) +(defun helm-mode-all-the-icons-handler (prompt collection test require-match + init hist default inherit-input-method + name buffer) + "Helm `completing-read' handler for `all-the-icons-insert'." + (let* ((max-len 0) + sname + (cands (cl-loop for (desc . str) in collection + ;; When the FAMILY argument is passed to + ;; `all-the-icons-insert' DESC is the name of icon only + ;; otherwise it is "name [family]" with unpredictable + ;; spaces or tab numbers between name and [family]. + for descnp = (substring-no-properties desc) + for sdesc = (if (string-match + "\\(.*\\)[[:blank:]]+\\(\\[.*\\]\\)" descnp) + ;; This is all-the-icons-insert function. + (match-string 1 descnp) + ;; This is one of + ;; all-the-icons-insert- + ;; functions, extract the family name. + (prog1 descnp + (unless sname + (setq sname (plist-get + (get-text-property + 0 'font-lock-face + (get-text-property 0 'display desc)) + :family))))) + for sdesc2 = (match-string 2 descnp) + do (setq max-len (max max-len (string-width sdesc))) + collect (cons (concat sdesc " " str " " sdesc2) desc))) + (fn (lambda () + (with-helm-buffer + (save-excursion + (goto-char (point-min)) + (helm-skip-header-and-separator-line 'next) + (while (re-search-forward "^[[:alnum:]_-]+" nil t) + (insert (make-string (- max-len (current-column)) ? ))))))) + (helm-after-update-hook (append helm-after-update-hook `(,fn)))) + (helm-completing-read-default-1 prompt cands test require-match + init hist default inherit-input-method + (or sname name) buffer t nil t 'buffer-substring))) + (defun helm-completing-read-default-find-tag (prompt collection test require-match init hist default inherit-input-method name buffer) - "Specialized `helm-mode' handler for `find-tag'." + "Helm `completing-read' handler for `find-tag'." ;; Some commands like find-tag may use `read-file-name' from inside ;; the calculation of collection. in this case it clash with ;; candidates-in-buffer that reuse precedent data (files) which is wrong. @@ -1101,7 +1211,7 @@ This handler uses dynamic matching which allows honouring `completion-styles'." (prompt collection test require-match init hist default inherit-input-method name buffer) - "`helm-mode' handler using sync source as backend." + "Helm `completing-read' handler using sync source as backend." (helm-completing-read-default-1 prompt collection test require-match init hist default inherit-input-method name buffer)) @@ -1110,7 +1220,7 @@ This handler uses dynamic matching which allows honouring `completion-styles'." (prompt collection test require-match init hist default inherit-input-method name buffer) - "`helm-mode' handler using inbuffer source as backend." + "Helm `completing-read' 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)) @@ -1119,7 +1229,10 @@ This handler uses dynamic matching which allows honouring `completion-styles'." (prompt collection test require-match init hist default inherit-input-method name buffer) - "Default `helm-mode' handler for all `completing-read'." + "Default Helm `completing-read' handler. + +Use either `helm-completing-read-default-1' or `helm-completing-read-default-2' +according to `helm-completion-style'." (let* (;; Standard will be used as CANDS-IN-BUFFER arg. (standard (and (memq helm-completion-style '(helm helm-fuzzy)) t)) (fn (if standard @@ -1179,6 +1292,22 @@ Affects `switch-to-buffer' `kill-buffer' and related." (t it)) val))) +(defun helm-mode--apply-helm-handler (handler arg-list) + "Ensure `minibuffer-complete' is disabled when running HANDLER. +ARG-LIST is a list of arguments to pass to HANDLER." + ;; Some functions are calling `minibuffer-complete' + ;; within `minibuffer-setup-hook' when calling their + ;; `completing-read', like `woman-file-name' (bug #2527). + ;; This defeat Helm which is already + ;; completing minibuffer, so deactivate + ;; minibuffer-complete one time for all [1]. + (cl-letf (((symbol-function 'minibuffer-complete) #'ignore)) + (apply handler arg-list))) + +(defvar helm-comp-read-require-match-overrides '((describe-function . t) + (describe-command . t)) + "Allow overriding REQUIRE-MATCH completing-read arg for a specific function.") + (cl-defun helm--completing-read-default (prompt collection &optional predicate require-match @@ -1199,7 +1328,10 @@ See documentation of `completing-read' and `all-completions' for details." helm-completing-read-handlers-alist)) (def-com (helm-mode--get-default-handler-for 'comp entry)) (str-defcom (and def-com (helm-symbol-name def-com))) - (def-args (list prompt collection predicate require-match + (def-args (list prompt collection predicate + (helm-aif (assq current-command + helm-comp-read-require-match-overrides) + (cdr it) require-match) initial-input hist def inherit-input-method)) ;; Append the two extra args needed to set the buffer and source name ;; in helm specialized functions. @@ -1228,11 +1360,18 @@ See documentation of `completing-read' and `all-completions' for details." ;; Disable hack that could be used before `completing-read'. ;; i.e (push ?\t unread-command-events). unread-command-events + ;; Let-bounding here helm-completion-style according to + ;; helm-completion-styles-alist allow using helm style per commands. + (helm-completion-style (helm-aif (cdr (assq current-command helm-completion-styles-alist)) + (if (cdr-safe it) (car it) it) + (default-value 'helm-completion-style))) + (completion-styles + (helm--prepare-completion-styles current-command)) (default-handler - ;; If nothing is found in - ;; helm-completing-read-handlers-alist use default - ;; handler. - #'helm-completing-read-default-handler)) + ;; If nothing is found in + ;; helm-completing-read-handlers-alist use default + ;; handler which will itself use `helm-completion-style'. + #'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 @@ -1255,25 +1394,28 @@ See documentation of `completing-read' and `all-completions' for details." (unwind-protect (cond (;; An helm specialized function exists, run it. (and def-com helm-mode) - (apply def-com others-args)) + ;; Disable `minibuffer-complete' for handlers using + ;; helm (bug #2533). + (helm-mode--apply-helm-handler + def-com others-args)) (;; Try to handle `ido-completing-read' everywhere. (and def-com (eq def-com 'ido-completing-read)) (setcar (memq collection def-args) (all-completions "" collection predicate)) (apply def-com def-args)) - (;; User set explicitely `completing-read' or something similar - ;; in *read-handlers-alist, use this with exactly the same - ;; args as in `completing-read'. - ;; If we are here `helm-mode' is now disabled. + (;; A non helm function specified in + ;; `helm-completing-read-handlers-alist' use it with + ;; exactly the same args as in `completing-read'. If + ;; we are here `helm-mode' is now disabled. def-com (apply def-com def-args)) (;; Use by default a in-buffer handler unless ;; COLLECTION is a function. t - (funcall default-handler - prompt collection predicate require-match - initial-input hist def inherit-input-method - str-command buf-name))) + ;; Disable `minibuffer-complete' for handlers using + ;; helm (bug #2533). + (helm-mode--apply-helm-handler + default-handler others-args))) (helm-mode 1) ;; When exiting minibuffer, `this-command' is set to ;; `helm-exit-minibuffer', which is unwanted when starting @@ -1414,7 +1556,8 @@ Keys description: helm-ff-auto-update-flag)) :mode-line mode-line :help-message 'helm-read-file-name-help-message - :nohighlight t + :nohighlight helm-ff-nohighlight-matches + :candidate-number-limit 'helm-ff-candidate-number-limit :candidates (lambda () (if test @@ -1436,9 +1579,8 @@ Keys description: helm-ff--list-directory-cache)) :match-on-real t :filtered-candidate-transformer (delq nil `(helm-ff-fct - helm-ff-sort-candidates - ,(and helm-ff-icon-mode - 'helm-ff-icons-transformer))) + helm-ff-maybe-show-thumbnails + helm-ff-sort-candidates)) :persistent-action-if persistent-action-if :persistent-help persistent-help :volatile t @@ -1488,9 +1630,24 @@ Keys description: dir))) (if (and fname (consp fname)) (setq fname (cl-loop for f in fname - collect (expand-file-name f dir))) + collect (if (file-name-absolute-p fname) + (expand-file-name + f (helm-mode-root-dir dir)) + (expand-file-name fname dir)))) (if (file-name-absolute-p fname) - fname (expand-file-name fname dir)))) + (if (file-remote-p fname) + fname + (substitute-in-file-name + (concat (helm-mode-root-dir dir) fname))) + (expand-file-name fname dir)))) + +(defun helm-mode-root-dir (dir) + (if (file-remote-p dir) + (let* ((host (file-remote-p dir 'host)) + (method (file-remote-p dir 'method)) + (user (file-remote-p dir 'user))) + (format "/%s:%s@%s:/" method user host)) + "/")) (cl-defun helm--generic-read-file-name (prompt &optional dir default-filename mustmatch initial predicate) @@ -1601,7 +1758,14 @@ Don't use it directly, use instead `helm-read-file-name' in your programs." ;; Helm handlers should always have a non nil INITIAL arg. :initial-input (if (string-match helm-ff-url-regexp init) init - (expand-file-name init dir)) + (if (file-name-absolute-p init) + (if (file-remote-p init) + init + (substitute-in-file-name + (concat (helm-mode-root-dir + (or dir init)) + init))) + (expand-file-name init dir))) :alistp nil :nomark (null helm-comp-read-use-marked) :marked-candidates helm-comp-read-use-marked @@ -1636,7 +1800,6 @@ The `helm-find-files' history `helm-ff-history' is used here." (helm-split-window-default-side (if (eq helm-split-window-default-side 'same) 'below helm-split-window-default-side)) - helm-split-window-inside-p helm-reuse-last-window-split-state ;; Helm handlers should always have a non nil INITIAL arg. (init (or initial dir default-directory))) @@ -1672,36 +1835,95 @@ 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--symbol-completion-table-affixation (completions) - "Same as `help--symbol-completion-table-affixation' but for helm. - -Return a list of cons cells of the form (disp . real)." - (mapcar (lambda (c) - (let* ((s (intern c)) - (doc (ignore-errors - (helm-get-first-line-documentation s)))) - (cons (concat (propertize - (format "%-4s" (help--symbol-class s)) - 'face 'completions-annotations) - c - (if doc - (propertize (format " -- %s" doc) - 'face 'completions-annotations) - "")) - c))) - completions)) - -(defun helm-completion-in-region--initial-filter (comps afun afix file-comp-p) +(defun helm--symbol-completion-table-affixation (_completions) + "Override `help--symbol-completion-table-affixation'. + +Normally affixation functions use COMPLETIONS as arg, and return a list of +modified COMPLETIONS. Now we allow affixations functions to return a +function instead, just like annotation functions. The function should return a +list of three elements like (comp prefix suffix). This increase significantly +the speed avoiding one useless loop on complete list of candidates. + +Returns a function and not a list of completions. + +It affects actually describe-variable/function/command/symbol functions. +It uses `helm-get-first-line-documentation' which allow providing documentation +for `describe-variable' symbols and align properly documentation when helm style +is used." + (lambda (comp) + (require 'help-fns) + (let* ((sym (intern comp)) + ;; When using in-buffer implementation we should have the + ;; longest len to align documentation for free. + ;; Check for style as well in case user switches to emacs + ;; style and a candidate buffer remains (with its local vars + ;; still available). + (max-len (and (memq helm-completion-style '(helm helm-fuzzy)) + (buffer-local-value + 'helm-candidate-buffer-longest-len + (get-buffer (or (helm-candidate-buffer) + ;; Return 0 in this case and don't + ;; fail with a nil arg with + ;; get-buffer. + helm-buffer))))) + (sep (if (or (null max-len) (zerop max-len)) + " --" ; Default separator. + (make-string (- max-len (length comp)) ? ))) + (doc (ignore-errors + (helm-get-first-line-documentation sym))) + (symbol-class (help--symbol-class sym))) + (list (if (or (symbol-function sym) (boundp sym) (facep sym)) + comp + ;; Not already defined function. To test add an advice on a non + ;; existing function. + (propertize comp 'face 'helm-completion-invalid)) + (propertize + (format "%-4s" (or (and (not (string= symbol-class "")) + symbol-class) + "i")) + 'face 'completions-annotations) + (if doc (propertize (format "%s%s" sep doc) + 'face 'completions-annotations) + ""))))) + +(defun helm-completion--initial-filter (comps afun afix file-comp-p) "Compute COMPS with function AFUN or AFIX unless FILE-COMP-P non nil. If both AFUN and AFIX are provided only AFIX is used. -When FILE-COMP-P is provided only filter out dot files." +When FILE-COMP-P is provided only filter out dot files. + +When AFUN, AFIX and FILE-COMP-P are nil return COMPS unmodified." + ;; Filter out dot files in file completion. Normally COMPS should be a list of + ;; string but in some cases it is given as a list of strings containing a list + ;; of string e.g. ("a" "b" "c" ("d" "e" "f")) ; This happen in rgrep + ;; (bug#2607) and highlight-* fns (bug #2610), so ensure the list is flattened to + ;; avoid e.g. wrong-type argument: stringp '("d" "e" "f") + ;; FIXME: If this create a new bug with completion-in-region, flatten COMPS + ;; directly in the caller i.e. helm-completing-read-default-1. + (when (or afix afun file-comp-p) + (setq comps (helm-fast-remove-dups + (helm-flatten-list comps) + :test 'equal))) (if file-comp-p - ;; Filter out dot files in file completion. - (cl-loop for f in comps unless - (string-match "\\`\\.\\{1,2\\}/\\'" f) + (cl-loop for f in comps + unless (string-match "\\`\\.\\{1,2\\}/\\'" f) collect f) - (cond (afix (helm--symbol-completion-table-affixation comps)) + (when (eq afix 'help--symbol-completion-table-affixation) + (setq afix 'helm--symbol-completion-table-affixation)) + (cond (afix (let ((affixations (funcall afix comps))) + (if (functionp affixations) + (cl-loop for comp in comps + for cand = (funcall affixations comp) + collect (cons (propertize (concat (nth 1 cand) ;prefix + (nth 0 cand) ;comp + (nth 2 cand)) ;suffix + 'match-part (nth 0 cand)) + comp)) + (cl-loop for (comp prefix suffix) in affixations + collect (cons (propertize + (concat prefix comp suffix) + 'match-part comp) + comp))))) (afun ;; Add annotation at end of ;; candidate if needed, e.g. foo, this happen when @@ -1886,6 +2108,9 @@ is non-nil." ;; Completion-in-region-function +(defvar helm--completing-region nil + "[INTERNAL] flag let-bounded to nil when completing in region.") + (defun helm--completion-in-region (origfun start end collection &optional predicate) "Helm replacement of `completion--in-region'. @@ -1916,6 +2141,7 @@ Can be used for `completion-in-region-function' by advicing it with an (unwind-protect (let* ((enable-recursive-minibuffers t) (completion-flex-nospace t) + (helm--completing-region t) (completion-styles (helm--prepare-completion-styles)) (input (buffer-substring-no-properties start end)) (prefix (and (eq helm-completion-style 'emacs) initial-input)) @@ -1957,7 +2183,7 @@ Can be used for `completion-in-region-function' by advicing it with an (string= input "")) " ")) (file-comp-p (or (eq (completion-metadata-get metadata 'category) 'file) - (helm-mode--in-file-completion-p) + (helm-guess-filename-at-point) ;; Assume that when `afun' and `predicate' are null ;; we are in filename completion. (and (null afun) (null predicate)))) @@ -2010,7 +2236,7 @@ Can be used for `completion-in-region-function' by advicing it with an (unless base-size (setq base-size bs)) (setq helm-completion--sorting-done (and sort-fn t)) (setq all (copy-sequence comps)) - (helm-completion-in-region--initial-filter + (helm-completion--initial-filter (if (and sort-fn (> (length str) 0)) (funcall sort-fn all) all) @@ -2142,10 +2368,6 @@ Be sure to know what you are doing when modifying this.") beg end (mapconcat 'identity (append result '("")) sep)))) (t nil))) -(defun helm-mode--in-file-completion-p () - (with-helm-current-buffer - (run-hook-with-args-until-success 'file-name-at-point-functions))) - (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) diff --git a/elpa/helm-20220616.1004/helm-net.el b/elpa/helm-20230806.1956/helm-net.el similarity index 99% rename from elpa/helm-20220616.1004/helm-net.el rename to elpa/helm-20230806.1956/helm-net.el index e60e9cad..a0ad9c89 100644 --- a/elpa/helm-20220616.1004/helm-net.el +++ b/elpa/helm-20230806.1956/helm-net.el @@ -1,6 +1,6 @@ ;;; helm-net.el --- helm browse url and search web. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 diff --git a/elpa/helm-20220616.1004/helm-occur.el b/elpa/helm-20230806.1956/helm-occur.el similarity index 76% rename from elpa/helm-20220616.1004/helm-occur.el rename to elpa/helm-20230806.1956/helm-occur.el index 9fccfcdd..c754f396 100644 --- a/elpa/helm-20220616.1004/helm-occur.el +++ b/elpa/helm-20230806.1956/helm-occur.el @@ -1,6 +1,6 @@ ;;; helm-occur.el --- Incremental Occur for Helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -29,6 +29,8 @@ (declare-function helm-grep-highlight-match "helm-grep") (declare-function helm-comp-read "helm-mode") +(defvar helm-current-error) + ;;; Internals ;; (defvar helm-source-occur nil @@ -65,7 +67,6 @@ Don't set it to any value, it will have no effect.") ("Save buffer" . helm-occur-save-results) ) "Actions for helm-occur." - :group 'helm-occur :type '(alist :key-type string :value-type function)) (defcustom helm-occur-use-ioccur-style-keys nil @@ -73,7 +74,6 @@ Don't set it to any value, it will have no effect.") Note that if you define this variable with `setq' your change will have no effect, use customize instead." - :group 'helm-occur :type 'boolean :set (lambda (var val) (set var val) @@ -86,12 +86,10 @@ have no effect, use customize instead." (defcustom helm-occur-always-search-in-current nil "Helm multi occur always search in current buffer when non--nil." - :group 'helm-occur :type 'boolean) (defcustom helm-occur-truncate-lines t "Truncate lines in occur buffer when non nil." - :group 'helm-occur :type 'boolean) (defcustom helm-occur-auto-update-on-resume nil @@ -100,7 +98,6 @@ noask => Always update without asking nil => Don't update but signal buffer needs update never => Never update and do not signal buffer needs update Any other non--nil value update after confirmation." - :group 'helm-regexp :type '(radio :tag "Allow auto updating helm-occur buffer when outdated." (const :tag "Always update without asking" noask) (const :tag "Never update and do not signal buffer needs update" never) @@ -109,44 +106,62 @@ Any other non--nil value update after confirmation." (defcustom helm-occur-candidate-number-limit 99999 "Value of `helm-candidate-number-limit' for helm-occur." - :group 'helm-occur :type 'integer) (defcustom helm-occur-buffer-substring-fn-for-modes '((mu4e-headers-mode . buffer-substring)) - "Function to use to display buffer contents for major-mode. + "Function used to display buffer contents per major-mode. -Can be one of `buffer-substring' or `buffer-substring-no-properties'. +Use this to display lines with their text properties in helm-occur +buffer. Can be one of `buffer-substring' or `buffer-substring-no-properties'. +See `helm-occur-buffer-substring-default-mode' to setup this globally. Note that when using `buffer-substring' initialization will be slower." - :group 'helm-regexp :type '(alist :key-type (symbol :tag "Mode") - :value-type (radio (const :tag "With text properties" buffer-substring) - (const :tag "Without text properties" buffer-substring-no-properties)))) + :value-type (radio (const :tag "With text properties" + buffer-substring) + (const :tag "Without text properties" + buffer-substring-no-properties)))) + +(defcustom helm-occur-buffer-substring-default-mode + 'buffer-substring-no-properties + "Function used to display buffer contents in helm-occur buffer. + +Default mode for major modes not defined in +`helm-occur-buffer-substring-fn-for-modes'. +Can be one of `buffer-substring' or `buffer-substring-no-properties'. + +Note that when using `buffer-substring' initialization will be +slower. If buffer-substring, all buffers with the modes not +defined in helm-occur-buffer-substring-fn-for-modes will be +displayed with colors and properties in the helm-occur buffer" + :type '(radio + (const :tag "With text properties" buffer-substring) + (const :tag "Without text properties" buffer-substring-no-properties))) (defcustom helm-occur-keep-closest-position t "When non nil select closest candidate from point after update. This happen only in `helm-source-occur' which is always related to `current-buffer'." - :group 'helm-regexp :type 'boolean) (defcustom helm-occur-ignore-diacritics nil "When non nil helm-occur will ignore diacritics in patterns." - :group 'helm-regexp + :type 'boolean) + +(defcustom helm-occur-match-shorthands nil + "Transform pattern according to `read-symbol-shorthands' when non nil." :type 'boolean) (defface helm-moccur-buffer `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :foreground "DarkTurquoise" :underline t)) - "Face used to highlight occur buffer names." - :group 'helm-occur) + "Face used to highlight occur buffer names.") (defface helm-resume-need-update `((t ,@(and (>= emacs-major-version 27) '(:extend t)) :background "red")) - "Face used to flash occur buffer when it needs update." - :group 'helm-occur) + "Face used to flash occur buffer when it needs update.") (defun helm-occur--select-closest-candidate () @@ -164,7 +179,7 @@ This happen only in `helm-source-occur' which is always related to end (point-max)) (helm-awhile (helm-get-next-header-pos) (when (string= name (buffer-substring-no-properties - (point-at-bol) (point-at-eol))) + (pos-bol) (pos-eol))) (forward-line 1) (setq beg (point) end (or (helm-get-next-header-pos) (point-max))) @@ -220,11 +235,15 @@ engine beeing completely different and also much faster." ;; When user mark defun with `mark-defun' with intention of ;; using helm-occur on this region, it is relevant to use the ;; thing-at-point located at previous position which have been - ;; pushed to `mark-ring'. - (setq def (save-excursion - (goto-char (setq pos (car mark-ring))) - (helm-aif (thing-at-point 'symbol) (regexp-quote it)))) - (narrow-to-region (region-beginning) (region-end))) + ;; pushed to `mark-ring', if it's within the active region. + (let ((beg (region-beginning)) + (end (region-end)) + (prev-pos (car mark-ring))) + (when (and prev-pos (>= prev-pos beg) (< prev-pos end)) + (setq def (save-excursion + (goto-char (setq pos prev-pos)) + (helm-aif (thing-at-point 'symbol) (regexp-quote it))))) + (narrow-to-region beg end))) (unwind-protect (helm :sources 'helm-source-occur :buffer "*helm occur*" @@ -253,21 +272,44 @@ engine beeing completely different and also much faster." "Return CANDIDATES prefixed with line number." (cl-loop with buf = (helm-get-attr 'buffer-name source) for c in candidates - for cand = (when (string-match helm-occur--search-buffer-regexp c) - (let ((linum (match-string 1 c)) - (disp (match-string 2 c))) - (when (and disp (not (string= disp ""))) - (cons (concat - (propertize " " 'display - (concat - (propertize - linum 'face 'helm-grep-lineno - 'help-echo (buffer-file-name - (get-buffer buf))) - ":")) - disp) - (string-to-number linum))))) - when cand collect cand)) + for disp-linum = (when (string-match helm-occur--search-buffer-regexp c) + (let ((linum (match-string 1 c)) + (disp (match-string 2 c))) + (list + linum + (format "%s:%s" + (propertize + linum 'face 'helm-grep-lineno + 'help-echo (buffer-file-name + (get-buffer buf))) + disp)))) + for linum = (car disp-linum) + for disp = (cadr disp-linum) + when (and disp (not (string= disp ""))) + collect (cons disp (string-to-number linum)))) + +(defvar helm-occur--gshorthands nil) +(defun helm-occur-symbol-shorthands-pattern-transformer (pattern buffer gshorthands) + "Maybe transform PATTERN to its `read-symbol-shorthands' counterpart in BUFFER. + +GSHORTHANDS is the concatenation of all `read-symbol-shorthands' value found in +all buffers i.e. `buffer-list'. +When GSHORTHANDS is nil use PATTERN unmodified." + (if gshorthands + (let* ((lshorthands (buffer-local-value 'read-symbol-shorthands buffer)) + (prefix (cl-loop for (k . v) in gshorthands + if (string-match (concat "\\`" k) pattern) + return k + else + if (string-match (concat "\\`" v) pattern) + return v)) + (lgstr (cdr (or (assoc prefix gshorthands) + (rassoc prefix gshorthands))))) + (if (and lgstr lshorthands) + (concat (car (rassoc lgstr lshorthands)) + (replace-regexp-in-string prefix "" pattern)) + pattern)) + pattern)) (defclass helm-moccur-class (helm-source-in-buffer) ((buffer-name :initarg :buffer-name @@ -278,60 +320,73 @@ engine beeing completely different and also much faster." (defun helm-occur-build-sources (buffers &optional source-name) "Build sources for `helm-occur' for each buffer in BUFFERS list." - (cl-loop for buf in buffers - for bname = (buffer-name buf) - collect - (helm-make-source (or source-name bname) - 'helm-moccur-class - :header-name (lambda (name) - (format "HO [%s]" (if (string= name "Helm occur") - bname name))) - :buffer-name bname - :match-part - (lambda (candidate) - ;; The regexp should match what is in candidate buffer, - ;; not what is displayed in helm-buffer e.g. "12 foo" - ;; and not "12:foo". - (when (string-match helm-occur--search-buffer-regexp - candidate) - (match-string 2 candidate))) - :diacritics helm-occur-ignore-diacritics - :search (lambda (pattern) - (when (string-match "\\`\\^\\([^ ]*\\)" pattern) - (setq pattern (concat "^[0-9]* \\{1\\}" (match-string 1 pattern)))) - (condition-case _err - (re-search-forward pattern nil t) - (invalid-regexp nil))) - :init `(lambda () - (with-current-buffer ,buf - (let* ((bsfn (or (cdr (assq - major-mode - helm-occur-buffer-substring-fn-for-modes)) - #'buffer-substring-no-properties)) - (contents (funcall bsfn (point-min) (point-max)))) - (helm-set-attr 'get-line bsfn) - (with-current-buffer (helm-candidate-buffer 'global) - (insert contents) - (goto-char (point-min)) - (let ((linum 1)) - (insert (format "%s " linum)) - (while (re-search-forward "\n" nil t) - (cl-incf linum) - (insert (format "%s " linum)))))))) - :filtered-candidate-transformer 'helm-occur-transformer - :help-message 'helm-moccur-help-message - :nomark t - :migemo t - ;; Needed for resume. - :history 'helm-occur-history - :candidate-number-limit helm-occur-candidate-number-limit - :action 'helm-occur-actions - :requires-pattern 2 - :follow 1 - :group 'helm-occur - :keymap helm-occur-map - :resume 'helm-occur-resume-fn - :moccur-buffers buffers))) + (setq helm-occur--gshorthands nil) + (and helm-occur-match-shorthands + (setq helm-occur--gshorthands + (cl-loop for b in (buffer-list) + for rss = (buffer-local-value + 'read-symbol-shorthands + b) + when rss append rss))) + (let (sources) + (dolist (buf buffers) + (let ((bname (buffer-name buf))) + (push (helm-make-source (or source-name bname) + 'helm-moccur-class + :header-name (lambda (name) + (format "HO [%s]" (if (string= name "Helm occur") + bname name))) + :buffer-name bname + :match-part + (lambda (candidate) + ;; The regexp should match what is in candidate buffer, + ;; not what is displayed in helm-buffer e.g. "12 foo" + ;; and not "12:foo". + (when (string-match helm-occur--search-buffer-regexp + candidate) + (match-string 2 candidate))) + :diacritics helm-occur-ignore-diacritics + :search (lambda (pattern) + (when (string-match "\\`\\^\\([^ ]*\\)" pattern) + (setq pattern (concat "^[0-9]* \\{1\\}" (match-string 1 pattern)))) + (condition-case _err + (re-search-forward pattern nil t) + (invalid-regexp nil))) + :pattern-transformer (lambda (pattern) + (helm-occur-symbol-shorthands-pattern-transformer + pattern buf helm-occur--gshorthands)) + :init (lambda () + (with-current-buffer buf + (let* ((bsfn (or (cdr (assq + major-mode + helm-occur-buffer-substring-fn-for-modes)) + helm-occur-buffer-substring-default-mode)) + (contents (funcall bsfn (point-min) (point-max)))) + (helm-set-attr 'get-line bsfn) + (with-current-buffer (helm-candidate-buffer 'global) + (insert contents) + (goto-char (point-min)) + (let ((linum 1)) + (insert (format "%s " linum)) + (while (re-search-forward "\n" nil t) + (cl-incf linum) + (insert (format "%s " linum)))))))) + :filtered-candidate-transformer 'helm-occur-transformer + :help-message 'helm-moccur-help-message + :nomark t + :migemo t + ;; Needed for resume. + :history 'helm-occur-history + :candidate-number-limit helm-occur-candidate-number-limit + :action 'helm-occur-actions + :requires-pattern 2 + :follow 1 + :group 'helm-occur + :keymap helm-occur-map + :resume 'helm-occur-resume-fn + :moccur-buffers buffers) + sources))) + (nreverse sources))) (defun helm-multi-occur-1 (buffers &optional input) "Run `helm-occur' on a list of buffers. @@ -370,7 +425,8 @@ Each buffer's result is displayed in a separated source." (helm :sources sources :buffer "*helm moccur*" :history 'helm-occur-history - :default (helm-aif (thing-at-point 'symbol) (regexp-quote it)) + :default (helm-aif (thing-at-point 'symbol) + (regexp-quote it)) :input input :truncate-lines helm-occur-truncate-lines) (remove-hook 'helm-after-update-hook 'helm-occur--select-closest-candidate)))) @@ -393,12 +449,14 @@ METHOD can be one of buffer, buffer-other-window, buffer-other-frame." (with-current-buffer buf (helm-goto-line lineno) ;; Move point to the nearest matching regexp from bol. - (cl-loop for reg in split-pat + (cl-loop for str in split-pat + for reg = (helm-occur-symbol-shorthands-pattern-transformer + str (get-buffer buf) helm-occur--gshorthands) when (save-excursion (condition-case _err (if helm-migemo-mode - (helm-mm-migemo-forward reg (point-at-eol) t) - (re-search-forward reg (point-at-eol) t)) + (helm-mm-migemo-forward reg (pos-eol) t) + (re-search-forward reg (pos-eol) t)) (invalid-regexp nil))) collect (match-beginning 0) into pos-ls finally (when pos-ls (goto-char (apply #'min pos-ls))))))) @@ -420,32 +478,21 @@ Same as `helm-occur-goto-line' but go in new frame." (helm-occur-action candidate 'buffer-other-frame)) -(defun helm-occur-run-goto-line-ow () +(helm-make-command-from-action helm-occur-run-goto-line-ow "Run goto line other window action from `helm-occur'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-occur-goto-line-ow))) -(put 'helm-occur-run-goto-line-ow 'helm-only t) + 'helm-occur-goto-line-ow) -(defun helm-occur-run-goto-line-of () +(helm-make-command-from-action helm-occur-run-goto-line-of "Run goto line new frame action from `helm-occur'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-occur-goto-line-of))) -(put 'helm-occur-run-goto-line-of 'helm-only t) + 'helm-occur-goto-line-of) -(defun helm-occur-run-default-action () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-occur-goto-line))) -(put 'helm-occur-run-default-action 'helm-only t) +(helm-make-command-from-action helm-occur-run-default-action + "Goto matching line from helm-occur buffer." + 'helm-occur-goto-line) -(defun helm-occur-run-save-buffer () +(helm-make-command-from-action helm-occur-run-save-buffer "Run moccur save results action from `helm-moccur'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-occur-save-results))) -(put 'helm-moccur-run-save-buffer 'helm-only t) + 'helm-occur-save-results) (defun helm-occur-right () "`helm-occur' action for right arrow. @@ -486,11 +533,15 @@ persistent action." (defun helm-occur-mode-goto-line () (interactive) + (setq next-error-last-buffer (current-buffer)) + (setq-local helm-current-error (point-marker)) (helm-aif (get-text-property (point) 'helm-realvalue) (progn (helm-occur-goto-line it) (helm-match-line-cleanup-pulse)))) (defun helm-occur-mode-goto-line-ow () (interactive) + (setq next-error-last-buffer (current-buffer)) + (setq-local helm-current-error (point-marker)) (helm-aif (get-text-property (point) 'helm-realvalue) (progn (helm-occur-goto-line-ow it) (helm-match-line-cleanup-pulse)))) @@ -546,8 +597,8 @@ persistent action." (forward-line -2) (while (not (eobp)) (if (helm-pos-header-line-p) - (let ((beg (point-at-bol)) - (end (point-at-eol))) + (let ((beg (pos-bol)) + (end (pos-eol))) (set-text-properties beg (1+ end) nil) (delete-region (1- beg) end)) (helm-aif (setq buf-name (assoc-default @@ -558,10 +609,10 @@ persistent action." 'face 'helm-moccur-buffer 'helm-realvalue (get-text-property (point) 'helm-realvalue))) (add-text-properties - (point-at-bol) (point-at-eol) + (pos-bol) (pos-eol) `(buffer-name ,buf-name)) (add-text-properties - (point-at-bol) (point-at-eol) + (pos-bol) (pos-eol) `(keymap ,map help-echo ,(concat (buffer-file-name @@ -576,6 +627,7 @@ persistent action." (buffer-enable-undo) (helm-occur-mode)) (pop-to-buffer buf) + (setq next-error-last-buffer (get-buffer buf)) (message "Helm occur Results saved in `%s' buffer" buf))) (defun helm-occur-mode-mouse-goto-line (event) @@ -646,11 +698,11 @@ numbered. The property \\='buffer-name is added to the whole string." ;; `helm-mm-search' puts point at eol. (forward-line 0) (re-search-forward "^\\([0-9]*\\)\\s-\\{1\\}\\(.*\\)$" - (point-at-eol) t)) + (pos-eol) t)) (setq linum (string-to-number (match-string 1)) mpart (match-string 2))) ;; Match part after line number. - when (and mpart (string-match pattern mpart)) + when (and mpart (helm-mm-match mpart pattern)) for line = (format "%s:%d:%s" (get-text-property (point) 'buffer-name) linum @@ -664,7 +716,8 @@ numbered. The property \\='buffer-name is added to the whole string." "\n")))) (when (fboundp 'wgrep-cleanup-overlays) (wgrep-cleanup-overlays (point-min) (point-max))) - (message "Reverting buffer done")))))) + (message "Reverting buffer done") + (when executing-kbd-macro (sit-for 1))))))) (defun helm-occur-filter-one-by-one (candidate) "`filter-one-by-one' function for `helm-source-moccur'." @@ -698,7 +751,8 @@ Special commands: (set (make-local-variable 'helm-occur-mode--last-pattern) helm-input) (set (make-local-variable 'next-error-function) - #'helm-occur-next-error)) + #'helm-occur-next-error) + (set (make-local-variable 'helm-current-error) nil)) (put 'helm-moccur-mode 'helm-only t) (defun helm-occur-next-error (&optional argp reset) @@ -707,8 +761,10 @@ RESET non-nil means rewind to the first match. This is the `next-error-function' for `helm-occur-mode'." (interactive "p") (goto-char (cond (reset (point-min)) - ((< argp 0) (line-beginning-position)) - ((> argp 0) (line-end-position)) + ((and (< argp 0) helm-current-error) + (line-beginning-position)) + ((and (> argp 0) helm-current-error) + (line-end-position)) ((point)))) (let ((fun (if (> argp 0) #'next-single-property-change @@ -717,6 +773,8 @@ This is the `next-error-function' for `helm-occur-mode'." (progn (goto-char it) (forward-line 0) + ;; `helm-current-error' is set in + ;; `helm-occur-mode-goto-line'. (helm-occur-mode-goto-line)) (user-error "No more matches")))) @@ -767,7 +825,8 @@ This is the `next-error-function' for `helm-occur-mode'." (point)) (point-max)))) (overlay-put ov 'face 'helm-resume-need-update) - (sit-for 0.3) (delete-overlay ov) + (sit-for 0) + (delete-overlay ov) (message "[Helm occur Buffer outdated (C-c C-u to update)]"))))) (unless buffer-is-modified (with-helm-after-update-hook diff --git a/elpa/helm-20230806.1956/helm-pkg.el b/elpa/helm-20230806.1956/helm-pkg.el new file mode 100644 index 00000000..6ea83912 --- /dev/null +++ b/elpa/helm-20230806.1956/helm-pkg.el @@ -0,0 +1,14 @@ +(define-package "helm" "20230806.1956" "Helm is an Emacs incremental and narrowing framework" + '((helm-core "3.9.3") + (wfnames "1.1") + (popup "0.5.3")) + :commit "97edf0af7bad329bca11e0c617d4c81f2d126a11" :authors + '(("Thierry Volpiatto" . "thievol@posteo.net")) + :maintainers + '(("Thierry Volpiatto" . "thievol@posteo.net")) + :maintainer + '("Thierry Volpiatto" . "thievol@posteo.net") + :url "https://emacs-helm.github.io/helm/") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-20220616.1004/helm-regexp.el b/elpa/helm-20230806.1956/helm-regexp.el similarity index 98% rename from elpa/helm-20220616.1004/helm-regexp.el rename to elpa/helm-20230806.1956/helm-regexp.el index eea6e671..73f00214 100644 --- a/elpa/helm-20220616.1004/helm-regexp.el +++ b/elpa/helm-20230806.1956/helm-regexp.el @@ -1,6 +1,6 @@ ;;; helm-regexp.el --- In buffer regexp searching and replacement for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 diff --git a/elpa/helm-20220616.1004/helm-ring.el b/elpa/helm-20230806.1956/helm-ring.el similarity index 90% rename from elpa/helm-20220616.1004/helm-ring.el rename to elpa/helm-20230806.1956/helm-ring.el index 6459ba39..56d67f58 100644 --- a/elpa/helm-20220616.1004/helm-ring.el +++ b/elpa/helm-20230806.1956/helm-ring.el @@ -1,6 +1,6 @@ ;;; helm-ring.el --- kill-ring, mark-ring, and register browsers for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -121,12 +121,13 @@ will not have separators between candidates any more." (setq helm-kill-ring--truncated-flag (not helm-kill-ring--truncated-flag)) (let* ((cur-cand (helm-get-selection)) (presel-fn (lambda () - (helm-kill-ring--preselect-fn cur-cand)))) + (helm-kill-ring--preselect-fn cur-cand))) + helm-display-source-at-screen-top) (helm-set-attr 'multiline - (if helm-kill-ring--truncated-flag - 15000000 - helm-kill-ring-max-offset)) - (helm-update presel-fn)))) + (if helm-kill-ring--truncated-flag + 15000000 + helm-kill-ring-max-offset)) + (helm-update presel-fn)))) (put 'helm-kill-ring-toggle-truncated 'helm-only t) (defun helm-kill-ring-kill-selection () @@ -222,11 +223,9 @@ yanked string." (list (current-buffer)) (regexp-quote (substring-no-properties str))))) -(defun helm-kill-ring-run-search-from-string () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-kill-ring-search-from-string))) -(put 'helm-kill-ring-run-search-from-string 'helm-only t) +(helm-make-command-from-action helm-kill-ring-run-search-from-string + "Run helm-occur from kill ring." + 'helm-kill-ring-search-from-string) (defun helm-kill-ring-action-delete (_candidate) "Delete marked candidates from `kill-ring'." @@ -247,22 +246,13 @@ yanked string." helm-visible-mark-overlays nil)) (helm-force-update (helm-aif (helm-get-selection nil t) (regexp-quote it))))) -(defun helm-kill-ring-run-persistent-delete () +(helm-make-persistent-command-from-action helm-kill-ring-run-persistent-delete "Delete current candidate without quitting." - (interactive) - (with-helm-alive-p - (helm-set-attr 'quick-delete '(helm-kill-ring-persistent-delete . never-split)) - (helm-execute-persistent-action 'quick-delete))) -(put 'helm-kill-ring-run-persistent-delete 'helm-only t) + 'quick-delete 'helm-kill-ring-persistent-delete) -(defun helm-kill-ring-delete () - "Delete marked candidates from `kill-ring'. - -This is a command for `helm-kill-ring-map'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-kill-ring-action-delete))) -(put 'helm-kill-ring-delete 'helm-only t) +(helm-make-command-from-action helm-kill-ring-delete + "Delete marked candidates from `kill-ring'." + 'helm-kill-ring-action-delete) ;;;; @@ -301,7 +291,7 @@ This is a command for `helm-kill-ring-map'." (helm-aif (marker-buffer candidate) (progn (switch-to-buffer it) - (helm-log-run-hook 'helm-goto-line-before-hook) + (helm-log-run-hook "helm-mark-ring-default-action" 'helm-goto-line-before-hook) (helm-match-line-cleanup) (with-helm-current-buffer (unless helm-yank-point (setq helm-yank-point (point)))) @@ -523,6 +513,7 @@ First call open the kill-ring browser, next calls move to next line." (let ((enable-recursive-minibuffers t)) (helm :sources helm-source-kill-ring :buffer "*helm kill ring*" + ;; :display-source-at-screen-top nil :resume 'noresume :allow-nest t))) @@ -530,8 +521,7 @@ First call open the kill-ring browser, next calls move to next line." (defun helm-execute-kmacro () "Preconfigured helm for keyboard macros. Define your macros with `f3' and `f4'. -See (info \"(emacs) Keyboard Macros\") for detailed infos. -This command is useful when used with persistent action." +See (info \"(emacs) Keyboard Macros\") for detailed infos." (interactive) (let ((helm-quit-if-no-candidate (lambda () (message "No kbd macro has been defined")))) @@ -548,7 +538,8 @@ This command is useful when used with persistent action." (cl-loop for c in candidates collect (propertize (help-key-description (car c) nil) 'helm-realvalue c))) - :persistent-help "Execute kmacro" + :persistent-action 'ignore + :persistent-help "Do nothing" :help-message 'helm-kmacro-help-message :action (helm-make-actions @@ -559,15 +550,44 @@ This command is useful when used with persistent action." "Delete marked macros" 'helm-kbd-macro-delete-macro "Edit marked macro" - 'helm-kbd-macro-edit-macro) + 'helm-kbd-macro-edit-macro + "Insert kbd macro" + 'helm-kbd-macro-insert-macro) :group 'helm-ring) :buffer "*helm kmacro*"))) -(defun helm-kbd-macro-execute (candidate) - ;; Move candidate on top of list for next use. +(defun helm-kbd-macro-make-current (candidate) + "Make CANDIDATE macro the current one." (setq kmacro-ring (delete candidate kmacro-ring)) (kmacro-push-ring) - (kmacro-split-ring-element candidate) + (kmacro-split-ring-element candidate)) + +(defun helm-kbd-macro-insert-macro (candidate) + "Insert macro at point in `helm-current-buffer'." + (let ((desc (read-string "Describe macro briefly: ")) + name key) + (while (fboundp (setq name (intern (read-string "New name for macro: ")))) + (message "Symbol `%s' already exists, choose another name" name) + (sit-for 1.5)) + (helm-kbd-macro-make-current candidate) + (kmacro-name-last-macro name) + (when (y-or-n-p "Bind macro to a new key?") + (helm-awhile (key-binding + (setq key (read-key-sequence-vector "Bind macro to key: "))) + (message "`%s' already run command `%s', choose another one" + (help-key-description key nil) it) + (sit-for 1.5)) + (global-set-key key name)) + (with-helm-current-buffer + (insert (format ";; %s%s\n" + desc + (and key (format " (bound to `%s')" + (help-key-description key nil))))) + (insert-kbd-macro name (not (null key)))))) + +(defun helm-kbd-macro-execute (candidate) + ;; Move candidate on top of list for next use. + (helm-kbd-macro-make-current candidate) (kmacro-exec-ring-item candidate helm-current-prefix-arg)) diff --git a/elpa/helm-20220616.1004/helm-semantic.el b/elpa/helm-20230806.1956/helm-semantic.el similarity index 97% rename from elpa/helm-20220616.1004/helm-semantic.el rename to elpa/helm-20230806.1956/helm-semantic.el index 46870294..025019e9 100644 --- a/elpa/helm-20220616.1004/helm-semantic.el +++ b/elpa/helm-20230806.1956/helm-semantic.el @@ -1,7 +1,7 @@ ;;; helm-semantic.el --- Helm interface for Semantic -*- lexical-binding: t -*- ;; Copyright (C) 2012 ~ 2017 Daniel Hackney -;; 2012 ~ 2021 Thierry Volpiatto +;; 2012 ~ 2023 Thierry Volpiatto ;; Author: Daniel Hackney @@ -83,7 +83,7 @@ you have completion on these functions with `C-M i' in the customize interface." (stylefn (or (with-helm-current-buffer (assoc-default major-mode helm-semantic-display-style)) #'semantic-format-tag-summarize))) - (cl-dolist (tag tags) + (dolist (tag tags) (when (listp tag) (cl-case (setq cur-type (semantic-tag-class tag)) ((function variable type) @@ -119,11 +119,12 @@ you have completion on these functions with `C-M i' in the customize interface." (defun helm-semantic-default-action (_candidate &optional persistent) ;; By default, helm doesn't pass on the text properties of the selection. ;; Fix this. - (helm-log-run-hook 'helm-goto-line-before-hook) + (helm-log-run-hook "helm-semantic-default-action" + 'helm-goto-line-before-hook) (with-current-buffer helm-buffer (when (looking-at " ") (goto-char (next-single-property-change - (point-at-bol) 'semantic-tag nil (point-at-eol)))) + (pos-bol) 'semantic-tag nil (pos-eol)))) (let ((tag (get-text-property (point) 'semantic-tag))) (semantic-go-to-tag tag) (unless persistent diff --git a/elpa/helm-20220616.1004/helm-shell.el b/elpa/helm-20230806.1956/helm-shell.el similarity index 100% rename from elpa/helm-20220616.1004/helm-shell.el rename to elpa/helm-20230806.1956/helm-shell.el diff --git a/elpa/helm-20220616.1004/helm-sys.el b/elpa/helm-20230806.1956/helm-sys.el similarity index 93% rename from elpa/helm-20220616.1004/helm-sys.el rename to elpa/helm-20230806.1956/helm-sys.el index fcd36583..b7dc3570 100644 --- a/elpa/helm-20220616.1004/helm-sys.el +++ b/elpa/helm-20230806.1956/helm-sys.el @@ -1,6 +1,6 @@ ;;; helm-sys.el --- System related functions for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -41,20 +41,20 @@ "Top command used to display output of top. A format string where %s will be replaced with `frame-width'. -To use \\='top' command, a version supporting batch mode (-b option) -is needed. On Mac OSX \\='top' command doesn't support this, so the -'ps' command is used instead by default. +To use top command, a version supporting batch mode (-b option) +is needed. On Mac OSX top command doesn't support this, so the +ps command is used instead by default. -Normally \\='top' command output have 12 columns, but in some +Normally top command output have 12 columns, but in some versions you may have less than this, so you can either customize -top to use 12 columns with the interactives \\='f' and \\='W' commands +top to use 12 columns with the interactives f and W commands of top, or modify `helm-top-sort-columns-alist' to fit with the -number of columns your \\='top' command is using. +number of columns your top command is using. -If you modify \\='ps' command be sure that \\='pid' comes in first and +If you modify ps command be sure that pid comes in first and \"env COLUMNS=%s\" is specified at beginning of command. Ensure also that no elements contain spaces (e.g., use start_time and -not start). Same as for \\='top': you can customize +not start). Same as for top: you can customize `helm-top-sort-columns-alist' to make sort commands working properly according to your settings." :group 'helm-sys @@ -416,6 +416,19 @@ Show actions only on line starting by a PID." (let (tabulated-list-use-header-line) (list-processes--refresh))) :candidates (lambda () (mapcar #'process-name (process-list))) + :candidate-transformer + (lambda (candidates) + (cl-loop for c in candidates + for command = (mapconcat + 'identity + (process-command (get-process c)) " ") + if (and command (not (string= command ""))) collect + (cons (concat c " --> " + (mapconcat 'identity + (process-command (get-process c)) " ")) + c) + else collect c)) + :multiline t :persistent-action (lambda (elm) (delete-process (get-process elm)) (helm-delete-current-selection)) @@ -443,7 +456,9 @@ Show actions only on line starting by a PID." (defun helm-list-emacs-process () "Preconfigured `helm' for Emacs process." (interactive) - (helm-other-buffer 'helm-source-emacs-process "*helm process*")) + (helm :sources 'helm-source-emacs-process + :truncate-lines t + :buffer "*helm process*")) ;;;###autoload (defun helm-xrandr-set () diff --git a/elpa/helm-20220616.1004/helm-tags.el b/elpa/helm-20230806.1956/helm-tags.el similarity index 89% rename from elpa/helm-20220616.1004/helm-tags.el rename to elpa/helm-20230806.1956/helm-tags.el index f977aae5..efbd9ce3 100644 --- a/elpa/helm-20220616.1004/helm-tags.el +++ b/elpa/helm-20230806.1956/helm-tags.el @@ -1,6 +1,6 @@ ;;; helm-tags.el --- Helm for Etags. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -33,14 +33,12 @@ (defcustom helm-etags-tag-file-name "TAGS" "Etags tag file name." - :type 'string - :group 'helm-tags) + :type 'string) (defcustom helm-etags-tag-file-search-limit 10 "The limit level of directory to search tag file. Don't search tag file deeply if outside this value." - :type 'number - :group 'helm-tags) + :type 'number) (defcustom helm-etags-match-part-only 'tag "Allow choosing the tag part of CANDIDATE in `helm-source-etags-select'. @@ -50,14 +48,12 @@ You can choose matching against the tag part (i.e \"(defun foo\"), or against the whole candidate (i.e \"(filename:5:(defun foo\")." :type '(choice (const :tag "Match only tag" tag) - (const :tag "Match all file+tag" all)) - :group 'helm-tags) + (const :tag "Match all file+tag" all))) (defcustom helm-etags-execute-action-at-once-if-one t "Whether to jump straight to the selected tag if there's only one match." - :type 'boolean - :group 'helm-tags) + :type 'boolean) (defgroup helm-tags-faces nil @@ -77,23 +73,25 @@ one match." ;;; Etags ;; ;; -(defun helm-etags-run-switch-other-window () +(defun helm-etags-find-file (candidate) + "Find file CANDIDATE from helm etags buffer." + (helm-etags-action-goto 'find-file candidate)) + +(defun helm-etags-find-file-other-window (candidate) + "Find file other window from helm etags buffer." + (helm-etags-action-goto 'find-file-other-window candidate)) + +(defun helm-etags-find-file-other-frame (candidate) + "Find file other frame from helm etags buffer." + (helm-etags-action-goto 'find-file-other-frame candidate)) + +(helm-make-command-from-action helm-etags-run-switch-other-window "Run switch to other window action from `helm-source-etags-select'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action - (lambda (c) - (helm-etags-action-goto 'find-file-other-window c))))) -(put 'helm-etags-run-switch-other-window 'helm-only t) - -(defun helm-etags-run-switch-other-frame () + 'helm-etags-find-file-other-window) + +(helm-make-command-from-action helm-etags-run-switch-other-frame "Run switch to other frame action from `helm-source-etags-select'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action - (lambda (c) - (helm-etags-action-goto 'find-file-other-frame c))))) -(put 'helm-etags-run-switch-other-frame 'helm-only t) + 'helm-etags-find-file-other-frame) (defvar helm-etags-map (let ((map (make-sparse-keymap))) @@ -230,16 +228,9 @@ If there is no entry in cache, create one." :fuzzy-match helm-etags-fuzzy-match :help-message 'helm-etags-help-message :keymap helm-etags-map - :action '(("Go to tag" . (lambda (c) - (helm-etags-action-goto 'find-file c))) - ("Go to tag in other window" . (lambda (c) - (helm-etags-action-goto - 'find-file-other-window - c))) - ("Go to tag in other frame" . (lambda (c) - (helm-etags-action-goto - 'find-file-other-frame - c)))) + :action '(("Go to tag" . helm-etags-find-file) + ("Go to tag in other window" . helm-etags-find-file-other-window) + ("Go to tag in other frame" . helm-etags-find-file-other-frame)) :group 'helm-tags :persistent-help "Go to line" :persistent-action (lambda (candidate) @@ -266,7 +257,7 @@ If there is no entry in cache, create one." "Helm default action to jump to an etags entry in other window." (require 'etags) (deactivate-mark t) - (helm-log-run-hook 'helm-goto-line-before-hook) + (helm-log-run-hook "helm-etags-action-goto " 'helm-goto-line-before-hook) (let* ((split (helm-grep-split-line candidate)) (fname (cl-loop for tagf being the hash-keys of helm-etags-cache for f = (expand-file-name diff --git a/elpa/helm-20220616.1004/helm-types.el b/elpa/helm-20230806.1956/helm-types.el similarity index 98% rename from elpa/helm-20220616.1004/helm-types.el rename to elpa/helm-20230806.1956/helm-types.el index 887711e9..6f129b22 100644 --- a/elpa/helm-20220616.1004/helm-types.el +++ b/elpa/helm-20230806.1956/helm-types.el @@ -135,6 +135,7 @@ "Jump to bookmark" 'helm-bookmark-jump "Jump to BM other window" 'helm-bookmark-jump-other-window "Jump to BM other frame" 'helm-bookmark-jump-other-frame + "Jump to BM other tab" 'helm-bookmark-jump-other-tab "Bookmark edit annotation" 'bookmark-edit-annotation "Bookmark show annotation" 'bookmark-show-annotation "Delete bookmark(s)" 'helm-delete-marked-bookmarks @@ -181,6 +182,8 @@ 'helm-switch-to-buffer-at-linum "Browse project `C-x C-d'" 'helm-buffers-browse-project + "Switch to shell" + 'helm-buffer-switch-to-shell "Query replace regexp `C-M-%'" 'helm-buffer-query-replace-regexp "Query replace `M-%'" 'helm-buffer-query-replace @@ -229,7 +232,7 @@ (defcustom helm-type-function-actions (helm-make-actions "Describe function" 'helm-describe-function - "Find function" 'helm-find-function + "Find function (C-u for source)" 'helm-find-function "Info lookup" 'helm-info-lookup-symbol "Debug on entry" 'debug-on-entry "Cancel debug on entry" 'cancel-debug-on-entry diff --git a/elpa/helm-20220616.1004/helm-utils.el b/elpa/helm-20230806.1956/helm-utils.el similarity index 87% rename from elpa/helm-20220616.1004/helm-utils.el rename to elpa/helm-20230806.1956/helm-utils.el index 048bc5dc..7e139b81 100644 --- a/elpa/helm-20220616.1004/helm-utils.el +++ b/elpa/helm-20230806.1956/helm-utils.el @@ -1,6 +1,6 @@ ;;; helm-utils.el --- Utilities Functions for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 @@ -28,6 +28,7 @@ (declare-function outline-show-subtree "outline") (declare-function org-reveal "org") (declare-function hs-show-block "hideshow.el") +(declare-function hs-show-all "hideshow.el") (declare-function tab-bar-tabs "tab-bar") (declare-function tab-bar-select-tab "tab-bar") (declare-function dired-goto-file "dired") @@ -87,6 +88,12 @@ Possible value are: (integer :tag "Match after or before (+/-)") (const :tag "Never match" never))) +(defcustom helm-highlight-only-all-matches nil + "Highlight only when all items match on the line when non nil. +See `helm-highlight-current-line'." + :group 'helm-utils + :type 'boolean) + (defcustom helm-buffers-to-resize-on-pa nil "A list of helm buffers where the helm-window should be reduced on PA. Where PA means persistent action." @@ -276,11 +283,13 @@ behavior is the same as with a nil value." (const :tag "Split window horizontally" nil) (symbol :tag "Guess how to split window" 'decide))) -(defcustom helm-window-show-buffers-function #'helm-window-default-split-fn +(defcustom helm-window-show-buffers-function #'helm-window-decide-split-fn "The default function to use when opening several buffers at once. It is typically used to rearrange windows." :group 'helm-utils :type '(choice + (function :tag "Decide how to split according to number of candidates" + helm-window-decide-split-fn) (function :tag "Split windows vertically or horizontally" helm-window-default-split-fn) (function :tag "Split in alternate windows" @@ -312,7 +321,8 @@ If a prefix arg is given split windows vertically." (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) + helm-buffers-maybe-switch-to-tab + tab-bar-mode) (let* ((tab-bar-tab-name-function #'tab-bar-tab-name-all) (tabs (tab-bar-tabs)) (tab-names (mapcar (lambda (tab) @@ -340,6 +350,15 @@ If a prefix arg is given split windows vertically." ;; e.g. '("tab-bar.el" "*scratch*, helm-buffers.el"). thereis (member buffer-name (split-string name ", " t)))) +(defun helm-window-decide-split-fn (candidates &optional other-window-fn) + "Try to find the best split window fn according to the number of CANDIDATES." + (let ((fn (cond ((> (length candidates) 3) + #'helm-window-mosaic-fn) + ((> (length candidates) 2) + #'helm-window-alternate-split-fn) + (t #'helm-window-default-split-fn)))) + (funcall fn candidates other-window-fn))) + (defun helm-window-default-split-fn (candidates &optional other-window-fn) "Split windows in one direction and balance them. @@ -489,7 +508,7 @@ Default is `helm-current-buffer'." #'outline-show-subtree) ((and (boundp 'hs-minor-mode) hs-minor-mode) - #'hs-show-block) + #'hs-show-all) ((and (boundp 'markdown-mode-map) (derived-mode-p 'markdown-mode)) #'markdown-show-entry))) @@ -503,13 +522,14 @@ Default is `helm-current-buffer'." (defun helm-goto-line (lineno &optional noanim) "Goto LINENO opening only outline headline if needed. Animation is used unless NOANIM is non--nil." - (helm-log-run-hook 'helm-goto-line-before-hook) + (helm-log-run-hook "helm-goto-line" + 'helm-goto-line-before-hook) (helm-match-line-cleanup) (unless helm-alive-p (with-helm-current-buffer (unless helm-yank-point (setq helm-yank-point (point))))) (goto-char (point-min)) - (helm-goto-char (point-at-bol lineno)) + (helm-goto-char (pos-bol lineno)) (unless noanim (helm-highlight-current-line))) @@ -528,32 +548,6 @@ To use this add it to `helm-goto-line-before-hook'." (set-marker (mark-marker) (point)) (push-mark (point) 'nomsg)))) -(defun helm-show-all-candidates-in-source (arg) - "Toggle all or only candidate-number-limit cands in current source. -With a numeric prefix arg show only the ARG number of candidates. -The prefix arg has no effect when toggling to only -candidate-number-limit." - (interactive "p") - (with-helm-alive-p - (with-helm-buffer - (if helm-source-filter - (progn - (setq-local helm-candidate-number-limit - (default-value 'helm-candidate-number-limit)) - (helm-set-source-filter nil)) - (with-helm-default-directory (helm-default-directory) - (setq-local helm-candidate-number-limit (and (> arg 1) arg)) - (helm-set-source-filter - (list (helm-get-current-source)))))))) -(put 'helm-show-all-candidates-in-source 'helm-only t) - -(defun helm-display-all-sources () - "Display all sources previously hidden by `helm-set-source-filter'." - (interactive) - (with-helm-alive-p - (helm-set-source-filter nil))) -(put 'helm-display-all-sources 'helm-only t) - (defun helm-displaying-source-names () "Return the list of sources name for this helm session." (with-current-buffer helm-buffer @@ -561,7 +555,7 @@ candidate-number-limit." (cl-loop with pos while (setq pos (next-single-property-change (point) 'helm-header)) do (goto-char pos) - collect (buffer-substring-no-properties (point-at-bol)(point-at-eol)) + collect (buffer-substring-no-properties (pos-bol)(pos-eol)) do (forward-line 1)))) (defun helm-handle-winner-boring-buffers () @@ -692,7 +686,9 @@ readable format,see `helm-file-human-size'." directory :path 'full :directories t) - (directory-files directory t)) + (directory-files + directory t + directory-files-no-dot-files-regexp)) for file in files sum (nth 7 (file-attributes file)) into total finally return (if human @@ -702,7 +698,7 @@ readable format,see `helm-file-human-size'." (cl-defun helm-file-attributes (file &key type links uid gid access-time modif-time status size mode gid-change inode device-num dired human-size - mode-type mode-owner mode-group mode-other (string t)) + mode-type mode-owner mode-group mode-other octal (string t)) "Return `file-attributes' elements of FILE separately according to key value. Availables keys are: - TYPE: Same as nth 0 `files-attributes' if STRING is nil @@ -722,7 +718,8 @@ Availables keys are: - DIRED: A line similar to what \\='ls -l' return. - HUMAN-SIZE: The size in human form, see `helm-file-human-size'. - MODE-TYPE, mode-owner,mode-group, mode-other: Split what - nth 7 `files-attributes' return in four categories. + nth 8 `files-attributes' return in four categories. +- OCTAL: The octal value of MODE-OWNER+MODE-GROUP+MODE-OTHER. - STRING: When non--nil (default) `helm-file-attributes' return more friendly values. If you want the same behavior as `files-attributes' , @@ -759,7 +756,8 @@ you have in `file-attributes'." :gid-change gid-change :inode inode :device-num device-num))) - (modes (helm-split-mode-file-attributes (cl-getf all :mode)))) + (perms (cl-getf all :mode)) + (modes (helm-split-mode-file-attributes perms))) (cond (type (cl-getf all :type)) (links (cl-getf all :links)) (uid (cl-getf all :uid)) @@ -768,44 +766,57 @@ you have in `file-attributes'." (modif-time (cl-getf all :modif-time)) (status (cl-getf all :status)) (size (cl-getf all :size)) - (mode (cl-getf all :mode)) + (mode perms) (gid-change (cl-getf all :gid-change)) (inode (cl-getf all :inode)) (device-num (cl-getf all :device-num)) - (dired (concat - (helm-split-mode-file-attributes - (cl-getf all :mode) t) " " - (number-to-string (cl-getf all :links)) " " - (cl-getf all :uid) ":" - (cl-getf all :gid) " " - (if human-size - (helm-file-human-size (cl-getf all :size)) - (int-to-string (cl-getf all :size))) " " - (cl-getf all :modif-time))) + (dired (helm-file-attributes-dired-line all human-size)) (human-size (helm-file-human-size (cl-getf all :size))) (mode-type (cl-getf modes :mode-type)) (mode-owner (cl-getf modes :user)) (mode-group (cl-getf modes :group)) (mode-other (cl-getf modes :other)) + (octal (cl-getf modes :octal)) (t (append all modes)))))) -(defun helm-split-mode-file-attributes (str &optional string) - "Split mode file attributes STR into a proplist. -If STRING is non--nil return instead a space separated string." - (cl-loop with type = (substring str 0 1) - with cdr = (substring str 1) - for i across cdr - for count from 1 - if (<= count 3) - concat (string i) into user - if (and (> count 3) (<= count 6)) - concat (string i) into group - if (and (> count 6) (<= count 9)) - concat (string i) into other - finally return +(defun helm-file-attributes-dired-line (all &optional human-size) + (format "%s %s %s:%s %s %s" + (helm-split-mode-file-attributes + (cl-getf all :mode) t) + (number-to-string (cl-getf all :links)) + (cl-getf all :uid) + (cl-getf all :gid) + (if human-size + (helm-file-human-size (cl-getf all :size)) + (int-to-string (cl-getf all :size))) + (cl-getf all :modif-time))) + +(defun helm-split-mode-file-attributes (modes &optional string) + "Split MODES in a list of modes. +MODES is same as what (nth 8 (file-attributes \"foo\")) would return." + (if (string-match "\\`\\(.\\)\\(...\\)\\(...\\)\\(...\\)\\'" modes) + (let* ((type (match-string 1 modes)) + (user (match-string 2 modes)) + (group (match-string 3 modes)) + (other (match-string 4 modes)) + (octal (helm-ff-numeric-permissions (list user group other)))) (if string - (mapconcat 'identity (list type user group other) " ") - (list :mode-type type :user user :group group :other other)))) + (mapconcat 'identity (list type user group other octal) " ") + (list :mode-type type :user user + :group group :other other + :octal octal))) + (error "Wrong modes specification for %s" modes))) + +(defun helm-ff-numeric-permissions (perms) + "Return the numeric representation of PERMS. +PERMS is the list of permissions for owner, group and others." + ;; `file-modes-symbolic-to-number' interpret its MODES argument as what would + ;; result when calling such mode on a file with chmod, BTW we have to remove + ;; all "-" like read-file-modes does. + (helm-aand (listp perms) + (apply 'format "u=%s,g=%s,o=%s" perms) + (replace-regexp-in-string "-" "" it) + (format "%o" (file-modes-symbolic-to-number it)))) (defun helm-format-columns-of-files (files) "Same as `dired-format-columns-of-files'. @@ -846,7 +857,14 @@ Inlined here for compatibility." (defvar helm--match-item-overlays nil) (cl-defun helm-highlight-current-line (&optional start end buf face) - "Highlight and underline current position" + "Highlight current line and all matching items around it. + +The number of lines around matched line where the matching items are +highlighted are defined by `helm-highlight-matches-around-point-max-lines'. +When the variable `helm-highlight-only-all-matches' is non nil only +the lines containing all matches (in case of multi match) are highlighted. + +Optional arguments START, END and FACE are only here for debugging purpose." (let* ((start (or start (line-beginning-position))) (end (or end (1+ (line-end-position)))) start-match end-match @@ -873,12 +891,12 @@ Inlined here for compatibility." (save-excursion (forward-line (- (car helm-highlight-matches-around-point-max-lines))) - (point-at-bol)) + (pos-bol)) end-match (save-excursion (forward-line (cdr helm-highlight-matches-around-point-max-lines)) - (point-at-bol)))) + (pos-bol)))) ((or (null helm-highlight-matches-around-point-max-lines) (zerop helm-highlight-matches-around-point-max-lines)) (setq start-match start @@ -888,7 +906,7 @@ Inlined here for compatibility." (save-excursion (forward-line helm-highlight-matches-around-point-max-lines) - (point-at-bol)) + (pos-bol)) end-match start)) ((> helm-highlight-matches-around-point-max-lines 0) (setq start-match start @@ -896,32 +914,50 @@ Inlined here for compatibility." (save-excursion (forward-line helm-highlight-matches-around-point-max-lines) - (point-at-bol))))) + (pos-bol))))) (catch 'empty-line - (cl-loop with ov - for r in (helm-remove-if-match - "\\`!" (helm-mm-split-pattern - (if (with-helm-buffer - ;; Needed for highlighting AG matches. - (assq 'pcre (helm-get-current-source))) - (helm--translate-pcre-to-elisp helm-input) - helm-input))) - do (save-excursion - (goto-char start-match) + (let* ((regex-list (helm-remove-if-match + "\\`!" (helm-mm-split-pattern + (if (with-helm-buffer + ;; Needed for highlighting AG matches. + (assq 'pcre (helm-get-current-source))) + (helm--translate-pcre-to-elisp helm-input) + helm-input)))) + (num-regex (length regex-list))) + (save-excursion + (goto-char start-match) + (while (< (point) end-match) + (let* ((start-line (line-beginning-position)) + (end-line (line-end-position)) + all-matches) + (dolist (r regex-list) + (let ((match-list '())) + (save-excursion + (goto-char start-line) (while (condition-case _err - (and (not (= start-match end-match)) + (and (not (= start-line end-line)) (if helm-migemo-mode - (helm-mm-migemo-forward r end-match t) - (re-search-forward r end-match t))) + (helm-mm-migemo-forward r end-line t) + (re-search-forward r end-line t))) (invalid-regexp nil)) (let ((s (match-beginning 0)) (e (match-end 0))) (if (= s e) (throw 'empty-line nil) - (push (setq ov (make-overlay s e)) - helm--match-item-overlays) - (overlay-put ov 'face 'helm-match-item) - (overlay-put ov 'priority 1)))))))) + (push (cons s e) match-list))))) + (when match-list + (push match-list all-matches)))) + (when (and all-matches + (or (not helm-highlight-only-all-matches) + (eql (length all-matches) num-regex))) + (cl-loop for ml in all-matches + do (cl-loop for (s . e) in ml + for ov = (make-overlay s e) + do (progn + (push ov helm--match-item-overlays) + (overlay-put ov 'face 'helm-match-item) + (overlay-put ov 'priority 1)))))) + (forward-line 1)))))) (recenter))) (defun helm--translate-pcre-to-elisp (regexp) @@ -1000,7 +1036,7 @@ Assume regexp is a pcre based regexp." (lambda () (save-selected-window (with-helm-window - (helm-aif (get-text-property (point-at-bol) 'help-echo) + (helm-aif (get-text-property (pos-bol) 'help-echo) (popup-tip (concat " " (abbreviate-file-name (replace-regexp-in-string "\n.*" "" it))) :around nil @@ -1064,7 +1100,8 @@ If FILE is a directory, open this directory." Run `helm-find-many-files-after-hook' at end." (let ((helm--reading-passwd-or-string t)) (mapc 'find-file (helm-marked-candidates)) - (helm-log-run-hook 'helm-find-many-files-after-hook))) + (helm-log-run-hook "helm-find-many-files" + 'helm-find-many-files-after-hook))) (defun helm-read-repeat-string (prompt &optional count) "Prompt as many time PROMPT is not empty. diff --git a/elpa/helm-20220616.1004/helm-x-files.el b/elpa/helm-20230806.1956/helm-x-files.el similarity index 99% rename from elpa/helm-20220616.1004/helm-x-files.el rename to elpa/helm-20230806.1956/helm-x-files.el index 17c35e7b..3cc2fae7 100644 --- a/elpa/helm-20220616.1004/helm-x-files.el +++ b/elpa/helm-20230806.1956/helm-x-files.el @@ -1,6 +1,6 @@ ;;; helm-x-files.el --- helm auxiliary functions and sources. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2021 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2023 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 diff --git a/elpa/helm-20220616.1004/helm.el b/elpa/helm-20230806.1956/helm.el similarity index 64% rename from elpa/helm-20220616.1004/helm.el rename to elpa/helm-20230806.1956/helm.el index 191aa538..f9554e8d 100644 --- a/elpa/helm-20220616.1004/helm.el +++ b/elpa/helm-20230806.1956/helm.el @@ -2,18 +2,18 @@ ;; Copyright (C) 2007 Tamas Patrovics ;; 2008 ~ 2011 rubikitch -;; 2011 ~ 2021 Thierry Volpiatto +;; 2011 ~ 2023 Thierry Volpiatto ;; This is a fork of anything.el wrote by Tamas Patrovics. ;; Authors of anything.el: Tamas Patrovics ;; rubikitch -;; Thierry Volpiatto +;; Thierry Volpiatto -;; Author: Thierry Volpiatto -;; Version: 3.8.5 +;; Author: Thierry Volpiatto +;; Version: 3.9.3 ;; URL: https://emacs-helm.github.io/helm/ -;; Package-Requires: ((helm-core "3.8.4") (popup "0.5.3")) +;; Package-Requires: ((helm-core "3.9.3") (wfnames "1.1") (popup "0.5.3")) ;; 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 @@ -38,6 +38,15 @@ (require 'helm-core) (require 'helm-global-bindings) +;; Build info sources and commands once called (bug #2608). We need to autoload +;; only these commands which are bound in helm-global-bindings, if we add more +;; helm-info* commands to helm-global-bindings we will have to autoload them +;; here. Requiring helm-info here instead will make recursive require to helm so +;; don't do that. +(autoload 'helm-info-emacs "helm-info" nil t) +(autoload 'helm-info-gnus "helm-info" nil t) +(autoload 'helm-info-at-point "helm-info" nil t) + (provide 'helm) ;;; helm.el ends here diff --git a/elpa/helm-bibtex-20191028.1313/bibtex-completion.el b/elpa/helm-bibtex-20191028.1313/bibtex-completion.el deleted file mode 100644 index c81cf76b..00000000 --- a/elpa/helm-bibtex-20191028.1313/bibtex-completion.el +++ /dev/null @@ -1,1507 +0,0 @@ -;;; bibtex-completion.el --- A BibTeX backend for completion frameworks - -;; Author: Titus von der Malsburg -;; Justin Burkett -;; Maintainer: Titus von der Malsburg -;; Version: 1.0.0 -;; Package-Requires: ((parsebib "1.0") (s "1.9.0") (dash "2.6.0") (f "0.16.2") (cl-lib "0.5")) - -;; 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 . - -;;; Commentary: - -;; A BibTeX backend for completion frameworks - -;; There are currently two fronends: helm-bibtex and ivy-bibtex. -;; -;; See the github page for details: -;; -;; https://github.com/tmalsburg/helm-bibtex - -;;; Code: - -(require 'browse-url) -(require 'parsebib) -(require 'cl-lib) -(require 'dash) -(require 's) -(require 'f) -(require 'biblio) -(require 'filenotify) - -;; Silence byte-compiler -(declare-function reftex-what-macro "reftex-parse") -(declare-function reftex-get-bibfile-list "reftex-cite") -(declare-function outline-show-all "outline") -(declare-function org-narrow-to-subtree "org") -(declare-function org-cycle-hide-drawers "org") -(declare-function org-find-property "org") -(declare-function org-show-entry "org") -(declare-function org-entry-get "org") -(declare-function org-element-parse-buffer "org-element") -(declare-function org-element-map "org-element") -(declare-function org-element-property "org-element") - -(defgroup bibtex-completion nil - "Helm plugin for searching entries in a BibTeX bibliography." - :group 'completion) - -(defcustom bibtex-completion-bibliography nil - "The BibTeX file or list of BibTeX files. Org-bibtex users can -also specify org-mode bibliography files, in which case it will -be assumed that a BibTeX file exists with the same name and -extension bib instead of org. If the bib file has a different -name, use a cons cell (\"orgfile.org\" . \"bibfile.bib\") instead." - :group 'bibtex-completion - :type '(choice file (repeat file))) - -(defcustom bibtex-completion-library-path nil - "A directory or list of directories in which PDFs are stored. -Bibtex-completion assumes that the names of these PDFs are -composed of the BibTeX-key plus a \".pdf\" suffix." - :group 'bibtex-completion - :type '(choice directory (repeat directory))) - -(defcustom bibtex-completion-pdf-open-function 'find-file - "The function used for opening PDF files. This can be an -arbitrary function that takes one argument: the path to the PDF -file. The default is `find-file' which opens the PDF in -Emacs (either with docview or, if installed, the much superior -pdf-tools. When set to `helm-open-file-with-default-tool', the -systems default viewer for PDFs is used." - :group 'bibtex-completion - :type 'function) - -(defcustom bibtex-completion-pdf-extension ".pdf" - "The extension of a BibTeX entry's \"PDF\" file. This makes it - possible to use another file type. It can also be a list of - file types, which are then tried sequentially until a file is - found. Beware that adding file types can reduce performance for - large bibliographies. This variable has no effect if PDFs are - referenced via the file field." - :group 'bibtex-completion - :type 'string) - -(defcustom bibtex-completion-find-additional-pdfs nil - "If non-nil, all files whose base name starts with the BibTeX - key and ends with `bibtex-completion-pdf-extension' are - considered as PDFs, not only \".\". Note that - for performance reasons, an entry is only marked as having a - PDF if \". (length (car it)) 0) entry-alist) - (cl-acons "" "" - (gethash (downcase crossref) entry-hash))))) - entry))))) - -(defun bibtex-completion-make-entry-hash (files reparsed-files) - "Return a hash table of all potentially cross-referenced bibliography entries in FILES, -assuming that only those files in REPARSED-FILES were reparsed -whereas the other files in FILES were up-to-date. Only entries -whose type belongs to -`bibtex-completion-cross-referenced-entry-types' are included in -the hash table." - (cl-loop - with entries = - (cl-loop - for file in files - for entries = (cddr (assoc file bibtex-completion-cache)) - if (member file reparsed-files) - ;; Entries are alists of \(FIELD . VALUE\) pairs. - append entries - ;; Entries are \(STRING . ALIST\) conses. - else - append (mapcar 'cdr entries)) - with ht = (make-hash-table :test #'equal :size (length entries)) - for entry in entries - for key = (bibtex-completion-get-value "=key=" entry) - if (member (downcase (bibtex-completion-get-value "=type=" entry)) - bibtex-completion-cross-referenced-entry-types) - do (puthash (downcase key) entry ht) - finally return ht)) - -(defun bibtex-completion-make-candidate (entry) - "Return a candidate for ENTRY." - (cons (bibtex-completion-clean-string - (s-join " " (-map #'cdr entry))) - entry)) - -(defun bibtex-completion-parse-bibliography (&optional ht-strings) - "Parse the BibTeX entries listed in the current buffer and -return a list of entries in the order in which they appeared in -the BibTeX file. Also do some preprocessing of the entries. - -If HT-STRINGS is provided it is assumed to be a hash table." - (goto-char (point-min)) - (cl-loop - with fields = (append '("title" "crossref") - (-map (lambda (it) (if (symbolp it) (symbol-name it) it)) - bibtex-completion-additional-search-fields)) - for entry-type = (parsebib-find-next-item) - while entry-type - unless (member-ignore-case entry-type '("preamble" "string" "comment")) - collect (let* ((entry (parsebib-read-entry entry-type (point) ht-strings)) - (fields (append - (list (if (assoc-string "author" entry 'case-fold) - "author" - "editor") - (if (assoc-string "date" entry 'case-fold) - "date" - "year")) - fields))) - (-map (lambda (it) - (cons (downcase (car it)) (cdr it))) - (bibtex-completion-prepare-entry entry fields))))) - -(defun bibtex-completion-get-entry (entry-key) - "Given a BibTeX key this function scans all bibliographies -listed in `bibtex-completion-bibliography' and returns an alist of the -record with that key. Fields from crossreferenced entries are -appended to the requested entry." - (let* ((entry (bibtex-completion-get-entry1 entry-key)) - (crossref (bibtex-completion-get-value "crossref" entry)) - (crossref (when crossref (bibtex-completion-get-entry1 crossref)))) - (bibtex-completion-remove-duplicated-fields (append entry crossref)))) - -(defun bibtex-completion-get-entry1 (entry-key &optional do-not-find-pdf) - (let ((bib (bibtex-completion-normalize-bibliography 'bibtex))) - (with-temp-buffer - (mapc #'insert-file-contents bib) - (goto-char (point-min)) - (if (re-search-forward (concat "^[ \t]*@\\(" parsebib--bibtex-identifier - "\\)[[:space:]]*[\(\{][[:space:]]*" - (regexp-quote entry-key) "[[:space:]]*,") - nil t) - (let ((entry-type (match-string 1))) - (reverse (bibtex-completion-prepare-entry - (parsebib-read-entry entry-type (point) bibtex-completion-string-hash-table) nil do-not-find-pdf))) - (progn - (display-warning :warning (concat "Bibtex-completion couldn't find entry with key \"" entry-key "\".")) - nil))))) - -(defun bibtex-completion-find-pdf-in-field (key-or-entry) - "Returns the path of the PDF specified in the field -`bibtex-completion-pdf-field' if that file exists. Returns nil if no -file is specified, or if the specified file does not exist, or if -`bibtex-completion-pdf-field' is nil." - (when bibtex-completion-pdf-field - (let* ((entry (if (stringp key-or-entry) - (bibtex-completion-get-entry1 key-or-entry t) - key-or-entry)) - (value (bibtex-completion-get-value bibtex-completion-pdf-field entry))) - (cond - ((not value) nil) ; Field not defined. - ((f-file? value) (list value)) ; A bare full path was found. - ((-any 'f-file? (--map (f-join it (f-filename value)) (-flatten bibtex-completion-library-path))) (-filter 'f-file? (--map (f-join it (f-filename value)) (-flatten bibtex-completion-library-path)))) - (t ; Zotero/Mendeley/JabRef format: - (let ((value (replace-regexp-in-string "\\([^\\]\\);" "\\1\^^" value))) - (cl-loop ; Looping over the files: - for record in (s-split "\^^" value) - ; Replace unescaped colons by field separator: - for record = (replace-regexp-in-string "\\([^\\]\\|^\\):" "\\1\^_" record) - ; Unescape stuff: - for record = (replace-regexp-in-string "\\\\\\(.\\)" "\\1" record) - ; Now we can safely split: - for record = (s-split "\^_" record) - for file-name = (nth 0 record) - for path = (or (nth 1 record) "") - for paths = (if (s-match "^[A-Z]:" path) - (list path) ; Absolute Windows path - ; Something else: - (append - (list - path - file-name - (f-join (f-root) path) ; Mendeley #105 - (f-join (f-root) path file-name)) ; Mendeley #105 - (--map (f-join it path) - (-flatten bibtex-completion-library-path)) ; Jabref #100 - (--map (f-join it path file-name) - (-flatten bibtex-completion-library-path)))) ; Jabref #100 - for result = (-first (lambda (path) - (if (and (not (s-blank-str? path)) - (f-exists? path)) - path nil)) paths) - if result collect result))))))) - - -(defun bibtex-completion-find-pdf-in-library (key-or-entry &optional find-additional) - "Searches the directories in `bibtex-completion-library-path' -for a PDF whose name is composed of the BibTeX key plus -`bibtex-completion-pdf-extension'. The path of the first matching -PDF is returned. - -If FIND-ADDITIONAL is non-nil, the paths of all PDFs whose name -starts with the BibTeX key and ends with -`bibtex-completion-pdf-extension' are returned instead." - (let* ((key (if (stringp key-or-entry) - key-or-entry - (bibtex-completion-get-value "=key=" key-or-entry))) - (main-pdf (cl-loop - for dir in (-flatten bibtex-completion-library-path) - append (cl-loop - for ext in (-flatten bibtex-completion-pdf-extension) - collect (f-join dir (s-concat key ext)))))) - (if find-additional - (sort ; move main pdf on top of the list if needed - (cl-loop - for dir in (-flatten bibtex-completion-library-path) - append (directory-files dir t - (s-concat "^" (regexp-quote key) - ".*\\(" - (mapconcat 'regexp-quote - (-flatten bibtex-completion-pdf-extension) - "\\|") - "\\)$"))) - (lambda (x y) - (and (member x main-pdf) - (not (member y main-pdf))))) - (-flatten (-first 'f-file? main-pdf))))) - -(defun bibtex-completion-find-pdf (key-or-entry &optional find-additional) - "Returns the path of the PDF associated with the specified -entry. This is either the path(s) specified in the field -`bibtex-completion-pdf-field' or, if that does not exist, the -first PDF in any of the directories in -`bibtex-completion-library-path' whose name is composed of the -the BibTeX key plus `bibtex-completion-pdf-extension' (or if -FIND-ADDITIONAL is non-nil, all PDFs in -`bibtex-completion-library-path' whose name starts with the -BibTeX key and ends with `bibtex-completion-pdf-extension'). -Returns nil if no PDF is found." - (or (bibtex-completion-find-pdf-in-field key-or-entry) - (bibtex-completion-find-pdf-in-library key-or-entry find-additional))) - -(defun bibtex-completion-prepare-entry (entry &optional fields do-not-find-pdf) - "Prepare ENTRY for display. -ENTRY is an alist representing an entry as returned by -parsebib-read-entry. All the fields not in FIELDS are removed -from ENTRY, with the exception of the \"=type=\" and \"=key=\" -fields. If FIELDS is empty, all fields are kept. Also add a -=has-pdf= and/or =has-note= field, if they exist for ENTRY. If -DO-NOT-FIND-PDF is non-nil, this function does not attempt to -find a PDF file." - (when entry ; entry may be nil, in which case just return nil - (let* ((fields (when fields (append fields (list "=type=" "=key=" "=has-pdf=" "=has-note=")))) - ; Check for PDF: - (entry (if (and (not do-not-find-pdf) (bibtex-completion-find-pdf entry)) - (cons (cons "=has-pdf=" bibtex-completion-pdf-symbol) entry) - entry)) - (entry-key (cdr (assoc "=key=" entry))) - ; Check for notes: - (entry (if (or - ;; One note file per entry: - (and bibtex-completion-notes-path - (f-directory? bibtex-completion-notes-path) - (f-file? (f-join bibtex-completion-notes-path - (s-concat entry-key - bibtex-completion-notes-extension)))) - ;; All notes in one file: - (and bibtex-completion-notes-path - (f-file? bibtex-completion-notes-path) - (member entry-key bibtex-completion-cached-notes-keys))) - (cons (cons "=has-note=" bibtex-completion-notes-symbol) entry) - entry)) - ; Remove unwanted fields: - (entry (if fields - (--filter (member-ignore-case (car it) fields) entry) - entry))) - ;; Normalize case of entry type: - (setcdr (assoc "=type=" entry) (downcase (cdr (assoc "=type=" entry)))) - ;; Remove duplicated fields: - (bibtex-completion-remove-duplicated-fields entry)))) - -(defun bibtex-completion-remove-duplicated-fields (entry) - "Remove duplicated fields from ENTRY." - (cl-remove-duplicates entry - :test (lambda (x y) (string= (s-downcase x) (s-downcase y))) - :key 'car :from-end t)) - - -(defun bibtex-completion-format-entry (entry width) - "Formats a BibTeX ENTRY for display in results list. WIDTH is -the width of the results list. The display format is governed by -the variable `bibtex-completion-display-formats'." - (let* ((format - (or (assoc-string (bibtex-completion-get-value "=type=" entry) - bibtex-completion-display-formats-internal - 'case-fold) - (assoc t bibtex-completion-display-formats-internal))) - (format-string (cadr format))) - (s-format - format-string - (lambda (field) - (let* ((field (split-string field ":")) - (field-name (car field)) - (field-width (cadr field)) - (field-value (bibtex-completion-get-value field-name entry))) - (when (and (string= field-name "author") - (not field-value)) - (setq field-value (bibtex-completion-get-value "editor" entry))) - (when (and (string= field-name "year") - (not field-value)) - (setq field-value (car (split-string (bibtex-completion-get-value "date" entry "") "-")))) - (setq field-value (bibtex-completion-clean-string (or field-value " "))) - (when (member field-name '("author" "editor")) - (setq field-value (bibtex-completion-shorten-authors field-value))) - (if (not field-width) - field-value - (setq field-width (string-to-number field-width)) - (truncate-string-to-width - field-value - (if (> field-width 0) - field-width - (- width (cddr format))) - 0 ?\s))))))) - - -(defun bibtex-completion-clean-string (s) - "Removes quoting and superfluous white space from BibTeX field -values." - (if s (replace-regexp-in-string "[\n\t ]+" " " - (replace-regexp-in-string "[\"{}]+" "" s)) - nil)) - -(defun bibtex-completion-shorten-authors (authors) - "Returns a comma-separated list of the surnames in authors." - (if authors - (cl-loop for a in (s-split " and " authors) - for p = (s-split "," a t) - for sep = "" then ", " - concat sep - if (eq 1 (length p)) - concat (-last-item (s-split " +" (car p) t)) - else - concat (car p)) - nil)) - - -(defun bibtex-completion-open-pdf (keys &optional fallback-action) - "Open the PDFs associated with the marked entries using the -function specified in `bibtex-completion-pdf-open-function'. -If multiple PDFs are found for an entry, ask for the one to -open using `completion-read'. If FALLBACK-ACTION is non-nil, it is called in -case no PDF is found." - (dolist (key keys) - (let ((pdf (bibtex-completion-find-pdf key bibtex-completion-find-additional-pdfs))) - (cond - ((> (length pdf) 1) - (let* ((pdf (f-uniquify-alist pdf)) - (choice (completing-read "File to open: " (mapcar 'cdr pdf) nil t)) - (file (car (rassoc choice pdf)))) - (funcall bibtex-completion-pdf-open-function file))) - (pdf - (funcall bibtex-completion-pdf-open-function (car pdf))) - (fallback-action - (funcall fallback-action (list key))) - (t - (message "No PDF(s) found for this entry: %s" - key)))))) - -(defun bibtex-completion-open-url-or-doi (keys) - "Open the associated URL or DOI in a browser." - (dolist (key keys) - (let* ((entry (bibtex-completion-get-entry key)) - (url (bibtex-completion-get-value "url" entry)) - (doi (bibtex-completion-get-value "doi" entry)) - (browse-url-browser-function - (or bibtex-completion-browser-function - browse-url-browser-function))) - (if url - (browse-url url) - (if doi (browse-url - (s-concat "http://dx.doi.org/" doi)) - (message "No URL or DOI found for this entry: %s" - key)))))) - -(defun bibtex-completion-open-any (keys) - "Open the PDFs associated with the marked entries using the -function specified in `bibtex-completion-pdf-open-function'. -If multiple PDFs are found for an entry, ask for the one to -open using `completion-read'. If no PDF is found, try to open a URL -or DOI in the browser instead." - (bibtex-completion-open-pdf keys 'bibtex-completion-open-url-or-doi)) - -(defun bibtex-completion-format-citation-default (keys) - "Default formatter for keys, separates multiple keys with commas." - (s-join ", " keys)) - -(defvar bibtex-completion-cite-command-history nil - "History list for LaTeX citation commands.") - -(defun bibtex-completion-format-citation-cite (keys) - "Formatter for LaTeX citation commands. Prompts for the command -and for arguments if the commands can take any. If point is -inside or just after a citation command, only adds KEYS to it." - (let (macro) - (cond - ((and (require 'reftex-parse nil t) - (setq macro (reftex-what-macro 1)) - (stringp (car macro)) - (string-match "\\`\\\\cite\\|cite\\'" (car macro))) - ;; We are inside a cite macro. Insert key at point, with appropriate delimiters. - (delete-horizontal-space) - (concat (pcase (preceding-char) - (?\{ "") - (?, " ") - (_ ", ")) - (s-join ", " keys) - (if (member (following-char) '(?\} ?,)) - "" - ", "))) - ((and (equal (preceding-char) ?\}) - (require 'reftex-parse nil t) - (save-excursion - (forward-char -1) - (setq macro (reftex-what-macro 1))) - (stringp (car macro)) - (string-match "\\`\\\\cite\\|cite\\'" (car macro))) - ;; We are right after a cite macro. Append key and leave point at the end. - (delete-char -1) - (delete-horizontal-space t) - (concat (pcase (preceding-char) - (?\{ "") - (?, " ") - (_ ", ")) - (s-join ", " keys) - "}")) - (t - ;; We are not inside or right after a cite macro. Insert a full citation. - (let* ((initial (when bibtex-completion-cite-default-as-initial-input - bibtex-completion-cite-default-command)) - (default (unless bibtex-completion-cite-default-as-initial-input - bibtex-completion-cite-default-command)) - (default-info (if default (format " (default \"%s\")" default) "")) - (cite-command (completing-read - (format "Cite command%s: " default-info) - bibtex-completion-cite-commands nil nil initial - 'bibtex-completion-cite-command-history default nil))) - (if (member cite-command '("nocite" "supercite")) ; These don't want arguments. - (format "\\%s{%s}" cite-command (s-join ", " keys)) - (let ((prenote (if bibtex-completion-cite-prompt-for-optional-arguments - (read-from-minibuffer "Prenote: ") - "")) - (postnote (if bibtex-completion-cite-prompt-for-optional-arguments - (read-from-minibuffer "Postnote: ") - ""))) - (cond ((not (string= "" prenote)) - (format "\\%s[%s][%s]{%s}" cite-command prenote postnote (s-join ", " keys))) - ((not (string= "" postnote)) - (format "\\%s[%s]{%s}" cite-command postnote (s-join ", " keys))) - (t - (format "\\%s{%s}" cite-command (s-join ", " keys))))))))))) - -(defun bibtex-completion-format-citation-pandoc-citeproc (keys) - "Formatter for pandoc-citeproc citations." - (let* ((prenote (if bibtex-completion-cite-prompt-for-optional-arguments (read-from-minibuffer "Prenote: ") "")) - (postnote (if bibtex-completion-cite-prompt-for-optional-arguments (read-from-minibuffer "Postnote: ") "")) - (prenote (if (string= "" prenote) "" (concat prenote " "))) - (postnote (if (string= "" postnote) "" (concat ", " postnote)))) - (format "[%s%s%s]" prenote (s-join "; " (--map (concat "@" it) keys)) postnote))) - -(defun bibtex-completion-format-citation-ebib (keys) - "Formatter for ebib references." - (s-join ", " - (--map (format "ebib:%s" it) keys))) - -(defun bibtex-completion-format-citation-org-link-to-PDF (keys) - "Formatter for org-links to PDF. Uses first matching PDF if -several are available. Entries for which no PDF is available are -omitted." - (s-join ", " (cl-loop - for key in keys - for pdfs = (bibtex-completion-find-pdf key bibtex-completion-find-additional-pdfs) - append (--map (format "[[%s][%s]]" it key) pdfs)))) - -(defun bibtex-completion-format-citation-org-apa-link-to-PDF (keys) - "Formatter for org-links to PDF. Link text loosely follows APA -format. Uses first matching PDF if several are available." - (s-join ", " (cl-loop - for key in keys - for entry = (bibtex-completion-get-entry key) - for author = (bibtex-completion-shorten-authors - (or (bibtex-completion-get-value "author" entry) - (bibtex-completion-get-value "editor" entry))) - for year = (or (bibtex-completion-get-value "year" entry) - (car (split-string (bibtex-completion-get-value "date" entry "") "-"))) - for pdf = (car (bibtex-completion-find-pdf key)) - if pdf - collect (format "[[file:%s][%s (%s)]]" pdf author year) - else - collect (format "%s (%s)" author year)))) - -;; When you want to create a todo list about reading, I think using -;; PDF's title is more intuitive. -(defun bibtex-completion-format-citation-org-title-link-to-PDF (keys) - "Formatter for org-links to PDF. Link text follows file title format. -Uses first matching PDF if several are available." - (s-join ", " (cl-loop - for key in keys - for entry = (bibtex-completion-get-entry key) - for title = (bibtex-completion-get-value "title" entry) - for pdf = (or (car (bibtex-completion-find-pdf key)) - (bibtex-completion-get-value "url" entry)) - if pdf - collect (format "[[file:%s][%s]]" pdf title) - else - collect (format "%s" title)))) - -(defun bibtex-completion-insert-citation (keys) - "Insert citation at point. The format depends on -`bibtex-completion-format-citation-functions'." - (let ((format-function - (cdr (or (assoc major-mode bibtex-completion-format-citation-functions) - (assoc 'default bibtex-completion-format-citation-functions))))) - (insert - (funcall format-function keys)))) - -(defun bibtex-completion-insert-reference (keys) - "Insert a reference for each selected entry." - (let* ((refs (--map - (s-word-wrap fill-column - (concat "\n- " (bibtex-completion-apa-format-reference it))) - keys))) - (insert "\n" (s-join "\n" refs) "\n"))) - -(defun bibtex-completion-apa-format-reference (key) - "Returns a plain text reference in APA format for the -publication specified by KEY." - (let* - ((entry (bibtex-completion-get-entry key)) - (ref (pcase (downcase (bibtex-completion-get-value "=type=" entry)) - ("article" - (s-format - "${author} (${year}). ${title}. ${journal}, ${volume}(${number}), ${pages}.${doi}" - 'bibtex-completion-apa-get-value entry)) - ("inproceedings" - (s-format - "${author} (${year}). ${title}. In ${editor}, ${booktitle} (pp. ${pages}). ${address}: ${publisher}." - 'bibtex-completion-apa-get-value entry)) - ("book" - (s-format - "${author} (${year}). ${title}. ${address}: ${publisher}." - 'bibtex-completion-apa-get-value entry)) - ("phdthesis" - (s-format - "${author} (${year}). ${title} (Doctoral dissertation). ${school}, ${address}." - 'bibtex-completion-apa-get-value entry)) - ("inbook" - (s-format - "${author} (${year}). ${title}. In ${editor} (Eds.), ${booktitle} (pp. ${pages}). ${address}: ${publisher}." - 'bibtex-completion-apa-get-value entry)) - ("incollection" - (s-format - "${author} (${year}). ${title}. In ${editor} (Eds.), ${booktitle} (pp. ${pages}). ${address}: ${publisher}." - 'bibtex-completion-apa-get-value entry)) - ("proceedings" - (s-format - "${editor} (Eds.). (${year}). ${booktitle}. ${address}: ${publisher}." - 'bibtex-completion-apa-get-value entry)) - ("unpublished" - (s-format - "${author} (${year}). ${title}. Unpublished manuscript." - 'bibtex-completion-apa-get-value entry)) - (_ - (s-format - "${author} (${year}). ${title}." - 'bibtex-completion-apa-get-value entry))))) - (replace-regexp-in-string "\\([.?!]\\)\\." "\\1" ref))) ; Avoid sequences of punctuation marks. - -(defun bibtex-completion-apa-get-value (field entry &optional default) - "Return FIELD or ENTRY formatted following the APA -guidelines. Return DEFAULT if FIELD is not present in ENTRY." - ;; Virtual fields: - (cond - ((string= field "author-or-editor") - (let ((value (bibtex-completion-get-value "author" entry))) - (if value - (bibtex-completion-apa-format-authors value) - (bibtex-completion-apa-format-editors - (bibtex-completion-get-value "editor" entry))))) - ((string= field "author-abbrev") - (let ((value (bibtex-completion-get-value "author" entry))) - (bibtex-completion-apa-format-authors-abbrev value))) - (t - ;; Real fields: - (let ((value (bibtex-completion-get-value field entry))) - (if value - (pcase field - ;; https://owl.english.purdue.edu/owl/resource/560/06/ - ("author" (bibtex-completion-apa-format-authors value)) - ("editor" (bibtex-completion-apa-format-editors value)) - ;; When referring to books, chapters, articles, or Web pages, - ;; capitalize only the first letter of the first word of a - ;; title and subtitle, the first word after a colon or a dash - ;; in the title, and proper nouns. Do not capitalize the first - ;; letter of the second word in a hyphenated compound word. - ("title" (replace-regexp-in-string ; remove braces - "[{}]" - "" - (replace-regexp-in-string ; remove macros - "\\\\[[:alpha:]]+{" - "" - (replace-regexp-in-string ; upcase initial letter - "^[[:alpha:]]" - 'upcase - (replace-regexp-in-string ; preserve stuff in braces from being downcased - "\\(^[^{]*{\\)\\|\\(}[^{]*{\\)\\|\\(}.*$\\)\\|\\(^[^{}]*$\\)" - (lambda (x) (downcase (s-replace "\\" "\\\\" x))) - value))))) - ("booktitle" value) - ;; Maintain the punctuation and capitalization that is used by - ;; the journal in its title. - ("pages" (s-join "–" (s-split "[^0-9]+" value t))) - ("doi" (s-concat " http://dx.doi.org/" value)) - ("year" (or value - (car (split-string (bibtex-completion-get-value "date" entry "") "-")))) - (_ value)) - ""))))) - -(defun bibtex-completion-apa-format-authors (value) - (cl-loop for a in (s-split " and " value t) - if (s-index-of "{" a) - collect - (replace-regexp-in-string "[{}]" "" a) - into authors - else if (s-index-of "," a) - collect - (let ((p (s-split " *, *" a t))) - (concat - (car p) ", " - (s-join " " (-map (lambda (it) (concat (s-left 1 it) ".")) - (s-split " " (cadr p)))))) - into authors - else - collect - (let ((p (s-split " " a t))) - (concat - (-last-item p) ", " - (s-join " " (-map (lambda (it) (concat (s-left 1 it) ".")) - (-butlast p))))) - into authors - finally return - (let ((l (length authors))) - (cond - ((= l 1) (car authors)) - ((< l 8) (concat (s-join ", " (-butlast authors)) - ", & " (-last-item authors))) - (t (concat (s-join ", " (-slice authors 0 7)) ", …")))))) - -(defun bibtex-completion-apa-format-authors-abbrev (value) - (cl-loop for a in (s-split " and " value t) - if (s-index-of "{" a) - collect - (replace-regexp-in-string "[{}]" "" a) - into authors - else if (s-index-of "," a) - collect - (let ((p (s-split " *, *" a t))) - (concat - (car p) ", " - (s-join " " (-map (lambda (it) (concat (s-left 1 it) ".")) - (s-split " " (cadr p)))))) - into authors - else - collect - (let ((p (s-split " " a t))) - (concat - (-last-item p) ", " - (s-join " " (-map (lambda (it) (concat (s-left 1 it) ".")) - (-butlast p))))) - into authors - finally return - (let ((l (length authors))) - (cond - ((= l 1) (car authors)) - ((= l 2) (concat (s-join " & " authors))) - (t (format "%s et al." (car authors))))))) - -(defun bibtex-completion-apa-format-editors (value) - (cl-loop for a in (s-split " and " value t) - if (s-index-of "," a) - collect - (let ((p (s-split " *, *" a t))) - (concat - (s-join " " (-map (lambda (it) (concat (s-left 1 it) ".")) - (s-split " " (cadr p)))) - " " (car p))) - into authors - else - collect - (let ((p (s-split " " a t))) - (concat - (s-join " " (-map (lambda (it) (concat (s-left 1 it) ".")) - (-butlast p))) - " " (-last-item p))) - into authors - finally return - (let ((l (length authors))) - (cond - ((= l 1) (car authors)) - ((< l 8) (concat (s-join ", " (-butlast authors)) - ", & " (-last-item authors))) - (t (concat (s-join ", " authors) ", ...")))))) - -(defun bibtex-completion-get-value (field entry &optional default) - "Return the requested value or `default' if the value is not -defined. Surrounding curly braces are stripped." - (let ((value (cdr (assoc-string field entry 'case-fold)))) - (if value - (replace-regexp-in-string - "\\(^[[:space:]]*[\"{][[:space:]]*\\)\\|\\([[:space:]]*[\"}][[:space:]]*$\\)" - "" - (s-collapse-whitespace value)) - default))) - -(defun bibtex-completion-insert-key (keys) - "Insert BibTeX key at point." - (insert - (funcall 'bibtex-completion-format-citation-default keys))) - -(defun bibtex-completion-insert-bibtex (keys) - "Insert BibTeX key at point." - (insert (s-join "\n" (--map (bibtex-completion-make-bibtex it) keys)))) - -(defun bibtex-completion-make-bibtex (key) - (let* ((entry (bibtex-completion-get-entry key)) - (entry-type (bibtex-completion-get-value "=type=" entry))) - (format "@%s{%s,\n%s}\n" - entry-type key - (cl-loop - for field in entry - for name = (car field) - for value = (cdr field) - unless (member name - (append (-map (lambda (it) (if (symbolp it) (symbol-name it) it)) - bibtex-completion-no-export-fields) - '("=type=" "=key=" "=has-pdf=" "=has-note=" "crossref"))) - concat - (format " %s = {%s},\n" name value))))) - -(defun bibtex-completion-add-PDF-attachment (keys) - "Attach the PDFs of the selected entries where available." - (dolist (key keys) - (let ((pdf (bibtex-completion-find-pdf key bibtex-completion-find-additional-pdfs))) - (if pdf - (mapc 'mml-attach-file pdf) - (message "No PDF(s) found for this entry: %s" - key))))) - -(define-minor-mode bibtex-completion-notes-mode - "Minor mode for managing notes." - :keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-c C-c") 'bibtex-completion-exit-notes-buffer) - (define-key map (kbd "C-c C-w") 'org-refile) - map) - (setq-local - header-line-format - (substitute-command-keys - " Finish \\[bibtex-completion-exit-notes-buffer], refile \\[org-refile]"))) - -;; Define global minor mode. This is needed to the toggle minor mode. -(define-globalized-minor-mode bibtex-completion-notes-global-mode bibtex-completion-notes-mode bibtex-completion-notes-mode) - -(defun bibtex-completion-exit-notes-buffer () - "Exit notes buffer and delete its window. -This will also disable `bibtex-completion-notes-mode' and remove the header -line." - (interactive) - (widen) - (bibtex-completion-notes-global-mode -1) - (setq-local - header-line-format nil) - (save-buffer) - (let ((window (get-buffer-window (get-file-buffer bibtex-completion-notes-path)))) - (if (and window (not (one-window-p window))) - (delete-window window) - (switch-to-buffer (other-buffer))))) - -(defun bibtex-completion-edit-notes (keys) - "Open the notes associated with the selected entries using `find-file'." - (dolist (key keys) - (let* ((entry (bibtex-completion-get-entry key)) - (year (or (bibtex-completion-get-value "year" entry) - (car (split-string (bibtex-completion-get-value "date" entry "") "-")))) - (entry (push (cons "year" year) entry))) - (if (and bibtex-completion-notes-path - (f-directory? bibtex-completion-notes-path)) - ; One notes file per publication: - (let* ((path (f-join bibtex-completion-notes-path - (s-concat key bibtex-completion-notes-extension)))) - (find-file path) - (unless (f-exists? path) - (insert (s-format bibtex-completion-notes-template-multiple-files - 'bibtex-completion-apa-get-value - entry)))) - ; One file for all notes: - (unless (and buffer-file-name - (f-same? bibtex-completion-notes-path buffer-file-name)) - (find-file-other-window bibtex-completion-notes-path)) - (widen) - (outline-show-all) - (goto-char (point-min)) - (if (re-search-forward (format bibtex-completion-notes-key-pattern (regexp-quote key)) nil t) - ; Existing entry found: - (when (eq major-mode 'org-mode) - (org-narrow-to-subtree) - (re-search-backward "^\*+ " nil t) - (org-cycle-hide-drawers nil) - (bibtex-completion-notes-mode 1)) - ; Create a new entry: - (goto-char (point-max)) - (save-excursion (insert (s-format bibtex-completion-notes-template-one-file - 'bibtex-completion-apa-get-value - entry))) - (re-search-forward "^*+ " nil t)) - (when (eq major-mode 'org-mode) - (org-narrow-to-subtree) - (re-search-backward "^\*+ " nil t) - (org-cycle-hide-drawers nil) - (goto-char (point-max)) - (bibtex-completion-notes-mode 1)))))) - -(defun bibtex-completion-buffer-visiting (file) - (or (get-file-buffer file) - (find-buffer-visiting file))) - -(defun bibtex-completion-show-entry (keys) - "Show the first selected entry in the BibTeX file." - (catch 'break - (dolist (bib-file (bibtex-completion-normalize-bibliography 'main)) - (let ((key (car keys)) - (buf (bibtex-completion-buffer-visiting bib-file))) - (find-file bib-file) - (widen) - (if (eq major-mode 'org-mode) - (let* ((prop (if (boundp 'org-bibtex-key-property) - org-bibtex-key-property - "CUSTOM_ID")) - (match (org-find-property prop key))) - (when match - (goto-char match) - (org-show-entry) - (throw 'break t))) - (goto-char (point-min)) - (when (re-search-forward - (concat "^@\\(" parsebib--bibtex-identifier - "\\)[[:space:]]*[\(\{][[:space:]]*" - (regexp-quote key) "[[:space:]]*,") nil t) - (throw 'break t))) - (unless buf - (kill-buffer)))))) - -(defun bibtex-completion-add-pdf-to-library (keys) - "Add a PDF to the library for the first selected entry. The PDF -can be added either from an open buffer, a file, or a URL." - (let* ((key (car keys)) - (source (char-to-string - (read-char-choice "Add pdf from [b]uffer, [f]ile, or [u]rl? " '(?b ?f ?u)))) - (buffer (when (string= source "b") - (read-buffer-to-switch "Add pdf buffer: "))) - (file (when (string= source "f") - (expand-file-name (read-file-name "Add pdf file: " nil nil t)))) - (url (when (string= source "u") - (read-string "Add pdf URL: "))) - (path (-flatten (list bibtex-completion-library-path))) - (path (if (cdr path) - (completing-read "Add pdf to: " path nil t) - (car path))) - (pdf (expand-file-name (completing-read "Rename pdf to: " - (--map (s-concat key it) - (-flatten bibtex-completion-pdf-extension)) - nil nil key) - path))) - (cond - (buffer - (with-current-buffer buffer - (write-file pdf t))) - (file - (copy-file file pdf 1)) - (url - (url-copy-file url pdf 1))))) - -(defun bibtex-completion-fallback-action (url-or-function search-expression) - (let ((browse-url-browser-function - (or bibtex-completion-browser-function - browse-url-browser-function))) - (cond - ((stringp url-or-function) - (browse-url (format url-or-function (url-hexify-string search-expression)))) - ((functionp url-or-function) - (funcall url-or-function search-expression)) - (t (error "Don't know how to interpret this: %s" url-or-function))))) - -(defun bibtex-completion-fallback-candidates () - "Compile list of fallback options. These consist of the online -resources defined in `bibtex-completion-fallback-options' plus -one entry for each bibliography file that will open that file for -editing." - (let ((bib-files (bibtex-completion-normalize-bibliography 'main))) - (-concat - (--map (cons (s-concat "Create new entry in " (f-filename it)) - `(lambda (_search-expression) (find-file ,it) (goto-char (point-max)) (newline))) - bib-files) - bibtex-completion-fallback-options))) - -(defun bibtex-completion-find-local-bibliography () - "Return a list of BibTeX files associated with the current -file. If the current file is a BibTeX file, return this -file. Otherwise, try to use `reftex' to find the associated -BibTeX files. If this fails, return nil." - (or (and (buffer-file-name) - (string= (or (f-ext (buffer-file-name)) "") "bib") - (list (buffer-file-name))) - (and (buffer-file-name) - (require 'reftex-cite nil t) - (ignore-errors (reftex-get-bibfile-list))))) - -(defun bibtex-completion-key-at-point () - "Return the key of the BibTeX entry at point. If the current -file is a BibTeX file, return the key of the entry at -point. Otherwise, try to use `reftex' to check whether point is -at a citation macro, and if so return the key at -point. Otherwise, if the current file is an org-mode file, return -the value of `org-bibtex-key-property' (or -default to \"CUSTOM_ID\"). Otherwise, return nil." - (or (and (eq major-mode 'bibtex-mode) - (save-excursion - (bibtex-beginning-of-entry) - (and (looking-at bibtex-entry-maybe-empty-head) - (bibtex-key-in-head)))) - (and (require 'reftex-parse nil t) - (save-excursion - (skip-chars-backward "[:space:],;}") - (let ((macro (reftex-what-macro 1))) - (and (stringp (car macro)) - (string-match "\\`\\\\cite\\|cite\\'" (car macro)) - ;; allow '_' in citekeys - (let ((temp-syn-table (make-syntax-table))) - (modify-syntax-entry ?_ "_" temp-syn-table) - (with-syntax-table temp-syn-table - (thing-at-point 'symbol))))))) - (and (eq major-mode 'org-mode) - (let (key) - (and (setq key (org-entry-get nil - (if (boundp 'org-bibtex-key-property) - org-bibtex-key-property - "CUSTOM_ID") - t)) - ;; KEY may be the empty string the the property is - ;; present but has no value - (> (length key) 0) - key))))) - -(provide 'bibtex-completion) - -;; Local Variables: -;; byte-compile-warnings: (not cl-functions obsolete) -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: - -;;; bibtex-completion.el ends here diff --git a/elpa/helm-bibtex-20191028.1313/helm-bibtex-pkg.el b/elpa/helm-bibtex-20191028.1313/helm-bibtex-pkg.el deleted file mode 100644 index b1b0ce89..00000000 --- a/elpa/helm-bibtex-20191028.1313/helm-bibtex-pkg.el +++ /dev/null @@ -1,15 +0,0 @@ -(define-package "helm-bibtex" "20191028.1313" "A bibliography manager based on Helm" - '((helm "1.5.5") - (parsebib "1.0") - (s "1.9.0") - (dash "2.6.0") - (f "0.16.2") - (cl-lib "0.5") - (biblio "0.2")) - :authors - '(("Titus von der Malsburg" . "malsburg@posteo.de")) - :maintainer - '("Titus von der Malsburg" . "malsburg@posteo.de")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/helm-bibtex-20191028.1313/helm-bibtex-autoloads.el b/elpa/helm-bibtex-20221114.1204/helm-bibtex-autoloads.el similarity index 59% rename from elpa/helm-bibtex-20191028.1313/helm-bibtex-autoloads.el rename to elpa/helm-bibtex-20221114.1204/helm-bibtex-autoloads.el index dbbedc16..fcacf8d6 100644 --- a/elpa/helm-bibtex-20191028.1313/helm-bibtex-autoloads.el +++ b/elpa/helm-bibtex-20221114.1204/helm-bibtex-autoloads.el @@ -1,10 +1,12 @@ -;;; helm-bibtex-autoloads.el --- automatically extracted autoloads +;;; helm-bibtex-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "helm-bibtex" "helm-bibtex.el" (23994 46472 -;;;;;; 966811 976000)) +;;;### (autoloads nil "helm-bibtex" "helm-bibtex.el" (0 0 0 0)) ;;; Generated autoloads from helm-bibtex.el (autoload 'helm-bibtex "helm-bibtex" "\ @@ -26,15 +28,30 @@ frequent searches (e.g. your own publications). (autoload 'helm-bibtex-with-local-bibliography "helm-bibtex" "\ Search BibTeX entries with local bibliography. +If none is found the global bibliography is used instead. With a +prefix ARG the cache is invalidated and the bibliography +reloaded. + +\(fn &optional ARG)" t nil) + +(autoload 'helm-bibtex-with-notes "helm-bibtex" "\ +Search BibTeX entries with notes. + With a prefix ARG the cache is invalidated and the bibliography reread. \(fn &optional ARG)" t nil) +(autoload 'helm-bibtex-follow "helm-bibtex" "\ + + +\(fn &optional CITATION ARGS)" t nil) + +(register-definition-prefixes "helm-bibtex" '("helm-")) + ;;;*** -;;;### (autoloads nil nil ("bibtex-completion.el" "helm-bibtex-pkg.el") -;;;;;; (23994 46472 967885 790000)) +;;;### (autoloads nil nil ("helm-bibtex-pkg.el") (0 0 0 0)) ;;;*** @@ -42,5 +59,6 @@ reread. ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; helm-bibtex-autoloads.el ends here diff --git a/elpa/helm-bibtex-20221114.1204/helm-bibtex-pkg.el b/elpa/helm-bibtex-20221114.1204/helm-bibtex-pkg.el new file mode 100644 index 00000000..e5736afe --- /dev/null +++ b/elpa/helm-bibtex-20221114.1204/helm-bibtex-pkg.el @@ -0,0 +1,15 @@ +(define-package "helm-bibtex" "20221114.1204" "A bibliography manager based on Helm" + '((bibtex-completion "1.0.0") + (helm "1.5.5") + (cl-lib "0.5") + (emacs "24.1")) + :commit "8ebf50d5bd368082d0b7ab79d26a52f372cdef98" :authors + '(("Titus von der Malsburg" . "malsburg@posteo.de")) + :maintainers + '(("Titus von der Malsburg" . "malsburg@posteo.de")) + :maintainer + '("Titus von der Malsburg" . "malsburg@posteo.de") + :url "https://github.com/tmalsburg/helm-bibtex") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-bibtex-20191028.1313/helm-bibtex.el b/elpa/helm-bibtex-20221114.1204/helm-bibtex.el similarity index 82% rename from elpa/helm-bibtex-20191028.1313/helm-bibtex.el rename to elpa/helm-bibtex-20221114.1204/helm-bibtex.el index 154a862d..d9c99725 100644 --- a/elpa/helm-bibtex-20191028.1313/helm-bibtex.el +++ b/elpa/helm-bibtex-20221114.1204/helm-bibtex.el @@ -2,8 +2,9 @@ ;; Author: Titus von der Malsburg ;; Maintainer: Titus von der Malsburg -;; Version: 2.0.0 -;; Package-Requires: ((helm "1.5.5") (parsebib "1.0") (s "1.9.0") (dash "2.6.0") (f "0.16.2") (cl-lib "0.5") (biblio "0.2")) +;; URL: https://github.com/tmalsburg/helm-bibtex +;; Version: 2.0.1 +;; Package-Requires: ((bibtex-completion "1.0.0") (helm "1.5.5") (cl-lib "0.5") (emacs "24.1")) ;; 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 @@ -93,6 +94,7 @@ (require 'helm) (require 'helm-net) (require 'helm-easymenu) +(require 'helm-files) (require 'bibtex-completion) ;; Silence the byte compiler @@ -243,14 +245,70 @@ frequent searches (e.g. your own publications)." (defun helm-bibtex-with-local-bibliography (&optional arg) "Search BibTeX entries with local bibliography. -With a prefix ARG the cache is invalidated and the bibliography -reread." +If none is found the global bibliography is used instead. With a +prefix ARG the cache is invalidated and the bibliography +reloaded." (interactive "P") (let* ((local-bib (bibtex-completion-find-local-bibliography)) (bibtex-completion-bibliography (or local-bib bibtex-completion-bibliography))) (helm-bibtex arg local-bib))) +;;;###autoload +(defun helm-bibtex-with-notes (&optional arg) + "Search BibTeX entries with notes. + +With a prefix ARG the cache is invalidated and the bibliography +reread." + (interactive "P") + (cl-letf* ((candidates (bibtex-completion-candidates)) + ((symbol-function 'bibtex-completion-candidates) + (lambda () + (seq-filter + (lambda (candidate) (assoc "=has-note=" candidate)) + candidates)))) + (helm-bibtex))) + +;; Helm-bibtex follow processor: + +(defvar helm-bibtex-follow-actions-alist + '(("Open PDF, URL or DOI" . bibtex-completion-open-pdf) + ("Open URL or DOI in browser" . bibtex-completion-open-url-or-doi) + ("Edit notes" . bibtex-completion-edit-notes) + ("Show entry" . bibtex-completion-show-entry) + ("Add PDF to library" . bibtex-completion-add-pdf-to-library))) + + +(defcustom helm-bibtex-follow-full-frame nil + "Non-nil means open ‘helm-bibtex-follow’ using the entire window. +When nil, the window will split below." + :group 'bibtex-completion + :type 'boolean) + +;;;###autoload +(defun helm-bibtex-follow (&optional citation args) + (interactive) + (let* ((key (if citation + (plist-get (cadr citation) :key) + (bibtex-completion-key-at-point))) + (item-info + (format "%s\t\t%s" + (bibtex-completion-apa-get-value + "title" (bibtex-completion-get-entry key)) + (bibtex-completion-apa-get-value + "author" (bibtex-completion-get-entry key))))) + (helm :sources + (helm-build-sync-source item-info + :candidates helm-bibtex-follow-actions-alist + :action (lambda (x) (funcall x (list key)))) + :full-frame helm-bibtex-follow-full-frame + :buffer "*helm bibtex follow*"))) + + +(org-cite-register-processor 'helm-bibtex-org-cite-follow + :follow 'helm-bibtex-follow) + + (provide 'helm-bibtex) ;; Local Variables: diff --git a/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-pkg.el b/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-pkg.el deleted file mode 100644 index 5ffe639f..00000000 --- a/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "helm-c-yasnippet" "20170128.1542" "helm source for yasnippet.el" '((helm "1.7.7") (yasnippet "0.8.0") (cl-lib "0.3")) :commit "65ca732b510bfc31636708aebcfe4d2d845b59b0" :keywords '("convenience" "emulation") :authors '(("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com")) :maintainer '("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com")) diff --git a/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-autoloads.el b/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-autoloads.el similarity index 73% rename from elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-autoloads.el rename to elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-autoloads.el index 41d5930b..f032c706 100644 --- a/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet-autoloads.el +++ b/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-autoloads.el @@ -1,4 +1,4 @@ -;;; helm-c-yasnippet-autoloads.el --- automatically extracted autoloads +;;; helm-c-yasnippet-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -11,21 +11,21 @@ ;;; Generated autoloads from helm-c-yasnippet.el (autoload 'helm-yas-complete "helm-c-yasnippet" "\ -List of yasnippet snippets using `helm' interface. - -\(fn)" t nil) +List of yasnippet snippets using `helm' interface." t nil) (autoload 'helm-yas-visit-snippet-file "helm-c-yasnippet" "\ -List of yasnippet snippet files - -\(fn)" t nil) +List of yasnippet snippet files" t nil) (autoload 'helm-yas-create-snippet-on-region "helm-c-yasnippet" "\ Create a snippet from region. \(fn &optional START END FILE-NAME)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-c-yasnippet" '("helm-"))) +(register-definition-prefixes "helm-c-yasnippet" '("helm-")) + +;;;*** + +;;;### (autoloads nil nil ("helm-c-yasnippet-pkg.el") (0 0 0 0)) ;;;*** diff --git a/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-pkg.el b/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-pkg.el new file mode 100644 index 00000000..1701f45a --- /dev/null +++ b/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet-pkg.el @@ -0,0 +1,15 @@ +(define-package "helm-c-yasnippet" "20210330.16" "helm source for yasnippet.el" + '((emacs "25.1") + (helm "1.7.7") + (yasnippet "0.8.0")) + :commit "e214eec8b2875d8a7cd09006dfb6a8e15e9e4079" :authors + '(("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com")) + :maintainers + '(("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com")) + :maintainer + '("Kenji.I (Kenji Imakado)" . "ken.imakaado@gmail.com") + :keywords + '("convenience" "emulation")) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet.el b/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet.el similarity index 93% rename from elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet.el rename to elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet.el index 1582abda..28d68c08 100644 --- a/elpa/helm-c-yasnippet-20170128.1542/helm-c-yasnippet.el +++ b/elpa/helm-c-yasnippet-20210330.16/helm-c-yasnippet.el @@ -6,8 +6,7 @@ ;; Author: Kenji.I (Kenji Imakado) ;; Version: 0.6.7 -;; Package-Version: 20170128.1542 -;; Package-Requires: ((helm "1.7.7") (yasnippet "0.8.0") (cl-lib "0.3")) +;; Package-Requires: ((emacs "25.1") (helm "1.7.7") (yasnippet "0.8.0")) ;; Keywords: convenience, emulation ;; This file is free software; you can redistribute it and/or modify @@ -180,7 +179,8 @@ If SNIPPET-FILE does not contain directory, it is placed in default snippet dire (let ((yas-choose-keys-first nil) (yas-choose-tables-first nil) (yas-buffer-local-condition 'always)) - (let* ((result-alist '((candidates) (transformed) (template-key-alist) (template-file-alist))) + (let* ((result-alist '((candidates) (transformed) (template-key-alist) + (template-file-alist) (template-expand-env-alist))) (cur-tables (if table (list table) @@ -200,21 +200,28 @@ If SNIPPET-FILE does not contain directory, it is placed in default snippet dire with templates with template-key-alist with template-file-alist + with template-expand-env-alist for lst in hash-value-alist for key = (car lst) for template-struct = (cdr lst) for name = (yas--template-name template-struct) ;`yas--template-name' for template = (yas--template-content template-struct) ;`yas--template-content' for file = (yas--template-load-file template-struct) ;`yas--template-content' + for condition = (yas--template-condition template-struct) + for expand-env = (yas--template-expand-env template-struct) + when (or (not condition) (ignore-errors (eval condition))) do (progn (push template templates) (push `(,name . ,template) transformed) (push `(,template . ,key) template-key-alist) (push `(,template . ,file) template-file-alist) + (push `(,template . ,expand-env) template-expand-env-alist) ) finally (progn (push `(candidates . ,templates) result-alist) (push `(transformed . ,transformed) result-alist) (push `(template-file-alist . ,template-file-alist) result-alist) - (push `(template-key-alist . ,template-key-alist) result-alist))) + (push `(template-key-alist . ,template-key-alist) result-alist) + (push `(template-expand-env-alist . ,template-expand-env-alist) result-alist) + )) result-alist) ))) @@ -254,7 +261,10 @@ like `yas--current-key'" for name = (car dotlst) for template = (cdr dotlst) for key = (helm-yas-get-key-by-template template alist) - for name-inc-key = (concat "[" (propertize key 'face 'helm-yas-key) "] " name) + for key-str = (cond ((stringp key) key) + ((vectorp key) (key-description key)) + (t (format "%s" key))) + for name-inc-key = (concat "[" (propertize key-str 'face 'helm-yas-key) "] " name) collect `(,name-inc-key . ,template)))) ;; default ex: for (...) { ... } @@ -279,6 +289,9 @@ like `yas--current-key'" (defun helm-yas-get-path-by-template (template) (assoc-default template (assoc-default 'template-file-alist helm-yas-cur-snippets-alist))) +(defun helm-yas-get-expand-env-by-template (template) + (assoc-default template (assoc-default 'template-expand-env-alist helm-yas-cur-snippets-alist))) + (defun helm-yas-match (candidate) "if customize variable `helm-yas-space-match-any-greedy' is non-nil space match anyword greedy" @@ -304,7 +317,8 @@ space match anyword greedy" (candidate-transformer . (lambda (candidates) (helm-yas-get-transformed-list helm-yas-cur-snippets-alist helm-yas-initial-input))) (action . (("Insert snippet" . (lambda (template) - (yas-expand-snippet template helm-yas-point-start helm-yas-point-end) + (yas-expand-snippet template helm-yas-point-start helm-yas-point-end + (helm-yas-get-expand-env-by-template template)) (when helm-yas-display-msg-after-complete (message "this snippet is bound to [ %s ]" (helm-yas-get-key-by-template template helm-yas-cur-snippets-alist))))) diff --git a/elpa/helm-core-20220607.1243/helm-core-pkg.el b/elpa/helm-core-20220607.1243/helm-core-pkg.el deleted file mode 100644 index 0a8a5abf..00000000 --- a/elpa/helm-core-20220607.1243/helm-core-pkg.el +++ /dev/null @@ -1,11 +0,0 @@ -(define-package "helm-core" "20220607.1243" "Development files for Helm" - '((emacs "25.1") - (async "1.9.4")) - :commit "a6df31a7cff0c64b8b999a85cbf5b4cc253a104f" :authors - '(("Thierry Volpiatto ")) - :maintainer - '("Thierry Volpiatto ") - :url "https://emacs-helm.github.io/helm/") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/helm-core-20220607.1243/helm-core-autoloads.el b/elpa/helm-core-20230806.1956/helm-core-autoloads.el similarity index 80% rename from elpa/helm-core-20220607.1243/helm-core-autoloads.el rename to elpa/helm-core-20230806.1956/helm-core-autoloads.el index f210aeb6..7b131039 100644 --- a/elpa/helm-core-20220607.1243/helm-core-autoloads.el +++ b/elpa/helm-core-20230806.1956/helm-core-autoloads.el @@ -1,17 +1,16 @@ -;;; helm-core-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; helm-core-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "helm-core" "helm-core.el" (0 0 0 0)) ;;; Generated autoloads from helm-core.el -(autoload 'helm-configuration "helm-core" "\ -Customize Helm." t nil) - (autoload 'helm-define-multi-key "helm-core" "\ In KEYMAP, define key sequence KEY for function list FUNCTIONS. Each function runs sequentially for each KEY press. @@ -29,23 +28,20 @@ E.g. (interactive) (message \"Run baz\")) -\(helm-define-multi-key global-map (kbd \" q\") \\='(foo bar baz) 2) +(helm-define-multi-key global-map (kbd \" q\") \\='(foo bar baz) 2) Each time \" q\" is pressed, the next function is executed. Waiting more than 2 seconds between key presses switches back to executing the first function on the next hit. -\(fn KEYMAP KEY FUNCTIONS &optional DELAY)" nil nil) - +(fn KEYMAP KEY FUNCTIONS &optional DELAY)") (autoload 'helm-multi-key-defun "helm-core" "\ Define NAME as a multi-key command running FUNS. After DELAY seconds, the FUNS list is reinitialized. See `helm-define-multi-key'. -\(fn NAME DOCSTRING FUNS &optional DELAY)" nil t) - -(function-put 'helm-multi-key-defun 'lisp-indent-function '2) - +(fn NAME DOCSTRING FUNS &optional DELAY)" nil t) +(function-put 'helm-multi-key-defun 'lisp-indent-function 2) (autoload 'helm-define-key-with-subkeys "helm-core" "\ Define in MAP a KEY and SUBKEY to COMMAND. @@ -76,25 +72,26 @@ in MAP and then exit the loop running EXIT-FN, if specified. If DELAY an integer is specified exit after DELAY seconds. NOTE: SUBKEY and OTHER-SUBKEYS bindings support only char syntax -and vectors, so don't use strings to define them. - -\(fn MAP KEY SUBKEY COMMAND &optional OTHER-SUBKEYS PROMPT EXIT-FN DELAY)" nil nil) - -(function-put 'helm-define-key-with-subkeys 'lisp-indent-function '1) +and vectors, so don't use strings to define them. While defining +or executing a kbd macro no SUBKEY or OTHER-SUBKEYS are provided, +i.e. the loop is not entered after running COMMAND. +(fn MAP KEY SUBKEY COMMAND &optional OTHER-SUBKEYS PROMPT EXIT-FN DELAY DOCSTRING)") +(function-put 'helm-define-key-with-subkeys 'lisp-indent-function 1) +(autoload 'helm-configuration "helm-core" "\ +Customize Helm." t) (autoload 'helm-debug-open-last-log "helm-core" "\ -Open Helm log file or buffer of last Helm session." t nil) - +Open Helm log file or buffer of last Helm session." t) (autoload 'helm "helm-core" "\ Main function to execute helm sources. PLIST is a list like -\(:key1 val1 :key2 val2 ...) +(:key1 val1 :key2 val2 ...) or -\(&optional sources input prompt resume preselect +(&optional sources input prompt resume preselect buffer keymap default history allow-nest). ** Keywords @@ -152,7 +149,7 @@ Buffer name for this Helm session. `helm-buffer' will take this value. *** :keymap -\[Obsolete] +[Obsolete] Keymap used at the start of this Helm session. @@ -195,7 +192,7 @@ Allow running this Helm command in a running Helm session. Other keywords are interpreted as local variables of this Helm session. The `helm-' prefix can be omitted. For example, -\(helm :sources \\='helm-source-buffers-list +(helm :sources \\='helm-source-buffers-list :buffer \"*helm buffers*\" :candidate-number-limit 10) @@ -207,56 +204,46 @@ Starts a Helm session with the variable For backward compatibility, positional parameters are supported: -\(helm sources input prompt resume preselect +(helm sources input prompt resume preselect buffer keymap default history allow-nest) However, the use of non-keyword args is deprecated. -\(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)" nil nil) - +(fn &key SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY ALLOW-NEST OTHER-LOCAL-VARS)") (autoload 'helm-cycle-resume "helm-core" "\ -Cycle in `helm-buffers' list and resume when waiting more than 1.2s." t nil) - +Cycle in `helm-buffers' list and resume when waiting more than 1.2s." t) (autoload 'helm-other-buffer "helm-core" "\ Simplified Helm interface with other `helm-buffer'. Call `helm' only with SOURCES and BUFFER as args. -\(fn SOURCES BUFFER)" nil nil) - +(fn SOURCES BUFFER)") (register-definition-prefixes "helm-core" '("helm-" "with-helm-")) -;;;*** -;;;### (autoloads nil "helm-lib" "helm-lib.el" (0 0 0 0)) ;;; Generated autoloads from helm-lib.el (register-definition-prefixes "helm-lib" '("helm-" "with-helm-")) -;;;*** -;;;### (autoloads nil "helm-multi-match" "helm-multi-match.el" (0 -;;;;;; 0 0 0)) ;;; Generated autoloads from helm-multi-match.el (register-definition-prefixes "helm-multi-match" '("helm-m")) -;;;*** -;;;### (autoloads nil "helm-source" "helm-source.el" (0 0 0 0)) ;;; Generated autoloads from helm-source.el (register-definition-prefixes "helm-source" '("helm-")) - -;;;*** -;;;### (autoloads nil nil ("helm-core-pkg.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'helm-core-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; helm-core-autoloads.el ends here diff --git a/elpa/helm-core-20230806.1956/helm-core-pkg.el b/elpa/helm-core-20230806.1956/helm-core-pkg.el new file mode 100644 index 00000000..1d1b300a --- /dev/null +++ b/elpa/helm-core-20230806.1956/helm-core-pkg.el @@ -0,0 +1,13 @@ +(define-package "helm-core" "20230806.1956" "Development files for Helm" + '((emacs "25.1") + (async "1.9.7")) + :commit "97edf0af7bad329bca11e0c617d4c81f2d126a11" :authors + '(("Thierry Volpiatto" . "thievol@posteo.net")) + :maintainers + '(("Thierry Volpiatto" . "thievol@posteo.net")) + :maintainer + '("Thierry Volpiatto" . "thievol@posteo.net") + :url "https://emacs-helm.github.io/helm/") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-core-20220607.1243/helm-core.el b/elpa/helm-core-20230806.1956/helm-core.el similarity index 89% rename from elpa/helm-core-20220607.1243/helm-core.el rename to elpa/helm-core-20230806.1956/helm-core.el index f552ba10..502a10b1 100644 --- a/elpa/helm-core-20220607.1243/helm-core.el +++ b/elpa/helm-core-20230806.1956/helm-core.el @@ -1,11 +1,11 @@ -;;; helm-core.el --- Development files for Helm -*- lexical-binding: t; -*- +;;; helm-core.el --- Development files for Helm -*- lexical-binding: t -*- -;; Copyright (C) 2022 Thierry Volpiatto +;; Copyright (C) 2022 ~ 2023 Thierry Volpiatto -;; Author: Thierry Volpiatto +;; Author: Thierry Volpiatto ;; URL: https://emacs-helm.github.io/helm/ -;; Version: 3.8.5 -;; Package-Requires: ((emacs "25.1") (async "1.9.4")) +;; Version: 3.9.3 +;; Package-Requires: ((emacs "25.1") (async "1.9.7")) ;; 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 @@ -23,6 +23,8 @@ ;;; Commentary: ;; Contains the main code for Helm. +;; As a package helm-core provides the files helm-core.el, helm-lib.el, +;; helm-source.el and helm-multi-match.el. ;;; Code: @@ -43,15 +45,155 @@ (declare-function helm-comp-read "helm-mode.el") (declare-function custom-unlispify-tag-name "cus-edit.el") +(declare-function helm-quit-and-find-file "helm-utils.el") +(declare-function linum-mode "linum.el") (defvar helm-marked-buffer-name) +(defvar display-buffer-function) -;; Easy access to customize -;;;###autoload -(defun helm-configuration () - "Customize Helm." - (interactive) - (customize-group "helm")) + +;;; Internal Variables +;; +;; +(defvar helm-source-filter nil + "A list of source names to be displayed. +Other sources won't appear in the search results. +If nil, no filtering is done. +Don't set this directly, use `helm-set-source-filter' during a +Helm session to modify it.") +(defvar helm-saved-action nil + "Saved value of the currently selected action by key.") +(defvar helm-saved-current-source nil + "Value of the current source when the action list is shown.") +(defvar helm-in-persistent-action nil + "Flag whether in persistent-action or not.") +(defvar helm-last-buffer nil + "`helm-buffer' of a previous Helm session.") +(defvar helm-saved-selection nil + "Value of the currently selected object when the action list is shown.") +(defvar helm-sources nil + "[INTERNAL] Value of current sources in use, a list of alists. +The list of sources (symbols or alists) is normalized to alists +in `helm-initialize'.") +(defvar helm-buffer-file-name nil + "Variable `buffer-file-name' when Helm is invoked.") +(defvar helm-candidate-cache (make-hash-table :test 'equal) + "Holds the available candidate within a single Helm invocation.") +(defvar helm--candidate-buffer-alist nil) +(defvar helm-input "" + "The input typed in the candidates panel.") +(defvar helm-input-local nil + "Internal, store locally `helm-pattern' value for later use in `helm-resume'.") +(defvar helm--source-name nil) +(defvar helm-current-source nil) +(defvar helm-issued-errors nil) +(defvar helm--last-log-file nil + "The name of the log file of the last Helm session.") +(defvar helm--local-variables nil) +(defvar helm-split-window-state nil) +(defvar helm--window-side-state nil) +(defvar helm-selection-point nil + "The value of point at selection.") +(defvar helm-alive-p nil) +(defvar helm-visible-mark-overlays nil) +(defvar helm-update-blacklist-regexps '("^" "^ *" "$" "!" " " "\\b" + "\\<" "\\>" "\\_<" "\\_>" ".*" + "??" "?*" "*?" "?")) +(defvar helm--force-updating-p nil + "[INTERNAL] Don't use this in your programs.") +(defvar helm-exit-status 0 + "Flag to inform if Helm did exit or quit. +0 means Helm did exit when executing an action. +1 means Helm did quit with \\[keyboard-quit] +Knowing this exit-status could help restore a window config when +Helm aborts in some special circumstances. See +`helm-exit-minibuffer' and `helm-keyboard-quit'.") +(defvar helm-minibuffer-confirm-state nil) +(defvar helm--quit nil) +(defvar helm-buffers nil + "Helm buffers listed in order of most recently used.") +(defvar helm-current-position nil + "Cons of (point . window-start) when Helm is invoked. +`helm-current-buffer' uses this to restore position after +`helm-keyboard-quit'") +(defvar helm-last-frame-or-window-configuration nil + "Used to store window or frame configuration at Helm start.") +(defvar helm-onewindow-p nil) +(defvar helm-types nil) +(defvar helm--mode-line-string-real nil) ; The string to display in mode-line. +(defvar helm-persistent-action-display-window nil) +(defvar helm-marked-candidates nil + "Marked candidates. List of (source . real) pair.") +(defvar helm--mode-line-display-prefarg nil) +(defvar helm--temp-follow-flag nil + "[INTERNAL] A simple flag to notify persistent action we are following.") +(defvar helm--reading-passwd-or-string nil) +(defvar helm--in-update nil) +(defvar helm--in-fuzzy nil) +(defvar helm-maybe-use-default-as-input nil + "Flag to notify the use of use-default-as-input. +Use only in let-bindings. +Use :default arg of `helm' as input to update display. +Note that if also :input is specified as `helm' arg, it will take +precedence on :default.") +(defvar helm--temp-hooks nil + "Store temporary hooks added by `with-helm-temp-hook'.") +(defvar helm--prompt nil) +(defvar helm--file-completion-sources + '("Find Files" "Read File Name") + "Sources that use the *find-files mechanism can be added here. +Sources generated by `helm-mode' don't need to be added here +because they are automatically added. + +You should not modify this yourself unless you know what you are +doing.") +(defvar helm--completing-file-name nil + "Non nil when `helm-read-file-name' is running. +Used for `helm-file-completion-source-p'.") +;; Same as `ffap-url-regexp' but keep it here to ensure `ffap-url-regexp' is not nil. +(defvar helm--url-regexp "\\`\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)") +(defvar helm--ignore-errors nil + "Flag to prevent Helm popping up errors in candidates functions. +Should be set in candidates functions if needed, and will be +restored at end of session.") +(defvar helm--action-prompt "Select action: ") +(defvar helm--cycle-resume-iterator nil) +(defvar helm--buffer-in-new-frame-p nil) +(defvar helm-initial-frame nil + "[INTERNAL] The selected frame before starting Helm. +Helm use this internally to know in which frame it started, don't +modify this yourself.") +(defvar helm-popup-frame nil + "The frame where Helm is displayed. + +This is only used when Helm is using +`helm-display-buffer-in-own-frame' as `helm-display-function' and +`helm-display-buffer-reuse-frame' is non nil.") +(defvar helm--nested nil) +(defconst helm--frame-default-attributes + '(width height tool-bar-lines left top + title undecorated vertical-scroll-bars + visibility fullscreen menu-bar-lines undecorated + alpha foreground-color background-color) + "Frame parameters to save in `helm--last-frame-parameters'.") +(defvar helm--last-frame-parameters nil + "Frame parameters to save for later resuming. +Local to `helm-buffer'.") +(defvar helm--executing-helm-action nil + "Non nil when action is triggering a new helm-session. +This may be let bounded in other places to notify the display +function to reuse the same frame parameters as the previous Helm +session just like resume would do.") +(defvar helm--current-buffer-narrowed nil) +(defvar helm--suspend-update-interactive-flag nil) +(defvar helm-persistent-action-window-buffer nil + "[INTERNAL] Store the buffer where helm is started. +It is generally `helm-current-buffer', but when this one is displayed +in a dedicated buffer, helm can't start in this window and use another +window handling a buffer, it is this one we store.") +(defvar helm--tramp-archive-maybe-loaded nil) +(defvar helm--original-dedicated-windows-alist nil + "[INTERNAL] Store all dedicated windows with their dedicated state on startup") ;;; Multi keys ;; @@ -97,9 +239,8 @@ Run each function in the FUNCTIONS list in turn when called within DELAY seconds." (declare (indent 1)) (let ((funs functions) - (iter (cl-gensym "helm-iter-key")) + (iter (list nil)) (timeout delay)) - (eval (list 'defvar iter nil)) (lambda () (interactive) (helm-run-multi-key-command funs iter timeout)))) @@ -109,19 +250,16 @@ DELAY seconds." (cl-loop for count from 1 to (length functions) collect count))) next) - (unless (and (symbol-value iterator) + (unless (and (car iterator) ;; Reset iterator when another key is pressed. (eq this-command real-last-command)) - (set iterator (helm-iter-list (funcall fn)))) - (setq next (helm-iter-next (symbol-value iterator))) - (unless next - (set iterator (helm-iter-list (funcall fn))) - (setq next (helm-iter-next (symbol-value iterator)))) - (and next (symbol-value iterator) + (setcar iterator (helm-iter-circular (funcall fn)))) + (setq next (helm-iter-next (car iterator))) + (and next (car iterator) (call-interactively (nth (1- next) functions))) (when delay (run-with-idle-timer delay nil (lambda () - (set iterator nil)))))) + (setcar iterator nil)))))) (helm-multi-key-defun helm-toggle-resplit-and-swap-windows "Multi key command to re-split and swap Helm window. @@ -130,9 +268,58 @@ and second call within 1s runs `helm-swap-windows'." '(helm-toggle-resplit-window helm-swap-windows) 1) (put 'helm-toggle-resplit-and-swap-windows 'helm-only t) +(defun helm-command-with-subkeys (map subkey command + &optional other-subkeys prompt exit-fn delay) + "Build a command that run COMMAND when SUBKEY is read. + +The command runs a loop reading keys and exit when user stops typing after DELAY +seconds. After this DELAY EXIT-FN run if specified. + +Arg OTHER-SUBKEYS should be an alist composed of (command . short-key) where +command is another command than COMMAND bound to short-key. + +A PROMPT can be used to describe bindings of COMMAND and OTHER-SUBKEYS. + +Return an anonymous interactive command to use with +`helm-define-key-with-subkeys'." + (lambda () + (interactive) + (let (timer) + (call-interactively command) + (unless (or defining-kbd-macro executing-kbd-macro) + (unwind-protect + (progn + (when delay + (setq timer (run-with-idle-timer + delay nil (lambda () (keyboard-quit))))) + (while (let ((input (read-key prompt)) other kb com) + (setq last-command-event input) + (cond + ((eq input subkey) + (call-interactively command) + (setq last-command command) + t) + ((setq other (assoc input other-subkeys)) + (call-interactively (cdr other)) + (setq last-command (cdr other)) + t) + (t + (setq kb (vector last-command-event)) + (setq com (lookup-key map kb)) + (if (commandp com) + (call-interactively com) + (setq unread-command-events + (nconc (mapcar #'identity kb) + unread-command-events))) + nil))))) + (when timer (cancel-timer timer)) + (and exit-fn (funcall exit-fn))))))) + ;;;###autoload (defun helm-define-key-with-subkeys (map key subkey command - &optional other-subkeys prompt exit-fn delay) + &optional other-subkeys + prompt exit-fn delay + docstring) "Define in MAP a KEY and SUBKEY to COMMAND. This allows typing KEY to call COMMAND the first time and @@ -162,40 +349,40 @@ in MAP and then exit the loop running EXIT-FN, if specified. If DELAY an integer is specified exit after DELAY seconds. NOTE: SUBKEY and OTHER-SUBKEYS bindings support only char syntax -and vectors, so don't use strings to define them." +and vectors, so don't use strings to define them. While defining +or executing a kbd macro no SUBKEY or OTHER-SUBKEYS are provided, +i.e. the loop is not entered after running COMMAND." (declare (indent 1)) - (define-key map key - (lambda () - (interactive) - (let (timer) - (unwind-protect - (progn - (call-interactively command) - (when delay - (setq timer (run-with-idle-timer - delay nil (lambda () (keyboard-quit))))) - (while (let ((input (read-key prompt)) other kb com) - (setq last-command-event input) - (cond - ((eq input subkey) - (call-interactively command) - (setq last-command command) - t) - ((setq other (assoc input other-subkeys)) - (call-interactively (cdr other)) - (setq last-command (cdr other)) - t) - (t - (setq kb (vector last-command-event)) - (setq com (lookup-key map kb)) - (if (commandp com) - (call-interactively com) - (setq unread-command-events - (nconc (mapcar 'identity kb) - unread-command-events))) - nil))))) - (when timer (cancel-timer timer)) - (and exit-fn (funcall exit-fn))))))) + (let ((fn (helm-command-with-subkeys + map subkey command other-subkeys prompt exit-fn delay)) + (com (intern (format "helm-%s-with-subkeys" + (symbol-name command))))) + (defalias com fn + (or docstring + ;; When no DOCSTRING, generate a basic one specifying + ;; COMMAND, SUBKEY and OTHER-SUBKEYS. + (concat + (format "Run `%s' and bound it to `%s' for subsequent calls." + command (if (numberp subkey) (single-key-description subkey) subkey)) + (if other-subkeys + (helm-basic-docstring-from-alist other-subkeys) + "")))) + (define-key map key com))) + +(defun helm-basic-docstring-from-alist (alist) + (let* ((len (length alist)) + (osk (cl-loop for (k . v) in alist + for count from 1 + for sep = (cond ((and (= count len) (> len 1)) + " and ") + ((> count 1) ",") + (t "")) + for key = (if (numberp k) (single-key-description k) k) + concat (format "%s`%s'" sep key) into ks + concat (format "%s`%s'" sep v) into kv + finally return (list ks kv)))) + (format "\nBound as well %s to %s%s." + (car osk) (if (> len 1) "respectively " "") (cadr osk)))) ;;; Keymap ;; @@ -203,92 +390,98 @@ and vectors, so don't use strings to define them." (defvar helm-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) - (define-key map (kbd "") 'helm-next-line) - (define-key map (kbd "") 'helm-previous-line) - (define-key map (kbd "C-n") 'helm-next-line) - (define-key map (kbd "C-p") 'helm-previous-line) - (define-key map (kbd "") 'helm-follow-action-forward) - (define-key map (kbd "") 'helm-follow-action-backward) - (define-key map (kbd "") 'helm-previous-page) - (define-key map (kbd "") 'helm-next-page) - (define-key map (kbd "M-v") 'helm-scroll-up) - (define-key map (kbd "C-v") 'helm-scroll-down) - (define-key map (kbd "M-<") 'helm-beginning-of-buffer) - (define-key map (kbd "M->") 'helm-end-of-buffer) - (define-key map (kbd "C-g") 'helm-keyboard-quit) - (define-key map (kbd "") 'helm-maybe-exit-minibuffer) - (define-key map (kbd "C-i") 'helm-select-action) - (define-key map (kbd "C-j") 'helm-execute-persistent-action) - (define-key map (kbd "C-o") 'helm-next-source) - (define-key map (kbd "M-o") 'helm-previous-source) - (define-key map (kbd "") 'helm-next-source) - (define-key map (kbd "") 'helm-previous-source) - (define-key map (kbd "C-l") 'helm-recenter-top-bottom-other-window) - (define-key map (kbd "M-C-l") 'helm-reposition-window-other-window) - (define-key map (kbd "C-M-v") 'helm-scroll-other-window) - (define-key map (kbd "M-") 'helm-scroll-other-window) - (define-key map (kbd "C-M-y") 'helm-scroll-other-window-down) - (define-key map (kbd "C-M-S-v") 'helm-scroll-other-window-down) - (define-key map (kbd "M-") 'helm-scroll-other-window-down) - (define-key map (kbd "") 'helm-scroll-other-window) - (define-key map (kbd "") 'helm-scroll-other-window-down) - (define-key map (kbd "C-@") 'helm-toggle-visible-mark) - (define-key map (kbd "C-SPC") 'helm-toggle-visible-mark-forward) - (define-key map (kbd "M-SPC") 'helm-toggle-visible-mark-backward) + (define-key map (kbd "") #'helm-next-line) + (define-key map (kbd "") #'helm-previous-line) + (define-key map (kbd "C-n") #'helm-next-line) + (define-key map (kbd "C-p") #'helm-previous-line) + (define-key map (kbd "") #'helm-follow-action-forward) + (define-key map (kbd "") #'helm-follow-action-backward) + (define-key map (kbd "") #'helm-previous-page) + (define-key map (kbd "") #'helm-next-page) + (define-key map (kbd "M-v") #'helm-scroll-up) + (define-key map (kbd "C-v") #'helm-scroll-down) + (define-key map (kbd "M-<") #'helm-beginning-of-buffer) + (define-key map (kbd "M->") #'helm-end-of-buffer) + (define-key map (kbd "C-g") #'helm-keyboard-quit) + (define-key map (kbd "") #'helm-maybe-exit-minibuffer) + (define-key map (kbd "C-i") #'helm-select-action) + (define-key map (kbd "C-j") #'helm-execute-persistent-action) + (define-key map (kbd "C-o") #'helm-next-source) + (define-key map (kbd "M-o") #'helm-previous-source) + (define-key map (kbd "") #'helm-next-source) + (define-key map (kbd "") #'helm-previous-source) + (define-key map (kbd "C-l") #'helm-recenter-top-bottom-other-window) + (define-key map (kbd "M-C-l") #'helm-reposition-window-other-window) + (define-key map (kbd "C-M-v") #'helm-scroll-other-window) + (define-key map (kbd "M-") #'helm-scroll-other-window) + (define-key map (kbd "C-M-y") #'helm-scroll-other-window-down) + (define-key map (kbd "C-M-S-v") #'helm-scroll-other-window-down) + (define-key map (kbd "M-") #'helm-scroll-other-window-down) + (define-key map (kbd "") #'helm-scroll-other-window) + (define-key map (kbd "") #'helm-scroll-other-window-down) + (define-key map (kbd "C-@") #'helm-toggle-visible-mark) + (define-key map (kbd "C-SPC") #'helm-toggle-visible-mark-forward) + (define-key map (kbd "M-SPC") #'helm-toggle-visible-mark-backward) (define-key map (kbd "M-[") nil) - (define-key map (kbd "M-(") 'helm-prev-visible-mark) - (define-key map (kbd "M-)") 'helm-next-visible-mark) - (define-key map (kbd "C-k") 'helm-delete-minibuffer-contents) - (define-key map (kbd "C-x C-f") 'helm-quit-and-find-file) - (define-key map (kbd "M-m") 'helm-toggle-all-marks) - (define-key map (kbd "M-a") 'helm-mark-all) - (define-key map (kbd "M-U") 'helm-unmark-all) - (define-key map (kbd "C-M-a") 'helm-show-all-candidates-in-source) - (define-key map (kbd "C-M-e") 'helm-display-all-sources) - (define-key map (kbd "C-s") 'undefined) - (define-key map (kbd "M-s") 'undefined) - (define-key map (kbd "C-}") 'helm-narrow-window) - (define-key map (kbd "C-{") 'helm-enlarge-window) - (define-key map (kbd "C-c -") 'helm-swap-windows) - (define-key map (kbd "C-c _") 'helm-toggle-full-frame) - (define-key map (kbd "C-c %") 'helm-exchange-minibuffer-and-header-line) - (define-key map (kbd "C-c C-y") 'helm-yank-selection) - (define-key map (kbd "C-c C-k") 'helm-kill-selection-and-quit) - (define-key map (kbd "C-c C-i") 'helm-insert-or-copy) - (define-key map (kbd "C-c C-f") 'helm-follow-mode) - (define-key map (kbd "C-c C-u") 'helm-refresh) - (define-key map (kbd "C-c >") 'helm-toggle-truncate-line) - (define-key map (kbd "C-c l") 'helm-display-line-numbers-mode) - (define-key map (kbd "M-p") 'previous-history-element) - (define-key map (kbd "M-n") 'next-history-element) - (define-key map (kbd "C-!") 'helm-toggle-suspend-update) - (define-key map (kbd "C-x b") 'helm-resume-previous-session-after-quit) - (define-key map (kbd "C-x C-b") 'helm-resume-list-buffers-after-quit) - (helm-define-key-with-subkeys map (kbd "C-c n") ?n 'helm-run-cycle-resume) + (define-key map (kbd "M-(") #'helm-prev-visible-mark) + (define-key map (kbd "M-)") #'helm-next-visible-mark) + (define-key map (kbd "C-k") #'helm-delete-minibuffer-contents) + (define-key map (kbd "C-x C-f") #'helm-quit-and-find-file) + (define-key map (kbd "M-m") #'helm-toggle-all-marks) + (define-key map (kbd "M-a") #'helm-mark-all) + (define-key map (kbd "M-U") #'helm-unmark-all) + (define-key map (kbd "C-M-a") #'helm-show-all-candidates-in-source) + (define-key map (kbd "C-M-e") #'helm-display-all-sources) + (define-key map (kbd "C-s") #'undefined) + (define-key map (kbd "M-s") #'undefined) + (define-key map (kbd "C-r") #'undefined) + (define-key map (kbd "C-M-r") #'undefined) + (define-key map (kbd "C-M-s") #'undefined) + (define-key map (kbd "C-z") #'undefined) + (define-key map (kbd "C-}") #'helm-narrow-window) + (define-key map (kbd "C-{") #'helm-enlarge-window) + (define-key map (kbd "C-c -") #'helm-swap-windows) + (define-key map (kbd "C-c _") #'helm-toggle-full-frame) + (define-key map (kbd "C-c %") #'helm-exchange-minibuffer-and-header-line) + (define-key map (kbd "C-c C-y") #'helm-yank-selection) + (define-key map (kbd "C-c C-k") #'helm-kill-selection-and-quit) + (define-key map (kbd "C-c C-i") #'helm-insert-or-copy) + (define-key map (kbd "C-c C-f") #'helm-follow-mode) + (define-key map (kbd "C-c C-u") #'helm-refresh) + (define-key map (kbd "C-c >") #'helm-toggle-truncate-line) + (define-key map (kbd "C-c l") #'helm-display-line-numbers-mode) + (define-key map (kbd "M-p") #'previous-history-element) + (define-key map (kbd "M-n") #'next-history-element) + ;; Unbind `previous-matching-history-element' which is non sense for helm. + (define-key map (kbd "M-r") #'undefined) + (define-key map (kbd "C-!") #'helm-toggle-suspend-update) + (define-key map (kbd "C-x b") #'helm-resume-previous-session-after-quit) + (define-key map (kbd "C-x C-b") #'helm-resume-list-buffers-after-quit) + (helm-define-key-with-subkeys map (kbd "C-c n") ?n #'helm-run-cycle-resume) ;; Disable `file-cache-minibuffer-complete'. - (define-key map (kbd "") 'undefined) + (define-key map (kbd "") #'undefined) ;; Multi keys - (define-key map (kbd "C-t") 'helm-toggle-resplit-and-swap-windows) + (define-key map (kbd "C-t") #'helm-toggle-resplit-and-swap-windows) ;; Debugging command - (define-key map (kbd "C-h C-d") 'helm-enable-or-switch-to-debug) - (define-key map (kbd "C-h c") 'helm-customize-group) + (define-key map (kbd "C-h C-d") #'helm-enable-or-switch-to-debug) + (define-key map (kbd "C-h c") #'helm-customize-group) ;; Allow to eval keymap without errors. (define-key map [f1] nil) - (define-key map (kbd "C-h C-h") 'undefined) - (define-key map (kbd "C-h h") 'undefined) + (define-key map (kbd "C-h C-h") #'undefined) + (define-key map (kbd "C-h h") #'undefined) (helm-define-key-with-subkeys map - (kbd "C-w") ?\C-w 'helm-yank-text-at-point + (kbd "C-w") ?\C-w #'helm-yank-text-at-point '((?\C-_ . helm-undo-yank-text-at-point))) ;; Use `describe-mode' key in `global-map'. - (cl-dolist (k (where-is-internal 'describe-mode global-map)) - (define-key map k 'helm-help)) - (define-key map (kbd "C-c ?") 'helm-help) - ;; Bind all actions from 1 to 12 to their corresponding nth index+1. - (cl-loop for n from 0 to 12 do - (define-key map (kbd (format "" (1+ n))) - `(lambda () - (interactive) - (helm-select-nth-action ,n)))) + (dolist (k (where-is-internal #'describe-mode global-map)) + (define-key map k #'helm-help)) + ;; Bind all actions from f1 to f12, `helm-select-nth-action' + ;; counts from 0, i.e. (helm-select-nth-action 0) = action 1. + (dotimes (n 12) + (define-key map (kbd (format "" (1+ n))) + (lambda () + (interactive) + (helm-select-nth-action n)))) map) "Keymap for helm.") @@ -309,19 +502,26 @@ and vectors, so don't use strings to define them." Default to Helm group when group is not defined in source." (interactive) - (helm-run-after-exit 'helm-customize-group-1 (helm-get-attr 'group))) + (let ((source (or (helm-get-current-source) + (helm-comp-read + "Customize variables for: " + (cl-loop for src in (with-helm-buffer helm-sources) + collect `(,(assoc-default 'name src) . + ,src)) + :allow-nest t + :exec-when-only-one t)))) + (helm-run-after-exit 'helm-customize-group-1 (helm-get-attr 'group source)))) (put 'helm-customize-group 'helm-only t) (defun helm--action-at-nth-set-fn-1 (value &optional negative) - (cl-loop for n from 1 to 9 - for key = (format value n) - for sym = (make-symbol (format "helm-execute-selection-action-at-nth-+%d" n)) - for fn = `(lambda () - (interactive) - (helm-execute-selection-action-at-nth ,(if negative (- n) n))) - do (progn - (defalias sym fn) - (define-key helm-map (kbd key) sym)))) + (dotimes (n 9) + (let ((key (format value (1+ n))) + (fn (lambda () + (interactive) + (helm-execute-selection-action-at-nth + (if negative (- (1+ n)) (1+ n)))))) + (define-key helm-map (kbd key) nil) + (define-key helm-map (kbd key) fn)))) (defun helm--action-at-nth-set-fn- (var val) (set var val) @@ -360,6 +560,13 @@ customize for immediate effect." "Open Helm." :prefix "helm-" :group 'convenience) +;; Easy access to customize +;;;###autoload +(defun helm-configuration () + "Customize Helm." + (interactive) + (customize-group "helm")) + (defcustom helm-completion-window-scroll-margin 5 "`scroll-margin' to use for Helm completion window. Set to 0 to disable. @@ -381,7 +588,7 @@ NOTE: When non-nil (default), disable :group 'helm :type 'boolean) -(defcustom helm-candidate-number-limit 100 +(defcustom helm-candidate-number-limit 50 "Global limit for number of candidates displayed. When the pattern is empty, the number of candidates shown will be as set here instead of the entire list, which may be hundreds or @@ -491,6 +698,16 @@ the same window scheme as the previous session unless :group 'helm :type 'boolean) +(defcustom helm-split-width-threshold nil + "The value of `split-width-threshold' for helm windows. +This affect the behavior of `helm-split-window-default-fn'. +When the value is an integer, `split-window-sensibly' is used inconditionally +and all the helm variables that affect window splitting are ignored." + :group 'helm + :type '(choice + (const :tag "Maybe use `split-window-sensibly'" nil) + (integer :tag "Inconditionally use `split-window-sensibly'"))) + (defcustom helm-split-window-preferred-function 'helm-split-window-default-fn "Default function used for splitting window." :group 'helm @@ -704,8 +921,10 @@ This applies when using `helm-next/previous-line'." :group 'helm :type 'function) -(defcustom helm-fuzzy-matching-highlight-fn 'helm-fuzzy-default-highlight-match - "The function to highlight fuzzy matches." +(defcustom helm-fuzzy-matching-highlight-fn #'helm-fuzzy-default-highlight-match + "The function to highlight fuzzy matches. +The function must have the same signature as +`helm-fuzzy-default-highlight-match' which is the default." :group 'helm :type 'function) @@ -740,7 +959,9 @@ update Helm." (const :tag "Provide guidance only for complex methods" complex-only))) (defcustom helm-display-header-line t - "Display header-line when non nil." + "Display header-line when non nil. +It has to be non nil when you want to display minibuffer contents in there with +`helm-echo-input-in-header-line'." :group 'helm :type 'boolean) @@ -752,7 +973,9 @@ The default is to enable this by default and then toggle :type 'boolean) (defcustom helm-echo-input-in-header-line nil - "Send current input to header-line when non-nil." + "Send current input to header-line when non-nil. +Note that `helm-display-header-line' has to be non nil as well for this to take +effect." :group 'helm :type 'boolean) @@ -790,16 +1013,6 @@ Only async sources than use a sentinel calling :type 'integer :group 'helm) -(defcustom helm-debug-root-directory nil - "When non-nil, save Helm log messages to a file in this directory. -When nil log messages are saved to a buffer instead. Log message -are saved only when `helm-debug' is non-nil, so setting this -doesn't enable debugging by itself. - -See `helm-log-save-maybe' for more info." - :type 'string - :group 'helm) - (defcustom helm-show-action-window-other-window nil "Show action buffer beside `helm-buffer' when non-nil. @@ -1147,18 +1360,12 @@ It is either a string or a list of two string arguments where the first string is the name and the second string is displayed in the mode-line. When nil, it defaults to `mode-line-format'.") -(defvar helm-minibuffer-set-up-hook nil +(defvar helm-minibuffer-set-up-hook '(helm-hide-minibuffer-maybe) "Hook that runs at minibuffer initialization. A hook useful for modifying minibuffer settings in Helm. -An example that hides the minibuffer when using -`helm-echo-input-in-header-line': - - (add-hook \\='helm-minibuffer-set-up-hook #'helm-hide-minibuffer-maybe) - -Note that we check `helm-echo-input-in-header-line' value -from `helm-buffer' which allows detecting possible local -value of this var.") +Uses `helm-hide-minibuffer-maybe' by default which hide minibuffer contents with +header-line contents when `helm-echo-input-in-header-line' is non nil.") (defvar helm-help-message "* Helm Generic Help @@ -1465,8 +1672,10 @@ slow frame popup in Emacs-26, to workaround this slowness in Emacs-26 use instea #+end_src WARNING: -There is a package called posframe and also one called helm-posframe, +There is a package called Posframe and also one called Helm-posframe, you DO NOT need these packages to display helm buffers in frames. +Thus Posframe package use child frames which have no minibuffers +and are by the way not compatible with Helm. ** Helm's basic operations and default key bindings @@ -1705,9 +1914,7 @@ use \\\\[helm-toggle-suspend-update] to turn off updating. When you are ready turn it on again to resume logging. Once you exit your Helm session you can access the debug buffer -with `helm-debug-open-last-log'. It is possible to save logs to -dated files when `helm-debug-root-directory' is set to a valid -directory. +with `helm-debug-open-last-log'. Note: Be aware that Helm log buffers grow really fast, so use `helm-debug' only when needed. @@ -1768,155 +1975,16 @@ The hook should takes one arg SOURCES.") ;; See bug#2503. (defvar helm-process-output-split-string-separator "\n" "Separator to use when splitting helm async output.") - -;;; Internal Variables -;; -;; -(defvar helm-source-filter nil - "A list of source names to be displayed. -Other sources won't appear in the search results. -If nil, no filtering is done. -Don't set this directly, use `helm-set-source-filter' during a -Helm session to modify it.") -(defvar helm-saved-action nil - "Saved value of the currently selected action by key.") -(defvar helm-saved-current-source nil - "Value of the current source when the action list is shown.") -(defvar helm-in-persistent-action nil - "Flag whether in persistent-action or not.") -(defvar helm-last-buffer nil - "`helm-buffer' of a previous Helm session.") -(defvar helm-saved-selection nil - "Value of the currently selected object when the action list is shown.") -(defvar helm-sources nil - "[INTERNAL] Value of current sources in use, a list of alists. -The list of sources (symbols or alists) is normalized to alists -in `helm-initialize'.") -(defvar helm-buffer-file-name nil - "Variable `buffer-file-name' when Helm is invoked.") -(defvar helm-candidate-cache (make-hash-table :test 'equal) - "Holds the available candidate within a single Helm invocation.") -(defvar helm--candidate-buffer-alist nil) -(defvar helm-input "" - "The input typed in the candidates panel.") -(defvar helm-input-local nil - "Internal, store locally `helm-pattern' value for later use in `helm-resume'.") -(defvar helm--source-name nil) -(defvar helm-current-source nil) -(defvar helm-issued-errors nil) -(defvar helm--last-log-file nil - "The name of the log file of the last Helm session.") -(defvar helm--local-variables nil) -(defvar helm-split-window-state nil) -(defvar helm--window-side-state nil) -(defvar helm-selection-point nil - "The value of point at selection.") -(defvar helm-alive-p nil) -(defvar helm-visible-mark-overlays nil) -(defvar helm-update-blacklist-regexps '("^" "^ *" "$" "!" " " "\\b" - "\\<" "\\>" "\\_<" "\\_>" ".*" - "??" "?*" "*?" "?")) -(defvar helm--force-updating-p nil - "[INTERNAL] Don't use this in your programs.") -(defvar helm-exit-status 0 - "Flag to inform if Helm did exit or quit. -0 means Helm did exit when executing an action. -1 means Helm did quit with \\[keyboard-quit] -Knowing this exit-status could help restore a window config when -Helm aborts in some special circumstances. See -`helm-exit-minibuffer' and `helm-keyboard-quit'.") -(defvar helm-minibuffer-confirm-state nil) -(defvar helm--quit nil) -(defvar helm-buffers nil - "Helm buffers listed in order of most recently used.") -(defvar helm-current-position nil - "Cons of (point . window-start) when Helm is invoked. -`helm-current-buffer' uses this to restore position after -`helm-keyboard-quit'") -(defvar helm-last-frame-or-window-configuration nil - "Used to store window or frame configuration at Helm start.") -(defvar helm-onewindow-p nil) -(defvar helm-types nil) -(defvar helm--mode-line-string-real nil) ; The string to display in mode-line. -(defvar helm-persistent-action-display-window nil) -(defvar helm-marked-candidates nil - "Marked candidates. List of (source . real) pair.") -(defvar helm--mode-line-display-prefarg nil) -(defvar helm--temp-follow-flag nil - "[INTERNAL] A simple flag to notify persistent action we are following.") -(defvar helm--reading-passwd-or-string nil) -(defvar helm--in-update nil) -(defvar helm--in-fuzzy nil) -(defvar helm-maybe-use-default-as-input nil - "Flag to notify the use of use-default-as-input. -Use only in let-bindings. -Use :default arg of `helm' as input to update display. -Note that if also :input is specified as `helm' arg, it will take -precedence on :default.") -(defvar helm--temp-hooks nil - "Store temporary hooks added by `with-helm-temp-hook'.") -(defvar helm--prompt nil) -(defvar helm--file-completion-sources - '("Find Files" "Read File Name") - "Sources that use the *find-files mechanism can be added here. -Sources generated by `helm-mode' don't need to be added here -because they are automatically added. -You should not modify this yourself unless you know what you are -doing.") -(defvar helm--completing-file-name nil - "Non nil when `helm-read-file-name' is running. -Used for `helm-file-completion-source-p'.") -;; Same as `ffap-url-regexp' but keep it here to ensure `ffap-url-regexp' is not nil. -(defvar helm--url-regexp "\\`\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)") -(defvar helm--ignore-errors nil - "Flag to prevent Helm popping up errors in candidates functions. -Should be set in candidates functions if needed, and will be -restored at end of session.") -(defvar helm--action-prompt "Select action: ") -(defvar helm--cycle-resume-iterator nil) -(defvar helm--buffer-in-new-frame-p nil) -(defvar helm-initial-frame nil - "[INTERNAL] The selected frame before starting Helm. -Helm use this internally to know in which frame it started, don't -modify this yourself.") -(defvar helm-popup-frame nil - "The frame where Helm is displayed. - -This is only used when Helm is using -`helm-display-buffer-in-own-frame' as `helm-display-function' and -`helm-display-buffer-reuse-frame' is non nil.") -(defvar helm--nested nil) -(defconst helm--frame-default-attributes - '(width height tool-bar-lines left top - title undecorated vertical-scroll-bars - visibility fullscreen menu-bar-lines undecorated - alpha foreground-color background-color) - "Frame parameters to save in `helm--last-frame-parameters'.") -(defvar helm--last-frame-parameters nil - "Frame parameters to save for later resuming. -Local to `helm-buffer'.") -(defvar helm--executing-helm-action nil - "Non nil when action is triggering a new helm-session. -This may be let bounded in other places to notify the display -function to reuse the same frame parameters as the previous Helm -session just like resume would do.") -(defvar helm--current-buffer-narrowed nil) -(defvar helm--suspend-update-interactive-flag nil) -(defvar helm-persistent-action-window-buffer nil - "[INTERNAL] Store the buffer where helm is started. -It is generally `helm-current-buffer', but when this one is displayed -in a dedicated buffer, helm can't start in this window and use another -window handling a buffer, it is this one we store.") -(defvar helm--tramp-archive-maybe-loaded nil) -(defvar helm--original-dedicated-windows-alist nil - "[INTERNAL] Store all dedicated windows with their dedicated state on startup") +(defvar helm-last-query "" + "The value of `helm-pattern' is stored here exit or quit.") ;; Utility: logging -(defun helm-log (format-string &rest args) - "Log message `helm-debug' is non-nil. +(defun helm-log (from format-string &rest args) + "Log message if `helm-debug' is non-nil. Messages are written to the `helm-debug-buffer' buffer. +FROM is the place from where it is called. Argument FORMAT-STRING is a string to use with `format'. Use optional arguments ARGS like in `format'." (when helm-debug @@ -1925,79 +1993,33 @@ Use optional arguments ARGS like in `format'." (buffer-disable-undo) (let ((inhibit-read-only t)) (goto-char (point-max)) - (insert (let ((tm (time-convert nil 'list))) + (insert (let ((tm (current-time))) (format (concat (if (string-match "Start session" format-string) "* " "** ") "%s.%06d (%s)\n %s\n") (format-time-string "%H:%M:%S" tm) (nth 2 tm) - (helm-log-get-current-function) + from (apply #'format (cons format-string args))))))))) -(defun helm-log-run-hook (hook) - "Run HOOK like `run-hooks' but write these actions to Helm log buffer." - (helm-log "Executing %s with value = %S" hook (symbol-value hook)) - (helm-log "Executing %s with global value = %S" hook (default-value hook)) +(defun helm-log-run-hook (from hook) + "Run HOOK like `run-hooks' and log these actions to Helm log buffer. +FROM is the place from where it is called." + (helm-log from "Executing %s with value = %S" hook (symbol-value hook)) + (helm-log from "Executing %s with global value = %S" hook (default-value hook)) (run-hooks hook) - (helm-log "executed %s" hook)) - -(defvar helm--log-exclude-functions '(helm-interpret-value - helm-log - helm-log-get-current-function - helm-log-error - helm-log-save-maybe - helm-log-run-hook - helm-apply-functions-from-source - helm-funcall-with-source helm-funcall-foreach - helm-compute-attr-in-sources)) -(defun helm-log-get-current-function () - "Get name of function calling `helm-log'." - (cl-loop for btn from 1 to 40 - for btf = (cl-second (backtrace-frame btn)) - for fn = (if (symbolp btf) (symbol-name btf) "") - if (and (string-match "\\`helm" fn) - (not (memq btf helm--log-exclude-functions))) - return fn)) - -(defun helm-log-error (&rest args) + (helm-log from "executed %s" hook)) + +(defun helm-log-error (from &rest args) "Accumulate error messages into `helm-issued-errors'. +FROM is the place from where it is called. ARGS are args given to `format'. E.g. (helm-log-error \"Error %s: %s\" (car err) (cdr err))." - (apply 'helm-log (concat "ERROR: " (car args)) (cdr args)) + (apply 'helm-log from (concat "ERROR: " (car args)) (cdr args)) (let ((msg (apply 'format args))) (unless (member msg helm-issued-errors) (cl-pushnew msg helm-issued-errors :test 'equal)))) -(defun helm-log-save-maybe () - "Save log buffer when `helm-debug-root-directory' is non nil. -Create `helm-debug-root-directory' directory if necessary. -Messages are logged to a file named with today's date and time in -this directory." - (when (and (stringp helm-debug-root-directory) - (not (file-directory-p helm-debug-root-directory))) - (make-directory helm-debug-root-directory t)) - (when helm-debug - (let ((logdir (expand-file-name (concat "helm-debug-" - (format-time-string "%Y%m%d")) - helm-debug-root-directory))) - (make-directory logdir t) - (with-current-buffer (get-buffer-create helm-debug-buffer) - (goto-char (point-max)) - (insert "\ - - -Local Variables: -mode: outline -End:") - (write-region (point-min) (point-max) - (setq helm--last-log-file - (expand-file-name - (format-time-string "%Y%m%d-%H%M%S") - logdir)) - nil 'silent) - (kill-buffer)))) - (setq helm-debug nil)) - ;;;###autoload (defun helm-debug-open-last-log () "Open Helm log file or buffer of last Helm session." @@ -2074,6 +2096,52 @@ End:") (helm-set-local-variable 'helm-display-function 'helm-display-buffer-in-own-frame) ,@body)) + +(defmacro helm-make-command-from-action (symbol doc action &rest body) + "Make a command SYMBOL from ACTION with docstring DOC. +The command SYMBOL will quit helm before execute. +Argument ACTION should be an existing helm action. +BODY form will run before calling action. + +Example: + + (helm-make-command-from-action foo-command + \"Docstring\" + \\='foo-action + (run body)) + +will produce a command like this: + + (defun foo-command () + \"docstring\" + (interactive) + (with-helm-alive-p + (run body) + (helm-exit-and-execute-action \\='foo-action))) + +And automatically put the symbol \\='helm-only on SYMBOL." + (declare (indent defun) (debug t)) + `(progn + (defun ,symbol () + ,doc + (interactive) + (with-helm-alive-p + (progn ,@body) + (helm-exit-and-execute-action ,action))) + (put ',symbol 'helm-only t))) + +(defmacro helm-make-persistent-command-from-action (symbol doc psymbol action) + "Make a persistent command SYMBOL bound to PSYMBOL from ACTION." + (declare (indent defun) (debug t)) + `(progn + (defun ,symbol () + ,doc + (interactive) + (with-helm-alive-p + (helm-set-attr ,psymbol (cons ,action 'never-split)) + (helm-execute-persistent-action ,psymbol))) + (put ',symbol 'helm-only t))) + ;;; helm-attributes ;; @@ -2186,11 +2254,12 @@ when predicate helm-ff-candidates-lisp-p returns non-nil: (let* ((actions (helm-get-attr 'action source 'ignorefn)) (action-transformers (helm-get-attr 'action-transformer source)) (new-action (list (cons name fn))) - (transformer (lambda (actions candidate) - (cond ((funcall predicate candidate) - (helm-append-at-nth - actions new-action index)) - (t actions))))) + (transformer (lambda (actions _candidate) + (let ((candidate (car (helm-marked-candidates)))) + (cond ((funcall predicate candidate) + (helm-append-at-nth + actions new-action index)) + (t actions)))))) (when (functionp actions) (helm-set-attr 'action (list (cons "Default action" actions)) source)) (when (or (symbolp action-transformers) (functionp action-transformers)) @@ -2239,7 +2308,7 @@ existing Helm function names." (let ((cur-disp-sel (helm-get-selection nil t))) (set (make-local-variable 'helm-source-filter) (helm--normalize-filter-sources sources)) - (helm-log "helm-source-filter = %S" helm-source-filter) + (helm-log "helm-set-source-filter" "helm-source-filter = %S" helm-source-filter) ;; Use force-update to run init/update functions. (helm-update (and (stringp cur-disp-sel) (regexp-quote cur-disp-sel)))))) @@ -2257,10 +2326,39 @@ If NO-INIT is non-nil, skip executing init functions of SOURCES. If NO-UPDATE is non-nil, skip executing `helm-update'." (with-current-buffer helm-buffer (setq helm-sources (helm-get-sources sources)) - (helm-log "helm-sources = %S" helm-sources)) + (helm-log "helm-set-sources" "helm-sources = %S" helm-sources)) (unless no-init (helm-compute-attr-in-sources 'init)) (unless no-update (helm-update))) +(defun helm-show-all-candidates-in-source (arg) + "Toggle all or only candidate-number-limit cands in current source. +With a numeric prefix arg show only the ARG number of candidates. +The prefix arg has no effect when toggling to only +candidate-number-limit." + (interactive "p") + (with-helm-alive-p + (with-helm-buffer + (if helm-source-filter + (progn + (setq-local helm-candidate-number-limit + (default-value 'helm-candidate-number-limit)) + (helm-set-source-filter nil)) + (with-helm-default-directory (helm-default-directory) + (setq-local helm-candidate-number-limit (and (> arg 1) arg)) + (helm-set-source-filter + (list (helm-get-current-source)))))))) +(put 'helm-show-all-candidates-in-source 'helm-only t) + +(defun helm-display-all-sources () + "Display all sources previously hidden by `helm-set-source-filter'." + (interactive) + (with-helm-alive-p + (helm-set-source-filter nil))) +(put 'helm-display-all-sources 'helm-only t) + + +;;; Source infos fns. +;; (defun helm-get-selection (&optional buffer force-display-part source) "Return the currently selected candidate from BUFFER. @@ -2304,7 +2402,7 @@ when you want the `display-to-real' function(s) to be applied." (helm-apply-functions-from-source source it disp)) (t disp)))) (unless (equal selection "") - (helm-log "selection = %S" selection) + (helm-log "helm-get-selection" "selection = %S" selection) selection))))) (defun helm-get-actions-from-current-source (&optional source) @@ -2324,9 +2422,7 @@ of (action-display . function)." ;; type so that the actions added by transformer fit with ;; all marked (previously we were looping on each marked ;; but it is too costly for the benefit it brings). - (if marked - (car marked) - (helm-get-selection nil nil src))) + (car marked)) actions)))) (defun helm-get-current-source () @@ -2359,8 +2455,8 @@ Use this on commands invoked from key bindings, but not on action functions invoked as action from the action menu, i.e. functions called with RET." (helm-kill-async-processes) - (helm-log "function = %S" function) - (helm-log "args = %S" args) + (helm-log "helm-run-after-exit" "function = %S" function) + (helm-log "helm-run-after-exit" "args = %S" args) (helm-exit-and-execute-action (lambda (_candidate) (apply function args)))) @@ -2378,7 +2474,7 @@ i.e. functions called with RET." ;; source that inherit actions from type, note that ACTION have to ;; be bound to a symbol and not to be an anonymous action ;; i.e. lambda or byte-code. - (helm-log "Start executing action") + (helm-log "helm-exit-and-execute-action" "Start executing action") (let ((actions (helm-get-actions-from-current-source))) (when actions (cl-assert (or (eq action actions) @@ -2501,7 +2597,7 @@ was deleted and the candidates list not updated." (with-helm-window (or (helm-empty-buffer-p) (and (helm-end-of-source-p) - (eq (point-at-bol) (point-at-eol)) + (eq (pos-bol) (pos-eol)) (or (save-excursion (forward-line -1) @@ -2522,8 +2618,8 @@ This function is also used to process functions called with no args, e.g. init functions. In this case it is called without ARGS. See `helm-process-filtered-candidate-transformer' -\`helm-compute-attr-in-sources' and -\`helm-process-candidate-transformer'. + `helm-compute-attr-in-sources' + `helm-process-candidate-transformer'. Arg FUNCTIONS is either a symbol or a list of functions, each function being applied on ARGS and called on the result of the @@ -2533,11 +2629,11 @@ precedent function. Return the result of last function call." (funs (if (functionp functions) (list functions) functions))) (cl-loop with result for fn in funs - do (setq result (apply fn args)) - when (and args (cdr funs)) ;; In filter functions, ARGS is a list of one or two elements where ;; the first element is the list of candidates and the second ;; a list containing the source. + do (setq result (apply fn args)) + when (and args (cdr funs)) ;; When more than one fn, set the candidates list to what returns ;; this fn to compute the modified candidates with the next fn ;; and so on. @@ -2556,7 +2652,7 @@ precedent function. Return the result of last function call." ;; `helm-sources' are local to helm-buffer. (with-helm-buffer helm-sources))))) (when sources - (cl-dolist (source sources) + (dolist (source sources) (helm-aif (assoc-default attr source) (helm-apply-functions-from-source source it)))))) @@ -2598,7 +2694,7 @@ of current source only." (or (helm-pos-header-line-p) (eobp)) (eobp))) ;; Don't count empty lines maybe added by popup (bug#1370). - unless (or (eq (point-at-bol) (point-at-eol)) + unless (or (eq (pos-bol) (pos-eol)) (helm-pos-header-line-p)) do (cl-incf ln) do (forward-line 1) finally return ln)))))) @@ -2850,13 +2946,13 @@ HISTORY args see `helm'." ;; Ensure linum-mode is disabled in Helm buffers to preserve ;; performances (Bug#1894). (advice-add 'linum-on :override #'helm--advice-linum-on '((depth . 100)))) - (helm-log (concat "[Start session] " (make-string 41 ?+))) - (helm-log "prompt = %S" prompt) - (helm-log "preselect = %S" preselect) - (helm-log "buffer = %S" buffer) - (helm-log "keymap = %S" keymap) - (helm-log "default = %S" default) - (helm-log "history = %S" history) + (helm-log "helm-internal" (concat "[Start session] " (make-string 41 ?+))) + (helm-log "helm-internal" "prompt = %S" prompt) + (helm-log "helm-internal" "preselect = %S" preselect) + (helm-log "helm-internal" "buffer = %S" buffer) + (helm-log "helm-internal" "keymap = %S" keymap) + (helm-log "helm-internal" "default = %S" default) + (helm-log "helm-internal" "history = %S" history) (setq helm--prompt (or prompt "pattern: ")) (let ((non-essential t) ;; Prevent mouse jumping to the upper-right @@ -2865,6 +2961,9 @@ HISTORY args see `helm'." focus-follows-mouse mode-line-in-non-selected-windows minibuffer-completion-confirm + (ori--minibuffer-follows-selected-frame + (and (boundp 'minibuffer-follows-selected-frame) + (default-toplevel-value 'minibuffer-follows-selected-frame))) (input-method-verbose-flag helm-input-method-verbose-flag) (helm-maybe-use-default-as-input (and (null input) @@ -2882,6 +2981,22 @@ HISTORY args see `helm'." (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) + ;; This allows giving the focus to a nested helm session which use + ;; a frame, like completion in + ;; `helm-eval-expression'. Unfortunately + ;; `minibuffer-follows-selected-frame' is available only in + ;; emacs-28+ (bug#2536). + ;; When non-nil (the default) the current active + ;; minibuffer is used in new frame, which is not what we + ;; want in helm when starting from an active minibuffer, + ;; either a helm minibuffer or something line M-:. + (and ori--minibuffer-follows-selected-frame + (setq minibuffer-follows-selected-frame + (unless (or helm--nested + ;; Allow keeping initial minibuffer visible + ;; e.g. completion-at-point from M-:. + (minibufferp helm-current-buffer)) + t))) ;; We don't display helm-buffer here to avoid popping ;; up a window or a frame when exiting immediately when ;; only one candidate (this avoid having the helm frame @@ -2903,7 +3018,7 @@ HISTORY args see `helm'." ;; until a key is hitted (Bug#1670). (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) - (helm-log "show prompt") + (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect @@ -2911,20 +3026,23 @@ HISTORY args see `helm'." (helm-cleanup)) (prog1 (unless helm--quit (helm-execute-selection-action)) - (helm-log (concat "[End session] " (make-string 41 ?-))))) + (helm-log "helm-internal" (concat "[End session] " (make-string 41 ?-))))) (quit (helm-restore-position-on-quit) - (helm-log-run-hook 'helm-quit-hook) - (helm-log (concat "[End session (quit)] " (make-string 34 ?-))) + (helm-log-run-hook "helm-internal" 'helm-quit-hook) + (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 ?-))) nil)) (when (fboundp 'advice-remove) (advice-remove 'tramp-read-passwd #'helm--suspend-read-passwd) (advice-remove 'ange-ftp-get-passwd #'helm--suspend-read-passwd) (advice-remove 'epa-passphrase-callback-function #'helm--suspend-read-passwd) (advice-remove 'linum-on #'helm--advice-linum-on)) - (helm-log "helm-alive-p = %S" (setq helm-alive-p nil)) + (helm-log "helm-internal" "helm-alive-p = %S" (setq helm-alive-p nil)) (helm--remap-mouse-mode -1) ; Reenable mouse bindings. (setq helm-alive-p nil) + (and ori--minibuffer-follows-selected-frame + (set-default-toplevel-value 'minibuffer-follows-selected-frame + ori--minibuffer-follows-selected-frame)) ;; Prevent error "No buffer named *helm*" triggered by ;; `helm-set-local-variable'. (setq helm--force-updating-p nil) @@ -2932,8 +3050,8 @@ HISTORY args see `helm'." ;; Reset helm-pattern so that lambda's using it ;; before running helm will not start with its old value. (setq helm-pattern "") - (setq helm--ignore-errors nil) - (helm-log-save-maybe)))) + (setq helm--ignore-errors nil + helm-debug nil)))) (defun helm--advice-linum-on () (unless (or (minibufferp) @@ -3079,12 +3197,6 @@ Return nil if no `helm-buffer' found." (put 'helm-run-cycle-resume 'helm-only t) -;;;###autoload -(defun helm-other-buffer (sources buffer) - "Simplified Helm interface with other `helm-buffer'. -Call `helm' only with SOURCES and BUFFER as args." - (helm :sources sources :buffer buffer)) - ;;; Nested sessions ;; ;; @@ -3107,7 +3219,7 @@ Don't use this directly, use instead `helm' with the keyword (orig-helm-last-frame-or-window-configuration helm-last-frame-or-window-configuration) (orig-one-window-p helm-onewindow-p) - (helm--nested t)) + (helm--nested (if helm--buffer-in-new-frame-p 'share t))) ;; FIXME Using helm-full-frame here allow showing the new ;; helm-buffer in the same window as old helm-buffer, why? (helm-set-local-variable 'helm-full-frame t) @@ -3154,35 +3266,15 @@ Don't use this directly, use instead `helm' with the keyword (helm-display-mode-line (helm-get-current-source))))))) -;;; Accessors +;;; Windows and frames +;; ;; -(defun helm-current-position (save-or-restore) - "Save or restore current position in `helm-current-buffer'. -Argument SAVE-OR-RESTORE is either save or restore." - (cl-case save-or-restore - (save - (helm-log "Save position at %S" (cons (point) (window-start))) - (setq helm-current-position (cons (point) (window-start)))) - (restore - ;; Maybe `helm-current-buffer' have been deleted - ;; during helm session so check if it is here - ;; otherwise position in underlying buffer will be lost. - (when (get-buffer-window helm-current-buffer 'visible) - (helm-log "Restore position at %S in buffer %s" - helm-current-position - (buffer-name (current-buffer))) - (goto-char (car helm-current-position)) - ;; Fix this position with the NOFORCE arg of `set-window-start' - ;; otherwise, if there is some other buffer than `helm-current-buffer' - ;; one, position will be lost. - (set-window-start (selected-window) (cdr helm-current-position) t))))) - (defun helm-frame-or-window-configuration (save-or-restore) "Save or restore last frame or window configuration. Argument SAVE-OR-RESTORE is either save or restore of window or frame configuration as per `helm-save-configuration-functions'." - (helm-log "helm-save-configuration-functions = %S" + (helm-log "helm-frame-or-window-configuration" "helm-save-configuration-functions = %S" helm-save-configuration-functions) (let ((window-persistent-parameters (append '((no-other-window . t)) window-persistent-parameters))) @@ -3237,11 +3329,13 @@ to `helm-default-display-buffer' is called from `helm-display-buffer' the value of `split-window-preferred-function' will be used by `display-buffer'." - (let* (split-width-threshold + (let* ((split-width-threshold (and (integerp helm-split-width-threshold) + helm-split-width-threshold)) (win (if (and (fboundp 'window-in-direction) ;; Don't try to split when starting in a minibuffer ;; e.g M-: and try to use helm-show-kill-ring. - (not (minibufferp helm-current-buffer))) + (not (minibufferp helm-current-buffer)) + (null helm-split-width-threshold)) (if (or (one-window-p t) helm-split-window-inside-p) (split-window @@ -3283,10 +3377,6 @@ Returns nil when window is dedicated." (helm-aif (other-window-for-scrolling) (and (not (window-dedicated-p it)) it))) - -;;; Display helm buffer -;; -;; (defun helm-resolve-display-function (com) "Decide which display function to use according to `helm-commands-using-frame'. @@ -3380,7 +3470,7 @@ value of `helm-full-frame' or `helm-split-window-default-side'." . ,(append helm-default-display-buffer-alist `((window-height . ,helm-display-buffer-default-height) (window-width . ,helm-display-buffer-default-width))))) - (helm-log-run-hook 'helm-window-configuration-hook)))) + (helm-log-run-hook "helm-default-display-buffer" 'helm-window-configuration-hook)))) ;; Shut up byte-compiler in emacs-26 (defvar tab-bar-mode) @@ -3397,7 +3487,9 @@ Function suitable for `helm-display-function', See `helm-display-buffer-height' and `helm-display-buffer-width' to configure frame size. -Note that this feature is available only with emacs-25+." +Note that this feature is available only with emacs-25+. +Note also it is not working properly in helm nested session with emacs +version < emacs-28." (cl-assert (and (fboundp 'window-absolute-pixel-edges) (fboundp 'frame-geometry)) nil "Helm buffer in own frame is only available starting at emacs-25+") @@ -3411,7 +3503,7 @@ Note that this feature is available only with emacs-25+." (prmt-size (length helm--prompt)) (line-height (frame-char-height)) tab-bar-mode - (default-frame-alist + (new-frame-alist (if resume (buffer-local-value 'helm--last-frame-parameters (get-buffer buffer)) @@ -3420,8 +3512,8 @@ Note that this feature is available only with emacs-25+." (tool-bar-lines . 0) (left . ,(- (car pos) (* (frame-char-width) - (if (< (- (point) (point-at-bol)) prmt-size) - (- (point) (point-at-bol)) + (if (< (- (point) (pos-bol)) prmt-size) + (- (point) (pos-bol)) prmt-size)))) ;; Try to put frame at the best possible place. ;; Frame should be below point if enough @@ -3463,7 +3555,7 @@ Note that this feature is available only with emacs-25+." (with-helm-buffer (setq-local helm-echo-input-in-header-line (not (> (cdr pos) half-screen-size))))) - (helm-display-buffer-popup-frame buffer default-frame-alist) + (helm-display-buffer-popup-frame buffer new-frame-alist) ;; When frame size have been modified manually by user restore ;; it to default value unless resuming or not using ;; `helm-display-buffer-reuse-frame'. @@ -3473,7 +3565,7 @@ Note that this feature is available only with emacs-25+." (set-frame-size helm-popup-frame helm-display-buffer-width helm-display-buffer-height))) - (helm-log-run-hook 'helm-window-configuration-hook))) + (helm-log-run-hook "helm-display-buffer-in-own-frame" 'helm-window-configuration-hook))) (defun helm-display-buffer-popup-frame (buffer frame-alist) (if helm-display-buffer-reuse-frame @@ -3496,7 +3588,8 @@ Note that this feature is available only with emacs-25+." (frame-live-p helm-popup-frame)) (delete-frame helm-popup-frame)) (display-buffer - buffer '(display-buffer-pop-up-frame . nil)))) + buffer `(display-buffer-pop-up-frame + . ((pop-up-frame-parameters . ,frame-alist)))))) ;; Ensure to quit helm when user delete helm frame manually. ;; If user deletes another frame keep session running. @@ -3521,7 +3614,7 @@ Return the resulting list." (defun helm-initialize (resume input default sources) "Start initialization of Helm session. For RESUME INPUT DEFAULT and SOURCES see `helm'." - (helm-log "start initialization: resume=%S input=%S" + (helm-log "helm-initialize" "start initialization: resume=%S input=%S" resume input) (helm-frame-or-window-configuration 'save) (let ((sources-list (helm-get-sources sources))) @@ -3532,31 +3625,48 @@ For RESUME INPUT DEFAULT and SOURCES see `helm'." when (or (memq 'helm-fuzzy-match matchfns) (memq 'helm-fuzzy-search searchfns)) return t)) - (helm-log "sources-list = %S" sources-list) + (helm-log "helm-initialize" "sources-list = %S" sources-list) (helm-set-local-variable 'helm-sources sources-list) ;; Once `helm-buffer' is created `helm-sources' will be a local ;; variable which value is a list of alists. (helm-current-position 'save) (if (helm-resume-p resume) (helm-initialize-overlays (helm-buffer-get)) - (helm-initial-setup default sources-list)) + (helm-initial-setup input default sources-list)) (setq helm-alive-p t) (unless (eq resume 'noresume) (helm--push-and-remove-dups helm-buffer 'helm-buffers) (setq helm-last-buffer helm-buffer)) - (when input - (setq helm-input input - helm-pattern input) - (helm--fuzzy-match-maybe-set-pattern)) ;; If a `resume' attribute is present `helm-compute-attr-in-sources' ;; will run its function. (when (helm-resume-p resume) (helm-compute-attr-in-sources 'resume)) - (helm-log "end initialization"))) + (helm-log "helm-initialize" "end initialization"))) + +(defun helm-current-position (save-or-restore) + "Save or restore current position in `helm-current-buffer'. +Argument SAVE-OR-RESTORE is either save or restore." + (cl-case save-or-restore + (save + (helm-log "helm-current-position" "Save position at %S" (cons (point) (window-start))) + (setq helm-current-position (cons (point) (window-start)))) + (restore + ;; Maybe `helm-current-buffer' have been deleted + ;; during helm session so check if it is here + ;; otherwise position in underlying buffer will be lost. + (when (get-buffer-window helm-current-buffer 'visible) + (helm-log "helm-current-position" "Restore position at %S in buffer %s" + helm-current-position + (buffer-name (current-buffer))) + (goto-char (car helm-current-position)) + ;; Fix this position with the NOFORCE arg of `set-window-start' + ;; otherwise, if there is some other buffer than `helm-current-buffer' + ;; one, position will be lost. + (set-window-start (selected-window) (cdr helm-current-position) t))))) (defun helm-initialize-overlays (buffer) "Initialize Helm overlays in BUFFER." - (helm-log "overlay setup") + (helm-log "helm-initialize-overlays" "overlay setup") (if helm-selection-overlay ;; make sure the overlay belongs to the helm buffer if ;; it's newly created @@ -3568,10 +3678,10 @@ For RESUME INPUT DEFAULT and SOURCES see `helm'." (overlay-put helm-selection-overlay 'face 'helm-selection) (overlay-put helm-selection-overlay 'priority 1))) -(defun helm-initial-setup (default sources) +(defun helm-initial-setup (input default sources) "Initialize Helm settings and set up the Helm buffer." ;; Run global hook. - (helm-log-run-hook 'helm-before-initialize-hook) + (helm-log-run-hook "helm-initial-setup" 'helm-before-initialize-hook) ;; Run local source hook. (helm--run-init-hooks 'before-init-hook sources) ;; For initialization of helm locals vars that need @@ -3604,36 +3714,53 @@ For RESUME INPUT DEFAULT and SOURCES see `helm'." 'vertical 'horizontal)) (setq helm--window-side-state (or helm-split-window-default-side 'below))) + ;; Some sources like helm-mu are using input to init their + ;; candidates in init function, so setup initial helm-pattern here. + ;; See bug#2530 and https://github.com/emacs-helm/helm-mu/issues/54. + ;; Input should have precedence on default. + (cond (input + (setq helm-input input + helm-pattern input)) + ((and default helm-maybe-use-default-as-input) + (setq helm-pattern (if (listp default) + (car default) + default) + ;; Even if helm-pattern is set we want the + ;; prompt to be empty when using default as input, why + ;; helm-input is initialized to "". + helm-input "")) + (helm-maybe-use-default-as-input + (setq helm-pattern (or (with-helm-current-buffer + (thing-at-point 'symbol)) + "") + helm-input "")) + (t + (setq helm-pattern "" + helm-input ""))) + (helm--fuzzy-match-maybe-set-pattern) ;; Call the init function for sources where appropriate (helm-compute-attr-in-sources 'init sources) - (setq helm-pattern (or (and helm-maybe-use-default-as-input - (or (if (listp default) - (car default) default) - (with-helm-current-buffer - (thing-at-point 'symbol)))) - "")) - (setq helm-input "") (clrhash helm-candidate-cache) (helm-create-helm-buffer) (helm-clear-visible-mark) ;; Run global hook. - (helm-log-run-hook 'helm-after-initialize-hook) + (helm-log-run-hook "helm-initial-setup" 'helm-after-initialize-hook) ;; Run local source hook. (helm--run-init-hooks 'after-init-hook sources)) (defun helm--run-init-hooks (hook sources) "Run after and before init hooks local to source. See :after-init-hook and :before-init-hook in `helm-source'." - (cl-loop with sname = (cl-ecase hook - (before-init-hook "h-before-init-hook") - (after-init-hook "h-after-init-hook")) - with h = (cl-gensym sname) - for s in sources + (cl-loop for s in sources for hv = (assoc-default hook s) - if (and hv (not (symbolp hv))) - do (set h hv) - and do (helm-log-run-hook h) - else do (helm-log-run-hook hv))) + when hv + do (pcase hv + ((and (pred (functionp)) + (guard (not (symbolp hv)))) + (funcall hv)) + ((and hook (pred (listp))) + (dolist (h hook) (funcall h))) + (_ (helm-log-run-hook "helm--run-init-hooks" hv))))) (defun helm-restore-position-on-quit () "Restore position in `helm-current-buffer' when quitting." @@ -3674,8 +3801,8 @@ Unuseful when used outside Helm, don't use it.") (let ((root-dir default-directory) (inhibit-read-only t)) (with-current-buffer (get-buffer-create helm-buffer) - (helm-log "Enabling major-mode %S" major-mode) - (helm-log "kill local variables: %S" (buffer-local-variables)) + (helm-log "helm-create-helm-buffer" "Enabling major-mode %S" major-mode) + (helm-log "helm-create-helm-buffer" "kill local variables: %S" (buffer-local-variables)) (kill-all-local-variables) (helm-major-mode) (set (make-local-variable 'buffer-read-only) nil) @@ -3696,8 +3823,8 @@ Unuseful when used outside Helm, don't use it.") (set (make-local-variable 'helm-marked-candidates) nil) (set (make-local-variable 'helm--prompt) helm--prompt) (helm-initialize-persistent-action) - (helm-log "helm-display-function = %S" helm-display-function) - (helm-log "helm--local-variables = %S" helm--local-variables) + (helm-log "helm-create-helm-buffer" "helm-display-function = %S" helm-display-function) + (helm-log "helm-create-helm-buffer" "helm--local-variables = %S" helm--local-variables) (helm--set-local-variables-internal) (setq truncate-lines helm-truncate-lines) ; already local. (setq left-margin-width helm-left-margin-width) @@ -3754,13 +3881,15 @@ For PRESELECT RESUME KEYMAP DEFAULT HISTORY, see `helm'." ;; prevent this and allow `C-g' (the helm one aka ;; `helm-keyboard-quit') to quit immediately. (inhibit-quit source-process-p)) - (helm-log "helm-get-candidate-number => %S" + (helm-log "helm-read-from-minibuffer" "helm-get-candidate-number => %S" (helm-get-candidate-number)) - (helm-log "helm-execute-action-at-once-if-one = %S" + (helm-log "helm-read-from-minibuffer" "helm-execute-action-at-once-if-one = %S" helm-execute-action-at-once-if-one) - (helm-log "helm-quit-if-no-candidate = %S" helm-quit-if-no-candidate) + (helm-log "helm-read-from-minibuffer" + "helm-quit-if-no-candidate = %S" helm-quit-if-no-candidate) (when (and src (helm-resume-p resume)) - (helm-display-mode-line src)) + (helm-display-mode-line src) + (setq helm-pattern input)) ;; Reset `helm-pattern' and update ;; display if no result found with precedent value of `helm-pattern' ;; unless `helm-quit-if-no-candidate' is non-`nil', in this case @@ -3816,7 +3945,8 @@ For PRESELECT RESUME KEYMAP DEFAULT HISTORY, see `helm'." ;; - Or fallback to the global value of helm-map. (helm--maybe-update-keymap (or src-keymap keymap helm-map)) - (helm-log-run-hook 'helm-minibuffer-set-up-hook) + (helm-log-run-hook "helm-read-from-minibuffer" + 'helm-minibuffer-set-up-hook) (setq timer (run-with-idle-timer (max (with-helm-buffer helm-input-idle-delay) @@ -3949,7 +4079,7 @@ WARNING: Do not use this mode yourself, it is internal to Helm." (defun helm-cleanup () "Clean up the mess when Helm exit or quit." - (helm-log "start cleanup") + (helm-log "helm-cleanup" "start cleanup") (with-selected-window ;; When exiting with `helm-execute-action-at-once-if-one', ;; `helm-window' may not be created and we endup with an error @@ -3967,7 +4097,14 @@ WARNING: Do not use this mode yourself, it is internal to Helm." ;; Be sure we call cleanup functions from helm-buffer. (helm-compute-attr-in-sources 'cleanup) ;; Delete or make invisible helm frame. - (if (and helm--buffer-in-new-frame-p (null helm--nested)) + (if (and helm--buffer-in-new-frame-p + ;; a helm session running in a frame that runs a nested + ;; session share the same frame for both sessions so + ;; don't delete the common frame. + ;; i.e. helm--nested == t => delete + ;; helm--nested == nil => delete + ;; helm--nested == share => don't delete + (not (eq helm--nested 'share))) (progn (setq-local helm--last-frame-parameters (helm--get-frame-parameters)) @@ -3990,7 +4127,7 @@ WARNING: Do not use this mode yourself, it is internal to Helm." ;; which have a minibuffer, so be sure to disable ;; the `no-other-window' prop there. (helm-prevent-switching-other-window :enabled nil) - (helm-log-run-hook 'helm-cleanup-hook) + (helm-log-run-hook "helm-cleanup" 'helm-cleanup-hook) (helm-frame-or-window-configuration 'restore) ;; [1] now bury-buffer from underlying windows otherwise, ;; if this window is killed the underlying buffer will @@ -4001,6 +4138,9 @@ WARNING: Do not use this mode yourself, it is internal to Helm." ;; `helm-set-local-variable'. (setq helm--force-updating-p nil) (setq helm--buffer-in-new-frame-p nil) + ;; No need to reinitialize helm-pattern here now it is done only + ;; once in init function bug#2530. + (setq helm-last-query helm-pattern) ;; This is needed in some cases where last input ;; is yielded infinitely in minibuffer after helm session. (helm-clean-up-minibuffer)) @@ -4030,9 +4170,9 @@ WARNING: Do not use this mode yourself, it is internal to Helm." (setq helm-pattern input) (unless (helm-action-window) (setq helm-input helm-pattern)) - (helm-log "helm-pattern = %S" helm-pattern) - (helm-log "helm-input = %S" helm-input) - (helm-log-run-hook 'helm-before-update-hook) + (helm-log "helm-check-new-input" "helm-pattern = %S" helm-pattern) + (helm-log "helm-check-new-input" "helm-input = %S" helm-input) + (helm-log-run-hook "helm-check-new-input" 'helm-before-update-hook) (setq helm--in-update t) (helm-update))) @@ -4070,7 +4210,9 @@ WARNING: Do not use this mode yourself, it is internal to Helm." ;; and not `helm-apply-functions-from-source'. (helm-interpret-value candidate-proc) (helm-interpret-value candidate-fn source)) - (error (helm-log "Error: %S" (setq cfn-error err)) nil)))) + (error (helm-log "helm-get-candidates" + "Error: %S" (setq cfn-error err)) + nil)))) (cond ((and (processp candidates) (not candidate-proc)) (warn "Candidates function `%s' should be called in a `candidates-process' attribute" candidate-fn)) @@ -4111,8 +4253,10 @@ Cache the candidates if there is no cached value yet." ;; handles quit-flag? (inhibit-quit (assoc-default 'candidates-process source))) (helm-aif candidate-cache - (prog1 it (helm-log "Use cached candidates")) - (helm-log "No cached candidates, calculate candidates") + (prog1 it (helm-log "helm-get-cached-candidates" + "Use cached candidates")) + (helm-log "helm-get-cached-candidates" + "No cached candidates, calculate candidates") (let ((candidates (helm-get-candidates source))) (cond ((processp candidates) (push (cons candidates @@ -4298,7 +4442,7 @@ This function is used with sources built with `helm-source-sync'." ;; the position of line and go ahead, ;; letting `helm-search-match-part' checking if ;; pattern match against this line. - (prog1 (list (point-at-bol) (point-at-eol)) + (prog1 (list (pos-bol) (pos-eol)) (forward-line 1)) ;; We could use here directly `re-search-forward' ;; on the regexp produced by `helm--mapconcat-pattern', @@ -4311,8 +4455,8 @@ This function is used with sources built with `helm-source-sync'." ;; then search the corresponding line with the whole regexp, ;; which increase dramatically the speed of the search. (cl-loop while (re-search-forward partial-regexp nil t) - for bol = (point-at-bol) - for eol = (point-at-eol) + for bol = (pos-bol) + for eol = (pos-eol) if (progn (goto-char bol) (re-search-forward regexp eol t)) do (goto-char eol) and return t @@ -4323,7 +4467,8 @@ This function is used with sources built with `helm-source-sync'." (defun helm-score-candidate-for-pattern (candidate pattern) "Assign score to CANDIDATE according to PATTERN." ;; Unknown candidates always go on top. - (if (equal (get-text-property 0 'display candidate) "[?]") + (if (or (get-text-property 0 'helm-new-file candidate) + (get-text-property 0 'unknown candidate)) 200.00 (funcall helm-fuzzy-default-score-fn candidate pattern))) @@ -4471,80 +4616,105 @@ useful when the order of the candidates is meaningful, e.g. with (char-fold-to-regexp pattern) pattern))) -(defun helm-fuzzy-default-highlight-match (candidate &optional diacritics) - "The default function to highlight matches in fuzzy matching. -Highlight elements in CANDIDATE matching `helm-pattern' according -to the matching method in use." - (if (string= helm-pattern "") - ;; Empty pattern, do nothing. - candidate - ;; Else start highlighting. - (let* ((pair (and (consp candidate) candidate)) - (display (helm-stringify (if pair (car pair) candidate))) - (real (cdr pair)) - (regex (helm--maybe-get-migemo-pattern helm-pattern diacritics)) - (mp (pcase (get-text-property 0 'match-part display) - ((pred (string= display)) nil) - (str str))) - (count 0) - beg-str end-str) - ;; Extract all parts of display keeping original properties. - (when (and mp (ignore-errors - ;; Avoid error when candidate is a huge line. - (string-match (regexp-quote mp) display))) - (setq beg-str (substring display 0 (match-beginning 0)) - end-str (substring display (match-end 0) (length display)) - mp (substring display (match-beginning 0) (match-end 0)))) - (with-temp-buffer - ;; Insert the whole display part and remove non--match-part - ;; to keep their original face properties. - (insert (propertize (or mp display) 'read-only nil)) ; Fix (bug#1176) - (goto-char (point-min)) - (condition-case nil - (progn - ;; Try first matching against whole pattern. +(defun helm-fuzzy-default-highlight-match-1 (candidate &optional pattern diacritics file-comp) + (let* ((pair (and (consp candidate) candidate)) + (display (helm-stringify (if pair (car pair) candidate))) + (real (cdr pair)) + (host (and file-comp (get-text-property + (max 0 (1- (length display))) 'host display))) + (regex (helm--maybe-get-migemo-pattern pattern diacritics)) + (mpart (get-text-property 0 'match-part display)) + (mp (cond ((and mpart (string= display mpart)) nil) + (mpart) + ;; FIXME: This may be wrong when match-on-real + ;; is nil, so we should flag match-on-real on + ;; top and use it. + (file-comp (file-name-nondirectory + (or host (and (stringp real) real) display))))) + (count 0) + beg-str end-str) + (when host (setq pattern (cadr (split-string pattern ":")))) + ;; Extract all parts of display keeping original properties. + (when (and mp (ignore-errors + ;; Avoid error when candidate is a huge line. + (string-match (regexp-quote mp) display))) + (setq beg-str (substring display 0 (match-beginning 0)) + end-str (substring display (match-end 0) (length display)) + mp (substring display (match-beginning 0) (match-end 0)))) + (with-temp-buffer + ;; Insert the whole display part and remove non--match-part + ;; to keep their original face properties. + (insert (propertize (or mp display) 'read-only nil)) ; Fix (bug#1176) + (goto-char (point-min)) + (condition-case nil + (progn + ;; Try first matching against whole pattern. + (unless (string= pattern "") (while (re-search-forward regex nil t) (cl-incf count) (helm-add-face-text-properties - (match-beginning 0) (match-end 0) 'helm-match)) - ;; If no matches start matching against multiples or fuzzy matches. - (when (zerop count) - (cl-loop with multi-match = (string-match-p " " helm-pattern) - with patterns = (if multi-match - (cl-loop for pat in (helm-mm-split-pattern - helm-pattern) - collect - (helm--maybe-get-migemo-pattern - pat diacritics)) - (split-string helm-pattern "" t)) - for p in patterns - ;; Multi matches (regexps patterns). - if multi-match do - (progn - (while (re-search-forward p nil t) - (helm-add-face-text-properties - (match-beginning 0) (match-end 0) - 'helm-match)) - (goto-char (point-min))) - ;; Fuzzy matches (literal patterns). - else do - (when (search-forward p nil t) + (match-beginning 0) (match-end 0) 'helm-match))) + ;; If no matches start matching against multiples or fuzzy matches. + (when (zerop count) + (cl-loop with multi-match = (string-match-p " " pattern) + with patterns = (if multi-match + (cl-loop for pat in (helm-mm-split-pattern + pattern) + collect + (helm--maybe-get-migemo-pattern + pat diacritics)) + (split-string pattern "" t)) + for p in patterns + ;; Multi matches (regexps patterns). + if multi-match do + (progn + (while (re-search-forward p nil t) (helm-add-face-text-properties (match-beginning 0) (match-end 0) - 'helm-match))))) - (invalid-regexp nil)) - ;; Now replace the original match-part with the part - ;; with face properties added. - (setq display (if mp (concat beg-str (buffer-string) end-str) (buffer-string)))) - (if real (cons display real) display)))) + 'helm-match)) + (goto-char (point-min))) + ;; Fuzzy matches (literal patterns). + else do + (when (search-forward p nil t) + (helm-add-face-text-properties + (match-beginning 0) (match-end 0) + 'helm-match))))) + (invalid-regexp nil)) + ;; Now replace the original match-part with the part + ;; with face properties added. + (setq display (if mp (concat beg-str (buffer-string) end-str) (buffer-string)))) + (if real (cons display real) display))) + +(cl-defun helm-fuzzy-default-highlight-match (candidate + &optional (pattern helm-pattern) diacritics file-comp) + "The default function to highlight matches in fuzzy matching. +Highlight elements in CANDIDATE matching PATTERN according +to the matching method in use. When DIACRITICS is specified, ignore +diacritics, see `char-fold-to-regexp' for more infos." + (if (string= pattern "") + ;; Empty pattern, do nothing. This is needed when this function + ;; is used outside of helm-fuzzy-highlight-matches like in *buffers-list. + candidate + ;; Else start highlighting. + (helm-fuzzy-default-highlight-match-1 candidate pattern diacritics file-comp))) (defun helm-fuzzy-highlight-matches (candidates source) - "The filtered-candidate-transformer function to highlight fuzzy matches. + "Highlight matches in CANDIDATES for SOURCE. +The filtered-candidate-transformer function to highlight fuzzy matches. See `helm-fuzzy-default-highlight-match'." (cl-assert helm-fuzzy-matching-highlight-fn nil "Wrong type argument functionp: nil") (cl-loop with diac = (helm-get-attr 'diacritics source) + with file-comp-p = (and (not (helm-action-window)) + (or minibuffer-completing-file-name + (helm-get-attr 'completing-file-name source))) + ;; helm-pattern may have been modified (fuzzy) so ensure to + ;; use helm-input which is the raw pattern. + with pattern = (if file-comp-p + (file-name-nondirectory helm-input) + helm-pattern) + when (string= pattern "") return candidates for c in candidates - collect (funcall helm-fuzzy-matching-highlight-fn c diac))) + collect (funcall helm-fuzzy-matching-highlight-fn c pattern diac file-comp-p))) ;;; helm-flex style @@ -4663,7 +4833,8 @@ emacs-27 to provide such scoring in emacs<27." (propertize c 'match-part part)) c))) (error (unless (eq (car err) 'invalid-regexp) ; Always ignore regexps errors. - (helm-log-error "helm-match-from-candidates in source `%s': %s %s" + (helm-log-error "helm-match-from-candidates" + "helm-match-from-candidates in source `%s': %s %s" (assoc-default 'name source) (car err) (cdr err))) nil)))) @@ -4695,8 +4866,7 @@ emacs-27 to provide such scoring in emacs<27." ;; display a list of candidates even with an empty ;; pattern. (helm--initialize-one-by-one-candidates - (helm-take-first-elements - (helm-get-cached-candidates source) limit) + (helm-take (helm-get-cached-candidates source) limit) source) ;; Compute candidates according to pattern with their match ;; fns. @@ -4711,7 +4881,7 @@ emacs-27 to provide such scoring in emacs<27." (defun helm-render-source (source matches) "Display MATCHES from SOURCE according to its settings." - (helm-log "Source = %S" (remove (assq 'keymap source) source)) + (helm-log "helm-render-source" "Source = %S" (remove (assq 'keymap source) source)) (when matches (helm-insert-header-from-source source) (cl-loop with separate = nil @@ -4755,7 +4925,8 @@ Unlike `while-no-input' this macro ensure to not returns `t'." (not (file-remote-p helm-pattern nil t))) ;; Tramp will ask for passwd, don't use `helm-while-no-input'. ,@body - (helm-log "Using here `helm-while-no-input'") + (helm-log "helm--maybe-use-while-no-input" + "Using here `helm-while-no-input'") ;; Emacs bug , unexpected ;; dbus-event is triggered on dbus init. ;; Ignoring the dbus-event work on emacs28+; for emacs27 or older @@ -4819,7 +4990,7 @@ When SOURCE is provided update mode-line for this source, otherwise the current source will be used. Argument CANDIDATES when provided is used to redisplay these candidates without recomputing them, it should be a list of lists." - (helm-log "Start updating") + (helm-log "helm-update" "Start updating") (helm-kill-async-processes) ;; When persistent action have been called ;; we have two windows even with `helm-full-frame'. @@ -4851,7 +5022,7 @@ without recomputing them, it should be a list of lists." ;; Compute matches without rendering the sources. ;; This prevent the helm-buffer flickering when constantly ;; updating. - (helm-log "Matches: %S" + (helm-log "helm-update" "Matches: %S" (setq matches (or candidates (helm--collect-matches sources)))) ;; If computing matches finished and is not interrupted ;; erase the helm-buffer and render results (Fix #1157). @@ -4871,15 +5042,15 @@ without recomputing them, it should be a list of lists." (let ((src (or source (helm-get-current-source)))) (unless (assq 'candidates-process src) (helm-display-mode-line src 'force) - (helm-log-run-hook 'helm-after-update-hook))) + (helm-log-run-hook "helm-update" 'helm-after-update-hook))) (when preselect - (helm-log "Update preselect candidate %s" preselect) + (helm-log "helm-update" "Update preselect candidate %s" preselect) (if (helm-window) (with-helm-window (helm-preselect preselect source)) (helm-preselect preselect source))) (setq helm--force-updating-p nil) (helm--reset-update-flag)) - (helm-log "end update"))) + (helm-log "helm-update" "end update"))) (defun helm-update-source-p (source) "Whether SOURCE needs updating or not." @@ -4955,7 +5126,7 @@ passed as argument to `recenter'." (helm-apply-functions-from-source source 'helm-candidate-buffer)) (kill-buffer it)) - (cl-dolist (attr '(update init)) + (dolist (attr '(update init)) (helm-aif (assoc-default attr source) (helm-apply-functions-from-source source it))) (helm-remove-candidate-cache source)) @@ -5029,7 +5200,7 @@ If MATCH is a cons cell then insert the car as display with the cdr stored as real value in a `helm-realvalue' text property. Args NUM and SOURCE are also stored as text property when specified as respectively `helm-cand-num' and `helm-cur-source'." - (let ((start (point-at-bol (point))) + (let ((start (pos-bol (point))) (dispvalue (helm-candidate-get-display match)) (realvalue (cdr-safe match)) (map (when helm-allow-mouse (make-sparse-keymap))) @@ -5038,7 +5209,7 @@ specified as respectively `helm-cand-num' and `helm-cur-source'." (when (and (stringp dispvalue) (not (zerop (length dispvalue)))) (funcall insert-function dispvalue) - (setq end (point-at-eol)) + (setq end (pos-eol)) ;; Some strings may handle another keymap prop. (remove-text-properties start end '(keymap nil)) (put-text-property start end 'read-only nil) @@ -5136,10 +5307,10 @@ additional info after the source name by overlay." (put-text-property start (point) 'helm-header-separator t))) (let ((start (point))) (insert name) - (put-text-property (point-at-bol) - (point-at-eol) 'helm-header t) + (put-text-property (pos-bol) + (pos-eol) 'helm-header t) (when display-string - (overlay-put (make-overlay (point-at-bol) (point-at-eol)) + (overlay-put (make-overlay (pos-bol) (pos-eol)) 'display display-string)) (insert "\n") (add-text-properties start (point) '(face helm-source-header @@ -5150,8 +5321,8 @@ additional info after the source name by overlay." (defun helm-insert-candidate-separator () "Insert separator of candidates into the Helm buffer." (insert (propertize helm-candidate-separator 'face 'helm-separator)) - (put-text-property (point-at-bol) - (point-at-eol) 'helm-candidate-separator t) + (put-text-property (pos-bol) + (pos-eol) 'helm-candidate-separator t) (insert "\n")) (defun helm-init-relative-display-line-numbers () @@ -5186,7 +5357,7 @@ This will work only in Emacs-26+, i.e. Emacs versions that have (helm-output-filter-1 (assoc process helm-async-processes) output-string))) (defun helm-output-filter-1 (process-assoc output-string) - (helm-log "output-string = %S" output-string) + (helm-log "helm-output-filter-1" "output-string = %S" output-string) (with-current-buffer helm-buffer (let ((source (cdr process-assoc))) (save-excursion @@ -5223,7 +5394,8 @@ This will work only in Emacs-26+, i.e. Emacs versions that have (cl-incf (cdr (assq 'item-count source))) (when (>= (assoc-default 'item-count source) limit) (helm-kill-async-process process) - (helm-log-run-hook 'helm-async-outer-limit-hook) + (helm-log-run-hook "helm-output-filter--process-source" + 'helm-async-outer-limit-hook) (cl-return)))) (defun helm-output-filter--collect-candidates (lines incomplete-line-info) @@ -5234,7 +5406,8 @@ This will work only in Emacs-26+, i.e. Emacs versions that have ;; incomplete line of the next arriving chunk. INCOMPLETE-LINE-INFO ;; is an attribute of source; it is created with an empty string ;; when the source is computed => (incomplete-line . "") - (helm-log "incomplete-line-info = %S" (cdr incomplete-line-info)) + (helm-log "helm-output-filter--collect-candidates" + "incomplete-line-info = %S" (cdr incomplete-line-info)) (butlast (cl-loop for line in lines ;; On start `incomplete-line-info' value is empty string. @@ -5260,7 +5433,8 @@ This will work only in Emacs-26+, i.e. Emacs versions that have ;; FIXME Don't hardcode follow delay. (helm-follow-execute-persistent-action-maybe 0.5) (helm-display-mode-line (helm-get-current-source)) - (helm-log-run-hook 'helm-after-update-hook) + (helm-log-run-hook "helm-output-filter--post-process" + 'helm-after-update-hook) (helm--reset-update-flag)))) (defun helm-process-deferred-sentinel-hook (process event file) @@ -5308,13 +5482,15 @@ function." ;; (defun helm-execute-selection-action () "Execute current action." - (helm-log-run-hook 'helm-before-action-hook) + (helm-log-run-hook "helm-execute-selection-action" + 'helm-before-action-hook) ;; Position can be change when `helm-current-buffer' ;; is split, so jump to this position before executing action. (helm-current-position 'restore) (unwind-protect (prog1 (helm-execute-selection-action-1) - (helm-log-run-hook 'helm-after-action-hook)) + (helm-log-run-hook "helm-execute-selection-action" + 'helm-after-action-hook)) (setq helm--executing-helm-action nil))) (defun helm-execute-selection-action-1 (&optional @@ -5322,7 +5498,7 @@ function." preserve-saved-action) "Execute ACTION on current SELECTION. If PRESERVE-SAVED-ACTION is non-nil, then save the action." - (helm-log "executing action") + (helm-log "helm-execute-selection-action-1" "executing action") (setq action (helm-get-default-action (or action helm-saved-action @@ -5369,7 +5545,7 @@ If action buffer is selected, back to the Helm buffer." (interactive) (with-helm-alive-p (let ((src (helm-get-current-source))) - (helm-log-run-hook 'helm-select-action-hook) + (helm-log-run-hook "helm-select-action" 'helm-select-action-hook) (setq helm-saved-selection (helm-get-selection nil nil src)) (with-selected-frame (with-helm-window (selected-frame)) (prog1 @@ -5502,7 +5678,7 @@ DIRECTION is either \\='next or \\='previous." (or (helm-pos-header-line-p) (helm-pos-candidate-separator-p))) (forward-line (if (and (eq direction 'previous) - (not (eq (point-at-bol) (point-min)))) + (not (eq (pos-bol) (point-min)))) -1 1))))) (defun helm-display-mode-line (source &optional force) @@ -5721,7 +5897,8 @@ Key arg DIRECTION can be one of: (with-helm-window (when helm-allow-mouse (helm--mouse-reset-selection-help-echo)) - (helm-log-run-hook 'helm-move-selection-before-hook) + (helm-log-run-hook "helm-move-selection-common" + 'helm-move-selection-before-hook) (funcall move-func) (and (memq direction '(next previous)) (helm-skip-noncandidate-line direction)) @@ -5732,7 +5909,8 @@ Key arg DIRECTION can be one of: (when follow (helm-follow-execute-persistent-action-maybe)) (helm-display-mode-line (setq source (helm-get-current-source))) - (helm-log-run-hook 'helm-move-selection-after-hook) + (helm-log-run-hook "helm-move-selection-common" + 'helm-move-selection-after-hook) (helm--set-minibuffer-completion-confirm source))))) (defun helm-move--beginning-of-multiline-candidate () @@ -5842,7 +6020,7 @@ Key arg DIRECTION can be one of: (condition-case err (while (not (string= name (helm-current-line-contents))) (goto-char (helm-get-next-header-pos))) - (error (helm-log "%S" err)))))) + (error (helm-log "helm-move--goto-source-fn" "%S" err)))))) (defun helm-candidate-number-at-point () (if helm-alive-p @@ -6004,7 +6182,7 @@ marking candidates." (when resumep (goto-char helm-selection-point)) (move-overlay - helm-selection-overlay (point-at-bol) + helm-selection-overlay (pos-bol) (if (helm-pos-multiline-p) (let ((header-pos (helm-get-next-header-pos)) (separator-pos (helm-get-next-candidate-separator-pos))) @@ -6014,7 +6192,7 @@ marking candidates." separator-pos) header-pos (point-max))) - (1+ (point-at-eol)))) + (1+ (pos-eol)))) (setq helm-selection-point (overlay-start helm-selection-overlay)) (when (and helm-allow-mouse (null nomouse)) (helm--bind-mouse-for-selection helm-selection-point)))) @@ -6051,14 +6229,14 @@ message \\='no match'." (minibuffer-message " [confirm]")) ;; When require-match is strict (i.e. `t'), buffer ;; should be either empty or in read-file-name have an - ;; unknown candidate ([?] prefix), if it's not the case + ;; unknown candidate ([+] prefix), if it's not the case ;; fix it in helm-mode but not here. ((and (or empty-buffer-p unknown) (eq minibuffer-completion-confirm t)) (minibuffer-message " [No match]")) (empty-buffer-p ;; This is used when helm-buffer is totally empty, - ;; i.e. the [?] have not been added because must-match + ;; i.e. the [+] have not been added because must-match ;; is used from outside helm-comp-read i.e. from a helm ;; source built with :must-match. (setq helm-saved-selection helm-pattern @@ -6118,7 +6296,8 @@ message \\='no match'." (unless helm-current-prefix-arg (setq helm-current-prefix-arg current-prefix-arg)) (setq helm-exit-status 0) - (helm-log-run-hook 'helm-exit-minibuffer-hook) + (helm-log-run-hook "helm-exit-minibuffer" + 'helm-exit-minibuffer-hook) (exit-minibuffer)) (defun helm-keyboard-quit () @@ -6164,12 +6343,12 @@ If action buffer is displayed, kill it." (defun helm-pos-header-line-p () "Return t if the current line is a header line." - (or (get-text-property (point-at-bol) 'helm-header) - (get-text-property (point-at-bol) 'helm-header-separator))) + (or (get-text-property (pos-bol) 'helm-header) + (get-text-property (pos-bol) 'helm-header-separator))) (defun helm-pos-candidate-separator-p () "Return t if the current line is a candidate separator." - (get-text-property (point-at-bol) 'helm-candidate-separator)) + (get-text-property (pos-bol) 'helm-candidate-separator)) ;;; Debugging @@ -6186,7 +6365,7 @@ If action buffer is displayed, kill it." (message "Calculating all helm-related values...") (insert "If you debug some variables or forms, set `helm-debug-variables' to a list of forms.\n\n") - (cl-dolist (v (or vars + (dolist (v (or vars helm-debug-variables (apropos-internal "^helm-" 'boundp))) (insert "** " @@ -6248,24 +6427,24 @@ Optional argument SOURCE is a Helm source object." (helm--mouse-reset-selection-help-echo)) (helm-mark-current-line) (helm-display-mode-line (or source (helm-get-current-source))) - (helm-log-run-hook 'helm-after-preselection-hook))) + (helm-log-run-hook "helm-preselect" 'helm-after-preselection-hook))) (defun helm-delete-current-selection () "Delete the currently selected item." (with-helm-window (cond ((helm-pos-multiline-p) (helm-aif (helm-get-next-candidate-separator-pos) - (delete-region (point-at-bol) - (1+ (progn (goto-char it) (point-at-eol)))) + (delete-region (pos-bol) + (1+ (progn (goto-char it) (pos-eol)))) ;; last candidate (goto-char (helm-get-previous-candidate-separator-pos)) - (delete-region (point-at-bol) (point-max))) + (delete-region (pos-bol) (point-max))) (when (helm-end-of-source-p) (goto-char (or (helm-get-previous-candidate-separator-pos) (point-min))) (forward-line 1))) (t - (delete-region (point-at-bol) (1+ (point-at-eol))) + (delete-region (pos-bol) (1+ (pos-eol))) (when (helm-end-of-source-p t) (let ((headp (save-excursion (forward-line -1) @@ -6279,7 +6458,7 @@ Optional argument SOURCE is a Helm source object." (if (and (helm-pos-multiline-p) (null at-point)) (null (helm-get-next-candidate-separator-pos)) (forward-line (if at-point 0 n)) - (or (eq (point-at-bol) (point-at-eol)) + (or (eq (pos-bol) (pos-eol)) (helm-pos-header-line-p) (if (< n 0) (bobp) (eobp)))))) @@ -6299,7 +6478,7 @@ Optional argument SOURCE is a Helm source object." (funcall func) (forward-line 0) (and realvalue - (put-text-property (point) (point-at-eol) + (put-text-property (point) (pos-eol) 'helm-realvalue realvalue)) (and multiline (put-text-property (point) @@ -6480,7 +6659,7 @@ To customize `helm-candidates-in-buffer' behaviour, use `search', for cand = (apply get-line-fn (if (and pos-lst (listp pos-lst)) pos-lst - (list (point-at-bol) (point-at-eol)))) + (list (pos-bol) (pos-eol)))) when (and match-part-fn (not (get-text-property 0 'match-part cand))) do (setq cand @@ -6518,23 +6697,25 @@ computed by match-part-fn and stored in the match-part property." (matchfn (cond (helm-migemo-mode 'helm-mm-migemo-string-match) (diacritics 'helm-mm-diacritics-string-match) (t 'string-match)))) - (if (string-match " " pattern) - (cl-loop for i in (helm-mm-split-pattern pattern) always - (if (string-match "\\`!" i) - (not (funcall matchfn (substring i 1) part)) - (funcall matchfn i part))) - (if (string-match "\\`!" pattern) - (if helm--in-fuzzy - ;; Fuzzy regexp have already been - ;; computed with substring 1. - (not (string-match fuzzy-regexp part)) - (not (funcall matchfn (substring pattern 1) part))) - (funcall matchfn (if helm--in-fuzzy fuzzy-regexp pattern) part))))) + (condition-case _err + (if (string-match " " pattern) + (cl-loop for i in (helm-mm-split-pattern pattern) always + (if (string-match "\\`!" i) + (not (funcall matchfn (substring i 1) part)) + (funcall matchfn i part))) + (if (string-match "\\`!" pattern) + (if helm--in-fuzzy + ;; Fuzzy regexp have already been + ;; computed with substring 1. + (not (string-match fuzzy-regexp part)) + (not (funcall matchfn (substring pattern 1) part))) + (funcall matchfn (if helm--in-fuzzy fuzzy-regexp pattern) part))) + (invalid-regexp nil)))) (defun helm-initial-candidates-from-candidate-buffer (get-line-fn limit) (cl-loop repeat limit until (eobp) - for line = (funcall get-line-fn (point-at-bol) (point-at-eol)) + for line = (funcall get-line-fn (pos-bol) (pos-eol)) when line collect line do (forward-line 1))) @@ -6695,6 +6876,9 @@ when initializing a source with `helm-source-in-buffer' class." (insert (mapconcat (lambda (i) (let ((cand (cond ((symbolp i) (symbol-name i)) ((numberp i) (number-to-string i)) + ((consp i) (propertize + (car i) + 'helm-realvalue (cdr i))) (t i)))) (setq-local helm-candidate-buffer-longest-len (max helm-candidate-buffer-longest-len @@ -6926,20 +7110,26 @@ splitting inconditionally, it is unused actually." (unless attr (setq attr (or (car (assq 'persistent-action source)) (car (assq 'persistent-action-if source))))) - (helm-log "executing persistent-action") + (helm-log "helm-execute-persistent-action" "executing persistent-action") (let* ((selection (and source (helm-get-selection nil nil source))) (attr-val (if (eq attr 'persistent-action-if) (funcall (assoc-default attr source) selection) (assoc-default attr source))) - ;; If attr value is a cons, use its car as persistent function - ;; and its car to decide if helm window should be splitted. + ;; If attr value is a cons, use its car as persistent function. (fn (if (and (consp attr-val) ;; maybe a lambda. (not (functionp attr-val))) (car attr-val) attr-val)) + ;; And its cdr to decide if helm window should be splitted. (no-split (and (consp attr-val) (not (functionp attr-val)) (cdr attr-val))) + ;; Is next-window (from helm-window) a suitable window for PA? + (no-suitable-win + (helm-aand (not helm--buffer-in-new-frame-p) + (get-buffer-window helm-current-buffer) + (or (window-dedicated-p it) + (window-parameter it 'window-side)))) (cursor-in-echo-area t) mode-line-in-non-selected-windows) (progn @@ -6951,11 +7141,13 @@ splitting inconditionally, it is unused actually." (when source (with-helm-window (save-selected-window + ;; FIXME: Simplify SPLIT behavior, it is a mess actually. (if no-split (helm-select-persistent-action-window :split 'never) (helm-select-persistent-action-window - :split (or split helm-onewindow-p))) - (helm-log "current-buffer = %S" (current-buffer)) + :split (or split helm-onewindow-p no-suitable-win))) + (helm-log "helm-execute-persistent-action" + "current-buffer = %S" (current-buffer)) (let ((helm-in-persistent-action t) (display-buffer-alist '((".*" (display-buffer-same-window)))) display-buffer-function pop-up-windows pop-up-frames @@ -6963,7 +7155,8 @@ splitting inconditionally, it is unused actually." (helm-execute-selection-action-1 selection (or fn (helm-get-actions-from-current-source source)) t) (unless (helm-action-window) - (helm-log-run-hook 'helm-after-persistent-action-hook))) + (helm-log-run-hook "helm-execute-persistent-action" + 'helm-after-persistent-action-hook))) ;; A typical case is when a persistent action delete ;; the buffer already displayed in ;; `helm-persistent-action-display-window' and `helm-full-frame' @@ -6990,8 +7183,14 @@ The symbol `never' is kept for backward compatibility." (get-buffer-window-list helm-buffer)))) helm-persistent-action-display-window) ((and helm--buffer-in-new-frame-p helm-initial-frame) - (with-selected-frame helm-initial-frame (selected-window))) - ((and split (not (eq split 'never))) (split-window)) + (with-selected-frame helm-initial-frame + (let ((win (selected-window))) + (if (or (window-dedicated-p win) + (window-parameter win 'window-side)) + (next-window win 1) + win)))) + ((and split (not (eq split 'never))) + (split-window)) ((get-buffer-window helm-current-buffer)) (t (previous-window (selected-window) 1)))))) @@ -7003,7 +7202,8 @@ See `helm-persistent-action-display-window' for how to use SPLIT." (select-window (setq minibuffer-scroll-window (helm-persistent-action-display-window :split split))) - (helm-log "Selected window is %S" minibuffer-scroll-window))) + (helm-log "helm-select-persistent-action-window" + "Selected window is %S" minibuffer-scroll-window))) ;;; Scrolling - recentering ;; @@ -7083,8 +7283,8 @@ Meaning of prefix ARG is the same as in `reposition-window'." (helm-get-next-header-pos) (point-max)) ;; Not multiline - (1+ (point-at-eol)))) - (o (make-overlay (point-at-bol) selection-end))) + (1+ (pos-eol)))) + (o (make-overlay (pos-bol) selection-end))) (overlay-put o 'priority 0) (overlay-put o 'face 'helm-visible-mark) (overlay-put o 'source source) @@ -7206,7 +7406,7 @@ starting it is not needed." (maxpoint (or end (point-max)))) (while (< (point) maxpoint) (helm-mark-current-line) - (let* ((prefix (get-text-property (point-at-bol) 'display)) + (let* ((prefix (get-text-property (pos-bol) 'helm-new-file)) (cand (helm-get-selection nil (helm-get-attr 'marked-with-props src) src)) @@ -7219,7 +7419,7 @@ starting it is not needed." ;; RFN. Display may be an image. See ;; https://github.com/yyoncho/helm-treemacs-icons/issues/5 ;; and also Bug#2296. - (equal prefix "[?]") + prefix (and filecomp-p (or ;; autosave files @@ -7311,7 +7511,8 @@ sources." (helm--compute-marked sel current-src (and with-wildcard (null (file-exists-p sel)))))) - (helm-log "Marked candidates = %S" candidates) + (helm-log "helm-marked-candidates" + "Marked candidates = %S" candidates) candidates))) (defun helm--remove-marked-and-update-mode-line (elm) @@ -7330,7 +7531,7 @@ sources." "Restore marked candidates when helm updates display." (with-current-buffer helm-buffer (save-excursion - (cl-dolist (o helm-visible-mark-overlays) + (dolist (o helm-visible-mark-overlays) (let* ((source (overlay-get o 'source)) (ov-src-name (assoc-default 'name source)) (ov-str (overlay-get o 'string)) @@ -7348,7 +7549,7 @@ sources." (goto-char (point-min)) (search-forward ov-src-name nil t) (while (and (search-forward ov-ml-str nil t) - (cl-loop for ov in (overlays-at (point-at-bol 0)) + (cl-loop for ov in (overlays-at (pos-bol 0)) never (overlay-get ov 'visible-mark)) (helm-current-source-name= ov-src-name)) (setq beg (match-beginning 0) @@ -7356,7 +7557,7 @@ sources." (match-end 0) (1+ (match-end 0)))) ;; Calculate real value of candidate. ;; It can be nil if candidate have only a display value. - (let ((real (get-text-property (point-at-bol 0) 'helm-realvalue))) + (let ((real (get-text-property (pos-bol 0) 'helm-realvalue))) (if real ;; Check if real value of current candidate is the same ;; than the one stored in overlay. @@ -7548,8 +7749,12 @@ source or `helm-follow-input-idle-delay' or helm-follow-input-idle-delay (or (and helm-input-idle-delay (max helm-input-idle-delay 0.01)) - 0.01)))) - (when (and (not (get-buffer-window helm-action-buffer 'visible)) + 0.01))) + (suspend (and helm--in-update + ;; Specific to helm-find-files. + (assoc-default 'suspend-follow-in-update src)))) + (when (and (not suspend) + (not (get-buffer-window helm-action-buffer 'visible)) (not (helm-pos-header-line-p)) (or (helm-follow-mode-p src) (and helm-follow-mode-persistent @@ -7638,9 +7843,17 @@ help." (with-helm-buffer (setq truncate-lines (not truncate-lines)) (when (helm-get-previous-header-pos) - (helm-update (regexp-quote (helm-get-selection nil t))))))) + (helm-update (regexp-quote (helm-get-selection nil t)))) + (message "%sisplaying continuation lines" + (if truncate-lines "Not D" "D"))))) (put 'helm-toggle-truncate-line 'helm-only t) +;;;###autoload +(defun helm-other-buffer (sources buffer) + "Simplified Helm interface with other `helm-buffer'. +Call `helm' only with SOURCES and BUFFER as args." + (helm :sources sources :buffer buffer)) + (provide 'helm-core) ;;; helm-core.el ends here diff --git a/elpa/helm-core-20220607.1243/helm-lib.el b/elpa/helm-core-20230806.1956/helm-lib.el similarity index 85% rename from elpa/helm-core-20220607.1243/helm-lib.el rename to elpa/helm-core-20230806.1956/helm-lib.el index 565db187..fdfbe631 100644 --- a/elpa/helm-core-20220607.1243/helm-lib.el +++ b/elpa/helm-core-20230806.1956/helm-lib.el @@ -28,8 +28,6 @@ (declare-function ansi-color--find-face "ansi-color.el") (declare-function ansi-color-apply-sequence "ansi-color.el") (declare-function dired-current-directory "dired.el") -(declare-function dired-log-summary "dired.el") -(declare-function dired-mark-remembered "dired.el") (declare-function ffap-file-remote-p "ffap.el") (declare-function ffap-url-p "ffap.el") (declare-function helm-get-attr "helm-core.el") @@ -40,8 +38,12 @@ (declare-function helm-get-sources "helm-core.el") (declare-function helm-interpret-value "helm-core.el") (declare-function helm-log-run-hook "helm-core.el") +(declare-function helm-next-line "helm-core.el") +(declare-function helm-get-next-header-pos "helm-core.el") +(declare-function helm-mark-current-line "helm-core.el") (declare-function helm-marked-candidates "helm-core.el") (declare-function helm-set-case-fold-search "helm-core.el") +(declare-function helm-get-previous-header-pos "helm-core.el") (declare-function helm-source--cl--print-table "helm-source.el") (declare-function helm-update "helm-core.el") (declare-function org-content "org.el") @@ -51,13 +53,6 @@ (declare-function org-table-align "org-table.el") (declare-function org-table-end "org-table.el") (declare-function org-open-at-point "org.el") -(declare-function wdired-change-to-dired-mode "wdired.el") -(declare-function wdired-do-perm-changes "wdired.el") -(declare-function wdired-do-renames "wdired.el") -(declare-function wdired-do-symlink-changes "wdired.el") -(declare-function wdired-flag-for-deletion "wdired.el") -(declare-function wdired-get-filename "wdired.el") -(declare-function wdired-normalize-filename "wdired.el") (declare-function helm-read-file-name "helm-mode.el") (declare-function find-function-library "find-func.el") (declare-function find-library-name "find-func.el") @@ -65,17 +60,18 @@ (defvar helm-sources) (defvar helm-initial-frame) (defvar helm-current-position) -(defvar wdired-old-marks) -(defvar wdired-keep-marker-rename) -(defvar wdired-allow-to-change-permissions) -(defvar wdired-allow-to-redirect-links) (defvar helm-persistent-action-display-window) (defvar helm--buffer-in-new-frame-p) (defvar helm-completion-style) (defvar helm-completion-styles-alist) (defvar helm-persistent-action-window-buffer) +(defvar helm-help-buffer-name) (defvar completion-flex-nospace) (defvar find-function-source-path) +(defvar ffap-machine-p-unknown) +(defvar ffap-machine-p-local) +(defvar ffap-machine-p-known) + ;;; User vars. ;; @@ -178,6 +174,8 @@ the customize functions e.g. `customize-set-variable' and NOT "Buffer showing actions.") (defvar helm-current-prefix-arg nil "Record `current-prefix-arg' when exiting minibuffer.") +(defvar helm-current-error nil + "Same as `compilation-current-error' but for helm-occur and helm-grep.") ;;; Compatibility ;; @@ -191,139 +189,6 @@ available APPEND is ignored." (add-face-text-property beg end face append object) (add-text-properties beg end `(face ,face) object))) -;; Override `wdired-finish-edit'. -;; Fix emacs bug in `wdired-finish-edit' where -;; Wdired is not handling the case where `dired-directory' is a cons -;; cell instead of a string. -(defun helm--advice-wdired-finish-edit () - (interactive) - (wdired-change-to-dired-mode) - ;; `wdired-old-marks' has been removed in emacs-28+. - (unless (boundp 'wdired-old-marks) - (setq-local wdired-old-marks nil)) - (let ((changes nil) - (errors 0) - files-deleted - files-renamed - some-file-names-unchanged - file-old file-new tmp-value) - (save-excursion - (when (and wdired-allow-to-redirect-links - (fboundp 'make-symbolic-link)) - (setq tmp-value (wdired-do-symlink-changes)) - (setq errors (cdr tmp-value)) - (setq changes (car tmp-value))) - (when (and wdired-allow-to-change-permissions - (boundp 'wdired-col-perm)) ; could have been changed - (setq tmp-value (wdired-do-perm-changes)) - (setq errors (+ errors (cdr tmp-value))) - (setq changes (or changes (car tmp-value)))) - (goto-char (point-max)) - (while (not (bobp)) - (setq file-old (wdired-get-filename nil t)) - (when file-old - (setq file-new (wdired-get-filename)) - (if (equal file-new file-old) - (setq some-file-names-unchanged t) - (setq changes t) - (if (not file-new) ;empty filename! - (push file-old files-deleted) - (when wdired-keep-marker-rename - (let ((mark (cond ((integerp wdired-keep-marker-rename) - wdired-keep-marker-rename) - (wdired-keep-marker-rename - (cdr (assoc file-old wdired-old-marks))) - (t nil)))) - (when mark - (push (cons (substitute-in-file-name file-new) mark) - wdired-old-marks)))) - (push (cons file-old (substitute-in-file-name file-new)) - files-renamed)))) - (forward-line -1))) - (when files-renamed - (setq errors (+ errors (wdired-do-renames files-renamed)))) - (if changes - (progn - ;; If we are displaying a single file (rather than the - ;; contents of a directory), change dired-directory if that - ;; file was renamed. (This ought to be generalized to - ;; handle the multiple files case, but that's less trivial) - ;; fixit [1]. - (cond ((and (stringp dired-directory) - (not (file-directory-p dired-directory)) - (null some-file-names-unchanged) - (= (length files-renamed) 1)) - (setq dired-directory (cdr (car files-renamed)))) - ;; Fix [1] i.e dired buffers created with - ;; (dired '(foo f1 f2 f3)). - ((and (consp dired-directory) - (cdr dired-directory) - files-renamed) - (setcdr dired-directory - ;; Replace in `dired-directory' files that have - ;; been modified with their new name keeping - ;; the ones that are unmodified at the same place. - (cl-loop with old-to-rename = (mapcar 'car files-renamed) - for f in (cdr dired-directory) - if (member f old-to-rename) - collect (assoc-default f files-renamed) - else collect f)))) - ;; Re-sort the buffer if all went well. - (unless (> errors 0) (revert-buffer)) - (let ((inhibit-read-only t)) - (dired-mark-remembered wdired-old-marks))) - (let ((inhibit-read-only t)) - (remove-text-properties (point-min) (point-max) - '(old-name nil end-name nil old-link nil - end-link nil end-perm nil - old-perm nil perm-changed nil)) - (message "(No changes to be performed)"))) - (when files-deleted - (wdired-flag-for-deletion files-deleted)) - (when (> errors 0) - (dired-log-summary (format "%d rename actions failed" errors) nil))) - (set-buffer-modified-p nil) - (setq buffer-undo-list nil)) - -;; Override `wdired-get-filename'. -;; Fix emacs bug in `wdired-get-filename' which returns the current -;; directory concatened with the filename i.e -;; "/home/you//home/you/foo" when filename is absolute in dired -;; buffer. -;; In consequence Wdired try to rename files even when buffer have -;; been modified and corrected, e.g delete one char and replace it so -;; that no change to file is done. -;; This also lead to ask confirmation for every files even when not -;; modified and when `wdired-use-interactive-rename' is nil. -(defun helm--advice-wdired-get-filename (&optional no-dir old) - ;; FIXME: Use dired-get-filename's new properties. - (let (beg end file) - (save-excursion - (setq end (line-end-position)) - (beginning-of-line) - (setq beg (next-single-property-change (point) 'old-name nil end)) - (unless (eq beg end) - (if old - (setq file (get-text-property beg 'old-name)) - ;; In the following form changed `(1+ beg)' to `beg' so that - ;; the filename end is found even when the filename is empty. - ;; Fixes error and spurious newlines when marking files for - ;; deletion. - (setq end (next-single-property-change beg 'end-name)) - (setq file (buffer-substring-no-properties (1+ beg) end))) - ;; Don't unquote the old name, it wasn't quoted in the first place - (and file (setq file (condition-case _err - ;; emacs-25+ - (apply #'wdired-normalize-filename - (list file (not old))) - (wrong-number-of-arguments - ;; emacs-24 - (wdired-normalize-filename file)))))) - (if (or no-dir old (and file (file-name-absolute-p file))) - file - (and file (> (length file) 0) - (expand-file-name file (dired-current-directory))))))) - ;;; Override `push-mark' ;; ;; Fix duplicates in `mark-ring' and `global-mark-ring' and update @@ -385,6 +250,51 @@ available APPEND is ignored." (defun helm-subr-native-elisp-p (object) (when (fboundp 'subr-native-elisp-p) (subr-native-elisp-p object))) + +;; Available only in Emacs-28+ +(unless (fboundp 'file-modes-number-to-symbolic) + (defun file-modes-number-to-symbolic (mode &optional filetype) + "Return a string describing a file's MODE. +For instance, if MODE is #o700, then it produces `-rwx------'. +FILETYPE if provided should be a character denoting the type of file, +such as `?d' for a directory, or `?l' for a symbolic link and will override +the leading `-' char." + (string + (or filetype + (pcase (ash mode -12) + ;; POSIX specifies that the file type is included in st_mode + ;; and provides names for the file types but values only for + ;; the permissions (e.g., S_IWOTH=2). + + ;; (#o017 ??) ;; #define S_IFMT 00170000 + (#o014 ?s) ;; #define S_IFSOCK 0140000 + (#o012 ?l) ;; #define S_IFLNK 0120000 + ;; (8 ??) ;; #define S_IFREG 0100000 + (#o006 ?b) ;; #define S_IFBLK 0060000 + (#o004 ?d) ;; #define S_IFDIR 0040000 + (#o002 ?c) ;; #define S_IFCHR 0020000 + (#o001 ?p) ;; #define S_IFIFO 0010000 + (_ ?-))) + (if (zerop (logand 256 mode)) ?- ?r) + (if (zerop (logand 128 mode)) ?- ?w) + (if (zerop (logand 64 mode)) + (if (zerop (logand 2048 mode)) ?- ?S) + (if (zerop (logand 2048 mode)) ?x ?s)) + (if (zerop (logand 32 mode)) ?- ?r) + (if (zerop (logand 16 mode)) ?- ?w) + (if (zerop (logand 8 mode)) + (if (zerop (logand 1024 mode)) ?- ?S) + (if (zerop (logand 1024 mode)) ?x ?s)) + (if (zerop (logand 4 mode)) ?- ?r) + (if (zerop (logand 2 mode)) ?- ?w) + (if (zerop (logand 512 mode)) + (if (zerop (logand 1 mode)) ?- ?x) + (if (zerop (logand 1 mode)) ?T ?t))))) + +(unless (and (fboundp 'pos-bol) (fboundp 'pos-eol)) + (defalias 'pos-bol 'line-beginning-position) + (defalias 'pos-eol 'line-end-position)) + ;;; Macros helper. ;; @@ -450,26 +360,26 @@ found in SEQ." else return index finally return ls))) -(defun helm-iter-list (seq) - "Return an iterator object from SEQ." +(defun helm-iter-list (seq &optional cycle) + "Return an iterator object from SEQ. +The iterator die and return nil when it reach end of SEQ. +When CYCLE is specified the iterator never ends." (let ((lis seq)) (lambda () (let ((elm (car lis))) - (setq lis (cdr lis)) + (setq lis (if cycle + (or (cdr lis) seq) + (cdr lis))) elm)))) (defun helm-iter-circular (seq) "Infinite iteration on SEQ." - (let ((lis seq)) - (lambda () - (let ((elm (car lis))) - (setq lis (pcase lis (`(,_ . ,ll) (or ll seq)))) - elm)))) + (helm-iter-list seq 'cycle)) (cl-defun helm-iter-sub-next-circular (seq elm &key (test 'eq)) "Infinite iteration of SEQ starting at ELM." (let* ((pos (1+ (helm-position elm seq :test test))) - (sub (append (nthcdr pos seq) (cl-subseq seq 0 pos))) + (sub (append (nthcdr pos seq) (helm-take seq pos))) (iterator (helm-iter-circular sub))) (lambda () (helm-iter-next iterator)))) @@ -649,7 +559,7 @@ INSERT-CONTENT-FN is the function that inserts text to be displayed in BUFNAME." (let ((winconf (current-frame-configuration)) (hframe (selected-frame))) - (helm-log-run-hook 'helm-help-mode-before-hook) + (helm-log-run-hook "helm-help-internal" 'helm-help-mode-before-hook) (with-selected-frame helm-initial-frame (select-frame-set-input-focus helm-initial-frame) (unwind-protect @@ -671,7 +581,7 @@ displayed in BUFNAME." (buffer-disable-undo) (helm-help-event-loop)) (raise-frame hframe) - (helm-log-run-hook 'helm-help-mode-after-hook) + (helm-log-run-hook "helm-help-internal" 'helm-help-mode-after-hook) (setq helm-suspend-update-flag nil) (set-frame-configuration winconf))))) @@ -723,7 +633,9 @@ displayed in BUFNAME." (defun helm-help-quit () "Quit `helm-help'." - (throw 'helm-help-quit nil)) + (if (get-buffer-window helm-help-buffer-name 'visible) + (throw 'helm-help-quit nil) + (quit-window))) (defun helm-help-org-open-at-point () "Calls `org-open-at-point' ignoring errors." @@ -827,8 +739,8 @@ See `helm-help-hkmap' for supported keys and functions." (nreverse result))) (defun helm-mklist (obj) - "If OBJ is a list (but not lambda), return itself. -Otherwise make a list with one element." + "Return OBJ as a list. +Otherwise make a list with one element OBJ." (if (and (listp obj) (not (functionp obj))) obj (list obj))) @@ -919,46 +831,71 @@ hashtable itself." unless (string-match-p regexp str) collect s)) -(defun helm-transform-mapcar (function args) - "`mapcar' for candidate-transformer. +(defun helm-transform-mapcar (fn seq) + "Apply function FN on all elements of list SEQ. +When SEQ is a list of cons cells apply FN on the cdr of each element, +keeping their car unmodified. -ARGS is (cand1 cand2 ...) or ((disp1 . real1) (disp2 . real2) ...) +Examples: -\(helm-transform-mapcar \\='upcase \\='(\"foo\" \"bar\")) -=> (\"FOO\" \"BAR\") -\(helm-transform-mapcar \\='upcase \\='((\"1st\" . \"foo\") (\"2nd\" . \"bar\"))) -=> ((\"1st\" . \"FOO\") (\"2nd\" . \"BAR\")) + (helm-transform-mapcar \\='upcase \\='(\"foo\" \"bar\")) + => (\"FOO\" \"BAR\") + (helm-transform-mapcar \\='upcase \\='((\"1st\" . \"foo\") (\"2nd\" . \"bar\"))) + => ((\"1st\" . \"FOO\") (\"2nd\" . \"BAR\")) " - (cl-loop for arg in args - if (consp arg) - collect (cons (car arg) (funcall function (cdr arg))) - else - collect (funcall function arg))) - -(defsubst helm-append-1 (elm seq) - "Append ELM to SEQ. -If ELM is not a list transform it in list." - (append (helm-mklist elm) seq)) + (cl-loop for elm in seq + if (consp elm) + collect (cons (car elm) (funcall fn (cdr elm))) + else + collect (funcall fn elm))) (defun helm-append-at-nth (seq elm index) - "Append ELM at INDEX in SEQ." - (let ((len (length seq))) - (setq index (min (max index 0) len)) - (if (zerop index) - (helm-append-1 elm seq) - (cl-loop for i in seq - for count from 1 collect i - when (= count index) - if (and (listp elm) (not (functionp elm))) - append elm - else collect elm)))) - -(defun helm-take-first-elements (seq n) + "Append ELM at INDEX in SEQ. +When INDEX is > to the SEQ length ELM is added at end of SEQ. +When INDEX is 0 or negative, ELM is added at beginning of SEQ. + +Examples: + + (helm-append-at-nth \\='(a b c d) \\='(z) 2) + =>(a b z c d) + + (helm-append-at-nth \\='(a b c d) \\='((x . 1) (y . 2)) 2) + =>(a b (x . 1) (y . 2) c d) + + But this is not working: + (helm-append-at-nth \\='(a b c d) \\='(x . 1) 2) + =>Wrong type argument: listp, 1 + +NOTE: This function uses `append' internally, so ELM is expected +to be a list to be appended to SEQ, even if for convenience an +atom is supported as ELM value." + (setq index (min (max index 0) (length seq)) + elm (helm-mklist elm)) + (if (zerop index) + (append elm seq) + (let* ((end-part (nthcdr index seq)) + (len (length end-part)) + (beg-part (butlast seq len))) + (append beg-part elm end-part)))) + +(cl-defgeneric helm-take (seq n) "Return the first N elements of SEQ if SEQ is longer than N. It is used for narrowing list of candidates to the `helm-candidate-number-limit'." (if (> (length seq) n) (cl-subseq seq 0 n) seq)) +(cl-defmethod helm-take ((seq list) n) + "`helm-take' optimized for lists." + (let ((store '())) + (if (> n (length seq)) + seq + (while (> (1+ (cl-decf n)) 0) + (push (pop seq) store)) + (nreverse store)))) + +(defalias 'helm-take-first-elements 'helm-take) +(make-obsolete 'helm-take-first-elements 'helm-take "3.9.1") + (defun helm-source-by-name (name &optional sources) "Get a Helm source in SOURCES by NAME. @@ -1003,7 +940,7 @@ Example: (setq B \\='(1 2 3 4 5 6 7 8 9)) - (helm-group-candidates-by B #'cl-oddp 2 \\='separate) + (helm-group-candidates-by B #\\='cl-oddp 2 \\='separate) => ((2 4 6 8) (1 3 5 7 9)) SELECTION specify where to start in CANDIDATES. @@ -1038,17 +975,17 @@ Examples: (reverse sequence) sequence)) (pos (1+ (cl-position elm new-seq :test 'equal)))) - (append (nthcdr pos new-seq) (cl-subseq new-seq 0 pos)))) + (append (nthcdr pos new-seq) (helm-take new-seq pos)))) ;;; Strings processing. ;; (defun helm-stringify (elm) "Return the representation of ELM as a string. ELM can be a string, a number or a symbol." - (cl-typecase elm - (string elm) - (number (number-to-string elm)) - (symbol (symbol-name elm)))) + (pcase elm + ((pred stringp) elm) + ((pred numberp) (number-to-string elm)) + ((pred symbolp) (symbol-name elm)))) (defun helm-substring (str width) "Return the substring of string STR from 0 to WIDTH. @@ -1057,7 +994,7 @@ Handle multibyte characters by moving by columns." (save-excursion (insert str)) (move-to-column width) - (buffer-substring (point-at-bol) (point)))) + (buffer-substring (pos-bol) (point)))) (defun helm-substring-by-width (str width &optional endstr) "Truncate string STR to end at column WIDTH. @@ -1108,7 +1045,7 @@ than WIDTH." (defun helm-current-line-contents () "Current line string without properties." - (buffer-substring-no-properties (point-at-bol) (point-at-eol))) + (buffer-substring-no-properties (pos-bol) (pos-eol))) (defun helm--replace-regexp-in-buffer-string (regexp rep str &optional fixedcase literal subexp start) "Replace REGEXP by REP in string STR. @@ -1183,14 +1120,13 @@ accepted. Example: - (let ((answer (helm-read-answer - \"answer [y,n,!,q]: \" - \\='(\"y\" \"n\" \"!\" \"q\")))) - (pcase answer - (\"y\" \"yes\") - (\"n\" \"no\") - (\"!\" \"all\") - (\"q\" \"quit\"))) + (pcase (helm-read-answer + \"answer [y,n,!,q]: \" + \\='(\"y\" \"n\" \"!\" \"q\")) + (\"y\" \"yes\") + (\"n\" \"no\") + (\"!\" \"all\") + (\"q\" \"quit\")) " (helm-awhile (read-key (propertize prompt 'face 'minibuffer-prompt)) @@ -1199,6 +1135,41 @@ Example: (cl-return str) (message "Please answer by %s" (mapconcat 'identity answer-list ", ")) (sit-for 1))))) + +(defun helm-read-answer-dolist-with-action (prompt list action) + "Read answer with PROMPT and execute ACTION on each element of LIST. + +Argument PROMPT is a format spec string e.g. \"Do this on %s?\" +which take each elements of LIST as argument, no need to provide +the help part i.e. [y,n,!,q] it will be already added. + +While looping through LIST, ACTION is executed on each elements +differently depending of answer: + +- y Execute ACTION on element. +- n Skip element. +- ! Don't ask anymore and execute ACTION on remaining elements. +- q Skip all remaining elements." + (let (dont-ask) + (catch 'break + (dolist (elm list) + (if dont-ask + (funcall action elm) + (pcase (helm-read-answer + (format (concat prompt "[y,n,!,q]") elm) + '("y" "n" "!" "q")) + ("y" (funcall action elm)) + ("n" (ignore)) + ("!" (prog1 + (funcall action elm) + (setq dont-ask t))) + ("q" (throw 'break nil)))))))) + +(defsubst helm-string-numberp (str) + "Return non nil if string STR represent a number." + (cl-assert (stringp str) t) + (or (cl-loop for c across str always (char-equal c ?0)) + (not (zerop (string-to-number str))))) ;;; Symbols routines ;; @@ -1316,10 +1287,16 @@ TYPE when nil specify function, for other values see ((defvar defface) (or (symbol-file sym it) (help-C-file-name sym 'var))) + ;; Sometimes e.g. with prefix key symbols + ;; `find-function-library' returns a list of only one + ;; element, the symbol itself i.e. no library. (t (cdr (find-function-library sym))))) - (library (find-library-name - (helm-basename symbol-lib t)))) - (find-function-search-for-symbol sym type library))) + (library (and symbol-lib + (find-library-name + (helm-basename symbol-lib t))))) + (if library + (find-function-search-for-symbol sym type library) + (error "Don't know where `%s' is defined" sym)))) (defun helm-find-function (func) "Try to jump to FUNC definition. @@ -1328,8 +1305,13 @@ using LOAD-PATH." (if (not helm-current-prefix-arg) (find-function (helm-symbolify func)) (let ((place (helm-find-function-noselect func))) - (when place - (switch-to-buffer (car place)) (goto-char (cdr place)))))) + (if (cdr place) + (progn + (switch-to-buffer (car place)) (goto-char (cdr place))) + (helm-aif (car place) + (message "Couldn't find Function `%s' in `%s'" + func (buffer-name it)) + (message "Couldn't find Function `%s'" func)))))) (defun helm-find-variable (var) "Try to jump to VAR definition. @@ -1398,6 +1380,30 @@ Argument ALIST is an alist of associated major modes." (eq (car (rassq cdr-o-assoc-mode alist)) cur-maj-mode))))) +;;; Source processing +;; +(defun helm-map-candidates-in-source (src fn pred) + "Map over all candidates in SRC and execute FN if PRED returns non nil. +Arg FN and PRED are functions called with current display part of +candidate as arg." + (declare (indent 1)) + (save-excursion + (goto-char (helm-get-previous-header-pos)) + (helm-next-line) + (let* ((next-head (helm-get-next-header-pos)) + (end (and next-head + (save-excursion + (goto-char next-head) + (forward-line -1) + (point)))) + (maxpoint (or end (point-max)))) + (while (< (point) maxpoint) + (helm-mark-current-line) + (let ((cand (helm-get-selection nil 'withprop src))) + (when (funcall pred cand) + (funcall fn cand))) + (forward-line 1) (end-of-line))))) + ;;; Files routines ;; (defun helm-file-name-sans-extension (filename) @@ -1412,9 +1418,7 @@ Argument ALIST is an alist of associated major modes." (defsubst helm-file-name-extension (file) "Returns FILE extension if it is not a number." (helm-aif (file-name-extension file) - (and (not (string-match "\\`0+\\'" it)) - (zerop (string-to-number it)) - it))) + (and (not (helm-string-numberp it)) it))) (defun helm-basename (fname &optional ext) "Print FNAME with any leading directory components removed. @@ -1432,11 +1436,16 @@ unconditionally." (file-name-sans-extension (file-name-nondirectory fname)) (file-name-nondirectory (directory-file-name fname))))) -(defun helm-basedir (fname) - "Return the base directory of filename ending by a slash." +(defun helm-basedir (fname &optional parent) + "Return the base directory of filename ending by a slash. +If PARENT is specified and FNAME is a directory return the parent +directory of FNAME." (helm-aif (and fname (or (and (string= fname "~") "~") - (file-name-directory fname))) + (file-name-directory + (if parent + (directory-file-name fname) + fname)))) (file-name-as-directory it))) (defun helm-current-directory () @@ -1664,7 +1673,7 @@ I.e. when using `helm-next-line' and friends in BODY." :test 'equal))) (defvar helm-blacklist-completion-styles '(emacs21 emacs22)) -(defun helm--prepare-completion-styles (&optional nomode styles) +(defun helm--prepare-completion-styles (&optional com-or-mode styles) "Return a suitable list of styles for `completion-styles'. When `helm-completion-style' is not `emacs' the Emacs vanilla @@ -1673,38 +1682,41 @@ default `completion-styles' is used except for value for `helm-completion-style'. If styles are specified in `helm-completion-styles-alist' for a -particular mode, use these styles unless NOMODE is non nil. +particular mode, use these styles for the corresponding mode. +If COM-OR-MODE (a mode or a command) is specified it is used to find the +corresponding styles in `helm-completion-styles-alist'. + If STYLES is specified as a list of styles suitable for `completion-styles' these styles are used in the given order. Otherwise helm style is added to `completion-styles' always after flex or helm-flex completion style if present." ;; For `helm-completion-style' and `helm-completion-styles-alist'. (require 'helm-mode) - (if (memq helm-completion-style '(helm helm-fuzzy)) - ;; Keep default settings, but probably nil is fine as well. - '(basic partial-completion emacs22) - (or - styles - (pcase (and (null nomode) - (cdr (assq major-mode helm-completion-styles-alist))) - (`(,_l . ,ll) ll)) - ;; We need to have flex always behind helm, otherwise - ;; when matching against e.g. '(foo foobar foao frogo bar - ;; baz) with pattern "foo" helm style if before flex will - ;; return foo and foobar only defeating flex that would - ;; return foo foobar foao and frogo. - (let* ((wflex (car (or (assq 'flex completion-styles-alist) - (assq 'helm-flex completion-styles-alist)))) - (styles (append (and (memq wflex completion-styles) - (list wflex)) - (cl-loop for s in completion-styles - unless (or (memq s helm-blacklist-completion-styles) - (memq wflex completion-styles)) - collect s)))) - (helm-append-at-nth - styles '(helm) - (if (memq wflex completion-styles) - 1 0)))))) + (let ((from (if com-or-mode com-or-mode major-mode))) + (if (memq helm-completion-style '(helm helm-fuzzy)) + ;; Keep default settings, but probably nil is fine as well. + '(basic partial-completion emacs22) + (or + styles + (pcase (cdr (assq from helm-completion-styles-alist)) + (`(,_l . ,ll) ll)) + ;; We need to have flex always behind helm, otherwise + ;; when matching against e.g. '(foo foobar foao frogo bar + ;; baz) with pattern "foo" helm style if before flex will + ;; return foo and foobar only defeating flex that would + ;; return foo foobar foao and frogo. + (let* ((wflex (car (or (assq 'flex completion-styles-alist) + (assq 'helm-flex completion-styles-alist)))) + (styles (append (and (memq wflex completion-styles) + (list wflex)) + (cl-loop for s in completion-styles + unless (or (memq s helm-blacklist-completion-styles) + (memq wflex completion-styles)) + collect s)))) + (helm-append-at-nth + styles '(helm) + (if (memq wflex completion-styles) + 1 0))))))) (defun helm-dynamic-completion (collection predicate &optional point metadata nomode styles) "Build a completion function for `helm-pattern' in COLLECTION. @@ -1776,6 +1788,18 @@ Also `helm-completion-style' settings have no effect here, all))))) ;; Ensure circular objects are removed. (complete-with-action t compsfn helm-pattern predicate)))) + +(defun helm-guess-filename-at-point () + (with-helm-current-buffer + ;; Ensure to disable the evil `ffap-machine-at-point' which may run here as + ;; `file-name-at-point-functions' contains by default + ;; `ffap-guess-file-name-at-point' See bug#2574. + ;; Use same value as in Emacs-29 for next 3 vars to ensure `ffap-machine-p' + ;; never ping. + (let ((ffap-machine-p-known 'accept) + (ffap-machine-p-local 'reject) + (ffap-machine-p-unknown 'reject)) + (run-hook-with-args-until-success 'file-name-at-point-functions)))) ;; Yank text at point. ;; @@ -1879,7 +1903,7 @@ broken." ;;; Fontlock -(cl-dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) +(dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) (font-lock-add-keywords mode '(("(\\<\\(with-helm-after-update-hook\\)\\>" 1 font-lock-keyword-face) @@ -1897,6 +1921,7 @@ broken." ("(\\<\\(helm-acond\\)\\>" 1 font-lock-keyword-face) ("(\\<\\(helm-aand\\)\\>" 1 font-lock-keyword-face) ("(\\<\\(helm-with-gensyms\\)\\>" 1 font-lock-keyword-face) + ("(\\<\\(helm-read-answer-dolist-with-action\\)\\>" 1 font-lock-keyword-face) ("(\\<\\(helm-read-answer\\)\\>" 1 font-lock-keyword-face)))) (provide 'helm-lib) diff --git a/elpa/helm-core-20220607.1243/helm-multi-match.el b/elpa/helm-core-20230806.1956/helm-multi-match.el similarity index 96% rename from elpa/helm-core-20220607.1243/helm-multi-match.el rename to elpa/helm-core-20230806.1956/helm-multi-match.el index 173df2ab..e4d143e6 100644 --- a/elpa/helm-core-20220607.1243/helm-multi-match.el +++ b/elpa/helm-core-20230806.1956/helm-multi-match.el @@ -224,8 +224,8 @@ the same cons cell against CANDIDATE. I.e. (identity (string-match \"foo\" \"foo bar\")) => t." (let ((pat (helm-mm-3-get-patterns pattern))) (cl-loop for (predicate . regexp) in pat - for re = (if (and (not (helm-mm-regexp-p regexp)) - helm-mm--match-on-diacritics) + for re = (if (and helm-mm--match-on-diacritics + (not (helm-mm-regexp-p regexp))) (char-fold-to-regexp regexp) regexp) always (funcall predicate @@ -241,28 +241,28 @@ I.e. (identity (string-match \"foo\" \"foo bar\")) => t." This is the search function for `candidates-in-buffer' enabled sources. Use the same method as `helm-mm-3-match' except it search in buffer instead of matching on a string. -i.e (identity (re-search-forward \"foo\" (point-at-eol) t)) => t." +i.e (identity (re-search-forward \"foo\" (pos-eol) t)) => t." (cl-loop with pat = (if (stringp pattern) (helm-mm-3-get-patterns pattern) pattern) with regex = (cdar pat) with regex1 = (if (and regex - (not (helm-mm-regexp-p regex)) - helm-mm--match-on-diacritics) + helm-mm--match-on-diacritics + (not (helm-mm-regexp-p regex))) (char-fold-to-regexp regex) regex) when (eq (caar pat) 'not) return ;; Pass the job to `helm-search-match-part'. - (prog1 (list (point-at-bol) (point-at-eol)) + (prog1 (list (pos-bol) (pos-eol)) (forward-line 1)) while (condition-case _err (funcall searchfn1 (or regex1 "") nil t) (invalid-regexp nil)) - for bol = (point-at-bol) - for eol = (point-at-eol) + for bol = (pos-bol) + for eol = (pos-eol) if (cl-loop for (pred . str) in (cdr pat) - for regexp = (if (and (not (helm-mm-regexp-p str)) - helm-mm--match-on-diacritics) + for regexp = (if (and helm-mm--match-on-diacritics + (not (helm-mm-regexp-p str))) (char-fold-to-regexp str) str) always diff --git a/elpa/helm-core-20220607.1243/helm-source.el b/elpa/helm-core-20230806.1956/helm-source.el similarity index 95% rename from elpa/helm-core-20220607.1243/helm-source.el rename to elpa/helm-core-20230806.1956/helm-source.el index 6b438234..0bad9b0f 100644 --- a/elpa/helm-core-20220607.1243/helm-source.el +++ b/elpa/helm-core-20230806.1956/helm-source.el @@ -39,6 +39,7 @@ (declare-function helm-init-candidates-in-buffer "helm-core.el") (declare-function helm-interpret-value "helm-core.el") (declare-function helm-fuzzy-highlight-matches "helm-core.el") +(declare-function helm-marked-candidates "helm-core.el") ;;; Advice Emacs fn ;; Make Classes's docstrings more readable by removing al the @@ -498,9 +499,14 @@ " Enable fuzzy matching in this source. This will overwrite settings in MATCH slot, and for sources built with child class `helm-source-in-buffer' the SEARCH slot. + This also add a `filtered-candidate-transformer' function to sort candidates + (see `helm-fuzzy-sort-fn') according to the score of each candidate which is + computed with `helm-fuzzy-default-score-fn'. This is an easy way of enabling fuzzy matching, but you can use the MATCH or SEARCH slots yourself if you want something more elaborated, mixing - different type of match (See `helm-source-buffers' class for example). + different type of match (See `helm-source-buffers' class for example), you + will have in this case to provide as well a sort fn + in `filtered-candidate-transformer' yourself. This attribute is not supported for asynchronous sources since they perform pattern matching themselves.") @@ -655,9 +661,11 @@ " A local hook that run at beginning of initilization of this source. i.e Before the creation of `helm-buffer'. - Should be a variable (defined with defvar). - Can be also an anonymous function or a list of functions - directly added to slot, this is not recommended though.") + Should be a variable (a symbol) bound to a list of + functions or a single function (see `run-hooks' documentation). + Even better is to use `add-hook' to feed this variable. + Usage of an anonymous function, or a list of functions is still + supported but not recommended.") (after-init-hook :initarg :after-init-hook @@ -666,10 +674,12 @@ :documentation " A local hook that run at end of initilization of this source. i.e After the creation of `helm-buffer'. - - Should be a variable. - Can be also an anonymous function or a list of functions - directly added to slot, this is not recommended though.") + + Should be a variable (a symbol) bound to a list of + functions or a single function (see `run-hooks' documentation). + Even better is to use `add-hook' to feed this variable. + Usage of an anonymous function, or a list of functions is still + supported but not recommended.") (delayed :initarg :delayed @@ -752,6 +762,8 @@ " Disable all helm matching functions when non nil. The :candidates function in this case is in charge of fetching candidates dynamically according to `helm-pattern'. + If you want to make your :candidates function working with `completion-styles' + use the function `helm-dynamic-completion'. Note that :volatile is automatically enabled when using this, so no need to specify it.")) @@ -918,7 +930,7 @@ See `helm-candidates-in-buffer' for more infos.") (when (helm-get-attr 'linum) (while (not (eobp)) (add-text-properties - (point-at-bol) (point-at-eol) + (pos-bol) (pos-eol) `(helm-linum ,count)) (cl-incf count) (forward-line 1))))))) @@ -1042,11 +1054,12 @@ an eieio class." (let* ((actions (slot-value source 'action)) (action-transformers (slot-value source 'action-transformer)) (new-action (list (cons name fn))) - (transformer (lambda (actions candidate) - (cond ((funcall predicate candidate) - (helm-append-at-nth - actions new-action index)) - (t actions))))) + (transformer (lambda (actions _candidate) + (let ((candidate (car (helm-marked-candidates)))) + (cond ((funcall predicate candidate) + (helm-append-at-nth + actions new-action index)) + (t actions)))))) (cond ((functionp actions) (setf (slot-value source 'action) (list (cons "Default action" actions)))) ((listp actions) @@ -1155,7 +1168,16 @@ The header line is based on one of `persistent-action-if', (let ((val (if (symbolp it) (symbol-value it) it))) - (setf (slot-value source 'requires-pattern) val)))) + (setf (slot-value source 'requires-pattern) val))) + (let ((sname (slot-value source 'name))) + (pcase (slot-value source 'before-init-hook) + ((or (and val (pred (functionp)) (guard (not (symbolp val)))) + (pred (consp))) + (warn "Helm source `%s': before-init-hook Should be defined as a symbol" sname))) + (pcase (slot-value source 'after-init-hook) + ((or (and val (pred (functionp)) (guard (not (symbolp val)))) + (pred (consp))) + (warn "Helm source `%s': after-init-hook Should be defined as a symbol" sname))))) (cl-defmethod helm-setup-user-source ((_source helm-source))) diff --git a/elpa/helm-gtags-20170116.529/helm-gtags-pkg.el b/elpa/helm-gtags-20170116.529/helm-gtags-pkg.el deleted file mode 100644 index 6cd6fd0e..00000000 --- a/elpa/helm-gtags-20170116.529/helm-gtags-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "helm-gtags" "20170116.529" "GNU GLOBAL helm interface" '((emacs "24.4") (helm "2.0")) :commit "108e93d0d099ebb7b98847388f368311cf177033" :authors '(("Syohei YOSHIDA" . "syohex@gmail.com")) :maintainer '("Syohei YOSHIDA" . "syohex@gmail.com") :url "https://github.com/syohex/emacs-helm-gtags") diff --git a/elpa/helm-gtags-20170116.529/helm-gtags-autoloads.el b/elpa/helm-gtags-20200602.1610/helm-gtags-autoloads.el similarity index 63% rename from elpa/helm-gtags-20170116.529/helm-gtags-autoloads.el rename to elpa/helm-gtags-20200602.1610/helm-gtags-autoloads.el index 68e6e539..e6263ad8 100644 --- a/elpa/helm-gtags-20170116.529/helm-gtags-autoloads.el +++ b/elpa/helm-gtags-20200602.1610/helm-gtags-autoloads.el @@ -1,4 +1,4 @@ -;;; helm-gtags-autoloads.el --- automatically extracted autoloads +;;; helm-gtags-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -10,49 +10,33 @@ ;;; Generated autoloads from helm-gtags.el (autoload 'helm-gtags-clear-all-cache "helm-gtags" "\ - - -\(fn)" t nil) +Not documented." t nil) (autoload 'helm-gtags-clear-cache "helm-gtags" "\ - - -\(fn)" t nil) +Not documented." t nil) (autoload 'helm-gtags-next-history "helm-gtags" "\ -Jump to next position on context stack - -\(fn)" t nil) +Jump to next position on context stack" t nil) (autoload 'helm-gtags-previous-history "helm-gtags" "\ -Jump to previous position on context stack - -\(fn)" t nil) +Jump to previous position on context stack" t nil) (autoload 'helm-gtags-select "helm-gtags" "\ - - -\(fn)" t nil) +Not documented." t nil) (autoload 'helm-gtags-select-path "helm-gtags" "\ - - -\(fn)" t nil) +Not documented." t nil) (autoload 'helm-gtags-tags-in-this-function "helm-gtags" "\ -Show tagnames which are referenced in this function and jump to it. - -\(fn)" t nil) +Show tagnames which are referenced in this function and jump to it." t nil) (autoload 'helm-gtags-create-tags "helm-gtags" "\ - +Not documented. \(fn DIR LABEL)" t nil) (autoload 'helm-gtags-delete-tags "helm-gtags" "\ -Delete file GTAGS, GRTAGS, GPATH, ID etc. generated by gtags. - -\(fn)" t nil) +Delete file GTAGS, GRTAGS, GPATH, ID etc. generated by gtags." t nil) (autoload 'helm-gtags-find-tag "helm-gtags" "\ Jump to definition @@ -87,65 +71,66 @@ Find file from tagged with gnu global. (autoload 'helm-gtags-find-tag-from-here "helm-gtags" "\ Jump point by current point information. Jump to definition point if cursor is on its reference. -Jump to reference point if curosr is on its definition - -\(fn)" t nil) +Jump to reference point if curosr is on its definition" t nil) (autoload 'helm-gtags-dwim "helm-gtags" "\ Find by context. Here is - on include statement then jump to included file - on symbol definition then jump to its references -- on reference point then jump to its definition. - -\(fn)" t nil) +- on reference point then jump to its definition." t nil) (autoload 'helm-gtags-parse-file "helm-gtags" "\ Parse current file with gnu global. This is similar to `imenu'. -You can jump definitions of functions, symbols in this file. +You can jump definitions of functions, symbols in this file." t nil) -\(fn)" t nil) +(autoload 'helm-gtags-push-stack "helm-gtags" "\ +Push current location to the stack." t nil) (autoload 'helm-gtags-pop-stack "helm-gtags" "\ -Jump to previous point on the context stack and pop it from stack. - -\(fn)" t nil) +Jump to previous point on the context stack and pop it from stack." t nil) (autoload 'helm-gtags-show-stack "helm-gtags" "\ -Show current context stack. - -\(fn)" t nil) +Show current context stack." t nil) (autoload 'helm-gtags-clear-stack "helm-gtags" "\ -Clear current context stack. - -\(fn)" t nil) +Clear current context stack." t nil) (autoload 'helm-gtags-clear-all-stacks "helm-gtags" "\ -Clear all context stacks. - -\(fn)" t nil) +Clear all context stacks." t nil) (autoload 'helm-gtags-update-tags "helm-gtags" "\ Update TAG file. Update All files with `C-u' prefix. -Generate new TAG file in selected directory with `C-u C-u' - -\(fn)" t nil) +Generate new TAG file in selected directory with `C-u C-u'" t nil) (autoload 'helm-gtags-resume "helm-gtags" "\ -Resurrect previously invoked `helm-gtags` command. - -\(fn)" t nil) +Resurrect previously invoked `helm-gtags` command." t nil) (autoload 'helm-gtags-mode "helm-gtags" "\ Toggle Helm-Gtags mode on or off. -With a prefix argument ARG, enable Helm-Gtags mode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'. + +This is a minor mode. If called interactively, toggle the +`Helm-Gtags mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `helm-gtags-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + \\{helm-gtags-mode-map} \(fn &optional ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-gtags" '("helm-"))) +(register-definition-prefixes "helm-gtags" '("helm-")) + +;;;*** + +;;;### (autoloads nil nil ("helm-gtags-pkg.el") (0 0 0 0)) ;;;*** diff --git a/elpa/helm-gtags-20200602.1610/helm-gtags-pkg.el b/elpa/helm-gtags-20200602.1610/helm-gtags-pkg.el new file mode 100644 index 00000000..0c280e83 --- /dev/null +++ b/elpa/helm-gtags-20200602.1610/helm-gtags-pkg.el @@ -0,0 +1,13 @@ +(define-package "helm-gtags" "20200602.1610" "GNU GLOBAL helm interface" + '((emacs "24.4") + (helm "2.0")) + :commit "a15fe1dd272d252ad933d8129db1dce02fd41adb" :authors + '(("Syohei YOSHIDA" . "syohex@gmail.com")) + :maintainers + '(("Syohei YOSHIDA" . "syohex@gmail.com")) + :maintainer + '("Syohei YOSHIDA" . "syohex@gmail.com") + :url "https://github.com/syohex/emacs-helm-gtags") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-gtags-20170116.529/helm-gtags.el b/elpa/helm-gtags-20200602.1610/helm-gtags.el similarity index 82% rename from elpa/helm-gtags-20170116.529/helm-gtags.el rename to elpa/helm-gtags-20200602.1610/helm-gtags.el index 8832c31b..eb510322 100644 --- a/elpa/helm-gtags-20170116.529/helm-gtags.el +++ b/elpa/helm-gtags-20200602.1610/helm-gtags.el @@ -4,8 +4,7 @@ ;; Author: Syohei YOSHIDA ;; URL: https://github.com/syohex/emacs-helm-gtags -;; Package-Version: 20170116.529 -;; Version: 1.5.6 +;; Version: 1.5.7 ;; Package-Requires: ((emacs "24.4") (helm "2.0")) ;; This program is free software; you can redistribute it and/or modify @@ -65,81 +64,103 @@ :group 'helm) (defcustom helm-gtags-path-style 'root - "Style of file path" + "Style of file path." :type '(choice (const :tag "Root of the current project" root) (const :tag "Relative from the current directory" relative) (const :tag "Absolute Path" absolute))) (defcustom helm-gtags-ignore-case nil "Ignore case in each search." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-cygwin-use-global-w32-port t "Use the GNU global win32 port in Cygwin." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-read-only nil "Gtags read only mode." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-auto-update nil "*If non-nil, tag files are updated whenever a file is saved." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-pulse-at-cursor t - "If non-nil, pulse at point after jumping" - :type 'boolean) + "If non-nil, pulse at point after jumping." + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-cache-select-result nil "*If non-nil, results of helm-gtags-select and helm-gtags-select-path are cached." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-cache-max-result-size (* 10 1024 1024) ;10M "Max size(bytes) to cache for each select result." - :type 'integer) + :type 'integer + :group 'helm-gtags) (defcustom helm-gtags-update-interval-second 60 - "Tags are updated in `after-save-hook' if this seconds is passed from last update. + "Tags are updated in `after-save-hook' if this seconds is passed from \ +last update. Always update if value of this variable is nil." :type '(choice (integer :tag "Update interval seconds") - (boolean :tag "Update every time" nil))) + (boolean :tag "Update every time" nil)) + :group 'helm-gtags) (defcustom helm-gtags-highlight-candidate t - "Highlight candidate or not" - :type 'boolean) + "Highlight candidate or not." + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-use-input-at-cursor nil - "Use input at cursor" - :type 'boolean) + "Use input at cursor." + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-prefix-key "\C-c" "If non-nil, it is used for the prefix key of gtags-xxx command." - :type 'string) + :type 'string + :group 'helm-gtags) (defcustom helm-gtags-suggested-key-mapping nil "If non-nil, suggested key mapping is enabled." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-preselect nil "If non-nil, preselect current file and line." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-display-style nil "Style of display result." :type '(choice (const :tag "Show in detail" detail) - (const :tag "Normal style" nil))) + (const :tag "Normal style" nil)) + :group 'helm-gtags) (defcustom helm-gtags-fuzzy-match nil - "Enable fuzzy match" - :type 'boolean) + "Enable fuzzy match." + :type 'boolean + :group 'helm-gtags) (defcustom helm-gtags-maximum-candidates (if helm-gtags-fuzzy-match 100 9999) - "Maximum number of helm candidates" - :type 'integer) + "Maximum number of helm candidates." + :type 'integer + :group 'helm-gtags) + +(defcustom helm-gtags-symbol-at-point-function 'helm-gtags--symbol-at-point + "Function to use to get the symbol at point." + :type 'symbol) (defcustom helm-gtags-direct-helm-completing nil "Use helm mode directly." - :type 'boolean) + :type 'boolean + :group 'helm-gtags) (defface helm-gtags-file '((t :inherit font-lock-keyword-face)) @@ -168,12 +189,15 @@ Always update if value of this variable is nil." (defvar helm-gtags--query nil) (defvar helm-gtags--last-default-directory nil) -(defconst helm-gtags--buffer "*helm gtags*") +(defconst helm-gtags--buffer "*helm gtags*" + "Not documented.") (defconst helm-gtags--include-regexp - "\\`\\s-*#\\(?:include\\|import\\)\\s-*[\"<]\\(?:[./]*\\)?\\(.*?\\)[\">]") + "\\`\\s-*#\\(?:include\\|import\\)\\s-*[\"<]\\(?:[./]*\\)?\\(.*?\\)[\">]" + "Not documented.") (defmacro helm-declare-obsolete-variable (old new version) + "Not documented, OLD, NEW, VERSION." `(progn (defvaralias ,old ,new) (make-obsolete-variable ,old ,new ,version))) @@ -202,18 +226,22 @@ Always update if value of this variable is nil." (pattern . helm-gtags--completing-pattern) (rtag . helm-gtags--completing-grtags) (symbol . helm-gtags--completing-gsyms) - (find-file . helm-gtags--completing-files))) + (find-file . helm-gtags--completing-files)) + "Not documented.") (defconst helm-gtags--search-option-alist '((pattern . "-g") (rtag . "-r") (symbol . "-s") - (find-file . "-Poa"))) + (find-file . "-Poa")) + "Not documented.") (defsubst helm-gtags--windows-p () + "Not documented." (memq system-type '(windows-nt ms-dos))) (defun helm-gtags--remove-carrige-returns () + "Not documented." (when (helm-gtags--windows-p) (save-excursion (goto-char (point-min)) @@ -222,9 +250,11 @@ Always update if value of this variable is nil." ;; Work around for GNU global Windows issue (defsubst helm-gtags--use-abs-path-p (gtagslibpath) + "Not documented." (and (helm-gtags--windows-p) gtagslibpath)) (defun helm-gtags--construct-options (type completion) + "Not documented." (let ((find-file-p (eq type 'find-file)) (gtagslibpath (getenv "GTAGSLIBPATH")) options) @@ -233,7 +263,7 @@ Always update if value of this variable is nil." (when completion (push "-c" options)) (helm-aif (assoc-default type helm-gtags--search-option-alist) - (push it options)) + (push it options)) (when (or (eq helm-gtags-path-style 'absolute) (helm-gtags--use-abs-path-p gtagslibpath)) (push "-a" options)) @@ -246,6 +276,7 @@ Always update if value of this variable is nil." options)) (defun helm-gtags--complete (type string predicate code) + "Not documented." (let* ((options (helm-gtags--construct-options type t)) (args (reverse (cons string options))) candidates) @@ -258,9 +289,13 @@ Always update if value of this variable is nil." (try-completion string candidates predicate) (all-completions string candidates predicate)))) +(defun helm-gtags--symbol-at-point () + (thing-at-point 'symbol)) + (defun helm-gtags--token-at-point (type) + "Not documented." (if (not (eq type 'find-file)) - (thing-at-point 'symbol) + (funcall helm-gtags-symbol-at-point-function) (let ((line (helm-current-line-contents))) (when (string-match helm-gtags--include-regexp line) (match-string-no-properties 1 line))))) @@ -270,9 +305,11 @@ Always update if value of this variable is nil." (pattern . "Find Pattern: ") (rtag . "Find Reference: ") (symbol . "Find Symbol: ") - (find-file . "Find File: "))) + (find-file . "Find File: ")) + "Not documented.") (defun helm-gtags--read-tagname (type &optional default-tagname) + "Not documented." (let ((tagname (helm-gtags--token-at-point type)) (prompt (assoc-default type helm-gtags--prompt-alist)) (comp-func (assoc-default type helm-gtags-comp-func-alist))) @@ -293,29 +330,33 @@ Always update if value of this variable is nil." 'helm-gtags--completing-history tagname)))))) (defun helm-gtags--path-libpath-p (tagroot) + "Not documented." (helm-aif (getenv "GTAGSLIBPATH") - (cl-loop for path in (parse-colon-path it) - for libpath = (file-name-as-directory (expand-file-name path)) - thereis (string= tagroot libpath)))) + (cl-loop for path in (parse-colon-path it) + for libpath = (file-name-as-directory (expand-file-name path)) + thereis (string= tagroot libpath)))) (defsubst helm-gtags--convert-cygwin-windows-file-name-p () + "Not documented." (and (eq system-type 'cygwin) helm-gtags-cygwin-use-global-w32-port)) (defun helm-gtags--tag-directory () + "Not documented." (with-temp-buffer (helm-aif (getenv "GTAGSROOT") - it - (unless (zerop (process-file "global" nil t nil "-p")) - (error "GTAGS not found")) - (goto-char (point-min)) - (when (looking-at "^\\([^\r\n]+\\)") - (let ((tag-path (match-string-no-properties 1))) - (file-name-as-directory - (if (helm-gtags--convert-cygwin-windows-file-name-p) - (cygwin-convert-file-name-from-windows tag-path) - tag-path))))))) + it + (unless (zerop (process-file "global" nil t nil "-p")) + (error "GTAGS not found")) + (goto-char (point-min)) + (when (looking-at "^\\([^\r\n]+\\)") + (let ((tag-path (match-string-no-properties 1))) + (file-name-as-directory + (if (helm-gtags--convert-cygwin-windows-file-name-p) + (cygwin-convert-file-name-from-windows tag-path) + tag-path))))))) (defun helm-gtags--find-tag-directory () + "Not documented." (setq helm-gtags--real-tag-location nil) (let ((tagroot (helm-gtags--tag-directory))) (if (and (helm-gtags--path-libpath-p tagroot) helm-gtags--tag-location) @@ -325,6 +366,7 @@ Always update if value of this variable is nil." (setq helm-gtags--tag-location tagroot)))) (defun helm-gtags--base-directory () + "Not documented." (let ((dir (or helm-gtags--last-default-directory helm-gtags--local-directory (cl-case helm-gtags-path-style @@ -337,31 +379,38 @@ Always update if value of this variable is nil." dir))) (defsubst helm-gtags--new-context-info (index stack) + "Not documented." (list :index index :stack stack)) (defun helm-gtags--put-context-stack (tag-location index stack) + "Not documented." (puthash tag-location (helm-gtags--new-context-info index stack) helm-gtags--context-stack)) (defsubst helm-gtags--current-context () + "Not documented." (let ((file (buffer-file-name (current-buffer)))) (list :file file :position (point) :readonly buffer-file-read-only))) (defsubst helm-gtags--save-current-context () + "Not documented." (setq helm-gtags--saved-context (helm-gtags--current-context))) (defun helm-gtags--open-file (file readonly) + "Not documented." (if readonly (find-file-read-only file) (find-file file))) (defun helm-gtags--open-file-other-window (file readonly) + "Not documented." (setq helm-gtags--use-otherwin nil) (if readonly (find-file-read-only-other-window file) (find-file-other-window file))) (defun helm-gtags--get-context-info () + "Not documented." (let* ((tag-location (helm-gtags--find-tag-directory)) (context-info (gethash tag-location helm-gtags--context-stack)) (context-stack (plist-get context-info :stack))) @@ -370,16 +419,19 @@ Always update if value of this variable is nil." context-info))) (defun helm-gtags--get-or-create-context-info () + "Not documented." (or (gethash helm-gtags--tag-location helm-gtags--context-stack) (helm-gtags--new-context-info -1 nil))) ;;;###autoload (defun helm-gtags-clear-all-cache () + "Not documented." (interactive) (clrhash helm-gtags--result-cache)) ;;;###autoload (defun helm-gtags-clear-cache () + "Not documented." (interactive) (helm-gtags--find-tag-directory) (let* ((tag-location (or helm-gtags--real-tag-location @@ -390,6 +442,7 @@ Always update if value of this variable is nil." (remhash gpath-path helm-gtags--result-cache))) (defun helm-gtags--move-to-context (context) + "Not documented." (let ((file (plist-get context :file)) (curpoint (plist-get context :position)) (readonly (plist-get context :readonly))) @@ -437,6 +490,7 @@ Always update if value of this variable is nil." current-index context-stack))) (defun helm-gtags--get-result-cache (file) + "Not documented." (helm-gtags--find-tag-directory) (let* ((file-path (concat (or helm-gtags--real-tag-location helm-gtags--tag-location) @@ -449,6 +503,7 @@ Always update if value of this variable is nil." nil))) (defun helm-gtags--put-result-cache (file cache) + "Not documented." (helm-gtags--find-tag-directory) (let* ((file-path (concat (or helm-gtags--real-tag-location helm-gtags--tag-location) @@ -458,6 +513,7 @@ Always update if value of this variable is nil." (puthash file-path hash-value helm-gtags--result-cache))) (defun helm-gtags--referer-function (file ref-line) + "Not documented." (let ((is-opened (cl-loop with path = (concat default-directory file) for buf in (buffer-list) when (string= (buffer-file-name buf) path) @@ -473,6 +529,7 @@ Always update if value of this variable is nil." retval))) (defun helm-gtags--show-detail () + "Not documented." (goto-char (point-min)) (while (not (eobp)) (let ((line (helm-current-line-contents))) @@ -486,6 +543,7 @@ Always update if value of this variable is nil." (forward-line 1))))) (defun helm-gtags--print-path-in-gtagslibpath (args) + "Not documented." (let ((libpath (getenv "GTAGSLIBPATH"))) (when libpath (dolist (path (parse-colon-path libpath)) @@ -493,6 +551,7 @@ Always update if value of this variable is nil." (apply #'process-file "global" nil t nil "-Poa" args)))))) (defun helm-gtags--exec-global-command (type input &optional detail) + "Not documented." (let ((args (helm-gtags--construct-command type input))) (helm-gtags--find-tag-directory) (helm-gtags--save-current-context) @@ -512,6 +571,7 @@ Always update if value of this variable is nil." (helm-gtags--show-detail))))))) (defun helm-gtags--construct-command (type &optional in) + "Not documented." (setq helm-gtags--local-directory nil) (let ((dir (helm-attr 'helm-gtags-base-directory (helm-get-current-source)))) (when (and dir (not (eq type 'find-file))) @@ -524,21 +584,27 @@ Always update if value of this variable is nil." (reverse (cons input options)))) (defun helm-gtags--tags-init (&optional input) + "Not documented." (helm-gtags--exec-global-command 'tag input)) (defun helm-gtags--pattern-init (&optional input) + "Not documented." (helm-gtags--exec-global-command 'pattern input helm-gtags-display-style)) (defun helm-gtags--rtags-init (&optional input) + "Not documented." (helm-gtags--exec-global-command 'rtag input helm-gtags-display-style)) (defun helm-gtags--gsyms-init () + "Not documented." (helm-gtags--exec-global-command 'symbol nil helm-gtags-display-style)) (defun helm-gtags--files-init () + "Not documented." (helm-gtags--exec-global-command 'find-file nil)) (defun helm-gtags--real-file-name () + "Not documented." (let ((buffile (buffer-file-name))) (unless buffile (error "This buffer is not related to file.")) @@ -547,6 +613,7 @@ Always update if value of this variable is nil." (file-truename buffile)))) (defun helm-gtags--find-tag-from-here-init () + "Not documented." (helm-gtags--find-tag-directory) (helm-gtags--save-current-context) (let ((token (helm-gtags--token-at-point 'from-here))) @@ -572,6 +639,7 @@ Always update if value of this variable is nil." (t (error "%s: not found" token))))))))) (defun helm-gtags--parse-file-init () + "Not documented." (with-current-buffer (helm-candidate-buffer 'global) (unless (zerop (process-file "global" nil t nil "--result=cscope" "-f" helm-gtags--parsed-file)) @@ -579,6 +647,7 @@ Always update if value of this variable is nil." (helm-gtags--remove-carrige-returns))) (defun helm-gtags--push-context (context) + "Not documented." (let* ((context-info (helm-gtags--get-or-create-context-info)) (current-index (plist-get context-info :index)) (context-stack (plist-get context-info :stack))) @@ -589,11 +658,13 @@ Always update if value of this variable is nil." (helm-gtags--put-context-stack helm-gtags--tag-location -1 context-stack))) (defsubst helm-gtags--select-find-file-func () + "Not documented." (if helm-gtags--use-otherwin #'helm-gtags--open-file-other-window #'helm-gtags--open-file)) (defun helm-gtags--do-open-file (open-func file line) + "Not documented." (funcall open-func file helm-gtags-read-only) (goto-char (point-min)) (forward-line (1- line)) @@ -604,19 +675,23 @@ Always update if value of this variable is nil." (pulse-momentary-highlight-one-line (point)))) (defun helm-gtags--find-line-number (cand) + "Not documented." (if (string-match "\\s-+\\([1-9][0-9]+\\)\\s-+" cand) (string-to-number (match-string-no-properties 1 cand)) (error "Can't find line number in %s" cand))) (defun helm-gtags--parse-file-action (cand) + "Not documented." (let ((line (helm-gtags--find-line-number cand)) (open-func (helm-gtags--select-find-file-func))) (helm-gtags--do-open-file open-func helm-gtags--parsed-file line))) (defsubst helm-gtags--has-drive-letter-p (path) + "Not documented." (string-match-p "\\`[a-zA-Z]:" path)) (defun helm-gtags--extract-file-and-line (cand) + "Not documented." (if (and (helm-gtags--windows-p) (helm-gtags--has-drive-letter-p cand)) (when (string-match "\\(\\`[a-zA-Z]:[^:]+\\):\\([^:]+\\)" cand) (cons (match-string-no-properties 1 cand) @@ -625,6 +700,7 @@ Always update if value of this variable is nil." (cons (cl-first elems) (string-to-number (cl-second elems)))))) (defun helm-gtags--action-openfile (cand) + "Not documented." (let* ((file-and-line (helm-gtags--extract-file-and-line cand)) (filename (car file-and-line)) (line (cdr file-and-line)) @@ -633,10 +709,12 @@ Always update if value of this variable is nil." (helm-gtags--do-open-file open-func filename line))) (defun helm-gtags--action-openfile-other-window (cand) + "Not documented." (let ((helm-gtags--use-otherwin t)) (helm-gtags--action-openfile cand))) (defun helm-gtags--file-content-at-pos (file pos) + "Not documented." (with-current-buffer (find-file-noselect file) (save-excursion (goto-char pos) @@ -646,12 +724,14 @@ Always update if value of this variable is nil." (helm-current-line-contents))))) (defun helm-gtags--files-candidate-transformer (file) + "Not documented." (if (eq helm-gtags-path-style 'absolute) file (let ((removed-regexp (concat "\\`" helm-gtags--tag-location))) (replace-regexp-in-string removed-regexp "" file)))) (defun helm-gtags--show-stack-init () + "Not documented." (cl-loop with context-stack = (plist-get (helm-gtags--get-context-info) :stack) with stack-length = (length context-stack) for context in (reverse context-stack) @@ -663,6 +743,7 @@ Always update if value of this variable is nil." collect (cons cand (propertize cand 'index index)))) (defun helm-gtags--persistent-action (cand) + "Not documented." (let* ((file-and-line (helm-gtags--extract-file-and-line cand)) (filename (car file-and-line)) (line (cdr file-and-line)) @@ -677,45 +758,51 @@ Always update if value of this variable is nil." (defvar helm-gtags--find-file-action (helm-make-actions "Open file" #'helm-gtags--action-openfile - "Open file other window" #'helm-gtags--action-openfile-other-window)) + "Open file other window" #'helm-gtags--action-openfile-other-window) + "Not documented.") (defvar helm-source-gtags-tags (helm-build-in-buffer-source "Jump to definitions" - :init 'helm-gtags--tags-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--candidate-transformer - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init 'helm-gtags--tags-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--candidate-transformer + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action) + "Not documented.") (defvar helm-source-gtags-pattern (helm-build-in-buffer-source "Find pattern" - :init 'helm-gtags--pattern-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--candidate-transformer - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init 'helm-gtags--pattern-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--candidate-transformer + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action) + "Not documented.") (defvar helm-source-gtags-rtags (helm-build-in-buffer-source "Jump to references" - :init 'helm-gtags--rtags-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--candidate-transformer - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init 'helm-gtags--rtags-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--candidate-transformer + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action) + "Not documented.") (defvar helm-source-gtags-gsyms (helm-build-in-buffer-source "Jump to symbols" - :init 'helm-gtags--gsyms-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--candidate-transformer - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init 'helm-gtags--gsyms-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--candidate-transformer + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action) + "Not documented.") (defun helm-gtags--highlight-candidate (candidate) + "Not documented." (let ((regexp (concat "\\_<" helm-gtags--last-input "\\_>")) (limit (1- (length candidate))) (last-pos 0) @@ -729,11 +816,13 @@ Always update if value of this variable is nil." candidate)) (defun helm-gtags--transformer-regexp (candidate) + "Not documented." (if (and (helm-gtags--windows-p) (helm-gtags--has-drive-letter-p candidate)) "\\`\\([a-zA-Z]:[^:]+\\):\\([^:]+\\):\\(.*\\)" "\\`\\([^:]+\\):\\([^:]+\\):\\(.*\\)")) (defun helm-gtags--candidate-transformer (candidate) + "Not documented." (if (not helm-gtags-highlight-candidate) candidate (let ((regexp (helm-gtags--transformer-regexp candidate))) @@ -744,6 +833,7 @@ Always update if value of this variable is nil." (helm-gtags--highlight-candidate (match-string 3 candidate))))))) (defun helm-gtags--parse-file-candidate-transformer (file) + "Not documented." (let ((removed-file (replace-regexp-in-string "\\`\\S-+ " "" file))) (when (string-match "\\`\\(\\S-+\\) \\(\\S-+\\) \\(.+\\)\\'" removed-file) (format "%-25s %-5s %s" @@ -753,22 +843,25 @@ Always update if value of this variable is nil." (defvar helm-source-gtags-find-tag-from-here (helm-build-in-buffer-source "Find tag from here" - :init 'helm-gtags--find-tag-from-here-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--candidate-transformer - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init 'helm-gtags--find-tag-from-here-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--candidate-transformer + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action) + "Not documented.") (defvar helm-source-gtags-parse-file (helm-build-in-buffer-source "Parse file" - :init 'helm-gtags--parse-file-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--parse-file-candidate-transformer - :fuzzy-match helm-gtags-fuzzy-match - :action 'helm-gtags--parse-file-action)) + :init 'helm-gtags--parse-file-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--parse-file-candidate-transformer + :fuzzy-match helm-gtags-fuzzy-match + :action 'helm-gtags--parse-file-action) + "Not documented.") (defun helm-gtags--show-stack-action (cand) + "Not documented." (let* ((index (get-text-property 0 'index cand)) (context-info (helm-gtags--get-context-info)) (context-stack (plist-get context-info :stack))) @@ -778,36 +871,42 @@ Always update if value of this variable is nil." (defvar helm-source-gtags-show-stack (helm-build-sync-source "Show Context Stack" - :candidates 'helm-gtags--show-stack-init - :volatile t - :candidate-number-limit helm-gtags-maximum-candidates - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action 'helm-gtags--show-stack-action)) + :candidates 'helm-gtags--show-stack-init + :volatile t + :candidate-number-limit helm-gtags-maximum-candidates + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action 'helm-gtags--show-stack-action) + "Not documented.") ;;;###autoload (defun helm-gtags-select () + "Not documented." (interactive) (helm-gtags--common '(helm-source-gtags-select) nil)) ;;;###autoload (defun helm-gtags-select-path () + "Not documented." (interactive) (helm-gtags--common '(helm-source-gtags-select-path) nil)) (defsubst helm-gtags--beginning-of-defun () + "Not documented." (cl-case major-mode ((c-mode c++-mode java-mode) 'c-beginning-of-defun) (php-mode 'php-beginning-of-defun) (otherwise #'beginning-of-defun))) (defsubst helm-gtags--end-of-defun () + "Not documented." (cl-case major-mode ((c-mode c++-mode java-mode malabar-mode) 'c-end-of-defun) (php-mode 'php-end-of-defun) (otherwise #'end-of-defun))) (defun helm-gtags--current-funcion-bound () + "Not documented." (save-excursion (let (start) (funcall (helm-gtags--beginning-of-defun)) @@ -816,6 +915,7 @@ Always update if value of this variable is nil." (cons start (line-number-at-pos))))) (defun helm-gtags--tags-refered-from-this-function () + "Not documented." (let* ((file (helm-gtags--real-file-name)) (bound (helm-gtags--current-funcion-bound)) (start-line (car bound)) @@ -839,6 +939,7 @@ Always update if value of this variable is nil." (reverse tagnames))))) (defun helm-gtags--tag-in-function-persistent-action (cand) + "Not documented." (let* ((bound (helm-gtags--current-funcion-bound)) (limit (save-excursion (goto-char (point-min)) @@ -863,31 +964,37 @@ Always update if value of this variable is nil." (helm-gtags-find-tag tag)))) (defun helm-gtags--source-select-tag (candidate) + "Not documented." (helm-build-in-buffer-source "Select Tag" - :init (lambda () (helm-gtags--tags-init candidate)) - :candidate-number-limit helm-gtags-maximum-candidates - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init (lambda () (helm-gtags--tags-init candidate)) + :candidate-number-limit helm-gtags-maximum-candidates + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action)) (defun helm-gtags--source-select-rtag (candidate) + "Not documented." (helm-build-in-buffer-source "Select Rtag" - :init (lambda () (helm-gtags--rtags-init candidate)) - :candidate-number-limit helm-gtags-maximum-candidates - :persistent-action 'helm-gtags--persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--find-file-action)) + :init (lambda () (helm-gtags--rtags-init candidate)) + :candidate-number-limit helm-gtags-maximum-candidates + :persistent-action 'helm-gtags--persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--find-file-action)) (defsubst helm-gtags--action-by-timer (src) + "Not documented." (run-with-timer 0.1 nil (lambda () (helm-gtags--common (list src) nil)))) (defun helm-gtags--select-tag-action (c) + "Not documented." (helm-gtags--action-by-timer (helm-gtags--source-select-tag c))) (defun helm-gtags--select-rtag-action (c) + "Not documented." (helm-gtags--action-by-timer (helm-gtags--source-select-rtag c))) (defun helm-gtags--select-cache-init-common (args tagfile) + "Not documented." (let ((cache (helm-gtags--get-result-cache tagfile))) (if cache (insert cache) @@ -898,6 +1005,7 @@ Always update if value of this variable is nil." (helm-gtags--put-result-cache tagfile cache)))))) (defun helm-gtags--source-select-init () + "Not documented." (with-current-buffer (helm-candidate-buffer 'global) (if (not helm-gtags-cache-select-result) (progn @@ -907,19 +1015,21 @@ Always update if value of this variable is nil." (defvar helm-source-gtags-select (helm-build-in-buffer-source "Find tag from here" - :init 'helm-gtags--source-select-init - :candidate-number-limit helm-gtags-maximum-candidates - :persistent-action #'ignore - :fuzzy-match helm-gtags-fuzzy-match - :action (helm-make-actions - "Goto the location" #'helm-gtags--select-tag-action - "Goto the location(other buffer)" - (lambda (c) - (setq helm-gtags--use-otherwin t) - (helm-gtags--select-tag-action c)) - "Move to the referenced point" #'helm-gtags--select-rtag-action))) + :init 'helm-gtags--source-select-init + :candidate-number-limit helm-gtags-maximum-candidates + :persistent-action #'ignore + :fuzzy-match helm-gtags-fuzzy-match + :action (helm-make-actions + "Goto the location" #'helm-gtags--select-tag-action + "Goto the location(other buffer)" + (lambda (c) + (setq helm-gtags--use-otherwin t) + (helm-gtags--select-tag-action c)) + "Move to the referenced point" #'helm-gtags--select-rtag-action)) + "Not documented.") (defun helm-gtags--select-path-init () + "Not documented." (helm-gtags--find-tag-directory) (with-current-buffer (helm-candidate-buffer 'global) (let ((options (if (eq helm-gtags-path-style 'relative) "-Po" "-Poa"))) @@ -930,6 +1040,7 @@ Always update if value of this variable is nil." (helm-gtags--select-cache-init-common (list options) "GPATH"))))) (defun helm-gtags--file-name (name) + "Not documented." (let ((remote (file-remote-p default-directory))) (if (not remote) name @@ -938,44 +1049,53 @@ Always update if value of this variable is nil." (otherwise (concat remote name)))))) (defun helm-gtags--find-file-common (open-fn cand) + "Not documented." (let ((default-directory (helm-gtags--base-directory))) (funcall open-fn (helm-gtags--file-name cand)))) (defun helm-gtags--find-file (cand) + "Not documented." (helm-gtags--find-file-common #'find-file cand)) (defun helm-gtags--find-file-other-window (cand) + "Not documented." (helm-gtags--find-file-common #'find-file-other-window cand)) (defvar helm-gtags--file-util-action (helm-make-actions "Open file" #'helm-gtags--find-file - "Open file other window" #'helm-gtags--find-file-other-window)) + "Open file other window" #'helm-gtags--find-file-other-window) + "Not documented.") (defun helm-gtags--file-persistent-action (cand) + "Not documented." (let ((default-directory (with-helm-current-buffer - default-directory))) + default-directory))) (helm-ff-kill-or-find-buffer-fname (helm-gtags--file-name cand)))) (defvar helm-source-gtags-select-path (helm-build-in-buffer-source "Select path" - :init 'helm-gtags--select-path-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display 'helm-gtags--files-candidate-transformer - :persistent-action #'helm-gtags--file-persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--file-util-action)) + :init 'helm-gtags--select-path-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display 'helm-gtags--files-candidate-transformer + :persistent-action #'helm-gtags--file-persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--file-util-action) + "Not documented.") (defun helm-gtags--searched-directory () + "Not documented." (cl-case (prefix-numeric-value current-prefix-arg) (4 (let ((dir (read-directory-name "Input Directory: "))) (setq helm-gtags--local-directory (file-name-as-directory dir)))) (16 (file-name-directory (buffer-file-name))))) (defsubst helm-gtags--using-other-window-p () + "Not documented." (< (prefix-numeric-value current-prefix-arg) 0)) (defun helm-gtags--make-gtags-sentinel (action) + "Not documented." (lambda (process _event) (when (eq (process-status process) 'exit) (if (zerop (process-exit-status process)) @@ -983,14 +1103,17 @@ Always update if value of this variable is nil." (message "Failed: %s TAGS(%d)" action (process-exit-status process)))))) (defsubst helm-gtags--read-gtagslabel () + "Not documented." (let ((labels '("default" "native" "ctags" "new-ctags" "pygments"))) (completing-read "GTAGSLABEL(Default: default): " labels nil t nil nil "default"))) (defsubst helm-gtags--label-option (label) + "Not documented." (concat "--gtagslabel=" label)) ;;;###autoload (defun helm-gtags-create-tags (dir label) + "Not documented." (interactive (list (read-directory-name "Root Directory: ") (helm-gtags--read-gtagslabel))) @@ -1001,6 +1124,7 @@ Always update if value of this variable is nil." (set-process-sentinel proc (helm-gtags--make-gtags-sentinel 'create))))) (defun helm-gtags--find-tag-simple () + "Not documented." (or (getenv "GTAGSROOT") (locate-dominating-file default-directory "GTAGS") (if (not (yes-or-no-p "File GTAGS not found. Run 'gtags'? ")) @@ -1015,6 +1139,7 @@ Always update if value of this variable is nil." tagroot)))) (defun helm-gtags--current-file-and-line () + "Not documented." (let* ((buffile (buffer-file-name)) (path (cl-case helm-gtags-path-style (absolute buffile) @@ -1025,9 +1150,11 @@ Always update if value of this variable is nil." (format "%s:%d" path (line-number-at-pos)))) (defsubst helm-gtags--clear-variables () + "Not documented." (setq helm-gtags--last-default-directory nil)) (defun helm-gtags--common (srcs tagname) + "Not documented." (helm-gtags--clear-variables) (let ((helm-quit-if-no-candidate t) (helm-execute-action-at-once-if-one t) @@ -1070,8 +1197,7 @@ Always update if value of this variable is nil." (progn (fit-window-to-buffer win) (when (yes-or-no-p "Remove GNU Global tag files? ") - (with-demoted-errors (mapc #'delete-file files)) - )) + (with-demoted-errors (mapc #'delete-file files)))) (when (window-live-p win) (quit-window t win)))))) @@ -1112,16 +1238,18 @@ Always update if value of this variable is nil." (helm-gtags--common '(helm-source-gtags-pattern) pattern)) (defun helm-gtags--find-file-after-hook () + "Not documented." (helm-gtags--push-context helm-gtags--saved-context)) (defvar helm-source-gtags-files (helm-build-in-buffer-source "Find files" - :init #'helm-gtags--files-init - :candidate-number-limit helm-gtags-maximum-candidates - :real-to-display #'helm-gtags--files-candidate-transformer - :persistent-action #'helm-gtags--file-persistent-action - :fuzzy-match helm-gtags-fuzzy-match - :action helm-gtags--file-util-action)) + :init #'helm-gtags--files-init + :candidate-number-limit helm-gtags-maximum-candidates + :real-to-display #'helm-gtags--files-candidate-transformer + :persistent-action #'helm-gtags--file-persistent-action + :fuzzy-match helm-gtags-fuzzy-match + :action helm-gtags--file-util-action) + "Not documented.") ;;;###autoload (defun helm-gtags-find-files (file) @@ -1152,11 +1280,12 @@ Jump to reference point if curosr is on its definition" (if (string-match helm-gtags--include-regexp line) (let ((helm-gtags-use-input-at-cursor t)) (helm-gtags-find-files (match-string-no-properties 1 line))) - (if (and (buffer-file-name) (thing-at-point 'symbol)) + (if (and (buffer-file-name) (funcall helm-gtags-symbol-at-point-function)) (helm-gtags-find-tag-from-here) (call-interactively 'helm-gtags-find-tag))))) (defun helm-gtags--set-parsed-file () + "Not documented." (let* ((this-file (file-name-nondirectory (buffer-file-name))) (file (if current-prefix-arg (read-file-name "Parsed File: " nil this-file) @@ -1164,6 +1293,7 @@ Jump to reference point if curosr is on its definition" (setq helm-gtags--parsed-file (expand-file-name file)))) (defun helm-gtags--find-preselect-line () + "Not documented." (let ((defun-bound (bounds-of-thing-at-point 'defun))) (if (not defun-bound) (line-number-at-pos) @@ -1200,6 +1330,12 @@ You can jump definitions of functions, symbols in this file." (helm :sources '(helm-source-gtags-parse-file) :buffer helm-gtags--buffer :preselect presel))) +;;;###autoload +(defun helm-gtags-push-stack () + "Push current location to the stack." + (interactive) + (helm-gtags--push-context (helm-gtags--current-context))) + ;;;###autoload (defun helm-gtags-pop-stack () "Jump to previous point on the context stack and pop it from stack." @@ -1233,23 +1369,27 @@ You can jump definitions of functions, symbols in this file." (setq helm-gtags--context-stack (make-hash-table :test 'equal))) (defun helm-gtags--read-tag-directory () + "Not documented." (let ((dir (read-directory-name "Directory tag generated: " nil nil t))) ;; On Windows, "gtags d:/tmp" work, but "gtags d:/tmp/" doesn't (directory-file-name (expand-file-name dir)))) (defsubst helm-gtags--how-to-update-tags () + "Not documented." (cl-case (prefix-numeric-value current-prefix-arg) (4 'entire-update) (16 'generate-other-directory) (otherwise 'single-update))) (defun helm-gtags--update-tags-command (how-to) + "Not documented." (cl-case how-to (entire-update '("global" "-u")) (generate-other-directory (list "gtags" (helm-gtags--read-tag-directory))) (single-update (list "global" "--single-update" (helm-gtags--real-file-name))))) (defun helm-gtags--update-tags-p (how-to interactive-p current-time) + "Not documented." (or interactive-p (and (eq how-to 'single-update) (buffer-file-name) diff --git a/elpa/helm-org-20200311.633/helm-org-pkg.el b/elpa/helm-org-20200311.633/helm-org-pkg.el deleted file mode 100644 index 037a54fe..00000000 --- a/elpa/helm-org-20200311.633/helm-org-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; Generated package description from /Users/andreas/.emacs.d/elpa/helm-org-20200311.633/helm-org.el -*- no-byte-compile: t -*- -(define-package "helm-org" "20200311.633" "Helm for org headlines and keywords completion" '((helm "3.3") (emacs "24.4")) :commit "b7a18dfc17e8b933956d61d68c435eee03a96c24" :authors '(("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) :maintainer '("Thierry Volpiatto" . "thierry.volpiatto@gmail.com") :url "https://github.com/emacs-helm/helm-org") diff --git a/elpa/helm-org-20200311.633/helm-org-autoloads.el b/elpa/helm-org-20210324.1927/helm-org-autoloads.el similarity index 88% rename from elpa/helm-org-20200311.633/helm-org-autoloads.el rename to elpa/helm-org-20210324.1927/helm-org-autoloads.el index 44aff9db..79407413 100644 --- a/elpa/helm-org-20200311.633/helm-org-autoloads.el +++ b/elpa/helm-org-20210324.1927/helm-org-autoloads.el @@ -1,4 +1,4 @@ -;;; helm-org-autoloads.el --- automatically extracted autoloads +;;; helm-org-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -43,7 +43,11 @@ selection, see (info \"(org) setting tags\"). \(fn PROMPT COLLECTION PRED REQ INITIAL HIST DEF INHERIT-INPUT-METHOD NAME BUFFER)" nil nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-org" '("helm-"))) +(register-definition-prefixes "helm-org" '("helm-")) + +;;;*** + +;;;### (autoloads nil nil ("helm-org-pkg.el") (0 0 0 0)) ;;;*** diff --git a/elpa/helm-org-20210324.1927/helm-org-pkg.el b/elpa/helm-org-20210324.1927/helm-org-pkg.el new file mode 100644 index 00000000..97e0980a --- /dev/null +++ b/elpa/helm-org-20210324.1927/helm-org-pkg.el @@ -0,0 +1,13 @@ +(define-package "helm-org" "20210324.1927" "Helm for org headlines and keywords completion" + '((helm "3.3") + (emacs "24.4")) + :commit "d67186d3a64e610c03a5f3d583488f018fb032e4" :authors + '(("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) + :maintainers + '(("Thierry Volpiatto" . "thierry.volpiatto@gmail.com")) + :maintainer + '("Thierry Volpiatto" . "thierry.volpiatto@gmail.com") + :url "https://github.com/emacs-helm/helm-org") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-org-20200311.633/helm-org.el b/elpa/helm-org-20210324.1927/helm-org.el similarity index 98% rename from elpa/helm-org-20200311.633/helm-org.el rename to elpa/helm-org-20210324.1927/helm-org.el index 8b0ff3bf..ae29e72c 100644 --- a/elpa/helm-org-20200311.633/helm-org.el +++ b/elpa/helm-org-20210324.1927/helm-org.el @@ -4,8 +4,6 @@ ;; Author: Thierry Volpiatto ;; URL: https://github.com/emacs-helm/helm-org -;; Package-Version: 20200311.633 -;; Package-Commit: b7a18dfc17e8b933956d61d68c435eee03a96c24 ;; Package-Requires: ((helm "3.3") (emacs "24.4")) ;; Version: 1.0 @@ -171,9 +169,11 @@ Note: [1] A separator can be a comma, a colon i.e. [,:] or a space. ** Commands \\ -\\[helm-org-run-open-heading-in-indirect-buffer]\t\tOpen heading in indirect buffer. -\\[helm-org-run-refile-heading-to]\t\tRefile current or marked headings to selection. -\\[helm-org-run-insert-link-to-heading-at-marker]\t\tInsert link at point to selection." +|Keys|Description +|-----------+----------| +|\\[helm-org-run-open-heading-in-indirect-buffer]|Open heading in indirect buffer. +|\\[helm-org-run-refile-heading-to]|Refile current or marked headings to selection. +|\\[helm-org-run-insert-link-to-heading-at-marker]|Insert link at point to selection." ) ;;; Org capture templates diff --git a/elpa/helm-projectile-20201217.908/helm-projectile-pkg.el b/elpa/helm-projectile-20201217.908/helm-projectile-pkg.el deleted file mode 100644 index 2094cd43..00000000 --- a/elpa/helm-projectile-20201217.908/helm-projectile-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; Generated package description from /Users/andreas/.emacs.d/elpa/helm-projectile-20201217.908/helm-projectile.el -*- no-byte-compile: t -*- -(define-package "helm-projectile" "20201217.908" "Helm integration for Projectile" '((helm "1.9.9") (projectile "2.2.0") (cl-lib "0.3")) :commit "58123f14c392021714fc5d23b9f95c7f95ce07f1" :authors '(("Bozhidar Batsov")) :maintainer '("Bozhidar Batsov") :keywords '("project" "convenience") :url "https://github.com/bbatsov/helm-projectile") diff --git a/elpa/helm-projectile-20201217.908/helm-projectile-autoloads.el b/elpa/helm-projectile-20221215.613/helm-projectile-autoloads.el similarity index 88% rename from elpa/helm-projectile-20201217.908/helm-projectile-autoloads.el rename to elpa/helm-projectile-20221215.613/helm-projectile-autoloads.el index 3e4338c5..9ba23f60 100644 --- a/elpa/helm-projectile-20201217.908/helm-projectile-autoloads.el +++ b/elpa/helm-projectile-20221215.613/helm-projectile-autoloads.el @@ -1,4 +1,4 @@ -;;; helm-projectile-autoloads.el --- automatically extracted autoloads +;;; helm-projectile-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -21,8 +21,9 @@ Find file at point based on context." t nil) (autoload 'helm-projectile-find-other-file "helm-projectile" "\ Switch between files with the same name but different extensions using Helm. -With FLEX-MATCHING, match any file that contains the base name of current file. -Other file extensions can be customized with the variable `projectile-other-file-alist'. +With FLEX-MATCHING, match any file that contains the base name of +current file. Other file extensions can be customized with the +variable `projectile-other-file-alist'. \(fn &optional FLEX-MATCHING)" t nil) @@ -66,7 +67,11 @@ If invoked outside of a project, displays a list of known projects to jump. (eval-after-load 'projectile '(progn (define-key projectile-command-map (kbd "h") #'helm-projectile))) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-projectile" '("helm-"))) +(register-definition-prefixes "helm-projectile" '("glob-quote" "helm-")) + +;;;*** + +;;;### (autoloads nil nil ("helm-projectile-pkg.el") (0 0 0 0)) ;;;*** diff --git a/elpa/helm-projectile-20221215.613/helm-projectile-pkg.el b/elpa/helm-projectile-20221215.613/helm-projectile-pkg.el new file mode 100644 index 00000000..8fb9da3a --- /dev/null +++ b/elpa/helm-projectile-20221215.613/helm-projectile-pkg.el @@ -0,0 +1,16 @@ +(define-package "helm-projectile" "20221215.613" "Helm integration for Projectile" + '((helm "1.9.9") + (projectile "2.2.0") + (cl-lib "0.3")) + :commit "35a2111d00c0c0c9d8743280d3f1243bb217118a" :authors + '(("Bozhidar Batsov")) + :maintainers + '(("Bozhidar Batsov")) + :maintainer + '("Bozhidar Batsov") + :keywords + '("project" "convenience") + :url "https://github.com/bbatsov/helm-projectile") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-projectile-20201217.908/helm-projectile.el b/elpa/helm-projectile-20221215.613/helm-projectile.el similarity index 96% rename from elpa/helm-projectile-20201217.908/helm-projectile.el rename to elpa/helm-projectile-20221215.613/helm-projectile.el index 3e9c02de..ef2b7b69 100644 --- a/elpa/helm-projectile-20201217.908/helm-projectile.el +++ b/elpa/helm-projectile-20221215.613/helm-projectile.el @@ -4,8 +4,6 @@ ;; Author: Bozhidar Batsov ;; URL: https://github.com/bbatsov/helm-projectile -;; Package-Version: 20201217.908 -;; Package-Commit: 58123f14c392021714fc5d23b9f95c7f95ce07f1 ;; Created: 2011-31-07 ;; Keywords: project, convenience ;; Version: 1.1.0-snapshot @@ -101,7 +99,8 @@ This needs to be set before loading helm-projectile.el." (reverse ret))) (defun helm-projectile-hack-actions (actions &rest prescription) - "Given a Helm action list and a prescription, return a hacked Helm action list, after applying the PRESCRIPTION. + "Given a Helm action list and a prescription, return a hacked Helm action list. +Optionally applies the PRESCRIPTION beforehand. The Helm action list ACTIONS is of the form: @@ -303,14 +302,14 @@ Previews the contents of a file in a temporary buffer." (set-auto-mode)) (font-lock-ensure) (setq inhibit-read-only nil))) - (if (and (helm-attr 'previewp) - (string= candidate (helm-attr 'current-candidate))) + (if (and (helm-get-attr 'previewp) + (string= candidate (helm-get-attr 'current-candidate))) (progn (kill-buffer buf) - (helm-attrset 'previewp nil)) + (helm-set-attr 'previewp nil)) (preview candidate) - (helm-attrset 'previewp t))) - (helm-attrset 'current-candidate candidate))) + (helm-set-attr 'previewp t))) + (helm-set-attr 'current-candidate candidate))) (defun helm-projectile-find-files-eshell-command-on-file-action (candidate) (interactive) @@ -536,11 +535,14 @@ Meant to be added to `helm-cleanup-hook', from which it removes (remove-hook 'helm-after-update-hook #'helm-projectile--move-to-real) (remove-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)) +(defvar helm-source-projectile-files-list-before-init-hook + (lambda () + (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real) + (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))) + (defvar helm-source-projectile-files-list (helm-build-sync-source "Projectile files" - :before-init-hook (lambda () - (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real) - (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)) + :before-init-hook 'helm-source-projectile-files-list-before-init-hook :candidates (lambda () (when (projectile-project-p) (with-helm-current-buffer @@ -675,11 +677,11 @@ Meant to be added to `helm-cleanup-hook', from which it removes ;; If a new buffer is longer that this value ;; this value will be updated (setq helm-buffer-max-len-mode (cdr result)))))) - (candidates :initform helm-projectile-buffers-list-cache) + (candidates :initform 'helm-projectile-buffers-list-cache) (matchplugin :initform nil) (match :initform 'helm-buffers-match-function) (persistent-action :initform 'helm-buffers-list-persistent-action) - (keymap :initform helm-buffer-map) + (keymap :initform 'helm-buffer-map) (volatile :initform t) (persistent-help :initform @@ -733,7 +735,7 @@ See documentation of `helm-grep-default-command' for the format." helm-source-projectile-files-list helm-source-projectile-projects) "Default sources for `helm-projectile'." - :type 'list + :type '(repeat symbol) :group 'helm-projectile) (defmacro helm-projectile-command (command source prompt &optional not-require-root truncate-lines-var) @@ -806,8 +808,9 @@ With a prefix ARG invalidates the cache first." ;;;###autoload (defun helm-projectile-find-other-file (&optional flex-matching) "Switch between files with the same name but different extensions using Helm. -With FLEX-MATCHING, match any file that contains the base name of current file. -Other file extensions can be customized with the variable `projectile-other-file-alist'." +With FLEX-MATCHING, match any file that contains the base name of +current file. Other file extensions can be customized with the +variable `projectile-other-file-alist'." (interactive "P") (let* ((project-root (projectile-project-root)) (other-files (projectile-get-other-files (buffer-file-name) @@ -988,14 +991,27 @@ DIR is the project root, if not set then current directory is used" (buffer-substring-no-properties (region-beginning) (region-end)) (helm-rg--get-thing-at-pt)))) +(defun glob-quote (string) + "Quote the special glob characters: *, ?, [, and ]. +STRING the string in which to escape special characters." + (replace-regexp-in-string "[]*?[]" "\\\\\\&" string)) + ;;;###autoload (defun helm-projectile-rg () "Projectile version of `helm-rg'." (interactive) (if (require 'helm-rg nil t) (if (projectile-project-p) - (let ((helm-rg-prepend-file-name-line-at-top-of-matches nil) - (helm-rg-include-file-on-every-match-line t)) + (let* ((helm-rg-prepend-file-name-line-at-top-of-matches nil) + (helm-rg-include-file-on-every-match-line t) + (ignored-files (mapcan (lambda (path) + (list "--glob" (concat "!" (glob-quote path)))) + (cl-union (projectile-ignored-files-rel) grep-find-ignored-files))) + (ignored-directories (mapcan (lambda (path) + (list "--glob" (concat "!" (glob-quote path) "/**"))) + (cl-union (mapcar 'directory-file-name (projectile-ignored-directories-rel)) + grep-find-ignored-directories))) + (helm-rg--extra-args `(,@ignored-files ,@ignored-directories))) (let ((default-directory (projectile-project-root))) (helm-rg (helm-projectile-rg--region-selection) nil))) diff --git a/elpa/helm-swoop-20200814.448/helm-swoop-pkg.el b/elpa/helm-swoop-20200814.448/helm-swoop-pkg.el deleted file mode 100644 index 05eaf6cb..00000000 --- a/elpa/helm-swoop-20200814.448/helm-swoop-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; Generated package description from /Users/andreas/.emacs.d/elpa/helm-swoop-20200814.448/helm-swoop.el -*- no-byte-compile: t -*- -(define-package "helm-swoop" "20200814.448" "Efficiently hopping squeezed lines powered by helm interface" '((emacs "25.1") (helm "3.6")) :commit "1f7d3cf0d742b199e4ce13fcb8b19c977a44611e" :authors '(("Shingo Fukuyama - http://fukuyama.co")) :maintainer '("Shingo Fukuyama - http://fukuyama.co") :keywords '("convenience" "helm" "swoop" "inner" "buffer" "search") :url "https://github.com/emacsorphanage/helm-swoop") diff --git a/elpa/helm-swoop-20200814.448/helm-swoop-autoloads.el b/elpa/helm-swoop-20210426.547/helm-swoop-autoloads.el similarity index 93% rename from elpa/helm-swoop-20200814.448/helm-swoop-autoloads.el rename to elpa/helm-swoop-20210426.547/helm-swoop-autoloads.el index 586e9d86..a6740fb3 100644 --- a/elpa/helm-swoop-20200814.448/helm-swoop-autoloads.el +++ b/elpa/helm-swoop-20210426.547/helm-swoop-autoloads.el @@ -1,4 +1,4 @@ -;;; helm-swoop-autoloads.el --- automatically extracted autoloads +;;; helm-swoop-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -68,7 +68,11 @@ Start helm-swoop without pre input query." t nil) (autoload 'helm-multi-swoop-edit "helm-swoop" "\ Multi swoop edit." t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-swoop" '("get-buffers-matching-mode" "helm-"))) +(register-definition-prefixes "helm-swoop" '("get-buffers-matching-mode" "helm-")) + +;;;*** + +;;;### (autoloads nil nil ("helm-swoop-pkg.el") (0 0 0 0)) ;;;*** diff --git a/elpa/helm-swoop-20210426.547/helm-swoop-pkg.el b/elpa/helm-swoop-20210426.547/helm-swoop-pkg.el new file mode 100644 index 00000000..cdd02799 --- /dev/null +++ b/elpa/helm-swoop-20210426.547/helm-swoop-pkg.el @@ -0,0 +1,15 @@ +(define-package "helm-swoop" "20210426.547" "Efficiently hopping squeezed lines powered by helm interface" + '((emacs "25.1") + (helm "3.6")) + :commit "1b3285791f1dc1fde548fe67aec07214d698fd57" :authors + '(("Shingo Fukuyama - http://fukuyama.co")) + :maintainers + '(("Shingo Fukuyama - http://fukuyama.co")) + :maintainer + '("Shingo Fukuyama - http://fukuyama.co") + :keywords + '("convenience" "helm" "swoop" "inner" "buffer" "search") + :url "https://github.com/emacsorphanage/helm-swoop") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/helm-swoop-20200814.448/helm-swoop.el b/elpa/helm-swoop-20210426.547/helm-swoop.el similarity index 99% rename from elpa/helm-swoop-20200814.448/helm-swoop.el rename to elpa/helm-swoop-20210426.547/helm-swoop.el index 6984190e..0137c880 100644 --- a/elpa/helm-swoop-20200814.448/helm-swoop.el +++ b/elpa/helm-swoop-20210426.547/helm-swoop.el @@ -4,8 +4,6 @@ ;; Copyright (C) 2013-2018 Shingo Fukuyama ;; Version: 3.0.0 -;; Package-Version: 20200814.448 -;; Package-Commit: 1f7d3cf0d742b199e4ce13fcb8b19c977a44611e ;; Author: Shingo Fukuyama - http://fukuyama.co ;; URL: https://github.com/emacsorphanage/helm-swoop ;; Created: Oct 24 2013 @@ -811,7 +809,7 @@ If LINUM is number, lines are separated by LINUM." (isearch-exit)) (helm-swoop :query query))) ;; When doing isearch, hand the word over to helm-swoop -(define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch) +;; (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch) ;; Receive word from evil search --------------- (defun helm-swoop-from-evil-search () -- 2.47.3