added typescript and readme

This commit is contained in:
Raymundo Vásquez Ruiz
2019-10-27 19:05:34 +01:00
parent b6023212ea
commit 22a9de120e
156 changed files with 7949 additions and 689 deletions

11
README.md Normal file
View File

@@ -0,0 +1,11 @@
# My EMACS configuration #
Supports:
* JavaScript
* JSON
* Typescript
* Rust
Addons:
* Autocompletion
* Projectile

View File

@@ -33,7 +33,7 @@
("exports" .
[1 0 0 0 0 0 0])
("require" .
[2 0 0 0 0 0 0])
[3 0 0 0 0 0 0])
("StepDefinitionTypes" .
[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0])
("END" .
@@ -87,4 +87,12 @@
("wprocess" .
[1 0 0 0 1 0 0 0])
("false" .
[1 0 0 0 0])))
[1 0 0 0 0])
("typescript-mode" .
[0 0 0 0 0 0 0 1 0 0 1 0 0 0 0])
("add-hook" .
[1 0 0 0 0 0 0 0])
("json-mode" .
[0 0 0 0 0 0 0 1 0])
("flycheck-mode" .
[0 0 0 0 0 1 0 0 0 0 0 0 0])))

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-10-27T10:10:02+0100 using RSA

File diff suppressed because it is too large Load Diff

View File

@@ -42,14 +42,21 @@
(require 'async)
(defcustom async-bytecomp-allowed-packages
;; FIXME: Arguably the default should be `all', but currently
;; this minor mode is silently/forcefully enabled by Helm and Magit to ensure
;; they get compiled asynchronously, so this conservative default value is
;; here to make sure that the mode can be enabled without the user's
;; explicit consent.
'(async helm helm-core helm-ls-git helm-ls-hg magit)
"Packages in this list will be compiled asynchronously by `package--compile'.
All the dependencies of these packages will be compiled async too,
so no need to add dependencies to this list.
The value of this variable can also be a list with a single element,
the symbol `all', in this case packages are always compiled asynchronously."
The value of this variable can also be the symbol `all', in this case
all packages are always compiled asynchronously."
:group 'async
:type '(repeat (choice symbol)))
:type '(choice
(const :tag "All packages" all)
(repeat symbol)))
(defvar async-byte-compile-log-file
(concat user-emacs-directory "async-bytecomp.log"))
@@ -109,46 +116,30 @@ All *.elc files are systematically deleted before proceeding."
(defvar package-alist)
(declare-function package-desc-reqs "package.el" (cl-x))
(defun async-bytecomp--get-package-deps (pkg &optional only)
(defun async-bytecomp--get-package-deps (pkgs)
;; Same as `package--get-deps' but parse instead `package-archive-contents'
;; because PKG is not already installed and not present in `package-alist'.
;; However fallback to `package-alist' in case PKG no more present
;; in `package-archive-contents' due to modification to `package-archives'.
;; See issue #58.
(let* ((pkg-desc (cadr (or (assq pkg package-archive-contents)
(assq pkg package-alist))))
(direct-deps (cl-loop for p in (package-desc-reqs pkg-desc)
for name = (car p)
when (or (assq name package-archive-contents)
(assq name package-alist))
collect name))
(indirect-deps (unless (eq only 'direct)
(delete-dups
(cl-loop for p in direct-deps append
(async-bytecomp--get-package-deps p))))))
(cl-case only
(direct direct-deps)
(separate (list direct-deps indirect-deps))
(indirect indirect-deps)
(t (delete-dups (append direct-deps indirect-deps))))))
(defun async-bytecomp-get-allowed-pkgs ()
(when (and async-bytecomp-allowed-packages
(listp async-bytecomp-allowed-packages))
(if package-archive-contents
(cl-loop for p in async-bytecomp-allowed-packages
when (assq p package-archive-contents)
append (async-bytecomp--get-package-deps p) into reqs
finally return
(delete-dups
(append async-bytecomp-allowed-packages reqs)))
async-bytecomp-allowed-packages)))
(let ((seen '()))
(while pkgs
(let ((pkg (pop pkgs)))
(unless (memq pkg seen)
(let ((pkg-desc (cadr (or (assq pkg package-archive-contents)
(assq pkg package-alist)))))
(when pkg-desc
(push pkg seen)
(setq pkgs (append (mapcar #'car (package-desc-reqs pkg-desc))
pkgs)))))))
seen))
(defadvice package--compile (around byte-compile-async)
(let ((cur-package (package-desc-name pkg-desc))
(pkg-dir (package-desc-dir pkg-desc)))
(if (or (equal async-bytecomp-allowed-packages '(all))
(memq cur-package (async-bytecomp-get-allowed-pkgs)))
(if (or (member async-bytecomp-allowed-packages '(t all (all)))
(memq cur-package (async-bytecomp--get-package-deps
async-bytecomp-allowed-packages)))
(progn
(when (eq cur-package 'async)
(fmakunbound 'async-byte-recompile-directory))

View File

@@ -1,4 +1,4 @@
(define-package "async" "20190503.656" "Asynchronous processing in Emacs" 'nil :keywords
(define-package "async" "20191009.1018" "Asynchronous processing in Emacs" 'nil :keywords
'("async")
:url "https://github.com/jwiegley/emacs-async")
;; Local Variables:

View File

@@ -0,0 +1,22 @@
;;; flymake-easy-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "flymake-easy" "flymake-easy.el" (0 0 0 0))
;;; Generated autoloads from flymake-easy.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flymake-easy" '("flymake-easy-")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; flymake-easy-autoloads.el ends here

View File

@@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "flymake-easy" "20140818.755" "Helpers for easily building flymake checkers" 'nil :commit "de41ea49503f71f997e5c359a2ad08df696c0147" :keywords '("convenience" "internal") :authors '(("Steve Purcell" . "steve@sanityinc.com")) :maintainer '("Steve Purcell" . "steve@sanityinc.com") :url "https://github.com/purcell/flymake-easy")

View File

@@ -0,0 +1,151 @@
;;; flymake-easy.el --- Helpers for easily building flymake checkers
;; Copyright (C) 2012 Steve Purcell
;; Author: Steve Purcell <steve@sanityinc.com>
;; URL: https://github.com/purcell/flymake-easy
;; Package-Version: 20140818.755
;; Version: DEV
;; Keywords: convenience, internal
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This library provides the `flymake-easy-load' helper function for
;; setting up flymake checkers. Just call that function with the
;; appropriate arguments in a major mode hook function. See
;; `flymake-ruby' for an example:
;; https://github.com/purcell/flymake-ruby
;;; Code:
(require 'flymake)
(defvar flymake-easy--active nil
"Indicates when flymake-easy-load has successfully run in this buffer.")
(defvar flymake-easy--command-fn nil
"The user-specified function for building the flymake command.")
(defvar flymake-easy--location nil
"Where to create the temp file when checking, one of 'tempdir, 'inplace or
'temp-with-folder.")
(defvar flymake-easy--extension nil
"The canonical file name extension to use for the current file.")
(mapc 'make-variable-buffer-local
'(flymake-easy--active
flymake-easy--command-fn
flymake-easy--location
flymake-easy--extension))
(defun flymake-easy--tempfile-in-temp-dir (file-name prefix)
"Create a temporary file for storing the contents of FILE-NAME in the system tempdir.
Argument PREFIX temp file prefix, supplied by flymake."
(make-temp-file (or prefix "flymake-easy")
nil
(concat "." flymake-easy--extension)))
(defun flymake-easy--flymake-init ()
"A catch-all flymake init function for use in `flymake-allowed-file-name-masks'."
(let* ((tempfile
(flymake-init-create-temp-buffer-copy
(cond
((eq 'tempdir flymake-easy--location)
'flymake-easy--tempfile-in-temp-dir)
((eq 'inplace flymake-easy--location)
'flymake-create-temp-inplace)
((eq 'temp-with-folder flymake-easy--location)
'flymake-create-temp-with-folder-structure)
(t
(error "unknown location for flymake-easy: %s" flymake-easy--location)))))
(command (funcall flymake-easy--command-fn tempfile)))
(list (car command) (cdr command))))
(defun flymake-easy-exclude-buffer-p ()
"Whether to skip flymake in the current buffer."
(and (fboundp 'tramp-tramp-file-p)
(buffer-file-name)
(tramp-tramp-file-p (buffer-file-name))))
(defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re info-re)
"Enable flymake in the containing buffer using a specific narrow configuration.
Argument COMMAND-FN function called to build the
command line to run (receives filename, returns list).
Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns').
Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\".
Argument LOCATION where to create the temporary copy: one of 'tempdir (default), 'inplace or 'temp-with-folder
Argument WARNING-RE a pattern which identifies error messages as warnings.
Argument INFO-RE a pattern which identifies messages as infos (supported only
by the flymake fork at https://github.com/illusori/emacs-flymake)."
(let ((executable (car (funcall command-fn "dummy"))))
(if (executable-find executable) ;; TODO: defer this checking
(unless (flymake-easy-exclude-buffer-p)
(setq flymake-easy--command-fn command-fn
flymake-easy--location (or location 'tempdir)
flymake-easy--extension extension
flymake-easy--active t)
(set (make-local-variable 'flymake-allowed-file-name-masks)
'(("." flymake-easy--flymake-init)))
(when err-line-patterns
(set (make-local-variable 'flymake-err-line-patterns) err-line-patterns))
(dolist (var '(flymake-warning-re flymake-warn-line-regexp))
(set (make-local-variable var) (or warning-re "^[wW]arn")))
(when (boundp 'flymake-info-line-regexp)
(set (make-local-variable 'flymake-info-line-regexp)
(or info-re "^[iI]nfo")))
(flymake-mode t))
(message "Not enabling flymake: '%s' program not found" executable))))
;; Internal overrides for flymake
(defun flymake-easy--find-all-matches (str)
"Return every match for `flymake-err-line-patterns' in STR.
This is a judicious override for `flymake-split-output', enabled
by the advice below, which allows for matching multi-line
patterns."
(let (matches
(last-match-end-pos 0))
(dolist (pattern flymake-err-line-patterns)
(let ((regex (car pattern))
(pos 0))
(while (string-match regex str pos)
(push (match-string 0 str) matches)
(setq pos (match-end 0)))
(setq last-match-end-pos (max pos last-match-end-pos))))
(let ((residual (substring str last-match-end-pos)))
(list matches
(unless (string= "" residual) residual)))))
(defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect)
"Override `flymake-split-output' to support mult-line error messages."
(setq ad-return-value (if flymake-easy--active
(flymake-easy--find-all-matches output)
ad-do-it)))
(defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate)
(when flymake-easy--active
(setq flymake-check-was-interrupted t)))
(provide 'flymake-easy)
;; Local Variables:
;; coding: utf-8
;; byte-compile-warnings: (not cl-functions)
;; eval: (checkdoc-minor-mode 1)
;; End:
;;; flymake-easy.el ends here

Binary file not shown.

View File

@@ -0,0 +1,32 @@
;;; flymake-json-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "flymake-json" "flymake-json.el" (0 0 0 0))
;;; Generated autoloads from flymake-json.el
(autoload 'flymake-json-load "flymake-json" "\
Configure flymake mode to check the current buffer's javascript syntax.
\(fn)" t nil)
(autoload 'flymake-json-maybe-load "flymake-json" "\
Call `flymake-json-load' if this file appears to be json.
\(fn)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flymake-json" '("flymake-json-")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; flymake-json-autoloads.el ends here

View File

@@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "flymake-json" "20180511.911" "A flymake handler for json using jsonlint" '((flymake-easy "0.1")) :commit "ae58795f948402e987cda4c15f10354f8ec2d0fd" :authors '(("Steve Purcell" . "steve@sanityinc.com")) :maintainer '("Steve Purcell" . "steve@sanityinc.com") :url "https://github.com/purcell/flymake-json")

View File

@@ -0,0 +1,79 @@
;;; flymake-json.el --- A flymake handler for json using jsonlint
;; Copyright (c) 2013-2017 Steve Purcell
;; Author: Steve Purcell <steve@sanityinc.com>
;; Homepage: https://github.com/purcell/flymake-json
;; Package-Version: 20180511.911
;; Package-X-Original-Version: 0
;; Package-Requires: ((flymake-easy "0.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This package requires the "jsonlint" program, which can be installed using npm:
;;
;; npm install jsonlint -g
;;
;; Usage:
;;
;; (require 'flymake-json)
;;
;; Then, if you're using `json-mode':
;;
;; (add-hook 'json-mode-hook 'flymake-json-load)
;;
;; or, if you use `js-mode' for json:
;;
;; (add-hook 'js-mode-hook 'flymake-json-maybe-load)
;;
;; otherwise:
;;
;; (add-hook 'find-file-hook 'flymake-json-maybe-load)
;;
;; Uses flymake-easy, from https://github.com/purcell/flymake-easy
;;; Code:
(require 'flymake-easy)
(defconst flymake-json-err-line-patterns
'(("^\\(.+\\)\: line \\([0-9]+\\), col \\([0-9]+\\), \\(.+\\)$" nil 2 3 4)))
(defun flymake-json-command (filename)
"Construct a command that flymake can use to check json source in FILENAME."
(list "jsonlint" "-c" "-q" filename))
;;;###autoload
(defun flymake-json-load ()
"Configure flymake mode to check the current buffer's javascript syntax."
(interactive)
(flymake-easy-load 'flymake-json-command
flymake-json-err-line-patterns
'tempdir
"json"))
;;;###autoload
(defun flymake-json-maybe-load ()
"Call `flymake-json-load' if this file appears to be json."
(interactive)
(if (and buffer-file-name
(string= "json" (file-name-extension buffer-file-name)))
(flymake-json-load)))
(provide 'flymake-json)
;;; flymake-json.el ends here

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
elpa/gnupg/tofu.db Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -694,6 +694,9 @@ 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'.
@@ -707,7 +710,7 @@ in `helm-current-prefix-arg', otherwise if prefix args were given before
That's mean you can pass prefix args before or after calling a command
that use `helm-comp-read' See `helm-M-x' for example.
\(fn PROMPT COLLECTION &key TEST INITIAL-INPUT DEFAULT PRESELECT (BUFFER \"*Helm Completions*\") MUST-MATCH FUZZY REVERSE-HISTORY (REQUIRES-PATTERN 0) HISTORY INPUT-HISTORY (CASE-FOLD helm-comp-read-case-fold-search) (DEL-INPUT t) (PERSISTENT-ACTION nil) (PERSISTENT-HELP \"DoNothing\") (MODE-LINE helm-comp-read-mode-line) HELP-MESSAGE (KEYMAP helm-comp-read-map) (NAME \"Helm Completions\") HEADER-NAME CANDIDATES-IN-BUFFER MATCH-PART 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)
\(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.

View File

@@ -3878,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

View File

@@ -123,17 +123,7 @@ 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-locate-update-mode-line "Find")
(helm-log "Error: Find %s"
(replace-regexp-in-string "\n" "" event))))))))

View File

@@ -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))))))))))

View File

@@ -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)
@@ -222,9 +217,47 @@ know what you are doing."
(set-keymap-parent map helm-map)
(define-key map (kbd "<C-return>") 'helm-cr-empty-string)
(define-key map (kbd "M-RET") 'helm-cr-empty-string)
(define-key map (kbd "DEL") 'helm-mode-delete-char-backward-maybe)
map)
"Keymap for `helm-comp-read'.")
(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 nil
"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
;;
@@ -324,7 +357,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
@@ -428,6 +461,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)
@@ -530,6 +564,9 @@ 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'.
@@ -578,7 +615,9 @@ that use `helm-comp-read' See `helm-M-x' for example."
;; `all-completions' which defeat helm
;; matching functions (multi match, fuzzy
;; etc...) issue #2134.
collection test sort alistp "")))
collection test sort alistp
(if (and match-dynamic (null candidates-in-buffer))
helm-pattern ""))))
(helm-cr-default default cands))))
(history-get-candidates
(lambda ()
@@ -614,8 +653,10 @@ 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
@@ -623,6 +664,7 @@ that use `helm-comp-read' See `helm-M-x' for example."
:keymap loc-map
:group group
:mode-line mode-line
:match-dynamic match-dynamic
:help-message help-message
:action action-fn
:volatile volatile))
@@ -1269,8 +1311,35 @@ The `helm-find-files' history `helm-ff-history' is used here."
"Default sort function for completion-in-region."
(sort candidates 'helm-generic-sort-fn))
(defun helm-completion-in-region--comps (comps afun file-comp-p)
(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.
(mapcar (lambda (s)
(let ((ann (funcall afun s)))
(if ann
(cons
(concat
s
(propertize
" " 'display
(propertize
ann
'face 'completions-annotations)))
s)
s)))
comps)
comps)))
(defun helm-mode--completion-in-region-initial-input (str)
(propertize str 'read-only t 'face 'helm-mode-prefix 'rear-nonsticky t))
(if (memq helm-completion-style '(helm helm-fuzzy))
(propertize str 'read-only t 'face 'helm-mode-prefix 'rear-nonsticky t)
str))
(defun helm-mode-delete-char-backward-1 ()
(interactive)
@@ -1303,6 +1372,94 @@ 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)
(defun helm-completion-in-region-sort-flex-candidates (candidates _source)
"Sort CANDIDATES computed with flex completion-style."
(sort candidates (lambda (s1 s2)
(let* ((str1 (if (consp s1) (car s1) s1))
(str2 (if (consp s2) (car s2) s2))
(scr1 (get-text-property 0 'completion-score str1))
(scr2 (get-text-property 0 'completion-score str2)))
(if (and scr1 scr2)
(> scr1 scr2)
(helm-generic-sort-fn s1 s2))))))
(defun helm-completion-in-region--fix-completion-styles ()
"Use a simple setting for `completion-styles' when using helm styles.
Returns a suitable value for `completion-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 completion-styles
when (member style all-styles)
collect style)))
;; Helm style
(defun helm-completion-try-completion (string table pred point)
"The try completion function for `completing-styles-alist'.
Actually do nothing."
(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)
;; For now (length prefix) is always == to 0.
(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)))
(multi-pats (string-match-p " " string))
(init-str (if multi-pats
(car (helm-mm-split-pattern string))
string))
(all (if (or multi-pats (string-match-p "\\`!" init-str))
(helm-completion--all-completions-multi string table pred)
(all-completions init-str table pred))))
(list all string prefix suffix point)))
(defun helm-completion--merge-metadata (metadata)
(if (and (eq helm-completion-style 'emacs)
(assq 'helm-completion completion-category-defaults)
(assq 'helm completion-styles-alist)
(not (assq 'category metadata)))
(append
metadata
'((category . helm-completion)))
metadata))
;; Setup completion styles for helm
(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)
(cl-pushnew '(helm-completion (styles . (helm)))
completion-category-defaults
:test 'equal))
(defun helm-mode--disable-completion-styles ()
(setq completion-styles-alist
(delete (assq 'helm completion-styles-alist)
completion-styles-alist)
completion-category-defaults
(delete (assq 'helm-completion completion-category-defaults)
completion-category-defaults)))
(defun helm--completion-in-region (start end collection &optional predicate)
"Helm replacement of `completion--in-region'.
Can be used as value for `completion-in-region-function'."
@@ -1313,9 +1470,23 @@ Can be used as value for `completion-in-region-function'."
(advice-add
'lisp--local-variables
:around #'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)
(input (buffer-substring-no-properties start end))
(helm-completion-in-region-default-sort-fn
(cond ((and (eq helm-completion-style 'emacs)
;; Emacs-27 only.
(memq 'flex completion-styles))
#'helm-completion-in-region-sort-flex-candidates)
((or (eq helm-completion-style 'helm-fuzzy)
;; Sly only.
(memq 'backend completion-styles))
nil)
(t helm-completion-in-region-default-sort-fn)))
(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))
@@ -1333,23 +1504,11 @@ Can be used as value for `completion-in-region-function'."
;; e.g "foo" => "foo <f>" 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
(metadata (helm-completion--merge-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 ""))
" "))
@@ -1358,33 +1517,47 @@ Can be used as value for `completion-in-region-function'."
;; 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.
(hash (make-hash-table :test 'equal))
;; `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
(or (gethash str hash)
(puthash str (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)
hash)))
(last-data (last comps)))
(setq base-size
(helm-aif (cdr last-data)
(prog1 (or base-size it)
(setcdr last-data nil))
0))
(helm-completion-in-region--comps
comps 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: ")
(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))
data
:name str-command
:fuzzy helm-completion-in-region-fuzzy-match
:nomark (null crm)
:marked-candidates crm
:initial-input
@@ -1400,10 +1573,13 @@ Can be used as value for `completion-in-region-function'."
(t (concat (helm-mode--completion-in-region-initial-input 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))
: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 ()
@@ -1414,6 +1590,12 @@ Can be used as value for `completion-in-region-function'."
(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)
(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)
@@ -1430,8 +1612,6 @@ Can be used as value for `completion-in-region-function'."
(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))))
(defun helm-mode--in-file-completion-p ()
(with-helm-current-buffer
@@ -1501,7 +1681,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).
@@ -1515,7 +1696,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
@@ -1523,6 +1705,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)
@@ -1531,7 +1714,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)

View File

@@ -1,4 +1,4 @@
(define-package "helm" "20191004.1946" "Helm is an Emacs incremental and narrowing framework"
(define-package "helm" "20191026.431" "Helm is an Emacs incremental and narrowing framework"
'((emacs "24.4")
(async "1.9.3")
(popup "0.5.3")

View File

@@ -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))))
(remove-hook 'helm-after-update-hook 'helm-top--skip-top-line)))
;;;###autoload
(defun helm-list-emacs-process ()

View File

@@ -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
:default (and (stringp str)
(if (or helm-etags-fuzzy-match
(and (eq major-mode 'haskell-mode)
(string-match "[']\\'" str)))
str
(list (concat "\\_<" str "\\_>") str))
(list (concat "\\_<" str "\\_>") str)))
:buffer "*helm etags*"))))
(provide 'helm-tags)

Some files were not shown because too many files have changed in this diff Show More