Subject: Re: bug#6776: 24.0.50; nxml mode binds completion to c-return

From: [email-masked]
Date: Tue, 03 Aug 2010 00:42:52 +0200

Stefan Monnier <[email-masked]> writes:

>> nxml mode does this:
>>   (define-key map [C-return] 'nxml-complete)
>> which isnt exactly a bug, but its annoying.
>
> Agreed.  It should add to completion-at-point-functions instead.
>
>> Its annoying because mode
>> specific completions should go somewhere consistent, such as M-tab, a
>
> Actually, I just noticed that completion-at-point is globally bound to M-tab.
>
>
>         Stefan

So, maybe something like this then?

=== modified file 'lisp/nxml/nxml-mode.el'
*** lisp/nxml/nxml-mode.el	2010-06-14 01:43:11 +0000
--- lisp/nxml/nxml-mode.el	2010-08-02 22:37:47 +0000
***************
*** 415,423 ****
      (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))
      map)
    "Keymap for nxml-mode.")
  
--- 415,420 ----
***************
*** 525,531 ****
  	  (nxml-scan-prolog)))))
    (add-hook 'after-change-functions 'nxml-after-change nil t)
    (add-hook 'change-major-mode-hook 'nxml-cleanup nil t)
! 
    ;; Emacs 23 handles the encoding attribute on the xml declaration
    ;; transparently to nxml-mode, so there is no longer a need for the below
    ;; hook. The hook also had the drawback of overriding explicit user
--- 522,528 ----
  	  (nxml-scan-prolog)))))
    (add-hook 'after-change-functions 'nxml-after-change nil t)
    (add-hook 'change-major-mode-hook 'nxml-cleanup nil t)
!   (add-hook 'completion-at-point-functions  'nxml-complete nil 'local)
    ;; Emacs 23 handles the encoding attribute on the xml declaration
    ;; transparently to nxml-mode, so there is no longer a need for the below
    ;; hook. The hook also had the drawback of overriding explicit user

-- 
Joakim Verona