Function: org-table-fedit-lisp-indent
org-table-fedit-lisp-indent is an interactive and byte-compiled
function defined in org-table.el.gz.
Signature
(org-table-fedit-lisp-indent)
Documentation
Pretty-print and re-indent Lisp expressions in the Formula Editor.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-fedit-lisp-indent ()
"Pretty-print and re-indent Lisp expressions in the Formula Editor."
(interactive)
(let ((pos (point)) beg end ind)
(forward-line 0)
(cond
((looking-at "[ \t]")
(goto-char pos)
(call-interactively 'lisp-indent-line))
((looking-at "[$&@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos))
((looking-at "[$&@0-9a-zA-Z]+ *= *'(")
(goto-char (- (match-end 0) 2))
(setq beg (point))
(setq ind (make-string (current-column) ?\ ))
(condition-case nil (forward-sexp 1)
(error
(user-error "Cannot pretty-print Lisp expression: Unbalanced parenthesis")))
(setq end (point))
(save-restriction
(narrow-to-region beg end)
(if (eq last-command this-command)
(progn
(goto-char (point-min))
(setq this-command nil)
(while (re-search-forward "[ \t]*\n[ \t]*" nil t)
(replace-match " ")))
(pp-buffer)
(untabify (point-min) (point-max))
(goto-char (1+ (point-min)))
(while (re-search-forward "^." nil t)
(forward-line 0)
(insert ind))
(goto-char (point-max))
(org-delete-backward-char 1)))
(goto-char beg))
(t nil))))