From 0856388bed6e4e0e39b17924b3e656adf413b5ae Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 31 Oct 2019 16:48:47 +0100 Subject: [PATCH] update helm --- bba.org | 2 +- elpa/helm-20190122.549/emacs-helm.sh | 111 -- elpa/helm-20190122.549/helm-org.el | 426 ----- elpa/helm-20190122.549/helm-regexp.el | 764 --------- elpa/helm-20191031.725/emacs-helm.sh | 219 +++ .../helm-adaptive.el | 2 +- .../helm-autoloads.el | 331 ++-- .../helm-bookmark.el | 2 +- .../helm-buffers.el | 143 +- .../helm-color.el | 2 +- elpa/helm-20191031.725/helm-comint.el | 219 +++ .../helm-command.el | 46 +- .../helm-config.el | 2 +- .../helm-dabbrev.el | 2 +- .../helm-easymenu.el | 5 +- .../helm-elisp-package.el | 225 ++- .../helm-elisp.el | 33 +- .../helm-eshell.el | 5 +- .../helm-eval.el | 2 +- .../helm-external.el | 2 +- .../helm-files.el | 914 +++++++--- .../helm-find.el | 26 +- .../helm-font.el | 2 +- .../helm-for-files.el | 2 +- .../helm-grep.el | 72 +- .../helm-help.el | 253 ++- .../helm-id-utils.el | 2 +- .../helm-imenu.el | 50 +- .../helm-info.el | 2 +- .../helm-locate.el | 29 +- .../helm-man.el | 2 +- .../helm-misc.el | 30 +- .../helm-mode.el | 535 ++++-- .../helm-net.el | 167 +- elpa/helm-20191031.725/helm-occur.el | 701 ++++++++ .../helm-pkg.el | 2 +- elpa/helm-20191031.725/helm-regexp.el | 138 ++ .../helm-ring.el | 35 +- .../helm-semantic.el | 25 +- elpa/helm-20191031.725/helm-shell.el | 44 + .../helm-sys.el | 18 +- .../helm-tags.el | 11 +- .../helm-types.el | 16 +- .../helm-utils.el | 60 +- .../helm-x-files.el | 2 +- .../bibtex-completion.el | 1507 +++++++++++++++++ .../helm-bibtex-autoloads.el | 46 + .../helm-bibtex-pkg.el | 15 + elpa/helm-bibtex-20191028.1313/helm-bibtex.el | 262 +++ .../helm-core-autoloads.el | 38 +- .../helm-core-pkg.el | 2 +- .../helm-lib.el | 83 +- .../helm-multi-match.el | 2 +- .../helm-source.el | 57 +- .../helm.el | 575 +++++-- .../helm-descbinds-pkg.el | 2 - .../helm-descbinds-autoloads.el | 12 +- .../helm-descbinds-pkg.el | 2 + .../helm-descbinds.el | 41 +- .../helm-projectile-autoloads.el | 12 +- .../helm-projectile-pkg.el | 2 +- .../helm-projectile.el | 13 +- .../helm-swoop-pkg.el | 2 - .../helm-swoop-autoloads.el | 11 +- .../helm-swoop-pkg.el | 2 + .../helm-swoop.el | 476 +++--- 66 files changed, 5821 insertions(+), 3022 deletions(-) delete mode 100755 elpa/helm-20190122.549/emacs-helm.sh delete mode 100644 elpa/helm-20190122.549/helm-org.el delete mode 100644 elpa/helm-20190122.549/helm-regexp.el create mode 100755 elpa/helm-20191031.725/emacs-helm.sh rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-adaptive.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-autoloads.el (75%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-bookmark.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-buffers.el (89%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-color.el (98%) create mode 100644 elpa/helm-20191031.725/helm-comint.el rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-command.el (90%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-config.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-dabbrev.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-easymenu.el (93%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-elisp-package.el (69%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-elisp.el (97%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-eshell.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-eval.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-external.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-files.el (86%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-find.el (88%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-font.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-for-files.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-grep.el (97%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-help.el (90%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-id-utils.el (98%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-imenu.el (92%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-info.el (99%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-locate.el (95%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-man.el (98%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-misc.el (91%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-mode.el (75%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-net.el (70%) create mode 100644 elpa/helm-20191031.725/helm-occur.el rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-pkg.el (76%) create mode 100644 elpa/helm-20191031.725/helm-regexp.el rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-ring.el (93%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-semantic.el (94%) create mode 100644 elpa/helm-20191031.725/helm-shell.el rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-sys.el (97%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-tags.el (96%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-types.el (96%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-utils.el (94%) rename elpa/{helm-20190122.549 => helm-20191031.725}/helm-x-files.el (98%) create mode 100644 elpa/helm-bibtex-20191028.1313/bibtex-completion.el create mode 100644 elpa/helm-bibtex-20191028.1313/helm-bibtex-autoloads.el create mode 100644 elpa/helm-bibtex-20191028.1313/helm-bibtex-pkg.el create mode 100644 elpa/helm-bibtex-20191028.1313/helm-bibtex.el rename elpa/{helm-core-20190122.549 => helm-core-20191013.626}/helm-core-autoloads.el (83%) rename elpa/{helm-core-20190122.549 => helm-core-20191013.626}/helm-core-pkg.el (69%) rename elpa/{helm-core-20190122.549 => helm-core-20191013.626}/helm-lib.el (94%) rename elpa/{helm-core-20190122.549 => helm-core-20191013.626}/helm-multi-match.el (99%) rename elpa/{helm-core-20190122.549 => helm-core-20191013.626}/helm-source.el (95%) rename elpa/{helm-core-20190122.549 => helm-core-20191013.626}/helm.el (93%) delete mode 100644 elpa/helm-descbinds-20180429.1456/helm-descbinds-pkg.el rename elpa/{helm-descbinds-20180429.1456 => helm-descbinds-20190501.935}/helm-descbinds-autoloads.el (84%) create mode 100644 elpa/helm-descbinds-20190501.935/helm-descbinds-pkg.el rename elpa/{helm-descbinds-20180429.1456 => helm-descbinds-20190501.935}/helm-descbinds.el (87%) rename elpa/{helm-projectile-20180815.1514 => helm-projectile-20190731.1538}/helm-projectile-autoloads.el (87%) rename elpa/{helm-projectile-20180815.1514 => helm-projectile-20190731.1538}/helm-projectile-pkg.el (65%) rename elpa/{helm-projectile-20180815.1514 => helm-projectile-20190731.1538}/helm-projectile.el (99%) delete mode 100644 elpa/helm-swoop-20180215.1154/helm-swoop-pkg.el rename elpa/{helm-swoop-20180215.1154 => helm-swoop-20191028.1402}/helm-swoop-autoloads.el (86%) create mode 100644 elpa/helm-swoop-20191028.1402/helm-swoop-pkg.el rename elpa/{helm-swoop-20180215.1154 => helm-swoop-20191028.1402}/helm-swoop.el (84%) diff --git a/bba.org b/bba.org index 44c4e7bc..d7b96bb0 100644 --- a/bba.org +++ b/bba.org @@ -3401,7 +3401,7 @@ Some links you might check out: (if (>= emacs-major-version 24) (progn (add-to-list 'load-path - "~/.emacs.d/elpa/helm-20190122.549") + "~/.emacs.d/elpa/helm-20191031.725") (require 'helm) (helm-mode 1) (global-set-key (kbd "M-y") 'helm-show-kill-ring) diff --git a/elpa/helm-20190122.549/emacs-helm.sh b/elpa/helm-20190122.549/emacs-helm.sh deleted file mode 100755 index 2f688eef..00000000 --- a/elpa/helm-20190122.549/emacs-helm.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh - - -## Copyright (C) 2012 ~ 2018 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: - -# Preconfigured `emacs -Q' with a basic Helm configuration. -# Run it from this directory or symlink it somewhere in your PATH. - -# If TEMP env var exists, use it, otherwise declare it. -test -z "$TEMP" && TEMP="/tmp" - -CONF_FILE="$TEMP/helm-cfg.el" -EMACS=emacs - -case $1 in - -P) - shift 1 - EMACS=$1 - shift 1 - ;; - -h) - echo "Usage: ${0##*/} [-P} Emacs path [-h} help [--] EMACS ARGS" - exit 1 - ;; -esac - -LOAD_PATH=$($EMACS -q -batch --eval "(prin1 load-path)") - -cd "${0%/*}" || exit 1 - -# Check if autoload file exists. -# It may be in a different directory if emacs-helm.sh is a symlink. -TRUENAME=$(find . -samefile "$0" -printf "%l") -if [ ! -z "$TRUENAME" ]; then - AUTO_FILE="${TRUENAME%/*}/helm-autoloads.el" -else - AUTO_FILE="helm-autoloads.el" -fi -if [ ! -e "$AUTO_FILE" ]; then - echo No autoloads found, please run make first to generate autoload file - exit 1 -fi - - -cat > $CONF_FILE <\`helm-find-files'\\n\ -;; - \`occur'(M-s o) =>\`helm-occur'\\n\ -;; - \`list-buffers'(C-x C-b) =>\`helm-buffers-list'\\n\ -;; - \`completion-at-point'(M-tab) =>\`helm-lisp-completion-at-point'[1]\\n\ -;; - \`dabbrev-expand'(M-/) =>\`helm-dabbrev'\\n\ -;; - \`execute-extended-command'(M-x) =>\`helm-M-x'\\n\\n -;; Some other Emacs commands are \"helmized\" by \`helm-mode'.\\n\ -;; [1] Coming with emacs-24.4, \`completion-at-point' is \"helmized\" by \`helm-mode'\\n\ -;; which provides Helm completion in many places like \`shell-mode'.\\n\ -;; Find context help for most Helm commands with \`C-h m'.\\n\ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\\n")) - -(setq load-path (quote $LOAD_PATH)) -(require 'package) -;; User may be using a non standard \`package-user-dir'. -;; Modify \`package-directory-list' instead of \`package-user-dir' -;; in case the user starts Helm from a non-ELPA installation. -(unless (file-equal-p package-user-dir "~/.emacs.d/elpa") - (add-to-list 'package-directory-list (directory-file-name - (file-name-directory - (directory-file-name default-directory))))) - -(setq package-load-list '((helm-core t) (helm t) (async t) (popup t))) -(package-initialize) -(add-to-list 'load-path (file-name-directory (file-truename "$0"))) -(setq default-frame-alist '((vertical-scroll-bars . nil) - (tool-bar-lines . 0) - (menu-bar-lines . 0) - (fullscreen . nil))) -(blink-cursor-mode -1) -(require 'helm-config) -(helm-mode 1) -(define-key global-map [remap find-file] 'helm-find-files) -(define-key global-map [remap occur] 'helm-occur) -(define-key global-map [remap list-buffers] 'helm-buffers-list) -(define-key global-map [remap dabbrev-expand] 'helm-dabbrev) -(define-key global-map [remap execute-extended-command] 'helm-M-x) -(unless (boundp 'completion-in-region-function) - (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point) - (define-key emacs-lisp-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)) -(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$CONF_FILE") (delete-file "$CONF_FILE")))) -EOF - -$EMACS -Q -l "$CONF_FILE" "$@" diff --git a/elpa/helm-20190122.549/helm-org.el b/elpa/helm-20190122.549/helm-org.el deleted file mode 100644 index b045ddaa..00000000 --- a/elpa/helm-20190122.549/helm-org.el +++ /dev/null @@ -1,426 +0,0 @@ -;;; helm-org.el --- Helm for org headlines and keywords completion -*- lexical-binding: t -*- - -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Code: -(require 'cl-lib) -(require 'helm) -(require 'helm-utils) -(require 'org) - -;; Load org-with-point-at macro when compiling -(eval-when-compile - (require 'org-macs)) - -(declare-function org-agenda-switch-to "org-agenda.el") - -(defgroup helm-org nil - "Org related functions for helm." - :group 'helm) - -(defcustom helm-org-headings-fontify nil - "Fontify org buffers before parsing them. -This reflect fontification in helm-buffer when non--nil. -NOTE: This will be slow on large org buffers." - :group 'helm-org - :type 'boolean) - -(defcustom helm-org-format-outline-path nil - "Show all org level as path." - :group 'helm-org - :type 'boolean) - -(defcustom helm-org-show-filename nil - "Show org filenames in `helm-org-agenda-files-headings' when non--nil. -Note this have no effect in `helm-org-in-buffer-headings'." - :group 'helm-org - :type 'boolean) - -(defcustom helm-org-headings-min-depth 1 - "Minimum depth of org headings to start with." - :group 'helm-org - :type 'integer) - -(defcustom helm-org-headings-max-depth 8 - "Go down to this maximum depth of org headings." - :group 'helm-org - :type 'integer) - -(defcustom helm-org-headings-actions - '(("Go to heading" . helm-org-goto-marker) - ("Open in indirect buffer `C-c i'" . helm-org--open-heading-in-indirect-buffer) - ("Refile heading(s) (marked-to-selected|current-to-selected) `C-c w`" . helm-org--refile-heading-to) - ("Insert link to this heading `C-c l`" . helm-org-insert-link-to-heading-at-marker)) - "Default actions alist for - `helm-source-org-headings-for-files'." - :group 'helm-org - :type '(alist :key-type string :value-type function)) - -(defcustom helm-org-truncate-lines t - "Truncate org-header-lines when non-nil" - :type 'boolean - :group 'helm-org) - -(defcustom helm-org-ignore-autosaves nil - "Ignore autosave files when starting `helm-org-agenda-files-headings'." - :type 'boolean - :group 'helm-org) - - -;;; Org capture templates -;; -;; -(defvar org-capture-templates) -(defun helm-source-org-capture-templates () - (helm-build-sync-source "Org Capture Templates:" - :candidates (cl-loop for template in org-capture-templates - collect (cons (nth 1 template) (nth 0 template))) - :action '(("Do capture" . (lambda (template-shortcut) - (org-capture nil template-shortcut)))))) - -;;; Org headings -;; -;; -(defun helm-org-goto-marker (marker) - (switch-to-buffer (marker-buffer marker)) - (goto-char (marker-position marker)) - (org-show-context) - (re-search-backward "^\\*+ " nil t) - (org-show-entry)) - -(defun helm-org--open-heading-in-indirect-buffer (marker) - (helm-org-goto-marker marker) - (org-tree-to-indirect-buffer) - - ;; Put the non-indirect buffer at the bottom of the prev-buffers - ;; list so it won't be selected when the indirect buffer is killed - (set-window-prev-buffers nil (append (cdr (window-prev-buffers)) - (car (window-prev-buffers))))) - -(defun helm-org-run-open-heading-in-indirect-buffer () - "Open selected Org heading in an indirect buffer." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action #'helm-org--open-heading-in-indirect-buffer))) -(put 'helm-org-run-open-heading-in-indirect-buffer 'helm-only t) - -(defvar helm-org-headings-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map helm-map) - (define-key map (kbd "C-c i") 'helm-org-run-open-heading-in-indirect-buffer) - (define-key map (kbd "C-c w") 'helm-org-run-refile-heading-to) - (define-key map (kbd "C-c l") 'helm-org-run-insert-link-to-heading-at-marker) - map) - "Keymap for `helm-source-org-headings-for-files'.") - -(defclass helm-org-headings-class (helm-source-sync) - ((parents - :initarg :parents - :initform nil - :custom boolean) - (match :initform - (lambda (candidate) - (string-match - helm-pattern - (helm-aif (get-text-property 0 'helm-real-display candidate) - it - candidate)))) - (help-message :initform 'helm-org-headings-help-message) - (action :initform 'helm-org-headings-actions) - (keymap :initform 'helm-org-headings-map) - (group :initform 'helm-org))) - -(defmethod helm--setup-source :after ((source helm-org-headings-class)) - (let ((parents (slot-value source 'parents))) - (setf (slot-value source 'candidate-transformer) - (lambda (candidates) - (let ((cands (helm-org-get-candidates candidates parents))) - (if parents (nreverse cands) cands)))))) - -(defun helm-source-org-headings-for-files (filenames &optional parents) - (helm-make-source "Org Headings" 'helm-org-headings-class - :filtered-candidate-transformer 'helm-org-startup-visibility - :parents parents - :candidates filenames)) - -(defun helm-org-startup-visibility (candidates _source) - "Indent headings and hide leading stars displayed in the helm buffer. -If `org-startup-indented' and `org-hide-leading-stars' are nil, do -nothing to CANDIDATES." - (cl-loop for i in candidates - collect - ;; Transformation is not needed if these variables are t. - (if (or helm-org-show-filename helm-org-format-outline-path) - (cons - (car i) (cdr i)) - (cons - (if helm-org-headings-fontify - (when (string-match "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)" (car i)) - (replace-match "\\1\\2\\3" t nil (car i))) - (when (string-match "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)" (car i)) - (let ((foreground (org-find-invisible-foreground))) - (with-helm-current-buffer - (cond - ;; org-startup-indented is t, and org-hide-leading-stars is t - ;; Or: #+STARTUP: indent hidestars - ((and org-startup-indented org-hide-leading-stars) - (with-helm-buffer - (require 'org-indent) - (org-indent-mode 1) - (replace-match - (format "%s\\2\\3" - (propertize (replace-match "\\1" t nil (car i)) - 'face `(:foreground ,foreground))) - t nil (car i)))) - ;; org-startup-indented is nil, org-hide-leading-stars is t - ;; Or: #+STARTUP: noindent hidestars - ((and (not org-startup-indented) org-hide-leading-stars) - (with-helm-buffer - (replace-match - (format "%s\\2\\3" - (propertize (replace-match "\\1" t nil (car i)) - 'face `(:foreground ,foreground))) - t nil (car i)))) - ;; org-startup-indented is nil, and org-hide-leading-stars is nil - ;; Or: #+STARTUP: noindent showstars - (t - (with-helm-buffer - (replace-match "\\1\\2\\3" t nil (car i))))))))) - (cdr i))))) - -(defun helm-org-get-candidates (filenames &optional parents) - (apply #'append - (mapcar (lambda (filename) - (helm-org--get-candidates-in-file - filename - helm-org-headings-fontify - (or parents (null helm-org-show-filename)) - parents)) - filenames))) - -(defun helm-org--get-candidates-in-file (filename &optional fontify nofname parents) - (with-current-buffer (pcase filename - ((pred bufferp) filename) - ((pred stringp) (find-file-noselect filename t))) - (let ((match-fn (if fontify - #'match-string - #'match-string-no-properties)) - (search-fn (lambda () - (re-search-forward - org-complex-heading-regexp nil t))) - (file (unless (or (bufferp filename) nofname) - (concat (helm-basename filename) ":")))) - (when parents - (add-function :around (var search-fn) - (lambda (old-fn &rest args) - (when (org-up-heading-safe) - (apply old-fn args))))) - (save-excursion - (save-restriction - (unless (and (bufferp filename) - (buffer-base-buffer filename)) - ;; Only widen direct buffers, not indirect ones. - (widen)) - (unless parents (goto-char (point-min))) - ;; clear cache for new version of org-get-outline-path - (and (boundp 'org-outline-path-cache) - (setq org-outline-path-cache nil)) - (cl-loop with width = (window-width (helm-window)) - while (funcall search-fn) - for beg = (point-at-bol) - for end = (point-at-eol) - when (and fontify - (null (text-property-any - beg end 'fontified t))) - do (jit-lock-fontify-now beg end) - for level = (length (match-string-no-properties 1)) - for heading = (funcall match-fn 4) - if (and (>= level helm-org-headings-min-depth) - (<= level helm-org-headings-max-depth)) - collect `(,(propertize - (if helm-org-format-outline-path - (org-format-outline-path - ;; org-get-outline-path changed in signature and behaviour since org's - ;; commit 105a4466971. Let's fall-back to the new version in case - ;; of wrong-number-of-arguments error. - (condition-case nil - (append (apply #'org-get-outline-path - (unless parents - (list t level heading))) - (list heading)) - (wrong-number-of-arguments - (org-get-outline-path t t))) - width file) - (if file - (concat file (funcall match-fn 0)) - (funcall match-fn 0))) - 'helm-real-display heading) - . ,(point-marker)))))))) - -(defun helm-org-insert-link-to-heading-at-marker (marker) - (with-current-buffer (marker-buffer marker) - (let ((heading-name (save-excursion (goto-char (marker-position marker)) - (nth 4 (org-heading-components)))) - (file-name (buffer-file-name))) - (with-helm-current-buffer - (org-insert-link - file-name (concat "file:" file-name "::*" heading-name)))))) - -(defun helm-org-run-insert-link-to-heading-at-marker () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action - 'helm-org-insert-link-to-heading-at-marker))) - -(defun helm-org--refile-heading-to (marker) - "Refile headings to heading at MARKER. -If multiple candidates are marked in the Helm session, they will -all be refiled. If no headings are marked, the selected heading -will be refiled." - (let* ((victims (with-helm-buffer (helm-marked-candidates))) - (buffer (marker-buffer marker)) - (filename (buffer-file-name buffer)) - (rfloc (list nil filename nil marker))) - (when (and (= 1 (length victims)) - (equal (helm-get-selection) (car victims))) - ;; No candidates are marked; we are refiling the entry at point - ;; to the selected heading - (setq victims (list (point)))) - ;; Probably best to check that everything returned a value - (when (and victims buffer filename rfloc) - (cl-loop for victim in victims - do (org-with-point-at victim - (org-refile nil nil rfloc)))))) - -(defun helm-org-in-buffer-preselect () - (if (org-on-heading-p) - (buffer-substring-no-properties (point-at-bol) (point-at-eol)) - (save-excursion - (outline-previous-visible-heading 1) - (buffer-substring-no-properties (point-at-bol) (point-at-eol))))) - -(defun helm-org-run-refile-heading-to () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-org--refile-heading-to))) -(put 'helm-org-run-refile-heading-to 'helm-only t) - -;;;###autoload -(defun helm-org-agenda-files-headings () - "Preconfigured helm for org files headings." - (interactive) - (let ((autosaves (cl-loop for f in (org-agenda-files) - when (file-exists-p - (expand-file-name - (concat "#" (helm-basename f) "#") - (helm-basedir f))) - collect (helm-basename f)))) - (when (or (null autosaves) - helm-org-ignore-autosaves - (y-or-n-p (format "%s have auto save data, continue?" - (mapconcat 'identity autosaves ", ")))) - (helm :sources (helm-source-org-headings-for-files (org-agenda-files)) - :candidate-number-limit 99999 - :truncate-lines helm-org-truncate-lines - :buffer "*helm org headings*")))) - -;;;###autoload -(defun helm-org-in-buffer-headings () - "Preconfigured helm for org buffer headings." - (interactive) - (let (helm-org-show-filename) - (helm :sources (helm-source-org-headings-for-files - (list (current-buffer))) - :candidate-number-limit 99999 - :preselect (helm-org-in-buffer-preselect) - :truncate-lines helm-org-truncate-lines - :buffer "*helm org inbuffer*"))) - -;;;###autoload -(defun helm-org-parent-headings () - "Preconfigured helm for org headings that are parents of the -current heading." - (interactive) - ;; Use a large max-depth to ensure all parents are displayed. - (let ((helm-org-headings-min-depth 1) - (helm-org-headings-max-depth 50)) - (helm :sources (helm-source-org-headings-for-files - (list (current-buffer)) t) - :candidate-number-limit 99999 - :truncate-lines helm-org-truncate-lines - :buffer "*helm org parent headings*"))) - -;;;###autoload -(defun helm-org-capture-templates () - "Preconfigured helm for org templates." - (interactive) - (helm :sources (helm-source-org-capture-templates) - :candidate-number-limit 99999 - :truncate-lines helm-org-truncate-lines - :buffer "*helm org capture templates*")) - -;;; Org tag completion - -;; Based on code from Anders Johansson posted on 3 Mar 2016 at -;; - -(defvar crm-separator) - -;;;###autoload -(defun helm-org-completing-read-tags (prompt collection pred req initial - hist def inherit-input-method _name _buffer) - "Completing read function for Org tags. - -This function is used as a `completing-read' function in -`helm-completing-read-handlers-alist' by `org-set-tags' and -`org-capture'. - -NOTE: Org tag completion will work only if you disable org fast tag -selection, see (info \"(org) setting tags\")." - (if (not (string= "Tags: " prompt)) - ;; Not a tags prompt. Use normal completion by calling - ;; `org-icompleting-read' again without this function in - ;; `helm-completing-read-handlers-alist' - (let ((helm-completing-read-handlers-alist - (rassq-delete-all - 'helm-org-completing-read-tags - (copy-alist helm-completing-read-handlers-alist)))) - (org-icompleting-read - prompt collection pred req initial hist def inherit-input-method)) - ;; Tags prompt - (let* ((curr (and (stringp initial) - (not (string= initial "")) - (org-split-string initial ":"))) - (table (delete curr - (org-uniquify - (mapcar 'car org-last-tags-completion-table)))) - (crm-separator ":\\|,\\|\\s-")) - (cl-letf (((symbol-function 'crm-complete-word) - 'self-insert-command)) - (mapconcat 'identity - (completing-read-multiple - prompt table pred nil initial hist def) - ":"))))) - -(provide 'helm-org) - -;; Local Variables: -;; byte-compile-warnings: (not obsolete) -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: - -;;; helm-org.el ends here diff --git a/elpa/helm-20190122.549/helm-regexp.el b/elpa/helm-20190122.549/helm-regexp.el deleted file mode 100644 index 02b3d966..00000000 --- a/elpa/helm-20190122.549/helm-regexp.el +++ /dev/null @@ -1,764 +0,0 @@ -;;; helm-regexp.el --- In buffer regexp searching and replacement for helm. -*- lexical-binding: t -*- - -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Code: - -(require 'cl-lib) -(require 'helm) -(require 'helm-help) -(require 'helm-utils) - -(declare-function helm-mm-split-pattern "helm-multi-match") - - -(defgroup helm-regexp nil - "Regexp related Applications and libraries for Helm." - :group 'helm) - -(defcustom helm-moccur-always-search-in-current nil - "Helm multi occur always search in current buffer when non--nil." - :group 'helm-regexp - :type 'boolean) - -(defcustom helm-moccur-use-ioccur-style-keys t - "Similar to `helm-grep-use-ioccur-style-keys' but for multi occur." - :group 'helm-regexp - :type 'boolean) - -(defcustom helm-moccur-auto-update-on-resume nil - "Allow auto updating helm-(m)occur buffer when outdated. -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-(m)occur buffer when outdated." - (const :tag "Always update without asking" noask) - (const :tag "Never update and do not signal buffer needs update" never) - (const :tag "Don't update but signal buffer needs update" nil) - (const :tag "Update after confirmation" t))) - -(defcustom helm-source-multi-occur-actions - '(("Go to Line" . helm-moccur-goto-line) - ("Goto line other window (C-u vertically)" . helm-moccur-goto-line-ow) - ("Goto line new frame" . helm-moccur-goto-line-of) - ("Save buffer" . helm-moccur-save-results)) - "Actions for helm-occur and helm-moccur." - :group 'helm-regexp - :type '(alist :key-type string :value-type function)) - -(defcustom helm-moccur-truncate-lines t - "When nil the (m)occur line that appears will not be truncated." - :group 'helm-regexp - :type 'boolean) - -(defcustom helm-moccur-show-buffer-fontification nil - "Show fontification of searched buffer in results when non nil. - -This enable or disable fontification globally in results, but you can -override this default setting with `helm-moccur-buffer-substring-fn-for-modes'." - :group 'helm-regexp - :type '(radio :tag "Allow preserving fontification of searched buffer in results" - (const :tag "Don't preserve buffer fontification" nil) - (const :tag "Preserve buffer fontification" t))) - -(defcustom helm-moccur-buffer-substring-fn-for-modes - '((mu4e-headers-mode . buffer-substring) - (package-menu-mode . buffer-substring-no-properties)) - "Alist that allow configuring the function to use for storing a buffer. - -Can be one of `buffer-substring' or `buffer-substring-no-properties'. -Allow overriding the global effect of `helm-moccur-show-buffer-fontification' -for a specific mode." - :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)))) - -(defcustom helm-occur-show-buffer-name nil - "Show buffer name in `helm-occur' results when non-nil. - -Not that this doesn't affect `helm-moccur' results and -`helm-moccur-mode' buffers where buffer names are always shown." - :group 'helm-regexp - :type 'boolean) - -(defface helm-moccur-buffer - '((t (:foreground "DarkTurquoise" :underline t))) - "Face used to highlight moccur buffer names." - :group 'helm-regexp) - -(defface helm-resume-need-update - '((t (:background "red"))) - "Face used to flash moccur buffer when it needs update." - :group 'helm-regexp) - - -(defvar helm-moccur-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-moccur-run-goto-line-ow) - (define-key map (kbd "C-c C-o") 'helm-moccur-run-goto-line-of) - (define-key map (kbd "C-x C-s") 'helm-moccur-run-save-buffer) - (when helm-moccur-use-ioccur-style-keys - (define-key map (kbd "") 'helm-execute-persistent-action) - (define-key map (kbd "") 'helm-moccur-run-default-action)) - (delq nil map)) - "Keymap used in Moccur source.") - - -;; History vars -(defvar helm-build-regexp-history nil) -(defvar helm-occur-history nil) - -(defun helm-query-replace-regexp (_candidate) - "Query replace regexp from `helm-regexp'. -With a prefix arg replace only matches surrounded by word boundaries, -i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." - (let ((regexp helm-input)) - (apply 'query-replace-regexp - (helm-query-replace-args regexp)))) - -(defun helm-kill-regexp-as-sexp (_candidate) - "Kill regexp in a format usable in lisp code." - (helm-regexp-kill-new - (prin1-to-string helm-input))) - -(defun helm-kill-regexp (_candidate) - "Kill regexp as it is in `helm-pattern'." - (helm-regexp-kill-new helm-input)) - -(defun helm-query-replace-args (regexp) - "create arguments of `query-replace-regexp' action in `helm-regexp'." - (let ((region-only (helm-region-active-p))) - (list - regexp - (query-replace-read-to regexp - (format "Query replace %sregexp %s" - (if helm-current-prefix-arg "word " "") - (if region-only "in region " "")) - t) - helm-current-prefix-arg - (when region-only (region-beginning)) - (when region-only (region-end))))) - -(defvar helm-source-regexp - (helm-build-in-buffer-source "Regexp Builder" - :init (lambda () - (helm-init-candidates-in-buffer - 'global (with-temp-buffer - (insert-buffer-substring helm-current-buffer) - (buffer-string)))) - :get-line #'helm-regexp-get-line - :persistent-action #'helm-regexp-persistent-action - :persistent-help "Show this line" - :multiline t - :multimatch nil - :requires-pattern 2 - :group 'helm-regexp - :mode-line "Press TAB to select action." - :action '(("Kill Regexp as sexp" . helm-kill-regexp-as-sexp) - ("Query Replace Regexp (C-u Not inside word.)" - . helm-query-replace-regexp) - ("Kill Regexp" . helm-kill-regexp)))) - -(defun helm-regexp-get-line (s e) - (let ((matches (match-data)) - (line (buffer-substring s e))) - (propertize - (cl-loop with ln = (format "%5d: %s" (1- (line-number-at-pos s)) line) - for i from 0 to (1- (/ (length matches) 2)) - if (match-string i) - concat (format "\n%s%s'%s'" - (make-string 10 ? ) (format "Group %d: " i) it) - into ln1 - finally return (concat ln ln1)) - 'helm-realvalue s))) - -(defun helm-regexp-persistent-action (pt) - (helm-goto-char pt) - (helm-highlight-current-line)) - -(defun helm-regexp-kill-new (input) - (kill-new (substring-no-properties input)) - (message "Killed: %s" input)) - - -;;; Occur -;; -;; -(defvar helm-source-occur nil) -(defun helm-occur-init-source () - (unless helm-source-occur - (setq helm-source-occur - (helm-make-source "Occur" 'helm-source-multi-occur)))) - - -;;; Multi occur -;; -;; - -;; Internal -(defvar helm-multi-occur-buffer-list nil) -(defvar helm-multi-occur-buffer-tick nil) -(defvar helm-occur--invisible nil - "[INTERNAL] Hide buffer name in results when non-nil. -Should be a local var to helm-buffer to allow resuming.") - -(defun helm-moccur-init () - "Create the initial helm multi occur buffer." - (helm-init-candidates-in-buffer - 'global - (cl-loop with buffers = (helm-attr 'moccur-buffers) - with bsubstring = (if helm-moccur-show-buffer-fontification - #'buffer-substring #'buffer-substring-no-properties) - for buf in buffers - for bufstr = (with-current-buffer buf - (helm-aif (assq major-mode - helm-moccur-buffer-substring-fn-for-modes) - (setq bsubstring (cdr it))) - ;; A leading space is needed to allow helm - ;; searching the first line of buffer - ;; (#1725). - (concat (if (memql (char-after (point-min)) - '(? ?\t ?\n)) - "" " ") - (funcall bsubstring (point-min) (point-max)))) - do (add-text-properties - 0 (length bufstr) - `(buffer-name ,(buffer-name (get-buffer buf))) - bufstr) - concat bufstr))) - -(defun helm-moccur--next-or-previous-char () - (save-excursion - (or (re-search-forward "^." nil t) - (re-search-backward "^." nil t)))) - -(defun helm-moccur-get-line (beg end) - "Format line for `helm-source-moccur'." - (prog1 - (format "%s:%d:%s" - (get-text-property (if (= beg end) - (helm-moccur--next-or-previous-char) - beg) - 'buffer-name) - (save-restriction - (narrow-to-region (or (previous-single-property-change - (point) 'buffer-name) - (point-at-bol 2)) - (or (next-single-property-change - (if (= beg end) - (helm-moccur--next-or-previous-char) - (point)) - 'buffer-name) - (point-max))) - (line-number-at-pos beg)) - ;; When matching empty line, use empty string - ;; to allow saving and modifying with wgrep. - (if (= beg end) "" (buffer-substring beg end))) - ;; When matching empty line, forward char ("\n") - ;; to not be blocked forever here. - (when (= beg end) (forward-char 1)))) - -(cl-defun helm-moccur-action (candidate - &optional (method (quote buffer))) - "Jump to CANDIDATE with METHOD. -arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." - (require 'helm-grep) - (let* ((split (helm-grep-split-line candidate)) - (buf (car split)) - (lineno (string-to-number (nth 1 split))) - (split-pat (helm-mm-split-pattern helm-input))) - (cl-case method - (buffer (switch-to-buffer buf)) - (buffer-other-window (helm-window-show-buffers (list buf) t)) - (buffer-other-frame (switch-to-buffer-other-frame buf))) - (with-current-buffer buf - (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))))))) - -(defun helm-moccur-persistent-action (candidate) - (helm-moccur-goto-line candidate) - (helm-highlight-current-line)) - -(defun helm-moccur-goto-line (candidate) - "From multi occur, switch to buffer and go to nth 1 CANDIDATE line." - (helm-moccur-action - candidate 'buffer)) - -(defun helm-moccur-goto-line-ow (candidate) - "Go to CANDIDATE line in other window. -Same as `helm-moccur-goto-line' but go in other window." - (helm-moccur-action - candidate 'buffer-other-window)) - -(defun helm-moccur-goto-line-of (candidate) - "Go to CANDIDATE line in new frame. -Same as `helm-moccur-goto-line' but go in new frame." - (helm-moccur-action - candidate 'buffer-other-frame)) - -(defun helm-moccur-run-goto-line-ow () - "Run goto line other window action from `helm-source-moccur'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-moccur-goto-line-ow))) -(put 'helm-moccur-run-goto-line-ow 'helm-only t) - -(defun helm-moccur-run-goto-line-of () - "Run goto line new frame action from `helm-source-moccur'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-moccur-goto-line-of))) -(put 'helm-moccur-run-goto-line-of 'helm-only t) - -(defun helm-moccur-run-default-action () - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-moccur-goto-line))) -(put 'helm-moccur-run-default-action 'helm-only t) - -(defvar helm-moccur-before-init-hook nil - "Hook that runs before initialization of the helm buffer.") - -(defvar helm-moccur-after-init-hook nil - "Hook that runs after initialization of the helm buffer.") - -(defvar helm-source-moccur nil) -(defclass helm-source-multi-occur (helm-source-in-buffer) - ((init :initform (lambda () - (require 'helm-grep) - (helm-moccur-init))) - (filter-one-by-one :initform 'helm-moccur-filter-one-by-one) - (get-line :initform helm-moccur-get-line) - (nohighlight :initform t) - (nomark :initform t) - (migemo :initform t) - (action :initform 'helm-source-multi-occur-actions) - (persistent-action :initform 'helm-moccur-persistent-action) - (persistent-help :initform "Go to line") - (resume :initform 'helm-moccur-resume-fn) - (candidate-number-limit :initform 9999) - (help-message :initform 'helm-moccur-help-message) - (keymap :initform helm-moccur-map) - (history :initform 'helm-occur-history) - (requires-pattern :initform 2) - (before-init-hook :initform 'helm-moccur-before-init-hook) - (after-init-hook :initform 'helm-moccur-after-init-hook) - (group :initform 'helm-regexp))) - -(defun helm-moccur-resume-fn () - (with-helm-buffer - (let (new-tick-ls buffer-is-modified) - (set (make-local-variable 'helm-multi-occur-buffer-list) - (cl-loop for b in helm-multi-occur-buffer-list - when (buffer-live-p (get-buffer b)) - collect b)) - (setq buffer-is-modified (/= (length helm-multi-occur-buffer-list) - (length (helm-attr 'moccur-buffers)))) - (helm-attrset 'moccur-buffers helm-multi-occur-buffer-list) - (setq new-tick-ls (cl-loop for b in helm-multi-occur-buffer-list - collect (buffer-chars-modified-tick (get-buffer b)))) - (when buffer-is-modified - (setq helm-multi-occur-buffer-tick new-tick-ls)) - (cl-assert (> (length helm-multi-occur-buffer-list) 0) nil - "helm-resume error: helm-(m)occur buffer list is empty") - (unless (eq helm-moccur-auto-update-on-resume 'never) - (when (or buffer-is-modified - (cl-loop for b in helm-multi-occur-buffer-list - for new-tick = (buffer-chars-modified-tick (get-buffer b)) - for tick in helm-multi-occur-buffer-tick - thereis (/= tick new-tick))) - (helm-aif helm-moccur-auto-update-on-resume - (when (or (eq it 'noask) - (y-or-n-p "Helm (m)occur Buffer outdated, update? ")) - (run-with-idle-timer 0.1 nil (lambda () - (with-helm-buffer - (helm-force-update) - (message "Helm (m)occur Buffer have been udated") - (sit-for 1) (message nil)))) - (unless buffer-is-modified (setq helm-multi-occur-buffer-tick new-tick-ls))) - (run-with-idle-timer 0.1 nil (lambda () - (with-helm-buffer - (let ((ov (make-overlay (save-excursion - (goto-char (point-min)) - (forward-line 1) - (point)) - (point-max)))) - (overlay-put ov 'face 'helm-resume-need-update) - (sit-for 0.3) (delete-overlay ov) - (message "[Helm occur Buffer outdated (C-c C-u to update)]"))))) - (unless buffer-is-modified - (with-helm-after-update-hook - (setq helm-multi-occur-buffer-tick new-tick-ls) - (message "Helm (m)occur Buffer have been udated"))))))))) - -(defun helm-moccur-filter-one-by-one (candidate &optional outside-helm) - "`filter-one-by-one' function for `helm-source-moccur'." - (require 'helm-grep) - (let* ((split (helm-grep-split-line candidate)) - (buf (car split)) - (lineno (nth 1 split)) - (str (nth 2 split))) - (cons (concat (propertize - buf - 'invisible (and (null outside-helm) - (with-helm-buffer - helm-occur--invisible)) - 'face 'helm-moccur-buffer - 'help-echo (buffer-file-name - (get-buffer buf)) - 'buffer-name buf) - (propertize ":" 'invisible (and (null outside-helm) - (with-helm-buffer - helm-occur--invisible))) - (propertize lineno 'face 'helm-grep-lineno) - ":" - (helm-grep-highlight-match str t)) - candidate))) - -(defun helm-multi-occur-1 (buffers &optional input) - "Main function to call `helm-source-moccur' with BUFFERS list." - (let ((bufs (if helm-moccur-always-search-in-current - (cons - ;; will become helm-current-buffer later. - (buffer-name (current-buffer)) - (remove helm-current-buffer buffers)) - buffers))) - (unless helm-source-moccur - (setq helm-source-moccur - (helm-make-source "Moccur" 'helm-source-multi-occur))) - (helm-attrset 'moccur-buffers bufs helm-source-moccur) - (helm-set-local-variable 'helm-multi-occur-buffer-list bufs) - (helm-set-local-variable - 'helm-multi-occur-buffer-tick - (cl-loop for b in bufs - collect (buffer-chars-modified-tick (get-buffer b))))) - (helm :sources 'helm-source-moccur - :buffer "*helm multi occur*" - :default (helm-aif (thing-at-point 'symbol) (regexp-quote it)) - :history 'helm-occur-history - :keymap helm-moccur-map - :input input - :truncate-lines helm-moccur-truncate-lines)) - -(defun helm-moccur-run-save-buffer () - "Run moccur save results action from `helm-moccur'." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-moccur-save-results))) -(put 'helm-moccur-run-save-buffer 'helm-only t) - - -;;; helm-moccur-mode -;; -;; -(defvar helm-moccur-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'helm-moccur-mode-goto-line) - (define-key map (kbd "C-o") 'helm-moccur-mode-goto-line-ow) - (define-key map (kbd "") 'helm-moccur-mode-goto-line-ow-forward) - (define-key map (kbd "") 'helm-moccur-mode-goto-line-ow-backward) - (define-key map (kbd "") 'helm-gm-next-file) - (define-key map (kbd "") 'helm-gm-precedent-file) - (define-key map (kbd "M-n") 'helm-moccur-mode-goto-line-ow-forward) - (define-key map (kbd "M-p") 'helm-moccur-mode-goto-line-ow-backward) - (define-key map (kbd "M-N") 'helm-gm-next-file) - (define-key map (kbd "M-P") 'helm-gm-precedent-file) - map)) - -(defun helm-moccur-mode-goto-line () - (interactive) - (helm-aif (get-text-property (point) 'helm-realvalue) - (progn (helm-moccur-goto-line it) (helm-match-line-cleanup-pulse)))) - -(defun helm-moccur-mode-goto-line-ow () - (interactive) - (helm-aif (get-text-property (point) 'helm-realvalue) - (progn (helm-moccur-goto-line-ow it) (helm-match-line-cleanup-pulse)))) - -(defun helm-moccur-mode-goto-line-ow-forward-1 (arg) - (condition-case nil - (progn - (save-selected-window - (helm-moccur-mode-goto-line-ow) - (recenter)) - (forward-line arg)) - (error nil))) - -(defun helm-moccur-mode-goto-line-ow-forward () - (interactive) - (helm-moccur-mode-goto-line-ow-forward-1 1)) - -(defun helm-moccur-mode-goto-line-ow-backward () - (interactive) - (helm-moccur-mode-goto-line-ow-forward-1 -1)) - -(defun helm-moccur-save-results (_candidate) - "Save helm moccur results in a `helm-moccur-mode' buffer." - (let ((buf "*hmoccur*") - new-buf) - (when (get-buffer buf) - (setq new-buf (helm-read-string "OccurBufferName: " buf)) - (cl-loop for b in (helm-buffer-list) - when (and (string= new-buf b) - (not (y-or-n-p - (format "Buffer `%s' already exists overwrite? " - new-buf)))) - do (setq new-buf (helm-read-string "OccurBufferName: " "*hmoccur "))) - (setq buf new-buf)) - (with-current-buffer (get-buffer-create buf) - (setq buffer-read-only t) - (let ((inhibit-read-only t) - (map (make-sparse-keymap))) - (erase-buffer) - (insert "-*- mode: helm-moccur -*-\n\n" - (format "Moccur Results for `%s':\n\n" helm-input)) - (save-excursion - (insert (with-current-buffer helm-buffer - (goto-char (point-min)) (forward-line 1) - (buffer-substring (point) (point-max))))) - (save-excursion - (while (not (eobp)) - (add-text-properties - (point-at-bol) (point-at-eol) - `(keymap ,map - help-echo ,(concat - (buffer-file-name - (get-buffer (get-text-property - (point) 'buffer-name))) - "\nmouse-1: set point\nmouse-2: jump to selection") - mouse-face highlight - invisible nil)) - (define-key map [mouse-1] 'mouse-set-point) - (define-key map [mouse-2] 'helm-moccur-mode-mouse-goto-line) - (define-key map [mouse-3] 'ignore) - (forward-line 1)))) - (helm-moccur-mode)) - (pop-to-buffer buf) - (message "Helm Moccur Results saved in `%s' buffer" buf))) - -(defun helm-moccur-mode-mouse-goto-line (event) - (interactive "e") - (let* ((window (posn-window (event-end event))) - (pos (posn-point (event-end event)))) - (with-selected-window window - (when (eq major-mode 'helm-moccur-mode) - (goto-char pos) - (helm-moccur-mode-goto-line))))) -(put 'helm-moccur-mode-mouse-goto-line 'helm-only t) - -;;;###autoload -(define-derived-mode helm-moccur-mode - special-mode "helm-moccur" - "Major mode to provide actions in helm moccur saved buffer. - -Special commands: -\\{helm-moccur-mode-map}" - (set (make-local-variable 'helm-multi-occur-buffer-list) - (with-helm-buffer helm-multi-occur-buffer-list)) - (set (make-local-variable 'revert-buffer-function) - #'helm-moccur-mode--revert-buffer-function)) -(put 'helm-moccur-mode 'helm-only t) - -(defun helm-moccur-mode--revert-buffer-function (&optional _ignore-auto _noconfirm) - (goto-char (point-min)) - (let (pattern) - (when (re-search-forward "^Moccur Results for `\\(.*\\)'" nil t) - (setq pattern (match-string 1)) - (forward-line 0) - (when (re-search-forward "^$" nil t) - (forward-line 1)) - (let ((inhibit-read-only t) - (buffer (current-buffer)) - (buflst helm-multi-occur-buffer-list) - (bsubstring (if helm-moccur-show-buffer-fontification - #'buffer-substring #'buffer-substring-no-properties))) - (delete-region (point) (point-max)) - (message "Reverting buffer...") - (save-excursion - (with-temp-buffer - (insert - "\n" - (cl-loop for buf in buflst - for bufstr = (or (and (buffer-live-p (get-buffer buf)) - (with-current-buffer buf - (funcall bsubstring - (point-min) (point-max)))) - "") - unless (string= bufstr "") - do (add-text-properties - 0 (length bufstr) - `(buffer-name ,(buffer-name (get-buffer buf))) - bufstr) - concat bufstr) - "\n") - (goto-char (point-min)) - (cl-loop with helm-pattern = pattern - while (helm-mm-search pattern) - for line = (helm-moccur-get-line (point-at-bol) (point-at-eol)) - when line - do (with-current-buffer buffer - (insert - (propertize - (car (helm-moccur-filter-one-by-one line t)) - 'helm-realvalue line) - "\n"))))) - (message "Reverting buffer done"))))) - - -;;; Predefined commands -;; -;; - -;;;###autoload -(defun helm-regexp () - "Preconfigured helm to build regexps. -`query-replace-regexp' can be run from there against found regexp." - (interactive) - (save-restriction - (when (and (helm-region-active-p) - ;; Don't narrow to region if buffer is already narrowed. - (not (helm-current-buffer-narrowed-p (current-buffer)))) - (narrow-to-region (region-beginning) (region-end))) - (helm :sources helm-source-regexp - :buffer "*helm regexp*" - :prompt "Regexp: " - :history 'helm-build-regexp-history))) - -;;;###autoload -(defun helm-occur () - "Preconfigured helm for searching lines matching pattern in `current-buffer'. - -When `helm-source-occur' is member of -`helm-sources-using-default-as-input' which is the default, -symbol at point is searched at startup. - -When a region is marked search only in this region by narrowing. - -To search in multiples buffers start from one of the commands listing -buffers (i.e. a helm command using `helm-source-buffers-list' like -`helm-mini') and use the multi occur buffers action. - -This is the helm implementation that collect lines matching pattern -like vanilla emacs `occur' but have nothing to do with it, the search -engine beeing completely different." - (interactive) - (helm-occur-init-source) - (let ((bufs (list (buffer-name (current-buffer))))) - (helm-attrset 'moccur-buffers bufs helm-source-occur) - (helm-set-local-variable 'helm-multi-occur-buffer-list bufs) - (helm-set-local-variable - 'helm-multi-occur-buffer-tick - (cl-loop for b in bufs - collect (buffer-chars-modified-tick (get-buffer b))))) - (helm-set-local-variable 'helm-occur--invisible - (null helm-occur-show-buffer-name)) - (save-restriction - (let (def pos) - (when (use-region-p) - ;; When user mark defun with `mark-defun' with intention of - ;; using helm-occur on this region, it is relevant to use the - ;; 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))) - (unwind-protect - (helm :sources 'helm-source-occur - :buffer "*helm occur*" - :default (or def (helm-aif (thing-at-point 'symbol) (regexp-quote it))) - :history 'helm-occur-history - :preselect (and (memq 'helm-source-occur helm-sources-using-default-as-input) - (format "%s:%d:" (regexp-quote (buffer-name)) - (line-number-at-pos (or pos (point))))) - :truncate-lines helm-moccur-truncate-lines) - (deactivate-mark t))))) - -;;;###autoload -(defun helm-occur-from-isearch () - "Invoke `helm-occur' from isearch." - (interactive) - (let ((input (if isearch-regexp - isearch-string - (regexp-quote isearch-string))) - (bufs (list (buffer-name (current-buffer))))) - (isearch-exit) - (helm-occur-init-source) - (helm-attrset 'moccur-buffers bufs helm-source-occur) - (helm-set-local-variable 'helm-multi-occur-buffer-list bufs) - (helm-set-local-variable - 'helm-multi-occur-buffer-tick - (cl-loop for b in bufs - collect (buffer-chars-modified-tick (get-buffer b)))) - (helm-set-local-variable 'helm-occur--invisible - (null helm-occur-show-buffer-name)) - (helm :sources 'helm-source-occur - :buffer "*helm occur*" - :history 'helm-occur-history - :input input - :truncate-lines helm-moccur-truncate-lines))) - -;;;###autoload -(defun helm-multi-occur-from-isearch (&optional _arg) - "Invoke `helm-multi-occur' from isearch. - -With a prefix arg, reverse the behavior of -`helm-moccur-always-search-in-current'. -The prefix arg can be set before calling -`helm-multi-occur-from-isearch' or during the buffer selection." - (interactive "p") - (let (buf-list - helm-moccur-always-search-in-current - (input (if isearch-regexp - isearch-string - (regexp-quote isearch-string)))) - (isearch-exit) - (setq buf-list (helm-comp-read "Buffers: " - (helm-buffer-list) - :name "Occur in buffer(s)" - :marked-candidates t)) - (setq helm-moccur-always-search-in-current - (if (or current-prefix-arg - helm-current-prefix-arg) - (not helm-moccur-always-search-in-current) - helm-moccur-always-search-in-current)) - (helm-multi-occur-1 buf-list input))) - - -(provide 'helm-regexp) - -;; Local Variables: -;; byte-compile-warnings: (not obsolete) -;; coding: utf-8 -;; indent-tabs-mode: nil -;; End: - -;;; helm-regexp.el ends here diff --git a/elpa/helm-20191031.725/emacs-helm.sh b/elpa/helm-20191031.725/emacs-helm.sh new file mode 100755 index 00000000..848a72c6 --- /dev/null +++ b/elpa/helm-20191031.725/emacs-helm.sh @@ -0,0 +1,219 @@ +#!/usr/bin/env sh + + +## Copyright (C) 2012 ~ 2019 Thierry Volpiatto +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . + +## Commentary: +# Preconfigured `emacs -Q' with a basic Helm configuration. + + +# If TEMP env var exists, use it, otherwise declare it. +test -z "$TEMP" && TEMP="/tmp" + +CONF_FILE="$TEMP/helm-cfg.el" +EMACS=emacs +TOOLBARS=-1 +LOAD_PACKAGES= + +usage () { + cat >&1 < $CONF_FILE <\`helm-find-files'\\n\ +;; - \`occur'(M-s o) =>\`helm-occur'\\n\ +;; - \`list-buffers'(C-x C-b) =>\`helm-buffers-list'\\n\ +;; - \`completion-at-point'(M-tab) =>\`helm-lisp-completion-at-point'[1]\\n\ +;; - \`apropos-command'(C-h a) =>\`helm-apropos'\\n\ +;; - \`dabbrev-expand'(M-/) =>\`helm-dabbrev'\\n\ +;; - \`execute-extended-command'(M-x) =>\`helm-M-x'\\n\\n +;; Some other Emacs commands are \"helmized\" by \`helm-mode'.\\n\ +;; [1] Coming with emacs-24.4, \`completion-at-point' is \"helmized\" by \`helm-mode'\\n\ + +;; which provides Helm completion in many places like \`shell-mode'.\\n\ +;; Find context help for most Helm commands with \`C-h m'.\\n\ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\\n")) + +(setq load-path (quote $LOAD_PATH)) +(require 'package) +;; User may be using a non standard \`package-user-dir'. +;; Modify \`package-directory-list' instead of \`package-user-dir' +;; in case the user starts Helm from a non-ELPA installation. +(unless (file-equal-p package-user-dir "~/.emacs.d/elpa") + (add-to-list 'package-directory-list (directory-file-name + (file-name-directory + (directory-file-name default-directory))))) + +(let* ((str-lst "$LOAD_PACKAGES") + (load-packages (and str-lst + (not (string= str-lst "")) + (split-string str-lst ",")))) + (setq package-load-list + (if (equal load-packages '("all")) + '(all) + (append '((helm-core t) (helm t) (async t) (popup t)) + (mapcar (lambda (p) (list (intern p) t)) load-packages))))) + +(package-initialize) +(add-to-list 'load-path (file-name-directory (file-truename "$0"))) +(unless (> $TOOLBARS 0) + (setq default-frame-alist '((vertical-scroll-bars . nil) + (tool-bar-lines . 0) + (menu-bar-lines . 0) + (fullscreen . nil)))) +(blink-cursor-mode -1) +(require 'helm-config) +(helm-mode 1) +(define-key global-map [remap find-file] 'helm-find-files) +(define-key global-map [remap occur] 'helm-occur) +(define-key global-map [remap list-buffers] 'helm-buffers-list) +(define-key global-map [remap dabbrev-expand] 'helm-dabbrev) +(define-key global-map [remap execute-extended-command] 'helm-M-x) +(define-key global-map [remap apropos-command] 'helm-apropos) +(unless (boundp 'completion-in-region-function) + (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point) + (define-key emacs-lisp-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)) +(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$CONF_FILE") (delete-file "$CONF_FILE")))) +EOF + +$EMACS -Q -l "$CONF_FILE" "$@" diff --git a/elpa/helm-20190122.549/helm-adaptive.el b/elpa/helm-20191031.725/helm-adaptive.el similarity index 99% rename from elpa/helm-20190122.549/helm-adaptive.el rename to elpa/helm-20191031.725/helm-adaptive.el index 0c6d255f..13b6f638 100644 --- a/elpa/helm-20190122.549/helm-adaptive.el +++ b/elpa/helm-20191031.725/helm-adaptive.el @@ -3,7 +3,7 @@ ;; Original Author: Tamas Patrovics ;; Copyright (C) 2007 Tamas Patrovics -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-autoloads.el b/elpa/helm-20191031.725/helm-autoloads.el similarity index 75% rename from elpa/helm-20190122.549/helm-autoloads.el rename to elpa/helm-20191031.725/helm-autoloads.el index bd3b0498..df57a075 100644 --- a/elpa/helm-20190122.549/helm-autoloads.el +++ b/elpa/helm-20191031.725/helm-autoloads.el @@ -1,12 +1,10 @@ ;;; helm-autoloads.el --- automatically extracted autoloads ;; ;;; 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-adaptive" "helm-adaptive.el" (0 0 0 0)) +;;;### (autoloads nil "helm-adaptive" "helm-adaptive.el" (23994 46474 +;;;;;; 909643 705000)) ;;; Generated autoloads from helm-adaptive.el (defvar helm-adaptive-mode nil "\ @@ -30,11 +28,10 @@ Useful when you have a old or corrupted `helm-adaptive-history-file'. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-adaptive" '("helm-adapt"))) - ;;;*** -;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (0 0 0 0)) +;;;### (autoloads nil "helm-bookmark" "helm-bookmark.el" (23994 46474 +;;;;;; 907610 560000)) ;;; Generated autoloads from helm-bookmark.el (autoload 'helm-bookmarks "helm-bookmark" "\ @@ -49,11 +46,10 @@ only if external addressbook-bookmark package is installed. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-bookmark" '("helm-" "bmkext-jump-" "bookmark"))) - ;;;*** -;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (0 0 0 0)) +;;;### (autoloads nil "helm-buffers" "helm-buffers.el" (23994 46474 +;;;;;; 930982 391000)) ;;; Generated autoloads from helm-buffers.el (autoload 'helm-buffers-list "helm-buffers" "\ @@ -62,15 +58,14 @@ Preconfigured `helm' to list buffers. \(fn)" t nil) (autoload 'helm-mini "helm-buffers" "\ -Preconfigured `helm' lightweight version (buffer -> recentf). +Preconfigured `helm' displaying `helm-mini-default-sources'. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-buffers" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-color" "helm-color.el" (0 0 0 0)) +;;;### (autoloads nil "helm-color" "helm-color.el" (23994 46474 938638 +;;;;;; 306000)) ;;; Generated autoloads from helm-color.el (autoload 'helm-colors "helm-color" "\ @@ -78,11 +73,31 @@ Preconfigured `helm' for color. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-color" '("helm-"))) +;;;*** + +;;;### (autoloads nil "helm-comint" "helm-comint.el" (23994 46474 +;;;;;; 913679 557000)) +;;; Generated autoloads from helm-comint.el + +(autoload 'helm-comint-prompts "helm-comint" "\ +Pre-configured `helm' to browse the prompts of the current comint buffer. + +\(fn)" t nil) + +(autoload 'helm-comint-prompts-all "helm-comint" "\ +Pre-configured `helm' to browse the prompts of all comint sessions. + +\(fn)" t nil) + +(autoload 'helm-comint-input-ring "helm-comint" "\ +Preconfigured `helm' that provide completion of `comint' history. + +\(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-command" "helm-command.el" (0 0 0 0)) +;;;### (autoloads nil "helm-command" "helm-command.el" (23994 46474 +;;;;;; 924805 444000)) ;;; Generated autoloads from helm-command.el (autoload 'helm-M-x "helm-command" "\ @@ -98,11 +113,10 @@ You can get help on each command by persistent action. \(fn ARG &optional COMMAND-NAME)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-command" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-config" "helm-config.el" (0 0 0 0)) +;;;### (autoloads nil "helm-config" "helm-config.el" (23994 46474 +;;;;;; 911721 532000)) ;;; Generated autoloads from helm-config.el (autoload 'helm-configuration "helm-config" "\ @@ -110,11 +124,10 @@ Customize `helm'. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-config" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (0 0 0 0)) +;;;### (autoloads nil "helm-dabbrev" "helm-dabbrev.el" (23994 46474 +;;;;;; 901745 205000)) ;;; Generated autoloads from helm-dabbrev.el (autoload 'helm-dabbrev "helm-dabbrev" "\ @@ -122,11 +135,10 @@ Preconfigured helm for dynamic abbreviations. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-dabbrev" '("helm-dabbrev-"))) - ;;;*** -;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (0 0 0 0)) +;;;### (autoloads nil "helm-elisp" "helm-elisp.el" (23994 46474 918696 +;;;;;; 776000)) ;;; Generated autoloads from helm-elisp.el (autoload 'helm-lisp-completion-at-point "helm-elisp" "\ @@ -177,12 +189,10 @@ Preconfigured helm for complex command history. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-elisp" '("helm-" "with-helm-show-completion"))) - ;;;*** ;;;### (autoloads nil "helm-elisp-package" "helm-elisp-package.el" -;;;;;; (0 0 0 0)) +;;;;;; (23994 46474 904594 983000)) ;;; Generated autoloads from helm-elisp-package.el (autoload 'helm-list-elisp-packages "helm-elisp-package" "\ @@ -198,11 +208,10 @@ Called with a prefix ARG always fetch packages on remote. \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-elisp-package" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (0 0 0 0)) +;;;### (autoloads nil "helm-eshell" "helm-eshell.el" (23994 46474 +;;;;;; 922815 472000)) ;;; Generated autoloads from helm-eshell.el (autoload 'helm-esh-pcomplete "helm-eshell" "\ @@ -225,11 +234,10 @@ Pre-configured `helm' to browse the prompts of all Eshell sessions. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-eshell" '("helm-e"))) - ;;;*** -;;;### (autoloads nil "helm-eval" "helm-eval.el" (0 0 0 0)) +;;;### (autoloads nil "helm-eval" "helm-eval.el" (23994 46474 897705 +;;;;;; 61000)) ;;; Generated autoloads from helm-eval.el (autoload 'helm-eval-expression "helm-eval" "\ @@ -247,11 +255,10 @@ Preconfigured helm for `helm-source-calculation-result'. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-eval" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-external" "helm-external.el" (0 0 0 0)) +;;;### (autoloads nil "helm-external" "helm-external.el" (23994 46474 +;;;;;; 929953 713000)) ;;; Generated autoloads from helm-external.el (autoload 'helm-run-external-command "helm-external" "\ @@ -262,17 +269,16 @@ You can set your own list of commands with \(fn PROGRAM)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-external" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-files" "helm-files.el" (0 0 0 0)) +;;;### (autoloads nil "helm-files" "helm-files.el" (23994 46474 935042 +;;;;;; 41000)) ;;; Generated autoloads from helm-files.el (autoload 'helm-projects-history "helm-files" "\ -\(fn)" t nil) +\(fn ARG)" t nil) (autoload 'helm-browse-project "helm-files" "\ Preconfigured helm to browse projects. @@ -311,11 +317,10 @@ It allows additionally to delete more than one connection at once. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-files" '("helm-" "eshell-command-aliases-list"))) - ;;;*** -;;;### (autoloads nil "helm-find" "helm-find.el" (0 0 0 0)) +;;;### (autoloads nil "helm-find" "helm-find.el" (23994 46474 927809 +;;;;;; 695000)) ;;; Generated autoloads from helm-find.el (autoload 'helm-find "helm-find" "\ @@ -338,11 +343,10 @@ are passed to \"find\" literally. \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-find" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-font" "helm-font.el" (0 0 0 0)) +;;;### (autoloads nil "helm-font" "helm-font.el" (23994 46474 912661 +;;;;;; 5000)) ;;; Generated autoloads from helm-font.el (autoload 'helm-select-xfont "helm-font" "\ @@ -357,12 +361,10 @@ Called with a prefix arg force reloading cache. \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-font" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-for-files" "helm-for-files.el" (0 0 0 -;;;;;; 0)) +;;;### (autoloads nil "helm-for-files" "helm-for-files.el" (23994 +;;;;;; 46474 899495 112000)) ;;; Generated autoloads from helm-for-files.el (autoload 'helm-for-files "helm-for-files" "\ @@ -386,11 +388,10 @@ Preconfigured `helm' for `recentf'. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-for-files" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-grep" "helm-grep.el" (0 0 0 0)) +;;;### (autoloads nil "helm-grep" "helm-grep.el" (23994 46474 910684 +;;;;;; 361000)) ;;; Generated autoloads from helm-grep.el (autoload 'helm-goto-precedent-file "helm-grep" "\ @@ -415,11 +416,10 @@ With a prefix arg ARG git-grep the whole repository. \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-grep" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-help" "helm-help.el" (0 0 0 0)) +;;;### (autoloads nil "helm-help" "helm-help.el" (23994 46474 908549 +;;;;;; 679000)) ;;; Generated autoloads from helm-help.el (autoload 'helm-documentation "helm-help" "\ @@ -430,18 +430,17 @@ Find here the documentation of all documented sources. \(fn)" t nil) -(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") +(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" "\ +(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") - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-help" '("helm-"))) +(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") ;;;*** -;;;### (autoloads nil "helm-id-utils" "helm-id-utils.el" (0 0 0 0)) +;;;### (autoloads nil "helm-id-utils" "helm-id-utils.el" (23994 46474 +;;;;;; 920660 910000)) ;;; Generated autoloads from helm-id-utils.el (autoload 'helm-gid "helm-id-utils" "\ @@ -453,11 +452,10 @@ See . \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-id-utils" '("helm-gid-"))) - ;;;*** -;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (0 0 0 0)) +;;;### (autoloads nil "helm-imenu" "helm-imenu.el" (23994 46474 914711 +;;;;;; 260000)) ;;; Generated autoloads from helm-imenu.el (autoload 'helm-imenu "helm-imenu" "\ @@ -472,11 +470,10 @@ or it have an association in `helm-imenu-all-buffer-assoc'. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-imenu" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-info" "helm-info.el" (0 0 0 0)) +;;;### (autoloads nil "helm-info" "helm-info.el" (23994 46474 923768 +;;;;;; 966000)) ;;; Generated autoloads from helm-info.el (autoload 'helm-info "helm-info" "\ @@ -500,11 +497,10 @@ Preconfigured `helm' for searching info at point. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-info" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-locate" "helm-locate.el" (0 0 0 0)) +;;;### (autoloads nil "helm-locate" "helm-locate.el" (23994 46474 +;;;;;; 934043 791000)) ;;; Generated autoloads from helm-locate.el (autoload 'helm-projects-find-files "helm-locate" "\ @@ -529,11 +525,10 @@ Where db_path is a filename matched by \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-locate" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-man" "helm-man.el" (0 0 0 0)) +;;;### (autoloads nil "helm-man" "helm-man.el" (23994 46474 936635 +;;;;;; 292000)) ;;; Generated autoloads from helm-man.el (autoload 'helm-man-woman "helm-man" "\ @@ -542,11 +537,10 @@ With a prefix arg reinitialize the cache. \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-man" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-misc" "helm-misc.el" (0 0 0 0)) +;;;### (autoloads nil "helm-misc" "helm-misc.el" (23994 46474 919678 +;;;;;; 757000)) ;;; Generated autoloads from helm-misc.el (autoload 'helm-world-time "helm-misc" "\ @@ -575,16 +569,10 @@ Preconfigured `helm' for `minibuffer-history'. \(fn)" t nil) -(autoload 'helm-comint-input-ring "helm-misc" "\ -Preconfigured `helm' that provide completion of `comint' history. - -\(fn)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-misc" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-mode" "helm-mode.el" (0 0 0 0)) +;;;### (autoloads nil "helm-mode" "helm-mode.el" (23994 46474 928891 +;;;;;; 861000)) ;;; Generated autoloads from helm-mode.el (autoload 'helm-comp-read "helm-mode" "\ @@ -677,18 +665,23 @@ Keys description: - MATCH-PART: Allow matching only one part of candidate. See match-part documentation in `helm-source'. +- MATCH-DYNAMIC: See match-dynamic in `helm-source-sync' + It have no effect when used with CANDIDATES-IN-BUFFER. + - ALLOW-NEST: Allow nesting this `helm-comp-read' in a helm session. See `helm'. - MULTILINE: See multiline in `helm-source'. +- GROUP: See group in `helm-source'. + Any prefix args passed during `helm-comp-read' invocation will be recorded in `helm-current-prefix-arg', otherwise if prefix args were given before `helm-comp-read' invocation, the value of `current-prefix-arg' will be used. That's mean you can pass prefix args before or after calling a command that use `helm-comp-read' See `helm-M-x' for example. -\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (BUFFER \"*Helm Completions*\") MUST-MATCH FUZZY REVERSE-HISTORY (REQUIRES-PATTERN 0) HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (DEL-INPUT t) (PERSISTENT-ACTION nil) (PERSISTENT-HELP \"DoNothing\") (MODE-LINE helm-comp-read-mode-line) HELP-MESSAGE (KEYMAP helm-comp-read-map) (NAME \"Helm Completions\") HEADER-NAME CANDIDATES-IN-BUFFER MATCH-PART EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (VOLATILE t) SORT FC-TRANSFORMER HIST-FC-TRANSFORMER MARKED-CANDIDATES NOMARK (ALISTP t) (CANDIDATE-NUMBER-LIMIT helm-candidate-number-limit) MULTILINE ALLOW-NEST)" nil nil) +\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (BUFFER \"*Helm Completions*\") MUST-MATCH FUZZY REVERSE-HISTORY (REQUIRES-PATTERN 0) HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (DEL-INPUT t) (PERSISTENT-ACTION nil) (PERSISTENT-HELP \"DoNothing\") (MODE-LINE helm-comp-read-mode-line) HELP-MESSAGE (KEYMAP helm-comp-read-map) (NAME \"Helm Completions\") HEADER-NAME CANDIDATES-IN-BUFFER MATCH-PART MATCH-DYNAMIC EXEC-WHEN-ONLY-ONE QUIT-WHEN-NO-CAND (VOLATILE t) SORT FC-TRANSFORMER HIST-FC-TRANSFORMER MARKED-CANDIDATES NOMARK (ALISTP t) (CANDIDATE-NUMBER-LIMIT helm-candidate-number-limit) MULTILINE ALLOW-NEST (GROUP \\='helm))" nil nil) (autoload 'helm-read-file-name "helm-mode" "\ Read a file name with helm completion. @@ -706,6 +699,9 @@ Keys description: - TEST: A predicate called with one arg 'candidate'. +- NORET: Allow disabling helm-ff-RET (have no effect if helm-ff-RET + isn't bound to RET). + - CASE-FOLD: Same as `helm-case-fold-search'. - PRESELECT: helm preselection. @@ -728,7 +724,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 default-directory) (BUFFER \"*Helm file completions*\") TEST (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 default-directory) (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) (defvar helm-mode nil "\ Non-nil if Helm mode is enabled. @@ -772,11 +768,10 @@ Note: This mode is incompatible with Emacs23. \(fn &optional ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-mode" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-net" "helm-net.el" (0 0 0 0)) +;;;### (autoloads nil "helm-net" "helm-net.el" (23994 46474 900586 +;;;;;; 803000)) ;;; Generated autoloads from helm-net.el (autoload 'helm-browse-url-firefox "helm-net" "\ @@ -824,73 +819,13 @@ Preconfigured `helm' for google search with google suggest. \(fn)" t nil) -(autoload 'helm-wikipedia-suggest "helm-net" "\ -Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest. - -\(fn)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-net" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-org" "helm-org.el" (0 0 0 0)) -;;; Generated autoloads from helm-org.el - -(autoload 'helm-org-agenda-files-headings "helm-org" "\ -Preconfigured helm for org files headings. - -\(fn)" t nil) - -(autoload 'helm-org-in-buffer-headings "helm-org" "\ -Preconfigured helm for org buffer headings. - -\(fn)" t nil) - -(autoload 'helm-org-parent-headings "helm-org" "\ -Preconfigured helm for org headings that are parents of the -current heading. - -\(fn)" t nil) +;;;### (autoloads nil "helm-occur" "helm-occur.el" (23994 46474 915743 +;;;;;; 393000)) +;;; Generated autoloads from helm-occur.el -(autoload 'helm-org-capture-templates "helm-org" "\ -Preconfigured helm for org templates. - -\(fn)" t nil) - -(autoload 'helm-org-completing-read-tags "helm-org" "\ -Completing read function for Org tags. - -This function is used as a `completing-read' function in -`helm-completing-read-handlers-alist' by `org-set-tags' and -`org-capture'. - -NOTE: Org tag completion will work only if you disable org fast tag -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-"))) - -;;;*** - -;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (0 0 0 0)) -;;; Generated autoloads from helm-regexp.el - -(autoload 'helm-moccur-mode "helm-regexp" "\ -Major mode to provide actions in helm moccur saved buffer. - -Special commands: -\\{helm-moccur-mode-map} - -\(fn)" t nil) - -(autoload 'helm-regexp "helm-regexp" "\ -Preconfigured helm to build regexps. -`query-replace-regexp' can be run from there against found regexp. - -\(fn)" t nil) - -(autoload 'helm-occur "helm-regexp" "\ +(autoload 'helm-occur "helm-occur" "\ Preconfigured helm for searching lines matching pattern in `current-buffer'. When `helm-source-occur' is member of @@ -905,16 +840,26 @@ 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. +engine beeing completely different and also much faster. + +\(fn)" t nil) + +(autoload 'helm-occur-mode "helm-occur" "\ +Major mode to provide actions in helm moccur saved buffer. + +Special commands: +\\{helm-occur-mode-map} \(fn)" t nil) -(autoload 'helm-occur-from-isearch "helm-regexp" "\ +(autoload 'helm-occur-from-isearch "helm-occur" "\ Invoke `helm-occur' from isearch. +To use this bind it to a key in `isearch-mode-map'. + \(fn)" t nil) -(autoload 'helm-multi-occur-from-isearch "helm-regexp" "\ +(autoload 'helm-multi-occur-from-isearch "helm-occur" "\ Invoke `helm-multi-occur' from isearch. With a prefix arg, reverse the behavior of @@ -922,13 +867,26 @@ 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. -\(fn &optional ARG)" t nil) +To use this bind it to a key in `isearch-mode-map'. -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-regexp" '("helm-"))) +\(fn)" t nil) ;;;*** -;;;### (autoloads nil "helm-ring" "helm-ring.el" (0 0 0 0)) +;;;### (autoloads nil "helm-regexp" "helm-regexp.el" (23994 46474 +;;;;;; 925788 765000)) +;;; 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. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "helm-ring" "helm-ring.el" (23994 46474 933072 +;;;;;; 315000)) ;;; Generated autoloads from helm-ring.el (autoload 'helm-mark-ring "helm-ring" "\ @@ -967,11 +925,10 @@ This command is useful when used with persistent action. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-ring" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (0 0 0 0)) +;;;### (autoloads nil "helm-semantic" "helm-semantic.el" (23994 46474 +;;;;;; 906574 106000)) ;;; Generated autoloads from helm-semantic.el (autoload 'helm-semantic "helm-semantic" "\ @@ -991,11 +948,20 @@ Fill in the symbol at point by default. \(fn ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-semantic" '("helm-s"))) +;;;*** + +;;;### (autoloads nil "helm-shell" "helm-shell.el" (23994 46474 902705 +;;;;;; 701000)) +;;; 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)) +;;;### (autoloads nil "helm-sys" "helm-sys.el" (23994 46474 932133 +;;;;;; 185000)) ;;; Generated autoloads from helm-sys.el (defvar helm-top-poll-mode nil "\ @@ -1028,11 +994,10 @@ Preconfigured helm for xrandr. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-sys" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-tags" "helm-tags.el" (0 0 0 0)) +;;;### (autoloads nil "helm-tags" "helm-tags.el" (23994 46474 917735 +;;;;;; 145000)) ;;; Generated autoloads from helm-tags.el (autoload 'helm-etags-select "helm-tags" "\ @@ -1049,18 +1014,10 @@ This function aggregates three sources of tag files: \(fn REINIT)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-tags" '("helm-"))) - -;;;*** - -;;;### (autoloads nil "helm-types" "helm-types.el" (0 0 0 0)) -;;; Generated autoloads from helm-types.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-types" '("helm-"))) - ;;;*** -;;;### (autoloads nil "helm-utils" "helm-utils.el" (0 0 0 0)) +;;;### (autoloads nil "helm-utils" "helm-utils.el" (23994 46474 905576 +;;;;;; 168000)) ;;; Generated autoloads from helm-utils.el (defvar helm-popup-tip-mode nil "\ @@ -1078,19 +1035,10 @@ Show help-echo informations in a popup tip at end of line. \(fn &optional ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (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 - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-x-files" '("helm-"))) - ;;;*** -;;;### (autoloads nil nil ("helm-easymenu.el" "helm-pkg.el") (0 0 -;;;;;; 0 0)) +;;;### (autoloads nil nil ("helm-easymenu.el" "helm-pkg.el" "helm-types.el" +;;;;;; "helm-x-files.el") (23994 46474 937667 37000)) ;;;*** @@ -1098,6 +1046,5 @@ Show help-echo informations in a popup tip at end of line. ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; helm-autoloads.el ends here diff --git a/elpa/helm-20190122.549/helm-bookmark.el b/elpa/helm-20191031.725/helm-bookmark.el similarity index 99% rename from elpa/helm-20190122.549/helm-bookmark.el rename to elpa/helm-20191031.725/helm-bookmark.el index f36fffea..66f49cbb 100644 --- a/elpa/helm-20190122.549/helm-bookmark.el +++ b/elpa/helm-20191031.725/helm-bookmark.el @@ -1,6 +1,6 @@ ;;; helm-bookmark.el --- Helm for Emacs regular Bookmarks. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-buffers.el b/elpa/helm-20191031.725/helm-buffers.el similarity index 89% rename from elpa/helm-20190122.549/helm-buffers.el rename to elpa/helm-20191031.725/helm-buffers.el index 2ed8dd37..1fa450e1 100644 --- a/elpa/helm-20190122.549/helm-buffers.el +++ b/elpa/helm-20191031.725/helm-buffers.el @@ -1,6 +1,6 @@ ;;; helm-buffers.el --- helm support for buffers. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ (require 'helm-grep) (require 'helm-regexp) (require 'helm-help) +(require 'helm-occur) (declare-function ido-make-buffer-list "ido" (default)) (declare-function ido-add-virtual-buffers-to-list "ido") @@ -88,6 +89,11 @@ Only buffer names are fuzzy matched when this is enabled, :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 helm-source-recentf helm-source-buffer-not-found) @@ -119,6 +125,13 @@ Also if some pretty names are too long you can add your own abbreviation here." :type '(alist :key-type symbol :value-type string) :group 'helm-buffers) + +(defcustom helm-buffers-maybe-switch-to-tab nil + "Switch to buffer in its tab when non nil. +This have no effect when `tab-bar-mode' is not available." + :group 'helm-buffers + :type 'boolean) + ;;; Faces ;; @@ -197,7 +210,7 @@ Note that this variable is buffer-local.") ;; 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-multi-occur) + (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) @@ -208,6 +221,7 @@ Note that this variable is buffer-local.") (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) @@ -216,6 +230,8 @@ Note that this variable is buffer-local.") (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)) map) "Keymap for buffer sources in helm.") @@ -280,24 +296,62 @@ Note that this variable is buffer-local.") (resume :initform (lambda () (setq helm-buffers-in-project-p nil))) (help-message :initform 'helm-buffer-help-message))) +(cl-defun helm-buffers-create-new-buffer-1 (candidate &optional (display-func 'switch-to-buffer)) + (let ((mjm (or (and helm-current-prefix-arg + (intern-soft (helm-comp-read + "Major-mode: " + helm-buffers-favorite-modes))) + (cl-loop for (r . m) in auto-mode-alist + when (string-match r candidate) + return m))) + (buffer (get-buffer-create candidate))) + (if mjm + (with-current-buffer buffer (funcall mjm)) + (set-buffer-major-mode buffer)) + (funcall display-func buffer))) + +(defun helm-buffers-create-new-buffer (candidate) + (helm-buffers-create-new-buffer-1 candidate)) + +(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 () + "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) + +(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 () + "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) + +(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) + map) + "Keymap for `helm-source-buffer-not-found' source.") + (defvar helm-source-buffer-not-found (helm-build-dummy-source "Create buffer" :action (helm-make-actions "Create buffer (C-u choose mode)" - (lambda (candidate) - (let ((mjm (or (and helm-current-prefix-arg - (intern-soft (helm-comp-read - "Major-mode: " - helm-buffers-favorite-modes))) - (cl-loop for (r . m) in auto-mode-alist - when (string-match r candidate) - return m))) - (buffer (get-buffer-create candidate))) - (if mjm - (with-current-buffer buffer (funcall mjm)) - (set-buffer-major-mode buffer)) - (switch-to-buffer buffer)))))) + #'helm-buffers-create-new-buffer + "Create buffer other window (C-u choose mode)" + #'helm-buffers-create-new-buffer-ow + "Create buffer other frame (C-u choose mode)" + #'helm-buffers-create-new-buffer-of) + :keymap helm-buffer-not-found-map)) (defvar ido-temp-list) (defvar ido-ignored-list) @@ -538,11 +592,12 @@ Should be called after others transformers i.e (boring buffers)." (lambda (s1 s2) (< (string-width s1) (string-width s2))))))) -(defun helm-buffers-mark-similar-buffers-1 () +(defun helm-buffers-mark-similar-buffers-1 (&optional type) (with-helm-window (let* ((src (helm-get-current-source)) - (type (get-text-property - 0 'type (helm-get-selection nil 'withprop src)))) + (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) @@ -562,7 +617,8 @@ Should be called after others transformers i.e (boring buffers)." (forward-line 1) (end-of-line)))) (helm-mark-current-line) (helm-display-mode-line src t) - (message "%s candidates marked" (length helm-marked-candidates))))) + (when helm-marked-candidates + (message "%s candidates marked" (length helm-marked-candidates)))))) (defun helm-buffers-mark-similar-buffers () "Mark All buffers that have same property `type' than current. @@ -755,12 +811,25 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (let ((marked (helm-marked-candidates)) (preselect (helm-get-selection nil t)) (enable-recursive-minibuffers t)) + (cl-assert marked nil "No buffers need to be saved") (cl-loop for buf in marked do (with-current-buffer (get-buffer buf) (when (buffer-file-name) (save-buffer)))) (when helm-marked-candidates (helm-unmark-all)) (helm-update (regexp-quote preselect))))) +(defun helm-buffer-save-some-buffers (_candidate) + (helm-buffers-mark-similar-buffers-1 'mod) + (helm-buffer-save-and-update nil)) + +(defun helm-buffer-run-save-some-buffers () + "Save unsaved file buffers without quitting helm." + (interactive) + (with-helm-alive-p + (helm-attrset '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) + (defun helm-buffer-save-persistent () "Save buffer without quitting helm." (interactive) @@ -846,6 +915,14 @@ If REGEXP-FLAG is given use `query-replace-regexp'." (helm-exit-and-execute-action 'switch-to-buffer-other-frame))) (put 'helm-buffer-switch-other-frame 'helm-only t) +(defun 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 'switch-to-buffer-other-tab))) +(put 'helm-buffers-switch-to-buffer-new-tab 'helm-only t) + (defun helm-buffer-switch-buffers (_candidate) "Switch to buffer candidates and replace current buffer. @@ -962,22 +1039,26 @@ See `helm-ediff-marked-buffers'." (defun helm-multi-occur-as-action (_candidate) "Multi occur action for `helm-source-buffers-list'. Can be used by any source that list buffers." - (let ((helm-moccur-always-search-in-current + (let ((helm-occur-always-search-in-current (if helm-current-prefix-arg - (not helm-moccur-always-search-in-current) - helm-moccur-always-search-in-current)) + (not helm-occur-always-search-in-current) + helm-occur-always-search-in-current)) (buffers (helm-marked-candidates)) - (input (cl-loop for i in (split-string helm-pattern " " t) - thereis (and (string-match "\\`@\\(.*\\)" i) - (match-string 1 i))))) + (input (cl-loop for i in (split-string (or (buffer-local-value + 'helm-input-local + (get-buffer helm-buffer)) + helm-pattern) + " " t) + thereis (and (string-match "\\`@\\(.*\\)" i) + (match-string 1 i))))) (helm-multi-occur-1 buffers input))) -(defun helm-buffers-run-multi-occur () +(defun 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-multi-occur 'helm-only t) +(put 'helm-buffers-run-occur 'helm-only t) (defun helm-buffers-toggle-show-hidden-buffers () (interactive) @@ -1037,11 +1118,12 @@ displayed with the `file-name-shadow' face if available." helm-source-buffer-not-found) :buffer "*helm buffers*" :keymap helm-buffer-map - :truncate-lines helm-buffers-truncate-lines)) + :truncate-lines helm-buffers-truncate-lines + :left-margin-width helm-buffers-left-margin-width)) ;;;###autoload (defun helm-mini () - "Preconfigured `helm' lightweight version \(buffer -> recentf\)." + "Preconfigured `helm' displaying `helm-mini-default-sources'." (interactive) (require 'helm-x-files) (unless helm-source-buffers-list @@ -1050,7 +1132,8 @@ displayed with the `file-name-shadow' face if available." (helm :sources helm-mini-default-sources :buffer "*helm mini*" :ff-transformer-show-only-basename nil - :truncate-lines helm-buffers-truncate-lines)) + :truncate-lines helm-buffers-truncate-lines + :left-margin-width helm-buffers-left-margin-width)) (defun helm-quit-and-helm-mini () "Drop into `helm-mini' from `helm'." diff --git a/elpa/helm-20190122.549/helm-color.el b/elpa/helm-20191031.725/helm-color.el similarity index 98% rename from elpa/helm-20190122.549/helm-color.el rename to elpa/helm-20191031.725/helm-color.el index 106e9bec..a962796a 100644 --- a/elpa/helm-20190122.549/helm-color.el +++ b/elpa/helm-20191031.725/helm-color.el @@ -1,6 +1,6 @@ ;;; helm-color.el --- colors and faces -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20191031.725/helm-comint.el b/elpa/helm-20191031.725/helm-comint.el new file mode 100644 index 00000000..953d8a76 --- /dev/null +++ b/elpa/helm-20191031.725/helm-comint.el @@ -0,0 +1,219 @@ +;;; helm-comint.el --- Comint prompt navigation for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Pierre Neidhardt + +;; 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: +;; +;; You can bind this as follows in .emacs: +;; +;; (add-hook 'comint-mode-hook +;; (lambda () +;; (define-key comint-mode-map (kbd "M-s f") 'helm-comint-prompts-all))) + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'helm-lib) +(require 'helm-help) +(require 'helm-elisp) + +;;; Comint prompts +;; +(defface helm-comint-prompts-promptidx + '((t (:foreground "cyan"))) + "Face used to highlight comint prompt index." + :group 'helm-comint-faces) + +(defface helm-comint-prompts-buffer-name + '((t (:foreground "green"))) + "Face used to highlight comint buffer name." + :group 'helm-comint-faces) + +(defcustom helm-comint-prompts-promptidx-p t + "Show prompt number." + :group 'helm-comint + :type 'boolean) + +(defcustom helm-comint-mode-list '(comint-mode slime-repl-mode) + "Supported modes for prompt navigation. +Derived modes (e.g. Geiser's REPL) are automatically supported." + :group 'helm-comint + :type '(repeat (choice symbol))) + +(defcustom helm-comint-max-offset 400 + "Max number of chars displayed per candidate in comint-input-ring browser. +When `t', don't truncate candidate, show all. +By default it is approximatively the number of bits contained in five lines +of 80 chars each i.e 80*5. +Note that if you set this to nil multiline will be disabled, i.e you +will not have anymore separators between candidates." + :type '(choice (const :tag "Disabled" t) + (integer :tag "Max candidate offset")) + :group 'helm-misc) + +(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) + map) + "Keymap for `helm-comint-prompt-all'.") + +(defun helm-comint-prompts-list (mode &optional buffer) + "List the prompts in BUFFER in mode MODE. + +Return a list of (\"prompt\" (point) (buffer-name) prompt-index)) +e.g. (\"ls\" 162 \"*shell*\" 3). +If BUFFER is nil, use current buffer." + (with-current-buffer (or buffer (current-buffer)) + (when (derived-mode-p mode) + (save-excursion + (goto-char (point-min)) + (let (result (count 1)) + (save-mark-and-excursion + (helm-awhile (and (not (eobp)) (comint-next-prompt 1)) + (push (list (buffer-substring-no-properties + it (point-at-eol)) + it (buffer-name) count) + result) + (setq count (1+ count)))) + (nreverse result)))))) + +(defun helm-comint-prompts-list-all (mode) + "List the prompts of all buffers in mode MODE. +See `helm-comint-prompts-list'." + (cl-loop for b in (buffer-list) + append (helm-comint-prompts-list mode b))) + +(defun helm-comint-prompts-transformer (candidates &optional all) + ;; ("ls" 162 "*shell*" 3) => ("*shell*:3:ls" . ("ls" 162 "*shell*" 3)) + (cl-loop for (prt pos buf id) in candidates + collect `(,(concat + (when all + (concat (propertize + buf + 'face 'helm-comint-prompts-buffer-name) + ":")) + (when helm-comint-prompts-promptidx-p + (concat (propertize + (number-to-string id) + 'face 'helm-comint-prompts-promptidx) + ":")) + prt) + . ,(list prt pos buf id)))) + +(defun helm-comint-prompts-all-transformer (candidates) + (helm-comint-prompts-transformer candidates t)) + +(cl-defun helm-comint-prompts-goto (candidate &optional (action 'switch-to-buffer)) + ;; Candidate format: ("ls" 162 "*shell*" 3) + (let ((buf (nth 2 candidate))) + (unless (and (string= (buffer-name) buf) + (eq action 'switch-to-buffer)) + (funcall action buf)) + (goto-char (nth 1 candidate)) + (recenter))) + +(defun helm-comint-prompts-goto-other-window (candidate) + (helm-comint-prompts-goto candidate 'switch-to-buffer-other-window)) + +(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) + +(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) + +;;;###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) + (helm :sources + (helm-build-sync-source "Comint prompts" + :candidates (helm-comint-prompts-list major-mode) + :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"))) + +;;;###autoload +(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) + (helm :sources + (helm-build-sync-source "All comint prompts" + :candidates (helm-comint-prompts-list-all major-mode) + :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) + ("Go to prompt in other frame `C-c C-o`" . + helm-comint-prompts-goto-other-frame))) + :keymap helm-comint-prompts-keymap) + :buffer "*helm comint all prompts*") + (message "Current buffer is not a comint buffer"))) + +;;; Comint history +;; +;; +(defun helm-comint-input-ring-action (candidate) + "Default action for comint history." + (with-helm-current-buffer + (delete-region (comint-line-beginning-position) (point-max)) + (insert candidate))) + +(defvar helm-source-comint-input-ring + (helm-build-sync-source "Comint history" + :candidates (lambda () + (with-helm-current-buffer + (cl-loop for elm in (ring-elements comint-input-ring) + unless (string= elm "") + collect elm))) + :action 'helm-comint-input-ring-action + ;; Multiline does not work for `shell' because of an Emacs bug. + ;; It works in other REPLs like Geiser. + :multiline 'helm-comint-max-offset) + "Source that provides Helm completion against `comint-input-ring'.") + +;;;###autoload +(defun helm-comint-input-ring () + "Preconfigured `helm' that provide completion of `comint' history." + (interactive) + (when (derived-mode-p 'comint-mode) + (helm :sources 'helm-source-comint-input-ring + :input (buffer-substring-no-properties (comint-line-beginning-position) + (point-at-eol)) + :buffer "*helm comint history*"))) + +(provide 'helm-comint) + +;; Local Variables: +;; byte-compile-warnings: (not obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-comint.el ends here diff --git a/elpa/helm-20190122.549/helm-command.el b/elpa/helm-20191031.725/helm-command.el similarity index 90% rename from elpa/helm-20190122.549/helm-command.el rename to elpa/helm-20191031.725/helm-command.el index 7639a781..54aae483 100644 --- a/elpa/helm-20190122.549/helm-command.el +++ b/elpa/helm-20191031.725/helm-command.el @@ -1,6 +1,6 @@ ;;; helm-command.el --- Helm execute-exended-command. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -246,6 +246,7 @@ than the default which is OBARRAY." :input-history 'helm-M-x-input-history :del-input nil :help-message 'helm-M-x-help-message + :group 'helm-command :keymap helm-M-x-map :must-match t :match-part (lambda (c) (car (split-string c))) @@ -272,27 +273,28 @@ You can get help on each command by persistent action." (progn (setq helm-M-x-prefix-argument current-prefix-arg) (list current-prefix-arg (helm-M-x-read-extended-command)))) - (unless (string= command-name "") - (let ((sym-com (and (stringp command-name) (intern-soft command-name)))) - (when sym-com - ;; Avoid having `this-command' set to *exit-minibuffer. - (setq this-command sym-com - ;; Handle C-x z (repeat) Issue #322 - real-this-command sym-com) - ;; If helm-M-x is called with regular emacs completion (kmacro) - ;; use the value of arg otherwise use helm-current-prefix-arg. - (let ((prefix-arg (or helm-current-prefix-arg helm-M-x-prefix-argument))) - (cl-flet ((save-hist (command) - (setq extended-command-history - (cons command (delete command extended-command-history))))) - (condition-case-unless-debug err - (progn - (command-execute sym-com 'record) - (save-hist command-name)) - (error - (when helm-M-x-always-save-history - (save-hist command-name)) - (signal (car err) (cdr err)))))))))) + (when (stringp command-name) + (unless (string= command-name "") + (let ((sym-com (and (stringp command-name) (intern-soft command-name)))) + (when sym-com + ;; Avoid having `this-command' set to *exit-minibuffer. + (setq this-command sym-com + ;; Handle C-x z (repeat) Issue #322 + real-this-command sym-com) + ;; If helm-M-x is called with regular emacs completion (kmacro) + ;; use the value of arg otherwise use helm-current-prefix-arg. + (let ((prefix-arg (or helm-current-prefix-arg helm-M-x-prefix-argument))) + (cl-flet ((save-hist (command) + (setq extended-command-history + (cons command (delete command extended-command-history))))) + (condition-case-unless-debug err + (progn + (command-execute sym-com 'record) + (save-hist command-name)) + (error + (when helm-M-x-always-save-history + (save-hist command-name)) + (signal (car err) (cdr err))))))))))) (put 'helm-M-x 'interactive-only 'command-execute) (provide 'helm-command) diff --git a/elpa/helm-20190122.549/helm-config.el b/elpa/helm-20191031.725/helm-config.el similarity index 99% rename from elpa/helm-20190122.549/helm-config.el rename to elpa/helm-20191031.725/helm-config.el index b99ab639..36107538 100644 --- a/elpa/helm-20190122.549/helm-config.el +++ b/elpa/helm-20191031.725/helm-config.el @@ -1,6 +1,6 @@ ;;; helm-config.el --- Applications library for `helm.el' -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-dabbrev.el b/elpa/helm-20191031.725/helm-dabbrev.el similarity index 99% rename from elpa/helm-20190122.549/helm-dabbrev.el rename to elpa/helm-20191031.725/helm-dabbrev.el index 2cb0e6ee..6adce190 100644 --- a/elpa/helm-20190122.549/helm-dabbrev.el +++ b/elpa/helm-20191031.725/helm-dabbrev.el @@ -1,6 +1,6 @@ ;;; helm-dabbrev.el --- Helm implementation of dabbrev. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-easymenu.el b/elpa/helm-20191031.725/helm-easymenu.el similarity index 93% rename from elpa/helm-20190122.549/helm-easymenu.el rename to elpa/helm-20191031.725/helm-easymenu.el index 5619aacb..eb6878ba 100644 --- a/elpa/helm-20190122.549/helm-easymenu.el +++ b/elpa/helm-20191031.725/helm-easymenu.el @@ -1,6 +1,6 @@ ;;; helm-easymenu.el --- Helm easymenu definitions. -*- lexical-binding: t -*- -;; Copyright (C) 2015 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2015 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -44,9 +44,6 @@ ["Emacs Manual index" helm-info-emacs t] ["Gnus Manual index" helm-info-gnus t] ["Helm documentation" helm-documentation t]) - ("Org" - ["Org headlines in org agenda files" helm-org-agenda-files-headings t] - ["Org headlines in buffer" helm-org-in-buffer-headings t]) ("Elpa" ["Elisp packages" helm-list-elisp-packages t] ["Elisp packages no fetch" helm-list-elisp-packages-no-fetch t]) diff --git a/elpa/helm-20190122.549/helm-elisp-package.el b/elpa/helm-20191031.725/helm-elisp-package.el similarity index 69% rename from elpa/helm-20190122.549/helm-elisp-package.el rename to elpa/helm-20191031.725/helm-elisp-package.el index e5daff82..77f2c763 100644 --- a/elpa/helm-20190122.549/helm-elisp-package.el +++ b/elpa/helm-20191031.725/helm-elisp-package.el @@ -1,6 +1,6 @@ ;;; helm-elisp-package.el --- helm interface for package.el -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -55,16 +55,13 @@ (inhibit-read-only t)) (when (null package-alist) (setq helm-el-package--show-only 'all)) - (when (and (fboundp 'package--removable-packages) - (setq helm-el-package--removable-packages - (package--removable-packages)) - (fboundp 'package-autoremove)) + (when (setq helm-el-package--removable-packages + (package--removable-packages)) (package-autoremove)) (unwind-protect (progn (save-selected-window - (if (and helm-el-package--initialized-p - (fboundp 'package-show-package-list)) + (if helm-el-package--initialized-p ;; Use this as `list-packages' doesn't work ;; properly (empty buffer) when called from lisp ;; with 'no-fetch (emacs-25 WA). @@ -79,6 +76,9 @@ (setq helm-el-package--tabulated-list tabulated-list-entries) (remove-text-properties (point-min) (point-max) '(read-only button follow-link category)) + (goto-char (point-min)) + (while (re-search-forward "^[ \t]+" nil t) + (replace-match "")) (buffer-string))) (setq helm-el-package--upgrades (helm-el-package-menu--find-upgrades)) (if helm--force-updating-p @@ -93,14 +93,11 @@ (defun helm-el-package-describe (candidate) (let ((id (get-text-property 0 'tabulated-list-id candidate))) - (describe-package (if (fboundp 'package-desc-name) - (package-desc-name id) - (car id))))) + (describe-package (package-desc-name id)))) (defun helm-el-package-visit-homepage (candidate) (let* ((id (get-text-property 0 'tabulated-list-id candidate)) - (pkg (if (fboundp 'package-desc-name) (package-desc-name id) - (car id))) + (pkg (package-desc-name id)) (desc (cadr (assoc pkg package-archive-contents))) (extras (package-desc-extras desc)) (url (and (listp extras) (cdr-safe (assoc :url extras))))) @@ -116,21 +113,28 @@ (helm-exit-and-execute-action 'helm-el-package-visit-homepage))) (put 'helm-el-run-visit-homepage 'helm-only t) +(defun helm-elisp-package--pkg-name (pkg) + (if (package-desc-p pkg) + (package-desc-name pkg) + pkg)) + (defun helm-el-package-install-1 (pkg-list) (cl-loop with mkd = pkg-list for p in mkd for id = (get-text-property 0 'tabulated-list-id p) - for pkg = (if (fboundp 'package-desc-name) id (car id)) - do (package-install pkg) - collect pkg into installed-list - finally do (if (fboundp 'package-desc-full-name) - (message (format "%d packages installed:\n(%s)" - (length installed-list) - (mapconcat #'package-desc-full-name - installed-list ", "))) - (message (format "%d packages installed:\n(%s)" - (length installed-list) - (mapconcat 'symbol-name installed-list ", ")))))) + for name = (helm-elisp-package--pkg-name id) + do (package-install id t) + when (helm-aand (assq name package-alist) + (package-desc-dir (cadr it)) + (file-exists-p it)) + collect id into installed-list and + do (unless (package--user-selected-p name) + (package--save-selected-packages + (cons name package-selected-packages))) + finally do (message (format "%d packages installed:\n(%s)" + (length installed-list) + (mapconcat #'package-desc-full-name + installed-list ", "))))) (defun helm-el-package-install (_candidate) (helm-el-package-install-1 (helm-marked-candidates))) @@ -147,45 +151,19 @@ for id = (get-text-property 0 'tabulated-list-id p) do (condition-case-unless-debug err - (with-no-warnings - (if (fboundp 'package-desc-full-name) - ;; emacs 24.4 - (condition-case nil - (package-delete id force) - (wrong-number-of-arguments - (package-delete id))) - ;; emacs 24.3 - (package-delete (symbol-name (car id)) - (package-version-join (cdr id))))) + (package-delete id force) (error (message (cadr err)))) ;; Seems like package-descs are symbols with props instead of ;; vectors in emacs-27, use package-desc-name to ensure ;; compatibility in all emacs versions. unless (assoc (package-desc-name id) package-alist) - collect (if (fboundp 'package-desc-full-name) - id - (cons (symbol-name (car id)) - (package-version-join (cdr id)))) - into delete-list + collect id into delete-list finally do (if delete-list - (if (fboundp 'package-desc-full-name) - ;; emacs 24.4 - (message (format "%d packages deleted:\n(%s)" - (length delete-list) - (mapconcat #'package-desc-full-name - delete-list ", "))) - ;; emacs 24.3 - (message (format "%d packages deleted:\n(%s)" - (length delete-list) - (mapconcat (lambda (x) - (concat (car x) "-" (cdr x))) - delete-list ", "))) - ;; emacs 24.3 doesn't update - ;; its `package-alist' after deleting. - (cl-loop for p in package-alist - when (assq (symbol-name (car p)) delete-list) - do (setq package-alist (delete p package-alist)))) - "No package deleted"))) + (message (format "%d packages deleted:\n(%s)" + (length delete-list) + (mapconcat #'package-desc-full-name + delete-list ", "))) + "No package deleted"))) (defun helm-el-package-uninstall (_candidate) (helm-el-package-uninstall-1 (helm-marked-candidates) helm-current-prefix-arg)) @@ -200,41 +178,60 @@ (cl-loop for entry in helm-el-package--tabulated-list for pkg-desc = (car entry) for status = (package-desc-status pkg-desc) - when (member status '("installed" "unsigned" "dependency")) - collect pkg-desc - into installed + ;; A dependency. + when (string= status "dependency") + collect pkg-desc into dependencies + ;; An installed package used as dependency (user have + ;; installed this package explicitely). + when (package--used-elsewhere-p pkg-desc) + collect pkg-desc into installed-as-dep + ;; An installed package. + when (member status '("installed" "unsigned")) + collect pkg-desc into installed when (member status '("available" "new")) - collect (cons (package-desc-name pkg-desc) pkg-desc) - into available + collect (cons (package-desc-name pkg-desc) pkg-desc) into available finally return - (cl-loop for pkg in installed - for avail-pkg = (assq (package-desc-name pkg) available) + ;; Always try to upgrade dependencies before installed. + (cl-loop with all = (append dependencies installed-as-dep installed) + for pkg in all + for name = (package-desc-name pkg) + for avail-pkg = (assq name available) when (and avail-pkg - (version-list-< (package-desc-version pkg) - (package-desc-version - (cdr avail-pkg)))) + (version-list-< + (package-desc-version pkg) + (package-desc-version (cdr avail-pkg)))) collect avail-pkg))) +(defun helm-el-package--user-installed-p (package) + "Return non-nil if PACKAGE is a user-installed package." + (let* ((assoc (assq package package-alist)) + (pkg-desc (and assoc (cadr assoc))) + (dir (and pkg-desc (package-desc-dir pkg-desc)))) + (when dir + (file-in-directory-p dir package-user-dir)))) + (defun helm-el-package-upgrade-1 (pkg-list) (cl-loop for p in pkg-list for pkg-desc = (car p) - for upgrade = (cdr (assq (package-desc-name pkg-desc) + for pkg-name = (package-desc-name pkg-desc) + for upgrade = (cdr (assq pkg-name helm-el-package--upgrades)) do - (cond ((null upgrade) + (cond (;; Install. + (equal pkg-desc upgrade) + (message "Installing package `%s'" pkg-name) + (package-install pkg-desc t)) + (;; Do nothing. + (or (null upgrade) + ;; This may happen when a Elpa version of pkg + ;; is installed and need upgrade and pkg is as + ;; well a builtin package. + (package-built-in-p pkg-name)) (ignore)) - ((equal pkg-desc upgrade) - ;;Install. - (with-no-warnings - (if (boundp 'package-selected-packages) - (package-install pkg-desc t) - (package-install pkg-desc)))) - (t - ;; Delete. - (if (boundp 'package-selected-packages) - (with-no-warnings - (package-delete pkg-desc t t)) - (package-delete pkg-desc)))))) + (;; Delete. + t + (message "Deleting package `%s'" pkg-name) + (package-delete pkg-desc t t))))) (defun helm-el-package-upgrade (_candidate) (helm-el-package-upgrade-1 @@ -270,25 +267,27 @@ (defun helm-el-package--transformer (candidates _source) (cl-loop for c in candidates + for disp = (concat " " c) for id = (get-text-property 0 'tabulated-list-id c) - for name = (if (fboundp 'package-desc-name) - (and id (package-desc-name id)) - (car id)) + for name = (and id (package-desc-name id)) for desc = (package-desc-status id) for built-in-p = (and (package-built-in-p name) (not (member desc '("available" "new" "installed" "dependency")))) for installed-p = (member desc '("installed" "dependency")) for upgrade-p = (assq name helm-el-package--upgrades) - for user-installed-p = (and (boundp 'package-selected-packages) - (memq name package-selected-packages)) - do (when user-installed-p (put-text-property 0 2 'display "S " c)) - do (when (memq name helm-el-package--removable-packages) - (put-text-property 0 2 'display "U " c) + for user-installed-p = (memq name package-selected-packages) + do (when (and user-installed-p (not upgrade-p)) + (put-text-property 0 2 'display "S " disp)) + do (when (or (memq name helm-el-package--removable-packages) + (and upgrade-p installed-p)) + (put-text-property 0 2 'display "U " disp) (put-text-property 2 (+ (length (symbol-name name)) 2) - 'face 'font-lock-variable-name-face c)) - for cand = (cons c (car (split-string c))) + 'face 'font-lock-variable-name-face disp)) + do (when (and upgrade-p (not installed-p) (not built-in-p)) + (put-text-property 0 2 'display "I " disp)) + for cand = (cons disp (car (split-string disp))) when (or (and built-in-p (eq helm-el-package--show-only 'built-in)) (and upgrade-p @@ -403,34 +402,32 @@ (defun helm-el-package-recompile (_pkg) (cl-loop for p in (helm-marked-candidates) - for pkg-desc = (get-text-property 0 'tabulated-list-id p) - for name = (package-desc-name pkg-desc) - for dir = (package-desc-dir pkg-desc) - do (if (fboundp 'async-byte-recompile-directory) - (async-byte-recompile-directory dir) - (when (y-or-n-p (format "Really recompile `%s' while already loaded ?" name)) - (byte-recompile-directory dir 0 t))))) + do (helm-el-package-recompile-1 p))) + +(defun helm-el-package-recompile-1 (pkg) + (let* ((pkg-desc (get-text-property 0 'tabulated-list-id pkg)) + (dir (package-desc-dir pkg-desc))) + (async-byte-recompile-directory dir))) (defun helm-el-package-reinstall (_pkg) (cl-loop for p in (helm-marked-candidates) for pkg-desc = (get-text-property 0 'tabulated-list-id p) - for name = (package-desc-name pkg-desc) - do (if (boundp 'package-selected-packages) - (with-no-warnings - (package-delete pkg-desc 'force 'nosave) - ;; pkg-desc contain the description - ;; of the installed package just removed - ;; and is BTW no more valid. - ;; Use the entry in package-archive-content - ;; which is the non--installed package entry. - ;; For some reason `package-install' - ;; need a pkg-desc (package-desc-p) for the build-in - ;; packages already installed, the name (as symbol) - ;; fails with such packages. - (package-install - (cadr (assq name package-archive-contents)) t)) - (package-delete pkg-desc) - (package-install name)))) + do (helm-el-package-reinstall-1 pkg-desc))) + +(defun helm-el-package-reinstall-1 (pkg-desc) + (let ((name (package-desc-name pkg-desc))) + (package-delete pkg-desc 'force 'nosave) + ;; pkg-desc contain the description + ;; of the installed package just removed + ;; and is BTW no more valid. + ;; Use the entry in package-archive-content + ;; which is the non--installed package entry. + ;; For some reason `package-install' + ;; need a pkg-desc (package-desc-p) for the build-in + ;; packages already installed, the name (as symbol) + ;; fails with such packages. + (package-install + (cadr (assq name package-archive-contents)) t))) (defun helm-el-run-package-reinstall () (interactive) diff --git a/elpa/helm-20190122.549/helm-elisp.el b/elpa/helm-20191031.725/helm-elisp.el similarity index 97% rename from elpa/helm-20190122.549/helm-elisp.el rename to elpa/helm-20191031.725/helm-elisp.el index 40b5d549..78a5a3ce 100644 --- a/elpa/helm-20190122.549/helm-elisp.el +++ b/elpa/helm-20191031.725/helm-elisp.el @@ -1,6 +1,6 @@ ;;; helm-elisp.el --- Elisp symbols completion for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -357,7 +357,7 @@ in other window according to the value of `helm-elisp-help-function'." (let ((sym (intern-soft candidate))) (cl-typecase sym ((and fboundp boundp) - (if (member name '("describe-function" "describe-variable")) + (if (member name `(,helm-describe-function-function ,helm-describe-variable-function)) (funcall (intern (format "helm-%s" name)) sym) ;; When there is no way to know what to describe ;; prefer describe-function. @@ -661,10 +661,10 @@ Filename completion happen if string start after or between a double quote." :nomark t :persistent-action (lambda (candidate) (helm-elisp--persistent-help - candidate 'helm-describe-function)) + candidate 'helm-describe-class)) :persistent-help "Toggle describe class" - :action '(("Describe function" . helm-describe-function) - ("Find function" . helm-find-function) + :action '(("Describe Class" . helm-describe-class) + ("Find Class" . helm-find-function) ("Info lookup" . helm-info-lookup-symbol)))) (defun helm-def-source--eieio-generic (&optional default) @@ -829,23 +829,28 @@ i.e the `symbol-name' of any existing symbol." regexp) nil t))) :match-part (lambda (candidate) - (if helm-ff-transformer-show-only-basename - (helm-basename candidate) candidate)) + (with-helm-buffer + (if helm-ff-transformer-show-only-basename + (helm-basename candidate) candidate))) :filter-one-by-one (lambda (c) - (if helm-ff-transformer-show-only-basename - (cons (helm-basename c) c) c)) + (with-helm-buffer + (if helm-ff-transformer-show-only-basename + (cons (helm-basename c) c) c))) :action (helm-actions-from-type-file)) :ff-transformer-show-only-basename nil :buffer "*helm locate library*")) (defun helm-set-variable (var) - "Set value to VAR interactively." + "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))) - (prin1-to-string val) - (format "'%s" (prin1-to-string val))))))) + (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))))))) ;;; Elisp Timers. diff --git a/elpa/helm-20190122.549/helm-eshell.el b/elpa/helm-20191031.725/helm-eshell.el similarity index 99% rename from elpa/helm-20190122.549/helm-eshell.el rename to elpa/helm-20191031.725/helm-eshell.el index 66e81d75..ac7c9003 100644 --- a/elpa/helm-20190122.549/helm-eshell.el +++ b/elpa/helm-20191031.725/helm-eshell.el @@ -1,6 +1,6 @@ ;;; helm-eshell.el --- pcomplete and eshell completion for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -335,7 +335,8 @@ The function that call this should set `helm-ec-target' to thing at point." (unwind-protect (with-helm-show-completion beg end (helm :sources (helm-make-source "Eshell history" - 'helm-eshell-history-source) + 'helm-eshell-history-source + :fuzzy-match helm-eshell-fuzzy-match) :buffer "*helm eshell history*" :resume 'noresume :input input)) diff --git a/elpa/helm-20190122.549/helm-eval.el b/elpa/helm-20191031.725/helm-eval.el similarity index 99% rename from elpa/helm-20190122.549/helm-eval.el rename to elpa/helm-20191031.725/helm-eval.el index f1844cf5..caa31020 100644 --- a/elpa/helm-20190122.549/helm-eval.el +++ b/elpa/helm-20191031.725/helm-eval.el @@ -1,6 +1,6 @@ ;;; helm-eval.el --- eval expressions from helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-external.el b/elpa/helm-20191031.725/helm-external.el similarity index 99% rename from elpa/helm-20190122.549/helm-external.el rename to elpa/helm-20191031.725/helm-external.el index 0238f4b0..e539cde4 100644 --- a/elpa/helm-20190122.549/helm-external.el +++ b/elpa/helm-20191031.725/helm-external.el @@ -1,6 +1,6 @@ ;;; helm-external.el --- Run Externals commands within Emacs with helm completion. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-files.el b/elpa/helm-20191031.725/helm-files.el similarity index 86% rename from elpa/helm-20190122.549/helm-files.el rename to elpa/helm-20191031.725/helm-files.el index a3b1ac4e..4263ae77 100644 --- a/elpa/helm-20190122.549/helm-files.el +++ b/elpa/helm-20191031.725/helm-files.el @@ -1,6 +1,6 @@ ;;; helm-files.el --- helm file browser and related. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -72,21 +72,13 @@ If you want to have the default tramp messages set it to 3." (defcustom helm-ff-auto-update-initial-value nil "Auto update when only one candidate directory is matched. -Default value when starting `helm-find-files' is nil because -it prevent using to delete char backward and by the way -confuse beginners. +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-lynx-style-map t - "Use arrow keys to navigate with `helm-find-files'. -You will have to restart Emacs or reeval `helm-find-files-map' -and `helm-read-file-map' for this take effect." - :group 'helm-files - :type 'boolean) - (defcustom helm-ff-history-max-length 100 "Number of elements shown in `helm-find-files' history." :group 'helm-files @@ -166,15 +158,24 @@ WARNING: Setting this to nil is unsafe and can cause deletion of a whole tree." :type 'boolean) (defcustom helm-ff-skip-boring-files nil - "Non--nil to skip files matching regexps in -`helm-boring-file-regexp-list'. + "Non--nil to skip boring files. +I.e. the files matching regexps in `helm-boring-file-regexp-list'. This take effect in `helm-find-files' and file completion used by `helm-mode' i.e `helm-read-file-name'. Note that when non-nil this will slow down slightly `helm-find-files'." :group 'helm-files :type 'boolean) +(defcustom helm-ff-skip-git-ignored-files nil + "Non--nil to skip git ignored files. + +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 "The `helm-candidate-number-limit' for `helm-find-files' and friends. Note that when going one level up with `\\\\[helm-find-files-up-one-level]' @@ -240,6 +241,11 @@ See also `ffap-url-unwrap-remote' that may override this variable." :group 'helm-files :type 'boolean) +(defcustom helm-ff-allow-non-existing-file-at-point nil + "Use file-at-point as initial input in `helm-find-files' even if it doesn't exists." + :group 'helm-files + :type 'boolean) + (defcustom helm-find-files-ignore-thing-at-point nil "Use only `default-directory' as default input in `helm-find-files'. I.e text under cursor in `current-buffer' is ignored. @@ -269,7 +275,11 @@ Remote filesystem are generally mounted with sshfs." :type '(repeat string)) (defcustom helm-browse-project-default-find-files-fn - #'helm-browse-project-walk-directory + (cond ((executable-find "rg") + #'helm-browse-project-rg-find-files) + ((executable-find "ag") + #'helm-browse-project-ag-find-files) + (t #'helm-browse-project-walk-directory)) "The default function to retrieve files in a non-vc directory. A function that takes a directory name as only arg." @@ -336,23 +346,24 @@ from `helm-find-files'." (defcustom helm-trash-remote-files nil "Allow trashing remote files when non-nil. -Deleting remote files with tramp doesn't work out of the box, it is -why it is disabled by default. +Trashing remote files with tramp doesn't work out of the box unless +'trash-cli' package is installed, it is why trashing remote files from +helm is disabled by default. -Following is NOT documented in tramp AFAIK but tramp is using -external trash command in its `delete-file' and `delete-directory' -handlers. +Tramp is using external 'trash' command in its `delete-file' and +`delete-directory' handlers when using `delete-by-moving-to-trash', +which is documented nowhere in Emacs. If you want to enable this you will have to install the 'trash' command -on remote (or locally if you want to trash as root), the package on -Ubuntu based distribution is 'trash-cli'." +on remote (and/or locally if you want to trash as root), on Ubuntu +based distribution it is 'trash-cli'." :group 'helm-files :type 'boolean) (defcustom helm-list-directory-function (cl-case system-type (gnu/linux #'helm-list-dir-external) - (berkeley-unix #'helm-list-dir-external) + (berkeley-unix #'helm-list-dir-lisp) (windows-nt #'helm-list-dir-lisp) (t #'helm-list-dir-lisp)) "The function used in `helm-find-files' to list remote directories. @@ -365,9 +376,42 @@ provided with local files i.e. colorized symlinks, executables files etc... whereas using `helm-list-dir-lisp' will allow colorizing only directories but is more portable. -NOTE that `helm-list-dir-external' needs ls and awk as dependencies." +NOTE: `helm-list-dir-external' needs ls and awk as dependencies. +Also the ls version installed on the remote side should support the +same arguments as the GNU/ls version that are -A -1 -F -b and -Q. +So even if you are using a GNU/ls version locally and you want to +connect e.g. on a Freebsd server you may have failures due to the +incompatible ls version installed on remote server. +In such case use `helm-list-dir-lisp' which work everywhere but is +slower and less featured (only directories colorized)." :type 'function :group 'helm-files) + +(defcustom helm-ff-initial-sort-method nil + "Sort method to use when initially listing a directory. +Note that this doesn't affect the listing when matching inside the +directory (i.e. filenames)." + :group 'helm-files + :type '(choice + (const :tag "alphabetically" nil) + (const :tag "newest" newest) + (const :tag "size" size))) + +(defcustom helm-ff-rotate-image-program "exiftran" + "External program used to rotate images." + :group 'helm-files + :type '(choice + (const :tag "Mogrify" "mogrify") + (const :tag "Exiftran" "exiftran") + (const :tag "Jpegtran" "jpegtran"))) + +(defcustom helm-ff-rotate-image-switch '("-i") + "Options used with `helm-ff-rotate-image-program'. +If you are using Mogrify or Jpegtran mandatory option is \"-rotate\", +with Exiftran mandatory option is \"-i\"." + :group 'helm-files + :type '(repeat string)) + ;;; Faces ;; @@ -466,6 +510,7 @@ NOTE that `helm-list-dir-external' needs ls and awk as dependencies." ;;; Helm-find-files - The helm file browser. ;; ;; Keymaps + (defvar helm-find-files-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) @@ -474,7 +519,7 @@ NOTE that `helm-list-dir-external' needs ls and awk as dependencies." (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-toggle-to-bookmark) + (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) @@ -526,14 +571,16 @@ NOTE that `helm-list-dir-external' needs ls and awk as dependencies." (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) (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 helm-ff-lynx-style-map - (define-key map (kbd "") 'helm-find-files-up-one-level) - (define-key map (kbd "") 'helm-execute-persistent-action)) - (delq nil map)) + (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 @@ -552,14 +599,37 @@ NOTE that `helm-list-dir-external' needs ls and awk as dependencies." '((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 helm-ff-lynx-style-map - (define-key map (kbd "") 'helm-find-files-up-one-level) - (define-key map (kbd "") 'helm-execute-persistent-action) - (define-key map (kbd "") 'helm-previous-source) - (define-key map (kbd "") 'helm-next-source)) - (delq nil map)) + map) "Keymap for `helm-read-file-name'.") +(defcustom helm-ff-lynx-style-map nil + "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 delete char backward. + +When nil always delete char backward." + :group 'helm-files + :type 'boolean) ;; Internal. (defvar helm-find-files-doc-header " (\\\\[helm-find-files-up-one-level]: Go up one level)" @@ -641,6 +711,9 @@ Don't set it directly, use instead `helm-ff-auto-update-initial-value'.") "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'." @@ -667,11 +740,11 @@ Should not be used among other sources.") (require 'helm-external))) (candidates :initform 'helm-find-files-get-candidates) (filtered-candidate-transformer - :initform '(helm-ff-sort-candidates - (lambda (candidates _source) + :initform '((lambda (candidates _source) (cl-loop for f in candidates for ff = (helm-ff-filter-candidate-one-by-one f) - when ff collect ff)))) + when ff collect ff)) + helm-ff-sort-candidates)) (persistent-action-if :initform 'helm-find-files-persistent-action-if) (persistent-help :initform "Hit1 Expand Candidate, Hit2 or (C-u) Find file") (help-message :initform 'helm-ff-help-message) @@ -708,8 +781,8 @@ Should not be used among other sources.") ;; directory. (when (file-directory-p fname) (helm-find-files-1 fname (if helm-ff-transformer-show-only-basename - (helm-basename presel) - presel))))) + (concat "^" (regexp-quote (helm-basename presel))) + (regexp-quote presel)))))) (defun helm-ff-bookmark-set () "Record `helm-find-files' session in bookmarks." @@ -787,13 +860,15 @@ ACTION must be an action supported by `helm-dired-action'." (helm-marked-candidates :with-wildcard t))) (cand (helm-get-selection)) ; Target (prefarg helm-current-prefix-arg) - (prompt (format "%s %s file(s) to: " + (prompt (format "%s %s file(s) %s: " (if (and (and (fboundp 'dired-async-mode) dired-async-mode) (null prefarg)) (concat "Async " (symbol-name action)) (capitalize (symbol-name action))) - (length ifiles))) + (length ifiles) + (if (memq action '(symlink relsymlink hardlink)) + "from" "to"))) helm-ff--move-to-first-real-candidate helm-display-source-at-screen-top ; prevent setting window-start. helm-ff-auto-update-initial-value @@ -942,7 +1017,7 @@ layout." (defvar eshell-command-aliases-list nil) (defvar helm-eshell-command-on-file-input-history nil) -(defun helm-find-files-eshell-command-on-file-1 (&optional map) +(cl-defun helm-find-files-eshell-command-on-file-1 (&optional map) "Run `eshell-command' on CANDIDATE or marked candidates. This is done possibly with an eshell alias, if no alias found, you can type in an eshell command. @@ -977,27 +1052,35 @@ working." (require 'em-alias) (eshell-read-aliases-list) (when (or eshell-command-aliases-list (y-or-n-p "No eshell aliases found, run eshell-command without alias anyway? ")) - (let* ((cand-list (helm-marked-candidates)) + (let* ((cand-list (helm-marked-candidates :with-wildcard t)) (default-directory (or helm-ff-default-directory ;; If candidate is an url *-ff-default-directory is nil ;; so keep value of default-directory. default-directory)) - (command (helm-comp-read - "Command: " - (cl-loop for (a c) in (eshell-read-aliases-list) - ;; Positional arguments may be double - ;; quoted (Issue #1881). - when (string-match "[\"]?.*\\(\\$1\\|\\$\\*\\)[\"]?\\'" c) - collect (propertize a 'help-echo c) into ls - finally return (sort ls 'string<)) - :buffer "*helm eshell on file*" - :name "Eshell command" - :mode-line - '("Eshell alias" - "C-h m: Help, \\[universal-argument]: Insert output at point") - :help-message 'helm-esh-help-message - :input-history - 'helm-eshell-command-on-file-input-history)) + helm-display-source-at-screen-top + (helm-actions-inherit-frame-settings t) + helm-use-frame-when-more-than-two-windows + (command (with-helm-display-marked-candidates + helm-marked-buffer-name + (helm-ff--count-and-collect-dups + (mapcar 'helm-basename cand-list)) + (with-helm-current-buffer + (helm-comp-read + "Command: " + (cl-loop for (a c) in (eshell-read-aliases-list) + ;; Positional arguments may be double + ;; quoted (Issue #1881). + when (string-match "[\"]?.*\\(\\$1\\|\\$\\*\\)[\"]?\\'" c) + collect (propertize a 'help-echo c) into ls + finally return (sort ls 'string<)) + :buffer "*helm eshell on file*" + :name "Eshell command" + :mode-line + '("Eshell alias" + "C-h m: Help, \\[universal-argument]: Insert output at point") + :help-message 'helm-esh-help-message + :input-history + 'helm-eshell-command-on-file-input-history)))) (alias-value (car (assoc-default command eshell-command-aliases-list))) cmd-line) (if (or (equal helm-current-prefix-arg '(16)) @@ -1026,10 +1109,9 @@ working." ;; This wont work on remote files, because tramp handlers depends ;; on `default-directory' (limitation). (let ((mapfiles (mapconcat 'eshell-quote-argument cand-list " "))) - (if (string-match "'%s'\\|\"%s\"\\|%s" command) + (if (string-match "%s" command) (setq cmd-line (format command mapfiles)) ; See [1] - (setq cmd-line (format "%s %s" command mapfiles))) - (helm-log "%S" cmd-line) + (setq cmd-line (format "%s %s" command mapfiles))) (eshell-command cmd-line)) ;; Run eshell-command on EACH marked files. @@ -1037,16 +1119,25 @@ working." ;; COMMAND on basename of each file, using ;; its basedir as `default-directory'. (cl-loop for f in cand-list + for n from 1 for dir = (and (not (string-match helm--url-regexp f)) (helm-basedir f)) - for file = (eshell-quote-argument - (format "%s" (if (and dir (file-remote-p dir)) - (helm-basename f) f))) - for com = (if (string-match "'%s'\\|\"%s\"\\|%s" command) + ;; We can use basename here as the command will run + ;; under default-directory. + ;; This allow running e.g. "tar czvf test.tar.gz + ;; %s/*" without creating an archive expanding from /home. + for file = (eshell-quote-argument (helm-basename f)) + ;; \@ => placeholder for file without extension. + ;; \# => placeholder for incremental number. + for fcmd = (replace-regexp-in-string + "\\\\@" (regexp-quote (file-name-sans-extension file)) + (replace-regexp-in-string + "\\\\#" (format "%03d" n) command)) + for com = (if (string-match "%s" fcmd) ;; [1] This allow to enter other args AFTER filename ;; i.e - (format command file) - (format "%s %s" command file)) + (format fcmd file) + (format "%s %s" fcmd file)) do (let ((default-directory (or dir default-directory))) (eshell-command com))))))) @@ -1134,6 +1225,30 @@ prefix arg eshell buffer doesn't exists, create it and switch to it." (helm-exit-and-execute-action 'helm-ff-touch-files))) (put 'helm-ff-run-touch-files 'helm-only t) +(defun helm-ff-sort-by-size () + (interactive) + (unless (eq helm-ff-initial-sort-method 'size) + (setq helm-ff-initial-sort-method 'size) + (helm-update (helm-get-selection nil helm-ff-transformer-show-only-basename))) + (message "Sorting by size")) +(put 'helm-ff-sort-by-size 'helm-only t) + +(defun helm-ff-sort-by-newest () + (interactive) + (unless (eq helm-ff-initial-sort-method 'newest) + (setq helm-ff-initial-sort-method 'newest) + (helm-update (helm-get-selection nil helm-ff-transformer-show-only-basename))) + (message "Sorting by newest")) +(put 'helm-ff-sort-by-newest 'helm-only t) + +(defun helm-ff-sort-alpha () + (interactive) + (unless (eq helm-ff-initial-sort-method nil) + (setq helm-ff-initial-sort-method nil) + (helm-update (helm-get-selection nil helm-ff-transformer-show-only-basename))) + (message "Sorting alphabetically")) +(put 'helm-ff-sort-alpha 'helm-only t) + (defun helm-ff-serial-rename-action (method) "Rename all marked files in `helm-ff-default-directory' with METHOD. See `helm-ff-serial-rename-1'." @@ -1360,7 +1475,8 @@ This doesn't replace inside the files, only modify filenames." (unless (string= query "!") (setq query (helm-read-answer (format "Replace `%s' by `%s' [!,y,n,q]" - old new) + (helm-basename old) + (helm-basename new)) '("y" "n" "!" "q")))) (when (string= query "q") (cl-return (message "Operation aborted"))) @@ -1448,21 +1564,32 @@ This doesn't replace inside the files, only modify filenames." (put 'helm-ff-run-toggle-auto-update 'helm-only t) (defun helm-ff-delete-char-backward () - "Disable helm find files auto update and delete char backward." + "Go up one level or disable HFF auto update and delete char backward. + +Going up one level works only when pattern is a directory endings with +\"/\", otherwise this command delete char backward. + +Going up one level can be disabled if necessary by deleting \"/\" at +end of pattern using \\\\[backward-char] and \\[helm-delete-minibuffer-contents]." (interactive) (with-helm-alive-p - (setq helm-ff-auto-update-flag nil) - (setq helm-ff--deleting-char-backward t) - (call-interactively - (lookup-key (current-global-map) - (read-kbd-macro "DEL"))) - (helm--update-header-line))) + (if (and helm-ff-DEL-up-one-level-maybe + (string-match "/\\'" helm-pattern) + (file-directory-p helm-pattern)) + (call-interactively 'helm-find-files-up-one-level) + (setq helm-ff-auto-update-flag nil) + (setq helm-ff--deleting-char-backward t) + (call-interactively + (lookup-key (current-global-map) + (read-kbd-macro "DEL"))) + (helm--update-header-line)))) (put 'helm-ff-delete-char-backward 'helm-only t) (defun helm-ff-delete-char-backward--exit-fn () (setq helm-ff-auto-update-flag helm-ff--auto-update-state) (setq helm-ff--deleting-char-backward nil)) +(defvar helm-ff--RET-disabled nil) (defun helm-ff-RET-1 (&optional must-match) "Used for RET action in `helm-find-files'. See `helm-ff-RET' for details. @@ -1471,6 +1598,10 @@ If MUST-MATCH is specified exit with (let ((sel (helm-get-selection))) (cl-assert sel nil "Trying to exit with no candidates") (if (and (file-directory-p sel) + ;; Allows exiting with default action when a prefix arg + ;; is specified. + (null current-prefix-arg) + (null helm-ff--RET-disabled) (not (string= "." (helm-basename sel)))) (helm-execute-persistent-action) (if must-match @@ -1489,6 +1620,29 @@ Behave differently depending of `helm-selection': (helm-ff-RET-1)) (put 'helm-ff-RET 'helm-only t) +(defun helm-ff-TAB-1 (&optional force-menu) + "Used for TAB action in `helm-find-files'." + (let ((sel (helm-get-selection))) + (if (and (null force-menu) + (file-directory-p sel) + (not (string= "." (helm-basename sel)))) + (helm-execute-persistent-action) + (helm-select-action)))) + +(defun helm-ff-TAB (arg) + "Default action for TAB in `helm-find-files'. + +Behave differently depending of `helm-selection': + +- candidate basename is \".\" => open the action menu. +- candidate is a directory => expand it. +- candidate is a file => open action menu. + +Called with a prefix arg open menu unconditionally." + (interactive "P") + (helm-ff-TAB-1 arg)) +(put 'helm-ff-TAB 'helm-only t) + (defun helm-ff-RET-must-match () "Same as `helm-ff-RET' but used in must-match map." (interactive) @@ -1775,19 +1929,38 @@ Same as `dired-do-print' but for helm." (defun helm-ff-checksum (file) "Calculate the checksum of FILE. -The checksum is copied to kill-ring." +The checksum is copied to kill-ring. +Checksum is calculated with the md5sum, sha1sum, sha224sum, sha256sum, +sha384sum and sha512sum when available, otherwise the emacs function +`secure-hash' is used but it is slow and may crash Emacs and even the +whole system as it eats all memory." (cl-assert (file-regular-p file) nil "`%s' is not a regular file" file) - (let ((algo (intern (helm-comp-read - "Algorithm: " - '(md5 sha1 sha224 sha256 sha384 sha512)))) - (bn (helm-basename file))) + (let* ((algo (intern (helm-comp-read + "Algorithm: " + '(md5 sha1 sha224 sha256 sha384 sha512)))) + (cmd (concat (symbol-name algo) "sum")) + (bn (helm-basename file)) + proc) (message "Calculating %s checksum for %s..." algo bn) - (async-let ((sum (with-temp-buffer - (insert-file-contents-literally file) - (secure-hash algo (current-buffer))))) - (kill-new sum) - (message "Calculating %s checksum for `%s' done and copied to kill-ring" algo bn)))) + (if (executable-find cmd) + (progn + (set-process-filter + (setq proc (start-file-process cmd nil cmd "-b" file)) + (lambda (_process output) + (when output (kill-new output)))) + (set-process-sentinel + proc + `(lambda (_process event) + (when (string= event "finished\n") + (message "Calculating %s checksum for `%s' done and copied to kill-ring" + ,(symbol-name algo) ,bn))))) + (async-let ((sum (with-temp-buffer + (insert-file-contents-literally file) + (secure-hash algo (current-buffer))))) + (kill-new sum) + (message "Calculating %s checksum for `%s' done and copied to kill-ring" + algo bn))))) (defun helm-ff-toggle-basename (_candidate) (with-helm-buffer @@ -1805,9 +1978,19 @@ The checksum is copied to kill-ring." (helm-ff-toggle-basename nil)))) (put 'helm-ff-run-toggle-basename 'helm-only t) -(defun helm-reduce-file-name (fname level) - "Reduce FNAME by number LEVEL from end." - ;; This version comes from issue #2004 (UNC paths) and should fix it. +(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 + ;; with ftp fnames (emacs bug). + (cl-loop with result + with iter = (helm-iter-reduce-fname (expand-file-name fname)) + repeat level do (setq result (helm-iter-next iter)) + finally return (or result (expand-file-name "/")))) + +(defun helm-reduce-file-name-2 (fname level) + ;; This version comes from issue #2004 (UNC paths) and should fix + ;; it. It works with local files and remote files as well but not + ;; with ftp, see helm-reduce-file-name-1. (while (> level 0) (unless (or (string= fname "/") (string= (file-remote-p fname 'localname) "/")) @@ -1816,6 +1999,24 @@ The checksum is copied to kill-ring." (setq level (1- level))) fname) +(defun helm-reduce-file-name (fname level) + "Reduce FNAME by number LEVEL from end." + (if (helm-aand (file-remote-p fname 'method) + (string= it "ftp")) + (helm-reduce-file-name-1 fname level) + (helm-reduce-file-name-2 fname level))) + +(defun helm-iter-reduce-fname (fname) + "Yield FNAME reduced by one level at each call." + (let ((split (split-string fname "/" t))) + (unless (or (null split) + (string-match "\\`\\(~\\|[[:alpha:]]:\\)" (car split))) + (setq split (cons "/" split))) + (lambda () + (when (and split (cdr split)) + (cl-loop for i in (setq split (butlast split)) + concat (if (string= i "/") i (concat i "/"))))))) + (defvar helm-find-files--level-tree nil) (defvar helm-find-files--level-tree-iterator nil) (defun helm-find-files-up-one-level (arg) @@ -2420,11 +2621,32 @@ purpose." If DIRECTORY is remote use `helm-list-directory-function' otherwise use `directory-files'." - (if (file-remote-p directory) - (funcall helm-list-directory-function directory) - (directory-files directory t directory-files-no-dot-files-regexp))) - -(defun helm-list-dir-lisp (directory) + (let* ((remote (file-remote-p directory 'method)) + (helm-list-directory-function + (if (and remote (not (string= remote "ftp"))) + helm-list-directory-function + #'helm-list-dir-lisp)) + (remote-fn-p (eq helm-list-directory-function + 'helm-list-dir-external)) + (sort-method (cl-case helm-ff-initial-sort-method + (newest (if (and remote remote-fn-p) + "-t" #'file-newer-than-file-p)) + (size (if (and remote remote-fn-p) + "-S" #'helm-ff-file-larger-that-file-p)) + (t nil)))) + (if remote + (funcall helm-list-directory-function directory sort-method) + (if sort-method + (sort (directory-files directory t directory-files-no-dot-files-regexp) + sort-method) + (directory-files directory t directory-files-no-dot-files-regexp))))) + +(defsubst helm-ff-file-larger-that-file-p (f1 f2) + (let ((attr1 (file-attributes f1)) + (attr2 (file-attributes f2))) + (> (nth 7 attr1) (nth 7 attr2)))) + +(defun helm-list-dir-lisp (directory &optional sort-method) "List DIRECTORY with `file-name-all-completions' as backend. Add a `helm-ff-dir' property on each fname ending with \"/\"." @@ -2433,7 +2655,7 @@ Add a `helm-ff-dir' property on each fname ending with \"/\"." ;; the displayed files will be plain wrong in this case, even worst ;; the filenames will be splitted in two or more filenames. (cl-loop for f in (sort (file-name-all-completions "" directory) - 'string-lessp) + (or sort-method 'string-lessp)) unless (or (string= f "") (member f '("./" "../")) ;; Ignore the tramp names from / @@ -2445,7 +2667,7 @@ Add a `helm-ff-dir' property on each fname ending with \"/\"." else collect (propertize (expand-file-name f directory) 'helm-ff-file t))) -(defun helm-list-dir-external (dir) +(defun helm-list-dir-external (dir &optional sort-method) "List directory DIR with external shell command as backend. This function is fast enough to be used for remote files and save the @@ -2464,7 +2686,8 @@ transformer." ;; "foo*" for the real file foo. The downside is ;; that we need an extra step to remove the quotes ;; at the end which impact performances. - "ls -A -1 -F -b -Q | awk -v dir=%s '{print dir $1}'" + "ls -A -1 -F -b -Q %s | awk -v dir=%s '{print dir $0}'" + (or sort-method "") (shell-quote-argument default-directory)) nil t nil) 0) @@ -2630,19 +2853,23 @@ Note that only existing directories are saved here." "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* ((all it) - (dired-line (helm-file-attributes + (let* ((dired-line (helm-file-attributes candidate :dired t :human-size t)) - (type (cl-getf all :type)) - (mode-type (cl-getf all :mode-type)) - (owner (cl-getf all :uid)) - (owner-right (cl-getf all :user t)) - (group (cl-getf all :gid)) - (group-right (cl-getf all :group)) - (other-right (cl-getf all :other)) - (size (helm-file-human-size (cl-getf all :size))) - (modif (cl-getf all :modif-time)) - (access (cl-getf all :access-time)) + (type (cl-getf it :type)) + (mode-type (cl-getf it :mode-type)) + (owner (cl-getf it :uid)) + (owner-right (cl-getf it :user t)) + (group (cl-getf it :gid)) + (group-right (cl-getf it :group)) + (other-right (cl-getf it :other)) + (trash (and (helm-ff-trash-file-p candidate) + (helm-ff--get-dest-file-from-trash + (helm-ff-trash-list) + (replace-regexp-in-string + "\\.trashinfo\\'" "" candidate)))) + (size (helm-file-human-size (cl-getf it :size))) + (modif (cl-getf it :modif-time)) + (access (cl-getf it :access-time)) (ext (helm-get-default-program-for-file candidate)) (tooltip-hide-delay (or helm-tooltip-hide-delay tooltip-hide-delay))) (if (and (display-graphic-p) tooltip-mode) @@ -2667,7 +2894,10 @@ Note that only existing directories are saved here." (format "Others: %s\n" other-right) (format "Size: %s\n" size) (format "Modified: %s\n" modif) - (format "Accessed: %s\n" access))) + (format "Accessed: %s\n" access) + (and (stringp trash) + (format "Trash: %s\n" + (abbreviate-file-name trash))))) (message dired-line) (sit-for 5))) (message "Permission denied, file not readable"))) @@ -2766,10 +2996,15 @@ return FNAME prefixed with [?]." (concat prefix-url " " fname)) (new-file (concat prefix-new " " fname))))) -(defun helm-ff-score-candidate-for-pattern (str pattern) - (if (member str '("." "..")) - 200 - (helm-score-candidate-for-pattern str pattern))) +(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))) (defun helm-ff-sort-candidates-1 (candidates input) "Sort function for `helm-source-find-files'. @@ -2782,18 +3017,22 @@ Return candidates prefixed with basename of INPUT first." (let* ((memo-src (make-hash-table :test 'equal)) (all (sort candidates (lambda (s1 s2) - (let* ((score (lambda (str) + (let* ((score (lambda (disp real) (helm-ff-score-candidate-for-pattern - str (helm-basename input)))) - (bn1 (helm-basename (if (consp s1) (cdr s1) s1))) - (bn2 (helm-basename (if (consp s2) (cdr s2) s2))) - (sc1 (or (gethash bn1 memo-src) - (puthash bn1 (funcall score bn1) memo-src))) - (sc2 (or (gethash bn2 memo-src) - (puthash bn2 (funcall score bn2) memo-src)))) + disp real (helm-basename input)))) + ;; Reals + (r1 (helm-basename (if (consp s1) (cdr s1) s1))) + (r2 (helm-basename (if (consp s2) (cdr s2) s2))) + ;; Displays + (d1 (helm-basename (if (consp s1) (car s1) s1))) + (d2 (helm-basename (if (consp s2) (car s2) s2))) + (sc1 (or (gethash r1 memo-src) + (puthash r1 (funcall score r1 d1) memo-src))) + (sc2 (or (gethash r2 memo-src) + (puthash r2 (funcall score r2 d2) memo-src)))) (cond ((= sc1 sc2) - (< (string-width bn1) - (string-width bn2))) + (< (string-width r1) + (string-width r2))) ((> sc1 sc2)))))))) all))) @@ -2805,16 +3044,25 @@ Return candidates prefixed with basename of `helm-input' first." (defun helm-ff-boring-file-p (file) ;; Prevent user doing silly thing like ;; adding the dotted files to boring regexps (#924). - (and (not (string-match "\\.$" file)) + (and helm-ff-skip-boring-files + (not (string-match "\\.$" file)) (string-match helm-ff--boring-regexp file))) +(defvar helm-ff--git-found-p nil) +(defun helm-ff-git-ignored-p (file) + (and helm-ff-skip-git-ignored-files + (not (file-remote-p file)) + (or helm-ff--git-found-p + (setq helm-ff--git-found-p (executable-find "git"))) + (zerop (call-process "git" nil nil nil "check-ignore" "-q" file)))) + (defun helm-ff-filter-candidate-one-by-one (file) "`filter-one-by-one' Transformer function for `helm-source-find-files'." ;; Handle boring files (let ((basename (helm-basename file)) dot) - (unless (and helm-ff-skip-boring-files - (helm-ff-boring-file-p basename)) + (unless (or (helm-ff-boring-file-p basename) + (helm-ff-git-ignored-p file)) ;; Handle tramp files with minimal highlighting. (if (and (or (string-match-p helm-tramp-file-name-regexp helm-pattern) @@ -2931,9 +3179,9 @@ Return candidates prefixed with basename of `helm-input' first." (when (file-regular-p candidate) (setq actions (helm-append-at-nth actions '(("Checksum File" . helm-ff-checksum)) 4))) - (cond ((and (string-match "Trash/files/?\\'" (helm-basedir candidate)) + (cond ((and (file-exists-p candidate) + (string-match "Trash/files/?\\'" (helm-basedir candidate)) (not (member (helm-basename candidate) '("." ".."))) - (file-exists-p candidate) (executable-find "trash")) (helm-append-at-nth actions @@ -2952,14 +3200,20 @@ Return candidates prefixed with basename of `helm-input' first." '(("Rotate image right `M-r'" . helm-ff-rotate-image-right) ("Rotate image left `M-l'" . helm-ff-rotate-image-left)) 3)) - ((string-match "\\.el$" (helm-aif (helm-marked-candidates) - (car it) candidate)) + ((string-match "\\.el\\'" (helm-aif (helm-marked-candidates) + (car it) candidate)) (helm-append-at-nth actions '(("Byte compile lisp file(s) `M-B, C-u to load'" . helm-find-files-byte-compile) ("Load File(s) `M-L'" . helm-find-files-load-files)) 2)) + ((string-match "\\.elc?\\'" (helm-aif (helm-marked-candidates) + (car it) candidate)) + (helm-append-at-nth + actions + '(("Load File(s) `M-L'" . helm-find-files-load-files)) + 2)) ((and (string-match "\\.html?$" candidate) (file-exists-p candidate)) (helm-append-at-nth @@ -2980,29 +3234,31 @@ e.g. '(\"delete\" \"deleting\"), ARGS are other args to be passed to FN." (with-helm-display-marked-candidates helm-marked-buffer-name (helm-ff--count-and-collect-dups (mapcar 'helm-basename mkd)) - (when (y-or-n-p (format "%s %s files from trash? " - (capitalize (car names)) - (length mkd))) - (message "%s files from trash..." (capitalize (cadr names))) - (cl-loop for f in mkd do - (condition-case err - (apply fn f args) - (error (push (format "%s" (cadr err)) errors) - nil))))) - (if errors - (display-warning 'helm - (with-temp-buffer - (insert (format-time-string "%Y-%m-%d %H:%M:%S\n" - (current-time))) - (insert (format - "Failed to %s %s/%s files from trash\n" - (car names) (length errors) (length mkd))) - (insert (mapconcat 'identity errors "\n") "\n ") - (buffer-string)) - :error - "*helm restore warnings*") - (message "%s %s files from trash done" - (capitalize (cadr names)) (length mkd))))) + (if (y-or-n-p (format "%s %s files from trash? " + (capitalize (car names)) + (length mkd))) + (progn + (message "%s files from trash..." (capitalize (cadr names))) + (cl-loop for f in mkd do + (condition-case err + (apply fn f args) + (error (push (format "%s" (cadr err)) errors) + nil))) + (if errors + (display-warning 'helm + (with-temp-buffer + (insert (format-time-string "%Y-%m-%d %H:%M:%S\n" + (current-time))) + (insert (format + "Failed to %s %s/%s files from trash\n" + (car names) (length errors) (length mkd))) + (insert (mapconcat 'identity errors "\n") "\n ") + (buffer-string)) + :error + "*helm restore warnings*") + (message "%s %s files from trash done" + (capitalize (cadr names)) (length mkd)))) + (message "Restoring files from trash aborted"))))) (defun helm-ff-trash-rm (_candidate) "Delete marked-files from a Trash directory. @@ -3013,6 +3269,21 @@ should have its '*.trashinfo' correspondent file in Trash/info directory." (helm-ff-trash-action 'helm-ff-trash-rm-1 '("delete" "deleting"))) +(defun helm-ff-trash-rm-1 (file) + (let ((info-file (concat (helm-reduce-file-name file 2) + "info/" (helm-basename file "trashinfo") + ".trashinfo"))) + (cl-assert (file-exists-p file) + nil (format "No such file or directory `%s'" + file)) + (cl-assert (file-exists-p info-file) + nil (format "No such file or directory `%s'" + info-file)) + (if (file-directory-p file) + (delete-directory file t) + (delete-file file)) + (delete-file info-file))) + (defun helm-restore-file-from-trash (_candidate) "Restore marked-files from a Trash directory. @@ -3022,52 +3293,56 @@ should have its '*.trashinfo' correspondent file in Trash/info directory." (let* ((default-directory (file-name-as-directory helm-ff-default-directory)) - (trashed-files (with-temp-buffer - (process-file "trash-list" nil t nil) - (split-string (buffer-string) "\n")))) + (trashed-files (helm-ff-trash-list))) (helm-ff-trash-action 'helm-restore-file-from-trash-1 '("restore" "restoring") trashed-files))) -(defun helm-ff-trash-rm-1 (file) - (let ((info-file (concat (helm-reduce-file-name file 2) - "info/" (helm-basename file) - ".trashinfo"))) - (cl-assert (file-exists-p file) - nil (format "No such file or directory `%s'" - file)) - (cl-assert (file-exists-p info-file) - nil (format "No such file or directory `%s'" - info-file)) - (delete-file file) - (delete-file info-file))) - (defun helm-restore-file-from-trash-1 (file trashed-files) "Restore FILE from a trash directory. -Arg TRASHED-FILES is the list of files in the trash directory obtained -with 'trash-list' command." - (let ((info-file (concat (helm-reduce-file-name file 2) - "info/" - (helm-basename file) - ".trashinfo")) - (dest-file (helm-ff--get-dest-file-from-trash - trashed-files file))) +Arg TRASHED-FILES is an alist of (fname_in_trash . dest) obtained with +`helm-ff-trash-list'." + ;; Emacs trash duplicate files with a unique name + .trashinfo in + ;; the filename which is wrong, only files in info directory should + ;; end with .trashinfo, so fix the filename before looking for dest name. + (let* ((fname (replace-regexp-in-string "\\.trashinfo\\'" "" file)) + (info-file (concat (helm-reduce-file-name fname 2) + "info/" + (helm-basename fname) + ".trashinfo")) + (dest-file (helm-ff--get-dest-file-from-trash + trashed-files fname))) (cl-assert (not (file-exists-p dest-file)) nil (format "File `%s' already exists" dest-file)) (cl-assert dest-file nil "No such file in trash") (rename-file file dest-file) (delete-file info-file))) +(defun helm-ff-trash-file-p (file) + "Return `t' when file is a trashed file." + (and (file-exists-p file) + (string-match "Trash/files/?\\'" (helm-basedir file)) + (not (member (helm-basename file) '("." ".."))))) + (defun helm-ff--get-dest-file-from-trash (trashed-files file) - (cl-loop for f in trashed-files - when (string-match - (concat (regexp-quote (helm-basename file)) - "\\'") - f) - return - (replace-regexp-in-string - "\\`\\([0-9]\\{2,4\\}[-:][0-9]\\{2\\}[:-][0-9]\\{2\\} \\)\\{2\\}" - "" f))) + (assoc-default (helm-basename file) trashed-files)) + +(defun helm-ff-trash-list () + "Return an alist of trashed files basename and dest name." + (cl-loop for f in (directory-files + (expand-file-name + ;; helm-ff-default-directory is actually the + ;; trash directory. + "info" (helm-basedir (directory-file-name helm-ff-default-directory))) + t directory-files-no-dot-files-regexp) + collect (cons (helm-basename (replace-regexp-in-string "\\.trashinfo\\'" "" f)) + (with-temp-buffer + (save-excursion + (insert-file-contents f)) + (when (re-search-forward "^path=" nil t) + (helm-url-unhex-string + (buffer-substring-no-properties + (point) (point-at-eol)))))))) (defun helm-ff-goto-linum (candidate) "Find file CANDIDATE and maybe jump to line number found in fname at point. @@ -3111,33 +3386,39 @@ e.g \"foo:12\"." "application/octet-stream"))))))) (defvar image-dired-display-image-buffer) -(defun helm-ff-rotate-current-image-1 (file &optional num-arg) - "Rotate current image at NUM-ARG degrees. -This is a destructive operation on FILE made by external tool mogrify." - (setq file (file-truename file)) ; For symlinked images. +(defun helm-ff-rotate-current-image-1 (file num-arg) + "Rotate current image at NUM-ARG degrees." + (setq file (file-truename file)) ; For symlinked images. ;; When FILE is not an image-file, do nothing. - (when (string-match (image-file-name-regexp) file) - (if (executable-find "mogrify") - (progn - (shell-command (format "mogrify -rotate %s %s" - (or num-arg 90) - (shell-quote-argument file))) + (when (and (file-exists-p file) + (string-match (image-file-name-regexp) file)) + (setq num-arg (if (string= helm-ff-rotate-image-program "exiftran") + (cl-case num-arg + (90 "-9") ; 90 clockwise + (270 "-2")) ; 270 clockwise == -90 + (number-to-string num-arg))) + (if (executable-find helm-ff-rotate-image-program) + (let ((default-directory (file-name-directory file)) + (basename (helm-basename file))) + (apply #'process-file helm-ff-rotate-image-program nil nil nil + (append helm-ff-rotate-image-switch + (list num-arg basename))) (when (buffer-live-p image-dired-display-image-buffer) (kill-buffer image-dired-display-image-buffer)) - (image-dired-display-image file) + (image-dired-display-image basename) (message nil) (display-buffer (get-buffer image-dired-display-image-buffer))) - (error "mogrify not found")))) + (error "%s not found" helm-ff-rotate-image-program)))) (defun helm-ff-rotate-image-left (candidate) "Rotate image file CANDIDATE left. This affect directly file CANDIDATE." - (helm-ff-rotate-current-image-1 candidate -90)) + (helm-ff-rotate-current-image-1 candidate 270)) (defun helm-ff-rotate-image-right (candidate) "Rotate image file CANDIDATE right. This affect directly file CANDIDATE." - (helm-ff-rotate-current-image-1 candidate)) + (helm-ff-rotate-current-image-1 candidate 90)) (defun helm-ff-rotate-left-persistent () "Rotate image left without quitting helm." @@ -3383,7 +3664,7 @@ prefix arg, one prefix arg or two prefix arg." (let* ((mkds (helm-marked-candidates :with-wildcard t)) (candidate (car mkds)) (end (point)) - (tap (helm-ff--fname-at-point)) + (tap (helm-ffap-guesser)) (guess (and (stringp tap) (substring-no-properties tap))) (beg (if guess (- (point) (length guess)) (point))) @@ -3537,31 +3818,38 @@ is helm-source-find-files." helm-ff-move-to-first-real-candidate helm-ff-clean-initial-input))) -(defun helm-find-files-toggle-to-bookmark () - "Toggle helm-bookmark for `helm-find-files' and `helm-find-files.'" +(defun helm-ff-bookmark () + (helm :sources 'helm-source-bookmark-helm-find-files + :buffer "*helm ff bookmarks*")) + +(defun helm-find-files-switch-to-bookmark () + "Switch to helm-bookmark for `helm-find-files' from `helm-find-files.'" (interactive) (require 'helm-bookmark) (with-helm-alive-p - (with-helm-buffer - (if (setq helm-find-files--toggle-bookmark - (not helm-find-files--toggle-bookmark)) - (progn - (helm-set-pattern "" t) - (helm-set-sources '(helm-source-bookmark-helm-find-files))) - ;; Switch back to helm-find-files. - (helm-set-pattern "./" t) ; Back to initial directory of hff session. - (helm-set-sources '(helm-source-find-files)) - (helm--maybe-update-keymap))))) -(put 'helm-find-files-toggle-to-bookmark 'helm-only t) + (helm-run-after-exit 'helm-ff-bookmark))) +(put 'helm-find-files-switch-to-bookmark 'helm-only t) (defun helm-find-files-initial-input (&optional input) "Return INPUT if present, otherwise try to guess it." - (unless (eq major-mode 'image-mode) - (or (and input (or (and (file-remote-p input) input) - (expand-file-name input))) - (helm-find-files-input - (helm-ffap-guesser) - (thing-at-point 'filename))))) + (let ((guesser (helm-acase (helm-ffap-guesser) + ("" nil) + (t it)))) + (unless (eq major-mode 'image-mode) + (or (and input (or (and (file-remote-p input) input) + (expand-file-name input))) + (helm-find-files-input + (if (and helm-ff-allow-non-existing-file-at-point + guesser + (not (string-match ffap-url-regexp guesser))) + ;; Keep the ability of jumping to numbered lines even + ;; when allowing non existing filenames at point. + (helm-aand guesser + (thing-at-point 'filename) + (replace-regexp-in-string + ":[0-9]+\\'" "" it)) + guesser) + (thing-at-point 'filename)))))) (defun helm-ffap-guesser () "Same as `ffap-guesser' but without gopher and machine support." @@ -3590,8 +3878,9 @@ is helm-source-find-files." (let* ((beg (and (use-region-p) (region-beginning))) (end (and (use-region-p) (region-end))) (str (and beg end (buffer-substring-no-properties beg end))) - (ffap (or (and helm-ff-guess-ffap-urls ffap-url-regexp - (ffap-fixup-url (ffap-url-at-point))) + (ffap (or (helm-aand helm-ff-guess-ffap-urls ffap-url-regexp + (ffap-fixup-url (ffap-url-at-point)) + (and (string-match ffap-url-regexp it) it)) (ffap-file-at-point)))) ;; Workaround emacs bugs: ;; When the region is active and a file is detected @@ -3616,7 +3905,9 @@ is helm-source-find-files." (file-p (and file-at-pt (not (string= file-at-pt "")) (not remp) - (file-exists-p file-at-pt) + (or (file-exists-p file-at-pt) + helm-ff-allow-non-existing-file-at-point) + (not urlp) thing-at-pt (not (string= thing-at-pt "")) (file-exists-p @@ -3632,7 +3923,8 @@ is helm-source-find-files." (urlp (helm-html-decode-entities-string file-at-pt)) ; possibly an url or email. ((and file-at-pt (not remp) - (file-exists-p file-at-pt)) + (or helm-ff-allow-non-existing-file-at-point + (file-exists-p file-at-pt))) (expand-file-name file-at-pt))))) (defun helm-ff-find-url-at-point () @@ -3659,10 +3951,10 @@ Find inside `require' and `declare-function' sexp." (buffer-substring-no-properties (1+ beg-sexp) (1- end-sexp))))) (ignore-errors - (cond ((and sexp (string-match "require \'.+[^)]" sexp)) + (cond ((and sexp (string-match "require ['].+[^)]" sexp)) (find-library-name (replace-regexp-in-string - "'\\|\)\\|\(" "" + "'\\|)\\|(" "" ;; If require use third arg, ignore it, ;; always use library path found in `load-path'. (cl-second (split-string (match-string 0 sexp)))))) @@ -3848,9 +4140,10 @@ inversed." helm-visible-mark-overlays nil) (helm-force-update (let ((presel (helm-get-selection))) - (concat "^" (regexp-quote (if (and helm-ff-transformer-show-only-basename - (not (helm-ff-dot-file-p presel))) - (helm-basename presel) presel))))))))) + (when presel + (concat "^" (regexp-quote (if (and helm-ff-transformer-show-only-basename + (not (helm-ff-dot-file-p presel))) + (helm-basename presel) presel)))))))))) (defun helm-delete-file (file &optional error-if-dot-file-p synchro trash) "Delete FILE after querying the user. @@ -4090,6 +4383,14 @@ Called with two prefix arg open files in background without 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) + (defun helm-ff--mkdir (dir &optional helm-ff) (when (or (not confirm-nonexistent-file-or-buffer) (y-or-n-p (format "Create directory `%s'? " @@ -4174,15 +4475,32 @@ This function is checking `helm-mounted-network-directories' list." "[Internal] This source is build to be used with `helm-find-files'. Don't use it in your own code unless you know what you are doing.") +(defvar helm--file-name-history-hide-deleted nil) + +(defun helm-file-name-history-show-or-hide-deleted () + (interactive) + (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) + +(defvar helm-file-name-history-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c d") 'helm-file-name-history-show-or-hide-deleted) + map)) + (defun helm-file-name-history-transformer (candidates _source) - (cl-loop for c in candidates collect - (cond ((or (file-remote-p c) - (and (fboundp 'tramp-archive-file-name-p) - (tramp-archive-file-name-p c))) - (cons (propertize c 'face 'helm-history-remote) c)) - ((file-exists-p c) - (cons (propertize c 'face 'helm-ff-file) c)) - (t (cons (propertize c 'face 'helm-history-deleted) c))))) + (cl-loop for c in candidates + when (cond ((or (file-remote-p c) + (and (fboundp 'tramp-archive-file-name-p) + (tramp-archive-file-name-p c))) + (cons (propertize c 'face 'helm-history-remote) c)) + ((file-exists-p c) + (cons (propertize c 'face 'helm-ff-file) c)) + (t (unless helm--file-name-history-hide-deleted + (cons (propertize c 'face 'helm-history-deleted) c)))) + collect it)) (defun helm-ff-file-name-history () "Switch to `file-name-history' without quitting `helm-find-files'." @@ -4200,6 +4518,7 @@ Don't use it in your own code unless you know what you are doing.") (if helm-ff-file-name-history-use-recentf recentf-list file-name-history)) + :help-message 'helm-file-name-history-help-message :fuzzy-match t :persistent-action 'ignore :migemo t @@ -4211,7 +4530,8 @@ Don't use it in your own code unless you know what you are doing.") (with-helm-after-update-hook (helm-exit-minibuffer))) "Find file in helm" (lambda (candidate) (helm-set-pattern - (expand-file-name candidate))))))) + (expand-file-name candidate)))) + :keymap helm-file-name-history-map))) (with-helm-alive-p (helm :sources 'helm-source--ff-file-name-history :buffer "*helm-file-name-history*" @@ -4227,6 +4547,12 @@ Don't use it in your own code unless you know what you are doing.") (defvar helm--browse-project-cache (make-hash-table :test 'equal)) (defvar helm-buffers-in-project-p) +(defvar helm-browse-project-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-generic-files-map) + (define-key map (kbd "M-g a") 'helm-browse-project-run-ag) + map)) + (defun helm-browse-project-get-buffers (root-directory) (cl-loop for b in (helm-buffer-list) ;; FIXME: Why default-directory is root-directory @@ -4253,58 +4579,104 @@ Don't use it in your own code unless you know what you are doing.") directory :directories nil :path 'full :skip-subdirs t)) +(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")))) + (with-temp-buffer + (call-process-shell-command + (format cmd directory) + nil t nil) + (mapcar (lambda (f) (expand-file-name f directory)) + (split-string (buffer-string) "\n"))))) + (defun helm-browse-project-ag-find-files (directory) "A suitable function for `helm-browse-project-default-find-files-fn'. +Use AG as backend." + (helm-browse-project-find-files-1 directory 'ag)) -Needs AG as backend." - (with-temp-buffer - (call-process-shell-command - (format "ag --hidden -g '.*' %s" directory) - nil t nil) - (mapcar (lambda (f) (expand-file-name f directory)) - (split-string (buffer-string) "\n")))) +(defun helm-browse-project-rg-find-files (directory) + "A suitable function for `helm-browse-project-default-find-files-fn'. +Use RG as backend." + (helm-browse-project-find-files-1 directory 'rg)) + +(defun helm-browse-project-ag (_candidate) + "helm-grep AG action for helm-browse-project." + (let ((dir (with-helm-buffer (helm-attr 'root-dir)))) + (helm-grep-ag dir helm-current-prefix-arg))) + +(defun helm-browse-project-run-ag () + "Runs helm-grep AG from helm-browse-project." + (interactive) + (with-helm-alive-p + (helm-exit-and-execute-action 'helm-browse-project-ag))) +(put 'helm-browse-project-run-ag 'helm-only t) + +(defclass helm-browse-project-override-inheritor (helm-type-file) ()) + +(defclass helm-browse-project-source (helm-source-in-buffer + helm-browse-project-override-inheritor) + ((root-dir :initarg :root-dir + :initform nil + :custom 'file) + (match-part :initform + (lambda (c) + (if (with-helm-buffer + helm-ff-transformer-show-only-basename) + (helm-basename c) c))) + (filter-one-by-one :initform + (lambda (c) + (if (with-helm-buffer + helm-ff-transformer-show-only-basename) + (cons (propertize (helm-basename c) + 'face 'helm-ff-file) + c) + (propertize c 'face 'helm-ff-file))))) + "Class to define a source in helm-browse-project handling non VC +handled directories.") + +(defmethod helm--setup-source :after ((source helm-browse-project-override-inheritor)) + (let ((actions (slot-value source 'action))) + (setf (slot-value source 'action) + (helm-append-at-nth + (symbol-value actions) + '(("Grep project with AG `M-g a, C-u select type'" . helm-browse-project-ag)) + 7)) + (setf (slot-value source 'keymap) helm-browse-project-map))) (defun helm-browse-project-find-files (directory &optional refresh) + "Browse non VC handled directory DIRECTORY." (when refresh (remhash directory helm--browse-project-cache)) (unless (gethash directory helm--browse-project-cache) (puthash directory (funcall helm-browse-project-default-find-files-fn directory) helm--browse-project-cache)) (helm :sources `(,(helm-browse-project-build-buffers-source directory) - ,(helm-build-in-buffer-source "Browse project" - :data (gethash directory helm--browse-project-cache) - :header-name (lambda (name) - (format - "%s (%s)" - name (abbreviate-file-name directory))) - :match-part (lambda (c) - (if (with-helm-buffer - helm-ff-transformer-show-only-basename) - (helm-basename c) c)) - :filter-one-by-one - (lambda (c) - (if (with-helm-buffer - helm-ff-transformer-show-only-basename) - (cons (propertize (helm-basename c) - 'face 'helm-ff-file) - c) - (propertize c 'face 'helm-ff-file))) - :keymap helm-generic-files-map - :action 'helm-type-file-actions)) + ,(helm-make-source "Browse project" + 'helm-browse-project-source + :root-dir directory + :data (gethash directory helm--browse-project-cache) + :header-name + (lambda (name) + (format + "%s (%s)" + name (abbreviate-file-name directory))))) :ff-transformer-show-only-basename nil :buffer "*helm browse project*")) (defvar helm-browse-project-history nil) ;;;###autoload -(defun helm-projects-history () - (interactive) +(defun helm-projects-history (arg) + (interactive "P") (helm :sources (helm-build-sync-source "Project history" :candidates helm-browse-project-history :action (lambda (candidate) (with-helm-default-directory candidate - (helm-browse-project nil)))) + (helm-browse-project + (or arg helm-current-prefix-arg))))) :buffer "*helm browse project history*")) ;;;###autoload @@ -4325,6 +4697,7 @@ Needed dependencies for VCS: and ." (interactive "P") + (require 'helm-x-files) (let ((helm-type-buffer-actions (remove (assoc "Browse project from buffer" helm-type-buffer-actions) @@ -4411,7 +4784,8 @@ This is the starting point for nearly all actions you can do on files." ((and (eq major-mode 'org-agenda-mode) org-directory (not smart-input)) - (expand-file-name org-directory)) + (file-name-as-directory + (expand-file-name org-directory))) ((and (eq major-mode 'dired-mode) smart-input) (file-name-directory smart-input)) ((and (not (string= smart-input "")) diff --git a/elpa/helm-20190122.549/helm-find.el b/elpa/helm-20191031.725/helm-find.el similarity index 88% rename from elpa/helm-20190122.549/helm-find.el rename to elpa/helm-20191031.725/helm-find.el index 80b3ecc6..9c1ab0ca 100644 --- a/elpa/helm-20190122.549/helm-find.el +++ b/elpa/helm-20191031.725/helm-find.el @@ -1,6 +1,6 @@ ;;; helm-find.el --- helm interface for find command. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -31,6 +31,11 @@ I.e use the -path/ipath arguments of find instead of -name/iname." :group 'helm-files :type 'boolean) +(defcustom helm-find-noerrors nil + "Prevent showing error messages in helm buffer when non nil." + :group 'helm-files + :type 'boolean) + (defvar helm-find-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-generic-files-map) @@ -107,7 +112,8 @@ Additional find options can be specified after a \"*\" separator." (let* (process-connection-type non-essential - (cmd (helm-find--build-cmd-line)) + (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) (prog1 proc @@ -117,19 +123,9 @@ separator." (helm-process-deferred-sentinel-hook process event (helm-default-directory)) (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 "[Find process finished - (%s results)]" - (max (1- (count-lines - (point-min) (point-max))) - 0)) - 'face 'helm-locate-finish)))) - (force-mode-line-update)) - (helm-log "Error: Find %s" - (replace-regexp-in-string "\n" "" event)))))))) + (helm-locate-update-mode-line "Find") + (helm-log "Error: Find %s" + (replace-regexp-in-string "\n" "" event)))))))) (defun helm-find-1 (dir) (let ((default-directory (file-name-as-directory dir))) diff --git a/elpa/helm-20190122.549/helm-font.el b/elpa/helm-20191031.725/helm-font.el similarity index 99% rename from elpa/helm-20190122.549/helm-font.el rename to elpa/helm-20191031.725/helm-font.el index c4e25d9d..d0a37a4a 100644 --- a/elpa/helm-20190122.549/helm-font.el +++ b/elpa/helm-20191031.725/helm-font.el @@ -1,6 +1,6 @@ ;;; helm-font --- Font and ucs selection for Helm -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-for-files.el b/elpa/helm-20191031.725/helm-for-files.el similarity index 99% rename from elpa/helm-20190122.549/helm-for-files.el rename to elpa/helm-20191031.725/helm-for-files.el index c259704d..e875c56e 100644 --- a/elpa/helm-20190122.549/helm-for-files.el +++ b/elpa/helm-20191031.725/helm-for-files.el @@ -1,6 +1,6 @@ ;;; helm-for-files.el --- helm-for-files and related. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-grep.el b/elpa/helm-20191031.725/helm-grep.el similarity index 97% rename from elpa/helm-20190122.549/helm-grep.el rename to elpa/helm-20191031.725/helm-grep.el index 57217873..43b491e3 100644 --- a/elpa/helm-20190122.549/helm-grep.el +++ b/elpa/helm-20191031.725/helm-grep.el @@ -1,6 +1,6 @@ ;;; helm-grep.el --- Helm Incremental Grep. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -134,11 +134,6 @@ when used matchs will be highlighted according to GREP_COLORS env var." :group 'helm-grep :type 'string) -(defcustom helm-grep-use-ioccur-style-keys t - "Use Arrow keys to jump to occurences." - :group 'helm-grep - :type 'boolean) - (defcustom helm-pdfgrep-default-read-command nil "Default command to read pdf files from pdfgrep. Where '%f' format spec is filename and '%p' is page number. @@ -226,7 +221,7 @@ 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 'string) + :type '(repeat string)) (defcustom helm-grep-ag-pipe-cmd-switches nil "A list of additional parameters to pass to grep-ag pipe command. @@ -235,14 +230,14 @@ Use parameters compatibles with the backend you are using You probably don't need to use this unless you know what you are doing." :group 'helm-grep - :type 'string) + :type '(repeat string)) (defcustom helm-grep-input-idle-delay 0.6 "Same as `helm-input-idle-delay' but for grep commands. It have a higher value than `helm-input-idle-delay' to avoid flickering when updating." :group 'helm-grep - :type 'integer) + :type 'float) ;;; Faces ;; @@ -294,12 +289,24 @@ Have no effect when grep backend use \"--color=\"." (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) - (when helm-grep-use-ioccur-style-keys - (define-key map (kbd "") 'helm-execute-persistent-action) - (define-key map (kbd "") 'helm-grep-run-default-action)) - (delq nil map)) + 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) @@ -578,7 +585,7 @@ It is intended to use as a let-bound variable, DON'T set this globaly.") (helm-get-candidate-number)) 'face 'helm-grep-finish)))) (force-mode-line-update) - (when helm-allow-mouse + (when (and helm-allow-mouse helm-selection-point) (helm--bind-mouse-for-selection helm-selection-point)))) ;; Catch error output in log. (t (helm-log @@ -671,7 +678,8 @@ With a prefix arg record CANDIDATE in `mark-ring'." "Go to next or precedent candidate file in helm grep/etags buffers. If N is positive go forward otherwise go backward." (let* ((allow-mode (or (eq major-mode 'helm-grep-mode) - (eq major-mode 'helm-moccur-mode))) + (eq major-mode 'helm-moccur-mode) + (eq major-mode 'helm-occur-mode))) (sel (if allow-mode (buffer-substring (point-at-bol) (point-at-eol)) (helm-get-selection nil t))) @@ -861,6 +869,8 @@ Special commands: ;; needed for wgrep. 'helm-realvalue line) "\n")))) + (when (fboundp 'wgrep-cleanup-overlays) + (wgrep-cleanup-overlays (point-min) (point-max))) (message "Reverting buffer done")))) (defun helm-gm-next-file () @@ -878,23 +888,25 @@ Special commands: (helm-match-line-cleanup-pulse)) (defun helm-grep-mode-jump-other-window-1 (arg) - (let ((candidate (buffer-substring (point-at-bol) (point-at-eol)))) - (condition-case nil - (progn - (save-selected-window - (helm-grep-action candidate 'other-window) - (helm-match-line-cleanup-pulse) - (recenter)) + (condition-case nil + (progn + (when (or (eq last-command 'helm-grep-mode-jump-other-window-forward) + (eq last-command 'helm-grep-mode-jump-other-window-backward)) (forward-line arg)) - (error nil)))) + (save-selected-window + (helm-grep-action (buffer-substring (point-at-bol) (point-at-eol)) + 'other-window) + (helm-match-line-cleanup-pulse) + (recenter))) + (error nil))) -(defun helm-grep-mode-jump-other-window-forward () - (interactive) - (helm-grep-mode-jump-other-window-1 1)) +(defun helm-grep-mode-jump-other-window-forward (arg) + (interactive "p") + (helm-grep-mode-jump-other-window-1 arg)) -(defun helm-grep-mode-jump-other-window-backward () - (interactive) - (helm-grep-mode-jump-other-window-1 -1)) +(defun helm-grep-mode-jump-other-window-backward (arg) + (interactive "p") + (helm-grep-mode-jump-other-window-1 (- arg))) (defun helm-grep-mode-jump-other-window () (interactive) @@ -1431,7 +1443,7 @@ Ripgrep (rg) types are also supported if this backend is used." (let* ((com (helm-grep--ag-command)) (ripgrep (string= com "rg")) (regex (if ripgrep "^\\(.*\\):" "^ *\\(--[a-z]*\\)")) - (prefix (if ripgrep "-t" ""))) + (prefix (if ripgrep "-t " ""))) (when (equal (call-process com nil t nil (if ripgrep diff --git a/elpa/helm-20190122.549/helm-help.el b/elpa/helm-20191031.725/helm-help.el similarity index 90% rename from elpa/helm-20190122.549/helm-help.el rename to elpa/helm-20191031.725/helm-help.el index 39ae6972..f86ae90e 100644 --- a/elpa/helm-20190122.549/helm-help.el +++ b/elpa/helm-20191031.725/helm-help.el @@ -1,6 +1,6 @@ ;;; helm-help.el --- Help messages for Helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -18,9 +18,6 @@ ;;; Code: (require 'helm) -(defvar helm-org-headings--nofilename) -(declare-function helm-source-org-headings-for-files "helm-org.el") - (defgroup helm-help nil "Embedded help for `helm'." @@ -61,8 +58,9 @@ With a prefix arg refresh the documentation. Find here the documentation of all documented sources." (interactive) - (require 'helm-org) - (with-current-buffer (get-buffer-create helm-documentation-buffer-name) + (let ((buf (get-buffer-create helm-documentation-buffer-name))) + (switch-to-buffer buf) + (set-buffer buf) (let ((inhibit-read-only t)) (erase-buffer) (cl-loop for elm in helm-help--string-list @@ -70,12 +68,8 @@ Find here the documentation of all documented sources." do (insert (substitute-command-keys str) "\n\n")) (org-mode)) (setq buffer-read-only t) - (view-mode)) - (let ((helm-org-headings--nofilename t)) - (helm :sources (helm-source-org-headings-for-files - (list (get-buffer helm-documentation-buffer-name))) - :candidate-number-limit 99999 - :buffer "*helm doc*"))) + (view-mode))) + ;;; Local help messages. @@ -182,6 +176,15 @@ and press \\\\[helm-buffer-switch-other-window], when called wi the buffer will be displayed vertically in other window. If you mark more than one buffer, the marked buffers will be displayed in different windows. +*** Saving buffers + +If buffer is associated to a file and is modified, it is by default colorized in orange, +see [[Meaning of colors and prefixes for buffers][Meaning of colors and prefixes for buffers]]. +You can save these buffers with \\\\[helm-buffer-save-persistent]. +If you want to save all these buffers, you can mark them with \\[helm-buffers-mark-similar-buffers] +and save them with \\[helm-buffer-save-persistent], you can also do this in one step with +\\[helm-buffer-run-save-some-buffers], note that you will not be asked for confirmation. + *** Meaning of colors and prefixes for buffers Remote buffers are prefixed with '@'. @@ -205,6 +208,7 @@ Yellow => Tramp archive buffer. \\[helm-buffer-diff-persistent]\t\tToggle Diff-buffer with saved file without leaving Helm. \\[helm-buffer-revert-persistent]\t\tRevert buffer without leaving Helm. \\[helm-buffer-save-persistent]\t\tSave buffer without leaving Helm. +\\[helm-buffer-run-save-some-buffers]\t\tSave all unsaved buffers. \\[helm-buffer-run-kill-buffers]\t\tDelete marked buffers and leave Helm. \\[helm-buffer-run-kill-persistent]\t\tDelete buffer without leaving Helm. \\[helm-buffer-run-rename-buffer]\t\tRename buffer. @@ -228,13 +232,38 @@ For a better experience you can enable auto completion by setting `helm-ff-auto-update-initial-value' to non-nil in your init file. It is not enabled by default to not confuse new users. +**** Navigate with arrow keys + +You can use and arrows to go down or up one level, to enable +this customize `helm-ff-lynx-style-map'. +This is disabled by default. +Note that using `setq' will NOT work. + **** Use `\\\\[helm-execute-persistent-action]' (persistent action) on a directory to go down one level On a symlinked directory a prefix argument expands to its true name. -**** Use `\\\\[helm-find-files-up-one-level]' on a directory to go up one level +**** Use `\\\\[helm-find-files-up-one-level]' or `DEL' on a directory to go up one level + +***** `DEL' behavior + +`DEL' by default is deleting char backward. + +But when `helm-ff-DEL-up-one-level-maybe' is non nil `DEL' behave +differently depending of helm-pattern contents, it go up one +level if pattern is a directory endings with \"/\" or disable HFF +auto update and delete char backward if pattern is a filename or +refer to a non existing path. Going up one level can be disabled +if necessary by deleting \"/\" at end of pattern using +\\\\[backward-char] and \\[helm-delete-minibuffer-contents]. + +Note that when deleting char backward, helm takes care of +disabling update letting you the time to edit your pattern for +e.g. renaming a file or creating a new file or directory. +When `helm-ff-auto-update-initial-value' is non nil you may want to +disable it temporarily, see [[Toggle auto-completion with `C-c DEL'][Toggle auto-completion with `C-c DEL']] for this. -**** Use `\\\\[helm-find-files-down-last-level]' to walk back the resulting tree of all the `\\\\[helm-execute-persistent-action]' you did +**** Use `\\\\[helm-find-files-down-last-level]' to walk back the resulting tree of all the `\\\\[helm-find-files-up-one-level]' or DEL you did The tree is reinitialized each time you browse a new tree with `\\\\[helm-execute-persistent-action]' or by entering some pattern in the prompt. @@ -265,12 +294,37 @@ you press `RET'. If you want the same behavior as in `helm-find-files', bind (define-key helm-read-file-map (kbd \"RET\") 'helm-ff-RET) +**** `TAB' behavior + +Normally `TAB' is bound to `helm-select-action' in helm-map which +display the action menu. + +You can change this behavior by setting in `helm-find-files-map' +a new command for `TAB': + + (define-key helm-find-files-map (kbd \"C-i\") 'helm-ff-TAB) + +It will then behave slighly differently +depending of `helm-selection': + +- candidate basename is \".\" => open the action menu. +- candidate is a directory => expand it (behave as \\\\[helm-execute-persistent-action]). +- candidate is a file => open action menu. + +Called with a prefix arg open menu unconditionally. + *** Find file at point Helm uses `ffap' partially or completely to find file at point depending on the value of `helm-ff-guess-ffap-filenames': if non-nil, support is complete \(annoying), if nil, support is partial. +Note that when the variable +`helm-ff-allow-non-existing-file-at-point' is non nil Helm will +insert the filename at point even if file with this name doesn't +exists. If non existing file at point ends with numbers prefixed +with \":\" the \":\" and numbers are stripped. + **** Find file at line number When text at point is in the form of @@ -687,7 +741,9 @@ On remote files grep is not well supported by TRAMP unless you suspend updates b entering the pattern and re-enable it once your pattern is ready. To toggle suspend-update, use `\\\\[helm-toggle-suspend-update]'. -*** Setting up aliases in Eshell allows you to set up powerful customized commands +*** Execute Eshell commands on files + +Setting up aliases in Eshell allows you to set up powerful customized commands. Adding Eshell aliases to your `eshell-aliases-file' or using the `alias' command from Eshell allows you to create personalized @@ -717,6 +773,13 @@ $ example foo bar baz Of course the alias command should support this. +If you add %s to the command line %s will be replaced with the candidate, this mean you can +add extra argument to your command e.g. command -extra-arg %s or command %s -extra-arg. +If you want to pass many files inside %s, don't forget to use a prefix arg. + +You can also use special placeholders in extra-args, +see the specific info page once you hit `\\\\[helm-ff-run-eshell-command-on-file]'. + *** Using TRAMP with `helm-find-files' to read remote directories `helm-find-files' works fine with TRAMP despite some limitations. @@ -866,16 +929,20 @@ will be moved to trash instead of beeing deleted. You can reverse at any time the behavior of `delete-by-moving-to-trash' by using a prefix arg with any of the delete files command. -On GNULinux distribution, when navigating to a Trash directory you +On GNULinux distributions, when navigating to a Trash directory you can restore any file in ..Trash/files directory with the 'Restore from trash' action you will find in action menu (needs the -trash-cli package installed). +trash-cli package installed for remote files, see [[Trashing remote files with tramp][Here]]). You can as well delete files from Trash directories with the 'delete files from trash' action. +If you want to know where a file will be restored, hit `M-i', you will find a trash info. Tip: Navigate to your Trash/files directories with `helm-find-files' and set a bookmark 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 @@ -896,6 +963,22 @@ NOTE: When deleting your files with sudo method, your trashed files will not be listed with trash-list until you log in as root. +*** Checksum file + +Checksum is calculated with the md5sum, sha1sum, sha224sum, +sha256sum, sha384sum and sha512sum when available, otherwise the +Emacs function `secure-hash' is used but it is slow and may crash +Emacs and even the whole system as it eats all memory. So if +your system doesn't have the md5 and sha command line tools be +careful when checking sum of larges files e.g. isos. + +*** Ignored or boring files + +Helm-find-files can ignore files matching +`helm-boring-file-regexp-list' or files that are git ignored, you +can set this with `helm-ff-skip-boring-files' or +`helm-ff-skip-git-ignored-files'. + ** Commands \\ \\[helm-ff-run-locate]\t\tRun `locate' (`\\[universal-argument]' to specify locate database, `M-n' to insert basename of candidate). @@ -939,7 +1022,7 @@ with trash-list until you log in as root. \\[helm-mark-all]\t\tMark all visible candidates. \\[helm-ff-run-toggle-auto-update]\t\tToggle auto-expansion of directories. \\[helm-unmark-all]\t\tUnmark all candidates, visible and invisible ones. -\\[helm-ff-run-gnus-attach-files]\t\tGnus' attach files to message buffer. +\\[helm-ff-run-mail-attach-files]\t\tAttach files to message buffer. \\[helm-ff-run-print-file]\t\tPrint file, (`\\[universal-argument]' to refresh printer list). \\[helm-enlarge-window]\t\tEnlarge Helm window. \\[helm-narrow-window]\t\tNarrow Helm window. @@ -948,7 +1031,26 @@ with trash-list until you log in as root. \\[helm-ff-run-find-alternate-file]\t\tFind alternate file. \\[helm-ff-run-insert-org-link]\t\tInsert org link. \\[helm-ff-bookmark-set]\t\tSet bookmark to current directory. -\\[helm-find-files-toggle-to-bookmark]\t\tJump to bookmark list.") +\\[helm-find-files-switch-to-bookmark]\t\tJump to bookmark list. +\\[helm-ff-sort-alpha]\t\tSort alphabetically +\\[helm-ff-sort-by-newest]\t\tSort by newest +\\[helm-ff-sort-by-size]\t\tSort by size") + +;;; Help for file-name-history +;; +;; +(defvar helm-file-name-history-help-message + "* Helm file name history + +** Tips +You can open directly the selected file and exit helm or preselect the file in helm-find-files, +see actions in action menu. + +You can toggle the view of deleted files, see commands below. + +** Commands +\\ +\\[helm-file-name-history-show-or-hide-deleted]\t\tToggle deleted files view.") ;;; Help for `helm-read-file-name' ;; @@ -1109,7 +1211,6 @@ than 1 megabyte: \\[helm-ff-run-switch-other-window]\t\tSwitch to other window. \\[helm-ff-properties-persistent]\t\tShow file properties. \\[helm-ff-run-etags]\t\tRun etags (`\\[universal-argument]' to use tap, `\\[universal-argument] \\[universal-argument]' to reload the database). -\\[helm-yank-text-at-point]\t\tYank text at point. \\[helm-ff-run-open-file-externally]\t\tOpen file with external program (`\\[universal-argument]' to choose). \\[helm-ff-run-open-file-with-default-tool]\t\tOpen file externally with default tool. \\[helm-ff-run-insert-org-link]\t\tInsert org link.") @@ -1301,6 +1402,35 @@ But you can also pass an argument or more after \"candidate_file\" like this: candidate_file [extra_args] +**** Use placeholders in extra arguments + +placeholder for file without extension: \\@ +placeholder for incremental number: \\# + +\"candidate_file\" will be added at \"%s\" and \\@ but without extension. + + + +\"candidate_file\" will be added at \"%s\" and \\# will be replaced by an incremental number. + + %s \\# + +Here examples: + +Say you want to use the =convert= command to convert all your .png files in a directory to .jpg. + +This will convert all your files to jpg keeping the same basename. + + convert %s \\@.jpg + +This will convert all your files to foo-001.jpg, foo-002.jpg etc... + + convert %s foo-\\#.jpg + +You can of course combine both placeholders if needed. + + convert %s \\@-\\#.jpg + *** Specify marked files as arguments Example: @@ -1366,6 +1496,7 @@ enable this you need to add `helm-source-occur' and `helm-source-moccur' to You can do this with `\\\\[helm-execute-persistent-action]' (persistent-action), to do it repeatedly you can use `\\\\[helm-follow-action-forward]' and `\\\\[helm-follow-action-backward]' or enable `helm-follow-mode' with `\\\\[helm-follow-mode]'. +Follow mode is enabled by default in helm-occur. *** Switch to buffer in other window @@ -1374,7 +1505,7 @@ in other window horizontally or vertically if a prefix arg is supplied. *** Save the results -Similarly to Helm-grep, you can save the results with `\\\\[helm-moccur-run-save-buffer]'. +Similarly to Helm-grep, you can save the results with `\\\\[helm-occur-run-save-buffer]'. Once in the saved buffer, you can edit it, see [[Edit a saved buffer][below]]. Of course if you don't save the results, you can resume the Helm session with @@ -1408,14 +1539,15 @@ this region with `mark-defun' the symbol that was at point before marking defun will be used when `helm-source-occur' is member of `helm-sources-using-default-as-input'. -** Commands -\\ -\\[helm-goto-next-file]\t\tNext buffer. -\\[helm-goto-precedent-file]\t\tPrevious buffer. -\\[helm-yank-text-at-point]\t\tYank text at point in minibuffer. -\\[helm-moccur-run-goto-line-ow]\t\tGo to line in other window. -\\[helm-moccur-run-goto-line-of]\t\tGo to line in new frame.") +*** Switch to next or previous source +See [[Moving in `helm-buffer'][Moving in `helm-buffer']]. + +** Commands +\\ +\\[helm-occur-run-goto-line-ow]\t\tGo to line in other window. +\\[helm-occur-run-goto-line-of]\t\tGo to line in new frame. +\\[helm-occur-run-save-buffer]\t\tSave results in new buffer.") ;;; Helm Top ;; ;; @@ -1578,14 +1710,14 @@ toggled; see the command list below. As opposed to `yank', numeric prefix arguments are ignored with `helm-show-kill-ring': there is no need for them since selection happens within -Helm. Moreover Helm has [[Shortcuts for executing Default Action on the nth -candidate][Shortcuts for executing Default Action on the nth candidate]]. +Helm. Moreover Helm has [[Shortcuts for executing the default action on the n-th candidate][Shortcuts for executing the default action on the n-th candidate]]. It is recommended to globally bind `M-y' to `helm-show-kill-ring'. Once in the Helm-kill-ring session you can navigate to next/previous line with `M-y' and `M-u' for convenience. Of course `\\[helm-next-line]' and `\\[helm-previous-line]' are still available. -It is possible to delete candidates from the kill ring. +It is possible to delete candidates from the kill ring with `\\\\[helm-kill-ring-delete]' +but also persistently with `\\\\[helm-kill-ring-run-persistent-delete]'. You can concatenate marked candidates and yank them in the current buffer, thus creating a new entry in the kill ring. Candidates are @@ -1610,56 +1742,6 @@ by using a prefix argument, i.e. `C-u RET', like the regular `yank' command does \\[helm-kill-ring-toggle-truncated]\t\tToggle truncated view of candidate. \\[helm-kill-ring-kill-selection]\t\tKill non-truncated of selection.") -;;; Org headings -;; -;; -(defvar helm-org-headings-help-message - "* Helm Org headings - -** Tips - -*** Refiling - -You can refile one or more headings at a time. - -To refile one heading, move the point to the entry you want to refile and run -\\[helm-org-in-buffer-headings]. Then select the heading you want to refile to -and press \\\\[helm-org-run-refile-heading-to] or select the refile action from the actions menu. - -To refile multiple headings, run \\[helm-org-in-buffer-headings] and mark the -headings you want to refile. Then select the heading you want to refile to -\(without marking it) and press \\\\[helm-org-run-refile-heading-to] or select the refile action from the -actions menu. - -*** Tags completion - -Tags completion use `completing-read-multiple', perhaps have a -look at its docstring. - -**** Single tag - -From an org heading hit C-c C-c which provide a -\"Tags\" prompt, then hit TAB and RET if you want to enter an -existing tag or write a new tag in prompt. At this point you end -up with an entry in your prompt, if you enter RET, the entry is -added as tag in your org header. - -**** Multiple tags - -If you want to add more tag to your org header, add a separator[1] after -your tag and write a new tag or hit TAB to find another existing -tag, and so on until you have all the tags you want -e.g \"foo,bar,baz\" then press RET to finally add the tags to your -org header. -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." - ) - ;;; Completing-read ;; (defun helm-comp-read-help-message () @@ -1700,7 +1782,8 @@ 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-toggle-suspend-update]:Tog.suspend \ +\\[helm-customize-group]:Conf") ;;;###autoload (defvar helm-read-file-name-mode-line-string "\ @@ -1711,7 +1794,8 @@ 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-toggle-suspend-update]:Tog.suspend \ +\\[helm-customize-group]:Conf" "String displayed in mode-line in `helm-source-find-files'.") ;;;###autoload @@ -1722,7 +1806,8 @@ f1/f2/f-n:NthAct \ \\[helm-select-action]:Act \ \\[helm-maybe-exit-minibuffer]/\ f1/f2/f-n:NthAct \ -\\[helm-toggle-suspend-update]:Tog.suspend") +\\[helm-toggle-suspend-update]:Tog.suspend \ +\\[helm-customize-group]:Conf") (provide 'helm-help) diff --git a/elpa/helm-20190122.549/helm-id-utils.el b/elpa/helm-20191031.725/helm-id-utils.el similarity index 98% rename from elpa/helm-20190122.549/helm-id-utils.el rename to elpa/helm-20191031.725/helm-id-utils.el index b3f564a8..8752fd55 100644 --- a/elpa/helm-20190122.549/helm-id-utils.el +++ b/elpa/helm-20191031.725/helm-id-utils.el @@ -1,6 +1,6 @@ ;;; helm-id-utils.el --- Helm interface for id-utils. -*- lexical-binding: t -*- -;; Copyright (C) 2015 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2015 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-imenu.el b/elpa/helm-20191031.725/helm-imenu.el similarity index 92% rename from elpa/helm-20190122.549/helm-imenu.el rename to elpa/helm-20191031.725/helm-imenu.el index 4493e366..2ff19723 100644 --- a/elpa/helm-20190122.549/helm-imenu.el +++ b/elpa/helm-20191031.725/helm-imenu.el @@ -1,6 +1,6 @@ ;;; helm-imenu.el --- Helm interface for Imenu -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -40,11 +40,6 @@ :group 'helm-imenu :type 'function) -(defcustom helm-imenu-lynx-style-map t - "Use Arrow keys to jump to occurences." - :group 'helm-imenu - :type 'boolean) - (defcustom helm-imenu-all-buffer-assoc nil "Major mode association alist for `helm-imenu-in-all-buffers'. Allow `helm-imenu-in-all-buffers' searching in these associated buffers @@ -92,28 +87,37 @@ Each car is a regexp match pattern of the imenu type string." (set-keymap-parent map helm-map) (define-key map (kbd "M-") 'helm-imenu-next-section) (define-key map (kbd "M-") 'helm-imenu-previous-section) - (when helm-imenu-lynx-style-map - (define-key map (kbd "") 'helm-maybe-exit-minibuffer) - (define-key map (kbd "") 'helm-execute-persistent-action) - (define-key map (kbd "M-") 'helm-previous-source) - (define-key map (kbd "M-") 'helm-next-source)) - (delq nil map))) + map)) + +(defcustom helm-imenu-lynx-style-map nil + "Use Arrow keys to jump to occurences." + :group 'helm-imenu + :type 'boolean + :set (lambda (var val) + (set var val) + (if val + (progn + (define-key helm-imenu-map (kbd "") 'helm-execute-persistent-action) + (define-key helm-imenu-map (kbd "") 'helm-maybe-exit-minibuffer)) + (define-key helm-imenu-map (kbd "") nil) + (define-key helm-imenu-map (kbd "") nil)))) (defun helm-imenu-next-or-previous-section (n) - (with-helm-buffer + (with-helm-window (let* ((fn (lambda () - (car (split-string (helm-get-selection nil t) - helm-imenu-delimiter)))) + (car (split-string + (buffer-substring + (point-at-bol) (point-at-eol)) + helm-imenu-delimiter)))) (curtype (funcall fn)) - (move-fn (if (> n 0) #'helm-next-line #'helm-previous-line)) (stop-fn (if (> n 0) #'helm-end-of-source-p - #'helm-beginning-of-source-p))) - (catch 'break - (while (not (funcall stop-fn)) - (funcall move-fn) - (unless (string= curtype (funcall fn)) - (throw 'break nil))))))) + #'helm-beginning-of-source-p))) + (while (and (not (funcall stop-fn)) + (string= curtype (funcall fn))) + (forward-line n)) + (helm-mark-current-line) + (helm-follow-execute-persistent-action-maybe)))) (defun helm-imenu-next-section () (interactive) @@ -298,7 +302,7 @@ Each car is a regexp match pattern of the imenu type string." when (string-match p x) return f finally return 'default))) types helm-imenu-delimiter) - for disp = (propertize disp1 'help-echo bufname) + for disp = (propertize disp1 'help-echo bufname 'types types) collect (cons disp (cons k v)))) diff --git a/elpa/helm-20190122.549/helm-info.el b/elpa/helm-20191031.725/helm-info.el similarity index 99% rename from elpa/helm-20190122.549/helm-info.el rename to elpa/helm-20191031.725/helm-info.el index 60c57c94..c484ab6c 100644 --- a/elpa/helm-20190122.549/helm-info.el +++ b/elpa/helm-20191031.725/helm-info.el @@ -1,6 +1,6 @@ ;;; helm-info.el --- Browse info index with helm -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-locate.el b/elpa/helm-20191031.725/helm-locate.el similarity index 95% rename from elpa/helm-20190122.549/helm-locate.el rename to elpa/helm-20191031.725/helm-locate.el index a7ce7417..ecba5cd5 100644 --- a/elpa/helm-20190122.549/helm-locate.el +++ b/elpa/helm-20191031.725/helm-locate.el @@ -1,6 +1,6 @@ ;;; helm-locate.el --- helm interface for locate. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -262,6 +262,21 @@ See also `helm-locate'." :default default :history 'helm-file-name-history))) +(defun helm-locate-update-mode-line (process-name) + "Update mode-line with PROCESS-NAME status information." + (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 - (%s results)]" + (max (1- (count-lines + (point-min) (point-max))) + 0) + ,process-name) + 'face 'helm-locate-finish)))) + (force-mode-line-update))) + (defun helm-locate-init () "Initialize async locate process for `helm-source-locate'." (let* ((locate-is-es (string-match "\\`es" helm-locate-command)) @@ -309,17 +324,7 @@ See also `helm-locate'." (when (and helm-locate-fuzzy-match (not (string-match-p "\\s-" helm-pattern))) (helm-redisplay-buffer)) - (with-helm-window - (setq mode-line-format - '(" " mode-line-buffer-identification " " - (:eval (format "L%s" (helm-candidate-number-at-point))) " " - (:eval (propertize - (format "[Locate process finished - (%s results)]" - (max (1- (count-lines - (point-min) (point-max))) - 0)) - 'face 'helm-locate-finish)))) - (force-mode-line-update))) + (helm-locate-update-mode-line "Locate")) (t (helm-log "Error: Locate %s" (replace-regexp-in-string "\n" "" event)))))))))) diff --git a/elpa/helm-20190122.549/helm-man.el b/elpa/helm-20191031.725/helm-man.el similarity index 98% rename from elpa/helm-20190122.549/helm-man.el rename to elpa/helm-20191031.725/helm-man.el index ab2d3002..26f8135f 100644 --- a/elpa/helm-20190122.549/helm-man.el +++ b/elpa/helm-20191031.725/helm-man.el @@ -1,6 +1,6 @@ ;;; helm-man.el --- Man and woman UI -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-20190122.549/helm-misc.el b/elpa/helm-20191031.725/helm-misc.el similarity index 91% rename from elpa/helm-20190122.549/helm-misc.el rename to elpa/helm-20191031.725/helm-misc.el index 9701e4e2..7843f0fb 100644 --- a/elpa/helm-20190122.549/helm-misc.el +++ b/elpa/helm-20191031.725/helm-misc.el @@ -1,6 +1,6 @@ ;;; helm-misc.el --- Various functions for helm -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -202,23 +202,6 @@ It is added to `extended-command-history'. (const :tag "Confirm" 'confirm) (const :tag "Always allow" nil))) -;;; Shell history -;; -;; -(defun helm-comint-input-ring-action (candidate) - "Default action for comint history." - (with-helm-current-buffer - (delete-region (comint-line-beginning-position) (point-max)) - (insert candidate))) - -(defvar helm-source-comint-input-ring - (helm-build-sync-source "Comint history" - :candidates (lambda () - (with-helm-current-buffer - (ring-elements comint-input-ring))) - :action 'helm-comint-input-ring-action) - "Source that provide helm completion against `comint-input-ring'.") - ;;; Helm ratpoison UI ;; @@ -339,17 +322,6 @@ Default action change TZ environment variable locally to emacs." (delete-minibuffer-contents) (insert elm))) -;;;###autoload -(defun helm-comint-input-ring () - "Preconfigured `helm' that provide completion of `comint' history." - (interactive) - (when (derived-mode-p 'comint-mode) - (helm :sources 'helm-source-comint-input-ring - :input (buffer-substring-no-properties (comint-line-beginning-position) - (point-at-eol)) - :buffer "*helm comint history*"))) - - (provide 'helm-misc) ;; Local Variables: diff --git a/elpa/helm-20190122.549/helm-mode.el b/elpa/helm-20191031.725/helm-mode.el similarity index 75% rename from elpa/helm-20190122.549/helm-mode.el rename to elpa/helm-20191031.725/helm-mode.el index f014d2dc..36521a4b 100644 --- a/elpa/helm-20190122.549/helm-mode.el +++ b/elpa/helm-20191031.725/helm-mode.el @@ -1,6 +1,6 @@ ;;; helm-mode.el --- Enable helm completion everywhere. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -41,8 +41,8 @@ (trace-function-foreground . helm-completing-read-symbols) (trace-function-background . helm-completing-read-symbols) (find-tag . helm-completing-read-default-find-tag) - (org-capture . helm-org-completing-read-tags) - (org-set-tags . helm-org-completing-read-tags) + (xref-find-definitions . helm-completing-read-default-find-tag) + (xref-find-references . helm-completing-read-default-find-tag) (ffap-alternate-file . nil) (tmm-menubar . nil) (find-file . nil) @@ -160,12 +160,6 @@ when non--nil." :group 'helm-mode :type 'boolean) -(defcustom helm-completion-in-region-fuzzy-match nil - "Whether `helm-completion-in-region' use fuzzy matching or not. -Affect among others `completion-at-point', `completing-read-multiple'." - :group 'helm-mode - :type 'boolean) - (defcustom helm-completion-in-region-default-sort-fn 'helm-completion-in-region-sort-fn "The default sort function to sort candidates in completion-in-region. @@ -173,8 +167,9 @@ Affect among others `completion-at-point', `completing-read-multiple'." When nil no sorting is done. The function is a `filtered-candidate-transformer' function which takes two args CANDIDATES and SOURCE. -It will be used only when `helm-completion-in-region-fuzzy-match' is -nil otherwise fuzzy use its own sort function." +It will be used only when `helm-completion-style' is either emacs or +helm, otherwise when helm-fuzzy style is used, the fuzzy sort function +will be used." :group 'helm-mode :type 'function) @@ -184,7 +179,7 @@ Note that this will slow down completion and modify sorting which is unwanted in many places. This affect only the functions with completing-read helmized by helm-mode. To fuzzy match `completion-at-point' and friends see -`helm-completion-in-region-fuzzy-match'." +`helm-completion-style'." :group 'helm-mode :type 'boolean) @@ -212,6 +207,10 @@ know what you are doing." :group 'helm-mode :type 'boolean) +(defface helm-mode-prefix + '((t (:background "red" :foreground "black"))) + "Face used for prefix completion." + :group 'helm-mode) (defvar helm-comp-read-map (let ((map (make-sparse-keymap))) @@ -220,6 +219,76 @@ know what you are doing." (define-key map (kbd "M-RET") 'helm-cr-empty-string) map) "Keymap for `helm-comp-read'.") + +(defun helm-mode-delete-char-backward-1 () + (interactive) + (condition-case err + (call-interactively 'delete-backward-char) + (text-read-only + (if (with-selected-window (minibuffer-window) + (not (string= (minibuffer-contents) ""))) + (message "Trying to delete prefix completion, next hit will quit") + (user-error "%s" (car err)))))) +(put 'helm-mode-delete-char-backward-1 'helm-only t) + +(defun helm-mode-delete-char-backward-2 () + (interactive) + (condition-case _err + (call-interactively 'delete-backward-char) + (text-read-only + (unless (with-selected-window (minibuffer-window) + (string= (minibuffer-contents) "")) + (with-helm-current-buffer + (run-with-timer 0.1 nil (lambda () + (call-interactively 'delete-backward-char)))) + (helm-keyboard-quit))))) +(put 'helm-mode-delete-char-backward-2 'helm-only t) + +(helm-multi-key-defun helm-mode-delete-char-backward-maybe + "Delete char backward when text is not the prefix helm is completing against. +First call warn user about deleting prefix completion. +Second call delete backward char in current-buffer and quit helm completion, +letting user starting a new completion with a new prefix." + '(helm-mode-delete-char-backward-1 helm-mode-delete-char-backward-2) 1) + +(defcustom helm-completion-style 'emacs + "Style of completion to use in `completion-in-region'. + +This affect only `completion-at-point' and friends, NOT +`completing-read' nor other helm commands. + +NB: This have nothing to do with `completion-styles', it is independent to +helm. + +There is three possible value to use: +- helm, use multi match regular helm completion. +- helm-fuzzy, use fuzzy matching, note that as usual when + entering a space helm switch to multi matching mode. +- emacs, use regular emacs completion according to + `completion-styles', note that even in this style, helm allow using + multi match. Emacs-27 provide a style called flex that can be used + along this helm style (see `completion-styles-alist'). + +Please use custom interface or `customize-set-variable' to set this, +NOT `setq'." + :group 'helm-mode + :type '(choice (const :tag "Emacs" emacs) + (const :tag "Helm" helm) + (const :tag "Helm-fuzzy" helm-fuzzy)) + :set (lambda (var val) + (set var val) + (if (memq val '(helm helm-fuzzy)) + (define-key helm-comp-read-map (kbd "DEL") 'helm-mode-delete-char-backward-maybe) + (define-key helm-comp-read-map (kbd "DEL") 'delete-backward-char)))) + +(defcustom helm-completion-styles-alist '((eshell-mode . helm)) + "Allow configuring `helm-completion-style' per mode. + +Each entry is a cons cell like (mode . style) where style must be a +suitable value for `helm-completion-style'." + :group 'helm-mode + :type '(alist :key-type (symbol :tag "Mode") + :value-type (symbol :tag "Style"))) ;;; helm-comp-read ;; @@ -319,7 +388,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." ;; Handle here specially such cases. ((and (functionp collection) (not (string= input "")) minibuffer-completing-file-name) - (cl-loop for f in (funcall collection input test t) + (cl-loop for f in (funcall collection input test) unless (member f '("./" "../")) if (string-match helm--url-regexp input) collect f @@ -423,6 +492,7 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." header-name candidates-in-buffer match-part + match-dynamic exec-when-only-one quit-when-no-cand (volatile t) @@ -434,7 +504,8 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." (alistp t) (candidate-number-limit helm-candidate-number-limit) multiline - allow-nest) + allow-nest + (group 'helm)) "Read a string in the minibuffer, with helm completion. It is helm `completing-read' equivalent. @@ -515,7 +586,7 @@ Keys description: - NOMARK: When non--nil don't allow marking candidates. -- ALISTP: \(default is non--nil\) See `helm-comp-read-get-candidates'. +- ALISTP: (default is non--nil) See `helm-comp-read-get-candidates'. - CANDIDATES-IN-BUFFER: when non--nil use a source build with `helm-source-in-buffer' which is much faster. @@ -524,11 +595,16 @@ Keys description: - MATCH-PART: Allow matching only one part of candidate. See match-part documentation in `helm-source'. +- MATCH-DYNAMIC: See match-dynamic in `helm-source-sync' + It have no effect when used with CANDIDATES-IN-BUFFER. + - ALLOW-NEST: Allow nesting this `helm-comp-read' in a helm session. See `helm'. - MULTILINE: See multiline in `helm-source'. +- GROUP: See group in `helm-source'. + Any prefix args passed during `helm-comp-read' invocation will be recorded in `helm-current-prefix-arg', otherwise if prefix args were given before `helm-comp-read' invocation, the value of `current-prefix-arg' will be used. @@ -565,12 +641,14 @@ that use `helm-comp-read' See `helm-M-x' for example." (get-candidates (lambda () (let ((cands (helm-comp-read-get-candidates + ;; If `helm-pattern' is passed as INPUT + ;; and :alistp is nil INPUT is passed to + ;; `all-completions' which defeat helm + ;; matching functions (multi match, fuzzy + ;; etc...) issue #2134. collection test sort alistp - ;; This should not be needed as - ;; `helm-pattern' is not yet computed when - ;; calling this from :init when - ;; candidates-in-buffer is in use. - (if candidates-in-buffer "" helm-pattern)))) + (if (and match-dynamic (null candidates-in-buffer)) + helm-pattern "")))) (helm-cr-default default cands)))) (history-get-candidates (lambda () @@ -596,6 +674,7 @@ that use `helm-comp-read' See `helm-M-x' for example." :persistent-action persistent-action :persistent-help persistent-help :keymap loc-map + :group group :mode-line mode-line :help-message help-message :action action-fn)) @@ -605,14 +684,18 @@ that use `helm-comp-read' See `helm-M-x' for example." :multiline multiline :header-name header-name :filtered-candidate-transformer - (append (helm-mklist fc-transformer) - '(helm-cr-default-transformer)) + (let ((transformers (helm-mklist fc-transformer))) + (append transformers + (unless (member 'helm-cr-default-transformer transformers) + '(helm-cr-default-transformer)))) :requires-pattern requires-pattern :persistent-action persistent-action :persistent-help persistent-help :fuzzy-match fuzzy :keymap loc-map + :group group :mode-line mode-line + :match-dynamic match-dynamic :help-message help-message :action action-fn :volatile volatile)) @@ -628,6 +711,7 @@ that use `helm-comp-read' See `helm-M-x' for example." :persistent-action persistent-action :fuzzy-match fuzzy :keymap loc-map + :group group :persistent-help persistent-help :mode-line mode-line :help-message help-message @@ -741,8 +825,7 @@ It should be used when candidate list don't need to rebuild dynamically." ((pred (stringp)) init) ;; INIT is a cons cell. (`(,l . ,_ll) l)) - (if minibuffer-completing-file-name it - (regexp-quote it))))) + it))) (helm-comp-read prompt collection :test test @@ -927,6 +1010,7 @@ See documentation of `completing-read' and `all-completions' for details." (initial-input default-directory) (buffer "*Helm file completions*") test + noret (case-fold helm-file-name-case-fold-search) preselect history @@ -955,6 +1039,9 @@ Keys description: - TEST: A predicate called with one arg 'candidate'. +- NORET: Allow disabling helm-ff-RET (have no effect if helm-ff-RET + isn't bound to RET). + - CASE-FOLD: Same as `helm-case-fold-search'. - PRESELECT: helm preselection. @@ -1004,11 +1091,13 @@ Keys description: (hist (and history (helm-comp-read-get-candidates history nil nil alistp))) (minibuffer-completion-confirm must-match) + (helm-ff--RET-disabled noret) (must-match-map (when must-match (let ((map (make-sparse-keymap))) (define-key map (kbd "RET") (let ((fn (lookup-key helm-read-file-map (kbd "RET")))) - (if (eq fn 'helm-ff-RET) + (if (and (eq fn 'helm-ff-RET) + (null helm-ff--RET-disabled)) #'helm-ff-RET-must-match #'helm-confirm-and-exit-minibuffer))) map))) @@ -1136,6 +1225,7 @@ Don't use it directly, use instead `helm-read-file-name' in your programs." ;; Append the two extra args needed to set the buffer and source name ;; in helm specialized functions. (any-args (append def-args (list str-command buf-name))) + (reading-directory (eq predicate 'file-directory-p)) helm-completion-mode-start-message ; Be quiet helm-completion-mode-quit-message ; Same here fname) @@ -1199,14 +1289,15 @@ Don't use it directly, use instead `helm-read-file-name' in your programs." :initial-input (expand-file-name init dir) :alistp nil :must-match mustmatch - :test predicate)))) + :test predicate + :noret reading-directory)))) (and ido-mode (ido-mode -1)) (helm-mode 1) ;; Same comment as in `helm--completing-read-default'. (setq this-command current-command)) (if (and ;; Using `read-directory-name'. - (eq predicate 'file-directory-p) + reading-directory ;; `file-name-as-directory' return "./" when FNAME is ;; empty string. (not (string= fname ""))) @@ -1240,15 +1331,133 @@ The `helm-find-files' history `helm-ff-history' is used here." :test predicate))) -;;; Completion in region +;;; Completion in region and Helm style ;; (defun helm-mode--advice-lisp--local-variables (old--fn &rest args) (ignore-errors (apply old--fn args))) +(defvar helm-completion--sorting-done nil + "Flag that notify the FCT if sorting have been done in completion function.") (defun helm-completion-in-region-sort-fn (candidates _source) "Default sort function for completion-in-region." - (sort candidates 'helm-generic-sort-fn)) + (if helm-completion--sorting-done + candidates + (sort candidates 'helm-generic-sort-fn))) + +(defun helm-mode--completion-in-region-initial-input (str) + "Highlight prefix in helm and helm-fuzzy `helm-completion-styles'." + (if (memq helm-completion-style '(helm helm-fuzzy)) + (propertize str 'read-only t 'face 'helm-mode-prefix 'rear-nonsticky t) + str)) + +(defun helm-completion-try-completion (string table pred point) + "The try completion function for `completing-styles-alist'. +Actually do nothing." + ;; AFAIU the try completion function is here to handle single + ;; element completion, in this case it throw this element without + ;; popping up *completions* buffer. If that's the case we don't need + ;; this because helm already handle this with + ;; `helm-execute-action-at-once-if-one', so returning unconditionaly + ;; nil should be fine. + (ignore string table pred point)) + +(defun helm-completion-all-completions (string table pred point) + "The all completions function for `completing-styles-alist'." + ;; FIXME: No need to bind all these value. + (cl-multiple-value-bind (all _pattern prefix _suffix _carbounds) + (helm-completion--substring-all-completions string table pred point) + (when all (nconc all (length prefix))))) + +(defun helm-completion--all-completions-multi (string collection &optional predicate) + "Allow `all-completions' multi matching on its candidates." + (all-completions "" collection (lambda (x) + (if predicate + (and (funcall predicate x) + (helm-mm-match (helm-stringify x) string)) + (helm-mm-match (helm-stringify x) string))))) + +(defun helm-completion--substring-all-completions (string table pred point) + "Collect completions from TABLE for helm completion style." + (let* ((beforepoint (substring string 0 point)) + (afterpoint (substring string point)) + (bounds (completion-boundaries beforepoint table pred afterpoint)) + (prefix (substring beforepoint 0 (car bounds))) + (suffix (substring afterpoint (cdr bounds))) + (all (if (or (string-match-p " " string) + (string-match-p "\\`!" string)) + (helm-completion--all-completions-multi string table pred) + (all-completions string table pred)))) + (list all string prefix suffix point))) + +(defun helm-completion-in-region--initial-filter (comps afun file-comp-p) + "Add annotations at end of candidates and filter out dot files." + (if file-comp-p + ;; Filter out dot files in file completion. + (cl-loop for f in comps unless + (string-match "\\`\\.\\{1,2\\}/\\'" f) + collect f) + (if afun + ;; Add annotation at end of + ;; candidate if needed, e.g. foo, this happen when + ;; completing against a quoted symbol. + (mapcar (lambda (s) + (let ((ann (funcall afun s))) + (if ann + (cons + (concat + s + (propertize + " " 'display + (propertize + ann + 'face 'completions-annotations))) + s) + s))) + comps) + comps))) + +;; Setup completion styles for helm-mode +(defun helm-mode--setup-completion-styles () + (cl-pushnew '(helm helm-completion-try-completion + helm-completion-all-completions + "helm completion style.") + completion-styles-alist + :test 'equal)) + +(defun helm-mode--disable-completion-styles () + (setq completion-styles-alist + (delete (assq 'helm completion-styles-alist) + completion-styles-alist))) + +(defun helm-completion-in-region--fix-completion-styles () + "Add helm style to `completion-styles' and filter out invalid styles." + (if (memq helm-completion-style '(helm helm-fuzzy)) + '(basic partial-completion emacs22) + (cl-loop with all-styles = (mapcar 'car completion-styles-alist) + for style in (cons 'helm completion-styles) + when (and (memq style all-styles) + (not (memq style styles))) + collect style into styles + finally return styles))) + +(defun helm-completion--adjust-metadata (metadata) + (if (memq helm-completion-style '(helm helm-fuzzy)) + metadata + (cl-flet ((compose-helm-sort-fn + (_existing-sort-fn) + (lambda (candidates) + (let ((res candidates)) + (sort res #'helm-generic-sort-fn))))) + (let ((alist (cdr metadata))) + (helm-aif (assq 'display-sort-function alist) + (setq alist (remove it alist))) + `(metadata . ,(cons + (cons 'display-sort-function + (compose-helm-sort-fn + (alist-get 'display-sort-function alist))) + alist)))))) +(put 'helm 'completion--adjust-metadata 'helm-completion--adjust-metadata) (defun helm--completion-in-region (start end collection &optional predicate) "Helm replacement of `completion--in-region'. @@ -1260,123 +1469,147 @@ Can be used as value for `completion-in-region-function'." (advice-add 'lisp--local-variables :around #'helm-mode--advice-lisp--local-variables) - (unwind-protect - (let* ((enable-recursive-minibuffers t) - (input (buffer-substring-no-properties start end)) - (current-command (or (helm-this-command) this-command)) - (crm (eq current-command 'crm-complete)) - (str-command (helm-symbol-name current-command)) - (buf-name (format "*helm-mode-%s*" str-command)) - (require-match (or (and (boundp 'require-match) require-match) - minibuffer-completion-confirm - ;; If prompt have not been propagated here, that's - ;; probably mean we have no prompt and we are in - ;; completion-at-point or friend, so use a non--nil - ;; value for require-match. - (not (boundp 'prompt)))) - ;; `completion-extra-properties' is let-bounded in `completion-at-point'. - ;; `afun' is a closure to call against each string in `data'. - ;; it provide the annotation info for each string. - ;; e.g "foo" => "foo " where foo is a function. - ;; See Issue #407. - (afun (plist-get completion-extra-properties :annotation-function)) - (metadata (completion-metadata - (buffer-substring-no-properties start (point)) - collection predicate)) - (data (completion-all-completions - (buffer-substring start end) - collection - predicate - (- (point) start) - metadata)) - ;; `completion-all-completions' store the base-size in the last `cdr', - ;; so data looks like this: '(a b c d . 0) and (last data) == (d . 0). - (last-data (last data)) - (base-size (helm-aif (cdr (last data)) - (prog1 it - (setcdr last-data nil)) - 0)) - (init-space-suffix (unless (or helm-completion-in-region-fuzzy-match - (string-suffix-p " " input) - (string= input "")) - " ")) - (file-comp-p (or (eq (completion-metadata-get metadata 'category) 'file) - (helm-mode--in-file-completion-p) - ;; Assume that when `afun' and `predicate' are null - ;; we are in filename completion. - (and (null afun) (null predicate)))) - ;; Completion-at-point and friends have no prompt. - (result (if (stringp data) - data - (helm-comp-read - (or (and (boundp 'prompt) prompt) "Pattern: ") - (if file-comp-p - (cl-loop for f in data unless - (string-match "\\`\\.\\{1,2\\}/\\'" f) - collect f) - (if afun - (mapcar (lambda (s) - (let ((ann (funcall afun s))) - (if ann - (cons - (concat - s - (propertize - " " 'display - (propertize - ann - 'face 'completions-annotations))) - s) - s))) - data) - data)) - :name str-command - :fuzzy helm-completion-in-region-fuzzy-match - :nomark (null crm) - :marked-candidates crm - :initial-input - (cond ((and file-comp-p - (not (string-match "/\\'" input))) - (concat (helm-basename input) - init-space-suffix)) - ((string-match "/\\'" input) nil) - ((or (null require-match) - (stringp require-match)) - input) - (t (concat input init-space-suffix))) - :buffer buf-name - :fc-transformer (append '(helm-cr-default-transformer) - (unless (or helm-completion-in-region-fuzzy-match - (null helm-completion-in-region-default-sort-fn)) - (list helm-completion-in-region-default-sort-fn))) - :exec-when-only-one t - :quit-when-no-cand - (lambda () - ;; Delay message to overwrite "Quit". - (run-with-timer - 0.01 nil - (lambda () - (message "[No matches]"))) - t) ; exit minibuffer immediately. - :must-match require-match)))) - (cond ((stringp result) - (choose-completion-string - result (current-buffer) - (list (+ start base-size) end) - completion-list-insert-choice-function)) - ((consp result) ; crm. - (let ((beg (+ start base-size)) - (sep ",")) - ;; Try to find a default separator. - (save-excursion - (goto-char beg) - (when (looking-back crm-separator (1- (point))) - (setq sep (match-string 0)))) - (funcall completion-list-insert-choice-function - beg end (mapconcat 'identity result sep)))) - (t nil))) - (advice-remove 'lisp--local-variables - #'helm-mode--advice-lisp--local-variables)))) + (let ((old--helm-completion-style helm-completion-style)) + (helm-aif (cdr (assq major-mode helm-completion-styles-alist)) + (customize-set-variable 'helm-completion-style it)) + (unwind-protect + (let* ((enable-recursive-minibuffers t) + (completion-styles (helm-completion-in-region--fix-completion-styles)) + (input (buffer-substring start end)) + (current-command (or (helm-this-command) this-command)) + (crm (eq current-command 'crm-complete)) + (str-command (helm-symbol-name current-command)) + (buf-name (format "*helm-mode-%s*" str-command)) + (require-match (or (and (boundp 'require-match) require-match) + minibuffer-completion-confirm + ;; If prompt have not been propagated here, that's + ;; probably mean we have no prompt and we are in + ;; completion-at-point or friend, so use a non--nil + ;; value for require-match. + (not (boundp 'prompt)))) + ;; `completion-extra-properties' is let-bounded in `completion-at-point'. + ;; `afun' is a closure to call against each string in `data'. + ;; it provide the annotation info for each string. + ;; e.g "foo" => "foo " where foo is a function. + ;; See Issue #407. + (afun (plist-get completion-extra-properties :annotation-function)) + (metadata (completion-metadata + (buffer-substring start (point)) + collection predicate)) + (init-space-suffix (unless (or (memq helm-completion-style '(helm-fuzzy emacs)) + (string-suffix-p " " input) + (string= input "")) + " ")) + (file-comp-p (or (eq (completion-metadata-get metadata 'category) 'file) + (helm-mode--in-file-completion-p) + ;; Assume that when `afun' and `predicate' are null + ;; we are in filename completion. + (and (null afun) (null predicate)))) + ;; `completion-all-completions' store the base-size in the last `cdr', + ;; so data looks like this: '(a b c d . 0) and (last data) == (d . 0). + base-size + (compfn (lambda (str _predicate _action) + ;; Cache data for subsequent calls when emacs + ;; style is in use, with helm style function + ;; is called only once and cache is not + ;; needed but it doesn't harm to set hash, it + ;; will not be used. + (let* ((comps + (completion-all-completions + ;; `helm-comp-read-get-candidates' + ;; set input to `helm-pattern' + ;; so no need to pass + ;; `helm-pattern' directly here. + str + collection + predicate + (length str) + metadata)) + (last-data (last comps)) + (sort-fn (and (eq helm-completion-style 'emacs) + (completion-metadata-get + metadata 'display-sort-function))) + all) + (setq base-size + (helm-aif (cdr last-data) + (prog1 (or base-size it) + (setcdr last-data nil)) + 0)) + (setq helm-completion--sorting-done (and sort-fn t)) + (setq all (copy-sequence comps)) + ;; Fall back to string-lessp sorting when + ;; str is too small as specialized + ;; sorting may be too slow (flex). + (when (and sort-fn (<= (length str) 1)) + (setq sort-fn (lambda (all) (sort all #'string-lessp)))) + (helm-completion-in-region--initial-filter + (if sort-fn (funcall sort-fn all) all) + afun file-comp-p)))) + (data (if (memq helm-completion-style '(helm helm-fuzzy)) + (funcall compfn (buffer-substring start end) nil nil) + compfn)) + (result (if (stringp data) + data + (helm-comp-read + ;; Completion-at-point and friends have no prompt. + (or (and (boundp 'prompt) prompt) "Pattern: ") + data + :name str-command + :nomark (null crm) + :marked-candidates crm + :initial-input + (cond ((and file-comp-p + (not (string-match "/\\'" input))) + (concat (helm-mode--completion-in-region-initial-input + (helm-basename input)) + init-space-suffix)) + ((string-match "/\\'" input) nil) + ((or (null require-match) + (stringp require-match)) + (helm-mode--completion-in-region-initial-input input)) + (t (concat (helm-mode--completion-in-region-initial-input input) + init-space-suffix))) + :buffer buf-name + :fc-transformer + ;; Ensure sort fn is at the end. + (append '(helm-cr-default-transformer) + (and helm-completion-in-region-default-sort-fn + (list helm-completion-in-region-default-sort-fn))) + :match-dynamic (eq helm-completion-style 'emacs) + :fuzzy (eq helm-completion-style 'helm-fuzzy) + :exec-when-only-one t + :quit-when-no-cand + (lambda () + ;; Delay message to overwrite "Quit". + (run-with-timer + 0.01 nil + (lambda () + (message "[No matches]"))) + t) ; exit minibuffer immediately. + :must-match require-match)))) + (helm-completion-in-region--insert-result result start end base-size)) + (customize-set-variable 'helm-completion-style old--helm-completion-style) + (setq helm-completion--sorting-done nil) + (advice-remove 'lisp--local-variables + #'helm-mode--advice-lisp--local-variables))))) + +(defun helm-completion-in-region--insert-result (result start end base-size) + (cond ((stringp result) + (choose-completion-string + result (current-buffer) + (list (+ start base-size) end) + completion-list-insert-choice-function)) + ((consp result) ; crm. + (let ((beg (+ start base-size)) + (sep ",")) + ;; Try to find a default separator. + (save-excursion + (goto-char beg) + (when (looking-back crm-separator (1- (point))) + (setq sep (match-string 0)))) + (funcall completion-list-insert-choice-function + beg end (mapconcat 'identity result sep)))) + (t nil))) (defun helm-mode--in-file-completion-p () (with-helm-current-buffer @@ -1446,7 +1679,8 @@ Note: This mode is incompatible with Emacs23." #'helm--generic-read-buffer) (when helm-mode-handle-completion-in-region (add-function :override completion-in-region-function - #'helm--completion-in-region)) + #'helm--completion-in-region) + (helm-mode--setup-completion-styles)) ;; If user have enabled ido-everywhere BEFORE enabling ;; helm-mode disable it and warn user about its ;; incompatibility with helm-mode (issue #2085). @@ -1460,7 +1694,8 @@ Note: This mode is incompatible with Emacs23." read-buffer-function 'helm--generic-read-buffer) (when (and (boundp 'completion-in-region-function) helm-mode-handle-completion-in-region) - (setq completion-in-region-function #'helm--completion-in-region)) + (setq completion-in-region-function #'helm--completion-in-region) + (helm-mode--setup-completion-styles)) (message helm-completion-mode-start-message)) (if (fboundp 'remove-function) (progn @@ -1468,6 +1703,7 @@ Note: This mode is incompatible with Emacs23." (remove-function read-file-name-function #'helm--generic-read-file-name) (remove-function read-buffer-function #'helm--generic-read-buffer) (remove-function completion-in-region-function #'helm--completion-in-region) + (helm-mode--disable-completion-styles) (remove-hook 'ido-everywhere-hook #'helm-mode--ido-everywhere-hook)) (setq completing-read-function (and (fboundp 'completing-read-default) 'completing-read-default) @@ -1476,7 +1712,8 @@ Note: This mode is incompatible with Emacs23." read-buffer-function (and (fboundp 'read-buffer) 'read-buffer)) (when (and (boundp 'completion-in-region-function) (boundp 'helm--old-completion-in-region-function)) - (setq completion-in-region-function helm--old-completion-in-region-function)) + (setq completion-in-region-function helm--old-completion-in-region-function) + (helm-mode--disable-completion-styles)) (message helm-completion-mode-quit-message)))) (provide 'helm-mode) diff --git a/elpa/helm-20190122.549/helm-net.el b/elpa/helm-20191031.725/helm-net.el similarity index 70% rename from elpa/helm-20190122.549/helm-net.el rename to elpa/helm-20191031.725/helm-net.el index 560277d3..59687009 100644 --- a/elpa/helm-20190122.549/helm-net.el +++ b/elpa/helm-20191031.725/helm-net.el @@ -1,6 +1,6 @@ ;;; helm-net.el --- helm browse url and search web. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -79,13 +79,6 @@ a personal url, see your settings on duckduckgo." :type 'string :group 'helm-net) -(defcustom helm-wikipedia-suggest-url - "https://en.wikipedia.org/w/api.php?action=opensearch&search=%s" - "Url used for looking up Wikipedia suggestions. -This is a format string, don't forget the `%s'." - :type 'string - :group 'helm-net) - (defcustom helm-search-suggest-action-wikipedia-url "https://en.wikipedia.org/wiki/Special:Search?search=%s" "The Wikipedia search url. @@ -93,13 +86,6 @@ This is a format string, don't forget the `%s'." :type 'string :group 'helm-net) -(defcustom helm-wikipedia-summary-url - "https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=text§ion=0&page=%s" - "URL for getting the summary of a Wikipedia topic. -This is a format string, don't forget the `%s'." - :type 'string - :group 'helm-net) - (defcustom helm-search-suggest-action-youtube-url "https://www.youtube.com/results?aq=f&search_query=%s" "The Youtube search url. @@ -162,6 +148,10 @@ Can be \"-new-tab\" (default) or \"-new-window\"." (const :tag "New tab" "-new-tab") (const :tag "New window" "-new-window"))) +(defcustom helm-net-curl-switches '("-s" "-L") + "Arguments list passed to curl when using `helm-net-prefer-curl'." + :group 'helm-net + :type '(repeat string)) ;;; Additional actions for search suggestions ;; @@ -175,7 +165,8 @@ Can be \"-new-tab\" (default) or \"-new-window\"." (defun helm-net--url-retrieve-sync (request parser) (if helm-net-prefer-curl (with-temp-buffer - (call-process "curl" nil t nil request "-L") + (apply #'call-process "curl" + nil t nil request helm-net-curl-switches) (funcall parser)) (with-current-buffer (url-retrieve-synchronously request) (funcall parser)))) @@ -256,142 +247,6 @@ Can be \"-new-tab\" (default) or \"-new-window\"." "Try to emacs lisp complete with google suggestions." (helm-google-suggest-set-candidates "emacs lisp")) -;;; Wikipedia suggestions -;; -;; -(declare-function json-read-from-string "json" (string)) -(defun helm-wikipedia-suggest-fetch () - "Fetch Wikipedia suggestions and return them as a list." - (require 'json) - (let ((request (format helm-wikipedia-suggest-url - (url-hexify-string helm-pattern)))) - (helm-net--url-retrieve-sync - request #'helm-wikipedia--parse-buffer))) - -(defun helm-wikipedia--parse-buffer () - (goto-char (point-min)) - (when (re-search-forward "^\\[.+\\[\\(.*\\)\\]\\]" nil t) - (cl-loop for i across (aref (json-read-from-string (match-string 0)) 1) - collect i into result - finally return (or result - (append - result - (list (cons (format "Search for '%s' on wikipedia" - helm-pattern) - helm-pattern))))))) - -(defvar helm-wikipedia--summary-cache (make-hash-table :test 'equal)) -(defun helm-wikipedia-show-summary (input) - "Show Wikipedia summary for INPUT in new buffer." - (interactive) - (let ((buffer (get-buffer-create "*helm wikipedia summary*")) - (summary (helm-wikipedia--get-summary input))) - (with-current-buffer buffer - (visual-line-mode) - (erase-buffer) - (insert summary) - (pop-to-buffer (current-buffer)) - (goto-char (point-min))))) - -(defun helm-wikipedia-persistent-action (candidate) - (unless (string= (format "Search for '%s' on wikipedia" - helm-pattern) - (helm-get-selection nil t)) - (message "Fetching summary from Wikipedia...") - (let ((buf (get-buffer-create "*helm wikipedia summary*")) - (result (helm-wikipedia--get-summary candidate))) - (with-current-buffer buf - (erase-buffer) - (setq cursor-type nil) - (insert result) - (fill-region (point-min) (point-max)) - (goto-char (point-min))) - (display-buffer buf)))) - -(defun helm-wikipedia--get-summary (input) - "Return Wikipedia summary for INPUT as string. -Follows any redirections from Wikipedia, and stores results in -`helm-wikipedia--summary-cache'." - (let (result) - (while (progn - (setq result (or (gethash input helm-wikipedia--summary-cache) - (puthash input - (helm-wikipedia--fetch-summary input) - helm-wikipedia--summary-cache))) - (when (and result - (listp result)) - (setq input (cdr result)) - (message "Redirected to %s" input) - t))) - (unless result - (error "Error when getting summary.")) - result)) - -(defun helm-wikipedia--fetch-summary (input) - (let* ((request (format helm-wikipedia-summary-url - (url-hexify-string input)))) - (helm-net--url-retrieve-sync - request #'helm-wikipedia--parse-summary))) - -(defun helm-wikipedia--parse-summary () - (goto-char (point-min)) - (when (search-forward "{" nil t) - (let ((result (cdr (assq '* - (assq 'text - (assq 'parse - (json-read-from-string - (buffer-substring-no-properties - (1- (point)) (point-max))))))))) - (when result - (if (string-match "]+>\\([^<]+\\)" result) - (cons 'redirect (match-string 1 result)) - - ;; find the beginning of the summary text in the result - - ;; check if there is a table before the summary and skip that - (when (or (string-match "\\(\n\\)?\n

" result) - ;; otherwise just find the first paragraph - (string-match "

" result)) - ;; remove cruft and do a simple formatting - (replace-regexp-in-string - "Cite error: .*" "" - (replace-regexp-in-string - " " "" - (replace-regexp-in-string - "\\[[^\]]+\\]" "" - (replace-regexp-in-string - "<[^>]*>" "" - (replace-regexp-in-string - "

\n

" "\n\n" - (substring result (match-end 0))))))))))))) - - -(defvar helm-wikipedia-map - (let ((map (copy-keymap helm-map))) - (define-key map (kbd "") 'helm-wikipedia-show-summary-action) - map) - "Keymap for `helm-wikipedia-suggest'.") - -(defvar helm-source-wikipedia-suggest - (helm-build-sync-source "Wikipedia Suggest" - :candidates #'helm-wikipedia-suggest-fetch - :action '(("Wikipedia" . (lambda (candidate) - (helm-search-suggest-perform-additional-action - helm-search-suggest-action-wikipedia-url - candidate))) - ("Show summary in new buffer (C-RET)" . helm-wikipedia-show-summary)) - :persistent-action #'helm-wikipedia-persistent-action - :persistent-help "show summary" - :volatile t - :keymap helm-wikipedia-map - :requires-pattern 3)) - -(defun helm-wikipedia-show-summary-action () - "Exit Helm buffer and call `helm-wikipedia-show-summary' with selected candidate." - (interactive) - (with-helm-alive-p - (helm-exit-and-execute-action 'helm-wikipedia-show-summary))) - ;;; Web browser functions. ;; @@ -565,14 +420,6 @@ NOTE: Probably not supported on some systems (e.g Windows)." (interactive) (helm-other-buffer 'helm-source-google-suggest "*helm google*")) -;;;###autoload -(defun helm-wikipedia-suggest () - "Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest." - (interactive) - (helm :sources 'helm-source-wikipedia-suggest - :buffer "*helm wikipedia*")) - - (provide 'helm-net) ;; Local Variables: diff --git a/elpa/helm-20191031.725/helm-occur.el b/elpa/helm-20191031.725/helm-occur.el new file mode 100644 index 00000000..72fc70ad --- /dev/null +++ b/elpa/helm-20191031.725/helm-occur.el @@ -0,0 +1,701 @@ +;;; helm-occur.el --- Incremental Occur for Helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-help) +(require 'helm-utils) + +;;; Internals +;; +(defvar helm-source-occur nil) +(defvar helm-source-moccur nil + "This is just a flag to add to `helm-sources-using-default-as-input'. +Don't set it to any value, it will have no effect.") +(defvar helm-occur--buffer-list nil) +(defvar helm-occur--buffer-tick nil) +(defvar helm-occur-history nil) +(defvar helm-occur--search-buffer-regexp "\\`\\([0-9]*\\)\\s-\\{1\\}\\(.*\\)\\'" + "The regexp matching candidates in helm-occur candidate buffer.") +(defvar helm-occur-mode--last-pattern nil) + + +(defvar helm-occur-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (define-key map (kbd "C-c o") 'helm-occur-run-goto-line-ow) + (define-key map (kbd "C-c C-o") 'helm-occur-run-goto-line-of) + (define-key map (kbd "C-x C-s") 'helm-occur-run-save-buffer) + map) + "Keymap used in occur source.") + +(defgroup helm-occur nil + "Regexp related Applications and libraries for Helm." + :group 'helm) + +(defcustom helm-occur-actions + '(("Go to Line" . helm-occur-goto-line) + ("Goto line other window (C-u vertically)" . helm-occur-goto-line-ow) + ("Goto line new frame" . helm-occur-goto-line-of) + ("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 + "Similar to `helm-grep-use-ioccur-style-keys' but for multi occur. + +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) + (if val + (progn + (define-key helm-occur-map (kbd "") 'helm-occur-right) + (define-key helm-occur-map (kbd "") 'helm-occur-run-default-action)) + (define-key helm-occur-map (kbd "") nil) + (define-key helm-occur-map (kbd "") nil)))) + +(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 + "Allow auto updating helm-occur buffer when outdated. +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) + (const :tag "Don't update but signal buffer needs update" nil) + (const :tag "Update after confirmation" t))) + +(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. + +Can be one of `buffer-substring' or `buffer-substring-no-properties'. + +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)))) + + +(defface helm-moccur-buffer + '((t (:foreground "DarkTurquoise" :underline t))) + "Face used to highlight occur buffer names." + :group 'helm-occur) + +(defface helm-resume-need-update + '((t (:background "red"))) + "Face used to flash occur buffer when it needs update." + :group 'helm-occur) + + +;;;###autoload +(defun helm-occur () + "Preconfigured helm for searching lines matching pattern in `current-buffer'. + +When `helm-source-occur' is member of +`helm-sources-using-default-as-input' which is the default, +symbol at point is searched at startup. + +When a region is marked search only in this region by narrowing. + +To search in multiples buffers start from one of the commands listing +buffers (i.e. a helm command using `helm-source-buffers-list' like +`helm-mini') and use the multi occur buffers action. + +This is the helm implementation that collect lines matching pattern +like vanilla emacs `occur' but have nothing to do with it, the search +engine beeing completely different and also much faster." + (interactive) + (setq helm-source-occur + (car (helm-occur-build-sources (list (current-buffer)) "Helm occur"))) + (helm-set-local-variable 'helm-occur--buffer-list (list (current-buffer)) + 'helm-occur--buffer-tick + (list (buffer-chars-modified-tick (current-buffer)))) + (save-restriction + (let (def pos) + (when (use-region-p) + ;; When user mark defun with `mark-defun' with intention of + ;; using helm-occur on this region, it is relevant to use the + ;; 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))) + (unwind-protect + (helm :sources 'helm-source-occur + :buffer "*helm occur*" + :history 'helm-occur-history + :default (or def (helm-aif (thing-at-point 'symbol) + (regexp-quote it))) + :preselect (and (memq 'helm-source-occur + helm-sources-using-default-as-input) + (format "^%d:" (line-number-at-pos + (or pos (point))))) + :truncate-lines helm-occur-truncate-lines) + (deactivate-mark t))))) + +(defun helm-occur-transformer (candidates source) + "Returns CANDIDATES prefixed with line number." + (cl-loop with buf = (helm-attr 'buffer-name source) + for c in candidates collect + (when (string-match helm-occur--search-buffer-regexp c) + (let ((linum (match-string 1 c)) + (disp (match-string 2 c))) + (cons (format "%s:%s" + (propertize + linum 'face 'helm-grep-lineno + 'help-echo (buffer-file-name + (get-buffer buf))) + disp) + (string-to-number linum)))))) + +(defclass helm-moccur-class (helm-source-in-buffer) + ((buffer-name :initarg :buffer-name + :initform nil) + (moccur-buffers :initarg :moccur-buffers + :initform nil))) + +(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 + collect + (helm-make-source (or source-name + (format "HO [%s]" + (buffer-name buf))) + 'helm-moccur-class + :buffer-name (buffer-name buf) + :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))) + :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-attrset 'get-line bsfn) + (with-current-buffer (helm-candidate-buffer 'local) + (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))) + +(defun helm-multi-occur-1 (buffers &optional input) + "Runs helm-occur on a list of buffers. +Each buffer's result is displayed in a separated source." + (let* ((curbuf (current-buffer)) + (bufs (if helm-occur-always-search-in-current + (cons curbuf (remove curbuf buffers)) + buffers)) + (sources (helm-occur-build-sources bufs)) + (helm--maybe-use-default-as-input + (not (null (memq 'helm-source-moccur + helm-sources-using-default-as-input))))) + (helm-set-local-variable 'helm-occur--buffer-list bufs + 'helm-occur--buffer-tick + (cl-loop for b in bufs collect + (buffer-chars-modified-tick + (get-buffer b)))) + (helm :sources sources + :buffer "*helm moccur*" + :history 'helm-occur-history + :default (helm-aif (thing-at-point 'symbol) (regexp-quote it)) + :input input + :truncate-lines helm-occur-truncate-lines))) + +;;; Actions +;; +(cl-defun helm-occur-action (lineno + &optional (method (quote buffer))) + "Jump to line number LINENO with METHOD. +arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame." + (require 'helm-grep) + (let ((buf (if (eq major-mode 'helm-occur-mode) + (get-text-property (point) 'buffer-name) + (helm-attr 'buffer-name))) + (split-pat (helm-mm-split-pattern helm-input))) + (cl-case method + (buffer (switch-to-buffer buf)) + (buffer-other-window (helm-window-show-buffers (list buf) t)) + (buffer-other-frame (switch-to-buffer-other-frame buf))) + (with-current-buffer buf + (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))))))) + +(defun helm-occur-goto-line (candidate) + "From multi occur, switch to buffer and CANDIDATE line." + (helm-occur-action + candidate 'buffer)) + +(defun helm-occur-goto-line-ow (candidate) + "Go to CANDIDATE line in other window. +Same as `helm-occur-goto-line' but go in other window." + (helm-occur-action + candidate 'buffer-other-window)) + +(defun helm-occur-goto-line-of (candidate) + "Go to CANDIDATE line in new frame. +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 () + "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) + +(defun 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) + +(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) + +(defun 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) + +(defun helm-occur-right () + "helm-occur action for right arrow. +This is used when `helm-occur-use-ioccur-style-keys' is enabled. +If follow is enabled (default) go to next source, otherwise execute +persistent action." + (interactive) + (if (helm-aand (helm-attr 'follow) (> it 0)) + (helm-next-source) + (helm-execute-persistent-action))) +(put 'helm-occur-right 'helm-only t) + + +;;; helm-occur-mode +;; +;; +(defvar helm-occur-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") 'helm-occur-mode-goto-line) + (define-key map (kbd "C-o") 'helm-occur-mode-goto-line-ow) + (define-key map (kbd "") 'helm-occur-mode-goto-line-ow-forward) + (define-key map (kbd "") 'helm-occur-mode-goto-line-ow-backward) + (define-key map (kbd "") 'helm-gm-next-file) + (define-key map (kbd "") 'helm-gm-precedent-file) + (define-key map (kbd "M-n") 'helm-occur-mode-goto-line-ow-forward) + (define-key map (kbd "M-p") 'helm-occur-mode-goto-line-ow-backward) + (define-key map (kbd "M-N") 'helm-gm-next-file) + (define-key map (kbd "M-P") 'helm-gm-precedent-file) + (define-key map (kbd "C-c b") 'helm-occur-mode-resume-session) + map)) + +(defun helm-occur-mode-goto-line () + (interactive) + (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) + (helm-aif (get-text-property (point) 'helm-realvalue) + (progn (helm-occur-goto-line-ow it) (helm-match-line-cleanup-pulse)))) + +(defun helm-occur-mode-goto-line-ow-forward-1 (arg) + (condition-case nil + (progn + (when (or (eq last-command 'helm-occur-mode-goto-line-ow-forward) + (eq last-command 'helm-occur-mode-goto-line-ow-backward)) + (forward-line arg)) + (save-selected-window + (helm-occur-mode-goto-line-ow) + (recenter))) + (error nil))) + +(defun helm-occur-mode-goto-line-ow-forward (arg) + (interactive "p") + (helm-occur-mode-goto-line-ow-forward-1 arg)) + +(defun helm-occur-mode-goto-line-ow-backward (arg) + (interactive "p") + (helm-occur-mode-goto-line-ow-forward-1 (- arg))) + +(defun helm-occur-save-results (_candidate) + "Save helm moccur results in a `helm-moccur-mode' buffer." + (let ((buf "*hmoccur*") + new-buf) + (when (get-buffer buf) + (setq new-buf (helm-read-string "OccurBufferName: " buf)) + (cl-loop for b in (helm-buffer-list) + when (and (string= new-buf b) + (not (y-or-n-p + (format "Buffer `%s' already exists overwrite? " + new-buf)))) + do (setq new-buf (helm-read-string + "OccurBufferName: " "*hmoccur "))) + (setq buf new-buf)) + (with-current-buffer (get-buffer-create buf) + (kill-all-local-variables) + (setq buffer-read-only t) + (buffer-disable-undo) + (let ((inhibit-read-only t) + (map (make-sparse-keymap)) + buf-name) + (erase-buffer) + (insert "-*- mode: helm-occur -*-\n\n" + (format "Occur Results for `%s':\n\n" helm-input)) + (save-excursion + (insert (with-current-buffer helm-buffer + (goto-char (point-min)) + (forward-line 1) + (buffer-substring (point) (point-max))))) + (save-excursion + (forward-line -2) + (while (not (eobp)) + (if (helm-pos-header-line-p) + (let ((beg (point-at-bol)) + (end (point-at-eol))) + (set-text-properties beg (1+ end) nil) + (delete-region (1- beg) end)) + (helm-aif (setq buf-name (assoc-default + 'buffer-name + (get-text-property (point) 'helm-cur-source))) + (progn + (insert (propertize (concat it ":") + 'face 'helm-moccur-buffer + 'helm-realvalue (get-text-property (point) 'helm-realvalue))) + (add-text-properties + (point-at-bol) (point-at-eol) + `(buffer-name ,buf-name)) + (add-text-properties + (point-at-bol) (point-at-eol) + `(keymap ,map + help-echo ,(concat + (buffer-file-name + (get-buffer buf-name)) + "\nmouse-1: set point\nmouse-2: jump to selection") + mouse-face highlight + invisible nil)) + (define-key map [mouse-1] 'mouse-set-point) + (define-key map [mouse-2] 'helm-occur-mode-mouse-goto-line) + (define-key map [mouse-3] 'ignore)))) + (forward-line 1)))) + (buffer-enable-undo) + (helm-occur-mode)) + (pop-to-buffer buf) + (message "Helm occur Results saved in `%s' buffer" buf))) + +(defun helm-occur-mode-mouse-goto-line (event) + (interactive "e") + (let* ((window (posn-window (event-end event))) + (pos (posn-point (event-end event)))) + (with-selected-window window + (when (eq major-mode 'helm-occur-mode) + (goto-char pos) + (helm-occur-mode-goto-line))))) +(put 'helm-moccur-mode-mouse-goto-line 'helm-only t) + +(defun helm-occur-mode-resume-session () + (interactive) + (cl-assert (eq major-mode 'helm-occur-mode) nil "Helm command called in wrong context") + (helm-multi-occur-1 helm-occur--buffer-list helm-occur-mode--last-pattern)) + +(defun helm-occur-buffer-substring-with-linums () + "Returns current-buffer contents as a string with all lines +numbered. The property 'buffer-name is added to the whole string." + (let ((bufstr (buffer-substring-no-properties (point-min) (point-max))) + (bufname (buffer-name))) + (with-temp-buffer + (save-excursion + (insert bufstr)) + (let ((linum 1)) + (insert (format "%s " linum)) + (while (re-search-forward "\n" nil t) + (cl-incf linum) + (insert (format "%s " linum))) + (add-text-properties (point-min) (point-max) `(buffer-name ,bufname))) + (buffer-string)))) + +(defun helm-occur-mode--revert-buffer-function (&optional _ignore-auto _noconfirm) + "The `revert-buffer-function' for `helm-occur-mode'." + (goto-char (point-min)) + (let (pattern) + (when (re-search-forward "^Occur Results for `\\(.*\\)'" nil t) + (setq pattern (match-string 1)) + (forward-line 0) + (when (re-search-forward "^$" nil t) + (forward-line 1)) + (let ((inhibit-read-only t) + (buffer (current-buffer)) + (buflst helm-occur--buffer-list)) + (delete-region (point) (point-max)) + (message "Reverting buffer...") + (save-excursion + (with-temp-buffer + (insert + "\n" + (cl-loop for buf in buflst + for bufstr = (or (and (buffer-live-p (get-buffer buf)) + (with-current-buffer buf + (helm-occur-buffer-substring-with-linums))) + "") + concat bufstr) + "\n") + (goto-char (point-min)) + (cl-loop with linum + with mpart + ;; Bind helm-pattern used by `helm-grep-split-line'. + with helm-pattern = pattern + while (helm-mm-search pattern) ; point is at eol. + ;; Calculate line number (linum) and extract real + ;; part of line (mpart). + do (when (save-excursion + ;; `helm-mm-search' puts point at eol. + (forward-line 0) + (re-search-forward "^\\([0-9]*\\)\\s-\\{1\\}\\(.*\\)$" + (point-at-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)) + for line = (format "%s:%d:%s" + (get-text-property (point) 'buffer-name) + linum + mpart) + when line + do (with-current-buffer buffer + (insert + (propertize + (car (helm-occur-filter-one-by-one line)) + 'helm-realvalue linum) + "\n")))) + (when (fboundp 'wgrep-cleanup-overlays) + (wgrep-cleanup-overlays (point-min) (point-max))) + (message "Reverting buffer done")))))) + +(defun helm-occur-filter-one-by-one (candidate) + "`filter-one-by-one' function for `helm-source-moccur'." + (require 'helm-grep) + (let* ((split (helm-grep-split-line candidate)) + (buf (car split)) + (lineno (nth 1 split)) + (str (nth 2 split))) + (cons (concat (propertize + buf + 'face 'helm-moccur-buffer + 'help-echo (buffer-file-name + (get-buffer buf)) + 'buffer-name buf) + ":" + (propertize lineno 'face 'helm-grep-lineno) + ":" + (helm-grep-highlight-match str t)) + candidate))) + +;;;###autoload +(define-derived-mode helm-occur-mode + special-mode "helm-moccur" + "Major mode to provide actions in helm moccur saved buffer. + +Special commands: +\\{helm-occur-mode-map}" + (set (make-local-variable 'helm-occur--buffer-list) + (with-helm-buffer helm-occur--buffer-list)) + (set (make-local-variable 'revert-buffer-function) + #'helm-occur-mode--revert-buffer-function) + (set (make-local-variable 'helm-occur-mode--last-pattern) + helm-input)) +(put 'helm-moccur-mode 'helm-only t) + + +;;; Resume +;; +(defun helm-occur-resume-fn () + (with-helm-buffer + (let (new-tick-ls buffer-is-modified) + (set (make-local-variable 'helm-occur--buffer-list) + (cl-loop for b in helm-occur--buffer-list + when (buffer-live-p (get-buffer b)) + collect b)) + (setq buffer-is-modified (/= (length helm-occur--buffer-list) + (length (helm-attr 'moccur-buffers)))) + (helm-attrset 'moccur-buffers helm-occur--buffer-list) + (setq new-tick-ls (cl-loop for b in helm-occur--buffer-list + collect (buffer-chars-modified-tick + (get-buffer b)))) + (when buffer-is-modified + (setq helm-occur--buffer-tick new-tick-ls)) + (cl-assert (> (length helm-occur--buffer-list) 0) nil + "helm-resume error: helm-(m)occur buffer list is empty") + (unless (eq helm-occur-auto-update-on-resume 'never) + (when (or buffer-is-modified + (cl-loop for b in helm-occur--buffer-list + for new-tick = (buffer-chars-modified-tick + (get-buffer b)) + for tick in helm-occur--buffer-tick + thereis (/= tick new-tick))) + (helm-aif helm-occur-auto-update-on-resume + (when (or (eq it 'noask) + (y-or-n-p "Helm (m)occur Buffer outdated, update? ")) + (run-with-idle-timer + 0.1 nil (lambda () + (with-helm-buffer + (helm-force-update) + (message "Helm (m)occur Buffer have been udated") + (sit-for 1) (message nil)))) + (unless buffer-is-modified (setq helm-occur--buffer-tick + new-tick-ls))) + (run-with-idle-timer + 0.1 nil + (lambda () + (with-helm-buffer + (let ((ov (make-overlay (save-excursion + (goto-char (point-min)) + (forward-line 1) + (point)) + (point-max)))) + (overlay-put ov 'face 'helm-resume-need-update) + (sit-for 0.3) (delete-overlay ov) + (message "[Helm occur Buffer outdated (C-c C-u to update)]"))))) + (unless buffer-is-modified + (with-helm-after-update-hook + (setq helm-occur--buffer-tick new-tick-ls) + (message "Helm (m)occur Buffer have been udated"))))))))) + +;;; Helm occur from isearch +;; +;;;###autoload +(defun helm-occur-from-isearch () + "Invoke `helm-occur' from isearch. + +To use this bind it to a key in `isearch-mode-map'." + (interactive) + (let ((input (if isearch-regexp + isearch-string + (regexp-quote isearch-string))) + (bufs (list (current-buffer)))) + (isearch-exit) + (helm-multi-occur-1 bufs input))) + +;;;###autoload +(defun helm-multi-occur-from-isearch () + "Invoke `helm-multi-occur' from isearch. + +With a prefix arg, reverse the behavior of +`helm-moccur-always-search-in-current'. +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'." + (interactive) + (let (buf-list + helm-moccur-always-search-in-current + (input (if isearch-regexp + isearch-string + (regexp-quote isearch-string)))) + (isearch-exit) + (setq buf-list (mapcar 'get-buffer + (helm-comp-read "Buffers: " + (helm-buffer-list) + :name "Occur in buffer(s)" + :marked-candidates t))) + (setq helm-moccur-always-search-in-current + (if (or current-prefix-arg + helm-current-prefix-arg) + (not helm-moccur-always-search-in-current) + helm-moccur-always-search-in-current)) + (helm-multi-occur-1 buf-list input))) + +(provide 'helm-occur) + +;; Local Variables: +;; byte-compile-warnings: (not obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-occur.el ends here diff --git a/elpa/helm-20190122.549/helm-pkg.el b/elpa/helm-20191031.725/helm-pkg.el similarity index 76% rename from elpa/helm-20190122.549/helm-pkg.el rename to elpa/helm-20191031.725/helm-pkg.el index 524303aa..fa05c8c3 100644 --- a/elpa/helm-20190122.549/helm-pkg.el +++ b/elpa/helm-20191031.725/helm-pkg.el @@ -1,4 +1,4 @@ -(define-package "helm" "20190122.549" "Helm is an Emacs incremental and narrowing framework" +(define-package "helm" "20191031.725" "Helm is an Emacs incremental and narrowing framework" '((emacs "24.4") (async "1.9.3") (popup "0.5.3") diff --git a/elpa/helm-20191031.725/helm-regexp.el b/elpa/helm-20191031.725/helm-regexp.el new file mode 100644 index 00000000..8c2e2b3e --- /dev/null +++ b/elpa/helm-20191031.725/helm-regexp.el @@ -0,0 +1,138 @@ +;;; helm-regexp.el --- In buffer regexp searching and replacement for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(require 'cl-lib) +(require 'helm) +(require 'helm-help) +(require 'helm-utils) + +(declare-function helm-mm-split-pattern "helm-multi-match") + + +(defgroup helm-regexp nil + "Regexp related Applications and libraries for Helm." + :group 'helm) + + + +;; History vars +(defvar helm-build-regexp-history nil) + +(defun helm-query-replace-regexp (_candidate) + "Query replace regexp from `helm-regexp'. +With a prefix arg replace only matches surrounded by word boundaries, +i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b." + (let ((regexp helm-input)) + (apply 'query-replace-regexp + (helm-query-replace-args regexp)))) + +(defun helm-kill-regexp-as-sexp (_candidate) + "Kill regexp in a format usable in lisp code." + (helm-regexp-kill-new + (prin1-to-string helm-input))) + +(defun helm-kill-regexp (_candidate) + "Kill regexp as it is in `helm-pattern'." + (helm-regexp-kill-new helm-input)) + +(defun helm-query-replace-args (regexp) + "create arguments of `query-replace-regexp' action in `helm-regexp'." + (let ((region-only (helm-region-active-p))) + (list + regexp + (query-replace-read-to regexp + (format "Query replace %sregexp %s" + (if helm-current-prefix-arg "word " "") + (if region-only "in region " "")) + t) + helm-current-prefix-arg + (when region-only (region-beginning)) + (when region-only (region-end))))) + +(defvar helm-source-regexp + (helm-build-in-buffer-source "Regexp Builder" + :init (lambda () + (helm-init-candidates-in-buffer + 'global (with-temp-buffer + (insert-buffer-substring helm-current-buffer) + (buffer-string)))) + :get-line #'helm-regexp-get-line + :persistent-action #'helm-regexp-persistent-action + :persistent-help "Show this line" + :multiline t + :multimatch nil + :requires-pattern 2 + :group 'helm-regexp + :mode-line "Press TAB to select action." + :action '(("Kill Regexp as sexp" . helm-kill-regexp-as-sexp) + ("Query Replace Regexp (C-u Not inside word.)" + . helm-query-replace-regexp) + ("Kill Regexp" . helm-kill-regexp)))) + +(defun helm-regexp-get-line (s e) + (let ((matches (match-data)) + (line (buffer-substring s e))) + (propertize + (cl-loop with ln = (format "%5d: %s" (1- (line-number-at-pos s)) line) + for i from 0 to (1- (/ (length matches) 2)) + if (match-string i) + concat (format "\n%s%s'%s'" + (make-string 10 ? ) (format "Group %d: " i) it) + into ln1 + finally return (concat ln ln1)) + 'helm-realvalue s))) + +(defun helm-regexp-persistent-action (pt) + (helm-goto-char pt) + (helm-highlight-current-line)) + +(defun helm-regexp-kill-new (input) + (kill-new (substring-no-properties input)) + (message "Killed: %s" input)) + + +;;; Predefined commands +;; +;; + +;;;###autoload +(defun helm-regexp () + "Preconfigured helm to build regexps. +`query-replace-regexp' can be run from there against found regexp." + (interactive) + (save-restriction + (when (and (helm-region-active-p) + ;; Don't narrow to region if buffer is already narrowed. + (not (helm-current-buffer-narrowed-p (current-buffer)))) + (narrow-to-region (region-beginning) (region-end))) + (helm :sources helm-source-regexp + :buffer "*helm regexp*" + :prompt "Regexp: " + :history 'helm-build-regexp-history))) + + +(provide 'helm-regexp) + +;; Local Variables: +;; byte-compile-warnings: (not obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-regexp.el ends here diff --git a/elpa/helm-20190122.549/helm-ring.el b/elpa/helm-20191031.725/helm-ring.el similarity index 93% rename from elpa/helm-20190122.549/helm-ring.el rename to elpa/helm-20191031.725/helm-ring.el index f28a16ec..f4504d53 100644 --- a/elpa/helm-20190122.549/helm-ring.el +++ b/elpa/helm-20191031.725/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 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -74,6 +74,7 @@ will not have anymore separators between candidates." (define-key map (kbd "M-D") 'helm-kill-ring-delete) (define-key map (kbd "C-]") 'helm-kill-ring-toggle-truncated) (define-key map (kbd "C-c C-k") 'helm-kill-ring-kill-selection) + (define-key map (kbd "C-c d") 'helm-kill-ring-run-persistent-delete) map) "Keymap for `helm-show-kill-ring'.") @@ -219,6 +220,27 @@ replace with STR as yanked string." do (setq kill-ring (delete c kill-ring)))) +(defun helm-kill-ring-persistent-delete (_candidate) + (unwind-protect + (cl-loop for c in (helm-marked-candidates) + do (progn + (helm-preselect (format "^%s" (regexp-quote c))) + (setq kill-ring (delete c kill-ring)) + (helm-delete-current-selection) + (helm--remove-marked-and-update-mode-line c))) + (with-helm-buffer + (setq helm-marked-candidates nil + 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 () + "Delete current candidate without quitting." + (interactive) + (with-helm-alive-p + (helm-attrset '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) + (defun helm-kill-ring-delete () "Delete marked candidates from `kill-ring'. @@ -226,6 +248,7 @@ 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) ;;;; @@ -384,16 +407,17 @@ This is a command for `helm-kill-ring-map'." (list (format "%s: %s\n" lines (truncate-string-to-width (mapconcat 'identity (list (car val)) - "^J") (- (window-width) 15))) + "^J") + (- (window-width) 15))) 'insert-register))) ((stringp val) (list - ;; without properties (concat (substring-no-properties val 0 (min (length val) helm-register-max-offset)) (if (> (length val) helm-register-max-offset) "[...]" "")) 'insert-register + 'kill-new 'append-to-register 'prepend-to-register))) unless (null string-actions) ; Fix Issue #1107. @@ -406,6 +430,11 @@ This is a command for `helm-kill-ring-map'." '((insert-register "Insert Register" . (lambda (c) (insert-register (car c)))) + (kill-new + "Kill Register" . + (lambda (c) (with-temp-buffer + (insert-register (car c)) + (kill-new (buffer-string))))) (jump-to-register "Jump to Register" . (lambda (c) (jump-to-register (car c)))) diff --git a/elpa/helm-20190122.549/helm-semantic.el b/elpa/helm-20191031.725/helm-semantic.el similarity index 94% rename from elpa/helm-20190122.549/helm-semantic.el rename to elpa/helm-20191031.725/helm-semantic.el index 402abb60..f5691244 100644 --- a/elpa/helm-20190122.549/helm-semantic.el +++ b/elpa/helm-20191031.725/helm-semantic.el @@ -1,7 +1,7 @@ ;;; helm-semantic.el --- Helm interface for Semantic -*- lexical-binding: t -*- ;; Copyright (C) 2012 ~ 2017 Daniel Hackney -;; 2012 ~ 2018 Thierry Volpiatto +;; 2012 ~ 2019 Thierry Volpiatto ;; Author: Daniel Hackney @@ -35,11 +35,6 @@ "Semantic tags related libraries and applications for helm." :group 'helm) -(defcustom helm-semantic-lynx-style-map t - "Use Arrow keys to jump to occurences." - :group 'helm-semantic - :type 'boolean) - (defcustom helm-semantic-display-style '((python-mode . semantic-format-tag-summarize) (c-mode . semantic-format-tag-concise-prototype-c-mode) @@ -64,10 +59,20 @@ you have completion on these functions with `C-M i' in the customize interface." (defvar helm-semantic-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (when helm-semantic-lynx-style-map - (define-key map (kbd "") 'helm-maybe-exit-minibuffer) - (define-key map (kbd "") 'helm-execute-persistent-action)) - (delq nil map))) + map)) + +(defcustom helm-semantic-lynx-style-map nil + "Use Arrow keys to jump to occurences." + :group 'helm-semantic + :type 'boolean + :set (lambda (var val) + (set var val) + (if val + (progn + (define-key helm-semantic-map (kbd "") 'helm-execute-persistent-action) + (define-key helm-semantic-map (kbd "") 'helm-maybe-exit-minibuffer)) + (define-key helm-semantic-map (kbd "") nil) + (define-key helm-semantic-map (kbd "") nil)))) ;; Internals vars (defvar helm-semantic--tags-cache nil) diff --git a/elpa/helm-20191031.725/helm-shell.el b/elpa/helm-20191031.725/helm-shell.el new file mode 100644 index 00000000..5f946dc5 --- /dev/null +++ b/elpa/helm-20191031.725/helm-shell.el @@ -0,0 +1,44 @@ +;;; helm-shell.el --- Shell prompt navigation for helm. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Pierre Neidhardt + +;; 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: +;; +;; This is superseded by helm-comint.el. + +;;; Code: +(require 'cl-lib) +(require 'helm) +(require 'helm-lib) +(require 'helm-help) +(require 'helm-elisp) +(require 'helm-comint) + +;;;###autoload +(defalias 'helm-shell-prompts 'helm-comint-prompts) + +;;;###autoload +(defalias 'helm-shell-prompts-all 'helm-comint-prompts-all) + +(provide 'helm-shell) + +;; Local Variables: +;; byte-compile-warnings: (not obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-shell ends here diff --git a/elpa/helm-20190122.549/helm-sys.el b/elpa/helm-20191031.725/helm-sys.el similarity index 97% rename from elpa/helm-20190122.549/helm-sys.el rename to elpa/helm-20191031.725/helm-sys.el index 9ec918d2..cfe015ec 100644 --- a/elpa/helm-20190122.549/helm-sys.el +++ b/elpa/helm-20191031.725/helm-sys.el @@ -1,6 +1,6 @@ ;;; helm-sys.el --- System related functions for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -427,15 +427,13 @@ Show actions only on line starting by a PID." "Preconfigured `helm' for top command." (interactive) (add-hook 'helm-after-update-hook 'helm-top--skip-top-line) - (save-window-excursion - (unless helm-alive-p (delete-other-windows)) - (unwind-protect - (helm :sources 'helm-source-top - :buffer "*helm top*" :full-frame t - :candidate-number-limit 9999 - :preselect "^\\s-*[0-9]+" - :truncate-lines helm-show-action-window-other-window) - (remove-hook 'helm-after-update-hook 'helm-top--skip-top-line)))) + (unwind-protect + (helm :sources 'helm-source-top + :buffer "*helm top*" :full-frame t + :candidate-number-limit 9999 + :preselect "^\\s-*[0-9]+" + :truncate-lines helm-show-action-window-other-window) + (remove-hook 'helm-after-update-hook 'helm-top--skip-top-line))) ;;;###autoload (defun helm-list-emacs-process () diff --git a/elpa/helm-20190122.549/helm-tags.el b/elpa/helm-20191031.725/helm-tags.el similarity index 96% rename from elpa/helm-20190122.549/helm-tags.el rename to elpa/helm-20191031.725/helm-tags.el index 88fc9043..782e87b4 100644 --- a/elpa/helm-20190122.549/helm-tags.el +++ b/elpa/helm-20191031.725/helm-tags.el @@ -1,6 +1,6 @@ ;;; helm-tags.el --- Helm for Etags. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -329,9 +329,12 @@ Create with etags shell command, or visit with `find-tag' or `visit-tags-table'. (helm-etags-build-source))) (helm :sources 'helm-source-etags-select :keymap helm-etags-map - :default (if helm-etags-fuzzy-match - str - (list (concat "\\_<" str "\\_>") str)) + :default (and (stringp str) + (if (or helm-etags-fuzzy-match + (and (eq major-mode 'haskell-mode) + (string-match "[']\\'" str))) + str + (list (concat "\\_<" str "\\_>") str))) :buffer "*helm etags*")))) (provide 'helm-tags) diff --git a/elpa/helm-20190122.549/helm-types.el b/elpa/helm-20191031.725/helm-types.el similarity index 96% rename from elpa/helm-20190122.549/helm-types.el rename to elpa/helm-20191031.725/helm-types.el index 15de27e7..868e7974 100644 --- a/elpa/helm-20190122.549/helm-types.el +++ b/elpa/helm-20191031.725/helm-types.el @@ -1,6 +1,6 @@ ;;; helm-types.el --- Helm types classes and methods. -*- lexical-binding: t -*- -;; Copyright (C) 2015 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2015 ~ 2019 Thierry Volpiatto ;; Author: Thierry Volpiatto ;; URL: http://github.com/emacs-helm/helm @@ -167,18 +167,22 @@ 'helm-buffer-switch-buffers-other-window "Switch to buffer other frame `C-c C-o'" 'switch-to-buffer-other-frame - "Browse project from buffer" + (lambda () (and (fboundp 'tab-bar-mode) + "Switch to buffer other tab `C-c C-t'")) + 'switch-to-buffer-other-tab + "Browse project `C-x C-d'" 'helm-buffers-browse-project "Query replace regexp `C-M-%'" 'helm-buffer-query-replace-regexp "Query replace `M-%'" 'helm-buffer-query-replace "View buffer" 'view-buffer "Display buffer" 'display-buffer - "Rename buffer" 'helm-buffers-rename-buffer - "Grep buffers `M-g s' (C-u grep all buffers)" + "Rename buffer `M-R'" 'helm-buffers-rename-buffer + "Grep buffer(s) `M-g s' (C-u grep all buffers)" 'helm-zgrep-buffers - "Multi occur buffer(s) `C-s'" 'helm-multi-occur-as-action - "Revert buffer(s) `M-U'" 'helm-revert-marked-buffers + "Multi occur buffer(s) `C-s (C-u search also in current)'" + 'helm-multi-occur-as-action + "Revert buffer(s) `M-G'" 'helm-revert-marked-buffers "Insert buffer" 'insert-buffer "Kill buffer(s) `M-D'" 'helm-kill-marked-buffers "Diff with file `C-='" 'diff-buffer-with-file diff --git a/elpa/helm-20190122.549/helm-utils.el b/elpa/helm-20191031.725/helm-utils.el similarity index 94% rename from elpa/helm-20190122.549/helm-utils.el rename to elpa/helm-20191031.725/helm-utils.el index 0364aa27..7593ecd5 100644 --- a/elpa/helm-20190122.549/helm-utils.el +++ b/elpa/helm-20191031.725/helm-utils.el @@ -1,6 +1,6 @@ ;;; helm-utils.el --- Utilities Functions for helm. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -24,6 +24,12 @@ (declare-function helm-find-files-1 "helm-files.el" (fname &optional preselect)) (declare-function popup-tip "ext:popup") +(declare-function markdown-show-subtree "outline.el") +(declare-function outline-show-subtree "outline.el") +(declare-function org-reveal "org.el") +(declare-function tab-bar-tabs "tab-bar.el") +(declare-function tab-bar-select-tab "tab-bar.el") +(defvar org-directory) (defvar winner-boring-buffers) (defvar helm-show-completion-overlay) @@ -264,7 +270,37 @@ If a prefix arg is given split windows vertically." (and other-window initial-ow-fn)) (if other-window (funcall initial-ow-fn (car buffers)) - (switch-to-buffer (car buffers)))))) + (helm-buffers-switch-to-buffer-or-tab (car buffers)))))) + +(defun helm-buffers-switch-to-buffer-or-tab (buffer) + "Switch to BUFFER in its tab if some." + (if (and (fboundp 'tab-bar-mode) + helm-buffers-maybe-switch-to-tab) + (let* ((tabs (tab-bar-tabs)) + (tab-names (mapcar (lambda (tab) + (cdr (assq 'name tab))) + (tab-bar-tabs))) + (bname (buffer-name (get-buffer buffer))) + (tab (helm-buffers--get-tab-from-name bname tabs))) + (if (helm-buffers--buffer-in-tab-p bname tab-names) + (progn + (tab-bar-select-tab tab) + (select-window (get-buffer-window bname))) + (switch-to-buffer buffer))) + (switch-to-buffer buffer))) + +(defun helm-buffers--get-tab-from-name (tab-name tabs) + "Return tab from TABS when it contains TAB-NAME." + (cl-loop for tab in tabs + when (member tab-name (split-string (cdr (assq 'name tab)) ", " t)) + return tab)) + +(defun helm-buffers--buffer-in-tab-p (buffer-name tab-names) + "Check if BUFFER-NAME is in TAB-NAMES list." + (cl-loop for name in tab-names + ;; Buf names are separated with "," in TAB-NAMES + ;; e.g. '("tab-bar.el" "*scratch*, helm-buffers.el"). + thereis (member buffer-name (split-string name ", " t)))) (defun helm-window-default-split-fn (candidates &optional other-window-fn) "Split windows in one direction and balance them. @@ -405,12 +441,17 @@ Default is `helm-current-buffer'." (defun helm-goto-char (loc) "Go to char, revealing if necessary." - (require 'org) ; On some old Emacs versions org may not be loaded. (goto-char loc) - (let ((fn (cond ((eq major-mode 'org-mode) #'org-reveal) + (let ((fn (cond ((eq major-mode 'org-mode) + ;; On some old Emacs versions org may not be loaded. + (require 'org) + #'org-reveal) ((and (boundp 'outline-minor-mode) outline-minor-mode) - (lambda () (outline-flag-subtree nil)))))) + #'outline-show-subtree) + ((and (boundp 'markdown-mode-map) + (derived-mode-p 'markdown-mode)) + #'markdown-show-subtree)))) ;; outline may fail in some conditions e.g. with markdown enabled ;; (issue #1919). (condition-case nil @@ -578,7 +619,8 @@ that is sorting is done against real value of candidate." (reg1 (concat "\\_<" qpattern "\\_>")) (reg2 (concat "\\_<" qpattern)) (reg3 helm-pattern) - (split (helm-mm-split-pattern helm-pattern)) + (split (helm-remove-if-match + "\\`!" (helm-mm-split-pattern helm-pattern))) (str1 (if (consp s1) (cdr s1) s1)) (str2 (if (consp s2) (cdr s2) s2)) (score (lambda (str r1 r2 r3 lst) @@ -588,10 +630,12 @@ that is sorting is done against real value of candidate." (string-match (concat "\\_<" (regexp-quote (car lst))) str) (cl-loop for r in (cdr lst) - always (string-match r str))) 4) + always (string-match r str))) + 4) ((and (string-match " " qpattern) (cl-loop for r in lst - always (string-match r str))) 3) + always (string-match r str))) + 3) ((string-match r2 str) 2) ((string-match r3 str) 1) (t 0))))) diff --git a/elpa/helm-20190122.549/helm-x-files.el b/elpa/helm-20191031.725/helm-x-files.el similarity index 98% rename from elpa/helm-20190122.549/helm-x-files.el rename to elpa/helm-20191031.725/helm-x-files.el index 7aad88a4..3dc9639f 100644 --- a/elpa/helm-20190122.549/helm-x-files.el +++ b/elpa/helm-20191031.725/helm-x-files.el @@ -1,6 +1,6 @@ ;;; helm-x-files.el --- helm auxiliary functions and sources. -*- lexical-binding: t -*- -;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2012 ~ 2019 Thierry Volpiatto ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/helm-bibtex-20191028.1313/bibtex-completion.el b/elpa/helm-bibtex-20191028.1313/bibtex-completion.el new file mode 100644 index 00000000..c81cf76b --- /dev/null +++ b/elpa/helm-bibtex-20191028.1313/bibtex-completion.el @@ -0,0 +1,1507 @@ +;;; 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-autoloads.el b/elpa/helm-bibtex-20191028.1313/helm-bibtex-autoloads.el new file mode 100644 index 00000000..dbbedc16 --- /dev/null +++ b/elpa/helm-bibtex-20191028.1313/helm-bibtex-autoloads.el @@ -0,0 +1,46 @@ +;;; helm-bibtex-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(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)) +;;; Generated autoloads from helm-bibtex.el + +(autoload 'helm-bibtex "helm-bibtex" "\ +Search BibTeX entries. + +With a prefix ARG, the cache is invalidated and the bibliography +reread. + +If LOCAL-BIB is non-nil, display that the BibTeX entries are read +from the local bibliography. This is set internally by +`helm-bibtex-with-local-bibliography'. + +If INPUT is non-nil and a string, that value is going to be used +as a predefined search term. Can be used to define functions for +frequent searches (e.g. your own publications). + +\(fn &optional ARG LOCAL-BIB INPUT)" t nil) + +(autoload 'helm-bibtex-with-local-bibliography "helm-bibtex" "\ +Search BibTeX entries with local bibliography. + +With a prefix ARG the cache is invalidated and the bibliography +reread. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("bibtex-completion.el" "helm-bibtex-pkg.el") +;;;;;; (23994 46472 967885 790000)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; helm-bibtex-autoloads.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 new file mode 100644 index 00000000..b1b0ce89 --- /dev/null +++ b/elpa/helm-bibtex-20191028.1313/helm-bibtex-pkg.el @@ -0,0 +1,15 @@ +(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.el b/elpa/helm-bibtex-20191028.1313/helm-bibtex.el new file mode 100644 index 00000000..154a862d --- /dev/null +++ b/elpa/helm-bibtex-20191028.1313/helm-bibtex.el @@ -0,0 +1,262 @@ +;;; helm-bibtex.el --- A bibliography manager based on Helm + +;; 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")) + +;; 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 bibliography manager for Emacs, based on Helm and the +;; bibtex-completion backend. +;; +;; News: +;; - 09/06/2018: Added virtual APA field `author-or-editor` for use in +;; notes templates. +;; - 02/06/2018: Reload bibliography proactively when bib files are +;; changed. +;; - 21/10/2017: Added support for multiple PDFs and other file +;; types. See `bibtex-completion-pdf-extension' and +;; `bibtex-completion-find-additional-pdfs' for details. +;; - 10/10/2017: Added support for ~@string~ constants. +;; - 02/10/2017: Date field is used when year is undefined. +;; - 29/09/2017: BibTeX entry, citation macro, or org-bibtex entry at +;; point, will be pre-selected in helm-bibtex and ivy-bibtex giving +;; quick access to PDFs and other functions. +;; +;; See NEWS.org for old news. +;; +;; Key features: +;; - Quick access to your bibliography from within Emacs +;; - Powerful search capabilities +;; - Provides instant search results as you type +;; - Tightly integrated with LaTeX authoring, emails, Org mode, etc. +;; - Open the PDFs, URLs, or DOIs associated with an entry +;; - Insert LaTeX cite commands, Ebib links, or Pandoc citations, +;; BibTeX entries, or plain text references at point, attach PDFs to +;; emails +;; - Support for note taking +;; - Quick access to online bibliographic databases such as Pubmed, +;; arXiv, Google Scholar, Library of Congress, etc. +;; - Imports BibTeX entries from CrossRef and other sources. +;; +;; See the github page for details: +;; +;; https://github.com/tmalsburg/helm-bibtex + +;;; Install: + +;; Put this file in a directory included in your load path or install +;; helm-bibtex from MELPA (preferred). Then add the following in your +;; Emacs startup file: +;; +;; (require 'helm-bibtex) +;; +;; Alternatively, you can use autoload: +;; +;; (autoload 'helm-bibtex "helm-bibtex" "" t) +;; +;; Requirements are parsebib, helm, s, dash, and f. The easiest way +;; to install these packages is through MELPA. Make sure helm is +;; properly configured (see +;; https://github.com/emacs-helm/helm#install-from-emacs-packaging-system). +;; +;; Let helm-bibtex know where it can find your bibliography by setting +;; the variable `bibtex-completion-bibliography'. See the manual for +;; more details: +;; +;; https://github.com/tmalsburg/helm-bibtex#minimal-configuration + +;;; Usage: + +;; You can search entries using the command `helm-bibtex'. Select an +;; entry and press TAB to access all available actions. At the end of +;; the list of matches you find some dummy entries that can be used +;; for searching in online databases. Apart from that, familiarize +;; yourself with Helm. It's more powerful that you might think. + +;;; Code: + +(require 'helm) +(require 'helm-net) +(require 'helm-easymenu) +(require 'bibtex-completion) + +;; Silence the byte compiler +(eval-when-compile (defvar helm-bibtex-local-bib)) + +;; The following allows people to continue using their old helm-bibtex +;; configurations: + +(cl-loop + for var in '("bibliography" "library-path" "pdf-open-function" + "pdf-symbol" "format-citation-functions" "notes-path" + "notes-template-multiple-files" + "notes-template-one-file" "notes-key-pattern" + "notes-extension" "notes-symbol" "fallback-options" + "browser-function" "additional-search-fields" + "no-export-fields" "cite-commands" + "cite-default-command" + "cite-prompt-for-optional-arguments" + "cite-default-as-initial-input" "pdf-field") + for oldvar = (intern (concat "helm-bibtex-" var)) + for newvar = (intern (concat "bibtex-completion-" var)) + do + (define-obsolete-variable-alias oldvar newvar "2016-03-20")) + +;; Helm-specific configurations: + +(defcustom helm-bibtex-full-frame t + "Non-nil means open `helm-bibtex' using the entire window. +When nil, the window will split below." + :group 'bibtex-completion + :type 'boolean) + +(easy-menu-add-item nil '("Tools" "Helm" "Tools") ["BibTeX" helm-bibtex t]) + +;; Candidate formatter: + +;; The function `window-width' does not necessarily report the correct +;; number of characters that fit on a line. This is a +;; work-around. See also this bug report: +;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19395 +(defun helm-bibtex-window-width () + "Return the width of the window to pass to `helm-bibtex-candidates-formatter'." + (1- (window-body-width))) + +(defun helm-bibtex-candidates-formatter (candidates _) + "Format CANDIDATES for display in helm." + (cl-loop + with width = (with-helm-window (helm-bibtex-window-width)) + for entry in candidates + for entry = (cdr entry) + for entry-key = (bibtex-completion-get-value "=key=" entry) + collect (cons (bibtex-completion-format-entry entry width) entry-key))) + +;; Warp bibtex-completion actions with some helm-specific code: + +(defmacro helm-bibtex-helmify-action (action name) + "Wrap ACTION in another function NAME. +Then pass the candidates marked in helm to ACTION. Also uses +`with-helm-current-buffer' such that when ACTION inserts text it +comes out in the right buffer." + `(defun ,name (_) + (let ((keys (helm-marked-candidates :with-wildcard t))) + (with-helm-current-buffer + (,action keys))))) + +(helm-bibtex-helmify-action bibtex-completion-open-pdf helm-bibtex-open-pdf) +(helm-bibtex-helmify-action bibtex-completion-open-url-or-doi helm-bibtex-open-url-or-doi) +(helm-bibtex-helmify-action bibtex-completion-open-any helm-bibtex-open-any) +(helm-bibtex-helmify-action bibtex-completion-insert-citation helm-bibtex-insert-citation) +(helm-bibtex-helmify-action bibtex-completion-insert-reference helm-bibtex-insert-reference) +(helm-bibtex-helmify-action bibtex-completion-insert-key helm-bibtex-insert-key) +(helm-bibtex-helmify-action bibtex-completion-insert-bibtex helm-bibtex-insert-bibtex) +(helm-bibtex-helmify-action bibtex-completion-add-PDF-attachment helm-bibtex-add-PDF-attachment) +(helm-bibtex-helmify-action bibtex-completion-edit-notes helm-bibtex-edit-notes) +(helm-bibtex-helmify-action bibtex-completion-show-entry helm-bibtex-show-entry) +(helm-bibtex-helmify-action bibtex-completion-add-pdf-to-library helm-bibtex-add-pdf-to-library) + +;; Helm sources: + +(defvar helm-source-bibtex + (helm-build-sync-source "BibTeX entries" + :header-name (lambda (name) + (format "%s%s: " name (if helm-bibtex-local-bib " (local)" ""))) + :candidates 'helm-bibtex-candidates + :filtered-candidate-transformer 'helm-bibtex-candidates-formatter + :action (helm-make-actions + "Open PDF, URL or DOI" 'helm-bibtex-open-any + "Open URL or DOI in browser" 'helm-bibtex-open-url-or-doi + "Insert citation" 'helm-bibtex-insert-citation + "Insert reference" 'helm-bibtex-insert-reference + "Insert BibTeX key" 'helm-bibtex-insert-key + "Insert BibTeX entry" 'helm-bibtex-insert-bibtex + "Attach PDF to email" 'helm-bibtex-add-PDF-attachment + "Edit notes" 'helm-bibtex-edit-notes + "Show entry" 'helm-bibtex-show-entry + "Add PDF to library" 'helm-bibtex-add-pdf-to-library)) + "Source for searching in BibTeX files.") + +(defvar helm-source-fallback-options + '((name . "Fallback options") + (match (lambda (_candidate) t)) + (candidates . bibtex-completion-fallback-candidates) + (no-matchplugin) + (nohighlight) + (action . (lambda (candidate) (bibtex-completion-fallback-action candidate helm-pattern)))) + "Source for online look-up.") + +;; Helm-bibtex command: + +;;;###autoload +(defun helm-bibtex (&optional arg local-bib input) + "Search BibTeX entries. + +With a prefix ARG, the cache is invalidated and the bibliography +reread. + +If LOCAL-BIB is non-nil, display that the BibTeX entries are read +from the local bibliography. This is set internally by +`helm-bibtex-with-local-bibliography'. + +If INPUT is non-nil and a string, that value is going to be used +as a predefined search term. Can be used to define functions for +frequent searches (e.g. your own publications)." + (interactive "P") + (when arg + (bibtex-completion-clear-cache)) + (bibtex-completion-init) + (let* ((candidates (bibtex-completion-candidates)) + (key (bibtex-completion-key-at-point)) + (preselect (and key + (cl-position-if (lambda (cand) + (member (cons "=key=" key) + (cdr cand))) + candidates)))) + (helm :sources (list helm-source-bibtex helm-source-fallback-options) + :full-frame helm-bibtex-full-frame + :buffer "*helm bibtex*" + :input input + :preselect (lambda () + (and preselect + (> preselect 0) + (helm-next-line preselect))) + :candidate-number-limit (max 500 (1+ (or preselect 0))) + :bibtex-candidates candidates + :bibtex-local-bib local-bib))) + +;;;###autoload +(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." + (interactive "P") + (let* ((local-bib (bibtex-completion-find-local-bibliography)) + (bibtex-completion-bibliography (or local-bib + bibtex-completion-bibliography))) + (helm-bibtex arg local-bib))) + +(provide 'helm-bibtex) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions obsolete) +;; coding: utf-8 +;; indent-tabs-mode: nil +;; End: + +;;; helm-bibtex.el ends here diff --git a/elpa/helm-core-20190122.549/helm-core-autoloads.el b/elpa/helm-core-20191013.626/helm-core-autoloads.el similarity index 83% rename from elpa/helm-core-20190122.549/helm-core-autoloads.el rename to elpa/helm-core-20191013.626/helm-core-autoloads.el index adc09a32..889e8baf 100644 --- a/elpa/helm-core-20190122.549/helm-core-autoloads.el +++ b/elpa/helm-core-20191013.626/helm-core-autoloads.el @@ -1,12 +1,9 @@ ;;; helm-core-autoloads.el --- automatically extracted autoloads ;; ;;; 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" "helm.el" (0 0 0 0)) +;;;### (autoloads nil "helm" "helm.el" (23994 46468 951673 745000)) ;;; Generated autoloads from helm.el (autoload 'helm-define-multi-key "helm" "\ @@ -56,7 +53,8 @@ Arg OTHER-SUBKEYS is an alist specifying other short key-bindings to use once started e.g: (helm-define-key-with-subkeys global-map - (kbd \"C-x v n\") ?n 'git-gutter:next-hunk '((?p . git-gutter:previous-hunk))) + (kbd \"C-x v n\") ?n 'git-gutter:next-hunk + '((?p . git-gutter:previous-hunk))) In this example, `C-x v n' will run `git-gutter:next-hunk' @@ -222,33 +220,10 @@ Call `helm' only with ANY-SOURCES and ANY-BUFFER as args. \(fn ANY-SOURCES ANY-BUFFER)" nil nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm" '("helm-" "with-helm-"))) - -;;;*** - -;;;### (autoloads nil "helm-lib" "helm-lib.el" (0 0 0 0)) -;;; Generated autoloads from helm-lib.el - -(if (fboundp 'register-definition-prefixes) (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 - -(if (fboundp 'register-definition-prefixes) (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 - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-source" '("helm-"))) - ;;;*** -;;;### (autoloads nil nil ("helm-core-pkg.el") (0 0 0 0)) +;;;### (autoloads nil nil ("helm-core-pkg.el" "helm-lib.el" "helm-multi-match.el" +;;;;;; "helm-source.el") (23994 46468 953271 677000)) ;;;*** @@ -256,6 +231,5 @@ Call `helm' only with ANY-SOURCES and ANY-BUFFER as args. ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; helm-core-autoloads.el ends here diff --git a/elpa/helm-core-20190122.549/helm-core-pkg.el b/elpa/helm-core-20191013.626/helm-core-pkg.el similarity index 69% rename from elpa/helm-core-20190122.549/helm-core-pkg.el rename to elpa/helm-core-20191013.626/helm-core-pkg.el index cd981568..b787ffa7 100644 --- a/elpa/helm-core-20190122.549/helm-core-pkg.el +++ b/elpa/helm-core-20191013.626/helm-core-pkg.el @@ -1,4 +1,4 @@ -(define-package "helm-core" "20190122.549" "Development files for Helm" +(define-package "helm-core" "20191013.626" "Development files for Helm" '((emacs "24.4") (async "1.9.3")) :url "https://emacs-helm.github.io/helm/") diff --git a/elpa/helm-core-20190122.549/helm-lib.el b/elpa/helm-core-20191013.626/helm-lib.el similarity index 94% rename from elpa/helm-core-20190122.549/helm-lib.el rename to elpa/helm-core-20191013.626/helm-lib.el index 342b68c2..f8366bff 100644 --- a/elpa/helm-core-20190122.549/helm-lib.el +++ b/elpa/helm-core-20191013.626/helm-lib.el @@ -1,6 +1,6 @@ ;;; helm-lib.el --- Helm routines. -*- lexical-binding: t -*- -;; Copyright (C) 2015 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2015 ~ 2019 Thierry Volpiatto ;; Author: Thierry Volpiatto ;; URL: http://github.com/emacs-helm/helm @@ -24,8 +24,19 @@ ;;; Code: (require 'cl-lib) -(eval-when-compile (require 'wdired)) +(declare-function wdired-change-to-dired-mode "wdired.el") +(declare-function wdired-do-symlink-changes "wdired.el") +(declare-function wdired-do-perm-changes "wdired.el") +(declare-function wdired-get-filename "wdired.el") +(declare-function wdired-do-renames "wdired.el") +(declare-function wdired-flag-for-deletion "wdired.el") +(declare-function wdired-normalize-filename "wdired.el") +(declare-function dired-mark-remembered "dired.el") +(declare-function dired-log-summary "dired.el") +(declare-function dired-current-directory "dired.el") +(declare-function ansi-color--find-face "ansi-color.el") +(declare-function ansi-color-apply-sequence "ansi-color.el") (declare-function helm-get-sources "helm.el") (declare-function helm-marked-candidates "helm.el") (declare-function helm-follow-mode-p "helm.el") @@ -37,10 +48,15 @@ (declare-function org-mark-ring-push "org.el") (declare-function helm-interpret-value "helm.el") (declare-function helm-get-current-source "helm.el") +(declare-function helm-source--cl--print-table "helm-source.el") + (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) ;;; User vars. @@ -117,6 +133,16 @@ customize functions e.g. `customize-set-variable' and NOT `setq'." :type '(repeat (choice regexp)) :set 'helm-ff--setup-boring-regex) +(defcustom helm-describe-function-function 'describe-function + "Function used to describe functions in Helm." + :group 'helm-elisp + :type 'function) + +(defcustom helm-describe-variable-function 'describe-variable + "Function used to describe variables in Helm." + :group 'helm-elisp + :type 'function) + ;;; Internal vars ;; @@ -460,15 +486,17 @@ usable in next condition." "A simple anaphoric `cl-case' implementation handling strings. EXPR is bound to a temporary variable called `it' which is usable in CLAUSES to refer to EXPR. -NOTE: Duplicate keys in CLAUSES are deliberately not handled." - (declare (indent 1) (debug t)) +NOTE: Duplicate keys in CLAUSES are deliberately not handled. + +\(fn EXPR (KEYLIST BODY...)...)" + (declare (indent 1) (debug (form &rest (sexp body)))) (unless (null clauses) (let ((clause1 (car clauses))) `(let ((key ',(car clause1)) (it ,expr)) (if (or (equal it key) - (eq key t) - (and (listp key) (member it key))) + (and (listp key) (member it key)) + (eq key t)) (progn ,@(cdr clause1)) (helm-acase it ,@(cdr clauses))))))) @@ -958,18 +986,26 @@ Example: "Anonymous" (symbol-name obj))) +(defun helm-describe-class (class) + "Display documentation of Eieio CLASS, a symbol or a string." + (advice-add 'cl--print-table :override #'helm-source--cl--print-table) + (unwind-protect + (let ((helm-describe-function-function 'describe-function)) + (helm-describe-function class)) + (advice-remove 'cl--print-table #'helm-source--cl--print-table))) + (defun helm-describe-function (func) - "FUNC is symbol or string." + "Display documentation of FUNC, a symbol or string." (cl-letf (((symbol-function 'message) #'ignore)) - (describe-function (helm-symbolify func)))) + (funcall helm-describe-function-function (helm-symbolify func)))) (defun helm-describe-variable (var) - "VAR is symbol or string." + "Display documentation of VAR, a symbol or a string." (cl-letf (((symbol-function 'message) #'ignore)) - (describe-variable (helm-symbolify var)))) + (funcall helm-describe-variable-function (helm-symbolify var)))) (defun helm-describe-face (face) - "FACE is symbol or string." + "Display documentation of FACE, a symbol or a string." (let ((faces (helm-marked-candidates))) (cl-letf (((symbol-function 'message) #'ignore)) (describe-face (if (cdr faces) @@ -992,10 +1028,21 @@ See `helm-elisp-show-help'." ;; When started from a help buffer, ;; Don't kill this buffer as it is helm-current-buffer. (unless (equal hbuf helm-current-buffer) + (kill-buffer hbuf) (set-window-buffer (get-buffer-window hbuf) - helm-current-buffer) - (kill-buffer hbuf)) - (helm-attrset 'help-running-p nil))) + ;; It is generally + ;; helm-current-buffer but it may + ;; be another buffer when helm have + ;; been started from a dedicated window. + (if helm--buffer-in-new-frame-p + helm-current-buffer + helm-persistent-action-window-buffer))) + (helm-attrset 'help-running-p nil)) + ;; Force running update hook to may be delete + ;; helm-persistent-action-display-window, this is done in + ;; helm-persistent-action-display-window (the function). + (unless helm--buffer-in-new-frame-p + (helm-update (regexp-quote (helm-get-selection))))) (t (if name (funcall fun candidate name) @@ -1277,6 +1324,14 @@ That is what completion commands operate on." `(with-selected-window (helm-window) ,@body)) +(defmacro helm-without-follow (&rest body) + "Ensure BODY runs without following. +I.e. when using `helm-next-line' and friends in BODY." + (declare (indent 0) (debug t)) + `(cl-letf (((symbol-function 'helm-follow-mode-p) + (lambda (&optional _) nil))) + (let (helm-follow-mode-persistent) + (progn ,@body)))) ;; Yank text at point. ;; diff --git a/elpa/helm-core-20190122.549/helm-multi-match.el b/elpa/helm-core-20191013.626/helm-multi-match.el similarity index 99% rename from elpa/helm-core-20190122.549/helm-multi-match.el rename to elpa/helm-core-20191013.626/helm-multi-match.el index 3d36bfea..e5d3c9da 100644 --- a/elpa/helm-core-20190122.549/helm-multi-match.el +++ b/elpa/helm-core-20191013.626/helm-multi-match.el @@ -3,7 +3,7 @@ ;; Original Author: rubikitch ;; Copyright (C) 2008 ~ 2011 rubikitch -;; Copyright (C) 2011 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2011 ~ 2019 Thierry Volpiatto ;; Author: Thierry Volpiatto ;; URL: http://github.com/emacs-helm/helm diff --git a/elpa/helm-core-20190122.549/helm-source.el b/elpa/helm-core-20191013.626/helm-source.el similarity index 95% rename from elpa/helm-core-20190122.549/helm-source.el rename to elpa/helm-core-20191013.626/helm-source.el index f656cc27..bcf434df 100644 --- a/elpa/helm-core-20190122.549/helm-source.el +++ b/elpa/helm-core-20191013.626/helm-source.el @@ -1,6 +1,6 @@ ;;; helm-source.el --- Helm source creation. -*- lexical-binding: t -*- -;; Copyright (C) 2015 ~ 2018 Thierry Volpiatto +;; Copyright (C) 2015 ~ 2019 Thierry Volpiatto ;; Author: Thierry Volpiatto ;; URL: http://github.com/emacs-helm/helm @@ -39,6 +39,18 @@ (declare-function helm-init-candidates-in-buffer "helm.el") (declare-function helm-interpret-value "helm.el") (declare-function helm-fuzzy-highlight-matches "helm.el") + +;;; Advice Emacs fn +;; Make Classes's docstrings more readable by removing al the +;; unnecessary crap. + +(defun helm-source--cl--print-table (_header rows) + "Advice for `cl--print-table' to make readable class slots docstrings." + (let ((format "%s\n\n Initform=%s\n\n%s")) + (dolist (row rows) + (setcar row (propertize (car row) 'face 'italic)) + (setcdr row (nthcdr 1 (cdr row))) + (insert "\n* " (apply #'format format row) "\n")))) (defgeneric helm--setup-source (source) @@ -104,7 +116,14 @@ Note that if the (DISPLAY . REAL) form is used then pattern matching is done on the displayed string, not on the real - value.") + value. + + This function, generally should not compute candidates according to + `helm-pattern' which defeat all the Helm's matching mechanism + i.e. multiple pattern matching and/or fuzzy matching. + If you want to do so, use :match-dynamic slot to be sure matching + occur only in :candidates function and there is no conflict with + other match functions.") (update :initarg :update @@ -555,7 +574,7 @@ :custom integer :documentation " Enable `helm-follow-mode' for this source only. -With a value of 1 enable, a value of -1 or nil disable the mode. + With a value of 1 enable, a value of -1 or nil disable the mode. See `helm-follow-mode' for more infos.") (follow-delay @@ -664,7 +683,18 @@ With a value of 1 enable, a value of -1 or nil disable the mode. functions will be used. You can specify those functions as a list of functions or a single symbol function. - NOTE: This have the same effect as using :MULTIMATCH nil.")) + NOTE: This have the same effect as using :MULTIMATCH nil.") + + (match-dynamic + :initarg :match-dynamic + :initform nil + :custom boolean + :documentation + " 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'. + Note that :volatile is automatically enabled when using this, so no + need to specify it.")) "Use this class to make helm sources using a list of candidates. This list should be given as a normal list, a variable handling a list @@ -689,6 +719,12 @@ Matching is done basically with `string-match' against each candidate.") (multimatch :initform nil)) "Use this class to define a helm source calling an external process. +The external process is called typically in a `start-process' call to be +asynchronous. + +Note that using multiples asynchronous sources is not fully working, +expect weird behavior if you try this. + The :candidates slot is not allowed even if described because this class inherit from `helm-source'.") @@ -974,6 +1010,8 @@ an eieio class." (defmethod helm--setup-source :primary ((_source helm-source))) (defmethod helm--setup-source :before ((source helm-source)) + (unless (slot-value source 'group) + (setf (slot-value source 'group) 'helm)) (when (slot-value source 'delayed) (warn "Deprecated usage of helm `delayed' slot in `%s'" (slot-value source 'name))) @@ -1019,9 +1057,18 @@ an eieio class." (unless (eq it 'nomultimatch) ; Use own migemo fn. (setf (slot-value source 'match) (append (helm-mklist (slot-value source 'match)) - '(helm-mm-3-migemo-match)))))) + '(helm-mm-3-migemo-match))))) + (when (slot-value source 'match-dynamic) + (setf (slot-value source 'match) 'identity) + (setf (slot-value source 'multimatch) nil) + (setf (slot-value source 'fuzzy-match) nil) + (setf (slot-value source 'volatile) t))) (defmethod helm--setup-source ((source helm-source-in-buffer)) + (cl-assert (eq (slot-value source 'candidates) 'helm-candidates-in-buffer) + nil + (format "Wrong usage of `candidates' attr in `%s' use `data' or `init' instead" + (slot-value source 'name))) (let ((cur-init (slot-value source 'init))) (helm-aif (slot-value source 'data) (setf (slot-value source 'init) diff --git a/elpa/helm-core-20190122.549/helm.el b/elpa/helm-core-20191013.626/helm.el similarity index 93% rename from elpa/helm-core-20190122.549/helm.el rename to elpa/helm-core-20191013.626/helm.el index 32cde471..ff5ff2f4 100644 --- a/elpa/helm-core-20190122.549/helm.el +++ b/elpa/helm-core-20191013.626/helm.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2007 Tamas Patrovics ;; 2008 ~ 2011 rubikitch -;; 2011 ~ 2018 Thierry Volpiatto +;; 2011 ~ 2019 Thierry Volpiatto ;; This is a fork of anything.el wrote by Tamas Patrovics. @@ -35,8 +35,8 @@ (require 'helm-multi-match) (require 'helm-source) -(declare-function 'helm-comp-read "helm-mode.el") - +(declare-function helm-comp-read "helm-mode.el") +(declare-function custom-unlispify-tag-name "cus-edit.el") ;;; Multi keys ;; @@ -110,7 +110,7 @@ Run each function in the FUNCTIONS list in turn when called within DELAY seconds (helm-multi-key-defun helm-toggle-resplit-and-swap-windows "Multi key command to re-split and swap helm window. First call runs `helm-toggle-resplit-window', -and second call within 0.5s runs `helm-swap-windows'." +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) @@ -128,8 +128,9 @@ call COMMAND. Arg OTHER-SUBKEYS is an alist specifying other short key-bindings to use once started e.g: - \(helm-define-key-with-subkeys global-map - \(kbd \"C-x v n\") ?n 'git-gutter:next-hunk '((?p . git-gutter:previous-hunk))\) + (helm-define-key-with-subkeys global-map + (kbd \"C-x v n\") ?n 'git-gutter:next-hunk + '((?p . git-gutter:previous-hunk))\) In this example, `C-x v n' will run `git-gutter:next-hunk' @@ -191,11 +192,8 @@ vectors, so don't use strings to define them." (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-next-source) - (define-key map (kbd "") 'helm-previous-source) (define-key map (kbd "") 'helm-maybe-exit-minibuffer) (define-key map (kbd "C-i") 'helm-select-action) - (define-key map (kbd "C-z") 'helm-execute-persistent-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) @@ -234,6 +232,7 @@ vectors, so don't use strings to define them." (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) @@ -268,12 +267,24 @@ vectors, so don't use strings to define them." map) "Keymap for helm.") +(defun helm-customize-group-1 (group) + (require 'cus-edit) + (let ((name (format "*Customize Group: %s*" + (custom-unlispify-tag-name group)))) + (if (buffer-live-p (get-buffer name)) + (switch-to-buffer name) + (custom-buffer-create + (list (list group 'custom-group)) + name + (concat " for group " + (custom-unlispify-tag-name group)))))) + (defun helm-customize-group () "Jump to customization group of current source. Default to `helm' when group is not defined in source." (interactive) - (helm-run-after-exit 'customize-group (helm-attr 'group))) + (helm-run-after-exit 'helm-customize-group-1 (helm-attr 'group))) (put 'helm-customize-group 'helm-only t) (defun helm--action-at-nth-set-fn-1 (value &optional negative) @@ -332,6 +343,11 @@ id is non-`nil'." :group 'helm :type 'integer) +(defcustom helm-left-margin-width 0 + "`left-margin-width' value for the `helm-buffer'." + :group 'helm + :type 'integer) + (defcustom helm-display-source-at-screen-top t "Display candidates at the top of screen. This happens with `helm-next-source' and `helm-previous-source'. @@ -372,7 +388,9 @@ If t, then Helm does not pop-up new window." :type 'boolean) (defcustom helm-candidate-separator - "--------------------" + (if (fontp (char-displayable-p (read "#x2015"))) + "――――――――――――――――――――――――――――――――――――――" + "--------------------------------------") "Candidates separator of `multiline' source." :group 'helm :type 'string) @@ -508,7 +526,8 @@ handle this." (defcustom helm-always-two-windows nil "When non-`nil' helm uses two windows in this frame. -To display `helm-buffer' in one window and `helm-current-buffer' + +I.e. `helm-buffer' in one window and `helm-current-buffer' in the other. Note: this has no effect when `helm-split-window-inside-p' is non-`nil', @@ -534,7 +553,7 @@ set to `other'." (defcustom helm-default-display-buffer-functions nil "Action functions to pass to `display-buffer'. -See (info \"(elisp) Display Action Functions\"). +See (info \"(elisp) Action Functions for Buffer Display\"). Have no effect when `helm-always-two-windows' is non-nil and may override other settings like `helm-split-window-inside-p'." @@ -543,7 +562,7 @@ override other settings like `helm-split-window-inside-p'." (defcustom helm-default-display-buffer-alist nil "Additional alist to pass to `display-buffer' action. -See (info \"(elisp) Display Action Functions\"). +See (info \"(elisp) Action Alists for Buffer Display\"). Have no effect when `helm-always-two-windows' is non-nil and may override other settings like `helm-split-window-inside-p'. @@ -795,11 +814,22 @@ Fallback to 100 when nil." :group 'helm :type 'boolean) +(defcustom helm-use-frame-when-dedicated-window nil + "Display helm buffer in frame when helm is started from a dedicated window." + :group 'helm + :type 'boolean) + (defcustom helm-default-prompt-display-function #'helm-set-default-prompt-display "The function to use to set face of fake cursor in header-line." :group 'helm :type 'function) + +(defcustom helm-truncate-lines nil + "The value of `truncate-lines' when helm startup. +You can toggle later `truncate-lines' with \\\\[helm-toggle-truncate-line]." + :group 'helm + :type 'boolean) ;;; Faces ;; @@ -891,6 +921,11 @@ Fallback to 100 when nil." "Face used for the minibuffer/headline prompt (such as Pattern:) in helm." :group 'helm-faces) +(defface helm-eob-line + '((t (:inherit default))) + "Face for empty line at end of sources in the helm buffer. +Allow specifying the height of this line." + :group 'helm-faces) ;;; Variables. ;; @@ -919,6 +954,9 @@ This hook runs after `helm-buffer' is created but not from (defvar helm-after-update-hook nil "Runs after updating the helm buffer with the new input pattern.") +(defvar helm-before-update-hook nil + "Runs before updating the helm buffer with the new input pattern.") + (defvar helm-cleanup-hook nil "Runs after exiting the minibuffer and before performing an action. @@ -988,7 +1026,8 @@ size of `helm-debug-buffer' grows quickly.") \\[helm-select-action]:Act \ \\[helm-maybe-exit-minibuffer]/\ f1/f2/f-n:NthAct \ -\\[helm-toggle-suspend-update]:Tog.suspend" +\\[helm-toggle-suspend-update]:Tog.suspend \ +\\[helm-customize-group]:Conf" "Help string displayed by helm in the mode-line. It is either a string or a list of two string arguments where the first string is the name and the second string is displayed in @@ -1011,24 +1050,26 @@ value of this var.") "* Helm Generic Help ** Basics -Helm narrows down the list of candidates as you type a filter pattern. +To navigate in this Help buffer see [[Helm help][here]]. + +Helm narrows down the list of candidates as you type a filter pattern see [[Matching in Helm][Matching in Helm]]. Helm accepts multiple space-separated patterns, each pattern can be negated with \"!\". Helm also supports fuzzy matching in some places when specified, you will find -several variables to enable fuzzy matching in diverse sources, +several variables to enable fuzzy matching in diverse [[Helm sources][sources]], see [[https://github.com/emacs-helm/helm/wiki/Fuzzy-matching][fuzzy-matching]] in helm-wiki for more infos. Helm generally uses familiar Emacs keys to navigate the list. Here follow some of the less obvious bindings: -- `\\[helm-maybe-exit-minibuffer]' selects the candidate from the list, executes the default action +- `\\\\[helm-maybe-exit-minibuffer]' selects the candidate from the list, executes the default action upon exiting the Helm session. -- `\\[helm-execute-persistent-action]' executes the default action but without exiting the Helm session. +- `\\\\[helm-execute-persistent-action]' executes the default action but without exiting the Helm session. Not all sources support this. -- `\\[helm-select-action]' displays a list of actions available on current candidate or all marked candidates. +- `\\\\[helm-select-action]' displays a list of actions available on current candidate or all marked candidates. The default binding is ordinarily used for completion, but that would be redundant since Helm completes upon every character entered in the prompt. See [[https://github.com/emacs-helm/helm/wiki#helm-completion-vs-emacs-completion][Helm wiki]]. @@ -1037,6 +1078,53 @@ Note: In addition to the default actions list, additional actions appear depending of the type of the selected candidate(s). They are called filtered actions. +** Helm sources + +Helm uses what's called sources to provide different kinds of completions, each helm session +can handle one or more source. +A source is an alist object which is build from various classes, see [[Writing your own Helm sources][here]] +and [[https://github.com/emacs-helm/helm/wiki/Developing#creating-a-source][Helm wiki]] for more infos. + +*** Configure sources + +You will find in helm sources already built and bound to a +variable called generally `helm-source-', in this case +it is an alist and you can change the attributes (keys) values +using `helm-attrset' function in your config, of course you have +to ensure before calling `helm-attrset' that the file containing +source is loaded with e.g. `with-eval-after-load'. Of course you +can also completely redefine the source but this is generally not +elegant as it duplicate for its most part code already defined in +Helm. + +You will find also sources that are not built and even not bound +to any variables because they are rebuilded at each start of helm +session. In this case you can add a defmethod called +`helm-setup-user-source' to your config: + +#+begin_src elisp + + (defmethod helm-setup-user-source ((source helm-moccur-class)) + (setf (slot-value source 'follow) -1)) + +#+end_src + +See [[https://github.com/emacs-helm/helm/wiki/FAQ#why-is-a-customizable-helm-source-nil][here]] for more infos, +and for more complex examples of configuration [[https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init-helm.el#L340][here]]. + +** Matching in Helm + +All what you write in minibuffer is interpreted as a regexp or +multiple regexps if separated by a space. This is true for most +sources unless developer of source have disabled it or have choosen to +use fuzzy matching. Even if a source have fuzzy matching enabled, +helm will switch to multi match as soon as it detect a space in +pattern, it may also switch to multi match as well if pattern starts +with a \"^\" beginning of line sign, in those cases each pattern +separated with space should be a regexp and not a fuzzy pattern. When +using multi match patterns, each pattern starting with \"!\" is +interpreted as a negation i.e. match everything but this. + ** Helm mode `helm-mode' toggles Helm completion in native Emacs functions, @@ -1064,6 +1152,27 @@ provide for this function. This is the intended behavior. Generally you are better off using the native Helm command than the helmized Emacs equivalent. +*** Completion behavior with Helm and completion-at-point + +Helm is NOT completing dynamically, that's mean that when you are +completing some text at point, completion is done against this +text and subsequent characters you add AFTER this text, this +allow you to use matching methods provided by Helm, that is multi +matching or fuzzy matching (see [[Matching in Helm][Matching in Helm]]). + +Completion is not done dynamically (against `helm-pattern') +because backend functions (i.e. `competion-at-point-functions') +are not aware of the Helm matching methods. + +By behaving like this, the benefit is that you can fully use Helm +matching methods but you can't start a full completion against a +prefix different than the initial text you have at point, Helm +warn you against this by colorizing the initial input and send an +user-error message when trying to delete backward text beyond +this limit at first hit on DEL and on second hit on DEL within a +short delay (1s) quit Helm and delete-backward char in +current-buffer. + ** Helm help \\[helm-documentation]: Show all helm documentations concatenated in one org file. @@ -1071,10 +1180,11 @@ than the helmized Emacs equivalent. From a Helm session, just hit \\\\[helm-help] to have the documentation for the current source followed by the global Helm documentation. -While in the help buffer, most of the regular keybindings are available in an -Emacs buffers; the most important ones are shown in minibuffer. However due to -the implementation restrictions, no regular Emacs keymap is used (it runs in a -loop when reading the help buffer) they are hardcoded and not modifiable. +While in the help buffer, most of the Emacs regular keybindings +are available; the most important ones are shown in minibuffer. +However due to the implementation restrictions, no regular Emacs +keymap is used (it runs in a loop when reading the help buffer) +they are hardcoded and not modifiable. The hard-coded documentation bindings are: @@ -1113,6 +1223,16 @@ Helm also has a special group for faces you can access via `M-x customize-group Note: Some sources may not have their group set and default to the `helm' group. +** Display Helm in windows and frames + +You can display the helm completion buffer in many differents +window configurations, see the custom interface to discover the +different windows configurations available (See [[Customize Helm][Customize Helm]] to jump to custom interface). +When using Emacs in a graphic display (i.e. not in a terminal) you can as +well display your helm buffers in separated frames globally for +all helm commands or separately for specific helm commands. +See [[https://github.com/emacs-helm/helm/wiki/frame][helm wiki]] for more infos. + ** Helm's basic operations and default key bindings | Key | Alternative Keys | Command | @@ -1121,36 +1241,58 @@ Note: Some sources may not have their group set and default to the `helm' group. | C-n | Down | Next line | | M-v | prior | Previous page | | C-v | next | Next page | -| Enter | | Execute first (default) action / Select | +| Enter | | Execute first (default) action / Select [1] | | M-< | | First line | | M-> | | Last line | | C-M-S-v | M-prior, C-M-y | Previous page (other-window) | | C-M-v | M-next | Next page (other-window) | | Tab | C-i | Show action list | -| Left | | Previous source | -| Right | C-o | Next source | -| C-k | | Delete pattern (with prefix arg delete from point to end or all [1]) | -| C-j | C-z | Persistent action (Execute and keep Helm session) | +| M-o | | Previous source | +| C-o | | Next source | +| C-k | | Delete pattern (with prefix arg delete from point to end or all [2]) | +| C-j | | Persistent action (Execute and keep Helm session) | -\[1] Delete from point to end or all depending on the value of +\[1] Behavior may change depending context in some source e.g. `helm-find-files'. + +\[2] Delete from point to end or all depending on the value of `helm-delete-minibuffer-contents-from-point'. -** Shortcuts for n-th action +** Action transformers + +You may be surprized to see you actions list changing depending of context, this +happen when a source have an action transformer function which check the current +candidate selectioned and add specific actions for this candidate. + +** Shortcuts for n-th first actions f1-f12: Execute n-th action where n is 1 to 12. ** Shortcuts for executing the default action on the n-th candidate +Helm does not display line numbers by default, with Emacs-26+ +you can enable it permanently in all helm buffers with: + + (add-hook 'helm-after-initialize-hook 'helm-init-relative-display-line-numbers) + +You can also toggle line numbers with \\\\[helm-display-line-numbers-mode] in current helm buffer. + +Of course when enabling `global-display-line-numbers-mode' helm buffers will have line numbers as well. +\(don't forget to customize `display-line-numbers-type' to relative). + +In Emacs versions < to 26 you will have to use [[https://github.com/coldnew/linum-relative][linum-relative]] package +and `helm-linum-relative-mode'. + +Then when line numbers are enabled with one of the methods above +the following keys are available([1]): + C-x : Execute default action on the n-th candidate before currently selected candidate. C-c : Execute default action on the n-th candidate after current selected candidate. -\"n\" is limited to 1-9. For larger jumps use other navigation keys. Helm does -not display line numbers by default: enable them with the -\[[https://github.com/coldnew/linum-relative][linum-relative]] package and -`helm-linum-relative-mode'. -If you are using Emacs-26+ version you can use `global-display-line-numbers-mode' -which seems even better (don't forget to customize `display-line-numbers-type' to relative). +\"n\" is limited to 1-9. For larger jumps use other navigation keys. + +\[1] Note that the keybindings are always available even if line numbers are not displayed, +they are just useless in this case. ** Mouse control in Helm @@ -1205,6 +1347,7 @@ go to previous/next line without executing the persistent action. ** Frequently Used Commands \\[helm-toggle-resplit-and-swap-windows]\t\tToggle vertical/horizontal split on first hit and swap Helm window on second hit. +\\[helm-exchange-minibuffer-and-header-line]\t\tExchange minibuffer and header-line. \\[helm-quit-and-find-file]\t\tDrop into `helm-find-files'. \\[helm-kill-selection-and-quit]\t\tKill display value of candidate and quit (with prefix arg, kill the real value). \\[helm-yank-selection]\t\tYank current selection into pattern. @@ -1232,10 +1375,11 @@ e.g. file deletion, file copy etc... You can move in `helm-buffer' with the usual commands used in Emacs: \(\\\\[helm-next-line], \\\\[helm-previous-line], etc. See above basic commands. -When `helm-buffer' contains more than one source, change source with \\\\[helm-next-source]. +When `helm-buffer' contains more than one source, change source with \\\\[helm-next-source] and \\[helm-previous-source]. -Note: When reaching the end of a source, \\\\[helm-next-line] will *not* go to the next source unless -variable `helm-move-to-line-cycle-in-source' is non-nil, so you will have to use \\\\[helm-next-source]. +Note: When reaching the end of a source, \\\\[helm-next-line] will *not* go to the next source when +variable `helm-move-to-line-cycle-in-source' is non-nil, so you will have to use \\\\[helm-next-source] +and \\[helm-previous-source]. ** Resume previous session from current Helm session @@ -1295,7 +1439,7 @@ what you want to do. To simplify this, several `helm-build-*' macros are provided. Below, simple examples to start with. We will not go further here, see [[https://github.com/emacs-helm/helm/wiki/Developing][Helm wiki]] and the source -code for more information and more complex exapmles. +code for more information and more complex examples. #+begin_src elisp @@ -1376,7 +1520,8 @@ The list of sources (symbols or alists) is normalized to alists in (defvar helm--local-variables nil) (defvar helm-split-window-state nil) (defvar helm--window-side-state nil) -(defvar helm-selection-point 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" @@ -1421,8 +1566,6 @@ 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-truncate-lines nil - "[Internal] Don't set this globally, it is used as a local var.") (defvar helm--prompt nil) (defvar helm--file-completion-sources '("Find Files" "Read File Name") @@ -1470,6 +1613,11 @@ 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.") ;; Utility: logging (defun helm-log (format-string &rest args) @@ -1500,15 +1648,22 @@ Use optional arguments ARGS like in `format'." (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 that is calling `helm-log'. -The original idea is from `tramp-debug-message'." - (cl-loop with exclude-func-re = "^helm-\\(?:interpret\\|log\\|.*funcall\\)" - for btn from 1 to 40 + "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 (string-match exclude-func-re fn))) + if (and (string-match "\\`helm" fn) + (not (memq btf helm--log-exclude-functions))) return fn)) (defun helm-log-error (&rest args) @@ -1533,6 +1688,13 @@ Messages are logged to a file named with todays date and time in this directory. 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 @@ -2077,9 +2239,6 @@ Return the result of last function call." (let ((helm--source-name (assoc-default 'name source)) (helm-current-source source) (funs (if (functionp functions) (list functions) functions))) - (helm-log "helm--source-name = %S" helm--source-name) - (helm-log "functions = %S" functions) - (helm-log "args = %S" args) (cl-loop with result for fn in funs do (setq result (apply fn args)) @@ -2513,6 +2672,9 @@ as a string with ARG." (progn (set-buffer (car it)) (setq narrow-pos (cdr it)))) + ;; This happen when calling C-x b within helm. + (helm-aif (get-buffer-window helm-marked-buffer-name 'visible) + (progn (delete-window it) (kill-buffer helm-marked-buffer-name))) (save-restriction (when narrow-pos (apply #'narrow-to-region narrow-pos)) ;; Restart with same `default-directory' value this session @@ -2527,13 +2689,14 @@ as a string with ARG." :buffer any-buffer) (run-hook-with-args 'helm-resume-after-hook sources)))))) -(defun helm-resume-previous-session-after-quit (arg) +(defun helm-resume-previous-session-after-quit () "Resume previous helm session within a running helm." - (interactive "p") + (interactive) (with-helm-alive-p - (if (> (length helm-buffers) arg) - (helm-run-after-exit (lambda () (helm-resume (nth arg helm-buffers)))) - (message "No previous helm sessions available for resuming!")))) + (let ((arg (if (null (member helm-buffer helm-buffers)) 0 1))) + (if (> (length helm-buffers) arg) + (helm-run-after-exit (lambda () (helm-resume (nth arg helm-buffers)))) + (message "No previous helm sessions available for resuming!"))))) (put 'helm-resume-previous-session-after-quit 'helm-only t) (defun helm-resume-list-buffers-after-quit () @@ -2761,34 +2924,36 @@ value of `split-window-preferred-function' in `helm-display-buffer'. When `helm-display-function' which default to `helm-default-display-buffer' is called from `helm-display-buffer' the value of `split-window-preferred-function' will be used by `display-buffer'." - (let (split-width-threshold) - (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))) - (if (or (one-window-p t) - helm-split-window-inside-p) - (split-window - (selected-window) nil (if (eq helm-split-window-default-side 'other) - 'below helm-split-window-default-side)) - ;; If more than one window reuse one of them. - (cl-case helm-split-window-default-side - (left (or (helm-window-in-direction 'left) - (helm-window-in-direction 'above) - (selected-window))) - (above (or (helm-window-in-direction 'above) - (helm-window-in-direction 'left) - (selected-window))) - (right (or (helm-window-in-direction 'right) - (helm-window-in-direction 'below) - (selected-window))) - (below (or (helm-window-in-direction 'below) - (helm-window-in-direction 'right) - (selected-window))) - (same (selected-window)) - (other (other-window-for-scrolling)) - (t (or (window-next-sibling) (selected-window))))) - (split-window-sensibly window)))) + (let* (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))) + (if (or (one-window-p t) + helm-split-window-inside-p) + (split-window + (selected-window) nil (if (eq helm-split-window-default-side 'other) + 'below helm-split-window-default-side)) + ;; If more than one window reuse one of them. + (cl-case helm-split-window-default-side + (left (or (helm-window-in-direction 'left) + (helm-window-in-direction 'above) + (selected-window))) + (above (or (helm-window-in-direction 'above) + (helm-window-in-direction 'left) + (selected-window))) + (right (or (helm-window-in-direction 'right) + (helm-window-in-direction 'below) + (selected-window))) + (below (or (helm-window-in-direction 'below) + (helm-window-in-direction 'right) + (selected-window))) + (same (selected-window)) + (other (other-window-for-scrolling)) + (t (or (window-next-sibling) (selected-window))))) + (split-window-sensibly window)))) + (setq helm-persistent-action-window-buffer (window-buffer win)) + win)) (defun helm-window-in-direction (direction) "Same as `window-in-direction' but check if window is dedicated." @@ -2810,6 +2975,8 @@ Fallback to global value of `helm-display-function' when no local value found and current command is not in `helm-commands-using-frame'." (or (with-helm-buffer helm-display-function) (and (or (memq com helm-commands-using-frame) + (and helm-use-frame-when-dedicated-window + (window-dedicated-p (get-buffer-window helm-current-buffer))) (and helm-use-frame-when-more-than-two-windows (null helm--nested) (> (length (window-list)) 2)) @@ -2863,17 +3030,23 @@ Arg ENABLE is the value of `no-other-window' window property." It is the default value of `helm-display-function' It uses `switch-to-buffer' or `display-buffer' depending on the value of `helm-full-frame' or `helm-split-window-default-side'." - (let (pop-up-frames) - (if (or (buffer-local-value 'helm-full-frame (get-buffer buffer)) - (and (eq helm-split-window-default-side 'same) - (one-window-p t))) + (let (pop-up-frames + (dedicated-p (window-dedicated-p + (get-buffer-window helm-current-buffer)))) + (if (and (null (eq dedicated-p t)) + (or (buffer-local-value 'helm-full-frame (get-buffer buffer)) + (and (eq helm-split-window-default-side 'same) + (one-window-p t)))) (progn (and (not (minibufferp helm-current-buffer)) (delete-other-windows)) (switch-to-buffer buffer)) (when (and (or helm-always-two-windows helm-autoresize-mode) (not (eq helm-split-window-default-side 'same)) (not (minibufferp helm-current-buffer)) - (not helm-split-window-inside-p)) + (not helm-split-window-inside-p) + ;; Prevent deleting OW only when helm-current-buffer + ;; is "strongly" dedicated. + (null (eq dedicated-p t))) (delete-other-windows)) (display-buffer buffer `(,helm-default-display-buffer-functions @@ -3186,6 +3359,7 @@ Unuseful when used outside helm, don't use it.") (helm-log "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) (setq cursor-type nil)) (helm-initialize-overlays helm-buffer) (get-buffer helm-buffer))) @@ -3498,6 +3672,7 @@ WARNING: Do not use this mode yourself, it is internal to helm." (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) (setq helm--in-update t) (helm-update))) @@ -3718,7 +3893,6 @@ Default function to match candidates according to `helm-pattern'." ;;; Fuzzy matching ;; ;; -(defconst helm--fuzzy-word-separators '("-" "_" "." ":" "/")) (defvar helm--fuzzy-regexp-cache (make-hash-table :test 'eq)) (defun helm--fuzzy-match-maybe-set-pattern () ;; Computing helm-pattern with helm--mapconcat-pattern @@ -3735,13 +3909,13 @@ Default function to match candidates according to `helm-pattern'." (if (string-match "\\`!" helm-pattern) (puthash 'helm-pattern (if (> (length helm-pattern) 1) - (list (funcall fun (substring helm-pattern 1 2)) + (list (regexp-quote (substring helm-pattern 1 2)) (funcall fun (substring helm-pattern 1))) '("" "")) helm--fuzzy-regexp-cache) (puthash 'helm-pattern (if (> (length helm-pattern) 0) - (list (funcall fun (substring helm-pattern 0 1)) + (list (regexp-quote (substring helm-pattern 0 1)) (funcall fun helm-pattern)) '("" "")) helm--fuzzy-regexp-cache))))) @@ -3809,29 +3983,18 @@ CANDIDATE. Contiguous matches get a coefficient of 2." (string= pattern (substring cand 0 1))) 150) (t 0))) - ;; Exact match e.g. foo > foo == 200 + ;; Exact match e.g. foo -> foo == 200 (bonus1 (and (string= cand pattern) 200)) - ;; Partial match e.g. foo > aafooaa == 100 - (bonus2 (and (string-match - (concat "\\<" (regexp-quote pattern) "\\>") - cand) - 100)) - ;; Prefix at word boundary e.g fb > foo-bar coeff 2 - (bonus3 (if (or bonus1 bonus2 (null pat-lookup)) - 0 - (cl-loop with seq = (copy-sequence str-lookup) - with count = 0 - for c across (substring pattern 1) - for assoc = (rassoc (list (string c)) (cdr seq)) - when (helm-aand - assoc - (car it) - (member it helm--fuzzy-word-separators)) - do (cl-incf count 2) - and do (setq seq (cdr (member assoc seq))) - finally return count)))) + ;; Partial match e.g. foo -> aafooaa == 100 + ;; or foo -> fooaaa + (bonus2 (and (or (string-match + (concat "\\`" (regexp-quote pattern)) + cand) + (string-match + (concat "\\<" (regexp-quote pattern) "\\>") + cand)) + 100))) (+ bonus - bonus3 (or bonus1 bonus2 ;; Give a coefficient of 2 for contiguous matches. ;; That's mean that "wiaaaki" will not take precedence @@ -3998,50 +4161,51 @@ It is used for narrowing list of candidates to the (if (> (length seq) n) (cl-subseq seq 0 n) seq)) (defun helm-match-from-candidates (cands matchfns match-part-fn limit source) - (condition-case-unless-debug err - (cl-loop with hash = (make-hash-table :test 'equal) - with allow-dups = (assq 'allow-dups source) - with case-fold-search = (helm-set-case-fold-search) - with count = 0 - for iter from 1 - for fn in matchfns - when (< count limit) nconc - (cl-loop for c in cands - for dup = (gethash c hash) - while (< count limit) - for target = (helm-candidate-get-display c) - for prop-part = (get-text-property 0 'match-part target) - for part = (and match-part-fn - (or prop-part - (funcall match-part-fn target))) - ;; When allowing dups check if DUP - ;; have been already found in previous loop - ;; by comparing its value with ITER. - when (and (or (and allow-dups dup (= dup iter)) - (null dup)) - (condition-case nil - (funcall fn (or part target)) - (invalid-regexp nil))) - do - (progn - ;; Give as value the iteration number of - ;; inner loop to be able to check if - ;; the duplicate have not been found in previous loop. - (puthash c iter hash) - (helm--maybe-process-filter-one-by-one-candidate c source) - (cl-incf count)) - ;; Filter out nil candidates maybe returned by - ;; `helm--maybe-process-filter-one-by-one-candidate'. - and when c collect - (if (and part (not prop-part)) - (if (consp c) - (cons (propertize target 'match-part part) (cdr c)) - (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" - (assoc-default 'name source) (car err) (cdr err))) - nil))) + (when cands ; nil in async sources. + (condition-case-unless-debug err + (cl-loop with hash = (make-hash-table :test 'equal) + with allow-dups = (assq 'allow-dups source) + with case-fold-search = (helm-set-case-fold-search) + with count = 0 + for iter from 1 + for fn in matchfns + when (< count limit) nconc + (cl-loop for c in cands + for dup = (gethash c hash) + while (< count limit) + for target = (helm-candidate-get-display c) + for prop-part = (get-text-property 0 'match-part target) + for part = (and match-part-fn + (or prop-part + (funcall match-part-fn target))) + ;; When allowing dups check if DUP + ;; have been already found in previous loop + ;; by comparing its value with ITER. + when (and (or (and allow-dups dup (= dup iter)) + (null dup)) + (condition-case nil + (funcall fn (or part target)) + (invalid-regexp nil))) + do + (progn + ;; Give as value the iteration number of + ;; inner loop to be able to check if + ;; the duplicate have not been found in previous loop. + (puthash c iter hash) + (helm--maybe-process-filter-one-by-one-candidate c source) + (cl-incf count)) + ;; Filter out nil candidates maybe returned by + ;; `helm--maybe-process-filter-one-by-one-candidate'. + and when c collect + (if (and part (not prop-part)) + (if (consp c) + (cons (propertize target 'match-part part) (cdr c)) + (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" + (assoc-default 'name source) (car err) (cdr err))) + nil)))) (defun helm-compute-matches (source) "Start computing candidates in SOURCE." @@ -4086,7 +4250,7 @@ It is used for narrowing list of candidates to the (defun helm-render-source (source matches) "Display MATCHES from SOURCE according to its settings." - (helm-log "Source name = %S" (assoc-default 'name source)) + (helm-log "Source = %S" (remove (assq 'keymap source) source)) (when matches (helm-insert-header-from-source source) (cl-loop with separate = nil @@ -4210,8 +4374,7 @@ without recomputing them, it should be a list of lists." do (helm-render-source src mtc)) ;; Move to first line only when there is matches ;; to avoid cursor moving upside down (issue #1703). - (helm--update-move-first-line) - (helm--reset-update-flag))) + (helm--update-move-first-line))) ;; When there is only one async source, update mode-line and run ;; `helm-after-update-hook' in `helm-output-filter--post-process', ;; when there is more than one source, update mode-line and run @@ -4219,14 +4382,15 @@ without recomputing them, it should be a list of lists." ;; present and running in BG. (let ((src (or source (helm-get-current-source)))) (unless (assq 'candidates-process src) - (and src (helm-display-mode-line src 'force)) + (helm-display-mode-line src 'force) (helm-log-run-hook 'helm-after-update-hook))) (when preselect (helm-log "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)) + (setq helm--force-updating-p nil) + (helm--reset-update-flag)) (helm-log "end update"))) (defun helm-update-source-p (source) @@ -4474,7 +4638,7 @@ If DISPLAY-STRING is non-`nil' and a string value then display this additional info after the source name by overlay." (unless (bobp) (let ((start (point))) - (insert "\n") + (insert (propertize "\n" 'face 'helm-eob-line)) (put-text-property start (point) 'helm-header-separator t))) (let ((start (point))) (insert name) @@ -4484,7 +4648,10 @@ this additional info after the source name by overlay." (overlay-put (make-overlay (point-at-bol) (point-at-eol)) 'display display-string)) (insert "\n") - (put-text-property start (point) 'face 'helm-source-header))) + (add-text-properties start (point) '(face helm-source-header + ;; Disable line numbers on + ;; source headers. + display-line-numbers-disable t)))) (defun helm-insert-candidate-separator () "Insert separator of candidates into the helm buffer." @@ -4493,6 +4660,29 @@ this additional info after the source name by overlay." (point-at-eol) 'helm-candidate-separator t) (insert "\n")) +(defun helm-init-relative-display-line-numbers () + "Enable `display-line-numbers' for helm buffers. +This is intended to be added to `helm-after-initialize-hook'. +This will work only in Emacs-26+, i.e. Emacs +versions that have `display-line-numbers-mode'." + (when (boundp 'display-line-numbers) + (with-helm-buffer + (setq display-line-numbers 'relative)))) + +(define-minor-mode helm-display-line-numbers-mode + "Toggle display of line numbers in current helm buffer." + :group 'helm + (with-helm-alive-p + (cl-assert (boundp 'display-line-numbers) nil + "`display-line-numbers' not available") + (if helm-display-line-numbers-mode + (with-helm-buffer + (setq display-line-numbers 'relative)) + (with-helm-buffer + (setq display-line-numbers nil))))) +(put 'helm-display-line-numbers-mode 'helm-only t) + + ;;; Async process ;; @@ -5718,6 +5908,14 @@ use `search', `get-line' and `match-part' attributes." (forward-line 1))) nconc (cl-loop with pos-lst + ;; POS-LST is used as a flag to decide if we + ;; run `helm-search-match-part' even if + ;; MATCH-PART isn't specified on source. This + ;; happen when fuzzy matching or using a + ;; negation (!) in one of the patterns, in + ;; these case the searcher returns a list + ;; '(BEG END) instead of an integer like + ;; `re-search-forward'. while (and (setq pos-lst (funcall searcher pattern)) (not (eobp)) (< count limit)) @@ -5943,7 +6141,9 @@ when initializing a source with `helm-source-in-buffer' class." "Toggle resplit helm window, vertically or horizontally." (interactive) (with-helm-alive-p - (if (= (length (window-list nil 1)) 2) + (if (and (= (length (window-list nil 1)) 2) + (not (window-dedicated-p + (get-buffer-window helm-current-buffer)))) (progn (when helm-prevent-escaping-from-minibuffer (helm-prevent-switching-other-window :enabled nil)) @@ -6134,8 +6334,9 @@ Possible values are 'left 'right 'below or 'above." (defun helm-initialize-persistent-action () (set (make-local-variable 'helm-persistent-action-display-window) nil)) -(cl-defun helm-execute-persistent-action (&optional attr split-onewindow) +(cl-defun helm-execute-persistent-action (&optional attr split) "Perform the associated action ATTR without quitting helm. + Arg ATTR default will be `persistent-action' or `persistent-action-if' if unspecified depending on what's found in source, but it can be anything else. @@ -6143,10 +6344,11 @@ In this case you have to add this new attribute to your source. See `persistent-action' and `persistent-action-if' slot documentation in `helm-source'. -When `helm-full-frame' or SPLIT-ONEWINDOW are non-`nil', and +When `helm-full-frame' is non-`nil', and `helm-buffer' is displayed in only one window, the helm window is split to display `helm-select-persistent-action-window' in other -window to maintain visibility." +window to maintain visibility. The argument SPLIT can be used to +force splitting inconditionally, it is unused actually." (interactive) (with-helm-alive-p (let ((source (helm-get-current-source))) @@ -6179,9 +6381,9 @@ window to maintain visibility." (with-helm-window (save-selected-window (if no-split - (helm-select-persistent-action-window) + (helm-select-persistent-action-window :split 'never) (helm-select-persistent-action-window - (or split-onewindow helm-onewindow-p))) + :split (or split helm-onewindow-p))) (helm-log "current-buffer = %S" (current-buffer)) (let ((helm-in-persistent-action t) (same-window-regexps '(".")) @@ -6205,9 +6407,12 @@ window to maintain visibility." (delete-other-windows)))))))))) (put 'helm-execute-persistent-action 'helm-only t) -(defun helm-persistent-action-display-window (&optional split-onewindow) +(cl-defun helm-persistent-action-display-window (&key split) "Return the window that will be used for persistent action. -If SPLIT-ONEWINDOW is non-`nil' window is split in persistent action." +If SPLIT is `t' window is split in persistent action, if it has the +special symbol `never' don't split, if it is `nil' normally don't +split but this may happen in case of dedicated-windows or unsuitable +window to display persistent action buffer." (with-helm-window (let (prev-win cur-win) (setq helm-persistent-action-display-window @@ -6217,28 +6422,32 @@ If SPLIT-ONEWINDOW is non-`nil' window is split in persistent action." helm-persistent-action-display-window) ((and helm--buffer-in-new-frame-p helm-initial-frame) (with-selected-frame helm-initial-frame (selected-window))) - (split-onewindow (split-window)) + ((and split (not (eq split 'never))) (split-window)) ;; Fix Issue #2050 with dedicated window. - ((window-dedicated-p - (setq prev-win (previous-window (selected-window) 1))) + ((and (window-dedicated-p + (setq prev-win (previous-window (selected-window) 1))) + (not (eq split 'never))) (with-helm-after-update-hook (and (window-live-p helm-persistent-action-display-window) (delete-window helm-persistent-action-display-window))) - (split-window)) + ;; If next-window is usable use it, otherwise split + ;; the helm window. + (let ((nw (next-window (selected-window) 1))) + (if (eql nw prev-win) (split-window) nw))) ((window-dedicated-p (setq cur-win (get-buffer-window helm-current-buffer))) - (split-window)) + (previous-window (selected-window) 1)) (cur-win) (t prev-win)))))) -(defun helm-select-persistent-action-window (&optional split-onewindow) +(cl-defun helm-select-persistent-action-window (&key split) "Select the window that will be used for persistent action. -See `helm-persistent-action-display-window' for how to use SPLIT-ONEWINDOW." +See `helm-persistent-action-display-window' for how to use SPLIT." (select-window (get-buffer-window (helm-buffer-get))) (prog1 (select-window (setq minibuffer-scroll-window - (helm-persistent-action-display-window split-onewindow))) + (helm-persistent-action-display-window :split split))) (helm-log "Selected window is %S" minibuffer-scroll-window))) ;;; Scrolling - recentering @@ -6800,6 +7009,7 @@ If source doesn't have any `help-message' attribute, a generic message explaining this is added instead. The global `helm-help-message' is always added after this local help." (interactive) + (require 'helm-mode) ; for helm-comp-read. (with-helm-alive-p (let ((source (or (helm-get-current-source) (helm-comp-read @@ -6832,6 +7042,7 @@ The global `helm-help-message' is always added after this local help." (helm-update (regexp-quote (helm-get-selection nil t))))))) (put 'helm-toggle-truncate-line 'helm-only t) + (provide 'helm) ;; Local Variables: diff --git a/elpa/helm-descbinds-20180429.1456/helm-descbinds-pkg.el b/elpa/helm-descbinds-20180429.1456/helm-descbinds-pkg.el deleted file mode 100644 index ffe94d1e..00000000 --- a/elpa/helm-descbinds-20180429.1456/helm-descbinds-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "helm-descbinds" "20180429.1456" "A convenient `describe-bindings' with `helm'" '((helm "1.5")) :commit "033be73f21778633813264ce1634a6e1ad873d8e" :keywords '("helm" "help") :authors '(("Taiki SUGAWARA" . "buzz.taiki@gmail.com")) :maintainer '("Taiki SUGAWARA" . "buzz.taiki@gmail.com") :url "https://github.com/emacs-helm/helm-descbinds") diff --git a/elpa/helm-descbinds-20180429.1456/helm-descbinds-autoloads.el b/elpa/helm-descbinds-20190501.935/helm-descbinds-autoloads.el similarity index 84% rename from elpa/helm-descbinds-20180429.1456/helm-descbinds-autoloads.el rename to elpa/helm-descbinds-20190501.935/helm-descbinds-autoloads.el index 30cbe3c2..c048fd6b 100644 --- a/elpa/helm-descbinds-20180429.1456/helm-descbinds-autoloads.el +++ b/elpa/helm-descbinds-20190501.935/helm-descbinds-autoloads.el @@ -1,13 +1,10 @@ ;;; helm-descbinds-autoloads.el --- automatically extracted autoloads ;; ;;; 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-descbinds" "helm-descbinds.el" (0 0 0 -;;;;;; 0)) +;;;### (autoloads nil "helm-descbinds" "helm-descbinds.el" (23994 +;;;;;; 46467 613261 783000)) ;;; Generated autoloads from helm-descbinds.el (defvar helm-descbinds-mode nil "\ @@ -58,14 +55,11 @@ useful, yet they are listed for completeness. \(fn &optional PREFIX BUFFER)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-descbinds" '("helm-descbind"))) - ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; helm-descbinds-autoloads.el ends here diff --git a/elpa/helm-descbinds-20190501.935/helm-descbinds-pkg.el b/elpa/helm-descbinds-20190501.935/helm-descbinds-pkg.el new file mode 100644 index 00000000..e601b4de --- /dev/null +++ b/elpa/helm-descbinds-20190501.935/helm-descbinds-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "helm-descbinds" "20190501.935" "A convenient `describe-bindings' with `helm'" '((helm "1.5")) :commit "b72515982396b6e336ad7beb6767e95a80fca192" :keywords '("helm" "help") :authors '(("Taiki SUGAWARA" . "buzz.taiki@gmail.com")) :maintainer '("Taiki SUGAWARA" . "buzz.taiki@gmail.com") :url "https://github.com/emacs-helm/helm-descbinds") diff --git a/elpa/helm-descbinds-20180429.1456/helm-descbinds.el b/elpa/helm-descbinds-20190501.935/helm-descbinds.el similarity index 87% rename from elpa/helm-descbinds-20180429.1456/helm-descbinds.el rename to elpa/helm-descbinds-20190501.935/helm-descbinds.el index bbc524bc..25f63957 100644 --- a/elpa/helm-descbinds-20180429.1456/helm-descbinds.el +++ b/elpa/helm-descbinds-20190501.935/helm-descbinds.el @@ -7,7 +7,7 @@ ;; Author: Taiki SUGAWARA ;; URL: https://github.com/emacs-helm/helm-descbinds -;; Package-Version: 20180429.1456 +;; Package-Version: 20190501.935 ;; Keywords: helm, help ;; Version: 1.12 ;; Package-Requires: ((helm "1.5")) @@ -107,6 +107,19 @@ This function will be called with two arguments KEY and BINDING." "A list of section order by name regexp." :type '(repeat (regexp :tag "Regexp"))) +(defvar helm-descbinds-prefix-help + "This is a prefix key, hit RET to see all bindings using this prefix. + +A “prefix key” is a key sequence whose binding is a keymap. The keymap +defines what to do with key sequences that extend the prefix key. For +example, ‘C-x’ is a prefix key, and it uses a keymap that is also stored +in the variable ‘ctl-x-map’. This keymap defines bindings for key +sequences starting with ‘C-x’. +See (info \"(elisp) Prefix Keys\") for more infos." + "A brief documentation of what is a prefix key. +This string is extracted from Elisp manual, +see (info \"(elisp) Prefix Keys\").") + (defvar helm-descbinds-Orig-describe-bindings (symbol-function 'describe-bindings)) (defvar helm-descbind--initial-full-frame helm-full-frame) @@ -192,12 +205,27 @@ This function will be called with two arguments KEY and BINDING." ;; directly `call-interactively'. (call-interactively x))))) +(defun helm-descbinds-display-string-in-help (str) + (with-current-buffer (help-buffer) + (let ((inhibit-read-only t)) + (erase-buffer) + (insert str)) + (help-mode) + (display-buffer (current-buffer)))) + (defun helm-descbinds-action:describe (candidate) "An action that describe selected CANDIDATE function." (let ((name (cdr candidate))) - (if (equal name "Keyboard Macro") - (describe-key (kbd (car candidate))) - (describe-function name)))) + (when (member name '("ignore" "ignore-event")) + (setq name 'ignore)) + (pcase name + ((pred (string= "Keyboard Macro")) + (describe-key (kbd (car candidate)))) + ((pred (string= "Prefix Command")) + (helm-descbinds-display-string-in-help + helm-descbinds-prefix-help)) + ((guard (and (symbolp name) (fboundp name))) + (describe-function name))))) (defun helm-descbinds-action:find-func (candidate) "An action that find selected CANDIDATE function." @@ -229,7 +257,10 @@ Provide a useful behavior for prefix commands." (helm-make-actions "helm-descbinds this prefix" (lambda (cand) - (describe-bindings (kbd (car cand))))) + (let ((binding (car cand))) + (if (member binding '("" "")) + (message "Key is bound to `ignore' because there is nothing to do") + (describe-bindings (kbd binding)))))) actions)) (defun helm-descbinds-sources (buffer &optional prefix menus) diff --git a/elpa/helm-projectile-20180815.1514/helm-projectile-autoloads.el b/elpa/helm-projectile-20190731.1538/helm-projectile-autoloads.el similarity index 87% rename from elpa/helm-projectile-20180815.1514/helm-projectile-autoloads.el rename to elpa/helm-projectile-20190731.1538/helm-projectile-autoloads.el index 815b4e92..1e9b287f 100644 --- a/elpa/helm-projectile-20180815.1514/helm-projectile-autoloads.el +++ b/elpa/helm-projectile-20190731.1538/helm-projectile-autoloads.el @@ -1,13 +1,10 @@ ;;; helm-projectile-autoloads.el --- automatically extracted autoloads ;; ;;; 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-projectile" "helm-projectile.el" (0 0 -;;;;;; 0 0)) +;;;### (autoloads nil "helm-projectile" "helm-projectile.el" (23994 +;;;;;; 46466 834972 289000)) ;;; Generated autoloads from helm-projectile.el (defvar helm-projectile-fuzzy-match t "\ @@ -74,14 +71,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-"))) - ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; helm-projectile-autoloads.el ends here diff --git a/elpa/helm-projectile-20180815.1514/helm-projectile-pkg.el b/elpa/helm-projectile-20190731.1538/helm-projectile-pkg.el similarity index 65% rename from elpa/helm-projectile-20180815.1514/helm-projectile-pkg.el rename to elpa/helm-projectile-20190731.1538/helm-projectile-pkg.el index 3cdbdc3f..c17919b8 100644 --- a/elpa/helm-projectile-20180815.1514/helm-projectile-pkg.el +++ b/elpa/helm-projectile-20190731.1538/helm-projectile-pkg.el @@ -1,2 +1,2 @@ ;;; -*- no-byte-compile: t -*- -(define-package "helm-projectile" "20180815.1514" "Helm integration for Projectile" '((helm "1.9.9") (projectile "0.14.0") (cl-lib "0.3")) :commit "8a2dbc973548fac89356c11d70f7f474ea1367a5" :keywords '("project" "convenience") :authors '(("Bozhidar Batsov")) :maintainer '("Bozhidar Batsov") :url "https://github.com/bbatsov/helm-projectile") +(define-package "helm-projectile" "20190731.1538" "Helm integration for Projectile" '((helm "1.9.9") (projectile "0.14.0") (cl-lib "0.3")) :commit "5328b74dddcee8d1913803ca8167868831a07463" :keywords '("project" "convenience") :authors '(("Bozhidar Batsov")) :maintainer '("Bozhidar Batsov") :url "https://github.com/bbatsov/helm-projectile") diff --git a/elpa/helm-projectile-20180815.1514/helm-projectile.el b/elpa/helm-projectile-20190731.1538/helm-projectile.el similarity index 99% rename from elpa/helm-projectile-20180815.1514/helm-projectile.el rename to elpa/helm-projectile-20190731.1538/helm-projectile.el index 723d0a71..c97c363a 100644 --- a/elpa/helm-projectile-20180815.1514/helm-projectile.el +++ b/elpa/helm-projectile-20190731.1538/helm-projectile.el @@ -4,7 +4,7 @@ ;; Author: Bozhidar Batsov ;; URL: https://github.com/bbatsov/helm-projectile -;; Package-Version: 20180815.1514 +;; Package-Version: 20190731.1538 ;; Created: 2011-31-07 ;; Keywords: project, convenience ;; Version: 0.14.0 @@ -792,7 +792,6 @@ Other file extensions can be customized with the variable `projectile-other-file (interactive "P") (let* ((project-root (projectile-project-root)) (other-files (projectile-get-other-files (buffer-file-name) - (projectile-current-project-files) flex-matching))) (if other-files (if (= (length other-files) 1) @@ -964,8 +963,10 @@ DIR is the project root, if not set then current directory is used" (declare-function helm-rg "helm-rg") (defun helm-projectile-rg--region-selection () - (when (use-region-p) - (buffer-substring-no-properties (region-beginning) (region-end)))) + (when helm-projectile-set-input-automatically + (if (region-active-p) + (buffer-substring-no-properties (region-beginning) (region-end)) + (helm-rg--get-thing-at-pt)))) ;;;###autoload (defun helm-projectile-rg () @@ -975,7 +976,9 @@ DIR is the project root, if not set then current directory is used" (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)) - (helm-rg (or (helm-projectile-rg--region-selection) "") nil (list (projectile-project-root)))) + (helm-rg (helm-projectile-rg--region-selection) + nil + (list (projectile-project-root)))) (error "You're not in a project")) (when (yes-or-no-p "`helm-rg' is not installed. Install? ") (condition-case nil diff --git a/elpa/helm-swoop-20180215.1154/helm-swoop-pkg.el b/elpa/helm-swoop-20180215.1154/helm-swoop-pkg.el deleted file mode 100644 index a1901a19..00000000 --- a/elpa/helm-swoop-20180215.1154/helm-swoop-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "helm-swoop" "20180215.1154" "Efficiently hopping squeezed lines powered by helm interface" '((helm "1.0") (emacs "24.3")) :commit "c66336b8245ddc51c4206f19c119f1081920985c" :keywords '("helm" "swoop" "inner" "buffer" "search") :authors '(("Shingo Fukuyama - http://fukuyama.co")) :maintainer '("Shingo Fukuyama - http://fukuyama.co") :url "https://github.com/ShingoFukuyama/helm-swoop") diff --git a/elpa/helm-swoop-20180215.1154/helm-swoop-autoloads.el b/elpa/helm-swoop-20191028.1402/helm-swoop-autoloads.el similarity index 86% rename from elpa/helm-swoop-20180215.1154/helm-swoop-autoloads.el rename to elpa/helm-swoop-20191028.1402/helm-swoop-autoloads.el index e1063e72..3ada954a 100644 --- a/elpa/helm-swoop-20180215.1154/helm-swoop-autoloads.el +++ b/elpa/helm-swoop-20191028.1402/helm-swoop-autoloads.el @@ -1,12 +1,10 @@ ;;; helm-swoop-autoloads.el --- automatically extracted autoloads ;; ;;; 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-swoop" "helm-swoop.el" (0 0 0 0)) +;;;### (autoloads nil "helm-swoop" "helm-swoop.el" (23994 46466 115498 +;;;;;; 456000)) ;;; Generated autoloads from helm-swoop.el (autoload 'helm-swoop-back-to-last-point "helm-swoop" "\ @@ -73,14 +71,11 @@ Start helm-swoop without pre input query. \(fn)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "helm-swoop" '("helm-" "get-buffers-matching-mode"))) - ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; helm-swoop-autoloads.el ends here diff --git a/elpa/helm-swoop-20191028.1402/helm-swoop-pkg.el b/elpa/helm-swoop-20191028.1402/helm-swoop-pkg.el new file mode 100644 index 00000000..c736e779 --- /dev/null +++ b/elpa/helm-swoop-20191028.1402/helm-swoop-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "helm-swoop" "20191028.1402" "Efficiently hopping squeezed lines powered by helm interface" '((helm "3.2") (emacs "24.4")) :commit "bfb5128712cbceec78cf6bb8eea4459d7de06323" :keywords '("convenience" "helm" "swoop" "inner" "buffer" "search") :authors '(("Shingo Fukuyama - http://fukuyama.co")) :maintainer '("Shingo Fukuyama - http://fukuyama.co") :url "https://github.com/emacsorphanage/helm-swoop") diff --git a/elpa/helm-swoop-20180215.1154/helm-swoop.el b/elpa/helm-swoop-20191028.1402/helm-swoop.el similarity index 84% rename from elpa/helm-swoop-20180215.1154/helm-swoop.el rename to elpa/helm-swoop-20191028.1402/helm-swoop.el index d0ce214b..7361f06c 100644 --- a/elpa/helm-swoop-20180215.1154/helm-swoop.el +++ b/elpa/helm-swoop-20191028.1402/helm-swoop.el @@ -1,24 +1,28 @@ -;;; helm-swoop.el --- Efficiently hopping squeezed lines powered by helm interface -*- coding: utf-8; lexical-binding: t -*- +;;; helm-swoop.el --- Efficiently hopping squeezed lines powered by helm interface -*- lexical-binding: t -*- -;; Copyright (C) 2013 - 2018 by Shingo Fukuyama +;; Copyright (C) 2019 Emacsorphanage Community +;; Copyright (C) 2013-2018 Shingo Fukuyama -;; Version: 1.7.4 -;; Package-Version: 20180215.1154 +;; Version: 2.0.0 +;; Package-Version: 20191028.1402 ;; Author: Shingo Fukuyama - http://fukuyama.co -;; URL: https://github.com/ShingoFukuyama/helm-swoop +;; URL: https://github.com/emacsorphanage/helm-swoop ;; Created: Oct 24 2013 -;; Keywords: helm swoop inner buffer search -;; Package-Requires: ((helm "1.0") (emacs "24.3")) +;; Keywords: convenience, helm, swoop, inner, buffer, search +;; Package-Requires: ((helm "3.2") (emacs "24.4")) -;; 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 2 of -;; the License, or (at your option) any later version. +;; 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. +;; 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: @@ -93,6 +97,7 @@ (require 'helm-grep) (declare-function migemo-search-pattern-get "migemo") +(declare-function migemo-forward "migemo") (declare-function projectile-buffers-with-file-or-process "projectile") (declare-function projectile-project-buffers "projectile") (defvar projectile-buffers-filter-function) @@ -121,31 +126,34 @@ :group 'helm-swoop) (defcustom helm-swoop-speed-or-color nil - "If nil, you can slightly boost invoke speed in exchange for text color" - :group 'helm-swoop :type 'boolean) + "If nil, you can slightly boost invoke speed in exchange for text color" + :group 'helm-swoop :type 'boolean) (defcustom helm-swoop-use-line-number-face nil "Use face to line numbers on helm-swoop buffer" :group 'helm-swoop :type 'boolean) (defcustom helm-swoop-split-with-multiple-windows nil - "Split window when having multiple windows open" - :group 'helm-swoop :type 'boolean) + "Split window when having multiple windows open" + :group 'helm-swoop :type 'boolean) (defcustom helm-swoop-move-to-line-cycle t - "Return to the opposite side of line" - :group 'helm-swoop :type 'boolean) + "Return to the opposite side of line" + :group 'helm-swoop :type 'boolean) (defcustom helm-swoop-split-direction 'split-window-vertically - "Split direction" - :type '(choice (const :tag "vertically" split-window-vertically) - (const :tag "horizontally" split-window-horizontally)) - :group 'helm-swoop) + "Split direction" + :type '(choice (const :tag "vertically" split-window-vertically) + (const :tag "horizontally" split-window-horizontally)) + :group 'helm-swoop) (defcustom helm-swoop-use-fuzzy-match nil "If t, use fuzzy matching functions as well as exact matches." :group 'helm-swoop :type 'boolean) +(defcustom helm-swoop-min-overlay-length 2 + "Minimum pattern length before applying the overlay on the matched word." + :group 'helm-swoop :type 'integer) (defvar helm-swoop-split-window-function (lambda ($buf &rest _$args) - (if helm-swoop-split-with-multiple-windows - (funcall helm-swoop-split-direction) - (when (one-window-p) + (if helm-swoop-split-with-multiple-windows + (funcall helm-swoop-split-direction) + (when (one-window-p) (funcall helm-swoop-split-direction))) (other-window 1) (switch-to-buffer $buf)) @@ -160,6 +168,23 @@ :group 'helm-swoop :type 'hook) +(defcustom helm-swoop-flash-region-function 'helm-swoop-flash-word + "The function used to flash the result when a search done." + :group 'helm-swoop + :type '(choice + (const :tag "Default highlight function" helm-swoop-flash-word) + (const :tag "Pulse highlight function" pulse-momentary-highlight-region) + function)) + +(defcustom helm-swoop-fontify-buffer-size-limit 100000 + "If buffer size smaller than value, do fontify to make buffer highlighted. + +If value is symbol `always', always do fontify." + :group 'helm-swoop + :type '(choice + integer + (const :tag "Always Fontify" always))) + (defvar helm-swoop-candidate-number-limit 19999) (defvar helm-swoop-buffer "*Helm Swoop*") (defvar helm-swoop-prompt "Swoop: ") @@ -169,8 +194,8 @@ ;; Buffer local variables (defvar helm-swoop-list-cache) -(defvar helm-swoop-pattern) ; Keep helm-pattern value -(defvar helm-swoop-last-query) ; Last search query for resume +(defvar helm-swoop-pattern nil) ; Keep helm-pattern value +(defvar helm-swoop-last-query nil) ; Last search query for resume (defvar-local helm-swoop-last-prefix-number 1) ; For multiline highlight ;; Global variables @@ -181,21 +206,55 @@ (defvar helm-swoop-line-overlay nil "Overlay object to indicate other window's line") +(defvar helm-swoop--basic-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (dolist (action '(next-line previous-line next-page previous-page + beginning-of-buffer end-of-buffer toggle-visible-mark)) + (let ((orig-fn (intern (format "helm-%s" action))) + (new-fn (intern (format "helm-swoop-%s" action)))) + (defalias new-fn `(lambda (&optional arg) + (interactive "p") + (call-interactively ',orig-fn) + (helm-swoop--move-line-action)) + (format "Replacement of `%s' action for `helm-swoop'. + +\(fn ARG)" orig-fn)) + (define-key map `[remap ,orig-fn] new-fn))) + map)) + (defvar helm-swoop-map (let (($map (make-sparse-keymap))) - (set-keymap-parent $map helm-map) + (set-keymap-parent $map helm-swoop--basic-map) (define-key $map (kbd "C-c C-e") 'helm-swoop-edit) (define-key $map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop) (define-key $map (kbd "C-w") 'helm-swoop-yank-thing-at-point) (define-key $map (kbd "^") 'helm-swoop-caret-match) - (delq nil $map)) + $map) "Keymap for helm-swoop") +(defvar helm-multi-swoop--basic-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map helm-map) + (dolist (action '(next-line previous-line next-page previous-page + beginning-of-buffer end-of-buffer toggle-visible-mark)) + (let ((orig-fn (intern (format "helm-%s" action))) + (new-fn (intern (format "helm-multi-swoop-%s" action)))) + (defalias new-fn `(lambda (&optional arg) + (interactive "p") + (call-interactively ',orig-fn) + (helm-multi-swoop--move-line-action)) + (format "Replacement of `%s' action for `helm-multi-swoop'. + +\(fn ARG)" orig-fn)) + (define-key map `[remap ,orig-fn] new-fn))) + map)) + (defvar helm-multi-swoop-map (let (($map (make-sparse-keymap))) - (set-keymap-parent $map helm-map) + (set-keymap-parent $map helm-multi-swoop--basic-map) (define-key $map (kbd "C-c C-e") 'helm-multi-swoop-edit) - (delq nil $map))) + $map)) (defvar helm-c-source-swoop-match-functions '(helm-mm-exact-match @@ -203,10 +262,62 @@ helm-mm-3-migemo-match)) (defvar helm-c-source-swoop-search-functions - '(helm-mm-exact-search - helm-mm-search - helm-candidates-in-buffer-search-default-fn - helm-mm-3-migemo-search)) + '(helm-mm-exact-search + helm-mm-search + helm-candidates-in-buffer-search-default-fn + helm-mm-3-migemo-search)) + +(defvar helm-swoop-font-lock-exclude + '(Man-mode + adoc-mode + bbdb-mode + bongo-library-mode + bongo-mode + bongo-playlist-mode + bookmark-bmenu-mode + circe-channel-mode + circe-query-mode + circe-server-mode + deadgrep-mode + debbugs-gnu-mode + dired-mode + elfeed-search-mode + elfeed-show-mode + emms-playlist-mode + emms-stream-mode + erc-mode + eshell-mode + eww-mode + forth-block-mode + forth-mode + fundamental-mode + gnus-article-mode + gnus-group-mode + gnus-summary-mode + help-mode + helpful-mode + jabber-chat-mode + magit-popup-mode + matrix-client-mode + matrix-client-room-list-mode + mu4e-headers-mode + mu4e-view-mode + nix-mode + notmuch-search-mode + notmuch-tree-mode + occur-edit-mode + occur-mode + org-agenda-mode + package-menu-mode + rcirc-mode + sauron-mode + treemacs-mode + twittering-mode + vc-dir-mode + w3m-mode + woman-mode + xref--xref-buffer-mode) + "List of major-modes that are incompatible with `font-lock-ensure'.") (defun helm-swoop-match-functions () (if helm-swoop-use-fuzzy-match @@ -224,14 +335,7 @@ :group 'helm-swoop :type 'function) (defun helm-swoop-pre-input-optimize ($query) - (when $query - (let (($regexp (list '("\+" . "\\\\+") - '("\*" . "\\\\*") - '("\#" . "\\\\#")))) - (mapc (lambda ($r) - (setq $query (replace-regexp-in-string (car $r) (cdr $r) $query))) - $regexp) - $query))) + (when $query (regexp-quote $query))) (defsubst helm-swoop--goto-line ($line) (goto-char (point-min)) @@ -241,26 +345,19 @@ (recenter (/ (window-height) 2))) (defsubst helm-swoop--delete-overlay ($identity &optional $beg $end) - (or $beg (setq $beg (point-min))) - (or $end (setq $end (point-max))) - (overlay-recenter $end) + (overlay-recenter (or $end (point-max))) (mapc (lambda ($o) (if (overlay-get $o $identity) (delete-overlay $o))) - (overlays-in $beg $end))) + (overlays-in (or $beg (point-min)) (or $end (point-max))))) (defsubst helm-swoop--get-string-at-line () (buffer-substring-no-properties (point-at-bol) (point-at-eol))) -(defsubst helm-swoop--buffer-substring ($point-min $point-max) +(defun helm-swoop--buffer-substring ($point-min $point-max) (if helm-swoop-speed-or-color (let (($content (buffer-substring $point-min $point-max))) - (with-temp-buffer - (let ((inhibit-read-only t)) - (insert $content) - (remove-text-properties (point-min) (point-max) '(read-only t)) - (setq $content (buffer-substring (point-min) (point-max))))) - $content) + (propertize $content 'read-only nil)) (buffer-substring-no-properties $point-min $point-max))) ;;;###autoload @@ -312,7 +409,7 @@ (helm-swoop--unveil-invisible-overlay)) (defun helm-swoop--validate-regexp (regexp) - (condition-case nil + (condition-case _err (progn (string-match-p regexp "") t) @@ -320,9 +417,9 @@ (defun helm-swoop--target-word-overlay ($identity &optional $threshold) (interactive) - (or $threshold (setq $threshold 2)) (save-excursion (let (($pat (split-string helm-pattern " ")) + ($threshold (or $threshold 2)) $o) (mapc (lambda ($wd) (when (and (helm-swoop--validate-regexp $wd) (< $threshold (length $wd))) @@ -334,15 +431,12 @@ (if (string-match "^\\^\\[0\\-9\\]\\+\\.\\(.+\\)" $wd) (setq $wd (concat "^" (match-string 1 $wd)))) (overlay-recenter (point-max)) - (let (finish) - (while (and (not finish) (re-search-forward $wd nil t)) - (if (= (match-beginning 0) (match-end 0)) - (forward-char 1) - (setq $o (make-overlay (match-beginning 0) (match-end 0))) - (overlay-put $o 'face 'helm-swoop-target-word-face) - (overlay-put $o $identity t)) - (when (eobp) - (setq finish t)))))) + (while (and (not (eobp)) (re-search-forward $wd nil t)) + (if (= (match-beginning 0) (match-end 0)) + (forward-char 1) + (setq $o (make-overlay (match-beginning 0) (match-end 0))) + (overlay-put $o 'face 'helm-swoop-target-word-face) + (overlay-put $o $identity t))))) $pat)))) (defun helm-swoop--restore-unveiled-overlay () @@ -366,24 +460,6 @@ This function needs to call after latest helm-swoop-line-overlay set." ;; helm action ------------------------------------------------ -(defadvice helm-next-line (around helm-swoop-next-line disable) - (let ((helm-move-to-line-cycle-in-source t)) - ad-do-it - (when (called-interactively-p 'any) - (helm-swoop--move-line-action)))) - -(defadvice helm-previous-line (around helm-swoop-previous-line disable) - (let ((helm-move-to-line-cycle-in-source t)) - ad-do-it - (when (called-interactively-p 'any) - (helm-swoop--move-line-action)))) - -(defadvice helm-toggle-visible-mark (around helm-swoop-toggle-visible-mark disable) - (let ((helm-move-to-line-cycle-in-source t)) - ad-do-it - (when (called-interactively-p 'any) - (helm-swoop--move-line-action)))) - (defun helm-swoop--move-line-action () (with-helm-window (let* (($key (helm-swoop--get-string-at-line)) @@ -392,12 +468,11 @@ This function needs to call after latest helm-swoop-line-overlay set." ;; Synchronizing line position (when (and $key $num) (with-selected-window helm-swoop-synchronizing-window - (progn - (helm-swoop--goto-line $num) - (with-current-buffer helm-swoop-target-buffer - (delete-overlay helm-swoop-line-overlay) - (helm-swoop--target-line-overlay-move)) - (helm-swoop--recenter))) + (helm-swoop--goto-line $num) + (with-current-buffer helm-swoop-target-buffer + (delete-overlay helm-swoop-line-overlay) + (helm-swoop--target-line-overlay-move)) + (helm-swoop--recenter)) (setq helm-swoop-last-line-info (cons helm-swoop-target-buffer $num)))))) @@ -446,8 +521,8 @@ This function needs to call after latest helm-swoop-line-overlay set." (string-to-number (match-string 0)) $list))) (setq $nearest-line (helm-swoop--nearest-line - (cdr helm-swoop-last-line-info) - $list)) + (cdr helm-swoop-last-line-info) + $list)) (goto-char $p) (re-search-forward (concat "^" (number-to-string $nearest-line) @@ -465,12 +540,12 @@ This function needs to call after latest helm-swoop-line-overlay set." "Overlay target words" (with-helm-window (setq helm-swoop-pattern helm-pattern) - (when (< 2 (length helm-pattern)) + (when (< helm-swoop-min-overlay-length (length helm-pattern)) (helm-swoop--delete-overlay 'target-buffer) - (helm-swoop--target-word-overlay 'target-buffer) + (helm-swoop--target-word-overlay 'target-buffer helm-swoop-min-overlay-length) (with-selected-window helm-swoop-synchronizing-window (helm-swoop--delete-overlay 'target-buffer) - (helm-swoop--target-word-overlay 'target-buffer))))) + (helm-swoop--target-word-overlay 'target-buffer helm-swoop-min-overlay-length))))) (defun helm-swoop-flash-word ($match-beg $match-end) (interactive) @@ -484,21 +559,37 @@ This function needs to call after latest helm-swoop-line-overlay set." ;; core ------------------------------------------------ +(defun helm-swoop--maybe-fontify! () + "Ensure the entired buffer is highlighted." + (let ((fontify-safe? + (not (or (derived-mode-p 'magit-mode) + (bound-and-true-p magit-blame-mode) + (memq major-mode helm-swoop-font-lock-exclude) + (not (derived-mode-p 'prog-mode)))))) + (when (and helm-swoop-speed-or-color + font-lock-mode + fontify-safe? + (or (eq 'always helm-swoop-fontify-buffer-size-limit) + (< (buffer-size) helm-swoop-fontify-buffer-size-limit))) + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (with-no-warnings (font-lock-fontify-buffer)))))) + (defun helm-swoop--get-content ($buffer &optional $linum) "Get the whole content in buffer and add line number at the head. If $linum is number, lines are separated by $linum" (let (($buf (get-buffer $buffer))) (when $buf (with-current-buffer $buf - (let (($bufstr (helm-swoop--buffer-substring (point-min) (point-max))) - $return) + (helm-swoop--maybe-fontify!) + (let (($bufstr (helm-swoop--buffer-substring (point-min) (point-max)))) (with-temp-buffer (insert $bufstr) (goto-char (point-min)) (let (($i 1)) (insert (format "%s " $i)) (while (re-search-forward "\n" nil t) - (cl-incf $i) + (setq $i (1+ $i)) (if helm-swoop-use-line-number-face (insert (propertize (format "%s" $i) 'font-lock-face 'helm-swoop-line-number-face) " ") (insert (format "%s " $i)))) @@ -507,8 +598,7 @@ If $linum is number, lines are separated by $linum" (goto-char (point-min)) (while (re-search-forward "^[0-9]+\\s-*$" nil t) (replace-match "")))) - (setq $return (helm-swoop--buffer-substring (point-min) (point-max)))) - $return))))) + (helm-swoop--buffer-substring (point-min) (point-max)))))))) (defun helm-swoop--goto-line-action ($line) (run-hooks 'helm-swoop-before-goto-line-action-hook) @@ -519,10 +609,10 @@ If $linum is number, lines are separated by $linum" (mapconcat 'identity (split-string helm-pattern " ") "\\|"))) - (when (or (and (and (featurep 'migemo) helm-migemo-mode) - (migemo-forward $regex nil t)) + (when (or (and (featurep 'migemo) helm-migemo-mode (migemo-forward $regex nil t)) (re-search-forward $regex nil t)) - (helm-swoop-flash-word (match-beginning 0) (match-end 0)) + (funcall helm-swoop-flash-region-function + (match-beginning 0) (match-end 0)) (goto-char (match-beginning 0)) (run-hooks 'helm-swoop-after-goto-line-action-hook))) (helm-swoop--recenter)) @@ -537,14 +627,13 @@ If $linum is number, lines are separated by $linum" (setq helm-swoop-list-cache (helm-swoop--get-content helm-swoop-target-buffer t)) "\n" helm-swoop-last-prefix-number))) - (get-line . ,(if helm-swoop-speed-or-color - 'helm-swoop--buffer-substring - 'buffer-substring-no-properties)) + (get-line . ,#'helm-swoop--buffer-substring) (keymap . ,helm-swoop-map) (header-line . ,(substitute-command-keys "[\\\\[helm-swoop-edit]] Edit mode, \ [\\\\[helm-multi-swoop-all-from-helm-swoop]] apply all buffers")) - (action . (("Go to Line" . helm-swoop--goto-line-action))) + (action . (("Go to Line" . helm-swoop--goto-line-action) + ("Edit" . helm-swoop--edit))) ,(if (and helm-swoop-last-prefix-number (> helm-swoop-last-prefix-number 1)) '(multiline)) @@ -571,10 +660,11 @@ If $linum is number, lines are separated by $linum" (setq helm-swoop-last-prefix-number (or $multiline 1))) ;; $multiline is for resume -;; Delete cache when modified file is saved +;; Delete cache when buffer is saved or file changes on disk (defun helm-swoop--clear-cache () (if (boundp 'helm-swoop-list-cache) (setq helm-swoop-list-cache nil))) (add-hook 'after-save-hook 'helm-swoop--clear-cache) +(add-hook 'after-revert-hook 'helm-swoop--clear-cache) (defadvice narrow-to-region (around helm-swoop-advice-narrow-to-region activate) (helm-swoop--clear-cache) @@ -594,19 +684,7 @@ If $linum is number, lines are separated by $linum" (helm-swoop-back-to-last-point t) (helm-swoop--restore-unveiled-overlay)) (setq helm-swoop-invisible-targets nil) - (ad-disable-advice 'helm-next-line 'around 'helm-swoop-next-line) - (ad-activate 'helm-next-line) - (ad-disable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) - (ad-activate 'helm-previous-line) - (ad-disable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) - (ad-activate 'helm-toggle-visible-mark) - (ad-disable-advice 'helm-move--next-line-fn 'around - 'helm-multi-swoop-next-line-cycle) - (ad-activate 'helm-move--next-line-fn) - (ad-disable-advice 'helm-move--previous-line-fn 'around - 'helm-multi-swoop-previous-line-cycle) - (ad-activate 'helm-move--previous-line-fn) - (remove-hook 'helm-update-hook 'helm-swoop--pattern-match) + (remove-hook 'helm-after-update-hook 'helm-swoop--pattern-match) (remove-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position) (setq helm-swoop-last-query helm-swoop-pattern) (mapc (lambda ($ov) @@ -646,19 +724,7 @@ If $linum is number, lines are separated by $linum" (unwind-protect (progn ;; For synchronizing line position - (ad-enable-advice 'helm-next-line 'around 'helm-swoop-next-line) - (ad-activate 'helm-next-line) - (ad-enable-advice 'helm-previous-line 'around 'helm-swoop-previous-line) - (ad-activate 'helm-previous-line) - (ad-enable-advice 'helm-toggle-visible-mark 'around 'helm-swoop-toggle-visible-mark) - (ad-activate 'helm-toggle-visible-mark) - (ad-enable-advice 'helm-move--next-line-fn 'around - 'helm-multi-swoop-next-line-cycle) - (ad-activate 'helm-move--next-line-fn) - (ad-enable-advice 'helm-move--previous-line-fn 'around - 'helm-multi-swoop-previous-line-cycle) - (ad-activate 'helm-move--previous-line-fn) - (add-hook 'helm-update-hook 'helm-swoop--pattern-match) + (add-hook 'helm-after-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (cond ($query (if (string-match @@ -745,7 +811,7 @@ If $linum is number, lines are separated by $linum" ;; For helm-resume ------------------------ (defadvice helm-resume-select-buffer - (around helm-swoop-if-selected-as-resume activate) + (around helm-swoop-if-selected-as-resume activate) "Resume if *Helm Swoop* buffer selected as a resume when helm-resume with prefix" (if (boundp 'helm-swoop-last-query) @@ -890,7 +956,7 @@ If $linum is number, lines are separated by $linum" " [\\\\[helm-swoop--edit-complete]] Complete" ", [\\\\[helm-swoop--edit-cancel]] Cancel" ", [\\\\[helm-swoop--edit-delete-all-lines]] Delete All" - )) + )) 'face 'helm-bookmark-addressbook))) ;; Line number and editable area (while (re-search-forward "^\\([0-9]+\s\\)\\(.*\\)$" nil t) @@ -901,7 +967,7 @@ If $linum is number, lines are separated by $linum" ;; Line number (add-text-properties $bol1 $eol1 '(face font-lock-function-name-face - intangible t)) + intangible t)) ;; Editable area (remove-text-properties $bol2 $eol2 '(read-only t)) ;; For line tail @@ -992,48 +1058,6 @@ If $linum is number, lines are separated by $linum" #'projectile-buffers-with-file-or-process) ;; action ----------------------------------------------------- -(defadvice helm-next-line (around helm-multi-swoop-next-line disable) - (let ((helm-move-to-line-cycle-in-source nil)) - ad-do-it - (when (called-interactively-p 'any) - (helm-multi-swoop--move-line-action)))) - -(defadvice helm-previous-line (around helm-multi-swoop-previous-line disable) - (let ((helm-move-to-line-cycle-in-source nil)) - ad-do-it - (when (called-interactively-p 'any) - (helm-multi-swoop--move-line-action)))) - -(defadvice helm-toggle-visible-mark (around helm-multi-swoop-toggle-visible-mark disable) - (let ((helm-move-to-line-cycle-in-source nil)) - ad-do-it - (when (called-interactively-p 'any) - (helm-multi-swoop--move-line-action)))) - -(defadvice helm-move--next-line-fn (around helm-multi-swoop-next-line-cycle disable) - (if (not (helm-pos-multiline-p)) - (if (eq (point-max) (save-excursion (forward-line 1) (point))) - (when helm-swoop-move-to-line-cycle - (helm-beginning-of-buffer) - (helm-swoop--recenter)) - (forward-line 1)) - (let ((line-num (line-number-at-pos))) - (helm-move--next-multi-line-fn) - (when (and helm-swoop-move-to-line-cycle - (eq line-num (line-number-at-pos))) - (helm-beginning-of-buffer))))) - -(defadvice helm-move--previous-line-fn (around helm-multi-swoop-previous-line-cycle disable) - (if (not (helm-pos-multiline-p)) - (forward-line -1) - (helm-move--previous-multi-line-fn)) - (when (and (helm-pos-header-line-p) - (eq (point) (save-excursion (forward-line -1) (point)))) - (when helm-swoop-move-to-line-cycle - (helm-end-of-buffer)) - (when (helm-pos-multiline-p) - (helm-move--previous-multi-line-fn)))) - (defun helm-multi-swoop--move-line-action () (with-helm-window (let* (($key (buffer-substring (point-at-bol) (point-at-eol))) @@ -1122,9 +1146,11 @@ If $linum is number, lines are separated by $linum" (split-string helm-pattern " ") "\\|") nil t) - (helm-swoop-flash-word (match-beginning 0) (match-end 0)) + (funcall helm-swoop-flash-region-function + (match-beginning 0) (match-end 0)) (goto-char (match-beginning 0))) - (helm-swoop--recenter))))))) + (helm-swoop--recenter))) + ("Edit" . helm-multi-swoop--edit))))) (setq $preserve-position (cons (cons $buf (point)) $preserve-position)) (setq @@ -1135,22 +1161,7 @@ If $linum is number, lines are separated by $linum" $buffs) (unwind-protect (progn - (ad-enable-advice 'helm-next-line 'around - 'helm-multi-swoop-next-line) - (ad-activate 'helm-next-line) - (ad-enable-advice 'helm-previous-line 'around - 'helm-multi-swoop-previous-line) - (ad-activate 'helm-previous-line) - (ad-enable-advice 'helm-toggle-visible-mark 'around - 'helm-multi-swoop-toggle-visible-mark) - (ad-activate 'helm-toggle-visible-mark) - (ad-enable-advice 'helm-move--next-line-fn 'around - 'helm-multi-swoop-next-line-cycle) - (ad-activate 'helm-move--next-line-fn) - (ad-enable-advice 'helm-move--previous-line-fn 'around - 'helm-multi-swoop-previous-line-cycle) - (ad-activate 'helm-move--previous-line-fn) - (add-hook 'helm-update-hook 'helm-swoop--pattern-match) + (add-hook 'helm-after-update-hook 'helm-swoop--pattern-match) (add-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position t) (setq helm-swoop-line-overlay (make-overlay (point) (point))) @@ -1177,22 +1188,7 @@ If $linum is number, lines are separated by $linum" (helm-swoop-back-to-last-point t) (helm-swoop--restore-unveiled-overlay)) (setq helm-swoop-invisible-targets nil) - (ad-disable-advice 'helm-next-line 'around - 'helm-multi-swoop-next-line) - (ad-activate 'helm-next-line) - (ad-disable-advice 'helm-previous-line 'around - 'helm-multi-swoop-previous-line) - (ad-activate 'helm-previous-line) - (ad-disable-advice 'helm-toggle-visible-mark 'around - 'helm-multi-swoop-toggle-visible-mark) - (ad-activate 'helm-toggle-visible-mark) - (ad-disable-advice 'helm-move--next-line-fn 'around - 'helm-multi-swoop-next-line-cycle) - (ad-activate 'helm-move--next-line-fn) - (ad-disable-advice 'helm-move--previous-line-fn 'around - 'helm-multi-swoop-previous-line-cycle) - (ad-activate 'helm-move--previous-line-fn) - (remove-hook 'helm-update-hook 'helm-swoop--pattern-match) + (remove-hook 'helm-after-update-hook 'helm-swoop--pattern-match) (remove-hook 'helm-after-update-hook 'helm-swoop--keep-nearest-position) (setq helm-multi-swoop-last-query helm-swoop-pattern) (helm-swoop--restore-unveiled-overlay) @@ -1335,12 +1331,8 @@ Last selected buffers will be applied to helm-multi-swoop. (defun helm-swoop--wrap-function-with-pre-input-function ($target-func $pre-input-func) - (let (($restore helm-swoop-pre-input-function)) - (unwind-protect - (progn - (setq helm-swoop-pre-input-function $pre-input-func) - (funcall $target-func)) - (setq helm-swoop-pre-input-function $restore)))) + (let ((helm-swoop-pre-input-function $pre-input-func)) + (funcall $target-func))) ;;;###autoload (defun helm-swoop-without-pre-input () @@ -1490,7 +1482,7 @@ Last selected buffers will be applied to helm-multi-swoop. ;; Line number (add-text-properties $bol1 $eol1 '(face font-lock-function-name-face - intangible t)) + intangible t)) ;; Editable area (remove-text-properties $bol2 $eol2 '(read-only t)) ;; (add-text-properties $bol2 $eol2 '(font-lock-face helm-match)) @@ -1538,20 +1530,20 @@ Last selected buffers will be applied to helm-multi-swoop. (let ($contents) ;; Make ((number . line) (number . line) (number . line) ...) (with-temp-buffer - (insert (format "%s" (nth (1+ $i) $list))) - (goto-char (point-min)) - (while (re-search-forward "^\\([0-9]+\\)\s" nil t) - (setq $contents - (cons (cons (string-to-number (match-string 1)) - (buffer-substring-no-properties - (point) - (save-excursion - (if (re-search-forward - "^\\([0-9]+\\)\s\\|^\\(\\-+\\)" nil t) - (1- (match-beginning 0)) - (goto-char (point-max)) - (re-search-backward "\n" nil t))))) - $contents)))) + (insert (format "%s" (nth (1+ $i) $list))) + (goto-char (point-min)) + (while (re-search-forward "^\\([0-9]+\\)\s" nil t) + (setq $contents + (cons (cons (string-to-number (match-string 1)) + (buffer-substring-no-properties + (point) + (save-excursion + (if (re-search-forward + "^\\([0-9]+\\)\s\\|^\\(\\-+\\)" nil t) + (1- (match-beginning 0)) + (goto-char (point-max)) + (re-search-backward "\n" nil t))))) + $contents)))) ;; Make ((buffer-name (number . line) (number . line) ...) ;; (buffer-name (number . line) (number . line) ...) ...) (setq $pairs (cons (cons (nth $i $list) $contents) $pairs))) @@ -1632,7 +1624,7 @@ Last selected buffers will be applied to helm-multi-swoop. (or $point (setq $point (point))) (let (($face (or (get-char-property $point 'read-face-name) (get-char-property $point 'face)))) - $face)) + $face)) (defun helm-swoop--cull-face-include-line ($face) (let (($list) ($po (point-min))) @@ -1648,7 +1640,7 @@ Last selected buffers will be applied to helm-multi-swoop. (point-max))))) (overlay-put $ov 'face 'helm-swoop-target-word-face) (overlay-put $ov 'target-buffer 'helm-swoop-target-word-face))))) - (nreverse (delete-dups $list)))) + (nreverse (delete-dups $list)))) (defun helm-swoop-same-face-at-point (&optional $face) (interactive) @@ -1669,7 +1661,8 @@ Last selected buffers will be applied to helm-multi-swoop. (while (<= (setq $po (next-single-property-change $po 'face)) $poe) (when (eq 'helm-swoop-target-word-face (helm-swoop--get-at-face $po)) (goto-char $po)))) - (helm-swoop--recenter)))))))) + (helm-swoop--recenter))) + ("Edit" . helm-swoop--edit)))))) (defun helm-multi-swoop-same-face-at-point (&optional $face) (interactive) @@ -1692,4 +1685,9 @@ Last selected buffers will be applied to helm-multi-swoop. :$buflist (helm-multi-swoop--get-buffer-list))) (provide 'helm-swoop) + +;; Local Variables: +;; indent-tabs-mode: nil +;; End: + ;;; helm-swoop.el ends here -- 2.47.3