Soy nuevo en Org API y me alegraría que pudieras echar un vistazo al código y compartir algunos comentarios.
En cuanto a la solución propuesta, considere la siguiente tabla:
|---+--------------------------------+---|
| 1 | one | a |
| 2 | two | b |
| 3 | This is a long chunk of text | c |
| 4 | four | d |
| 5 | Yet another long chunk of text | e |
|---+--------------------------------+---|
Coloque el cursor en cualquier lugar de la segunda columna y escriba:
M-x org-table-wrap-to-width
Ingrese un ancho de columna según lo solicitado. Por ejemplo, entrando 15
, obtienes:
|---+----------------+---|
| 1 | one | a |
| 2 | two | b |
| 3 | This is a long | c |
| | chunk of text | |
| 4 | four | d |
| 5 | Yet another | e |
| | long chunk of | |
| | text | |
|---+----------------+---|
Si no está satisfecho con este ancho y desea probar un valor diferente, use el deshacer estándar de Emacs, que restaurará el diseño anterior, para que pueda volver a ejecutar la función de ajuste.
Aquí está el código. Si conoce Org, por favor, envíe sus comentarios.
(defun org-table-wrap-to-width (width)
"Wrap current column to WIDTH."
(interactive (list (read-number "Enter column width: ")))
(org-table-check-inside-data-field)
(org-table-align)
(let (cline (ccol (org-table-current-column)) new-row-count (more t))
(org-table-goto-line 1)
(org-table-goto-column ccol)
(while more
(setq cline (org-table-current-line))
;; Cut current field
(org-table-copy-region (point) (point) 'cut)
;; Justify for width
(setq org-table-clip
(mapcar 'list (org-wrap (caar org-table-clip) width nil)))
;; Add new lines and fill
(setq new-row-count (1- (length org-table-clip)))
(if (> new-row-count 0)
(org-table-insert-n-row-below new-row-count))
(org-table-goto-line cline)
(org-table-goto-column ccol)
(org-table-paste-rectangle)
(org-table-goto-line (+ cline new-row-count))
;; Move to next line
(setq more (org-table-goto-line (+ cline new-row-count 1)))
(org-table-goto-column ccol))
(org-table-goto-line 1)
(org-table-goto-column ccol)))
(defun org-table-insert-n-row-below (n)
"Insert N new lines below the current."
(let* ((line (buffer-substring (point-at-bol) (point-at-eol)))
(new (org-table-clean-line line)))
;; Fix the first field if necessary
(if (string-match "^[ \t]*| *[#$] *|" line)
(setq new (replace-match (match-string 0 line) t t new)))
(beginning-of-line 2)
(setq new
(apply 'concat (make-list n (concat new "\n"))))
(let (org-table-may-need-update) (insert-before-markers new)) ;;; remove?
(beginning-of-line 0)
(re-search-forward "| ?" (point-at-eol) t)
(and (or org-table-may-need-update org-table-overlay-coordinates) ;;; remove?
(org-table-align))
(org-table-fix-formulas "@" nil (1- (org-table-current-dline)) n)))
org-table
Sin embargo, no estoy seguro de que sea enmendado fácilmente.