0

I want to activate reftex-isearch-minor-mode and tried the solution in this post offered by giordano,

(add-hook 'TeX-mode-hook (lambda () (reftex-isearch-minor-mode))) ; for AUCTeX

it works when I first open .tex file on emacs, but the minor mode will be lost, and the multi-search mode becomes the usual search mode after either C-c C-n or revert buffer.

How can I keep the reftex-isearch-minor-mode when I do the refreshing? Many thanks!

My AUCTeX version is 11.90.2, emacs version is 24.5.2

davyjones
  • 127
  • 5
  • What happens if you pass a positive argument to reftex-isearch-minor-mode? I.e., (add-hook 'TeX-mode-hook (lambda () (reftex-isearch-minor-mode 1))). – Arash Esbati Dec 03 '17 at 21:33
  • @ArashEsbati sadly, no... and now I cannot even get it to work after restart. Except when I do manually M-x reftex-isearch-minor-mode RET. I probably should not be asking this, but what is the minimum amount of code in the .emacs to make it work? I have tried this line alone, and with (setq TeX-parse-self t), and a lot other variants... – davyjones Dec 03 '17 at 22:44
  • @ArashEsbati, I just found that (add-hook 'LaTeX-mode-hook (lambda () (reftex-isearch-minor-mode))) does work (with TeX-LaTeX), at least so far... but I have to put it before (add-hook 'LaTeX-mode-hook 'turn-on-reftex). Does this make sense? – davyjones Dec 03 '17 at 23:03

2 Answers2

1

Here is the way to go:

(defun mylatexhook nil
   (turn-on-reftex)
   (add-hook 'reftex-mode-hook 
      (lambda nil (reftex-isearch-minor-mode 1))))

(add-hook 'LaTeX-mode-hook 'mylatexhook)

It has to be done in two steps, that was the mystery to be solved!

HTH, O.

Muihlinn
  • 2,614
  • 1
  • 15
  • 22
0

Hello some years afterwards,

For those who are still searching for an answer like me ... I decided to go for the radical line of code


(eval-after-load "reftex" (setq reftex-isearch-minor-mode t))

in my .emacs file.

reftex autoloads lots of things ... This way, we are sure that we overwrite the initial value (that is nil in reftex.el).

Drew
  • 77,472
  • 10
  • 114
  • 243