0

I have strange thing in my Emacs and I can't locate it, everytime I switch a buffer I get message with major mode name even when I call the function I get minibuffer-inactive-mode

The only global function (for all modes) in my .emacs file (I think) is this:

(add-hook 'after-change-major-mode-hook (lambda () (if (not (memql (intern (major-mode)) '(fundamental-mode erc-mode text-mode sql-mode))) (local-set-key (kbd "RET") 'new-line-and-indent-fix)))) 

How to find the place that add this annoying thing? What different hook can be executed on each mode?

5
  • Does that happens with "emacs -q"? If so, does it happens with "emacs -Q"? If "emacs -q" removes this, I would suggest to do a "binary search" with your configuration file (selectively evaluating portions of it until you find the culprit). Commented Sep 24, 2013 at 11:01
  • 1
    major-mode is not a function, so in the code you quoted you want to replace (intern (major-mode)) with major-mode (since the value of major-mode is already an interned symbol). Commented Sep 24, 2013 at 12:44
  • What is the annoying message that you see? Have you tried grepping for that message in the source code that you use? Commented Sep 24, 2013 at 14:46
  • @Stefan it seams that major-mode is a function and a variable. Commented Sep 24, 2013 at 16:05
  • @Draw the message is the value of major-mode variable. I can't grep it. Commented Sep 24, 2013 at 16:06

1 Answer 1

1

There is no major-mode function in vanilla Emacs. Whatever that function is in your config, it's probably responsible for displaying the message you're seeing.

You want to fix your code (as per Stefan's comment), but you probably also want to look into that non-standard function:

M-x find-function RET major-mode RET

Sign up to request clarification or add additional context in comments.

3 Comments

Yea, I have (defun major-mode () (interactive) (message (symbol-name major-mode))) in my functions.el. Tanks
I would get rid of that function -- it looks like it was written so you could check the current buffer's mode symbol with M-x major-mode RET, but you can trivially do the same thing with M-: major-mode RET, so there's really no need for it.
In addition, message returns nil always, so the value will not be the value of variable major-mode. (Not to mention that the value of that variable is a symbol anyway, so it does not need to be interned.) In sum, this code is misguided in more than one way.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.