Org mode 表格像素对齐

我猜你是用空格缩进的?空格我这里没有问题呀,你遇到具体的情况是什么?对不齐?还是根本就没启动对齐?

我试了一下,在Emacs 26.2、27、28中如果emacs -q的话,都能通过valign-table正确对齐。所以应该是跟什么冲突了。我研究一下是哪里出的问题

按tab后好像可以对齐,但输入空格然后 C-cC-c 之后,感觉直接退出了 valign-mode

弄清楚了:跟org-indent-mode冲突了,关掉就好了。org-indent-mode会根据你org文件的结构,在左边加上line-prefixwrap-prefix来增加缩进。就像我上面的截图里,虽然|左侧没有whitespace,但它仍然是缩进了的。另:就我个人来说,可以接受关掉org-indent-mode的解决方案:想关掉它不是第一次了,有不少难受的问题。

原来是这样,我看看能不能支持line-prefix。

最新版应该可以了。

实现了,现在在markdown分支下。markdown有个莫名的问题,如果表格里有链接,对齐好的表格有的时候会被神秘力量搞乱,你看看你有没有这个问题?

对齐可以了,不过我发现一个小问题,当我按 tab 跳到下一个 cell,然后输一任意一个字符,会把 cell 原来的内容删除

Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 3)
  advice-remove(org-table-align :after valign-table)
  (if (and valign-mode window-system) (progn (add-hook 'org-mode-hook #'valign--org-mode-hook 90) (add-hook 'org-agenda-finalize-hook #'valign--force-align-buffer) (advice-add 'org-table-align :after #'valign-table) (advice-add 'org-toggle-inline-images :after #'valign--force-align-buffer) (advice-add 'org-restart-font-lock :before #'valign--realign-on-refontification) (advice-add 'visible-mode :before #'valign--realign-on-refontification) (advice-add 'org-flag-region :before #'valign--org-flag-region-advice) (let ((--dolist-tail-- (buffer-list))) (while --dolist-tail-- (let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (if (derived-mode-p ...) (progn ...))) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (remove-hook 'org-mode-hook #'valign--org-mode-hook) (remove-hook 'org-agenda-finalize-hook #'valign--force-align-buffer) (advice-remove 'org-toggle-inline-images #'valign--force-align-buffer) (advice-remove 'org-restart-font-lock #'valign--realign-on-refontification) (advice-remove 'visible-mode #'valign--realign-on-refontification) (advice-remove 'org-table-align :after #'valign-table) (advice-remove 'org-flag-region #'valign--org-flag-region-advice) (let ((--dolist-tail-- (buffer-list))) (while --dolist-tail-- (let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (if (derived-mode-p 'org-mode) (progn (valign-reset-buffer)))) (setq --dolist-tail-- (cdr --dolist-tail--))))))
  (let ((last-message (current-message))) (progn (set-default 'valign-mode (if (eq arg 'toggle) (not (default-value 'valign-mode)) (> (prefix-numeric-value arg) 0)))) (if (and valign-mode window-system) (progn (add-hook 'org-mode-hook #'valign--org-mode-hook 90) (add-hook 'org-agenda-finalize-hook #'valign--force-align-buffer) (advice-add 'org-table-align :after #'valign-table) (advice-add 'org-toggle-inline-images :after #'valign--force-align-buffer) (advice-add 'org-restart-font-lock :before #'valign--realign-on-refontification) (advice-add 'visible-mode :before #'valign--realign-on-refontification) (advice-add 'org-flag-region :before #'valign--org-flag-region-advice) (let ((--dolist-tail-- (buffer-list))) (while --dolist-tail-- (let ((buf ...)) (save-current-buffer (set-buffer buf) (if ... ...)) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (remove-hook 'org-mode-hook #'valign--org-mode-hook) (remove-hook 'org-agenda-finalize-hook #'valign--force-align-buffer) (advice-remove 'org-toggle-inline-images #'valign--force-align-buffer) (advice-remove 'org-restart-font-lock #'valign--realign-on-refontification) (advice-remove 'visible-mode #'valign--realign-on-refontification) (advice-remove 'org-table-align :after #'valign-table) (advice-remove 'org-flag-region #'valign--org-flag-region-advice) (let ((--dolist-tail-- (buffer-list))) (while --dolist-tail-- (let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (if (derived-mode-p ...) (progn ...))) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (run-hooks 'valign-mode-hook (if (default-value 'valign-mode) 'valign-mode-on-hook 'valign-mode-off-hook)) (if (called-interactively-p 'any) (progn (customize-mark-as-set 'valign-mode) (if (and (current-message) (not (equal last-message (current-message)))) nil (let ((local "")) (message "Valign mode %sabled%s" (if (default-value ...) "en" "dis") local))))))
  valign-mode(toggle)
  funcall-interactively(valign-mode toggle)
  call-interactively(valign-mode record nil)
  command-execute(valign-mode record)
  counsel-M-x-action("valign-mode")
  ivy-call()
  ivy-read("M-x " ("valign-mode" "toggle-debug-on-error" "byte-compile-file" "eval-buffer" "magit-remote-add" "checkdoc" "magit-rebase-interactive" "replace-string" "org-brain-visualize" "wjw-gongwen-update-headline" "package-list-packages" "posframe-delete-all" "org-fill-paragraph" "eaf-open-browser-with-history" "comment-region" "ivy-posframe-mode" "swiper" "replace-regexp" "org-babel-execute-buffer" "liberime-select-schema-interactive" "company-posframe-mode" "eh-org-attach-subtree" "run-python" "eh-save-buffer-with-utf8" "projectile-grep" "pyim-delete-last-word" "pyim-restart" "org-download-delete" "counsel-org-tag" "uncomment-region" "el2org-generate-readme" "po-mode" "helm-M-x" "grep-find" "package-install" "R" "tongbu" "wjw-gongwen-wash" "customize-face" "eh-org-query" "org-babel-execute-subtree" "eaf-open" "org-sort" "org-ql-search" "package-lint-current-buffer" "liberime-build" "org-download-screenshot" "org-lint" "yas-reload-all" "org-board-archive" ...) :predicate #f(compiled-function (x) #<bytecode 0x1589946f63c9>) :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)

我的锅…advice写错了。明天起来改。自动删除那个是org的功能。

还真是。。。。 :rofl:

爬起来改了,force push上去了。

:rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl:

不应该 Force push 吧?

没有别人写PR的话就没事……我觉得应该没有

我这边也是doom emacs,看下来也会org-indent-mode的问题,disable了之后可以align了

spacemacs中如何安装? 是否支持变宽字体?

  1. spacemacs 支持从 Github 装 packages link
  2. 支持

macOS mojave & emacs-mac 26.3

*Agenda*t d 调用 org-agenda-todo时,会跳出 *Agenda*, 并进入对应的 org 文件,同时报出这个错误信息:

...
Error during redisplay: (jit-lock-function 1) signaled (user-error "Not on a table") [2 times]
Preparing diary...done
TODO state changed to DONE
TODO state changed to 
Entry repeats: SCHEDULED: <2020-06-02 Tue ++1d> 
Error in post-command-hook (org-add-log-note): (user-error "Not on a table")
...

markdown-mode下显示得有点问题

对应的表格是这样的

| key           | function                                             |
|---------------|------------------------------------------------------|
| <kbd>zm</kbd> | `evil-close-folds`隐藏所有代码块                     |
| <kbd>zr</kbd> | `evil-open-folds`显示所有被隐藏的代码块              |
| <kbd>zo</kbd> | `evil-open-fold`隐藏当前代码块                       |
| <kbd>zO</kbd> | `evil-open-fold-rec`递归地隐藏当前以及之内的代码块   |
| <kbd>zc</kbd> | `evil-close-fold`显示当前被隐藏的代码块              |
| <kbd>zC</kbd> | `evil-close-fold-rec`递归地显示当前以及之内的代码块  |

分隔行看起来没加上text property,能在vanilla下试试吗?我这里可以对齐,只不过有之前说的神秘力量在对齐以后搞乱,tab一下就又对齐了。