王依依

王依依的博客

她的个人主页  她的博客

emacs linum-mode 处理

王依依  2010年05月08日 星期六 00:31 | 3682次浏览 | 2条评论

一般来说为了方便是要开 global-linum-mode 的

但是这么一来,所有的临时 buffer 都会有行号,而且部分buffer 的行号会跳一下才显示。

想了个简单的解决方法:

;;; linum-mode
(setq linum-format
   (lambda (line)
  (propertize
   (format (let ((w (length (number-to-string
        (count-lines (point-min) (point-max))))))
      (concat "%" (number-to-string w) "d ")) line) 'face 'linum)))
(defun my-linum-on ()   ; linum should turn off in non-editor buffer
  (unless (or (minibufferp)
     (equal (string-match "
\\*.*\\ *" (buffer-name (current-buffer))) 0))
    (linum-mode 1)))
(define-globalized-minor-mode my-global-linum-mode linum-mode my-linum-on)
(my-global-linum-mode 1)

这样在 *xxxx* buffer 下不启用 linum-mode

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !
Will Song

回复 Will Song  2010年05月08日 星期六 16:43

学习下。。。

1条回复

暂时没有评论

Zeuux © 2024

京ICP备05028076号