1

I'm using org-mode with predictive and having an issue with predictive changing a key binding that org-mode uses. Specifically, predictive changes M-tab and I prefer to keep org-mode's definition of M-tab.

I'm loading up predictive with

(add-hook 'org-mode-hook 'predictive-mode)

which makes me think that I can do something like: (eval-after-load 'org-mode '(define-key....

But I'm not sure if this is the correct "emacs" way to solve this problem.

2

First of all, are you sure that the M-tab binding you like is from Org mode? The version of Org-mode I'm using (7.9.3f, from emacs 24.3) doesn't bind M-tab, if I'm reading things right. Check C-h k M-TAB to be sure.

If that's what you want, add it to a hook function (you don't want eval-after-load, because that will only be executed when the org-mode library loads, not whenever you start org-mode, which is what you want). Something like this (warning: untested, because I haven't installed predictive):

(defun fixup-org-mode-keys ()
  (let* ((key     [(meta tab)])
         (binding (lookup-key org-mode-map key)))
    (require 'predictive)
    (predictive-mode 1)
    (local-set-key key binding)))
(add-hook 'org-mode-hook 'fixup-org-mode-keys)

If that's not the command you want, replace the lookup-key expression above with whatever function C-h k M-TAB reports, e.g.:

   ...(let* ((key     [(meta tab)])
             (binding 'pcomplete))
   ...

An alternative method is to disable predictive's M-TAB binding altogether. This is simpler, but has the effect of removing this binding everywhere. You may or may not like that, it's up to you:

(eval-after-load 'predictive (define-key predictive-map [(meta tab)] nil))
  • Closest I got is that the online docs for org indicate it is complete. I at some point got it to point to 'pcomplete while M-<tab> with predictive is complete-or-cycle-word-at-point. – Jonathan Leech-Pepin Sep 30 '14 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.