0

When I try to input a capital M in org-mode with ubuntu, I always got a M- in minibuffer, so M letter can never being input to my document.

How to fix it?

lucky1928
  • 1,622
  • 8
  • 28
  • If you say `C-h c S-m` in that org mode buffer, what do you get in the echo area? Does the problem occur if you start emacs with `emacs -q` (i.e. without your init file)? – NickD Oct 12 '21 at 02:25
  • it's weird, if with -q parameter, it works fine. so it's me add some bad config. but how to figure it out? – lucky1928 Oct 13 '21 at 19:06
  • 1
    What does `C-h c S-m` say? If it is bound to function `foo`, then search in your init file for that name: chances are you'll find the culprit. A more systematic approach is to bisect your init file: see https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems – NickD Oct 13 '21 at 19:15
  • C-h c S-m will not work since Shift-M has been translated to M-, looks like I can not paste M into minibuffer either! Let me comment out it line by line to debug – lucky1928 Oct 13 '21 at 19:49
  • Unless your init file is very short (less that a couple of dozen lines say), you are better off bisecting it. – NickD Oct 13 '21 at 20:00
  • @NickD I finally found the code. after comment out that line, it works fine now. but still not figure out why M-q map will impact on shift-m input. – lucky1928 Oct 13 '21 at 21:08

1 Answers1

1

Thanks for @NickD's help.

Finally I found below line make the trouble:

(defun samplefunction()
  (interactive)
  (let ((fill-paragraph-function nil)
        (adaptive-fill-function nil))
    (fill-paragraph)))

(define-key org-mode-map "M-q" 'samplefunction)

This is define Meta-q, but not sure why it impackt on Shift-m.

lucky1928
  • 1,622
  • 8
  • 28
  • 2
    Try `(define-key org-mode-map (kbd "M-q") 'samplefunction)` instead. – NickD Oct 14 '21 at 14:45
  • 1
    or change the line to `(define-key org-mode-map "\M-q" 'samplefunction)` (see https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Sequences.html) – JeanPierre Mar 13 '22 at 15:44