0

I'm using Emacs 25 on Ubuntu 16.04, after a while spent on Emacs 24. One thing that I've noticed changed in version 25 is, cscope minor mode is not enabled by default when I edit C files, while it was in Emacs 24 (I also checked that this is the case with C-h m, cscope is indeed present in 24 but not 25). I'm using xcscope-el that comes with Ubuntu 16.04 (version 1.1-1, as far as I can tell). I have to type M-x cscope-minor-mode whenever opening a C file, which is quite annoying.

I have very limited knowledge of Elisp and don't understand how minor modes are associated with major ones, any idea what's going on here, or how can I at least start to investigate why this happens?

0

Even my knowledge is limited, but I could do it by adding following line to my .emacs

(add-hook 'c-mode-hook (lambda () (interactive) (setq cscope-minor-mode t)))

You can add hooks for other languages also.

  • 1
    Hook functions don't need to be interactive. And minor modes are better enabled by calling their function. I.e.: (add-hook 'c-mode-hook #'cscope-minor-mode) – Stefan Apr 30 '18 at 18:59
  • @fencekicker Please write your last comment as an answer to your own question and accept it as soon as possible. If you remove your comment afterwards I will do the same. – Tobias Jun 29 '18 at 23:28
  • @Tobias OK, I just did that. – fencekicker Jul 2 '18 at 7:46
0

Moving contents of my comment to answer: Thanks, got some help on the Emacs help group: groups.google.com/forum/#!topic/gnu.emacs.help/7U816OSm2Cw Apparently, adding (cscope-setup) in my .emacs solved it. Still not sure why this worked automagically in 24. That function adds hooks for a bunch of languages, including C and C++.

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.