Org mode 表格像素对齐

这个确实是个问题,我目前还没有找到什么好办法。算是个长期目标。

有人告诉了我解决办法,传到jit分支了。

1 个赞

valign

jit 分支最新版 el 文件在我这里是有问题的, 打开 .org 文件默认情况下是不对齐的. 我随意缩放一下或在表格上 TAB 键它才自动对齐

把文件发我看看?我用vanilla Emacs没有问题的。你的视频里对齐地也有点奇怪,左边那一列空了好大一部分。

现在应该没问题了。

我修复了一个卡死的bug,大概就是你遇到的这个。

a.org文件内容只有下面这个列表,

| Variable                                   | Default | Description                                                       |
|--------------------------------------------+---------+-------------------------------------------------------------------|
| evil-collection-company-use-tng            | t       | Set up autocompletion to be similar to Vim's YouCompleteMe.       |
| evil-collection-outline-bind-tab-p         | nil     | Enable <tab>-based bindings in Outline mode.                      |
| evil-collection-term-sync-state-and-mode-p | t       | Synchronize insert/normal state with char/line-mode in term-mode. |
| evil-collection-setup-minibuffer           | nil     | Set up Vim style bindings in the minibuffer.                      |
| evil-collection-setup-debugger-keys        | t       | Set up debugger keys for certain modes.                           |

在 c4ddfb3 这个 commit 上,直接打开上面这个a.org文件直接卡死了。

不过,如果有一级 headline 的情况下,倒是不会挂

改了,这回绝对没问题了!

2 个赞

:rofl: 可以了!

问题解决了, 赞!

重启 emacs 后,第一次运行打开任意一个 org文件时会报以下错误:

Debugger entered--Lisp error: (valign-not-on-table)
  signal(valign-not-on-table nil)
  valign-table()
  valign-table-quite()
  valign-initial-alignment(1 501)
  #f(compiled-function (fun) #<bytecode 0x460b7f45>)(valign-initial-alignment)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode 0x460b7f45>) valign-initial-alignment)
  jit-lock--run-functions(1 501)
  jit-lock-fontify-now(1 501)
  jit-lock-function(1)
  vertical-motion(0)
  beginning-of-visual-line()
  nav-flash-show()
  (if (minibufferp) nil (nav-flash-show) (overlay-put compilation-highlight-overlay (quote window) (selected-window)))
  +nav-flash-blink-cursor()
  (if (or (memq this-command +nav-flash-exclude-commands) (and (boundp (quote so-long-minor-mode)) so-long-minor-mode) (derived-mode-p (quote so-long-mode) (quote special-mode) (quote term-mode)) (and (equal (point-marker) (car +nav-flash--last-point)) (equal (selected-window) (cdr +nav-flash--last-point)))) nil (+nav-flash-blink-cursor) (setq +nav-flash--last-point (cons (point-marker) (selected-window))))
  +nav-flash-blink-cursor-a()
  apply(+nav-flash-blink-cursor-a nil)
  #f(advice-wrapper :after #f(compiled-function () #<bytecode 0x44736781>) +nav-flash-blink-cursor-a)()
  ad-Advice-save-place-find-file-hook(#f(advice-wrapper :after #f(compiled-function () #<bytecode 0x44736781>) +nav-flash-blink-cursor-a))
  apply(ad-Advice-save-place-find-file-hook #f(advice-wrapper :after #f(compiled-function () #<bytecode 0x44736781>) +nav-flash-blink-cursor-a) nil)
  #f(advice-wrapper :around #f(advice-wrapper :after #f(compiled-function () #<bytecode 0x44736781>) +nav-flash-blink-cursor-a) ad-Advice-save-place-find-file-hook)()
  apply(#f(advice-wrapper :around #f(advice-wrapper :after #f(compiled-function () #<bytecode 0x44736781>) +nav-flash-blink-cursor-a) ad-Advice-save-place-find-file-hook) nil)
  save-place-find-file-hook()
  run-hooks(find-file-hook)
  #f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>)(nil t)
  apply(#f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) (nil t))
  (if (setq doom-large-file-p (and buffer-file-name (not doom-large-file-p) (file-exists-p buffer-file-name) (condition-case nil (progn (> (nth 7 (file-attributes buffer-file-name)) (* 1024 1024 (assoc-default buffer-file-name doom-large-file-size-alist ...)))) (error nil)))) (prog1 (apply orig-fn args) (if (memq major-mode doom-large-file-excluded-modes) (setq doom-large-file-p nil) (if (fboundp (quote so-long-minor-mode)) (progn (so-long-minor-mode 1))) (message "Large file detected! Cutting a few corners to improve performance..."))) (apply orig-fn args))
  doom--optimize-for-large-files-a(#f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) nil t)
  apply(doom--optimize-for-large-files-a #f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) (nil t))
  #f(advice-wrapper :around #f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) doom--optimize-for-large-files-a)(nil t)
  apply(#f(advice-wrapper :around #f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) doom--optimize-for-large-files-a) (nil t))
  #f(advice-wrapper :before #f(advice-wrapper :around #f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) doom--optimize-for-large-files-a) doom-first-file-hook-h)(nil t)
  apply(#f(advice-wrapper :before #f(advice-wrapper :around #f(compiled-function (&optional error warn noauto after-find-file-from-revert-buffer nomodes) "Called after finding a file and by the default revert function.\nSets buffer mode, parses file-local and directory-local variables.\nOptional args ERROR, WARN, and NOAUTO: ERROR non-nil means there was an\nerror in reading the file.  WARN non-nil means warn if there\nexists an auto-save file more recent than the visited file.\nNOAUTO means don't mess with auto-save mode.\nFourth arg AFTER-FIND-FILE-FROM-REVERT-BUFFER is ignored\n(see `revert-buffer-in-progress-p' for similar functionality).\nFifth arg NOMODES non-nil means don't alter the file's modes.\nFinishes by calling the functions in `find-file-hook'\nunless NOMODES is non-nil." #<bytecode 0x400935d7>) doom--optimize-for-large-files-a) doom-first-file-hook-h) (nil t))
  after-find-file(nil t)
  find-file-noselect-1(#<buffer elfeed.org> "~/org/elfeed.org" nil nil "~/Library/Mobile Documents/iCloud~com~appsonthemove~beorg/Documents/org/elfeed.org" (9873416 16777224))
  find-file-noselect("/Users/mls/org/elfeed.org")
  #f(compiled-function (file) #<bytecode 0x45245ca1>)("/Users/mls/org/elfeed.org")
  #f(compiled-function (it) #<bytecode 0x42951415>)("/Users/mls/org/elfeed.org")
  mapcar(#f(compiled-function (it) #<bytecode 0x42951415>) ("/Users/mls/org/elfeed.org"))
  -mapcat(#f(compiled-function (file) #<bytecode 0x45245ca1>) ("/Users/mls/org/elfeed.org"))
  rmh-elfeed-org-import-headlines-from-files(("/Users/mls/org/elfeed.org") "elfeed")
  rmh-elfeed-org-process(("/Users/mls/org/elfeed.org") "elfeed")
  ad-Advice-elfeed(#f(compiled-function () (interactive nil) #<bytecode 0x460ee75d>))
  apply(ad-Advice-elfeed #f(compiled-function () (interactive nil) #<bytecode 0x460ee75d>) nil)
  elfeed()
  funcall-interactively(elfeed)
  call-interactively(elfeed nil nil)
  command-execute(elfeed)

之后再开任何 org文件都不再报错。

楼主,用ditaa 画图也没问题了吗?楼主真强大!

麻烦你试试github上的jit分支,这个问题可能已经修复了。

jit 直接合到 master 上去吧

确实不报错了,但是,表格列宽被拉的太大。如图:

麻烦把问题表格贴上来,我在本地试试看是什么问题。

release难产,Emacs特色了

#+TITLE:

* test
| a          | b           | c        |
|------------+-------------+----------|
| ab 明……    | 精神        | 仲 test  |
| Ωω         | $\beta$     | $\alpha$ |
| aoej       | ……^         | #@       |
| あいうえお | 므재ㅓ 쟈호 |          |
| sdsd       |             |          |

* test2
| JournalHeader 4K with padding | abc |
|-------------------------------+-----|
|                               |     |
| JournalRecordMeta zone        |     |
|                               |     |
| 测试一下                      |     |
|                               |     |
|                               |     |
|-------------------------------+-----|
| Data Zone                     |     |
|                               |     |
|                               |     |
|                               |     |
|                               |     |
|                               |     |
|-------------------------------+-----|
|                               |     |
* test3
| JournalHeader 4K with padding |
|-------------------------------|
|                               |
| JournalRecordMeta zone        |
|                               |
| 测试一下                      |
|                               |
|                               |
|-------------------------------|
| Data Zone                     |
|                               |
** 2017-11 十一月
      所有时间均为北京时间
|------------------+----------------------------+-----------+------+-------+----------|
| 此花亭奇谈       | 轻百合,兽耳萝莉           | 周四 0000 | B 站 | 10.05 | 追!     |
| Just Because     | 鸭志田一,校园,恋爱       | 周五 0000 | B 站 | 10.06 | 追!     |
| 少女终末旅行     | 废土,公路,百合           | 周五 2200 | B 站 | 10.06 | 追!     |
| 新 奇诺之旅      | 有生之年,公路,旅行       | 周六 0100 | 下载 | 10.07 | 追!     |
| 结成友奈是勇者   | 战斗,致郁,残疾部         | 周六 0325 | B 站 | 10.07 | 等新剧情 |
| 调教咖啡厅       | 日常,喜剧,咖啡厅,芳文社 | 周日 0100 | B 站 | 10.08 | 追!     |
| 舞动青春         | 青春,运动,社交舞         | 周日 0208 | B 站 |  在播 | 追!     |
| 3 月的狮子第二季 | 将棋,励志,治愈,感情     | 周日 0300 | B 站 | 10.15 | 追!     |
| 幻界战线第二季   | 热血,奇幻,异能           | 周日 0308 | B 站 | 10.08 | 追!     |
| 如果有妹妹就好了 | 恋爱,喜剧,丧病妹控       | 周日 2300 | B 站 | 10.08 | 追!     |
|                  |                            |           |      |       |          |
|------------------+----------------------------+-----------+------+-------+----------|

好用! 不过发现了一个问题,如果表格内容中有 + 的话会被当成边框来对齐

a

测试:

| a    | b        |
| 你好 | +我不好+ |

修复了。

顺便,最新版合并到master分支了。

1 个赞

我本地没有问题,麻烦你下载最新版然后重启Emacs重新加载valign再试一试。