mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 19:29:37 +00:00
Merge pull request from waymondo/master
Allow string values in cons for :bind keywords GitHub-reference: https://github.com/jwiegley/use-package/issues/303
This commit is contained in:
commit
416096bfdc
1 changed files with 18 additions and 9 deletions
|
@ -651,8 +651,14 @@ manually updated package."
|
||||||
(and allow-vector (vectorp (car x))))
|
(and allow-vector (vectorp (car x))))
|
||||||
(symbolp (cdr x))))
|
(symbolp (cdr x))))
|
||||||
|
|
||||||
|
(defsubst use-package-is-string-pair (x)
|
||||||
|
"Return t if X has the type (STRING . STRING)."
|
||||||
|
(and (consp x)
|
||||||
|
(stringp (car x))
|
||||||
|
(stringp (cdr x))))
|
||||||
|
|
||||||
(defun use-package-normalize-pairs
|
(defun use-package-normalize-pairs
|
||||||
(name label arg &optional recursed allow-vector)
|
(name label arg &optional recursed allow-vector allow-string-cdrs)
|
||||||
"Normalize a list of string/symbol pairs."
|
"Normalize a list of string/symbol pairs."
|
||||||
(cond
|
(cond
|
||||||
((or (stringp arg) (and allow-vector (vectorp arg)))
|
((or (stringp arg) (and allow-vector (vectorp arg)))
|
||||||
|
@ -662,16 +668,18 @@ manually updated package."
|
||||||
((and (not recursed) (listp arg) (listp (cdr arg)))
|
((and (not recursed) (listp arg) (listp (cdr arg)))
|
||||||
(mapcar #'(lambda (x)
|
(mapcar #'(lambda (x)
|
||||||
(let ((ret (use-package-normalize-pairs
|
(let ((ret (use-package-normalize-pairs
|
||||||
name label x t allow-vector)))
|
name label x t allow-vector allow-string-cdrs)))
|
||||||
(if (listp ret)
|
(if (listp ret)
|
||||||
(car ret)
|
(car ret)
|
||||||
ret))) arg))
|
ret))) arg))
|
||||||
|
((and allow-string-cdrs (use-package-is-string-pair arg))
|
||||||
|
(list arg))
|
||||||
(t arg)))
|
(t arg)))
|
||||||
|
|
||||||
(defun use-package-normalize-binder (name keyword args)
|
(defun use-package-normalize-binder (name keyword args)
|
||||||
(use-package-as-one (symbol-name keyword) args
|
(use-package-as-one (symbol-name keyword) args
|
||||||
(lambda (label arg)
|
(lambda (label arg)
|
||||||
(use-package-normalize-pairs name label arg nil t))))
|
(use-package-normalize-pairs name label arg nil t t))))
|
||||||
|
|
||||||
(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
|
(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
|
||||||
(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
|
(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
|
||||||
|
@ -857,12 +865,13 @@ deferred until the prefix key sequence is pressed."
|
||||||
(apply
|
(apply
|
||||||
#'nconc
|
#'nconc
|
||||||
(mapcar #'(lambda (command)
|
(mapcar #'(lambda (command)
|
||||||
(append
|
(when (not (stringp command))
|
||||||
`((unless (fboundp ',command)
|
(append
|
||||||
(autoload #',command ,name-string nil t)))
|
`((unless (fboundp ',command)
|
||||||
(when (bound-and-true-p byte-compile-current-file)
|
(autoload #',command ,name-string nil t)))
|
||||||
`((eval-when-compile
|
(when (bound-and-true-p byte-compile-current-file)
|
||||||
(declare-function ,command ,name-string))))))
|
`((eval-when-compile
|
||||||
|
(declare-function ,command ,name-string)))))))
|
||||||
(delete-dups (plist-get state :commands))))
|
(delete-dups (plist-get state :commands))))
|
||||||
|
|
||||||
body)))
|
body)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue