From: Chong Yidong Date: Mon, 12 Mar 2012 03:58:20 +0000 (+0800) Subject: Adapt nXML mode to Emacs 24 completion scheme. X-Git-Tag: emacs-pretest-24.0.05~90 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5d1ac394e135c411ff7e793e0a05ab5e2f7d2066;p=emacs.git Adapt nXML mode to Emacs 24 completion scheme. * lisp/nxml/nxml-mode.el (nxml-mode-map): Do not bind C-RET. (nxml-completion-at-point-function): New function. (nxml-mode): Use it. (nxml-bind-meta-tab-to-complete-flag): Default to t. Fixes: debbugs:6776 --- diff --git a/etc/NEWS b/etc/NEWS index 4e4a551a9d1..72eaee13dd7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -771,6 +771,11 @@ See MH-E-NEWS for details. --- ** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags. +** nXML mode no longer binds C-RET to `nxml-complete'. +Completion is now performed via `completion-at-point', bound to M-TAB. +If `nxml-bind-meta-tab-to-complete-flag' is non-nil (the default), +this performs tag completion. + --- ** Prolog mode has been completely revamped, with lots of additional functionality such as more intelligent indentation, electricity, support for diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9108455df44..ee92720d717 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2012-03-12 Chong Yidong + * nxml/nxml-mode.el (nxml-mode-map): Do not bind C-RET (Bug#6776). + (nxml-completion-at-point-function): New function. + (nxml-mode): Use it. + (nxml-bind-meta-tab-to-complete-flag): Default to t. + * emacs-lisp/package.el (package-unpack, package-unpack-single): Load generated autoloads file before byte compiling (Bug#10970). (package--make-autoloads-and-compile): New helper fun. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index a22288e7d4e..f9122e7245e 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -86,18 +86,9 @@ as the first attribute on the previous line." :group 'nxml :type 'integer) -(defcustom nxml-bind-meta-tab-to-complete-flag (not window-system) - "Non-nil means bind M-TAB in `nxml-mode-map' to `nxml-complete'. -C-return will be bound to `nxml-complete' in any case. -M-TAB gets swallowed by many window systems/managers, and -`documentation' will show M-TAB rather than C-return as the -binding for `nxml-complete' when both are bound. So it's better -to bind M-TAB only when it will work." +(defcustom nxml-bind-meta-tab-to-complete-flag t + "Non-nil means to use nXML completion in \\[completion-at-point]." :group 'nxml - :set (lambda (sym flag) - (set-default sym flag) - (when (and (boundp 'nxml-mode-map) nxml-mode-map) - (define-key nxml-mode-map "\M-\t" (and flag 'nxml-complete)))) :type 'boolean) (defcustom nxml-prefer-utf-16-to-utf-8-flag nil @@ -418,9 +409,7 @@ reference.") (define-key map "\C-c\C-o" nxml-outline-prefix-map) (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) (define-key map "/" 'nxml-electric-slash) - (define-key map [C-return] 'nxml-complete) - (when nxml-bind-meta-tab-to-complete-flag - (define-key map "\M-\t" 'nxml-complete)) + (define-key map "\M-\t" 'completion-at-point) map) "Keymap for nxml-mode.") @@ -479,7 +468,7 @@ the start-tag, point, and end-tag are all left on separate lines. If `nxml-slash-auto-complete-flag' is non-nil, then inserting a `