diff options
| author | Chong Yidong | 2012-03-12 11:58:20 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-03-12 11:58:20 +0800 |
| commit | 5d1ac394e135c411ff7e793e0a05ab5e2f7d2066 (patch) | |
| tree | 8c386af8034372d7d3256599ffa55073d39bc08f | |
| parent | 292112ed3b196b6181010b0965a1df41d0cacf3a (diff) | |
| download | emacs-5d1ac394e135c411ff7e793e0a05ab5e2f7d2066.tar.gz emacs-5d1ac394e135c411ff7e793e0a05ab5e2f7d2066.zip | |
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
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/nxml/nxml-mode.el | 26 |
3 files changed, 21 insertions, 15 deletions
| @@ -771,6 +771,11 @@ See MH-E-NEWS for details. | |||
| 771 | --- | 771 | --- |
| 772 | ** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags. | 772 | ** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags. |
| 773 | 773 | ||
| 774 | ** nXML mode no longer binds C-RET to `nxml-complete'. | ||
| 775 | Completion is now performed via `completion-at-point', bound to M-TAB. | ||
| 776 | If `nxml-bind-meta-tab-to-complete-flag' is non-nil (the default), | ||
| 777 | this performs tag completion. | ||
| 778 | |||
| 774 | --- | 779 | --- |
| 775 | ** Prolog mode has been completely revamped, with lots of additional | 780 | ** Prolog mode has been completely revamped, with lots of additional |
| 776 | functionality such as more intelligent indentation, electricity, support for | 781 | 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 @@ | |||
| 1 | 2012-03-12 Chong Yidong <cyd@gnu.org> | 1 | 2012-03-12 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * nxml/nxml-mode.el (nxml-mode-map): Do not bind C-RET (Bug#6776). | ||
| 4 | (nxml-completion-at-point-function): New function. | ||
| 5 | (nxml-mode): Use it. | ||
| 6 | (nxml-bind-meta-tab-to-complete-flag): Default to t. | ||
| 7 | |||
| 3 | * emacs-lisp/package.el (package-unpack, package-unpack-single): | 8 | * emacs-lisp/package.el (package-unpack, package-unpack-single): |
| 4 | Load generated autoloads file before byte compiling (Bug#10970). | 9 | Load generated autoloads file before byte compiling (Bug#10970). |
| 5 | (package--make-autoloads-and-compile): New helper fun. | 10 | (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." | |||
| 86 | :group 'nxml | 86 | :group 'nxml |
| 87 | :type 'integer) | 87 | :type 'integer) |
| 88 | 88 | ||
| 89 | (defcustom nxml-bind-meta-tab-to-complete-flag (not window-system) | 89 | (defcustom nxml-bind-meta-tab-to-complete-flag t |
| 90 | "Non-nil means bind M-TAB in `nxml-mode-map' to `nxml-complete'. | 90 | "Non-nil means to use nXML completion in \\[completion-at-point]." |
| 91 | C-return will be bound to `nxml-complete' in any case. | ||
| 92 | M-TAB gets swallowed by many window systems/managers, and | ||
| 93 | `documentation' will show M-TAB rather than C-return as the | ||
| 94 | binding for `nxml-complete' when both are bound. So it's better | ||
| 95 | to bind M-TAB only when it will work." | ||
| 96 | :group 'nxml | 91 | :group 'nxml |
| 97 | :set (lambda (sym flag) | ||
| 98 | (set-default sym flag) | ||
| 99 | (when (and (boundp 'nxml-mode-map) nxml-mode-map) | ||
| 100 | (define-key nxml-mode-map "\M-\t" (and flag 'nxml-complete)))) | ||
| 101 | :type 'boolean) | 92 | :type 'boolean) |
| 102 | 93 | ||
| 103 | (defcustom nxml-prefer-utf-16-to-utf-8-flag nil | 94 | (defcustom nxml-prefer-utf-16-to-utf-8-flag nil |
| @@ -418,9 +409,7 @@ reference.") | |||
| 418 | (define-key map "\C-c\C-o" nxml-outline-prefix-map) | 409 | (define-key map "\C-c\C-o" nxml-outline-prefix-map) |
| 419 | (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) | 410 | (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) |
| 420 | (define-key map "/" 'nxml-electric-slash) | 411 | (define-key map "/" 'nxml-electric-slash) |
| 421 | (define-key map [C-return] 'nxml-complete) | 412 | (define-key map "\M-\t" 'completion-at-point) |
| 422 | (when nxml-bind-meta-tab-to-complete-flag | ||
| 423 | (define-key map "\M-\t" 'nxml-complete)) | ||
| 424 | map) | 413 | map) |
| 425 | "Keymap for nxml-mode.") | 414 | "Keymap for nxml-mode.") |
| 426 | 415 | ||
| @@ -479,7 +468,7 @@ the start-tag, point, and end-tag are all left on separate lines. | |||
| 479 | If `nxml-slash-auto-complete-flag' is non-nil, then inserting a `</' | 468 | If `nxml-slash-auto-complete-flag' is non-nil, then inserting a `</' |
| 480 | automatically inserts the rest of the end-tag. | 469 | automatically inserts the rest of the end-tag. |
| 481 | 470 | ||
| 482 | \\[nxml-complete] performs completion on the symbol preceding point. | 471 | \\[completion-at-point] performs completion on the symbol preceding point. |
| 483 | 472 | ||
| 484 | \\[nxml-dynamic-markup-word] uses the contents of the current buffer | 473 | \\[nxml-dynamic-markup-word] uses the contents of the current buffer |
| 485 | to choose a tag to put around the word preceding point. | 474 | to choose a tag to put around the word preceding point. |
| @@ -555,6 +544,8 @@ Many aspects this mode can be customized using | |||
| 555 | (nxml-clear-inside (point-min) (point-max)) | 544 | (nxml-clear-inside (point-min) (point-max)) |
| 556 | (nxml-with-invisible-motion | 545 | (nxml-with-invisible-motion |
| 557 | (nxml-scan-prolog))))) | 546 | (nxml-scan-prolog))))) |
| 547 | (add-hook 'completion-at-point-functions | ||
| 548 | #'nxml-completion-at-point-function nil t) | ||
| 558 | (add-hook 'after-change-functions 'nxml-after-change nil t) | 549 | (add-hook 'after-change-functions 'nxml-after-change nil t) |
| 559 | (add-hook 'change-major-mode-hook 'nxml-cleanup nil t) | 550 | (add-hook 'change-major-mode-hook 'nxml-cleanup nil t) |
| 560 | 551 | ||
| @@ -1654,6 +1645,11 @@ depend on `nxml-completion-hook'." | |||
| 1654 | (ding) | 1645 | (ding) |
| 1655 | (message "Cannot complete in this context"))) | 1646 | (message "Cannot complete in this context"))) |
| 1656 | 1647 | ||
| 1648 | (defun nxml-completion-at-point-function () | ||
| 1649 | "Call `nxml-complete' to perform completion at point." | ||
| 1650 | (when nxml-bind-meta-tab-to-complete-flag | ||
| 1651 | #'nxml-complete)) | ||
| 1652 | |||
| 1657 | ;;; Movement | 1653 | ;;; Movement |
| 1658 | 1654 | ||
| 1659 | (defun nxml-forward-balanced-item (&optional arg) | 1655 | (defun nxml-forward-balanced-item (&optional arg) |