[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5264379 29/40: Cleanup redundant cl dependency, :group & :
From: |
Noam Postavsky |
Subject: |
[elpa] master 5264379 29/40: Cleanup redundant cl dependency, :group & :require |
Date: |
Wed, 26 Oct 2016 23:06:34 +0000 (UTC) |
branch: master
commit 52643799088eb653e9250b4f04319e5e3e2801a0
Author: Stefan Monnier <address@hidden>
Commit: Noam Postavsky <address@hidden>
Cleanup redundant cl dependency, :group & :require
* yasnippet.el: Replace calls to cl functions with cl- prefixed cl-lib
equivalents. Use #' to quote function symbols.
(yas-snippet-dirs, yas-new-snippet-default, yas-prompt-functions):
(yas-indent-line, yas-also-auto-indent-first-line):
(yas-snippet-revival, yas-triggers-in-field):
(yas-fallback-behavior, yas-choose-keys-first, yas-choose-tables-first):
(yas-use-menu, yas-trigger-symbol, yas-wrap-around-region):
(yas-good-grace, yas-visit-from-menu, yas-expand-only-for-last-commands):
(yas-field-highlight-face, yas--field-debug-face): Remove redundant
:group.
(yas-snippet-dirs, yas-global-mode): Remove :require. The :set value
for yas-snippet-dirs checks if yas-reload-all is fbound, and the
autoload cookie on yas-global-mode makes :require redundant.
---
yasnippet.el | 346 ++++++++++++++++++++++++++++------------------------------
1 file changed, 164 insertions(+), 182 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 0223963..250f957 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -131,7 +131,6 @@
;;; Code:
-(require 'cl)
(require 'cl-lib)
(require 'easymenu)
(require 'help-mode)
@@ -178,8 +177,6 @@ created with `yas-new-snippet'. "
:type '(choice (directory :tag "Single directory")
(repeat :tag "List of directories"
(choice (directory) (variable))))
- :group 'yasnippet
- :require 'yasnippet
:set #'(lambda (symbol new)
(let ((old (and (boundp symbol)
(symbol-value symbol))))
@@ -210,8 +207,7 @@ created with `yas-new-snippet'. "
$0`(yas-escape-text yas-selected-text)`"
"Default snippet to use when creating a new snippet.
If nil, don't use any snippet."
- :type 'string
- :group 'yasnippet)
+ :type 'string)
(defcustom yas-prompt-functions '(yas-dropdown-prompt
yas-completing-prompt
@@ -240,8 +236,7 @@ nil.
signal `quit' with
(signal \\='quit \"user quit!\")."
- :type '(repeat function)
- :group 'yasnippet)
+ :type '(repeat function))
(defcustom yas-indent-line 'auto
"Controls indenting applied to a recent snippet expansion.
@@ -257,28 +252,24 @@ after expansion (the manual per-line \"$>\" indentation
still
applies)."
:type '(choice (const :tag "Nothing" nothing)
(const :tag "Fixed" fixed)
- (const :tag "Auto" auto))
- :group 'yasnippet)
+ (const :tag "Auto" auto)))
(defcustom yas-also-auto-indent-first-line nil
"Non-nil means also auto indent first line according to mode.
Naturally this is only valid when `yas-indent-line' is `auto'"
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-snippet-revival t
"Non-nil means re-activate snippet fields after undo/redo."
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-triggers-in-field nil
"If non-nil, allow stacked expansions (snippets inside snippets).
Otherwise `yas-next-field-or-maybe-expand' just moves on to the
next field"
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-fallback-behavior 'call-other-command
"How to act when `yas-expand' does *not* expand a snippet.
@@ -294,8 +285,7 @@ next field"
COMMAND. If ARGS is non-nil, call COMMAND non-interactively
with ARGS as arguments."
:type '(choice (const :tag "Call previous command" call-other-command)
- (const :tag "Do nothing" return-nil))
- :group 'yasnippet)
+ (const :tag "Do nothing" return-nil)))
(defcustom yas-choose-keys-first nil
"If non-nil, prompt for snippet key first, then for template.
@@ -303,8 +293,7 @@ next field"
Otherwise prompts for all possible snippet names.
This affects `yas-insert-snippet' and `yas-visit-snippet-file'."
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-choose-tables-first nil
"If non-nil, and multiple eligible snippet tables, prompts user for tables
first.
@@ -313,8 +302,7 @@ Otherwise, user chooses between the merging together of all
eligible tables.
This affects `yas-insert-snippet', `yas-visit-snippet-file'"
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-use-menu 'abbreviate
"Display a YASnippet menu in the menu bar.
@@ -332,16 +320,14 @@ menu and the modes set in `yas--extra-modes' are listed.
Any other non-nil value, every submenu is listed."
:type '(choice (const :tag "Full" full)
(const :tag "Abbreviate" abbreviate)
- (const :tag "No menu" nil))
- :group 'yasnippet)
+ (const :tag "No menu" nil)))
(defcustom yas-trigger-symbol (or (and (eq window-system 'mac)
(ignore-errors
(char-to-string ?\x21E5))) ;; little
->| sign
" =>")
"The text that will be used in menu to represent the trigger."
- :type 'string
- :group 'yasnippet)
+ :type 'string)
(defcustom yas-wrap-around-region nil
"What to insert for snippet's $0 field.
@@ -353,22 +339,19 @@ per-snippet basis. A value of `cua' is considered
equivalent to
:type '(choice (character :tag "Insert from register")
(const t :tag "Insert region contents")
(const nil :tag "Don't insert anything")
- (const cua)) ; backwards compat
- :group 'yasnippet)
+ (const cua))) ; backwards compat
(defcustom yas-good-grace t
"If non-nil, don't raise errors in inline elisp evaluation.
An error string \"[yas] error\" is returned instead."
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-visit-from-menu nil
"If non-nil visit snippets's files from menu, instead of expanding them.
This can only work when snippets are loaded from files."
- :type 'boolean
- :group 'yasnippet)
+ :type 'boolean)
(defcustom yas-expand-only-for-last-commands nil
"List of `last-command' values to restrict tab-triggering to, or nil.
@@ -381,8 +364,7 @@ Optionally, set this to something like
(self-insert-command) if
you to wish restrict expansion to only happen when the last
letter of the snippet tab trigger was typed immediately before
the trigger key itself."
- :type '(repeat function)
- :group 'yasnippet)
+ :type '(repeat function))
(defcustom yas-alias-to-yas/prefix-p t
"If non-nil make aliases for the old style yas/ prefixed symbols.
@@ -394,13 +376,11 @@ It must be set to nil before loading yasnippet to take
effect."
;;
(defface yas-field-highlight-face
'((t (:inherit 'region)))
- "The face used to highlight the currently active field of a snippet"
- :group 'yasnippet)
+ "The face used to highlight the currently active field of a snippet")
(defface yas--field-debug-face
'()
- "The face used for debugging some overlays normally hidden"
- :group 'yasnippet)
+ "The face used for debugging some overlays normally hidden")
;;; User-visible variables
@@ -637,33 +617,33 @@ snippet itself contains a condition that returns the
symbol
)
("Prompting method"
["System X-widget" (setq yas-prompt-functions
- (cons 'yas-x-prompt
- (remove 'yas-x-prompt
+ (cons #'yas-x-prompt
+ (remove #'yas-x-prompt
yas-prompt-functions)))
:help "Use your windowing system's (gtk, mac, windows, etc...) default
menu"
:active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-x-prompt)]
+ #'yas-x-prompt)]
["Dropdown-list" (setq yas-prompt-functions
- (cons 'yas-dropdown-prompt
- (remove 'yas-dropdown-prompt
+ (cons #'yas-dropdown-prompt
+ (remove #'yas-dropdown-prompt
yas-prompt-functions)))
:help "Use a special dropdown list"
:active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-dropdown-prompt)]
+ #'yas-dropdown-prompt)]
["Ido" (setq yas-prompt-functions
- (cons 'yas-ido-prompt
- (remove 'yas-ido-prompt
+ (cons #'yas-ido-prompt
+ (remove #'yas-ido-prompt
yas-prompt-functions)))
:help "Use an ido-style minibuffer prompt"
:active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-ido-prompt)]
+ #'yas-ido-prompt)]
["Completing read" (setq yas-prompt-functions
- (cons 'yas-completing-prompt
- (remove 'yas-completing-prompt
+ (cons #'yas-completing-prompt
+ (remove #'yas-completing-prompt
yas-prompt-functions)))
:help "Use a normal minibuffer prompt"
:active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-completing-prompt)]
+ #'yas-completing-prompt)]
)
("Misc"
["Wrap region in exit marker"
@@ -776,10 +756,7 @@ Negative prefix argument turns off the mode.
Key bindings:
\\{yas-minor-mode-map}"
- nil
- ;; The indicator for the mode line.
- " yas"
- :group 'yasnippet
+ :lighter " yas" ;; The indicator for the mode line.
(cond ((and yas-minor-mode (featurep 'yasnippet))
;; Install the direct keymaps in `emulation-mode-map-alists'
;; (we use `add-hook' even though it's not technically a hook,
@@ -872,9 +849,7 @@ Honour `yas-dont-activate-functions', which see."
(yas-minor-mode 1)))
;;;###autoload
-(define-globalized-minor-mode yas-global-mode yas-minor-mode yas-minor-mode-on
- :group 'yasnippet
- :require 'yasnippet)
+(define-globalized-minor-mode yas-global-mode yas-minor-mode yas-minor-mode-on)
(defun yas--global-mode-reload-with-jit-maybe ()
"Run `yas-reload-all' when `yas-global-mode' is on."
@@ -913,9 +888,9 @@ Honour `yas-dont-activate-functions', which see."
"Menu used when snippet-mode is active."
(cons "Snippet"
(mapcar #'(lambda (ent)
- (when (third ent)
- (define-key map (third ent) (second ent)))
- (vector (first ent) (second ent) t))
+ (when (nth 2 ent)
+ (define-key map (nth 2 ent) (nth 1 ent)))
+ (vector (nth 0 ent) (nth 1 ent) t))
'(("Load this snippet" yas-load-snippet-buffer "\C-c\C-l")
("Load and quit window"
yas-load-snippet-buffer-and-close "\C-c\C-c")
("Try out this snippet" yas-tryout-snippet
"\C-c\C-t")))))
@@ -977,7 +952,7 @@ Honour `yas-dont-activate-functions', which see."
table
)
-(defstruct (yas--table (:constructor yas--make-snippet-table (name)))
+(cl-defstruct (yas--table (:constructor yas--make-snippet-table (name)))
"A table to store snippets for a particular mode.
Has the following fields:
@@ -1152,9 +1127,9 @@ Return TEMPLATE."
(unless (eq (cdr menu-binding-pair) :none)
;; the menu item name
;;
- (setf (cadar menu-binding-pair) (yas--template-name template))
+ (setf (cl-cadar menu-binding-pair) (yas--template-name template))
;; the :keys information (also visible to the user)
- (setf (getf (cdr (car menu-binding-pair)) :keys)
+ (setf (cl-getf (cdr (car menu-binding-pair)) :keys)
(or (and keybinding (key-description keybinding))
(and key (concat key yas-trigger-symbol))))))
(unless (yas--template-menu-managed-by-yas-define-menu template)
@@ -1165,7 +1140,7 @@ Return TEMPLATE."
(group (yas--template-group template)))
;; Remove from menu keymap
;;
- (assert menu-keymap)
+ (cl-assert menu-keymap)
(yas--delete-from-keymap menu-keymap (yas--template-uuid template))
;; Add necessary subgroups as necessary.
@@ -1228,10 +1203,10 @@ This function implements the rules described in
(let ((requirement (yas--require-template-specific-condition-p)))
(if (eq requirement 'always)
templates
- (remove-if-not #'(lambda (pair)
- (yas--template-can-expand-p
- (yas--template-condition (cdr pair)) requirement))
- templates))))
+ (cl-remove-if-not (lambda (pair)
+ (yas--template-can-expand-p
+ (yas--template-condition (cdr pair)) requirement))
+ templates))))
(defun yas--require-template-specific-condition-p ()
"Decide if this buffer requests/requires snippet-specific
@@ -1300,9 +1275,9 @@ Returns (TEMPLATES START END). This function respects
(save-excursion
(goto-char original)
(setq templates
- (mapcan #'(lambda (table)
- (yas--fetch table possible-key))
- (yas--get-snippet-tables))))))
+ (cl-mapcan (lambda (table)
+ (yas--fetch table possible-key))
+ (yas--get-snippet-tables))))))
(when templates
(list templates (point) original)))))
@@ -1556,31 +1531,31 @@ Optional PROMPT sets the prompt to use."
(sort templates #'(lambda (t1 t2)
(< (length (yas--template-name t1))
(length (yas--template-name t2))))))
- (some #'(lambda (fn)
- (funcall fn (or prompt "Choose a snippet: ")
- templates
- #'yas--template-name))
- yas-prompt-functions)))
+ (cl-some (lambda (fn)
+ (funcall fn (or prompt "Choose a snippet: ")
+ templates
+ #'yas--template-name))
+ yas-prompt-functions)))
(defun yas--prompt-for-keys (keys &optional prompt)
"Interactively choose a template key from the list KEYS.
Optional PROMPT sets the prompt to use."
(when keys
- (some #'(lambda (fn)
- (funcall fn (or prompt "Choose a snippet key: ") keys))
- yas-prompt-functions)))
+ (cl-some (lambda (fn)
+ (funcall fn (or prompt "Choose a snippet key: ") keys))
+ yas-prompt-functions)))
(defun yas--prompt-for-table (tables &optional prompt)
"Interactively choose a table from the list TABLES.
Optional PROMPT sets the prompt to use."
(when tables
- (some #'(lambda (fn)
- (funcall fn (or prompt "Choose a snippet table: ")
- tables
- #'yas--table-name))
- yas-prompt-functions)))
+ (cl-some (lambda (fn)
+ (funcall fn (or prompt "Choose a snippet table: ")
+ tables
+ #'yas--table-name))
+ yas-prompt-functions)))
(defun yas-x-prompt (prompt choices &optional display-fn)
"Display choices in a x-window prompt."
@@ -1597,9 +1572,10 @@ Optional PROMPT sets the prompt to use."
(selected-window)))
t)
`(,prompt ("title"
- ,@(mapcar* (lambda (c d) `(,(concat " " d) . ,c))
- choices
- (if display-fn (mapcar display-fn choices)
choices)))))
+ ,@(cl-mapcar (lambda (c d) `(,(concat " " d) . ,c))
+ choices
+ (if display-fn (mapcar display-fn choices)
+ choices)))))
(keyboard-quit))))
(defun yas-maybe-ido-prompt (prompt choices &optional display-fn)
@@ -1626,11 +1602,11 @@ Optional PROMPT sets the prompt to use."
nil 'require-match nil nil)))
(if (eq choices formatted-choices)
chosen
- (nth (or (position chosen formatted-choices :test #'string=) 0)
+ (nth (or (cl-position chosen formatted-choices :test #'string=) 0)
choices))))
(defun yas-no-prompt (_prompt choices &optional _display-fn)
- (first choices))
+ (cl-first choices))
;;; Defining snippets
@@ -1720,7 +1696,7 @@ the current buffers contents."
(defun yas--define-parents (mode parents)
"Add PARENTS to the list of MODE's parents."
- (puthash mode (remove-duplicates
+ (puthash mode (cl-remove-duplicates
(append parents
(gethash mode yas--parents)))
yas--parents))
@@ -1852,9 +1828,10 @@ prefix argument."
(catch 'abort
(let ((errors)
(snippet-editing-buffers
- (remove-if-not #'(lambda (buffer)
- (with-current-buffer buffer
yas--editing-template))
- (buffer-list))))
+ (cl-remove-if-not (lambda (buffer)
+ (with-current-buffer buffer
+ yas--editing-template))
+ (buffer-list))))
;; Warn if there are buffers visiting snippets, since reloading will
break
;; any on-line editing of those buffers.
;;
@@ -2011,10 +1988,9 @@ static in the menu."
(defun yas--show-menu-p (mode)
(cond ((eq yas-use-menu 'abbreviate)
- (find mode
- (mapcar #'(lambda (table)
- (yas--table-mode table))
- (yas--get-snippet-tables))))
+ (cl-find mode
+ (mapcar #'yas--table-mode
+ (yas--get-snippet-tables))))
(yas-use-menu t)))
(defun yas--delete-from-keymap (keymap uuid)
@@ -2028,19 +2004,19 @@ static in the menu."
;;
(mapc #'(lambda (item)
(when (and (listp (cdr item))
- (keymapp (third (cdr item))))
- (yas--delete-from-keymap (third (cdr item)) uuid)))
- (rest keymap))
+ (keymapp (nth 2 (cdr item))))
+ (yas--delete-from-keymap (nth 2 (cdr item)) uuid)))
+ (cdr keymap))
;; Set the uuid entry to nil
;;
(define-key keymap (vector (make-symbol uuid)) nil)
;; Destructively modify keymap
;;
- (setcdr keymap (delete-if #'(lambda (item)
- (or (null (cdr item))
- (and (keymapp (third (cdr item)))
- (null (cdr (third (cdr item)))))))
- (rest keymap))))
+ (setcdr keymap (cl-delete-if (lambda (item)
+ (or (null (cdr item))
+ (and (keymapp (nth 2 (cdr item)))
+ (null (cdr (nth 2 (cdr item)))))))
+ (cdr keymap))))
(defun yas-define-menu (mode menu &optional omit-items)
"Define a snippet menu for MODE according to MENU, omitting OMIT-ITEMS.
@@ -2087,13 +2063,13 @@ omitted from MODE's menu, even if they're manually
loaded."
:perm-group group-list
:uuid name)
uuidhash))))
- (define-key menu-keymap (vector (gensym))
+ (define-key menu-keymap (vector (cl-gensym))
(car (yas--template-menu-binding-pair-get-create template :stay))))
else if (or (eq type 'yas-submenu)
(and yas-alias-to-yas/prefix-p
(eq type 'yas/submenu)))
do (let ((subkeymap (make-sparse-keymap)))
- (define-key menu-keymap (vector (gensym))
+ (define-key menu-keymap (vector (cl-gensym))
`(menu-item ,name ,subkeymap))
(yas--define-menu-1 table
subkeymap
@@ -2103,7 +2079,7 @@ omitted from MODE's menu, even if they're manually
loaded."
else if (or (eq type 'yas-separator)
(and yas-alias-to-yas/prefix-p
(eq type 'yas/separator)))
- do (define-key menu-keymap (vector (gensym))
+ do (define-key menu-keymap (vector (cl-gensym))
'(menu-item "----"))
else do (yas--message 1 "Don't know anything about menu entry %s" type)))
@@ -2194,12 +2170,13 @@ object satisfying `yas--field-p' to restrict the
expansion to."
If expansion fails, execute the previous binding for this key"
(interactive)
(setq yas--condition-cache-timestamp (current-time))
- (let* ((vec (subseq (this-command-keys-vector) (if current-prefix-arg
- (length
(this-command-keys))
- 0)))
- (templates (mapcan #'(lambda (table)
- (yas--fetch table vec))
- (yas--get-snippet-tables))))
+ (let* ((vec (cl-subseq (this-command-keys-vector)
+ (if current-prefix-arg
+ (length (this-command-keys))
+ 0)))
+ (templates (cl-mapcan (lambda (table)
+ (yas--fetch table vec))
+ (yas--get-snippet-tables))))
(if templates
(yas--expand-or-prompt-for-template templates)
(let ((yas-fallback-behavior 'call-other-command))
@@ -2211,7 +2188,7 @@ If expansion fails, execute the previous binding for this
key"
Prompt the user if TEMPLATES has more than one element, else
expand immediately. Common gateway for
`yas-expand-from-trigger-key' and `yas-expand-from-keymap'."
- (let ((yas--current-template (or (and (rest templates) ;; more than one
+ (let ((yas--current-template (or (and (cl-rest templates) ;; more than one
(yas--prompt-for-template (mapcar
#'cdr templates)))
(cdar templates))))
(when yas--current-template
@@ -2249,7 +2226,7 @@ Common gateway for `yas-expand-from-trigger-key' and
(yas-minor-mode nil)
(beyond-yasnippet (yas--keybinding-beyond-yasnippet)))
(yas--message 4 "Falling back to %s" beyond-yasnippet)
- (assert (or (null beyond-yasnippet) (commandp beyond-yasnippet)))
+ (cl-assert (or (null beyond-yasnippet) (commandp beyond-yasnippet)))
(setq this-command beyond-yasnippet)
(when beyond-yasnippet
(call-interactively beyond-yasnippet))))
@@ -2314,13 +2291,13 @@ Honours `yas-choose-tables-first',
`yas-choose-keys-first' and
(mapcar #'cdr
(if yas-choose-keys-first
(let ((key (yas--prompt-for-keys
- (mapcan #'yas--table-all-keys tables))))
+ (cl-mapcan #'yas--table-all-keys tables))))
(when key
- (mapcan #'(lambda (table)
- (yas--fetch table key))
- tables)))
- (remove-duplicates (mapcan #'yas--table-templates tables)
- :test #'equal))))
+ (cl-mapcan (lambda (table)
+ (yas--fetch table key))
+ tables)))
+ (cl-remove-duplicates (cl-mapcan #'yas--table-templates tables)
+ :test #'equal))))
(defun yas--lookup-snippet-1 (name mode)
"Get the snippet called NAME in MODE's tables."
@@ -2357,7 +2334,7 @@ by condition."
yas-buffer-local-condition))
(templates (yas--all-templates (yas--get-snippet-tables)))
(yas--current-template (and templates
- (or (and (rest templates) ;; more than one
template for same key
+ (or (and (cl-rest templates) ;; more than
one template for same key
(yas--prompt-for-template
templates))
(car templates))))
(where (if (region-active-p)
@@ -2452,8 +2429,9 @@ where snippets of table might exist."
(defun yas--make-directory-maybe (table-and-dirs &optional main-table-string)
"Return a dir inside TABLE-AND-DIRS, prompts for creation if none exists."
- (or (some #'(lambda (dir) (when (file-directory-p dir) dir)) (cdr
table-and-dirs))
- (let ((candidate (first (cdr table-and-dirs))))
+ (or (cl-some (lambda (dir) (when (file-directory-p dir) dir))
+ (cdr table-and-dirs))
+ (let ((candidate (cl-first (cdr table-and-dirs))))
(unless (file-writable-p (file-name-directory candidate))
(error (yas--format "%s is not writable." candidate)))
(if (y-or-n-p (format "Guessed directory (%s) for%s%s table \"%s\"
does not exist! Create? "
@@ -2487,10 +2465,11 @@ NO-TEMPLATE is non-nil."
(kill-all-local-variables)
(snippet-mode)
(yas-minor-mode 1)
- (set (make-local-variable 'yas--guessed-modes) (mapcar #'(lambda (d)
- (yas--table-mode
(car d)))
- guessed-directories))
- (set (make-local-variable 'default-directory) (car (cdr (car
guessed-directories))))
+ (set (make-local-variable 'yas--guessed-modes)
+ (mapcar (lambda (d) (yas--table-mode (car d)))
+ guessed-directories))
+ (set (make-local-variable 'default-directory)
+ (car (cdr (car guessed-directories))))
(if (and (not no-template) yas-new-snippet-default)
(yas-expand-snippet yas-new-snippet-default))))
@@ -2503,12 +2482,13 @@ representing one or more of the mode's parents.
Note that MODE-SYM need not be the symbol of a real major mode,
neither do the elements of PARENTS."
(let* ((file-dir (and file
- (directory-file-name (or (some #'(lambda (special)
-
(locate-dominating-file file special))
- '(".yas-setup.el"
- ".yas-make-groups"
- ".yas-parents"))
- (directory-file-name
(file-name-directory file))))))
+ (directory-file-name
+ (or (cl-some (lambda (special)
+ (locate-dominating-file file special))
+ '(".yas-setup.el"
+ ".yas-make-groups"
+ ".yas-parents"))
+ (directory-file-name (file-name-directory
file))))))
(parents-file-name (concat file-dir "/.yas-parents"))
(major-mode-name (and file-dir
(file-name-nondirectory file-dir)))
@@ -2544,15 +2524,15 @@ neither do the elements of PARENTS."
(intern
(funcall prompt (format "Choose or enter a table (yas guesses %s): "
(if yas--guessed-modes
- (first yas--guessed-modes)
+ (cl-first yas--guessed-modes)
"nothing"))
(mapcar #'symbol-name yas--guessed-modes)
nil
nil
nil
nil
- (if (first yas--guessed-modes)
- (symbol-name (first yas--guessed-modes)))))))
+ (if (cl-first yas--guessed-modes)
+ (symbol-name (cl-first yas--guessed-modes)))))))
(defun yas-load-snippet-buffer (table &optional interactive)
"Parse and load current buffer's snippet definition into TABLE.
@@ -2614,7 +2594,8 @@ and `kill-buffer' instead."
(y-or-n-p
(format "[yas] Loaded for %s. Also save snippet buffer?"
(yas--table-name (yas--template-table template)))))
- (let ((default-directory (car (cdr (car (yas--guess-snippet-directories
(yas--template-table template))))))
+ (let ((default-directory (car (cdr (car (yas--guess-snippet-directories
+ (yas--template-table
template))))))
(default-file-name (yas--template-name template)))
(unless (or buffer-file-name (not default-file-name))
(setq buffer-file-name
@@ -2631,7 +2612,7 @@ and `kill-buffer' instead."
(test-mode (or (and (car major-mode-and-parent)
(fboundp (car major-mode-and-parent))
(car major-mode-and-parent))
- (first yas--guessed-modes)
+ (cl-first yas--guessed-modes)
(intern (read-from-minibuffer (yas--format "Please
input a mode: ")))))
(yas--current-template
(and parsed
@@ -2654,15 +2635,17 @@ and `kill-buffer' instead."
(point-max)
(yas--template-expand-env
yas--current-template))
(when (and debug
- (require 'yasnippet-debug nil t))
- (add-hook 'post-command-hook 'yas-debug-snippet-vars nil t))))
+ (require 'yasnippet-debug nil t)
+ (fboundp 'yas-debug-snippet-vars))
+ (add-hook 'post-command-hook #'yas-debug-snippet-vars nil t))))
(t
(yas--message 1 "Cannot test snippet for unknown major mode")))))
(defun yas-active-keys ()
"Return all active trigger keys for current buffer and point."
- (remove-duplicates
- (remove-if-not #'stringp (mapcan #'yas--table-all-keys
(yas--get-snippet-tables)))
+ (cl-remove-duplicates
+ (cl-remove-if-not #'stringp (cl-mapcan #'yas--table-all-keys
+ (yas--get-snippet-tables)))
:test #'string=))
(defun yas--template-fine-group (template)
@@ -2827,16 +2810,16 @@ The last element of POSSIBILITIES may be a list of
strings."
(when (listp last-elem)
(setcar last-link (car last-elem))
(setcdr last-link (cdr last-elem))))
- (some #'(lambda (fn)
- (funcall fn "Choose: " possibilities))
- yas-prompt-functions)))
+ (cl-some (lambda (fn)
+ (funcall fn "Choose: " possibilities))
+ yas-prompt-functions)))
(defun yas-key-to-value (alist)
(unless (or yas-moving-away-p
yas-modified-p)
(let ((key (read-key-sequence "")))
(when (stringp key)
- (or (cdr (find key alist :key #'car :test #'string=))
+ (or (cdr (cl-find key alist :key #'car :test #'string=))
key)))))
(defun yas-throw (text)
@@ -2847,7 +2830,8 @@ The last element of POSSIBILITIES may be a list of
strings."
"Verify that the current field value is in POSSIBILITIES.
Otherwise throw exception."
- (when (and yas-moving-away-p (notany #'(lambda (pos) (string= pos yas-text))
possibilities))
+ (when (and yas-moving-away-p
+ (cl-notany (lambda (pos) (string= pos yas-text)) possibilities))
(yas-throw (yas--format "Field only allows %s" possibilities))))
(defun yas-field-value (number)
@@ -2914,7 +2898,7 @@ Use this in primary and mirror transformations to tget."
(put 'yas--active-field-overlay 'permanent-local t)
(put 'yas--field-protection-overlays 'permanent-local t)
-(defstruct (yas--snippet (:constructor yas--make-snippet ()))
+(cl-defstruct (yas--snippet (:constructor yas--make-snippet ()))
"A snippet.
..."
@@ -2928,7 +2912,7 @@ Use this in primary and mirror transformations to tget."
previous-active-field
force-exit)
-(defstruct (yas--field (:constructor yas--make-field (number start end
parent-field)))
+(cl-defstruct (yas--field (:constructor yas--make-field (number start end
parent-field)))
"A field.
NUMBER is the field number.
@@ -2948,7 +2932,7 @@ NEXT is another `yas--field' or `yas--mirror' or
`yas--exit'.
next)
-(defstruct (yas--mirror (:constructor yas--make-mirror (start end transform)))
+(cl-defstruct (yas--mirror (:constructor yas--make-mirror (start end
transform)))
"A mirror.
START and END are mostly buffer markers, but see \"apropos markers-to-points\".
@@ -2962,7 +2946,7 @@ DEPTH is a count of how many nested mirrors can affect
this mirror"
next
depth)
-(defstruct (yas--exit (:constructor yas--make-exit (marker)))
+(cl-defstruct (yas--exit (:constructor yas--make-exit (marker)))
marker
next)
@@ -2999,9 +2983,9 @@ With optional string TEXT do it in that string."
(replace-match to t t text))))
(defun yas--snippet-find-field (snippet number)
- (find-if #'(lambda (field)
- (eq number (yas--field-number field)))
- (yas--snippet-fields snippet)))
+ (cl-find-if (lambda (field)
+ (eq number (yas--field-number field)))
+ (yas--snippet-fields snippet)))
(defun yas--snippet-sort-fields (snippet)
"Sort the fields of SNIPPET in navigation order."
@@ -3154,7 +3138,7 @@ Also create some protection overlays"
(defun yas-exit-snippet (snippet)
"Goto exit-marker of SNIPPET."
- (interactive (list (first (yas--snippets-at-point))))
+ (interactive (list (cl-first (yas--snippets-at-point))))
(when snippet
(setf (yas--snippet-force-exit snippet) t)
(goto-char (if (yas--snippet-exit snippet)
@@ -3466,9 +3450,10 @@ Move the overlays, or create them if they do not exit."
;; go on to normal overlay creation/moving
;;
(cond ((and yas--field-protection-overlays
- (every #'overlay-buffer yas--field-protection-overlays))
- (move-overlay (first yas--field-protection-overlays) (1- start)
start)
- (move-overlay (second yas--field-protection-overlays) end (1+ end)))
+ (cl-every #'overlay-buffer yas--field-protection-overlays))
+ (move-overlay (nth 0 yas--field-protection-overlays)
+ (1- start) start)
+ (move-overlay (nth 1 yas--field-protection-overlays) end (1+ end)))
(t
(setq yas--field-protection-overlays
(list (make-overlay (1- start) start nil t nil)
@@ -3770,7 +3755,7 @@ has to be called before the $-constructs are deleted."
(setq soup
(sort soup compare-fom-begs))
(when soup
- (reduce link-foms soup)))))
+ (cl-reduce link-foms soup)))))
(defun yas--calculate-mirrors-in-fields (snippet mirror)
"Attempt to assign a parent field of SNIPPET to the mirror MIRROR.
@@ -4228,19 +4213,15 @@ When multiple expressions are found, only the last one
counts."
(yas--field-mirrors parent))))
(or (yas--mirror-depth mirror)
(setf (yas--mirror-depth mirror)
- (cond ((memq mirror traversed)
- 0)
+ (cond ((memq mirror traversed) 0)
((and parent parents-mirrors)
- (1+ (reduce #'max
- (mapcar #'(lambda (m)
- (yas--calculate-mirror-depth m
-
(cons mirror
-
traversed)))
- parents-mirrors))))
- (parent
- 1)
- (t
- 0))))))
+ (1+ (cl-reduce
+ #'max parents-mirrors
+ :key (lambda (m)
+ (yas--calculate-mirror-depth
+ m (cons mirror traversed))))))
+ (parent 1)
+ (t 0))))))
(defun yas--update-mirrors (snippet)
"Update all the mirrors of SNIPPET."
@@ -4340,12 +4321,14 @@ When multiple expressions are found, only the last one
counts."
;; restored correctly, this condition handles that
;;
(let* ((snippet (car (yas--snippets-at-point)))
- (target-field (and snippet
- (find-if-not #'(lambda (field)
-
(yas--field-probably-deleted-p snippet field))
- (remove nil
- (cons
(yas--snippet-active-field snippet)
-
(yas--snippet-fields snippet)))))))
+ (target-field
+ (and snippet
+ (cl-find-if-not
+ (lambda (field)
+ (yas--field-probably-deleted-p snippet field))
+ (remq nil
+ (cons (yas--snippet-active-field snippet)
+ (yas--snippet-fields snippet)))))))
(when target-field
(yas--move-to-field snippet target-field))))
((not (yas--undo-in-progress))
@@ -4387,9 +4370,9 @@ object satisfying `yas--field-p' to restrict the
expansion to.")))
(concat "Expand/run snippets from keymaps, possibly falling back to original
binding.\n"
(when (and context (eq this-command 'describe-key))
(let* ((vec (this-single-command-keys))
- (templates (mapcan #'(lambda (table)
- (yas--fetch table vec))
- (yas--get-snippet-tables)))
+ (templates (cl-mapcan (lambda (table)
+ (yas--fetch table vec))
+ (yas--get-snippet-tables)))
(yas--direct-keymaps nil)
(fallback (key-binding vec)))
(concat "In this case, "
@@ -4658,6 +4641,5 @@ can more or less safely rely upon them.")
;; Local Variables:
;; coding: utf-8
;; indent-tabs-mode: nil
-;; byte-compile-warnings: (not cl-functions)
;; End:
;;; yasnippet.el ends here
- [elpa] master d4da806 17/40: Fix removal of snippets by uuid, (continued)
- [elpa] master d4da806 17/40: Fix removal of snippets by uuid, Noam Postavsky, 2016/10/26
- [elpa] master 42b0c26 18/40: Don't warn about modifications to other buffers, Noam Postavsky, 2016/10/26
- [elpa] master eaaec30 38/40: Replace all occurances of `capitaomorte', Noam Postavsky, 2016/10/26
- [elpa] master ff6f31e 37/40: Replace yas--with-temp-redefs with cl-letf, Noam Postavsky, 2016/10/26
- [elpa] master 244cdfa 26/40: Merge: Simplify `yas-new-snippet' load&save logic, Noam Postavsky, 2016/10/26
- [elpa] master 9500b00 21/40: Fix field navigation in the backwards direction, Noam Postavsky, 2016/10/26
- [elpa] master 309fe15 31/40: * Rakefile: Handle unset `warnings' parameter, Noam Postavsky, 2016/10/26
- [elpa] master 9cf9208 32/40: Fix test-rebindings, Noam Postavsky, 2016/10/26
- [elpa] master 7e0a0de 28/40: Use new name of python-in-string/comment in docs, Noam Postavsky, 2016/10/26
- [elpa] master e6b8651 39/40: * NEWS: Update for 0.11.0., Noam Postavsky, 2016/10/26
- [elpa] master 5264379 29/40: Cleanup redundant cl dependency, :group & :require,
Noam Postavsky <=
- [elpa] master 4b12f7d 30/40: Don't warn about cl-functions with old cl-lib, Noam Postavsky, 2016/10/26
- [elpa] master a5e88b2 34/40: Add test for snippet saving, Noam Postavsky, 2016/10/26
- [elpa] master 299efcb 40/40: packages/yasnippet: Merge external (v0.11.0), Noam Postavsky, 2016/10/26