Emacs在win10上面表现差的问题

学习了。前段时间在Win下用的时候也遇到类似的问题,回头改下设置代码看有没有效果。

windows 10下如丝般顺滑吗?

是啊,配置好了就如丝。配置不好如屎。

安装esup 看看哪些包占用时间比较长。defer一下。

这样设置后软件启动只需一秒多点。

编辑中文卡顿,可以使用sarasa 等宽字体。

一直用 cygwin 下带的 emacs. 自己调整字体大小,竖线能对齐就行。 汉字太胖,没办法改。 ~/.emacs.d/init.el

(custom-set-faces 
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "Hack" :foundry "outline" :weight normal :height 110 :width normal)))))

;;;; for WINDOWS
;;; 中文等宽字体设置
;;|中文比例对比行|
;;|chinese scale.|
(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font (frame-parameter nil 'font)
		    charset
		    (font-spec :family "Microsoft Yahei" :size 18)))

尝试了这个你说的这个 gcmh 确实管用,不然在Windows 10 上设置 GC 为 20m 还是会很频繁的进行垃圾回收。开启垃圾回收消息可以看的清楚(setq garbage-collection-messages t),难怪用eglot的时候,经常会卡一下 :grin:
目前 Doom Emacs 也是使用的 gcmh 进行 gc 优化

好久没抄doom-emacs的作业了,以前抄的,不知道doom-emacs是不是有新的优化了。

early-init.el中关闭gc

;; Defer garbage collection further back in the startup process
(setq gc-cons-threshold most-positive-fixnum)

启动后,在配置文件中打开gc,如init-xxx.el里面

(defmacro add-transient-hook! (hook-or-function &rest forms)
  "Attaches a self-removing function to HOOK-OR-FUNCTION.

FORMS are evaluated once, when that function/hook is first invoked, then never
again.

HOOK-OR-FUNCTION can be a quoted hook or a sharp-quoted function (which will be
advised)."
  (declare (indent 1))
  (let ((append (if (eq (car forms) :after) (pop forms)))
        (fn (intern (format "doom--transient-%s-h" (sxhash hook-or-function)))))
    `(let ((sym ,hook-or-function))
       (defun ,fn (&rest _)
         ,@forms
         (let ((sym ,hook-or-function))
           (cond ((functionp sym) (advice-remove sym #',fn))
                 ((symbolp sym)   (remove-hook sym #',fn))))
         (unintern ',fn nil))
       (cond ((functionp sym)
              (advice-add ,hook-or-function ,(if append :after :before) #',fn))
             ((symbolp sym)
              (put ',fn 'permanent-local-hook t)
              (add-hook sym #',fn ,append))))))

(defvar doom-interactive-mode (not noninteractive)
  "If non-nil, Emacs is in interactive mode.")

;; Adopt a sneaky garbage collection strategy of waiting until idle time to
;; collect; staving off the collector while the user is working.
(when doom-interactive-mode
  (add-transient-hook! 'pre-command-hook (gcmh-mode +1))
  (with-eval-after-load 'gcmh
    (setq gcmh-idle-delay 10
          gcmh-verbose nil)
    (add-hook 'focus-out-hook #'gcmh-idle-garbage-collect)))

(use-package gcmh)

最近换工作,在公司局域网里速度有些慢。 将 system-name设置成 PC名.公司域名 访问文件速度就快了些。大概是读文件的时候要去解析一下域名