Org mode 表格像素对齐

vanilla下人工执行valign-table可以对齐。

不过在现在使用的配置时人工执行valign-table会出现这个错误:

Debugger entered--Lisp error: (cl-no-applicable-method valign--align-separator-row gfm-mode multi-column (181 891))
  signal(cl-no-applicable-method (valign--align-separator-row gfm-mode multi-column (181 891)))
  cl-no-applicable-method(#s(cl--generic :name valign--align-separator-row :dispatches ((2 #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12a5989a124586b3>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13d7fdcbedba6a4d>))) (1 #s(cl--generic-generalizer :name cl--generic-eql-generalizer :priority 100 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12039f2dac21e95b>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13dc62babc648d59>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12a5989a124586b3>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13d7fdcbedba6a4d>))) (0 #s(cl--generic-generalizer :name cl--generic-eql-generalizer :priority 100 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12039f2dac21e95b>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13dc62babc648d59>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12a5989a124586b3>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13d7fdcbedba6a4d>)))) :method-table (#s(cl--generic-method :specializers ((eql markdown-mode) (eql multi-column) t) :qualifiers nil :uses-cnm nil :function #f(compiled-function (type style pos-list) "Align the separator row in multi column style.\nTYPE must be 'markdown-mode, STYLE is 'multi-column.\nPOS-LIST is a list of positions for each column’s right bar. " #<bytecode 0x17c6ce31a1e6a254>)) #s(cl--generic-method :specializers ((eql org-mode) (eql multi-column) t) :qualifiers nil :uses-cnm nil :function #f(compiled-function (type style pos-list) "Align the separator row in multi column style.\nTYPE must be 'org-mode, STYLE is 'multi-column.\nPOS-LIST is a list of positions for each column’s right bar." #<bytecode 0x1d1d628f6f821ec>)) #s(cl--generic-method :specializers (t (eql single-column) t) :qualifiers nil :uses-cnm nil :function #f(compiled-function (type style pos-list) "Align the separator row (|---+---|) as “|---------|”.\nAssumes the point is after the left bar (“|”).  TYPE can be\neither 'org-mode or 'markdown, it doesn’t make any difference.\nSTYLE is 'single-column.  POS-LIST is a list of each column’s\nright bar’s position." #<bytecode 0x40d46c030241f03>))) :options nil) gfm-mode multi-column (181 891))
  apply(cl-no-applicable-method #s(cl--generic :name valign--align-separator-row :dispatches ((2 #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12a5989a124586b3>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13d7fdcbedba6a4d>))) (1 #s(cl--generic-generalizer :name cl--generic-eql-generalizer :priority 100 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12039f2dac21e95b>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13dc62babc648d59>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12a5989a124586b3>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13d7fdcbedba6a4d>))) (0 #s(cl--generic-generalizer :name cl--generic-eql-generalizer :priority 100 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12039f2dac21e95b>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13dc62babc648d59>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode -0x12a5989a124586b3>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x13d7fdcbedba6a4d>)))) :method-table (#s(cl--generic-method :specializers ((eql markdown-mode) (eql multi-column) t) :qualifiers nil :uses-cnm nil :function #f(compiled-function (type style pos-list) "Align the separator row in multi column style.\nTYPE must be 'markdown-mode, STYLE is 'multi-column.\nPOS-LIST is a list of positions for each column’s right bar. " #<bytecode 0x17c6ce31a1e6a254>)) #s(cl--generic-method :specializers ((eql org-mode) (eql multi-column) t) :qualifiers nil :uses-cnm nil :function #f(compiled-function (type style pos-list) "Align the separator row in multi column style.\nTYPE must be 'org-mode, STYLE is 'multi-column.\nPOS-LIST is a list of positions for each column’s right bar." #<bytecode 0x1d1d628f6f821ec>)) #s(cl--generic-method :specializers (t (eql single-column) t) :qualifiers nil :uses-cnm nil :function #f(compiled-function (type style pos-list) "Align the separator row (|---+---|) as “|---------|”.\nAssumes the point is after the left bar (“|”).  TYPE can be\neither 'org-mode or 'markdown, it doesn’t make any difference.\nSTYLE is 'single-column.  POS-LIST is a list of each column’s\nright bar’s position." #<bytecode 0x40d46c030241f03>))) :options nil) (gfm-mode multi-column (181 891)))
  #f(compiled-function (&rest args) #<bytecode -0x11d8a5583da6c2a8>)(gfm-mode multi-column (181 891))
  apply(#f(compiled-function (&rest args) #<bytecode -0x11d8a5583da6c2a8>) gfm-mode (multi-column (181 891)))
  #f(compiled-function (arg &rest args) #<bytecode 0x1492386c915e0907>)(gfm-mode multi-column (181 891))
  apply(#f(compiled-function (arg &rest args) #<bytecode 0x1492386c915e0907>) gfm-mode multi-column (181 891))
  valign--align-separator-row(gfm-mode multi-column (181 891))
  valign-table()
  funcall-interactively(valign-table)
  call-interactively(valign-table record nil)
  command-execute(valign-table record)
  counsel-M-x-action("valign-table")
  ivy-call()
  ivy-read("M-x " [0 c-clear-char-property-fun ansi-color-apply-overlay-face epg-context-signers locals 0 -is-infix\? message-all-epg-keys-available-p so-long-override-variables avy-words epg--status-VALIDSIG org-publish--store-crossrefs markdown-xhtml-body-preamble duplicate magit-wip-buffer-backed-up mml-secure-smime-sign-with-sender rmsbolt--handle-finish-compile desktop-lazy-create-buffer template ido-choice-list flycheck-error-list-mode-line-map resourceOperations lsp-solargraph-references local-only cl-print--preprocess Find\ file\ in\ directory lsp-pyls-plugins-flake8-max-line-length mu4e~compose-complete-contact org-agenda-regexp-filter-preset mu4e-context-vars--cmacro 0 post-deadline cl--struct-epg-signature-p evil-visual-exchange-corners c-mode-var f-directory\? message-kill-actions time-format eshell-output-filter \' counsel-projectile-switch-to-buffer-transformer osx-org-clock-menubar mu4e-hide-other-mu4e-buffers org-babel-results-keyword evil-echo-area-message magit-diff-wash-hunk not-at-beginning-of-line log-edit-set-header expired doc-view-pdf/ps->png ...] :predicate #f(compiled-function (sym) #<bytecode 0xcfa0837e3e7010c>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)

这样,我以为只有markdown-mode,除了gfm-mode还有别的吗

没了,字数补丁

推上去了。神秘力量我暂时还没搞明白

赞!显示效果很棒!

我基本上修复了神秘力量,一般不会出现了,再不行手动tab重新对齐一下吧。

果然是人多力量大啊,一堆隐藏问题都试出来了w

期待中…

代码量翻了一倍orz

1 个赞

在打开空的a.md之后,插入表格直接CPU利用率100%了。。

然后发现如果a.md文件里只有这个表格的话,打开这个文件就直接会卡死

| 这是一列 | 这是另一列 |
|----------|------------|
| Apple    | 苹果       |
| Peach    | 桃子??? |

修复了,另外我合并markdown分支了,现在拉master就可以。

打开空文件,然后再输入表格的 | 时仍然会导致Emacs的CPU利用率100%

确定是master吗(markdown分支不行)

确定的, HEAD 为这个 dc72743

我发现是在插入一个|之后紧跟1个空格会出现这个问题

啊,是空文件下第一行插入一个|就会出问题

终于找到问题了,我太菜了…… 现在应该没有问题了,能不能再帮测试下?

这下连最基础的功能都出问题了…

image

这是测试表格

| 这是一行       | 这是另一行 |
|----------------|------------|
| 我来看看这里   | 啊         |
| 好像对齐失败了 | 怎么回事   |

cc3e068 下测试成功

valign

最新的commit应该解决了,再有问题…………我再改。

赞!字数补丁

估计还会增长。。。。

看到有人回复还以为又发现bug了,还好还好😄

1 个赞

Agenda 里 这个错误还在的嘛,是设置的问题?

Error in post-command-hook (org-add-log-note): (user-error "Not on a table")

简单注释掉 (use-package! valign)语句,Agenda 是正常无错的。