monnier pushed a commit to branch externals/auctex in repository elpa. commit d549b79ccdc71b5167df6eb8f58112f9d149780d Author: Mosè Giordano <giordano.m...@libero.it> Date: Mon Apr 15 16:00:20 2013 +0200
Better unbinding of SPC in LaTeX-arg-acro-key-val and LaTeX-arg-siunitx-unit. * style/acro.el (LaTeX-arg-acro-key-val): Let-bind keymap with SPC key binding removed, instead of defining a new key binding for SPC. Use `TeX-arg-key-val' instead of `multi-prompt-key-value' and `TeX-argument-insert'. * style/siunitx.el (LaTeX-arg-siunitx-unit): Let-bind keymap with SPC key binding removed, instead of defining a new key binding for SPC. --- ChangeLog | 11 +++++++++-- style/acro.el | 19 ++++++------------- style/siunitx.el | 36 ++++++++++++++++++------------------ 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24534ef..8ebeec9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,13 +6,20 @@ * tex.el (fboundp): Use `crm-separator' as separator in XEmacs `TeX-completing-read-multiple' implementation. + * style/acro.el (LaTeX-arg-acro-key-val): Let-bind keymap with SPC + key binding removed, instead of defining a new key binding for + SPC. Use `TeX-arg-key-val' instead of `multi-prompt-key-value' + and `TeX-argument-insert'. + * style/pst-node.el (LaTeX-pstnode-env-psmatrix): Replace `completing-read-multiple' with `TeX-completing-read-multiple'. * style/pstricks.el (LaTeX-package-parameters): Ditto. - * style/siunitx.el (LaTeX-arg-siunitx-unit): Replace - `completing-read-multiple' with `TeX-completing-read-multiple'. + * style/siunitx.el (LaTeX-arg-siunitx-unit): Let-bind keymap with + SPC key binding removed, instead of defining a new key binding for + SPC. Replace `completing-read-multiple' with + `TeX-completing-read-multiple'. 2013-04-15 Tassilo Horn <t...@gnu.org> diff --git a/style/acro.el b/style/acro.el index 61b57a0..d41a9a1 100644 --- a/style/acro.el +++ b/style/acro.el @@ -139,24 +139,17 @@ in its optional argument.") (defun LaTeX-arg-acro-key-val (optional prompt key-val-alist) "Prompt for keys and values in KEY-VAL-ALIST. -<SPC> key bindings in minibuffer are removed temporarily. Insert +<SPC> key binding in minibuffer is removed temporarily. Insert the given value as a TeX macro argument. If OPTIONAL is non-nil, insert it as an optional argument. Use PROMPT as the prompt string. KEY-VAL-ALIST is an alist. The car of each element should be a string representing a key and the optional cdr should be a list with strings to be used as values for the key." - ;; Remove <SPC> key bindings in minibuffer. - (let ((space-completion (lookup-key minibuffer-local-completion-map " ")) - (space-must-match (lookup-key minibuffer-local-must-match-map " "))) - (define-key minibuffer-local-completion-map " " nil) - (define-key minibuffer-local-must-match-map " " nil) - (let ((var (multi-prompt-key-value - (TeX-argument-prompt optional "Options (k=v)" prompt) - (eval key-val-alist)))) - (TeX-argument-insert var optional)) - ;; Restore <SPC> key bindings in minibuffer. - (define-key minibuffer-local-completion-map " " space-completion) - (define-key minibuffer-local-must-match-map " " space-must-match))) + ;; Remove <SPC> key binding from map used in `multi-prompt-key-value' (called + ;; by `TeX-arg-key-val') with `require-match' set to `nil'. + (let ((crm-local-completion-map + (remove (assoc 32 crm-local-completion-map) crm-local-completion-map))) + (TeX-arg-key-val optional key-val-alist prompt))) (TeX-add-style-hook "acro" diff --git a/style/siunitx.el b/style/siunitx.el index 81981fb..230c62e 100644 --- a/style/siunitx.el +++ b/style/siunitx.el @@ -64,24 +64,24 @@ argument, otherwise as a mandatory one. Use PROMPT as the prompt string. If INITIAL-INPUT is non-nil, insert it in the minibuffer initially, with point positioned at the end. If DEFINITION is non-nil, add the chosen unit to the list of defined units." - ;; Remove <SPC> key bindings in minibuffer and set completion - ;; separator to <SPC>. - (let ((space-completion (lookup-key minibuffer-local-completion-map " ")) - (space-must-match (lookup-key minibuffer-local-must-match-map " ")) - (crm-separator " ")) - (define-key minibuffer-local-completion-map " " nil) - (define-key minibuffer-local-must-match-map " " nil) - (let ((unit (mapconcat 'identity - (TeX-completing-read-multiple - (TeX-argument-prompt optional prompt "Unit") - (LaTeX-siunitx-unit-list) nil nil initial-input) - crm-separator))) - (if (and definition (not (string-equal "" unit))) - (LaTeX-add-siunitx-units unit)) - (TeX-argument-insert unit optional)) - ;; Restore <SPC> key bindings in minibuffer. - (define-key minibuffer-local-completion-map " " space-completion) - (define-key minibuffer-local-must-match-map " " space-must-match))) + ;; Remove <SPC> key binding from map used in `TeX-completing-read-multiple' + ;; with `require-match' set to `nil' (it's `crm-local-completion-map' if + ;; `completing-read-multiple' is bound, `minibuffer-local-completion-map' + ;; otherwise) and set completion separator to <SPC>. + (let* ((crm-local-completion-map + (remove (assoc 32 crm-local-completion-map) crm-local-completion-map)) + (minibuffer-local-completion-map + (remove (assoc 32 minibuffer-local-completion-map) + minibuffer-local-completion-map)) + (crm-separator " ") + (unit (mapconcat 'identity + (TeX-completing-read-multiple + (TeX-argument-prompt optional prompt "Unit") + (LaTeX-siunitx-unit-list) nil nil initial-input) + crm-separator))) + (if (and definition (not (string-equal "" unit))) + (LaTeX-add-siunitx-units unit)) + (TeX-argument-insert unit optional))) (defun LaTeX-arg-define-siunitx-unit (optional &optional prompt) "Prompt for a LaTeX siunitx unit, prefix, power, and qualifier.