Emacs Org-Mode: Turn off line numbers

痞子三分冷 提交于 2019-11-30 01:40:17

Try adding this to your .emacs:

(defun nolinum ()
  (global-linum-mode 0)
)
(add-hook 'org-mode-hook 'nolinum)

This is assuming that you use linum and not something else to number lines. Anyway, you can add this hook to org-mode to disable anything that might make org slow only when you're using org-mode.

Disclaimer: I don't have linum installed so I can't test this, but it should work.

blake314

If you type M-x customize, go to Linum in the Convenience group, change Linum Eager to off, or change Linum Delay to on, it will improve performance greatly.

On my laptop (3 GB RAM, dual core) the performance drawback (of this versus having linum off) is unnoticeable, however on my netbook there may still be some slight performance issues with a ~3000 line 130KB file (~50-150 ms delay when paging).

linum-off.el mentioned in my quesiton has solved this. Instructions are in the file: place the file into the Emacs load-path and add (require 'linum-off) to ~/.emacs. This script turns off line numbering for the modes specified only. I've tested it and it works fine.

Use nlinum, a much faster alternative.

You only need to add (add-hook 'org-mode-hook (lambda () (linum-mode 0))).

I tried the following which worked out pretty well:

(defun nolinum ()
  (interactive)
  (message "Deactivated linum mode")
  (global-linum-mode 0)
  (linum-mode 0)
)

(global-set-key (kbd "<f6>") 'nolinum)

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

Of course, you do not need the keybinding. I suggest you leave it in for testing purposes and disable it if everything works fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!