Org mode 表格像素对齐

org-agenda 有相关 hook, 可以更改 buffer 内容 org-agenda-finalize-hook

我记得是不支持的,你手写一个 org 表格,能在一个 cell 里支持换行吗?

我加了个hook到org-agenda-finalize-hook,试试?我本地的agenda没有表格,没办法测试。

1 个赞

同一张图在两个表里显示的效果还不一样,一个对齐一个不齐。 :frowning:

3

似乎同列文字宽度小于图片宽度则表格不齐。

4

我吐了,能不能在两张图上C-u C-x =然后把结果给我看看?

1 个赞

开启valign-setup后,org文件打开就卡死了,先打开org文件,再执行valign-table也会导致卡死。

环境参考: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.17.3) of 2020-05-22

奇怪……我用的也是master,没法复现,会不会是Org文件有什么不一样的地方?能发给我一个样本Org文件吗?我在我电脑上试试。

             position: 250 of 2145 (12%), column: 15
            character: [ (displayed as  ) (codepoint 91, #o133, #x5b)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x5B
               script: latin
               syntax: (]	which means: open, matches ]
             category: .:Base, <:Not at eol, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 5b" or "C-x 8 RET LEFT SQUARE BRACKET"
          buffer code: #x5B
            file code: #x5B (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-APPL-Monaco-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x3E)

Character code properties: customize what to show
  name: LEFT SQUARE BRACKET
  old-name: OPENING SQUARE BRACKET
  general-category: Ps (Punctuation, Open)
  decomposition: (91) ('[')

There are 2 overlays here:
 From 235 to 279
  face                 hl-line
  priority             -50
  window               #<window 3 on org_align.org>
 From 250 to 261
  display              (image :type png :file "/home/mls/1.png" :scale 1 :width nil)
  face                 default
  keymap               [Show]
  modification-hooks   (org-display-inline-remove-overlay)
  org-image-overlay    t


There are text properties here:
  face                 org-link
  font-lock-multiline  t
  fontified            t
  help-echo            "LINK: ~/1.png"
  htmlize-link         (:uri "~/1.png")
  invisible            org-link
  keymap               [Show]
  line-prefix          [Show]
  mouse-face           highlight
  org-category         "org_align"
  valign-init          t
  wrap-prefix          [Show]
             position: 638 of 2145 (30%), column: 2
            character: [ (displayed as [) (codepoint 91, #o133, #x5b)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x5B
               script: latin
               syntax: (]	which means: open, matches ]
             category: .:Base, <:Not at eol, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 5b" or "C-x 8 RET LEFT SQUARE BRACKET"
          buffer code: #x5B
            file code: #x5B (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-APPL-Monaco-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x3E)

Character code properties: customize what to show
  name: LEFT SQUARE BRACKET
  old-name: OPENING SQUARE BRACKET
  general-category: Ps (Punctuation, Open)
  decomposition: (91) ('[')

There are 2 overlays here:
 From 636 to 688
  face                 hl-line
  priority             -50
  window               #<window 3 on org_align.org>
 From 638 to 649
  display              (image :type png :file "/home/mls/1.png" :scale 1 :width nil)
  face                 default
  keymap               [Show]
  modification-hooks   (org-display-inline-remove-overlay)
  org-image-overlay    t


There are text properties here:
  face                 org-link
  font-lock-multiline  t
  fontified            t
  help-echo            "LINK: ~/1.png"
  htmlize-link         (:uri "~/1.png")
  invisible            org-link
  keymap               [Show]
  line-prefix          [Show]
  mouse-face           highlight
  valign-init          t
  wrap-prefix          [Show]

还有,若 emacs 中设置了 org-image-actual-width 为非 nil ,表格中有图片也不能对齐。

合并了tumashu的分支,现在可以用valign-mode了,我把valign-setup删了。

可以了,赞赞赞!

合并分支后,首次打开 org 文件不会自动对齐了,要手动运行 valign-table一次。

wsl2 ubuntu 下面通过xserver试用似乎没有效果,doom-emacs

test_valign

你说的这几个我都没法复现。保险起见能不能pull最新的commit,重启emacs再试一试?

这个我实在不了解…按理说只要是GuiEmacs就应该可以的,不应该依赖具体GUI kit

打开 org 文件报错:

File mode specification error: (error Specified window is not displaying the current buffer)

doom config.el 设置:

(use-package! valign
  :init
  (require 'valign)
  :hook
  ('org-mode . #'valign-mode))

现在好了,尴尬。

:sweat_smile: :sweat_smile: 同样错误,操作反过来了:首次打开 org 文件没报错,但是表格没对齐,关掉 org (不退出 emacs)文件再次打开,就一直报这个错。

这会应该好了😅我为了能让开关valign-mode的时候所有buffer同步状态,费了老鼻子劲,太麻烦了。

:sweat: :sweat: 好尷尬,似乎没有好欸。瑟瑟~~