请问emacs显示变量函数的是用imenulist吗?怎么加上icon呢?

现在treeamcslsp-treemacs都支持imenu icon 了

喊你去看源码

对齐的方法是啥?求分享

简单说就是用TAB,并设置width为1

有啥代码可以抄的吗?最近比较流行抄作业。 :slight_smile:

比如

谢谢,我自己在 snails 代码里面按照你的方法试验,感觉没有对齐啊,只是增加了 tab 字符

(defun snails-wrap-buffer-icon (buf)
  "Wrap display name with buffer icon, use for buffer search backend."
  (if (featurep 'all-the-icons)
      (progn
        (setq-local tab-width 1)
        (format "%s\t '%s'"
                (with-current-buffer buf
                  (all-the-icons-icon-for-buffer))
                (string-trim-left (buffer-name buf))))
    (buffer-name buf)))

(defun snails-wrap-file-icon (file)
  "Wrap display name with file icon, use for file search backend."
  (if (featurep 'all-the-icons)
      (progn
        (setq-local tab-width 1)
        (format "%s\t %s"
                (all-the-icons-icon-for-file file :height 1)
                (string-trim-left file)))
    file))

(defun snails-wrap-file-icon-with-candidate (file candidate &optional no-trim)
  "Wrap display name with file icon, use for file search backend."
  (if (featurep 'all-the-icons)
      (progn
        (setq-local tab-width 1)
        (format "%s\t %s"
                (all-the-icons-icon-for-file (format "hello.%s" (file-name-extension file)) :height 1)
                (if no-trim
                    candidate
                  (string-trim-left candidate)
                  )))
    candidate))

我没有使用snails,如果还不行用overlay肯定可以解决